From 51de5e6b22ea3ed01298b84c0b982f87728e656b Mon Sep 17 00:00:00 2001 From: Rohaan Deb <67634136+RD0407@users.noreply.github.com> Date: Thu, 30 Jan 2025 10:43:50 +0100 Subject: [PATCH] [PWGLF] Update PWGLF/Tasks/Nuspex/spectraTOF.cxx (#9621) Co-authored-by: ALICE Action Bot --- PWGLF/Tasks/Nuspex/spectraTOF.cxx | 328 +++++++++++++++++++++++------- 1 file changed, 254 insertions(+), 74 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/spectraTOF.cxx b/PWGLF/Tasks/Nuspex/spectraTOF.cxx index da7bf8a4439..8d1621fa0e2 100644 --- a/PWGLF/Tasks/Nuspex/spectraTOF.cxx +++ b/PWGLF/Tasks/Nuspex/spectraTOF.cxx @@ -69,9 +69,8 @@ std::array, NpCharge> hDecayLengthMCCharm; // Decay Length std::array, NpCharge> hDecayLengthMCBeauty; // Decay Length in the MC for particles from charm std::array, NpCharge> hDecayLengthMCNotHF; // Decay Length in the MC for particles from not a HF -// Spectra task -// o2-linter: disable=name/workflow-file -struct tofSpectra { // o2-linter: disable=name/struct +// Spectra tas +struct tofSpectra { struct : ConfigurableGroup { Configurable cfgCutVertex{"cfgCutVertex", 10.0f, "Accepted z-vertex range"}; Configurable cfgINELCut{"cfgINELCut", 0, "INEL event selection: 0 no sel, 1 INEL>0, 2 INEL>1"}; @@ -460,18 +459,57 @@ struct tofSpectra { // o2-linter: disable=name/struct histos.add("MC/fake/neg", "Fake negative tracks", kTH1D, {ptAxis}); histos.add("MC/no_collision/pos", "No collision pos track", kTH1D, {ptAxis}); histos.add("MC/no_collision/neg", "No collision neg track", kTH1D, {ptAxis}); - histos.add("MC/withPID/pi/pos/prm/pt/num", "recons. MC #pi^{+}", kTHnSparseD, {ptAxis, impParamAxis}); - histos.add("MC/withPID/pi/neg/prm/pt/num", "recons. MC #pi^{-}", kTHnSparseD, {ptAxis, impParamAxis}); - histos.add("MC/withPID/ka/pos/prm/pt/num", "recons. MC K^{+}", kTHnSparseD, {ptAxis, impParamAxis}); - histos.add("MC/withPID/ka/neg/prm/pt/num", "recons. MC K^{-}", kTHnSparseD, {ptAxis, impParamAxis}); - histos.add("MC/withPID/pr/pos/prm/pt/num", "recons. MC p", kTHnSparseD, {ptAxis, impParamAxis}); - histos.add("MC/withPID/pr/neg/prm/pt/num", "recons. MC #bar{p}", kTHnSparseD, {ptAxis, impParamAxis}); - histos.add("MC/withPID/pi/pos/prm/pt/numtof", "recons. MC #pi^{+}", kTHnSparseD, {ptAxis, impParamAxis}); - histos.add("MC/withPID/pi/neg/prm/pt/numtof", "recons. MC #pi^{-}", kTHnSparseD, {ptAxis, impParamAxis}); - histos.add("MC/withPID/ka/pos/prm/pt/numtof", "recons. MC K^{+}", kTHnSparseD, {ptAxis, impParamAxis}); - histos.add("MC/withPID/ka/neg/prm/pt/numtof", "recons. MC K^{-}", kTHnSparseD, {ptAxis, impParamAxis}); - histos.add("MC/withPID/pr/pos/prm/pt/numtof", "recons. MC p", kTHnSparseD, {ptAxis, impParamAxis}); - histos.add("MC/withPID/pr/neg/prm/pt/numtof", "recons. MC #bar{p}", kTHnSparseD, {ptAxis, impParamAxis}); + if (isImpactParam) { + histos.add("MC/withPID/pi/pos/prm/pt/num", "recons. MC #pi^{+}", kTHnSparseD, {ptAxis, impParamAxis}); + histos.add("MC/withPID/pi/neg/prm/pt/num", "recons. MC #pi^{-}", kTHnSparseD, {ptAxis, impParamAxis}); + histos.add("MC/withPID/ka/pos/prm/pt/num", "recons. MC K^{+}", kTHnSparseD, {ptAxis, impParamAxis}); + histos.add("MC/withPID/ka/neg/prm/pt/num", "recons. MC K^{-}", kTHnSparseD, {ptAxis, impParamAxis}); + histos.add("MC/withPID/pr/pos/prm/pt/num", "recons. MC p", kTHnSparseD, {ptAxis, impParamAxis}); + histos.add("MC/withPID/pr/neg/prm/pt/num", "recons. MC #bar{p}", kTHnSparseD, {ptAxis, impParamAxis}); + histos.add("MC/withPID/pi/pos/prm/pt/num_str", "recons. MC #pi^{+}", kTHnSparseD, {ptAxis, impParamAxis}); + histos.add("MC/withPID/pi/neg/prm/pt/num_str", "recons. MC #pi^{-}", kTHnSparseD, {ptAxis, impParamAxis}); + histos.add("MC/withPID/ka/pos/prm/pt/num_str", "recons. MC K^{+}", kTHnSparseD, {ptAxis, impParamAxis}); + histos.add("MC/withPID/ka/neg/prm/pt/num_str", "recons. MC K^{-}", kTHnSparseD, {ptAxis, impParamAxis}); + histos.add("MC/withPID/pr/pos/prm/pt/num_str", "recons. MC p", kTHnSparseD, {ptAxis, impParamAxis}); + histos.add("MC/withPID/pr/neg/prm/pt/num_str", "recons. MC #bar{p}", kTHnSparseD, {ptAxis, impParamAxis}); + histos.add("MC/withPID/pi/pos/prm/pt/num_mat", "recons. MC #pi^{+}", kTHnSparseD, {ptAxis, impParamAxis}); + histos.add("MC/withPID/pi/neg/prm/pt/num_mat", "recons. MC #pi^{-}", kTHnSparseD, {ptAxis, impParamAxis}); + histos.add("MC/withPID/ka/pos/prm/pt/num_mat", "recons. MC K^{+}", kTHnSparseD, {ptAxis, impParamAxis}); + histos.add("MC/withPID/ka/neg/prm/pt/num_mat", "recons. MC K^{-}", kTHnSparseD, {ptAxis, impParamAxis}); + histos.add("MC/withPID/pr/pos/prm/pt/num_mat", "recons. MC p", kTHnSparseD, {ptAxis, impParamAxis}); + histos.add("MC/withPID/pr/neg/prm/pt/num_mat", "recons. MC #bar{p}", kTHnSparseD, {ptAxis, impParamAxis}); + histos.add("MC/withPID/pi/pos/prm/pt/numtof", "recons. MC #pi^{+}", kTHnSparseD, {ptAxis, impParamAxis}); + histos.add("MC/withPID/pi/neg/prm/pt/numtof", "recons. MC #pi^{-}", kTHnSparseD, {ptAxis, impParamAxis}); + histos.add("MC/withPID/ka/pos/prm/pt/numtof", "recons. MC K^{+}", kTHnSparseD, {ptAxis, impParamAxis}); + histos.add("MC/withPID/ka/neg/prm/pt/numtof", "recons. MC K^{-}", kTHnSparseD, {ptAxis, impParamAxis}); + histos.add("MC/withPID/pr/pos/prm/pt/numtof", "recons. MC p", kTHnSparseD, {ptAxis, impParamAxis}); + histos.add("MC/withPID/pr/neg/prm/pt/numtof", "recons. MC #bar{p}", kTHnSparseD, {ptAxis, impParamAxis}); + } else { + histos.add("MC/withPID/pi/pos/prm/pt/num", "recons. MC #pi^{+}", kTHnSparseD, {ptAxis, multAxis}); + histos.add("MC/withPID/pi/neg/prm/pt/num", "recons. MC #pi^{-}", kTHnSparseD, {ptAxis, multAxis}); + histos.add("MC/withPID/ka/pos/prm/pt/num", "recons. MC K^{+}", kTHnSparseD, {ptAxis, multAxis}); + histos.add("MC/withPID/ka/neg/prm/pt/num", "recons. MC K^{-}", kTHnSparseD, {ptAxis, multAxis}); + histos.add("MC/withPID/pr/pos/prm/pt/num", "recons. MC p", kTHnSparseD, {ptAxis, multAxis}); + histos.add("MC/withPID/pr/neg/prm/pt/num", "recons. MC #bar{p}", kTHnSparseD, {ptAxis, multAxis}); + histos.add("MC/withPID/pi/pos/prm/pt/num_str", "recons. MC #pi^{+}", kTHnSparseD, {ptAxis, multAxis}); + histos.add("MC/withPID/pi/neg/prm/pt/num_str", "recons. MC #pi^{-}", kTHnSparseD, {ptAxis, multAxis}); + histos.add("MC/withPID/ka/pos/prm/pt/num_str", "recons. MC K^{+}", kTHnSparseD, {ptAxis, multAxis}); + histos.add("MC/withPID/ka/neg/prm/pt/num_str", "recons. MC K^{-}", kTHnSparseD, {ptAxis, multAxis}); + histos.add("MC/withPID/pr/pos/prm/pt/num_str", "recons. MC p", kTHnSparseD, {ptAxis, multAxis}); + histos.add("MC/withPID/pr/neg/prm/pt/num_str", "recons. MC #bar{p}", kTHnSparseD, {ptAxis, multAxis}); + histos.add("MC/withPID/pi/pos/prm/pt/num_mat", "recons. MC #pi^{+}", kTHnSparseD, {ptAxis, multAxis}); + histos.add("MC/withPID/pi/neg/prm/pt/num_mat", "recons. MC #pi^{-}", kTHnSparseD, {ptAxis, multAxis}); + histos.add("MC/withPID/ka/pos/prm/pt/num_mat", "recons. MC K^{+}", kTHnSparseD, {ptAxis, multAxis}); + histos.add("MC/withPID/ka/neg/prm/pt/num_mat", "recons. MC K^{-}", kTHnSparseD, {ptAxis, multAxis}); + histos.add("MC/withPID/pr/pos/prm/pt/num_mat", "recons. MC p", kTHnSparseD, {ptAxis, multAxis}); + histos.add("MC/withPID/pr/neg/prm/pt/num_mat", "recons. MC #bar{p}", kTHnSparseD, {ptAxis, multAxis}); + histos.add("MC/withPID/pi/pos/prm/pt/numtof", "recons. MC #pi^{+}", kTHnSparseD, {ptAxis, multAxis}); + histos.add("MC/withPID/pi/neg/prm/pt/numtof", "recons. MC #pi^{-}", kTHnSparseD, {ptAxis, multAxis}); + histos.add("MC/withPID/ka/pos/prm/pt/numtof", "recons. MC K^{+}", kTHnSparseD, {ptAxis, multAxis}); + histos.add("MC/withPID/ka/neg/prm/pt/numtof", "recons. MC K^{-}", kTHnSparseD, {ptAxis, multAxis}); + histos.add("MC/withPID/pr/pos/prm/pt/numtof", "recons. MC p", kTHnSparseD, {ptAxis, multAxis}); + histos.add("MC/withPID/pr/neg/prm/pt/numtof", "recons. MC #bar{p}", kTHnSparseD, {ptAxis, multAxis}); + } if (doprocessMCgen) { histos.add("MC/test/pi/pos/prm/pt/den", "generated MC #pi^{+}", kTHnSparseD, {ptAxis, impParamAxis}); histos.add("MC/test/pi/neg/prm/pt/den", "generated MC #pi^{-}", kTHnSparseD, {ptAxis, impParamAxis}); @@ -626,13 +664,23 @@ struct tofSpectra { // o2-linter: disable=name/struct if (includeCentralityMC) { //*************************************RD********************************************** - histos.add(hpt_num_prm[i].data(), pTCharge[i], kTHnSparseD, {ptAxis, multAxis, dcaXyAxis, occupancyAxis}); - histos.add(hpt_num_str[i].data(), pTCharge[i], kTHnSparseD, {ptAxis, multAxis, dcaXyAxis}); - histos.add(hpt_num_mat[i].data(), pTCharge[i], kTHnSparseD, {ptAxis, multAxis, dcaXyAxis}); + if (isImpactParam) { + histos.add(hpt_num_prm[i].data(), pTCharge[i], kTHnSparseD, {ptAxis, impParamAxis, dcaXyAxis, occupancyAxis}); + histos.add(hpt_num_str[i].data(), pTCharge[i], kTHnSparseD, {ptAxis, impParamAxis, dcaXyAxis}); + histos.add(hpt_num_mat[i].data(), pTCharge[i], kTHnSparseD, {ptAxis, impParamAxis, dcaXyAxis}); + + histos.add(hpt_numtof_prm[i].data(), pTCharge[i], kTHnSparseD, {ptAxis, impParamAxis, dcaXyAxis, occupancyAxis}); + histos.add(hpt_numtof_str[i].data(), pTCharge[i], kTHnSparseD, {ptAxis, impParamAxis, dcaXyAxis}); + histos.add(hpt_numtof_mat[i].data(), pTCharge[i], kTHnSparseD, {ptAxis, impParamAxis, dcaXyAxis}); + } else { + histos.add(hpt_num_prm[i].data(), pTCharge[i], kTHnSparseD, {ptAxis, multAxis, dcaXyAxis, occupancyAxis}); + histos.add(hpt_num_str[i].data(), pTCharge[i], kTHnSparseD, {ptAxis, multAxis, dcaXyAxis}); + histos.add(hpt_num_mat[i].data(), pTCharge[i], kTHnSparseD, {ptAxis, multAxis, dcaXyAxis}); - histos.add(hpt_numtof_prm[i].data(), pTCharge[i], kTHnSparseD, {ptAxis, multAxis, dcaXyAxis, occupancyAxis}); - histos.add(hpt_numtof_str[i].data(), pTCharge[i], kTHnSparseD, {ptAxis, multAxis, dcaXyAxis}); - histos.add(hpt_numtof_mat[i].data(), pTCharge[i], kTHnSparseD, {ptAxis, multAxis, dcaXyAxis}); + histos.add(hpt_numtof_prm[i].data(), pTCharge[i], kTHnSparseD, {ptAxis, multAxis, dcaXyAxis, occupancyAxis}); + histos.add(hpt_numtof_str[i].data(), pTCharge[i], kTHnSparseD, {ptAxis, multAxis, dcaXyAxis}); + histos.add(hpt_numtof_mat[i].data(), pTCharge[i], kTHnSparseD, {ptAxis, multAxis, dcaXyAxis}); + } histos.add(hpt_numtofgoodmatch_prm[i].data(), pTCharge[i], kTH3D, {ptAxis, multAxis, etaAxis}); @@ -1123,7 +1171,7 @@ struct tofSpectra { // o2-linter: disable=name/struct return false; } } - return (std::abs(track.dcaXY()) <= (maxDcaXYFactor.value * (0.0105f + 0.0350f / pow(track.pt(), 1.1f)))); // o2-linter: disable=std-prefix + return (std::abs(track.dcaXY()) <= (maxDcaXYFactor.value * (0.0105f + 0.0350f / pow(track.pt(), 1.1f)))); } return track.isGlobalTrack(); } @@ -1496,26 +1544,26 @@ struct tofSpectra { // o2-linter: disable=name/struct } // end of the process function PROCESS_SWITCH(tofSpectra, processDerived, "Derived data processor", false); -#define makeProcessFunction(processorName, inputPid, particleId, isFull, tofTable, tpcTable) /* o2-linter: disable=name/macro */ \ - void process##processorName##inputPid(CollisionCandidates::iterator const& collision, \ - soa::Join const& tracks) \ - { \ - if (!isEventSelected(collision)) { \ - return; \ - } \ - for (const auto& track : tracks) { \ - if (!isTrackSelected(track, collision)) { \ - continue; \ - } \ - fillParticleHistos(track, collision); \ - } \ - } \ +#define makeProcessFunction(processorName, inputPid, particleId, isFull, tofTable, tpcTable) \ + void process##processorName##inputPid(CollisionCandidates::iterator const& collision, \ + soa::Join const& tracks) \ + { \ + if (!isEventSelected(collision)) { \ + return; \ + } \ + for (const auto& track : tracks) { \ + if (!isTrackSelected(track, collision)) { \ + continue; \ + } \ + fillParticleHistos(track, collision); \ + } \ + } \ PROCESS_SWITCH(tofSpectra, process##processorName##inputPid, Form("Process for the %s hypothesis from %s tables", #particleId, #processorName), false); // Full tables -#define makeProcessFunctionFull(inputPid, particleId) makeProcessFunction(Full, inputPid, particleId, true, TOFFull, TPCFull) // o2-linter: disable=name/macro +#define makeProcessFunctionFull(inputPid, particleId) makeProcessFunction(Full, inputPid, particleId, true, TOFFull, TPCFull) makeProcessFunctionFull(El, Electron); makeProcessFunctionFull(Mu, Muon); @@ -1529,7 +1577,7 @@ struct tofSpectra { // o2-linter: disable=name/struct #undef makeProcessFunctionFull // Full LF tables -#define makeProcessFunctionFull(inputPid, particleId) makeProcessFunction(LfFull, inputPid, particleId, true, TOFFull, TPCLfFull) // o2-linter: disable=name/macro +#define makeProcessFunctionFull(inputPid, particleId) makeProcessFunction(LfFull, inputPid, particleId, true, TOFFull, TPCLfFull) makeProcessFunctionFull(El, Electron); makeProcessFunctionFull(Mu, Muon); @@ -1667,7 +1715,7 @@ struct tofSpectra { // o2-linter: disable=name/struct using RecoMCCollisions = soa::Join; // RD template - void fillTrackHistograms_MC(TrackType const& track, // o2-linter: disable=name/function-variable + void fillTrackHistograms_MC(TrackType const& track, ParticleType::iterator const& mcParticle, RecoMCCollisions::iterator const& collision, ParticleType const& mcParticles) @@ -1677,12 +1725,10 @@ struct tofSpectra { // o2-linter: disable=name/struct } const auto& mcCollision = collision.mcCollision_as(); - float multiplicity = getMultiplicityMC(mcCollision); + const float multiplicity = getMultiplicityMC(mcCollision); int occupancy = collision.trackOccupancyInTimeRange(); //************************************RD************************************************** - if (isImpactParam) { - multiplicity = mcCollision.impactParameter(); - } + const float impParam = mcCollision.impactParameter(); //************************************RD************************************************** if (mcParticle.pdgCode() != PDGs[i]) { @@ -1759,10 +1805,10 @@ struct tofSpectra { // o2-linter: disable=name/struct } if (enableDCAvsmotherHistograms) { - bool IsD0Mother = false; // o2-linter: disable=name/function-variable - bool IsCharmMother = false; // o2-linter: disable=name/function-variable - bool IsBeautyMother = false; // o2-linter: disable=name/function-variable - bool IsNotHFMother = false; // o2-linter: disable=name/function-variable + bool IsD0Mother = false; + bool IsCharmMother = false; + bool IsBeautyMother = false; + bool IsNotHFMother = false; if (mcParticle.has_mothers()) { const int charmOrigin = RecoDecay::getCharmHadronOrigin(mcParticles, mcParticle, false); for (const auto& mother : mcParticle.template mothers_as()) { @@ -1882,23 +1928,135 @@ struct tofSpectra { // o2-linter: disable=name/struct } } else { if (includeCentralityMC) { - histos.fill(HIST(hpt_num_prm[i]), track.pt(), multiplicity, track.dcaXY(), occupancy); + if (isImpactParam) { + histos.fill(HIST(hpt_num_prm[i]), track.pt(), impParam, track.dcaXY(), occupancy); + } else { + histos.fill(HIST(hpt_num_prm[i]), track.pt(), multiplicity, track.dcaXY(), occupancy); + } } else { histos.fill(HIST(hpt_num_prm[i]), track.pt(), multiplicity); } if (isPionTPC || isKaonTPC || isProtonTPC) { if (pdgCode == 2212) { - histos.fill(HIST("MC/withPID/pr/pos/prm/pt/num"), track.pt(), multiplicity); + if (isImpactParam) { + histos.fill(HIST("MC/withPID/pr/pos/prm/pt/num"), track.pt(), impParam); + if (!mcParticle.isPhysicalPrimary()) { + if (mcParticle.getProcess() == 4) { + histos.fill(HIST("MC/withPID/pr/pos/prm/pt/num_str"), track.pt(), impParam); + } else { + histos.fill(HIST("MC/withPID/pr/pos/prm/pt/num_mat"), track.pt(), impParam); + } + } + } else { + histos.fill(HIST("MC/withPID/pr/pos/prm/pt/num"), track.pt(), multiplicity); + if (!mcParticle.isPhysicalPrimary()) { + if (mcParticle.getProcess() == 4) { + histos.fill(HIST("MC/withPID/pr/pos/prm/pt/num_str"), track.pt(), multiplicity); + } else { + histos.fill(HIST("MC/withPID/pr/pos/prm/pt/num_mat"), track.pt(), multiplicity); + } + } + } } else if (pdgCode == -2212) { - histos.fill(HIST("MC/withPID/pr/neg/prm/pt/num"), track.pt(), multiplicity); + if (isImpactParam) { + histos.fill(HIST("MC/withPID/pr/neg/prm/pt/num"), track.pt(), impParam); + if (!mcParticle.isPhysicalPrimary()) { + if (mcParticle.getProcess() == 4) { + histos.fill(HIST("MC/withPID/pr/neg/prm/pt/num_str"), track.pt(), impParam); + } else { + histos.fill(HIST("MC/withPID/pr/neg/prm/pt/num_mat"), track.pt(), impParam); + } + } + } else { + histos.fill(HIST("MC/withPID/pr/neg/prm/pt/num"), track.pt(), multiplicity); + if (!mcParticle.isPhysicalPrimary()) { + if (mcParticle.getProcess() == 4) { + histos.fill(HIST("MC/withPID/pr/neg/prm/pt/num_str"), track.pt(), multiplicity); + } else { + histos.fill(HIST("MC/withPID/pr/neg/prm/pt/num_mat"), track.pt(), multiplicity); + } + } + } } else if (pdgCode == 211) { - histos.fill(HIST("MC/withPID/pi/pos/prm/pt/num"), track.pt(), multiplicity); + if (isImpactParam) { + histos.fill(HIST("MC/withPID/pi/pos/prm/pt/num"), track.pt(), impParam); + if (!mcParticle.isPhysicalPrimary()) { + if (mcParticle.getProcess() == 4) { + histos.fill(HIST("MC/withPID/pi/pos/prm/pt/num_str"), track.pt(), impParam); + } else { + histos.fill(HIST("MC/withPID/pi/pos/prm/pt/num_mat"), track.pt(), impParam); + } + } + } else { + histos.fill(HIST("MC/withPID/pi/pos/prm/pt/num"), track.pt(), multiplicity); + if (!mcParticle.isPhysicalPrimary()) { + if (mcParticle.getProcess() == 4) { + histos.fill(HIST("MC/withPID/pi/pos/prm/pt/num_str"), track.pt(), multiplicity); + } else { + histos.fill(HIST("MC/withPID/pi/pos/prm/pt/num_mat"), track.pt(), multiplicity); + } + } + } } else if (pdgCode == -211) { - histos.fill(HIST("MC/withPID/pi/neg/prm/pt/num"), track.pt(), multiplicity); + if (isImpactParam) { + histos.fill(HIST("MC/withPID/pi/neg/prm/pt/num"), track.pt(), impParam); + if (!mcParticle.isPhysicalPrimary()) { + if (mcParticle.getProcess() == 4) { + histos.fill(HIST("MC/withPID/pi/neg/prm/pt/num_str"), track.pt(), impParam); + } else { + histos.fill(HIST("MC/withPID/pi/neg/prm/pt/num_mat"), track.pt(), impParam); + } + } + } else { + histos.fill(HIST("MC/withPID/pi/neg/prm/pt/num"), track.pt(), multiplicity); + if (!mcParticle.isPhysicalPrimary()) { + if (mcParticle.getProcess() == 4) { + histos.fill(HIST("MC/withPID/pi/neg/prm/pt/num_str"), track.pt(), multiplicity); + } else { + histos.fill(HIST("MC/withPID/pi/neg/prm/pt/num_mat"), track.pt(), multiplicity); + } + } + } } else if (pdgCode == 321) { - histos.fill(HIST("MC/withPID/ka/pos/prm/pt/num"), track.pt(), multiplicity); + if (isImpactParam) { + histos.fill(HIST("MC/withPID/ka/pos/prm/pt/num"), track.pt(), impParam); + if (!mcParticle.isPhysicalPrimary()) { + if (mcParticle.getProcess() == 4) { + histos.fill(HIST("MC/withPID/ka/pos/prm/pt/num_str"), track.pt(), impParam); + } else { + histos.fill(HIST("MC/withPID/ka/pos/prm/pt/num_mat"), track.pt(), impParam); + } + } + } else { + histos.fill(HIST("MC/withPID/ka/pos/prm/pt/num"), track.pt(), multiplicity); + if (!mcParticle.isPhysicalPrimary()) { + if (mcParticle.getProcess() == 4) { + histos.fill(HIST("MC/withPID/ka/pos/prm/pt/num_str"), track.pt(), multiplicity); + } else { + histos.fill(HIST("MC/withPID/ka/pos/prm/pt/num_mat"), track.pt(), multiplicity); + } + } + } } else if (pdgCode == -321) { - histos.fill(HIST("MC/withPID/ka/neg/prm/pt/num"), track.pt(), multiplicity); + if (isImpactParam) { + histos.fill(HIST("MC/withPID/ka/neg/prm/pt/num"), track.pt(), impParam); + if (!mcParticle.isPhysicalPrimary()) { + if (mcParticle.getProcess() == 4) { + histos.fill(HIST("MC/withPID/ka/neg/prm/pt/num_str"), track.pt(), impParam); + } else { + histos.fill(HIST("MC/withPID/ka/neg/prm/pt/num_mat"), track.pt(), impParam); + } + } + } else { + histos.fill(HIST("MC/withPID/ka/neg/prm/pt/num"), track.pt(), multiplicity); + if (!mcParticle.isPhysicalPrimary()) { + if (mcParticle.getProcess() == 4) { + histos.fill(HIST("MC/withPID/ka/neg/prm/pt/num_str"), track.pt(), multiplicity); + } else { + histos.fill(HIST("MC/withPID/ka/neg/prm/pt/num_mat"), track.pt(), multiplicity); + } + } + } } } if (track.hasTRD() && trkselOptions.lastRequiredTrdCluster > 0) { @@ -1916,21 +2074,49 @@ struct tofSpectra { // o2-linter: disable=name/struct if (track.hasTOF()) { if (isPionTOF || isKaonTOF || isProtonTOF) { if (pdgCode == 2212) { - histos.fill(HIST("MC/withPID/pr/pos/prm/pt/numtof"), track.pt(), multiplicity); + if (isImpactParam) { + histos.fill(HIST("MC/withPID/pr/pos/prm/pt/numtof"), track.pt(), impParam); + } else { + histos.fill(HIST("MC/withPID/pr/pos/prm/pt/numtof"), track.pt(), multiplicity); + } } else if (pdgCode == -2212) { - histos.fill(HIST("MC/withPID/pr/neg/prm/pt/numtof"), track.pt(), multiplicity); + if (isImpactParam) { + histos.fill(HIST("MC/withPID/pr/neg/prm/pt/numtof"), track.pt(), impParam); + } else { + histos.fill(HIST("MC/withPID/pr/neg/prm/pt/numtof"), track.pt(), multiplicity); + } } else if (pdgCode == 211) { - histos.fill(HIST("MC/withPID/pi/pos/prm/pt/numtof"), track.pt(), multiplicity); + if (isImpactParam) { + histos.fill(HIST("MC/withPID/pi/pos/prm/pt/numtof"), track.pt(), impParam); + } else { + histos.fill(HIST("MC/withPID/pi/pos/prm/pt/numtof"), track.pt(), multiplicity); + } } else if (pdgCode == -211) { - histos.fill(HIST("MC/withPID/pi/neg/prm/pt/numtof"), track.pt(), multiplicity); + if (isImpactParam) { + histos.fill(HIST("MC/withPID/pi/neg/prm/pt/numtof"), track.pt(), impParam); + } else { + histos.fill(HIST("MC/withPID/pi/neg/prm/pt/numtof"), track.pt(), multiplicity); + } } else if (pdgCode == 321) { - histos.fill(HIST("MC/withPID/ka/pos/prm/pt/numtof"), track.pt(), multiplicity); + if (isImpactParam) { + histos.fill(HIST("MC/withPID/ka/pos/prm/pt/numtof"), track.pt(), impParam); + } else { + histos.fill(HIST("MC/withPID/ka/pos/prm/pt/numtof"), track.pt(), multiplicity); + } } else if (pdgCode == -321) { - histos.fill(HIST("MC/withPID/ka/neg/prm/pt/numtof"), track.pt(), multiplicity); + if (isImpactParam) { + histos.fill(HIST("MC/withPID/ka/neg/prm/pt/numtof"), track.pt(), impParam); + } else { + histos.fill(HIST("MC/withPID/ka/neg/prm/pt/numtof"), track.pt(), multiplicity); + } } } if (includeCentralityMC) { - histos.fill(HIST(hpt_numtof_prm[i]), track.pt(), multiplicity, track.dcaXY(), occupancy); + if (isImpactParam) { + histos.fill(HIST(hpt_numtof_prm[i]), track.pt(), impParam, track.dcaXY(), occupancy); + } else { + histos.fill(HIST(hpt_numtof_prm[i]), track.pt(), multiplicity, track.dcaXY(), occupancy); + } } else { histos.fill(HIST(hpt_numtof_prm[i]), track.pt(), multiplicity); } @@ -1960,7 +2146,7 @@ struct tofSpectra { // o2-linter: disable=name/struct } template - void fillParticleHistograms_MC(const float multiplicity, ParticleType const& mcParticle) // o2-linter: disable=name/function-variable + void fillParticleHistograms_MC(const float multiplicity, ParticleType const& mcParticle) { if (!isParticleEnabled()) { // Check if the particle is enabled return; @@ -1986,7 +2172,7 @@ struct tofSpectra { // o2-linter: disable=name/struct } template - void fillParticleHistograms_MCRecoEvs(ParticleType const& mcParticle, RecoMCCollisions::iterator const& collision) // o2-linter: disable=name/function-variable + void fillParticleHistograms_MCRecoEvs(ParticleType const& mcParticle, RecoMCCollisions::iterator const& collision) { if (!isParticleEnabled()) { // Check if the particle is enabled return; @@ -2044,7 +2230,7 @@ struct tofSpectra { // o2-linter: disable=name/struct } template - void fillParticleHistograms_MCGenEvs(ParticleType const& mcParticle, GenMCCollisions::iterator const& mcCollision) // o2-linter: disable=name/function-variable + void fillParticleHistograms_MCGenEvs(ParticleType const& mcParticle, GenMCCollisions::iterator const& mcCollision) { if (!isParticleEnabled()) { // Check if the particle is enabled @@ -2118,13 +2304,7 @@ struct tofSpectra { // o2-linter: disable=name/struct } const auto& mcCollision = collision.mcCollision_as(); const auto& particlesInCollision = mcParticles.sliceByCached(aod::mcparticle::mcCollisionId, mcCollision.globalIndex(), cache); - float multiplicity = getMultiplicity(collision); - //************************************RD************************************************** - if (isImpactParam) { - multiplicity = mcCollision.impactParameter(); - } - //************************************RD************************************************** - + const float multiplicity = getMultiplicity(collision); for (const auto& mcParticle : particlesInCollision) { if (std::abs(mcParticle.y()) > trkselOptions.cfgCutY) { @@ -2253,7 +2433,7 @@ struct tofSpectra { // o2-linter: disable=name/struct } } PROCESS_SWITCH(tofSpectra, processMCgen, "process generated MC", false); - void processMCgen_RecoEvs(soa::Join const& tracks, aod::McTrackLabels const& mcTrackLabels,