Skip to content

Commit 1091493

Browse files
authored
Merge branch 'master' into master
2 parents 64e86dd + 9c02f21 commit 1091493

File tree

82 files changed

+9226
-1870
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+9226
-1870
lines changed

CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
/PWGEM @alibuild @feisenhu @dsekihat @ivorobye
3737
/PWGEM/Dilepton @alibuild @mikesas @rbailhac @dsekihat @ivorobye @feisenhu
3838
/PWGEM/PhotonMeson @alibuild @mikesas @rbailhac @m-c-danisch @novitzky @mhemmer-cern @dsekihat
39-
/PWGHF @alibuild @vkucera @fcolamar @fgrosa @fcatalan92 @mfaggin @mmazzilli @deepathoms @NicoleBastid @hahassan7 @jpxrk @apalasciano
39+
/PWGHF @alibuild @vkucera @fcolamar @fgrosa @fcatalan92 @mfaggin @mmazzilli @deepathoms @NicoleBastid @hahassan7 @jpxrk @apalasciano @zhangbiao-phy
4040
# PWG-LF
4141
/PWGLF @alibuild @njacazio @skundu692
4242
/PWGLF/Tasks/GlobalEventProperties @alibuild @njacazio @skundu692 @gbencedi @omvazque

Common/Core/RecoDecay.h

Lines changed: 43 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -668,9 +668,11 @@ struct RecoDecay {
668668
}
669669

670670
/// Checks whether the reconstructed decay candidate is the expected decay.
671-
/// \param checkProcess switch to accept only decay daughters by checking the production process of MC particles
672-
/// \param acceptIncompleteReco switch to accept candidates with only part of the daughters reconstructed
671+
/// \tparam acceptFlavourOscillation switch to accept flavour oscillastion (i.e. B0 -> B0bar -> D+pi-)
672+
/// \tparam checkProcess switch to accept only decay daughters by checking the production process of MC particles
673+
/// \tparam acceptIncompleteReco switch to accept candidates with only part of the daughters reconstructed
673674
/// \tparam acceptTrackDecay switch to accept candidates with daughter tracks of pions and kaons which decayed
675+
/// \tparam acceptTrackIntWithMaterial switch to accept candidates with final (i.e. p, K, pi) daughter tracks interacting with material
674676
/// \param particlesMC table with MC particles
675677
/// \param arrDaughters array of candidate daughters
676678
/// \param PDGMother expected mother PDG code
@@ -680,8 +682,9 @@ struct RecoDecay {
680682
/// \param depthMax maximum decay tree level to check; Daughters up to this level will be considered. If -1, all levels are considered.
681683
/// \param nPiToMu number of pion prongs decayed to a muon
682684
/// \param nKaToPi number of kaon prongs decayed to a pion
685+
/// \param nInteractionsWithMaterial number of daughter particles that interacted with material
683686
/// \return index of the mother particle if the mother and daughters are correct, -1 otherwise
684-
template <bool acceptFlavourOscillation = false, bool checkProcess = false, bool acceptIncompleteReco = false, bool acceptTrackDecay = false, std::size_t N, typename T, typename U>
687+
template <bool acceptFlavourOscillation = false, bool checkProcess = false, bool acceptIncompleteReco = false, bool acceptTrackDecay = false, bool acceptTrackIntWithMaterial = false, std::size_t N, typename T, typename U>
685688
static int getMatchedMCRec(const T& particlesMC,
686689
const std::array<U, N>& arrDaughters,
687690
int PDGMother,
@@ -690,16 +693,18 @@ struct RecoDecay {
690693
int8_t* sign = nullptr,
691694
int depthMax = 1,
692695
int8_t* nPiToMu = nullptr,
693-
int8_t* nKaToPi = nullptr)
696+
int8_t* nKaToPi = nullptr,
697+
int8_t* nInteractionsWithMaterial = nullptr)
694698
{
695699
// Printf("MC Rec: Expected mother PDG: %d", PDGMother);
696-
int8_t coefFlavourOscillation = 1; // 1 if no B0(s) flavour oscillation occured, -1 else
697-
int8_t sgn = 0; // 1 if the expected mother is particle, -1 if antiparticle (w.r.t. PDGMother)
698-
int8_t nPiToMuLocal = 0; // number of pion prongs decayed to a muon
699-
int8_t nKaToPiLocal = 0; // number of kaon prongs decayed to a pion
700-
int indexMother = -1; // index of the mother particle
701-
std::vector<int> arrAllDaughtersIndex; // vector of indices of all daughters of the mother of the first provided daughter
702-
std::array<int, N> arrDaughtersIndex; // array of indices of provided daughters
700+
int8_t coefFlavourOscillation = 1; // 1 if no B0(s) flavour oscillation occured, -1 else
701+
int8_t sgn = 0; // 1 if the expected mother is particle, -1 if antiparticle (w.r.t. PDGMother)
702+
int8_t nPiToMuLocal = 0; // number of pion prongs decayed to a muon
703+
int8_t nKaToPiLocal = 0; // number of kaon prongs decayed to a pion
704+
int8_t nInteractionsWithMaterialLocal = 0; // number of interactions with material
705+
int indexMother = -1; // index of the mother particle
706+
std::vector<int> arrAllDaughtersIndex; // vector of indices of all daughters of the mother of the first provided daughter
707+
std::array<int, N> arrDaughtersIndex; // array of indices of provided daughters
703708
if (sign) {
704709
*sign = sgn;
705710
}
@@ -737,6 +742,28 @@ struct RecoDecay {
737742
particleI = motherI;
738743
}
739744
}
745+
if constexpr (acceptTrackIntWithMaterial) {
746+
// Replace the MC particle associated with the prong by its mother for part → part due to material interactions.
747+
// It keeps looking at the mother iteratively, until it finds a particle from decay or primary
748+
auto process = particleI.getProcess();
749+
auto pdgI = std::abs(particleI.pdgCode());
750+
auto pdgMotherI = std::abs(particleI.pdgCode());
751+
while (process != TMCProcess::kPDecay && process != TMCProcess::kPPrimary && pdgI == pdgMotherI) {
752+
if (!particleI.has_mothers()) {
753+
break;
754+
}
755+
auto motherI = particleI.template mothers_first_as<T>();
756+
pdgI = std::abs(particleI.pdgCode());
757+
pdgMotherI = std::abs(motherI.pdgCode());
758+
if (pdgI == pdgMotherI) {
759+
particleI = motherI;
760+
process = particleI.getProcess();
761+
if (process == TMCProcess::kPDecay || process == TMCProcess::kPPrimary) { // we found the original daughter that interacted with material
762+
nInteractionsWithMaterialLocal++;
763+
}
764+
}
765+
}
766+
}
740767
arrDaughtersIndex[iProng] = particleI.globalIndex();
741768
// Get the list of daughter indices from the mother of the first prong.
742769
if (iProng == 0) {
@@ -817,6 +844,11 @@ struct RecoDecay {
817844
*nKaToPi = nKaToPiLocal;
818845
}
819846
}
847+
if constexpr (acceptTrackIntWithMaterial) {
848+
if (nInteractionsWithMaterial) {
849+
*nInteractionsWithMaterial = nInteractionsWithMaterialLocal;
850+
}
851+
}
820852
return indexMother;
821853
}
822854

