Skip to content

Commit b539389

Browse files
committed
Add pt and minor changes
1 parent c6befe2 commit b539389

File tree

1 file changed

+30
-24
lines changed

1 file changed

+30
-24
lines changed

PWGHF/Tasks/pidStudies.cxx

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,12 @@ namespace o2::aod
3939
{
4040
namespace pid_studies
4141
{
42-
enum Particle {NotMatched=0, Lambda, K0s, Omega};
42+
enum Particle {NotMatched=0, K0s, Lambda, Omega};
4343
// V0s
4444
DECLARE_SOA_COLUMN(MassK0, massK0, float); //! Candidate mass
4545
DECLARE_SOA_COLUMN(MassLambda, massLambda, float); //! Candidate mass
4646
DECLARE_SOA_COLUMN(MassAntiLambda, massAntiLambda, float); //! Candidate mass
47+
DECLARE_SOA_COLUMN(Pt, pt, float); //! Transverse momentum of the candidate (GeV/c)
4748
DECLARE_SOA_COLUMN(PtPos, ptPos, float); //! Transverse momentum of positive track (GeV/c)
4849
DECLARE_SOA_COLUMN(PtNeg, ptNeg, float); //! Transverse momentum of negative track (GeV/c)
4950
DECLARE_SOA_COLUMN(Radius, radius, float); //! Radius
@@ -80,6 +81,7 @@ DECLARE_SOA_TABLE(pidV0s, "AOD", "PIDV0S", //! Table with PID information
8081
pid_studies::MassK0,
8182
pid_studies::MassLambda,
8283
pid_studies::MassAntiLambda,
84+
pid_studies::Pt,
8385
pid_studies::PtPos,
8486
pid_studies::PtNeg,
8587
pid_studies::Radius,
@@ -103,6 +105,7 @@ DECLARE_SOA_TABLE(pidV0s, "AOD", "PIDV0S", //! Table with PID information
103105

104106
DECLARE_SOA_TABLE(pidCascades, "AOD", "PIDCASCADES", //! Table with PID information
105107
pid_studies::MassOmega,
108+
pid_studies::Pt,
106109
pid_studies::MassXi,
107110
pid_studies::CascCosPA,
108111
pid_studies::DCAV0daughters,
@@ -142,23 +145,23 @@ struct pidStudies {
142145
{
143146
}
144147

145-
template <typename Cand>
148+
template <bool isV0, typename Cand>
146149
void fillTree(Cand const& candidate, const int& flag)
147150
{
148-
LOG(info) << candidate.pt();
149151
float pseudoRndm = candidate.pt() * 1000. - (int64_t)(candidate.pt() * 1000);
150152
if (candidate.pt() < ptMaxForDownSample && pseudoRndm > downSampleBkgFactor) {
151153
return;
152154
}
153155

154156
const auto& coll = candidate.template collision_as<CollSels>();
155-
if constexpr (std::is_same<Cand, V0sMCRec::iterator>::value) {
157+
if constexpr (isV0) {
156158
const auto& posTrack = candidate.template posTrack_as<PIDTracks>();
157159
const auto& negTrack = candidate.template negTrack_as<PIDTracks>();
158160
pidV0(
159161
candidate.mK0Short(),
160162
candidate.mLambda(),
161163
candidate.mAntiLambda(),
164+
candidate.pt(),
162165
posTrack.pt(),
163166
negTrack.pt(),
164167
candidate.v0radius(),
@@ -179,11 +182,11 @@ struct pidStudies {
179182
coll.centFT0M(),
180183
flag
181184
);
182-
}
183-
if constexpr (std::is_same<Cand, CascsMCRec::iterator>::value) {
185+
} else {
184186
const auto& bachTrack = candidate.template bachelor_as<PIDTracks>();
185187
pidCascade(
186188
candidate.mOmega(),
189+
candidate.pt(),
187190
candidate.mXi(),
188191
candidate.casccosPA(coll.posX(), coll.posY(), coll.posZ()),
189192
candidate.dcaV0daughters(),
@@ -206,15 +209,6 @@ struct pidStudies {
206209
return aod::pid_studies::NotMatched;
207210
}
208211
auto v0MC = cand.template v0MCCore_as<aod::V0MCCores>();
209-
LOG(info) << v0MC.pdgCode();
210-
if (v0MC.pdgCode() == kLambda0 && v0MC.pdgCodeNegative() == -kPiPlus
211-
&& v0MC.pdgCodePositive() == kProton) {
212-
return aod::pid_studies::Lambda;
213-
}
214-
if (v0MC.pdgCode() == -kLambda0 && v0MC.pdgCodeNegative() == -kProton
215-
&& v0MC.pdgCodePositive() == kPiPlus) {
216-
return -aod::pid_studies::Lambda;
217-
}
218212
if (v0MC.pdgCode() == kK0Short && v0MC.pdgCodeNegative() == -kPiPlus
219213
&& v0MC.pdgCodePositive() == kPiPlus) {
220214
return aod::pid_studies::K0s;
@@ -223,6 +217,14 @@ struct pidStudies {
223217
&& v0MC.pdgCodePositive() == kPiPlus) {
224218
return -aod::pid_studies::K0s;
225219
}
220+
if (v0MC.pdgCode() == kLambda0 && v0MC.pdgCodeNegative() == -kPiPlus
221+
&& v0MC.pdgCodePositive() == kProton) {
222+
return aod::pid_studies::Lambda;
223+
}
224+
if (v0MC.pdgCode() == -kLambda0 && v0MC.pdgCodeNegative() == -kProton
225+
&& v0MC.pdgCodePositive() == kPiPlus) {
226+
return -aod::pid_studies::Lambda;
227+
}
226228
}
227229
if constexpr (std::is_same<T1, CascsMCRec::iterator>::value) {
228230
if (!cand.has_cascMCCore()) {
@@ -249,27 +251,26 @@ struct pidStudies {
249251
}
250252
}
251253

252-
void processMC(V0sMCRec const& V0s, aod::V0MCCores const& V0sMC, CascsMCRec const& cascs,
253-
aod::CascMCCores const& cascsMC, CollSels const&, PIDTracks const&) {
254+
void processMC(V0sMCRec const& V0s, aod::V0MCCores const&, CascsMCRec const& cascades,
255+
aod::CascMCCores const&, CollSels const&, PIDTracks const&) {
254256
for (const auto& v0 : V0s) {
255257
if (v0.mK0Short() > massK0Min && v0.mK0Short() < massK0Max ||
256258
v0.mLambda() > massLambdaMin && v0.mLambda() < massLambdaMax ||
257259
v0.mAntiLambda() > massLambdaMin && v0.mAntiLambda() < massLambdaMax) {
258260
int matched = isMatched(v0);
259-
if(matched != 0) {
260-
fillTree(v0, matched);
261+
if(matched != aod::pid_studies::NotMatched) {
262+
fillTree<true>(v0, matched);
261263
}
262264
}
263265
}
264-
for (const auto& casc : cascs) {
266+
for (const auto& casc : cascades) {
265267
if (casc.mOmega() > massOmegaMin && casc.mOmega() < massOmegaMax) {
266268
int matched = isMatched(casc);
267-
if(matched != 0) {
268-
fillTree(casc, matched);
269+
if(matched != aod::pid_studies::NotMatched) {
270+
fillTree<false>(casc, matched);
269271
}
270272
}
271273
}
272-
273274
}
274275
PROCESS_SWITCH(pidStudies, processMC, "Process MC", true);
275276

@@ -279,7 +280,12 @@ struct pidStudies {
279280
if (v0.mK0Short() > massK0Min && v0.mK0Short() < massK0Max ||
280281
v0.mLambda() > massLambdaMin && v0.mLambda() < massLambdaMax ||
281282
v0.mAntiLambda() > massLambdaMin && v0.mAntiLambda() < massLambdaMax) {
282-
fillTree(v0, aod::pid_studies::NotMatched);
283+
fillTree<true>(v0, aod::pid_studies::NotMatched);
284+
}
285+
}
286+
for (const auto& casc : cascades) {
287+
if (casc.mOmega() > massOmegaMin && casc.mOmega() < massOmegaMax) {
288+
fillTree<false>(casc, aod::pid_studies::NotMatched);
283289
}
284290
}
285291
}

0 commit comments

Comments
 (0)