Skip to content

Commit 96f9ae4

Browse files
committed
Fix MC check for charm + add more collision information
1 parent 63792d9 commit 96f9ae4

File tree

1 file changed

+39
-5
lines changed

1 file changed

+39
-5
lines changed

PWGHF/Tasks/checkMcPvContr.cxx

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,24 +50,36 @@ namespace check_mc_pv_contr
5050
// V0s
5151
DECLARE_SOA_COLUMN(IdCollGen, idCollGen, int); //! Generated collision index
5252
DECLARE_SOA_COLUMN(ImpParGen, impParGen, float); //! Generated impact parameter
53+
DECLARE_SOA_COLUMN(XCollGen, xCollGen, float); //! Generated x coordinate of the collision
54+
DECLARE_SOA_COLUMN(YCollGen, yCollGen, float); //! Generated y coordinate of the collision
55+
DECLARE_SOA_COLUMN(ZCollGen, zCollGen, float); //! Generated z coordinate of the collision
5356
DECLARE_SOA_COLUMN(TimeGen, timeGen, float); //! Generated collision time
5457
DECLARE_SOA_COLUMN(TimeRec, timeRec, float); //! Reconstructed collision time
5558
DECLARE_SOA_COLUMN(NCharm, nCharm, int); //! Number of charm quarks in the collision
5659
DECLARE_SOA_COLUMN(NCharmFromInj, nCharmFromInj, int); //! Number of charm quarks from injected events
5760
DECLARE_SOA_COLUMN(NPVContributors, nPVContributors, int); //! Number of contributors to the PV
5861
DECLARE_SOA_COLUMN(Centrality, centrality, int); //! Centrality FT0C
62+
DECLARE_SOA_COLUMN(XCollRec, xCollRec, float); //! Reconstructed x coordinate of the collision
63+
DECLARE_SOA_COLUMN(YCollRec, yCollRec, float); //! Reconstructed y coordinate of the collision
64+
DECLARE_SOA_COLUMN(ZCollRec, zCollRec, float); //! Reconstructed z coordinate of the collision
5965
DECLARE_SOA_COLUMN(BC, Bc, int); //! Bunch crossing
6066
} // namespace check_mc_pv_contr
6167

6268
DECLARE_SOA_TABLE(CheckInj, "AOD", "CHECKINJ", //! Table with PID information
6369
check_mc_pv_contr::IdCollGen,
6470
check_mc_pv_contr::ImpParGen,
71+
check_mc_pv_contr::XCollGen,
72+
check_mc_pv_contr::YCollGen,
73+
check_mc_pv_contr::ZCollGen,
6574
check_mc_pv_contr::TimeGen,
6675
check_mc_pv_contr::TimeRec,
6776
check_mc_pv_contr::NCharm,
6877
check_mc_pv_contr::NCharmFromInj,
6978
check_mc_pv_contr::NPVContributors,
7079
check_mc_pv_contr::Centrality,
80+
check_mc_pv_contr::XCollRec,
81+
check_mc_pv_contr::YCollRec,
82+
check_mc_pv_contr::ZCollRec,
7183
check_mc_pv_contr::BC);
7284
} // namespace o2::aod
7385

