From c5d8ae5706b2a4d148775da56f0248d5c6b5761d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Fri, 21 Aug 2026 15:12:57 +0200 Subject: [PATCH 1/6] Fix codechecker in OTF tracker --- ALICE3/TableProducer/OTF/onTheFlyTracker.cxx | 356 ++++++++++--------- 1 file changed, 182 insertions(+), 174 deletions(-) diff --git a/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx b/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx index 45dee932571..0b831aa7d89 100644 --- a/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx +++ b/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx @@ -106,14 +106,6 @@ using namespace o2; using namespace o2::framework; using std::array; -#define getHist(type, name) \ - std::get>(histPointers[name]) -#define fillHist(type, name, ...) \ - if (histPointers.find(name) != histPointers.end()) \ - std::get>(histPointers[name])->Fill(__VA_ARGS__); \ - else \ - LOG(fatal) << "Histogram " << name << " not found!"; -#define insertHist(name, ...) histPointers[name] = histos.add((name).c_str(), __VA_ARGS__); enum TrackType { kNone = 0, @@ -276,7 +268,7 @@ struct OnTheFlyTracker { using TimeEst = o2::dataformats::TimeStampWithError; public: - TrackAlice3() = default; + TrackAlice3() : TrackParCov{}, mcLabel{-1}, timeEst{}, isDecayDau{false}, isWeakDecayDau{false}, isUsedInCascading{0}, nSiliconHits{0}, nTPCHits{0}, trackType{TrackType::kNone} {} ~TrackAlice3() = default; TrackAlice3(const TrackAlice3& src) = default; TrackAlice3(const o2::track::TrackParCov& src, const int64_t label, @@ -329,7 +321,7 @@ struct OnTheFlyTracker { float mLambda; float mXi; }; - cascadecandidate thisCascade; + cascadecandidate thisCascade{}; // Helper struct to pass V0 information struct v0candidate { @@ -346,7 +338,7 @@ struct OnTheFlyTracker { float mAntiLambda; float mK0; }; - v0candidate thisV0; + v0candidate thisV0{}; // Constants static constexpr int kv0Prongs = 2; static constexpr std::array v0PDGs = {PDG_t::kK0Short, @@ -373,7 +365,7 @@ struct OnTheFlyTracker { std::pair vertexReconstructionEfficiencyCounters = {0, 0}; // {nVerticesWithMoreThan2Contributors, nVerticesReconstructed} // necessary for particle charges - Service pdgDB; + Service pdgDB{}; // for handling basic QA histograms if requested HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -399,19 +391,41 @@ struct OnTheFlyTracker { // For TGenPhaseSpace seed TRandom3 rand; - Service ccdb; + Service ccdb{}; // Configuration defined at init time o2::fastsim::GeometryContainer mGeoContainer; float mMagneticField = 0.0f; // Time resolution constants - const float timeResolutionNs = 100.f; // ns - const float nsToMus = 1e-3f; - const float timeResolutionUs = timeResolutionNs * nsToMus; // us + static constexpr float timeResolutionNs = 100.f; // ns + static constexpr float nsToMus = 1e-3f; + static constexpr float timeResolutionUs = timeResolutionNs * nsToMus; // us o2::dataformats::DCA dcaInfo; o2::dataformats::VertexBase vtx; + template + std::shared_ptr getHist(const std::string& name) + { + return std::get>(histPointers.at(name)); + } + + template + void fillHist(const std::string& name, Args&&... args) + { + const auto it = histPointers.find(name); + if (it == histPointers.end()) { + LOG(fatal) << "Histogram " << name << " not found!"; + } + std::get>(it->second)->Fill(std::forward(args)...); + } + + template + void insertHist(const std::string& name, Args&&... args) + { + histPointers[name] = histos.add(name.c_str(), std::forward(args)...); + } + void init(o2::framework::InitContext& initContext) { LOG(info) << "Initializing OnTheFlyTracker task"; @@ -508,8 +522,8 @@ struct OnTheFlyTracker { insertHist(histPath + "hVtxMultReco", "hVtxMultReco;Reconstructed Vertex Multiplicity", {kTH1D, {{axes.axisVtxMult}}}); insertHist(histPath + "hVtxTrials", "hVtxTrials;Vertex Reconstruction Trials", {kTH1D, {{2, -0.5, 1.5}}}); // Set the bin labels - getHist(TH1, histPath + "hVtxTrials")->GetXaxis()->SetBinLabel(1, "Tried"); - getHist(TH1, histPath + "hVtxTrials")->GetXaxis()->SetBinLabel(2, "Succeeded"); + getHist( histPath + "hVtxTrials")->GetXaxis()->SetBinLabel(1, "Tried"); + getHist( histPath + "hVtxTrials")->GetXaxis()->SetBinLabel(2, "Succeeded"); } if (enableSecondarySmearing) { @@ -523,14 +537,14 @@ struct OnTheFlyTracker { if (cascadeDecaySettings.doXiQA) { insertHist(histPath + "hXiBuilding", "hXiBuilding", {kTH1F, {{10, -0.5f, 9.5f}}}); - getHist(TH1, histPath + "hXiBuilding")->GetXaxis()->SetBinLabel(1, "Generated"); - getHist(TH1, histPath + "hXiBuilding")->GetXaxis()->SetBinLabel(2, "Secondary smearing prong 0"); - getHist(TH1, histPath + "hXiBuilding")->GetXaxis()->SetBinLabel(3, "Secondary smearing prong 1"); - getHist(TH1, histPath + "hXiBuilding")->GetXaxis()->SetBinLabel(4, "Secondary smearing prong 2"); - getHist(TH1, histPath + "hXiBuilding")->GetXaxis()->SetBinLabel(5, "Not Nan"); - getHist(TH1, histPath + "hXiBuilding")->GetXaxis()->SetBinLabel(6, "Start Reco"); - getHist(TH1, histPath + "hXiBuilding")->GetXaxis()->SetBinLabel(7, "V0 fitter ok"); - getHist(TH1, histPath + "hXiBuilding")->GetXaxis()->SetBinLabel(8, "Kink fitter ok"); + getHist( histPath + "hXiBuilding")->GetXaxis()->SetBinLabel(1, "Generated"); + getHist( histPath + "hXiBuilding")->GetXaxis()->SetBinLabel(2, "Secondary smearing prong 0"); + getHist( histPath + "hXiBuilding")->GetXaxis()->SetBinLabel(3, "Secondary smearing prong 1"); + getHist( histPath + "hXiBuilding")->GetXaxis()->SetBinLabel(4, "Secondary smearing prong 2"); + getHist( histPath + "hXiBuilding")->GetXaxis()->SetBinLabel(5, "Not Nan"); + getHist( histPath + "hXiBuilding")->GetXaxis()->SetBinLabel(6, "Start Reco"); + getHist( histPath + "hXiBuilding")->GetXaxis()->SetBinLabel(7, "V0 fitter ok"); + getHist( histPath + "hXiBuilding")->GetXaxis()->SetBinLabel(8, "Kink fitter ok"); insertHist(histPath + "hGenXi", "hGenXi;Decay Radius;#it{p}_{T}", {kTH2F, {axes.axisDecayRadius, axes.axisMomentum}}); insertHist(histPath + "hRecoXi", "hRecoXi;Decay Radius;#it{p}_{T}", {kTH2F, {axes.axisDecayRadius, axes.axisMomentum}}); @@ -567,14 +581,14 @@ struct OnTheFlyTracker { insertHist(histPath + "nTPCHitsCascadeProngs", "nTPCHitsCascadeProngs", {kTH1F, {{10, -0.5f, 9.5f}}}); insertHist(histPath + "hFastTrackerHits", "hFastTrackerHits", {kTH2F, {axes.axisZ, axes.axisRadius}}); insertHist(histPath + "hFastTrackerQA", "hFastTrackerQA", {kTH1F, {{8, -0.5f, 7.5f}}}); - getHist(TH1, histPath + "hFastTrackerQA")->GetXaxis()->SetBinLabel(1, "Negative eigenvalue"); - getHist(TH1, histPath + "hFastTrackerQA")->GetXaxis()->SetBinLabel(2, "Failed sanity check"); - getHist(TH1, histPath + "hFastTrackerQA")->GetXaxis()->SetBinLabel(3, "intercept original radius"); - getHist(TH1, histPath + "hFastTrackerQA")->GetXaxis()->SetBinLabel(4, "propagate to original radius"); - getHist(TH1, histPath + "hFastTrackerQA")->GetXaxis()->SetBinLabel(5, "problematic layer"); - getHist(TH1, histPath + "hFastTrackerQA")->GetXaxis()->SetBinLabel(6, "multiple scattering"); - getHist(TH1, histPath + "hFastTrackerQA")->GetXaxis()->SetBinLabel(7, "energy loss"); - getHist(TH1, histPath + "hFastTrackerQA")->GetXaxis()->SetBinLabel(8, "efficiency"); + getHist( histPath + "hFastTrackerQA")->GetXaxis()->SetBinLabel(1, "Negative eigenvalue"); + getHist( histPath + "hFastTrackerQA")->GetXaxis()->SetBinLabel(2, "Failed sanity check"); + getHist( histPath + "hFastTrackerQA")->GetXaxis()->SetBinLabel(3, "intercept original radius"); + getHist( histPath + "hFastTrackerQA")->GetXaxis()->SetBinLabel(4, "propagate to original radius"); + getHist( histPath + "hFastTrackerQA")->GetXaxis()->SetBinLabel(5, "problematic layer"); + getHist( histPath + "hFastTrackerQA")->GetXaxis()->SetBinLabel(6, "multiple scattering"); + getHist( histPath + "hFastTrackerQA")->GetXaxis()->SetBinLabel(7, "energy loss"); + getHist( histPath + "hFastTrackerQA")->GetXaxis()->SetBinLabel(8, "efficiency"); } } @@ -704,7 +718,7 @@ struct OnTheFlyTracker { auto field = grpmag.getNominalL3Field(); o2::base::Propagator::initFieldFromGRP(&grpmag); - auto fieldInstance = static_cast(TGeoGlobalMagField::Instance()->GetField()); + auto fieldInstance = dynamic_cast(TGeoGlobalMagField::Instance()->GetField()); if (!fieldInstance) { LOGF(fatal, "Failed to set up magnetic field! Stopping now!"); } @@ -766,9 +780,7 @@ struct OnTheFlyTracker { return o2::track::PID::Proton; } else if (std::abs(pdgCode) == PDG_t::kLambda0) { return o2::track::PID::Lambda; - } else if (std::abs(pdgCode) == PDG_t::kSigmaPlus) { - return o2::track::PID::XiMinus; // Close enough - } else if (std::abs(pdgCode) == PDG_t::kSigmaMinus) { + } else if (std::abs(pdgCode) == PDG_t::kSigmaPlus || std::abs(pdgCode) == PDG_t::kSigmaMinus) { return o2::track::PID::XiMinus; // Close enough } else if (std::abs(pdgCode) == PDG_t::kXiMinus) { return o2::track::PID::XiMinus; @@ -786,14 +798,14 @@ struct OnTheFlyTracker { /// \param xiDecayVertex the address of the xi decay vertex /// \param laDecayVertex the address of the la decay vertex template - void decayCascade(McParticleType particle, o2::track::TrackParCov track, std::vector& decayDaughters, std::vector& xiDecayVertex, std::vector& laDecayVertex) + void decayCascade(const McParticleType& particle, o2::track::TrackParCov track, std::vector& decayDaughters, std::vector& xiDecayVertex, std::vector& laDecayVertex) { const double uXi = rand.Uniform(0, 1); const double ctauXi = 4.91; // cm const double betaGammaXi = particle.p() / o2::constants::physics::MassXiMinus; const double rxyzXi = (-betaGammaXi * ctauXi * std::log(1 - uXi)); - float sna, csa; + float sna{0.f}, csa{0.f}; o2::math_utils::CircleXYf_t circleXi; track.getCircleParams(mMagneticField, circleXi, sna, csa); const double rxyXi = rxyzXi / std::sqrt(1. + track.getTgl() * track.getTgl()); @@ -837,7 +849,7 @@ struct OnTheFlyTracker { /// \param decayDaughters the address of resulting daughters /// \param v0DecayVertex the address of the la decay vertex template - void decayV0Particle(McParticleType particle, std::vector& decayDaughters, std::vector& v0DecayVertex, int pdgCode) + void decayV0Particle(const McParticleType& particle, std::vector& decayDaughters, std::vector& v0DecayVertex, int pdgCode) { double u = rand.Uniform(0, 1); double v0Mass = -1.; @@ -890,7 +902,7 @@ struct OnTheFlyTracker { /// \param mcParticles the set of MC particles to compute dN/deta from /// \param histPath the path to the histogram where the computed dN/deta value will be stored for QA purposes template - void computeDNDEta(float& dNdEta, McParticleType const& mcParticles, const std::string histPath) + void computeDNDEta(float& dNdEta, McParticleType const& mcParticles, const std::string& histPath) { for (const auto& mcParticle : mcParticles) { if (std::abs(mcParticle.eta()) > multEtaRange) { @@ -922,7 +934,7 @@ struct OnTheFlyTracker { LOG(debug) << "Computed dNch/deta before normalization: " << dNdEta; dNdEta /= (multEtaRange * 2.0f); - getHist(TH1, histPath + "hLUTMultiplicity")->Fill(dNdEta); + getHist( histPath + "hLUTMultiplicity")->Fill(dNdEta); } /// Function to study the cascade decay and fill the relevant histograms and output track vector @@ -939,7 +951,7 @@ struct OnTheFlyTracker { std::vector& tracksCascadeProngs, o2::vertexing::PVertex& primaryVertex, int icfg, - int dNdEta, + float dNdEta, float eventCollisionTimeNS) { o2::track::TrackParCov trackParCov; @@ -951,10 +963,10 @@ struct OnTheFlyTracker { static constexpr int kCascProngs = 3; std::array xiDaughterTrackParCovsPerfect; std::array xiDaughterTrackParCovsTracked; - std::array isReco; - std::array nHitsCascadeProngs; // total - std::array nSiliconHitsCascadeProngs; // silicon type - std::array nTPCHitsCascadeProngs; // TPC type + std::array isReco{}; + std::array nHitsCascadeProngs{}; // total + std::array nSiliconHitsCascadeProngs{}; // silicon type + std::array nTPCHitsCascadeProngs{}; // TPC type o2::track::TrackParCov xiTrackParCov; o2::upgrade::convertMCParticleToO2Track(mcParticle, xiTrackParCov, pdgDB); @@ -966,14 +978,14 @@ struct OnTheFlyTracker { double laDecayRadius2D = std::hypot(laDecayVertex[0], laDecayVertex[1]); if (cascadeDecaySettings.doXiQA) { - getHist(TH2, histPath + "hGenXi")->Fill(xiDecayRadius2D, mcParticle.pt()); - getHist(TH2, histPath + "hGenPiFromXi")->Fill(xiDecayRadius2D, cascadeDecayProducts[0].Pt()); - getHist(TH2, histPath + "hGenPiFromLa")->Fill(laDecayRadius2D, cascadeDecayProducts[1].Pt()); - getHist(TH2, histPath + "hGenPrFromLa")->Fill(laDecayRadius2D, cascadeDecayProducts[2].Pt()); + getHist( histPath + "hGenXi")->Fill(xiDecayRadius2D, mcParticle.pt()); + getHist( histPath + "hGenPiFromXi")->Fill(xiDecayRadius2D, cascadeDecayProducts[0].Pt()); + getHist( histPath + "hGenPiFromLa")->Fill(laDecayRadius2D, cascadeDecayProducts[1].Pt()); + getHist( histPath + "hGenPrFromLa")->Fill(laDecayRadius2D, cascadeDecayProducts[2].Pt()); } if (cascadeDecaySettings.doXiQA) { - getHist(TH1, histPath + "hXiBuilding")->Fill(0.0f); + getHist( histPath + "hXiBuilding")->Fill(0.0f); } o2::upgrade::convertTLorentzVectorToO2Track(PDG_t::kPiMinus, cascadeDecayProducts[0], xiDecayVertex, xiDaughterTrackParCovsPerfect[0], pdgDB); @@ -1011,11 +1023,11 @@ struct OnTheFlyTracker { nTPCHitsCascadeProngs[i] = fastTracker[icfg]->GetNGasPoints(); if (nHitsCascadeProngs[i] < 0 && cascadeDecaySettings.doXiQA) { // QA - getHist(TH1, histPath + "hFastTrackerQA")->Fill(o2::math_utils::abs(nHitsCascadeProngs[i])); + getHist( histPath + "hFastTrackerQA")->Fill(o2::math_utils::abs(nHitsCascadeProngs[i])); } - getHist(TH1, histPath + "nSiliconHitsCascadeProngs")->Fill(nSiliconHitsCascadeProngs[i]); - getHist(TH1, histPath + "nTPCHitsCascadeProngs")->Fill(nTPCHitsCascadeProngs[i]); + getHist( histPath + "nSiliconHitsCascadeProngs")->Fill(nSiliconHitsCascadeProngs[i]); + getHist( histPath + "nTPCHitsCascadeProngs")->Fill(nTPCHitsCascadeProngs[i]); if (nSiliconHitsCascadeProngs[i] >= fastTrackerSettings.minSiliconHits || (nSiliconHitsCascadeProngs[i] >= fastTrackerSettings.minSiliconHitsIfTPCUsed && nTPCHitsCascadeProngs[i] >= fastTrackerSettings.minTPCClusters)) { @@ -1024,18 +1036,18 @@ struct OnTheFlyTracker { continue; // extra sure } if (cascadeDecaySettings.doXiQA) { - getHist(TH1, histPath + "hXiBuilding")->Fill(static_cast(i + 1)); + getHist( histPath + "hXiBuilding")->Fill(static_cast(i + 1)); } isReco[i] = true; for (uint32_t ih = 0; ih < fastTracker[icfg]->GetNHits() && cascadeDecaySettings.doXiQA; ih++) { - getHist(TH2, histPath + "hFastTrackerHits")->Fill(fastTracker[icfg]->GetHitZ(ih), std::hypot(fastTracker[icfg]->GetHitX(ih), fastTracker[icfg]->GetHitY(ih))); + getHist( histPath + "hFastTrackerHits")->Fill(fastTracker[icfg]->GetHitZ(ih), std::hypot(fastTracker[icfg]->GetHitX(ih), fastTracker[icfg]->GetHitY(ih))); } } else { isReco[i] = true; xiDaughterTrackParCovsTracked[i] = xiDaughterTrackParCovsPerfect[i]; if (cascadeDecaySettings.doXiQA) { - getHist(TH1, histPath + "hXiBuilding")->Fill(static_cast(i + 1)); + getHist( histPath + "hXiBuilding")->Fill(static_cast(i + 1)); } } @@ -1043,7 +1055,7 @@ struct OnTheFlyTracker { isReco[i] = false; continue; } else { - getHist(TH1, histPath + "hXiBuilding")->Fill(4.0f); + getHist( histPath + "hXiBuilding")->Fill(4.0f); histos.fill(HIST("hNaNBookkeeping"), i + 1, 1.0f); } trackTime = (eventCollisionTimeNS + gRandom->Gaus(0., timeResolutionNs)) * nsToMus; @@ -1069,7 +1081,7 @@ struct OnTheFlyTracker { // cascade building starts here if (cascadeDecaySettings.findXi && reconstructedCascade && cascadeDecaySettings.doKinkReco != 2) { if (cascadeDecaySettings.doXiQA) { - getHist(TH1, histPath + "hXiBuilding")->Fill(3.0f); + getHist( histPath + "hXiBuilding")->Fill(3.0f); } // use DCA fitters @@ -1094,14 +1106,14 @@ struct OnTheFlyTracker { // V0 found successfully if (dcaFitterV0Status) { if (cascadeDecaySettings.doXiQA) { - getHist(TH1, histPath + "hXiBuilding")->Fill(4.0f); + getHist( histPath + "hXiBuilding")->Fill(4.0f); } - std::array pos; - std::array posCascade; - std::array posP; - std::array negP; - std::array bachP; + std::array pos{}; + std::array posCascade{}; + std::array posP{}; + std::array negP{}; + std::array bachP{}; o2::track::TrackParCov pTrackAtPCA = fitter.getTrack(1); // proton (positive) o2::track::TrackParCov nTrackAtPCA = fitter.getTrack(0); // pion (negative) @@ -1161,7 +1173,7 @@ struct OnTheFlyTracker { // Cascade found successfully if (dcaFitterCascadeStatus) { if (cascadeDecaySettings.doXiQA) { - getHist(TH1, histPath + "hXiBuilding")->Fill(6.0f); + getHist( histPath + "hXiBuilding")->Fill(6.0f); } o2::track::TrackParCov bachelorTrackAtPCA = fitter.getTrack(1); @@ -1219,7 +1231,7 @@ struct OnTheFlyTracker { } // get potential cluster position - std::array posClusterCandidate; + std::array posClusterCandidate{}; xiTrackParCov.getXYZGlo(posClusterCandidate); float r{std::hypot(posClusterCandidate[0], posClusterCandidate[1])}; float phi{std::atan2(-posClusterCandidate[1], -posClusterCandidate[0]) + o2::constants::math::PI}; @@ -1272,9 +1284,9 @@ struct OnTheFlyTracker { const int nCascHits = fastTracker[icfg]->FastTrack(perfectCascadeTrack, trackedCascade, dNdEta, xiDecayRadius2D); reconstructedCascade = (fastTrackerSettings.minSiliconHitsForKinkReco < nCascHits) ? true : false; if (reconstructedCascade) { - std::array pCasc; - std::array pBach; - std::array pV0; + std::array pCasc{}; + std::array pBach{}; + std::array pV0{}; trackedCascade.getPxPyPzGlo(pCasc); trackedBach.getPxPyPzGlo(pBach); for (size_t i = 0; i < pCasc.size(); ++i) { @@ -1310,7 +1322,7 @@ struct OnTheFlyTracker { histos.fill(HIST("hFitterStatusCode"), fitterStatusCode); if (kinkFitterOK) { if (cascadeDecaySettings.doXiQA) { - getHist(TH1, histPath + "hXiBuilding")->Fill(7.0f); + getHist( histPath + "hXiBuilding")->Fill(7.0f); } o2::track::TrackParCov newCascadeTrack = fitter.getTrack(0); // (cascade) @@ -1330,9 +1342,7 @@ struct OnTheFlyTracker { std::array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassLambda}); newCascadeTrack.setPID(pdgCodeToPID(PDG_t::kXiMinus)); // FIXME: not OK for omegas float trackTime = (eventCollisionTimeNS + gRandom->Gaus(0., timeResolutionNs)) * nsToMus; - if (reconstructedCascade) { - tracksCascadeProngs[kCascProngs + 1] = TrackAlice3{newCascadeTrack, mcParticle.globalIndex(), trackTime, timeResolutionUs, false, false, 1, thisCascade.foundClusters, TrackType::kRecoCascDaug}; - } + tracksCascadeProngs[kCascProngs + 1] = TrackAlice3{newCascadeTrack, mcParticle.globalIndex(), trackTime, timeResolutionUs, false, false, 1, thisCascade.foundClusters, 0, TrackType::kRecoCascDaug}; fillCascadeTable = true; } // end fitter OK } // end cascade found @@ -1343,44 +1353,44 @@ struct OnTheFlyTracker { o2::track::TrackParCov trackParametrization(xiTrackParCov); if (cascadeDecaySettings.doXiQA) { if (reconstructedCascade) { - getHist(TH2, histPath + "hRecoXi")->Fill(xiDecayRadius2D, mcParticle.pt()); - getHist(TH1, histPath + "hMassLambda")->Fill(thisCascade.mLambda); - getHist(TH1, histPath + "hMassXi")->Fill(thisCascade.mXi); - getHist(TH2, histPath + "h2dMassXi")->Fill(thisCascade.mXi, thisCascade.pt); - getHist(TH2, histPath + "h2dDeltaPtVsPt")->Fill(thisCascade.pt, (mcParticle.pt() - thisCascade.pt) / thisCascade.pt); - getHist(TH2, histPath + "h2dDeltaEtaVsPt")->Fill(thisCascade.pt, mcParticle.eta() - thisCascade.eta); - getHist(TH2, histPath + "hFoundVsFindable")->Fill(thisCascade.findableClusters, thisCascade.foundClusters); - getHist(TH2, histPath + "h2dDCAxyCascade")->Fill(trackParametrization.getPt(), dcaXY * 1e+4); // in microns, please - getHist(TH2, histPath + "h2dDCAzCascade")->Fill(trackParametrization.getPt(), dcaZ * 1e+4); // in microns, please + getHist( histPath + "hRecoXi")->Fill(xiDecayRadius2D, mcParticle.pt()); + getHist( histPath + "hMassLambda")->Fill(thisCascade.mLambda); + getHist( histPath + "hMassXi")->Fill(thisCascade.mXi); + getHist( histPath + "h2dMassXi")->Fill(thisCascade.mXi, thisCascade.pt); + getHist( histPath + "h2dDeltaPtVsPt")->Fill(thisCascade.pt, (mcParticle.pt() - thisCascade.pt) / thisCascade.pt); + getHist( histPath + "h2dDeltaEtaVsPt")->Fill(thisCascade.pt, mcParticle.eta() - thisCascade.eta); + getHist( histPath + "hFoundVsFindable")->Fill(thisCascade.findableClusters, thisCascade.foundClusters); + getHist( histPath + "h2dDCAxyCascade")->Fill(trackParametrization.getPt(), dcaXY * 1e+4); // in microns, please + getHist( histPath + "h2dDCAzCascade")->Fill(trackParametrization.getPt(), dcaZ * 1e+4); // in microns, please } if (isReco[0]) { - getHist(TH2, histPath + "hRecoPiFromXi")->Fill(xiDecayRadius2D, cascadeDecayProducts[0].Pt()); + getHist( histPath + "hRecoPiFromXi")->Fill(xiDecayRadius2D, cascadeDecayProducts[0].Pt()); o2::track::TrackParCov trackParametrizationBachelor(xiTrackParCov); if (populateTracksDCA && trackParametrizationBachelor.propagateToDCA(primaryVertex, mMagneticField, &dcaInfo)) { dcaXY = dcaInfo.getY(); dcaZ = dcaInfo.getZ(); - getHist(TH2, histPath + "h2dDCAxyCascadeBachelor")->Fill(trackParametrizationBachelor.getPt(), dcaXY * 1e+4); // in microns, please - getHist(TH2, histPath + "h2dDCAzCascadeBachelor")->Fill(trackParametrizationBachelor.getPt(), dcaZ * 1e+4); // in microns, please + getHist( histPath + "h2dDCAxyCascadeBachelor")->Fill(trackParametrizationBachelor.getPt(), dcaXY * 1e+4); // in microns, please + getHist( histPath + "h2dDCAzCascadeBachelor")->Fill(trackParametrizationBachelor.getPt(), dcaZ * 1e+4); // in microns, please } } if (isReco[1]) { - getHist(TH2, histPath + "hRecoPiFromLa")->Fill(laDecayRadius2D, cascadeDecayProducts[1].Pt()); + getHist( histPath + "hRecoPiFromLa")->Fill(laDecayRadius2D, cascadeDecayProducts[1].Pt()); o2::track::TrackParCov trackParametrizationNegative(xiTrackParCov); if (populateTracksDCA && trackParametrizationNegative.propagateToDCA(primaryVertex, mMagneticField, &dcaInfo)) { dcaXY = dcaInfo.getY(); dcaZ = dcaInfo.getZ(); - getHist(TH2, histPath + "h2dDCAxyCascadeNegative")->Fill(trackParametrizationNegative.getPt(), dcaXY * 1e+4); // in microns, please - getHist(TH2, histPath + "h2dDCAzCascadeNegative")->Fill(trackParametrizationNegative.getPt(), dcaZ * 1e+4); // in microns, please + getHist( histPath + "h2dDCAxyCascadeNegative")->Fill(trackParametrizationNegative.getPt(), dcaXY * 1e+4); // in microns, please + getHist( histPath + "h2dDCAzCascadeNegative")->Fill(trackParametrizationNegative.getPt(), dcaZ * 1e+4); // in microns, please } } if (isReco[2]) { - getHist(TH2, histPath + "hRecoPrFromLa")->Fill(laDecayRadius2D, cascadeDecayProducts[2].Pt()); + getHist( histPath + "hRecoPrFromLa")->Fill(laDecayRadius2D, cascadeDecayProducts[2].Pt()); o2::track::TrackParCov trackParametrizationPositive(xiTrackParCov); if (populateTracksDCA && trackParametrizationPositive.propagateToDCA(primaryVertex, mMagneticField, &dcaInfo)) { dcaXY = dcaInfo.getY(); dcaZ = dcaInfo.getZ(); - getHist(TH2, histPath + "h2dDCAxyCascadePositive")->Fill(trackParametrizationPositive.getPt(), dcaXY * 1e+4); // in microns, please - getHist(TH2, histPath + "h2dDCAzCascadePositive")->Fill(trackParametrizationPositive.getPt(), dcaZ * 1e+4); // in microns, please + getHist( histPath + "h2dDCAxyCascadePositive")->Fill(trackParametrizationPositive.getPt(), dcaXY * 1e+4); // in microns, please + getHist( histPath + "h2dDCAzCascadePositive")->Fill(trackParametrizationPositive.getPt(), dcaZ * 1e+4); // in microns, please } } } @@ -1424,13 +1434,11 @@ struct OnTheFlyTracker { const McParticleType& mcParticle, std::vector& tracksV0Daugs, int icfg, - int dNdEta, + float dNdEta, float eventCollisionTimeNS) { o2::track::TrackParCov trackParCov; o2::upgrade::convertMCParticleToO2Track(mcParticle, trackParCov, pdgDB); - const std::string histPath = "Configuration_" + std::to_string(icfg) + "/"; - std::vector v0DecayProducts; std::vector laDecayVertex, v0DecayVertex; decayV0Particle(mcParticle, v0DecayProducts, v0DecayVertex, mcParticle.pdgCode()); @@ -1446,9 +1454,9 @@ struct OnTheFlyTracker { } for (int indexDetector = 0; indexDetector < mGeoContainer.getNumberOfConfigurations(); indexDetector++) { std::string path = Form("V0Building_Configuration_%i/%s/", indexDetector, NameV0s[indexV0].data()); - fillHist(TH2, path + "hGen", v0DecayRadius2D, mcParticle.pt()); - fillHist(TH2, path + "hGenNegDaughterFromV0", v0DecayRadius2D, v0DecayProducts[0].Pt()); - fillHist(TH2, path + "hGenPosDaughterFromV0", v0DecayRadius2D, v0DecayProducts[1].Pt()); + fillHist( path + "hGen", v0DecayRadius2D, mcParticle.pt()); + fillHist( path + "hGenNegDaughterFromV0", v0DecayRadius2D, v0DecayProducts[0].Pt()); + fillHist( path + "hGenPosDaughterFromV0", v0DecayRadius2D, v0DecayProducts[1].Pt()); } } } @@ -1461,7 +1469,7 @@ struct OnTheFlyTracker { std::vector nV0SiliconHits(kv0Prongs); // silicon type std::vector nV0TPCHits(kv0Prongs); // TPC type if (v0DecaySettings.doV0QA) { - fillHist(TH1, Form("V0Building_Configuration_%i/hV0Building", icfg), 0.0f); + fillHist( Form("V0Building_Configuration_%i/hV0Building", icfg), 0.0f); } switch (mcParticle.pdgCode()) { case kK0Short: @@ -1482,9 +1490,9 @@ struct OnTheFlyTracker { // Store not reconstructed daughters, will update them in case reconstruction is successful float trackTime = (eventCollisionTimeNS + gRandom->Gaus(0., timeResolutionNs)) * nsToMus; - tracksV0Daugs.push_back(TrackAlice3{v0DaughterTrackParCovsPerfect[0], mcParticle.globalIndex(), 0.f, timeResolutionUs, true, true, 1, TrackType::kGhostV0Daug}); + tracksV0Daugs.push_back(TrackAlice3{v0DaughterTrackParCovsPerfect[0], mcParticle.globalIndex(), 0.f, timeResolutionUs, true, true, 1, 0, 0, TrackType::kGhostV0Daug}); trackTime = (eventCollisionTimeNS + gRandom->Gaus(0., timeResolutionNs)) * nsToMus; - tracksV0Daugs.push_back(TrackAlice3{v0DaughterTrackParCovsPerfect[1], mcParticle.globalIndex(), 0.f, timeResolutionUs, true, true, 1, TrackType::kGhostV0Daug}); + tracksV0Daugs.push_back(TrackAlice3{v0DaughterTrackParCovsPerfect[1], mcParticle.globalIndex(), 0.f, timeResolutionUs, true, true, 1, 0, 0, TrackType::kGhostV0Daug}); bool fillV0Table{false}; for (int i = 0; i < kv0Prongs; i++) { @@ -1507,10 +1515,10 @@ struct OnTheFlyTracker { if (v0DecaySettings.doV0QA) { // QA if (nV0Hits[i] < 0) { - fillHist(TH1, Form("V0Building_Configuration_%i/hFastTrackerQA", icfg), o2::math_utils::abs(nV0Hits[i])); + fillHist( Form("V0Building_Configuration_%i/hFastTrackerQA", icfg), o2::math_utils::abs(nV0Hits[i])); } for (uint32_t ih = 0; ih < fastTracker[icfg]->GetNHits(); ih++) { - fillHist(TH2, Form("V0Building_Configuration_%i/hFastTrackerHits", icfg), fastTracker[icfg]->GetHitZ(ih), std::hypot(fastTracker[icfg]->GetHitX(ih), fastTracker[icfg]->GetHitY(ih))); + fillHist( Form("V0Building_Configuration_%i/hFastTrackerHits", icfg), fastTracker[icfg]->GetHitZ(ih), std::hypot(fastTracker[icfg]->GetHitX(ih), fastTracker[icfg]->GetHitY(ih))); } } } else { @@ -1525,24 +1533,24 @@ struct OnTheFlyTracker { } if (v0DecaySettings.doV0QA) { if (isV0Reco[0] && isV0Reco[1]) { - fillHist(TH1, Form("V0Building_Configuration_%i/hV0Building", icfg), 1.0f); + fillHist( Form("V0Building_Configuration_%i/hV0Building", icfg), 1.0f); for (size_t indexV0 = 0; indexV0 < v0PDGs.size(); indexV0++) { if (mcParticle.pdgCode() == v0PDGs[indexV0]) { - fillHist(TH2, Form("V0Building_Configuration_%i/%s/hReco", icfg, NameV0s[indexV0].data()), v0DecayRadius2D, mcParticle.pt()); + fillHist( Form("V0Building_Configuration_%i/%s/hReco", icfg, NameV0s[indexV0].data()), v0DecayRadius2D, mcParticle.pt()); } } } if (isV0Reco[0]) { for (size_t indexV0 = 0; indexV0 < v0PDGs.size(); indexV0++) { if (mcParticle.pdgCode() == v0PDGs[indexV0]) { - fillHist(TH2, Form("V0Building_Configuration_%i/%s/hRecoNegDaughterFromV0", icfg, NameV0s[indexV0].data()), v0DecayRadius2D, v0DecayProducts[0].Pt()); + fillHist( Form("V0Building_Configuration_%i/%s/hRecoNegDaughterFromV0", icfg, NameV0s[indexV0].data()), v0DecayRadius2D, v0DecayProducts[0].Pt()); } } } if (isV0Reco[1]) { for (size_t indexV0 = 0; indexV0 < v0PDGs.size(); indexV0++) { if (mcParticle.pdgCode() == v0PDGs[indexV0]) { - fillHist(TH2, Form("V0Building_Configuration_%i/%s/hRecoPosDaughterFromV0", icfg, NameV0s[indexV0].data()), v0DecayRadius2D, v0DecayProducts[1].Pt()); + fillHist( Form("V0Building_Configuration_%i/%s/hRecoPosDaughterFromV0", icfg, NameV0s[indexV0].data()), v0DecayRadius2D, v0DecayProducts[1].Pt()); } } } @@ -1553,7 +1561,7 @@ struct OnTheFlyTracker { // V0 building starts here if (v0DecaySettings.findV0 && isV0Reco[0] && isV0Reco[1]) { if (v0DecaySettings.doV0QA) { - fillHist(TH1, Form("V0Building_Configuration_%i/hV0Building", icfg), 2.0f); + fillHist( Form("V0Building_Configuration_%i/hV0Building", icfg), 2.0f); } // assign indices of the daughter particles @@ -1584,12 +1592,12 @@ struct OnTheFlyTracker { // V0 found successfully if (dcaFitterV0Status) { if (v0DecaySettings.doV0QA) { - fillHist(TH1, Form("V0Building_Configuration_%i/hV0Building", icfg), 3.0f); + fillHist( Form("V0Building_Configuration_%i/hV0Building", icfg), 3.0f); } - std::array pos; - std::array posP; - std::array negP; + std::array pos{}; + std::array posP{}; + std::array negP{}; o2::track::TrackParCov pTrackAtPCA = fitter.getTrack(1); // (positive) o2::track::TrackParCov nTrackAtPCA = fitter.getTrack(0); // (negative) @@ -1632,15 +1640,15 @@ struct OnTheFlyTracker { } if (v0DecaySettings.doV0QA) { - fillHist(TH1, Form("V0Building_Configuration_%i/hV0Building", icfg), 4.0f); + fillHist( Form("V0Building_Configuration_%i/hV0Building", icfg), 4.0f); if (std::abs(mcParticle.pdgCode()) == kK0Short) { - fillHist(TH2, Form("V0Building_Configuration_%i/K0/hMass", icfg), thisV0.mK0, thisV0.pt); + fillHist( Form("V0Building_Configuration_%i/K0/hMass", icfg), thisV0.mK0, thisV0.pt); } if (mcParticle.pdgCode() == kLambda0) { - fillHist(TH2, Form("V0Building_Configuration_%i/Lambda/hMass", icfg), thisV0.mLambda, thisV0.pt); + fillHist( Form("V0Building_Configuration_%i/Lambda/hMass", icfg), thisV0.mLambda, thisV0.pt); } if (mcParticle.pdgCode() == kLambda0Bar) { - fillHist(TH2, Form("V0Building_Configuration_%i/AntiLambda/hMass", icfg), thisV0.mAntiLambda, thisV0.pt); + fillHist( Form("V0Building_Configuration_%i/AntiLambda/hMass", icfg), thisV0.mAntiLambda, thisV0.pt); } } @@ -1682,7 +1690,7 @@ struct OnTheFlyTracker { } vertexReconstructionEfficiencyCounters.first += 1; const std::string histPath = "Configuration_" + std::to_string(icfg) + "/"; - fillHist(TH1, histPath + "hVtxMultGen", prmTrks.size()); + fillHist( histPath + "hVtxMultGen", prmTrks.size()); std::vector lblTracks; std::vector vertices; std::vector vertexTrackIDs; @@ -1697,7 +1705,7 @@ struct OnTheFlyTracker { idxVec.emplace_back(i, o2::dataformats::GlobalTrackID::ITS); // let's say ITS } - getHist(TH1, histPath + "hVtxTrials")->Fill(0); // Tried vertexing + getHist( histPath + "hVtxTrials")->Fill(0); // Tried vertexing // Calculate vertices const int n_vertices = vertexer.process(prmTrks, // track array @@ -1716,7 +1724,7 @@ struct OnTheFlyTracker { return; // primary vertex not reconstructed } vertexReconstructionEfficiencyCounters.second += 1; - getHist(TH1, histPath + "hVtxTrials")->Fill(1); // Succeeded vertexing + getHist( histPath + "hVtxTrials")->Fill(1); // Succeeded vertexing // Find largest vertex int largestVertex = 0; @@ -1729,11 +1737,11 @@ struct OnTheFlyTracker { if (doExtraQA) { histos.fill(HIST("h2dVerticesVsContributors"), primaryVertex.getNContributors(), n_vertices); } - fillHist(TH1, histPath + "hVtxMultReco", primaryVertex.getNContributors()); - fillHist(TH1, histPath + "hDeltaMultPVRecoGen", static_cast(primaryVertex.getNContributors()) - static_cast(prmTrks.size())); - fillHist(TH2, histPath + "hDeltaXPVRecoGen", primaryVertex.getX() - mcCollision.posX(), primaryVertex.getNContributors()); - fillHist(TH2, histPath + "hDeltaYPVRecoGen", primaryVertex.getY() - mcCollision.posY(), primaryVertex.getNContributors()); - fillHist(TH2, histPath + "hDeltaZPVRecoGen", primaryVertex.getZ() - mcCollision.posZ(), primaryVertex.getNContributors()); + fillHist( histPath + "hVtxMultReco", primaryVertex.getNContributors()); + fillHist( histPath + "hDeltaMultPVRecoGen", static_cast(primaryVertex.getNContributors()) - static_cast(prmTrks.size())); + fillHist( histPath + "hDeltaXPVRecoGen", primaryVertex.getX() - mcCollision.posX(), primaryVertex.getNContributors()); + fillHist( histPath + "hDeltaYPVRecoGen", primaryVertex.getY() - mcCollision.posY(), primaryVertex.getNContributors()); + fillHist( histPath + "hDeltaZPVRecoGen", primaryVertex.getZ() - mcCollision.posZ(), primaryVertex.getNContributors()); } /// Function to fill track information into the relevant tables and histograms @@ -1750,14 +1758,14 @@ struct OnTheFlyTracker { if (populateTracksDCA) { float dcaXY = 1e+10, dcaZ = 1e+10; - o2::track::TrackParCov trackParametrization(trackParCov); + o2::track::TrackParCov trackParametrization(static_cast(trackParCov)); if (trackParametrization.propagateToDCA(primaryVertex, mMagneticField, &dcaInfo)) { dcaXY = dcaInfo.getY(); dcaZ = dcaInfo.getZ(); } if (doExtraQA && (!extraQAwithoutDecayDaughters || (extraQAwithoutDecayDaughters && !trackParCov.isDecayDau))) { - getHist(TH2, histPath + "h2dDCAxy")->Fill(trackParametrization.getPt(), dcaXY * 1e+4); - getHist(TH2, histPath + "h2dDCAz")->Fill(trackParametrization.getPt(), dcaZ * 1e+4); + getHist( histPath + "h2dDCAxy")->Fill(trackParametrization.getPt(), dcaXY * 1e+4); + getHist( histPath + "h2dDCAz")->Fill(trackParametrization.getPt(), dcaZ * 1e+4); histos.fill(HIST("hTrackXatDCA"), trackParametrization.getX()); } tableTracksDCA(dcaXY, dcaZ); @@ -1844,11 +1852,11 @@ struct OnTheFlyTracker { if (brSettings.doBRQA) { const std::string histPath = "Configuration_" + std::to_string(icfg) + "/"; - getHist(TH1, histPath + "h1dNBRPhotons")->Fill(static_cast(nPhotons)); - getHist(TH1, histPath + "h1dBREnergyLoss")->Fill((initialMomentum - afterRadiationMomentum) / afterRadiationMomentum); + getHist( histPath + "h1dNBRPhotons")->Fill(static_cast(nPhotons)); + getHist( histPath + "h1dBREnergyLoss")->Fill((initialMomentum - afterRadiationMomentum) / afterRadiationMomentum); - getHist(TH2, histPath + "h2dBRPtRes")->Fill(trackParCov.getPt(), (trackParCov.getPt() - mcParticle.pt()) / trackParCov.getPt()); - getHist(TH2, histPath + "h2dBRPtResAbs")->Fill(trackParCov.getPt(), trackParCov.getPt() - mcParticle.pt()); + getHist( histPath + "h2dBRPtRes")->Fill(trackParCov.getPt(), (trackParCov.getPt() - mcParticle.pt()) / trackParCov.getPt()); + getHist( histPath + "h2dBRPtResAbs")->Fill(trackParCov.getPt(), trackParCov.getPt() - mcParticle.pt()); } } } @@ -1929,34 +1937,34 @@ struct OnTheFlyTracker { reconstructed = mSmearer[icfg]->smearTrack(trackParCov, mcParticle.pdgCode(), dNdEta); nTrkHits = fastTrackerSettings.minSiliconHits; } - getHist(TH1, histPath + "hPtGenerated")->Fill(mcParticle.pt()); - getHist(TH1, histPath + "hPhiGenerated")->Fill(mcParticle.phi()); + getHist( histPath + "hPtGenerated")->Fill(mcParticle.pt()); + getHist( histPath + "hPhiGenerated")->Fill(mcParticle.phi()); if (std::abs(mcParticle.pdgCode()) == kElectron) - getHist(TH1, histPath + "hPtGeneratedEl")->Fill(mcParticle.pt()); + getHist( histPath + "hPtGeneratedEl")->Fill(mcParticle.pt()); if (std::abs(mcParticle.pdgCode()) == kPiPlus) - getHist(TH1, histPath + "hPtGeneratedPi")->Fill(mcParticle.pt()); + getHist( histPath + "hPtGeneratedPi")->Fill(mcParticle.pt()); if (std::abs(mcParticle.pdgCode()) == kKPlus) - getHist(TH1, histPath + "hPtGeneratedKa")->Fill(mcParticle.pt()); + getHist( histPath + "hPtGeneratedKa")->Fill(mcParticle.pt()); if (std::abs(mcParticle.pdgCode()) == kProton) - getHist(TH1, histPath + "hPtGeneratedPr")->Fill(mcParticle.pt()); + getHist( histPath + "hPtGeneratedPr")->Fill(mcParticle.pt()); if (!reconstructed && !processUnreconstructedTracks) { continue; } - getHist(TH1, histPath + "hPtReconstructed")->Fill(trackParCov.getPt()); + getHist( histPath + "hPtReconstructed")->Fill(trackParCov.getPt()); if (std::abs(mcParticle.pdgCode()) == kElectron) - getHist(TH1, histPath + "hPtReconstructedEl")->Fill(trackParCov.getPt()); + getHist( histPath + "hPtReconstructedEl")->Fill(trackParCov.getPt()); if (std::abs(mcParticle.pdgCode()) == kPiPlus) - getHist(TH1, histPath + "hPtReconstructedPi")->Fill(trackParCov.getPt()); + getHist( histPath + "hPtReconstructedPi")->Fill(trackParCov.getPt()); if (std::abs(mcParticle.pdgCode()) == kKPlus) - getHist(TH1, histPath + "hPtReconstructedKa")->Fill(trackParCov.getPt()); + getHist( histPath + "hPtReconstructedKa")->Fill(trackParCov.getPt()); if (std::abs(mcParticle.pdgCode()) == kProton) - getHist(TH1, histPath + "hPtReconstructedPr")->Fill(trackParCov.getPt()); + getHist( histPath + "hPtReconstructedPr")->Fill(trackParCov.getPt()); } if (doExtraQA) { - getHist(TH2, histPath + "h2dPtRes")->Fill(trackParCov.getPt(), (trackParCov.getPt() - mcParticle.pt()) / trackParCov.getPt()); - getHist(TH2, histPath + "h2dPtResAbs")->Fill(trackParCov.getPt(), trackParCov.getPt() - mcParticle.pt()); + getHist( histPath + "h2dPtRes")->Fill(trackParCov.getPt(), (trackParCov.getPt() - mcParticle.pt()) / trackParCov.getPt()); + getHist( histPath + "h2dPtResAbs")->Fill(trackParCov.getPt(), trackParCov.getPt() - mcParticle.pt()); histos.fill(HIST("hRecoTrackX"), trackParCov.getX()); } @@ -1983,7 +1991,7 @@ struct OnTheFlyTracker { return; } computeVertex(mcCollision, recoPrimaries, primaryVertex, icfg); - getHist(TH1, histPath + "hPVz")->Fill(primaryVertex.getZ()); + getHist( histPath + "hPVz")->Fill(primaryVertex.getZ()); // populate collisions tableCollisions(-1, // BC is irrelevant in synthetic MC tests for now, could be adjusted in future primaryVertex.getX(), primaryVertex.getY(), primaryVertex.getZ(), @@ -2027,8 +2035,8 @@ struct OnTheFlyTracker { } if (doExtraQA) { histos.fill(HIST("hRecoVsSimMultiplicity"), multiplicityCounter, recoPrimaries.size()); - getHist(TH1, histPath + "hSimMultiplicity")->Fill(multiplicityCounter); - getHist(TH1, histPath + "hRecoMultiplicity")->Fill(recoPrimaries.size()); + getHist( histPath + "hSimMultiplicity")->Fill(multiplicityCounter); + getHist( histPath + "hRecoMultiplicity")->Fill(recoPrimaries.size()); } LOG(debug) << " <- Finished processing OTF tracking with LUT configuration ID " << icfg; @@ -2088,20 +2096,20 @@ struct OnTheFlyTracker { } if (enablePrimarySmearing) { - getHist(TH1, histPath + "hPtGenerated")->Fill(mcParticle.pt()); - getHist(TH1, histPath + "hPhiGenerated")->Fill(mcParticle.phi()); + getHist( histPath + "hPtGenerated")->Fill(mcParticle.pt()); + getHist( histPath + "hPhiGenerated")->Fill(mcParticle.phi()); switch (std::abs(mcParticle.pdgCode())) { case kElectron: - getHist(TH1, histPath + "hPtGeneratedEl")->Fill(mcParticle.pt()); + getHist( histPath + "hPtGeneratedEl")->Fill(mcParticle.pt()); break; case kPiPlus: - getHist(TH1, histPath + "hPtGeneratedPi")->Fill(mcParticle.pt()); + getHist( histPath + "hPtGeneratedPi")->Fill(mcParticle.pt()); break; case kKPlus: - getHist(TH1, histPath + "hPtGeneratedKa")->Fill(mcParticle.pt()); + getHist( histPath + "hPtGeneratedKa")->Fill(mcParticle.pt()); break; case kProton: - getHist(TH1, histPath + "hPtGeneratedPr")->Fill(mcParticle.pt()); + getHist( histPath + "hPtGeneratedPr")->Fill(mcParticle.pt()); break; } } @@ -2153,49 +2161,49 @@ struct OnTheFlyTracker { histos.fill(HIST("hNaNBookkeeping"), 0.0f, 1.0f); if (enablePrimarySmearing) { const float ptResolution = (trackParCov.getPt() - mcParticle.pt()) / trackParCov.getPt(); - getHist(TH1, histPath + "hPtReconstructed")->Fill(trackParCov.getPt()); + getHist( histPath + "hPtReconstructed")->Fill(trackParCov.getPt()); if (otfParticle.isPrimary()) { - getHist(TH2, histPath + "h2dPrimaryPtRes")->Fill(trackParCov.getPt(), ptResolution); + getHist( histPath + "h2dPrimaryPtRes")->Fill(trackParCov.getPt(), ptResolution); } else { - getHist(TH2, histPath + "h2dSecondaryPtRes")->Fill(trackParCov.getPt(), ptResolution); + getHist( histPath + "h2dSecondaryPtRes")->Fill(trackParCov.getPt(), ptResolution); } if (std::abs(mcParticle.pdgCode()) == kElectron) { - getHist(TH1, histPath + "hPtReconstructedEl")->Fill(trackParCov.getPt()); + getHist( histPath + "hPtReconstructedEl")->Fill(trackParCov.getPt()); if (otfParticle.isPrimary()) { - getHist(TH2, histPath + "h2dPrimaryElPtRes")->Fill(trackParCov.getPt(), ptResolution); + getHist( histPath + "h2dPrimaryElPtRes")->Fill(trackParCov.getPt(), ptResolution); } else { - getHist(TH2, histPath + "h2dSecondaryElPtRes")->Fill(trackParCov.getPt(), ptResolution); + getHist( histPath + "h2dSecondaryElPtRes")->Fill(trackParCov.getPt(), ptResolution); } } if (std::abs(mcParticle.pdgCode()) == kPiPlus) { - getHist(TH1, histPath + "hPtReconstructedPi")->Fill(trackParCov.getPt()); + getHist( histPath + "hPtReconstructedPi")->Fill(trackParCov.getPt()); if (otfParticle.isPrimary()) { - getHist(TH2, histPath + "h2dPrimaryPiPtRes")->Fill(trackParCov.getPt(), ptResolution); + getHist( histPath + "h2dPrimaryPiPtRes")->Fill(trackParCov.getPt(), ptResolution); } else { - getHist(TH2, histPath + "h2dSecondaryPiPtRes")->Fill(trackParCov.getPt(), ptResolution); + getHist( histPath + "h2dSecondaryPiPtRes")->Fill(trackParCov.getPt(), ptResolution); } } if (std::abs(mcParticle.pdgCode()) == kKPlus) { - getHist(TH1, histPath + "hPtReconstructedKa")->Fill(trackParCov.getPt()); + getHist( histPath + "hPtReconstructedKa")->Fill(trackParCov.getPt()); if (otfParticle.isPrimary()) { - getHist(TH2, histPath + "h2dPrimaryKaPtRes")->Fill(trackParCov.getPt(), ptResolution); + getHist( histPath + "h2dPrimaryKaPtRes")->Fill(trackParCov.getPt(), ptResolution); } else { - getHist(TH2, histPath + "h2dSecondaryKaPtRes")->Fill(trackParCov.getPt(), ptResolution); + getHist( histPath + "h2dSecondaryKaPtRes")->Fill(trackParCov.getPt(), ptResolution); } } if (std::abs(mcParticle.pdgCode()) == kProton) { - getHist(TH1, histPath + "hPtReconstructedPr")->Fill(trackParCov.getPt()); + getHist( histPath + "hPtReconstructedPr")->Fill(trackParCov.getPt()); if (otfParticle.isPrimary()) { - getHist(TH2, histPath + "h2dPrimaryPrPtRes")->Fill(trackParCov.getPt(), ptResolution); + getHist( histPath + "h2dPrimaryPrPtRes")->Fill(trackParCov.getPt(), ptResolution); } else { - getHist(TH2, histPath + "h2dSecondaryPrPtRes")->Fill(trackParCov.getPt(), ptResolution); + getHist( histPath + "h2dSecondaryPrPtRes")->Fill(trackParCov.getPt(), ptResolution); } } } if (reconstructed) { tracksAlice3.push_back(TrackAlice3{trackParCov, mcParticle.globalIndex(), time, timeResolutionUs, isSecondary, false, 0, nTrkHits, kRecoPrimary}); - getHist(TH1, histPath + "hPtReconstructedPr")->Fill(trackParCov.getPt()); + getHist( histPath + "hPtReconstructedPr")->Fill(trackParCov.getPt()); } else { ghostTracksAlice3.push_back(TrackAlice3{trackParCov, mcParticle.globalIndex(), time, timeResolutionUs, isSecondary, false, 0, nTrkHits, kGhostPrimary}); } @@ -2208,9 +2216,9 @@ struct OnTheFlyTracker { } computeVertex(mcCollision, tracksAlice3, primaryVertex, icfg); - getHist(TH1, histPath + "hSimMultiplicity")->Fill(multiplicityCounter); - getHist(TH1, histPath + "hRecoMultiplicity")->Fill(tracksAlice3.size()); - getHist(TH1, histPath + "hPVz")->Fill(primaryVertex.getZ()); + getHist( histPath + "hSimMultiplicity")->Fill(multiplicityCounter); + getHist( histPath + "hRecoMultiplicity")->Fill(tracksAlice3.size()); + getHist( histPath + "hPVz")->Fill(primaryVertex.getZ()); // *+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+* // populate collisions From b942fb571d0f8bf9e4650b6a1f69c59739b682c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Fri, 21 Aug 2026 15:15:02 +0200 Subject: [PATCH 2/6] Update onTheFlyTracker.cxx --- ALICE3/TableProducer/OTF/onTheFlyTracker.cxx | 248 +++++++++---------- 1 file changed, 124 insertions(+), 124 deletions(-) diff --git a/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx b/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx index 0b831aa7d89..049507e9113 100644 --- a/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx +++ b/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx @@ -522,8 +522,8 @@ struct OnTheFlyTracker { insertHist(histPath + "hVtxMultReco", "hVtxMultReco;Reconstructed Vertex Multiplicity", {kTH1D, {{axes.axisVtxMult}}}); insertHist(histPath + "hVtxTrials", "hVtxTrials;Vertex Reconstruction Trials", {kTH1D, {{2, -0.5, 1.5}}}); // Set the bin labels - getHist( histPath + "hVtxTrials")->GetXaxis()->SetBinLabel(1, "Tried"); - getHist( histPath + "hVtxTrials")->GetXaxis()->SetBinLabel(2, "Succeeded"); + getHist(histPath + "hVtxTrials")->GetXaxis()->SetBinLabel(1, "Tried"); + getHist(histPath + "hVtxTrials")->GetXaxis()->SetBinLabel(2, "Succeeded"); } if (enableSecondarySmearing) { @@ -537,14 +537,14 @@ struct OnTheFlyTracker { if (cascadeDecaySettings.doXiQA) { insertHist(histPath + "hXiBuilding", "hXiBuilding", {kTH1F, {{10, -0.5f, 9.5f}}}); - getHist( histPath + "hXiBuilding")->GetXaxis()->SetBinLabel(1, "Generated"); - getHist( histPath + "hXiBuilding")->GetXaxis()->SetBinLabel(2, "Secondary smearing prong 0"); - getHist( histPath + "hXiBuilding")->GetXaxis()->SetBinLabel(3, "Secondary smearing prong 1"); - getHist( histPath + "hXiBuilding")->GetXaxis()->SetBinLabel(4, "Secondary smearing prong 2"); - getHist( histPath + "hXiBuilding")->GetXaxis()->SetBinLabel(5, "Not Nan"); - getHist( histPath + "hXiBuilding")->GetXaxis()->SetBinLabel(6, "Start Reco"); - getHist( histPath + "hXiBuilding")->GetXaxis()->SetBinLabel(7, "V0 fitter ok"); - getHist( histPath + "hXiBuilding")->GetXaxis()->SetBinLabel(8, "Kink fitter ok"); + getHist(histPath + "hXiBuilding")->GetXaxis()->SetBinLabel(1, "Generated"); + getHist(histPath + "hXiBuilding")->GetXaxis()->SetBinLabel(2, "Secondary smearing prong 0"); + getHist(histPath + "hXiBuilding")->GetXaxis()->SetBinLabel(3, "Secondary smearing prong 1"); + getHist(histPath + "hXiBuilding")->GetXaxis()->SetBinLabel(4, "Secondary smearing prong 2"); + getHist(histPath + "hXiBuilding")->GetXaxis()->SetBinLabel(5, "Not Nan"); + getHist(histPath + "hXiBuilding")->GetXaxis()->SetBinLabel(6, "Start Reco"); + getHist(histPath + "hXiBuilding")->GetXaxis()->SetBinLabel(7, "V0 fitter ok"); + getHist(histPath + "hXiBuilding")->GetXaxis()->SetBinLabel(8, "Kink fitter ok"); insertHist(histPath + "hGenXi", "hGenXi;Decay Radius;#it{p}_{T}", {kTH2F, {axes.axisDecayRadius, axes.axisMomentum}}); insertHist(histPath + "hRecoXi", "hRecoXi;Decay Radius;#it{p}_{T}", {kTH2F, {axes.axisDecayRadius, axes.axisMomentum}}); @@ -581,14 +581,14 @@ struct OnTheFlyTracker { insertHist(histPath + "nTPCHitsCascadeProngs", "nTPCHitsCascadeProngs", {kTH1F, {{10, -0.5f, 9.5f}}}); insertHist(histPath + "hFastTrackerHits", "hFastTrackerHits", {kTH2F, {axes.axisZ, axes.axisRadius}}); insertHist(histPath + "hFastTrackerQA", "hFastTrackerQA", {kTH1F, {{8, -0.5f, 7.5f}}}); - getHist( histPath + "hFastTrackerQA")->GetXaxis()->SetBinLabel(1, "Negative eigenvalue"); - getHist( histPath + "hFastTrackerQA")->GetXaxis()->SetBinLabel(2, "Failed sanity check"); - getHist( histPath + "hFastTrackerQA")->GetXaxis()->SetBinLabel(3, "intercept original radius"); - getHist( histPath + "hFastTrackerQA")->GetXaxis()->SetBinLabel(4, "propagate to original radius"); - getHist( histPath + "hFastTrackerQA")->GetXaxis()->SetBinLabel(5, "problematic layer"); - getHist( histPath + "hFastTrackerQA")->GetXaxis()->SetBinLabel(6, "multiple scattering"); - getHist( histPath + "hFastTrackerQA")->GetXaxis()->SetBinLabel(7, "energy loss"); - getHist( histPath + "hFastTrackerQA")->GetXaxis()->SetBinLabel(8, "efficiency"); + getHist(histPath + "hFastTrackerQA")->GetXaxis()->SetBinLabel(1, "Negative eigenvalue"); + getHist(histPath + "hFastTrackerQA")->GetXaxis()->SetBinLabel(2, "Failed sanity check"); + getHist(histPath + "hFastTrackerQA")->GetXaxis()->SetBinLabel(3, "intercept original radius"); + getHist(histPath + "hFastTrackerQA")->GetXaxis()->SetBinLabel(4, "propagate to original radius"); + getHist(histPath + "hFastTrackerQA")->GetXaxis()->SetBinLabel(5, "problematic layer"); + getHist(histPath + "hFastTrackerQA")->GetXaxis()->SetBinLabel(6, "multiple scattering"); + getHist(histPath + "hFastTrackerQA")->GetXaxis()->SetBinLabel(7, "energy loss"); + getHist(histPath + "hFastTrackerQA")->GetXaxis()->SetBinLabel(8, "efficiency"); } } @@ -934,7 +934,7 @@ struct OnTheFlyTracker { LOG(debug) << "Computed dNch/deta before normalization: " << dNdEta; dNdEta /= (multEtaRange * 2.0f); - getHist( histPath + "hLUTMultiplicity")->Fill(dNdEta); + getHist(histPath + "hLUTMultiplicity")->Fill(dNdEta); } /// Function to study the cascade decay and fill the relevant histograms and output track vector @@ -978,14 +978,14 @@ struct OnTheFlyTracker { double laDecayRadius2D = std::hypot(laDecayVertex[0], laDecayVertex[1]); if (cascadeDecaySettings.doXiQA) { - getHist( histPath + "hGenXi")->Fill(xiDecayRadius2D, mcParticle.pt()); - getHist( histPath + "hGenPiFromXi")->Fill(xiDecayRadius2D, cascadeDecayProducts[0].Pt()); - getHist( histPath + "hGenPiFromLa")->Fill(laDecayRadius2D, cascadeDecayProducts[1].Pt()); - getHist( histPath + "hGenPrFromLa")->Fill(laDecayRadius2D, cascadeDecayProducts[2].Pt()); + getHist(histPath + "hGenXi")->Fill(xiDecayRadius2D, mcParticle.pt()); + getHist(histPath + "hGenPiFromXi")->Fill(xiDecayRadius2D, cascadeDecayProducts[0].Pt()); + getHist(histPath + "hGenPiFromLa")->Fill(laDecayRadius2D, cascadeDecayProducts[1].Pt()); + getHist(histPath + "hGenPrFromLa")->Fill(laDecayRadius2D, cascadeDecayProducts[2].Pt()); } if (cascadeDecaySettings.doXiQA) { - getHist( histPath + "hXiBuilding")->Fill(0.0f); + getHist(histPath + "hXiBuilding")->Fill(0.0f); } o2::upgrade::convertTLorentzVectorToO2Track(PDG_t::kPiMinus, cascadeDecayProducts[0], xiDecayVertex, xiDaughterTrackParCovsPerfect[0], pdgDB); @@ -1023,11 +1023,11 @@ struct OnTheFlyTracker { nTPCHitsCascadeProngs[i] = fastTracker[icfg]->GetNGasPoints(); if (nHitsCascadeProngs[i] < 0 && cascadeDecaySettings.doXiQA) { // QA - getHist( histPath + "hFastTrackerQA")->Fill(o2::math_utils::abs(nHitsCascadeProngs[i])); + getHist(histPath + "hFastTrackerQA")->Fill(o2::math_utils::abs(nHitsCascadeProngs[i])); } - getHist( histPath + "nSiliconHitsCascadeProngs")->Fill(nSiliconHitsCascadeProngs[i]); - getHist( histPath + "nTPCHitsCascadeProngs")->Fill(nTPCHitsCascadeProngs[i]); + getHist(histPath + "nSiliconHitsCascadeProngs")->Fill(nSiliconHitsCascadeProngs[i]); + getHist(histPath + "nTPCHitsCascadeProngs")->Fill(nTPCHitsCascadeProngs[i]); if (nSiliconHitsCascadeProngs[i] >= fastTrackerSettings.minSiliconHits || (nSiliconHitsCascadeProngs[i] >= fastTrackerSettings.minSiliconHitsIfTPCUsed && nTPCHitsCascadeProngs[i] >= fastTrackerSettings.minTPCClusters)) { @@ -1036,18 +1036,18 @@ struct OnTheFlyTracker { continue; // extra sure } if (cascadeDecaySettings.doXiQA) { - getHist( histPath + "hXiBuilding")->Fill(static_cast(i + 1)); + getHist(histPath + "hXiBuilding")->Fill(static_cast(i + 1)); } isReco[i] = true; for (uint32_t ih = 0; ih < fastTracker[icfg]->GetNHits() && cascadeDecaySettings.doXiQA; ih++) { - getHist( histPath + "hFastTrackerHits")->Fill(fastTracker[icfg]->GetHitZ(ih), std::hypot(fastTracker[icfg]->GetHitX(ih), fastTracker[icfg]->GetHitY(ih))); + getHist(histPath + "hFastTrackerHits")->Fill(fastTracker[icfg]->GetHitZ(ih), std::hypot(fastTracker[icfg]->GetHitX(ih), fastTracker[icfg]->GetHitY(ih))); } } else { isReco[i] = true; xiDaughterTrackParCovsTracked[i] = xiDaughterTrackParCovsPerfect[i]; if (cascadeDecaySettings.doXiQA) { - getHist( histPath + "hXiBuilding")->Fill(static_cast(i + 1)); + getHist(histPath + "hXiBuilding")->Fill(static_cast(i + 1)); } } @@ -1055,7 +1055,7 @@ struct OnTheFlyTracker { isReco[i] = false; continue; } else { - getHist( histPath + "hXiBuilding")->Fill(4.0f); + getHist(histPath + "hXiBuilding")->Fill(4.0f); histos.fill(HIST("hNaNBookkeeping"), i + 1, 1.0f); } trackTime = (eventCollisionTimeNS + gRandom->Gaus(0., timeResolutionNs)) * nsToMus; @@ -1081,7 +1081,7 @@ struct OnTheFlyTracker { // cascade building starts here if (cascadeDecaySettings.findXi && reconstructedCascade && cascadeDecaySettings.doKinkReco != 2) { if (cascadeDecaySettings.doXiQA) { - getHist( histPath + "hXiBuilding")->Fill(3.0f); + getHist(histPath + "hXiBuilding")->Fill(3.0f); } // use DCA fitters @@ -1106,7 +1106,7 @@ struct OnTheFlyTracker { // V0 found successfully if (dcaFitterV0Status) { if (cascadeDecaySettings.doXiQA) { - getHist( histPath + "hXiBuilding")->Fill(4.0f); + getHist(histPath + "hXiBuilding")->Fill(4.0f); } std::array pos{}; @@ -1173,7 +1173,7 @@ struct OnTheFlyTracker { // Cascade found successfully if (dcaFitterCascadeStatus) { if (cascadeDecaySettings.doXiQA) { - getHist( histPath + "hXiBuilding")->Fill(6.0f); + getHist(histPath + "hXiBuilding")->Fill(6.0f); } o2::track::TrackParCov bachelorTrackAtPCA = fitter.getTrack(1); @@ -1322,7 +1322,7 @@ struct OnTheFlyTracker { histos.fill(HIST("hFitterStatusCode"), fitterStatusCode); if (kinkFitterOK) { if (cascadeDecaySettings.doXiQA) { - getHist( histPath + "hXiBuilding")->Fill(7.0f); + getHist(histPath + "hXiBuilding")->Fill(7.0f); } o2::track::TrackParCov newCascadeTrack = fitter.getTrack(0); // (cascade) @@ -1353,44 +1353,44 @@ struct OnTheFlyTracker { o2::track::TrackParCov trackParametrization(xiTrackParCov); if (cascadeDecaySettings.doXiQA) { if (reconstructedCascade) { - getHist( histPath + "hRecoXi")->Fill(xiDecayRadius2D, mcParticle.pt()); - getHist( histPath + "hMassLambda")->Fill(thisCascade.mLambda); - getHist( histPath + "hMassXi")->Fill(thisCascade.mXi); - getHist( histPath + "h2dMassXi")->Fill(thisCascade.mXi, thisCascade.pt); - getHist( histPath + "h2dDeltaPtVsPt")->Fill(thisCascade.pt, (mcParticle.pt() - thisCascade.pt) / thisCascade.pt); - getHist( histPath + "h2dDeltaEtaVsPt")->Fill(thisCascade.pt, mcParticle.eta() - thisCascade.eta); - getHist( histPath + "hFoundVsFindable")->Fill(thisCascade.findableClusters, thisCascade.foundClusters); - getHist( histPath + "h2dDCAxyCascade")->Fill(trackParametrization.getPt(), dcaXY * 1e+4); // in microns, please - getHist( histPath + "h2dDCAzCascade")->Fill(trackParametrization.getPt(), dcaZ * 1e+4); // in microns, please + getHist(histPath + "hRecoXi")->Fill(xiDecayRadius2D, mcParticle.pt()); + getHist(histPath + "hMassLambda")->Fill(thisCascade.mLambda); + getHist(histPath + "hMassXi")->Fill(thisCascade.mXi); + getHist(histPath + "h2dMassXi")->Fill(thisCascade.mXi, thisCascade.pt); + getHist(histPath + "h2dDeltaPtVsPt")->Fill(thisCascade.pt, (mcParticle.pt() - thisCascade.pt) / thisCascade.pt); + getHist(histPath + "h2dDeltaEtaVsPt")->Fill(thisCascade.pt, mcParticle.eta() - thisCascade.eta); + getHist(histPath + "hFoundVsFindable")->Fill(thisCascade.findableClusters, thisCascade.foundClusters); + getHist(histPath + "h2dDCAxyCascade")->Fill(trackParametrization.getPt(), dcaXY * 1e+4); // in microns, please + getHist(histPath + "h2dDCAzCascade")->Fill(trackParametrization.getPt(), dcaZ * 1e+4); // in microns, please } if (isReco[0]) { - getHist( histPath + "hRecoPiFromXi")->Fill(xiDecayRadius2D, cascadeDecayProducts[0].Pt()); + getHist(histPath + "hRecoPiFromXi")->Fill(xiDecayRadius2D, cascadeDecayProducts[0].Pt()); o2::track::TrackParCov trackParametrizationBachelor(xiTrackParCov); if (populateTracksDCA && trackParametrizationBachelor.propagateToDCA(primaryVertex, mMagneticField, &dcaInfo)) { dcaXY = dcaInfo.getY(); dcaZ = dcaInfo.getZ(); - getHist( histPath + "h2dDCAxyCascadeBachelor")->Fill(trackParametrizationBachelor.getPt(), dcaXY * 1e+4); // in microns, please - getHist( histPath + "h2dDCAzCascadeBachelor")->Fill(trackParametrizationBachelor.getPt(), dcaZ * 1e+4); // in microns, please + getHist(histPath + "h2dDCAxyCascadeBachelor")->Fill(trackParametrizationBachelor.getPt(), dcaXY * 1e+4); // in microns, please + getHist(histPath + "h2dDCAzCascadeBachelor")->Fill(trackParametrizationBachelor.getPt(), dcaZ * 1e+4); // in microns, please } } if (isReco[1]) { - getHist( histPath + "hRecoPiFromLa")->Fill(laDecayRadius2D, cascadeDecayProducts[1].Pt()); + getHist(histPath + "hRecoPiFromLa")->Fill(laDecayRadius2D, cascadeDecayProducts[1].Pt()); o2::track::TrackParCov trackParametrizationNegative(xiTrackParCov); if (populateTracksDCA && trackParametrizationNegative.propagateToDCA(primaryVertex, mMagneticField, &dcaInfo)) { dcaXY = dcaInfo.getY(); dcaZ = dcaInfo.getZ(); - getHist( histPath + "h2dDCAxyCascadeNegative")->Fill(trackParametrizationNegative.getPt(), dcaXY * 1e+4); // in microns, please - getHist( histPath + "h2dDCAzCascadeNegative")->Fill(trackParametrizationNegative.getPt(), dcaZ * 1e+4); // in microns, please + getHist(histPath + "h2dDCAxyCascadeNegative")->Fill(trackParametrizationNegative.getPt(), dcaXY * 1e+4); // in microns, please + getHist(histPath + "h2dDCAzCascadeNegative")->Fill(trackParametrizationNegative.getPt(), dcaZ * 1e+4); // in microns, please } } if (isReco[2]) { - getHist( histPath + "hRecoPrFromLa")->Fill(laDecayRadius2D, cascadeDecayProducts[2].Pt()); + getHist(histPath + "hRecoPrFromLa")->Fill(laDecayRadius2D, cascadeDecayProducts[2].Pt()); o2::track::TrackParCov trackParametrizationPositive(xiTrackParCov); if (populateTracksDCA && trackParametrizationPositive.propagateToDCA(primaryVertex, mMagneticField, &dcaInfo)) { dcaXY = dcaInfo.getY(); dcaZ = dcaInfo.getZ(); - getHist( histPath + "h2dDCAxyCascadePositive")->Fill(trackParametrizationPositive.getPt(), dcaXY * 1e+4); // in microns, please - getHist( histPath + "h2dDCAzCascadePositive")->Fill(trackParametrizationPositive.getPt(), dcaZ * 1e+4); // in microns, please + getHist(histPath + "h2dDCAxyCascadePositive")->Fill(trackParametrizationPositive.getPt(), dcaXY * 1e+4); // in microns, please + getHist(histPath + "h2dDCAzCascadePositive")->Fill(trackParametrizationPositive.getPt(), dcaZ * 1e+4); // in microns, please } } } @@ -1454,9 +1454,9 @@ struct OnTheFlyTracker { } for (int indexDetector = 0; indexDetector < mGeoContainer.getNumberOfConfigurations(); indexDetector++) { std::string path = Form("V0Building_Configuration_%i/%s/", indexDetector, NameV0s[indexV0].data()); - fillHist( path + "hGen", v0DecayRadius2D, mcParticle.pt()); - fillHist( path + "hGenNegDaughterFromV0", v0DecayRadius2D, v0DecayProducts[0].Pt()); - fillHist( path + "hGenPosDaughterFromV0", v0DecayRadius2D, v0DecayProducts[1].Pt()); + fillHist(path + "hGen", v0DecayRadius2D, mcParticle.pt()); + fillHist(path + "hGenNegDaughterFromV0", v0DecayRadius2D, v0DecayProducts[0].Pt()); + fillHist(path + "hGenPosDaughterFromV0", v0DecayRadius2D, v0DecayProducts[1].Pt()); } } } @@ -1469,7 +1469,7 @@ struct OnTheFlyTracker { std::vector nV0SiliconHits(kv0Prongs); // silicon type std::vector nV0TPCHits(kv0Prongs); // TPC type if (v0DecaySettings.doV0QA) { - fillHist( Form("V0Building_Configuration_%i/hV0Building", icfg), 0.0f); + fillHist(Form("V0Building_Configuration_%i/hV0Building", icfg), 0.0f); } switch (mcParticle.pdgCode()) { case kK0Short: @@ -1515,10 +1515,10 @@ struct OnTheFlyTracker { if (v0DecaySettings.doV0QA) { // QA if (nV0Hits[i] < 0) { - fillHist( Form("V0Building_Configuration_%i/hFastTrackerQA", icfg), o2::math_utils::abs(nV0Hits[i])); + fillHist(Form("V0Building_Configuration_%i/hFastTrackerQA", icfg), o2::math_utils::abs(nV0Hits[i])); } for (uint32_t ih = 0; ih < fastTracker[icfg]->GetNHits(); ih++) { - fillHist( Form("V0Building_Configuration_%i/hFastTrackerHits", icfg), fastTracker[icfg]->GetHitZ(ih), std::hypot(fastTracker[icfg]->GetHitX(ih), fastTracker[icfg]->GetHitY(ih))); + fillHist(Form("V0Building_Configuration_%i/hFastTrackerHits", icfg), fastTracker[icfg]->GetHitZ(ih), std::hypot(fastTracker[icfg]->GetHitX(ih), fastTracker[icfg]->GetHitY(ih))); } } } else { @@ -1533,24 +1533,24 @@ struct OnTheFlyTracker { } if (v0DecaySettings.doV0QA) { if (isV0Reco[0] && isV0Reco[1]) { - fillHist( Form("V0Building_Configuration_%i/hV0Building", icfg), 1.0f); + fillHist(Form("V0Building_Configuration_%i/hV0Building", icfg), 1.0f); for (size_t indexV0 = 0; indexV0 < v0PDGs.size(); indexV0++) { if (mcParticle.pdgCode() == v0PDGs[indexV0]) { - fillHist( Form("V0Building_Configuration_%i/%s/hReco", icfg, NameV0s[indexV0].data()), v0DecayRadius2D, mcParticle.pt()); + fillHist(Form("V0Building_Configuration_%i/%s/hReco", icfg, NameV0s[indexV0].data()), v0DecayRadius2D, mcParticle.pt()); } } } if (isV0Reco[0]) { for (size_t indexV0 = 0; indexV0 < v0PDGs.size(); indexV0++) { if (mcParticle.pdgCode() == v0PDGs[indexV0]) { - fillHist( Form("V0Building_Configuration_%i/%s/hRecoNegDaughterFromV0", icfg, NameV0s[indexV0].data()), v0DecayRadius2D, v0DecayProducts[0].Pt()); + fillHist(Form("V0Building_Configuration_%i/%s/hRecoNegDaughterFromV0", icfg, NameV0s[indexV0].data()), v0DecayRadius2D, v0DecayProducts[0].Pt()); } } } if (isV0Reco[1]) { for (size_t indexV0 = 0; indexV0 < v0PDGs.size(); indexV0++) { if (mcParticle.pdgCode() == v0PDGs[indexV0]) { - fillHist( Form("V0Building_Configuration_%i/%s/hRecoPosDaughterFromV0", icfg, NameV0s[indexV0].data()), v0DecayRadius2D, v0DecayProducts[1].Pt()); + fillHist(Form("V0Building_Configuration_%i/%s/hRecoPosDaughterFromV0", icfg, NameV0s[indexV0].data()), v0DecayRadius2D, v0DecayProducts[1].Pt()); } } } @@ -1561,7 +1561,7 @@ struct OnTheFlyTracker { // V0 building starts here if (v0DecaySettings.findV0 && isV0Reco[0] && isV0Reco[1]) { if (v0DecaySettings.doV0QA) { - fillHist( Form("V0Building_Configuration_%i/hV0Building", icfg), 2.0f); + fillHist(Form("V0Building_Configuration_%i/hV0Building", icfg), 2.0f); } // assign indices of the daughter particles @@ -1592,7 +1592,7 @@ struct OnTheFlyTracker { // V0 found successfully if (dcaFitterV0Status) { if (v0DecaySettings.doV0QA) { - fillHist( Form("V0Building_Configuration_%i/hV0Building", icfg), 3.0f); + fillHist(Form("V0Building_Configuration_%i/hV0Building", icfg), 3.0f); } std::array pos{}; @@ -1640,15 +1640,15 @@ struct OnTheFlyTracker { } if (v0DecaySettings.doV0QA) { - fillHist( Form("V0Building_Configuration_%i/hV0Building", icfg), 4.0f); + fillHist(Form("V0Building_Configuration_%i/hV0Building", icfg), 4.0f); if (std::abs(mcParticle.pdgCode()) == kK0Short) { - fillHist( Form("V0Building_Configuration_%i/K0/hMass", icfg), thisV0.mK0, thisV0.pt); + fillHist(Form("V0Building_Configuration_%i/K0/hMass", icfg), thisV0.mK0, thisV0.pt); } if (mcParticle.pdgCode() == kLambda0) { - fillHist( Form("V0Building_Configuration_%i/Lambda/hMass", icfg), thisV0.mLambda, thisV0.pt); + fillHist(Form("V0Building_Configuration_%i/Lambda/hMass", icfg), thisV0.mLambda, thisV0.pt); } if (mcParticle.pdgCode() == kLambda0Bar) { - fillHist( Form("V0Building_Configuration_%i/AntiLambda/hMass", icfg), thisV0.mAntiLambda, thisV0.pt); + fillHist(Form("V0Building_Configuration_%i/AntiLambda/hMass", icfg), thisV0.mAntiLambda, thisV0.pt); } } @@ -1690,7 +1690,7 @@ struct OnTheFlyTracker { } vertexReconstructionEfficiencyCounters.first += 1; const std::string histPath = "Configuration_" + std::to_string(icfg) + "/"; - fillHist( histPath + "hVtxMultGen", prmTrks.size()); + fillHist(histPath + "hVtxMultGen", prmTrks.size()); std::vector lblTracks; std::vector vertices; std::vector vertexTrackIDs; @@ -1705,7 +1705,7 @@ struct OnTheFlyTracker { idxVec.emplace_back(i, o2::dataformats::GlobalTrackID::ITS); // let's say ITS } - getHist( histPath + "hVtxTrials")->Fill(0); // Tried vertexing + getHist(histPath + "hVtxTrials")->Fill(0); // Tried vertexing // Calculate vertices const int n_vertices = vertexer.process(prmTrks, // track array @@ -1724,7 +1724,7 @@ struct OnTheFlyTracker { return; // primary vertex not reconstructed } vertexReconstructionEfficiencyCounters.second += 1; - getHist( histPath + "hVtxTrials")->Fill(1); // Succeeded vertexing + getHist(histPath + "hVtxTrials")->Fill(1); // Succeeded vertexing // Find largest vertex int largestVertex = 0; @@ -1737,11 +1737,11 @@ struct OnTheFlyTracker { if (doExtraQA) { histos.fill(HIST("h2dVerticesVsContributors"), primaryVertex.getNContributors(), n_vertices); } - fillHist( histPath + "hVtxMultReco", primaryVertex.getNContributors()); - fillHist( histPath + "hDeltaMultPVRecoGen", static_cast(primaryVertex.getNContributors()) - static_cast(prmTrks.size())); - fillHist( histPath + "hDeltaXPVRecoGen", primaryVertex.getX() - mcCollision.posX(), primaryVertex.getNContributors()); - fillHist( histPath + "hDeltaYPVRecoGen", primaryVertex.getY() - mcCollision.posY(), primaryVertex.getNContributors()); - fillHist( histPath + "hDeltaZPVRecoGen", primaryVertex.getZ() - mcCollision.posZ(), primaryVertex.getNContributors()); + fillHist(histPath + "hVtxMultReco", primaryVertex.getNContributors()); + fillHist(histPath + "hDeltaMultPVRecoGen", static_cast(primaryVertex.getNContributors()) - static_cast(prmTrks.size())); + fillHist(histPath + "hDeltaXPVRecoGen", primaryVertex.getX() - mcCollision.posX(), primaryVertex.getNContributors()); + fillHist(histPath + "hDeltaYPVRecoGen", primaryVertex.getY() - mcCollision.posY(), primaryVertex.getNContributors()); + fillHist(histPath + "hDeltaZPVRecoGen", primaryVertex.getZ() - mcCollision.posZ(), primaryVertex.getNContributors()); } /// Function to fill track information into the relevant tables and histograms @@ -1764,8 +1764,8 @@ struct OnTheFlyTracker { dcaZ = dcaInfo.getZ(); } if (doExtraQA && (!extraQAwithoutDecayDaughters || (extraQAwithoutDecayDaughters && !trackParCov.isDecayDau))) { - getHist( histPath + "h2dDCAxy")->Fill(trackParametrization.getPt(), dcaXY * 1e+4); - getHist( histPath + "h2dDCAz")->Fill(trackParametrization.getPt(), dcaZ * 1e+4); + getHist(histPath + "h2dDCAxy")->Fill(trackParametrization.getPt(), dcaXY * 1e+4); + getHist(histPath + "h2dDCAz")->Fill(trackParametrization.getPt(), dcaZ * 1e+4); histos.fill(HIST("hTrackXatDCA"), trackParametrization.getX()); } tableTracksDCA(dcaXY, dcaZ); @@ -1852,11 +1852,11 @@ struct OnTheFlyTracker { if (brSettings.doBRQA) { const std::string histPath = "Configuration_" + std::to_string(icfg) + "/"; - getHist( histPath + "h1dNBRPhotons")->Fill(static_cast(nPhotons)); - getHist( histPath + "h1dBREnergyLoss")->Fill((initialMomentum - afterRadiationMomentum) / afterRadiationMomentum); + getHist(histPath + "h1dNBRPhotons")->Fill(static_cast(nPhotons)); + getHist(histPath + "h1dBREnergyLoss")->Fill((initialMomentum - afterRadiationMomentum) / afterRadiationMomentum); - getHist( histPath + "h2dBRPtRes")->Fill(trackParCov.getPt(), (trackParCov.getPt() - mcParticle.pt()) / trackParCov.getPt()); - getHist( histPath + "h2dBRPtResAbs")->Fill(trackParCov.getPt(), trackParCov.getPt() - mcParticle.pt()); + getHist(histPath + "h2dBRPtRes")->Fill(trackParCov.getPt(), (trackParCov.getPt() - mcParticle.pt()) / trackParCov.getPt()); + getHist(histPath + "h2dBRPtResAbs")->Fill(trackParCov.getPt(), trackParCov.getPt() - mcParticle.pt()); } } } @@ -1937,34 +1937,34 @@ struct OnTheFlyTracker { reconstructed = mSmearer[icfg]->smearTrack(trackParCov, mcParticle.pdgCode(), dNdEta); nTrkHits = fastTrackerSettings.minSiliconHits; } - getHist( histPath + "hPtGenerated")->Fill(mcParticle.pt()); - getHist( histPath + "hPhiGenerated")->Fill(mcParticle.phi()); + getHist(histPath + "hPtGenerated")->Fill(mcParticle.pt()); + getHist(histPath + "hPhiGenerated")->Fill(mcParticle.phi()); if (std::abs(mcParticle.pdgCode()) == kElectron) - getHist( histPath + "hPtGeneratedEl")->Fill(mcParticle.pt()); + getHist(histPath + "hPtGeneratedEl")->Fill(mcParticle.pt()); if (std::abs(mcParticle.pdgCode()) == kPiPlus) - getHist( histPath + "hPtGeneratedPi")->Fill(mcParticle.pt()); + getHist(histPath + "hPtGeneratedPi")->Fill(mcParticle.pt()); if (std::abs(mcParticle.pdgCode()) == kKPlus) - getHist( histPath + "hPtGeneratedKa")->Fill(mcParticle.pt()); + getHist(histPath + "hPtGeneratedKa")->Fill(mcParticle.pt()); if (std::abs(mcParticle.pdgCode()) == kProton) - getHist( histPath + "hPtGeneratedPr")->Fill(mcParticle.pt()); + getHist(histPath + "hPtGeneratedPr")->Fill(mcParticle.pt()); if (!reconstructed && !processUnreconstructedTracks) { continue; } - getHist( histPath + "hPtReconstructed")->Fill(trackParCov.getPt()); + getHist(histPath + "hPtReconstructed")->Fill(trackParCov.getPt()); if (std::abs(mcParticle.pdgCode()) == kElectron) - getHist( histPath + "hPtReconstructedEl")->Fill(trackParCov.getPt()); + getHist(histPath + "hPtReconstructedEl")->Fill(trackParCov.getPt()); if (std::abs(mcParticle.pdgCode()) == kPiPlus) - getHist( histPath + "hPtReconstructedPi")->Fill(trackParCov.getPt()); + getHist(histPath + "hPtReconstructedPi")->Fill(trackParCov.getPt()); if (std::abs(mcParticle.pdgCode()) == kKPlus) - getHist( histPath + "hPtReconstructedKa")->Fill(trackParCov.getPt()); + getHist(histPath + "hPtReconstructedKa")->Fill(trackParCov.getPt()); if (std::abs(mcParticle.pdgCode()) == kProton) - getHist( histPath + "hPtReconstructedPr")->Fill(trackParCov.getPt()); + getHist(histPath + "hPtReconstructedPr")->Fill(trackParCov.getPt()); } if (doExtraQA) { - getHist( histPath + "h2dPtRes")->Fill(trackParCov.getPt(), (trackParCov.getPt() - mcParticle.pt()) / trackParCov.getPt()); - getHist( histPath + "h2dPtResAbs")->Fill(trackParCov.getPt(), trackParCov.getPt() - mcParticle.pt()); + getHist(histPath + "h2dPtRes")->Fill(trackParCov.getPt(), (trackParCov.getPt() - mcParticle.pt()) / trackParCov.getPt()); + getHist(histPath + "h2dPtResAbs")->Fill(trackParCov.getPt(), trackParCov.getPt() - mcParticle.pt()); histos.fill(HIST("hRecoTrackX"), trackParCov.getX()); } @@ -1991,7 +1991,7 @@ struct OnTheFlyTracker { return; } computeVertex(mcCollision, recoPrimaries, primaryVertex, icfg); - getHist( histPath + "hPVz")->Fill(primaryVertex.getZ()); + getHist(histPath + "hPVz")->Fill(primaryVertex.getZ()); // populate collisions tableCollisions(-1, // BC is irrelevant in synthetic MC tests for now, could be adjusted in future primaryVertex.getX(), primaryVertex.getY(), primaryVertex.getZ(), @@ -2035,8 +2035,8 @@ struct OnTheFlyTracker { } if (doExtraQA) { histos.fill(HIST("hRecoVsSimMultiplicity"), multiplicityCounter, recoPrimaries.size()); - getHist( histPath + "hSimMultiplicity")->Fill(multiplicityCounter); - getHist( histPath + "hRecoMultiplicity")->Fill(recoPrimaries.size()); + getHist(histPath + "hSimMultiplicity")->Fill(multiplicityCounter); + getHist(histPath + "hRecoMultiplicity")->Fill(recoPrimaries.size()); } LOG(debug) << " <- Finished processing OTF tracking with LUT configuration ID " << icfg; @@ -2096,20 +2096,20 @@ struct OnTheFlyTracker { } if (enablePrimarySmearing) { - getHist( histPath + "hPtGenerated")->Fill(mcParticle.pt()); - getHist( histPath + "hPhiGenerated")->Fill(mcParticle.phi()); + getHist(histPath + "hPtGenerated")->Fill(mcParticle.pt()); + getHist(histPath + "hPhiGenerated")->Fill(mcParticle.phi()); switch (std::abs(mcParticle.pdgCode())) { case kElectron: - getHist( histPath + "hPtGeneratedEl")->Fill(mcParticle.pt()); + getHist(histPath + "hPtGeneratedEl")->Fill(mcParticle.pt()); break; case kPiPlus: - getHist( histPath + "hPtGeneratedPi")->Fill(mcParticle.pt()); + getHist(histPath + "hPtGeneratedPi")->Fill(mcParticle.pt()); break; case kKPlus: - getHist( histPath + "hPtGeneratedKa")->Fill(mcParticle.pt()); + getHist(histPath + "hPtGeneratedKa")->Fill(mcParticle.pt()); break; case kProton: - getHist( histPath + "hPtGeneratedPr")->Fill(mcParticle.pt()); + getHist(histPath + "hPtGeneratedPr")->Fill(mcParticle.pt()); break; } } @@ -2161,49 +2161,49 @@ struct OnTheFlyTracker { histos.fill(HIST("hNaNBookkeeping"), 0.0f, 1.0f); if (enablePrimarySmearing) { const float ptResolution = (trackParCov.getPt() - mcParticle.pt()) / trackParCov.getPt(); - getHist( histPath + "hPtReconstructed")->Fill(trackParCov.getPt()); + getHist(histPath + "hPtReconstructed")->Fill(trackParCov.getPt()); if (otfParticle.isPrimary()) { - getHist( histPath + "h2dPrimaryPtRes")->Fill(trackParCov.getPt(), ptResolution); + getHist(histPath + "h2dPrimaryPtRes")->Fill(trackParCov.getPt(), ptResolution); } else { - getHist( histPath + "h2dSecondaryPtRes")->Fill(trackParCov.getPt(), ptResolution); + getHist(histPath + "h2dSecondaryPtRes")->Fill(trackParCov.getPt(), ptResolution); } if (std::abs(mcParticle.pdgCode()) == kElectron) { - getHist( histPath + "hPtReconstructedEl")->Fill(trackParCov.getPt()); + getHist(histPath + "hPtReconstructedEl")->Fill(trackParCov.getPt()); if (otfParticle.isPrimary()) { - getHist( histPath + "h2dPrimaryElPtRes")->Fill(trackParCov.getPt(), ptResolution); + getHist(histPath + "h2dPrimaryElPtRes")->Fill(trackParCov.getPt(), ptResolution); } else { - getHist( histPath + "h2dSecondaryElPtRes")->Fill(trackParCov.getPt(), ptResolution); + getHist(histPath + "h2dSecondaryElPtRes")->Fill(trackParCov.getPt(), ptResolution); } } if (std::abs(mcParticle.pdgCode()) == kPiPlus) { - getHist( histPath + "hPtReconstructedPi")->Fill(trackParCov.getPt()); + getHist(histPath + "hPtReconstructedPi")->Fill(trackParCov.getPt()); if (otfParticle.isPrimary()) { - getHist( histPath + "h2dPrimaryPiPtRes")->Fill(trackParCov.getPt(), ptResolution); + getHist(histPath + "h2dPrimaryPiPtRes")->Fill(trackParCov.getPt(), ptResolution); } else { - getHist( histPath + "h2dSecondaryPiPtRes")->Fill(trackParCov.getPt(), ptResolution); + getHist(histPath + "h2dSecondaryPiPtRes")->Fill(trackParCov.getPt(), ptResolution); } } if (std::abs(mcParticle.pdgCode()) == kKPlus) { - getHist( histPath + "hPtReconstructedKa")->Fill(trackParCov.getPt()); + getHist(histPath + "hPtReconstructedKa")->Fill(trackParCov.getPt()); if (otfParticle.isPrimary()) { - getHist( histPath + "h2dPrimaryKaPtRes")->Fill(trackParCov.getPt(), ptResolution); + getHist(histPath + "h2dPrimaryKaPtRes")->Fill(trackParCov.getPt(), ptResolution); } else { - getHist( histPath + "h2dSecondaryKaPtRes")->Fill(trackParCov.getPt(), ptResolution); + getHist(histPath + "h2dSecondaryKaPtRes")->Fill(trackParCov.getPt(), ptResolution); } } if (std::abs(mcParticle.pdgCode()) == kProton) { - getHist( histPath + "hPtReconstructedPr")->Fill(trackParCov.getPt()); + getHist(histPath + "hPtReconstructedPr")->Fill(trackParCov.getPt()); if (otfParticle.isPrimary()) { - getHist( histPath + "h2dPrimaryPrPtRes")->Fill(trackParCov.getPt(), ptResolution); + getHist(histPath + "h2dPrimaryPrPtRes")->Fill(trackParCov.getPt(), ptResolution); } else { - getHist( histPath + "h2dSecondaryPrPtRes")->Fill(trackParCov.getPt(), ptResolution); + getHist(histPath + "h2dSecondaryPrPtRes")->Fill(trackParCov.getPt(), ptResolution); } } } if (reconstructed) { tracksAlice3.push_back(TrackAlice3{trackParCov, mcParticle.globalIndex(), time, timeResolutionUs, isSecondary, false, 0, nTrkHits, kRecoPrimary}); - getHist( histPath + "hPtReconstructedPr")->Fill(trackParCov.getPt()); + getHist(histPath + "hPtReconstructedPr")->Fill(trackParCov.getPt()); } else { ghostTracksAlice3.push_back(TrackAlice3{trackParCov, mcParticle.globalIndex(), time, timeResolutionUs, isSecondary, false, 0, nTrkHits, kGhostPrimary}); } @@ -2216,9 +2216,9 @@ struct OnTheFlyTracker { } computeVertex(mcCollision, tracksAlice3, primaryVertex, icfg); - getHist( histPath + "hSimMultiplicity")->Fill(multiplicityCounter); - getHist( histPath + "hRecoMultiplicity")->Fill(tracksAlice3.size()); - getHist( histPath + "hPVz")->Fill(primaryVertex.getZ()); + getHist(histPath + "hSimMultiplicity")->Fill(multiplicityCounter); + getHist(histPath + "hRecoMultiplicity")->Fill(tracksAlice3.size()); + getHist(histPath + "hPVz")->Fill(primaryVertex.getZ()); // *+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+* // populate collisions From 0406513f01c0f2316f1d505a34009a6ecc6cd437 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Fri, 21 Aug 2026 15:19:39 +0200 Subject: [PATCH 3/6] Refactor pdgCodeToPID function to use switch case --- ALICE3/TableProducer/OTF/onTheFlyTracker.cxx | 42 ++++++++++---------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx b/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx index 049507e9113..fd1548e2ced 100644 --- a/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx +++ b/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx @@ -768,26 +768,28 @@ struct OnTheFlyTracker { /// \param pdgCode pdg code for a common particle (particle handled by the tracker) int pdgCodeToPID(int pdgCode) const { - if (std::abs(pdgCode) == PDG_t::kElectron) { - return o2::track::PID::Electron; - } else if (std::abs(pdgCode) == PDG_t::kMuonMinus) { - return o2::track::PID::Muon; - } else if (std::abs(pdgCode) == PDG_t::kPiPlus) { - return o2::track::PID::Pion; - } else if (std::abs(pdgCode) == PDG_t::kKPlus) { - return o2::track::PID::Kaon; - } else if (std::abs(pdgCode) == PDG_t::kProton) { - return o2::track::PID::Proton; - } else if (std::abs(pdgCode) == PDG_t::kLambda0) { - return o2::track::PID::Lambda; - } else if (std::abs(pdgCode) == PDG_t::kSigmaPlus || std::abs(pdgCode) == PDG_t::kSigmaMinus) { - return o2::track::PID::XiMinus; // Close enough - } else if (std::abs(pdgCode) == PDG_t::kXiMinus) { - return o2::track::PID::XiMinus; - } else if (std::abs(pdgCode) == PDG_t::kOmegaMinus) { - return o2::track::PID::OmegaMinus; - } else { - return o2::track::PID::Pion; // Default trackParCov assumption + switch (std::abs(pdgCode)) { + case PDG_t::kElectron: + return o2::track::PID::Electron; + case PDG_t::kMuonMinus: + return o2::track::PID::Muon; + case PDG_t::kPiPlus: + return o2::track::PID::Pion; + case PDG_t::kKPlus: + return o2::track::PID::Kaon; + case PDG_t::kProton: + return o2::track::PID::Proton; + case PDG_t::kLambda0: + return o2::track::PID::Lambda; + case PDG_t::kSigmaPlus: + case PDG_t::kSigmaMinus: + return o2::track::PID::XiMinus; // Close enough + case PDG_t::kXiMinus: + return o2::track::PID::XiMinus; + case PDG_t::kOmegaMinus: + return o2::track::PID::OmegaMinus; + default: + return o2::track::PID::Pion; // Default trackParCov assumption } } From 2ed69d499b2b61d8c1a4f7ef25421e1bd8a29e56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Fri, 21 Aug 2026 15:55:17 +0200 Subject: [PATCH 4/6] Refactor TrackAlice3 constructor and member variables Refactored TrackAlice3 constructor to use default member initializers. --- ALICE3/TableProducer/OTF/onTheFlyTracker.cxx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx b/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx index fd1548e2ced..918db2d4ae8 100644 --- a/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx +++ b/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx @@ -268,7 +268,7 @@ struct OnTheFlyTracker { using TimeEst = o2::dataformats::TimeStampWithError; public: - TrackAlice3() : TrackParCov{}, mcLabel{-1}, timeEst{}, isDecayDau{false}, isWeakDecayDau{false}, isUsedInCascading{0}, nSiliconHits{0}, nTPCHits{0}, trackType{TrackType::kNone} {} + TrackAlice3() = default; ~TrackAlice3() = default; TrackAlice3(const TrackAlice3& src) = default; TrackAlice3(const o2::track::TrackParCov& src, const int64_t label, @@ -289,13 +289,13 @@ struct OnTheFlyTracker { nTPCHits(nTPCHitsInput), trackType(trackTypeInput) {} const TimeEst& getTimeMUS() const { return timeEst; } - int64_t mcLabel; - TimeEst timeEst; ///< time estimate in ns - bool isDecayDau; - bool isWeakDecayDau; - int isUsedInCascading; // 0: not at all, 1: is a cascade, 2: is a bachelor, 3: is a pion, 4: is a proton - int nSiliconHits; - int nTPCHits; + int64_t mcLabel = -1; ///< MC label of the track + TimeEst timeEst{}; ///< time estimate in ns + bool isDecayDau = false; ///< is a decay daughter + bool isWeakDecayDau = false; ///< is a weak decay daughter + int isUsedInCascading = 0; ///< 0: not at all, 1: is a cascade, 2: is a bachelor, 3: is a pion, 4: is a proton + int nSiliconHits = 0; ///< number of silicon hits + int nTPCHits = 0; ///< number of TPC hits TrackType trackType; }; From 63822f160c82c2a6e50026e48ea5ccab1c0327fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Fri, 21 Aug 2026 16:03:55 +0200 Subject: [PATCH 5/6] Refactor insertHist calls for consistency --- ALICE3/TableProducer/OTF/onTheFlyTracker.cxx | 143 +++++++++---------- 1 file changed, 71 insertions(+), 72 deletions(-) diff --git a/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx b/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx index 918db2d4ae8..cc12010021a 100644 --- a/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx +++ b/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx @@ -494,33 +494,33 @@ struct OnTheFlyTracker { // smear un-reco'ed tracks if asked to do so mSmearer[icfg]->skipUnreconstructed(!processUnreconstructedTracks.value); - insertHist(histPath + "hPtGenerated", "hPtGenerated;#it{p}_{T} (GeV/c);Counts", {kTH1D, {{axes.axisMomentum}}}); - insertHist(histPath + "hPhiGenerated", "hPhiGenerated;#phi (rad);Counts", {kTH1D, {{100, 0.0f, 2 * M_PI, "#phi (rad)"}}}); - - insertHist(histPath + "hPtGeneratedEl", "hPtGeneratedEl;Gen #it{p}_{T} (GeV/c);Counts", {kTH1D, {{axes.axisMomentum}}}); - insertHist(histPath + "hPtGeneratedPi", "hPtGeneratedPi;Gen #it{p}_{T} (GeV/c);Counts", {kTH1D, {{axes.axisMomentum}}}); - insertHist(histPath + "hPtGeneratedKa", "hPtGeneratedKa;Gen #it{p}_{T} (GeV/c);Counts", {kTH1D, {{axes.axisMomentum}}}); - insertHist(histPath + "hPtGeneratedPr", "hPtGeneratedPr;Gen #it{p}_{T} (GeV/c);Counts", {kTH1D, {{axes.axisMomentum}}}); - insertHist(histPath + "hPtReconstructed", "hPtReconstructed;Reco #it{p}_{T} (GeV/c);Counts", {kTH1D, {{axes.axisMomentum}}}); - insertHist(histPath + "hPtReconstructedEl", "hPtReconstructedEl;Reco #it{p}_{T} (GeV/c);Counts", {kTH1D, {{axes.axisMomentum}}}); - insertHist(histPath + "hPtReconstructedPi", "hPtReconstructedPi;Reco #it{p}_{T} (GeV/c);Counts", {kTH1D, {{axes.axisMomentum}}}); - insertHist(histPath + "hPtReconstructedKa", "hPtReconstructedKa;Reco #it{p}_{T} (GeV/c);Counts", {kTH1D, {{axes.axisMomentum}}}); - insertHist(histPath + "hPtReconstructedPr", "hPtReconstructedPr;Reco #it{p}_{T} (GeV/c);Counts", {kTH1D, {{axes.axisMomentum}}}); + insertHist(histPath + "hPtGenerated", "hPtGenerated;#it{p}_{T} (GeV/c);Counts", kTH1D, {{axes.axisMomentum}}); + insertHist(histPath + "hPhiGenerated", "hPhiGenerated;#phi (rad);Counts", kTH1D, {{100, 0.0f, 2 * M_PI, "#phi (rad)"}}); + + insertHist(histPath + "hPtGeneratedEl", "hPtGeneratedEl;Gen #it{p}_{T} (GeV/c);Counts", kTH1D, {{axes.axisMomentum}}); + insertHist(histPath + "hPtGeneratedPi", "hPtGeneratedPi;Gen #it{p}_{T} (GeV/c);Counts", kTH1D, {{axes.axisMomentum}}); + insertHist(histPath + "hPtGeneratedKa", "hPtGeneratedKa;Gen #it{p}_{T} (GeV/c);Counts", kTH1D, {{axes.axisMomentum}}); + insertHist(histPath + "hPtGeneratedPr", "hPtGeneratedPr;Gen #it{p}_{T} (GeV/c);Counts", kTH1D, {{axes.axisMomentum}}); + insertHist(histPath + "hPtReconstructed", "hPtReconstructed;Reco #it{p}_{T} (GeV/c);Counts", kTH1D, {{axes.axisMomentum}}); + insertHist(histPath + "hPtReconstructedEl", "hPtReconstructedEl;Reco #it{p}_{T} (GeV/c);Counts", kTH1D, {{axes.axisMomentum}}); + insertHist(histPath + "hPtReconstructedPi", "hPtReconstructedPi;Reco #it{p}_{T} (GeV/c);Counts", kTH1D, {{axes.axisMomentum}}); + insertHist(histPath + "hPtReconstructedKa", "hPtReconstructedKa;Reco #it{p}_{T} (GeV/c);Counts", kTH1D, {{axes.axisMomentum}}); + insertHist(histPath + "hPtReconstructedPr", "hPtReconstructedPr;Reco #it{p}_{T} (GeV/c);Counts", kTH1D, {{axes.axisMomentum}}); } // Collision QA - insertHist(histPath + "hPVz", "hPVz;Primary Vertex Z (cm);Counts", {kTH1D, {{axes.axisVertexZ}}}); - insertHist(histPath + "hLUTMultiplicity", "hLUTMultiplicity;dN/d#eta;Counts", {kTH1D, {{axes.axisMultiplicity}}}); - insertHist(histPath + "hSimMultiplicity", "hSimMultiplicity;Gen. multiplicity;Counts", {kTH1D, {{axes.axisMultiplicity}}}); - insertHist(histPath + "hRecoMultiplicity", "hRecoMultiplicity;Reco Multiplicity;Counts", {kTH1D, {{axes.axisMultiplicity}}}); + insertHist(histPath + "hPVz", "hPVz;Primary Vertex Z (cm);Counts", kTH1D, {{axes.axisVertexZ}}); + insertHist(histPath + "hLUTMultiplicity", "hLUTMultiplicity;dN/d#eta;Counts", kTH1D, {{axes.axisMultiplicity}}); + insertHist(histPath + "hSimMultiplicity", "hSimMultiplicity;Gen. multiplicity;Counts", kTH1D, {{axes.axisMultiplicity}}); + insertHist(histPath + "hRecoMultiplicity", "hRecoMultiplicity;Reco Multiplicity;Counts", kTH1D, {{axes.axisMultiplicity}}); if (enablePrimaryVertexing) { - insertHist(histPath + "hDeltaXPVRecoGen", "hDeltaXPVRecoGen;Delta X (reco - gen), cm", {kTH2D, {{axes.axisDeltaVtxCoord, axes.axisMultiplicity}}}); - insertHist(histPath + "hDeltaYPVRecoGen", "hDeltaYPVRecoGen;Delta Y (reco - gen), cm", {kTH2D, {{axes.axisDeltaVtxCoord, axes.axisMultiplicity}}}); - insertHist(histPath + "hDeltaZPVRecoGen", "hDeltaZPVRecoGen;Delta Z (reco - gen), cm", {kTH2D, {{axes.axisDeltaVtxCoord, axes.axisMultiplicity}}}); - insertHist(histPath + "hDeltaMultPVRecoGen", "hDeltaMultPVRecoGen;Delta Multiplicity (reco - gen)", {kTH1D, {{axes.axisDeltaMultPVRecoGen}}}); - insertHist(histPath + "hVtxMultGen", "hVtxMultGen;Generated Vertex Multiplicity", {kTH1D, {{axes.axisVtxMult}}}); - insertHist(histPath + "hVtxMultReco", "hVtxMultReco;Reconstructed Vertex Multiplicity", {kTH1D, {{axes.axisVtxMult}}}); - insertHist(histPath + "hVtxTrials", "hVtxTrials;Vertex Reconstruction Trials", {kTH1D, {{2, -0.5, 1.5}}}); + insertHist(histPath + "hDeltaXPVRecoGen", "hDeltaXPVRecoGen;Delta X (reco - gen), cm", kTH2D, {{axes.axisDeltaVtxCoord, axes.axisMultiplicity}}); + insertHist(histPath + "hDeltaYPVRecoGen", "hDeltaYPVRecoGen;Delta Y (reco - gen), cm", kTH2D, {{axes.axisDeltaVtxCoord, axes.axisMultiplicity}}); + insertHist(histPath + "hDeltaZPVRecoGen", "hDeltaZPVRecoGen;Delta Z (reco - gen), cm", kTH2D, {{axes.axisDeltaVtxCoord, axes.axisMultiplicity}}); + insertHist(histPath + "hDeltaMultPVRecoGen", "hDeltaMultPVRecoGen;Delta Multiplicity (reco - gen)", kTH1D, {{axes.axisDeltaMultPVRecoGen}}); + insertHist(histPath + "hVtxMultGen", "hVtxMultGen;Generated Vertex Multiplicity", kTH1D, {{axes.axisVtxMult}}); + insertHist(histPath + "hVtxMultReco", "hVtxMultReco;Reconstructed Vertex Multiplicity", kTH1D, {{axes.axisVtxMult}}); + insertHist(histPath + "hVtxTrials", "hVtxTrials;Vertex Reconstruction Trials", kTH1D, {{2, -0.5, 1.5}}); // Set the bin labels getHist(histPath + "hVtxTrials")->GetXaxis()->SetBinLabel(1, "Tried"); getHist(histPath + "hVtxTrials")->GetXaxis()->SetBinLabel(2, "Succeeded"); @@ -536,7 +536,7 @@ struct OnTheFlyTracker { fastTracker[icfg]->Print(); // print fastTracker settings if (cascadeDecaySettings.doXiQA) { - insertHist(histPath + "hXiBuilding", "hXiBuilding", {kTH1F, {{10, -0.5f, 9.5f}}}); + insertHist(histPath + "hXiBuilding", "hXiBuilding", kTH1F, {{10, -0.5f, 9.5f}}); getHist(histPath + "hXiBuilding")->GetXaxis()->SetBinLabel(1, "Generated"); getHist(histPath + "hXiBuilding")->GetXaxis()->SetBinLabel(2, "Secondary smearing prong 0"); getHist(histPath + "hXiBuilding")->GetXaxis()->SetBinLabel(3, "Secondary smearing prong 1"); @@ -546,41 +546,40 @@ struct OnTheFlyTracker { getHist(histPath + "hXiBuilding")->GetXaxis()->SetBinLabel(7, "V0 fitter ok"); getHist(histPath + "hXiBuilding")->GetXaxis()->SetBinLabel(8, "Kink fitter ok"); - insertHist(histPath + "hGenXi", "hGenXi;Decay Radius;#it{p}_{T}", {kTH2F, {axes.axisDecayRadius, axes.axisMomentum}}); - insertHist(histPath + "hRecoXi", "hRecoXi;Decay Radius;#it{p}_{T}", {kTH2F, {axes.axisDecayRadius, axes.axisMomentum}}); + insertHist(histPath + "hGenXi", "hGenXi;Decay Radius;#it{p}_{T}", kTH2F, {axes.axisDecayRadius, axes.axisMomentum}); + insertHist(histPath + "hRecoXi", "hRecoXi;Decay Radius;#it{p}_{T}", kTH2F, {axes.axisDecayRadius, axes.axisMomentum}); - insertHist(histPath + "hGenPiFromXi", "hGenPiFromXi;Decay Radius;#it{p}_{T}", {kTH2F, {axes.axisDecayRadius, axes.axisMomentum}}); - insertHist(histPath + "hGenPiFromLa", "hGenPiFromLa;Decay Radius;#it{p}_{T}", {kTH2F, {axes.axisDecayRadius, axes.axisMomentum}}); - insertHist(histPath + "hGenPrFromLa", "hGenPrFromLa;Decay Radius;#it{p}_{T}", {kTH2F, {axes.axisDecayRadius, axes.axisMomentum}}); - insertHist(histPath + "hRecoPiFromXi", "hRecoPiFromXi;Decay Radius;#it{p}_{T}", {kTH2F, {axes.axisDecayRadius, axes.axisMomentum}}); - insertHist(histPath + "hRecoPiFromLa", "hRecoPiFromLa;Decay Radius;#it{p}_{T}", {kTH2F, {axes.axisDecayRadius, axes.axisMomentum}}); - insertHist(histPath + "hRecoPrFromLa", "hRecoPrFromLa;Decay Radius;#it{p}_{T}", {kTH2F, {axes.axisDecayRadius, axes.axisMomentum}}); + insertHist(histPath + "hGenPiFromXi", "hGenPiFromXi;Decay Radius;#it{p}_{T}", kTH2F, {axes.axisDecayRadius, axes.axisMomentum}); + insertHist(histPath + "hGenPiFromLa", "hGenPiFromLa;Decay Radius;#it{p}_{T}", kTH2F, {axes.axisDecayRadius, axes.axisMomentum}); + insertHist(histPath + "hGenPrFromLa", "hGenPrFromLa;Decay Radius;#it{p}_{T}", kTH2F, {axes.axisDecayRadius, axes.axisMomentum}); + insertHist(histPath + "hRecoPiFromXi", "hRecoPiFromXi;Decay Radius;#it{p}_{T}", kTH2F, {axes.axisDecayRadius, axes.axisMomentum}); + insertHist(histPath + "hRecoPiFromLa", "hRecoPiFromLa;Decay Radius;#it{p}_{T}", kTH2F, {axes.axisDecayRadius, axes.axisMomentum}); + insertHist(histPath + "hRecoPrFromLa", "hRecoPrFromLa;Decay Radius;#it{p}_{T}", kTH2F, {axes.axisDecayRadius, axes.axisMomentum}); // basic mass histograms to see if we're in business - insertHist(histPath + "hMassLambda", "hMassLambda;Mass;Counts", {kTH1F, {{axes.axisLambdaMass}}}); - insertHist(histPath + "hMassXi", "hMassXi;Mass;Counts", {kTH1F, {{axes.axisXiMass}}}); - insertHist(histPath + "h2dMassXi", "h2dMassXi;Mass;Counts", {kTH2F, {{axes.axisXiMass}, {axes.axisMomentum}}}); + insertHist(histPath + "hMassLambda", "hMassLambda;Mass;Counts", kTH1F, {{axes.axisLambdaMass}}); + insertHist(histPath + "hMassXi", "hMassXi;Mass;Counts", kTH1F, {{axes.axisXiMass}}); + insertHist(histPath + "h2dMassXi", "h2dMassXi;Mass;Counts", kTH2F, {{axes.axisXiMass}, {axes.axisMomentum}}); // OTF strangeness tracking QA - insertHist(histPath + "hFoundVsFindable", "hFoundVsFindable;Found;Findable", {kTH2F, {{10, -0.5f, 9.5f}, {10, -0.5f, 9.5f}}}); - - insertHist(histPath + "h2dDCAxyCascade", "h2dDCAxyCascade;#it{p}_{T};DCA_{xy}", {kTH2F, {axes.axisMomentum, axes.axisDCA}}); - insertHist(histPath + "h2dDCAxyCascadeBachelor", "h2dDCAxyCascadeBachelor;#it{p}_{T};DCA_{xy}", {kTH2F, {axes.axisMomentum, axes.axisDCA}}); - insertHist(histPath + "h2dDCAxyCascadeNegative", "h2dDCAxyCascadeNegative;#it{p}_{T};DCA_{xy}", {kTH2F, {axes.axisMomentum, axes.axisDCA}}); - insertHist(histPath + "h2dDCAxyCascadePositive", "h2dDCAxyCascadePositive;#it{p}_{T};DCA_{xy}", {kTH2F, {axes.axisMomentum, axes.axisDCA}}); - - insertHist(histPath + "h2dDCAzCascade", "h2dDCAzCascade;#it{p}_{T};DCA_{z}", {kTH2F, {axes.axisMomentum, axes.axisDCA}}); - insertHist(histPath + "h2dDCAzCascadeBachelor", "h2dDCAzCascadeBachelor;#it{p}_{T};DCA_{z}", {kTH2F, {axes.axisMomentum, axes.axisDCA}}); - insertHist(histPath + "h2dDCAzCascadeNegative", "h2dDCAzCascadeNegative;#it{p}_{T};DCA_{z}", {kTH2F, {axes.axisMomentum, axes.axisDCA}}); - insertHist(histPath + "h2dDCAzCascadePositive", "h2dDCAzCascadePositive;#it{p}_{T};DCA_{z}", {kTH2F, {axes.axisMomentum, axes.axisDCA}}); - - insertHist(histPath + "h2dDeltaPtVsPt", "h2dDeltaPtVsPt;Gen p_{T};#Delta p_{T}", {kTH2F, {axes.axisMomentum, axes.axisDeltaPt}}); - insertHist(histPath + "h2dDeltaEtaVsPt", "h2dDeltaEtaVsPt;Gen p_{T};#Delta #eta", {kTH2F, {axes.axisMomentum, axes.axisDeltaEta}}); - - insertHist(histPath + "nSiliconHitsCascadeProngs", "nSiliconHitsCascadeProngs", {kTH1F, {{40, -0.5f, 39.5f}}}); - insertHist(histPath + "nTPCHitsCascadeProngs", "nTPCHitsCascadeProngs", {kTH1F, {{10, -0.5f, 9.5f}}}); - insertHist(histPath + "hFastTrackerHits", "hFastTrackerHits", {kTH2F, {axes.axisZ, axes.axisRadius}}); - insertHist(histPath + "hFastTrackerQA", "hFastTrackerQA", {kTH1F, {{8, -0.5f, 7.5f}}}); + insertHist(histPath + "hFoundVsFindable", "hFoundVsFindable;Found;Findable", kTH2F, {{10, -0.5f, 9.5f}, {10, -0.5f, 9.5f}}); + + insertHist(histPath + "h2dDCAxyCascade", "h2dDCAxyCascade;#it{p}_{T};DCA_{xy}", kTH2F, {axes.axisMomentum, axes.axisDCA}); + insertHist(histPath + "h2dDCAxyCascadeBachelor", "h2dDCAxyCascadeBachelor;#it{p}_{T};DCA_{xy}", kTH2F, {axes.axisMomentum, axes.axisDCA}); + insertHist(histPath + "h2dDCAxyCascadeNegative", "h2dDCAxyCascadeNegative;#it{p}_{T};DCA_{xy}", kTH2F, {axes.axisMomentum, axes.axisDCA}); + insertHist(histPath + "h2dDCAxyCascadePositive", "h2dDCAxyCascadePositive;#it{p}_{T};DCA_{xy}", kTH2F, {axes.axisMomentum, axes.axisDCA}); + insertHist(histPath + "h2dDCAzCascade", "h2dDCAzCascade;#it{p}_{T};DCA_{z}", kTH2F, {axes.axisMomentum, axes.axisDCA}); + insertHist(histPath + "h2dDCAzCascadeBachelor", "h2dDCAzCascadeBachelor;#it{p}_{T};DCA_{z}", kTH2F, {axes.axisMomentum, axes.axisDCA}); + insertHist(histPath + "h2dDCAzCascadeNegative", "h2dDCAzCascadeNegative;#it{p}_{T};DCA_{z}", kTH2F, {axes.axisMomentum, axes.axisDCA}); + insertHist(histPath + "h2dDCAzCascadePositive", "h2dDCAzCascadePositive;#it{p}_{T};DCA_{z}", kTH2F, {axes.axisMomentum, axes.axisDCA}); + + insertHist(histPath + "h2dDeltaPtVsPt", "h2dDeltaPtVsPt;Gen p_{T};#Delta p_{T}", kTH2F, {axes.axisMomentum, axes.axisDeltaPt}); + insertHist(histPath + "h2dDeltaEtaVsPt", "h2dDeltaEtaVsPt;Gen p_{T};#Delta #eta", kTH2F, {axes.axisMomentum, axes.axisDeltaEta}); + + insertHist(histPath + "nSiliconHitsCascadeProngs", "nSiliconHitsCascadeProngs", kTH1F, {{40, -0.5f, 39.5f}}); + insertHist(histPath + "nTPCHitsCascadeProngs", "nTPCHitsCascadeProngs", kTH1F, {{10, -0.5f, 9.5f}}); + insertHist(histPath + "hFastTrackerHits", "hFastTrackerHits", kTH2F, {axes.axisZ, axes.axisRadius}); + insertHist(histPath + "hFastTrackerQA", "hFastTrackerQA", kTH1F, {{8, -0.5f, 7.5f}}); getHist(histPath + "hFastTrackerQA")->GetXaxis()->SetBinLabel(1, "Negative eigenvalue"); getHist(histPath + "hFastTrackerQA")->GetXaxis()->SetBinLabel(2, "Failed sanity check"); getHist(histPath + "hFastTrackerQA")->GetXaxis()->SetBinLabel(3, "intercept original radius"); @@ -593,31 +592,31 @@ struct OnTheFlyTracker { } if (doExtraQA) { - insertHist(histPath + "h2dPtRes", "h2dPtRes;Gen p_{T};#Delta p_{T} / Reco p_{T}", {kTH2D, {{axes.axisMomentum, axes.axisPtRes}}}); - insertHist(histPath + "h2dPtResAbs", "h2dPtResAbs;Gen p_{T};#Delta p_{T}", {kTH2D, {{axes.axisMomentum, axes.axisPtRes}}}); - insertHist(histPath + "h2dDCAxy", "h2dDCAxy;p_{T};DCA_{xy}", {kTH2D, {{axes.axisMomentum, axes.axisDCA}}}); - insertHist(histPath + "h2dDCAz", "h2dDCAz;p_{T};DCA_{z}", {kTH2D, {{axes.axisMomentum, axes.axisDCA}}}); + insertHist(histPath + "h2dPtRes", "h2dPtRes;Gen p_{T};#Delta p_{T} / Reco p_{T}", kTH2D, {{axes.axisMomentum, axes.axisPtRes}}); + insertHist(histPath + "h2dPtResAbs", "h2dPtResAbs;Gen p_{T};#Delta p_{T}", kTH2D, {{axes.axisMomentum, axes.axisPtRes}}); + insertHist(histPath + "h2dDCAxy", "h2dDCAxy;p_{T};DCA_{xy}", kTH2D, {{axes.axisMomentum, axes.axisDCA}}); + insertHist(histPath + "h2dDCAz", "h2dDCAz;p_{T};DCA_{z}", kTH2D, {{axes.axisMomentum, axes.axisDCA}}); } if (brSettings.doBRQA) { - insertHist(histPath + "h1dNBRPhotons", "h1dNBRPhotons;N_{#gamma};Counts", {kTH1D, {{axes.axisNphotons}}}); - insertHist(histPath + "h1dBREnergyLoss", "h1dBREnergyLoss;#Delta p / p;Counts", {kTH1D, {{axes.axisBRenergyLoss}}}); + insertHist(histPath + "h1dNBRPhotons", "h1dNBRPhotons;N_{#gamma};Counts", kTH1D, {{axes.axisNphotons}}); + insertHist(histPath + "h1dBREnergyLoss", "h1dBREnergyLoss;#Delta p / p;Counts", kTH1D, {{axes.axisBRenergyLoss}}); - insertHist(histPath + "h2dBRPtRes", "h2dPtRes;Gen p_{T};#Delta p_{T} / Reco p_{T}", {kTH2D, {{axes.axisMomentum, axes.axisPtRes}}}); - insertHist(histPath + "h2dBRPtResAbs", "h2dPtResAbs;Gen p_{T};#Delta p_{T}", {kTH2D, {{axes.axisMomentum, axes.axisPtRes}}}); + insertHist(histPath + "h2dBRPtRes", "h2dPtRes;Gen p_{T};#Delta p_{T} / Reco p_{T}", kTH2D, {{axes.axisMomentum, axes.axisPtRes}}); + insertHist(histPath + "h2dBRPtResAbs", "h2dPtResAbs;Gen p_{T};#Delta p_{T}", kTH2D, {{axes.axisMomentum, axes.axisPtRes}}); } if (doprocessDecayer) { - insertHist(histPath + "h2dPrimaryPtRes", "h2dPrimaryPtRes;Gen p_{T};#Delta p_{T} / Reco p_{T}", {kTH2D, {{axes.axisMomentum, axes.axisPtRes}}}); - insertHist(histPath + "h2dSecondaryPtRes", "h2dSecondaryPtRes;Gen p_{T};#Delta p_{T} / Reco p_{T}", {kTH2D, {{axes.axisMomentum, axes.axisPtRes}}}); - insertHist(histPath + "h2dPrimaryElPtRes", "h2dPrimaryElPtRes;Gen p_{T};#Delta p_{T} / Reco p_{T}", {kTH2D, {{axes.axisMomentum, axes.axisPtRes}}}); - insertHist(histPath + "h2dSecondaryElPtRes", "h2dSecondaryElPtRes;Gen p_{T};#Delta p_{T} / Reco p_{T}", {kTH2D, {{axes.axisMomentum, axes.axisPtRes}}}); - insertHist(histPath + "h2dPrimaryPiPtRes", "h2dPrimaryPiPtRes;Gen p_{T};#Delta p_{T} / Reco p_{T}", {kTH2D, {{axes.axisMomentum, axes.axisPtRes}}}); - insertHist(histPath + "h2dSecondaryPiPtRes", "h2dSecondaryPiPtRes;Gen p_{T};#Delta p_{T} / Reco p_{T}", {kTH2D, {{axes.axisMomentum, axes.axisPtRes}}}); - insertHist(histPath + "h2dPrimaryKaPtRes", "h2dPrimaryKaPtRes;Gen p_{T};#Delta p_{T} / Reco p_{T}", {kTH2D, {{axes.axisMomentum, axes.axisPtRes}}}); - insertHist(histPath + "h2dSecondaryKaPtRes", "h2dSecondaryKaPtRes;Gen p_{T};#Delta p_{T} / Reco p_{T}", {kTH2D, {{axes.axisMomentum, axes.axisPtRes}}}); - insertHist(histPath + "h2dPrimaryPrPtRes", "h2dPrimaryPrPtRes;Gen p_{T};#Delta p_{T} / Reco p_{T}", {kTH2D, {{axes.axisMomentum, axes.axisPtRes}}}); - insertHist(histPath + "h2dSecondaryPrPtRes", "h2dSecondaryPrPtRes;Gen p_{T};#Delta p_{T} / Reco p_{T}", {kTH2D, {{axes.axisMomentum, axes.axisPtRes}}}); + insertHist(histPath + "h2dPrimaryPtRes", "h2dPrimaryPtRes;Gen p_{T};#Delta p_{T} / Reco p_{T}", kTH2D, {{axes.axisMomentum, axes.axisPtRes}}); + insertHist(histPath + "h2dSecondaryPtRes", "h2dSecondaryPtRes;Gen p_{T};#Delta p_{T} / Reco p_{T}", kTH2D, {{axes.axisMomentum, axes.axisPtRes}}); + insertHist(histPath + "h2dPrimaryElPtRes", "h2dPrimaryElPtRes;Gen p_{T};#Delta p_{T} / Reco p_{T}", kTH2D, {{axes.axisMomentum, axes.axisPtRes}}); + insertHist(histPath + "h2dSecondaryElPtRes", "h2dSecondaryElPtRes;Gen p_{T};#Delta p_{T} / Reco p_{T}", kTH2D, {{axes.axisMomentum, axes.axisPtRes}}); + insertHist(histPath + "h2dPrimaryPiPtRes", "h2dPrimaryPiPtRes;Gen p_{T};#Delta p_{T} / Reco p_{T}", kTH2D, {{axes.axisMomentum, axes.axisPtRes}}); + insertHist(histPath + "h2dSecondaryPiPtRes", "h2dSecondaryPiPtRes;Gen p_{T};#Delta p_{T} / Reco p_{T}", kTH2D, {{axes.axisMomentum, axes.axisPtRes}}); + insertHist(histPath + "h2dPrimaryKaPtRes", "h2dPrimaryKaPtRes;Gen p_{T};#Delta p_{T} / Reco p_{T}", kTH2D, {{axes.axisMomentum, axes.axisPtRes}}); + insertHist(histPath + "h2dSecondaryKaPtRes", "h2dSecondaryKaPtRes;Gen p_{T};#Delta p_{T} / Reco p_{T}", kTH2D, {{axes.axisMomentum, axes.axisPtRes}}); + insertHist(histPath + "h2dPrimaryPrPtRes", "h2dPrimaryPrPtRes;Gen p_{T};#Delta p_{T} / Reco p_{T}", kTH2D, {{axes.axisMomentum, axes.axisPtRes}}); + insertHist(histPath + "h2dSecondaryPrPtRes", "h2dSecondaryPrPtRes;Gen p_{T};#Delta p_{T} / Reco p_{T}", kTH2D, {{axes.axisMomentum, axes.axisPtRes}}); } } // end config loop From 581b374219b83679fcf1909c1d0de3f3e52d1c90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Fri, 21 Aug 2026 16:20:59 +0200 Subject: [PATCH 6/6] Update insertHist to include title and axis specs --- ALICE3/TableProducer/OTF/onTheFlyTracker.cxx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx b/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx index cc12010021a..0deff6d1c8e 100644 --- a/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx +++ b/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx @@ -420,10 +420,9 @@ struct OnTheFlyTracker { std::get>(it->second)->Fill(std::forward(args)...); } - template - void insertHist(const std::string& name, Args&&... args) + void insertHist(const std::string& name, const std::string& title, HistType type, std::vector axisSpecs) { - histPointers[name] = histos.add(name.c_str(), std::forward(args)...); + histPointers[name] = histos.add(name.c_str(), title.c_str(), type, axisSpecs); } void init(o2::framework::InitContext& initContext)