From 6f68d5b786d71b049b18c8edd592a8880eb522d5 Mon Sep 17 00:00:00 2001 From: SuJeong Ji <120470463+SuJeong-Ji@users.noreply.github.com> Date: Thu, 30 Oct 2025 22:43:50 +0900 Subject: [PATCH 1/2] Hotfix: Add MC table for processMCQA --- PWGLF/Tasks/Resonances/chk892pp.cxx | 383 ++++++++++++++-------------- 1 file changed, 198 insertions(+), 185 deletions(-) diff --git a/PWGLF/Tasks/Resonances/chk892pp.cxx b/PWGLF/Tasks/Resonances/chk892pp.cxx index e0986eb7cbe..9be83ebfb96 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 @@ -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| EventCuts.cfgEventCentralityMax) continue; - - if (doprocessMC) { + + if (doprocessMC){ histos.fill(HIST("QACent_wCentCut"), lCentrality); } allowedMcIds.insert(mcid); @@ -756,7 +756,7 @@ struct Chk892pp { } template - void buildReferenceMcIds(McCollsT const& mccolls, McPartsT const& mcparts) + void buildReferenceMcIds(McCollsT const &mccolls, McPartsT const &mcparts) { refClassIds.clear(); refCentByMcId.clear(); @@ -764,18 +764,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(); @@ -901,7 +899,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) @@ -976,57 +975,60 @@ struct Chk892pp { if (std::abs(yreco) > KstarCuts.cfgKstarMaxRap) continue; histos.fill(HIST("EffKstar/recoKstar"), ptreco, lCentrality); - } + } } } // 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; @@ -1048,18 +1050,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; @@ -1067,18 +1069,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()); } @@ -1114,39 +1116,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; @@ -1156,46 +1158,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); @@ -1207,30 +1209,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); @@ -1250,13 +1252,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, @@ -1287,17 +1289,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; @@ -1307,19 +1311,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; @@ -1327,45 +1331,54 @@ 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, - 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 mccoll = collision.template mcCollision_as>(); + + auto id = collision.mcCollisionId(); + + auto mccoll = mccolls.iteratorAt(id); const float lCentrality = mccoll.centFT0M(); if (lCentrality < EventCuts.cfgEventCentralityMin || lCentrality > EventCuts.cfgEventCentralityMax) @@ -1373,7 +1386,7 @@ struct Chk892pp { colCuts.fillQA(collision); fillHistograms(collision, tracks, v0s); - } + } PROCESS_SWITCH(Chk892pp, processMCQA, "Process Event for MC and fill QA plots", false); }; From e770619663bb9ae9f17d70f617449c776cf0959a Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Thu, 30 Oct 2025 13:45:42 +0000 Subject: [PATCH 2/2] Please consider the following formatting changes --- PWGLF/Tasks/Resonances/chk892pp.cxx | 381 ++++++++++++++-------------- 1 file changed, 186 insertions(+), 195 deletions(-) diff --git a/PWGLF/Tasks/Resonances/chk892pp.cxx b/PWGLF/Tasks/Resonances/chk892pp.cxx index 9be83ebfb96..dd6a8721a8f 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 @@ -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| EventCuts.cfgEventCentralityMax) continue; - - if (doprocessMC){ + + if (doprocessMC) { histos.fill(HIST("QACent_wCentCut"), lCentrality); } allowedMcIds.insert(mcid); @@ -756,7 +756,7 @@ struct Chk892pp { } template - void buildReferenceMcIds(McCollsT const &mccolls, McPartsT const &mcparts) + void buildReferenceMcIds(McCollsT const& mccolls, McPartsT const& mcparts) { refClassIds.clear(); refCentByMcId.clear(); @@ -764,16 +764,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(); @@ -899,8 +901,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) @@ -975,60 +976,57 @@ struct Chk892pp { if (std::abs(yreco) > KstarCuts.cfgKstarMaxRap) continue; histos.fill(HIST("EffKstar/recoKstar"), ptreco, lCentrality); - } + } } } // 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; @@ -1050,18 +1048,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; @@ -1069,18 +1067,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()); } @@ -1116,39 +1114,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; @@ -1158,46 +1156,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); @@ -1209,30 +1207,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); @@ -1252,13 +1250,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, @@ -1289,19 +1287,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; @@ -1311,19 +1307,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; @@ -1331,52 +1327,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(); @@ -1386,7 +1377,7 @@ struct Chk892pp { colCuts.fillQA(collision); fillHistograms(collision, tracks, v0s); - } + } PROCESS_SWITCH(Chk892pp, processMCQA, "Process Event for MC and fill QA plots", false); };