Skip to content

Commit c9fe219

Browse files
committed
dev: adding FT0 to generated for closing centrality tests
1 parent 7942678 commit c9fe219

2 files changed

Lines changed: 53 additions & 14 deletions

File tree

PWGLF/DataModel/LFNonPromptCascadeTables.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,10 @@ DECLARE_SOA_COLUMN(NoSameBunchPileup, noSameBunchPileup, bool);
128128
DECLARE_SOA_COLUMN(GlobalBC, globalBC, uint64_t);
129129
DECLARE_SOA_COLUMN(PtGen, ptGen, float);
130130
DECLARE_SOA_COLUMN(PtRec, ptRec, float);
131+
DECLARE_SOA_COLUMN(EtaGen, etaGen, float);
132+
DECLARE_SOA_COLUMN(EtaRec, etaRec, float);
131133
DECLARE_SOA_COLUMN(MultGen, multGen, int);
134+
DECLARE_SOA_COLUMN(MultGenFT0, multGenFT0, int);
132135

133136
} // namespace NPCascadeTable
134137
DECLARE_SOA_TABLE(NPCascTable, "AOD", "NPCASCTABLE",
@@ -455,8 +458,11 @@ DECLARE_SOA_TABLE(NPCascTableGen, "AOD", "NPCASCTABLEGen",
455458
DECLARE_SOA_TABLE(NPMCChargedTable, "AOD", "NPMCChargedTABLE",
456459
NPCascadeTable::PtGen,
457460
NPCascadeTable::PtRec,
461+
NPCascadeTable::EtaGen,
462+
NPCascadeTable::EtaRec,
458463
NPCascadeTable::MultNTracksNP,
459-
NPCascadeTable::MultGen);
464+
NPCascadeTable::MultGen,
465+
NPCascadeTable::MultGenFT0);
460466
DECLARE_SOA_TABLE(NPCollisionTable, "AOD", "NPCollisionTABLE",
461467
NPCascadeTable::RunNumber,
462468
NPCascadeTable::GlobalBC,
@@ -469,7 +475,8 @@ DECLARE_SOA_TABLE(NPCollisionTable, "AOD", "NPCollisionTABLE",
469475
DECLARE_SOA_INDEX_COLUMN_FULL(NPCollision, npCollision, int32_t, NPCollisionTable, "");
470476
DECLARE_SOA_TABLE(NPRecoChargedCand, "AOD", "NPRecoChargedCand",
471477
NPCollisionId,
472-
NPCascadeTable::PtRec);
478+
NPCascadeTable::PtRec,
479+
NPCascadeTable::EtaRec);
473480
} // namespace o2::aod
474481

475482
#endif // PWGLF_DATAMODEL_LFNONPROMPTCASCADETABLES_H_

PWGLF/Tasks/Strangeness/nonPromptCascade.cxx

Lines changed: 44 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -841,6 +841,29 @@ struct NonPromptCascadeTask {
841841
return q != 0;
842842
};
843843

844+
static constexpr float minEtaFT0A = 3.5f;
845+
static constexpr float maxEtaFT0A = 4.9f;
846+
static constexpr float minEtaFT0C = -3.3f;
847+
static constexpr float maxEtaFT0C = -2.1f;
848+
static constexpr float invalidEta = -999.f;
849+
850+
auto isAcceptedMCParticleFT0 = [&](auto const& mcp) {
851+
if (!mcp.isPhysicalPrimary()) {
852+
return false;
853+
}
854+
855+
const float eta = mcp.eta();
856+
if (!((eta > minEtaFT0A && eta < maxEtaFT0A) || (eta > minEtaFT0C && eta < maxEtaFT0C))) {
857+
return false;
858+
}
859+
860+
int q = 0;
861+
if (auto pdg = pdgDB->GetParticle(mcp.pdgCode())) {
862+
q = static_cast<int>(std::round(pdg->Charge() / 3.0));
863+
}
864+
return q != 0;
865+
};
866+
844867
// ------------------------------------------------------------
845868
// Helper: accepted reconstructed track
846869
// Use same cuts as data.
@@ -866,6 +889,7 @@ struct NonPromptCascadeTask {
866889
// mcid: mc collision row of mc particle
867890
// ------------------------------------------------------------
868891
std::vector<int> mcMult(mcCollisions.size(), 0);
892+
std::vector<int> mcMultFT0(mcCollisions.size(), 0);
869893
// std::cout << "mcCollisions size:" << mcCollisions.size() << std::endl;
870894
for (auto const& mcp : mcParticles) {
871895
const int mcid = mcp.mcCollisionId();
@@ -874,10 +898,12 @@ struct NonPromptCascadeTask {
874898
LOG(info) << "0 This should never happen ?";
875899
continue;
876900
}
877-
if (!isAcceptedMCParticle(mcp)) {
878-
continue;
901+
if (isAcceptedMCParticle(mcp)) {
902+
++mcMult[mcid];
903+
}
904+
if (isAcceptedMCParticleFT0(mcp)) {
905+
++mcMultFT0[mcid];
879906
}
880-
++mcMult[mcid];
881907
}
882908

883909
// ------------------------------------------------------------
@@ -990,11 +1016,12 @@ struct NonPromptCascadeTask {
9901016
const int mcCollId = col.mcCollisionId();
9911017
const float multReco = recoMultDense[dIdx];
9921018
const float ptReco = trk.pt();
1019+
const float etaReco = trk.eta();
9931020

9941021
if (mcCollId < 0 || static_cast<int64_t>(mcCollId) >= mcCollisions.size()) {
9951022
if (writeRecoCollision[dIdx]) {
9961023
// Fake: accepted reco track whose reconstructed collision has no valid MC collision label.
997-
NPMCNTable(-1.f, ptReco, multReco, -1.f);
1024+
NPMCNTable(-1.f, ptReco, invalidEta, etaReco, multReco, -1.f, -1.f);
9981025
}
9991026
continue;
10001027
}
@@ -1003,7 +1030,7 @@ struct NonPromptCascadeTask {
10031030
if (mcPid < 0 || static_cast<int64_t>(mcPid) >= mcParticles.size()) {
10041031
if (writeMcCollision[mcCollId]) {
10051032
// Fake: accepted reco track with invalid or missing MC particle label.
1006-
NPMCNTable(-2.f, ptReco, multReco, -2.f);
1033+
NPMCNTable(-2.f, ptReco, invalidEta, etaReco, multReco, -2.f, mcMultFT0[mcCollId]);
10071034
}
10081035
continue;
10091036
}
@@ -1014,15 +1041,15 @@ struct NonPromptCascadeTask {
10141041
if (mcParCollId != mcCollId) {
10151042
if (writeMcCollision[mcCollId]) {
10161043
// Fake: reco collision and particle label point to different MC collisions.
1017-
NPMCNTable(-3.f, ptReco, multReco, -3.f);
1044+
NPMCNTable(-3.f, ptReco, invalidEta, etaReco, multReco, -3.f, mcMultFT0[mcCollId]);
10181045
}
10191046
continue;
10201047
}
10211048

10221049
if (!isAcceptedMCParticle(mcPar)) {
10231050
if (writeMcCollision[mcCollId]) {
10241051
// Feed-in: accepted reco track matched to truth outside fiducial phase space.
1025-
NPMCNTable(-4.f, ptReco, multReco, -4.f);
1052+
NPMCNTable(-4.f, ptReco, mcPar.eta(), etaReco, multReco, -4.f, mcMultFT0[mcCollId]);
10261053
}
10271054
continue;
10281055
}
@@ -1031,6 +1058,7 @@ struct NonPromptCascadeTask {
10311058

10321059
const float multMC = mcMult[mcCollId];
10331060
const float ptMC = mcPar.pt();
1061+
const float etaMC = mcPar.eta();
10341062

10351063
mRegistrydNdeta.fill(HIST("hdNdetaRM/hdNdetaRM"),
10361064
multMC,
@@ -1040,7 +1068,7 @@ struct NonPromptCascadeTask {
10401068

10411069
if (writeMcCollision[mcCollId]) {
10421070
// Matched: accepted truth particle reconstructed inside the fiducial reco phase space.
1043-
NPMCNTable(ptMC, ptReco, multReco, multMC);
1071+
NPMCNTable(ptMC, ptReco, etaMC, etaReco, multReco, multMC, mcMultFT0[mcCollId]);
10441072
}
10451073
}
10461074

@@ -1069,14 +1097,15 @@ struct NonPromptCascadeTask {
10691097
}
10701098

10711099
const float multMC = mcMult[mcid];
1100+
const float multMCFT0 = mcMultFT0[mcid];
10721101

10731102
mRegistrydNdeta.fill(HIST("hdNdetaRM/hdNdetaRMNotInRecoTrk"),
10741103
multMC,
10751104
mcp.pt());
10761105

10771106
if (writeMcCollision[mcid]) {
10781107
// Missed track: accepted truth particle in a reconstructed MC collision, but no accepted reco track.
1079-
NPMCNTable(mcp.pt(), -1.f, -1.f, multMC);
1108+
NPMCNTable(mcp.pt(), -1.f, mcp.eta(), invalidEta, -1.f, multMC, multMCFT0);
10801109
}
10811110
}
10821111

@@ -1089,6 +1118,7 @@ struct NonPromptCascadeTask {
10891118
}
10901119

10911120
const float multMC = mcMult[mcid];
1121+
const float multMCFT0 = mcMultFT0[mcid];
10921122

10931123
for (auto const& mcp : mcParticles) {
10941124
if (mcp.mcCollisionId() != mcid) {
@@ -1105,7 +1135,7 @@ struct NonPromptCascadeTask {
11051135

11061136
if (writeMcCollision[mcid]) {
11071137
// Missed collision: accepted truth particle from an MC collision with no reconstructed collision.
1108-
NPMCNTable(mcp.pt(), -2.f, -2.f, multMC);
1138+
NPMCNTable(mcp.pt(), -2.f, mcp.eta(), invalidEta, -2.f, multMC, multMCFT0);
11091139
}
11101140
}
11111141
}
@@ -1134,13 +1164,15 @@ struct NonPromptCascadeTask {
11341164
auto tracksThisColl = tracks.sliceBy(perCollisionSel, coll.globalIndex());
11351165
int multreco = 0;
11361166
std::vector<float> recoPts;
1167+
std::vector<float> recoEtas;
11371168
// std::cout << "tracks:" << tracksThisColl.size() << std::endl;
11381169
for (auto const& track : tracksThisColl) {
11391170
// std::cout << track.pt() << " tracks " << track.isGlobalTrack() << std::endl;
11401171
if (std::fabs(track.eta()) < cfgEtaCutdNdeta && track.tpcNClsFound() >= 80 && track.tpcNClsCrossedRows() >= 100) {
11411172
if (track.isGlobalTrack()) {
11421173
multreco++;
11431174
recoPts.push_back(track.pt());
1175+
recoEtas.push_back(track.eta());
11441176
}
11451177
}
11461178
}
@@ -1158,8 +1190,8 @@ struct NonPromptCascadeTask {
11581190
coll.multFT0M(),
11591191
coll.selection_bit(aod::evsel::kNoSameBunchPileup));
11601192
auto collIdx = NPCollsTable.lastIndex();
1161-
for (auto const& pt : recoPts) {
1162-
NPRecoCandTable(collIdx, pt);
1193+
for (size_t i = 0; i < recoPts.size(); ++i) {
1194+
NPRecoCandTable(collIdx, recoPts[i], recoEtas[i]);
11631195
}
11641196
}
11651197
}

0 commit comments

Comments
 (0)