From 8f771532803fa59084a8793aa79a6d8d2a5a1bc3 Mon Sep 17 00:00:00 2001 From: nepeivodaRS Date: Mon, 13 Oct 2025 18:46:36 +0200 Subject: [PATCH 1/4] str-upd ### Summary - Added FV0 detector to RCT checks. - Removed the collision iterator to fix event ordering issues. --- .../Strangeness/cascqaanalysis.cxx | 40 +- .../Tasks/Strangeness/derivedupcanalysis.cxx | 368 ++++++++++-------- 2 files changed, 248 insertions(+), 160 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/cascqaanalysis.cxx b/PWGLF/TableProducer/Strangeness/cascqaanalysis.cxx index 6a3310d316f..2542f963ad9 100644 --- a/PWGLF/TableProducer/Strangeness/cascqaanalysis.cxx +++ b/PWGLF/TableProducer/Strangeness/cascqaanalysis.cxx @@ -34,6 +34,7 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; +using namespace o2::aod::rctsel; // using DauTracks = soa::Join; using TrkPidInfo = soa::Join; @@ -79,6 +80,14 @@ struct Cascqaanalysis { Configurable isNoITSROFrameBorder{"isNoITSROFrameBorder", 1, "ITS ROF border cut"}; Configurable isNoCollInTimeRangeNarrow{"isNoCollInTimeRangeNarrow", 1, "No collisions in +-2us window"}; + Configurable requireRCTFlagChecker{"requireRCTFlagChecker", true, "Check event quality in run condition table"}; + Configurable cfgEvtRCTFlagCheckerLabel{"cfgEvtRCTFlagCheckerLabel", "CBT_hadronPID", "Evt sel: RCT flag checker label"}; + Configurable cfgEvtRCTFlagCheckerZDCCheck{"cfgEvtRCTFlagCheckerZDCCheck", false, "Evt sel: RCT flag checker ZDC check"}; + Configurable cfgEvtRCTFlagCheckerFV0Check{"cfgEvtRCTFlagCheckerFV0Check", false, "Evt sel: RCT flag checker FV0 check"}; + Configurable cfgEvtRCTFlagCheckerLimitAcceptAsBad{"cfgEvtRCTFlagCheckerLimitAcceptAsBad", false, "Evt sel: RCT flag checker treat Limited Acceptance As Bad"}; + + RCTFlagsChecker rctChecker; + // Cascade selection criteria Configurable scalefactor{"scalefactor", 1.0, "Scaling factor"}; Configurable casccospa{"casccospa", 0.97, "Casc CosPA"}; @@ -119,9 +128,9 @@ struct Cascqaanalysis { { TString hCandidateCounterLabels[4] = {"All candidates", "passed topo cuts", "has associated MC particle", "associated with Xi(Omega)"}; TString hNEventsMCLabels[6] = {"All", "z vrtx", "INEL", "INEL>0", "INEL>1", "Associated with rec. collision"}; - TString hNEventsLabels[13] = {"All", "kIsTriggerTVX", "kNoTimeFrameBorder", "kNoITSROFrameBorder", "kIsVertexITSTPC", "kNoSameBunchPileup", "kIsGoodZvtxFT0vsPV", "isVertexTOFmatched", "kNoCollInTimeRangeNarrow", "z vrtx", "INEL", "INEL>0", "INEL>1"}; + TString hNEventsLabels[14] = {"All", "kIsTriggerTVX", "kNoTimeFrameBorder", "kNoITSROFrameBorder", "kIsVertexITSTPC", "kNoSameBunchPileup", "kIsGoodZvtxFT0vsPV", "isVertexTOFmatched", "kNoCollInTimeRangeNarrow", "z vrtx", "RCTFlagsChecker", "INEL", "INEL>0", "INEL>1"}; - registry.add("hNEvents", "hNEvents", {HistType::kTH1D, {{13, 0.f, 13.f}}}); + registry.add("hNEvents", "hNEvents", {HistType::kTH1D, {{14, 0.f, 14.f}}}); for (int n = 1; n <= registry.get(HIST("hNEvents"))->GetNbinsX(); n++) { registry.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(n, hNEventsLabels[n - 1]); @@ -169,6 +178,13 @@ struct Cascqaanalysis { registry.add("hFT0MFV0Asignal", "hFT0MFV0Asignal", {HistType::kTH2D, {signalFT0MAxis, signalFV0AAxis}}); registry.add("hFT0MsignalPVContr", "hFT0MsignalPVContr", {HistType::kTH3D, {signalFT0MAxis, multNTracksAxis, eventTypeAxis}}); } + + + rctChecker.init(cfgEvtRCTFlagCheckerLabel, cfgEvtRCTFlagCheckerZDCCheck, cfgEvtRCTFlagCheckerLimitAcceptAsBad); + if (cfgEvtRCTFlagCheckerFV0Check) { + rctChecker.set(o2::aod::rctsel::kFV0Bad); + } + } Filter preFilter = @@ -256,14 +272,14 @@ struct Cascqaanalysis { { // 0 - INEL, 1 - INEL>0, 2 - INEL>1 int evFlag = 0; - registry.fill(HIST("hNEvents"), 10.5); // INEL + registry.fill(HIST("hNEvents"), 11.5); // INEL if (collision.isInelGt0()) { evFlag += 1; - registry.fill(HIST("hNEvents"), 11.5); // INEL>0 + registry.fill(HIST("hNEvents"), 12.5); // INEL>0 } if (collision.isInelGt1()) { evFlag += 1; - registry.fill(HIST("hNEvents"), 12.5); // INEL>1 + registry.fill(HIST("hNEvents"), 13.5); // INEL>1 } return evFlag; } @@ -347,6 +363,14 @@ struct Cascqaanalysis { registry.fill(HIST("hZCollision"), collision.posZ()); } + // RCTFlagChecker selection + if (requireRCTFlagChecker && !rctChecker(collision)) { + return false; + } + if (isFillEventSelectionQA) { + registry.fill(HIST("hNEvents"), 10.5); + } + return true; } @@ -483,15 +507,15 @@ struct Cascqaanalysis { uint16_t nchFV0 = getGenNchInFV0Aregion(mcPartSlice); int evType = 0; - registry.fill(HIST("hNEvents"), 10.5); // INEL + registry.fill(HIST("hNEvents"), 11.5); // INEL // Rec. collision associated with INEL>0 gen. one if (pwglf::isINELgtNmc(mcPartSlice, 0, pdgDB)) { - registry.fill(HIST("hNEvents"), 11.5); // INEL + registry.fill(HIST("hNEvents"), 12.5); // INEL evType++; } // Rec. collision associated with INEL>1 gen. one if (pwglf::isINELgtNmc(mcPartSlice, 1, pdgDB)) { - registry.fill(HIST("hNEvents"), 12.5); // INEL + registry.fill(HIST("hNEvents"), 13.5); // INEL evType++; } diff --git a/PWGLF/Tasks/Strangeness/derivedupcanalysis.cxx b/PWGLF/Tasks/Strangeness/derivedupcanalysis.cxx index b3021033d32..0ee12cded84 100644 --- a/PWGLF/Tasks/Strangeness/derivedupcanalysis.cxx +++ b/PWGLF/Tasks/Strangeness/derivedupcanalysis.cxx @@ -62,10 +62,11 @@ using NeutronsMC = soa::Join; using CascMCCoresFull = soa::Join; +using StraCollisonsFull = soa::Join; using StraCollisonFull = soa::Join::iterator; -using StraCollisonFullMC = soa::Join::iterator; using StraCollisonsFullMC = soa::Join; +using StraCollisonFullMC = soa::Join::iterator; using StraMCCollisionsFull = soa::Join; using V0MCCoresFull = soa::Join; @@ -102,11 +103,16 @@ struct Derivedupcanalysis { Configurable requireRCTFlagChecker{"requireRCTFlagChecker", true, "Check event quality in run condition table"}; Configurable cfgEvtRCTFlagCheckerLabel{"cfgEvtRCTFlagCheckerLabel", "CBT_hadronPID", "Evt sel: RCT flag checker label"}; Configurable cfgEvtRCTFlagCheckerZDCCheck{"cfgEvtRCTFlagCheckerZDCCheck", true, "Evt sel: RCT flag checker ZDC check"}; + Configurable cfgEvtRCTFlagCheckerFV0Check{"cfgEvtRCTFlagCheckerFV0Check", true, "Evt sel: RCT flag checker FV0 check"}; Configurable cfgEvtRCTFlagCheckerLimitAcceptAsBad{"cfgEvtRCTFlagCheckerLimitAcceptAsBad", false, "Evt sel: RCT flag checker treat Limited Acceptance As Bad"}; } evSels; RCTFlagsChecker rctChecker; + // Custom grouping + std::vector> v0sGrouped; + std::vector> cascadesGrouped; + Configurable verbose{"verbose", false, "additional printouts"}; // Acceptance selections @@ -744,6 +750,9 @@ struct Derivedupcanalysis { } rctChecker.init(evSels.cfgEvtRCTFlagCheckerLabel, evSels.cfgEvtRCTFlagCheckerZDCCheck, evSels.cfgEvtRCTFlagCheckerLimitAcceptAsBad); + if (evSels.cfgEvtRCTFlagCheckerFV0Check) { + rctChecker.set(o2::aod::rctsel::kFV0Bad); + } // initialise bit masks setBits(maskTopologicalV0, {selV0CosPA, selDCANegToPV, selDCAPosToPV, selDCAV0Dau, selV0Radius, selV0RadiusMax}); @@ -933,6 +942,7 @@ struct Derivedupcanalysis { histos.add("eventQA/mc/hGenEventFT0ampl", "hGenEventFT0ampl", kTH1D, {axisDetectors.axisFT0Aampl}); histos.add("eventQA/mc/hGenEventCentrality", "hGenEventCentrality", kTH1D, {axisFT0Cqa}); histos.add("eventQA/mc/hGeneratorsId", "hGeneratorsId", kTH1D, {axisGeneratorIds}); + histos.add("eventQA/mc/hSelGeneratorsId", "hSelGeneratorsId", kTH1D, {axisGeneratorIds}); } if (doprocessV0sMC || doprocessCascadesMC) { @@ -1073,7 +1083,16 @@ struct Derivedupcanalysis { histos.fill(HIST("eventQA/hSelGapSide"), gap); histos.fill(HIST("eventQA/hFT0"), collision.totalFT0AmplitudeA(), collision.totalFT0AmplitudeC(), gap); histos.fill(HIST("eventQA/hFDD"), collision.totalFDDAmplitudeA(), collision.totalFDDAmplitudeC(), gap); - histos.fill(HIST("eventQA/hZN"), collision.energyCommonZNA(), collision.energyCommonZNC(), gap); + + auto zna = collision.energyCommonZNA(); + auto znc = collision.energyCommonZNC(); + constexpr float inf_f = std::numeric_limits::infinity(); + + if (zna == -inf_f) histos.fill(HIST("eventQA/hZN"), -1, znc, gap); + else if (znc == -inf_f) histos.fill(HIST("eventQA/hZN"), zna, -1, gap); + else if (zna == -999 && znc == -999) histos.fill(HIST("eventQA/hZN"), -2, -2, gap); + else if (zna == -999 || znc == -999) LOG(warning) << "Only one ZDC signal is -999"; + } template @@ -1791,6 +1810,8 @@ struct Derivedupcanalysis { continue; } + histos.fill(HIST("eventQA/mc/hSelGeneratorsId"), mcCollision.generatorsID()); + histos.fill(HIST("eventQA/mc/hEventSelectionMC"), 0.0, mcCollision.multMCNParticlesEta08(), mcCollision.generatorsID()); if (std::abs(mcCollision.posZ()) > maxZVtxPosition) @@ -1907,35 +1928,45 @@ struct Derivedupcanalysis { } } - void processV0s(StraCollisonFull const& collision, V0Candidates const& fullV0s, DauTracks const&) + void processV0s(StraCollisonsFull const& collisions, V0Candidates const& fullV0s, DauTracks const&) { - if (!acceptEvent(collision, true)) { - return; - } // event is accepted + v0sGrouped.clear(); + v0sGrouped.resize(collisions.size()); + for (const auto& v0 : fullV0s) { + v0sGrouped[v0.straCollisionId()].push_back(v0.globalIndex()); + } + for (const auto& collision : collisions) { + if (!acceptEvent(collision, true)) { + continue; + } // event is accepted - histos.fill(HIST("eventQA/hRawGapSide"), collision.gapSide()); + histos.fill(HIST("eventQA/hRawGapSide"), collision.gapSide()); - int selGapSide = collision.isUPC() ? getGapSide(collision) : -1; - if (evSels.studyUPConly && (selGapSide < -0.5)) - return; + int selGapSide = collision.isUPC() ? getGapSide(collision) : -1; + if (evSels.studyUPConly && (selGapSide < -0.5)) + continue; - fillHistogramsQA(collision, selGapSide); + fillHistogramsQA(collision, selGapSide); - for (const auto& v0 : fullV0s) { - if ((v0.v0Type() != v0cuts.v0TypeSelection) && (v0cuts.v0TypeSelection > 0)) - continue; // skip V0s that are not standard + std::size_t nV0sThisColl = v0sGrouped[collision.globalIndex()].size(); - std::bitset selMap = computeBitmapV0(v0, collision); + for (std::size_t i = 0 ; i < nV0sThisColl ; i++) { + auto v0 = fullV0s.rawIteratorAt(v0sGrouped[collision.globalIndex()][i]); + if ((v0.v0Type() != v0cuts.v0TypeSelection) && (v0cuts.v0TypeSelection > 0)) + continue; // skip V0s that are not standard - // consider all species for the candidate - setBits(selMap, {selConsiderK0Short, selConsiderLambda, selConsiderAntiLambda, - selPhysPrimK0Short, selPhysPrimLambda, selPhysPrimAntiLambda}); + std::bitset selMap = computeBitmapV0(v0, collision); - analyseV0Candidate(v0, collision, selGapSide, selMap); - } // end v0 loop + // consider all species for the candidate + setBits(selMap, {selConsiderK0Short, selConsiderLambda, selConsiderAntiLambda, + selPhysPrimK0Short, selPhysPrimLambda, selPhysPrimAntiLambda}); + + analyseV0Candidate(v0, collision, selGapSide, selMap); + } // end v0 loop + } } - void processV0sMC(StraCollisonFullMC const& collision, + void processV0sMC(StraCollisonsFullMC const& collisions, V0CandidatesMC const& fullV0s, DauTracks const&, aod::MotherMCParts const&, @@ -1943,114 +1974,136 @@ struct Derivedupcanalysis { V0MCCoresFull const&, NeutronsMC const& neutrons) { - if (!collision.has_straMCCollision()) { - histos.fill(HIST("eventQA/mc/hFakeEvents"), 0); // no assoc. MC collisions - return; + v0sGrouped.clear(); + v0sGrouped.resize(collisions.size()); + for (const auto& v0 : fullV0s) { + v0sGrouped[v0.straCollisionId()].push_back(v0.globalIndex()); } - const auto& mcCollision = collision.straMCCollision_as(); // take gen. collision associated to the rec. collision + for (const auto& collision : collisions) { + if (!collision.has_straMCCollision()) { + histos.fill(HIST("eventQA/mc/hFakeEvents"), 0); // no assoc. MC collisions + continue; + } - if (std::find(generatorIds->begin(), generatorIds->end(), mcCollision.generatorsID()) == generatorIds->end()) { - return; - } + const auto& mcCollision = collision.straMCCollision_as(); // take gen. collision associated to the rec. collision - if (!acceptEvent(collision, true)) { - return; - } // event is accepted + if (std::find(generatorIds->begin(), generatorIds->end(), mcCollision.generatorsID()) == generatorIds->end()) { + continue; + } - histos.fill(HIST("eventQA/hRawGapSide"), collision.gapSide()); + if (!acceptEvent(collision, true)) { + continue; + } // event is accepted - int selGapSide = collision.isUPC() ? getGapSide(collision) : -1; - int selGapSideNoNeutrons = selGapSide; + histos.fill(HIST("eventQA/hRawGapSide"), collision.gapSide()); - auto groupedNeutrons = neutrons.sliceBy(neutronsPerMcCollision, mcCollision.globalIndex()); - if (checkNeutronsInMC) { - for (const auto& neutron : groupedNeutrons) { - if (selGapSide < -0.5) - break; + int selGapSide = collision.isUPC() ? getGapSide(collision) : -1; + int selGapSideNoNeutrons = selGapSide; - const float eta = neutron.eta(); - switch (selGapSide) { - case 0: // SGA - if (eta > neutronEtaCut) - selGapSide = -1; - break; - case 1: // SGC - if (eta < -neutronEtaCut) - selGapSide = -1; - break; - case 2: // DG - if (eta > neutronEtaCut) - selGapSide = 1; - else if (eta < -neutronEtaCut) - selGapSide = 0; + auto groupedNeutrons = neutrons.sliceBy(neutronsPerMcCollision, mcCollision.globalIndex()); + if (checkNeutronsInMC) { + for (const auto& neutron : groupedNeutrons) { + if (selGapSide < -0.5) break; + + const float eta = neutron.eta(); + switch (selGapSide) { + case 0: // SGA + if (eta > neutronEtaCut) + selGapSide = -1; + break; + case 1: // SGC + if (eta < -neutronEtaCut) + selGapSide = -1; + break; + case 2: // DG + if (eta > neutronEtaCut) + selGapSide = 1; + else if (eta < -neutronEtaCut) + selGapSide = 0; + break; + } } } - } - if (evSels.studyUPConly && (selGapSide < -0.5)) - return; + if (evSels.studyUPConly && (selGapSide < -0.5)) + continue; - histos.fill(HIST("eventQA/hSelGapSideNoNeutrons"), selGapSideNoNeutrons); - fillHistogramsQA(collision, selGapSide); + histos.fill(HIST("eventQA/hSelGapSideNoNeutrons"), selGapSideNoNeutrons); + fillHistogramsQA(collision, selGapSide); - histos.fill(HIST("eventQA/mc/hNTracksGlobalvsMCNParticlesEta08rec"), collision.multNTracksGlobal(), mcCollision.multMCNParticlesEta08()); - histos.fill(HIST("eventQA/mc/hNTracksPVeta1vsMCNParticlesEta10rec"), collision.multNTracksPVeta1(), mcCollision.multMCNParticlesEta10()); - histos.fill(HIST("eventQA/mc/hNTracksGlobalvstotalMultMCParticles"), collision.multNTracksGlobal(), mcCollision.totalMultMCParticles()); - histos.fill(HIST("eventQA/mc/hNTracksPVeta1vstotalMultMCParticles"), collision.multNTracksPVeta1(), mcCollision.totalMultMCParticles()); + histos.fill(HIST("eventQA/mc/hNTracksGlobalvsMCNParticlesEta08rec"), collision.multNTracksGlobal(), mcCollision.multMCNParticlesEta08()); + histos.fill(HIST("eventQA/mc/hNTracksPVeta1vsMCNParticlesEta10rec"), collision.multNTracksPVeta1(), mcCollision.multMCNParticlesEta10()); + histos.fill(HIST("eventQA/mc/hNTracksGlobalvstotalMultMCParticles"), collision.multNTracksGlobal(), mcCollision.totalMultMCParticles()); + histos.fill(HIST("eventQA/mc/hNTracksPVeta1vstotalMultMCParticles"), collision.multNTracksPVeta1(), mcCollision.totalMultMCParticles()); - for (const auto& v0 : fullV0s) { - if ((v0.v0Type() != v0cuts.v0TypeSelection) && (v0cuts.v0TypeSelection > 0)) - continue; // skip V0s that are not standard + std::size_t nV0sThisColl = v0sGrouped[collision.globalIndex()].size(); + + for (std::size_t i = 0 ; i < nV0sThisColl ; i++) { + auto v0 = fullV0s.rawIteratorAt(v0sGrouped[collision.globalIndex()][i]); + if ((v0.v0Type() != v0cuts.v0TypeSelection) && (v0cuts.v0TypeSelection > 0)) + continue; // skip V0s that are not standard - std::bitset selMap = computeBitmapV0(v0, collision); + std::bitset selMap = computeBitmapV0(v0, collision); - if (doMCAssociation) { - if (v0.has_v0MCCore()) { - const auto& v0MC = v0.v0MCCore_as(); - computeV0MCAssociation(v0MC, selMap); - if (calculateFeeddownMatrix) { - fillFeeddownMatrix(collision, v0, selMap); + if (doMCAssociation) { + if (v0.has_v0MCCore()) { + const auto& v0MC = v0.v0MCCore_as(); + computeV0MCAssociation(v0MC, selMap); + if (calculateFeeddownMatrix) { + fillFeeddownMatrix(collision, v0, selMap); + } } + } else { + // consider all species for the candidate + setBits(selMap, {selConsiderK0Short, selConsiderLambda, selConsiderAntiLambda, + selPhysPrimK0Short, selPhysPrimLambda, selPhysPrimAntiLambda}); } - } else { - // consider all species for the candidate - setBits(selMap, {selConsiderK0Short, selConsiderLambda, selConsiderAntiLambda, - selPhysPrimK0Short, selPhysPrimLambda, selPhysPrimAntiLambda}); - } - analyseV0Candidate(v0, collision, selGapSide, selMap); - } // end v0 loop + analyseV0Candidate(v0, collision, selGapSide, selMap); + } // end v0 loop + } } - void processCascades(StraCollisonFull const& collision, + void processCascades(StraCollisonsFull const& collisions, CascadeCandidates const& fullCascades, DauTracks const&) { - if (!acceptEvent(collision, true)) { - return; - } // event is accepted + cascadesGrouped.clear(); + cascadesGrouped.resize(collisions.size()); + for (const auto& cascade : fullCascades) { + cascadesGrouped[cascade.straCollisionId()].push_back(cascade.globalIndex()); + } - histos.fill(HIST("eventQA/hRawGapSide"), collision.gapSide()); + for (const auto& collision : collisions) { + if (!acceptEvent(collision, true)) { + continue; + } // event is accepted - int selGapSide = collision.isUPC() ? getGapSide(collision) : -1; - if (evSels.studyUPConly && (selGapSide < -0.5)) - return; + histos.fill(HIST("eventQA/hRawGapSide"), collision.gapSide()); - fillHistogramsQA(collision, selGapSide); + int selGapSide = collision.isUPC() ? getGapSide(collision) : -1; + if (evSels.studyUPConly && (selGapSide < -0.5)) + continue; + + fillHistogramsQA(collision, selGapSide); - for (const auto& casc : fullCascades) { - std::bitset selMap = computeBitmapCascade(casc, collision); - // the candidate may belong to any particle species - setBits(selMap, {selConsiderXi, selConsiderAntiXi, selConsiderOmega, selConsiderAntiOmega, - selPhysPrimXi, selPhysPrimAntiXi, selPhysPrimOmega, selPhysPrimAntiOmega}); + std::size_t nCascadesThisColl = cascadesGrouped[collision.globalIndex()].size(); - analyseCascCandidate(casc, collision, selGapSide, selMap); - } // end casc loop + for (std::size_t i = 0 ; i < nCascadesThisColl ; i++) { + auto casc = fullCascades.rawIteratorAt(cascadesGrouped[collision.globalIndex()][i]); + std::bitset selMap = computeBitmapCascade(casc, collision); + // the candidate may belong to any particle species + setBits(selMap, {selConsiderXi, selConsiderAntiXi, selConsiderOmega, selConsiderAntiOmega, + selPhysPrimXi, selPhysPrimAntiXi, selPhysPrimOmega, selPhysPrimAntiOmega}); + + analyseCascCandidate(casc, collision, selGapSide, selMap); + } // end casc loop + } } - void processCascadesMC(StraCollisonFullMC const& collision, + void processCascadesMC(StraCollisonsFullMC const& collisions, CascadeCandidatesMC const& fullCascades, DauTracks const&, aod::MotherMCParts const&, @@ -2058,79 +2111,90 @@ struct Derivedupcanalysis { CascMCCoresFull const&, NeutronsMC const& neutrons) { - if (!collision.has_straMCCollision()) { - histos.fill(HIST("eventQA/mc/hFakeEvents"), 0); // no assoc. MC collisions - return; + cascadesGrouped.clear(); + cascadesGrouped.resize(collisions.size()); + for (const auto& cascade : fullCascades) { + cascadesGrouped[cascade.straCollisionId()].push_back(cascade.globalIndex()); } - const auto& mcCollision = collision.straMCCollision_as(); // take gen. collision associated to the rec. collision + for (const auto& collision : collisions) { + if (!collision.has_straMCCollision()) { + histos.fill(HIST("eventQA/mc/hFakeEvents"), 0); // no assoc. MC collisions + continue; + } - if (std::find(generatorIds->begin(), generatorIds->end(), mcCollision.generatorsID()) == generatorIds->end()) { - return; - } + const auto& mcCollision = collision.straMCCollision_as(); // take gen. collision associated to the rec. collision - if (!acceptEvent(collision, true)) { - return; - } // event is accepted + if (std::find(generatorIds->begin(), generatorIds->end(), mcCollision.generatorsID()) == generatorIds->end()) { + continue; + } - histos.fill(HIST("eventQA/hRawGapSide"), collision.gapSide()); + if (!acceptEvent(collision, true)) { + continue; + } // event is accepted - int selGapSide = collision.isUPC() ? getGapSide(collision) : -1; - int selGapSideNoNeutrons = selGapSide; + histos.fill(HIST("eventQA/hRawGapSide"), collision.gapSide()); - auto groupedNeutrons = neutrons.sliceBy(neutronsPerMcCollision, mcCollision.globalIndex()); - if (checkNeutronsInMC) { - for (const auto& neutron : groupedNeutrons) { - if (selGapSide < -0.5) - break; + int selGapSide = collision.isUPC() ? getGapSide(collision) : -1; + int selGapSideNoNeutrons = selGapSide; - const float eta = neutron.eta(); - switch (selGapSide) { - case 0: // SGA - if (eta > neutronEtaCut) - selGapSide = -1; - break; - case 1: // SGC - if (eta < -neutronEtaCut) - selGapSide = -1; - break; - case 2: // DG - if (eta > neutronEtaCut) - selGapSide = 1; - else if (eta < -neutronEtaCut) - selGapSide = 0; + auto groupedNeutrons = neutrons.sliceBy(neutronsPerMcCollision, mcCollision.globalIndex()); + if (checkNeutronsInMC) { + for (const auto& neutron : groupedNeutrons) { + if (selGapSide < -0.5) break; + + const float eta = neutron.eta(); + switch (selGapSide) { + case 0: // SGA + if (eta > neutronEtaCut) + selGapSide = -1; + break; + case 1: // SGC + if (eta < -neutronEtaCut) + selGapSide = -1; + break; + case 2: // DG + if (eta > neutronEtaCut) + selGapSide = 1; + else if (eta < -neutronEtaCut) + selGapSide = 0; + break; + } } } - } - if (evSels.studyUPConly && (selGapSide < -0.5)) - return; + if (evSels.studyUPConly && (selGapSide < -0.5)) + continue; - histos.fill(HIST("eventQA/hSelGapSideNoNeutrons"), selGapSideNoNeutrons); - fillHistogramsQA(collision, selGapSide); + histos.fill(HIST("eventQA/hSelGapSideNoNeutrons"), selGapSideNoNeutrons); + fillHistogramsQA(collision, selGapSide); - histos.fill(HIST("eventQA/mc/hNTracksGlobalvsMCNParticlesEta08rec"), collision.multNTracksGlobal(), mcCollision.multMCNParticlesEta08()); - histos.fill(HIST("eventQA/mc/hNTracksPVeta1vsMCNParticlesEta10rec"), collision.multNTracksPVeta1(), mcCollision.multMCNParticlesEta10()); - histos.fill(HIST("eventQA/mc/hNTracksGlobalvstotalMultMCParticles"), collision.multNTracksGlobal(), mcCollision.totalMultMCParticles()); - histos.fill(HIST("eventQA/mc/hNTracksPVeta1vstotalMultMCParticles"), collision.multNTracksPVeta1(), mcCollision.totalMultMCParticles()); + histos.fill(HIST("eventQA/mc/hNTracksGlobalvsMCNParticlesEta08rec"), collision.multNTracksGlobal(), mcCollision.multMCNParticlesEta08()); + histos.fill(HIST("eventQA/mc/hNTracksPVeta1vsMCNParticlesEta10rec"), collision.multNTracksPVeta1(), mcCollision.multMCNParticlesEta10()); + histos.fill(HIST("eventQA/mc/hNTracksGlobalvstotalMultMCParticles"), collision.multNTracksGlobal(), mcCollision.totalMultMCParticles()); + histos.fill(HIST("eventQA/mc/hNTracksPVeta1vstotalMultMCParticles"), collision.multNTracksPVeta1(), mcCollision.totalMultMCParticles()); - for (const auto& casc : fullCascades) { - std::bitset selMap = computeBitmapCascade(casc, collision); + std::size_t nCascadesThisColl = cascadesGrouped[collision.globalIndex()].size(); - if (doMCAssociation) { - if (casc.has_cascMCCore()) { - const auto& cascMC = casc.cascMCCore_as(); - computeCascadeMCAssociation(cascMC, selMap); + for (std::size_t i = 0 ; i < nCascadesThisColl ; i++) { + auto casc = fullCascades.rawIteratorAt(cascadesGrouped[collision.globalIndex()][i]); + std::bitset selMap = computeBitmapCascade(casc, collision); + + if (doMCAssociation) { + if (casc.has_cascMCCore()) { + const auto& cascMC = casc.cascMCCore_as(); + computeCascadeMCAssociation(cascMC, selMap); + } + } else { + // the candidate may belong to any particle species + setBits(selMap, {selConsiderXi, selConsiderAntiXi, selConsiderOmega, selConsiderAntiOmega, + selPhysPrimXi, selPhysPrimAntiXi, selPhysPrimOmega, selPhysPrimAntiOmega}); } - } else { - // the candidate may belong to any particle species - setBits(selMap, {selConsiderXi, selConsiderAntiXi, selConsiderOmega, selConsiderAntiOmega, - selPhysPrimXi, selPhysPrimAntiXi, selPhysPrimOmega, selPhysPrimAntiOmega}); - } - analyseCascCandidate(casc, collision, selGapSide, selMap); - } // end casc loop + analyseCascCandidate(casc, collision, selGapSide, selMap); + } // end casc loop + } } void processGenerated(StraMCCollisionsFull const& mcCollisions, From 2799f7ef7d6d1a36608cfc7ebe45b0d1b607f652 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Mon, 13 Oct 2025 16:47:56 +0000 Subject: [PATCH 2/4] Please consider the following formatting changes --- .../Strangeness/cascqaanalysis.cxx | 2 -- .../Tasks/Strangeness/derivedupcanalysis.cxx | 21 +++++++++++-------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/cascqaanalysis.cxx b/PWGLF/TableProducer/Strangeness/cascqaanalysis.cxx index 2542f963ad9..7a50c6454ae 100644 --- a/PWGLF/TableProducer/Strangeness/cascqaanalysis.cxx +++ b/PWGLF/TableProducer/Strangeness/cascqaanalysis.cxx @@ -179,12 +179,10 @@ struct Cascqaanalysis { registry.add("hFT0MsignalPVContr", "hFT0MsignalPVContr", {HistType::kTH3D, {signalFT0MAxis, multNTracksAxis, eventTypeAxis}}); } - rctChecker.init(cfgEvtRCTFlagCheckerLabel, cfgEvtRCTFlagCheckerZDCCheck, cfgEvtRCTFlagCheckerLimitAcceptAsBad); if (cfgEvtRCTFlagCheckerFV0Check) { rctChecker.set(o2::aod::rctsel::kFV0Bad); } - } Filter preFilter = diff --git a/PWGLF/Tasks/Strangeness/derivedupcanalysis.cxx b/PWGLF/Tasks/Strangeness/derivedupcanalysis.cxx index 0ee12cded84..13945029013 100644 --- a/PWGLF/Tasks/Strangeness/derivedupcanalysis.cxx +++ b/PWGLF/Tasks/Strangeness/derivedupcanalysis.cxx @@ -1088,11 +1088,14 @@ struct Derivedupcanalysis { auto znc = collision.energyCommonZNC(); constexpr float inf_f = std::numeric_limits::infinity(); - if (zna == -inf_f) histos.fill(HIST("eventQA/hZN"), -1, znc, gap); - else if (znc == -inf_f) histos.fill(HIST("eventQA/hZN"), zna, -1, gap); - else if (zna == -999 && znc == -999) histos.fill(HIST("eventQA/hZN"), -2, -2, gap); - else if (zna == -999 || znc == -999) LOG(warning) << "Only one ZDC signal is -999"; - + if (zna == -inf_f) + histos.fill(HIST("eventQA/hZN"), -1, znc, gap); + else if (znc == -inf_f) + histos.fill(HIST("eventQA/hZN"), zna, -1, gap); + else if (zna == -999 && znc == -999) + histos.fill(HIST("eventQA/hZN"), -2, -2, gap); + else if (zna == -999 || znc == -999) + LOG(warning) << "Only one ZDC signal is -999"; } template @@ -1950,7 +1953,7 @@ struct Derivedupcanalysis { std::size_t nV0sThisColl = v0sGrouped[collision.globalIndex()].size(); - for (std::size_t i = 0 ; i < nV0sThisColl ; i++) { + for (std::size_t i = 0; i < nV0sThisColl; i++) { auto v0 = fullV0s.rawIteratorAt(v0sGrouped[collision.globalIndex()][i]); if ((v0.v0Type() != v0cuts.v0TypeSelection) && (v0cuts.v0TypeSelection > 0)) continue; // skip V0s that are not standard @@ -2040,7 +2043,7 @@ struct Derivedupcanalysis { std::size_t nV0sThisColl = v0sGrouped[collision.globalIndex()].size(); - for (std::size_t i = 0 ; i < nV0sThisColl ; i++) { + for (std::size_t i = 0; i < nV0sThisColl; i++) { auto v0 = fullV0s.rawIteratorAt(v0sGrouped[collision.globalIndex()][i]); if ((v0.v0Type() != v0cuts.v0TypeSelection) && (v0cuts.v0TypeSelection > 0)) continue; // skip V0s that are not standard @@ -2091,7 +2094,7 @@ struct Derivedupcanalysis { std::size_t nCascadesThisColl = cascadesGrouped[collision.globalIndex()].size(); - for (std::size_t i = 0 ; i < nCascadesThisColl ; i++) { + for (std::size_t i = 0; i < nCascadesThisColl; i++) { auto casc = fullCascades.rawIteratorAt(cascadesGrouped[collision.globalIndex()][i]); std::bitset selMap = computeBitmapCascade(casc, collision); // the candidate may belong to any particle species @@ -2177,7 +2180,7 @@ struct Derivedupcanalysis { std::size_t nCascadesThisColl = cascadesGrouped[collision.globalIndex()].size(); - for (std::size_t i = 0 ; i < nCascadesThisColl ; i++) { + for (std::size_t i = 0; i < nCascadesThisColl; i++) { auto casc = fullCascades.rawIteratorAt(cascadesGrouped[collision.globalIndex()][i]); std::bitset selMap = computeBitmapCascade(casc, collision); From 33628a47e905c533d378240e467ab5db7fcef1c7 Mon Sep 17 00:00:00 2001 From: nepeivodaRS Date: Mon, 13 Oct 2025 18:56:58 +0200 Subject: [PATCH 3/4] add required headers --- PWGLF/TableProducer/Strangeness/cascqaanalysis.cxx | 1 + PWGLF/Tasks/Strangeness/derivedupcanalysis.cxx | 1 + 2 files changed, 2 insertions(+) diff --git a/PWGLF/TableProducer/Strangeness/cascqaanalysis.cxx b/PWGLF/TableProducer/Strangeness/cascqaanalysis.cxx index 2542f963ad9..f7496b0b6c3 100644 --- a/PWGLF/TableProducer/Strangeness/cascqaanalysis.cxx +++ b/PWGLF/TableProducer/Strangeness/cascqaanalysis.cxx @@ -16,6 +16,7 @@ #include #include #include +#include #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" diff --git a/PWGLF/Tasks/Strangeness/derivedupcanalysis.cxx b/PWGLF/Tasks/Strangeness/derivedupcanalysis.cxx index 0ee12cded84..02f7c3ea4e2 100644 --- a/PWGLF/Tasks/Strangeness/derivedupcanalysis.cxx +++ b/PWGLF/Tasks/Strangeness/derivedupcanalysis.cxx @@ -22,6 +22,7 @@ #include #include #include +#include #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" From 7bcbd5777ae765fa97ffbcf64b39bb2e45a4164b Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Mon, 13 Oct 2025 16:58:02 +0000 Subject: [PATCH 4/4] Please consider the following formatting changes --- .../Strangeness/cascqaanalysis.cxx | 30 +++++++----- .../Tasks/Strangeness/derivedupcanalysis.cxx | 49 ++++++++++--------- 2 files changed, 43 insertions(+), 36 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/cascqaanalysis.cxx b/PWGLF/TableProducer/Strangeness/cascqaanalysis.cxx index 74fc8811371..2d4e02dd783 100644 --- a/PWGLF/TableProducer/Strangeness/cascqaanalysis.cxx +++ b/PWGLF/TableProducer/Strangeness/cascqaanalysis.cxx @@ -13,24 +13,28 @@ /// \brief Analysis of cascades in pp collisions /// \author Roman Nepeivoda (roman.nepeivoda@cern.ch) -#include -#include -#include -#include +#include "PWGLF/DataModel/cascqaanalysis.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Common/DataModel/TrackSelectionTables.h" #include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGLF/DataModel/mcCentrality.h" +#include "PWGLF/Utils/inelGt.h" + +#include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/Centrality.h" -#include "PWGLF/DataModel/cascqaanalysis.h" -#include "TRandom2.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "Framework/AnalysisTask.h" #include "Framework/O2DatabasePDGPlugin.h" -#include "PWGLF/Utils/inelGt.h" -#include "PWGLF/DataModel/mcCentrality.h" +#include "Framework/runDataProcessing.h" + +#include "TRandom2.h" +#include + +#include +#include +#include using namespace o2; using namespace o2::framework; diff --git a/PWGLF/Tasks/Strangeness/derivedupcanalysis.cxx b/PWGLF/Tasks/Strangeness/derivedupcanalysis.cxx index e3acddab2f0..12ea48cadc4 100644 --- a/PWGLF/Tasks/Strangeness/derivedupcanalysis.cxx +++ b/PWGLF/Tasks/Strangeness/derivedupcanalysis.cxx @@ -13,35 +13,38 @@ /// \brief Analysis of strangeness production in UPC collisions /// \author Roman Nepeivoda (roman.nepeivoda@cern.ch) -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "PWGLF/DataModel/LFStrangenessPIDTables.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGLF/Utils/strangenessMasks.h" +#include "PWGUD/Core/SGSelector.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/O2DatabasePDGPlugin.h" -#include "ReconstructionDataFormats/Track.h" #include "Common/Core/RecoDecay.h" -#include "Common/Core/trackUtilities.h" -#include "PWGLF/DataModel/LFStrangenessTables.h" -#include "PWGLF/DataModel/LFStrangenessPIDTables.h" #include "Common/Core/TrackSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/EventSelection.h" +#include "Common/Core/trackUtilities.h" #include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" #include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/O2DatabasePDGPlugin.h" #include "Framework/StaticFor.h" -#include "PWGUD/Core/SGSelector.h" -#include "PWGLF/Utils/strangenessMasks.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/Track.h" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include using namespace o2; using namespace o2::framework;