From 176f82885b49470679634ffcd27bf720c40f9fb9 Mon Sep 17 00:00:00 2001 From: Veronika Barbasova Date: Fri, 24 Nov 2023 12:52:11 +0100 Subject: [PATCH 1/3] MC support in rsnanalysisTHnSparse workflow --- PWGLF/Tasks/rsnanalysisTHnSparse.cxx | 284 ++++++++++++++++++++++----- 1 file changed, 239 insertions(+), 45 deletions(-) diff --git a/PWGLF/Tasks/rsnanalysisTHnSparse.cxx b/PWGLF/Tasks/rsnanalysisTHnSparse.cxx index 327772f0f42..9ce3b1cfd75 100644 --- a/PWGLF/Tasks/rsnanalysisTHnSparse.cxx +++ b/PWGLF/Tasks/rsnanalysisTHnSparse.cxx @@ -12,78 +12,106 @@ /// \author Veronika Barbasova (veronika.barbasova@cern.ch) /// \since October 12, 2023 -#include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" -#include -#include "ReconstructionDataFormats/PID.h" #include "Framework/ASoAHelpers.h" +#include "Framework/O2DatabasePDGPlugin.h" +#include "ReconstructionDataFormats/PID.h" +#include "TDatabasePDG.h" +#include using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; -struct rsnanalysisTHnSparse { +struct rsnanalysisTHnSparse +{ SliceCache cache; - Configurable test{"test", false, "Running in test mode."}; + Configurable verboselevel{"verbose-level", 0, "Verbose level"}; Configurable refresh{"print-refresh", 0, "Freqency of print event information."}; - Configurable refresh_index{"print-refresh-index", 1, "Freqency of print event information index."}; + Configurable refresh_index{"print-refresh-index", 0, "Freqency of print event information index."}; Configurable tpcnSigma1{"tpcnSigma1", 3.0f, "TPC NSigma cut of the first particle."}; + Configurable ignorezeroevent{"ignore-zero-event", true, "Flag if zero event is skipped"}; Configurable tpcnSigma2{"tpcnSigma2", 3.0f, "TPC NSigma cut of the second particle."}; Configurable dauther1{"dauther1", 3, "Particle type of the first dauther according to ReconstructionDataFormats/PID.h (Default = Kaon)"}; - Configurable dauther2{"dauther", 3, "Particle type of the second dauther according to ReconstructionDataFormats/PID.h (Default = Kaon)"}; - Configurable vertexfilter{"vertex-filter", 10.0f, "Z vertex range."}; + Configurable dauther2{"dauther2", 3, "Particle type of the second dauther according to ReconstructionDataFormats/PID.h (Default = Kaon)"}; + Configurable zVertex{"zvertex", 10.0f, "Z vertex range."}; + Configurable rapidityCut{"rapidity-max", 0.5, "Rapidity cut."}; - ConfigurableAxis invaxis{"invAxis", {200, 0.97, 1.1}, "Invariant mass axis binning."}; + ConfigurableAxis invaxis{"invAxis", {130, 0.97, 1.1}, "Invariant mass axis binning."}; ConfigurableAxis ptaxis{"ptAxis", {20, 0., 20.}, "Pt axis binning."}; - ConfigurableAxis maxis{"mAxis", {200, 0., 2000.}, "Multiplicity axis binning."}; - ConfigurableAxis nsigmaaxis{"nsigma-axis", {300, -15., 15.}, "NSigma axis binning."}; + ConfigurableAxis mcposZ{"mcposZ", {40, -20., 20.}, "Z vertex position axis binning."}; + ConfigurableAxis multiplicityaxis{"multiplicityAxis", {50, 0., 5000.}, "Multiplicity axis binning."}; + ConfigurableAxis rapidityaxis{"rapidityAxis", {10., -1.0 * rapidityCut, rapidityCut}, "Rapidity axis binning."}; + ConfigurableAxis nsigmatrackaxis{"nsigmatrackaxis", {300, -15., 15.}, "NSigma axis binning."}; + ConfigurableAxis nsigmaaxis1{"nsigmaAxis1", {1, 0., tpcnSigma1}, "NSigma axis binning in THnSparse."}; + ConfigurableAxis nsigmaaxis2{"nsigmaAxis2", {1, 0., tpcnSigma2}, "NSigma axis binning in THnSparse."}; HistogramRegistry registry{"registry", - {{"hNsigmaPos", "hNsigmaPos", {HistType::kTH1F, {nsigmaaxis}}}, - {"hNsigmaNeg", "hNsigmaNeg", {HistType::kTH1F, {nsigmaaxis}}}}}; + {{"hNsigmaPos", "hNsigmaPos", {HistType::kTH1F, {nsigmatrackaxis}}}, + {"hNsigmaNeg", "hNsigmaNeg", {HistType::kTH1F, {nsigmatrackaxis}}}, + {"motherGen", "motherGen", {HistType::kTH1F, {ptaxis}}}, + {"motherTrue", "motherTrue", {HistType::kTH1F, {ptaxis}}}, + {"motherBgr", "motherBgr", {HistType::kTH1F, {ptaxis}}}, + {"mcTrueposZ", "mcTrueposZ", {HistType::kTH1F, {mcposZ}}}, + {"mcGenposZ", "mcGenposZ", {HistType::kTH1F, {mcposZ}}}}}; // defined in DataFormats/Reconstruction/include/ReconstructionDataFormats/PID.h float mass1 = o2::track::PID::getMass(dauther1); float mass2 = o2::track::PID::getMass(dauther2); + Service pdg; + float multiplicity; + float multiplicityMC; + int n = 0; Filter eventFilter = (o2::aod::evsel::sel8 == true); - Filter vtxFilter = (nabs(o2::aod::collision::posZ) < vertexfilter); + Filter vtxFilter = (nabs(o2::aod::collision::posZ) < zVertex); using EventCandidates = soa::Filtered>; + using EventCandidate = EventCandidates::iterator; using TrackCandidates = soa::Join; + using EventCandidatesMC = soa::Filtered>; + using TrackCandidatesMC = soa::Join; + Partition positive = (aod::track::signed1Pt > 0.0f) && (nabs(o2::aod::pidtpc::tpcNSigmaKa) < tpcnSigma1); Partition negative = (aod::track::signed1Pt < 0.0f) && (nabs(o2::aod::pidtpc::tpcNSigmaKa) < tpcnSigma2); + Partition positiveMC = (aod::track::signed1Pt > 0.0f) && (nabs(o2::aod::pidtpc::tpcNSigmaKa) < tpcnSigma1); + Partition negativeMC = (aod::track::signed1Pt < 0.0f) && (nabs(o2::aod::pidtpc::tpcNSigmaKa) < tpcnSigma2); + TLorentzVector d1, d2, mother; - void init(o2::framework::InitContext&) + void init(o2::framework::InitContext &) { - if (test) - LOGF(info, "Running test"); - AxisSpec invAxis = {invaxis, "Inv. mass (GeV/c^{2})", "im"}; AxisSpec ptAxis = {ptaxis, "p_{T} (GeV/c)", "pt"}; - AxisSpec mAxis = {maxis, "N", "m"}; - HistogramConfigSpec Hist({HistType::kTHnSparseF, {invAxis, ptAxis, mAxis}}); - registry.add("unlike", "Unlike", Hist); - registry.add("likep", "Likep", Hist); - registry.add("liken", "Liken", Hist); + AxisSpec mAxis = {multiplicityaxis, "N", "m"}; + AxisSpec yAxis = {rapidityaxis, "y", "y"}; + AxisSpec nsigmatrackaxis1 = {nsigmaaxis1, fmt::format("nSigma particle X({})", mass1), "sx"}; + AxisSpec nsigmatrackaxis2 = {nsigmaaxis1, fmt::format("nSigma particle Y({})", mass2), "sy"}; + HistogramConfigSpec pairHisto({HistType::kTHnSparseF, {invAxis, ptAxis, mAxis, nsigmatrackaxis1, nsigmatrackaxis2, yAxis}}); + registry.add("unlike", "Unlike", pairHisto); + registry.add("likep", "Likep", pairHisto); + registry.add("liken", "Liken", pairHisto); + + registry.add("unlikeTrue", "UnlikeTrue", pairHisto); + registry.add("unlikeGen", "UnlikeGen", pairHisto); } template - bool selectedTrack(const T& track) + bool selectedTrack(const T &track) { if (!track.isPrimaryTrack()) return false; @@ -91,46 +119,50 @@ struct rsnanalysisTHnSparse { } template - bool selectedPair(TLorentzVector& mother, const T& track1, const T& track2) + bool selectedPair(TLorentzVector &mother, const T &track1, const T &track2) { d1.SetXYZM(track1.px(), track1.py(), track1.pz(), mass1); d2.SetXYZM(track2.px(), track2.py(), track2.pz(), mass2); mother = d1 + d2; + if (std::abs(mother.Rapidity()) > 0.5) + return false; + return true; } - void process(EventCandidate const& collision, TrackCandidates const& tracks) + void processData(EventCandidate const &collision, TrackCandidates const &tracks) { - if (test && collision.globalIndex() != 1) - return; - auto posDauthers = positive->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); auto negDauthers = negative->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); - if (collision.globalIndex() == 0) { - if (test) { + if (ignorezeroevent && collision.globalIndex() == 0) + { + if (verboselevel > 0) LOGF(info, "BAD pos=%lld neg=%lld, Z vertex position: %f [cm], %d, mult:%f.0", posDauthers.size(), negDauthers.size(), collision.posZ(), collision.globalIndex(), multiplicity); - } + return; } multiplicity = collision.multFT0A() + collision.multFT0C(); - if (refresh > 0 && collision.globalIndex() % refresh == refresh_index) + if (verboselevel > 0 && refresh > 0 && collision.globalIndex() % refresh == refresh_index) LOGF(info, "pos=%lld neg=%lld, Z vertex position: %f [cm], %d, mult:%f.0", posDauthers.size(), negDauthers.size(), collision.posZ(), collision.globalIndex(), multiplicity); - for (const auto& trk : posDauthers) { + for (const auto &trk : posDauthers) + { registry.fill(HIST("hNsigmaPos"), trk.tpcNSigmaKa()); } - for (const auto& trk : negDauthers) { + for (const auto &trk : negDauthers) + { registry.fill(HIST("hNsigmaNeg"), trk.tpcNSigmaKa()); } - for (auto& [track1, track2] : combinations(o2::soa::CombinationsUpperIndexPolicy(posDauthers, negDauthers))) { + for (auto &[track1, track2] : combinations(o2::soa::CombinationsUpperIndexPolicy(posDauthers, negDauthers))) + { if (!selectedTrack(track1)) continue; @@ -139,10 +171,15 @@ struct rsnanalysisTHnSparse { if (!selectedPair(mother, track1, track2)) continue; - registry.fill(HIST("unlike"), mother.Mag(), mother.Pt(), multiplicity); + + if (verboselevel > 1) + LOGF(info, "Unlike-sign: d1=%ld , d2=%ld , mother=%f", track1.globalIndex(), track2.globalIndex(), mother.Mag()); + + registry.fill(HIST("unlike"), mother.Mag(), mother.Pt(), multiplicity, track1.tpcNSigmaKa(), track2.tpcNSigmaKa(), mother.Rapidity()); } - for (auto& [track1, track2] : combinations(o2::soa::CombinationsStrictlyUpperIndexPolicy(posDauthers, posDauthers))) { + for (auto &[track1, track2] : combinations(o2::soa::CombinationsStrictlyUpperIndexPolicy(posDauthers, posDauthers))) + { if (!selectedTrack(track1)) continue; @@ -151,10 +188,15 @@ struct rsnanalysisTHnSparse { if (!selectedPair(mother, track1, track2)) continue; - registry.fill(HIST("likep"), mother.Mag(), mother.Pt(), multiplicity); + + if (verboselevel > 1) + LOGF(info, "Like-sign positive: d1=%ld , d2=%ld , mother=%f", track1.globalIndex(), track2.globalIndex(), mother.Mag()); + + registry.fill(HIST("likep"), mother.Mag(), mother.Pt(), multiplicity, track1.tpcNSigmaKa(), track2.tpcNSigmaKa(), mother.Rapidity()); } - for (auto& [track1, track2] : combinations(o2::soa::CombinationsStrictlyUpperIndexPolicy(negDauthers, negDauthers))) { + for (auto &[track1, track2] : combinations(o2::soa::CombinationsStrictlyUpperIndexPolicy(negDauthers, negDauthers))) + { if (!selectedTrack(track1)) continue; @@ -163,13 +205,165 @@ struct rsnanalysisTHnSparse { if (!selectedPair(mother, track1, track2)) continue; - registry.fill(HIST("liken"), mother.Mag(), mother.Pt(), multiplicity); + + if (verboselevel > 1) + LOGF(info, "Like-sign negative: d1=%ld , d2=%ld , mother=%f", track1.globalIndex(), track2.globalIndex(), mother.Mag()); + + registry.fill(HIST("liken"), mother.Mag(), mother.Pt(), multiplicity, track1.tpcNSigmaKa(), track2.tpcNSigmaKa(), mother.Rapidity()); } } + + PROCESS_SWITCH(rsnanalysisTHnSparse, processData, "Process Event for Data", true); + + void processTrue(EventCandidatesMC::iterator const &collision, TrackCandidatesMC const &tracks, aod::McParticles const &mcParticles, aod::McCollisions const &mcCollisions) + { + auto posDauthersMC = positiveMC->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + auto negDauthersMC = negativeMC->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + + if (!collision.has_mcCollision()) + { + LOGF(warning, "No MC collision for this collision, skip..."); + return; + } + + if (std::abs(collision.posZ()) < zVertex) + { + registry.fill(HIST("mcTrueposZ"), collision.posZ()); + + multiplicityMC = collision.multFT0A() + collision.multFT0C(); + + for (auto &[track1, track2] : combinations(o2::soa::CombinationsUpperIndexPolicy(posDauthersMC, negDauthersMC))) + { + + if (!track1.has_mcParticle()) + { + LOGF(warning, "No MC particle for track, skip..."); + continue; + } + + if (!track2.has_mcParticle()) + { + LOGF(warning, "No MC particle for track, skip..."); + continue; + } + + if (!selectedTrack(track1)) + continue; + + if (!selectedTrack(track2)) + continue; + + const auto mctrack1 = track1.mcParticle(); + const auto mctrack2 = track2.mcParticle(); + int track1PDG = std::abs(mctrack1.pdgCode()); + int track2PDG = std::abs(mctrack2.pdgCode()); + + if (!(track1PDG == 321 && track2PDG == 321)) + { + continue; + } + for (auto &mothertrack1 : mctrack1.mothers_as()) + { + for (auto &mothertrack2 : mctrack2.mothers_as()) + { + if (mothertrack1.pdgCode() != mothertrack2.pdgCode()) + continue; + + if (mothertrack1.globalIndex() != mothertrack2.globalIndex()) + continue; + + if (std::abs(mothertrack1.y()) > rapidityCut) + continue; + + if (std::abs(mothertrack2.y()) > rapidityCut) + continue; + + if (std::abs(mothertrack1.pdgCode()) != 333) + continue; + + registry.fill(HIST("motherTrue"), mothertrack1.pt()); + n++; + if (verboselevel > 0) + LOGF(info, "True: %d, d1=%d (%ld), d2=%d (%ld), mother=%d (%ld)", n, mctrack1.pdgCode(), mctrack1.globalIndex(), mctrack2.pdgCode(), mctrack2.globalIndex(), mothertrack1.pdgCode(), mothertrack1.globalIndex()); + + if (!selectedPair(mother, mctrack1, mctrack2)) + continue; + registry.fill(HIST("unlikeTrue"), mother.Mag(), mother.Pt(), multiplicityMC, tpcnSigma1 / 2.0, tpcnSigma2 / 2.0, mother.Rapidity()); + } + } + } + } + } + + PROCESS_SWITCH(rsnanalysisTHnSparse, processTrue, "Process Event for MC reconstruction.", false); + + int numberofEntries = 0; + + void processGen(aod::McCollision const &mcCollision, aod::McParticles const &mcParticles) + { + if (std::abs(mcCollision.posZ()) < zVertex) + { + registry.fill(HIST("mcGenposZ"), mcCollision.posZ()); + + int nuberofPhi = 0; + + for (auto &particle : mcParticles) + { + if (std::abs(particle.y()) > rapidityCut) + continue; + + if (particle.pdgCode() == 333) + { + auto daughters = particle.daughters_as(); + if (daughters.size() != 2) + continue; + + auto daup = false; + auto daun = false; + + for (auto &dau : daughters) + { + if (!dau.isPhysicalPrimary()) + continue; + + if (dau.pdgCode() == +321) + { + daup = true; + d1.SetXYZM(dau.px(), dau.py(), dau.pz(), mass1); + } + else if (dau.pdgCode() == -321) + { + daun = true; + d2.SetXYZM(dau.px(), dau.py(), dau.pz(), mass2); + } + } + if (!daup && !daun) + continue; + + mother = d1 + d2; + + registry.fill(HIST("unlikeGen"), mother.Mag(), mother.Pt(), multiplicityMC, tpcnSigma1 / 2.0, tpcnSigma2 / 2.0, mother.Rapidity()); + registry.fill(HIST("motherGen"), particle.pt()); + + nuberofPhi++; + numberofEntries++; + + if (verboselevel > 0) + LOGF(info, "Gen: %d, #Phi =%d, mother=%d (%ld), Inv.mass:%f, Pt= %f", numberofEntries, nuberofPhi, particle.pdgCode(), particle.globalIndex(), mother.Mag(), mother.Pt()); + } + else + { + registry.fill(HIST("motherBgr"), particle.pt()); + } + } + } + } + + PROCESS_SWITCH(rsnanalysisTHnSparse, processGen, "Process generated.", false); }; -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +WorkflowSpec defineDataProcessing(ConfigContext const &cfgc) { return WorkflowSpec{ - adaptAnalysisTask(cfgc)}; + adaptAnalysisTask(cfgc)}; } From 81ef19eb4e97b67f25e4cabb6f5f6949805fc881 Mon Sep 17 00:00:00 2001 From: Veronika Barbasova Date: Fri, 24 Nov 2023 12:55:46 +0100 Subject: [PATCH 2/3] Update --- PWGLF/Tasks/rsnanalysisTHnSparse.cxx | 84 ++++++++++------------------ 1 file changed, 30 insertions(+), 54 deletions(-) diff --git a/PWGLF/Tasks/rsnanalysisTHnSparse.cxx b/PWGLF/Tasks/rsnanalysisTHnSparse.cxx index 9ce3b1cfd75..0c5fe99715c 100644 --- a/PWGLF/Tasks/rsnanalysisTHnSparse.cxx +++ b/PWGLF/Tasks/rsnanalysisTHnSparse.cxx @@ -30,8 +30,7 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; -struct rsnanalysisTHnSparse -{ +struct rsnanalysisTHnSparse { SliceCache cache; @@ -93,7 +92,7 @@ struct rsnanalysisTHnSparse TLorentzVector d1, d2, mother; - void init(o2::framework::InitContext &) + void init(o2::framework::InitContext&) { AxisSpec invAxis = {invaxis, "Inv. mass (GeV/c^{2})", "im"}; AxisSpec ptAxis = {ptaxis, "p_{T} (GeV/c)", "pt"}; @@ -111,7 +110,7 @@ struct rsnanalysisTHnSparse } template - bool selectedTrack(const T &track) + bool selectedTrack(const T& track) { if (!track.isPrimaryTrack()) return false; @@ -119,7 +118,7 @@ struct rsnanalysisTHnSparse } template - bool selectedPair(TLorentzVector &mother, const T &track1, const T &track2) + bool selectedPair(TLorentzVector& mother, const T& track1, const T& track2) { d1.SetXYZM(track1.px(), track1.py(), track1.pz(), mass1); d2.SetXYZM(track2.px(), track2.py(), track2.pz(), mass2); @@ -131,13 +130,12 @@ struct rsnanalysisTHnSparse return true; } - void processData(EventCandidate const &collision, TrackCandidates const &tracks) + void processData(EventCandidate const& collision, TrackCandidates const& tracks) { auto posDauthers = positive->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); auto negDauthers = negative->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); - if (ignorezeroevent && collision.globalIndex() == 0) - { + if (ignorezeroevent && collision.globalIndex() == 0) { if (verboselevel > 0) LOGF(info, "BAD pos=%lld neg=%lld, Z vertex position: %f [cm], %d, mult:%f.0", posDauthers.size(), negDauthers.size(), collision.posZ(), collision.globalIndex(), multiplicity); @@ -151,18 +149,15 @@ struct rsnanalysisTHnSparse LOGF(info, "pos=%lld neg=%lld, Z vertex position: %f [cm], %d, mult:%f.0", posDauthers.size(), negDauthers.size(), collision.posZ(), collision.globalIndex(), multiplicity); - for (const auto &trk : posDauthers) - { + for (const auto& trk : posDauthers) { registry.fill(HIST("hNsigmaPos"), trk.tpcNSigmaKa()); } - for (const auto &trk : negDauthers) - { + for (const auto& trk : negDauthers) { registry.fill(HIST("hNsigmaNeg"), trk.tpcNSigmaKa()); } - for (auto &[track1, track2] : combinations(o2::soa::CombinationsUpperIndexPolicy(posDauthers, negDauthers))) - { + for (auto& [track1, track2] : combinations(o2::soa::CombinationsUpperIndexPolicy(posDauthers, negDauthers))) { if (!selectedTrack(track1)) continue; @@ -178,8 +173,7 @@ struct rsnanalysisTHnSparse registry.fill(HIST("unlike"), mother.Mag(), mother.Pt(), multiplicity, track1.tpcNSigmaKa(), track2.tpcNSigmaKa(), mother.Rapidity()); } - for (auto &[track1, track2] : combinations(o2::soa::CombinationsStrictlyUpperIndexPolicy(posDauthers, posDauthers))) - { + for (auto& [track1, track2] : combinations(o2::soa::CombinationsStrictlyUpperIndexPolicy(posDauthers, posDauthers))) { if (!selectedTrack(track1)) continue; @@ -195,8 +189,7 @@ struct rsnanalysisTHnSparse registry.fill(HIST("likep"), mother.Mag(), mother.Pt(), multiplicity, track1.tpcNSigmaKa(), track2.tpcNSigmaKa(), mother.Rapidity()); } - for (auto &[track1, track2] : combinations(o2::soa::CombinationsStrictlyUpperIndexPolicy(negDauthers, negDauthers))) - { + for (auto& [track1, track2] : combinations(o2::soa::CombinationsStrictlyUpperIndexPolicy(negDauthers, negDauthers))) { if (!selectedTrack(track1)) continue; @@ -215,34 +208,29 @@ struct rsnanalysisTHnSparse PROCESS_SWITCH(rsnanalysisTHnSparse, processData, "Process Event for Data", true); - void processTrue(EventCandidatesMC::iterator const &collision, TrackCandidatesMC const &tracks, aod::McParticles const &mcParticles, aod::McCollisions const &mcCollisions) + void processTrue(EventCandidatesMC::iterator const& collision, TrackCandidatesMC const& tracks, aod::McParticles const& mcParticles, aod::McCollisions const& mcCollisions) { auto posDauthersMC = positiveMC->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); auto negDauthersMC = negativeMC->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); - if (!collision.has_mcCollision()) - { + if (!collision.has_mcCollision()) { LOGF(warning, "No MC collision for this collision, skip..."); return; } - if (std::abs(collision.posZ()) < zVertex) - { + if (std::abs(collision.posZ()) < zVertex) { registry.fill(HIST("mcTrueposZ"), collision.posZ()); multiplicityMC = collision.multFT0A() + collision.multFT0C(); - for (auto &[track1, track2] : combinations(o2::soa::CombinationsUpperIndexPolicy(posDauthersMC, negDauthersMC))) - { + for (auto& [track1, track2] : combinations(o2::soa::CombinationsUpperIndexPolicy(posDauthersMC, negDauthersMC))) { - if (!track1.has_mcParticle()) - { + if (!track1.has_mcParticle()) { LOGF(warning, "No MC particle for track, skip..."); continue; } - if (!track2.has_mcParticle()) - { + if (!track2.has_mcParticle()) { LOGF(warning, "No MC particle for track, skip..."); continue; } @@ -258,14 +246,11 @@ struct rsnanalysisTHnSparse int track1PDG = std::abs(mctrack1.pdgCode()); int track2PDG = std::abs(mctrack2.pdgCode()); - if (!(track1PDG == 321 && track2PDG == 321)) - { + if (!(track1PDG == 321 && track2PDG == 321)) { continue; } - for (auto &mothertrack1 : mctrack1.mothers_as()) - { - for (auto &mothertrack2 : mctrack2.mothers_as()) - { + for (auto& mothertrack1 : mctrack1.mothers_as()) { + for (auto& mothertrack2 : mctrack2.mothers_as()) { if (mothertrack1.pdgCode() != mothertrack2.pdgCode()) continue; @@ -299,21 +284,18 @@ struct rsnanalysisTHnSparse int numberofEntries = 0; - void processGen(aod::McCollision const &mcCollision, aod::McParticles const &mcParticles) + void processGen(aod::McCollision const& mcCollision, aod::McParticles const& mcParticles) { - if (std::abs(mcCollision.posZ()) < zVertex) - { + if (std::abs(mcCollision.posZ()) < zVertex) { registry.fill(HIST("mcGenposZ"), mcCollision.posZ()); int nuberofPhi = 0; - for (auto &particle : mcParticles) - { + for (auto& particle : mcParticles) { if (std::abs(particle.y()) > rapidityCut) continue; - if (particle.pdgCode() == 333) - { + if (particle.pdgCode() == 333) { auto daughters = particle.daughters_as(); if (daughters.size() != 2) continue; @@ -321,18 +303,14 @@ struct rsnanalysisTHnSparse auto daup = false; auto daun = false; - for (auto &dau : daughters) - { + for (auto& dau : daughters) { if (!dau.isPhysicalPrimary()) continue; - if (dau.pdgCode() == +321) - { + if (dau.pdgCode() == +321) { daup = true; d1.SetXYZM(dau.px(), dau.py(), dau.pz(), mass1); - } - else if (dau.pdgCode() == -321) - { + } else if (dau.pdgCode() == -321) { daun = true; d2.SetXYZM(dau.px(), dau.py(), dau.pz(), mass2); } @@ -350,9 +328,7 @@ struct rsnanalysisTHnSparse if (verboselevel > 0) LOGF(info, "Gen: %d, #Phi =%d, mother=%d (%ld), Inv.mass:%f, Pt= %f", numberofEntries, nuberofPhi, particle.pdgCode(), particle.globalIndex(), mother.Mag(), mother.Pt()); - } - else - { + } else { registry.fill(HIST("motherBgr"), particle.pt()); } } @@ -362,8 +338,8 @@ struct rsnanalysisTHnSparse PROCESS_SWITCH(rsnanalysisTHnSparse, processGen, "Process generated.", false); }; -WorkflowSpec defineDataProcessing(ConfigContext const &cfgc) +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ - adaptAnalysisTask(cfgc)}; + adaptAnalysisTask(cfgc)}; } From f50a1ef9228f7552d7a7775e6a5940455cf1c3bf Mon Sep 17 00:00:00 2001 From: Veronika Barbasova Date: Fri, 24 Nov 2023 13:05:57 +0100 Subject: [PATCH 3/3] name change --- PWGLF/Tasks/CMakeLists.txt | 4 ++-- ...nanalysisTHnSparse.cxx => phianalysisTHnSparse.cxx} | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) rename PWGLF/Tasks/{rsnanalysisTHnSparse.cxx => phianalysisTHnSparse.cxx} (98%) diff --git a/PWGLF/Tasks/CMakeLists.txt b/PWGLF/Tasks/CMakeLists.txt index 7fcae9513c6..ea0ac8983c3 100644 --- a/PWGLF/Tasks/CMakeLists.txt +++ b/PWGLF/Tasks/CMakeLists.txt @@ -211,8 +211,8 @@ o2physics_add_dpl_workflow(delta-analysis PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(rsn-analysis-thnsparse - SOURCES rsnanalysisTHnSparse.cxx +o2physics_add_dpl_workflow(phi-analysis-thnsparse + SOURCES phianalysisTHnSparse.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) diff --git a/PWGLF/Tasks/rsnanalysisTHnSparse.cxx b/PWGLF/Tasks/phianalysisTHnSparse.cxx similarity index 98% rename from PWGLF/Tasks/rsnanalysisTHnSparse.cxx rename to PWGLF/Tasks/phianalysisTHnSparse.cxx index 0c5fe99715c..45fafe3a2d2 100644 --- a/PWGLF/Tasks/rsnanalysisTHnSparse.cxx +++ b/PWGLF/Tasks/phianalysisTHnSparse.cxx @@ -30,7 +30,7 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; -struct rsnanalysisTHnSparse { +struct phianalysisTHnSparse { SliceCache cache; @@ -206,7 +206,7 @@ struct rsnanalysisTHnSparse { } } - PROCESS_SWITCH(rsnanalysisTHnSparse, processData, "Process Event for Data", true); + PROCESS_SWITCH(phianalysisTHnSparse, processData, "Process Event for Data", true); void processTrue(EventCandidatesMC::iterator const& collision, TrackCandidatesMC const& tracks, aod::McParticles const& mcParticles, aod::McCollisions const& mcCollisions) { @@ -280,7 +280,7 @@ struct rsnanalysisTHnSparse { } } - PROCESS_SWITCH(rsnanalysisTHnSparse, processTrue, "Process Event for MC reconstruction.", false); + PROCESS_SWITCH(phianalysisTHnSparse, processTrue, "Process Event for MC reconstruction.", false); int numberofEntries = 0; @@ -335,11 +335,11 @@ struct rsnanalysisTHnSparse { } } - PROCESS_SWITCH(rsnanalysisTHnSparse, processGen, "Process generated.", false); + PROCESS_SWITCH(phianalysisTHnSparse, processGen, "Process generated.", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ - adaptAnalysisTask(cfgc)}; + adaptAnalysisTask(cfgc)}; }