Skip to content

Commit 6276479

Browse files
authored
Add centrality information to MC collisions
1, Added centrality for MC collisions and updated relevant event split and event loose processing functions.
1 parent 4261565 commit 6276479

File tree

1 file changed

+49
-8
lines changed

1 file changed

+49
-8
lines changed

PWGHF/D2H/Tasks/taskXic0ToXiPi.cxx

Lines changed: 49 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "PWGHF/Core/HfHelper.h"
2020
#include "PWGHF/DataModel/CandidateReconstructionTables.h"
2121
#include "PWGHF/DataModel/CandidateSelectionTables.h"
22+
#include "PWGLF/DataModel/mcCentrality.h"
2223

2324
#include "Common/Core/RecoDecay.h"
2425
#include "Common/DataModel/Centrality.h"
@@ -81,6 +82,8 @@ struct HfTaskXic0ToXiPi {
8182
using CollisionsWithFT0M = soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Ms>;
8283
using CollisionsWithMcLabels = soa::Join<aod::Collisions, aod::McCollisionLabels, aod::EvSels>;
8384

85+
using McCollisionsCentFT0Ms = soa::Join<aod::McCollisions, aod::McCentFT0Ms>;
86+
8487
Filter filterSelectXic0Candidates = aod::hf_sel_toxipi::resultSelections == true;
8588
Filter filterXicMatchedRec = nabs(aod::hf_cand_xic0_omegac0::flagMcMatchRec) == static_cast<int8_t>(BIT(aod::hf_cand_xic0_omegac0::DecayType::XiczeroToXiPi));
8689
Filter filterXicMatchedGen = nabs(aod::hf_cand_xic0_omegac0::flagMcMatchGen) == static_cast<int8_t>(BIT(aod::hf_cand_xic0_omegac0::DecayType::XiczeroToXiPi));
@@ -124,18 +127,25 @@ struct HfTaskXic0ToXiPi {
124127
const AxisSpec thnAxisGenPtD{thnConfigAxisGenPtD, "#it{p}_{T} (GeV/#it{c})"};
125128
const AxisSpec thnAxisGenPtB{thnConfigAxisGenPtB, "#it{p}_{T}^{B} (GeV/#it{c})"};
126129
const AxisSpec thnAxisNumPvContr{thnConfigAxisNumPvContr, "Number of PV contributors"};
130+
const AxisSpec thnAxisCent{thnConfigAxisCent, "Centrality percentile"};
127131

128132
if (doprocessMcWithKFParticle || doprocessMcWithKFParticleMl || doprocessMcWithDCAFitter || doprocessMcWithDCAFitterMl) {
129-
std::vector<AxisSpec> const axesAcc = {thnAxisGenPtD, thnAxisGenPtB, thnAxisY, thnAxisOrigin, thnAxisNumPvContr};
133+
std::vector<AxisSpec> const axesAcc = {thnAxisGenPtD, thnAxisGenPtB, thnAxisY, thnAxisOrigin, thnAxisCent, thnAxisNumPvContr};
130134
registry.add("hSparseAcc", "Thn for generated Xic0 from charm and beauty", HistType::kTHnSparseD, axesAcc);
131135
registry.get<THnSparse>(HIST("hSparseAcc"))->Sumw2();
136+
137+
registry.add("hSparseAccWithRecoColl", "Gen. Xic0 from charm and beauty (associated to a reco collision)", HistType::kTHnSparseD, axesAcc);
138+
registry.get<THnSparse>(HIST("hSparseAccWithRecoColl"))->Sumw2();
139+
140+
registry.add("hNumRecoCollPerMcColl", "Number of reco collisions associated to a mc collision;Num. reco. coll. per Mc coll.;", {HistType::kTH1D, {{10, -0.5, 9.5}}});
132141
}
133142

134143
std::vector<AxisSpec> axes = {thnAxisMass, thnAxisPt, thnAxisY};
135-
if (doprocessMcWithKFParticle || doprocessMcWithKFParticleMl) {
144+
if (doprocessMcWithKFParticle || doprocessMcWithKFParticleMl || doprocessMcWithDCAFitter || doprocessMcWithDCAFitterMl) {
136145
axes.push_back(thnAxisPtB);
137146
axes.push_back(thnAxisOrigin);
138147
axes.push_back(thnAxisMatchFlag);
148+
axes.push_back(thnAxisCent);
139149
axes.push_back(thnAxisNumPvContr);
140150
}
141151
if (applyMl) {
@@ -203,12 +213,12 @@ struct HfTaskXic0ToXiPi {
203213
}
204214
}
205215

206-
template <bool UseKfParticle, bool ApplyMl, typename CandType, typename CollType>
216+
template <bool UseKfParticle, bool ApplyMl, typename CandType, typename CollType, typename McCollisionWithCents>
207217
void processMc(const CandType& candidates,
208218
Xic0Gen const& mcParticles,
209219
TracksMc const&,
210220
CollType const& collisions,
211-
aod::McCollisions const&)
221+
McCollisionWithCents const&)
212222
{
213223
// MC rec.
214224
for (const auto& candidate : candidates) {
@@ -225,6 +235,8 @@ struct HfTaskXic0ToXiPi {
225235
continue;
226236
}
227237

238+
auto collision = candidate.template collision_as<CollisionsWithMcLabels>();
239+
float const mcCent = o2::hf_centrality::getCentralityColl(collision.template mcCollision_as<McCollisionWithCents>());
228240
auto numPvContributors = candidate.template collision_as<CollType>().numContrib();
229241
double const ptXic = RecoDecay::pt(candidate.pxCharmBaryon(), candidate.pyCharmBaryon());
230242
if constexpr (ApplyMl) {
@@ -236,6 +248,7 @@ struct HfTaskXic0ToXiPi {
236248
candidate.ptBhadMotherPart(),
237249
candidate.originMcRec(),
238250
candidate.flagMcMatchRec(),
251+
mcCent,
239252
numPvContributors);
240253
} else {
241254
registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsXic0Type"),
@@ -245,6 +258,7 @@ struct HfTaskXic0ToXiPi {
245258
candidate.ptBhadMotherPart(),
246259
candidate.originMcRec(),
247260
candidate.flagMcMatchRec(),
261+
mcCent,
248262
numPvContributors);
249263
}
250264
}
@@ -258,6 +272,7 @@ struct HfTaskXic0ToXiPi {
258272
auto ptGen = particle.pt();
259273
auto yGen = particle.rapidityCharmBaryonGen();
260274

275+
float const mcCent = o2::hf_centrality::getCentralityColl(particle.template mcCollision_as<McCollisionWithCents>());
261276
unsigned maxNumContrib = 0;
262277
const auto& recoCollsPerMcColl = collisions.sliceBy(colPerMcCollision, particle.mcCollision().globalIndex());
263278
for (const auto& recCol : recoCollsPerMcColl) {
@@ -270,6 +285,7 @@ struct HfTaskXic0ToXiPi {
270285
-1.,
271286
yGen,
272287
RecoDecay::OriginType::Prompt,
288+
mcCent,
273289
maxNumContrib);
274290
} else {
275291
float const ptGenB = mcParticles.rawIteratorAt(particle.idxBhadMotherPart()).pt();
@@ -278,8 +294,33 @@ struct HfTaskXic0ToXiPi {
278294
ptGenB,
279295
yGen,
280296
RecoDecay::OriginType::NonPrompt,
297+
mcCent,
281298
maxNumContrib);
282299
}
300+
301+
registry.fill(HIST("hNumRecoCollPerMcColl"), recoCollsPerMcColl.size());
302+
303+
// fill sparse only for gen particles associated to a reconstructed collision
304+
if (recoCollsPerMcColl.size() >= 1) {
305+
if (particle.originMcGen() == RecoDecay::OriginType::Prompt) {
306+
registry.fill(HIST("hSparseAccWithRecoColl"),
307+
ptGen,
308+
-1.,
309+
yGen,
310+
RecoDecay::OriginType::Prompt,
311+
mcCent,
312+
maxNumContrib);
313+
} else {
314+
float const ptGenB = mcParticles.rawIteratorAt(particle.idxBhadMotherPart()).pt();
315+
registry.fill(HIST("hSparseAccWithRecoColl"),
316+
ptGen,
317+
ptGenB,
318+
yGen,
319+
RecoDecay::OriginType::NonPrompt,
320+
mcCent,
321+
maxNumContrib);
322+
}
323+
}
283324
}
284325
}
285326

@@ -443,7 +484,7 @@ struct HfTaskXic0ToXiPi {
443484
Xic0Gen const& mcParticles,
444485
TracksMc const& tracks,
445486
CollisionsWithMcLabels const& collisions,
446-
aod::McCollisions const& mcCollisions)
487+
McCollisionsCentFT0Ms const& mcCollisions)
447488
{
448489
processMc<false, false>(xic0CandidatesMc, mcParticles, tracks, collisions, mcCollisions);
449490
}
@@ -453,7 +494,7 @@ struct HfTaskXic0ToXiPi {
453494
Xic0Gen const& mcParticles,
454495
TracksMc const& tracks,
455496
CollisionsWithMcLabels const& collisions,
456-
aod::McCollisions const& mcCollisions)
497+
McCollisionsCentFT0Ms const& mcCollisions)
457498
{
458499
processMc<true, false>(xic0CandidatesMcKf, mcParticles, tracks, collisions, mcCollisions);
459500
}
@@ -463,7 +504,7 @@ struct HfTaskXic0ToXiPi {
463504
Xic0Gen const& mcParticles,
464505
TracksMc const& tracks,
465506
CollisionsWithMcLabels const& collisions,
466-
aod::McCollisions const& mcCollisions)
507+
McCollisionsCentFT0Ms const& mcCollisions)
467508
{
468509
processMc<false, true>(xic0CandidatesMlMc, mcParticles, tracks, collisions, mcCollisions);
469510
}
@@ -473,7 +514,7 @@ struct HfTaskXic0ToXiPi {
473514
Xic0Gen const& mcParticles,
474515
TracksMc const& tracks,
475516
CollisionsWithMcLabels const& collisions,
476-
aod::McCollisions const& mcCollisions)
517+
McCollisionsCentFT0Ms const& mcCollisions)
477518
{
478519
processMc<true, true>(xic0CandidatesMlMcKf, mcParticles, tracks, collisions, mcCollisions);
479520
}

0 commit comments

Comments
 (0)