Skip to content

Commit d247b5a

Browse files
authored
Merge branch 'AliceO2Group:master' into master
2 parents 09bfea3 + 3931df4 commit d247b5a

File tree

100 files changed

+5936
-1800
lines changed

Some content is hidden

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

100 files changed

+5936
-1800
lines changed

CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
/Common/CCDB @alibuild @jgrosseo @iarsene @ekryshen @ddobrigk
1616
/Common/Tools/Multiplicity @alibuild @ddobrigk @victor-gonzalez
1717
/ALICE3 @alibuild @njacazio @hscheid
18-
/DPG @alibuild @chiarazampolli @noferini
18+
/DPG @alibuild @chiarazampolli @alcaliva @catalinristea
1919
/DPG/Tasks/AOTEvent @alibuild @ekryshen @strogolo @altsybee
2020
/DPG/Tasks/AOTTrack @alibuild @mfaggin @iouribelikov @njacazio
2121
/DPG/Tasks/TOF @alibuild @noferini @njacazio

Common/Core/RecoDecay.h

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,6 +1035,119 @@ struct RecoDecay {
10351035
}
10361036
return OriginType::None;
10371037
}
1038+
1039+
/// based on getCharmHardronOrigin in order to extend general particle
1040+
/// Finding the origin (from charm hadronisation or beauty-hadron decay) of paritcle (b, c and others)
1041+
/// \param particlesMC table with MC particles
1042+
/// \param particle MC particle
1043+
/// \param searchUpToQuark if true tag origin based on charm/beauty quark otherwise on the presence of a b-hadron or c-hadron
1044+
/// \param idxBhadMothers optional vector of b-hadron indices (might be more than one in case of searchUpToQuark in case of beauty resonances)
1045+
/// \return an integer corresponding to the origin (0: none(others), 1: charm, 2: beauty) as in OriginType
1046+
template <typename T>
1047+
static int getParticleOrigin(const T& particlesMC,
1048+
const typename T::iterator& particle,
1049+
const bool searchUpToQuark = false,
1050+
std::vector<int>* idxBhadMothers = nullptr)
1051+
{
1052+
int stage = 0; // mother tree level (just for debugging)
1053+
1054+
// vector of vectors with mother indices; each line corresponds to a "stage"
1055+
std::vector<std::vector<int64_t>> arrayIds{};
1056+
std::vector<int64_t> initVec{particle.globalIndex()};
1057+
arrayIds.push_back(initVec); // the first vector contains the index of the original particle
1058+
auto PDGParticle = std::abs(particle.pdgCode());
1059+
bool couldBeCharm = false;
1060+
if (PDGParticle / 100 == 4 || PDGParticle / 1000 == 4) {
1061+
couldBeCharm = true;
1062+
}
1063+
while (arrayIds[-stage].size() > 0) {
1064+
// vector of mother indices for the current stage
1065+
std::vector<int64_t> arrayIdsStage{};
1066+
for (auto& iPart : arrayIds[-stage]) { // check all the particles that were the mothers at the previous stage
1067+
auto particleMother = particlesMC.rawIteratorAt(iPart - particlesMC.offset());
1068+
if (particleMother.has_mothers()) {
1069+
1070+
// we break immediately if searchUpToQuark is false and the first mother is a parton (an hadron should never be the mother of a parton)
1071+
if (!searchUpToQuark) {
1072+
auto mother = particlesMC.rawIteratorAt(particleMother.mothersIds().front() - particlesMC.offset());
1073+
auto PDGParticleIMother = std::abs(mother.pdgCode()); // PDG code of the mother
1074+
if (PDGParticleIMother < 9 || (PDGParticleIMother > 20 && PDGParticleIMother < 38)) {
1075+
auto PDGPaticle = std::abs(particleMother.pdgCode());
1076+
if (
1077+
(PDGParticleIMother / 100 == 5 || // b mesons
1078+
PDGParticleIMother / 1000 == 5) // b baryons
1079+
) {
1080+
return OriginType::NonPrompt; // beauty
1081+
}
1082+
if (
1083+
(PDGParticleIMother / 100 == 4 || // c mesons
1084+
PDGParticleIMother / 1000 == 4) // c baryons
1085+
) {
1086+
return OriginType::Prompt; // charm
1087+
}
1088+
break;
1089+
}
1090+
}
1091+
1092+
for (auto iMother = particleMother.mothersIds().front(); iMother <= particleMother.mothersIds().back(); ++iMother) { // loop over the mother particles of the analysed particle
1093+
if (std::find(arrayIdsStage.begin(), arrayIdsStage.end(), iMother) != arrayIdsStage.end()) { // if a mother is still present in the vector, do not check it again
1094+
continue;
1095+
}
1096+
auto mother = particlesMC.rawIteratorAt(iMother - particlesMC.offset());
1097+
// Check status code
1098+
auto motherStatusCode = std::abs(mother.getGenStatusCode());
1099+
auto PDGParticleIMother = std::abs(mother.pdgCode()); // PDG code of the mother
1100+
// Check mother's PDG code.
1101+
// printf("getMother: ");
1102+
// for (int i = stage; i < 0; i++) // Indent to make the tree look nice.
1103+
// printf(" ");
1104+
// printf("Stage %d: Mother PDG: %d, status: %d, Index: %d\n", stage, PDGParticleIMother, motherStatusCode, iMother);
1105+
1106+
if (searchUpToQuark) {
1107+
if (idxBhadMothers) {
1108+
if (PDGParticleIMother / 100 == 5 || // b mesons
1109+
PDGParticleIMother / 1000 == 5) // b baryons
1110+
{
1111+
idxBhadMothers->push_back(iMother);
1112+
}
1113+
}
1114+
if (PDGParticleIMother == 5) { // b quark
1115+
return OriginType::NonPrompt; // beauty
1116+
}
1117+
if (PDGParticleIMother == 4) { // c quark
1118+
return OriginType::Prompt; // charm
1119+
}
1120+
} else {
1121+
if (
1122+
(PDGParticleIMother / 100 == 5 || // b mesons
1123+
PDGParticleIMother / 1000 == 5) // b baryons
1124+
) {
1125+
if (idxBhadMothers) {
1126+
idxBhadMothers->push_back(iMother);
1127+
}
1128+
return OriginType::NonPrompt; // beauty
1129+
}
1130+
if (
1131+
(PDGParticleIMother / 100 == 4 || // c mesons
1132+
PDGParticleIMother / 1000 == 4) // c baryons
1133+
) {
1134+
couldBeCharm = true;
1135+
}
1136+
}
1137+
// add mother index in the vector for the current stage
1138+
arrayIdsStage.push_back(iMother);
1139+
}
1140+
}
1141+
}
1142+
// add vector of mother indices for the current stage
1143+
arrayIds.push_back(arrayIdsStage);
1144+
stage--;
1145+
}
1146+
if (couldBeCharm) {
1147+
return OriginType::Prompt; // charm
1148+
}
1149+
return OriginType::None;
1150+
}
10381151
};
10391152

