Skip to content

Commit 59f1940

Browse files
committed
Adding function for PID-purity calculation
1 parent c491a9b commit 59f1940

1 file changed

Lines changed: 69 additions & 2 deletions

File tree

PWGCF/FemtoUniverse/Core/FemtoUniverseParticleHisto.h

Lines changed: 69 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ class FemtoUniverseParticleHisto
138138
if constexpr (mParticleType == o2::aod::femtouniverseparticle::ParticleType::kTrack || mParticleType == o2::aod::femtouniverseparticle::ParticleType::kV0Child || mParticleType == o2::aod::femtouniverseparticle::ParticleType::kCascadeBachelor || mParticleType == o2::aod::femtouniverseparticle::ParticleType::kMCTruthTrack) {
139139
/// Track histograms
140140
mHistogramRegistry->add((folderName + folderSuffix + "/hPDG").c_str(), "; PDG; Entries", kTH1I, {{6001, -3000, 3000}});
141-
mHistogramRegistry->add((folderName + folderSuffix + "/hOrigin_MC").c_str(), "; Origin; Entries", kTH1I, {{7, 0, 7}});
141+
mHistogramRegistry->add((folderName + folderSuffix + "/hOrigin_MC").c_str(), "; Origin; Entries", kTH1I, {{100, 0, 100}});
142142
mHistogramRegistry->add((folderName + folderSuffix + "/hNoMCtruthCounter").c_str(), "; Counter; Entries", kTH1I, {{1, 0, 1}});
143143
// DCA plots
144144
mHistogramRegistry->add((folderName + folderSuffix + "/hDCAxy_Material").c_str(), "; #it{p}_{T} (GeV/#it{c}); DCA_{xy} (cm)", kTH2F, {tempFitVarpTAxis, tempFitVarAxis});
@@ -147,6 +147,8 @@ class FemtoUniverseParticleHisto
147147
mHistogramRegistry->add((folderName + folderSuffix + "/hDCAxy_DaughterSigmaplus").c_str(), "; #it{p}_{T} (GeV/#it{c}); DCA_{xy} (cm)", kTH2F, {tempFitVarpTAxis, tempFitVarAxis});
148148
mHistogramRegistry->add((folderName + folderSuffix + "/hDCAxy_Primary").c_str(), "; #it{p}_{T} (GeV/#it{c}); DCA_{xy} (cm)", kTH2F, {tempFitVarpTAxis, tempFitVarAxis});
149149
mHistogramRegistry->add((folderName + folderSuffix + "/hDCAxy_Daughter").c_str(), "; #it{p}_{T} (GeV/#it{c}); DCA_{xy} (cm)", kTH2F, {tempFitVarpTAxis, tempFitVarAxis});
150+
mHistogramRegistry->add((folderName + folderSuffix + "/hDCAxy_NoMCTruthOrigin").c_str(), "; #it{p}_{T} (GeV/#it{c}); DCA_{xy} (cm)", kTH2F, {tempFitVarpTAxis, tempFitVarAxis});
151+
mHistogramRegistry->add((folderName + folderSuffix + "/hMisidentification").c_str(), "; #it{p}_{T} (GeV/#it{c}); Particle; Particle", kTH3F, {{4, 0, 4}, {4, 0, 4}, tempFitVarpTAxis});
150152
} else if constexpr (mParticleType == o2::aod::femtouniverseparticle::ParticleType::kV0) {
151153
/// V0 histograms
152154
/// to be implemented
@@ -338,9 +340,13 @@ class FemtoUniverseParticleHisto
338340
mHistogramRegistry->fill(histFolder + HIST("_MC/hDCAxy_DaughterSigmaplus"),
339341
part.pt(), part.tempFitVar());
340342
break;
343+
case (99):
344+
mHistogramRegistry->fill(histFolder + HIST("_MC/hDCAxy_NoMCTruthOrigin"),
345+
part.pt(), part.tempFitVar());
346+
break;
341347
default:
342348
LOG(fatal) << "femtouniverseparticleMC: not known value for ParticleOriginMCTruth - please check. Quitting!";
343-
}
349+
}
344350
} else if constexpr (mParticleType == o2::aod::femtouniverseparticle::ParticleType::kV0) {
345351
/// V0 histograms
346352
} else if constexpr (mParticleType == o2::aod::femtouniverseparticle::ParticleType::kCascade) {
@@ -355,6 +361,40 @@ class FemtoUniverseParticleHisto
355361
}
356362
}
357363

