Skip to content

Commit 2160cb5

Browse files
committed
Update nucleiAntineutronCex task
1 parent a7a0353 commit 2160cb5

2 files changed

Lines changed: 162 additions & 4 deletions

File tree

PWGLF/DataModel/LFAntinCexTables.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ DECLARE_SOA_COLUMN(McAngleDeg, mcAngleDeg, float);
4141
DECLARE_SOA_COLUMN(McVtxX, mcVtxX, float);
4242
DECLARE_SOA_COLUMN(McVtxY, mcVtxY, float);
4343
DECLARE_SOA_COLUMN(McVtxZ, mcVtxZ, float);
44+
DECLARE_SOA_COLUMN(VtxNAll, vtxNAll, int16_t);
45+
DECLARE_SOA_COLUMN(VtxNCh, vtxNCh, int16_t);
46+
DECLARE_SOA_COLUMN(VtxNNeut, vtxNNeut, int16_t);
47+
DECLARE_SOA_COLUMN(VtxNPi0, vtxNPi0, int16_t);
48+
DECLARE_SOA_COLUMN(VtxNGamma, vtxNGamma, int16_t);
49+
DECLARE_SOA_COLUMN(VtxNN, vtxNN, int16_t);
4450

4551
// Tracks (pair, fitter)
4652
DECLARE_SOA_COLUMN(TrkPairP, trkPairP, float);
@@ -85,6 +91,7 @@ DECLARE_SOA_COLUMN(AntipTrkNClsIts, antipTrkNClsIts, int16_t);
8591
DECLARE_SOA_COLUMN(SelMask, selMask, uint32_t);
8692