10401153
/// Calculations using (pT, η, φ) coordinates, aka (transverse momentum, pseudorapidity, azimuth)

Common/DataModel/PIDResponseITS.h

Lines changed: 59 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
/// \since 2024-11-12
1515
/// \author Nicolò Jacazio [email protected]
1616
/// \author Francesco Mazzaschi [email protected]
17+
/// \author Giorgio Alberto Lucia [email protected]
1718
/// \brief Set of tables, tasks and utilities to provide the interface between
1819
/// the analysis data model and the PID response of the ITS
1920
///
@@ -54,19 +55,33 @@ struct ITSResponse {
5455
static constexpr float inverseMass = 1. / o2::track::pid_constants::sMasses[id];
5556
static constexpr float charge = static_cast<float>(o2::track::pid_constants::sCharges[id]);
5657
const float bg = momentum * inverseMass;
57-
return (mITSRespParams[0] / (std::pow(bg, mITSRespParams[1])) + mITSRespParams[2]) * std::pow(charge, mChargeFactor);
58+
if (id == o2::track::PID::Helium3 || id == o2::track::PID::Alpha) {
59+
return (mITSRespParamsZ2[0] / (std::pow(bg, mITSRespParamsZ2[1])) + mITSRespParamsZ2[2]);
60+
}
61+
return (mITSRespParams[0] / (std::pow(bg, mITSRespParams[1])) + mITSRespParams[2]);
62+
}
63+
64+
template <o2::track::PID::ID id>
65+
static float expResolution(const float momentum)
66+
{
67+
static constexpr float inverseMass = 1. / o2::track::pid_constants::sMasses[id];
68+
static constexpr float charge = static_cast<float>(o2::track::pid_constants::sCharges[id]);
69+
const float bg = momentum * inverseMass;
70+
float relRes = mResolutionParams[0] * std::erf((bg - mResolutionParams[1]) / mResolutionParams[2]);
71+
return relRes;
5872
}
5973

