Skip to content

Commit 3ed7389

Browse files
authored
Apply filter if both reco collisions and MC tracks belong to the same generated collision
1 parent 4796e37 commit 3ed7389

1 file changed

Lines changed: 42 additions & 46 deletions

File tree

PWGLF/Tasks/GlobalEventProperties/heavyionMultiplicity.cxx

Lines changed: 42 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ enum {
8787
kSpOther,
8888
kSpStrangeDecay,
8989
kBkg,
90+
kFake,
9091
kSpNotPrimary,
9192
kSpAll,
9293
kSpeciesend
@@ -207,7 +208,6 @@ struct HeavyionMultiplicity {
207208
Configurable<bool> isApplyCentFT0M{"isApplyCentFT0M", false, "Centrality based on FT0A + FT0C"};
208209
Configurable<bool> isApplyCentNGlobal{"isApplyCentNGlobal", false, "Centrality based on global tracks"};
209210
Configurable<bool> isApplyCentMFT{"isApplyCentMFT", false, "Centrality based on MFT tracks"};
210-
Configurable<bool> isApplySplitRecCol{"isApplySplitRecCol", false, "Split MC reco collisions"};
211211
Configurable<bool> isApplyInelgt0{"isApplyInelgt0", false, "Enable INEL > 0 condition"};
212212
Configurable<bool> isApplyTVX{"isApplyTVX", false, "Enable TVX trigger sel"};
213213

@@ -580,17 +580,15 @@ struct HeavyionMultiplicity {
580580
histos.fill(HIST("NPVtracks_vs_GlobalMult"), cols.multNTracksPV(), nchTracks);
581581
}
582582

583-
void processMonteCarlo(CollisionMCTrueTable::iterator const&, CollisionMCRecTable const& RecCols, TrackMCTrueTable const& GenParticles, FilTrackMCRecTable const& RecTracks)
583+
void processMonteCarlo(soa::Join<CollisionMCTrueTable, aod::McCollsExtra>::iterator const& mcCollision, CollisionMCRecTable const& RecCols, TrackMCTrueTable const& GenParticles, FilTrackMCRecTable const& RecTracks)
584584
{
585-
586-
if (isApplySplitRecCol && (RecCols.size() == 0 || RecCols.size() > 1)) {
587-
return;
588-
}
589-
590585
for (const auto& RecCol : RecCols) {
591586
if (!isEventSelected(RecCol)) {
592587
continue;
593588
}
589+
if (RecCol.globalIndex() != mcCollision.bestCollisionIndex()) {
590+
continue;
591+
}
594592
histos.fill(HIST("VtxZHist"), RecCol.posZ());
595593
histos.fill(HIST("CentPercentileMCRecHist"), selColCent(RecCol));
596594
histos.fill(HIST("hmczvtxcent"), RecCol.posZ(), selColCent(RecCol), selColOccu(RecCol));
@@ -600,6 +598,15 @@ struct HeavyionMultiplicity {
600598
if (!isTrackSelected(Rectrack)) {
601599
continue;
602600
}
601+
if (!Rectrack.has_mcParticle()) {
602+
histos.fill(HIST("hmcrecdndeta"), RecCol.posZ(), selColCent(RecCol), selColOccu(RecCol), Rectrack.eta(), Rectrack.phi(), static_cast<double>(kBkg), kGlobalplusITS);
603+
histos.fill(HIST("hmcrecdndetaMB"), RecCol.posZ(), Rectrack.eta(), Rectrack.phi(), static_cast<double>(kBkg));
604+
continue;
605+
}
606+
auto mcpart = Rectrack.mcParticle();
607+
if (RecCol.mcCollisionId() != mcpart.mcCollisionId()) {
608+
continue;
609+
}
603610
histos.fill(HIST("hmcdcaxy"), Rectrack.dcaXY());
604611
histos.fill(HIST("hmcdcaz"), Rectrack.dcaZ());
605612
histos.fill(HIST("MCrecPhiVsEtaHist"), Rectrack.phi(), Rectrack.eta());
@@ -611,43 +618,37 @@ struct HeavyionMultiplicity {
611618
histos.fill(HIST("hmcrecdndeta"), RecCol.posZ(), selColCent(RecCol), selColOccu(RecCol), Rectrack.eta(), Rectrack.phi(), static_cast<double>(kSpAll), kITSonly);
612619
}
613620

614-
if (Rectrack.has_mcParticle()) {
615-
int pid = kBkg;
616-
auto mcpart = Rectrack.template mcParticle_as<aod::McParticles>();
617-
if (mcpart.isPhysicalPrimary()) {
618-
switch (std::abs(mcpart.pdgCode())) {
619-
case PDG_t::kPiPlus:
620-
pid = kSpPion;
621-
break;
622-
case PDG_t::kKPlus:
623-
pid = kSpKaon;
624-
break;
625-
case PDG_t::kProton:
626-
pid = kSpProton;
627-
break;
628-
default:
629-
pid = kSpOther;
630-
break;
631-
}
632-
} else {
633-
pid = kSpNotPrimary;
634-
}
635-
if (mcpart.has_mothers()) {
636-
auto mcpartMother = mcpart.template mothers_as<aod::McParticles>().front();
637-
if (mcpartMother.pdgCode() == PDG_t::kK0Short || std::abs(mcpartMother.pdgCode()) == PDG_t::kLambda0) {
638-
pid = kSpStrangeDecay;
639-
}
621+
int pid = kFake;
622+
if (mcpart.isPhysicalPrimary()) {
623+
switch (std::abs(mcpart.pdgCode())) {
624+
case PDG_t::kPiPlus:
625+
pid = kSpPion;
626+
break;
627+
case PDG_t::kKPlus:
628+
pid = kSpKaon;
629+
break;
630+
case PDG_t::kProton:
631+
pid = kSpProton;
632+
break;
633+
default:
634+
pid = kSpOther;
635+
break;
640636
}
641-
if (find(mclabels.begin(), mclabels.end(), Rectrack.mcParticleId()) != mclabels.end()) {
642-
pid = kBkg;
643-
}
644-
mclabels.push_back(Rectrack.mcParticleId());
645-
histos.fill(HIST("hmcrecdndeta"), RecCol.posZ(), selColCent(RecCol), selColOccu(RecCol), Rectrack.eta(), Rectrack.phi(), static_cast<double>(pid), kGlobalplusITS);
646-
histos.fill(HIST("hmcrecdndetaMB"), RecCol.posZ(), Rectrack.eta(), Rectrack.phi(), static_cast<double>(pid));
647637
} else {
648-
histos.fill(HIST("hmcrecdndeta"), RecCol.posZ(), selColCent(RecCol), selColOccu(RecCol), Rectrack.eta(), Rectrack.phi(), static_cast<double>(kBkg), kGlobalplusITS);
649-
histos.fill(HIST("hmcrecdndetaMB"), RecCol.posZ(), Rectrack.eta(), Rectrack.phi(), static_cast<double>(kBkg));
638+
pid = kSpNotPrimary;
650639
}
640+
if (mcpart.has_mothers()) {
641+
auto mcpartMother = mcpart.template mothers_as<aod::McParticles>().front();
642+
if (mcpartMother.pdgCode() == PDG_t::kK0Short || std::abs(mcpartMother.pdgCode()) == PDG_t::kLambda0) {
643+
pid = kSpStrangeDecay;
644+
}
645+
}
646+
if (find(mclabels.begin(), mclabels.end(), Rectrack.mcParticleId()) != mclabels.end()) {
647+
pid = kFake;
648+
}
649+
mclabels.push_back(Rectrack.mcParticleId());
650+
histos.fill(HIST("hmcrecdndeta"), RecCol.posZ(), selColCent(RecCol), selColOccu(RecCol), Rectrack.eta(), Rectrack.phi(), static_cast<double>(pid), kGlobalplusITS);
651+
histos.fill(HIST("hmcrecdndetaMB"), RecCol.posZ(), Rectrack.eta(), Rectrack.phi(), static_cast<double>(pid));
651652
} // track (mcrec) loop
652653

653654
for (const auto& particle : GenParticles) {
@@ -663,7 +664,6 @@ struct HeavyionMultiplicity {
663664
histos.fill(HIST("hmcgendndeta"), RecCol.posZ(), selColCent(RecCol), particle.eta(), particle.phi(), static_cast<double>(kSpAll), kGenpTup);
664665
histos.fill(HIST("hmcgendndeta"), RecCol.posZ(), selColCent(RecCol), particle.eta(), particle.phi(), static_cast<double>(kSpAll), kGenpTdown);
665666
}
666-
667667
int pid = 0;
668668
switch (std::abs(particle.pdgCode())) {
669669
case PDG_t::kPiPlus:
@@ -824,10 +824,6 @@ struct HeavyionMultiplicity {
824824

825825
void processppMonteCarlo(CollisionMCTrueTable::iterator const&, ColMCRecTablepp const& RecCols, TrackMCTrueTable const& GenParticles, FilTrackMCRecTable const& RecTracks)
826826
{
827-
if (isApplySplitRecCol && (RecCols.size() == 0 || RecCols.size() > 1)) {
828-
return;
829-
}
830-
831827
for (const auto& RecCol : RecCols) {
832828
if (!isEventSelected(RecCol)) {
833829
continue;

0 commit comments

Comments
 (0)