From 2c699ec25acc71e38cfdf2cac21236f67bbd4722 Mon Sep 17 00:00:00 2001 From: Maria Paula Martins Palhares Date: Thu, 23 Oct 2025 16:15:40 +0200 Subject: [PATCH 1/3] Add kNoTISROFrameBorder condition to study margin effects in qaMatchEff and fixed sayPrim. --- DPG/Tasks/AOTTrack/qaMatchEff.cxx | 223 ++++++++++++++++-------------- 1 file changed, 116 insertions(+), 107 deletions(-) diff --git a/DPG/Tasks/AOTTrack/qaMatchEff.cxx b/DPG/Tasks/AOTTrack/qaMatchEff.cxx index 4b6d3e87d13..e419d104472 100644 --- a/DPG/Tasks/AOTTrack/qaMatchEff.cxx +++ b/DPG/Tasks/AOTTrack/qaMatchEff.cxx @@ -19,58 +19,40 @@ // // Internal version number: 6.3 // - -#include "Common/CCDB/EventSelectionParams.h" #include "Common/Core/TrackSelection.h" #include "Common/Core/TrackSelectionDefaults.h" -#include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/PIDResponseTOF.h" -#include "Common/DataModel/PIDResponseTPC.h" +#include "Common/DataModel/Centrality.h" #include "Common/DataModel/TrackSelectionTables.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include -#include -#include -#include -#include +#include "Common/DataModel/PIDResponse.h" +#include "CommonConstants/MathConstants.h" +#include "CCDB/BasicCCDBManager.h" +#include "Common/Core/RecoDecay.h" +// +#include "Framework/AnalysisTask.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/runDataProcessing.h" +// #include #include - +#include +#include +#include +// namespace extConfPar { -static constexpr int nParDCA = 1; -static constexpr int nParVaDCA = 2; +static constexpr int NParDCA = 1; +static constexpr int NParVaDCA = 2; static const std::vector parClassDCA{"TrVtx"}; static const std::vector parNameDCA{"dcaXY", "dcaZ"}; -static const float parTableDCA[nParDCA][nParVaDCA]{{9999.f, 99999.f}}; -static constexpr int nParPID = 2; -static constexpr int nParVaPID = 6; +static const float parTableDCA[NParDCA][NParVaDCA]{{9999.f, 99999.f}}; +static constexpr int NParPID = 2; +static constexpr int NParVaPID = 6; +static constexpr int kNumberOfITSLayers = 7; + static const std::vector parClassPID{"TPC", "TOF"}; static const std::vector parNamePID{"nSigPionMin", "nSigPionMax", "nSigKaonMin", "nSigKaonMax", "nSigProtonMin", "nSigProtonMax"}; -static const float parTablePID[nParPID][nParVaPID]{ +static const float parTablePID[NParPID][NParVaPID]{ {-99999.f, 999999.f, -99999.f, 999999.f, -99999.f, 999999.f}, {-99999.f, 999999.f, -99999.f, 999999.f, -99999.f, 999999.f}}; } // namespace extConfPar @@ -95,7 +77,6 @@ using TracksIUPID = soa::Join; using MCTracksIU = soa::Join; -// struct qaMatchEff { int lastRunNumber = -1; bool timeMonitorSetUp = false; @@ -151,8 +132,8 @@ struct qaMatchEff { // // // DCA and PID cuts - Configurable> dcaMaxCut{"dcaMaxCut", {parTableDCA[0], nParDCA, nParVaDCA, parClassDCA, parNameDCA}, "Track DCA cuts"}; - Configurable> nSigmaPID{"nSigmaPID", {parTablePID[0], nParPID, nParVaPID, parClassPID, parNamePID}, "PID nSigma cuts TPC and TOF"}; + Configurable> dcaMaxCut{"dcaMaxCut", {parTableDCA[0], NParDCA, NParVaDCA, parClassDCA, parNameDCA}, "Track DCA cuts"}; + Configurable> nSigmaPID{"nSigmaPID", {parTablePID[0], NParPID, NParVaPID, parClassPID, parNamePID}, "PID nSigma cuts TPC and TOF"}; // TPC Configurable tpcNClusterMin{"tpcNClusterMin", 0, "Minimum number of clusters in TPC"}; Configurable tpcNCrossedRowsMin{"tpcNCrossedRowsMin", 70, "Minimum number of crossed rows in TPC"}; @@ -166,21 +147,21 @@ struct qaMatchEff { // TRD presence Configurable isTRDThere{"isTRDThere", 2, "Integer to turn the presence of TRD off, on, don't care (0,1,anything else)"}; Configurable isTOFThere{"isTOFThere", 2, "Integer to turn the presence of TOF off, on, don't care (0,1,anything else)"}; - // + Configurable isitMC{"isitMC", false, "Reading MC files, data if false"}; Configurable doDebug{"doDebug", false, "Flag of debug information"}; // Histogram configuration - // + // histos bins Configurable etaBins{"eta-bins", 40, "Number of eta bins"}; Configurable phiBins{"phi-bins", 18, "Number of phi bins"}; Configurable qoptBins{"qopt-bins", 500, "Number of Q/pt bins"}; - // + // special histo, few particles explicitly stored, then pdg>3000 Configurable pdgBins{"pdg-bins", 14, "Number of pdg values counted"}; - // + // histo axes - // + ConfigurableAxis ptBins{"ptBins", {100, 0.f, 20.f}, "pT binning"}; ConfigurableAxis XBins{"XBins", {400, -2.f, 2.f}, "X binning"}; ConfigurableAxis ZBins{"ZBins", {400, -20.f, 20.f}, "Z binning"}; @@ -193,23 +174,21 @@ struct qaMatchEff { // pdg codes vector std::vector pdgChoice = {211, 213, 215, 217, 219, 221, 223, 321, 411, 521, 2212, 1114, 2214}; - // // Tracks selection object TrackSelection cutObject; - // + // do you want pt comparison 2d's ? Configurable makept2d{"makept2d", false, "choose if produce pt reco/TPC derived pt 2dims "}; - // + // common flags for PID Configurable isPIDPionRequired{"isPIDPionRequired", false, "choose if apply pion PID"}; Configurable isPIDKaonRequired{"isPIDKaonRequired", false, "choose if apply kaon PID"}; Configurable isPIDProtonRequired{"isPIDProtonRequired", false, "choose if apply proton PID"}; - // + // limit for z position of primary vertex Configurable zPrimVtxMax{"zPrimVtxax", 999.f, "Maximum asbolute value of z of primary vertex"}; - // // configuration for THnSparse's - // + ConfigurableAxis thnd0{"thnd0", {150, -3.0f, 3.0f}, "impact parameter in xy [cm]"}; ConfigurableAxis thndz{"thndz", {150, -10.0f, 10.0f}, "impact parameter in z [cm]"}; ConfigurableAxis thnPt{"thnPt", {80, 0.0f, 20.0f}, "pt [GeV/c]"}; @@ -271,7 +250,7 @@ struct qaMatchEff { cutObject.SetMaxChi2PerClusterITS(itsChi2Max); // ITS hitmap std::set set_customITShitmap; // = {}; - for (int index_ITSlayer = 0; index_ITSlayer < 7; index_ITSlayer++) { + for (int index_ITSlayer = 0; index_ITSlayer < kNumberOfITSLayers; index_ITSlayer++) { if ((customITShitmap & (1 << index_ITSlayer)) > 0) { set_customITShitmap.insert(static_cast(index_ITSlayer)); } @@ -310,7 +289,7 @@ struct qaMatchEff { } if (customAnaTrkSel.isChangeAnalysisITSHitmap) { std::set set_customITShitmap; // = {}; - for (int index_ITSlayer = 0; index_ITSlayer < 7; index_ITSlayer++) { + for (int index_ITSlayer = 0; index_ITSlayer < kNumberOfITSLayers; index_ITSlayer++) { if ((customITShitmap & (1 << index_ITSlayer)) > 0) { set_customITShitmap.insert(static_cast(index_ITSlayer)); } @@ -1412,7 +1391,7 @@ struct qaMatchEff { /// Using pt calculated at the inner wall of TPC /// Caveat: tgl still from tracking: this is not the value of tgl at the /// inner wall of TPC - return track.tpcInnerParam() / sqrt(1.f + track.tgl() * track.tgl()); + return track.tpcInnerParam() / std::sqrt(1.f + track.tgl() * track.tgl()); } /// Function applying the kinematic selections @@ -1525,7 +1504,7 @@ struct qaMatchEff { float hasdet = -999.f; // // - for (auto& track : tracks) { + for (const auto& track : tracks) { // choose if we keep the track according to the TRD presence requirement if ((isTRDThere == 1) && !track.hasTRD()) continue; @@ -1566,7 +1545,8 @@ struct qaMatchEff { // // here n of clusters of TPC assigned to float for histos (and to hack it if needed) :) // - Float_t clustpc = (Float_t)track.tpcNClsFound(); + float clustpc = track.tpcNClsFound(); + // Float_t findcltpc = (Float_t)track.tpcNClsFindable(); // Float_t crowstpc = (Float_t)track.tpcNClsCrossedRows(); // Float_t finclusmincrotpc = (Float_t)track.tpcNClsFindableMinusCrossedRows(); @@ -1583,7 +1563,7 @@ struct qaMatchEff { countData++; // // keep sign of track - Int_t signOfTrack = track.signed1Pt() > 0 ? 1 : -1; + int signOfTrack = track.signed1Pt() > 0 ? 1 : -1; // // PID sigmas if constexpr (!IS_MC) { @@ -1621,18 +1601,18 @@ struct qaMatchEff { if constexpr (IS_MC) { auto mcpart = track.mcParticle(); siPDGCode = mcpart.pdgCode(); - tpPDGCode = TMath::Abs(siPDGCode); - if (mcpart.isPhysicalPrimary()) { + tpPDGCode = std::abs(siPDGCode); + //if (mcpart.isPhysicalPrimary()) { // histos.get(HIST("MC/control/etahist_diff"))->Fill(mcpart.eta() - track.eta()); - auto delta = mcpart.phi() - track.phi(); - if (delta > PI) { - delta -= TwoPI; - } - if (delta < -PI) { - delta += TwoPI; - } + // auto delta = RecoDecay::constrainAngle(mcpart.phi() - track.phi()); + // if (delta > o2::constants::math::PI) { + // delta -= o2::constants::math::TwoPI; + // } + // if (delta < o2::constants::math::PI) { + // delta += o2::constants::math::TwoPI; + // } // histos.get(HIST("MC/control/phihist_diff"))->Fill(delta); - } + //} /// MC info for THnSparse filling sayPrim = -99; @@ -1705,7 +1685,7 @@ struct qaMatchEff { if (makethn) { if constexpr (IS_MC) { histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet); - if (siPDGCode == 211 || siPDGCode == 321) // pions and kaons together + if (siPDGCode == PDG_t::kPiPlus|| siPDGCode == PDG_t::kKPlus) // pions and kaons together histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), 10, signOfTrack, hasdet); } else { histos.fill(HIST("data/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet); @@ -1722,7 +1702,7 @@ struct qaMatchEff { if (makethn) { if constexpr (IS_MC) { histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet); - if (siPDGCode == 211 || siPDGCode == 321) // pions and kaons together + if (siPDGCode == PDG_t::kPiPlus|| siPDGCode == PDG_t::kKPlus) // pions and kaons together histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), 10, signOfTrack, hasdet); } else { histos.fill(HIST("data/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet); @@ -1739,7 +1719,7 @@ struct qaMatchEff { if (makethn) { if constexpr (IS_MC) { histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet); - if (siPDGCode == 211 || siPDGCode == 321) // pions and kaons together + if (siPDGCode == PDG_t::kPiPlus|| siPDGCode == PDG_t::kKPlus) // pions and kaons together histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), 10, signOfTrack, hasdet); } else { histos.fill(HIST("data/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet); @@ -1756,7 +1736,7 @@ struct qaMatchEff { if (makethn) { if constexpr (IS_MC) { histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet); - if (siPDGCode == 211 || siPDGCode == 321) // pions and kaons together + if (siPDGCode == PDG_t::kPiPlus|| siPDGCode == PDG_t::kKPlus) // pions and kaons together histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), 10, signOfTrack, hasdet); } else { histos.fill(HIST("data/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet); @@ -1773,7 +1753,7 @@ struct qaMatchEff { if (makethn) { if constexpr (IS_MC) { histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet); - if (siPDGCode == 211 || siPDGCode == 321) // pions and kaons together + if (siPDGCode == PDG_t::kPiPlus|| siPDGCode == PDG_t::kKPlus) // pions and kaons together histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), 10, signOfTrack, hasdet); } else { histos.fill(HIST("data/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet); @@ -1790,7 +1770,7 @@ struct qaMatchEff { if (makethn) { if constexpr (IS_MC) { histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet); - if (siPDGCode == 211 || siPDGCode == 321) // pions and kaons together + if (siPDGCode == PDG_t::kPiPlus|| siPDGCode == PDG_t::kKPlus) // pions and kaons together histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), 10, signOfTrack, hasdet); } else { histos.fill(HIST("data/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet); @@ -1807,7 +1787,7 @@ struct qaMatchEff { if (makethn) { if constexpr (IS_MC) { histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet); - if (siPDGCode == 211 || siPDGCode == 321) // pions and kaons together + if (siPDGCode == PDG_t::kPiPlus|| siPDGCode == PDG_t::kKPlus) // pions and kaons together histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), 10, signOfTrack, hasdet); } else { histos.fill(HIST("data/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet); @@ -1824,7 +1804,7 @@ struct qaMatchEff { if (makethn) { if constexpr (IS_MC) { histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet); - if (siPDGCode == 211 || siPDGCode == 321) // pions and kaons together + if (siPDGCode == PDG_t::kPiPlus|| siPDGCode == PDG_t::kKPlus) // pions and kaons together histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), 10, signOfTrack, hasdet); } else { histos.fill(HIST("data/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet); @@ -1841,7 +1821,7 @@ struct qaMatchEff { if (makethn) { if constexpr (IS_MC) { histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet); - if (siPDGCode == 211 || siPDGCode == 321) // pions and kaons together + if (siPDGCode == PDG_t::kPiPlus|| siPDGCode == PDG_t::kKPlus) // pions and kaons together histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), 10, signOfTrack, hasdet); } else { histos.fill(HIST("data/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet); @@ -1858,7 +1838,7 @@ struct qaMatchEff { if (makethn) { if constexpr (IS_MC) { histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet); - if (siPDGCode == 211 || siPDGCode == 321) // pions and kaons together + if (siPDGCode == PDG_t::kPiPlus|| siPDGCode == PDG_t::kKPlus) // pions and kaons together histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), 10, signOfTrack, hasdet); } else { histos.fill(HIST("data/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet); @@ -1875,7 +1855,7 @@ struct qaMatchEff { if (makethn) { if constexpr (IS_MC) { histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet); - if (siPDGCode == 211 || siPDGCode == 321) // pions and kaons together + if (siPDGCode == PDG_t::kPiPlus|| siPDGCode == PDG_t::kKPlus) // pions and kaons together histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), 10, signOfTrack, hasdet); } else { histos.fill(HIST("data/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet); @@ -1910,19 +1890,19 @@ struct qaMatchEff { // TPC clusters all pions MC truth // - if (tpPDGCode == 211) { + if (tpPDGCode == PDG_t::kPiPlus) { histos.get(HIST("MC/TPCclust/tpcNClsFound_piMC"))->Fill(clustpc); // histos.get(HIST("MC/TPCclust/tpcNClsFindable_piMC"))->Fill(findcltpc); // histos.get(HIST("MC/TPCclust/tpcCrossedRows_piMC"))->Fill(crowstpc); // histos.get(HIST("MC/TPCclust/tpcsFindableMinusCrossedRows_piMC"))->Fill(crowstpc); } - if (tpPDGCode == 321) { + if (tpPDGCode == PDG_t::kKPlus) { histos.get(HIST("MC/TPCclust/tpcNClsFound_kaMC"))->Fill(clustpc); // histos.get(HIST("MC/TPCclust/tpcNClsFindable_kaMC"))->Fill(findcltpc); // histos.get(HIST("MC/TPCclust/tpcCrossedRows_kaMC"))->Fill(crowstpc); // histos.get(HIST("MC/TPCclust/tpcsFindableMinusCrossedRows_kaMC"))->Fill(crowstpc); } - if (tpPDGCode == 2212) { + if (tpPDGCode == PDG_t::kProton) { histos.get(HIST("MC/TPCclust/tpcNClsFound_prMC"))->Fill(clustpc); // histos.get(HIST("MC/TPCclust/tpcNClsFindable_prMC"))->Fill(findcltpc); // histos.get(HIST("MC/TPCclust/tpcCrossedRows_prMC"))->Fill(crowstpc); @@ -2963,7 +2943,7 @@ struct qaMatchEff { } // end if secondaries from material // // protons only - if (tpPDGCode == 2212) { + if (tpPDGCode == PDG_t::kProton) { if (trkWTPC && isTrackSelectedTPCCuts(track)) { // // TPC clusters @@ -3031,7 +3011,7 @@ struct qaMatchEff { } // // pions only - if (tpPDGCode == 211) { + if (tpPDGCode == PDG_t::kPiPlus) { if (trkWTPC && isTrackSelectedTPCCuts(track)) { // // TPC clusters @@ -3141,7 +3121,7 @@ struct qaMatchEff { } // end pions only // // no primary/sec-d pions - if (!((tpPDGCode == 211) && (mcpart.isPhysicalPrimary()))) { + if (!((tpPDGCode == PDG_t::kPiPlus) && (mcpart.isPhysicalPrimary()))) { // gets the pdg code and finds its index in our vector itr_pdg = std::find(pdgChoice.begin(), pdgChoice.end(), tpPDGCode); if (itr_pdg != pdgChoice.cend()) @@ -3166,7 +3146,7 @@ struct qaMatchEff { } // end if not prim/sec-d pi // // kaons only - if (tpPDGCode == 321) { + if (tpPDGCode == PDG_t::kKPlus) { if (trkWTPC && isTrackSelectedTPCCuts(track)) { // // TPC clusters @@ -3234,7 +3214,7 @@ struct qaMatchEff { } // // pions and kaons together - if (tpPDGCode == 211 || tpPDGCode == 321) { + if (tpPDGCode == PDG_t::kPiPlus || tpPDGCode == PDG_t::kKPlus) { if (trkWTPC && isTrackSelectedTPCCuts(track)) { histos.get(HIST("MC/PID/pthist_tpc_piK"))->Fill(trackPt); histos.get(HIST("MC/PID/phihist_tpc_piK"))->Fill(track.phi()); @@ -3318,10 +3298,17 @@ struct qaMatchEff { ////////////////////////////////////////////// void processMC(CollisionsEvSel::iterator const& collision, soa::Join const& tracks, aod::McParticles const& mcParticles) { - if (isEnableEventSelection && !collision.sel8()) { - if (doDebug) - LOGF(info, "Event selection not passed, skipping..."); - return; + if (isEnableEventSelection) { + if (!collision.selection_bit(aod::evsel::kIsTriggerTVX) && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { + if (doDebug) + LOGF(info, "Event selection not passed to TriggerTVX and TFBorder, skipping..."); + return; + } + if (!collision.selection_bit(aod::evsel::kNoITSROFrameBorder)) { + if (doDebug) + LOGF(info, "Event selection not passed to ITSROFrame border, skipping..."); + return; + } } fillHistograms(tracks, mcParticles, mcParticles); /// 3rd argument non-sense in this case fillGeneralHistos(collision); @@ -3338,10 +3325,17 @@ struct qaMatchEff { LOGF(warning, "Centrality not defined for pp collision type, return..."); return; } - if (isEnableEventSelection && !collision.sel8()) { - if (doDebug) - LOGF(info, "Event selection not passed, skipping..."); - return; + if (isEnableEventSelection) { + if (!collision.selection_bit(aod::evsel::kIsTriggerTVX) && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { + if (doDebug) + LOGF(info, "Event selection not passed to TriggerTVX and TFBorder, skipping..."); + return; + } + if (!collision.selection_bit(aod::evsel::kNoITSROFrameBorder)) { + if (doDebug) + LOGF(info, "Event selection not passed to ITSROFrame border, skipping..."); + return; + } } float centrality = collision.centFT0C(); if (isCentralityRequired) { @@ -3365,7 +3359,7 @@ struct qaMatchEff { if (doDebug) LOGF(info, "Event selection not passed, skipping..."); return; - } + } fillHistograms(tracks, mcParticles, mcParticles); /// 3rd argument non-sense in this case fillGeneralHistos(collision); } @@ -3389,10 +3383,17 @@ struct qaMatchEff { // tracks.rawIteratorAt(0).collision().bc_as().timestamp(); /// NB: in ms setUpTimeMonitoring(bcs); } - if (isEnableEventSelection && !collision.sel8()) { - if (doDebug) - LOGF(info, "Event selection not passed, skipping..."); - return; + if (isEnableEventSelection) { + if (!collision.selection_bit(aod::evsel::kIsTriggerTVX) && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { + if (doDebug) + LOGF(info, "Event selection not passed to TriggerTVX and TFBorder, skipping..."); + return; + } + if (!collision.selection_bit(aod::evsel::kNoITSROFrameBorder)) { + if (doDebug) + LOGF(info, "Event selection not passed to ITSROFrame border, skipping..."); + return; + } } fillHistograms(tracks, tracks, bcs); // 2nd argument not used in this case fillGeneralHistos(collision); @@ -3412,10 +3413,17 @@ struct qaMatchEff { if (enableMonitorVsTime) { setUpTimeMonitoring(bcs); } - if (isEnableEventSelection && !collision.sel8()) { - if (doDebug) - LOGF(info, "Event selection not passed, skipping..."); - return; + if (isEnableEventSelection) { + if (!collision.selection_bit(aod::evsel::kIsTriggerTVX) && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { + if (doDebug) + LOGF(info, "Event selection not passed to TriggerTVX and TFBorder, skipping..."); + return; + } + if (!collision.selection_bit(aod::evsel::kNoITSROFrameBorder)) { + if (doDebug) + LOGF(info, "Event selection not passed to ITSROFrame border, skipping..."); + return; + } } const float centrality = collision.centFT0C(); const int occupancy = collision.trackOccupancyInTimeRange(); @@ -3454,7 +3462,7 @@ struct qaMatchEff { if (doDebug) LOGF(info, "Event selection not passed, skipping..."); return; - } + } fillHistograms(tracks, tracks, tracks); // 2nd and 3rd arguments not used in this case fillGeneralHistos(collision); } @@ -3478,3 +3486,4 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) return WorkflowSpec{ adaptAnalysisTask(cfgc, TaskName{"qa-match-eff"})}; } + From 9e05467b841a3f0a48d1e20a74283b9e058c3290 Mon Sep 17 00:00:00 2001 From: Maria Paula Martins Palhares Date: Wed, 29 Oct 2025 10:43:33 +0100 Subject: [PATCH 2/3] Enable histogram filling for the difference between true and generated eta and phi of primary particles. --- DPG/Tasks/AOTTrack/qaMatchEff.cxx | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/DPG/Tasks/AOTTrack/qaMatchEff.cxx b/DPG/Tasks/AOTTrack/qaMatchEff.cxx index e419d104472..d025ff1cb79 100644 --- a/DPG/Tasks/AOTTrack/qaMatchEff.cxx +++ b/DPG/Tasks/AOTTrack/qaMatchEff.cxx @@ -1602,17 +1602,15 @@ struct qaMatchEff { auto mcpart = track.mcParticle(); siPDGCode = mcpart.pdgCode(); tpPDGCode = std::abs(siPDGCode); - //if (mcpart.isPhysicalPrimary()) { - // histos.get(HIST("MC/control/etahist_diff"))->Fill(mcpart.eta() - track.eta()); - // auto delta = RecoDecay::constrainAngle(mcpart.phi() - track.phi()); - // if (delta > o2::constants::math::PI) { - // delta -= o2::constants::math::TwoPI; - // } - // if (delta < o2::constants::math::PI) { - // delta += o2::constants::math::TwoPI; - // } - // histos.get(HIST("MC/control/phihist_diff"))->Fill(delta); - //} + if (mcpart.isPhysicalPrimary()) { + histos.get(HIST("MC/control/etahist_diff"))->Fill(mcpart.eta() - track.eta()); + auto delta = RecoDecay::constrainAngle(mcpart.phi() - track.phi()); + if (delta > o2::constants::math::PI) { + delta -= o2::constants::math::TwoPI;} + if (delta < o2::constants::math::PI) { + delta += o2::constants::math::TwoPI;} + histos.get(HIST("MC/control/phihist_diff"))->Fill(delta); + } /// MC info for THnSparse filling sayPrim = -99; From 6b27a5ee692eb9c7f2fa3dd163be4afb74b0ae95 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Wed, 29 Oct 2025 09:57:06 +0000 Subject: [PATCH 3/3] Please consider the following formatting changes --- DPG/Tasks/AOTTrack/qaMatchEff.cxx | 59 ++++++++++++++++--------------- 1 file changed, 31 insertions(+), 28 deletions(-) diff --git a/DPG/Tasks/AOTTrack/qaMatchEff.cxx b/DPG/Tasks/AOTTrack/qaMatchEff.cxx index d025ff1cb79..cf8903650e7 100644 --- a/DPG/Tasks/AOTTrack/qaMatchEff.cxx +++ b/DPG/Tasks/AOTTrack/qaMatchEff.cxx @@ -19,25 +19,27 @@ // // Internal version number: 6.3 // +#include "Common/Core/RecoDecay.h" #include "Common/Core/TrackSelection.h" #include "Common/Core/TrackSelectionDefaults.h" -#include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Centrality.h" -#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/DataModel/EventSelection.h" #include "Common/DataModel/PIDResponse.h" -#include "CommonConstants/MathConstants.h" +#include "Common/DataModel/TrackSelectionTables.h" + #include "CCDB/BasicCCDBManager.h" -#include "Common/Core/RecoDecay.h" +#include "CommonConstants/MathConstants.h" // #include "Framework/AnalysisTask.h" #include "Framework/RunningWorkflowInfo.h" #include "Framework/runDataProcessing.h" // +#include + +#include +#include #include #include -#include -#include -#include // namespace extConfPar { @@ -147,21 +149,21 @@ struct qaMatchEff { // TRD presence Configurable isTRDThere{"isTRDThere", 2, "Integer to turn the presence of TRD off, on, don't care (0,1,anything else)"}; Configurable isTOFThere{"isTOFThere", 2, "Integer to turn the presence of TOF off, on, don't care (0,1,anything else)"}; - + Configurable isitMC{"isitMC", false, "Reading MC files, data if false"}; Configurable doDebug{"doDebug", false, "Flag of debug information"}; // Histogram configuration - + // histos bins Configurable etaBins{"eta-bins", 40, "Number of eta bins"}; Configurable phiBins{"phi-bins", 18, "Number of phi bins"}; Configurable qoptBins{"qopt-bins", 500, "Number of Q/pt bins"}; - + // special histo, few particles explicitly stored, then pdg>3000 Configurable pdgBins{"pdg-bins", 14, "Number of pdg values counted"}; - + // histo axes - + ConfigurableAxis ptBins{"ptBins", {100, 0.f, 20.f}, "pT binning"}; ConfigurableAxis XBins{"XBins", {400, -2.f, 2.f}, "X binning"}; ConfigurableAxis ZBins{"ZBins", {400, -20.f, 20.f}, "Z binning"}; @@ -1606,9 +1608,11 @@ struct qaMatchEff { histos.get(HIST("MC/control/etahist_diff"))->Fill(mcpart.eta() - track.eta()); auto delta = RecoDecay::constrainAngle(mcpart.phi() - track.phi()); if (delta > o2::constants::math::PI) { - delta -= o2::constants::math::TwoPI;} + delta -= o2::constants::math::TwoPI; + } if (delta < o2::constants::math::PI) { - delta += o2::constants::math::TwoPI;} + delta += o2::constants::math::TwoPI; + } histos.get(HIST("MC/control/phihist_diff"))->Fill(delta); } @@ -1683,7 +1687,7 @@ struct qaMatchEff { if (makethn) { if constexpr (IS_MC) { histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet); - if (siPDGCode == PDG_t::kPiPlus|| siPDGCode == PDG_t::kKPlus) // pions and kaons together + if (siPDGCode == PDG_t::kPiPlus || siPDGCode == PDG_t::kKPlus) // pions and kaons together histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), 10, signOfTrack, hasdet); } else { histos.fill(HIST("data/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet); @@ -1700,7 +1704,7 @@ struct qaMatchEff { if (makethn) { if constexpr (IS_MC) { histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet); - if (siPDGCode == PDG_t::kPiPlus|| siPDGCode == PDG_t::kKPlus) // pions and kaons together + if (siPDGCode == PDG_t::kPiPlus || siPDGCode == PDG_t::kKPlus) // pions and kaons together histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), 10, signOfTrack, hasdet); } else { histos.fill(HIST("data/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet); @@ -1717,7 +1721,7 @@ struct qaMatchEff { if (makethn) { if constexpr (IS_MC) { histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet); - if (siPDGCode == PDG_t::kPiPlus|| siPDGCode == PDG_t::kKPlus) // pions and kaons together + if (siPDGCode == PDG_t::kPiPlus || siPDGCode == PDG_t::kKPlus) // pions and kaons together histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), 10, signOfTrack, hasdet); } else { histos.fill(HIST("data/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet); @@ -1734,7 +1738,7 @@ struct qaMatchEff { if (makethn) { if constexpr (IS_MC) { histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet); - if (siPDGCode == PDG_t::kPiPlus|| siPDGCode == PDG_t::kKPlus) // pions and kaons together + if (siPDGCode == PDG_t::kPiPlus || siPDGCode == PDG_t::kKPlus) // pions and kaons together histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), 10, signOfTrack, hasdet); } else { histos.fill(HIST("data/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet); @@ -1751,7 +1755,7 @@ struct qaMatchEff { if (makethn) { if constexpr (IS_MC) { histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet); - if (siPDGCode == PDG_t::kPiPlus|| siPDGCode == PDG_t::kKPlus) // pions and kaons together + if (siPDGCode == PDG_t::kPiPlus || siPDGCode == PDG_t::kKPlus) // pions and kaons together histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), 10, signOfTrack, hasdet); } else { histos.fill(HIST("data/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet); @@ -1768,7 +1772,7 @@ struct qaMatchEff { if (makethn) { if constexpr (IS_MC) { histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet); - if (siPDGCode == PDG_t::kPiPlus|| siPDGCode == PDG_t::kKPlus) // pions and kaons together + if (siPDGCode == PDG_t::kPiPlus || siPDGCode == PDG_t::kKPlus) // pions and kaons together histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), 10, signOfTrack, hasdet); } else { histos.fill(HIST("data/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet); @@ -1785,7 +1789,7 @@ struct qaMatchEff { if (makethn) { if constexpr (IS_MC) { histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet); - if (siPDGCode == PDG_t::kPiPlus|| siPDGCode == PDG_t::kKPlus) // pions and kaons together + if (siPDGCode == PDG_t::kPiPlus || siPDGCode == PDG_t::kKPlus) // pions and kaons together histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), 10, signOfTrack, hasdet); } else { histos.fill(HIST("data/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet); @@ -1802,7 +1806,7 @@ struct qaMatchEff { if (makethn) { if constexpr (IS_MC) { histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet); - if (siPDGCode == PDG_t::kPiPlus|| siPDGCode == PDG_t::kKPlus) // pions and kaons together + if (siPDGCode == PDG_t::kPiPlus || siPDGCode == PDG_t::kKPlus) // pions and kaons together histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), 10, signOfTrack, hasdet); } else { histos.fill(HIST("data/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet); @@ -1819,7 +1823,7 @@ struct qaMatchEff { if (makethn) { if constexpr (IS_MC) { histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet); - if (siPDGCode == PDG_t::kPiPlus|| siPDGCode == PDG_t::kKPlus) // pions and kaons together + if (siPDGCode == PDG_t::kPiPlus || siPDGCode == PDG_t::kKPlus) // pions and kaons together histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), 10, signOfTrack, hasdet); } else { histos.fill(HIST("data/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet); @@ -1836,7 +1840,7 @@ struct qaMatchEff { if (makethn) { if constexpr (IS_MC) { histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet); - if (siPDGCode == PDG_t::kPiPlus|| siPDGCode == PDG_t::kKPlus) // pions and kaons together + if (siPDGCode == PDG_t::kPiPlus || siPDGCode == PDG_t::kKPlus) // pions and kaons together histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), 10, signOfTrack, hasdet); } else { histos.fill(HIST("data/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet); @@ -1853,7 +1857,7 @@ struct qaMatchEff { if (makethn) { if constexpr (IS_MC) { histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet); - if (siPDGCode == PDG_t::kPiPlus|| siPDGCode == PDG_t::kKPlus) // pions and kaons together + if (siPDGCode == PDG_t::kPiPlus || siPDGCode == PDG_t::kKPlus) // pions and kaons together histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), 10, signOfTrack, hasdet); } else { histos.fill(HIST("data/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet); @@ -3357,7 +3361,7 @@ struct qaMatchEff { if (doDebug) LOGF(info, "Event selection not passed, skipping..."); return; - } + } fillHistograms(tracks, mcParticles, mcParticles); /// 3rd argument non-sense in this case fillGeneralHistos(collision); } @@ -3460,7 +3464,7 @@ struct qaMatchEff { if (doDebug) LOGF(info, "Event selection not passed, skipping..."); return; - } + } fillHistograms(tracks, tracks, tracks); // 2nd and 3rd arguments not used in this case fillGeneralHistos(collision); } @@ -3484,4 +3488,3 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) return WorkflowSpec{ adaptAnalysisTask(cfgc, TaskName{"qa-match-eff"})}; } -