364+
template <typename T, typename H>
365+
void fillQA_MC_MisIden(T const& part, int pdgcode, int confPDG, H const& histFolder) // o2-linter: disable=name/function-variable
366+
{
367+
if (mHistogramRegistry) {
368+
if constexpr (mParticleType == o2::aod::femtouniverseparticle::ParticleType::kTrack) {
369+
if (confPDG == mConfPDGCodePart[0]) {
370+
PDGbin = 0;
371+
} else if (confPDG == mConfPDGCodePart[1]) {
372+
PDGbin = 1;
373+
} else if (confPDG == mConfPDGCodePart[2]) {
374+
PDGbin = 2;
375+
} else {
376+
PDGbin = 3;
377+
}
378+
if (std::abs(pdgcode == 211)) {
379+
mHistogramRegistry->fill(histFolder + HIST("_MC/hMisidentification"),
380+
PDGbin, 0, part.pt());
381+
} else if (std::abs(pdgcode == 321)) {
382+
mHistogramRegistry->fill(histFolder + HIST("_MC/hMisidentification"),
383+
PDGbin, 1, part.pt());
384+
} else if (std::abs(pdgcode == 2212)) {
385+
mHistogramRegistry->fill(histFolder + HIST("_MC/hMisidentification"),
386+
PDGbin, 2, part.pt());
387+
} else {
388+
mHistogramRegistry->fill(histFolder + HIST("_MC/hMisidentification"),
389+
PDGbin, 3, part.pt());
390+
}
391+
}
392+
} else {
393+
LOG(fatal) << "FemtoUniverseParticleHisto: Histogramming for requested object not defined - quitting!";
394+
}
395+
}
396+
397+
358398
/// Templated function to fill particle histograms for data/ Monte Carlo reconstructed and Monte Carlo truth
359399
/// Always calls fillQA_base fill histogramms with data/ Monte Carlo reconstructed
360400
/// In case of Monte Carlo, calls fillQA_base with Monte Carlo truth info and specialized function fillQA_MC for additional histogramms
@@ -387,12 +427,39 @@ class FemtoUniverseParticleHisto
387427
}
388428
}
389429

430+
/// Templated function to fill particle histograms for data/ Monte Carlo reconstructed and Monte Carlo truth
431+
/// Always calls fillQA_base fill histogramms with data/ Monte Carlo reconstructed
432+
/// In case of Monte Carlo, calls fillQA_base with Monte Carlo truth info and specialized function fillQA_MC for additional histogramms
433+
/// \tparam T particle type
434+
/// \tparam isMC fills the additional histograms for Monte Carlo truth
435+
/// \param part particle for which the histograms should be filled
436+
template <bool isMC, bool isDebug, typename T>
437+
void fillQAMisIden(T const& part, int confPDG)
438+
{
439+
fillQABaseMisiden<isMC, isDebug, T>(part, HIST(o2::aod::femtouniverseparticle::ParticleTypeName[mParticleType]) + HIST(mFolderSuffix[mFolderSuffixType]), confPDG);
440+
}
441+
442+
template <bool isMC, bool isDebug, typename T, typename H>
443+
void fillQABaseMisiden(T const& part, H const& histFolder, int confPDG)
444+
{
445+
std::string tempFitVarName;
446+
if (mHistogramRegistry) {
447+
if constexpr (isMC) {
448+
if (part.has_fdMCParticle()) {
449+
fillQA_MC_MisIden(part, (part.fdMCParticle()).pdgMCTruth(), confPDG, histFolder);
450+
}
451+
}
452+
}
453+
}
454+
390455
private:
391456
HistogramRegistry* mHistogramRegistry; ///< For QA output
392457
static constexpr o2::aod::femtouniverseparticle::ParticleType mParticleType = particleType; ///< Type of the particle under analysis // o2-linter: disable=name/constexpr-constant
393458
static constexpr int mFolderSuffixType = suffixType; ///< Counter for the folder suffix specified below // o2-linter: disable=name/constexpr-constant
394459
static constexpr std::string_view mFolderSuffix[5] = {"", "_one", "_two", "_pos", "_neg"}; ///< Suffix for the folder name in case of analyses of pairs of the same kind (T-T, V-V, C-C) // o2-linter: disable=name/constexpr-constant
460+
int mConfPDGCodePart[4] = {211, 321, 2212, 9999}; ///< PDG code as per analysis
395461
int mPDG = 0; ///< PDG code of the selected particle
462+
int PDGbin = 0;
396463
};
397464
} // namespace o2::analysis::femto_universe
398465

0 commit comments

Comments
 (0)