From 8688485f50580fa7bbbbdaacf25aed44db321958 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Kr=C3=BCger?= Date: Mon, 23 Nov 2026 23:08:51 +0100 Subject: [PATCH] [PWGLF] chargedParticles: own DCA cuts relative to the resolution, pileup and matching QA, ITS-only multiplicity option - DCA cuts applied in the task instead of the central track selection: |DCA| < k sigma(pT), sigma = p0 + p1 / pT^p2 (Run 3: core width measured in pp data, used for all systems; Run 2: the cuts of the central global track selection); k = 7 (xy) and 10 (z); systematic variants vary k to 4 / 10 (xy) and 6 / 14 (z) - multPtSpec_trk_pileup_meas: selected tracks from other MC collisions - QA: eta-phi of selected tracks; ITS-TPC matching of the other tracks in collisions with 2-4 candidates (Run 3) - multEstimator: option to count ITS-only tracks in the measured multiplicity, spectra unchanged - per-run efficiency QA: true-multiplicity axis coarser above 100, run bin looked up once per collision --- PWGLF/Tasks/Nuspex/chargedParticles.cxx | 236 ++++++++++++++++++++---- 1 file changed, 205 insertions(+), 31 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/chargedParticles.cxx b/PWGLF/Tasks/Nuspex/chargedParticles.cxx index 062ab0a5bd3..ed794669f8c 100644 --- a/PWGLF/Tasks/Nuspex/chargedParticles.cxx +++ b/PWGLF/Tasks/Nuspex/chargedParticles.cxx @@ -116,6 +116,7 @@ struct ChargedParticles { // NOLINT(clang-analyzer-optin.performance.Padding): o Configurable etaCut{"etaCut", 0.8f, "eta cut"}; Configurable ptRange{"ptRange", "nominal", "pt window and binning of tracks and particles: nominal (0.15-10), lowPt (0.05-10, low field), highPt (0.15-50)"}; Configurable fiducialMult{"fiducialMult", true, "count n_ch (measured and true, and so the event class fiducial) only in the fiducial window 0.15 < pt < 10, whatever ptRange"}; + Configurable multEstimator{"multEstimator", 0, "measured multiplicity: 0 = selected tracks (ITS-TPC), 1 = also ITS-only tracks that pass all other selections (spectra stay ITS-TPC)"}; static constexpr float FiducialPtMin = 0.15f; static constexpr float FiducialPtMax = 10.f; float ptMin{FiducialPtMin}; // from ptRange @@ -159,9 +160,29 @@ struct ChargedParticles { // NOLINT(clang-analyzer-optin.performance.Padding): o int phiRunBin{0}; // qa: run bin of qa/tracks/phiRun (0 = no run label yet) int lastEvSelRunNumber{-1}; // qa: run label of the per-run cut flow (all candidates, not only accepted events) std::string evSelRunLabel; - std::string mcRunLabel; // qa: run of the current mc collision (per-run efficiencies) + std::string mcRunLabel; // qa: run of the current mc collision (per-run efficiencies) + std::array primGenRunX{}; // qa: x of the run bin of qa/tracks/primGenRun per class, set once per mc collision + std::array primRecoRunX{}; // qa: same for qa/tracks/primRecoRun, set once per reco collision Configurable evSelBits{"evSelBits", "auto", "event selection bits on top of sel8 (names as in EventSelectionParams), comma separated; auto = default of the collision system (currently kNoSameBunchPileup for all)"}; Configurable maxVtxZ{"maxVtxZ", 10.f, "max |z| of the reco and true vertex"}; + // own dca cuts |dca| < k * sigma(pt), sigma = p0 + p1 / pt^p2 (cm), k fixed for the analysis; run 3: measured + // resolution; run 2 (converted data): the dca cuts of the central global track selection (dca_xy 0.0105 + 0.035 / + // pt^1.1, dca_z 2 cm) + struct DcaPars { + float p0{0.f}; + float p1{0.f}; + float p2{1.f}; + }; + static constexpr DcaPars DefaultDcaXY{.p0 = 0.0015f, .p1 = 0.005f, .p2 = 1.1f}; + static constexpr DcaPars DefaultDcaZ{.p0 = 0.2f, .p1 = 0.f, .p2 = 1.f}; + static constexpr float NSigmaDcaXY = 7.f; // as in run 2; variations 4, 10 + static constexpr float NSigmaDcaZ = 10.f; // variations 6, 14 + DcaPars dcaCutXY{}; // cut = p0 + p1 / pt^p2, i.e. k * sigma (from init) + DcaPars dcaCutZ{}; + // run 3 dca resolution: core width of pp 13.6 tev data (2026, lhc26ac), used for all systems (within 20 % in pp at + // low field, o-o and pb-pb mc) + static constexpr DcaPars DcaResRun3XY{.p0 = 0.0006405f, .p1 = 0.002207f, .p2 = 0.950f}; + static constexpr DcaPars DcaResRun3Z{.p0 = 0.0005770f, .p1 = 0.002423f, .p2 = 0.9414f}; uint64_t evSelMask{0}; std::vector evSelBitList; // configured bits in the given order (cut-flow) std::vector trackCutBits; // single cuts of the track selection mask (track qa) @@ -183,13 +204,13 @@ struct ChargedParticles { // NOLINT(clang-analyzer-optin.performance.Padding): o kSystDownTPCCrossedRowsOverNCls, // 105 kSystUpTPCCrossedRowsOverNCls, // 106 kSystDownTPCFracSharedCls, // 107 - kSystDownDCAxy = 111, - kSystUpDCAxy, // 112 - kSystDownDCAz, // 113 - kSystUpDCAz, // 114 - kSystITSHits, // 115, only relevant for converted data - kSystDownTPCCrossedRows, // 116 - kSystUpTPCCrossedRows, // 117 + kSystDownDCAxy = 111, // 4 sigma (nominal 7) + kSystUpDCAxy, // 112, 10 sigma + kSystDownDCAz, // 113, 6 sigma (nominal 10) + kSystUpDCAz, // 114, 14 sigma + kSystITSHits, // 115, only relevant for converted data + kSystDownTPCCrossedRows, // 116 + kSystUpTPCCrossedRows, // 117 kSystDownPCC = 120, kSystUpPCC, // 121 kSystDownVtxZ = 130, // |z| < 7 cm (reco and true vertex) @@ -244,6 +265,18 @@ struct ChargedParticles { // NOLINT(clang-analyzer-optin.performance.Padding): o template void processMeas(const T& tracks, bool isRepresentative = true); + template + void fillMatchQA(const T& tracks); + template + bool isItsOnlyCandidate(const T& track); + template + bool passesDcaXY(const T& track) const; + template + bool passesDcaZ(const T& track) const; + static bool isTpcCut(TrackSelection::TrackCuts cut) + { + return cut == TrackSelection::TrackCuts::kTPCNCls || cut == TrackSelection::TrackCuts::kTPCCrossedRows || cut == TrackSelection::TrackCuts::kTPCCrossedRowsOverNCls || cut == TrackSelection::TrackCuts::kTPCChi2NDF || cut == TrackSelection::TrackCuts::kTPCRefit || cut == TrackSelection::TrackCuts::kTPCFracSharedCls; + } template void processTrue(const P& particles); @@ -465,6 +498,12 @@ void ChargedParticles::init(InitContext& ic) histos.add("QA/tracks/signed1Pt", "", kTH1D, {{200, -8., 8., "q/#it{p}_{T}"}}); histos.add("QA/tracks/eta", "", kTH1D, {{180, -0.9, 0.9, "#eta"}}); histos.add("QA/tracks/phi", "", kTH1D, {{180, 0., o2::constants::math::TwoPI, "#phi (rad)"}}); + histos.add("QA/tracks/etaPhi", "", kTH2D, {{16, -0.8, 0.8, "#eta"}, {180, 0., o2::constants::math::TwoPI, "#phi (rad)"}}); // acceptance holes: tpc (phi stripes) vs its (eta-phi patches) + const AxisSpec matchPtAxis{std::vector{0.15, 0.5, 1., 2., 5., 10.}, "#it{p}_{T} of a selected track (GeV/#it{c})"}; + const AxisSpec matchCandAxis{3, 1.5, 4.5, "candidates (selected + ITS-only)"}; + const AxisSpec matchOtherAxis{std::vector{0.15, 0.5, 10.}, "#it{p}_{T} of another candidate (GeV/#it{c})"}; + histos.add("QA/tracks/matchOthersSelected", "", kTH3D, {matchPtAxis, matchCandAxis, matchOtherAxis}); // its-tpc matching of the other tracks vs a selected track, collisions with 2-4 candidates: other candidate selected + histos.add("QA/tracks/matchOthersItsOnly", "", kTH3D, {matchPtAxis, matchCandAxis, matchOtherAxis}); // same, other candidate its-only histos.add("QA/tracks/phiRun", "", kTH2D, {{180, 0., o2::constants::math::TwoPI, "#phi (rad)"}, {512, 0., 512.}}); // run axis labelled as runStatistics histos.add("QA/tracks/itsNCls", "", kTH1D, {{8, -0.5, 7.5, "# clusters ITS"}}); histos.add("QA/tracks/itsHits", "", kTH1D, {{7, -0.5, 6.5, "layer ITS"}}); @@ -527,6 +566,20 @@ void ChargedParticles::init(InitContext& ic) const int nBinsMultTrue = maxMultTrue + 1; const AxisSpec multTrueAxis = {nBinsMultTrue, -0.5, nBinsMultTrue - 0.5, "#it{N}_{ch}", "mult_true"}; + // per-run qa: unit bins up to n_ch = 100, then about 50 equal bins (keeps the 512-run histograms small in pb-pb) + constexpr int MaxUnitBinsRun = 100; + constexpr int NCoarseBinsRun = 50; + std::vector runMultEdges; + for (int i = 0; i <= std::min(maxMultTrue, MaxUnitBinsRun) + 1; ++i) { + runMultEdges.push_back(i - 0.5); + } + if (maxMultTrue > MaxUnitBinsRun) { + const int step = (maxMultTrue - MaxUnitBinsRun + NCoarseBinsRun - 1) / NCoarseBinsRun; + while (runMultEdges.back() < maxMultTrue + 0.5) { + runMultEdges.push_back(runMultEdges.back() + step); + } + } + const AxisSpec runMultTrueAxis{runMultEdges, "#it{N}_{ch}", "mult_true_run"}; histos.add("collision_ambiguity", "", kTH1D, {{6, -0.5, 5.5, "reco collisions per true collision"}}); // log the number of collisions that were reconstructed for a MC collision histos.add("track_ambiguity", "", kTH1D, {{6, 0.5, 6.5, "reco tracks per true particle"}}); // log the number of tracks that were reconstructed for a MC particle @@ -552,6 +605,7 @@ void ChargedParticles::init(InitContext& ic) histos.add((dir + "multPtSpec_prim_meas").c_str(), "", kTH2D, {multTrueAxis, ptTrueAxis}); // measured primary charged particles as function of true properties (no contamination from background events) histos.add((dir + "multPtSpec_trk_prim_meas").c_str(), "", kTH2D, {multMeasAxis, ptMeasAxis}); // tracks from measured primaries (no contamination from secondaries, particles smeared into acceptance or background events) histos.add((dir + "multPtSpec_trk_sec_meas").c_str(), "", kTH2D, {multMeasAxis, ptMeasAxis}); // tracks from measured secondaries (no contamination from particles smeared into acceptance or background events) [for QA to disentangle secondaries from other contamination] + histos.add((dir + "multPtSpec_trk_pileup_meas").c_str(), "", kTH2D, {multMeasAxis, ptMeasAxis}); // tracks from other mc collisions (pileup) in measured events of the class [for QA to disentangle pileup from other contamination] histos.add((dir + "multPtSpec_trk_meas_evtcont").c_str(), "", kTH2D, {multMeasAxis, ptMeasAxis}); // tracks from events that are measured, but do not belong to the desired class of events histos.add((dir + "multPtSpec_trk_inter").c_str(), "", kTH2D, {multTrueAxis, ptMeasAxis}); if (isNominal) { @@ -559,8 +613,8 @@ void ChargedParticles::init(InitContext& ic) histos.add((dir + "QA/events/eventSelectionMC").c_str(), "", kTH1D, {{NStagesMC, -0.5, NStagesMC - 0.5}}); histos.add((dir + "QA/tracks/deltaPt").c_str(), "", kTH2D, {ptMeasAxis, {relResEdges, "#Delta(#it{p}_{T}) / #it{p}^{ meas}_{T}"}}); // event and tracking efficiency per run, as in the unfolding (run axis labelled as runStatistics) - histos.add((dir + "QA/events/evtGenRun").c_str(), "", kTH2D, {{512, 0., 512.}, multTrueAxis}); - histos.add((dir + "QA/events/evtRecoRun").c_str(), "", kTH2D, {{512, 0., 512.}, multTrueAxis}); + histos.add((dir + "QA/events/evtGenRun").c_str(), "", kTH2D, {{512, 0., 512.}, runMultTrueAxis}); + histos.add((dir + "QA/events/evtRecoRun").c_str(), "", kTH2D, {{512, 0., 512.}, runMultTrueAxis}); histos.add((dir + "QA/tracks/primGenRun").c_str(), "", kTH2D, {{512, 0., 512.}, ptTrueAxis}); histos.add((dir + "QA/tracks/primRecoRun").c_str(), "", kTH2D, {{512, 0., 512.}, ptTrueAxis}); } @@ -617,6 +671,9 @@ void ChargedParticles::init(InitContext& ic) if (ptRange.value != "nominal") { metaLabel += ", ptRange " + ptRange.value + ", fiducialMult " + (fiducialMult.value ? "true" : "false"); } + if (multEstimator.value != 0) { + metaLabel += ", multEstimator " + std::to_string(multEstimator.value); + } if (doprocessMC || doprocessMCnoPCC) { metaLabel += ", " + eventClasses.value; forEachDir([&](auto dir) { @@ -660,22 +717,8 @@ void ChargedParticles::init(InitContext& ic) } else if (systMode == kSystDownTPCFracSharedCls) { trackSel.SetMaxTPCFractionSharedCls(0.4f); // not in the nominal mask: nothing to remove from it trackSelFlag = TrackSelection::TrackCuts::kTPCFracSharedCls; - } else if (systMode == kSystDownDCAxy) { - trackSel.SetMaxDcaXYPtDep([](float pt) { return 4. / 7. * (0.0105f + 0.0350f / std::pow(pt, 1.1f)); }); - cutVarFlag = TrackSelectionFlags::kDCAxy; - trackSelFlag = TrackSelection::TrackCuts::kDCAxy; - } else if (systMode == kSystUpDCAxy) { - trackSel.SetMaxDcaXYPtDep([](float pt) { return 10. / 7. * (0.0105f + 0.0350f / std::pow(pt, 1.1f)); }); - cutVarFlag = TrackSelectionFlags::kDCAxy; - trackSelFlag = TrackSelection::TrackCuts::kDCAxy; - } else if (systMode == kSystDownDCAz) { - trackSel.SetMaxDcaZ(1.0); - cutVarFlag = TrackSelectionFlags::kDCAz; - trackSelFlag = TrackSelection::TrackCuts::kDCAz; - } else if (systMode == kSystUpDCAz) { - trackSel.SetMaxDcaZ(5.0); - cutVarFlag = TrackSelectionFlags::kDCAz; - trackSelFlag = TrackSelection::TrackCuts::kDCAz; + } else if (systMode == kSystDownDCAxy || systMode == kSystUpDCAxy || systMode == kSystDownDCAz || systMode == kSystUpDCAz) { + // own dca cuts with another number of sigmas (below) } else if (systMode == kSystITSHits) { trackSel.ResetITSRequirements(); cutVarFlag = TrackSelectionFlags::kITSHits; @@ -697,6 +740,31 @@ void ChargedParticles::init(InitContext& ic) } isCutVar = (cutVarFlag != 0) || (systMode == kSystDownTPCFracSharedCls); trackSelMask &= (~cutVarFlag); + + // own dca cuts replace the dca bits of the central track selection + trackSelMask &= ~(TrackSelectionFlags::kDCAxy | TrackSelectionFlags::kDCAz); + float nSigmaXY = NSigmaDcaXY; + float nSigmaZ = NSigmaDcaZ; + if (systMode == kSystDownDCAxy) { + nSigmaXY = 4.f; + } else if (systMode == kSystUpDCAxy) { + nSigmaXY = 10.f; + } else if (systMode == kSystDownDCAz) { + nSigmaZ = 6.f; + } else if (systMode == kSystUpDCAz) { + nSigmaZ = 14.f; + } + const DcaPars resXY = isRun3 ? DcaResRun3XY : DefaultDcaXY; + const DcaPars resZ = isRun3 ? DcaResRun3Z : DefaultDcaZ; + dcaCutXY = {.p0 = nSigmaXY * resXY.p0, .p1 = nSigmaXY * resXY.p1, .p2 = resXY.p2}; + dcaCutZ = {.p0 = nSigmaZ * resZ.p0, .p1 = nSigmaZ * resZ.p1, .p2 = resZ.p2}; + + if (multEstimator.value != 0 && multEstimator.value != 1) { + LOGP(fatal, "invalid multEstimator {} (0 = selected tracks, 1 = also its-only tracks)", multEstimator.value); + } + if (multEstimator.value == 1 && !isRun3) { + LOGP(fatal, "multEstimator 1 (its-only tracks) is defined for run 3 only"); + } } //************************************************************************************************** @@ -851,6 +919,45 @@ uint32_t ChargedParticles::getTrackRepetitions(const T& track, bool& isValidPart return 1u; } +//************************************************************************************************** +/** + * ITS-only track (run 3): no TPC, passes every selection that does not concern the TPC (with the varied cut of a + * systematic variant, if not a TPC cut) and the optional dca_z cut, in the eta/pt and multiplicity window. + */ +//************************************************************************************************** +template +bool ChargedParticles::isItsOnlyCandidate(const T& track) +{ + if (track.hasTPC() || std::abs(track.eta()) >= etaCut || track.pt() <= ptMin || track.pt() >= ptMax || !isInMultWindow(track.pt())) { + return false; + } + constexpr uint32_t TpcBits = TrackSelectionFlags::kTPCNCls | TrackSelectionFlags::kTPCCrossedRows | TrackSelectionFlags::kTPCCrossedRowsOverNCls | TrackSelectionFlags::kTPCChi2NDF | TrackSelectionFlags::kTPCRefit; + if (((~static_cast(track.trackCutFlag())) & trackSelMask & ~TpcBits) != 0) { + return false; + } + if (!passesDcaXY(track) || !passesDcaZ(track)) { + return false; + } + return !(isCutVar && !isTpcCut(trackSelFlag) && !trackSel.IsSelected(track, trackSelFlag)); +} + +//************************************************************************************************** +/** + * Own DCA cuts |DCA| < k * sigma(pT) (dcaCutXY, dcaCutZ = k * parameters; same arithmetic as the central selection). + */ +//************************************************************************************************** +template +bool ChargedParticles::passesDcaXY(const T& track) const +{ + return std::fabs(track.dcaXY()) <= dcaCutXY.p0 + dcaCutXY.p1 / std::pow(track.pt(), dcaCutXY.p2); +} + +template +bool ChargedParticles::passesDcaZ(const T& track) const +{ + return std::fabs(track.dcaZ()) <= dcaCutZ.p0 + dcaCutZ.p1 / std::pow(track.pt(), dcaCutZ.p2); +} + //************************************************************************************************** /** * Check if track is good. @@ -868,6 +975,9 @@ bool ChargedParticles::initTrack(const T& track) if (!TrackSelectionFlags::checkFlag(track.trackCutFlag(), trackSelMask)) { return false; } + if (!passesDcaXY(track) || !passesDcaZ(track)) { + return false; + } // for systematic variation of standard selections, check if the varied cut is passed if (isCutVar && !trackSel.IsSelected(track, trackSelFlag)) { return false; @@ -886,8 +996,9 @@ void ChargedParticles::initEvent(const C& collision, const T& tracks) vars.multMeas = 0; bool isValidParticle{false}; for (const auto& track : tracks) { - if (initTrack(track) && isInMultWindow(track.pt())) { - // same definition in data and mc: every selected track counts + // same definition in data and mc: every selected track counts + // multEstimator 1: also its-only candidates + if ((initTrack(track) && isInMultWindow(track.pt())) || (multEstimator.value == 1 && isItsOnlyCandidate(track))) { vars.multMeas += getTrackRepetitions(track, isValidParticle); } } @@ -978,7 +1089,13 @@ void ChargedParticles::fillTrackCutQA(const T& track) } const auto flags = track.trackCutFlag(); const int nCuts = trackCutBits.size(); - const auto passes = [&](int bit) { return (flags & (1 << bit)) != 0; }; + const int dcaXYBit = static_cast(TrackSelection::TrackCuts::kDCAxy); + const int dcaZBit = static_cast(TrackSelection::TrackCuts::kDCAz); + const bool ownDcaXY = passesDcaXY(track); + const bool ownDcaZ = passesDcaZ(track); + const auto passes = [&](int bit) { // dca bits: own cuts + return bit == dcaXYBit ? ownDcaXY : (bit == dcaZBit ? ownDcaZ : (flags & (1 << bit)) != 0); + }; int nFailed = 0; int failedBit = -1; for (const auto& bit : trackCutBits) { @@ -1047,6 +1164,7 @@ void ChargedParticles::fillTrackQA(const T& track) histos.fill(HIST("QA/tracks/signed1Pt"), track.signed1Pt()); histos.fill(HIST("QA/tracks/eta"), track.eta()); histos.fill(HIST("QA/tracks/phi"), track.phi()); + histos.fill(HIST("QA/tracks/etaPhi"), track.eta(), track.phi()); if (phiRunBin > 0) { histos.fill(HIST("QA/tracks/phiRun"), track.phi(), phiRunBin - 0.5); } @@ -1181,6 +1299,8 @@ void ChargedParticles::processTrue(const P& particles) histos.fill(HIST(ClassDir[Dir]) + HIST("multDist_evt_gen"), vars.multTrue); if (fillRunQA) { histos.get(HIST(ClassDir[Dir]) + HIST("QA/events/evtGenRun"))->Fill(mcRunLabel.c_str(), vars.multTrue, 1.); + auto* axis = histos.get(HIST(ClassDir[Dir]) + HIST("QA/tracks/primGenRun"))->GetXaxis(); + primGenRunX[Dir] = axis->GetBinCenter(axis->FindBin(mcRunLabel.c_str())); // adds the label once per run } if (vars.isTriggeredMC) { histos.fill(HIST(ClassDir[Dir]) + HIST("multDist_evt_gen_trig"), vars.multTrue); @@ -1198,7 +1318,7 @@ void ChargedParticles::processTrue(const P& particles) if (!vars.isAcceptedEvent) { histos.fill(HIST(ClassDir[Dir]) + HIST("multPtSpec_prim_gen_evtloss"), vars.multTrue, particle.pt()); } else if (fillRunQA) { - histos.get(HIST(ClassDir[Dir]) + HIST("QA/tracks/primGenRun"))->Fill(mcRunLabel.c_str(), particle.pt(), 1.); + histos.fill(HIST(ClassDir[Dir]) + HIST("QA/tracks/primGenRun"), primGenRunX[Dir], particle.pt()); } } }); @@ -1210,6 +1330,49 @@ void ChargedParticles::processTrue(const P& particles) } } +//************************************************************************************************** +/** + * ITS-TPC matching QA: in collisions with 2-4 candidates (selected tracks and ITS-only tracks), for every selected + * track the other candidates, matched or not. + */ +//************************************************************************************************** +template +void ChargedParticles::fillMatchQA(const T& tracks) +{ + constexpr size_t MinCandidates = 2; + constexpr size_t MaxCandidates = 4; + std::array selectedPt{}, itsOnlyPt{}; + size_t nSelected = 0, nItsOnly = 0; + for (const auto& track : tracks) { + const bool isSelected = initTrack(track) && isInMultWindow(track.pt()); + if (!isSelected && !isItsOnlyCandidate(track)) { + continue; + } + if (nSelected + nItsOnly == MaxCandidates) { + return; // more than 4 candidates + } + if (isSelected) { + selectedPt[nSelected++] = track.pt(); + } else { + itsOnlyPt[nItsOnly++] = track.pt(); + } + } + const size_t nCandidates = nSelected + nItsOnly; + if (nCandidates < MinCandidates) { + return; + } + for (size_t i = 0; i < nSelected; ++i) { + for (size_t j = 0; j < nSelected; ++j) { + if (j != i) { + histos.fill(HIST("QA/tracks/matchOthersSelected"), selectedPt[i], nCandidates, selectedPt[j]); + } + } + for (size_t j = 0; j < nItsOnly; ++j) { + histos.fill(HIST("QA/tracks/matchOthersItsOnly"), selectedPt[i], nCandidates, itsOnlyPt[j]); + } + } +} + //************************************************************************************************** /** * Function to process reconstructed data and MC. Assumes initEvent (and initEventMC in case of MC) have been called previously. @@ -1221,6 +1384,9 @@ void ChargedParticles::processMeas(const T& tracks, bool isRepresentative) if (!vars.isAcceptedEvent) { return; } + if (isNominal && isRun3) { // its-only = no tpc: run 3 tracking + fillMatchQA(tracks); + } // mc: only the representative collision corresponds to the true event (per event class) [[maybe_unused]] auto isTrueEvent = [&](int dir) { return isRepresentative && isInDir(dir); }; @@ -1233,6 +1399,8 @@ void ChargedParticles::processMeas(const T& tracks, bool isRepresentative) histos.fill(HIST(ClassDir[Dir]) + HIST("multCorrel_evt"), vars.multMeas, vars.multTrue); if (isNominal && isRun3) { histos.get(HIST(ClassDir[Dir]) + HIST("QA/events/evtRecoRun"))->Fill(mcRunLabel.c_str(), vars.multTrue, 1.); + auto* axis = histos.get(HIST(ClassDir[Dir]) + HIST("QA/tracks/primRecoRun"))->GetXaxis(); + primRecoRunX[Dir] = axis->GetBinCenter(axis->FindBin(mcRunLabel.c_str())); // adds the label once per run } } }); @@ -1254,6 +1422,10 @@ void ChargedParticles::processMeas(const T& tracks, bool isRepresentative) // all fills repeated as often as the particle (pcc) bool isValidParticle{false}; const uint32_t nRepetitions = getTrackRepetitions(track, isValidParticle); + [[maybe_unused]] bool isPileup{false}; // particle from another mc collision + if constexpr (IS_MC) { + isPileup = track.has_mcParticle() && track.template mcParticle_as

().mcCollisionId() != vars.mcCollisionIndex; + } if (isNominal) { for (auto i = 0u; i < nRepetitions; ++i) { fillTrackQA(track); @@ -1309,10 +1481,12 @@ void ChargedParticles::processMeas(const T& tracks, bool isRepresentative) histos.fill(HIST(ClassDir[Dir]) + HIST("ptCorrel_prim"), track.pt(), particle.pt()); histos.fill(HIST(ClassDir[Dir]) + HIST("multPtSpec_prim_meas"), vars.multTrue, particle.pt()); if (isNominal && isRun3) { - histos.get(HIST(ClassDir[Dir]) + HIST("QA/tracks/primRecoRun"))->Fill(mcRunLabel.c_str(), particle.pt(), 1.); + histos.fill(HIST(ClassDir[Dir]) + HIST("QA/tracks/primRecoRun"), primRecoRunX[Dir], particle.pt()); } histos.fill(HIST(ClassDir[Dir]) + HIST("multPtSpec_trk_prim_meas"), vars.multMeas, track.pt()); } + } else if (isPileup) { + histos.fill(HIST(ClassDir[Dir]) + HIST("multPtSpec_trk_pileup_meas"), vars.multMeas, track.pt()); } }); }