Skip to content

Commit a540747

Browse files
author
Preet Pati
committed
Addition of MC truth process
1 parent 210ef93 commit a540747

File tree

1 file changed

+65
-2
lines changed

1 file changed

+65
-2
lines changed

PWGCF/TwoParticleCorrelations/Tasks/pidDiHadron.cxx

Lines changed: 65 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,11 @@ struct PidDiHadron {
183183

184184
// make the filters and cuts.
185185
Filter collisionFilter = (nabs(aod::collision::posZ) < cfgCutVertex);
186-
Filter trackFilter = (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtPOIMin) && (aod::track::pt < cfgCutPtPOIMax) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t) true)) && (aod::track::tpcChi2NCl < cfgCutChi2prTPCcls) && (nabs(aod::track::dcaZ) < cfgCutDCAz);
186+
Filter trackFilter = (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtPOIMin) && (aod::track::pt < cfgCutPtPOIMax) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t)true)) && (aod::track::tpcChi2NCl < cfgCutChi2prTPCcls) && (nabs(aod::track::dcaZ) < cfgCutDCAz);
187+
187188
using FilteredCollisions = soa::Filtered<soa::Join<aod::Collisions, aod::EvSel, aod::CentFT0Cs, aod::CentFT0CVariant1s, aod::CentFT0Ms, aod::CentFV0As, aod::Mults>>;
188189
using FilteredTracks = soa::Filtered<soa::Join<aod::Tracks, aod::TrackSelection, aod::TracksExtra, aod::TracksDCA, aod::pidTPCFullPi, aod::pidTPCFullKa, aod::pidTPCFullPr, aod::pidTOFbeta, aod::pidTOFFullPi, aod::pidTOFFullKa, aod::pidTOFFullPr>>;
190+
using FilteredMcTracks = soa::Filtered<soa::Join<aod::Tracks, aod::McTrackLabels, aod::TrackSelection, aod::TracksExtra, aod::TracksDCA, aod::pidTPCFullPi, aod::pidTPCFullKa, aod::pidTPCFullPr, aod::pidTOFbeta, aod::pidTOFFullPi, aod::pidTOFFullKa, aod::pidTOFFullPr>>;
189191
using V0TrackCandidate = aod::V0Datas;
190192

191193
Preslice<aod::Tracks> perCollision = aod::track::collisionId;
@@ -356,7 +358,7 @@ struct PidDiHadron {
356358
massAxisReso = {resoSwitchVals[kMassBins][iPhi], resoCutVals[kMassMin][iPhi], resoCutVals[kMassMax][iPhi], "M_{K^{+}K^{-}} (GeV/c^{2})"};
357359

358360
// Event Counter
359-
if ((doprocessSame || doprocessSameReso) && cfgUseAdditionalEventCut) {
361+
if ((doprocessSame || doprocessSameReso || doprocessMC) && cfgUseAdditionalEventCut) {
360362
histos.add("hEventCount", "Number of Events;; Count", {HistType::kTH1D, {{15, -0.5, 14.5}}});
361363
histos.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(kFilteredEvents + 1, "Filtered event");
362364
histos.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(kAfterSel8 + 1, "After sel8");
@@ -512,6 +514,15 @@ struct PidDiHadron {
512514
if (doprocessMixed || doprocessMixedReso) {
513515
histos.add("deltaEta_deltaPhi_mixed", "", {HistType::kTH2D, {axisDeltaPhi, axisDeltaEta}});
514516
}
517+
if (doprocessMC) {
518+
histos.add("hNsigmaPionSelected", "hNsigmaPionSelected", {HistType::kTH1D, {axisPt}});
519+
histos.add("hNsigmaKaonSelected", "hNsigmaKaonSelected", {HistType::kTH1D, {axisPt}});
520+
histos.add("hNsigmaProtonSelected", "hNsigmaProtonSelected", {HistType::kTH1D, {axisPt}});
521+
522+
histos.add("hNsigmaPionTrue", "hNsigmaPionTrue", {HistType::kTH1D, {axisPt}});
523+
histos.add("hNsigmaKaonTrue", "hNsigmaKaonTrue", {HistType::kTH1D, {axisPt}});
524+
histos.add("hNsigmaProtonTrue", "hNsigmaProtonTrue", {HistType::kTH1D, {axisPt}});
525+
}
515526

516527
histos.add("eventcount", "bin", {HistType::kTH1F, {{4, 0, 4, "bin"}}}); // histogram to see how many events are in the same and mixed event
517528

@@ -1467,6 +1478,58 @@ struct PidDiHadron {
14671478
}
14681479
}
14691480
PROCESS_SWITCH(PidDiHadron, processMixedReso, "Process mixed events", true);
1481+
1482+
void processMC(FilteredCollisions::iterator const& collision, FilteredMcTracks const& tracksmc, aod::BCsWithTimestamps const&, aod::McParticles const&)
1483+
{
1484+
float cent = -1.;
1485+
if (!cfgCentTableUnavailable)
1486+
cent = getCentrality(collision);
1487+
if (cfgUseAdditionalEventCut && !selectionEvent(collision, tracksmc.size(), cent, true))
1488+
return;
1489+
1490+
if (cfgSelCollByNch && (tracksmc.size() < cfgCutMultMin || tracksmc.size() >= cfgCutMultMax)) {
1491+
return;
1492+
}
1493+
if (!cfgSelCollByNch && !cfgCentTableUnavailable && (cent < cfgCutCentMin || cent >= cfgCutCentMax)) {
1494+
return;
1495+
}
1496+
1497+
// loop over all tracks
1498+
for (auto const& track : tracksmc) {
1499+
1500+
if (!trackSelected(track))
1501+
continue;
1502+
1503+
int pidIndex = getNsigmaPID(track);
1504+
1505+
// Check the PDG code for the particles (MC truth) and match with analysed Nsigma PID
1506+
if (std::abs(track.mcParticle().pdgCode()) == PDG_t::kPiPlus) {
1507+
histos.fill(HIST("hNsigmaPionTrue"), track.pt());
1508+
1509+
if (pidIndex == kPions) {
1510+
histos.fill(HIST("hNsigmaPionSelected"), track.pt());
1511+
}
1512+
} // Pion condition
1513+
1514+
if (std::abs(track.mcParticle().pdgCode()) == PDG_t::kKPlus) {
1515+
histos.fill(HIST("hNsigmaKaonTrue"), track.pt());
1516+
1517+
if (pidIndex == kKaons) {
1518+
histos.fill(HIST("hNsigmaKaonSelected"), track.pt());
1519+
}
1520+
} // Kaon condition
1521+
1522+
if (std::abs(track.mcParticle().pdgCode()) == PDG_t::kProton) {
1523+
histos.fill(HIST("hNsigmaProtonTrue"), track.pt());
1524+
1525+
if (pidIndex == kProtons) {
1526+
histos.fill(HIST("hNsigmaProtonSelected"), track.pt());
1527+
}
1528+
} // Proton condition
1529+
1530+
} // end of tracks MC loop
1531+
} // end of process MC
1532+
PROCESS_SWITCH(PidDiHadron, processMC, "Process Monte Carlo", true);
14701533
};
14711534

14721535
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)

0 commit comments

Comments
 (0)