From 4332fab6a37fb4ef1bc71b11efb3c7f7eabeec78 Mon Sep 17 00:00:00 2001 From: cmuncinelli Date: Mon, 9 Mar 2026 19:28:23 -0300 Subject: [PATCH 1/5] Rewriting DataModel to fix AO2D merging problem on hyperloop. Improving TableProducer's w/ TOF vs wo/ TOF workflows to only use resources when needed. Fixing major formatting errors as per Vit's suggestion (thanks!). Still need to fix includes --- PWGLF/DataModel/lambdaJetPolarizationIons.h | 55 +-- .../Strangeness/lambdaJetPolarizationIons.cxx | 316 +++++++++--------- .../lambdaJetPolarizationIonsDerived.cxx | 8 +- 3 files changed, 189 insertions(+), 190 deletions(-) diff --git a/PWGLF/DataModel/lambdaJetPolarizationIons.h b/PWGLF/DataModel/lambdaJetPolarizationIons.h index fef233231c0..ceb2066265e 100644 --- a/PWGLF/DataModel/lambdaJetPolarizationIons.h +++ b/PWGLF/DataModel/lambdaJetPolarizationIons.h @@ -17,32 +17,28 @@ // cicero.domenico.muncinelli@cern.ch // -#ifndef PWGLF_DATAMODEL_LAMBDAJETPOL_H_ -#define PWGLF_DATAMODEL_LAMBDAJETPOL_H_ +#ifndef PWGLF_DATAMODEL_LAMBDAJETPOLARIZATIONIONS_H_ +#define PWGLF_DATAMODEL_LAMBDAJETPOLARIZATIONIONS_H_ #include +#include +#include namespace o2::aod { namespace lambdajetpol { - -// DECLARE_SOA_COLUMN(CollIdx, collIdx, uint64_t); // Using a regular SOA column instead of an index column for convenience // Collision information: -DECLARE_SOA_INDEX_COLUMN(Collision, collision); DECLARE_SOA_COLUMN(CentFT0M, centFT0M, float); DECLARE_SOA_COLUMN(CentFT0C, centFT0C, float); -DECLARE_SOA_COLUMN(CentFT0CVariant1, centFT0CVariant1, float); -DECLARE_SOA_COLUMN(CentMFT, centMFT, float); -DECLARE_SOA_COLUMN(CentNGlobal, centNGlobal, float); DECLARE_SOA_COLUMN(CentFV0A, centFV0A, float); // Jet (and jet proxies) information: DECLARE_SOA_COLUMN(JetPt, jetPt, float); DECLARE_SOA_COLUMN(JetEta, jetEta, float); DECLARE_SOA_COLUMN(JetPhi, jetPhi, float); -DECLARE_SOA_COLUMN(JetNConstituents, jetNConstituents, uint64_t); +DECLARE_SOA_COLUMN(JetNConstituents, jetNConstituents, int); DECLARE_SOA_COLUMN(LeadParticlePt, leadParticlePt, float); DECLARE_SOA_COLUMN(LeadParticleEta, leadParticleEta, float); @@ -70,9 +66,9 @@ DECLARE_SOA_COLUMN(PosTPCNSigmaPi, posTPCNSigmaPi, float); DECLARE_SOA_COLUMN(NegTPCNSigmaPr, negTPCNSigmaPr, float); DECLARE_SOA_COLUMN(NegTPCNSigmaPi, negTPCNSigmaPi, float); -DECLARE_SOA_COLUMN(V0CosPA, v0cosPA, float); -DECLARE_SOA_COLUMN(V0Radius, v0radius, float); -DECLARE_SOA_COLUMN(DcaV0Daughters, dcaV0daughters, float); +DECLARE_SOA_COLUMN(V0CosPA, v0CosPA, float); +DECLARE_SOA_COLUMN(V0Radius, v0Radius, float); +DECLARE_SOA_COLUMN(DcaV0Daughters, dcaV0Daughters, float); DECLARE_SOA_COLUMN(DcaPosToPV, dcaPosToPV, float); DECLARE_SOA_COLUMN(DcaNegToPV, dcaNegToPV, float); @@ -90,32 +86,42 @@ DECLARE_SOA_DYNAMIC_COLUMN(LeadParticlePy, leadParticlePy, //! Leading particle [](float leadParticlePt, float leadParticlePhi) -> float { return leadParticlePt * std::sin(leadParticlePhi); }); DECLARE_SOA_DYNAMIC_COLUMN(LeadParticlePz, leadParticlePz, //! Leading particle pz [](float leadParticlePt, float leadParticleEta) -> float { return leadParticlePt * std::sinh(leadParticleEta); }); +} // namespace lambdajetpol + +DECLARE_SOA_TABLE(RingCollisions, "AOD", "RINGCOLLISIONS", + o2::soa::Index<>, // self-index: auto-assigned row number + lambdajetpol::CentFT0M, + lambdajetpol::CentFT0C, + lambdajetpol::CentFV0A); +namespace lambdajetpol +{ +DECLARE_SOA_INDEX_COLUMN(RingCollision, ringCollision); // Declare index after table is available } // namespace lambdajetpol -DECLARE_SOA_TABLE(RingJets, "AOD", "RINGJETS", // Renamed to follow convention on "s" at the end of table name. - lambdajetpol::CollisionId, // Changed to an internal O2 index, slightly different from usual o2::soa::Index<> though +DECLARE_SOA_TABLE(RingJets, "AOD", "RINGJETS", + lambdajetpol::RingCollisionId, // relational index -> RingCollisions lambdajetpol::JetPt, lambdajetpol::JetEta, lambdajetpol::JetPhi, lambdajetpol::JetNConstituents, - // Dynamic columns - lambdajetpol::JetPx, // Explicitly binding to static columns + // Dynamic columns (explicitly bound to their static inputs): + lambdajetpol::JetPx, lambdajetpol::JetPy, lambdajetpol::JetPz); -DECLARE_SOA_TABLE(RingLeadP, "AOD", "RINGLEADP", // Leading particle table - lambdajetpol::CollisionId, +DECLARE_SOA_TABLE(RingLeadP, "AOD", "RINGLEADP", + lambdajetpol::RingCollisionId, lambdajetpol::LeadParticlePt, lambdajetpol::LeadParticleEta, lambdajetpol::LeadParticlePhi, - // Dynamic columns + // Dynamic columns: lambdajetpol::LeadParticlePx, lambdajetpol::LeadParticlePy, lambdajetpol::LeadParticlePz); DECLARE_SOA_TABLE(RingLaV0s, "AOD", "RINGLAV0S", - lambdajetpol::CollisionId, + lambdajetpol::RingCollisionId, lambdajetpol::V0Pt, lambdajetpol::V0Eta, lambdajetpol::V0Phi, @@ -139,12 +145,7 @@ DECLARE_SOA_TABLE(RingLaV0s, "AOD", "RINGLAV0S", lambdajetpol::DcaPosToPV, lambdajetpol::DcaNegToPV); -DECLARE_SOA_TABLE(RingCollisions, "AOD", "RINGCOLLISIONS", - lambdajetpol::CollisionId, - lambdajetpol::CentFT0M, - lambdajetpol::CentFT0C, - lambdajetpol::CentFV0A); - +using RingCollision = RingCollisions::iterator; // Useful shorthand } // namespace o2::aod -#endif // PWGLF_DATAMODEL_LAMBDAJETPOL_H_ +#endif // PWGLF_DATAMODEL_LAMBDAJETPOLARIZATIONIONS_H_ diff --git a/PWGLF/TableProducer/Strangeness/lambdaJetPolarizationIons.cxx b/PWGLF/TableProducer/Strangeness/lambdaJetPolarizationIons.cxx index 14a1f4da3c4..793db7777fc 100644 --- a/PWGLF/TableProducer/Strangeness/lambdaJetPolarizationIons.cxx +++ b/PWGLF/TableProducer/Strangeness/lambdaJetPolarizationIons.cxx @@ -17,7 +17,7 @@ // Jet Polarization Ions task // ================ // -// This code loops over a V0Cores table and produces standard derived +// This code loops over a V0Datas table and produces standard derived // data as output. In the post-processing stage, this analysis aims // to measure the formation of vorticity rings in HI collisions. // @@ -26,54 +26,54 @@ // cicero.domenico.muncinelli@cern.ch // -// O2 Framework -#include -#include -#include -#include -#include -#include +// Standard Library +#include +#include +#include +#include +#include -// O2 CCDB / Conditions -#include "DataFormatsParameters/GRPMagField.h" -#include -#include +// PWGLF +#include "PWGLF/DataModel/lambdaJetPolarizationIons.h" +#include "PWGLF/DataModel/LFStrangenessPIDTables.h" +// #include "Common/DataModel/PIDResponseTOF.h" // Maybe switch this around with LFStrangenessPIDTables? +#include "PWGLF/DataModel/LFStrangenessTables.h" // For V0TOFPIDs and NSigmas getters. Better for considering the daughters as coming from V0s instead of from PV: -// O2 Reconstruction Data Formats -#include +// // MC +// #include "Common/DataModel/CollisionAssociationTables.h" +// #include "Common/DataModel/McCollisionExtra.h" +// #include "PWGLF/DataModel/mcCentrality.h" -// O2 Common Core -#include "Common/Core/RecoDecay.h" -#include "Common/Core/TrackSelection.h" -#include "Common/Core/trackUtilities.h" +// PWGJE +#include "PWGJE/Core/JetBkgSubUtils.h" +#include "PWGJE/Core/JetUtilities.h" -// O2 Common DataModel +// Common DataModel #include "Common/DataModel/Centrality.h" -#include "Common/DataModel/CollisionAssociationTables.h" #include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/McCollisionExtra.h" -#include "Common/DataModel/Multiplicity.h" // for pp +#include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/PIDResponseTPC.h" -// For PID in raw data: -// #include "Common/DataModel/PIDResponseTOF.h" // Maybe switch this around with LFStrangenessPIDTables? -// #include "Common/DataModel/Qvectors.h" #include "Common/DataModel/TrackSelectionTables.h" -// PWGJE -#include "PWGJE/Core/JetBkgSubUtils.h" -#include "PWGJE/Core/JetDerivedDataUtilities.h" -#include "PWGJE/Core/JetUtilities.h" -#include "PWGJE/DataModel/Jet.h" -#include "PWGJE/DataModel/JetReducedData.h" +// Common Core +#include "Common/Core/RecoDecay.h" +#include "Common/Core/TrackSelection.h" -// PWGLF -#include "PWGLF/DataModel/LFStrangenessPIDTables.h" -// For V0TOFPIDs and NSigmas getters. Better for considering the daughters as coming from V0s instead of from PV? -#include "PWGLF/DataModel/LFStrangenessTables.h" -#include "PWGLF/DataModel/lambdaJetPolarizationIons.h" -#include "PWGLF/DataModel/mcCentrality.h" +// Framework +#include +#include +#include +#include +#include + +// O2 subsystems +#include +#include +#include "Common/CCDB/ctpRateFetcher.h" +#include +#include -// External Libraries (FastJet) +// External libraries #include #include #include @@ -83,43 +83,25 @@ #include #include -// ROOT Math +// ROOT math #include "Math/GenVector/Boost.h" #include "Math/Vector3D.h" #include "Math/Vector4D.h" -// Standard Library -#include -#include -#include -#include - using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; -using std::array; using namespace o2::aod::rctsel; ///// Aliases for joined tables /// Collisions: using SelCollisions = soa::Join; // Added PVMults to get MultNTracksPVeta1 as centrality estimator -using SelCollisionsSimple = soa::Join; // Simpler, for jets - /// V0s and Daughter tracks: -// using V0Candidates = soa::Join; -// using V0CandidatesSimple = soa::Join; // No TOF -/// To run in RAW data: -// using V0Candidates = aod::V0Datas; // TODO: possible quicker subscription for analysis that do not require TOF. using V0CandidatesWithTOF = soa::Join; // Tables created by o2-analysis-lf-strangenesstofpid -// using DauTracks = soa::Join; -// Actually used subscriptions (smaller memory usage): using DauTracks = soa::Join; - /// Jets: -using PseudoJetTracks = soa::Join; // Simpler tracks access. (Not using TracksIU and TracksCovIU. Did not use their info for now) - // , aod::pidTOFFullPi, aod::pidTOFFullKa, aod::pidTOFFullPr>; // Not using TOF right now due to some possible mismatches - +// using JetTracks = soa::Join; // Simpler tracks access, yet can't pass this and DauTracks as subscriptions simultaneously. /// MC: // using SimCollisions = soa::Join; // using DauTracksMC = soa::Join; @@ -658,7 +640,7 @@ struct lambdajetpolarizationions { addHypothesis(AntiLambda, analyseAntiLambda); auto hSelectionV0s = histos.add("GeneralQA/hSelectionV0s", "V0 #rightarrow #Lambda / #bar{#Lambda} selection flow", kTH1D, - {{(int)v0LambdaSelectionLabels.size(), -0.5, (double)v0LambdaSelectionLabels.size() - 0.5}}); + {{static_cast(v0LambdaSelectionLabels.size()), -0.5, static_cast(v0LambdaSelectionLabels.size()) - 0.5}}); for (size_t i = 0; i < v0LambdaSelectionLabels.size(); ++i) { auto lbl = v0LambdaSelectionLabels[i].label; if (!v0LambdaSelectionLabels[i].enabled) @@ -778,7 +760,7 @@ struct lambdajetpolarizationions { if (analyseAntiLambda) { histos.add("hMassAntiLambda", "hMassAntiLambda", kTH1D, {axisConfigurations.axisLambdaMass}); histos.add("AntiLambda/hAntiLambdasPerEvent", "hAntiLambdasPerEvent", kTH1D, {{15, 0, 15}}); - }; + } if (analyseLambda && analyseAntiLambda) { histos.add("hAmbiguousLambdaCandidates", "hAmbiguousLambdaCandidates", kTH1D, {{1, 0, 1}}); histos.add("hAmbiguousPerEvent", "hAmbiguousPerEvent", kTH1D, {{15, 0, 15}}); @@ -870,6 +852,7 @@ struct lambdajetpolarizationions { histos.add("GeneralQA/h2dArmenterosFullSelected", "h2dArmenterosFullSelected", kTH2D, {axisConfigurations.axisAPAlpha, axisConfigurations.axisAPQt}); histos.add("GeneralQA/h2dArmenterosFullSelectedLambda", "h2dArmenterosFullSelectedLambda", kTH2D, {axisConfigurations.axisAPAlpha, axisConfigurations.axisAPQt}); histos.add("GeneralQA/h2dArmenterosFullSelectedAntiLambda", "h2dArmenterosFullSelectedAntiLambda", kTH2D, {axisConfigurations.axisAPAlpha, axisConfigurations.axisAPQt}); + histos.add("GeneralQA/h2dArmenterosFullSelectedNonAmbiguous", "h2dArmenterosFullSelectedNonAmbiguous", kTH2D, {axisConfigurations.axisAPAlpha, axisConfigurations.axisAPQt}); histos.add("GeneralQA/h2dArmenterosFullSelectedAmbiguous", "h2dArmenterosFullSelectedAmbiguous", kTH2D, {axisConfigurations.axisAPAlpha, axisConfigurations.axisAPQt}); // Jets histograms: @@ -1237,6 +1220,9 @@ struct lambdajetpolarizationions { pseudoJetCandidateTrackSelections.dcaxyMaxTrackPar1 / std::pow(pt, pseudoJetCandidateTrackSelections.dcaxyMaxTrackPar2))) return false; JetTrackSelCounter.fill(); + } else { // Should fill counters an equal number of times to advance indices (future-proofing, but could do it by just advancing indices by hand in JetTrackSelectionFlowCounter) + JetTrackSelCounter.fill(); + JetTrackSelCounter.fill(); } return true; } @@ -1399,36 +1385,45 @@ struct lambdajetpolarizationions { return false; V0SelCounter.fill(); - // TOF PID in DeltaT (if TOF is not available, then uses the track. If is available, uses it. In this sense, TOF is optional) - // const bool posHasTOF = posTrackExtra.hasTOF(); // For the older version, which worked only for Lambdas - const bool protonHasTOF = protonTrack.hasTOF(); // Should work even without PIDResponseTOF.h, as it is a TracksExtra property - const bool pionHasTOF = pionTrack.hasTOF(); + // Only do TOF checks when actually using TOF subscriptions: + // if (doprocessDataWithTOF) { + if constexpr (requires { v0.tofNSigmaLaPr(); }) { // Compile-time check is better in hot-loop + // TOF PID in DeltaT (if TOF is not available, then uses the track. If is available, uses it. In this sense, TOF is optional) + // const bool posHasTOF = posTrackExtra.hasTOF(); // For the older version, which worked only for Lambdas + const bool protonHasTOF = protonTrack.hasTOF(); // Should work even without PIDResponseTOF.h, as it is a TracksExtra property + const bool pionHasTOF = pionTrack.hasTOF(); - // Proton-like track - if (protonHasTOF && std::abs(Lambda_hypothesis ? v0.posTOFDeltaTLaPr() : v0.negTOFDeltaTLaPr()) > v0Selections.maxDeltaTimeProton) - return false; - V0SelCounter.fill(); - // Pion-like track - if (pionHasTOF && std::abs(Lambda_hypothesis ? v0.negTOFDeltaTLaPi() : v0.posTOFDeltaTLaPi()) > v0Selections.maxDeltaTimePion) - return false; - V0SelCounter.fill(); - - // TOF PID in NSigma (TODO: add asymmetric NSigma windows for purity tuning?) - // Proton-like track - if (protonHasTOF && std::fabs(v0.tofNSigmaLaPr()) > v0Selections.tofPidNsigmaCutLaPr) - return false; // (No need to select which candidate is which with the Lambda_hypothesis. Automatically done already!) - V0SelCounter.fill(); - // Pion-like track - if (pionHasTOF && std::fabs(v0.tofNSigmaLaPi()) > v0Selections.tofPidNsigmaCutLaPi) - return false; - V0SelCounter.fill(); - - // (CAUTION!) You cannot use the getter for raw data's PIDResponseTOF.h instead of LFStrangenessPIDTables.h (as below) - // If you do use, TOF will just try to identify that track as a proton, instead of using the correct path length from the - // V0s PV-DCA and the such! In other words, it is a naive estimator of TOF PID, because it does not correct for the V0 - // mother's travel time and considers all tracks as if they came from the PV! - // if (protonHasTOF && std::fabs(protonTrack.tofNSigmaPr()) > v0Selections.tofPidNsigmaCutLaPr) return false; - // To properly use the LFStrangenessPIDTables version, you need to call o2-analysis-lf-strangenesstofpid too. + // Proton-like track + if (protonHasTOF && std::abs(Lambda_hypothesis ? v0.posTOFDeltaTLaPr() : v0.negTOFDeltaTLaPr()) > v0Selections.maxDeltaTimeProton) + return false; + V0SelCounter.fill(); + // Pion-like track + if (pionHasTOF && std::abs(Lambda_hypothesis ? v0.negTOFDeltaTLaPi() : v0.posTOFDeltaTLaPi()) > v0Selections.maxDeltaTimePion) + return false; + V0SelCounter.fill(); + + // TOF PID in NSigma (TODO: add asymmetric NSigma windows for purity tuning?) + // Proton-like track (notice usage of tofNSigmaLaPr vs tofNSigmaALaPr) + if (protonHasTOF && std::fabs(Lambda_hypothesis ? v0.tofNSigmaLaPr() : v0.tofNSigmaALaPr()) > v0Selections.tofPidNsigmaCutLaPr) + return false; // (No need to select which candidate is which with the Lambda_hypothesis. Automatically done already!) + V0SelCounter.fill(); + // Pion-like track + if (pionHasTOF && std::fabs(Lambda_hypothesis ? v0.tofNSigmaLaPi() : v0.tofNSigmaALaPi()) > v0Selections.tofPidNsigmaCutLaPi) + return false; + V0SelCounter.fill(); + + // (CAUTION!) You cannot use the getter for raw data's PIDResponseTOF.h instead of LFStrangenessPIDTables.h (as below) + // If you do use, TOF will just try to identify that track as a proton from the PV, instead of using the correct path + // length from the V0s PV-DCA and the such! In other words, it is a naive estimator of TOF PID, because it does not + // correct for the V0 mother's travel time and considers all tracks as if they came from the PV! + // if (protonHasTOF && std::fabs(protonTrack.tofNSigmaPr()) > v0Selections.tofPidNsigmaCutLaPr) return false; + // To properly use the LFStrangenessPIDTables version, you need to call o2-analysis-lf-strangenesstofpid too. + } else { // Should fill counters an equal number of times to advance indices (TODO: implement better solution, such as just advancing the index) + V0SelCounter.fill(); + V0SelCounter.fill(); + V0SelCounter.fill(); + V0SelCounter.fill(); + } // proper lifetime if (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0 > v0Selections.lambdaLifetimeCut) @@ -1462,20 +1457,9 @@ struct lambdajetpolarizationions { // else return -1; // AntiLambda // } - void processJetsData(SelCollisionsSimple::iterator const& collision, PseudoJetTracks const& tracks, aod::BCsWithTimestamps const& bcs) - { // Uses BCsWithTimestamps to get timestamps for rejectTPCsectorBoundary - float centrality = -1.0f; // Just a placeholder - - // For event QA the last two indices never change for NEv_withJets and NEv_withV0s - // (Not the best way to initialize this: runs once per collision! TODO: think of a better way to do it) - int lastBinEvSel = histos.get(HIST("hEventSelection"))->GetXaxis()->GetNbins(); - bool validJetAlreadyFound = false; // Do not fill Event QA more than once - - auto bc = bcs.iteratorAt(collision.bcId()); // Got the iteratorAt() idea from O2Physics/PWGUD/Core/UDHelpers.h - if (!isEventAccepted(collision, bc, centrality, false)) - return; // Uses return instead of continue, as there is no explicit loop here - const uint64_t collIdx = collision.globalIndex(); - + template + void jetsProcess(TJetTracks const& tracks, const int ringCollIdx, const float centrality) + { // Loop over reconstructed tracks: std::vector fjParticles; int leadingParticleIdx = -1; // Initialized as -1, but could leave it unitialized as well. We reject any invalid events where this could pose a problem (e.g., pT<=0) @@ -1505,15 +1489,16 @@ struct lambdajetpolarizationions { if (fjParticles.size() < 1) return; + int lastBinEvSel = histos.get(HIST("hEventSelection"))->GetXaxis()->GetNbins(); + auto const& leadingParticle = fjParticles[leadingParticleIdx]; if (leadingParticle.pt() > jetConfigurations.minLeadParticlePt) { // If not, leading particle is probably a bad proxy - tableLeadParticles(collIdx, leadingParticle.pt(), leadingParticle.eta(), leadingParticle.phi()); + tableLeadParticles(ringCollIdx, leadingParticle.pt(), leadingParticle.eta(), leadingParticle.phi()); } // Start jet clusterization: // Cluster particles using the anti-kt algorithm fastjet::JetDefinition jetDef(mapFJAlgorithm(jetConfigurations.jetAlgorithm), jetConfigurations.radiusJet, mapFJRecombScheme(jetConfigurations.jetRecombScheme)); - // std::vector jets_pt, jets_eta, jets_phi; // Not worth it to store 4-vectors: the tracks assume pion mass hypothesis, so energy and rapidity are not right. if (jetConfigurations.bkgSubtraction == kAreaBased) { fastjet::AreaDefinition areaDef(fastjet::active_area, fastjet::GhostedAreaSpec(jetConfigurations.GhostedAreaSpecRapidity)); fastjet::ClusterSequenceArea clustSeq(fjParticles, jetDef, areaDef); // Attributes an area for each pseudojet in the list @@ -1527,7 +1512,6 @@ struct lambdajetpolarizationions { int selectedJets = 0; fastjet::PseudoJet leadingJetSub; - // bool hasLeadingJet = false; // Not needed: if the event has any jet, that is the leading jet. Check is superseded by the selectedJets information float leadingJetPt = -1.f; for (const auto& jet : jets) { // Jet must be fully contained in the acceptance (0.9 for ITS+TPC barrel) @@ -1546,7 +1530,7 @@ struct lambdajetpolarizationions { selectedJets++; // Store jet: - tableJets(collIdx, + tableJets(ringCollIdx, jetMinusBkg.pt(), jetMinusBkg.eta(), // Using eta instead of rapidity jetMinusBkg.phi(), @@ -1563,9 +1547,7 @@ struct lambdajetpolarizationions { return; histos.fill(HIST("hEventsWithJet"), 0.5); // Another version of this counter, which is already integrated in the Event Selection flow: - if (doEventQA && !validJetAlreadyFound) - fillEventSelectionQA(lastBinEvSel - 1, centrality); // hasRingJet passes - validJetAlreadyFound = true; + if (doEventQA) fillEventSelectionQA(lastBinEvSel - 1, centrality); // hasRingJet passes if (doJetKinematicsQA) { histos.fill(HIST("JetKinematicsQA/hLeadingJetPt"), leadingJetSub.pt()); @@ -1647,9 +1629,7 @@ struct lambdajetpolarizationions { return; histos.fill(HIST("hEventsWithJet"), 0.5); // Another version of this counter, which is already integrated in the Event Selection flow: - if (doEventQA && !validJetAlreadyFound) - fillEventSelectionQA(lastBinEvSel - 1, centrality); // hasRingJet passes - validJetAlreadyFound = true; + if (doEventQA) fillEventSelectionQA(lastBinEvSel - 1, centrality); // hasRingJet passes const auto& leadingJet = jets[0]; for (const auto& jet : jets) { @@ -1658,7 +1638,7 @@ struct lambdajetpolarizationions { if (std::fabs(jet_eta) > (0.9f - jetConfigurations.radiusJet)) continue; - tableJets(collIdx, + tableJets(ringCollIdx, jet.pt(), jet_eta, // Using eta instead of rapidity jet.phi(), @@ -1735,10 +1715,9 @@ struct lambdajetpolarizationions { } } - // Had to include DauTracks in subscription, even though I don't loop in it, for the indices - // to resolve, avoiding " Exception while running: Index pointing to Tracks is not bound!" - // Added the compiler option [[maybe_unused]] to avoid triggering any warnings because of this - void processV0sData(SelCollisions::iterator const& collision, V0CandidatesWithTOF const& fullV0s, aod::BCsWithTimestamps const& bcs, [[maybe_unused]] DauTracks const& V0DauTracks) + // No longer use a separate JetTracks joined table -- it was mostly a subset of DauTracks + TracksIU (which was not used) + template + void dataProcess(TCollision const& collision, TV0Candidates const& V0s, TDaughterTracks const& V0DauTracks, aod::BCsWithTimestamps const& bcs) { float centrality = getCentrality(collision); // Strictly for QA. We save other types of centrality estimators in the derived data! @@ -1754,22 +1733,24 @@ struct lambdajetpolarizationions { if (!isEventAccepted(collision, bc, centrality, doEventQA)) return; // Uses return instead of continue, as there is no explicit loop here - if (doEventQA) - fillCentralityProperties(collision, centrality); - const uint64_t collIdx = collision.globalIndex(); - if (v0Selections.rejectTPCsectorBoundary) - initCCDB(bc); // Substituted call from collision to bc for raw data + if (doEventQA) fillCentralityProperties(collision, centrality); + if (v0Selections.rejectTPCsectorBoundary) initCCDB(bc); // Substituted call from collision to bc for raw data // Fill event table: - tableCollisions(collIdx, - collision.centFT0M(), + tableCollisions(collision.centFT0M(), collision.centFT0C(), collision.centFV0A()); // (TODO: add InteractionRate info and other useful cuts for later on in the analysis?) + // Get the derived collision row index for this event: + const int ringCollIdx = tableCollisions.lastIndex(); + + // Call to jets process: + jetsProcess(V0DauTracks, ringCollIdx, centrality); // V0DauTracks takes the place of jetTracks now + uint NLambdas = 0; // Counting particles per event uint NAntiLambdas = 0; uint NAmbiguous = 0; - for (auto const& v0 : fullV0s) { + for (auto const& v0 : V0s) { V0SelCounter.resetForNewV0(); V0SelCounter.fill(); // Fill for all v0 candidates if (doArmenterosQA) @@ -1789,7 +1770,7 @@ struct lambdajetpolarizationions { isAntiLambda = passesLambdaLambdaBarHypothesis(v0, collision, false); if (!isLambda && !isAntiLambda) - continue; // Candidate is not considered to be a Lambda + continue; // Candidate is not considered to be a Lambda-like if (isLambda) NLambdas++; @@ -1803,6 +1784,10 @@ struct lambdajetpolarizationions { if (!isLambda && isAntiLambda) histos.fill(HIST("GeneralQA/h2dArmenterosFullSelectedAntiLambda"), v0.alpha(), v0.qtarm()); + // XOR check: + if (isLambda ^ isAntiLambda) + histos.fill(HIST("GeneralQA/h2dArmenterosFullSelectedNonAmbiguous"), v0.alpha(), v0.qtarm()); + // int lambdaIdx = -1; // No need to pass armenteros if (isLambda && isAntiLambda) { NAmbiguous++; @@ -1828,7 +1813,7 @@ struct lambdajetpolarizationions { auto const v0pt = v0.pt(); const auto posTrackExtra = v0.template posTrack_as(); const auto negTrackExtra = v0.template negTrack_as(); - tableV0s(collIdx, + tableV0s(ringCollIdx, v0pt, v0.eta(), v0.phi(), // Using eta instead of rapidity isLambda, isAntiLambda, v0.mLambda(), v0.mAntiLambda(), @@ -1912,19 +1897,21 @@ struct lambdajetpolarizationions { histos.fill(HIST("Lambda/h3dPosTPCsignalVsTrackPt"), centrality, v0.positivept(), posTrackExtra.tpcSignal()); histos.fill(HIST("Lambda/h3dNegTPCsignalVsTrackPt"), centrality, v0.negativept(), negTrackExtra.tpcSignal()); } - if (doTOFQA) { - histos.fill(HIST("Lambda/h3dPosNsigmaTOF"), centrality, v0pt, v0.tofNSigmaLaPr()); - histos.fill(HIST("Lambda/h3dNegNsigmaTOF"), centrality, v0pt, v0.tofNSigmaLaPi()); - histos.fill(HIST("Lambda/h3dPosTOFdeltaT"), centrality, v0pt, v0.posTOFDeltaTLaPr()); - histos.fill(HIST("Lambda/h3dNegTOFdeltaT"), centrality, v0pt, v0.negTOFDeltaTLaPi()); - histos.fill(HIST("Lambda/h3dPosNsigmaTOFvsTrackPtot"), centrality, v0.pfracpos() * v0.p(), v0.tofNSigmaLaPr()); - histos.fill(HIST("Lambda/h3dNegNsigmaTOFvsTrackPtot"), centrality, v0.pfracneg() * v0.p(), v0.tofNSigmaLaPi()); - histos.fill(HIST("Lambda/h3dPosTOFdeltaTvsTrackPtot"), centrality, v0.pfracpos() * v0.p(), v0.posTOFDeltaTLaPr()); - histos.fill(HIST("Lambda/h3dNegTOFdeltaTvsTrackPtot"), centrality, v0.pfracneg() * v0.p(), v0.negTOFDeltaTLaPi()); - histos.fill(HIST("Lambda/h3dPosNsigmaTOFvsTrackPt"), centrality, v0.positivept(), v0.tofNSigmaLaPr()); - histos.fill(HIST("Lambda/h3dNegNsigmaTOFvsTrackPt"), centrality, v0.negativept(), v0.tofNSigmaLaPi()); - histos.fill(HIST("Lambda/h3dPosTOFdeltaTvsTrackPt"), centrality, v0.positivept(), v0.posTOFDeltaTLaPr()); - histos.fill(HIST("Lambda/h3dNegTOFdeltaTvsTrackPt"), centrality, v0.negativept(), v0.negTOFDeltaTLaPi()); + if constexpr (requires { v0.tofNSigmaLaPr(); }) { + if (doTOFQA) { + histos.fill(HIST("Lambda/h3dPosNsigmaTOF"), centrality, v0pt, v0.tofNSigmaLaPr()); + histos.fill(HIST("Lambda/h3dNegNsigmaTOF"), centrality, v0pt, v0.tofNSigmaLaPi()); + histos.fill(HIST("Lambda/h3dPosTOFdeltaT"), centrality, v0pt, v0.posTOFDeltaTLaPr()); + histos.fill(HIST("Lambda/h3dNegTOFdeltaT"), centrality, v0pt, v0.negTOFDeltaTLaPi()); + histos.fill(HIST("Lambda/h3dPosNsigmaTOFvsTrackPtot"), centrality, v0.pfracpos() * v0.p(), v0.tofNSigmaLaPr()); + histos.fill(HIST("Lambda/h3dNegNsigmaTOFvsTrackPtot"), centrality, v0.pfracneg() * v0.p(), v0.tofNSigmaLaPi()); + histos.fill(HIST("Lambda/h3dPosTOFdeltaTvsTrackPtot"), centrality, v0.pfracpos() * v0.p(), v0.posTOFDeltaTLaPr()); + histos.fill(HIST("Lambda/h3dNegTOFdeltaTvsTrackPtot"), centrality, v0.pfracneg() * v0.p(), v0.negTOFDeltaTLaPi()); + histos.fill(HIST("Lambda/h3dPosNsigmaTOFvsTrackPt"), centrality, v0.positivept(), v0.tofNSigmaLaPr()); + histos.fill(HIST("Lambda/h3dNegNsigmaTOFvsTrackPt"), centrality, v0.negativept(), v0.tofNSigmaLaPi()); + histos.fill(HIST("Lambda/h3dPosTOFdeltaTvsTrackPt"), centrality, v0.positivept(), v0.posTOFDeltaTLaPr()); + histos.fill(HIST("Lambda/h3dNegTOFdeltaTvsTrackPt"), centrality, v0.negativept(), v0.negTOFDeltaTLaPi()); + } } if (doEtaPhiQA) { histos.fill(HIST("Lambda/h5dV0PhiVsEta"), centrality, v0pt, v0.mLambda(), v0.phi(), v0.eta()); @@ -1958,19 +1945,21 @@ struct lambdajetpolarizationions { histos.fill(HIST("AntiLambda/h3dPosTPCsignalVsTrackPt"), centrality, v0.positivept(), posTrackExtra.tpcSignal()); histos.fill(HIST("AntiLambda/h3dNegTPCsignalVsTrackPt"), centrality, v0.negativept(), negTrackExtra.tpcSignal()); } - if (doTOFQA) { - histos.fill(HIST("AntiLambda/h3dPosNsigmaTOF"), centrality, v0pt, v0.tofNSigmaALaPi()); - histos.fill(HIST("AntiLambda/h3dNegNsigmaTOF"), centrality, v0pt, v0.tofNSigmaALaPr()); - histos.fill(HIST("AntiLambda/h3dPosTOFdeltaT"), centrality, v0pt, v0.posTOFDeltaTLaPi()); - histos.fill(HIST("AntiLambda/h3dNegTOFdeltaT"), centrality, v0pt, v0.negTOFDeltaTLaPr()); - histos.fill(HIST("AntiLambda/h3dPosNsigmaTOFvsTrackPtot"), centrality, v0.pfracpos() * v0.p(), v0.tofNSigmaALaPi()); - histos.fill(HIST("AntiLambda/h3dNegNsigmaTOFvsTrackPtot"), centrality, v0.pfracneg() * v0.p(), v0.tofNSigmaALaPr()); - histos.fill(HIST("AntiLambda/h3dPosTOFdeltaTvsTrackPtot"), centrality, v0.pfracpos() * v0.p(), v0.posTOFDeltaTLaPi()); - histos.fill(HIST("AntiLambda/h3dNegTOFdeltaTvsTrackPtot"), centrality, v0.pfracneg() * v0.p(), v0.negTOFDeltaTLaPr()); - histos.fill(HIST("AntiLambda/h3dPosNsigmaTOFvsTrackPt"), centrality, v0.positivept(), v0.tofNSigmaALaPi()); - histos.fill(HIST("AntiLambda/h3dNegNsigmaTOFvsTrackPt"), centrality, v0.negativept(), v0.tofNSigmaALaPr()); - histos.fill(HIST("AntiLambda/h3dPosTOFdeltaTvsTrackPt"), centrality, v0.positivept(), v0.posTOFDeltaTLaPi()); - histos.fill(HIST("AntiLambda/h3dNegTOFdeltaTvsTrackPt"), centrality, v0.negativept(), v0.negTOFDeltaTLaPr()); + if constexpr (requires { v0.tofNSigmaLaPr(); }) { + if (doTOFQA) { + histos.fill(HIST("AntiLambda/h3dPosNsigmaTOF"), centrality, v0pt, v0.tofNSigmaALaPi()); + histos.fill(HIST("AntiLambda/h3dNegNsigmaTOF"), centrality, v0pt, v0.tofNSigmaALaPr()); + histos.fill(HIST("AntiLambda/h3dPosTOFdeltaT"), centrality, v0pt, v0.posTOFDeltaTLaPi()); + histos.fill(HIST("AntiLambda/h3dNegTOFdeltaT"), centrality, v0pt, v0.negTOFDeltaTLaPr()); + histos.fill(HIST("AntiLambda/h3dPosNsigmaTOFvsTrackPtot"), centrality, v0.pfracpos() * v0.p(), v0.tofNSigmaALaPi()); + histos.fill(HIST("AntiLambda/h3dNegNsigmaTOFvsTrackPtot"), centrality, v0.pfracneg() * v0.p(), v0.tofNSigmaALaPr()); + histos.fill(HIST("AntiLambda/h3dPosTOFdeltaTvsTrackPtot"), centrality, v0.pfracpos() * v0.p(), v0.posTOFDeltaTLaPi()); + histos.fill(HIST("AntiLambda/h3dNegTOFdeltaTvsTrackPtot"), centrality, v0.pfracneg() * v0.p(), v0.negTOFDeltaTLaPr()); + histos.fill(HIST("AntiLambda/h3dPosNsigmaTOFvsTrackPt"), centrality, v0.positivept(), v0.tofNSigmaALaPi()); + histos.fill(HIST("AntiLambda/h3dNegNsigmaTOFvsTrackPt"), centrality, v0.negativept(), v0.tofNSigmaALaPr()); + histos.fill(HIST("AntiLambda/h3dPosTOFdeltaTvsTrackPt"), centrality, v0.positivept(), v0.posTOFDeltaTLaPi()); + histos.fill(HIST("AntiLambda/h3dNegTOFdeltaTvsTrackPt"), centrality, v0.negativept(), v0.negTOFDeltaTLaPr()); + } } if (doEtaPhiQA) { histos.fill(HIST("AntiLambda/h5dV0PhiVsEta"), centrality, v0pt, v0.mAntiLambda(), v0.phi(), v0.eta()); @@ -1989,14 +1978,23 @@ struct lambdajetpolarizationions { histos.fill(HIST("AntiLambda/h2dNbrOfAntiLambdaVsCentrality"), centrality, NAntiLambdas); } - PROCESS_SWITCH(lambdajetpolarizationions, processJetsData, "Process jets and produce derived data in Run 3 Data", true); - PROCESS_SWITCH(lambdajetpolarizationions, processV0sData, "Process V0s and produce derived data in Run 3 Data", true); - // PROCESS_SWITCH(lambdajetpolarizationions, processJetsMC, "Process jets and produced derived data in Run 3 MC", true); - // PROCESS_SWITCH(lambdajetpolarizationions, processV0sMC, "Process V0s and produce derived data in Run 3 MC", true); + void processData(SelCollisions::iterator const& collision, aod::V0Datas const& V0s, DauTracks const& V0DauTracks, aod::BCsWithTimestamps const& bcs) + { + dataProcess(collision, V0s, V0DauTracks, bcs); // No longer need "JetTracks const& jetTracks" -- using DauTracks subscription instead + } + + void processDataWithTOF(SelCollisions::iterator const& collision, V0CandidatesWithTOF const& V0s, DauTracks const& V0DauTracks, aod::BCsWithTimestamps const& bcs) + { + dataProcess(collision, V0s, V0DauTracks, bcs); + } + + PROCESS_SWITCH(lambdajetpolarizationions, processData, "Process jets and V0s, produces derived data in Run 3 Data", true); + PROCESS_SWITCH(lambdajetpolarizationions, processDataWithTOF, "Process jets and V0s (with TOF), produces derived data in Run 3 Data", false); + // PROCESS_SWITCH(lambdajetpolarizationions, processMC, "Process jets and V0s, produces derived data in Run 3 MC", true); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ adaptAnalysisTask(cfgc)}; -} +} \ No newline at end of file diff --git a/PWGLF/Tasks/Strangeness/lambdaJetPolarizationIonsDerived.cxx b/PWGLF/Tasks/Strangeness/lambdaJetPolarizationIonsDerived.cxx index 3bff75a5a54..a8423c536ed 100644 --- a/PWGLF/Tasks/Strangeness/lambdaJetPolarizationIonsDerived.cxx +++ b/PWGLF/Tasks/Strangeness/lambdaJetPolarizationIonsDerived.cxx @@ -424,14 +424,14 @@ struct lambdajetpolarizationionsderived { // Preslices for correct collisions association: // (TODO: test using custom grouping) - Preslice perColJets = o2::aod::lambdajetpol::collisionId; - Preslice perColV0s = o2::aod::lambdajetpol::collisionId; - Preslice perColLeadPs = o2::aod::lambdajetpol::collisionId; + Preslice perColJets = o2::aod::lambdajetpol::ringCollisionId; + Preslice perColV0s = o2::aod::lambdajetpol::ringCollisionId; + Preslice perColLeadPs = o2::aod::lambdajetpol::ringCollisionId; void processPolarizationData(o2::aod::RingCollisions const& collisions, o2::aod::RingJets const& jets, o2::aod::RingLaV0s const& v0s, o2::aod::RingLeadP const& leadPs) { for (auto const& collision : collisions) { - const auto collId = collision.collisionId(); + const auto collId = collision.globalIndex(); // The self-index accessor const double centrality = getCentrality(collision); // Slice jets, V0s and leading particle belonging to this collision: From 80eda41cf03be46bdde71cdcbd99e47af49b2024 Mon Sep 17 00:00:00 2001 From: cmuncinelli Date: Mon, 9 Mar 2026 20:35:56 -0300 Subject: [PATCH 2/5] clang-tidy fixes for includes + fixes to hSelectionV0s filling --- PWGLF/DataModel/lambdaJetPolarizationIons.h | 1 - .../Strangeness/lambdaJetPolarizationIons.cxx | 58 +++++++++++++------ .../lambdaJetPolarizationIonsDerived.cxx | 14 +++-- 3 files changed, 51 insertions(+), 22 deletions(-) diff --git a/PWGLF/DataModel/lambdaJetPolarizationIons.h b/PWGLF/DataModel/lambdaJetPolarizationIons.h index ceb2066265e..b96edfd6980 100644 --- a/PWGLF/DataModel/lambdaJetPolarizationIons.h +++ b/PWGLF/DataModel/lambdaJetPolarizationIons.h @@ -22,7 +22,6 @@ #include #include -#include namespace o2::aod { diff --git a/PWGLF/TableProducer/Strangeness/lambdaJetPolarizationIons.cxx b/PWGLF/TableProducer/Strangeness/lambdaJetPolarizationIons.cxx index 793db7777fc..6f9183a8744 100644 --- a/PWGLF/TableProducer/Strangeness/lambdaJetPolarizationIons.cxx +++ b/PWGLF/TableProducer/Strangeness/lambdaJetPolarizationIons.cxx @@ -28,13 +28,16 @@ // Standard Library #include -#include +#include #include +#include #include #include // PWGLF #include "PWGLF/DataModel/lambdaJetPolarizationIons.h" +#include "RCTSelectionFlags.h" +#include "EventSelectionParams.h" #include "PWGLF/DataModel/LFStrangenessPIDTables.h" // #include "Common/DataModel/PIDResponseTOF.h" // Maybe switch this around with LFStrangenessPIDTables? #include "PWGLF/DataModel/LFStrangenessTables.h" // For V0TOFPIDs and NSigmas getters. Better for considering the daughters as coming from V0s instead of from PV: @@ -57,13 +60,21 @@ // Common Core #include "Common/Core/RecoDecay.h" -#include "Common/Core/TrackSelection.h" // Framework +#include +#include #include #include +#include #include +#include +#include +#include +#include +#include #include +#include #include // O2 subsystems @@ -71,22 +82,20 @@ #include #include "Common/CCDB/ctpRateFetcher.h" #include -#include // External libraries #include #include #include #include +#include #include -#include -#include -#include +#include // ROOT math -#include "Math/GenVector/Boost.h" -#include "Math/Vector3D.h" -#include "Math/Vector4D.h" +#include +#include +#include using namespace o2; using namespace o2::framework; @@ -970,9 +979,24 @@ struct lambdajetpolarizationions { HistogramRegistry* histos = nullptr; // Had to pass the histos group to this struct, as it was not visible to the members of this struct void resetForNewV0() { binValue = -1; } + // Advance to targetBinX, filling all intermediate bins. + // Use this for DISABLED cuts within a single hypothesis + // (shows pass-through count as a flat line, making it visually + // clear that the stage was not active). + // (Replaces N dummy fill() calls) + void fillUpTo(int targetBinX) { + while (binValue < targetBinX) + histos->fill(HIST("GeneralQA/hSelectionV0s"), ++binValue); + } + + void advanceTo(int targetBinX) { binValue = targetBinX - 1; } // next fill() lands at targetBin. Needed to deal with early exits at isLambda vs isAntiLambda checks void fill() { histos->fill(HIST("GeneralQA/hSelectionV0s"), ++binValue); } // Hardcoded hSelectionV0s histogram, as it will not change. Increments before filling, by default }; - V0SelectionFlowCounter V0SelCounter{0, &histos}; + V0SelectionFlowCounter V0SelCounter{-1, &histos}; // Could initialize with any index (resetForNewV0 is always called for a new V0 anyways) + // Calculating some bins, for convenience: + int nGenericCuts = 31; // x=0 to x=30 + int nHypoCuts = 9; // per hypothesis (x=31..39 for Lambda) + int lambdaHypoEnd = nGenericCuts + nHypoCuts - 1; // x=39 // Minimal helper to fill hSelectionJetTracks, mirroring V0SelectionFlowCounter. // Reset once per track candidate, fill once per passed cut stage. @@ -982,7 +1006,7 @@ struct lambdajetpolarizationions { void resetForNewTrack() { binValue = -1; } void fill() { histos->fill(HIST("GeneralQA/hSelectionJetTracks"), ++binValue); } }; - JetTrackSelectionFlowCounter JetTrackSelCounter{0, &histos}; + JetTrackSelectionFlowCounter JetTrackSelCounter{-1, &histos}; // Short inlined helper to simplify QA inline void fillEventSelectionQA(int bin, float centrality) @@ -1418,11 +1442,8 @@ struct lambdajetpolarizationions { // correct for the V0 mother's travel time and considers all tracks as if they came from the PV! // if (protonHasTOF && std::fabs(protonTrack.tofNSigmaPr()) > v0Selections.tofPidNsigmaCutLaPr) return false; // To properly use the LFStrangenessPIDTables version, you need to call o2-analysis-lf-strangenesstofpid too. - } else { // Should fill counters an equal number of times to advance indices (TODO: implement better solution, such as just advancing the index) - V0SelCounter.fill(); - V0SelCounter.fill(); - V0SelCounter.fill(); - V0SelCounter.fill(); + } else { // Should fill counters an equal number of times to advance indices + V0SelCounter.fillUpTo(V0SelCounter.binValue + 4); // Fills the 4 times "V0SelCounter.fill()" would be called } // proper lifetime @@ -1766,8 +1787,11 @@ struct lambdajetpolarizationions { bool isAntiLambda = false; if (analyseLambda) isLambda = passesLambdaLambdaBarHypothesis(v0, collision, true); - if (analyseAntiLambda) + if (analyseAntiLambda) { + if (analyseLambda) // We only need to advance when the Lambda hypothesis had an early exit on the counters + V0SelCounter.advanceTo(lambdaHypoEnd + 1); // sync to bin 41 (x=40 means bin 41, the first #bar{#Lambda} bin) isAntiLambda = passesLambdaLambdaBarHypothesis(v0, collision, false); + } if (!isLambda && !isAntiLambda) continue; // Candidate is not considered to be a Lambda-like diff --git a/PWGLF/Tasks/Strangeness/lambdaJetPolarizationIonsDerived.cxx b/PWGLF/Tasks/Strangeness/lambdaJetPolarizationIonsDerived.cxx index a8423c536ed..86c679a68c0 100644 --- a/PWGLF/Tasks/Strangeness/lambdaJetPolarizationIonsDerived.cxx +++ b/PWGLF/Tasks/Strangeness/lambdaJetPolarizationIonsDerived.cxx @@ -30,27 +30,33 @@ // cicero.domenico.muncinelli@cern.ch // +#include +#include #include -#include #include #include -#include +#include +#include +#include +#include +#include #include // Custom data model: #include "PWGLF/DataModel/lambdaJetPolarizationIons.h" #include -#include +#include #include #include // #include // #include // New recommended format: -#include +#include // clang-tidy usually confuses this! Careful! #include #include +#include #include // For perpendicular jet direction QAs using namespace o2; From 4522db9e0e82987f23a45570d414b95232dbf2cc Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Tue, 10 Mar 2026 02:27:33 +0000 Subject: [PATCH 3/5] Please consider the following formatting changes --- PWGLF/DataModel/lambdaJetPolarizationIons.h | 5 +- .../Strangeness/lambdaJetPolarizationIons.cxx | 50 +++++++++++-------- .../lambdaJetPolarizationIonsDerived.cxx | 4 +- 3 files changed, 34 insertions(+), 25 deletions(-) diff --git a/PWGLF/DataModel/lambdaJetPolarizationIons.h b/PWGLF/DataModel/lambdaJetPolarizationIons.h index b96edfd6980..fe1116ee525 100644 --- a/PWGLF/DataModel/lambdaJetPolarizationIons.h +++ b/PWGLF/DataModel/lambdaJetPolarizationIons.h @@ -21,6 +21,7 @@ #define PWGLF_DATAMODEL_LAMBDAJETPOLARIZATIONIONS_H_ #include + #include namespace o2::aod @@ -88,7 +89,7 @@ DECLARE_SOA_DYNAMIC_COLUMN(LeadParticlePz, leadParticlePz, //! Leading particle } // namespace lambdajetpol DECLARE_SOA_TABLE(RingCollisions, "AOD", "RINGCOLLISIONS", - o2::soa::Index<>, // self-index: auto-assigned row number + o2::soa::Index<>, // self-index: auto-assigned row number lambdajetpol::CentFT0M, lambdajetpol::CentFT0C, lambdajetpol::CentFV0A); @@ -99,7 +100,7 @@ DECLARE_SOA_INDEX_COLUMN(RingCollision, ringCollision); // Declare index after t } // namespace lambdajetpol DECLARE_SOA_TABLE(RingJets, "AOD", "RINGJETS", - lambdajetpol::RingCollisionId, // relational index -> RingCollisions + lambdajetpol::RingCollisionId, // relational index -> RingCollisions lambdajetpol::JetPt, lambdajetpol::JetEta, lambdajetpol::JetPhi, diff --git a/PWGLF/TableProducer/Strangeness/lambdaJetPolarizationIons.cxx b/PWGLF/TableProducer/Strangeness/lambdaJetPolarizationIons.cxx index 6f9183a8744..6cbd75138d5 100644 --- a/PWGLF/TableProducer/Strangeness/lambdaJetPolarizationIons.cxx +++ b/PWGLF/TableProducer/Strangeness/lambdaJetPolarizationIons.cxx @@ -35,10 +35,11 @@ #include // PWGLF -#include "PWGLF/DataModel/lambdaJetPolarizationIons.h" -#include "RCTSelectionFlags.h" #include "EventSelectionParams.h" +#include "RCTSelectionFlags.h" + #include "PWGLF/DataModel/LFStrangenessPIDTables.h" +#include "PWGLF/DataModel/lambdaJetPolarizationIons.h" // #include "Common/DataModel/PIDResponseTOF.h" // Maybe switch this around with LFStrangenessPIDTables? #include "PWGLF/DataModel/LFStrangenessTables.h" // For V0TOFPIDs and NSigmas getters. Better for considering the daughters as coming from V0s instead of from PV: @@ -68,19 +69,20 @@ #include #include #include -#include #include +#include +#include #include #include -#include #include #include #include // O2 subsystems +#include "Common/CCDB/ctpRateFetcher.h" + #include #include -#include "Common/CCDB/ctpRateFetcher.h" #include // External libraries @@ -984,18 +986,19 @@ struct lambdajetpolarizationions { // (shows pass-through count as a flat line, making it visually // clear that the stage was not active). // (Replaces N dummy fill() calls) - void fillUpTo(int targetBinX) { - while (binValue < targetBinX) - histos->fill(HIST("GeneralQA/hSelectionV0s"), ++binValue); + void fillUpTo(int targetBinX) + { + while (binValue < targetBinX) + histos->fill(HIST("GeneralQA/hSelectionV0s"), ++binValue); } - void advanceTo(int targetBinX) { binValue = targetBinX - 1; } // next fill() lands at targetBin. Needed to deal with early exits at isLambda vs isAntiLambda checks + void advanceTo(int targetBinX) { binValue = targetBinX - 1; } // next fill() lands at targetBin. Needed to deal with early exits at isLambda vs isAntiLambda checks void fill() { histos->fill(HIST("GeneralQA/hSelectionV0s"), ++binValue); } // Hardcoded hSelectionV0s histogram, as it will not change. Increments before filling, by default }; V0SelectionFlowCounter V0SelCounter{-1, &histos}; // Could initialize with any index (resetForNewV0 is always called for a new V0 anyways) - // Calculating some bins, for convenience: - int nGenericCuts = 31; // x=0 to x=30 - int nHypoCuts = 9; // per hypothesis (x=31..39 for Lambda) + // Calculating some bins, for convenience: + int nGenericCuts = 31; // x=0 to x=30 + int nHypoCuts = 9; // per hypothesis (x=31..39 for Lambda) int lambdaHypoEnd = nGenericCuts + nHypoCuts - 1; // x=39 // Minimal helper to fill hSelectionJetTracks, mirroring V0SelectionFlowCounter. @@ -1438,11 +1441,11 @@ struct lambdajetpolarizationions { // (CAUTION!) You cannot use the getter for raw data's PIDResponseTOF.h instead of LFStrangenessPIDTables.h (as below) // If you do use, TOF will just try to identify that track as a proton from the PV, instead of using the correct path - // length from the V0s PV-DCA and the such! In other words, it is a naive estimator of TOF PID, because it does not + // length from the V0s PV-DCA and the such! In other words, it is a naive estimator of TOF PID, because it does not // correct for the V0 mother's travel time and considers all tracks as if they came from the PV! // if (protonHasTOF && std::fabs(protonTrack.tofNSigmaPr()) > v0Selections.tofPidNsigmaCutLaPr) return false; // To properly use the LFStrangenessPIDTables version, you need to call o2-analysis-lf-strangenesstofpid too. - } else { // Should fill counters an equal number of times to advance indices + } else { // Should fill counters an equal number of times to advance indices V0SelCounter.fillUpTo(V0SelCounter.binValue + 4); // Fills the 4 times "V0SelCounter.fill()" would be called } @@ -1568,7 +1571,8 @@ struct lambdajetpolarizationions { return; histos.fill(HIST("hEventsWithJet"), 0.5); // Another version of this counter, which is already integrated in the Event Selection flow: - if (doEventQA) fillEventSelectionQA(lastBinEvSel - 1, centrality); // hasRingJet passes + if (doEventQA) + fillEventSelectionQA(lastBinEvSel - 1, centrality); // hasRingJet passes if (doJetKinematicsQA) { histos.fill(HIST("JetKinematicsQA/hLeadingJetPt"), leadingJetSub.pt()); @@ -1650,7 +1654,8 @@ struct lambdajetpolarizationions { return; histos.fill(HIST("hEventsWithJet"), 0.5); // Another version of this counter, which is already integrated in the Event Selection flow: - if (doEventQA) fillEventSelectionQA(lastBinEvSel - 1, centrality); // hasRingJet passes + if (doEventQA) + fillEventSelectionQA(lastBinEvSel - 1, centrality); // hasRingJet passes const auto& leadingJet = jets[0]; for (const auto& jet : jets) { @@ -1754,8 +1759,10 @@ struct lambdajetpolarizationions { if (!isEventAccepted(collision, bc, centrality, doEventQA)) return; // Uses return instead of continue, as there is no explicit loop here - if (doEventQA) fillCentralityProperties(collision, centrality); - if (v0Selections.rejectTPCsectorBoundary) initCCDB(bc); // Substituted call from collision to bc for raw data + if (doEventQA) + fillCentralityProperties(collision, centrality); + if (v0Selections.rejectTPCsectorBoundary) + initCCDB(bc); // Substituted call from collision to bc for raw data // Fill event table: tableCollisions(collision.centFT0M(), @@ -1764,7 +1771,7 @@ struct lambdajetpolarizationions { // Get the derived collision row index for this event: const int ringCollIdx = tableCollisions.lastIndex(); - + // Call to jets process: jetsProcess(V0DauTracks, ringCollIdx, centrality); // V0DauTracks takes the place of jetTracks now @@ -1788,7 +1795,7 @@ struct lambdajetpolarizationions { if (analyseLambda) isLambda = passesLambdaLambdaBarHypothesis(v0, collision, true); if (analyseAntiLambda) { - if (analyseLambda) // We only need to advance when the Lambda hypothesis had an early exit on the counters + if (analyseLambda) // We only need to advance when the Lambda hypothesis had an early exit on the counters V0SelCounter.advanceTo(lambdaHypoEnd + 1); // sync to bin 41 (x=40 means bin 41, the first #bar{#Lambda} bin) isAntiLambda = passesLambdaLambdaBarHypothesis(v0, collision, false); } @@ -2021,4 +2028,5 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ adaptAnalysisTask(cfgc)}; -} \ No newline at end of file +} + \ No newline at end of file diff --git a/PWGLF/Tasks/Strangeness/lambdaJetPolarizationIonsDerived.cxx b/PWGLF/Tasks/Strangeness/lambdaJetPolarizationIonsDerived.cxx index 86c679a68c0..1681867e98b 100644 --- a/PWGLF/Tasks/Strangeness/lambdaJetPolarizationIonsDerived.cxx +++ b/PWGLF/Tasks/Strangeness/lambdaJetPolarizationIonsDerived.cxx @@ -30,13 +30,13 @@ // cicero.domenico.muncinelli@cern.ch // -#include #include +#include #include #include #include -#include #include +#include #include #include #include From fc705ac12650450813c43eff9284ad0d9286f98f Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Tue, 10 Mar 2026 02:29:50 +0000 Subject: [PATCH 4/5] Please consider the following formatting changes --- PWGLF/TableProducer/Strangeness/lambdaJetPolarizationIons.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/PWGLF/TableProducer/Strangeness/lambdaJetPolarizationIons.cxx b/PWGLF/TableProducer/Strangeness/lambdaJetPolarizationIons.cxx index 6cbd75138d5..b58c239f0f6 100644 --- a/PWGLF/TableProducer/Strangeness/lambdaJetPolarizationIons.cxx +++ b/PWGLF/TableProducer/Strangeness/lambdaJetPolarizationIons.cxx @@ -2029,4 +2029,3 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) return WorkflowSpec{ adaptAnalysisTask(cfgc)}; } - \ No newline at end of file From 8fdfb86958d3931489435b18a09b6f9276f0ef66 Mon Sep 17 00:00:00 2001 From: cmuncinelli Date: Mon, 9 Mar 2026 23:37:20 -0300 Subject: [PATCH 5/5] C++ style of casting --- PWGLF/TableProducer/Strangeness/lambdaJetPolarizationIons.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGLF/TableProducer/Strangeness/lambdaJetPolarizationIons.cxx b/PWGLF/TableProducer/Strangeness/lambdaJetPolarizationIons.cxx index 6f9183a8744..f630d74554e 100644 --- a/PWGLF/TableProducer/Strangeness/lambdaJetPolarizationIons.cxx +++ b/PWGLF/TableProducer/Strangeness/lambdaJetPolarizationIons.cxx @@ -672,7 +672,7 @@ struct lambdajetpolarizationions { {"DCA_{xy} to PV (parametric)", pseudoJetCandidateTrackSelections.doDCAcuts.value}, }; auto hSelectionJetTracks = histos.add("GeneralQA/hSelectionJetTracks", "Charged pseudojet candidate selection flow", kTH1D, - {{(int)jetTrackSelectionLabels.size(), -0.5, (double)jetTrackSelectionLabels.size() - 0.5}}); + {{static_cast(jetTrackSelectionLabels.size()), -0.5, static_cast(jetTrackSelectionLabels.size()) - 0.5}}); for (size_t i = 0; i < jetTrackSelectionLabels.size(); ++i) { auto lbl = jetTrackSelectionLabels[i].label; if (!jetTrackSelectionLabels[i].enabled)