From 0d50e35f5f9d44c9ed1ad276ed7436baa77e42f1 Mon Sep 17 00:00:00 2001 From: FabiolaLP Date: Tue, 10 Mar 2026 11:18:46 -0600 Subject: [PATCH 1/4] Update nucleiAntineutronCex task --- PWGLF/DataModel/LFAntinCexTables.h | 10 +- .../Nuspex/nucleiAntineutronCex.cxx | 151 +++++++++++++++++- 2 files changed, 159 insertions(+), 2 deletions(-) diff --git a/PWGLF/DataModel/LFAntinCexTables.h b/PWGLF/DataModel/LFAntinCexTables.h index 9e8f4ce1ca8..c5e4dd080f6 100644 --- a/PWGLF/DataModel/LFAntinCexTables.h +++ b/PWGLF/DataModel/LFAntinCexTables.h @@ -41,6 +41,12 @@ DECLARE_SOA_COLUMN(McAngleDeg, mcAngleDeg, float); DECLARE_SOA_COLUMN(McVtxX, mcVtxX, float); DECLARE_SOA_COLUMN(McVtxY, mcVtxY, float); DECLARE_SOA_COLUMN(McVtxZ, mcVtxZ, float); +DECLARE_SOA_COLUMN(VtxNAll, vtxNAll, int16_t); +DECLARE_SOA_COLUMN(VtxNCh, vtxNCh, int16_t); +DECLARE_SOA_COLUMN(VtxNNeut, vtxNNeut, int16_t); +DECLARE_SOA_COLUMN(VtxNPi0, vtxNPi0, int16_t); +DECLARE_SOA_COLUMN(VtxNGamma, vtxNGamma, int16_t); +DECLARE_SOA_COLUMN(VtxNN, vtxNN, int16_t); // Tracks (pair, fitter) DECLARE_SOA_COLUMN(TrkPairP, trkPairP, float); @@ -85,6 +91,7 @@ DECLARE_SOA_COLUMN(AntipTrkNClsIts, antipTrkNClsIts, int16_t); DECLARE_SOA_COLUMN(SelMask, selMask, uint32_t); DECLARE_SOA_COLUMN(PairPointingAngleDeg, pairPointingAngleDeg, float); +DECLARE_SOA_COLUMN(PvsvAngleZDeg, pvsvAngleZDeg, float); DECLARE_SOA_COLUMN(PairPBalance, pairPBalance, float); DECLARE_SOA_COLUMN(PairPtBalance, pairPtBalance, float); DECLARE_SOA_COLUMN(PairQ, pairQ, float); @@ -121,6 +128,7 @@ DECLARE_SOA_TABLE(AntinCexPairs, "AOD", "ANTINCEX", antin_cex::MotherPdg, antin_cex::ColId, antin_cex::PId, antin_cex::AntipId, antin_cex::McPairP, antin_cex::McPairPt, antin_cex::McPairPz, antin_cex::McDplane, antin_cex::McAngleDeg, antin_cex::McVtxX, antin_cex::McVtxY, antin_cex::McVtxZ, + antin_cex::VtxNAll, antin_cex::VtxNCh, antin_cex::VtxNNeut, antin_cex::VtxNPi0, antin_cex::VtxNGamma, antin_cex::VtxNN, antin_cex::TrkPairP, antin_cex::TrkPairPt, antin_cex::TrkPairPz, antin_cex::TrkAngleDeg, antin_cex::TrkVtxfitDcaPair, antin_cex::TrkVtxfitR, antin_cex::TrkVtxfitDistToPv, antin_cex::TrkVtxfitSecVtxX, antin_cex::TrkVtxfitSecVtxY, antin_cex::TrkVtxfitSecVtxZ, @@ -129,7 +137,7 @@ DECLARE_SOA_TABLE(AntinCexPairs, "AOD", "ANTINCEX", antin_cex::PTrkP, antin_cex::PTrkPx, antin_cex::PTrkPy, antin_cex::PTrkPz, antin_cex::PTrkEta, antin_cex::PTrkTpcSignal, antin_cex::PTrkNClsIts, antin_cex::AntipTrkP, antin_cex::AntipTrkPx, antin_cex::AntipTrkPy, antin_cex::AntipTrkPz, antin_cex::AntipTrkEta, antin_cex::AntipTrkTpcSignal, antin_cex::AntipTrkNClsIts, antin_cex::SelMask, - antin_cex::PairPointingAngleDeg, antin_cex::PairPBalance, antin_cex::PairPtBalance, antin_cex::PairQ, + antin_cex::PairPointingAngleDeg, antin_cex::PvsvAngleZDeg, antin_cex::PairPBalance, antin_cex::PairPtBalance, antin_cex::PairQ, antin_cex::DPairP, antin_cex::DPairPt, antin_cex::DPairPz, antin_cex::DOpenAngle, antin_cex::SVNearestLayerId, antin_cex::SVDeltaRToLayer, antin_cex::PTrkItsHitMap, antin_cex::APTrkItsHitMap, antin_cex::PLayersOk, antin_cex::APLayersOk, diff --git a/PWGLF/TableProducer/Nuspex/nucleiAntineutronCex.cxx b/PWGLF/TableProducer/Nuspex/nucleiAntineutronCex.cxx index 4ba3316a0b7..9e65b08eed9 100644 --- a/PWGLF/TableProducer/Nuspex/nucleiAntineutronCex.cxx +++ b/PWGLF/TableProducer/Nuspex/nucleiAntineutronCex.cxx @@ -28,6 +28,7 @@ #include #include +#include #include #include #include @@ -53,7 +54,7 @@ struct NucleiAntineutronCex { static constexpr double kIts2MaxR = 48.0; // ITS2 max radius [cm] static constexpr double kIts2MaxVz = 39.0; // ITS2 max |vz| [cm] static constexpr double kAccMaxEta = 1.2; // acceptance |eta| - static constexpr double kAccMaxVz = 5.3; // acceptance |vz| [cm] + static constexpr double kAccMaxVz = 10.0; // acceptance |vz| [cm] static constexpr double kStrictEta = 0.9; // tighter eta cut static constexpr double kInitDplane = 10.0; // init dplane static constexpr double kHuge = 1e9; // fallback for bad denom @@ -105,6 +106,25 @@ struct NucleiAntineutronCex { // test (MC) histos.add("antip_test", "Secondary antiprotons;|p| (GeV/c);Entries", kTH1F, {{100, 0., 10.}}); + // Process enum breakdown (secondary antiproton that anchors the SV) + histos.add("hProcEnumAP_CEX", "procEnum of secondary #bar{p} (CEX);procEnum;Entries", kTH1I, {{100, -0.5, 99.5}}); + histos.add("hProcEnumAP_BG", "procEnum of secondary #bar{p} (BG);procEnum;Entries", kTH1I, {{100, -0.5, 99.5}}); + + // Multiplicity/composition at the SV (MC truth, for FINAL selected candidates) + histos.add("hVtxNAll_CEX", "N(all) secondaries at SV (CEX);N;Entries", kTH1I, {{60, -0.5, 59.5}}); + histos.add("hVtxNAll_BG", "N(all) secondaries at SV (BG);N;Entries", kTH1I, {{60, -0.5, 59.5}}); + histos.add("hVtxNCh_CEX", "N(charged) secondaries at SV (CEX);N;Entries", kTH1I, {{60, -0.5, 59.5}}); + histos.add("hVtxNCh_BG", "N(charged) secondaries at SV (BG);N;Entries", kTH1I, {{60, -0.5, 59.5}}); + histos.add("hVtxNNeut_CEX", "N(neutral) secondaries at SV (CEX);N;Entries", kTH1I, {{60, -0.5, 59.5}}); + histos.add("hVtxNNeut_BG", "N(neutral) secondaries at SV (BG);N;Entries", kTH1I, {{60, -0.5, 59.5}}); + + histos.add("hVtxNPi0_CEX", "N(#pi^{0}) at SV (CEX);N;Entries", kTH1I, {{40, -0.5, 39.5}}); + histos.add("hVtxNPi0_BG", "N(#pi^{0}) at SV (BG);N;Entries", kTH1I, {{40, -0.5, 39.5}}); + histos.add("hVtxNGamma_CEX", "N(#gamma) at SV (CEX);N;Entries", kTH1I, {{60, -0.5, 59.5}}); + histos.add("hVtxNGamma_BG", "N(#gamma) at SV (BG);N;Entries", kTH1I, {{60, -0.5, 59.5}}); + histos.add("hVtxNN_CEX", "N(n) at SV (CEX);N;Entries", kTH1I, {{40, -0.5, 39.5}}); + histos.add("hVtxNN_BG", "N(n) at SV (BG);N;Entries", kTH1I, {{40, -0.5, 39.5}}); + // CEX pair from antineutron (MC) histos.add("cexPairMcP", "CEX pair total momentum;|p| (GeV/c);Entries", kTH1F, {{100, 0., 10.}}); histos.add("cexPairMcPt", "CEX pair p_{T};p_{T} (GeV/c);Entries", kTH1F, {{100, 0., 10.}}); @@ -130,6 +150,13 @@ struct NucleiAntineutronCex { histos.add("cexbg_pairmc_vtxz", "Background secondary vertex Z;Z (cm);Entries", kTH1F, {{200, -60., 60.}}); histos.add("cexbg_pairmc_pITScuts", "Background momentum (ITS cuts);|p| (GeV/c);Entries", kTH1F, {{100, 0., 10.}}); + histos.add("hDeltaP_CEX", "|p_{mother}-Σp_{SV}| (CEX);Δp (GeV/c);Entries", kTH1F, {{200, 0., 10.}}); + histos.add("hDeltaP_BG", "|p_{mother}-Σp_{SV}| (BG);Δp (GeV/c);Entries", kTH1F, {{200, 0., 10.}}); + + // Mother IB hits + histos.add("hMotherNHitIB_CEX", "Mother #bar{p} IB hit layers (L0-L2) (CEX);N_{IB layers};Entries", kTH1I, {{4, -0.5, 3.5}}); + histos.add("hMotherNHitIB_BG", "Mother #bar{p} IB hit layers (L0-L2) (BG);N_{IB layers};Entries", kTH1I, {{4, -0.5, 3.5}}); + // CEX pair from antineutron (TRK) histos.add("cex_pairtrk_angle", "Pair opening angle (tracks);Angle (°);Entries", kTH1F, {{180, 0., 180.}}); histos.add("cexPairTrkP", "Pair momentum (tracks);|p| (GeV/c);Entries", kTH1F, {{120, 0., 12.}}); @@ -265,21 +292,27 @@ struct NucleiAntineutronCex { // Primary mother bool hasPrimaryMotherAntip = false; double motherPt = 0.0; + double motherPx = 0.0; + double motherPy = 0.0; double motherPz = 0.0; double motherVz = 0.0; double motherP = 0.0; double motherEta = 0.0; int motherPdg = 0; + int motherId = -1; for (const auto& mother : particle.mothers_as()) { if (mother.isPhysicalPrimary()) { hasPrimaryMotherAntip = true; motherPt = mother.pt(); + motherPx = mother.px(); + motherPy = mother.py(); motherPz = mother.pz(); motherVz = mother.vz(); motherP = mother.p(); motherEta = mother.eta(); motherPdg = mother.pdgCode(); + motherId = mother.globalIndex(); break; } } @@ -530,6 +563,10 @@ struct NucleiAntineutronCex { int8_t antipTrkItsPidValid = 0; float antipTrkTgl = 0.f; + bool motherHasTrack = false; + uint16_t motherItsMap = 0; + int motherNHitIB = 0; // number of hits in IB (L0-L2) + o2::aod::ITSResponse itsResponse; for (const auto& track : tracks) { @@ -557,6 +594,12 @@ struct NucleiAntineutronCex { int nITS = track.itsNCls(); bool layerCondition = (!hitIB) && hitOuter && (nITS >= kMinItsHits); + if (mc.globalIndex() == motherId) { + motherHasTrack = true; + motherItsMap = static_cast(track.itsClusterMap()); + motherNHitIB = static_cast(hitL0) + static_cast(hitL1) + static_cast(hitL2); + } + if (mc.globalIndex() == antipId) { antipTrkP = track.p(); antipTrkPx = track.px(); @@ -695,6 +738,9 @@ struct NucleiAntineutronCex { const TVector3 pv2sv(secX - pvtxX, secY - pvtxY, secZ - pvtxZ); const double pairPointingAngleDeg = pv2sv.Angle(total_trk_pVec) * Rad2Deg; + const TVector3 zAxis(0., 0., 1.); + const double pvsvAngleZDeg = pv2sv.Angle(zAxis) * Rad2Deg; + const double pP = pVecProton_trk.Mag(); const double pAP = AntipVecProton_trk.Mag(); const double ptP = pVecProton_trk.Pt(); @@ -757,11 +803,106 @@ struct NucleiAntineutronCex { const bool isCex = (motherPdg == -kNeutron); + // Nature of the process + if (isCex) { + histos.fill(HIST("hProcEnumAP_CEX"), static_cast(procEnum)); + } else { + histos.fill(HIST("hProcEnumAP_BG"), static_cast(procEnum)); + } + + // Count material secondaries produced at the same SV as the selected secondary antiproton. + int vtxNAll = 0; + int vtxNCh = 0; + int vtxNNeut = 0; + int vtxNPi0 = 0; + int vtxNGamma = 0; + int vtxNN = 0; + double sumPx_vtx = 0.0; + double sumPy_vtx = 0.0; + double sumPz_vtx = 0.0; + auto* pdgDB = TDatabasePDG::Instance(); + + for (const auto& particle5 : mcPartsThis) { + if (particle5.mcCollisionId() != colId) { + continue; + } + // Same SV (use the SV of the selected secondary antiproton) + if (std::abs(particle5.vx() - antipVx) >= kVtxTol || std::abs(particle5.vy() - antipVy) >= kVtxTol || std::abs(particle5.vz() - antipVz) >= kVtxTol) { + continue; + } + const auto proc5Enum = particle5.getProcess(); + const bool isSecondaryFromMaterial5 = + (!particle5.producedByGenerator()) && (proc5Enum == kPHadronic || proc5Enum == kPHInhelastic); + if (!isSecondaryFromMaterial5) { + continue; + } + ++vtxNAll; + sumPx_vtx += particle5.px(); + sumPy_vtx += particle5.py(); + sumPz_vtx += particle5.pz(); + const int pdg = particle5.pdgCode(); + if (pdg == kPi0) { + ++vtxNPi0; + } + if (pdg == kGamma) { + ++vtxNGamma; + } + if (pdg == kNeutron) { + ++vtxNN; + } + // Charged vs neutral via PDG database (Charge() is in units of e/3) + double q = 0.0; + if (auto* part = pdgDB->GetParticle(pdg)) { + q = part->Charge() / 3.0; + } + if (std::abs(q) > 0.0) { + ++vtxNCh; + } else { + ++vtxNN; + } + } + + // Fill histos (final selected candidates only) + if (isCex) { + histos.fill(HIST("hVtxNAll_CEX"), vtxNAll); + histos.fill(HIST("hVtxNCh_CEX"), vtxNCh); + histos.fill(HIST("hVtxNNeut_CEX"), vtxNNeut); + histos.fill(HIST("hVtxNPi0_CEX"), vtxNPi0); + histos.fill(HIST("hVtxNGamma_CEX"), vtxNGamma); + histos.fill(HIST("hVtxNN_CEX"), vtxNN); + } else { + histos.fill(HIST("hVtxNAll_BG"), vtxNAll); + histos.fill(HIST("hVtxNCh_BG"), vtxNCh); + histos.fill(HIST("hVtxNNeut_BG"), vtxNNeut); + histos.fill(HIST("hVtxNPi0_BG"), vtxNPi0); + histos.fill(HIST("hVtxNGamma_BG"), vtxNGamma); + histos.fill(HIST("hVtxNN_BG"), vtxNN); + } + const float vtxfitDX = secX - antipVx; const float vtxfitDY = secY - antipVy; const float vtxfitDZ = secZ - antipVz; const float vtxfitD3D = std::sqrt(vtxfitDX * vtxfitDX + vtxfitDY * vtxfitDY + vtxfitDZ * vtxfitDZ); + const double dPx = motherPx - sumPx_vtx; + const double dPy = motherPy - sumPy_vtx; + const double dPz = motherPz - sumPz_vtx; + const double deltaP = std::sqrt(dPx * dPx + dPy * dPy + dPz * dPz); + + if (isCex) { + histos.fill(HIST("hDeltaP_CEX"), deltaP); + } else { + histos.fill(HIST("hDeltaP_BG"), deltaP); + } + + if (motherHasTrack) { + if (isCex) { + histos.fill(HIST("hMotherNHitIB_CEX"), motherNHitIB); + } else { + histos.fill(HIST("hMotherNHitIB_BG"), motherNHitIB); + } + } + const uint32_t selMask = 0u; outPairs( @@ -780,6 +921,13 @@ struct NucleiAntineutronCex { antipVy, antipVz, + static_cast(vtxNAll), + static_cast(vtxNCh), + static_cast(vtxNNeut), + static_cast(vtxNPi0), + static_cast(vtxNGamma), + static_cast(vtxNN), + cexPairTrkP, cexPairTrkPt, cexPairTrkPz, @@ -818,6 +966,7 @@ struct NucleiAntineutronCex { selMask, pairPointingAngleDeg, + pvsvAngleZDeg, pairPBalance, pairPtBalance, pairQ, From 03a8a85bc7e9b6c1a786f459f4795c7cd1fba9de Mon Sep 17 00:00:00 2001 From: FabiolaLP Date: Sat, 14 Mar 2026 13:52:02 -0600 Subject: [PATCH 2/4] Fix mother IB hit handling and update AntinCex variables --- PWGLF/DataModel/LFAntinCexTables.h | 18 +++++++------ .../Nuspex/nucleiAntineutronCex.cxx | 26 +++++++++---------- 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/PWGLF/DataModel/LFAntinCexTables.h b/PWGLF/DataModel/LFAntinCexTables.h index c5e4dd080f6..0e762f03e17 100644 --- a/PWGLF/DataModel/LFAntinCexTables.h +++ b/PWGLF/DataModel/LFAntinCexTables.h @@ -26,11 +26,12 @@ namespace o2::aod namespace antin_cex { // Metadata -DECLARE_SOA_COLUMN(IsCex, isCex, bool); // 1=CEX (from antin), 0=BG -DECLARE_SOA_COLUMN(MotherPdg, motherPdg, int32_t); // mother PDG -DECLARE_SOA_COLUMN(ColId, colId, int32_t); // mcCollisionId -DECLARE_SOA_COLUMN(PId, pId, int32_t); // proton MC id -DECLARE_SOA_COLUMN(AntipId, antipId, int32_t); // antiproton MC id +DECLARE_SOA_COLUMN(IsCex, isCex, bool); // 1=CEX (from antin), 0=BG +DECLARE_SOA_COLUMN(MotherPdg, motherPdg, int32_t); // mother PDG +DECLARE_SOA_COLUMN(MotherNHitIB, motherNHitIB, int); // mother IB Hits +DECLARE_SOA_COLUMN(ColId, colId, int32_t); // mcCollisionId +DECLARE_SOA_COLUMN(PId, pId, int32_t); // proton MC id +DECLARE_SOA_COLUMN(AntipId, antipId, int32_t); // antiproton MC id // MC (pair) DECLARE_SOA_COLUMN(McPairP, mcPairP, float); @@ -91,7 +92,8 @@ DECLARE_SOA_COLUMN(AntipTrkNClsIts, antipTrkNClsIts, int16_t); DECLARE_SOA_COLUMN(SelMask, selMask, uint32_t); DECLARE_SOA_COLUMN(PairPointingAngleDeg, pairPointingAngleDeg, float); -DECLARE_SOA_COLUMN(PvsvAngleZDeg, pvsvAngleZDeg, float); +DECLARE_SOA_COLUMN(PvsvThetaDeg, pvsvThetaDeg, float); +DECLARE_SOA_COLUMN(PvsvPhiDeg, pvsvPhiDeg, float); DECLARE_SOA_COLUMN(PairPBalance, pairPBalance, float); DECLARE_SOA_COLUMN(PairPtBalance, pairPtBalance, float); DECLARE_SOA_COLUMN(PairQ, pairQ, float); @@ -125,7 +127,7 @@ DECLARE_SOA_COLUMN(AntipTrkTgl, antipTrkTgl, float); // Table DECLARE_SOA_TABLE(AntinCexPairs, "AOD", "ANTINCEX", antin_cex::IsCex, - antin_cex::MotherPdg, antin_cex::ColId, antin_cex::PId, antin_cex::AntipId, + antin_cex::MotherPdg, antin_cex::MotherNHitIB, antin_cex::ColId, antin_cex::PId, antin_cex::AntipId, antin_cex::McPairP, antin_cex::McPairPt, antin_cex::McPairPz, antin_cex::McDplane, antin_cex::McAngleDeg, antin_cex::McVtxX, antin_cex::McVtxY, antin_cex::McVtxZ, antin_cex::VtxNAll, antin_cex::VtxNCh, antin_cex::VtxNNeut, antin_cex::VtxNPi0, antin_cex::VtxNGamma, antin_cex::VtxNN, @@ -137,7 +139,7 @@ DECLARE_SOA_TABLE(AntinCexPairs, "AOD", "ANTINCEX", antin_cex::PTrkP, antin_cex::PTrkPx, antin_cex::PTrkPy, antin_cex::PTrkPz, antin_cex::PTrkEta, antin_cex::PTrkTpcSignal, antin_cex::PTrkNClsIts, antin_cex::AntipTrkP, antin_cex::AntipTrkPx, antin_cex::AntipTrkPy, antin_cex::AntipTrkPz, antin_cex::AntipTrkEta, antin_cex::AntipTrkTpcSignal, antin_cex::AntipTrkNClsIts, antin_cex::SelMask, - antin_cex::PairPointingAngleDeg, antin_cex::PvsvAngleZDeg, antin_cex::PairPBalance, antin_cex::PairPtBalance, antin_cex::PairQ, + antin_cex::PairPointingAngleDeg, antin_cex::PvsvThetaDeg, antin_cex::PvsvPhiDeg, antin_cex::PairPBalance, antin_cex::PairPtBalance, antin_cex::PairQ, antin_cex::DPairP, antin_cex::DPairPt, antin_cex::DPairPz, antin_cex::DOpenAngle, antin_cex::SVNearestLayerId, antin_cex::SVDeltaRToLayer, antin_cex::PTrkItsHitMap, antin_cex::APTrkItsHitMap, antin_cex::PLayersOk, antin_cex::APLayersOk, diff --git a/PWGLF/TableProducer/Nuspex/nucleiAntineutronCex.cxx b/PWGLF/TableProducer/Nuspex/nucleiAntineutronCex.cxx index 9e65b08eed9..71cbd488d71 100644 --- a/PWGLF/TableProducer/Nuspex/nucleiAntineutronCex.cxx +++ b/PWGLF/TableProducer/Nuspex/nucleiAntineutronCex.cxx @@ -103,9 +103,6 @@ struct NucleiAntineutronCex { histos.add("pEta", "Pseudorapidity;#eta;Entries", kTH1F, {{100, -10., 10.}}); histos.add("pP_ITScuts", "Momentum with ITS cuts;|p| (GeV/c);Entries", kTH1F, {{100, 0., 10.}}); - // test (MC) - histos.add("antip_test", "Secondary antiprotons;|p| (GeV/c);Entries", kTH1F, {{100, 0., 10.}}); - // Process enum breakdown (secondary antiproton that anchors the SV) histos.add("hProcEnumAP_CEX", "procEnum of secondary #bar{p} (CEX);procEnum;Entries", kTH1I, {{100, -0.5, 99.5}}); histos.add("hProcEnumAP_BG", "procEnum of secondary #bar{p} (BG);procEnum;Entries", kTH1I, {{100, -0.5, 99.5}}); @@ -154,8 +151,8 @@ struct NucleiAntineutronCex { histos.add("hDeltaP_BG", "|p_{mother}-Σp_{SV}| (BG);Δp (GeV/c);Entries", kTH1F, {{200, 0., 10.}}); // Mother IB hits - histos.add("hMotherNHitIB_CEX", "Mother #bar{p} IB hit layers (L0-L2) (CEX);N_{IB layers};Entries", kTH1I, {{4, -0.5, 3.5}}); - histos.add("hMotherNHitIB_BG", "Mother #bar{p} IB hit layers (L0-L2) (BG);N_{IB layers};Entries", kTH1I, {{4, -0.5, 3.5}}); + histos.add("hMotherNHitIB_CEX", "Mother IB hit layers (L0-L2) (CEX);N_{IB layers};Entries", kTH1I, {{5, -1.5, 4.5}}); + histos.add("hMotherNHitIB_BG", "Mother IB hit layers (L0-L2) (BG);N_{IB layers};Entries", kTH1I, {{5, -1.5, 4.5}}); // CEX pair from antineutron (TRK) histos.add("cex_pairtrk_angle", "Pair opening angle (tracks);Angle (°);Entries", kTH1F, {{180, 0., 180.}}); @@ -287,7 +284,6 @@ struct NucleiAntineutronCex { const bool isSecondaryFromMaterial = (!particle.producedByGenerator()) && (procEnum == kPHadronic || procEnum == kPHInhelastic); if (particle.pdgCode() != -kProton || !isSecondaryFromMaterial || particle.mothersIds().empty()) continue; - histos.fill(HIST("antip_test"), particle.p()); // Primary mother bool hasPrimaryMotherAntip = false; @@ -564,8 +560,7 @@ struct NucleiAntineutronCex { float antipTrkTgl = 0.f; bool motherHasTrack = false; - uint16_t motherItsMap = 0; - int motherNHitIB = 0; // number of hits in IB (L0-L2) + int motherNHitIB = -1; // number of hits in IB (L0-L2) o2::aod::ITSResponse itsResponse; @@ -596,7 +591,6 @@ struct NucleiAntineutronCex { if (mc.globalIndex() == motherId) { motherHasTrack = true; - motherItsMap = static_cast(track.itsClusterMap()); motherNHitIB = static_cast(hitL0) + static_cast(hitL1) + static_cast(hitL2); } @@ -738,8 +732,12 @@ struct NucleiAntineutronCex { const TVector3 pv2sv(secX - pvtxX, secY - pvtxY, secZ - pvtxZ); const double pairPointingAngleDeg = pv2sv.Angle(total_trk_pVec) * Rad2Deg; - const TVector3 zAxis(0., 0., 1.); - const double pvsvAngleZDeg = pv2sv.Angle(zAxis) * Rad2Deg; + const double pvsvThetaDeg = pv2sv.Theta() * Rad2Deg; + + double pvsvPhiDeg = pv2sv.Phi() * Rad2Deg; + if (pvsvPhiDeg < 0.) { + pvsvPhiDeg += 360.; + } const double pP = pVecProton_trk.Mag(); const double pAP = AntipVecProton_trk.Mag(); @@ -858,7 +856,7 @@ struct NucleiAntineutronCex { if (std::abs(q) > 0.0) { ++vtxNCh; } else { - ++vtxNN; + ++vtxNNeut; } } @@ -908,6 +906,7 @@ struct NucleiAntineutronCex { outPairs( isCex, motherPdg, + motherNHitIB, colId, pId, antipId, @@ -966,7 +965,8 @@ struct NucleiAntineutronCex { selMask, pairPointingAngleDeg, - pvsvAngleZDeg, + pvsvThetaDeg, + pvsvPhiDeg, pairPBalance, pairPtBalance, pairQ, From 68918800d61fb4ad5f8ae40b0872c9673a90c467 Mon Sep 17 00:00:00 2001 From: FabiolaLP Date: Wed, 13 May 2026 12:59:59 -0600 Subject: [PATCH 3/4] Update antineutron CEX table and task --- PWGLF/DataModel/LFAntinCexTables.h | 25 +- .../Nuspex/nucleiAntineutronCex.cxx | 218 +++++------------- 2 files changed, 67 insertions(+), 176 deletions(-) diff --git a/PWGLF/DataModel/LFAntinCexTables.h b/PWGLF/DataModel/LFAntinCexTables.h index 0e762f03e17..ec4a90d2ed0 100644 --- a/PWGLF/DataModel/LFAntinCexTables.h +++ b/PWGLF/DataModel/LFAntinCexTables.h @@ -26,12 +26,12 @@ namespace o2::aod namespace antin_cex { // Metadata -DECLARE_SOA_COLUMN(IsCex, isCex, bool); // 1=CEX (from antin), 0=BG -DECLARE_SOA_COLUMN(MotherPdg, motherPdg, int32_t); // mother PDG -DECLARE_SOA_COLUMN(MotherNHitIB, motherNHitIB, int); // mother IB Hits -DECLARE_SOA_COLUMN(ColId, colId, int32_t); // mcCollisionId -DECLARE_SOA_COLUMN(PId, pId, int32_t); // proton MC id -DECLARE_SOA_COLUMN(AntipId, antipId, int32_t); // antiproton MC id +DECLARE_SOA_COLUMN(IsCex, isCex, bool); // 1=CEX (from antin), 0=BG +DECLARE_SOA_COLUMN(MotherPdg, motherPdg, int32_t); // mother PDG +DECLARE_SOA_COLUMN(MotherP, motherP, float); // mother P +DECLARE_SOA_COLUMN(ColId, colId, int32_t); // mcCollisionId +DECLARE_SOA_COLUMN(PId, pId, int32_t); // proton MC id +DECLARE_SOA_COLUMN(AntipId, antipId, int32_t); // antiproton MC id // MC (pair) DECLARE_SOA_COLUMN(McPairP, mcPairP, float); @@ -42,12 +42,6 @@ DECLARE_SOA_COLUMN(McAngleDeg, mcAngleDeg, float); DECLARE_SOA_COLUMN(McVtxX, mcVtxX, float); DECLARE_SOA_COLUMN(McVtxY, mcVtxY, float); DECLARE_SOA_COLUMN(McVtxZ, mcVtxZ, float); -DECLARE_SOA_COLUMN(VtxNAll, vtxNAll, int16_t); -DECLARE_SOA_COLUMN(VtxNCh, vtxNCh, int16_t); -DECLARE_SOA_COLUMN(VtxNNeut, vtxNNeut, int16_t); -DECLARE_SOA_COLUMN(VtxNPi0, vtxNPi0, int16_t); -DECLARE_SOA_COLUMN(VtxNGamma, vtxNGamma, int16_t); -DECLARE_SOA_COLUMN(VtxNN, vtxNN, int16_t); // Tracks (pair, fitter) DECLARE_SOA_COLUMN(TrkPairP, trkPairP, float); @@ -108,8 +102,6 @@ DECLARE_SOA_COLUMN(SVDeltaRToLayer, svDeltaRToLayer, float); DECLARE_SOA_COLUMN(PTrkItsHitMap, pTrkItsHitMap, uint16_t); DECLARE_SOA_COLUMN(APTrkItsHitMap, apTrkItsHitMap, uint16_t); -DECLARE_SOA_COLUMN(PLayersOk, pLayersOk, int8_t); -DECLARE_SOA_COLUMN(APLayersOk, apLayersOk, int8_t); DECLARE_SOA_COLUMN(PVtxZ, pVtxZ, float); @@ -127,10 +119,9 @@ DECLARE_SOA_COLUMN(AntipTrkTgl, antipTrkTgl, float); // Table DECLARE_SOA_TABLE(AntinCexPairs, "AOD", "ANTINCEX", antin_cex::IsCex, - antin_cex::MotherPdg, antin_cex::MotherNHitIB, antin_cex::ColId, antin_cex::PId, antin_cex::AntipId, + antin_cex::MotherPdg, antin_cex::MotherP, antin_cex::ColId, antin_cex::PId, antin_cex::AntipId, antin_cex::McPairP, antin_cex::McPairPt, antin_cex::McPairPz, antin_cex::McDplane, antin_cex::McAngleDeg, antin_cex::McVtxX, antin_cex::McVtxY, antin_cex::McVtxZ, - antin_cex::VtxNAll, antin_cex::VtxNCh, antin_cex::VtxNNeut, antin_cex::VtxNPi0, antin_cex::VtxNGamma, antin_cex::VtxNN, antin_cex::TrkPairP, antin_cex::TrkPairPt, antin_cex::TrkPairPz, antin_cex::TrkAngleDeg, antin_cex::TrkVtxfitDcaPair, antin_cex::TrkVtxfitR, antin_cex::TrkVtxfitDistToPv, antin_cex::TrkVtxfitSecVtxX, antin_cex::TrkVtxfitSecVtxY, antin_cex::TrkVtxfitSecVtxZ, @@ -142,7 +133,7 @@ DECLARE_SOA_TABLE(AntinCexPairs, "AOD", "ANTINCEX", antin_cex::PairPointingAngleDeg, antin_cex::PvsvThetaDeg, antin_cex::PvsvPhiDeg, antin_cex::PairPBalance, antin_cex::PairPtBalance, antin_cex::PairQ, antin_cex::DPairP, antin_cex::DPairPt, antin_cex::DPairPz, antin_cex::DOpenAngle, antin_cex::SVNearestLayerId, antin_cex::SVDeltaRToLayer, - antin_cex::PTrkItsHitMap, antin_cex::APTrkItsHitMap, antin_cex::PLayersOk, antin_cex::APLayersOk, + antin_cex::PTrkItsHitMap, antin_cex::APTrkItsHitMap, antin_cex::PVtxZ, antin_cex::PTrkItsNSigmaPr, antin_cex::PTrkItsPidValid, antin_cex::PTrkTgl, antin_cex::AntipTrkItsNSigmaPr, antin_cex::AntipTrkItsPidValid, antin_cex::AntipTrkTgl); diff --git a/PWGLF/TableProducer/Nuspex/nucleiAntineutronCex.cxx b/PWGLF/TableProducer/Nuspex/nucleiAntineutronCex.cxx index 71cbd488d71..d5eebf64f80 100644 --- a/PWGLF/TableProducer/Nuspex/nucleiAntineutronCex.cxx +++ b/PWGLF/TableProducer/Nuspex/nucleiAntineutronCex.cxx @@ -14,24 +14,22 @@ /// \brief Analysis task for antineutron detection through cex interactions /// \author Fabiola Lugo /// +#include +#include +#include +#include #include - #include - #include #include #include -#include -#include -#include -#include #include -#include #include #include #include +#include #include #include @@ -46,15 +44,15 @@ using o2::constants::math::Rad2Deg; struct NucleiAntineutronCex { // Slicing per colision Preslice perMcByColl = aod::mcparticle::mcCollisionId; - // Check available tables in the AOD, specifically TracksIU, TracksCovIU + using TracksWCovMc = soa::Join; // === Cut values === static constexpr double kIts2MinR = 4.5; // ITS2 min radius (exluding IB) [cm] static constexpr double kIts2MaxR = 48.0; // ITS2 max radius [cm] static constexpr double kIts2MaxVz = 39.0; // ITS2 max |vz| [cm] - static constexpr double kAccMaxEta = 1.2; // acceptance |eta| - static constexpr double kAccMaxVz = 10.0; // acceptance |vz| [cm] + static constexpr double kAccMaxEta = 1.2; // acceptance |eta| (primary particles) + static constexpr double kAccMaxVz = 10.0; // acceptance |vz| (primary particles) [cm] static constexpr double kStrictEta = 0.9; // tighter eta cut static constexpr double kInitDplane = 10.0; // init dplane static constexpr double kHuge = 1e9; // fallback for bad denom @@ -102,33 +100,18 @@ struct NucleiAntineutronCex { histos.add("pPz", "p_{z};p_{z} (GeV/c);Entries", kTH1F, {{100, -10., 10.}}); histos.add("pEta", "Pseudorapidity;#eta;Entries", kTH1F, {{100, -10., 10.}}); histos.add("pP_ITScuts", "Momentum with ITS cuts;|p| (GeV/c);Entries", kTH1F, {{100, 0., 10.}}); - + // Process enum breakdown (secondary antiproton that anchors the SV) histos.add("hProcEnumAP_CEX", "procEnum of secondary #bar{p} (CEX);procEnum;Entries", kTH1I, {{100, -0.5, 99.5}}); - histos.add("hProcEnumAP_BG", "procEnum of secondary #bar{p} (BG);procEnum;Entries", kTH1I, {{100, -0.5, 99.5}}); - - // Multiplicity/composition at the SV (MC truth, for FINAL selected candidates) - histos.add("hVtxNAll_CEX", "N(all) secondaries at SV (CEX);N;Entries", kTH1I, {{60, -0.5, 59.5}}); - histos.add("hVtxNAll_BG", "N(all) secondaries at SV (BG);N;Entries", kTH1I, {{60, -0.5, 59.5}}); - histos.add("hVtxNCh_CEX", "N(charged) secondaries at SV (CEX);N;Entries", kTH1I, {{60, -0.5, 59.5}}); - histos.add("hVtxNCh_BG", "N(charged) secondaries at SV (BG);N;Entries", kTH1I, {{60, -0.5, 59.5}}); - histos.add("hVtxNNeut_CEX", "N(neutral) secondaries at SV (CEX);N;Entries", kTH1I, {{60, -0.5, 59.5}}); - histos.add("hVtxNNeut_BG", "N(neutral) secondaries at SV (BG);N;Entries", kTH1I, {{60, -0.5, 59.5}}); - - histos.add("hVtxNPi0_CEX", "N(#pi^{0}) at SV (CEX);N;Entries", kTH1I, {{40, -0.5, 39.5}}); - histos.add("hVtxNPi0_BG", "N(#pi^{0}) at SV (BG);N;Entries", kTH1I, {{40, -0.5, 39.5}}); - histos.add("hVtxNGamma_CEX", "N(#gamma) at SV (CEX);N;Entries", kTH1I, {{60, -0.5, 59.5}}); - histos.add("hVtxNGamma_BG", "N(#gamma) at SV (BG);N;Entries", kTH1I, {{60, -0.5, 59.5}}); - histos.add("hVtxNN_CEX", "N(n) at SV (CEX);N;Entries", kTH1I, {{40, -0.5, 39.5}}); - histos.add("hVtxNN_BG", "N(n) at SV (BG);N;Entries", kTH1I, {{40, -0.5, 39.5}}); - + histos.add("hProcEnumAP_BG", "procEnum of secondary #bar{p} (BG);procEnum;Entries", kTH1I, {{100, -0.5, 99.5}}); + // CEX pair from antineutron (MC) histos.add("cexPairMcP", "CEX pair total momentum;|p| (GeV/c);Entries", kTH1F, {{100, 0., 10.}}); histos.add("cexPairMcPt", "CEX pair p_{T};p_{T} (GeV/c);Entries", kTH1F, {{100, 0., 10.}}); histos.add("cexPairMcPz", "CEX pair p_{z};p_{z} (GeV/c);Entries", kTH1F, {{100, -10., 10.}}); histos.add("cex_pairmcDplane", "CEX pair d_{plane};d_{plane} (cm);Entries", kTH1F, {{100, 0., 10.}}); histos.add("cex_pairmc_angle", "Pair opening angle;Angle (°);Entries", kTH1F, {{180, 0., 180.}}); - histos.add("cex_pairmc_vtx", "MC CEX pair vertex;X (cm);Y (cm)", kTH2F, {{100, -50., 50.}, {100, -50., 50.}}); + histos.add("cex_pairmc_vtx", "MC CEX pair vertex;X (cm);Y (cm)", kTH2F, {{200, -60., 60.}, {200, -60., 60.}}); histos.add("cex_pairmc_vtxz", "MC secondary vertex Z;Z (cm);Entries", kTH1F, {{200, -60., 60.}}); histos.add("cexPairMcPITScuts", "CEX pair momentum (ITS cuts);|p| (GeV/c);Entries", kTH1F, {{100, 0., 10.}}); @@ -143,16 +126,12 @@ struct NucleiAntineutronCex { histos.add("cexbg_pairmc_pz", "Background pair p_{z};p_{z} (GeV/c);Entries", kTH1F, {{100, -10., 10.}}); histos.add("cexbg_pairmcDplane", "Background d_{plane};d_{plane} (cm);Entries", kTH1F, {{100, 0., 10.}}); histos.add("cexbg_pairmc_angle", "Background opening angle;Angle (°);Entries", kTH1F, {{180, 0., 180.}}); - histos.add("cexbg_pairmc_vtx", "Background pair vertex;X (cm);Y (cm)", kTH2F, {{100, -50., 50.}, {100, -50., 50.}}); + histos.add("cexbg_pairmc_vtx", "Background pair vertex;X (cm);Y (cm)", kTH2F, {{200, -60., 60.}, {200, -60., 60.}}); histos.add("cexbg_pairmc_vtxz", "Background secondary vertex Z;Z (cm);Entries", kTH1F, {{200, -60., 60.}}); histos.add("cexbg_pairmc_pITScuts", "Background momentum (ITS cuts);|p| (GeV/c);Entries", kTH1F, {{100, 0., 10.}}); - - histos.add("hDeltaP_CEX", "|p_{mother}-Σp_{SV}| (CEX);Δp (GeV/c);Entries", kTH1F, {{200, 0., 10.}}); - histos.add("hDeltaP_BG", "|p_{mother}-Σp_{SV}| (BG);Δp (GeV/c);Entries", kTH1F, {{200, 0., 10.}}); - - // Mother IB hits - histos.add("hMotherNHitIB_CEX", "Mother IB hit layers (L0-L2) (CEX);N_{IB layers};Entries", kTH1I, {{5, -1.5, 4.5}}); - histos.add("hMotherNHitIB_BG", "Mother IB hit layers (L0-L2) (BG);N_{IB layers};Entries", kTH1I, {{5, -1.5, 4.5}}); + + //Pi0 events + histos.add("cexPairMcP_pi0", "CEX pair total momentum;|p| (GeV/c);Entries", kTH1F, {{100, 0., 10.}}); // CEX pair from antineutron (TRK) histos.add("cex_pairtrk_angle", "Pair opening angle (tracks);Angle (°);Entries", kTH1F, {{180, 0., 180.}}); @@ -324,7 +303,7 @@ struct NucleiAntineutronCex { double antipE = particle.e(); int antipId = particle.globalIndex(); - // Selection conditions: Produced in the ITS + // Selection conditions: Produced in the ITS IB const double r = std::sqrt(antipVx * antipVx + antipVy * antipVy); // Config for ITS // if(3.9<=r && r<=43.0 && std::abs(antipVz)<=48.9){ @@ -387,9 +366,36 @@ struct NucleiAntineutronCex { break; } } - + if (pionPlus || pionMinus) continue; + + // Pion 0 count + bool pion0 = false; + for (const auto& particle4 : mcPartsThis) { + if (particle4.mcCollisionId() != colId) + continue; + const auto proc4Enum = particle4.getProcess(); + const bool isSecondaryFromMaterial4 = (!particle4.producedByGenerator()) && (proc4Enum == kPHadronic || proc4Enum == kPHInhelastic); + if (particle4.pdgCode() != kPi0 || !isSecondaryFromMaterial4 || particle4.mothersIds().empty()) + continue; + bool hasPrimaryMotherPi0 = false; + for (const auto& mother : particle4.mothers_as()) { + if (mother.isPhysicalPrimary()) { + hasPrimaryMotherPi0 = true; + break; + } + } + if (!hasPrimaryMotherPi0) + continue; + double pi0Vx = particle4.vx(); + double pi0Vy = particle4.vy(); + double pi0Vz = particle4.vz(); + if (std::abs(pi0Vx - antipVx) < kVtxTol && std::abs(pi0Vy - antipVy) < kVtxTol && std::abs(pi0Vz - antipVz) < kVtxTol) { + pion0 = true; + break; + } + } // CEX selection double dplane = kInitDplane; @@ -448,7 +454,6 @@ struct NucleiAntineutronCex { continue; // CEX proton selection - // dplaneTmp = (pPy*antipPz - pPz*antipPy)*(pvtxX-antipVx) + (pPz*antipPx - pPx*antipPz)*(pvtxY-antipVy) + (pPx*antipPy - pPy*antipPx)*(pvtxZ-antipVz); double nx = (pPy * antipPz - pPz * antipPy); double ny = (pPz * antipPx - pPx * antipPz); double nz = (pPx * antipPy - pPy * antipPx); @@ -513,6 +518,8 @@ struct NucleiAntineutronCex { histos.fill(HIST("cexn_pairmc_pt"), cexPairMcPt / motherPt); if (motherPz != 0) histos.fill(HIST("cexn_pairmc_pz"), cexPairMcPz / motherPz); + if (motherP != 0 && pion0) + histos.fill(HIST("cexPairMcP_pi0"), cexPairMcP / motherP); } // BG mother if (motherPdg != -kNeutron) { @@ -528,8 +535,8 @@ struct NucleiAntineutronCex { histos.fill(HIST("cexbg_pairmc_pITScuts"), cexPairMcP); } - // Detector signal - bool antipLayers = false; + // Reconstructed data + bool antipLayers_condition = false; bool antipHasTrack = false; double antipTrkPx = 0.; double antipTrkPy = 0.; @@ -544,7 +551,7 @@ struct NucleiAntineutronCex { int8_t pTrkItsPidValid = 0; float pTrkTgl = 0.f; - bool pLayers = false; + bool pLayers_condition = false; bool pHasTrack = false; double pTrkPx = 0.; double pTrkPy = 0.; @@ -559,9 +566,6 @@ struct NucleiAntineutronCex { int8_t antipTrkItsPidValid = 0; float antipTrkTgl = 0.f; - bool motherHasTrack = false; - int motherNHitIB = -1; // number of hits in IB (L0-L2) - o2::aod::ITSResponse itsResponse; for (const auto& track : tracks) { @@ -589,11 +593,6 @@ struct NucleiAntineutronCex { int nITS = track.itsNCls(); bool layerCondition = (!hitIB) && hitOuter && (nITS >= kMinItsHits); - if (mc.globalIndex() == motherId) { - motherHasTrack = true; - motherNHitIB = static_cast(hitL0) + static_cast(hitL1) + static_cast(hitL2); - } - if (mc.globalIndex() == antipId) { antipTrkP = track.p(); antipTrkPx = track.px(); @@ -609,9 +608,8 @@ struct NucleiAntineutronCex { antipTrkItsPidValid = std::isfinite(nsigmaITSantip) ? 1 : 0; antipHasTrack = true; apItsMap = static_cast(track.itsClusterMap()); - antipLayers = (apItsMap != 0); if (layerCondition) - antipLayers = true; + antipLayers_condition = true; if (motherPdg == -kNeutron) { histos.fill(HIST("apItsNsigmaPr"), antipTrkItsNSigmaPr); histos.fill(HIST("apItsPidValid"), antipTrkItsPidValid); @@ -638,9 +636,8 @@ struct NucleiAntineutronCex { pTrkItsPidValid = std::isfinite(nsigmaITSp) ? 1 : 0; pHasTrack = true; pItsMap = static_cast(track.itsClusterMap()); - pLayers = (pItsMap != 0); if (layerCondition) - pLayers = true; + pLayers_condition = true; if (motherPdg == -kNeutron) { histos.fill(HIST("pItsNsigmaPr"), pTrkItsNSigmaPr); histos.fill(HIST("pItsPidValid"), pTrkItsPidValid); @@ -718,7 +715,7 @@ struct NucleiAntineutronCex { if (motherPdg != -kNeutron) histos.fill(HIST("cexbg_pairtrkVtxfitDcaPair"), dcaPair); - if (!(antipLayers && pLayers)) + if (!(antipLayers_condition && pLayers_condition)) continue; double cexPairTrkP = total_trk_pVec.Mag(); double cexPairTrkPt = total_trk_pVec.Pt(); @@ -731,7 +728,7 @@ struct NucleiAntineutronCex { const TVector3 pv2sv(secX - pvtxX, secY - pvtxY, secZ - pvtxZ); const double pairPointingAngleDeg = pv2sv.Angle(total_trk_pVec) * Rad2Deg; - + const double pvsvThetaDeg = pv2sv.Theta() * Rad2Deg; double pvsvPhiDeg = pv2sv.Phi() * Rad2Deg; @@ -800,113 +797,24 @@ struct NucleiAntineutronCex { histos.fill(HIST("vtxfit_mc_d3D"), d3d); const bool isCex = (motherPdg == -kNeutron); - + // Nature of the process if (isCex) { histos.fill(HIST("hProcEnumAP_CEX"), static_cast(procEnum)); } else { histos.fill(HIST("hProcEnumAP_BG"), static_cast(procEnum)); } - - // Count material secondaries produced at the same SV as the selected secondary antiproton. - int vtxNAll = 0; - int vtxNCh = 0; - int vtxNNeut = 0; - int vtxNPi0 = 0; - int vtxNGamma = 0; - int vtxNN = 0; - double sumPx_vtx = 0.0; - double sumPy_vtx = 0.0; - double sumPz_vtx = 0.0; - auto* pdgDB = TDatabasePDG::Instance(); - - for (const auto& particle5 : mcPartsThis) { - if (particle5.mcCollisionId() != colId) { - continue; - } - // Same SV (use the SV of the selected secondary antiproton) - if (std::abs(particle5.vx() - antipVx) >= kVtxTol || std::abs(particle5.vy() - antipVy) >= kVtxTol || std::abs(particle5.vz() - antipVz) >= kVtxTol) { - continue; - } - const auto proc5Enum = particle5.getProcess(); - const bool isSecondaryFromMaterial5 = - (!particle5.producedByGenerator()) && (proc5Enum == kPHadronic || proc5Enum == kPHInhelastic); - if (!isSecondaryFromMaterial5) { - continue; - } - ++vtxNAll; - sumPx_vtx += particle5.px(); - sumPy_vtx += particle5.py(); - sumPz_vtx += particle5.pz(); - const int pdg = particle5.pdgCode(); - if (pdg == kPi0) { - ++vtxNPi0; - } - if (pdg == kGamma) { - ++vtxNGamma; - } - if (pdg == kNeutron) { - ++vtxNN; - } - // Charged vs neutral via PDG database (Charge() is in units of e/3) - double q = 0.0; - if (auto* part = pdgDB->GetParticle(pdg)) { - q = part->Charge() / 3.0; - } - if (std::abs(q) > 0.0) { - ++vtxNCh; - } else { - ++vtxNNeut; - } - } - - // Fill histos (final selected candidates only) - if (isCex) { - histos.fill(HIST("hVtxNAll_CEX"), vtxNAll); - histos.fill(HIST("hVtxNCh_CEX"), vtxNCh); - histos.fill(HIST("hVtxNNeut_CEX"), vtxNNeut); - histos.fill(HIST("hVtxNPi0_CEX"), vtxNPi0); - histos.fill(HIST("hVtxNGamma_CEX"), vtxNGamma); - histos.fill(HIST("hVtxNN_CEX"), vtxNN); - } else { - histos.fill(HIST("hVtxNAll_BG"), vtxNAll); - histos.fill(HIST("hVtxNCh_BG"), vtxNCh); - histos.fill(HIST("hVtxNNeut_BG"), vtxNNeut); - histos.fill(HIST("hVtxNPi0_BG"), vtxNPi0); - histos.fill(HIST("hVtxNGamma_BG"), vtxNGamma); - histos.fill(HIST("hVtxNN_BG"), vtxNN); - } - + const float vtxfitDX = secX - antipVx; const float vtxfitDY = secY - antipVy; const float vtxfitDZ = secZ - antipVz; const float vtxfitD3D = std::sqrt(vtxfitDX * vtxfitDX + vtxfitDY * vtxfitDY + vtxfitDZ * vtxfitDZ); - - const double dPx = motherPx - sumPx_vtx; - const double dPy = motherPy - sumPy_vtx; - const double dPz = motherPz - sumPz_vtx; - const double deltaP = std::sqrt(dPx * dPx + dPy * dPy + dPz * dPz); - - if (isCex) { - histos.fill(HIST("hDeltaP_CEX"), deltaP); - } else { - histos.fill(HIST("hDeltaP_BG"), deltaP); - } - - if (motherHasTrack) { - if (isCex) { - histos.fill(HIST("hMotherNHitIB_CEX"), motherNHitIB); - } else { - histos.fill(HIST("hMotherNHitIB_BG"), motherNHitIB); - } - } - const uint32_t selMask = 0u; outPairs( isCex, motherPdg, - motherNHitIB, + motherP, colId, pId, antipId, @@ -920,13 +828,6 @@ struct NucleiAntineutronCex { antipVy, antipVz, - static_cast(vtxNAll), - static_cast(vtxNCh), - static_cast(vtxNNeut), - static_cast(vtxNPi0), - static_cast(vtxNGamma), - static_cast(vtxNN), - cexPairTrkP, cexPairTrkPt, cexPairTrkPz, @@ -981,8 +882,6 @@ struct NucleiAntineutronCex { pItsMap, apItsMap, - static_cast(pLayers ? 1 : 0), - static_cast(antipLayers ? 1 : 0), pvtxZ, @@ -992,7 +891,8 @@ struct NucleiAntineutronCex { antipTrkItsNSigmaPr, antipTrkItsPidValid, - antipTrkTgl); + antipTrkTgl + ); } } // ==== end DCAFitter2 ==== From e5c7f98e46a11b5fbd994c669e3fae0b92b7806b Mon Sep 17 00:00:00 2001 From: FabiolaLP Date: Wed, 13 May 2026 13:05:32 -0600 Subject: [PATCH 4/4] Apply clang-format --- PWGLF/DataModel/LFAntinCexTables.h | 2 +- .../Nuspex/nucleiAntineutronCex.cxx | 38 +++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/PWGLF/DataModel/LFAntinCexTables.h b/PWGLF/DataModel/LFAntinCexTables.h index ec4a90d2ed0..9a1dcbffdb6 100644 --- a/PWGLF/DataModel/LFAntinCexTables.h +++ b/PWGLF/DataModel/LFAntinCexTables.h @@ -28,7 +28,7 @@ namespace antin_cex // Metadata DECLARE_SOA_COLUMN(IsCex, isCex, bool); // 1=CEX (from antin), 0=BG DECLARE_SOA_COLUMN(MotherPdg, motherPdg, int32_t); // mother PDG -DECLARE_SOA_COLUMN(MotherP, motherP, float); // mother P +DECLARE_SOA_COLUMN(MotherP, motherP, float); // mother P DECLARE_SOA_COLUMN(ColId, colId, int32_t); // mcCollisionId DECLARE_SOA_COLUMN(PId, pId, int32_t); // proton MC id DECLARE_SOA_COLUMN(AntipId, antipId, int32_t); // antiproton MC id diff --git a/PWGLF/TableProducer/Nuspex/nucleiAntineutronCex.cxx b/PWGLF/TableProducer/Nuspex/nucleiAntineutronCex.cxx index d5eebf64f80..8effc48efd6 100644 --- a/PWGLF/TableProducer/Nuspex/nucleiAntineutronCex.cxx +++ b/PWGLF/TableProducer/Nuspex/nucleiAntineutronCex.cxx @@ -14,22 +14,23 @@ /// \brief Analysis task for antineutron detection through cex interactions /// \author Fabiola Lugo /// -#include -#include -#include -#include - #include + #include + #include #include #include +#include +#include +#include +#include #include +#include #include #include #include -#include #include #include @@ -44,7 +45,7 @@ using o2::constants::math::Rad2Deg; struct NucleiAntineutronCex { // Slicing per colision Preslice perMcByColl = aod::mcparticle::mcCollisionId; - + using TracksWCovMc = soa::Join; // === Cut values === @@ -100,11 +101,11 @@ struct NucleiAntineutronCex { histos.add("pPz", "p_{z};p_{z} (GeV/c);Entries", kTH1F, {{100, -10., 10.}}); histos.add("pEta", "Pseudorapidity;#eta;Entries", kTH1F, {{100, -10., 10.}}); histos.add("pP_ITScuts", "Momentum with ITS cuts;|p| (GeV/c);Entries", kTH1F, {{100, 0., 10.}}); - + // Process enum breakdown (secondary antiproton that anchors the SV) histos.add("hProcEnumAP_CEX", "procEnum of secondary #bar{p} (CEX);procEnum;Entries", kTH1I, {{100, -0.5, 99.5}}); - histos.add("hProcEnumAP_BG", "procEnum of secondary #bar{p} (BG);procEnum;Entries", kTH1I, {{100, -0.5, 99.5}}); - + histos.add("hProcEnumAP_BG", "procEnum of secondary #bar{p} (BG);procEnum;Entries", kTH1I, {{100, -0.5, 99.5}}); + // CEX pair from antineutron (MC) histos.add("cexPairMcP", "CEX pair total momentum;|p| (GeV/c);Entries", kTH1F, {{100, 0., 10.}}); histos.add("cexPairMcPt", "CEX pair p_{T};p_{T} (GeV/c);Entries", kTH1F, {{100, 0., 10.}}); @@ -129,8 +130,8 @@ struct NucleiAntineutronCex { histos.add("cexbg_pairmc_vtx", "Background pair vertex;X (cm);Y (cm)", kTH2F, {{200, -60., 60.}, {200, -60., 60.}}); histos.add("cexbg_pairmc_vtxz", "Background secondary vertex Z;Z (cm);Entries", kTH1F, {{200, -60., 60.}}); histos.add("cexbg_pairmc_pITScuts", "Background momentum (ITS cuts);|p| (GeV/c);Entries", kTH1F, {{100, 0., 10.}}); - - //Pi0 events + + // Pi0 events histos.add("cexPairMcP_pi0", "CEX pair total momentum;|p| (GeV/c);Entries", kTH1F, {{100, 0., 10.}}); // CEX pair from antineutron (TRK) @@ -366,10 +367,10 @@ struct NucleiAntineutronCex { break; } } - + if (pionPlus || pionMinus) continue; - + // Pion 0 count bool pion0 = false; for (const auto& particle4 : mcPartsThis) { @@ -728,7 +729,7 @@ struct NucleiAntineutronCex { const TVector3 pv2sv(secX - pvtxX, secY - pvtxY, secZ - pvtxZ); const double pairPointingAngleDeg = pv2sv.Angle(total_trk_pVec) * Rad2Deg; - + const double pvsvThetaDeg = pv2sv.Theta() * Rad2Deg; double pvsvPhiDeg = pv2sv.Phi() * Rad2Deg; @@ -797,14 +798,14 @@ struct NucleiAntineutronCex { histos.fill(HIST("vtxfit_mc_d3D"), d3d); const bool isCex = (motherPdg == -kNeutron); - + // Nature of the process if (isCex) { histos.fill(HIST("hProcEnumAP_CEX"), static_cast(procEnum)); } else { histos.fill(HIST("hProcEnumAP_BG"), static_cast(procEnum)); } - + const float vtxfitDX = secX - antipVx; const float vtxfitDY = secY - antipVy; const float vtxfitDZ = secZ - antipVz; @@ -891,8 +892,7 @@ struct NucleiAntineutronCex { antipTrkItsNSigmaPr, antipTrkItsPidValid, - antipTrkTgl - ); + antipTrkTgl); } } // ==== end DCAFitter2 ====