From 98cbe62c080d9a2bbf1f34167e957bc88c127226 Mon Sep 17 00:00:00 2001 From: Rocco Liotino Date: Mon, 23 Feb 2026 15:53:06 +0100 Subject: [PATCH 1/2] updating table producer --- .../AOTTrack/PID/HMPID/hmpidTableProducer.cxx | 87 ++++++++++++------- DPG/Tasks/AOTTrack/PID/HMPID/tableHMPID.h | 7 +- 2 files changed, 59 insertions(+), 35 deletions(-) diff --git a/DPG/Tasks/AOTTrack/PID/HMPID/hmpidTableProducer.cxx b/DPG/Tasks/AOTTrack/PID/HMPID/hmpidTableProducer.cxx index 76267171742..9ea193fe5e2 100644 --- a/DPG/Tasks/AOTTrack/PID/HMPID/hmpidTableProducer.cxx +++ b/DPG/Tasks/AOTTrack/PID/HMPID/hmpidTableProducer.cxx @@ -57,24 +57,28 @@ struct HmpidTableProducer { Produces hmpidAnalysis; - // using TrackCandidates = soa::Join; + // configurable for quality requirements + Configurable requireITS{"requireITS", true, "Require ITS track"}; + Configurable requireTPC{"requireTPC", true, "Require TPC track"}; + Configurable requireTOF{"requireTOF", true, "Require TOF track"}; - using CollisionCandidates = o2::soa::Join; + using CollisionCandidates = o2::soa::Join; using TrackCandidates = soa::Join; - // using CentralityClass = o2::soa::Join; - void init(o2::framework::InitContext&) { // Configure CCDB ccdb->setURL(ccdbConfig.ccdbUrl); ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); + ccdb->setFatalWhenNull(false); histos.add("eventCounter", "eventCounter", kTH1F, {axisEvtCounter}); + histos.add("goodEventCounter", "goodEventCounter", kTH1F, {axisEvtCounter}); + histos.add("eventsHmpid", "eventsWithHmpid", kTH1F, {axisEvtCounter}); } // function to manage ccdb @@ -87,50 +91,75 @@ struct HmpidTableProducer { mCCDBRunNumber = bc.runNumber(); } - void process(soa::Join::iterator const& col, - const aod::HMPIDs& hmpids, - TrackCandidates const&, - aod::BCsWithTimestamps const&) + void processEvent(CollisionCandidates::iterator const& col, + aod::BCsWithTimestamps const&) { histos.fill(HIST("eventCounter"), 0.5); + if (col.sel8()) { + histos.fill(HIST("goodEventCounter"), 0.5); + } + // initialize CCDB for current BC initCCDB(col.bc_as()); + } + PROCESS_SWITCH(HmpidTableProducer, processEvent, "Process event level - collisions", true); + + void processHmpid( + aod::HMPIDs const& hmpids, + TrackCandidates const&, + CollisionCandidates const&, + aod::BCsWithTimestamps const&) + { + // --- Static set to track unique collisions with HMPID tracks --- + static std::unordered_set collisionsWithHmpid; - for (const auto& t : hmpids) { + for (auto const& t : hmpids) { - // global tracks associated to hmpid tracks + // Access the global track associated to the HMPID track const auto& globalTrack = t.track_as(); - if (!globalTrack.isGlobalTrack()) - continue; - if (!globalTrack.hasITS() || !globalTrack.hasTPC() || !globalTrack.hasTOF()) + + if (!globalTrack.has_collision()) continue; - // verify accessible collision - if (!globalTrack.has_collision()) { + // Access the associated collision + const auto& col = globalTrack.collision_as(); + initCCDB(col.bc_as()); + uint32_t collId = col.globalIndex(); + + // --- Track quality selection --- + if ((requireITS && !globalTrack.hasITS()) || + (requireTPC && !globalTrack.hasTPC()) || + (requireTOF && !globalTrack.hasTOF())) { continue; } + // Count collisions with at least one valid HMPID track + if (collisionsWithHmpid.insert(collId).second) { + histos.fill(HIST("eventsHmpid"), 0.5); + } + + float centrality = col.centFV0A(); + float hmpidPhotsCharge2[o2::aod::kDimPhotonsCharge]; for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) { hmpidPhotsCharge2[i] = t.hmpidPhotsCharge()[i]; } - float centrality = col.centFV0A(); - - /////FILL TABLE - hmpidAnalysis( - t.hmpidSignal(), globalTrack.phi(), globalTrack.eta(), t.hmpidMom(), - globalTrack.p(), t.hmpidXTrack(), t.hmpidYTrack(), t.hmpidXMip(), - t.hmpidYMip(), t.hmpidNPhotons(), t.hmpidQMip(), (t.hmpidClusSize() % 1000000) / 1000, - t.hmpidClusSize() / 1000000, hmpidPhotsCharge2, globalTrack.eta(), globalTrack.phi(), - globalTrack.px(), globalTrack.py(), globalTrack.pz(), globalTrack.itsNCls(), - globalTrack.tpcNClsFound(), globalTrack.tpcNClsCrossedRows(), globalTrack.tpcChi2NCl(), globalTrack.itsChi2NCl(), - globalTrack.dcaXY(), globalTrack.dcaZ(), globalTrack.tpcNSigmaPi(), globalTrack.tofNSigmaPi(), - globalTrack.tpcNSigmaKa(), globalTrack.tofNSigmaKa(), globalTrack.tpcNSigmaPr(), globalTrack.tofNSigmaPr(), - globalTrack.tpcNSigmaDe(), globalTrack.tofNSigmaDe(), centrality); - } + /////FILL HMPID CUSTOM TABLE + hmpidAnalysis(t.hmpidSignal(), t.hmpidMom(), + globalTrack.p(), t.hmpidXTrack(), t.hmpidYTrack(), t.hmpidXMip(), + t.hmpidYMip(), t.hmpidNPhotons(), t.hmpidQMip(), (t.hmpidClusSize() % 1000000) / 1000, + t.hmpidClusSize() / 1000000, hmpidPhotsCharge2, globalTrack.eta(), globalTrack.phi(), + globalTrack.px(), globalTrack.py(), globalTrack.pz(), globalTrack.itsNCls(), + globalTrack.tpcNClsFound(), globalTrack.tpcNClsCrossedRows(), globalTrack.tpcChi2NCl(), globalTrack.itsChi2NCl(), + globalTrack.dcaXY(), globalTrack.dcaZ(), globalTrack.tpcNSigmaPi(), globalTrack.tofNSigmaPi(), + globalTrack.tpcNSigmaKa(), globalTrack.tofNSigmaKa(), globalTrack.tpcNSigmaPr(), globalTrack.tofNSigmaPr(), + globalTrack.tpcNSigmaDe(), globalTrack.tofNSigmaDe(), centrality); + } // end loop on hmpid table entries } + + PROCESS_SWITCH(HmpidTableProducer, processHmpid, "Process hmpid entries - tracks", true); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfg) { return WorkflowSpec{adaptAnalysisTask(cfg)}; } diff --git a/DPG/Tasks/AOTTrack/PID/HMPID/tableHMPID.h b/DPG/Tasks/AOTTrack/PID/HMPID/tableHMPID.h index 045282d3e0e..622713b484b 100644 --- a/DPG/Tasks/AOTTrack/PID/HMPID/tableHMPID.h +++ b/DPG/Tasks/AOTTrack/PID/HMPID/tableHMPID.h @@ -23,8 +23,6 @@ inline constexpr int kDimPhotonsCharge = 10; namespace variables_table { DECLARE_SOA_COLUMN(ChAngle, chAngle, float); -DECLARE_SOA_COLUMN(Phi, phi, float); -DECLARE_SOA_COLUMN(Eta, eta, float); DECLARE_SOA_COLUMN(MomentumHmpid, momentumHmpid, float); DECLARE_SOA_COLUMN(MomentumTrack, momentumTrack, float); DECLARE_SOA_COLUMN(XTrack, xTrack, float); @@ -60,15 +58,12 @@ DECLARE_SOA_COLUMN(TpcNSigmaPr, tpcNSigmaPr, float); DECLARE_SOA_COLUMN(TofNSigmaPr, tofNSigmaPr, float); DECLARE_SOA_COLUMN(TpcNSigmaDe, tpcNSigmaDe, float); DECLARE_SOA_COLUMN(TofNSigmaDe, tofNSigmaDe, float); - DECLARE_SOA_COLUMN(Centrality, centrality, float); } // namespace variables_table DECLARE_SOA_TABLE(HmpidAnalysis, "AOD", "HMPIDANALYSIS", variables_table::ChAngle, - variables_table::Phi, - variables_table::Eta, variables_table::MomentumHmpid, variables_table::MomentumTrack, variables_table::XTrack, @@ -104,4 +99,4 @@ DECLARE_SOA_TABLE(HmpidAnalysis, "AOD", "HMPIDANALYSIS", } // namespace o2::aod -#endif // DPG_TASKS_AOTTRACK_PID_HMPID_TABLEHMPID_H_ +#endif // DPG_TASKS_AOTTRACK_PID_HMPID_TABLEHMPID_H_ \ No newline at end of file From d7aab37218010a84b1054ca5a6fe2acb61e7040c Mon Sep 17 00:00:00 2001 From: Rocco Liotino Date: Mon, 23 Feb 2026 16:17:36 +0100 Subject: [PATCH 2/2] fixing clang and megalinter --- DPG/Tasks/AOTTrack/PID/HMPID/hmpidTableProducer.cxx | 1 + DPG/Tasks/AOTTrack/PID/HMPID/tableHMPID.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/DPG/Tasks/AOTTrack/PID/HMPID/hmpidTableProducer.cxx b/DPG/Tasks/AOTTrack/PID/HMPID/hmpidTableProducer.cxx index 9ea193fe5e2..f2865d65be9 100644 --- a/DPG/Tasks/AOTTrack/PID/HMPID/hmpidTableProducer.cxx +++ b/DPG/Tasks/AOTTrack/PID/HMPID/hmpidTableProducer.cxx @@ -38,6 +38,7 @@ #include #include +#include using namespace o2; using namespace o2::framework; diff --git a/DPG/Tasks/AOTTrack/PID/HMPID/tableHMPID.h b/DPG/Tasks/AOTTrack/PID/HMPID/tableHMPID.h index 622713b484b..dff3a00ed4f 100644 --- a/DPG/Tasks/AOTTrack/PID/HMPID/tableHMPID.h +++ b/DPG/Tasks/AOTTrack/PID/HMPID/tableHMPID.h @@ -99,4 +99,4 @@ DECLARE_SOA_TABLE(HmpidAnalysis, "AOD", "HMPIDANALYSIS", } // namespace o2::aod -#endif // DPG_TASKS_AOTTRACK_PID_HMPID_TABLEHMPID_H_ \ No newline at end of file +#endif // DPG_TASKS_AOTTRACK_PID_HMPID_TABLEHMPID_H_