Skip to content

Commit 2979f70

Browse files
committed
Event filter
1 parent 6817b80 commit 2979f70

File tree

1 file changed

+41
-54
lines changed

1 file changed

+41
-54
lines changed

PWGLF/Tasks/Strangeness/strangecasctrack.cxx

Lines changed: 41 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@ struct StrangeCascTrack {
116116
} axesConfig;
117117

118118
// Filters events
119-
// Filter eventFilter = (o2::aod::evsel::sel8 == true);
120-
// Filter posZFilter = (nabs(o2::aod::collision::posZ) < selCuts.cutZVertex);
121-
// Filter posZFilterMC = (nabs(o2::aod::mccollision::posZ) < selCuts.cutZVertex);
119+
// Filter eventFilter = (o2::aod::evsel::sel8 == true);
120+
// Filter posZFilter = (nabs(o2::aod::collision::posZ) < selCuts.cutZVertex);
121+
// Filter posZFilterMC = (nabs(o2::aod::mccollision::posZ) < selCuts.cutZVertex);
122122

123123
// cascade reconstruction types
124124
static constexpr std::string_view kTypeNames[] = {"Standard", "Tracked"};
@@ -156,14 +156,10 @@ struct StrangeCascTrack {
156156
auto timeStamp = timestamp;
157157

158158
std::string efficiencyCCDBPath = [&]() {
159-
if (doProcesspp)
160-
return efficiencyCCDBPath_pp;
161-
if (doProcesspO)
162-
return efficiencyCCDBPath_pO;
163-
if (doProcessPbPb)
164-
return efficiencyCCDBPath_PbPb;
165-
if (doProcessOO)
166-
return efficiencyCCDBPath_OO;
159+
if (doProcesspp) return efficiencyCCDBPath_pp;
160+
if (doProcesspO) return efficiencyCCDBPath_pO;
161+
if (doProcessPbPb) return efficiencyCCDBPath_PbPb;
162+
if (doProcessOO) return efficiencyCCDBPath_OO;
167163
}();
168164

169165
TList* listEfficiencies = ccdb->getForTimeStamp<TList>(efficiencyCCDBPath, timeStamp);
@@ -216,6 +212,8 @@ struct StrangeCascTrack {
216212
template <typename TEvent, typename TCascade>
217213
bool isValidCasc(TEvent collision, TCascade cascade)
218214
{
215+
if (std::abs(collision.posZ()) > selCuts.cutZVertex)
216+
return false;
219217
if (cascade.dcaXYCascToPV() > selCuts.cutDCAtoPVxy)
220218
return false;
221219
if (cascade.dcaZCascToPV() > selCuts.cutDCAtoPVz)
@@ -253,10 +251,9 @@ struct StrangeCascTrack {
253251
template <typename TCascade>
254252
bool passesTOF(TCascade cascade, TString particle)
255253
{
256-
if (particle == "xi")
257-
return cascade.tofXiCompatibility(selCuts.nSigmaTOFXi);
258-
if (particle == "omega")
259-
return cascade.tofOmegaCompatibility(selCuts.nSigmaTOFOmega);
254+
if (particle == "xi") return cascade.tofXiCompatibility(selCuts.nSigmaTOFXi);
255+
if (particle == "omega") return cascade.tofOmegaCompatibility(selCuts.nSigmaTOFOmega);
256+
return true;
260257
}
261258
// checks whether gen cascade corresponds to PDG code
262259
template <typename TCascade>
@@ -372,9 +369,10 @@ struct StrangeCascTrack {
372369
efficiencyXi = 1.;
373370
efficiencyXiErr = 0.;
374371
}
372+
375373
}
376374
}
377-
375+
378376
if (doApplyPurity) {
379377
if constexpr (requires { cascade.topologyChi2(); }) {
380378
purityOmega = hPurityOmegaTra->Interpolate(cascade.pt(), mult);
@@ -429,55 +427,47 @@ struct StrangeCascTrack {
429427
histos.fill(HIST(kTypeNames[type]) + HIST("/NoSel/MassOmega"), massOmega);
430428

431429
if constexpr (requires { collision.straMCCollisionId(); }) {
432-
if (isMCTruth(stdCasc, "xi") || isMCTruth(stdCasc, "omega")) {
433-
histos.fill(HIST(kTypeNames[type]) + HIST("/NoSel-Truth/DCAxy"), cascade.dcaXYCascToPV());
434-
histos.fill(HIST(kTypeNames[type]) + HIST("/NoSel-Truth/DCAz"), cascade.dcaZCascToPV());
435-
histos.fill(HIST(kTypeNames[type]) + HIST("/NoSel-Truth/DCAzVSpt"), pt, cascade.dcaZCascToPV());
436-
histos.fill(HIST(kTypeNames[type]) + HIST("/NoSel-Truth/Phi"), cascade.phi());
437-
histos.fill(HIST(kTypeNames[type]) + HIST("/NoSel-Truth/Eta"), cascade.eta());
438-
histos.fill(HIST(kTypeNames[type]) + HIST("/NoSel-Truth/EvMult"), mult);
439-
histos.fill(HIST(kTypeNames[type]) + HIST("/NoSel-Truth/BachCosPA"), stdCasc.bachBaryonCosPA());
440-
histos.fill(HIST(kTypeNames[type]) + HIST("/NoSel-Truth/V0CosPA"), v0cosPA);
441-
if (isMCTruth(stdCasc, "xi"))
442-
histos.fill(HIST(kTypeNames[type]) + HIST("/NoSel-Truth/MassXi"), massXi);
443-
if (isMCTruth(stdCasc, "omega"))
444-
histos.fill(HIST(kTypeNames[type]) + HIST("/NoSel-Truth/MassOmega"), massOmega);
445-
}
446-
}
430+
if (isMCTruth(stdCasc, "xi") || isMCTruth(stdCasc, "omega")) {
431+
histos.fill(HIST(kTypeNames[type]) + HIST("/NoSel-Truth/DCAxy"), cascade.dcaXYCascToPV());
432+
histos.fill(HIST(kTypeNames[type]) + HIST("/NoSel-Truth/DCAz"), cascade.dcaZCascToPV());
433+
histos.fill(HIST(kTypeNames[type]) + HIST("/NoSel-Truth/DCAzVSpt"), pt, cascade.dcaZCascToPV());
434+
histos.fill(HIST(kTypeNames[type]) + HIST("/NoSel-Truth/Phi"), cascade.phi());
435+
histos.fill(HIST(kTypeNames[type]) + HIST("/NoSel-Truth/Eta"), cascade.eta());
436+
histos.fill(HIST(kTypeNames[type]) + HIST("/NoSel-Truth/EvMult"), mult);
437+
histos.fill(HIST(kTypeNames[type]) + HIST("/NoSel-Truth/BachCosPA"), stdCasc.bachBaryonCosPA());
438+
histos.fill(HIST(kTypeNames[type]) + HIST("/NoSel-Truth/V0CosPA"), v0cosPA);
439+
if (isMCTruth(stdCasc, "xi")) histos.fill(HIST(kTypeNames[type]) + HIST("/NoSel-Truth/MassXi"), massXi);
440+
if (isMCTruth(stdCasc, "omega")) histos.fill(HIST(kTypeNames[type]) + HIST("/NoSel-Truth/MassOmega"), massOmega);
441+
}}
447442

448443
// start checking selections
449444
bool passedAllSels = true;
450445
// apply general selection criteria
451446
if (doApplyCuts) {
452-
if (!isValidCasc(collision, stdCasc))
453-
passedAllSels = false;
447+
if (!isValidCasc(collision, stdCasc)) passedAllSels = false;
454448
}
455449
// apply tpc pid
456450
if (doApplyTPCPID) {
457-
if (!passesTPC(stdCasc))
458-
passedAllSels = false;
451+
if (!passesTPC(stdCasc)) passedAllSels = false;
459452
}
460453
// apply tof pid
461454
bool passedAllSelsXi = passedAllSels;
462455
bool passedAllSelsOmega = passedAllSels;
463456
if (doApplyTOFPID) {
464-
if (!passesTOF(stdCasc, "xi"))
465-
passedAllSelsXi = false;
466-
if (!passesTOF(stdCasc, "omega"))
467-
passedAllSelsOmega = false;
457+
if (!passesTOF(stdCasc, "xi")) passedAllSelsXi = false;
458+
if (!passesTOF(stdCasc, "omega")) passedAllSelsOmega = false;
468459
}
469460
// apply competing mass rej
470461
if (doCompetingMassRej) {
471-
if (!(std::abs(massXi - o2::constants::physics::MassXiMinus) > selCuts.compMassRej))
472-
passedAllSelsOmega = false;
462+
if (!(std::abs(massXi - o2::constants::physics::MassXiMinus) > selCuts.compMassRej)) passedAllSelsOmega = false;
473463
}
474464

475465
// fill truth w/ cascs that passed all applied sels
476466
double binFillXi[3] = {massXi, pt, mult};
477467

478468
if constexpr (requires { collision.straMCCollisionId(); }) {
479469
if (passedAllSels && (passedAllSelsXi || passedAllSelsOmega)) { // fill once for every desired cascade
480-
if (isMCTruth(stdCasc, "xi") || isMCTruth(stdCasc, "omega")) {
470+
if (isMCTruth(stdCasc, "xi") || isMCTruth(stdCasc, "omega")) {
481471
histos.fill(HIST(kTypeNames[type]) + HIST("/Rec-Truth/DCAxy"), cascade.dcaXYCascToPV());
482472
histos.fill(HIST(kTypeNames[type]) + HIST("/Rec-Truth/DCAz"), cascade.dcaZCascToPV());
483473
histos.fill(HIST(kTypeNames[type]) + HIST("/Rec-Truth/DCAzVSpt"), pt, cascade.dcaZCascToPV());
@@ -486,20 +476,17 @@ struct StrangeCascTrack {
486476
histos.fill(HIST(kTypeNames[type]) + HIST("/Rec-Truth/EvMult"), mult);
487477
histos.fill(HIST(kTypeNames[type]) + HIST("/Rec-Truth/BachCosPA"), stdCasc.bachBaryonCosPA());
488478
histos.fill(HIST(kTypeNames[type]) + HIST("/Rec-Truth/V0CosPA"), v0cosPA);
489-
}
490-
}
491-
}
479+
}}}
492480

493481
// fill rec
494482
if (passedAllSelsXi) {
495483
histos.fill(HIST(kTypeNames[type]) + HIST("/Rec/MassXi"), massXi);
496484
fillHist(histos.get<THn>(HIST(kTypeNames[type]) + HIST("/Rec/Xi")), binFillXi, efficiencyXi, efficiencyXiErr, purityXi, purityXiErr);
497485
if constexpr (requires { collision.straMCCollisionId(); }) {
498-
if (isMCTruth(stdCasc, "xi")) {
486+
if (isMCTruth(stdCasc, "xi")) {
499487
histos.fill(HIST(kTypeNames[type]) + HIST("/Rec-Truth/MassXi"), massXi);
500488
histos.fill(HIST(kTypeNames[type]) + HIST("/Rec-Truth/Xi"), massXi, pt, mult);
501-
}
502-
}
489+
}}
503490
}
504491
double binFillOmega[3] = {massOmega, pt, mult};
505492
if (passedAllSelsOmega) {
@@ -509,8 +496,7 @@ struct StrangeCascTrack {
509496
if (isMCTruth(stdCasc, "omega")) {
510497
histos.fill(HIST(kTypeNames[type]) + HIST("/Rec-Truth/MassOmega"), massOmega);
511498
histos.fill(HIST(kTypeNames[type]) + HIST("/Rec-Truth/Omega"), massOmega, pt, mult);
512-
}
513-
}
499+
}}
514500
}
515501
}
516502
}
@@ -564,15 +550,16 @@ struct StrangeCascTrack {
564550
histos.add(Form("%s/Rec-Truth/MassOmega", kTypeNames[type].data()), "Invariant mass hypothesis", kTH1F, {axesConfig.axisOmegaMass});
565551
histos.add(Form("%s/Rec-Truth/Omega", kTypeNames[type].data()), "", kTHnD, {axesConfig.axisOmegaMass, axesConfig.axisPt, axesConfig.axisMult});
566552
histos.add(Form("%s/Rec-Truth/Xi", kTypeNames[type].data()), "", kTHnD, {axesConfig.axisXiMass, axesConfig.axisPt, axesConfig.axisMult});
553+
567554
});
568555
// for MC-specific processing
569556
histos.add("MC/Gen/EvCounter", "Event Counter", kTH1F, {{1, 0, 1}});
570-
histos.add("MC/Gen/Xi", "Xi", kTH2F, {axesConfig.axisPt, axesConfig.axisMult}); // generated Xis
571-
histos.add("MC/Gen/Omega", "Omega", kTH2F, {axesConfig.axisPt, axesConfig.axisMult}); // generated Omegas
557+
histos.add("MC/Gen/Xi", "Xi", kTH2F, {axesConfig.axisPt, axesConfig.axisMult}); // generated Xis
558+
histos.add("MC/Gen/Omega", "Omega", kTH2F, {axesConfig.axisPt, axesConfig.axisMult}); // generated Omegas
572559
histos.add("MC/Gen/PrimaryXi", "Xi primaries", kTH2F, {axesConfig.axisPt, axesConfig.axisMult}); // generated primary Xis
573560
histos.add("MC/Gen/PrimaryOmega", "Omega primaries", kTH2F, {axesConfig.axisPt, axesConfig.axisMult}); // generated primary Omegas
574-
histos.add("MC/Rec/EvCounter", "Event Counter", kTH1F, {{1, 0, 1}}); // counter of all recreated events
575-
histos.add("MC/Rec/EvMult", "Multiplicity", kTH1F, {axesConfig.axisMult}); // multiplicity of all recreated events
561+
histos.add("MC/Rec/EvCounter", "Event Counter", kTH1F, {{1, 0, 1}}); // counter of all recreated events
562+
histos.add("MC/Rec/EvMult", "Multiplicity", kTH1F, {axesConfig.axisMult}); // multiplicity of all recreated events
576563
}
577564

578565
void processDerivedData(DerCollisionWMults::iterator const& collision, DerCascDatas const& allCascs, DerTraCascDatas const& traCascs, DauTracks const&)

0 commit comments

Comments
 (0)