Common/DataModel/PIDResponseITS.h

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,24 @@ namespace o2::aod
3434
struct ITSResponse {
3535
static float averageClusterSize(uint32_t itsClusterSizes)
3636
{
37-
float average = 0;
37+
float sum = 0;
3838
int nclusters = 0;
39-
39+
int max = 0;
4040
for (int layer = 0; layer < 7; layer++) {
41-
if ((itsClusterSizes >> (layer * 4)) & 0xf) {
41+
int clsize = (itsClusterSizes >> (layer * 4)) & 0xf;
42+
if (clsize > 0) {
4243
nclusters++;
43-
average += (itsClusterSizes >> (layer * 4)) & 0xf;
44+
sum += clsize;
45+
if (clsize > max) {
46+
max = clsize;
47+
}
4448
}
4549
}
4650
if (nclusters == 0) {
4751
return 0;
4852
}
49-
return average / nclusters;
53+
// truncated mean
54+
return (sum - max) / (nclusters - 1);
5055
};
5156

5257
template <o2::track::PID::ID id>
@@ -67,8 +72,10 @@ struct ITSResponse {
6772
static constexpr float inverseMass = 1. / o2::track::pid_constants::sMasses[id];
6873
// static constexpr float charge = static_cast<float>(o2::track::pid_constants::sCharges[id]);
6974
const float bg = momentum * inverseMass;
70-
float relRes = mResolutionParams[0] * std::erf((bg - mResolutionParams[1]) / mResolutionParams[2]);
71-
return relRes;
75+
if (id == o2::track::PID::Helium3 || id == o2::track::PID::Alpha) {
76+
return mResolutionParamsZ2[0] * std::erf((bg - mResolutionParamsZ2[1]) / mResolutionParamsZ2[2]);
77+
}
78+
return mResolutionParams[0] * std::erf((bg - mResolutionParams[1]) / mResolutionParams[2]);
7279
}
7380

7481
template <o2::track::PID::ID id>
@@ -87,7 +94,10 @@ struct ITSResponse {
8794
return nSigmaITS<id>(track.itsClusterSizes(), track.p(), track.eta());
8895
}
8996

90-
static void setParameters(float p0, float p1, float p2, float p0_Z2, float p1_Z2, float p2_Z2, float p0_res, float p1_res, float p2_res)
97+
static void setParameters(float p0, float p1, float p2,
98+
float p0_Z2, float p1_Z2, float p2_Z2,
99+
float p0_res, float p1_res, float p2_res,
100+
float p0_res_Z2, float p1_res_Z2, float p2_res_Z2)
91101
{
92102
if (mIsInitialized) {
93103
LOG(fatal) << "ITSResponse parameters already initialized";
@@ -102,19 +112,24 @@ struct ITSResponse {
102112
mResolutionParams[0] = p0_res;
103113
mResolutionParams[1] = p1_res;
104114
mResolutionParams[2] = p2_res;
115+
mResolutionParamsZ2[0] = p0_res_Z2;
116+
mResolutionParamsZ2[1] = p1_res_Z2;
117+
mResolutionParamsZ2[2] = p2_res_Z2;
105118
}
106119

107120
private:
108121
static std::array<float, 3> mITSRespParams;
109122
static std::array<float, 3> mITSRespParamsZ2;
110123
static std::array<float, 3> mResolutionParams;
124+
static std::array<float, 3> mResolutionParamsZ2;
111125
static bool mIsInitialized;
112126
};
113127

114-
std::array<float, 3> ITSResponse::mITSRespParams = {1.1576, 1.684, 1.9453};
115-
std::array<float, 3> ITSResponse::mITSRespParamsZ2 = {2.8752, 1.1246, 5.0259};
128+
std::array<float, 3> ITSResponse::mITSRespParams = {1.18941, 1.53792, 1.69961};
129+
std::array<float, 3> ITSResponse::mITSRespParamsZ2 = {2.35117, 1.80347, 5.14355};
116130
// relative resolution is modelled with an erf function: [0]*TMath::Erf((x-[1])/[2])
117-
std::array<float, 3> ITSResponse::mResolutionParams = {0.2431, -0.3293, 1.533};
131+
std::array<float, 3> ITSResponse::mResolutionParams = {1.94669e-01, -2.08616e-01, 1.30753};
132+
std::array<float, 3> ITSResponse::mResolutionParamsZ2 = {8.74371e-02, -1.82804, 5.06449e-01};
118133
bool ITSResponse::mIsInitialized = false;
119134

120135
namespace pidits

Common/TableProducer/PID/pidITS.cxx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,16 @@ using namespace o2::track;
4343
MetadataHelper metadataInfo;
4444

4545
static constexpr int nCases = 2;
46-
static constexpr int nParameters = 9;
46+
static constexpr int nParameters = 12;
4747
static const std::vector<std::string> casesNames{"Data", "MC"};
4848
static const std::vector<std::string> parameterNames{"RespITSPar1", "RespITSPar2", "RespITSPar3",
4949
"RespITSPar1_Z2", "RespITSPar2_Z2", "RespITSPar3_Z2",
50-
"ResolutionPar1", "ResolutionPar2", "ResolutionPar3"};
51-
static constexpr float defaultParameters[nCases][nParameters]{{0.903, 2.014, 2.440,
52-
2.8752, 1.1246, 5.0259,
53-
0.2431, -0.3293, 1.533},
54-
{0.903, 2.014, 2.440,
55-
2.8752, 1.1246, 5.0259,
56-
0.2431, -0.3293, 1.533}};
50+
"ResolutionPar1", "ResolutionPar2", "ResolutionPar3",
51+
"ResolutionPar1_Z2", "ResolutionPar2_Z2", "ResolutionPar3_Z2"};
52+
53+
static constexpr float defaultParameters[nCases][nParameters] = {
54+
{1.18941, 1.53792, 1.69961, 2.35117, 1.80347, 5.14355, 1.94669e-01, -2.08616e-01, 1.30753, 8.74371e-02, -1.82804, 5.06449e-01},
55+
{1.18941, 1.53792, 1.69961, 2.35117, 1.80347, 5.14355, 1.94669e-01, -2.08616e-01, 1.30753, 8.74371e-02, -1.82804, 5.06449e-01}};
5756

5857
/// Task to produce the ITS PID information for each particle species
5958
/// The parametrization is: [p0/(bg)**p1 + p2] being bg = p/m. Different parametrizations are used for He3 and Alpha particles.
@@ -90,7 +89,10 @@ struct itsPid {
9089
itsParams->get(key, "RespITSPar3_Z2"),
9190
itsParams->get(key, "ResolutionPar1"),
9291
itsParams->get(key, "ResolutionPar2"),
93-
itsParams->get(key, "ResolutionPar3"));
92+
itsParams->get(key, "ResolutionPar3"),
93+
itsParams->get(key, "ResolutionPar1_Z2"),
94+
itsParams->get(key, "ResolutionPar2_Z2"),
95+
itsParams->get(key, "ResolutionPar3_Z2"));
9496
}
9597
}
9698

0 commit comments

Comments
 (0)