From f6e49e81bcaa794d29d2d95641f68c027643c73f Mon Sep 17 00:00:00 2001 From: Maria Paula Martins Palhares Date: Wed, 11 Mar 2026 11:23:09 +0100 Subject: [PATCH 1/3] Changed track selection: nTPCClus -> ntpcNClsCrossedRows and fix EvtSel --- PWGLF/TableProducer/Nuspex/lnnRecoTask.cxx | 163 +++++++++++---------- 1 file changed, 85 insertions(+), 78 deletions(-) diff --git a/PWGLF/TableProducer/Nuspex/lnnRecoTask.cxx b/PWGLF/TableProducer/Nuspex/lnnRecoTask.cxx index 5f7de80eff7..72ec61d9d25 100644 --- a/PWGLF/TableProducer/Nuspex/lnnRecoTask.cxx +++ b/PWGLF/TableProducer/Nuspex/lnnRecoTask.cxx @@ -87,6 +87,8 @@ std::shared_ptr h2FT0CnClusTPCtoTrBfSel; std::shared_ptr h2FT0CnClusTPCtoPiBfSel; std::shared_ptr h2FT0Cchi2NClTPCtoTrBfSel; std::shared_ptr h2FT0Cchi2NClITStoTrBfSel; +std::shared_ptr h2FT0CnTPCNClsCrossedRows3HBfSel; +std::shared_ptr h2FT0CnTPCNClsCrossedRowsPiBfSel; // QA ITS-TPC and ITS-TPC-TOF track signals std::shared_ptr h2FT0CptTrBfSelItsTpc; std::shared_ptr h2FT0CptTrBfSelItsTpcTof; @@ -101,14 +103,9 @@ std::shared_ptr hPtTrkItsTpcTofTrStr; std::shared_ptr hPtItsTpcPiStr; std::shared_ptr hPtTrkItsTpcPiStr; // QA reco generated candidate and daugher particles from secondary vertex -std::shared_ptr h2FT0CPtGenColRecoGenCandMC; -std::shared_ptr h2FT0CPtGenColRecoGenTrStrMC; -std::shared_ptr h2FT0CPtGenColRecoGenPiStrMC; -std::shared_ptr h2FT0CPtRecColRecoGenCandMC; -std::shared_ptr h2FT0CPtRecColRecoGenTrStrMC; -std::shared_ptr h2FT0CPtRecColRecoGenPiStrMC; -std::shared_ptr h2FT0CPtRecColRecoTrStrMC; -std::shared_ptr h2FT0CPtRecColRecoPiStrMC; +std::shared_ptr h2FT0CPtGenColRecCandMC; +std::shared_ptr h2FT0CPtGenColRecTrStrMC; +std::shared_ptr h2FT0CPtGenColRecPiStrMC; // QA signal generated candidate and daugher particles from secondary vertex std::shared_ptr h2FT0CPtGenColGenCandMC; std::shared_ptr h2FT0CPtGenColGenTrStrMC; @@ -200,13 +197,16 @@ struct lnnRecoTask { Configurable tpcRigidityMin3H{"tpcRigidityMin3H", 0.2, "Minimum rigidity of the triton candidate"}; Configurable nSigmaCutMinTPC{"nSigmaCutMinTPC", -5, "triton dEdx cut (n sigma)"}; Configurable nSigmaCutMaxTPC{"nSigmaCutMaxTPC", 5, "triton dEdx cut (n sigma)"}; + Configurable nTPCNClsCrossedRows3H{"nTPCNClsCrossedRows3H", 80, "Number of crossed TPC Rows for triton"}; + Configurable nTPCNClsCrossedRowsPi{"nTPCNClsCrossedRowsPi", 80, "Number of crossed TPC Rows for pions"}; Configurable nTPCClusMin3H{"nTPCClusMin3H", 80, "triton NTPC clusters cut"}; Configurable nTPCClusMinPi{"nTPCClusMinPi", 60, "pion NTPC clusters cut"}; Configurable ptMinTOF{"ptMinTOF", 0.8, "minimum pt for TOF cut"}; Configurable trTOFMass2Cut{"trTOFMass2Cut", 5.5, "minimum Triton mass square to TOF"}; Configurable betaTrTOF{"betaTrTOF", 0.4, "minimum beta TOF cut"}; Configurable mcSignalOnly{"mcSignalOnly", true, "If true, save only signal in MC"}; - Configurable doTrackQA{"doTrackQA", true, "If true, compute the QA studies beased on detectors (ITS-TPC-TOF) signals"}; + Configurable doTrackQA{"doTrackQA", true, "if true, compute the QA studies beased on detectors (ITS-TPC-TOF) signals"}; + Configurable useNoSameBunchPileup{"useNoSameBunchPileup", false, "reject collisions in case of pileup with another collision in the same foundBC"}; // Define o2 fitter, 2-prong, active memory (no need to redefine per event) o2::vertexing::DCAFitterN<2> fitter; @@ -247,6 +247,7 @@ struct lnnRecoTask { ConfigurableAxis betaBins{"betaBins", {550, 0.f, 1.1f}, "Binning for Beta"}; ConfigurableAxis dcaXYBins{"dcaXYBins", {550, -5.f, 5.f}, "Binning for dcaXY triton"}; ConfigurableAxis tpcNClusBins{"tpcNClusBins", {260, 30, 165}, "Binning for nClusTPC"}; + ConfigurableAxis tpcNClsCrossedRowsBins{"TPCNClsCrossedRowsBins", {260, 30, 165}, "Binning for TPCNClsCrossedRows"}; ConfigurableAxis tpcChi2NClusBins{"tpcChi2NClusBins", {20, 0.5, 10}, "Binning for chi2NClusTPC"}; ConfigurableAxis itsChi2NClusBins{"itsChi2NClusBins", {72, 0, 36}, "Binning for chi2NClusTPC"}; ConfigurableAxis candPtBins{"candPtBins", {160, 0, 8}, "Binning for lnn cand pt"}; @@ -302,6 +303,7 @@ struct lnnRecoTask { const AxisSpec betaAxis{betaBins, "#beta_{TOF}"}; const AxisSpec dcaXYAxis(dcaXYBins, "DCA_{xy} ({}^{3}H (cm)"); const AxisSpec tpcNClusAxis(tpcNClusBins, "N_{clus}^{TPC}"); + const AxisSpec tpcNClsCrossedRowsAxis(tpcNClsCrossedRowsBins, "N_{TPC} crossed rows"); const AxisSpec tpcChi2NClusAxis(tpcChi2NClusBins, "{#Chi}^{2}/N_{clus}^{TPC}"); const AxisSpec itsChi2NClusAxis(itsChi2NClusBins, "{#Chi}^{2}/N_{clus}^{ITS}"); const AxisSpec candPtAxis(candPtBins, "#it{p}_{T} (Gev/#it{c})"); @@ -315,29 +317,32 @@ struct lnnRecoTask { hdEdxTot = qaRegistry.add("hdEdxTot", ";p_{TPC}/z (GeV/#it{c}); dE/dx", HistType::kTH2F, {rigidityAxis, dEdxAxis}); h3HMassPtTOF = qaRegistry.add("PID/hTrMassPtTOF", "; #it{p}_{T} ({}^{3}H) (GeV/#it{c}); #frac{m^{2}}{z^{2}} (GeV^{2}/#it{c}^{4})", HistType::kTH2F, {tPtAxis, mTOFAxis}); h3HSignalPtTOF = qaRegistry.add("PID/h3HSignalPtTOF", "; #it{p}_{T}({}^{3}H) (GeV/#it{c}); #beta_{TOF}", HistType::kTH2F, {tPtAxis, betaAxis}); - hEvents = qaRegistry.add("hEvents", ";Events; ", HistType::kTH1D, {{3, -0.5, 2.5}}); + hEvents = qaRegistry.add("hEvents", ";Events; ", HistType::kTH1D, {{4, -0.5, 3.5}}); hLnnCandLoss = qaRegistry.add("CandCounts/hLnnCandLoss", ";CandLoss; ", HistType::kTH1D, {{7, -0.5, 6.5}}); // QA its-tpc and its-tpc-tof tracks before selection h2FT0CnClusTPCtoTrBfSel = qaRegistry.add("QATracks/h2FT0CnClusTPCtoTrBfSel", ";FT0C (%);N_{clus}^{TPC}", HistType::kTH2F, {centAxis, tpcNClusAxis}); h2FT0CnClusTPCtoPiBfSel = qaRegistry.add("QATracks/h2FT0CnClusTPCtoPiBfSel", ";FT0C (%);N_{clus}^{TPC}", HistType::kTH2F, {centAxis, tpcNClusAxis}); h2FT0Cchi2NClTPCtoTrBfSel = qaRegistry.add("QATracks/h2FT0Cchi2NClTPCtoTrBfSel", ";FT0C (%);{#Chi}^{2}/N_{clus}^{TPC} ", HistType::kTH2F, {centAxis, tpcChi2NClusAxis}); h2FT0Cchi2NClITStoTrBfSel = qaRegistry.add("QATracks/h2FT0Cchi2NClITStoTrBfSel", ";FT0C (%);{#Chi}^{2}/N_{clus}^{ITS}", HistType::kTH2F, {centAxis, itsChi2NClusAxis}); - h2FT0CptTrBfSelItsTpc = qaRegistry.add("QATracks/h2FT0CptTrBfSelItsTpc", "; #it{p}_{T}({}^{3}H) (GeV/#it{c}); #beta_{TOF}", HistType::kTH2F, {centAxis, candPtBins}); - h2FT0CptTrBfSelItsTpcTof = qaRegistry.add("QATracks/h2FT0CptTrBfSelItsTpcTof", "; #it{p}_{T}({}^{3}H) (GeV/#it{c}); #beta_{TOF}", HistType::kTH2F, {centAxis, candPtBins}); - h2FT0CptPiBfSelItsTpc = qaRegistry.add("QATracks/h2FT0CptPiBfSelItsTpc", "; #it{p}_{T}({}^{3}H) (GeV/#it{c}); #beta_{TOF}", HistType::kTH2F, {centAxis, candPtBins}); + h2FT0CnTPCNClsCrossedRows3HBfSel = qaRegistry.add("QATracks/h2FT0CnTPCNClsCrossedRows3H", ";FT0C (%);N_{TPC} crossed rows", HistType::kTH2F, {centAxis, tpcNClsCrossedRowsAxis}); + h2FT0CnTPCNClsCrossedRowsPiBfSel = qaRegistry.add("QATracks/h2FT0CnTPCNClsCrossedRowsPi", ";FT0C (%);N_{TPC} crossed rows", HistType::kTH2F, {centAxis, tpcNClsCrossedRowsAxis}); + h2FT0CptTrBfSelItsTpc = qaRegistry.add("QATracks/h2FT0CptTrBfSelItsTpc", ";FT0C (%);#it{p}_{T}", HistType::kTH2F, {centAxis, candPtBins}); + h2FT0CptTrBfSelItsTpcTof = qaRegistry.add("QATracks/h2FT0CptTrBfSelItsTpcTof", ";FT0C (%);#it{p}_{T}", HistType::kTH2F, {centAxis, candPtBins}); + h2FT0CptPiBfSelItsTpc = qaRegistry.add("QATracks/h2FT0CptPiBfSelItsTpc", ";FT0C (%);#it{p}_{T}", HistType::kTH2F, {centAxis, candPtBins}); // QA its-tpc, its-tpc-tof, and generated MC hPtItsTpcTrStr = qaRegistry.add("MC/McTracks/hPtItsTpcTrStr", ";FT0C (%);#it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {{10, 0, 100}, {160, 0, 8}}); hPtTrkItsTpcTrStr = qaRegistry.add("MC/McTracks/hPtTrkItsTpcTrStr", ";FT0C (%);#it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {{10, 0, 100}, {160, 0, 8}}); hPtItsTpcTofTrStr = qaRegistry.add("MC/McTracks/hPtItsTpcTofTrStr", ";FT0C (%);#it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {{10, 0, 100}, {160, 0, 8}}); hPtTrkItsTpcTofTrStr = qaRegistry.add("MC/McTracks/hPtTrkItsTpcTofTrStr", ";FT0C (%);#it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {{10, 0, 100}, {160, 0, 8}}); hPtItsTpcPiStr = qaRegistry.add("MC/McTracks/hPtItsTpcPiStr", ";FT0C (%);#it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {{10, 0, 100}, {160, 0, 8}}); - hPtTrkItsTpcPiStr = qaRegistry.add("MC/McTracks/hPtTrkItsTpcPiStr", ";FT0C (%);#it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {{10, 0, 100}, {160, 0, 8}}); - hPtGeneratedTrStr = qaRegistry.add("MC/McGen/hPtGeneratedTrStr", ";FT0C (%);#it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {{10, 0, 100}, {160, 0, 8}}); - hPtGeneratedPiStr = qaRegistry.add("MC/McGen/hPtGeneratedPiStr", ";FT0C (%);#it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {{10, 0, 100}, {160, 0, 8}}); - + hPtTrkItsTpcPiStr = qaRegistry.add("MC/McTracks/hPtTrkItsTpcPiStr", ";FT0C (%);#it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {{10, 0, 100}, {160, 0, 8}}); + hPtGeneratedTrStr = qaRegistry.add("MC/McGen/hPtGeneratedTrStr", ";FT0C (%);#it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {{10, 0, 100}, {160, 0, 8}}); + hPtGeneratedPiStr = qaRegistry.add("MC/McGen/hPtGeneratedPiStr", ";FT0C (%);#it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {{10, 0, 100}, {160, 0, 8}}); + hEvents->GetXaxis()->SetBinLabel(1, "All"); hEvents->GetXaxis()->SetBinLabel(2, "sel8"); hEvents->GetXaxis()->SetBinLabel(3, "z_{vtx}"); + hEvents->GetXaxis()->SetBinLabel(4, "NoSameBunchPileUp"); hLnnCandLoss->GetYaxis()->SetTitle("#it{N}_{cand}"); hLnnCandLoss->GetXaxis()->SetTitle("Cuts"); hLnnCandLoss->GetXaxis()->SetBinLabel(1, "Initial"); @@ -349,19 +354,15 @@ struct lnnRecoTask { hLnnCandLoss->GetXaxis()->SetBinLabel(7, "cosPA"); if (doprocessMC) { hDecayChannel = qaRegistry.add("MC/hDecayChannel", ";Decay channel; ", HistType::kTH1D, {{2, -0.5, 1.5}}); - hDecayChannel->GetXaxis()->SetBinLabel(1, "2-body"); + hDecayChannel->GetXaxis()->SetBinLabel(1, "All"); + hDecayChannel->GetXaxis()->SetBinLabel(2, "2-body"); hIsMatterGen = qaRegistry.add("MC/hIsMatterGen", ";; ", HistType::kTH1D, {{2, -0.5, 1.5}}); hIsMatterGen->GetXaxis()->SetBinLabel(1, "Matter"); hIsMatterGen->GetXaxis()->SetBinLabel(2, "Antimatter"); // QA for generated mother candidate and daughter particles - h2FT0CPtGenColRecoGenCandMC = qaRegistry.add("MC/QARecoGenSV/h2FT0CPtGenColRecoGenCandMC", ";FT0C (%);#it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {centAxis, candPtAxis}); - h2FT0CPtGenColRecoGenTrStrMC = qaRegistry.add("MC/QARecoGenSV/h2FT0CPtGenColRecoGenTrStrMC", ";FT0C (%);#it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {centAxis, candPtAxis}); - h2FT0CPtGenColRecoGenPiStrMC = qaRegistry.add("MC/QARecoGenSV/h2FT0CPtGenColRecoGenPiStrMC", ";FT0C (%);#it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {centAxis, candPtAxis}); - h2FT0CPtRecColRecoGenCandMC = qaRegistry.add("MC/QARecoGenSV/h2FT0CPtRecColRecoGenCandMC", ";FT0C (%);#it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {centAxis, candPtAxis}); - h2FT0CPtRecColRecoGenTrStrMC = qaRegistry.add("MC/QARecoGenSV/h2FT0CPtRecColRecoGenTrStrMC", ";FT0C (%);#it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {centAxis, candPtAxis}); - h2FT0CPtRecColRecoGenPiStrMC = qaRegistry.add("MC/QARecoGenSV/h2FT0CPtRecColRecoGenPiStrMC", ";FT0C (%);#it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {centAxis, candPtAxis}); - h2FT0CPtRecColRecoTrStrMC = qaRegistry.add("MC/QARecoGenSV/h2FT0CPtRecColRecoTrStrMC", ";FT0C (%);#it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {centAxis, candPtAxis}); - h2FT0CPtRecColRecoPiStrMC = qaRegistry.add("MC/QARecoGenSV/h2FT0CPtRecColRecoPiStrMC", ";FT0C (%);#it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {centAxis, candPtAxis}); + h2FT0CPtGenColRecCandMC = qaRegistry.add("MC/RecMcCol/h2FT0CPtGenColRecCandMC", ";FT0C (%);#it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {centAxis, candPtAxis}); + h2FT0CPtGenColRecTrStrMC = qaRegistry.add("MC/RecMcCol/h2FT0CPtGenColRecTrStrMC", ";FT0C (%);#it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {centAxis, candPtAxis}); + h2FT0CPtGenColRecPiStrMC = qaRegistry.add("MC/RecMcCol/h2FT0CPtGenColRecPiStrMC", ";FT0C (%);#it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {centAxis, candPtAxis}); // QA signal generated candidate and daugher particles from secondary vertex h2FT0CPtGenColGenCandMC = qaRegistry.add("MC/QASignalGenSV/h2FT0CPtGenColGenCandMC", ";FT0C (%);#it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {centAxis, candPtAxis}); h2FT0CPtGenColGenTrStrMC = qaRegistry.add("MC/QASignalGenSV/h2FT0CPtGenColGenTrStrMC", ";FT0C (%);#it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {centAxis, candPtAxis}); @@ -484,9 +485,11 @@ struct lnnRecoTask { // fill QA track histogram studies to check track signal before selections h2FT0CnClusTPCtoTrBfSel->Fill(collision.centFT0C(), h3track.tpcNClsFound()); h2FT0CnClusTPCtoPiBfSel->Fill(collision.centFT0C(), pitrack.tpcNClsFound()); + h2FT0CnTPCNClsCrossedRows3HBfSel->Fill(collision.centFT0C(), h3track.tpcNClsCrossedRows()); + h2FT0CnTPCNClsCrossedRowsPiBfSel->Fill(collision.centFT0C(), pitrack.tpcNClsCrossedRows()); h2FT0Cchi2NClTPCtoTrBfSel->Fill(collision.centFT0C(), h3track.tpcChi2NCl()); h2FT0Cchi2NClITStoTrBfSel->Fill(collision.centFT0C(), h3track.itsChi2NCl()); - + if (doTrackQA) { bool passedTrTrackITS = h3track.hasITS(); bool passedTrTrackTOF = h3track.hasTOF(); @@ -503,11 +506,11 @@ struct lnnRecoTask { } if (h3Rigidity < tpcRigidityMin3H || - h3track.tpcNClsFound() < nTPCClusMin3H || + h3track.tpcNClsCrossedRows() < nTPCNClsCrossedRows3H || h3track.tpcChi2NCl() < chi2nClusTPCMin || h3track.tpcChi2NCl() > chi2nClusTPCMax || h3track.itsChi2NCl() > chi2nClusITS || - pitrack.tpcNClsFound() < nTPCClusMinPi) { + pitrack.tpcNClsCrossedRows() < nTPCNClsCrossedRowsPi) { continue; } @@ -694,35 +697,33 @@ struct lnnRecoTask { bool isLnnDecay(aod::McParticles::iterator const& mcPart) { - if (!mcPart.has_mothers()) + if (!mcPart.has_mothers()) + return false; + + if (mcPart.getProcess() != 4) return false; - bool motherIsAccepted = true; + bool motherIsAccepted = false; auto mothers = mcPart.mothers_as(); for (const auto& mother : mothers) { - if (mcPart.getProcess() == 4) { - motherIsAccepted = false; - // só aceita se a mãe for um Lnn - if (std::abs(mother.pdgCode()) == lnnPdg) { - motherIsAccepted = true; - } + if (std::abs(mother.pdgCode()) == lnnPdg) { + motherIsAccepted = true; + break; } } return motherIsAccepted; } - + template - void fillMcHistograms(TracksFullMC::iterator const& mcTrack, aod::McParticles::iterator const& mc, bool motherIsAccepted, Tcoll const& collision) - { + void fillMcHistograms(TracksFullMC::iterator const& mcTrack, aod::McParticles::iterator const& mc, Tcoll const& collision) { bool passedTrackITS = mcTrack.hasITS(); bool passedTrackTPC = mcTrack.hasTPC(); bool passedTrackTOF = mcTrack.hasTOF(); - if (!motherIsAccepted) - return; + int pdg = std::abs(mc.pdgCode()); - if (std::abs(mc.pdgCode()) == h3DauPdg) { + if (pdg == h3DauPdg) { hPtGeneratedTrStr->Fill(collision.centFT0C(), mc.pt()); if (passedTrackITS && passedTrackTPC) { @@ -735,14 +736,14 @@ struct lnnRecoTask { } } - if (std::abs(mc.pdgCode()) == piDauPdg) { + if (pdg == piDauPdg) { hPtGeneratedPiStr->Fill(collision.centFT0C(), mc.pt()); if (passedTrackITS && passedTrackTPC) { hPtItsTpcPiStr->Fill(collision.centFT0C(), mc.pt()); hPtTrkItsTpcPiStr->Fill(collision.centFT0C(), mcTrack.pt()); } } - } + } void processData(CollisionsFull const& collisions, aod::V0s const& V0s, TracksFull const& tracks, aod::BCsWithTimestamps const&) { @@ -761,6 +762,11 @@ struct lnnRecoTask { continue; } hEvents->Fill(2.); + if (useNoSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + continue; + } + hEvents->Fill(3.); + hZvtx->Fill(collision.posZ()); hCentFT0A->Fill(collision.centFT0A()); @@ -792,7 +798,7 @@ struct lnnRecoTask { PROCESS_SWITCH(lnnRecoTask, processData, "Data analysis", true); // MC process - void processMC(CollisionsFullMC const& collisions, aod::McCollisions const& mcCollisions, aod::V0s const& V0s, aod::BCsWithTimestamps const&, TracksFull const& tracks, TracksFullMC const& tracksMC, aod::McTrackLabels const& trackLabelsMC, aod::McParticles const& particlesMC) + void processMC(CollisionsFullMC const& collisions, aod::McCollisions const& mcCollisions, aod::V0s const& V0s, aod::BCsWithTimestamps const&, TracksFull const& tracks, TracksFullMC const& tracksMC, aod::McTrackLabels const& trackLabelsMC, aod::McParticles const& particlesMC) { filledMothers.clear(); isGoodCollision.clear(); @@ -805,13 +811,15 @@ struct lnnRecoTask { for (const auto& collision : collisions) { for (auto const& trackMC : tracksMC) { - if (!trackMC.has_mcParticle()) + if (!trackMC.has_mcParticle()) continue; auto mc = trackMC.mcParticle(); - bool motherIsAccepted = isLnnDecay(mc); + + if (!isLnnDecay(mc)) + continue; - fillMcHistograms(trackMC, mc, motherIsAccepted, collision); + fillMcHistograms(trackMC, mc, collision); } lnnCandidates.clear(); @@ -822,6 +830,7 @@ struct lnnRecoTask { if (collision.has_mcCollision()) { recoCollisionIds[collision.mcCollisionId()] = collision.globalIndex(); } + if ((!collision.sel8())) { continue; } @@ -830,7 +839,11 @@ struct lnnRecoTask { continue; } hEvents->Fill(2.); - + if (useNoSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + continue; + } + hEvents->Fill(3.); + hZvtx->Fill(collision.posZ()); hCentFT0A->Fill(collision.centFT0A()); hCentFT0C->Fill(collision.centFT0C()); @@ -854,19 +867,10 @@ struct lnnRecoTask { continue; } int chargeFactor = -1 + 2 * (lnnCand.pdgCode > 0); - - // Fill 2D map for generated daughter particles which the mother candidate is reconstructed - h2FT0CPtGenColRecoGenCandMC->Fill(collision.centFT0C(), chargeFactor * lnnCand.genPt()); - h2FT0CPtGenColRecoGenTrStrMC->Fill(collision.centFT0C(), chargeFactor * lnnCand.genPt3H()); - h2FT0CPtGenColRecoGenPiStrMC->Fill(collision.centFT0C(), chargeFactor * lnnCand.genPtPi()); - if (lnnCand.recoMcColl) { - h2FT0CPtRecColRecoGenCandMC->Fill(collision.centFT0C(), chargeFactor * lnnCand.genPt()); - h2FT0CPtRecColRecoGenTrStrMC->Fill(collision.centFT0C(), chargeFactor * lnnCand.genPt3H()); - h2FT0CPtRecColRecoGenPiStrMC->Fill(collision.centFT0C(), chargeFactor * lnnCand.genPtPi()); - if (lnnCand.isReco && lnnCand.survEvSelection) { - h2FT0CPtRecColRecoTrStrMC->Fill(collision.centFT0C(), chargeFactor * lnnCand.recoPt3H()); - h2FT0CPtRecColRecoPiStrMC->Fill(collision.centFT0C(), chargeFactor * lnnCand.recoPtPi()); - } + if (lnnCand.recoMcColl && lnnCand.survEvSelection) { + h2FT0CPtGenColRecCandMC->Fill(collision.centFT0C(), chargeFactor * lnnCand.genPt()); + h2FT0CPtGenColRecTrStrMC->Fill(collision.centFT0C(), chargeFactor * lnnCand.genPt3H()); + h2FT0CPtGenColRecPiStrMC->Fill(collision.centFT0C(), chargeFactor * lnnCand.genPtPi()); } outputMCTable(collision.centFT0A(), collision.centFT0C(), collision.centFT0M(), collision.posX(), collision.posY(), collision.posZ(), @@ -885,11 +889,14 @@ struct lnnRecoTask { // now we fill only the signal candidates that were not reconstructed for (const auto& mcPart : particlesMC) { - + if (std::abs(mcPart.pdgCode()) != lnnPdg) { continue; } float cent = collisionFT0Ccent[mcPart.mcCollisionId()]; + + h2FT0CPtGenColGenCandMC->Fill(cent, mcPart.pt()); + constexpr std::size_t kVtxDim = 3; std::array secVtx; std::array primVtx = {mcPart.vx(), mcPart.vy(), mcPart.vz()}; @@ -902,14 +909,17 @@ struct lnnRecoTask { bool is3HFound = false; for (const auto& mcDaught : mcPart.daughters_as()) { - if (std::abs(mcDaught.pdgCode()) == h3DauPdg) { + int pdg = std::abs(mcDaught.pdgCode()); + + if (pdg == h3DauPdg) { secVtx = {mcDaught.vx(), mcDaught.vy(), mcDaught.vz()}; mom3H = mcDaught.pVector(); + h2FT0CPtGenColGenTrStrMC->Fill(cent, mcDaught.pt()); is3HFound = true; - break; } - if (std::abs(mcDaught.pdgCode()) == piDauPdg) { + if (pdg == piDauPdg) { momPi = mcDaught.pVector(); + h2FT0CPtGenColGenPiStrMC->Fill(cent, mcDaught.pt()); } } @@ -918,9 +928,9 @@ struct lnnRecoTask { } else { hIsMatterGen->Fill(1.); } + if (!is3HFound) { hDecayChannel->Fill(1.); - continue; } hDecayChannel->Fill(0.); if (std::find(filledMothers.begin(), filledMothers.end(), mcPart.globalIndex()) != std::end(filledMothers)) { @@ -941,18 +951,15 @@ struct lnnRecoTask { lnnCand.posTrackID = -1; lnnCand.negTrackID = -1; lnnCand.isSignal = true; - if (lnnCand.isSignal) { - h2FT0CPtGenColGenCandMC->Fill(cent, chargeFactor * lnnCand.genPt()); - h2FT0CPtGenColGenTrStrMC->Fill(cent, chargeFactor * lnnCand.genPt3H()); - h2FT0CPtGenColGenPiStrMC->Fill(cent, chargeFactor * lnnCand.genPtPi()); - } - float centFT0C = -1.; + float centFT0A = -1, centFT0C = -1, centFT0M = -1; if (lnnCand.recoMcColl) { auto recoCollision = collisions.rawIteratorAt(recoCollisionIds[mcPart.mcCollisionId()]); + centFT0A = recoCollision.centFT0A(); centFT0C = recoCollision.centFT0C(); - } - outputMCTable(-1, centFT0C, -1, + centFT0M = recoCollision.centFT0M(); + } + outputMCTable(centFT0A, centFT0C, centFT0M, -1, -1, -1, 0, -1, -1, -1, @@ -965,7 +972,7 @@ struct lnnRecoTask { -1, -1, -1, chargeFactor * lnnCand.genPt(), lnnCand.genPhi(), lnnCand.genEta(), lnnCand.genPt3H(), lnnCand.gDecVtx[0], lnnCand.gDecVtx[1], lnnCand.gDecVtx[2], lnnCand.isReco, lnnCand.isSignal, lnnCand.recoMcColl, lnnCand.survEvSelection); - } + } } } PROCESS_SWITCH(lnnRecoTask, processMC, "MC analysis", false); @@ -976,4 +983,4 @@ WorkflowSpec { return WorkflowSpec{ adaptAnalysisTask(cfgc)}; -} +} \ No newline at end of file From ad4b2a1167f6a3147a46da97dfbb18f95c3bee35 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Wed, 11 Mar 2026 10:26:14 +0000 Subject: [PATCH 2/3] Please consider the following formatting changes --- PWGLF/TableProducer/Nuspex/lnnRecoTask.cxx | 41 +++++++++++----------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/PWGLF/TableProducer/Nuspex/lnnRecoTask.cxx b/PWGLF/TableProducer/Nuspex/lnnRecoTask.cxx index 72ec61d9d25..fa1622bdae2 100644 --- a/PWGLF/TableProducer/Nuspex/lnnRecoTask.cxx +++ b/PWGLF/TableProducer/Nuspex/lnnRecoTask.cxx @@ -335,10 +335,10 @@ struct lnnRecoTask { hPtItsTpcTofTrStr = qaRegistry.add("MC/McTracks/hPtItsTpcTofTrStr", ";FT0C (%);#it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {{10, 0, 100}, {160, 0, 8}}); hPtTrkItsTpcTofTrStr = qaRegistry.add("MC/McTracks/hPtTrkItsTpcTofTrStr", ";FT0C (%);#it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {{10, 0, 100}, {160, 0, 8}}); hPtItsTpcPiStr = qaRegistry.add("MC/McTracks/hPtItsTpcPiStr", ";FT0C (%);#it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {{10, 0, 100}, {160, 0, 8}}); - hPtTrkItsTpcPiStr = qaRegistry.add("MC/McTracks/hPtTrkItsTpcPiStr", ";FT0C (%);#it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {{10, 0, 100}, {160, 0, 8}}); - hPtGeneratedTrStr = qaRegistry.add("MC/McGen/hPtGeneratedTrStr", ";FT0C (%);#it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {{10, 0, 100}, {160, 0, 8}}); - hPtGeneratedPiStr = qaRegistry.add("MC/McGen/hPtGeneratedPiStr", ";FT0C (%);#it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {{10, 0, 100}, {160, 0, 8}}); - + hPtTrkItsTpcPiStr = qaRegistry.add("MC/McTracks/hPtTrkItsTpcPiStr", ";FT0C (%);#it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {{10, 0, 100}, {160, 0, 8}}); + hPtGeneratedTrStr = qaRegistry.add("MC/McGen/hPtGeneratedTrStr", ";FT0C (%);#it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {{10, 0, 100}, {160, 0, 8}}); + hPtGeneratedPiStr = qaRegistry.add("MC/McGen/hPtGeneratedPiStr", ";FT0C (%);#it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {{10, 0, 100}, {160, 0, 8}}); + hEvents->GetXaxis()->SetBinLabel(1, "All"); hEvents->GetXaxis()->SetBinLabel(2, "sel8"); hEvents->GetXaxis()->SetBinLabel(3, "z_{vtx}"); @@ -489,7 +489,7 @@ struct lnnRecoTask { h2FT0CnTPCNClsCrossedRowsPiBfSel->Fill(collision.centFT0C(), pitrack.tpcNClsCrossedRows()); h2FT0Cchi2NClTPCtoTrBfSel->Fill(collision.centFT0C(), h3track.tpcChi2NCl()); h2FT0Cchi2NClITStoTrBfSel->Fill(collision.centFT0C(), h3track.itsChi2NCl()); - + if (doTrackQA) { bool passedTrTrackITS = h3track.hasITS(); bool passedTrTrackTOF = h3track.hasTOF(); @@ -697,9 +697,9 @@ struct lnnRecoTask { bool isLnnDecay(aod::McParticles::iterator const& mcPart) { - if (!mcPart.has_mothers()) + if (!mcPart.has_mothers()) return false; - + if (mcPart.getProcess() != 4) return false; @@ -713,9 +713,10 @@ struct lnnRecoTask { } return motherIsAccepted; } - + template - void fillMcHistograms(TracksFullMC::iterator const& mcTrack, aod::McParticles::iterator const& mc, Tcoll const& collision) { + void fillMcHistograms(TracksFullMC::iterator const& mcTrack, aod::McParticles::iterator const& mc, Tcoll const& collision) + { bool passedTrackITS = mcTrack.hasITS(); bool passedTrackTPC = mcTrack.hasTPC(); @@ -743,7 +744,7 @@ struct lnnRecoTask { hPtTrkItsTpcPiStr->Fill(collision.centFT0C(), mcTrack.pt()); } } - } + } void processData(CollisionsFull const& collisions, aod::V0s const& V0s, TracksFull const& tracks, aod::BCsWithTimestamps const&) { @@ -767,7 +768,6 @@ struct lnnRecoTask { } hEvents->Fill(3.); - hZvtx->Fill(collision.posZ()); hCentFT0A->Fill(collision.centFT0A()); hCentFT0C->Fill(collision.centFT0C()); @@ -798,7 +798,7 @@ struct lnnRecoTask { PROCESS_SWITCH(lnnRecoTask, processData, "Data analysis", true); // MC process - void processMC(CollisionsFullMC const& collisions, aod::McCollisions const& mcCollisions, aod::V0s const& V0s, aod::BCsWithTimestamps const&, TracksFull const& tracks, TracksFullMC const& tracksMC, aod::McTrackLabels const& trackLabelsMC, aod::McParticles const& particlesMC) + void processMC(CollisionsFullMC const& collisions, aod::McCollisions const& mcCollisions, aod::V0s const& V0s, aod::BCsWithTimestamps const&, TracksFull const& tracks, TracksFullMC const& tracksMC, aod::McTrackLabels const& trackLabelsMC, aod::McParticles const& particlesMC) { filledMothers.clear(); isGoodCollision.clear(); @@ -811,11 +811,11 @@ struct lnnRecoTask { for (const auto& collision : collisions) { for (auto const& trackMC : tracksMC) { - if (!trackMC.has_mcParticle()) + if (!trackMC.has_mcParticle()) continue; auto mc = trackMC.mcParticle(); - + if (!isLnnDecay(mc)) continue; @@ -830,7 +830,7 @@ struct lnnRecoTask { if (collision.has_mcCollision()) { recoCollisionIds[collision.mcCollisionId()] = collision.globalIndex(); } - + if ((!collision.sel8())) { continue; } @@ -843,7 +843,7 @@ struct lnnRecoTask { continue; } hEvents->Fill(3.); - + hZvtx->Fill(collision.posZ()); hCentFT0A->Fill(collision.centFT0A()); hCentFT0C->Fill(collision.centFT0C()); @@ -889,7 +889,7 @@ struct lnnRecoTask { // now we fill only the signal candidates that were not reconstructed for (const auto& mcPart : particlesMC) { - + if (std::abs(mcPart.pdgCode()) != lnnPdg) { continue; } @@ -958,7 +958,7 @@ struct lnnRecoTask { centFT0A = recoCollision.centFT0A(); centFT0C = recoCollision.centFT0C(); centFT0M = recoCollision.centFT0M(); - } + } outputMCTable(centFT0A, centFT0C, centFT0M, -1, -1, -1, 0, @@ -972,7 +972,7 @@ struct lnnRecoTask { -1, -1, -1, chargeFactor * lnnCand.genPt(), lnnCand.genPhi(), lnnCand.genEta(), lnnCand.genPt3H(), lnnCand.gDecVtx[0], lnnCand.gDecVtx[1], lnnCand.gDecVtx[2], lnnCand.isReco, lnnCand.isSignal, lnnCand.recoMcColl, lnnCand.survEvSelection); - } + } } } PROCESS_SWITCH(lnnRecoTask, processMC, "MC analysis", false); @@ -983,4 +983,5 @@ WorkflowSpec { return WorkflowSpec{ adaptAnalysisTask(cfgc)}; -} \ No newline at end of file +} + \ No newline at end of file From be13e7fabc071afefb368176ae3e9c8a661b6a94 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Wed, 11 Mar 2026 10:47:29 +0000 Subject: [PATCH 3/3] Please consider the following formatting changes --- PWGLF/TableProducer/Nuspex/lnnRecoTask.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/PWGLF/TableProducer/Nuspex/lnnRecoTask.cxx b/PWGLF/TableProducer/Nuspex/lnnRecoTask.cxx index fa1622bdae2..4e8d5fb205e 100644 --- a/PWGLF/TableProducer/Nuspex/lnnRecoTask.cxx +++ b/PWGLF/TableProducer/Nuspex/lnnRecoTask.cxx @@ -984,4 +984,3 @@ WorkflowSpec return WorkflowSpec{ adaptAnalysisTask(cfgc)}; } - \ No newline at end of file