6074
template <o2::track::PID::ID id>
61-
static float nSigmaITS(uint32_t itsClusterSizes, float momentum)
75+
static float nSigmaITS(uint32_t itsClusterSizes, float momentum, float eta)
6276
{
6377
const float exp = expSignal<id>(momentum);
6478
const float average = averageClusterSize(itsClusterSizes);
65-
const float resolution = mResolution * exp;
66-
return (average - exp) / resolution;
79+
const float coslInv = 1. / std::cosh(eta);
80+
const float resolution = expResolution<id>(momentum) * exp;
81+
return (average * coslInv - exp) / resolution;
6782
};
6883

69-
static void setParameters(float p0, float p1, float p2, float chargeFactor, float resolution)
84+
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)
7085
{
7186
if (mIsInitialized) {
7287
LOG(fatal) << "ITSResponse parameters already initialized";
@@ -75,79 +90,84 @@ struct ITSResponse {
7590
mITSRespParams[0] = p0;
7691
mITSRespParams[1] = p1;
7792
mITSRespParams[2] = p2;
78-
mChargeFactor = chargeFactor;
79-
mResolution = resolution;
93+
mITSRespParamsZ2[0] = p0_Z2;
94+
mITSRespParamsZ2[1] = p1_Z2;
95+
mITSRespParamsZ2[2] = p2_Z2;
96+
mResolutionParams[0] = p0_res;
97+
mResolutionParams[1] = p1_res;
98+
mResolutionParams[2] = p2_res;
8099
}
81100

82101
private:
83102
static std::array<float, 3> mITSRespParams;
84-
static float mChargeFactor;
85-
static float mResolution;
103+
static std::array<float, 3> mITSRespParamsZ2;
104+
static std::array<float, 3> mResolutionParams;
86105
static bool mIsInitialized;
87106
};
88107

89-
std::array<float, 3> ITSResponse::mITSRespParams = {0.903, 2.014, 2.440};
90-
float ITSResponse::mChargeFactor = 2.299999952316284f;
91-
float ITSResponse::mResolution = 0.15f;
108+
std::array<float, 3> ITSResponse::mITSRespParams = {1.1576, 1.684, 1.9453};
109+
std::array<float, 3> ITSResponse::mITSRespParamsZ2 = {2.8752, 1.1246, 5.0259};
110+
// relative resolution is modelled with an erf function: [0]*TMath::Erf((x-[1])/[2])
111+
std::array<float, 3> ITSResponse::mResolutionParams = {0.2431, -0.3293, 1.533};
92112
bool ITSResponse::mIsInitialized = false;
93113

94114
namespace pidits
95115
{
96116
DECLARE_SOA_DYNAMIC_COLUMN(ITSNSigmaElImp, itsNSigmaEl, //! Nsigma separation with the ITS detector for electrons
97-
[](uint32_t itsClusterSizes, float momentum) -> float {
98-
return ITSResponse::nSigmaITS<o2::track::PID::Electron>(itsClusterSizes, momentum);
117+
[](uint32_t itsClusterSizes, float momentum, float eta) -> float {
118+
return ITSResponse::nSigmaITS<o2::track::PID::Electron>(itsClusterSizes, momentum, eta);
99119
});
100120

101121
DECLARE_SOA_DYNAMIC_COLUMN(ITSNSigmaMuImp, itsNSigmaMu, //! Nsigma separation with the ITS detector for muons
102-
[](uint32_t itsClusterSizes, float momentum) -> float {
103-
return ITSResponse::nSigmaITS<o2::track::PID::Muon>(itsClusterSizes, momentum);
122+
[](uint32_t itsClusterSizes, float momentum, float eta) -> float {
123+
return ITSResponse::nSigmaITS<o2::track::PID::Muon>(itsClusterSizes, momentum, eta);
104124
});
105125

106126
DECLARE_SOA_DYNAMIC_COLUMN(ITSNSigmaPiImp, itsNSigmaPi, //! Nsigma separation with the ITS detector for pions
107-
[](uint32_t itsClusterSizes, float momentum) -> float {
108-
return ITSResponse::nSigmaITS<o2::track::PID::Pion>(itsClusterSizes, momentum);
127+
[](uint32_t itsClusterSizes, float momentum, float eta) -> float {
128+
return ITSResponse::nSigmaITS<o2::track::PID::Pion>(itsClusterSizes, momentum, eta);
109129
});
110130

111131
DECLARE_SOA_DYNAMIC_COLUMN(ITSNSigmaKaImp, itsNSigmaKa, //! Nsigma separation with the ITS detector for kaons
112-
[](uint32_t itsClusterSizes, float momentum) -> float {
113-
return ITSResponse::nSigmaITS<o2::track::PID::Kaon>(itsClusterSizes, momentum);
132+
[](uint32_t itsClusterSizes, float momentum, float eta) -> float {
133+
return ITSResponse::nSigmaITS<o2::track::PID::Kaon>(itsClusterSizes, momentum, eta);
114134
});
115135

116136
DECLARE_SOA_DYNAMIC_COLUMN(ITSNSigmaPrImp, itsNSigmaPr, //! Nsigma separation with the ITS detector for protons
117-
[](uint32_t itsClusterSizes, float momentum) -> float {
118-
return ITSResponse::nSigmaITS<o2::track::PID::Proton>(itsClusterSizes, momentum);
137+
[](uint32_t itsClusterSizes, float momentum, float eta) -> float {
138+
return ITSResponse::nSigmaITS<o2::track::PID::Proton>(itsClusterSizes, momentum, eta);
119139
});
120140

121141
DECLARE_SOA_DYNAMIC_COLUMN(ITSNSigmaDeImp, itsNSigmaDe, //! Nsigma separation with the ITS detector for deuterons
122-
[](uint32_t itsClusterSizes, float momentum) -> float {
123-
return ITSResponse::nSigmaITS<o2::track::PID::Deuteron>(itsClusterSizes, momentum);
142+
[](uint32_t itsClusterSizes, float momentum, float eta) -> float {
143+
return ITSResponse::nSigmaITS<o2::track::PID::Deuteron>(itsClusterSizes, momentum, eta);
124144
});
125145

126146
DECLARE_SOA_DYNAMIC_COLUMN(ITSNSigmaTrImp, itsNSigmaTr, //! Nsigma separation with the ITS detector for tritons
127-
[](uint32_t itsClusterSizes, float momentum) -> float {
128-
return ITSResponse::nSigmaITS<o2::track::PID::Triton>(itsClusterSizes, momentum);
147+
[](uint32_t itsClusterSizes, float momentum, float eta) -> float {
148+
return ITSResponse::nSigmaITS<o2::track::PID::Triton>(itsClusterSizes, momentum, eta);
129149
});
130150

131151
DECLARE_SOA_DYNAMIC_COLUMN(ITSNSigmaHeImp, itsNSigmaHe, //! Nsigma separation with the ITS detector for helium3
132-
[](uint32_t itsClusterSizes, float momentum) -> float {
133-
return ITSResponse::nSigmaITS<o2::track::PID::Helium3>(itsClusterSizes, momentum);
152+
[](uint32_t itsClusterSizes, float momentum, float eta) -> float {
153+
return ITSResponse::nSigmaITS<o2::track::PID::Helium3>(itsClusterSizes, momentum, eta);
134154
});
135155

136156
DECLARE_SOA_DYNAMIC_COLUMN(ITSNSigmaAlImp, itsNSigmaAl, //! Nsigma separation with the ITS detector for alphas
137-
[](uint32_t itsClusterSizes, float momentum) -> float {
138-
return ITSResponse::nSigmaITS<o2::track::PID::Alpha>(itsClusterSizes, momentum);
157+
[](uint32_t itsClusterSizes, float momentum, float eta) -> float {
158+
return ITSResponse::nSigmaITS<o2::track::PID::Alpha>(itsClusterSizes, momentum, eta);
139159
});
140160

141161
// Define user friendly names for the columns to join with the tracks
142-
using ITSNSigmaEl = ITSNSigmaElImp<o2::aod::track::ITSClusterSizes, o2::aod::track::P>;
143-
using ITSNSigmaMu = ITSNSigmaMuImp<o2::aod::track::ITSClusterSizes, o2::aod::track::P>;
144-
using ITSNSigmaPi = ITSNSigmaPiImp<o2::aod::track::ITSClusterSizes, o2::aod::track::P>;
145-
using ITSNSigmaKa = ITSNSigmaKaImp<o2::aod::track::ITSClusterSizes, o2::aod::track::P>;
146-
using ITSNSigmaPr = ITSNSigmaPrImp<o2::aod::track::ITSClusterSizes, o2::aod::track::P>;
147-
using ITSNSigmaDe = ITSNSigmaDeImp<o2::aod::track::ITSClusterSizes, o2::aod::track::P>;
148-
using ITSNSigmaTr = ITSNSigmaTrImp<o2::aod::track::ITSClusterSizes, o2::aod::track::P>;
149-
using ITSNSigmaHe = ITSNSigmaHeImp<o2::aod::track::ITSClusterSizes, o2::aod::track::P>;
150-
using ITSNSigmaAl = ITSNSigmaAlImp<o2::aod::track::ITSClusterSizes, o2::aod::track::P>;
162+
using ITSNSigmaEl = ITSNSigmaElImp<o2::aod::track::ITSClusterSizes, o2::aod::track::P, o2::aod::track::Eta>;
163+
using ITSNSigmaMu = ITSNSigmaMuImp<o2::aod::track::ITSClusterSizes, o2::aod::track::P, o2::aod::track::Eta>;
164+
using ITSNSigmaPi = ITSNSigmaPiImp<o2::aod::track::ITSClusterSizes, o2::aod::track::P, o2::aod::track::Eta>;
165+
using ITSNSigmaKa = ITSNSigmaKaImp<o2::aod::track::ITSClusterSizes, o2::aod::track::P, o2::aod::track::Eta>;
166+
using ITSNSigmaPr = ITSNSigmaPrImp<o2::aod::track::ITSClusterSizes, o2::aod::track::P, o2::aod::track::Eta>;
167+
using ITSNSigmaDe = ITSNSigmaDeImp<o2::aod::track::ITSClusterSizes, o2::aod::track::P, o2::aod::track::Eta>;
168+
using ITSNSigmaTr = ITSNSigmaTrImp<o2::aod::track::ITSClusterSizes, o2::aod::track::P, o2::aod::track::Eta>;
169+
using ITSNSigmaHe = ITSNSigmaHeImp<o2::aod::track::ITSClusterSizes, o2::aod::track::P, o2::aod::track::Eta>;
170+
using ITSNSigmaAl = ITSNSigmaAlImp<o2::aod::track::ITSClusterSizes, o2::aod::track::P, o2::aod::track::Eta>;
151171

152172
} // namespace pidits
153173
} // namespace o2::aod

Common/TableProducer/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,3 +129,8 @@ o2physics_add_dpl_workflow(ese-table-producer
129129
SOURCES eseTableProducer.cxx
130130
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore
131131
COMPONENT_NAME Analysis)
132+
133+
o2physics_add_dpl_workflow(mftmch-matching-data
134+
SOURCES match-mft-mch-data.cxx
135+
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsBase O2Physics::AnalysisCCDB O2Physics::PWGDQCore O2Physics::EventFilteringUtils
136+
COMPONENT_NAME Analysis)

0 commit comments

Comments
 (0)