8793
DECLARE_SOA_COLUMN(PairPointingAngleDeg, pairPointingAngleDeg, float);
94+
DECLARE_SOA_COLUMN(PvsvAngleZDeg, pvsvAngleZDeg, float);
8895
DECLARE_SOA_COLUMN(PairPBalance, pairPBalance, float);
8996
DECLARE_SOA_COLUMN(PairPtBalance, pairPtBalance, float);
9097
DECLARE_SOA_COLUMN(PairQ, pairQ, float);
@@ -121,6 +128,7 @@ DECLARE_SOA_TABLE(AntinCexPairs, "AOD", "ANTINCEX",
121128
antin_cex::MotherPdg, antin_cex::ColId, antin_cex::PId, antin_cex::AntipId,
122129
antin_cex::McPairP, antin_cex::McPairPt, antin_cex::McPairPz,
123130
antin_cex::McDplane, antin_cex::McAngleDeg, antin_cex::McVtxX, antin_cex::McVtxY, antin_cex::McVtxZ,
131+
antin_cex::VtxNAll, antin_cex::VtxNCh, antin_cex::VtxNNeut, antin_cex::VtxNPi0, antin_cex::VtxNGamma, antin_cex::VtxNN,
124132
antin_cex::TrkPairP, antin_cex::TrkPairPt, antin_cex::TrkPairPz, antin_cex::TrkAngleDeg,
125133
antin_cex::TrkVtxfitDcaPair, antin_cex::TrkVtxfitR, antin_cex::TrkVtxfitDistToPv,
126134
antin_cex::TrkVtxfitSecVtxX, antin_cex::TrkVtxfitSecVtxY, antin_cex::TrkVtxfitSecVtxZ,
@@ -129,7 +137,7 @@ DECLARE_SOA_TABLE(AntinCexPairs, "AOD", "ANTINCEX",
129137
antin_cex::PTrkP, antin_cex::PTrkPx, antin_cex::PTrkPy, antin_cex::PTrkPz, antin_cex::PTrkEta, antin_cex::PTrkTpcSignal, antin_cex::PTrkNClsIts,
130138
antin_cex::AntipTrkP, antin_cex::AntipTrkPx, antin_cex::AntipTrkPy, antin_cex::AntipTrkPz, antin_cex::AntipTrkEta, antin_cex::AntipTrkTpcSignal, antin_cex::AntipTrkNClsIts,
131139
antin_cex::SelMask,
132-
antin_cex::PairPointingAngleDeg, antin_cex::PairPBalance, antin_cex::PairPtBalance, antin_cex::PairQ,
140+
antin_cex::PairPointingAngleDeg, antin_cex::PvsvAngleZDeg, antin_cex::PairPBalance, antin_cex::PairPtBalance, antin_cex::PairQ,
133141
antin_cex::DPairP, antin_cex::DPairPt, antin_cex::DPairPz, antin_cex::DOpenAngle,
134142
antin_cex::SVNearestLayerId, antin_cex::SVDeltaRToLayer,
135143
antin_cex::PTrkItsHitMap, antin_cex::APTrkItsHitMap, antin_cex::PLayersOk, antin_cex::APLayersOk,

PWGLF/TableProducer/Nuspex/nucleiAntineutronCex.cxx

Lines changed: 153 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include <TMCProcess.h>
3232
#include <TMath.h>
3333
#include <TPDGCode.h>
34+
#include <TDatabasePDG.h>
3435
#include <TVector3.h>
3536

3637
#include <algorithm>
@@ -53,7 +54,7 @@ struct NucleiAntineutronCex {
5354
static constexpr double kIts2MaxR = 48.0; // ITS2 max radius [cm]
5455
static constexpr double kIts2MaxVz = 39.0; // ITS2 max |vz| [cm]
5556
static constexpr double kAccMaxEta = 1.2; // acceptance |eta|
56-
static constexpr double kAccMaxVz = 5.3; // acceptance |vz| [cm]
57+
static constexpr double kAccMaxVz = 10.0; // acceptance |vz| [cm]
5758
static constexpr double kStrictEta = 0.9; // tighter eta cut
5859
static constexpr double kInitDplane = 10.0; // init dplane
5960
static constexpr double kHuge = 1e9; // fallback for bad denom
@@ -104,7 +105,26 @@ struct NucleiAntineutronCex {
104105

105106
// test (MC)
106107
histos.add("antip_test", "Secondary antiprotons;|p| (GeV/c);Entries", kTH1F, {{100, 0., 10.}});
107-
108+
109+
// Process enum breakdown (secondary antiproton that anchors the SV)
110+
histos.add("hProcEnumAP_CEX", "procEnum of secondary #bar{p} (CEX);procEnum;Entries", kTH1I, {{100, -0.5, 99.5}});
111+
histos.add("hProcEnumAP_BG", "procEnum of secondary #bar{p} (BG);procEnum;Entries", kTH1I, {{100, -0.5, 99.5}});
112+
113+
//Multiplicity/composition at the SV (MC truth, for FINAL selected candidates)
114+
histos.add("hVtxNAll_CEX", "N(all) secondaries at SV (CEX);N;Entries", kTH1I, {{60, -0.5, 59.5}});
115+
histos.add("hVtxNAll_BG", "N(all) secondaries at SV (BG);N;Entries", kTH1I, {{60, -0.5, 59.5}});
116+
histos.add("hVtxNCh_CEX", "N(charged) secondaries at SV (CEX);N;Entries", kTH1I, {{60, -0.5, 59.5}});
117+
histos.add("hVtxNCh_BG", "N(charged) secondaries at SV (BG);N;Entries", kTH1I, {{60, -0.5, 59.5}});
118+
histos.add("hVtxNNeut_CEX", "N(neutral) secondaries at SV (CEX);N;Entries", kTH1I, {{60, -0.5, 59.5}});
119+
histos.add("hVtxNNeut_BG", "N(neutral) secondaries at SV (BG);N;Entries", kTH1I, {{60, -0.5, 59.5}});
120+
121+
histos.add("hVtxNPi0_CEX", "N(#pi^{0}) at SV (CEX);N;Entries", kTH1I, {{40, -0.5, 39.5}});
122+
histos.add("hVtxNPi0_BG", "N(#pi^{0}) at SV (BG);N;Entries", kTH1I, {{40, -0.5, 39.5}});
123+
histos.add("hVtxNGamma_CEX", "N(#gamma) at SV (CEX);N;Entries", kTH1I, {{60, -0.5, 59.5}});
124+
histos.add("hVtxNGamma_BG", "N(#gamma) at SV (BG);N;Entries", kTH1I, {{60, -0.5, 59.5}});
125+
histos.add("hVtxNN_CEX", "N(n) at SV (CEX);N;Entries", kTH1I, {{40, -0.5, 39.5}});
126+
histos.add("hVtxNN_BG", "N(n) at SV (BG);N;Entries", kTH1I, {{40, -0.5, 39.5}});
127+
108128
// CEX pair from antineutron (MC)
109129
histos.add("cexPairMcP", "CEX pair total momentum;|p| (GeV/c);Entries", kTH1F, {{100, 0., 10.}});
110130
histos.add("cexPairMcPt", "CEX pair p_{T};p_{T} (GeV/c);Entries", kTH1F, {{100, 0., 10.}});
@@ -129,6 +149,13 @@ struct NucleiAntineutronCex {
129149
histos.add("cexbg_pairmc_vtx", "Background pair vertex;X (cm);Y (cm)", kTH2F, {{100, -50., 50.}, {100, -50., 50.}});
130150
histos.add("cexbg_pairmc_vtxz", "Background secondary vertex Z;Z (cm);Entries", kTH1F, {{200, -60., 60.}});
131151
histos.add("cexbg_pairmc_pITScuts", "Background momentum (ITS cuts);|p| (GeV/c);Entries", kTH1F, {{100, 0., 10.}});
152+
153+
histos.add("hDeltaP_CEX", "|p_{mother}-Σp_{SV}| (CEX);Δp (GeV/c);Entries", kTH1F, {{200, 0., 10.}});
154+
histos.add("hDeltaP_BG", "|p_{mother}-Σp_{SV}| (BG);Δp (GeV/c);Entries", kTH1F, {{200, 0., 10.}});
155+
156+
// Mother IB hits
157+
histos.add("hMotherNHitIB_CEX", "Mother #bar{p} IB hit layers (L0-L2) (CEX);N_{IB layers};Entries", kTH1I, {{4, -0.5, 3.5}});
158+
histos.add("hMotherNHitIB_BG", "Mother #bar{p} IB hit layers (L0-L2) (BG);N_{IB layers};Entries", kTH1I, {{4, -0.5, 3.5}});
132159

133160
// CEX pair from antineutron (TRK)
134161
histos.add("cex_pairtrk_angle", "Pair opening angle (tracks);Angle (°);Entries", kTH1F, {{180, 0., 180.}});
@@ -265,21 +292,27 @@ struct NucleiAntineutronCex {
265292
// Primary mother
266293
bool hasPrimaryMotherAntip = false;
267294
double motherPt = 0.0;
295+
double motherPx = 0.0;
296+
double motherPy = 0.0;
268297
double motherPz = 0.0;
269298
double motherVz = 0.0;
270299
double motherP = 0.0;
271300
double motherEta = 0.0;
272301
int motherPdg = 0;
302+
int motherId = -1;
273303

274304
for (const auto& mother : particle.mothers_as<aod::McParticles>()) {
275305
if (mother.isPhysicalPrimary()) {
276306
hasPrimaryMotherAntip = true;
277307
motherPt = mother.pt();
308+
motherPx = mother.px();
309+
motherPy = mother.py();
278310
motherPz = mother.pz();
279311
motherVz = mother.vz();
280312
motherP = mother.p();
281313
motherEta = mother.eta();
282314
motherPdg = mother.pdgCode();
315+
motherId = mother.globalIndex();
283316
break;
284317
}
285318
}
@@ -529,6 +562,10 @@ struct NucleiAntineutronCex {
529562
float antipTrkItsNSigmaPr = -999.f;
530563
int8_t antipTrkItsPidValid = 0;
531564
float antipTrkTgl = 0.f;
565+
566+
bool motherHasTrack = false;
567+
uint16_t motherItsMap = 0;
568+
int motherNHitIB = 0; // number of hits in IB (L0-L2)
532569

533570
o2::aod::ITSResponse itsResponse;
534571

@@ -556,6 +593,12 @@ struct NucleiAntineutronCex {
556593
bool hitOuter = (hitL3 || hitL4 || hitL5 || hitL6);
557594
int nITS = track.itsNCls();
558595
bool layerCondition = (!hitIB) && hitOuter && (nITS >= kMinItsHits);
596+
597+
if (mc.globalIndex() == motherId) {
598+
motherHasTrack = true;
599+
motherItsMap = static_cast<uint16_t>(track.itsClusterMap());
600+
motherNHitIB = static_cast<int>(hitL0) + static_cast<int>(hitL1) + static_cast<int>(hitL2);
601+
}
559602

560603
if (mc.globalIndex() == antipId) {
561604
antipTrkP = track.p();
@@ -694,6 +737,9 @@ struct NucleiAntineutronCex {
694737

695738
const TVector3 pv2sv(secX - pvtxX, secY - pvtxY, secZ - pvtxZ);
696739
const double pairPointingAngleDeg = pv2sv.Angle(total_trk_pVec) * Rad2Deg;
740+
741+
const TVector3 zAxis(0., 0., 1.);
742+
const double pvsvAngleZDeg = pv2sv.Angle(zAxis) * Rad2Deg;
697743

698744
const double pP = pVecProton_trk.Mag();
699745
const double pAP = AntipVecProton_trk.Mag();
@@ -756,11 +802,106 @@ struct NucleiAntineutronCex {
756802
histos.fill(HIST("vtxfit_mc_d3D"), d3d);
757803

758804
const bool isCex = (motherPdg == -kNeutron);
805+
806+
// Nature of the process
807+
if (isCex) {
808+
histos.fill(HIST("hProcEnumAP_CEX"), static_cast<int>(procEnum));
809+
} else {
810+
histos.fill(HIST("hProcEnumAP_BG"), static_cast<int>(procEnum));
811+
}
812+
813+
// Count material secondaries produced at the same SV as the selected secondary antiproton.
814+
int vtxNAll = 0;
815+
int vtxNCh = 0;
816+
int vtxNNeut = 0;
817+
int vtxNPi0 = 0;
818+
int vtxNGamma = 0;
819+
int vtxNN = 0;
820+
double sumPx_vtx = 0.0;
821+
double sumPy_vtx = 0.0;
822+
double sumPz_vtx = 0.0;
823+
auto* pdgDB = TDatabasePDG::Instance();
824+
825+
for (const auto& particle5 : mcPartsThis) {
826+
if (particle5.mcCollisionId() != colId) {
827+
continue;
828+
}
829+
// Same SV (use the SV of the selected secondary antiproton)
830+
if (std::abs(particle5.vx() - antipVx) >= kVtxTol || std::abs(particle5.vy() - antipVy) >= kVtxTol || std::abs(particle5.vz() - antipVz) >= kVtxTol) {
831+
continue;
832+
}
833+
const auto proc5Enum = particle5.getProcess();
834+
const bool isSecondaryFromMaterial5 =
835+
(!particle5.producedByGenerator()) && (proc5Enum == kPHadronic || proc5Enum == kPHInhelastic);
836+
if (!isSecondaryFromMaterial5) {
837+
continue;
838+
}
839+
++vtxNAll;
840+
sumPx_vtx += particle5.px();
841+
sumPy_vtx += particle5.py();
842+
sumPz_vtx += particle5.pz();
843+
const int pdg = particle5.pdgCode();
844+
if (pdg == kPi0) {
845+
++vtxNPi0;
846+
}
847+
if (pdg == kGamma) {
848+
++vtxNGamma;
849+
}
850+
if (pdg == kNeutron) {
851+
++vtxNN;
852+
}
853+
// Charged vs neutral via PDG database (Charge() is in units of e/3)
854+
double q = 0.0;
855+
if (auto* part = pdgDB->GetParticle(pdg)) {
856+
q = part->Charge() / 3.0;
857+
}
858+
if (std::abs(q) > 0.0) {
859+
++vtxNCh;
860+
} else {
861+
++vtxNN;
862+
}
863+
}
864+
865+
// Fill histos (final selected candidates only)
866+
if (isCex) {
867+
histos.fill(HIST("hVtxNAll_CEX"),vtxNAll);
868+
histos.fill(HIST("hVtxNCh_CEX"),vtxNCh);
869+
histos.fill(HIST("hVtxNNeut_CEX"),vtxNNeut);
870+
histos.fill(HIST("hVtxNPi0_CEX"),vtxNPi0);
871+
histos.fill(HIST("hVtxNGamma_CEX"),vtxNGamma);
872+
histos.fill(HIST("hVtxNN_CEX"),vtxNN);
873+
} else {
874+
histos.fill(HIST("hVtxNAll_BG"),vtxNAll);
875+
histos.fill(HIST("hVtxNCh_BG"),vtxNCh);
876+
histos.fill(HIST("hVtxNNeut_BG"),vtxNNeut);
877+
histos.fill(HIST("hVtxNPi0_BG"),vtxNPi0);
878+
histos.fill(HIST("hVtxNGamma_BG"),vtxNGamma);
879+
histos.fill(HIST("hVtxNN_BG"),vtxNN);
880+
}
759881

760882
const float vtxfitDX = secX - antipVx;
761883
const float vtxfitDY = secY - antipVy;
762884
const float vtxfitDZ = secZ - antipVz;
763885
const float vtxfitD3D = std::sqrt(vtxfitDX * vtxfitDX + vtxfitDY * vtxfitDY + vtxfitDZ * vtxfitDZ);
886+
887+
const double dPx = motherPx - sumPx_vtx;
888+
const double dPy = motherPy - sumPy_vtx;
889+
const double dPz = motherPz - sumPz_vtx;
890+
const double deltaP = std::sqrt(dPx*dPx + dPy*dPy + dPz*dPz);
891+
892+
if (isCex) {
893+
histos.fill(HIST("hDeltaP_CEX"), deltaP);
894+
} else {
895+
histos.fill(HIST("hDeltaP_BG"), deltaP);
896+
}
897+
898+
if (motherHasTrack ) {
899+
if (isCex) {
900+
histos.fill(HIST("hMotherNHitIB_CEX"), motherNHitIB);
901+
} else {
902+
histos.fill(HIST("hMotherNHitIB_BG"), motherNHitIB);
903+
}
904+
}
764905

765906
const uint32_t selMask = 0u;
766907

@@ -779,6 +920,13 @@ struct NucleiAntineutronCex {
779920
antipVx,
780921
antipVy,
781922
antipVz,
923+
924+
static_cast<int16_t>(vtxNAll),
925+
static_cast<int16_t>(vtxNCh),
926+
static_cast<int16_t>(vtxNNeut),
927+
static_cast<int16_t>(vtxNPi0),
928+
static_cast<int16_t>(vtxNGamma),
929+
static_cast<int16_t>(vtxNN),
782930

783931
cexPairTrkP,
784932
cexPairTrkPt,
@@ -818,6 +966,7 @@ struct NucleiAntineutronCex {
818966
selMask,
819967

820968
pairPointingAngleDeg,
969+
pvsvAngleZDeg,
821970
pairPBalance,
822971
pairPtBalance,
823972
pairQ,
@@ -843,7 +992,8 @@ struct NucleiAntineutronCex {
843992

844993
antipTrkItsNSigmaPr,
845994
antipTrkItsPidValid,
846-
antipTrkTgl);
995+
antipTrkTgl
996+
);
847997
}
848998
}
849999
// ==== end DCAFitter2 ====

0 commit comments

Comments
 (0)