From 30da0966a6be79a94c602da755006803b3ca5955 Mon Sep 17 00:00:00 2001 From: SuJeong Ji <120470463+SuJeong-Ji@users.noreply.github.com> Date: Sun, 9 Nov 2025 22:16:49 +0900 Subject: [PATCH 1/4] Add histogram for truth tagged reco invariant mass distribution --- PWGLF/Tasks/Resonances/chk892pp.cxx | 408 +++++++++++++++------------- 1 file changed, 213 insertions(+), 195 deletions(-) diff --git a/PWGLF/Tasks/Resonances/chk892pp.cxx b/PWGLF/Tasks/Resonances/chk892pp.cxx index 6c667e332d6..f81445ac286 100644 --- a/PWGLF/Tasks/Resonances/chk892pp.cxx +++ b/PWGLF/Tasks/Resonances/chk892pp.cxx @@ -35,8 +35,7 @@ #include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/PIDResponseTOF.h" -#include "Common/DataModel/PIDResponseTPC.h" +#include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/TrackSelectionTables.h" #include "CCDB/BasicCCDBManager.h" @@ -61,11 +60,11 @@ #include "Math/Vector3D.h" #include "Math/Vector4D.h" #include "TF1.h" -#include "TParticlePDG.h" #include "TRandom3.h" #include "TVector2.h" #include #include // FIXME +#include "TParticlePDG.h" #include #include @@ -85,19 +84,19 @@ using namespace o2::aod::rctsel; namespace { -template -inline bool getTruthK0sAndGenKinematics(V0T const& v0, double& ptgen, double& ygen) -{ - if (!v0.has_mcParticle()) - return false; - auto mcPart = v0.template mcParticle_as(); - if (mcPart.pdgCode() != kK0Short) - return false; - ptgen = mcPart.pt(); - ygen = mcPart.y(); - return true; -} -} // namespace + template + inline bool getTruthK0sAndGenKinematics(V0T const& v0, double& ptgen, double& ygen) + { + if (!v0.has_mcParticle()) + return false; + auto mcPart = v0.template mcParticle_as(); + if (mcPart.pdgCode() != kK0Short) + return false; + ptgen = mcPart.pt(); + ygen = mcPart.y(); + return true; + } +}// namespace struct Chk892pp { enum BinType : unsigned int { @@ -111,18 +110,18 @@ struct Chk892pp { }; enum EvtStep { - kAll = 0, + kAll=0, kZvtx, kINELgt0, kAssocReco, kNSteps }; - const int nSteps = static_cast(EvtStep::kNSteps); + const int nSteps = static_cast(EvtStep::kNSteps); SliceCache cache; Preslice perCollision = aod::track::collisionId; - Preslice perCollisionV0 = aod::v0data::collisionId; + Preslice perCollisionV0 = aod::v0data::collisionId; Preslice perMCCollision = o2::aod::mcparticle::mcCollisionId; using EventCandidates = soa::Join; @@ -186,7 +185,7 @@ struct Chk892pp { } EventCuts; RCTFlagsChecker rctChecker; - Configurable cfgFillQAPlots{"cfgFillQAPlots", false, "Fill QA plots"}; + Configurable cfgFillQAPlots{"cfgFillQAPlots", false, "Fill QA plots"}; Configurable cfgCentEst{"cfgCentEst", 2, "Centrality estimator, 1: FT0C, 2: FT0M"}; /// PID Selections, pion @@ -195,7 +194,7 @@ struct Chk892pp { Configurable cfgMaxTPCnSigmaPion{"cfgMaxTPCnSigmaPion", 3.0, "TPC nSigma cut for Pion"}; // TPC Configurable cfgMaxTOFnSigmaPion{"cfgMaxTOFnSigmaPion", 3.0, "TOF nSigma cut for Pion"}; // TOF Configurable cfgNsigmaCutCombinedPion{"cfgNsigmaCutCombinedPion", -999, "Combined nSigma cut for Pion"}; // Combined - Configurable cfgTOFVeto{"cfgTOFVeto", true, "TOF Veto, if false, TOF is nessessary for PID selection"}; // TOF Veto + Configurable cfgTOFVeto{"cfgTOFVeto", false, "TOF Veto, if false, TOF is nessessary for PID selection"}; // TOF Veto Configurable cfgTOFMinPt{"cfgTOFMinPt", 0.6, "Minimum TOF pT cut for Pion"}; // TOF pT cut } PIDCuts; @@ -264,7 +263,7 @@ struct Chk892pp { Configurable cfgNrotBkg{"cfgNrotBkg", 4, "Number of rotated copies (background) per each original candidate"}; } BkgEstimationConfig; - Configurable cfgTruthUseInelGt0{"cfgTruthUseInelGt0", true, "Truth denominator: require INEL>0"}; + Configurable cfgTruthUseInelGt0{"cfgTruthUseInelGt0", true, "Truth denominator: require INEL>0"}; Configurable cfgTruthIncludeZvtx{"cfgTruthIncludeZvtx", true, "Truth denominator: also require |vtxz|GetXaxis()->SetBinLabel(2, "zvtx"); hstep->GetXaxis()->SetBinLabel(3, "INEL>0"); hstep->GetXaxis()->SetBinLabel(4, "Assoc with reco coll"); + + 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); @@ -685,7 +687,7 @@ struct Chk892pp { // Check bTrack first if (std::abs(motherbTrack.pdgCode()) != kKstarPlus) // Are you charged Kstar's daughter? - return false; // Apply first since it's more restrictive + return false; // Apply first since it's more restrictive if (std::abs(motherkV0.pdgCode()) != kPDGK0s) // Is it K0s? return false; @@ -718,7 +720,7 @@ struct Chk892pp { centTruthByAllowed.clear(); for (const auto& coll : events) { - // lCentrality = getCentrality(coll); + //lCentrality = getCentrality(coll); if (!coll.has_mcCollision()) continue; @@ -728,7 +730,7 @@ struct Chk892pp { const float lCentrality = mccoll.centFT0M(); - if (doprocessMC) { + if (doprocessMC){ histos.fill(HIST("QACent_woCut"), lCentrality); histos.fill(HIST("QAvtxz_woCut"), coll.posZ()); } @@ -740,15 +742,15 @@ struct Chk892pp { if (!coll.isInelGt0()) continue; - if (doprocessMC) { + if (doprocessMC){ histos.fill(HIST("QACent_woCentCut"), lCentrality); histos.fill(HIST("QAvtxz_wVtxzCut"), coll.posZ()); } if (lCentrality < EventCuts.cfgEventCentralityMin || lCentrality > EventCuts.cfgEventCentralityMax) continue; - - if (doprocessMC) { + + if (doprocessMC){ histos.fill(HIST("QACent_wCentCut"), lCentrality); } allowedMcIds.insert(mcid); @@ -757,7 +759,7 @@ struct Chk892pp { } template - void buildReferenceMcIds(McCollsT const& mccolls, McPartsT const& mcparts) + void buildReferenceMcIds(McCollsT const &mccolls, McPartsT const &mcparts) { refClassIds.clear(); refCentByMcId.clear(); @@ -765,18 +767,16 @@ struct Chk892pp { for (const auto& coll : mccolls) { bool pass = true; - if (cfgTruthIncludeZvtx && std::abs(coll.posZ()) >= EventCuts.cfgEvtZvtx) - pass = false; + if (cfgTruthIncludeZvtx && std::abs(coll.posZ()) >= EventCuts.cfgEvtZvtx) pass = false; - if (pass && cfgTruthUseInelGt0) { + if (pass && cfgTruthUseInelGt0) + { auto partsThisMc = mcparts.sliceBy(perMCCollision, coll.globalIndex()); - if (!pwglf::isINELgtNmc(partsThisMc, 0, pdg)) - pass = false; + if (!pwglf::isINELgtNmc(partsThisMc, 0, pdg)) pass = false; } - if (!pass) - continue; - + if (!pass) continue; + const auto mcid = coll.globalIndex(); refClassIds.insert(mcid); const float lCentrality = coll.centFT0M(); @@ -902,7 +902,8 @@ struct Chk892pp { void effKstarProcessGen(MCTrueTrackCandidates const& mcparts) { - for (const auto& part : mcparts) { + for (const auto& part : mcparts) + { if (!part.has_mcCollision()) continue; if (std::abs(part.pdgCode()) != kKstarPlus) @@ -967,67 +968,77 @@ struct Chk892pp { lDecayDaughter_bach = LorentzVectorSetXYZM(bTrack.px(), bTrack.py(), bTrack.pz(), MassPionCharged); lResoKstar = lResoSecondary + lDecayDaughter_bach; - double ptgen = 0, ygen = 0; - if (!matchRecoToTruthKstar(v0, bTrack, ptgen, ygen)) - continue; - const double ptreco = lResoKstar.Pt(); const double yreco = lResoKstar.Rapidity(); if (std::abs(yreco) > KstarCuts.cfgKstarMaxRap) continue; - histos.fill(HIST("EffKstar/recoKstar"), ptreco, lCentrality); - } + + double ptgen = 0, ygen = 0; + const bool isTrue = matchRecoToTruthKstar(v0, bTrack, ptgen, ygen); + + if (isTrue) { + + histos.fill(HIST("EffKstar/recoKstar"), ptreco, lCentrality); + histos.fill(HIST("MCReco/hInvmass_Kstar_true"), lCentrality, ptreco, lResoKstar.M()); + + } else { + histos.fill(HIST("MCReco/hInvmass_Kstar_bkg"), lCentrality, ptreco, lResoKstar.M()); + } + } } } // effKstarProcessReco void fillSigLossNum(MCTrueTrackCandidates const& mcparts) { - for (auto const& part : mcparts) { + for (auto const& part : mcparts) + { if (!part.has_mcCollision()) continue; if (std::abs(part.pdgCode()) != kKstarPlus) continue; if (std::abs(part.y()) > KstarCuts.cfgKstarMaxRap) continue; - + const auto mcid = part.mcCollisionId(); if (allowedMcIds.count(mcid) == 0) continue; - + auto iter = centTruthByAllowed.find(mcid); if (iter == centTruthByAllowed.end()) continue; - + const float lCentrality = iter->second; histos.fill(HIST("Correction/sigLoss_num"), part.pt(), lCentrality); } - } // fillSigLossNum + }//fillSigLossNum void fillSigLossDen(MCTrueTrackCandidates const& mcparts) { - for (auto const& part : mcparts) { + for (auto const& part : mcparts) + { if (!part.has_mcCollision()) continue; if (std::abs(part.pdgCode()) != kKstarPlus) continue; if (std::abs(part.y()) > KstarCuts.cfgKstarMaxRap) continue; - + const auto mcid = part.mcCollisionId(); if (refClassIds.count(mcid) == 0) continue; - + auto iter = refCentByMcId.find(mcid); if (iter == refCentByMcId.end()) continue; - + const float lCentrality = iter->second; histos.fill(HIST("Correction/sigLoss_den"), part.pt(), lCentrality); } - } // fillSigLossDen + }//fillSigLossDen + int count = 0; @@ -1049,18 +1060,18 @@ struct Chk892pp { auto trkbNSigmaPiTOF = (istrkbhasTOF) ? bTrack.tofNSigmaPi() : -999.; if constexpr (!IsMix) { - if (cfgFillQAPlots) { - // Bachelor pion QA plots - histos.fill(HIST("QA/before/trkbpionTPCPID"), trkbpt, trkbNSigmaPiTPC); - if (istrkbhasTOF) { - histos.fill(HIST("QA/before/trkbpionTOFPID"), trkbpt, trkbNSigmaPiTOF); - histos.fill(HIST("QA/before/trkbpionTPCTOFPID"), trkbNSigmaPiTPC, trkbNSigmaPiTOF); - } - histos.fill(HIST("QA/before/trkbpionpT"), trkbpt); - histos.fill(HIST("QA/before/trkbpionDCAxy"), bTrack.dcaXY()); - histos.fill(HIST("QA/before/trkbpionDCAz"), bTrack.dcaZ()); - } - } + if (cfgFillQAPlots) { + // Bachelor pion QA plots + histos.fill(HIST("QA/before/trkbpionTPCPID"), trkbpt, trkbNSigmaPiTPC); + if (istrkbhasTOF) { + histos.fill(HIST("QA/before/trkbpionTOFPID"), trkbpt, trkbNSigmaPiTOF); + histos.fill(HIST("QA/before/trkbpionTPCTOFPID"), trkbNSigmaPiTPC, trkbNSigmaPiTOF); + } + histos.fill(HIST("QA/before/trkbpionpT"), trkbpt); + histos.fill(HIST("QA/before/trkbpionDCAxy"), bTrack.dcaXY()); + histos.fill(HIST("QA/before/trkbpionDCAz"), bTrack.dcaZ()); + } + } if (!trackCut(bTrack)) continue; @@ -1068,18 +1079,18 @@ struct Chk892pp { continue; if constexpr (!IsMix) { - if (cfgFillQAPlots) { - // Bachelor pion QA plots after applying cuts - histos.fill(HIST("QA/after/trkbpionTPCPID"), trkbpt, trkbNSigmaPiTPC); - if (istrkbhasTOF) { - histos.fill(HIST("QA/after/trkbpionTOFPID"), trkbpt, trkbNSigmaPiTOF); - histos.fill(HIST("QA/after/trkbpionTPCTOFPID"), trkbNSigmaPiTPC, trkbNSigmaPiTOF); - } - histos.fill(HIST("QA/after/trkbpionpT"), trkbpt); - histos.fill(HIST("QA/after/trkbpionDCAxy"), bTrack.dcaXY()); - histos.fill(HIST("QA/after/trkbpionDCAz"), bTrack.dcaZ()); - } - } + if (cfgFillQAPlots) { + // Bachelor pion QA plots after applying cuts + histos.fill(HIST("QA/after/trkbpionTPCPID"), trkbpt, trkbNSigmaPiTPC); + if (istrkbhasTOF) { + histos.fill(HIST("QA/after/trkbpionTOFPID"), trkbpt, trkbNSigmaPiTOF); + histos.fill(HIST("QA/after/trkbpionTPCTOFPID"), trkbNSigmaPiTPC, trkbNSigmaPiTOF); + } + histos.fill(HIST("QA/after/trkbpionpT"), trkbpt); + histos.fill(HIST("QA/after/trkbpionDCAxy"), bTrack.dcaXY()); + histos.fill(HIST("QA/after/trkbpionDCAz"), bTrack.dcaZ()); + } + } trackIndicies.push_back(bTrack.index()); } @@ -1115,39 +1126,39 @@ struct Chk892pp { lResoSecondary = LorentzVectorSetXYZM(k0sCand.px(), k0sCand.py(), k0sCand.pz(), trkkMass); if constexpr (!IsMix) { - if (cfgFillQAPlots) { - // Seconddary QA plots - histos.fill(HIST("QA/before/trkppionTPCPID"), trkppt, trkpNSigmaPiTPC); - if (istrkphasTOF) { - histos.fill(HIST("QA/before/trkppionTOFPID"), trkppt, trkpNSigmaPiTOF); - histos.fill(HIST("QA/before/trkppionTPCTOFPID"), trkpNSigmaPiTPC, trkpNSigmaPiTOF); - } - histos.fill(HIST("QA/before/trkppionpT"), trkppt); - histos.fill(HIST("QA/before/trkppionDCAxy"), posDauTrack.dcaXY()); - histos.fill(HIST("QA/before/trkppionDCAz"), posDauTrack.dcaZ()); - - histos.fill(HIST("QA/before/trknpionTPCPID"), trknpt, trknNSigmaPiTPC); - if (istrknhasTOF) { - histos.fill(HIST("QA/before/trknpionTOFPID"), trknpt, trknNSigmaPiTOF); - histos.fill(HIST("QA/before/trknpionTPCTOFPID"), trknNSigmaPiTPC, trknNSigmaPiTOF); - } - histos.fill(HIST("QA/before/trknpionpT"), trknpt); - histos.fill(HIST("QA/before/trknpionDCAxy"), negDauTrack.dcaXY()); - histos.fill(HIST("QA/before/trknpionDCAz"), negDauTrack.dcaZ()); - - histos.fill(HIST("QA/before/hDauDCASecondary"), trkkDauDCA); - histos.fill(HIST("QA/before/hDauPosDCAtoPVSecondary"), trkkDauDCAPostoPV); - histos.fill(HIST("QA/before/hDauNegDCAtoPVSecondary"), trkkDauDCANegtoPV); - - histos.fill(HIST("QA/before/hpT_Secondary"), trkkpt); - histos.fill(HIST("QA/before/hy_Secondary"), trkky); - histos.fill(HIST("QA/before/hRadiusSecondary"), trkkRadius); - histos.fill(HIST("QA/before/hDCAtoPVSecondary"), trkkDCAtoPV); - histos.fill(HIST("QA/before/hCPASecondary"), trkkCPA); - histos.fill(HIST("QA/before/hPropTauSecondary"), trkkPropTau); - histos.fill(HIST("QA/before/hInvmassSecondary"), trkkMass); - } - } + if (cfgFillQAPlots) { + // Seconddary QA plots + histos.fill(HIST("QA/before/trkppionTPCPID"), trkppt, trkpNSigmaPiTPC); + if (istrkphasTOF) { + histos.fill(HIST("QA/before/trkppionTOFPID"), trkppt, trkpNSigmaPiTOF); + histos.fill(HIST("QA/before/trkppionTPCTOFPID"), trkpNSigmaPiTPC, trkpNSigmaPiTOF); + } + histos.fill(HIST("QA/before/trkppionpT"), trkppt); + histos.fill(HIST("QA/before/trkppionDCAxy"), posDauTrack.dcaXY()); + histos.fill(HIST("QA/before/trkppionDCAz"), posDauTrack.dcaZ()); + + histos.fill(HIST("QA/before/trknpionTPCPID"), trknpt, trknNSigmaPiTPC); + if (istrknhasTOF) { + histos.fill(HIST("QA/before/trknpionTOFPID"), trknpt, trknNSigmaPiTOF); + histos.fill(HIST("QA/before/trknpionTPCTOFPID"), trknNSigmaPiTPC, trknNSigmaPiTOF); + } + histos.fill(HIST("QA/before/trknpionpT"), trknpt); + histos.fill(HIST("QA/before/trknpionDCAxy"), negDauTrack.dcaXY()); + histos.fill(HIST("QA/before/trknpionDCAz"), negDauTrack.dcaZ()); + + histos.fill(HIST("QA/before/hDauDCASecondary"), trkkDauDCA); + histos.fill(HIST("QA/before/hDauPosDCAtoPVSecondary"), trkkDauDCAPostoPV); + histos.fill(HIST("QA/before/hDauNegDCAtoPVSecondary"), trkkDauDCANegtoPV); + + histos.fill(HIST("QA/before/hpT_Secondary"), trkkpt); + histos.fill(HIST("QA/before/hy_Secondary"), trkky); + histos.fill(HIST("QA/before/hRadiusSecondary"), trkkRadius); + histos.fill(HIST("QA/before/hDCAtoPVSecondary"), trkkDCAtoPV); + histos.fill(HIST("QA/before/hCPASecondary"), trkkCPA); + histos.fill(HIST("QA/before/hPropTauSecondary"), trkkPropTau); + histos.fill(HIST("QA/before/hInvmassSecondary"), trkkMass); + } + } if (!SecondaryCuts.cfgByPassDauPIDSelection && !selectionPIDPion(posDauTrack)) continue; @@ -1157,46 +1168,46 @@ struct Chk892pp { continue; if constexpr (!IsMix) { - if (cfgFillQAPlots) { - // Seconddary QA plots after applying cuts - - histos.fill(HIST("QA/after/trkppionTPCPID"), trkppt, trkpNSigmaPiTPC); - if (istrkphasTOF) { - histos.fill(HIST("QA/after/trkppionTOFPID"), trkppt, trkpNSigmaPiTOF); - histos.fill(HIST("QA/after/trkppionTPCTOFPID"), trkpNSigmaPiTPC, trkpNSigmaPiTOF); - } - histos.fill(HIST("QA/after/trkppionpT"), trkppt); - histos.fill(HIST("QA/after/trkppionDCAxy"), posDauTrack.dcaXY()); - histos.fill(HIST("QA/after/trkppionDCAz"), posDauTrack.dcaZ()); - - histos.fill(HIST("QA/after/trknpionTPCPID"), trknpt, trknNSigmaPiTPC); - if (istrknhasTOF) { - histos.fill(HIST("QA/after/trknpionTOFPID"), trknpt, trknNSigmaPiTOF); - histos.fill(HIST("QA/after/trknpionTPCTOFPID"), trknNSigmaPiTPC, trknNSigmaPiTOF); - } - histos.fill(HIST("QA/after/trknpionpT"), trknpt); - histos.fill(HIST("QA/after/trknpionDCAxy"), negDauTrack.dcaXY()); - histos.fill(HIST("QA/after/trknpionDCAz"), negDauTrack.dcaZ()); - - histos.fill(HIST("QA/after/hDauDCASecondary"), trkkDauDCA); - histos.fill(HIST("QA/after/hDauPosDCAtoPVSecondary"), trkkDauDCAPostoPV); - histos.fill(HIST("QA/after/hDauNegDCAtoPVSecondary"), trkkDauDCANegtoPV); - - histos.fill(HIST("QA/after/hpT_Secondary"), trkkpt); - histos.fill(HIST("QA/after/hy_Secondary"), trkky); - histos.fill(HIST("QA/after/hRadiusSecondary"), trkkRadius); - histos.fill(HIST("QA/after/hDCAtoPVSecondary"), trkkDCAtoPV); - histos.fill(HIST("QA/after/hCPASecondary"), trkkCPA); - histos.fill(HIST("QA/after/hPropTauSecondary"), trkkPropTau); - histos.fill(HIST("QA/after/hInvmassSecondary"), trkkMass); - } - histos.fill(HIST("hInvmass_K0s"), lCentrality, lResoSecondary.Pt(), lResoSecondary.M()); - } - k0sIndicies.push_back(k0sCand.index()); - } + if (cfgFillQAPlots) { + // Seconddary QA plots after applying cuts + + histos.fill(HIST("QA/after/trkppionTPCPID"), trkppt, trkpNSigmaPiTPC); + if (istrkphasTOF) { + histos.fill(HIST("QA/after/trkppionTOFPID"), trkppt, trkpNSigmaPiTOF); + histos.fill(HIST("QA/after/trkppionTPCTOFPID"), trkpNSigmaPiTPC, trkpNSigmaPiTOF); + } + histos.fill(HIST("QA/after/trkppionpT"), trkppt); + histos.fill(HIST("QA/after/trkppionDCAxy"), posDauTrack.dcaXY()); + histos.fill(HIST("QA/after/trkppionDCAz"), posDauTrack.dcaZ()); + + histos.fill(HIST("QA/after/trknpionTPCPID"), trknpt, trknNSigmaPiTPC); + if (istrknhasTOF) { + histos.fill(HIST("QA/after/trknpionTOFPID"), trknpt, trknNSigmaPiTOF); + histos.fill(HIST("QA/after/trknpionTPCTOFPID"), trknNSigmaPiTPC, trknNSigmaPiTOF); + } + histos.fill(HIST("QA/after/trknpionpT"), trknpt); + histos.fill(HIST("QA/after/trknpionDCAxy"), negDauTrack.dcaXY()); + histos.fill(HIST("QA/after/trknpionDCAz"), negDauTrack.dcaZ()); + + histos.fill(HIST("QA/after/hDauDCASecondary"), trkkDauDCA); + histos.fill(HIST("QA/after/hDauPosDCAtoPVSecondary"), trkkDauDCAPostoPV); + histos.fill(HIST("QA/after/hDauNegDCAtoPVSecondary"), trkkDauDCANegtoPV); + + histos.fill(HIST("QA/after/hpT_Secondary"), trkkpt); + histos.fill(HIST("QA/after/hy_Secondary"), trkky); + histos.fill(HIST("QA/after/hRadiusSecondary"), trkkRadius); + histos.fill(HIST("QA/after/hDCAtoPVSecondary"), trkkDCAtoPV); + histos.fill(HIST("QA/after/hCPASecondary"), trkkCPA); + histos.fill(HIST("QA/after/hPropTauSecondary"), trkkPropTau); + histos.fill(HIST("QA/after/hInvmassSecondary"), trkkMass); + } + histos.fill(HIST("hInvmass_K0s"), lCentrality, lResoSecondary.Pt(), lResoSecondary.M()); + } + k0sIndicies.push_back(k0sCand.index()); + } for (const auto& trackIndex : trackIndicies) { - auto bTrack = dTracks1.rawIteratorAt(trackIndex); + auto bTrack = dTracks1.rawIteratorAt(trackIndex); for (const auto& k0sIndex : k0sIndicies) { auto k0sCand = dTracks2.rawIteratorAt(k0sIndex); @@ -1208,30 +1219,30 @@ struct Chk892pp { // QA plots if constexpr (!IsMix) { - if (cfgFillQAPlots) { - histos.fill(HIST("QA/before/KstarRapidity"), lResoKstar.Rapidity()); - histos.fill(HIST("QA/before/kstarinvmass"), lResoKstar.M()); - } - } + if (cfgFillQAPlots) { + histos.fill(HIST("QA/before/KstarRapidity"), lResoKstar.Rapidity()); + histos.fill(HIST("QA/before/kstarinvmass"), lResoKstar.M()); + } + } if (lResoKstar.Rapidity() > KstarCuts.cfgKstarMaxRap || lResoKstar.Rapidity() < KstarCuts.cfgKstarMinRap) continue; if constexpr (!IsMix) { unsigned int typeKstar = bTrack.sign() > 0 ? BinType::kKstarP : BinType::kKstarN; - if (cfgFillQAPlots) { + if (cfgFillQAPlots) { - histos.fill(HIST("QA/after/KstarRapidity"), lResoKstar.Rapidity()); - histos.fill(HIST("QA/after/kstarinvmass"), lResoKstar.M()); - } - histos.fill(HIST("hInvmass_Kstar"), typeKstar, lCentrality, lResoKstar.Pt(), lResoKstar.M()); + histos.fill(HIST("QA/after/KstarRapidity"), lResoKstar.Rapidity()); + histos.fill(HIST("QA/after/kstarinvmass"), lResoKstar.M()); + } + histos.fill(HIST("hInvmass_Kstar"), typeKstar, lCentrality, lResoKstar.Pt(), lResoKstar.M()); if (BkgEstimationConfig.cfgFillRotBkg) { for (int i = 0; i < BkgEstimationConfig.cfgNrotBkg; i++) { auto lRotAngle = BkgEstimationConfig.cfgMinRot + i * ((BkgEstimationConfig.cfgMaxRot - BkgEstimationConfig.cfgMinRot) / (BkgEstimationConfig.cfgNrotBkg - 1)); - if (cfgFillQAPlots) { - histos.fill(HIST("QA/RotBkg/hRotBkg"), lRotAngle); - } + if (cfgFillQAPlots) { + histos.fill(HIST("QA/RotBkg/hRotBkg"), lRotAngle); + } if (BkgEstimationConfig.cfgRotPion) { lDaughterRot = lDecayDaughter_bach; // lDaughterRot.RotateZ(lRotAngle); @@ -1251,13 +1262,13 @@ struct Chk892pp { histos.fill(HIST("hInvmass_Kstar"), typeKstar, lCentrality, lResonanceRot.Pt(), lResonanceRot.M()); } } - } // IsMix - } // K0scand - } // bTrack + }// IsMix + }// K0scand + }// bTrack count++; - } // fillHistograms + }// fillHistograms void processData(EventCandidates::iterator const& collision, TrackCandidates const& tracks, @@ -1288,17 +1299,19 @@ struct Chk892pp { { buildAllowedMcIds(events); buildReferenceMcIds(mccolls, mcpart); - effK0sProcessGen(mcpart); - effK0sProcessReco(v0s); - effKstarProcessGen(mcpart); - effKstarProcessReco(v0s, tracks); + effK0sProcessGen(mcpart); + effK0sProcessReco(v0s); + effKstarProcessGen(mcpart); + effKstarProcessReco(v0s, tracks); fillSigLossNum(mcpart); fillSigLossDen(mcpart); - for (const auto& mcid : refClassIds) { + for (const auto& mcid : refClassIds) + { histos.fill(HIST("Correction/EF_den"), refCentByMcId[mcid]); } - for (const auto& mcid : allowedMcIds) { + for (const auto& mcid : allowedMcIds) + { auto iter = centTruthByAllowed.find(mcid); if (iter == centTruthByAllowed.end()) continue; @@ -1308,19 +1321,19 @@ struct Chk892pp { } size_t nIntersect = 0; - for (const auto& mcid : allowedMcIds) - if (refClassIds.count(mcid)) - nIntersect++; + for (const auto& mcid : allowedMcIds) if (refClassIds.count(mcid)) nIntersect++; histos.fill(HIST("Correction/setSizes"), 0.0, refClassIds.size()); histos.fill(HIST("Correction/setSizes"), 1.0, allowedMcIds.size()); histos.fill(HIST("Correction/setSizes"), 2.0, nIntersect); histos.fill(HIST("Correction/setSizes"), 3.0, allowedMcIds.size() - nIntersect); - for (const auto& mcc : mccolls) { + for (const auto& mcc : mccolls) + { histos.fill(HIST("Correction/MCTruthCent_all"), mcc.centFT0M()); } - for (const auto& mcid : refClassIds) { + for (const auto& mcid : refClassIds) + { auto iter = refCentByMcId.find(mcid); if (iter == refCentByMcId.end()) continue; @@ -1328,47 +1341,52 @@ struct Chk892pp { histos.fill(HIST("Correction/MCTruthCent_cut"), lCentrality); } - for (auto const& mcc : mccolls) { + for (auto const& mcc : mccolls) + { const auto mcid = mcc.globalIndex(); histos.fill(HIST("Correction/hNEventsMCTruth"), 1.0); bool passZvtx = true; - if (cfgTruthIncludeZvtx && std::abs(mcc.posZ()) > EventCuts.cfgEvtZvtx) { + if (cfgTruthIncludeZvtx && std::abs(mcc.posZ()) > EventCuts.cfgEvtZvtx) + { passZvtx = false; } - if (passZvtx) { + if (passZvtx) + { histos.fill(HIST("Correction/hNEventsMCTruth"), 2.0); auto partsThisMc = mcpart.sliceBy(perMCCollision, mcid); - if (pwglf::isINELgtNmc(partsThisMc, 0, pdg)) { + if (pwglf::isINELgtNmc(partsThisMc, 0, pdg)) + { histos.fill(HIST("Correction/hNEventsMCTruth"), 3.0); } } - if (allowedMcIds.count(mcid)) { + if (allowedMcIds.count(mcid)) + { histos.fill(HIST("Correction/hNEventsMCTruth"), 4.0); } } } PROCESS_SWITCH(Chk892pp, processMC, "Process Event for MC", true); - void processMCQA(MCEventCandidates::iterator const& collision, - MCTrackCandidates const& tracks, - MCV0Candidates const& v0s, - soa::Join const& mccolls, - aod::BCsWithTimestamps const&) - { - if (!colCuts.isSelected(collision)) - return; - if (EventCuts.cfgEvtUseRCTFlagChecker && !rctChecker(collision)) - return; + void processMCQA(MCEventCandidates::iterator const& collision, + MCTrackCandidates const& tracks, + MCV0Candidates const& v0s, + soa::Join const& mccolls, + aod::BCsWithTimestamps const&) + { + if (!colCuts.isSelected(collision)) + return; + if (EventCuts.cfgEvtUseRCTFlagChecker && !rctChecker(collision)) + return; if (!collision.isInelGt0()) return; if (!collision.has_mcCollision()) return; - auto id = collision.mcCollisionId(); + auto id = collision.mcCollisionId(); auto mccoll = mccolls.iteratorAt(id); const float lCentrality = mccoll.centFT0M(); @@ -1378,7 +1396,7 @@ struct Chk892pp { colCuts.fillQA(collision); fillHistograms(collision, tracks, v0s); - } + } PROCESS_SWITCH(Chk892pp, processMCQA, "Process Event for MC and fill QA plots", false); }; From 40cc48d2fdae52fe577d6ecb3970195fa737f7a8 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Sun, 9 Nov 2025 13:19:10 +0000 Subject: [PATCH 2/4] Please consider the following formatting changes --- PWGLF/Tasks/Resonances/chk892pp.cxx | 405 ++++++++++++++-------------- 1 file changed, 198 insertions(+), 207 deletions(-) diff --git a/PWGLF/Tasks/Resonances/chk892pp.cxx b/PWGLF/Tasks/Resonances/chk892pp.cxx index f81445ac286..fd4e7d8d75d 100644 --- a/PWGLF/Tasks/Resonances/chk892pp.cxx +++ b/PWGLF/Tasks/Resonances/chk892pp.cxx @@ -60,11 +60,11 @@ #include "Math/Vector3D.h" #include "Math/Vector4D.h" #include "TF1.h" +#include "TParticlePDG.h" #include "TRandom3.h" #include "TVector2.h" #include #include // FIXME -#include "TParticlePDG.h" #include #include @@ -84,19 +84,19 @@ using namespace o2::aod::rctsel; namespace { - template - inline bool getTruthK0sAndGenKinematics(V0T const& v0, double& ptgen, double& ygen) - { - if (!v0.has_mcParticle()) - return false; - auto mcPart = v0.template mcParticle_as(); - if (mcPart.pdgCode() != kK0Short) - return false; - ptgen = mcPart.pt(); - ygen = mcPart.y(); - return true; - } -}// namespace +template +inline bool getTruthK0sAndGenKinematics(V0T const& v0, double& ptgen, double& ygen) +{ + if (!v0.has_mcParticle()) + return false; + auto mcPart = v0.template mcParticle_as(); + if (mcPart.pdgCode() != kK0Short) + return false; + ptgen = mcPart.pt(); + ygen = mcPart.y(); + return true; +} +} // namespace struct Chk892pp { enum BinType : unsigned int { @@ -110,18 +110,18 @@ struct Chk892pp { }; enum EvtStep { - kAll=0, + kAll = 0, kZvtx, kINELgt0, kAssocReco, kNSteps }; - const int nSteps = static_cast(EvtStep::kNSteps); + const int nSteps = static_cast(EvtStep::kNSteps); SliceCache cache; Preslice perCollision = aod::track::collisionId; - Preslice perCollisionV0 = aod::v0data::collisionId; + Preslice perCollisionV0 = aod::v0data::collisionId; Preslice perMCCollision = o2::aod::mcparticle::mcCollisionId; using EventCandidates = soa::Join; @@ -185,7 +185,7 @@ struct Chk892pp { } EventCuts; RCTFlagsChecker rctChecker; - Configurable cfgFillQAPlots{"cfgFillQAPlots", false, "Fill QA plots"}; + Configurable cfgFillQAPlots{"cfgFillQAPlots", false, "Fill QA plots"}; Configurable cfgCentEst{"cfgCentEst", 2, "Centrality estimator, 1: FT0C, 2: FT0M"}; /// PID Selections, pion @@ -194,7 +194,7 @@ struct Chk892pp { Configurable cfgMaxTPCnSigmaPion{"cfgMaxTPCnSigmaPion", 3.0, "TPC nSigma cut for Pion"}; // TPC Configurable cfgMaxTOFnSigmaPion{"cfgMaxTOFnSigmaPion", 3.0, "TOF nSigma cut for Pion"}; // TOF Configurable cfgNsigmaCutCombinedPion{"cfgNsigmaCutCombinedPion", -999, "Combined nSigma cut for Pion"}; // Combined - Configurable cfgTOFVeto{"cfgTOFVeto", false, "TOF Veto, if false, TOF is nessessary for PID selection"}; // TOF Veto + Configurable cfgTOFVeto{"cfgTOFVeto", false, "TOF Veto, if false, TOF is nessessary for PID selection"}; // TOF Veto Configurable cfgTOFMinPt{"cfgTOFMinPt", 0.6, "Minimum TOF pT cut for Pion"}; // TOF pT cut } PIDCuts; @@ -263,7 +263,7 @@ struct Chk892pp { Configurable cfgNrotBkg{"cfgNrotBkg", 4, "Number of rotated copies (background) per each original candidate"}; } BkgEstimationConfig; - Configurable cfgTruthUseInelGt0{"cfgTruthUseInelGt0", true, "Truth denominator: require INEL>0"}; + Configurable cfgTruthUseInelGt0{"cfgTruthUseInelGt0", true, "Truth denominator: require INEL>0"}; Configurable cfgTruthIncludeZvtx{"cfgTruthIncludeZvtx", true, "Truth denominator: also require |vtxz|GetXaxis()->SetBinLabel(3, "INEL>0"); hstep->GetXaxis()->SetBinLabel(4, "Assoc with reco coll"); - 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}); + 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); @@ -687,7 +687,7 @@ struct Chk892pp { // Check bTrack first if (std::abs(motherbTrack.pdgCode()) != kKstarPlus) // Are you charged Kstar's daughter? - return false; // Apply first since it's more restrictive + return false; // Apply first since it's more restrictive if (std::abs(motherkV0.pdgCode()) != kPDGK0s) // Is it K0s? return false; @@ -720,7 +720,7 @@ struct Chk892pp { centTruthByAllowed.clear(); for (const auto& coll : events) { - //lCentrality = getCentrality(coll); + // lCentrality = getCentrality(coll); if (!coll.has_mcCollision()) continue; @@ -730,7 +730,7 @@ struct Chk892pp { const float lCentrality = mccoll.centFT0M(); - if (doprocessMC){ + if (doprocessMC) { histos.fill(HIST("QACent_woCut"), lCentrality); histos.fill(HIST("QAvtxz_woCut"), coll.posZ()); } @@ -742,15 +742,15 @@ struct Chk892pp { if (!coll.isInelGt0()) continue; - if (doprocessMC){ + if (doprocessMC) { histos.fill(HIST("QACent_woCentCut"), lCentrality); histos.fill(HIST("QAvtxz_wVtxzCut"), coll.posZ()); } if (lCentrality < EventCuts.cfgEventCentralityMin || lCentrality > EventCuts.cfgEventCentralityMax) continue; - - if (doprocessMC){ + + if (doprocessMC) { histos.fill(HIST("QACent_wCentCut"), lCentrality); } allowedMcIds.insert(mcid); @@ -759,7 +759,7 @@ struct Chk892pp { } template - void buildReferenceMcIds(McCollsT const &mccolls, McPartsT const &mcparts) + void buildReferenceMcIds(McCollsT const& mccolls, McPartsT const& mcparts) { refClassIds.clear(); refCentByMcId.clear(); @@ -767,16 +767,18 @@ struct Chk892pp { for (const auto& coll : mccolls) { bool pass = true; - if (cfgTruthIncludeZvtx && std::abs(coll.posZ()) >= EventCuts.cfgEvtZvtx) pass = false; + if (cfgTruthIncludeZvtx && std::abs(coll.posZ()) >= EventCuts.cfgEvtZvtx) + pass = false; - if (pass && cfgTruthUseInelGt0) - { + if (pass && cfgTruthUseInelGt0) { auto partsThisMc = mcparts.sliceBy(perMCCollision, coll.globalIndex()); - if (!pwglf::isINELgtNmc(partsThisMc, 0, pdg)) pass = false; + if (!pwglf::isINELgtNmc(partsThisMc, 0, pdg)) + pass = false; } - if (!pass) continue; - + if (!pass) + continue; + const auto mcid = coll.globalIndex(); refClassIds.insert(mcid); const float lCentrality = coll.centFT0M(); @@ -902,8 +904,7 @@ struct Chk892pp { void effKstarProcessGen(MCTrueTrackCandidates const& mcparts) { - for (const auto& part : mcparts) - { + for (const auto& part : mcparts) { if (!part.has_mcCollision()) continue; if (std::abs(part.pdgCode()) != kKstarPlus) @@ -974,71 +975,68 @@ struct Chk892pp { if (std::abs(yreco) > KstarCuts.cfgKstarMaxRap) continue; - double ptgen = 0, ygen = 0; - const bool isTrue = matchRecoToTruthKstar(v0, bTrack, ptgen, ygen); + double ptgen = 0, ygen = 0; + const bool isTrue = matchRecoToTruthKstar(v0, bTrack, ptgen, ygen); - if (isTrue) { + if (isTrue) { - histos.fill(HIST("EffKstar/recoKstar"), ptreco, lCentrality); - histos.fill(HIST("MCReco/hInvmass_Kstar_true"), lCentrality, ptreco, lResoKstar.M()); + histos.fill(HIST("EffKstar/recoKstar"), ptreco, lCentrality); + histos.fill(HIST("MCReco/hInvmass_Kstar_true"), lCentrality, ptreco, lResoKstar.M()); - } else { - histos.fill(HIST("MCReco/hInvmass_Kstar_bkg"), lCentrality, ptreco, lResoKstar.M()); - } - } + } else { + histos.fill(HIST("MCReco/hInvmass_Kstar_bkg"), lCentrality, ptreco, lResoKstar.M()); + } + } } } // effKstarProcessReco void fillSigLossNum(MCTrueTrackCandidates const& mcparts) { - for (auto const& part : mcparts) - { + for (auto const& part : mcparts) { if (!part.has_mcCollision()) continue; if (std::abs(part.pdgCode()) != kKstarPlus) continue; if (std::abs(part.y()) > KstarCuts.cfgKstarMaxRap) continue; - + const auto mcid = part.mcCollisionId(); if (allowedMcIds.count(mcid) == 0) continue; - + auto iter = centTruthByAllowed.find(mcid); if (iter == centTruthByAllowed.end()) continue; - + const float lCentrality = iter->second; histos.fill(HIST("Correction/sigLoss_num"), part.pt(), lCentrality); } - }//fillSigLossNum + } // fillSigLossNum void fillSigLossDen(MCTrueTrackCandidates const& mcparts) { - for (auto const& part : mcparts) - { + for (auto const& part : mcparts) { if (!part.has_mcCollision()) continue; if (std::abs(part.pdgCode()) != kKstarPlus) continue; if (std::abs(part.y()) > KstarCuts.cfgKstarMaxRap) continue; - + const auto mcid = part.mcCollisionId(); if (refClassIds.count(mcid) == 0) continue; - + auto iter = refCentByMcId.find(mcid); if (iter == refCentByMcId.end()) continue; - + const float lCentrality = iter->second; histos.fill(HIST("Correction/sigLoss_den"), part.pt(), lCentrality); } - }//fillSigLossDen - + } // fillSigLossDen int count = 0; @@ -1060,18 +1058,18 @@ struct Chk892pp { auto trkbNSigmaPiTOF = (istrkbhasTOF) ? bTrack.tofNSigmaPi() : -999.; if constexpr (!IsMix) { - if (cfgFillQAPlots) { - // Bachelor pion QA plots - histos.fill(HIST("QA/before/trkbpionTPCPID"), trkbpt, trkbNSigmaPiTPC); - if (istrkbhasTOF) { - histos.fill(HIST("QA/before/trkbpionTOFPID"), trkbpt, trkbNSigmaPiTOF); - histos.fill(HIST("QA/before/trkbpionTPCTOFPID"), trkbNSigmaPiTPC, trkbNSigmaPiTOF); - } - histos.fill(HIST("QA/before/trkbpionpT"), trkbpt); - histos.fill(HIST("QA/before/trkbpionDCAxy"), bTrack.dcaXY()); - histos.fill(HIST("QA/before/trkbpionDCAz"), bTrack.dcaZ()); - } - } + if (cfgFillQAPlots) { + // Bachelor pion QA plots + histos.fill(HIST("QA/before/trkbpionTPCPID"), trkbpt, trkbNSigmaPiTPC); + if (istrkbhasTOF) { + histos.fill(HIST("QA/before/trkbpionTOFPID"), trkbpt, trkbNSigmaPiTOF); + histos.fill(HIST("QA/before/trkbpionTPCTOFPID"), trkbNSigmaPiTPC, trkbNSigmaPiTOF); + } + histos.fill(HIST("QA/before/trkbpionpT"), trkbpt); + histos.fill(HIST("QA/before/trkbpionDCAxy"), bTrack.dcaXY()); + histos.fill(HIST("QA/before/trkbpionDCAz"), bTrack.dcaZ()); + } + } if (!trackCut(bTrack)) continue; @@ -1079,18 +1077,18 @@ struct Chk892pp { continue; if constexpr (!IsMix) { - if (cfgFillQAPlots) { - // Bachelor pion QA plots after applying cuts - histos.fill(HIST("QA/after/trkbpionTPCPID"), trkbpt, trkbNSigmaPiTPC); - if (istrkbhasTOF) { - histos.fill(HIST("QA/after/trkbpionTOFPID"), trkbpt, trkbNSigmaPiTOF); - histos.fill(HIST("QA/after/trkbpionTPCTOFPID"), trkbNSigmaPiTPC, trkbNSigmaPiTOF); - } - histos.fill(HIST("QA/after/trkbpionpT"), trkbpt); - histos.fill(HIST("QA/after/trkbpionDCAxy"), bTrack.dcaXY()); - histos.fill(HIST("QA/after/trkbpionDCAz"), bTrack.dcaZ()); - } - } + if (cfgFillQAPlots) { + // Bachelor pion QA plots after applying cuts + histos.fill(HIST("QA/after/trkbpionTPCPID"), trkbpt, trkbNSigmaPiTPC); + if (istrkbhasTOF) { + histos.fill(HIST("QA/after/trkbpionTOFPID"), trkbpt, trkbNSigmaPiTOF); + histos.fill(HIST("QA/after/trkbpionTPCTOFPID"), trkbNSigmaPiTPC, trkbNSigmaPiTOF); + } + histos.fill(HIST("QA/after/trkbpionpT"), trkbpt); + histos.fill(HIST("QA/after/trkbpionDCAxy"), bTrack.dcaXY()); + histos.fill(HIST("QA/after/trkbpionDCAz"), bTrack.dcaZ()); + } + } trackIndicies.push_back(bTrack.index()); } @@ -1126,39 +1124,39 @@ struct Chk892pp { lResoSecondary = LorentzVectorSetXYZM(k0sCand.px(), k0sCand.py(), k0sCand.pz(), trkkMass); if constexpr (!IsMix) { - if (cfgFillQAPlots) { - // Seconddary QA plots - histos.fill(HIST("QA/before/trkppionTPCPID"), trkppt, trkpNSigmaPiTPC); - if (istrkphasTOF) { - histos.fill(HIST("QA/before/trkppionTOFPID"), trkppt, trkpNSigmaPiTOF); - histos.fill(HIST("QA/before/trkppionTPCTOFPID"), trkpNSigmaPiTPC, trkpNSigmaPiTOF); - } - histos.fill(HIST("QA/before/trkppionpT"), trkppt); - histos.fill(HIST("QA/before/trkppionDCAxy"), posDauTrack.dcaXY()); - histos.fill(HIST("QA/before/trkppionDCAz"), posDauTrack.dcaZ()); - - histos.fill(HIST("QA/before/trknpionTPCPID"), trknpt, trknNSigmaPiTPC); - if (istrknhasTOF) { - histos.fill(HIST("QA/before/trknpionTOFPID"), trknpt, trknNSigmaPiTOF); - histos.fill(HIST("QA/before/trknpionTPCTOFPID"), trknNSigmaPiTPC, trknNSigmaPiTOF); - } - histos.fill(HIST("QA/before/trknpionpT"), trknpt); - histos.fill(HIST("QA/before/trknpionDCAxy"), negDauTrack.dcaXY()); - histos.fill(HIST("QA/before/trknpionDCAz"), negDauTrack.dcaZ()); - - histos.fill(HIST("QA/before/hDauDCASecondary"), trkkDauDCA); - histos.fill(HIST("QA/before/hDauPosDCAtoPVSecondary"), trkkDauDCAPostoPV); - histos.fill(HIST("QA/before/hDauNegDCAtoPVSecondary"), trkkDauDCANegtoPV); - - histos.fill(HIST("QA/before/hpT_Secondary"), trkkpt); - histos.fill(HIST("QA/before/hy_Secondary"), trkky); - histos.fill(HIST("QA/before/hRadiusSecondary"), trkkRadius); - histos.fill(HIST("QA/before/hDCAtoPVSecondary"), trkkDCAtoPV); - histos.fill(HIST("QA/before/hCPASecondary"), trkkCPA); - histos.fill(HIST("QA/before/hPropTauSecondary"), trkkPropTau); - histos.fill(HIST("QA/before/hInvmassSecondary"), trkkMass); - } - } + if (cfgFillQAPlots) { + // Seconddary QA plots + histos.fill(HIST("QA/before/trkppionTPCPID"), trkppt, trkpNSigmaPiTPC); + if (istrkphasTOF) { + histos.fill(HIST("QA/before/trkppionTOFPID"), trkppt, trkpNSigmaPiTOF); + histos.fill(HIST("QA/before/trkppionTPCTOFPID"), trkpNSigmaPiTPC, trkpNSigmaPiTOF); + } + histos.fill(HIST("QA/before/trkppionpT"), trkppt); + histos.fill(HIST("QA/before/trkppionDCAxy"), posDauTrack.dcaXY()); + histos.fill(HIST("QA/before/trkppionDCAz"), posDauTrack.dcaZ()); + + histos.fill(HIST("QA/before/trknpionTPCPID"), trknpt, trknNSigmaPiTPC); + if (istrknhasTOF) { + histos.fill(HIST("QA/before/trknpionTOFPID"), trknpt, trknNSigmaPiTOF); + histos.fill(HIST("QA/before/trknpionTPCTOFPID"), trknNSigmaPiTPC, trknNSigmaPiTOF); + } + histos.fill(HIST("QA/before/trknpionpT"), trknpt); + histos.fill(HIST("QA/before/trknpionDCAxy"), negDauTrack.dcaXY()); + histos.fill(HIST("QA/before/trknpionDCAz"), negDauTrack.dcaZ()); + + histos.fill(HIST("QA/before/hDauDCASecondary"), trkkDauDCA); + histos.fill(HIST("QA/before/hDauPosDCAtoPVSecondary"), trkkDauDCAPostoPV); + histos.fill(HIST("QA/before/hDauNegDCAtoPVSecondary"), trkkDauDCANegtoPV); + + histos.fill(HIST("QA/before/hpT_Secondary"), trkkpt); + histos.fill(HIST("QA/before/hy_Secondary"), trkky); + histos.fill(HIST("QA/before/hRadiusSecondary"), trkkRadius); + histos.fill(HIST("QA/before/hDCAtoPVSecondary"), trkkDCAtoPV); + histos.fill(HIST("QA/before/hCPASecondary"), trkkCPA); + histos.fill(HIST("QA/before/hPropTauSecondary"), trkkPropTau); + histos.fill(HIST("QA/before/hInvmassSecondary"), trkkMass); + } + } if (!SecondaryCuts.cfgByPassDauPIDSelection && !selectionPIDPion(posDauTrack)) continue; @@ -1168,46 +1166,46 @@ struct Chk892pp { continue; if constexpr (!IsMix) { - if (cfgFillQAPlots) { - // Seconddary QA plots after applying cuts - - histos.fill(HIST("QA/after/trkppionTPCPID"), trkppt, trkpNSigmaPiTPC); - if (istrkphasTOF) { - histos.fill(HIST("QA/after/trkppionTOFPID"), trkppt, trkpNSigmaPiTOF); - histos.fill(HIST("QA/after/trkppionTPCTOFPID"), trkpNSigmaPiTPC, trkpNSigmaPiTOF); - } - histos.fill(HIST("QA/after/trkppionpT"), trkppt); - histos.fill(HIST("QA/after/trkppionDCAxy"), posDauTrack.dcaXY()); - histos.fill(HIST("QA/after/trkppionDCAz"), posDauTrack.dcaZ()); - - histos.fill(HIST("QA/after/trknpionTPCPID"), trknpt, trknNSigmaPiTPC); - if (istrknhasTOF) { - histos.fill(HIST("QA/after/trknpionTOFPID"), trknpt, trknNSigmaPiTOF); - histos.fill(HIST("QA/after/trknpionTPCTOFPID"), trknNSigmaPiTPC, trknNSigmaPiTOF); - } - histos.fill(HIST("QA/after/trknpionpT"), trknpt); - histos.fill(HIST("QA/after/trknpionDCAxy"), negDauTrack.dcaXY()); - histos.fill(HIST("QA/after/trknpionDCAz"), negDauTrack.dcaZ()); - - histos.fill(HIST("QA/after/hDauDCASecondary"), trkkDauDCA); - histos.fill(HIST("QA/after/hDauPosDCAtoPVSecondary"), trkkDauDCAPostoPV); - histos.fill(HIST("QA/after/hDauNegDCAtoPVSecondary"), trkkDauDCANegtoPV); - - histos.fill(HIST("QA/after/hpT_Secondary"), trkkpt); - histos.fill(HIST("QA/after/hy_Secondary"), trkky); - histos.fill(HIST("QA/after/hRadiusSecondary"), trkkRadius); - histos.fill(HIST("QA/after/hDCAtoPVSecondary"), trkkDCAtoPV); - histos.fill(HIST("QA/after/hCPASecondary"), trkkCPA); - histos.fill(HIST("QA/after/hPropTauSecondary"), trkkPropTau); - histos.fill(HIST("QA/after/hInvmassSecondary"), trkkMass); - } - histos.fill(HIST("hInvmass_K0s"), lCentrality, lResoSecondary.Pt(), lResoSecondary.M()); - } - k0sIndicies.push_back(k0sCand.index()); - } + if (cfgFillQAPlots) { + // Seconddary QA plots after applying cuts + + histos.fill(HIST("QA/after/trkppionTPCPID"), trkppt, trkpNSigmaPiTPC); + if (istrkphasTOF) { + histos.fill(HIST("QA/after/trkppionTOFPID"), trkppt, trkpNSigmaPiTOF); + histos.fill(HIST("QA/after/trkppionTPCTOFPID"), trkpNSigmaPiTPC, trkpNSigmaPiTOF); + } + histos.fill(HIST("QA/after/trkppionpT"), trkppt); + histos.fill(HIST("QA/after/trkppionDCAxy"), posDauTrack.dcaXY()); + histos.fill(HIST("QA/after/trkppionDCAz"), posDauTrack.dcaZ()); + + histos.fill(HIST("QA/after/trknpionTPCPID"), trknpt, trknNSigmaPiTPC); + if (istrknhasTOF) { + histos.fill(HIST("QA/after/trknpionTOFPID"), trknpt, trknNSigmaPiTOF); + histos.fill(HIST("QA/after/trknpionTPCTOFPID"), trknNSigmaPiTPC, trknNSigmaPiTOF); + } + histos.fill(HIST("QA/after/trknpionpT"), trknpt); + histos.fill(HIST("QA/after/trknpionDCAxy"), negDauTrack.dcaXY()); + histos.fill(HIST("QA/after/trknpionDCAz"), negDauTrack.dcaZ()); + + histos.fill(HIST("QA/after/hDauDCASecondary"), trkkDauDCA); + histos.fill(HIST("QA/after/hDauPosDCAtoPVSecondary"), trkkDauDCAPostoPV); + histos.fill(HIST("QA/after/hDauNegDCAtoPVSecondary"), trkkDauDCANegtoPV); + + histos.fill(HIST("QA/after/hpT_Secondary"), trkkpt); + histos.fill(HIST("QA/after/hy_Secondary"), trkky); + histos.fill(HIST("QA/after/hRadiusSecondary"), trkkRadius); + histos.fill(HIST("QA/after/hDCAtoPVSecondary"), trkkDCAtoPV); + histos.fill(HIST("QA/after/hCPASecondary"), trkkCPA); + histos.fill(HIST("QA/after/hPropTauSecondary"), trkkPropTau); + histos.fill(HIST("QA/after/hInvmassSecondary"), trkkMass); + } + histos.fill(HIST("hInvmass_K0s"), lCentrality, lResoSecondary.Pt(), lResoSecondary.M()); + } + k0sIndicies.push_back(k0sCand.index()); + } for (const auto& trackIndex : trackIndicies) { - auto bTrack = dTracks1.rawIteratorAt(trackIndex); + auto bTrack = dTracks1.rawIteratorAt(trackIndex); for (const auto& k0sIndex : k0sIndicies) { auto k0sCand = dTracks2.rawIteratorAt(k0sIndex); @@ -1219,30 +1217,30 @@ struct Chk892pp { // QA plots if constexpr (!IsMix) { - if (cfgFillQAPlots) { - histos.fill(HIST("QA/before/KstarRapidity"), lResoKstar.Rapidity()); - histos.fill(HIST("QA/before/kstarinvmass"), lResoKstar.M()); - } - } + if (cfgFillQAPlots) { + histos.fill(HIST("QA/before/KstarRapidity"), lResoKstar.Rapidity()); + histos.fill(HIST("QA/before/kstarinvmass"), lResoKstar.M()); + } + } if (lResoKstar.Rapidity() > KstarCuts.cfgKstarMaxRap || lResoKstar.Rapidity() < KstarCuts.cfgKstarMinRap) continue; if constexpr (!IsMix) { unsigned int typeKstar = bTrack.sign() > 0 ? BinType::kKstarP : BinType::kKstarN; - if (cfgFillQAPlots) { + if (cfgFillQAPlots) { - histos.fill(HIST("QA/after/KstarRapidity"), lResoKstar.Rapidity()); - histos.fill(HIST("QA/after/kstarinvmass"), lResoKstar.M()); - } - histos.fill(HIST("hInvmass_Kstar"), typeKstar, lCentrality, lResoKstar.Pt(), lResoKstar.M()); + histos.fill(HIST("QA/after/KstarRapidity"), lResoKstar.Rapidity()); + histos.fill(HIST("QA/after/kstarinvmass"), lResoKstar.M()); + } + histos.fill(HIST("hInvmass_Kstar"), typeKstar, lCentrality, lResoKstar.Pt(), lResoKstar.M()); if (BkgEstimationConfig.cfgFillRotBkg) { for (int i = 0; i < BkgEstimationConfig.cfgNrotBkg; i++) { auto lRotAngle = BkgEstimationConfig.cfgMinRot + i * ((BkgEstimationConfig.cfgMaxRot - BkgEstimationConfig.cfgMinRot) / (BkgEstimationConfig.cfgNrotBkg - 1)); - if (cfgFillQAPlots) { - histos.fill(HIST("QA/RotBkg/hRotBkg"), lRotAngle); - } + if (cfgFillQAPlots) { + histos.fill(HIST("QA/RotBkg/hRotBkg"), lRotAngle); + } if (BkgEstimationConfig.cfgRotPion) { lDaughterRot = lDecayDaughter_bach; // lDaughterRot.RotateZ(lRotAngle); @@ -1262,13 +1260,13 @@ struct Chk892pp { histos.fill(HIST("hInvmass_Kstar"), typeKstar, lCentrality, lResonanceRot.Pt(), lResonanceRot.M()); } } - }// IsMix - }// K0scand - }// bTrack + } // IsMix + } // K0scand + } // bTrack count++; - }// fillHistograms + } // fillHistograms void processData(EventCandidates::iterator const& collision, TrackCandidates const& tracks, @@ -1299,19 +1297,17 @@ struct Chk892pp { { buildAllowedMcIds(events); buildReferenceMcIds(mccolls, mcpart); - effK0sProcessGen(mcpart); - effK0sProcessReco(v0s); - effKstarProcessGen(mcpart); - effKstarProcessReco(v0s, tracks); + effK0sProcessGen(mcpart); + effK0sProcessReco(v0s); + effKstarProcessGen(mcpart); + effKstarProcessReco(v0s, tracks); fillSigLossNum(mcpart); fillSigLossDen(mcpart); - for (const auto& mcid : refClassIds) - { + for (const auto& mcid : refClassIds) { histos.fill(HIST("Correction/EF_den"), refCentByMcId[mcid]); } - for (const auto& mcid : allowedMcIds) - { + for (const auto& mcid : allowedMcIds) { auto iter = centTruthByAllowed.find(mcid); if (iter == centTruthByAllowed.end()) continue; @@ -1321,19 +1317,19 @@ struct Chk892pp { } size_t nIntersect = 0; - for (const auto& mcid : allowedMcIds) if (refClassIds.count(mcid)) nIntersect++; + for (const auto& mcid : allowedMcIds) + if (refClassIds.count(mcid)) + nIntersect++; histos.fill(HIST("Correction/setSizes"), 0.0, refClassIds.size()); histos.fill(HIST("Correction/setSizes"), 1.0, allowedMcIds.size()); histos.fill(HIST("Correction/setSizes"), 2.0, nIntersect); histos.fill(HIST("Correction/setSizes"), 3.0, allowedMcIds.size() - nIntersect); - for (const auto& mcc : mccolls) - { + for (const auto& mcc : mccolls) { histos.fill(HIST("Correction/MCTruthCent_all"), mcc.centFT0M()); } - for (const auto& mcid : refClassIds) - { + for (const auto& mcid : refClassIds) { auto iter = refCentByMcId.find(mcid); if (iter == refCentByMcId.end()) continue; @@ -1341,52 +1337,47 @@ struct Chk892pp { histos.fill(HIST("Correction/MCTruthCent_cut"), lCentrality); } - for (auto const& mcc : mccolls) - { + for (auto const& mcc : mccolls) { const auto mcid = mcc.globalIndex(); histos.fill(HIST("Correction/hNEventsMCTruth"), 1.0); bool passZvtx = true; - if (cfgTruthIncludeZvtx && std::abs(mcc.posZ()) > EventCuts.cfgEvtZvtx) - { + if (cfgTruthIncludeZvtx && std::abs(mcc.posZ()) > EventCuts.cfgEvtZvtx) { passZvtx = false; } - if (passZvtx) - { + if (passZvtx) { histos.fill(HIST("Correction/hNEventsMCTruth"), 2.0); auto partsThisMc = mcpart.sliceBy(perMCCollision, mcid); - if (pwglf::isINELgtNmc(partsThisMc, 0, pdg)) - { + if (pwglf::isINELgtNmc(partsThisMc, 0, pdg)) { histos.fill(HIST("Correction/hNEventsMCTruth"), 3.0); } } - if (allowedMcIds.count(mcid)) - { + if (allowedMcIds.count(mcid)) { histos.fill(HIST("Correction/hNEventsMCTruth"), 4.0); } } } PROCESS_SWITCH(Chk892pp, processMC, "Process Event for MC", true); - void processMCQA(MCEventCandidates::iterator const& collision, - MCTrackCandidates const& tracks, - MCV0Candidates const& v0s, - soa::Join const& mccolls, - aod::BCsWithTimestamps const&) - { - if (!colCuts.isSelected(collision)) - return; - if (EventCuts.cfgEvtUseRCTFlagChecker && !rctChecker(collision)) - return; + void processMCQA(MCEventCandidates::iterator const& collision, + MCTrackCandidates const& tracks, + MCV0Candidates const& v0s, + soa::Join const& mccolls, + aod::BCsWithTimestamps const&) + { + if (!colCuts.isSelected(collision)) + return; + if (EventCuts.cfgEvtUseRCTFlagChecker && !rctChecker(collision)) + return; if (!collision.isInelGt0()) return; if (!collision.has_mcCollision()) return; - auto id = collision.mcCollisionId(); + auto id = collision.mcCollisionId(); auto mccoll = mccolls.iteratorAt(id); const float lCentrality = mccoll.centFT0M(); @@ -1396,7 +1387,7 @@ struct Chk892pp { colCuts.fillQA(collision); fillHistograms(collision, tracks, v0s); - } + } PROCESS_SWITCH(Chk892pp, processMCQA, "Process Event for MC and fill QA plots", false); }; From 18b60cfe40a2e0a36897870ce6887af0ade3dfa9 Mon Sep 17 00:00:00 2001 From: SuJeong Ji <120470463+SuJeong-Ji@users.noreply.github.com> Date: Mon, 10 Nov 2025 14:25:14 +0900 Subject: [PATCH 3/4] test for o2 build issue --- PWGLF/Tasks/Resonances/chk892pp.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGLF/Tasks/Resonances/chk892pp.cxx b/PWGLF/Tasks/Resonances/chk892pp.cxx index fd4e7d8d75d..2e50e555a74 100644 --- a/PWGLF/Tasks/Resonances/chk892pp.cxx +++ b/PWGLF/Tasks/Resonances/chk892pp.cxx @@ -988,7 +988,7 @@ struct Chk892pp { } } } - } // effKstarProcessReco + } //effKstarProcessReco void fillSigLossNum(MCTrueTrackCandidates const& mcparts) { From 87908f61e2b789f93ca76aacc0ecd244e8e3a6dc Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Mon, 10 Nov 2025 05:27:52 +0000 Subject: [PATCH 4/4] Please consider the following formatting changes --- PWGLF/Tasks/Resonances/chk892pp.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGLF/Tasks/Resonances/chk892pp.cxx b/PWGLF/Tasks/Resonances/chk892pp.cxx index 2e50e555a74..fd4e7d8d75d 100644 --- a/PWGLF/Tasks/Resonances/chk892pp.cxx +++ b/PWGLF/Tasks/Resonances/chk892pp.cxx @@ -988,7 +988,7 @@ struct Chk892pp { } } } - } //effKstarProcessReco + } // effKstarProcessReco void fillSigLossNum(MCTrueTrackCandidates const& mcparts) {