@@ -84,14 +96,32 @@ struct checkMcPvContr {
8496
HistogramRegistry registry{"registry", {}};
8597
std::shared_ptr<TH1> hCharmPerCollImpPar;
8698

99+
bool isCharm(int pdg)
100+
{
101+
if (std::abs(pdg) / 1000 == 4)
102+
return true;
103+
if (std::abs(pdg) / 100 == 4)
104+
return true;
105+
return false;
106+
}
107+
108+
bool isBeauty(int pdg)
109+
{
110+
if (std::abs(pdg) / 1000 == 5)
111+
return true;
112+
if (std::abs(pdg) / 100 == 5)
113+
return true;
114+
return false;
115+
}
116+
87117
void init(InitContext&)
88118
{
89119
registry.add("hCharmImpPar", ";Impact parameter (fm);Charm counts", {HistType::kTH1F, {{200, 0, 20}}});
90120
registry.add("hCollImpPar", ";Impact parameter (fm);Counts", {HistType::kTH1F, {{200, 0, 20}}});
91121
hCharmPerCollImpPar = registry.add<TH1>("hCharmPerCollImpPar", ";Impact parameter (fm);Charm counts per collision", {HistType::kTH1F, {{200, 0, 20}}});
92122

93-
registry.add("hDeltaX", ";#DeltaX (cm);Counts", {HistType::kTH1F, {{200, 0.01, 0.01}}});
94-
registry.add("hDeltaY", ";#DeltaY (cm);Counts", {HistType::kTH1F, {{200, 0.01, 0.01}}});
123+
registry.add("hDeltaX", ";#DeltaX (cm);Counts", {HistType::kTH1F, {{200, -0.01, 0.01}}});
124+
registry.add("hDeltaY", ";#DeltaY (cm);Counts", {HistType::kTH1F, {{200, -0.01, 0.01}}});
95125
registry.add("hDeltaZ", ";#DeltaZ (cm);Counts", {HistType::kTH1F, {{200, -0.01, 0.01}}});
96126
}
97127

@@ -100,6 +130,7 @@ struct checkMcPvContr {
100130
aod::McParticles const& mcParticles,
101131
aod::McCollisions const& mcCollisions)
102132
{
133+
assert(isCharm(413));
103134
int splitColls{0};
104135
for (const auto& mcColl : mcCollisions) {
105136
const auto collSlice = collisions.sliceBy(colPerMcCollision, mcColl.globalIndex());
@@ -124,7 +155,7 @@ struct checkMcPvContr {
124155
if (track.has_mcParticle()) {
125156
auto mcPart = track.mcParticle_as<aod::McParticles>();
126157
for (const auto& mother : mcPart.mothers_as<aod::McParticles>()) {
127-
if (std::abs(mother.pdgCode()) == 4) { // (anti)charm quark
158+
if (isCharm(mother.pdgCode())) { // charm hadron
128159
registry.fill(HIST("hDeltaX"), collision.posX() - collisions.rawIteratorAt(idxCollMostPVContrib).posX());
129160
registry.fill(HIST("hDeltaY"), collision.posY() - collisions.rawIteratorAt(idxCollMostPVContrib).posY());
130161
registry.fill(HIST("hDeltaZ"), collision.posZ() - collisions.rawIteratorAt(idxCollMostPVContrib).posZ());
@@ -137,15 +168,18 @@ struct checkMcPvContr {
137168
}
138169
}
139170
}
140-
checkInj(mcColl.globalIndex(), mcColl.impactParameter(), mcColl.t(), collision.collisionTime(), charmIds.size(), fromSignalEv, collision.numContrib(), collision.centFT0C(), collision.bcId());
171+
checkInj(
172+
mcColl.globalIndex(), mcColl.impactParameter(), mcColl.posX(), mcColl.posY(), mcColl.posZ(), mcColl.t(), collision.collisionTime(),
173+
charmIds.size(), fromSignalEv, collision.numContrib(), collision.centFT0C(), collision.posX(), collision.posY(), collision.posZ(),
174+
collision.bcId());
141175
}
142176
}
143177
for (const auto& mcColl : mcCollisions) {
144178
registry.fill(HIST("hCollImpPar"), mcColl.impactParameter());
145179
}
146180
int count_bkg{0}, count_sgn{0};
147181
for (const auto& mcPart : mcParticles) {
148-
if (std::abs(mcPart.pdgCode()) == 4) { // (anti)charm quark
182+
if (isCharm(mcPart.pdgCode())) { // charm hadron
149183
if (!mcPart.fromBackgroundEvent()) {
150184
auto mcCollision = mcPart.mcCollision_as<aod::McCollisions>();
151185
registry.fill(HIST("hCharmImpPar"), mcCollision.impactParameter());

0 commit comments

Comments
 (0)