Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 76 additions & 1 deletion PWGCF/TwoParticleCorrelations/Tasks/pidDiHadron.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,10 @@ struct PidDiHadron {
// make the filters and cuts.
Filter collisionFilter = (nabs(aod::collision::posZ) < cfgCutVertex);
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);

using FilteredCollisions = soa::Filtered<soa::Join<aod::Collisions, aod::EvSel, aod::CentFT0Cs, aod::CentFT0CVariant1s, aod::CentFT0Ms, aod::CentFV0As, aod::Mults>>;
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>>;
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>>;
using V0TrackCandidate = aod::V0Datas;

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

// Event Counter
if ((doprocessSame || doprocessSameReso) && cfgUseAdditionalEventCut) {
if ((doprocessSame || doprocessSameReso || doprocessMC) && cfgUseAdditionalEventCut) {
histos.add("hEventCount", "Number of Events;; Count", {HistType::kTH1D, {{15, -0.5, 14.5}}});
histos.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(kFilteredEvents + 1, "Filtered event");
histos.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(kAfterSel8 + 1, "After sel8");
Expand Down Expand Up @@ -512,6 +514,19 @@ struct PidDiHadron {
if (doprocessMixed || doprocessMixedReso) {
histos.add("deltaEta_deltaPhi_mixed", "", {HistType::kTH2D, {axisDeltaPhi, axisDeltaEta}});
}
if (doprocessMC) {
histos.add("hNsigmaPionTruePositives", "hNsigmaPionTruePositives", {HistType::kTH1D, {axisPt}}); // Fraction of particles that are pions and selected as pions
histos.add("hNsigmaKaonTruePositives", "hNsigmaKaonTruePositives", {HistType::kTH1D, {axisPt}}); // Fraction of particles that are kaons and selected as kaons
histos.add("hNsigmaProtonTruePositives", "hNsigmaProtonTruePositives", {HistType::kTH1D, {axisPt}}); // Fraction of particles that are protons and selected as protons

histos.add("hNsigmaPionSelected", "hNsigmaPionSelected", {HistType::kTH1D, {axisPt}});
histos.add("hNsigmaKaonSelected", "hNsigmaKaonSelected", {HistType::kTH1D, {axisPt}});
histos.add("hNsigmaProtonSelected", "hNsigmaProtonSelected", {HistType::kTH1D, {axisPt}});

histos.add("hNsigmaPionTrue", "hNsigmaPionTrue", {HistType::kTH1D, {axisPt}}); // All true pions from MC
histos.add("hNsigmaKaonTrue", "hNsigmaKaonTrue", {HistType::kTH1D, {axisPt}}); // All true kaons from MC
histos.add("hNsigmaProtonTrue", "hNsigmaProtonTrue", {HistType::kTH1D, {axisPt}}); // All true protons from MC
}

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

Expand Down Expand Up @@ -1467,6 +1482,66 @@ struct PidDiHadron {
}
}
PROCESS_SWITCH(PidDiHadron, processMixedReso, "Process mixed events", true);

void processMC(FilteredCollisions::iterator const& collision, FilteredMcTracks const& tracksmc, aod::BCsWithTimestamps const&, aod::McParticles const&)
{
float cent = -1.;
if (!cfgCentTableUnavailable)
cent = getCentrality(collision);
if (cfgUseAdditionalEventCut && !selectionEvent(collision, tracksmc.size(), cent, true))
return;

if (cfgSelCollByNch && (tracksmc.size() < cfgCutMultMin || tracksmc.size() >= cfgCutMultMax)) {
return;
}
if (!cfgSelCollByNch && !cfgCentTableUnavailable && (cent < cfgCutCentMin || cent >= cfgCutCentMax)) {
return;
}

// loop over all tracks
for (auto const& track : tracksmc) {

if (!trackSelected(track))
continue;

int pidIndex = getNsigmaPID(track);

// Fill Counts for selection through Nsigma cuts
if (pidIndex == kPions)
histos.fill(HIST("hNsigmaPionSelected"), track.pt());
if (pidIndex == kKaons)
histos.fill(HIST("hNsigmaKaonSelected"), track.pt());
if (pidIndex == kProtons)
histos.fill(HIST("hNsigmaProtonSelected"), track.pt());

// Check the PDG code for the particles (MC truth) and match with analysed Nsigma PID
if (std::abs(track.mcParticle().pdgCode()) == PDG_t::kPiPlus) {
histos.fill(HIST("hNsigmaPionTrue"), track.pt());

if (pidIndex == kPions) {
histos.fill(HIST("hNsigmaPionTruePositives"), track.pt());
}
} // Pion condition

if (std::abs(track.mcParticle().pdgCode()) == PDG_t::kKPlus) {
histos.fill(HIST("hNsigmaKaonTrue"), track.pt());

if (pidIndex == kKaons) {
histos.fill(HIST("hNsigmaKaonTruePositives"), track.pt());
}
} // Kaon condition

if (std::abs(track.mcParticle().pdgCode()) == PDG_t::kProton) {
histos.fill(HIST("hNsigmaProtonTrue"), track.pt());

if (pidIndex == kProtons) {
histos.fill(HIST("hNsigmaProtonTruePositives"), track.pt());
}
} // Proton condition
Comment on lines +1518 to +1540
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess that, except this part, the rest is the same as for data
If you template the whole processing and condition, constexpr, this part to the existence of the McParticleId column on the received tracks table you will be able to have a single function, without replicating code, for both data and reconstructed MC


} // end of tracks MC loop
} // end of process MC
PROCESS_SWITCH(PidDiHadron, processMC, "Process Monte Carlo", true);
};

WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
Expand Down
Loading