Skip to content

Commit

Permalink
[PWGHF] Fixing bugs for Lc-H correlation (AliceO2Group#8799)
Browse files Browse the repository at this point in the history
Co-authored-by: Antonio Palasciano <[email protected]>
  • Loading branch information
zz951 and apalasciano authored Dec 7, 2024
1 parent 90b609c commit c231493
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 37 deletions.
56 changes: 29 additions & 27 deletions PWGHF/HFC/TableProducer/correlatorLcHadrons.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ struct HfCorrelatorLcHadronsSelection {
// filter on selection of Lc and decay channel Lc->PKPi
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);

/// Code to select collisions with at least one Lc - for real data and data-like analysis
void processLcSelectionData(SelCollisions::iterator const& collision,
CandidatesLcData const& candidates)
{
Expand Down Expand Up @@ -182,21 +183,11 @@ struct HfCorrelatorLcHadrons {
Configurable<std::vector<double>> binsPtHadron{"binsPtHadron", std::vector<double>{0.3, 2., 4., 8., 12., 50.}, "pT bin limits for assoc particle"};
Configurable<std::vector<double>> binsPtEfficiencyLc{"binsPtEfficiencyLc", std::vector<double>{o2::analysis::hf_cuts_lc_to_p_k_pi::vecBinsPt}, "pT bin limits for efficiency"};
Configurable<std::vector<double>> efficiencyLc{"efficiencyLc", {1., 1., 1., 1., 1., 1.}, "efficiency values for Lc"};
ConfigurableAxis binsMultiplicity{"binsMultiplicity", {VARIABLE_WIDTH, 0.0f, 2000.0f, 6000.0f, 100000.0f}, "Mixing bins - multiplicity"};
ConfigurableAxis binsZVtx{"binsZVtx", {VARIABLE_WIDTH, -10.0f, -2.5f, 2.5f, 10.0f}, "Mixing bins - z-vertex"};
ConfigurableAxis binsMultiplicityMc{"binsMultiplicityMc", {VARIABLE_WIDTH, 0.0f, 20.0f, 50.0f, 500.0f}, "Mixing bins - MC multiplicity"}; // In MCGen multiplicity is defined by counting tracks
ConfigurableAxis binsBdtScore{"binsBdtScore", {100, 0., 1.}, "Bdt output scores"};
ConfigurableAxis binsEta{"binsEta", {50, -2., 2.}, "#it{#eta}"};
ConfigurableAxis binsPhi{"binsPhi", {64, -PIHalf, 3. * PIHalf}, "#it{#varphi}"};
ConfigurableAxis binsPoolBin{"binsPoolBin", {9, 0., 9.}, "PoolBin"};
ConfigurableAxis binsMultFT0M{"binsMultFT0M", {600, 0., 6000.}, "Multiplicity as FT0M signal amplitude"};
ConfigurableAxis binsMassLc{"binsMassLc", {200, 1.98, 2.58}, "inv. mass (p K #pi) (GeV/#it{c}^{2})"};
Configurable<bool> storeAutoCorrelationFlag{"storeAutoCorrelationFlag", false, "Store flag that indicates if the track is paired to its Lc mother instead of skipping it"};
Configurable<bool> correlateLcWithLeadingParticle{"correlateLcWithLeadingParticle", false, "Switch for correlation of Lc baryons with leading particle only"};

HfHelper hfHelper;
SliceCache cache;
BinningType corrBinning{{binsZVtx, binsMultiplicity}, true};
int leadingIndex = 0;
bool correlationStatus = false;

Expand All @@ -218,6 +209,19 @@ struct HfCorrelatorLcHadrons {
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);
Filter trackFilter = (nabs(aod::track::eta) < etaTrackMax) && (nabs(aod::track::pt) > ptTrackMin) && (nabs(aod::track::dcaXY) < dcaXYTrackMax) && (nabs(aod::track::dcaZ) < dcaZTrackMax);

// configurable axis definition
ConfigurableAxis binsMultiplicity{"binsMultiplicity", {VARIABLE_WIDTH, 0.0f, 2000.0f, 6000.0f, 100000.0f}, "Mixing bins - multiplicity"};
ConfigurableAxis binsZVtx{"binsZVtx", {VARIABLE_WIDTH, -10.0f, -2.5f, 2.5f, 10.0f}, "Mixing bins - z-vertex"};
ConfigurableAxis binsMultiplicityMc{"binsMultiplicityMc", {VARIABLE_WIDTH, 0.0f, 20.0f, 50.0f, 500.0f}, "Mixing bins - MC multiplicity"}; // In MCGen multiplicity is defined by counting tracks
ConfigurableAxis binsBdtScore{"binsBdtScore", {100, 0., 1.}, "Bdt output scores"};
ConfigurableAxis binsEta{"binsEta", {50, -2., 2.}, "#it{#eta}"};
ConfigurableAxis binsPhi{"binsPhi", {64, -PIHalf, 3. * PIHalf}, "#it{#varphi}"};
ConfigurableAxis binsPoolBin{"binsPoolBin", {9, 0., 9.}, "PoolBin"};
ConfigurableAxis binsMultFT0M{"binsMultFT0M", {600, 0., 6000.}, "Multiplicity as FT0M signal amplitude"};
ConfigurableAxis binsMassLc{"binsMassLc", {200, 1.98, 2.58}, "inv. mass (p K #pi) (GeV/#it{c}^{2})"};

BinningType corrBinning{{binsZVtx, binsMultiplicity}, true};

HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject};
void init(InitContext&)
{
Expand All @@ -242,7 +246,7 @@ struct HfCorrelatorLcHadrons {
registry.add("hEta", "Lc,Hadron candidates;candidate #it{#eta};entries", {HistType::kTH1F, {axisEta}});
registry.add("hPhi", "Lc,Hadron candidates;candidate #it{#varphi};entries", {HistType::kTH1F, {axisPhi}});
registry.add("hY", "Lc,Hadron candidates;candidate #it{#y};entries", {HistType::kTH1F, {axisRapidity}});
registry.add("hcountLcHadronPerEvent", "Lc,Hadron particles - MC gen;Number per event;entries", {HistType::kTH1F, {{21, -0.5, 20.5}}});
registry.add("hCountLcHadronPerEvent", "Lc,Hadron particles - MC gen;Number per event;entries", {HistType::kTH1F, {{21, -0.5, 20.5}}});
registry.add("hMultiplicityPreSelection", "multiplicity prior to selection;multiplicity;entries", {HistType::kTH1F, {{10000, 0., 10000.}}});
registry.add("hMultiplicity", "multiplicity;multiplicity;entries", {HistType::kTH1F, {{10000, 0., 10000.}}});
registry.add("hMultFT0M", "multiplicity;multiplicity;entries", {HistType::kTH1F, {{10000, 0., 10000.}}});
Expand Down Expand Up @@ -293,6 +297,7 @@ struct HfCorrelatorLcHadrons {
corrBinning = {{binsZVtx, binsMultiplicity}, true};
}

/// Lc-hadron correlation pair builder - for real data and data-like analysis (i.e. reco-level w/o matching request via MC truth)
void processData(SelCollisionsWithLc::iterator const& collision,
TracksData const& tracks,
CandidatesLcData const& candidates)
Expand Down Expand Up @@ -409,7 +414,7 @@ struct HfCorrelatorLcHadrons {
cntLc++;
} // end outer Lc loop
registry.fill(HIST("hZvtx"), collision.posZ());
registry.fill(HIST("hMultT0M"), collision.multFT0M());
registry.fill(HIST("hMultFT0M"), collision.multFT0M());
}
PROCESS_SWITCH(HfCorrelatorLcHadrons, processData, "Process data", true);

Expand Down Expand Up @@ -486,7 +491,7 @@ struct HfCorrelatorLcHadrons {
registry.fill(HIST("hMassLcMcRec"), hfHelper.invMassLcToPKPi(candidate), efficiencyWeightLc);
registry.fill(HIST("hMassLcMcRecSig"), hfHelper.invMassLcToPKPi(candidate), candidate.pt(), efficiencyWeightLc);
registry.fill(HIST("hMassLcVsPtMcRec"), hfHelper.invMassLcToPKPi(candidate), candidate.pt(), efficiencyWeightLc);
registry.fill(HIST("hSelectionStatusMcRec"), candidate.isSelLcToPKPi());
registry.fill(HIST("hSelectionStatusLcToPKPiMcRec"), candidate.isSelLcToPKPi());
entryLcCandRecoInfo(hfHelper.invMassLcToPKPi(candidate), candidate.pt(), outputMl[0], outputMl[1]); // 0: BkgBDTScore, 1:PromptBDTScore
entryLcCandGenInfo(isLcPrompt);
}
Expand All @@ -504,7 +509,7 @@ struct HfCorrelatorLcHadrons {
registry.fill(HIST("hMassLcMcRec"), hfHelper.invMassLcToPiKP(candidate), efficiencyWeightLc);
registry.fill(HIST("hMassLcMcRecSig"), hfHelper.invMassLcToPiKP(candidate), candidate.pt(), efficiencyWeightLc);
registry.fill(HIST("hMassLcVsPtMcRec"), hfHelper.invMassLcToPiKP(candidate), candidate.pt(), efficiencyWeightLc);
registry.fill(HIST("hSelectionStatusMcRec"), candidate.isSelLcToPiKP());
registry.fill(HIST("hSelectionStatusLcToPiKPMcRec"), candidate.isSelLcToPiKP());
entryLcCandRecoInfo(hfHelper.invMassLcToPiKP(candidate), candidate.pt(), outputMl[0], outputMl[1]); // 0: BkgBDTScore, 1:PromptBDTScore
entryLcCandGenInfo(isLcPrompt);
}
Expand All @@ -521,7 +526,7 @@ struct HfCorrelatorLcHadrons {
registry.fill(HIST("hMassLcMcRec"), hfHelper.invMassLcToPKPi(candidate), efficiencyWeightLc);
registry.fill(HIST("hMassLcMcRecBkg"), hfHelper.invMassLcToPKPi(candidate), candidate.pt(), efficiencyWeightLc);
registry.fill(HIST("hMassLcVsPtMcRec"), hfHelper.invMassLcToPKPi(candidate), candidate.pt(), efficiencyWeightLc);
registry.fill(HIST("hSelectionStatusMcRec"), candidate.isSelLcToPKPi());
registry.fill(HIST("hSelectionStatusLcToPKPiMcRec"), candidate.isSelLcToPKPi());
}
if (candidate.isSelLcToPiKP() >= selectionFlagLc) {
for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) {
Expand All @@ -530,7 +535,7 @@ struct HfCorrelatorLcHadrons {
registry.fill(HIST("hMassLcMcRec"), hfHelper.invMassLcToPiKP(candidate), efficiencyWeightLc);
registry.fill(HIST("hMassLcMcRecBkg"), hfHelper.invMassLcToPiKP(candidate), candidate.pt(), efficiencyWeightLc);
registry.fill(HIST("hMassLcVsPtMcRec"), hfHelper.invMassLcToPiKP(candidate), candidate.pt(), efficiencyWeightLc);
registry.fill(HIST("hSelectionStatusMcRec"), candidate.isSelLcToPiKP());
registry.fill(HIST("hSelectionStatusLcToPiKPMcRec"), candidate.isSelLcToPiKP());
}
}
registry.fill(HIST("hLcBin"), poolBin);
Expand Down Expand Up @@ -612,11 +617,11 @@ struct HfCorrelatorLcHadrons {
} // end inner loop (Tracks)
} // end outer Lc loop
registry.fill(HIST("hZvtx"), collision.posZ());
registry.fill(HIST("hMultT0M"), collision.multFT0M());
registry.fill(HIST("hMultFT0M"), collision.multFT0M());
}
PROCESS_SWITCH(HfCorrelatorLcHadrons, processMcRec, "Process Mc Reco mode", false);

/// Lc-Hadron correlation pair builder - for Mc gen-level analysis
/// Lc-Hadron correlation pair builder - for Mc Gen-level analysis
void processMcGen(SelCollisionsWithLcMc::iterator const& mcCollision,
CandidatesLcMcGen const& mcParticles)
{
Expand All @@ -635,7 +640,7 @@ struct HfCorrelatorLcHadrons {
leadingIndex = findLeadingParticleMcGen(mcParticles, etaTrackMax.value, ptTrackMin.value);
}

// Mc gen level
// Mc Gen level
for (const auto& particle : mcParticles) {
if (std::abs(particle.pdgCode()) != Pdg::kLambdaCPlus) {
continue;
Expand Down Expand Up @@ -684,14 +689,14 @@ struct HfCorrelatorLcHadrons {
continue;
}
if (particleAssoc.globalIndex() == prongsId[0] || particleAssoc.globalIndex() == prongsId[1] || particleAssoc.globalIndex() == prongsId[2]) {
continue;
}
if ((std::abs(particleAssoc.pdgCode()) != kElectron) && (std::abs(particleAssoc.pdgCode()) != kMuonMinus) && (std::abs(particleAssoc.pdgCode()) != kPiPlus) && (std::abs(particle.pdgCode()) != kKPlus) && (std::abs(particleAssoc.pdgCode()) != kProton)) {
if (!storeAutoCorrelationFlag) {
continue;
}
correlationStatus = true;
}
if ((std::abs(particleAssoc.pdgCode()) != kElectron) && (std::abs(particleAssoc.pdgCode()) != kMuonMinus) && (std::abs(particleAssoc.pdgCode()) != kPiPlus) && (std::abs(particle.pdgCode()) != kKPlus) && (std::abs(particleAssoc.pdgCode()) != kProton)) {
continue;
}
if (!particleAssoc.isPhysicalPrimary()) {
continue;
}
Expand Down Expand Up @@ -723,9 +728,6 @@ struct HfCorrelatorLcHadrons {
CandidatesLcData const& candidates,
TracksData const& tracks)
{
if (candidates.size() == 0) {
return;
}
auto tracksTuple = std::make_tuple(candidates, tracks);
Pair<SelCollisionsWithLc, CandidatesLcData, TracksData, BinningType> pairData{corrBinning, numberEventsMixed, -1, collisions, tracksTuple, &cache};

Expand Down Expand Up @@ -819,8 +821,8 @@ struct HfCorrelatorLcHadrons {
int poolBin = corrBinning.getBin(std::make_tuple(c2.posZ(), c2.multFT0M()));
int poolBinLc = corrBinning.getBin(std::make_tuple(c1.posZ(), c1.multFT0M()));
registry.fill(HIST("hMultFT0M"), c1.multFT0M());
registry.fill(HIST("hZVtx"), c1.posZ());
registry.fill(HIST("TracksPoolBin"), poolBin);
registry.fill(HIST("hZvtx"), c1.posZ());
registry.fill(HIST("hTracksPoolBin"), poolBin);
registry.fill(HIST("hLcPoolBin"), poolBinLc);
for (const auto& [candidate, pAssoc] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) {
if (std::abs(hfHelper.yLc(candidate)) > yCandMax || candidate.pt() < ptCandMin || candidate.pt() > ptCandMax) {
Expand Down
Loading

0 comments on commit c231493

Please sign in to comment.