From c3913142b86396015126e599ed820328cb6cd6f8 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Tue, 2 Jun 2026 18:20:26 +0000 Subject: [PATCH] Please consider the following formatting changes --- PWGLF/Tasks/Resonances/chk892LI.cxx | 622 +++++++++++++--------------- 1 file changed, 299 insertions(+), 323 deletions(-) diff --git a/PWGLF/Tasks/Resonances/chk892LI.cxx b/PWGLF/Tasks/Resonances/chk892LI.cxx index dbbefde9c49..ecdc279d04a 100644 --- a/PWGLF/Tasks/Resonances/chk892LI.cxx +++ b/PWGLF/Tasks/Resonances/chk892LI.cxx @@ -16,7 +16,7 @@ /// \author Su-Jeong Ji , Bong-Hwi Lim #include "PWGLF/DataModel/LFStrangenessTables.h" -//#include "PWGLF/DataModel/mcCentrality.h" +// #include "PWGLF/DataModel/mcCentrality.h" #include "PWGLF/Utils/collisionCuts.h" #include "PWGLF/Utils/inelGt.h" @@ -116,13 +116,13 @@ struct Chk892LI { using MCTrackCandidates = soa::Join; //, aod::McParticles>; using MCV0Candidates = soa::Join; - Preslice perCollision = aod::track::collisionId; - Preslice perCollisionV0 = aod::v0data::collisionId; - Preslice perCollisionMC = aod::track::collisionId; - PresliceUnsorted perMcRecoCollision = aod::mccollisionlabel::mcCollisionId; + Preslice perCollision = aod::track::collisionId; + Preslice perCollisionV0 = aod::v0data::collisionId; + Preslice perCollisionMC = aod::track::collisionId; + PresliceUnsorted perMcRecoCollision = aod::mccollisionlabel::mcCollisionId; // for MC truth - using MCTrueEventCandidates = aod::McCollisions; + using MCTrueEventCandidates = aod::McCollisions; using MCTrueTrackCandidates = aod::McParticles; using LorentzVectorSetXYZM = ROOT::Math::LorentzVector>; @@ -146,8 +146,8 @@ struct Chk892LI { Configurable cNbinsDiv{"cNbinsDiv", 1, "Integer to divide the number of bins"}; Configurable cNbinsDivQA{"cNbinsDivQA", 1, "Integer to divide the number of bins for QA"}; - Configurable> cfgGenMultCuts{"cfgGenMultCuts", std::vector{500, 300, 200, 120, 80, 50, 30, 10, 0}, "Generated multiplicity lower cuts corresponding to reco centrality bins"}; - Configurable> cfgCentBinCentres{"cfgCentBinCentres", std::vector{2.5, 7.5, 15.0, 25.0, 35.0, 45.0, 55.0, 75.0, 95.0}, "Reco centrality bin centres"}; + Configurable> cfgGenMultCuts{"cfgGenMultCuts", std::vector{500, 300, 200, 120, 80, 50, 30, 10, 0}, "Generated multiplicity lower cuts corresponding to reco centrality bins"}; + Configurable> cfgCentBinCentres{"cfgCentBinCentres", std::vector{2.5, 7.5, 15.0, 25.0, 35.0, 45.0, 55.0, 75.0, 95.0}, "Reco centrality bin centres"}; } AxisConfig; /// Event cuts @@ -180,7 +180,7 @@ struct Chk892LI { /// PID Selections, pion struct : ConfigurableGroup { - Configurable cfgTPConly{"cfgTPConly", true, "Use only TPC for PID"}; // bool + Configurable cfgTPConly{"cfgTPConly", true, "Use only TPC for PID"}; // bool Configurable cfgMaxTPCnSigmaPion{"cfgMaxTPCnSigmaPion", 5.0, "TPC nSigma cut for Pion"}; // TPC Configurable cfgMaxTOFnSigmaPion{"cfgMaxTOFnSigmaPion", 5.0, "TOF nSigma cut for Pion"}; // TOF Configurable cfgNsigmaCutCombinedPion{"cfgNsigmaCutCombinedPion", -999, "Combined nSigma cut for Pion"}; // Combined @@ -258,8 +258,8 @@ struct Chk892LI { Configurable cfgTruthUseInelGt0{"cfgTruthUseInelGt0", false, "Truth denominator: require INEL>0"}; Configurable cfgTruthIncludeZvtx{"cfgTruthIncludeZvtx", false, "Truth denominator: also require |vtxz| cfgGenMultEtaMax{"cfgGenMultEtaMax", 0.5, "Max Eta for generated mid-rapidity multiplicity"}; - Configurable cfgGenMultEtaMin{"cfgGenMultEtaMin", -0.5, "Min Eta for generated mid-rapidity multiplicity"}; + Configurable cfgGenMultEtaMax{"cfgGenMultEtaMax", 0.5, "Max Eta for generated mid-rapidity multiplicity"}; + Configurable cfgGenMultEtaMin{"cfgGenMultEtaMin", -0.5, "Min Eta for generated mid-rapidity multiplicity"}; float lCentrality; @@ -268,7 +268,7 @@ struct Chk892LI { int kPDGK0 = kK0; int kKstarPlus = o2::constants::physics::Pdg::kKPlusStar892; // int kPiPlus = 211; - double fMaxPosPV = 1e-2; + double fMaxPosPV = 1e-2; void init(o2::framework::InitContext&) { @@ -428,7 +428,7 @@ struct Chk892LI { // MC if (doprocessMC) { - AxisSpec genMultAxis{500, -0.5, 499.5, "N_{ch}^{gen} (|#eta|<0.5)"}; + AxisSpec genMultAxis{500, -0.5, 499.5, "N_{ch}^{gen} (|#eta|<0.5)"}; histos.add("QACent_woCut", "Centrality without cut", HistType::kTH1F, {centAxis}); histos.add("QACent_woCentCut", "Centrality without cent cut", HistType::kTH1F, {centAxis}); @@ -453,17 +453,15 @@ struct Chk892LI { histos.add("Correction/sigLoss_num_pri_pos", "Gen primary Kstar selected by vertex position (|y|<0.5, selected events) in reco class", HistType::kTH2F, {ptAxis, centAxis}); histos.add("Correction/EF_den", "Gen events (truth class)", HistType::kTH1F, {centAxis}); histos.add("Correction/EF_num", "Reco events (selected events)", HistType::kTH1F, {centAxis}); - histos.add("Correction/RecoCentVsGenMult", "Reco centrality vs generated mid-rapidity multiplicity", HistType::kTH2F, {centAxis, genMultAxis}); - histos.add("Correction/sigLoss_num_vsGenMult","Generated Kstar in selected events vs gen mult", HistType::kTH2F, {ptAxis, genMultAxis}); - histos.add("Correction/sigLoss_num_vsGenMult_pri","Generated Kstar in selected events vs gen mult", HistType::kTH2F, {ptAxis, genMultAxis}); - histos.add("Correction/sigLoss_num_vsGenMult_pri_pos","Generated Kstar in selected events vs gen mult", HistType::kTH2F, {ptAxis, genMultAxis}); - histos.add("Correction/sigLoss_den_vsGenMult","Generated Kstar vs generated mid-rapidity multiplicity",HistType::kTH2F,{ptAxis, genMultAxis}); - histos.add("Correction/sigLoss_den_vsGenMult_pri","Generated primary Kstar vs generated mid-rapidity multiplicity",HistType::kTH2F,{ptAxis, genMultAxis}); - histos.add("Correction/sigLoss_den_vsGenMult_pri_pos","Generated primary Kstar selected by vertex position vs generated mid-rapidity multiplicity",HistType::kTH2F,{ptAxis, genMultAxis}); - histos.add("Correction/EF_num_vsGenMult", "Selected reco-associated events vs gen mult",HistType::kTH1F,{genMultAxis}); - histos.add("Correction/EF_den_vsGenMult", "Truth selected generated events vs generated multiplicity",HistType::kTH1F,{genMultAxis}); - - + histos.add("Correction/RecoCentVsGenMult", "Reco centrality vs generated mid-rapidity multiplicity", HistType::kTH2F, {centAxis, genMultAxis}); + histos.add("Correction/sigLoss_num_vsGenMult", "Generated Kstar in selected events vs gen mult", HistType::kTH2F, {ptAxis, genMultAxis}); + histos.add("Correction/sigLoss_num_vsGenMult_pri", "Generated Kstar in selected events vs gen mult", HistType::kTH2F, {ptAxis, genMultAxis}); + histos.add("Correction/sigLoss_num_vsGenMult_pri_pos", "Generated Kstar in selected events vs gen mult", HistType::kTH2F, {ptAxis, genMultAxis}); + histos.add("Correction/sigLoss_den_vsGenMult", "Generated Kstar vs generated mid-rapidity multiplicity", HistType::kTH2F, {ptAxis, genMultAxis}); + histos.add("Correction/sigLoss_den_vsGenMult_pri", "Generated primary Kstar vs generated mid-rapidity multiplicity", HistType::kTH2F, {ptAxis, genMultAxis}); + histos.add("Correction/sigLoss_den_vsGenMult_pri_pos", "Generated primary Kstar selected by vertex position vs generated mid-rapidity multiplicity", HistType::kTH2F, {ptAxis, genMultAxis}); + histos.add("Correction/EF_num_vsGenMult", "Selected reco-associated events vs gen mult", HistType::kTH1F, {genMultAxis}); + histos.add("Correction/EF_den_vsGenMult", "Truth selected generated events vs generated multiplicity", HistType::kTH1F, {genMultAxis}); histos.add("Correction/MCTruthCent_all", "MC truth FT0M centrality (all mcCollisions)", HistType::kTH1F, {centAxis}); histos.add("Correction/MCTruthCent_allowed", "MC truth FT0M centrality (allowed mcCollisions)", HistType::kTH1F, {centAxis}); @@ -485,7 +483,6 @@ struct Chk892LI { histos.add("MCReco/hInvmass_Kstar_true", "MC-reco truth-tagged chK(892)", HistType::kTHnSparseD, {centAxis, ptAxis, invMassAxisReso}); histos.add("MCReco/hInvmass_Kstar_bkg", "MC-reco residual background chK(892)", HistType::kTHnSparseD, {centAxis, ptAxis, invMassAxisReso}); - } ccdb->setURL(CCDBConfig.cfgURL); @@ -511,61 +508,59 @@ struct Chk892LI { return collision.centFT0C(); } else if (cfgCentEst == kCentFT0M) { return collision.centFT0M(); - } else if (cfgCentEst == kCentFV0A) { - return collision.centFV0A(); + } else if (cfgCentEst == kCentFV0A) { + return collision.centFV0A(); } else { return kInvalidCentrality; } } - template + template int getGenMidRapMultiplicity(McPartsT const& partsThisMc) { - int nCh = 0; - - for (auto const& part : partsThisMc) { - if (!part.isPhysicalPrimary()) { - continue; - } - if (part.eta() > cfgGenMultEtaMax || part.eta() < cfgGenMultEtaMin){ - continue; - } + int nCh = 0; - auto pdgParticle = pdg->GetParticle(part.pdgCode()); - if (!pdgParticle) { - continue; - } - if (pdgParticle->Charge() == 0) { - continue; - } - - nCh++; - } + for (auto const& part : partsThisMc) { + if (!part.isPhysicalPrimary()) { + continue; + } + if (part.eta() > cfgGenMultEtaMax || part.eta() < cfgGenMultEtaMin) { + continue; + } - return nCh; - } + auto pdgParticle = pdg->GetParticle(part.pdgCode()); + if (!pdgParticle) { + continue; + } + if (pdgParticle->Charge() == 0) { + continue; + } + nCh++; + } - float getCentClassFromGenMult(int nCh) - { - const auto& cuts = AxisConfig.cfgGenMultCuts.value; - const auto& centres = AxisConfig.cfgCentBinCentres.value; + return nCh; + } - if (cuts.size() != centres.size()) { - LOGF(fatal, - "cfgGenMultCuts size (%zu) and cfgCentBinCentres size (%zu) must be same", - cuts.size(), centres.size()); - } + float getCentClassFromGenMult(int nCh) + { + const auto& cuts = AxisConfig.cfgGenMultCuts.value; + const auto& centres = AxisConfig.cfgCentBinCentres.value; - for (size_t i = 0; i < cuts.size(); ++i) { - if (nCh >= cuts[i]) { - return centres[i]; - } - } + if (cuts.size() != centres.size()) { + LOGF(fatal, + "cfgGenMultCuts size (%zu) and cfgCentBinCentres size (%zu) must be same", + cuts.size(), centres.size()); + } - return kInvalidCentrality; - } + for (size_t i = 0; i < cuts.size(); ++i) { + if (nCh >= cuts[i]) { + return centres[i]; + } + } + return kInvalidCentrality; + } // Track selection template @@ -612,8 +607,8 @@ struct Chk892LI { if (std::abs(track.dcaXY()) > TrackCuts.cfgMaxbDCArToPVcut) return false; } - if (TrackCuts.cfgpTdepDCAzCut) { - // Tuned on the LHC22f anchored MC LHC23d1d on primary pions. 7 Sigmas of the resolution + if (TrackCuts.cfgpTdepDCAzCut) { + // Tuned on the LHC22f anchored MC LHC23d1d on primary pions. 7 Sigmas of the resolution if (std::abs(track.dcaZ()) > (0.004 + (0.013 / track.pt()))) return false; } else { @@ -797,128 +792,126 @@ struct Chk892LI { allowedMcIds.clear(); centTruthByAllowed.clear(); - for (const auto& mcColl : mcCollisions) { + for (const auto& mcColl : mcCollisions) { const auto mcid = mcColl.globalIndex(); - if (doprocessMC) { + if (doprocessMC) { histos.fill(HIST("QAvtxz_woCut"), mcColl.posZ()); - } - if (cfgTruthIncludeZvtx && std::abs(mcColl.posZ()) >= EventCuts.cfgEvtZvtx) { + } + if (cfgTruthIncludeZvtx && std::abs(mcColl.posZ()) >= EventCuts.cfgEvtZvtx) { continue; - } - if (doprocessMC) { + } + if (doprocessMC) { histos.fill(HIST("QAvtxz_wVtxzCut"), mcColl.posZ()); - } - - auto groupedCollisions = events.sliceBy(perMcRecoCollision, mcid); - - bool atLeastOneMatch = false; - int biggestNContribs = -1; - float bestCent = kInvalidCentrality; - - for (auto const& coll : groupedCollisions) { - const float lCentrality = getCentrality(coll); - if (lCentrality == kInvalidCentrality) - continue; - - if (doprocessMC) { - histos.fill(HIST("QACent_woCut"), lCentrality); - } - - if (!colCuts.isSelected(coll)) { - continue; - } - if (EventCuts.cfgEvtUseRCTFlagChecker && !rctChecker(coll)) { - continue; - } - if (cfgRecoUseInelGt0 && !coll.isInelGt0()) { - continue; - } - - if (doprocessMC) { - histos.fill(HIST("QACent_woCentCut"), lCentrality); - } - - atLeastOneMatch = true; - - // choose best collision by largest number of PV contributors - const int nContrib = coll.multPVTotalContributors(); - if (nContrib > biggestNContribs) { - biggestNContribs = nContrib; - bestCent = lCentrality; - } - } - - if (!atLeastOneMatch || bestCent == kInvalidCentrality) { - continue; - } - - auto partsThisMc = mcparts.sliceBy(perMCCollision, mcid); - const int genMult = getGenMidRapMultiplicity(partsThisMc); - const float genCentClass = getCentClassFromGenMult(genMult); - - if (genCentClass == kInvalidCentrality) - continue; - - if (genCentClass < EventCuts.cfgEventCentralityMin || genCentClass > EventCuts.cfgEventCentralityMax) { - continue; - } - - if (doprocessMC) { - histos.fill(HIST("QACent_wCentCut"), bestCent); - } - - allowedMcIds.insert(mcid); - centTruthByAllowed.emplace(mcid, genCentClass); - genMultByMcId[mcid] = genMult; - - if (doprocessMC) { - histos.fill(HIST("Correction/EF_num_vsGenMult"), genMult); - histos.fill(HIST("Correction/RecoCentVsGenMult"), bestCent, genMult); - histos.fill(HIST("QAMCCent_allowed"), genCentClass); - } - } - }//buildAllowedMcIds + } + + auto groupedCollisions = events.sliceBy(perMcRecoCollision, mcid); + + bool atLeastOneMatch = false; + int biggestNContribs = -1; + float bestCent = kInvalidCentrality; + + for (auto const& coll : groupedCollisions) { + const float lCentrality = getCentrality(coll); + if (lCentrality == kInvalidCentrality) + continue; + + if (doprocessMC) { + histos.fill(HIST("QACent_woCut"), lCentrality); + } + if (!colCuts.isSelected(coll)) { + continue; + } + if (EventCuts.cfgEvtUseRCTFlagChecker && !rctChecker(coll)) { + continue; + } + if (cfgRecoUseInelGt0 && !coll.isInelGt0()) { + continue; + } + + if (doprocessMC) { + histos.fill(HIST("QACent_woCentCut"), lCentrality); + } + + atLeastOneMatch = true; + + // choose best collision by largest number of PV contributors + const int nContrib = coll.multPVTotalContributors(); + if (nContrib > biggestNContribs) { + biggestNContribs = nContrib; + bestCent = lCentrality; + } + } + + if (!atLeastOneMatch || bestCent == kInvalidCentrality) { + continue; + } + + auto partsThisMc = mcparts.sliceBy(perMCCollision, mcid); + const int genMult = getGenMidRapMultiplicity(partsThisMc); + const float genCentClass = getCentClassFromGenMult(genMult); + + if (genCentClass == kInvalidCentrality) + continue; + + if (genCentClass < EventCuts.cfgEventCentralityMin || genCentClass > EventCuts.cfgEventCentralityMax) { + continue; + } + + if (doprocessMC) { + histos.fill(HIST("QACent_wCentCut"), bestCent); + } + + allowedMcIds.insert(mcid); + centTruthByAllowed.emplace(mcid, genCentClass); + genMultByMcId[mcid] = genMult; + + if (doprocessMC) { + histos.fill(HIST("Correction/EF_num_vsGenMult"), genMult); + histos.fill(HIST("Correction/RecoCentVsGenMult"), bestCent, genMult); + histos.fill(HIST("QAMCCent_allowed"), genCentClass); + } + } + } // buildAllowedMcIds template void buildReferenceMcIds(McCollsT const& mccolls, McPartsT const& mcparts) { - refClassIds.clear(); - refCentByMcId.clear(); + refClassIds.clear(); + refCentByMcId.clear(); - for (const auto& coll : mccolls) { - const auto mcid = coll.globalIndex(); + for (const auto& coll : mccolls) { + const auto mcid = coll.globalIndex(); - if (cfgTruthIncludeZvtx && std::abs(coll.posZ()) >= EventCuts.cfgEvtZvtx) { - continue; - } - - auto partsThisMc = mcparts.sliceBy(perMCCollision, mcid); + if (cfgTruthIncludeZvtx && std::abs(coll.posZ()) >= EventCuts.cfgEvtZvtx) { + continue; + } - if (cfgTruthUseInelGt0 && !pwglf::isINELgtNmc(partsThisMc, 0, pdg)) { - continue; - } + auto partsThisMc = mcparts.sliceBy(perMCCollision, mcid); - const int genMult = getGenMidRapMultiplicity(partsThisMc); - const float genCentClass = getCentClassFromGenMult(genMult); + if (cfgTruthUseInelGt0 && !pwglf::isINELgtNmc(partsThisMc, 0, pdg)) { + continue; + } - if (genCentClass == kInvalidCentrality) { - continue; - } - if (genCentClass < EventCuts.cfgEventCentralityMin || genCentClass > EventCuts.cfgEventCentralityMax) { - continue; - } + const int genMult = getGenMidRapMultiplicity(partsThisMc); + const float genCentClass = getCentClassFromGenMult(genMult); - refClassIds.insert(mcid); - refCentByMcId.emplace(mcid, genCentClass); - genMultByMcId[mcid] = genMult; + if (genCentClass == kInvalidCentrality) { + continue; + } + if (genCentClass < EventCuts.cfgEventCentralityMin || genCentClass > EventCuts.cfgEventCentralityMax) { + continue; + } - histos.fill(HIST("Correction/EF_den_vsGenMult"), genMult); + refClassIds.insert(mcid); + refCentByMcId.emplace(mcid, genCentClass); + genMultByMcId[mcid] = genMult; - }//for - }//buildReferenceMcIds + histos.fill(HIST("Correction/EF_den_vsGenMult"), genMult); + } // for + } // buildReferenceMcIds void effK0sProcessGen(MCTrueTrackCandidates const& mcparts) { @@ -959,11 +952,11 @@ struct Chk892LI { if (allowedMcIds.count(mcid) == 0) continue; - auto iter = centTruthByAllowed.find(mcid); - if (iter == centTruthByAllowed.end()) { + auto iter = centTruthByAllowed.find(mcid); + if (iter == centTruthByAllowed.end()) { continue; - } - const float lCentrality = iter->second; + } + const float lCentrality = iter->second; const double ptreco = v0.pt(); const double yreco = v0.yK0Short(); @@ -1039,7 +1032,6 @@ struct Chk892LI { return true; } // matchRecoToTruthKstar - void effKstarProcessGen(MCTrueEventCandidates const&, MCTrueTrackCandidates const& mcparts) { for (const auto& part : mcparts) { @@ -1047,47 +1039,40 @@ struct Chk892LI { continue; if (std::abs(part.pdgCode()) != kKstarPlus) continue; - if (part.y() < KstarCuts.cfgKstarMinRap || part.y() > KstarCuts.cfgKstarMaxRap) - continue; - - - const int pionWanted = (part.pdgCode() > 0) ? +kPiPlus : -kPiPlus; - bool hasRightPion = false; - bool hasK0sToPipi = false; - - for (const auto& d1 : part.template daughters_as()) { - const int pdg1 = d1.pdgCode(); - if (pdg1 == pionWanted) - { - hasRightPion = true; - } else if (std::abs(pdg1) == kPDGK0) - { - for (const auto& d2 : d1.template daughters_as()) - { - if (std::abs(d2.pdgCode()) == kPDGK0s) - { - bool seenPip = false, seenPim = false; - for (const auto& d3 : d2.template daughters_as()) - { - if (d3.pdgCode() == +kPiPlus) - seenPip = true; - else if (d3.pdgCode() == -kPiPlus) - seenPim = true; - } - if (seenPip && seenPim) - { - hasK0sToPipi = true; - break; - } - } - } - } - if (hasRightPion && hasK0sToPipi) break; - } - - if (!(hasRightPion && hasK0sToPipi)) - continue; + if (part.y() < KstarCuts.cfgKstarMinRap || part.y() > KstarCuts.cfgKstarMaxRap) + continue; + + const int pionWanted = (part.pdgCode() > 0) ? +kPiPlus : -kPiPlus; + bool hasRightPion = false; + bool hasK0sToPipi = false; + + for (const auto& d1 : part.template daughters_as()) { + const int pdg1 = d1.pdgCode(); + if (pdg1 == pionWanted) { + hasRightPion = true; + } else if (std::abs(pdg1) == kPDGK0) { + for (const auto& d2 : d1.template daughters_as()) { + if (std::abs(d2.pdgCode()) == kPDGK0s) { + bool seenPip = false, seenPim = false; + for (const auto& d3 : d2.template daughters_as()) { + if (d3.pdgCode() == +kPiPlus) + seenPip = true; + else if (d3.pdgCode() == -kPiPlus) + seenPim = true; + } + if (seenPip && seenPim) { + hasK0sToPipi = true; + break; + } + } + } + } + if (hasRightPion && hasK0sToPipi) + break; + } + if (!(hasRightPion && hasK0sToPipi)) + continue; const auto mcid = part.mcCollisionId(); if (allowedMcIds.count(mcid) == 0) @@ -1098,28 +1083,26 @@ struct Chk892LI { continue; const float lCentrality = iter->second; - + histos.fill(HIST("EffKstar/genKstar"), part.pt(), lCentrality); - if (part.vt() == 0) - { - histos.fill(HIST("EffKstar/genKstar_pri"), part.pt(), lCentrality); - } + if (part.vt() == 0) { + histos.fill(HIST("EffKstar/genKstar_pri"), part.pt(), lCentrality); + } - const auto mcc = part.mcCollision_as(); + const auto mcc = part.mcCollision_as(); - const float dx = part.vx() - mcc.posX(); - const float dy = part.vy() - mcc.posY(); - const float dz = part.vz() - mcc.posZ(); + const float dx = part.vx() - mcc.posX(); + const float dy = part.vy() - mcc.posY(); + const float dz = part.vz() - mcc.posZ(); - const float distanceFromPV = std::sqrt(dx*dx + dy*dy + dz*dz); + const float distanceFromPV = std::sqrt(dx * dx + dy * dy + dz * dz); - if (distanceFromPV < fMaxPosPV) - { - histos.fill(HIST("EffKstar/genKstar_pri_pos"), part.pt(), lCentrality); - } + if (distanceFromPV < fMaxPosPV) { + histos.fill(HIST("EffKstar/genKstar_pri_pos"), part.pt(), lCentrality); + } } - } //effKstarProcessGen + } // effKstarProcessGen template void effKstarProcessReco(V0RangeT const& v0s, TrkRangeT const& tracks) @@ -1136,12 +1119,12 @@ struct Chk892LI { if (allowedMcIds.count(mcid) == 0) continue; - auto iter = centTruthByAllowed.find(mcid); - if (iter == centTruthByAllowed.end()) { + auto iter = centTruthByAllowed.find(mcid); + if (iter == centTruthByAllowed.end()) { continue; - } + } - const float lCentrality = iter->second; + const float lCentrality = iter->second; if (!SecondaryCuts.cfgByPassDauPIDSelection) { auto posDauTrack = v0.template posTrack_as(); @@ -1154,13 +1137,12 @@ struct Chk892LI { if (!selectionK0s(coll, v0)) continue; - auto trks = tracks.sliceBy(perCollisionMC, v0.collisionId()); for (const auto& bTrack : trks) { if (bTrack.collisionId() != v0.collisionId()) continue; - if (!trackCut(bTrack)) + if (!trackCut(bTrack)) continue; if (!selectionPIDPion(bTrack)) continue; @@ -1173,8 +1155,8 @@ struct Chk892LI { const double ptreco = lResoKstar.Pt(); const double yreco = lResoKstar.Rapidity(); - if (yreco < KstarCuts.cfgKstarMinRap || yreco > KstarCuts.cfgKstarMaxRap) - continue; + if (yreco < KstarCuts.cfgKstarMinRap || yreco > KstarCuts.cfgKstarMaxRap) + continue; double ptgen = 0, ygen = 0; const bool isTrue = matchRecoToTruthKstar(v0, bTrack, ptgen, ygen); @@ -1187,7 +1169,7 @@ struct Chk892LI { } } } - } // effKstarProcessReco + } // effKstarProcessReco void fillSigLossNum(MCTrueEventCandidates const&, MCTrueTrackCandidates const& mcparts) { @@ -1196,8 +1178,8 @@ struct Chk892LI { continue; if (std::abs(part.pdgCode()) != kKstarPlus) continue; - if (part.y() < KstarCuts.cfgKstarMinRap || part.y() > KstarCuts.cfgKstarMaxRap) - continue; + if (part.y() < KstarCuts.cfgKstarMinRap || part.y() > KstarCuts.cfgKstarMaxRap) + continue; const auto mcid = part.mcCollisionId(); if (allowedMcIds.count(mcid) == 0) @@ -1209,35 +1191,33 @@ struct Chk892LI { const float lCentrality = iter->second; - auto itMult = genMultByMcId.find(mcid); - if (itMult != genMultByMcId.end()){ - histos.fill(HIST("Correction/sigLoss_num_vsGenMult"),part.pt(),itMult->second); - } + auto itMult = genMultByMcId.find(mcid); + if (itMult != genMultByMcId.end()) { + histos.fill(HIST("Correction/sigLoss_num_vsGenMult"), part.pt(), itMult->second); + } histos.fill(HIST("Correction/sigLoss_num"), part.pt(), lCentrality); - if (part.vt() == 0) - { - if (itMult != genMultByMcId.end()){ - histos.fill(HIST("Correction/sigLoss_num_vsGenMult_pri"),part.pt(),itMult->second); - } - histos.fill(HIST("Correction/sigLoss_num_pri"), part.pt(), lCentrality); - } - - const auto mcc = part.mcCollision_as(); - - const float dx = part.vx() - mcc.posX(); - const float dy = part.vy() - mcc.posY(); - const float dz = part.vz() - mcc.posZ(); - - const float distanceFromPV = std::sqrt(dx*dx + dy*dy + dz*dz); - - if (distanceFromPV < fMaxPosPV) - { - if (itMult != genMultByMcId.end()){ - histos.fill(HIST("Correction/sigLoss_num_vsGenMult_pri_pos"),part.pt(),itMult->second); - } - histos.fill(HIST("Correction/sigLoss_num_pri_pos"), part.pt(), lCentrality); - } + if (part.vt() == 0) { + if (itMult != genMultByMcId.end()) { + histos.fill(HIST("Correction/sigLoss_num_vsGenMult_pri"), part.pt(), itMult->second); + } + histos.fill(HIST("Correction/sigLoss_num_pri"), part.pt(), lCentrality); + } + + const auto mcc = part.mcCollision_as(); + + const float dx = part.vx() - mcc.posX(); + const float dy = part.vy() - mcc.posY(); + const float dz = part.vz() - mcc.posZ(); + + const float distanceFromPV = std::sqrt(dx * dx + dy * dy + dz * dz); + + if (distanceFromPV < fMaxPosPV) { + if (itMult != genMultByMcId.end()) { + histos.fill(HIST("Correction/sigLoss_num_vsGenMult_pri_pos"), part.pt(), itMult->second); + } + histos.fill(HIST("Correction/sigLoss_num_pri_pos"), part.pt(), lCentrality); + } } } // fillSigLossNum @@ -1248,8 +1228,8 @@ struct Chk892LI { continue; if (std::abs(part.pdgCode()) != kKstarPlus) continue; - if (part.y() < KstarCuts.cfgKstarMinRap || part.y() > KstarCuts.cfgKstarMaxRap) - continue; + if (part.y() < KstarCuts.cfgKstarMinRap || part.y() > KstarCuts.cfgKstarMaxRap) + continue; const auto mcid = part.mcCollisionId(); if (refClassIds.count(mcid) == 0) @@ -1263,33 +1243,31 @@ struct Chk892LI { histos.fill(HIST("Correction/sigLoss_den"), part.pt(), lCentrality); - auto itMult = genMultByMcId.find(mcid); - if (itMult != genMultByMcId.end()) { - histos.fill(HIST("Correction/sigLoss_den_vsGenMult"), part.pt(), itMult->second); - } - if (part.vt() == 0) - { - histos.fill(HIST("Correction/sigLoss_den_pri"), part.pt(), lCentrality); - if (itMult != genMultByMcId.end()) { - histos.fill(HIST("Correction/sigLoss_den_vsGenMult_pri"), part.pt(), itMult->second); - } - } - - const auto mcc = part.mcCollision_as(); - - const float dx = part.vx() - mcc.posX(); - const float dy = part.vy() - mcc.posY(); - const float dz = part.vz() - mcc.posZ(); - - const float distanceFromPV = std::sqrt(dx*dx + dy*dy + dz*dz); - - if (distanceFromPV < fMaxPosPV) - { - histos.fill(HIST("Correction/sigLoss_den_pri_pos"), part.pt(), lCentrality); - if (itMult != genMultByMcId.end()) { - histos.fill(HIST("Correction/sigLoss_den_vsGenMult_pri_pos"), part.pt(), itMult->second); - } - } + auto itMult = genMultByMcId.find(mcid); + if (itMult != genMultByMcId.end()) { + histos.fill(HIST("Correction/sigLoss_den_vsGenMult"), part.pt(), itMult->second); + } + if (part.vt() == 0) { + histos.fill(HIST("Correction/sigLoss_den_pri"), part.pt(), lCentrality); + if (itMult != genMultByMcId.end()) { + histos.fill(HIST("Correction/sigLoss_den_vsGenMult_pri"), part.pt(), itMult->second); + } + } + + const auto mcc = part.mcCollision_as(); + + const float dx = part.vx() - mcc.posX(); + const float dy = part.vy() - mcc.posY(); + const float dz = part.vz() - mcc.posZ(); + + const float distanceFromPV = std::sqrt(dx * dx + dy * dy + dz * dz); + + if (distanceFromPV < fMaxPosPV) { + histos.fill(HIST("Correction/sigLoss_den_pri_pos"), part.pt(), lCentrality); + if (itMult != genMultByMcId.end()) { + histos.fill(HIST("Correction/sigLoss_den_vsGenMult_pri_pos"), part.pt(), itMult->second); + } + } } } // fillSigLossDen @@ -1547,9 +1525,9 @@ struct Chk892LI { MCV0Candidates const& v0s, MCEventCandidates const& events, MCTrueEventCandidates const& mccolls) - { - genMultByMcId.clear(); - buildAllowedMcIds(mccolls, events, mcpart); + { + genMultByMcId.clear(); + buildAllowedMcIds(mccolls, events, mcpart); buildReferenceMcIds(mccolls, mcpart); effK0sProcessGen(mcpart); effK0sProcessReco(v0s); @@ -1558,16 +1536,14 @@ struct Chk892LI { fillSigLossNum(mccolls, mcpart); fillSigLossDen(mccolls, mcpart); - for (const auto& mcid : refClassIds) { - auto iter = refCentByMcId.find(mcid); - if (iter == refCentByMcId.end()) - continue; + auto iter = refCentByMcId.find(mcid); + if (iter == refCentByMcId.end()) + continue; - const float lCentrality = iter->second; + const float lCentrality = iter->second; histos.fill(HIST("Correction/EF_den"), lCentrality); } - for (const auto& mcid : allowedMcIds) { auto iter = centTruthByAllowed.find(mcid); @@ -1587,15 +1563,15 @@ struct Chk892LI { histos.fill(HIST("Correction/setSizes"), 2.0, nIntersect); histos.fill(HIST("Correction/setSizes"), 3.0, allowedMcIds.size() - nIntersect); - for (auto const& mcc : mccolls) { - auto partsThisMc = mcpart.sliceBy(perMCCollision, mcc.globalIndex()); - const int genMult = getGenMidRapMultiplicity(partsThisMc); - const float genCentClass = getCentClassFromGenMult(genMult); - if (genCentClass == kInvalidCentrality) { - continue; - } - histos.fill(HIST("Correction/MCTruthCent_all"), genCentClass); - } + for (auto const& mcc : mccolls) { + auto partsThisMc = mcpart.sliceBy(perMCCollision, mcc.globalIndex()); + const int genMult = getGenMidRapMultiplicity(partsThisMc); + const float genCentClass = getCentClassFromGenMult(genMult); + if (genCentClass == kInvalidCentrality) { + continue; + } + histos.fill(HIST("Correction/MCTruthCent_all"), genCentClass); + } for (const auto& mcid : refClassIds) { auto iter = refCentByMcId.find(mcid); @@ -1641,16 +1617,16 @@ struct Chk892LI { return; if (cfgRecoUseInelGt0 && !collision.isInelGt0()) return; - if (!collision.has_mcCollision()) - return; + if (!collision.has_mcCollision()) + return; - const auto mcid = collision.mcCollisionId(); + const auto mcid = collision.mcCollisionId(); - auto it = centTruthByAllowed.find(mcid); - if (it == centTruthByAllowed.end()) { - return; - } - lCentrality = it->second; + auto it = centTruthByAllowed.find(mcid); + if (it == centTruthByAllowed.end()) { + return; + } + lCentrality = it->second; if (lCentrality < EventCuts.cfgEventCentralityMin || lCentrality > EventCuts.cfgEventCentralityMax) return;