Skip to content

Commit 1690c9e

Browse files
[PWGHF] added Lambda0 processes to calculate data driven efficiency (#13167)
Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
1 parent f44171a commit 1690c9e

File tree

1 file changed

+216
-0
lines changed

1 file changed

+216
-0
lines changed

PWGHF/HFC/TableProducer/correlatorLcScHadrons.cxx

Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,32 @@ struct HfCorrelatorLcScHadrons {
265265
Configurable<bool> calEffEventWithCand{"calEffEventWithCand", true, "Calculate the efficiency of Lc candidate"};
266266
Configurable<float> eventFractionToAnalyze{"eventFractionToAnalyze", -1, "Fraction of events to analyze (use only for ME offline on very large samples)"};
267267

268+
struct : ConfigurableGroup {
269+
Configurable<float> cfgDaughPrPtMax{"cfgDaughPrPtMax", 5., "max. pT Daughter Proton"};
270+
Configurable<float> cfgDaughPrPtMin{"cfgDaughPrPtMin", 0.3, "min. pT Daughter Proton"};
271+
Configurable<float> cfgDaughPiPtMax{"cfgDaughPiPtMax", 10., "max. pT Daughter Pion"};
272+
Configurable<float> cfgDaughPiPtMin{"cfgDaughPiPtMin", 0.3, "min. pT Daughter Pion"};
273+
Configurable<float> cfgDaughPIDCutsTPCPr{"cfgDaughPIDCutsTPCPr", 3., "max. TPCnSigma Proton"};
274+
Configurable<float> cfgDaughPIDCutsTPCPi{"cfgDaughPIDCutsTPCPi", 2., "max. TPCnSigma Pion"};
275+
Configurable<float> cfgDaughPIDCutsTOFPi{"cfgDaughPIDCutsTOFPi", 2., "max. TOFnSigma Pion"};
276+
277+
Configurable<float> cfgV0radiusMin{"cfgV0radiusMin", 1.2, "minimum decay radius"};
278+
Configurable<float> cfgDCAPosToPVMin{"cfgDCAPosToPVMin", 0.05, "minimum DCA to PV for positive track"};
279+
Configurable<float> cfgDCANegToPVMin{"cfgDCANegToPVMin", 0.2, "minimum DCA to PV for negative track"};
280+
Configurable<float> cfgV0CosPA{"cfgV0CosPA", 0.995, "minimum v0 cosine"};
281+
Configurable<float> cfgDCAV0Dau{"cfgDCAV0Dau", 1.0, "maximum DCA between daughters"};
282+
Configurable<float> cfgHypMassWindow{"cfgHypMassWindow", 0.5, "single lambda mass selection"};
283+
Configurable<float> cfgV0PtMin{"cfgV0PtMin", 0, "minimum pT for lambda"};
284+
Configurable<float> cfgV0LifeTime{"cfgV0LifeTime", 30., "maximum lambda lifetime"};
285+
Configurable<float> cfgPV{"cfgPV", 10., "maximum z-vertex"};
286+
Configurable<int> cfgMaxOccupancy{"cfgMaxOccupancy", 999999, "maximum occupancy of tracks in neighbouring collisions in a given time range"};
287+
Configurable<int> cfgMinOccupancy{"cfgMinOccupancy", 0, "maximum occupancy of tracks in neighbouring collisions in a given time range"};
288+
} cfgV0;
289+
268290
HfHelper hfHelper;
269291
SliceCache cache;
270292
Service<o2::framework::O2DatabasePDG> pdg;
293+
double massLambda = o2::constants::physics::MassLambda;
271294
int8_t chargeCand = 3;
272295
int8_t signSoftPion = 0;
273296
int leadingIndex = 0;
@@ -306,6 +329,7 @@ struct HfCorrelatorLcScHadrons {
306329
// Tracks used in Data and MC
307330
using TracksData = soa::Filtered<soa::Join<aod::TracksWDca, aod::TrackSelection, aod::TracksExtra, aod::pidTPCFullPi, aod::pidTPCFullKa, aod::pidTPCFullPr, aod::pidTOFFullPi, aod::pidTOFFullKa, aod::pidTOFFullPr>>; // trackFilter applied
308331
using TracksWithMc = soa::Filtered<soa::Join<aod::TracksWDca, aod::TrackSelection, aod::TracksExtra, o2::aod::McTrackLabels, aod::pidTPCFullPi, aod::pidTPCFullKa, aod::pidTPCFullPr, aod::pidTOFFullPi, aod::pidTOFFullKa, aod::pidTOFFullPr>>; // trackFilter applied
332+
309333
// Filters for ME
310334
Filter collisionFilter = aod::hf_selection_lc_collision::lcSel == true;
311335
Filter lcFilter = ((o2::aod::hf_track_index::hfflag & static_cast<uint8_t>(1 << aod::hf_cand_3prong::DecayType::LcToPKPi)) != static_cast<uint8_t>(0)) && (aod::hf_sel_candidate_lc::isSelLcToPKPi >= selectionFlagLc || aod::hf_sel_candidate_lc::isSelLcToPiKP >= selectionFlagLc);
@@ -345,6 +369,8 @@ struct HfCorrelatorLcScHadrons {
345369
AxisSpec axisPoolBin = {binsPoolBin, "PoolBin"};
346370
AxisSpec axisRapidity = {100, -2, 2, "Rapidity"};
347371
AxisSpec axisSign = {5, -2.5, 2.5, "Sign"};
372+
AxisSpec axisPtV0 = {500, 0., 50.0, "#it{p}_{T} (GeV/#it{c})"};
373+
AxisSpec axisMassV0 = {200, 0.9f, 1.2f, "inv. mass (p #pi) (GeV/#it{c}^{2})"};
348374

349375
registry.add("hPtCand", "Lc,Hadron candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPtLc}});
350376
registry.add("hPtProng0", "Lc,Hadron candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPtLc}});
@@ -403,6 +429,17 @@ struct HfCorrelatorLcScHadrons {
403429
registry.add("hPhiMcGen", "Lc,Hadron particles - MC Gen", {HistType::kTH1F, {axisPhi}});
404430
registry.add("hMultFT0AMcGen", "Lc,Hadron multiplicity FT0A - MC Gen", {HistType::kTH1F, {axisMultiplicity}});
405431

432+
// Lambda V0 histograms
433+
registry.add("hEventLambdaV0", "Lambda, events", {HistType::kTH1F, {{2, 0, 2}}});
434+
registry.add("hV0Lambda", "V0 Lambda candidates;inv. mass (p #pi) (GeV/#it{c}^{2});GeV/#it{c};GeV/#it{c}", {HistType::kTH3F, {{axisMassV0}, {axisPtV0}, {axisPtHadron}}});
435+
registry.add("hV0LambdaRefl", "V0 Lambda reflected candidates;inv. mass (p #pi) (GeV/#it{c}^{2});GeV/#it{c};GeV/#it{c}", {HistType::kTH3F, {{axisMassV0}, {axisPtV0}, {axisPtHadron}}});
436+
registry.add("hV0LambdaPiKRej", "V0 Lambda candidates with #pi K rejection;inv. mass (p #pi) (GeV/#it{c}^{2});GeV/#it{c};GeV/#it{c}", {HistType::kTH3F, {{axisMassV0}, {axisPtV0}, {axisPtHadron}}});
437+
registry.add("hV0LambdaReflPiKRej", "V0 Lambda reflected candidates with #pi K rejection;inv. mass (p #pi) (GeV/#it{c}^{2});GeV/#it{c};GeV/#it{c}", {HistType::kTH3F, {{axisMassV0}, {axisPtV0}, {axisPtHadron}}});
438+
registry.add("hV0LambdaMcRec", "McRec V0 Lambda candidates;inv. mass (p #pi) (GeV/#it{c}^{2});GeV/#it{c};GeV/#it{c}", {HistType::kTH3F, {{axisMassV0}, {axisPtV0}, {axisPtHadron}}});
439+
registry.add("hV0LambdaReflMcRec", "McRec V0 Lambda reflected candidates;inv. mass (p #pi) (GeV/#it{c}^{2});GeV/#it{c};GeV/#it{c}", {HistType::kTH3F, {{axisMassV0}, {axisPtV0}, {axisPtHadron}}});
440+
registry.add("hV0LambdaPiKRejMcRec", "McRec V0 Lambda candidates with #pi K rejection;inv. mass (p #pi) (GeV/#it{c}^{2});GeV/#it{c};GeV/#it{c}", {HistType::kTH3F, {{axisMassV0}, {axisPtV0}, {axisPtHadron}}});
441+
registry.add("hV0LambdaReflPiKRejMcRec", "McRec V0 Lambda reflected candidates with #pi K rejection;inv. mass (p #pi) (GeV/#it{c}^{2});GeV/#it{c};GeV/#it{c}", {HistType::kTH3F, {{axisMassV0}, {axisPtV0}, {axisPtHadron}}});
442+
406443
corrBinning = {{binsZVtx, binsMultiplicity}, true};
407444
}
408445

@@ -433,6 +470,159 @@ struct HfCorrelatorLcScHadrons {
433470
return y;
434471
}
435472

473+
template <typename TCollision, typename V0>
474+
bool selectionV0(TCollision const& collision, V0 const& candidate)
475+
{
476+
if (candidate.v0radius() < cfgV0.cfgV0radiusMin) {
477+
return false;
478+
}
479+
if (std::abs(candidate.dcapostopv()) < cfgV0.cfgDCAPosToPVMin) {
480+
return false;
481+
}
482+
if (std::abs(candidate.dcanegtopv()) < cfgV0.cfgDCANegToPVMin) {
483+
return false;
484+
}
485+
if (candidate.v0cosPA() < cfgV0.cfgV0CosPA) {
486+
return false;
487+
}
488+
if (std::abs(candidate.dcaV0daughters()) > cfgV0.cfgDCAV0Dau) {
489+
return false;
490+
}
491+
if (candidate.pt() < cfgV0.cfgV0PtMin) {
492+
return false;
493+
}
494+
if (std::abs(candidate.yLambda()) > yCandMax) {
495+
return false;
496+
}
497+
if (candidate.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * massLambda > cfgV0.cfgV0LifeTime) {
498+
return false;
499+
}
500+
501+
return true;
502+
}
503+
504+
template <typename T>
505+
bool isSelectedV0Daughter(T const& track, int pid)
506+
{
507+
// if (!track.isGlobalTrackWoDCA())
508+
// return false;
509+
if (std::abs(pid) == kProton && std::abs(track.tpcNSigmaPr()) > cfgV0.cfgDaughPIDCutsTPCPr) {
510+
return false;
511+
}
512+
if (std::abs(pid) == kPiPlus && std::abs(track.tpcNSigmaPi()) > cfgV0.cfgDaughPIDCutsTPCPi && std::abs(track.tofNSigmaPi()) > cfgV0.cfgDaughPIDCutsTOFPi) {
513+
return false;
514+
}
515+
if (std::abs(track.eta()) > etaTrackMax) {
516+
return false;
517+
}
518+
if (std::abs(pid) == kProton && track.pt() > cfgV0.cfgDaughPrPtMax) {
519+
return false;
520+
}
521+
if (std::abs(pid) == kProton && track.pt() < cfgV0.cfgDaughPrPtMin) {
522+
return false;
523+
}
524+
if (std::abs(pid) == kPiPlus && track.pt() > cfgV0.cfgDaughPiPtMax) {
525+
return false;
526+
}
527+
if (std::abs(pid) == kPiPlus && track.pt() < cfgV0.cfgDaughPiPtMin) {
528+
return false;
529+
}
530+
531+
return true;
532+
}
533+
534+
template <bool isMcRec = false, typename CollType, typename V0, typename TrackType>
535+
void fillV0Histograms(CollType const& collV0, V0 const& v0s, TrackType const&)
536+
{
537+
for (const auto& v0 : v0s) {
538+
539+
if (!selectionV0(collV0, v0)) {
540+
continue;
541+
}
542+
543+
auto posTrackV0 = v0.template posTrack_as<TrackType>();
544+
auto negTrackV0 = v0.template negTrack_as<TrackType>();
545+
546+
if (isSelectedV0Daughter(posTrackV0, kProton) && isSelectedV0Daughter(negTrackV0, kPiPlus)) {
547+
if (std::abs(massLambda - v0.mLambda()) < cfgV0.cfgHypMassWindow) {
548+
registry.fill(HIST("hV0Lambda"), v0.mLambda(), v0.pt(), posTrackV0.pt());
549+
registry.fill(HIST("hV0LambdaRefl"), v0.mAntiLambda(), v0.pt(), negTrackV0.pt());
550+
551+
if (passPIDSelection(posTrackV0, trkPIDspecies, pidTPCMax, pidTOFMax, tofPIDThreshold, forceTOF)) {
552+
registry.fill(HIST("hV0LambdaPiKRej"), v0.mLambda(), v0.pt(), posTrackV0.pt());
553+
registry.fill(HIST("hV0LambdaReflPiKRej"), v0.mAntiLambda(), v0.pt(), negTrackV0.pt());
554+
}
555+
}
556+
}
557+
if (isSelectedV0Daughter(negTrackV0, kProton) && isSelectedV0Daughter(posTrackV0, kPiPlus)) {
558+
if (std::abs(massLambda - v0.mAntiLambda()) > cfgV0.cfgHypMassWindow) {
559+
registry.fill(HIST("hV0Lambda"), v0.mAntiLambda(), v0.pt(), negTrackV0.pt());
560+
registry.fill(HIST("hV0LambdaRefl"), v0.mLambda(), v0.pt(), posTrackV0.pt());
561+
562+
if (passPIDSelection(negTrackV0, trkPIDspecies, pidTPCMax, pidTOFMax, tofPIDThreshold, forceTOF)) {
563+
registry.fill(HIST("hV0LambdaPiKRej"), v0.mAntiLambda(), v0.pt(), negTrackV0.pt());
564+
registry.fill(HIST("hV0LambdaReflPiKRej"), v0.mLambda(), v0.pt(), posTrackV0.pt());
565+
}
566+
}
567+
}
568+
if constexpr (isMcRec) {
569+
if (!v0.has_mcParticle() || !posTrackV0.has_mcParticle() || !negTrackV0.has_mcParticle()) {
570+
continue;
571+
}
572+
auto v0Mc = v0.mcParticle();
573+
auto posTrack = posTrackV0.mcParticle();
574+
auto negTrack = negTrackV0.mcParticle();
575+
576+
if (std::abs(v0Mc.pdgCode()) == kLambda0) {
577+
if (std::abs(posTrack.pdgCode()) == kProton) {
578+
registry.fill(HIST("hV0LambdaMcRec"), v0.mLambda(), v0.pt(), posTrackV0.pt());
579+
registry.fill(HIST("hV0LambdaReflMcRec"), v0.mAntiLambda(), v0.pt(), negTrackV0.pt());
580+
581+
if (passPIDSelection(posTrackV0, trkPIDspecies, pidTPCMax, pidTOFMax, tofPIDThreshold, forceTOF)) {
582+
registry.fill(HIST("hV0LambdaPiKRejMcRec"), v0.mLambda(), v0.pt(), posTrackV0.pt());
583+
registry.fill(HIST("hV0LambdaReflPiKRejMcRec"), v0.mAntiLambda(), v0.pt(), negTrackV0.pt());
584+
}
585+
}
586+
if (std::abs(negTrack.pdgCode()) == kProton) {
587+
registry.fill(HIST("hV0LambdaMcRec"), v0.mAntiLambda(), v0.pt(), negTrackV0.pt());
588+
registry.fill(HIST("hV0LambdaReflMcRec"), v0.mLambda(), v0.pt(), posTrackV0.pt());
589+
590+
if (passPIDSelection(negTrackV0, trkPIDspecies, pidTPCMax, pidTOFMax, tofPIDThreshold, forceTOF)) {
591+
registry.fill(HIST("hV0LambdaPiKRejMcRec"), v0.mAntiLambda(), v0.pt(), negTrackV0.pt());
592+
registry.fill(HIST("hV0LambdaReflPiKRejMcRec"), v0.mLambda(), v0.pt(), posTrackV0.pt());
593+
}
594+
}
595+
}
596+
}
597+
}
598+
}
599+
600+
template <typename TCollision>
601+
bool eventSelV0(TCollision collision)
602+
{
603+
if (!collision.sel8()) {
604+
return 0;
605+
}
606+
607+
if (!collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) {
608+
return 0;
609+
}
610+
if (!collision.selection_bit(aod::evsel::kNoSameBunchPileup)) {
611+
return 0;
612+
}
613+
if (std::abs(collision.posZ()) > cfgV0.cfgPV) {
614+
return 0;
615+
}
616+
if (!collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) {
617+
return 0;
618+
}
619+
if (collision.trackOccupancyInTimeRange() > cfgV0.cfgMaxOccupancy || collision.trackOccupancyInTimeRange() < cfgV0.cfgMinOccupancy) {
620+
return 0;
621+
}
622+
623+
return 1;
624+
} // event selection V0
625+
436626
template <typename T1, typename T2, typename McPart>
437627
void calculateTrkEff(T1 const& trackPos1, T2 const& trackPos2, McPart const& mcParticles)
438628
{
@@ -1189,6 +1379,32 @@ struct HfCorrelatorLcScHadrons {
11891379
}
11901380
}
11911381
PROCESS_SWITCH(HfCorrelatorLcScHadrons, processMcGenMixedEvent, "Process Mixed Event McGen", false);
1382+
1383+
void processDataLambdaV0(soa::Join<aod::Collisions, aod::EvSels>::iterator const& collision,
1384+
TracksData const& tracks, aod::V0Datas const& V0s)
1385+
{
1386+
registry.fill(HIST("hEventLambdaV0"), 0.5);
1387+
if (!eventSelV0(collision)) {
1388+
return;
1389+
}
1390+
registry.fill(HIST("hEventLambdaV0"), 1.5);
1391+
1392+
fillV0Histograms<false>(collision, V0s, tracks);
1393+
}
1394+
PROCESS_SWITCH(HfCorrelatorLcScHadrons, processDataLambdaV0, "Data process for v0 lambda", false);
1395+
1396+
void processMcLambdaV0(soa::Join<aod::Collisions, aod::EvSels>::iterator const& collision,
1397+
TracksWithMc const& tracks, soa::Join<aod::V0Datas, aod::McV0Labels> const& V0s, aod::McParticles const&)
1398+
{
1399+
registry.fill(HIST("hEventLambdaV0"), 0.5);
1400+
if (!eventSelV0(collision)) {
1401+
return;
1402+
}
1403+
registry.fill(HIST("hEventLambdaV0"), 1.5);
1404+
1405+
fillV0Histograms<true>(collision, V0s, tracks);
1406+
}
1407+
PROCESS_SWITCH(HfCorrelatorLcScHadrons, processMcLambdaV0, "Mc process for v0 lambda", false);
11921408
};
11931409

11941410
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)

0 commit comments

Comments
 (0)