From 64b76589bcea2341f45d4b9a6f64f996c1738cf0 Mon Sep 17 00:00:00 2001 From: Jonghan Park Date: Thu, 17 Jul 2025 16:22:27 +0900 Subject: [PATCH 001/345] eID study for single electron analysis --- PWGHF/HFL/Tasks/taskSingleElectron.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/PWGHF/HFL/Tasks/taskSingleElectron.cxx b/PWGHF/HFL/Tasks/taskSingleElectron.cxx index d8a8b6e5b87..a03820f5cc4 100644 --- a/PWGHF/HFL/Tasks/taskSingleElectron.cxx +++ b/PWGHF/HFL/Tasks/taskSingleElectron.cxx @@ -46,7 +46,6 @@ struct HfTaskSingleElectron { Configurable tofNSigmaMax{"tofNSigmaMax", 3., "max of tof nsigma"}; Configurable tpcNSigmaMin{"tpcNSigmaMin", -1., "min of tpc nsigma"}; Configurable tpcNSigmaMax{"tpcNSigmaMax", 3., "max of tpc nsigma"}; - Configurable nBinsPt{"nBinsPt", 100, "N bins in pT histo"}; // SliceCache From f133bd9dea82fa2c3981fd11624c1ca2056318bc Mon Sep 17 00:00:00 2001 From: Jonghan Park Date: Fri, 18 Jul 2025 10:17:02 +0900 Subject: [PATCH 002/345] eID study for single electron analysis --- PWGHF/HFL/Tasks/taskSingleElectron.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/PWGHF/HFL/Tasks/taskSingleElectron.cxx b/PWGHF/HFL/Tasks/taskSingleElectron.cxx index a03820f5cc4..d8a8b6e5b87 100644 --- a/PWGHF/HFL/Tasks/taskSingleElectron.cxx +++ b/PWGHF/HFL/Tasks/taskSingleElectron.cxx @@ -46,6 +46,7 @@ struct HfTaskSingleElectron { Configurable tofNSigmaMax{"tofNSigmaMax", 3., "max of tof nsigma"}; Configurable tpcNSigmaMin{"tpcNSigmaMin", -1., "min of tpc nsigma"}; Configurable tpcNSigmaMax{"tpcNSigmaMax", 3., "max of tpc nsigma"}; + Configurable nBinsPt{"nBinsPt", 100, "N bins in pT histo"}; // SliceCache From c16ef786de9c8f2413d955f3d7a889820250e382 Mon Sep 17 00:00:00 2001 From: Jonghan Park Date: Tue, 12 Aug 2025 11:13:31 +0900 Subject: [PATCH 003/345] Add electron source selection method --- PWGHF/HFL/Tasks/taskSingleElectron.cxx | 348 ++++++++++++++++++++++++- 1 file changed, 339 insertions(+), 9 deletions(-) diff --git a/PWGHF/HFL/Tasks/taskSingleElectron.cxx b/PWGHF/HFL/Tasks/taskSingleElectron.cxx index d8a8b6e5b87..e938d95425a 100644 --- a/PWGHF/HFL/Tasks/taskSingleElectron.cxx +++ b/PWGHF/HFL/Tasks/taskSingleElectron.cxx @@ -27,6 +27,44 @@ using namespace o2::constants::math; using namespace o2::framework; using namespace o2::framework::expressions; +enum PdgCode { + kEta = 221, + kOmega = 223, + kPhi = 333, + kEtaPrime = 331 +}; + +enum SourceType { + NotElec = 0, // not electron + DirectCharm = 1, // electrons from prompt charm hadrons + DirectBeauty = 2, // electrons from primary beauty hadrons + BeautyCharm = 3, // electrons from non-prompt charm hadrons + DirectGamma = 4, // electrons from direct photon + GammaPi0 = 5, + GammaEta = 6, + GammaOmega = 7, + GammaPhi = 8, + GammaEtaPrime = 9, + GammaRho0 = 10, + GammaK0s = 11, + GammaK0l = 12, + GammaKe3 = 13, + GammaLambda0 = 14, + GammaSigma = 15, + Pi0 = 16, + Eta = 17, + Omega = 18, + Phi = 19, + EtaPrime = 20, + Rho0 = 21, + K0s = 22, + K0l = 23, + Ke3 = 24, + Lambda0 = 25, + Sigma = 26, + Else = 27 +}; + struct HfTaskSingleElectron { // Produces @@ -55,6 +93,7 @@ struct HfTaskSingleElectron { // using declarations using MyCollisions = soa::Join; using TracksEl = soa::Join; + using McTracksEl = soa::Join; // Filter Filter collZFilter = nabs(aod::collision::posZ) < posZMax; @@ -79,7 +118,6 @@ struct HfTaskSingleElectron { void init(InitContext const&) { // create histograms - histos.add("hEventCounter", "hEventCounter", kTH1F, {axisEvt}); histos.add("nEvents", "Number of events", kTH1F, {{1, 0., 1.}}); histos.add("VtxZ", "VtxZ; cm; entries", kTH1F, {axisPosZ}); histos.add("etaTrack", "etaTrack; #eta; entries", kTH1F, {axisEta}); @@ -102,6 +140,16 @@ struct HfTaskSingleElectron { // track impact parameter histos.add("dcaTrack", "", kTH2F, {{axisPtEl}, {axisTrackIp}}); + histos.add("dcaBeauty", "", kTH2F, {{axisPtEl}, {axisTrackIp}}); + histos.add("dcaCharm", "", kTH2F, {{axisPtEl}, {axisTrackIp}}); + histos.add("dcaDalitz", "", kTH2F, {{axisPtEl}, {axisTrackIp}}); + histos.add("dcaConv", "", kTH2F, {{axisPtEl}, {axisTrackIp}}); + + // QA plots for MC + histos.add("hPdgC", "", kTH1F, {{10001, -0.5, 10000.5}}); + histos.add("hPdgB", "", kTH1F, {{10001, -0.5, 10000.5}}); + histos.add("hPdgDa", "", kTH1F, {{10001, -0.5, 10000.5}}); + histos.add("hPdgCo", "", kTH1F, {{10001, -0.5, 10000.5}}); } template @@ -138,24 +186,281 @@ struct HfTaskSingleElectron { return true; } - void process(soa::Filtered::iterator const& collision, - TracksEl const& tracks) + template + int getElecSource(const TrackType& track, double& mpt, int& mpdg) + { + auto mcpart = track.mcParticle(); + if (std::abs(mcpart.pdgCode()) != kElectron) { + return NotElec; + } + + int motherPdg = -999; + int grmotherPdg = -999; + int ggrmotherPdg = -999; // mother, grand mother, grand grand mother pdg + int motherPt = -999.; + int grmotherPt = -999; + int ggrmotherPt = -999.; // mother, grand mother, grand grand mother pt + + auto partMother = mcpart.template mothers_as(); // first mother particle of electron + auto partMotherCopy = partMother; // copy of the first mother + auto mctrack = partMother; // will change all the time + + motherPt = partMother.front().pt(); // first mother pt + motherPdg = std::abs(partMother.front().pdgCode()); // first mother pdg + mpt = motherPt; // copy of first mother pt + mpdg = motherPdg; // copy of first mother pdg + + std::vector anc; + anc.push_back(std::abs(mcpart.pdgCode())); + anc.push_back(mpdg); + + // check if electron from charm hadrons + if ((int(motherPdg / 100.) % 10) == kCharm || (int(motherPdg / 1000.) % 10) == kCharm) { + + // iterate until B hadron is found as an ancestor + while (partMother.size()) { + mctrack = partMother.front().template mothers_as(); + if (mctrack.size()) { + auto const& grmothersIdsVec = mctrack.front().mothersIds(); + + if (grmothersIdsVec.empty()) { + return DirectCharm; + } else { + grmotherPt = mctrack.front().pt(); + grmotherPdg = std::abs(mctrack.front().pdgCode()); + anc.push_back(mctrack.front().pdgCode()); + if ((int(grmotherPdg / 100.) % 10) == kBottom || (int(grmotherPdg / 1000.) % 10) == kBottom) { + mpt = grmotherPt; + mpdg = grmotherPdg; + return BeautyCharm; + } + } + } + partMother = mctrack; + } + } + + // check if electron from beauty hadrons + else if ((int(motherPdg / 100.) % 10) == kBottom || (int(motherPdg / 1000.) % 10) == kBottom) { + return DirectBeauty; + } + + // check if electron from photon conversion + else if (motherPdg == kGamma) { + mctrack = partMother.front().template mothers_as(); + if (mctrack.size()) { + auto const& grmothersIdsVec = mctrack.front().mothersIds(); + if (grmothersIdsVec.empty()) { + return DirectGamma; + } else { + grmotherPdg = std::abs(mctrack.front().pdgCode()); + mpdg = grmotherPdg; + mpt = mctrack.front().pt(); + + partMother = mctrack; + mctrack = partMother.front().template mothers_as(); + if (mctrack.size()) { + auto const& ggrmothersIdsVec = mctrack.front().mothersIds(); + if (ggrmothersIdsVec.empty()) { + if (grmotherPdg == kPi0) { + return GammaPi0; + } else if (grmotherPdg == kEta) { + return GammaEta; + } else if (grmotherPdg == kOmega) { + return GammaOmega; + } else if (grmotherPdg == kPhi) { + return GammaPhi; + } else if (grmotherPdg == kEtaPrime) { + return GammaEtaPrime; + } else if (grmotherPdg == kRho770_0) { + return GammaRho0; + } else { + return Else; + } + } else { + ggrmotherPdg = mctrack.front().pdgCode(); + ggrmotherPt = mctrack.front().pt(); + mpdg = ggrmotherPdg; + mpt = ggrmotherPt; + if (grmotherPdg == kPi0) { + if (ggrmotherPdg == kK0Short) { + return GammaK0s; + } else if (ggrmotherPdg == kK0Long) { + return GammaK0l; + } else if (ggrmotherPdg == kKPlus) { + return GammaKe3; + } else if (ggrmotherPdg == kLambda0) { + return GammaLambda0; + } else if (ggrmotherPdg == kSigmaPlus) { + return GammaSigma; + } else { + mpdg = grmotherPdg; + mpt = grmotherPt; + return GammaPi0; + } + } else if (grmotherPdg == kEta) { + mpdg = grmotherPdg; + mpt = grmotherPt; + return GammaEta; + } else if (grmotherPdg == kOmega) { + mpdg = grmotherPdg; + mpt = grmotherPt; + return GammaOmega; + } else if (grmotherPdg == kPhi) { + mpdg = grmotherPdg; + mpt = grmotherPt; + return GammaPhi; + } else if (grmotherPdg == kEtaPrime) { + mpdg = grmotherPdg; + mpt = grmotherPt; + return GammaEtaPrime; + } else if (grmotherPdg == kRho770_0) { + mpdg = grmotherPdg; + mpt = grmotherPt; + return GammaRho0; + } else { + return Else; + } + } + } + } + } + } + + // check if electron from Dalitz decays + else { + mctrack = partMother.front().template mothers_as(); + if (mctrack.size()) { + auto const& grmothersIdsVec = mctrack.front().mothersIds(); + if (grmothersIdsVec.empty()) { + if (motherPdg == kPi0) { + return Pi0; + } else if (motherPdg == kEta) { + return Eta; + } else if (motherPdg == kOmega) { + return Omega; + } else if (motherPdg == kPhi) { + return Phi; + } else if (motherPdg == kEtaPrime) { + return EtaPrime; + } else if (motherPdg == kRho770_0) { + return Rho0; + } else if (motherPdg == kKPlus) { + return Ke3; + } else if (motherPdg == kK0Long) { + return K0l; + } else { + return Else; + } + } else { + if (motherPdg == kPi0) { + grmotherPt = mctrack.front().pt(); + grmotherPdg = mctrack.front().pdgCode(); + mpt = grmotherPt; + mpdg = grmotherPdg; + if (grmotherPdg == kK0Short) { + return K0s; + } else if (grmotherPdg == kK0Long) { + return K0l; + } else if (grmotherPdg == kKPlus) { + return Ke3; + } else if (grmotherPdg == kLambda0) { + return Lambda0; + } else if (grmotherPdg == kSigmaPlus) { + return Sigma; + } else { + mpt = motherPt; + mpdg = motherPdg; + return Pi0; + } + } else if (motherPdg == kEta) { + return Eta; + } else if (motherPdg == kOmega) { + return Omega; + } else if (motherPdg == kPhi) { + return Phi; + } else if (motherPdg == kEtaPrime) { + return EtaPrime; + } else if (motherPdg == kRho770_0) { + return Rho0; + } else if (motherPdg == kKPlus) { + return Ke3; + } else if (motherPdg == kK0Long) { + return K0l; + } else { + return Else; + } + } + } + } + + return Else; + } + + void processData(soa::Filtered::iterator const& collision, + TracksEl const& tracks) + { + float flagAnalysedEvt = 0.5; + + if (!collision.sel8()) { + return; + } + + if (collision.numContrib() < nContribMin) { + return; + } + + histos.fill(HIST("VtxZ"), collision.posZ()); + histos.fill(HIST("nEvents"), flagAnalysedEvt); + + for (const auto& track : tracks) { + + if (!trackSel(track)) { + continue; + } + + histos.fill(HIST("etaTrack"), track.eta()); + histos.fill(HIST("ptTrack"), track.pt()); + + histos.fill(HIST("tpcNClsTrack"), track.tpcNClsCrossedRows()); + histos.fill(HIST("tpcFoundFindableTrack"), track.tpcCrossedRowsOverFindableCls()); + histos.fill(HIST("tpcChi2Track"), track.tpcChi2NCl()); + histos.fill(HIST("itsIBClsTrack"), track.itsNClsInnerBarrel()); + histos.fill(HIST("dcaXYTrack"), track.dcaXY()); + histos.fill(HIST("dcaZTrack"), track.dcaZ()); + + histos.fill(HIST("tofNSigPt"), track.pt(), track.tofNSigmaEl()); + histos.fill(HIST("tpcNSigPt"), track.pt(), track.tpcNSigmaEl()); + + if (std::abs(track.tofNSigmaEl()) > tofNSigmaMax) { + continue; + } + histos.fill(HIST("tofNSigPtQA"), track.pt(), track.tofNSigmaEl()); + histos.fill(HIST("tpcNSigPtAfterTofCut"), track.pt(), track.tpcNSigmaEl()); + + if (track.tpcNSigmaEl() < tpcNSigmaMin || track.tpcNSigmaEl() > tpcNSigmaMax) { + continue; + } + histos.fill(HIST("tpcNSigPtQA"), track.pt(), track.tpcNSigmaEl()); + + histos.fill(HIST("dcaTrack"), track.pt(), track.dcaXY()); + } + } + PROCESS_SWITCH(HfTaskSingleElectron, processData, "For real data", true); + + void processMc(soa::Filtered::iterator const& collision, + McTracksEl const& tracks, + aod::McParticles const&) { - float flagEventFill = 0.5; float flagAnalysedEvt = 0.5; - histos.fill(HIST("hEventCounter"), flagEventFill); if (!collision.sel8()) { return; } - flagEventFill += 1.; - histos.fill(HIST("hEventCounter"), flagEventFill); if (collision.numContrib() < nContribMin) { return; } - flagEventFill += 1.; - histos.fill(HIST("hEventCounter"), flagEventFill); histos.fill(HIST("VtxZ"), collision.posZ()); histos.fill(HIST("nEvents"), flagAnalysedEvt); @@ -179,6 +484,30 @@ struct HfTaskSingleElectron { histos.fill(HIST("tofNSigPt"), track.pt(), track.tofNSigmaEl()); histos.fill(HIST("tpcNSigPt"), track.pt(), track.tpcNSigmaEl()); + int mpdg; // electron source pdg code + double mpt; // electron source pt + int source = getElecSource(track, mpt, mpdg); + + if (source == DirectBeauty || source == BeautyCharm) { + histos.fill(HIST("hPdgB"), mpdg); + histos.fill(HIST("dcaBeauty"), track.pt(), track.dcaXY()); + } + + if (source == DirectCharm) { + histos.fill(HIST("hPdgC"), mpdg); + histos.fill(HIST("dcaCharm"), track.pt(), track.dcaXY()); + } + + if (source >= GammaPi0 && source <= GammaSigma) { + histos.fill(HIST("hPdgCo"), mpdg); + histos.fill(HIST("dcaConv"), track.pt(), track.dcaXY()); + } + + if (source >= Pi0 && source <= Sigma) { + histos.fill(HIST("hPdgDa"), mpdg); + histos.fill(HIST("dcaDalitz"), track.pt(), track.dcaXY()); + } + if (std::abs(track.tofNSigmaEl()) > tofNSigmaMax) { continue; } @@ -193,6 +522,7 @@ struct HfTaskSingleElectron { histos.fill(HIST("dcaTrack"), track.pt(), track.dcaXY()); } } + PROCESS_SWITCH(HfTaskSingleElectron, processMc, "For real data", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From d82d261a8807d095c5cd3ecbfc77c91454734d8b Mon Sep 17 00:00:00 2001 From: Jonghan Park Date: Tue, 12 Aug 2025 12:23:56 +0900 Subject: [PATCH 004/345] Add a method for electron source selection --- PWGHF/HFL/Tasks/taskSingleElectron.cxx | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/PWGHF/HFL/Tasks/taskSingleElectron.cxx b/PWGHF/HFL/Tasks/taskSingleElectron.cxx index e938d95425a..9fe31d25ca5 100644 --- a/PWGHF/HFL/Tasks/taskSingleElectron.cxx +++ b/PWGHF/HFL/Tasks/taskSingleElectron.cxx @@ -215,7 +215,7 @@ struct HfTaskSingleElectron { anc.push_back(mpdg); // check if electron from charm hadrons - if ((int(motherPdg / 100.) % 10) == kCharm || (int(motherPdg / 1000.) % 10) == kCharm) { + if ((static_cast(motherPdg / 100.) % 10) == kCharm || (static_cast(motherPdg / 1000.) % 10) == kCharm) { // iterate until B hadron is found as an ancestor while (partMother.size()) { @@ -229,7 +229,7 @@ struct HfTaskSingleElectron { grmotherPt = mctrack.front().pt(); grmotherPdg = std::abs(mctrack.front().pdgCode()); anc.push_back(mctrack.front().pdgCode()); - if ((int(grmotherPdg / 100.) % 10) == kBottom || (int(grmotherPdg / 1000.) % 10) == kBottom) { + if ((static_cast(grmotherPdg / 100.) % 10) == kBottom || (static_cast(grmotherPdg / 1000.) % 10) == kBottom) { mpt = grmotherPt; mpdg = grmotherPdg; return BeautyCharm; @@ -238,15 +238,9 @@ struct HfTaskSingleElectron { } partMother = mctrack; } - } - - // check if electron from beauty hadrons - else if ((int(motherPdg / 100.) % 10) == kBottom || (int(motherPdg / 1000.) % 10) == kBottom) { + } else if ((static_cast(motherPdg / 100.) % 10) == kBottom || (static_cast(motherPdg / 1000.) % 10) == kBottom) { // check if electron from beauty hadrons return DirectBeauty; - } - - // check if electron from photon conversion - else if (motherPdg == kGamma) { + } else if (motherPdg == kGamma) { // check if electron from photon conversion mctrack = partMother.front().template mothers_as(); if (mctrack.size()) { auto const& grmothersIdsVec = mctrack.front().mothersIds(); @@ -325,10 +319,7 @@ struct HfTaskSingleElectron { } } } - } - - // check if electron from Dalitz decays - else { + } else { // check if electron from Dalitz decays mctrack = partMother.front().template mothers_as(); if (mctrack.size()) { auto const& grmothersIdsVec = mctrack.front().mothersIds(); From 346623c1692c207fcf40619614b6e1887c0c741f Mon Sep 17 00:00:00 2001 From: Jonghan Park Date: Tue, 12 Aug 2025 12:28:44 +0900 Subject: [PATCH 005/345] Add a method for electron source selection --- PWGHF/HFL/Tasks/taskSingleElectron.cxx | 5 ----- 1 file changed, 5 deletions(-) diff --git a/PWGHF/HFL/Tasks/taskSingleElectron.cxx b/PWGHF/HFL/Tasks/taskSingleElectron.cxx index 9fe31d25ca5..55b7c90c39e 100644 --- a/PWGHF/HFL/Tasks/taskSingleElectron.cxx +++ b/PWGHF/HFL/Tasks/taskSingleElectron.cxx @@ -210,10 +210,6 @@ struct HfTaskSingleElectron { mpt = motherPt; // copy of first mother pt mpdg = motherPdg; // copy of first mother pdg - std::vector anc; - anc.push_back(std::abs(mcpart.pdgCode())); - anc.push_back(mpdg); - // check if electron from charm hadrons if ((static_cast(motherPdg / 100.) % 10) == kCharm || (static_cast(motherPdg / 1000.) % 10) == kCharm) { @@ -228,7 +224,6 @@ struct HfTaskSingleElectron { } else { grmotherPt = mctrack.front().pt(); grmotherPdg = std::abs(mctrack.front().pdgCode()); - anc.push_back(mctrack.front().pdgCode()); if ((static_cast(grmotherPdg / 100.) % 10) == kBottom || (static_cast(grmotherPdg / 1000.) % 10) == kBottom) { mpt = grmotherPt; mpdg = grmotherPdg; From b533da279c25afbe140093d09f66bf1e81ef8ba4 Mon Sep 17 00:00:00 2001 From: Jonghan Park Date: Tue, 12 Aug 2025 17:16:45 +0900 Subject: [PATCH 006/345] Add a method for electron source selection --- PWGHF/HFL/Tasks/taskSingleElectron.cxx | 51 +++++++++++++------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/PWGHF/HFL/Tasks/taskSingleElectron.cxx b/PWGHF/HFL/Tasks/taskSingleElectron.cxx index 55b7c90c39e..254b9f71bef 100644 --- a/PWGHF/HFL/Tasks/taskSingleElectron.cxx +++ b/PWGHF/HFL/Tasks/taskSingleElectron.cxx @@ -18,19 +18,20 @@ #include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/TrackSelectionTables.h" +#include #include #include #include using namespace o2; using namespace o2::constants::math; +using namespace o2::constants::physics; using namespace o2::framework; using namespace o2::framework::expressions; enum PdgCode { kEta = 221, kOmega = 223, - kPhi = 333, kEtaPrime = 331 }; @@ -118,38 +119,38 @@ struct HfTaskSingleElectron { void init(InitContext const&) { // create histograms - histos.add("nEvents", "Number of events", kTH1F, {{1, 0., 1.}}); - histos.add("VtxZ", "VtxZ; cm; entries", kTH1F, {axisPosZ}); - histos.add("etaTrack", "etaTrack; #eta; entries", kTH1F, {axisEta}); - histos.add("ptTrack", "#it{p}_{T} distribution of selected tracks; #it{p}_{T} (GeV/#it{c}); entries", kTH1F, {axisPt}); + histos.add("nEvents", "Number of events", kTH1D, {{1, 0., 1.}}); + histos.add("VtxZ", "VtxZ; cm; entries", kTH1D, {axisPosZ}); + histos.add("etaTrack", "etaTrack; #eta; entries", kTH1D, {axisEta}); + histos.add("ptTrack", "#it{p}_{T} distribution of selected tracks; #it{p}_{T} (GeV/#it{c}); entries", kTH1D, {axisPt}); // QA plots for trigger track selection - histos.add("tpcNClsTrack", "tpcNClsTrack", kTH1F, {{200, 0, 200}}); - histos.add("tpcFoundFindableTrack", "", kTH1F, {{10, 0, 1}}); - histos.add("tpcChi2Track", "", kTH1F, {{100, 0, 10}}); - histos.add("itsIBClsTrack", "", kTH1F, {{10, 0, 10}}); - histos.add("dcaXYTrack", "", kTH1F, {{600, -3, 3}}); - histos.add("dcaZTrack", "", kTH1F, {{600, -3, 3}}); + histos.add("tpcNClsTrack", "tpcNClsTrack", kTH1D, {{200, 0, 200}}); + histos.add("tpcFoundFindableTrack", "", kTH1D, {{10, 0, 1}}); + histos.add("tpcChi2Track", "", kTH1D, {{100, 0, 10}}); + histos.add("itsIBClsTrack", "", kTH1D, {{10, 0, 10}}); + histos.add("dcaXYTrack", "", kTH1D, {{600, -3, 3}}); + histos.add("dcaZTrack", "", kTH1D, {{600, -3, 3}}); // pid - histos.add("tofNSigPt", "", kTH2F, {{axisPtEl}, {axisNsig}}); - histos.add("tofNSigPtQA", "", kTH2F, {{axisPtEl}, {axisNsig}}); - histos.add("tpcNSigPt", "", kTH2F, {{axisPtEl}, {axisNsig}}); - histos.add("tpcNSigPtAfterTofCut", "", kTH2F, {{axisPtEl}, {axisNsig}}); - histos.add("tpcNSigPtQA", "", kTH2F, {{axisPtEl}, {axisNsig}}); + histos.add("tofNSigPt", "", kTH2D, {{axisPtEl}, {axisNsig}}); + histos.add("tofNSigPtQA", "", kTH2D, {{axisPtEl}, {axisNsig}}); + histos.add("tpcNSigPt", "", kTH2D, {{axisPtEl}, {axisNsig}}); + histos.add("tpcNSigPtAfterTofCut", "", kTH2D, {{axisPtEl}, {axisNsig}}); + histos.add("tpcNSigPtQA", "", kTH2D, {{axisPtEl}, {axisNsig}}); // track impact parameter - histos.add("dcaTrack", "", kTH2F, {{axisPtEl}, {axisTrackIp}}); - histos.add("dcaBeauty", "", kTH2F, {{axisPtEl}, {axisTrackIp}}); - histos.add("dcaCharm", "", kTH2F, {{axisPtEl}, {axisTrackIp}}); - histos.add("dcaDalitz", "", kTH2F, {{axisPtEl}, {axisTrackIp}}); - histos.add("dcaConv", "", kTH2F, {{axisPtEl}, {axisTrackIp}}); + histos.add("dcaTrack", "", kTH2D, {{axisPtEl}, {axisTrackIp}}); + histos.add("dcaBeauty", "", kTH2D, {{axisPtEl}, {axisTrackIp}}); + histos.add("dcaCharm", "", kTH2D, {{axisPtEl}, {axisTrackIp}}); + histos.add("dcaDalitz", "", kTH2D, {{axisPtEl}, {axisTrackIp}}); + histos.add("dcaConv", "", kTH2D, {{axisPtEl}, {axisTrackIp}}); // QA plots for MC - histos.add("hPdgC", "", kTH1F, {{10001, -0.5, 10000.5}}); - histos.add("hPdgB", "", kTH1F, {{10001, -0.5, 10000.5}}); - histos.add("hPdgDa", "", kTH1F, {{10001, -0.5, 10000.5}}); - histos.add("hPdgCo", "", kTH1F, {{10001, -0.5, 10000.5}}); + histos.add("hPdgC", "", kTH1D, {{10001, -0.5, 10000.5}}); + histos.add("hPdgB", "", kTH1D, {{10001, -0.5, 10000.5}}); + histos.add("hPdgDa", "", kTH1D, {{10001, -0.5, 10000.5}}); + histos.add("hPdgCo", "", kTH1D, {{10001, -0.5, 10000.5}}); } template From 4a9229faf8ffabddd84cea6e6aad576989a24a58 Mon Sep 17 00:00:00 2001 From: lucamicheletti93 <38209984+lucamicheletti93@users.noreply.github.com> Date: Wed, 23 Jul 2025 04:11:54 +0200 Subject: [PATCH 007/345] [PWGDQ] Adding histograms for tag and probe (#12193) Co-authored-by: Lucamicheletti93 --- PWGDQ/Core/HistogramsLibrary.cxx | 4 ++++ PWGDQ/Core/VarManager.h | 21 ++++++--------------- PWGDQ/Tasks/dqEfficiency_withAssoc.cxx | 18 ++++++++++++++++++ PWGDQ/Tasks/tableReader.cxx | 21 ++++++++++----------- 4 files changed, 38 insertions(+), 26 deletions(-) diff --git a/PWGDQ/Core/HistogramsLibrary.cxx b/PWGDQ/Core/HistogramsLibrary.cxx index 11c87e700de..66f88ba7a6a 100644 --- a/PWGDQ/Core/HistogramsLibrary.cxx +++ b/PWGDQ/Core/HistogramsLibrary.cxx @@ -1158,6 +1158,10 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h hm->AddHistogram(histClass, "Mass_Pt", "", false, 750, 0.0, 15.0, VarManager::kMass, 120, 0.0, 30.0, VarManager::kPt); hm->AddHistogram(histClass, "Mass_Rapidity", "", false, 750, 0.0, 15.0, VarManager::kMass, 150, 2.5, 4.0, VarManager::kRap); hm->AddHistogram(histClass, "Mass_Phi", "", false, 750, 0.0, 15.0, VarManager::kMass, 180, constants::math::PI, 2 * constants::math::PI, VarManager::kPhi); + if (subGroupStr.Contains("dimuon-tag-and-probe")) { + hm->AddHistogram(histClass, "Mass_PtProbe", "mass vs probe pT", false, 750, 0.0, 15.0, VarManager::kMass, 120, 0.0, 30.0, VarManager::kPt2); // Warning: in the tag-and-probe task t2 is always the probe + hm->AddHistogram(histClass, "Mass_EtaProbe", "mass vs probe eta", false, 750, 0.0, 15.0, VarManager::kMass, 120, 0.0, 30.0, VarManager::kEta2); // Warning: in the tag-and-probe task t2 is always the probe + } if (subGroupStr.Contains("dimuon-multi-diff")) { int varsKine[3] = {VarManager::kMass, VarManager::kPt, VarManager::kRap}; int binsKine[3] = {250, 120, 60}; diff --git a/PWGDQ/Core/VarManager.h b/PWGDQ/Core/VarManager.h index dfcba891bfc..ec2ec55b83b 100644 --- a/PWGDQ/Core/VarManager.h +++ b/PWGDQ/Core/VarManager.h @@ -2810,21 +2810,12 @@ void VarManager::FillPair(T1 const& t1, T2 const& t2, float* values) double Ptot2 = TMath::Sqrt(v2.Px() * v2.Px() + v2.Py() * v2.Py() + v2.Pz() * v2.Pz()); values[kDeltaPtotTracks] = Ptot1 - Ptot2; - if (t1.sign() > 0) { - values[kPt1] = t1.pt(); - values[kEta1] = t1.eta(); - values[kPhi1] = t1.phi(); - values[kPt2] = t2.pt(); - values[kEta2] = t2.eta(); - values[kPhi2] = t2.phi(); - } else { - values[kPt1] = t2.pt(); - values[kEta1] = t2.eta(); - values[kPhi1] = t2.phi(); - values[kPt2] = t1.pt(); - values[kEta2] = t1.eta(); - values[kPhi2] = t1.phi(); - } + values[kPt1] = t1.pt(); + values[kEta1] = t1.eta(); + values[kPhi1] = t1.phi(); + values[kPt2] = t2.pt(); + values[kEta2] = t2.eta(); + values[kPhi2] = t2.phi(); if (fgUsedVars[kDeltaPhiPair2]) { double phipair2 = v1.Phi() - v2.Phi(); diff --git a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx index e2a58ff5bf2..17ae4e76d22 100644 --- a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx +++ b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx @@ -1927,6 +1927,24 @@ struct AnalysisSameEventPairing { float dileptonMass = VarManager::fgValues[VarManager::kMass]; if (dileptonMass > useMiniTree.fConfigMiniTreeMinMass && dileptonMass < useMiniTree.fConfigMiniTreeMaxMass) { + // In the miniTree the positive daughter is positioned as first + if (t1.sign() > 0) { + dileptonMiniTreeRec(mcDecision, + VarManager::fgValues[VarManager::kMass], + VarManager::fgValues[VarManager::kPt], VarManager::fgValues[VarManager::kEta], VarManager::fgValues[VarManager::kPhi], VarManager::fgValues[VarManager::kCentFT0C], + t1.reducedMCTrack().pt(), t1.reducedMCTrack().eta(), t1.reducedMCTrack().phi(), + t2.reducedMCTrack().pt(), t2.reducedMCTrack().eta(), t2.reducedMCTrack().phi(), + t1.pt(), t1.eta(), t1.phi(), + t2.pt(), t2.eta(), t2.phi()); + } else { + dileptonMiniTreeRec(mcDecision, + VarManager::fgValues[VarManager::kMass], + VarManager::fgValues[VarManager::kPt], VarManager::fgValues[VarManager::kEta], VarManager::fgValues[VarManager::kPhi], VarManager::fgValues[VarManager::kCentFT0C], + t2.reducedMCTrack().pt(), t2.reducedMCTrack().eta(), t2.reducedMCTrack().phi(), + t1.reducedMCTrack().pt(), t1.reducedMCTrack().eta(), t1.reducedMCTrack().phi(), + t2.pt(), t2.eta(), t2.phi(), + t2.pt(), t2.eta(), t2.phi()); + } dileptonMiniTreeRec(mcDecision, VarManager::fgValues[VarManager::kMass], VarManager::fgValues[VarManager::kPt], VarManager::fgValues[VarManager::kEta], VarManager::fgValues[VarManager::kPhi], VarManager::fgValues[VarManager::kCentFT0C], diff --git a/PWGDQ/Tasks/tableReader.cxx b/PWGDQ/Tasks/tableReader.cxx index 22a8d82e2d8..ece46047109 100644 --- a/PWGDQ/Tasks/tableReader.cxx +++ b/PWGDQ/Tasks/tableReader.cxx @@ -1476,17 +1476,16 @@ struct AnalysisSameEventPairing { // By default (kPt1, kEta1, kPhi1) are for the positive charge float dileptonMass = VarManager::fgValues[VarManager::kMass]; if (dileptonMass > useMiniTree.fConfigMiniTreeMinMass && dileptonMass < useMiniTree.fConfigMiniTreeMaxMass) { - dileptonMiniTree(VarManager::fgValues[VarManager::kMass], - VarManager::fgValues[VarManager::kPt], - VarManager::fgValues[VarManager::kRap], - VarManager::fgValues[VarManager::kCentFT0C], - VarManager::fgValues[VarManager::kCos2DeltaPhi], - VarManager::fgValues[VarManager::kPt1], - VarManager::fgValues[VarManager::kEta1], - VarManager::fgValues[VarManager::kPhi1], - VarManager::fgValues[VarManager::kPt2], - VarManager::fgValues[VarManager::kEta2], - VarManager::fgValues[VarManager::kPhi2]); + // In the miniTree the positive daughter is positioned as first + if (t1.sign() > 0) { + dileptonMiniTree(VarManager::fgValues[VarManager::kMass], VarManager::fgValues[VarManager::kPt], VarManager::fgValues[VarManager::kRap], + VarManager::fgValues[VarManager::kCentFT0C], VarManager::fgValues[VarManager::kCos2DeltaPhi], + t1.pt(), t1.eta(), t1.phi(), t2.pt(), t2.eta(), t2.phi()); + } else { + dileptonMiniTree(VarManager::fgValues[VarManager::kMass], VarManager::fgValues[VarManager::kPt], VarManager::fgValues[VarManager::kRap], + VarManager::fgValues[VarManager::kCentFT0C], VarManager::fgValues[VarManager::kCos2DeltaPhi], + t2.pt(), t2.eta(), t2.phi(), t1.pt(), t1.eta(), t1.phi()); + } } } } else { From 4d7ee41fdb2d5a066f947db1c97eede129f0ed39 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Wed, 23 Jul 2025 07:28:40 +0200 Subject: [PATCH 008/345] [PWGEM/PhotonMeson] add an option to require ITS hit to V0 legs (#12150) --- .../treeCreatorElectronMLDDA.cxx | 142 +++++++----------- .../TableProducer/photonconversionbuilder.cxx | 5 + 2 files changed, 56 insertions(+), 91 deletions(-) diff --git a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx index ecb9261cf84..0a0dda6a69f 100644 --- a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx +++ b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx @@ -81,7 +81,6 @@ struct TreeCreatorElectronMLDDA { {"V0/hMassK0Short", "V0 mass K0S", {HistType::kTH1F, {{200, 0.4, 0.6}}}}, {"V0/hMassLambda", "V0 mass Lambda", {HistType::kTH1F, {{100, 1.08, 1.18}}}}, {"V0/hMassAntiLambda", "V0 mass AntiLambda", {HistType::kTH1F, {{100, 1.08, 1.18}}}}, - {"hMvsPhiV", "m_{ee} vs. #varphi_{V};#varphi_{V} (rad.);m_{ee} (GeV/c^{2})", {HistType::kTH2F, {{90, 0, M_PI}, {100, 0, 0.1}}}}, {"V0/hTPCdEdx_P_El", "TPC dEdx vs. p;p_{in} (GeV/c);TPC dE/dx", {HistType::kTH2F, {{500, 0, 5}, {200, 0, 200}}}}, {"V0/hTPCdEdx_P_Pi", "TPC dEdx vs. p;p_{in} (GeV/c);TPC dE/dx", {HistType::kTH2F, {{500, 0, 5}, {200, 0, 200}}}}, @@ -120,13 +119,11 @@ struct TreeCreatorElectronMLDDA { Configurable d_bz_input{"d_bz_input", -999, "bz field, -999 is automatic"}; Configurable useMatCorrType{"useMatCorrType", 2, "0: none, 1: TGeo, 2: LUT"}; - Configurable downscaling_electron_primary{"downscaling_electron_primary", 1.1, "down scaling factor to store primary electron for validation"}; Configurable downscaling_electron{"downscaling_electron", 0.005, "down scaling factor to store electron"}; Configurable downscaling_pion{"downscaling_pion", 0.001, "down scaling factor to store pion"}; Configurable downscaling_kaon{"downscaling_kaon", 1.1, "down scaling factor to store kaon"}; Configurable downscaling_proton{"downscaling_proton", 0.005, "down scaling factor to store proton"}; - Configurable max_p_for_downscaling_electron_primary{"max_p_for_downscaling_electron_primary", 0.0, "max p to apply down scaling factor to store primary electron for validation"}; Configurable max_p_for_downscaling_electron{"max_p_for_downscaling_electron", 2.0, "max p to apply down scaling factor to store electron"}; Configurable max_p_for_downscaling_pion{"max_p_for_downscaling_pion", 2.0, "max p to apply down scaling factor to store pion"}; Configurable max_p_for_downscaling_kaon{"max_p_for_downscaling_kaon", 0.0, "max p to apply down scaling factor to store kaon"}; @@ -169,8 +166,8 @@ struct TreeCreatorElectronMLDDA { Configurable cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 0, "min ncluster tpc"}; Configurable cfg_min_ncluster_its{"cfg_min_ncluster_its", 4, "min ncluster its"}; Configurable cfg_min_ncluster_itsib{"cfg_min_ncluster_itsib", 1, "min ncluster itsib"}; - Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 5.0, "max chi2/NclsTPC"}; - Configurable cfg_max_chi2its{"cfg_max_chi2its", 6.0, "max chi2/NclsITS"}; + Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 5.0, "max chi2/NclsTPC"}; // comment + Configurable cfg_max_chi2its{"cfg_max_chi2its", 36.0, "max chi2/NclsITS"}; Configurable cfg_max_dcaxy{"cfg_max_dcaxy", 1.0, "max dca XY in cm"}; Configurable cfg_max_dcaz{"cfg_max_dcaz", 1.0, "max dca Z in cm"}; } trackcuts; @@ -183,8 +180,8 @@ struct TreeCreatorElectronMLDDA { Configurable cfg_max_mass_photon{"cfg_max_mass_photon", 0.02, "max mass for photon conversion"}; Configurable cfg_min_mass_k0s{"cfg_min_mass_k0s", 0.490, "min mass for K0S"}; Configurable cfg_max_mass_k0s{"cfg_max_mass_k0s", 0.505, "max mass for K0S"}; - Configurable cfg_min_mass_lambda{"cfg_min_mass_lambda", 1.113, "min mass for Lambda rejection"}; - Configurable cfg_max_mass_lambda{"cfg_max_mass_lambda", 1.118, "max mass for Lambda rejection"}; + Configurable cfg_min_mass_lambda{"cfg_min_mass_lambda", 1.113, "min mass for Lambda"}; + Configurable cfg_max_mass_lambda{"cfg_max_mass_lambda", 1.118, "max mass for Lambda"}; Configurable cfg_min_cospa{"cfg_min_cospa", 0.9998, "min cospa for v0"}; Configurable cfg_max_dcadau{"cfg_max_dcadau", 0.2, "max distance between 2 legs for v0"}; Configurable cfg_min_cr2findable_ratio_tpc{"cfg_min_cr2findable_ratio_tpc", 0.8, "min. TPC Ncr/Nf ratio"}; @@ -237,8 +234,8 @@ struct TreeCreatorElectronMLDDA { std::string prefix = "cascadecut_group"; Configurable cfg_min_mass_lambda{"cfg_min_mass_lambda", 1.11, "min mass for lambda in cascade"}; Configurable cfg_max_mass_lambda{"cfg_max_mass_lambda", 1.12, "max mass for lambda in cascade"}; - Configurable cfg_min_mass_Xi{"cfg_min_mass_Xi", 1.31, "min mass for Xi"}; // this is for veto. - Configurable cfg_max_mass_Xi{"cfg_max_mass_Xi", 1.33, "max mass for Xi"}; // this is for veto. + Configurable cfg_min_mass_Xi_veto{"cfg_min_mass_Xi_veto", 1.31, "min mass for Xi veto"}; + Configurable cfg_max_mass_Xi_veto{"cfg_max_mass_Xi_veto", 1.33, "max mass for Xi veto"}; Configurable cfg_min_mass_Omega{"cfg_min_mass_Omega", 1.669, "min mass for Omega"}; Configurable cfg_max_mass_Omega{"cfg_max_mass_Omega", 1.675, "max mass for Omega"}; Configurable cfg_min_cospa_v0{"cfg_min_cospa_v0", 0.97, "minimum V0 CosPA in cascade"}; @@ -555,7 +552,7 @@ struct TreeCreatorElectronMLDDA { bool isElectronTight(TTrack const& track) { bool is_El_TPC = v0cuts.cfg_min_TPCNsigmaEl_tight < track.tpcNSigmaEl() && track.tpcNSigmaEl() < v0cuts.cfg_max_TPCNsigmaEl_tight; - bool is_El_TOF = track.hasTOF() && (v0cuts.cfg_min_TOFNsigmaEl_tight < track.tofNSigmaEl() && track.tofNSigmaEl() < v0cuts.cfg_max_TOFNsigmaEl_tight); // TOFreq + bool is_El_TOF = track.hasTOF() ? v0cuts.cfg_min_TOFNsigmaEl_tight < track.tofNSigmaEl() && track.tofNSigmaEl() < v0cuts.cfg_max_TOFNsigmaEl_tight : true; // TOFif return is_El_TPC && is_El_TOF; } @@ -576,7 +573,7 @@ struct TreeCreatorElectronMLDDA { } template - void fillTrackTable(TCollision const& collision, TTrack const& track, const uint8_t pidlabel, const uint8_t tracktype, const bool isForValidation) + void fillTrackTable(TCollision const& collision, TTrack const& track, const uint8_t pidlabel, const bool isForValidation) { if (store_ele_band_only && !isElectron(track)) { return; @@ -591,27 +588,21 @@ struct TreeCreatorElectronMLDDA { // float dcaXY = mDcaInfoCov.getY(); // float dcaZ = mDcaInfoCov.getZ(); - if (tracktype == static_cast(o2::aod::pwgem::dilepton::ml::Track_Type::kPrimary)) { - if (dist01(engine) > downscaling_electron_primary && trackParCov.getP() < max_p_for_downscaling_electron_primary) { + if (pidlabel == static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kElectron)) { + if (dist01(engine) > downscaling_electron && trackParCov.getP() < max_p_for_downscaling_electron) { return; } - } else { // secondary - if (pidlabel == static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kElectron)) { - if (dist01(engine) > downscaling_electron && trackParCov.getP() < max_p_for_downscaling_electron) { - return; - } - } else if (pidlabel == static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kPion)) { - if (dist01(engine) > downscaling_pion && trackParCov.getP() < max_p_for_downscaling_pion) { - return; - } - } else if (pidlabel == static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kKaon)) { - if (dist01(engine) > downscaling_kaon && trackParCov.getP() < max_p_for_downscaling_kaon) { - return; - } - } else if (pidlabel == static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kProton)) { - if (dist01(engine) > downscaling_proton && trackParCov.getP() < max_p_for_downscaling_proton) { - return; - } + } else if (pidlabel == static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kPion)) { + if (dist01(engine) > downscaling_pion && trackParCov.getP() < max_p_for_downscaling_pion) { + return; + } + } else if (pidlabel == static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kKaon)) { + if (dist01(engine) > downscaling_kaon && trackParCov.getP() < max_p_for_downscaling_kaon) { + return; + } + } else if (pidlabel == static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kProton)) { + if (dist01(engine) > downscaling_proton && trackParCov.getP() < max_p_for_downscaling_proton) { + return; } } @@ -772,21 +763,27 @@ struct TreeCreatorElectronMLDDA { registry.fill(HIST("V0/hCosPA"), v0.v0cosPA()); registry.fill(HIST("V0/hAP"), v0.alpha(), v0.qtarm()); - if (isPion(pos) && isPion(neg)) { + if (isPionTight(pos) && isPion(neg)) { registry.fill(HIST("V0/hMassK0Short"), v0.mK0Short()); if (v0cuts.cfg_min_mass_k0s < v0.mK0Short() && v0.mK0Short() < v0cuts.cfg_max_mass_k0s) { registry.fill(HIST("V0/hTPCdEdx_P_Pi"), neg.tpcInnerParam(), neg.tpcSignal()); registry.fill(HIST("V0/hTOFbeta_P_Pi"), neg.tpcInnerParam(), neg.beta()); - registry.fill(HIST("V0/hTPCdEdx_P_Pi"), pos.tpcInnerParam(), pos.tpcSignal()); - registry.fill(HIST("V0/hTOFbeta_P_Pi"), pos.tpcInnerParam(), pos.beta()); - fillTrackTable(collision, pos, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kPion), static_cast(o2::aod::pwgem::dilepton::ml::Track_Type::kSecondary), false); - fillTrackTable(collision, neg, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kPion), static_cast(o2::aod::pwgem::dilepton::ml::Track_Type::kSecondary), false); + fillTrackTable(collision, neg, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kPion), false); + } + if (isPion(pos) && isPionTight(neg)) { + registry.fill(HIST("V0/hMassK0Short"), v0.mK0Short()); + if (v0cuts.cfg_min_mass_k0s < v0.mK0Short() && v0.mK0Short() < v0cuts.cfg_max_mass_k0s) { + registry.fill(HIST("V0/hTPCdEdx_P_Pi"), pos.tpcInnerParam(), pos.tpcSignal()); + registry.fill(HIST("V0/hTOFbeta_P_Pi"), pos.tpcInnerParam(), pos.beta()); + fillTrackTable(collision, pos, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kPion), false); + } } } + if (isProton(pos) && isPionTight(neg)) { registry.fill(HIST("V0/hMassLambda"), v0.mLambda()); if (v0cuts.cfg_min_mass_lambda < v0.mLambda() && v0.mLambda() < v0cuts.cfg_max_mass_lambda) { - fillTrackTable(collision, pos, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kProton), static_cast(o2::aod::pwgem::dilepton::ml::Track_Type::kSecondary), false); + fillTrackTable(collision, pos, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kProton), false); registry.fill(HIST("V0/hTPCdEdx_P_Pr"), pos.tpcInnerParam(), pos.tpcSignal()); registry.fill(HIST("V0/hTOFbeta_P_Pr"), pos.tpcInnerParam(), pos.beta()); } @@ -794,24 +791,34 @@ struct TreeCreatorElectronMLDDA { if (isPionTight(pos) && isProton(neg)) { registry.fill(HIST("V0/hMassAntiLambda"), v0.mAntiLambda()); if (v0cuts.cfg_min_mass_lambda < v0.mAntiLambda() && v0.mAntiLambda() < v0cuts.cfg_max_mass_lambda) { - fillTrackTable(collision, neg, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kProton), static_cast(o2::aod::pwgem::dilepton::ml::Track_Type::kSecondary), false); + fillTrackTable(collision, neg, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kProton), false); registry.fill(HIST("V0/hTPCdEdx_P_Pr"), neg.tpcInnerParam(), neg.tpcSignal()); registry.fill(HIST("V0/hTOFbeta_P_Pr"), neg.tpcInnerParam(), neg.beta()); } } - if (isElectron(pos) && isElectron(neg)) { + + if (isElectronTight(pos) && isElectron(neg)) { registry.fill(HIST("V0/hMassGamma"), v0.mGamma()); - registry.fill(HIST("V0/hXY_Gamma"), v0.x(), v0.y()); registry.fill(HIST("V0/hMassGamma_Rxy"), v0.v0radius(), v0.mGamma()); - if ((v0cuts.cfg_min_mass_photon < v0.mGamma() && v0.mGamma() < v0cuts.cfg_max_mass_photon)) { - fillTrackTable(collision, pos, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kElectron), static_cast(o2::aod::pwgem::dilepton::ml::Track_Type::kSecondary), false); - fillTrackTable(collision, neg, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kElectron), static_cast(o2::aod::pwgem::dilepton::ml::Track_Type::kSecondary), false); + if (v0cuts.cfg_min_mass_photon < v0.mGamma() && v0.mGamma() < v0cuts.cfg_max_mass_photon) { + registry.fill(HIST("V0/hXY_Gamma"), v0.x(), v0.y()); + fillTrackTable(collision, neg, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kElectron), false); registry.fill(HIST("V0/hTPCdEdx_P_El"), neg.tpcInnerParam(), neg.tpcSignal()); registry.fill(HIST("V0/hTOFbeta_P_El"), neg.tpcInnerParam(), neg.beta()); + } + } + + if (isElectron(pos) && isElectronTight(neg)) { + registry.fill(HIST("V0/hMassGamma"), v0.mGamma()); + registry.fill(HIST("V0/hMassGamma_Rxy"), v0.v0radius(), v0.mGamma()); + if (v0cuts.cfg_min_mass_photon < v0.mGamma() && v0.mGamma() < v0cuts.cfg_max_mass_photon) { + registry.fill(HIST("V0/hXY_Gamma"), v0.x(), v0.y()); + fillTrackTable(collision, pos, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kElectron), false); registry.fill(HIST("V0/hTPCdEdx_P_El"), pos.tpcInnerParam(), pos.tpcSignal()); registry.fill(HIST("V0/hTOFbeta_P_El"), pos.tpcInnerParam(), pos.beta()); } } + } // end of v0 loop auto cascades_coll = cascades.sliceBy(perCollision_cascade, collision.globalIndex()); @@ -884,7 +891,7 @@ struct TreeCreatorElectronMLDDA { registry.fill(HIST("Cascade/hRxy_Xi"), cascade.mXi(), cascade.cascradius()); registry.fill(HIST("Cascade/hCTau_Xi"), cascade.mXi(), ctauXi); } - if (!(cascadecuts.cfg_min_mass_Xi < cascade.mXi() && cascade.mXi() < cascadecuts.cfg_max_mass_Xi) && isKaon(bachelor)) { // reject Xi candidates + if (!(cascadecuts.cfg_min_mass_Xi_veto < cascade.mXi() && cascade.mXi() < cascadecuts.cfg_max_mass_Xi_veto) && isKaon(bachelor)) { // reject Xi candidates registry.fill(HIST("Cascade/hMassOmega"), cascade.mOmega()); registry.fill(HIST("Cascade/hMassPt_Omega"), cascade.mOmega(), cascade.pt()); registry.fill(HIST("Cascade/hRxy_Omega"), cascade.mOmega(), cascade.cascradius()); @@ -892,58 +899,11 @@ struct TreeCreatorElectronMLDDA { if (cascadecuts.cfg_min_mass_Omega < cascade.mOmega() && cascade.mOmega() < cascadecuts.cfg_max_mass_Omega) { // select Omega candidates registry.fill(HIST("V0/hTPCdEdx_P_Ka"), bachelor.tpcInnerParam(), bachelor.tpcSignal()); registry.fill(HIST("V0/hTOFbeta_P_Ka"), bachelor.tpcInnerParam(), bachelor.beta()); - fillTrackTable(collision, bachelor, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kKaon), static_cast(o2::aod::pwgem::dilepton::ml::Track_Type::kSecondary), false); + fillTrackTable(collision, bachelor, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kKaon), false); } } } // end of cascade loop - - if (downscaling_electron_primary > 0.0) { - std::array ppos{0, 0, 0}; - std::array pneg{0, 0, 0}; - - // for electron sample for validation - auto posTracks_per_coll = posTracks->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache); - auto negTracks_per_coll = negTracks->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache); - for (const auto& [pos, neg] : combinations(CombinationsFullIndexPolicy(posTracks_per_coll, negTracks_per_coll))) { - if (!isElectron(pos) || !isElectron(neg)) { - continue; - } - if (!isSelectedTrack(collision, pos) || !isSelectedTrack(collision, neg)) { - continue; - } - - auto posParCov = getTrackParCov(pos); - posParCov.setPID(pos.pidForTracking()); - mVtx.setPos({collision.posX(), collision.posY(), collision.posZ()}); - mVtx.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); - o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, posParCov, 2.f, matCorr, &mDcaInfoCov); - getPxPyPz(posParCov, ppos); - - auto negParCov = getTrackParCov(neg); - negParCov.setPID(pos.pidForTracking()); - mVtx.setPos({collision.posX(), collision.posY(), collision.posZ()}); - mVtx.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); - o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, negParCov, 2.f, matCorr, &mDcaInfoCov); - getPxPyPz(negParCov, pneg); - - ROOT::Math::PtEtaPhiMVector v1(negParCov.getPt(), negParCov.getEta(), negParCov.getPhi() > 0.f ? negParCov.getPhi() : negParCov.getPhi() + 2 * M_PI, o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v2(posParCov.getPt(), posParCov.getEta(), posParCov.getPhi() > 0.f ? posParCov.getPhi() : posParCov.getPhi() + 2 * M_PI, o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(ppos[0], ppos[1], ppos[2], pneg[0], pneg[1], pneg[2], pos.sign(), neg.sign(), d_bz); - registry.fill(HIST("hMvsPhiV"), phiv, v12.M()); - - if ((dalitzcuts.cfg_min_mass_ee < v12.M() && v12.M() < dalitzcuts.cfg_max_mass_ee) && (dalitzcuts.cfg_min_phiv_ee < phiv && phiv < dalitzcuts.cfg_max_phiv_ee)) { // ee from pi0 dalitz decay is found. - if (isElectronTight(pos) && isElectron(neg)) { - fillTrackTable(collision, neg, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kElectron), static_cast(o2::aod::pwgem::dilepton::ml::Track_Type::kPrimary), true); // primary electron candidates - } - if (isElectron(pos) && isElectronTight(neg)) { - fillTrackTable(collision, pos, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kElectron), static_cast(o2::aod::pwgem::dilepton::ml::Track_Type::kPrimary), true); // primary electron candidates - } - } - } // end of ULS pair loop - } } // end of collision loop - stored_trackIds.clear(); stored_trackIds.shrink_to_fit(); } // end of process diff --git a/PWGEM/PhotonMeson/TableProducer/photonconversionbuilder.cxx b/PWGEM/PhotonMeson/TableProducer/photonconversionbuilder.cxx index 8f8e795edfb..a3521b5fa4c 100644 --- a/PWGEM/PhotonMeson/TableProducer/photonconversionbuilder.cxx +++ b/PWGEM/PhotonMeson/TableProducer/photonconversionbuilder.cxx @@ -92,6 +92,7 @@ struct PhotonConversionBuilder { Configurable moveTPCTracks{"moveTPCTracks", true, "Move TPC-only tracks under the collision assumption"}; Configurable disableITSonlyTracks{"disableITSonlyTracks", false, "disable ITSonly tracks in V0 legs"}; Configurable disableTPConlyTracks{"disableTPConlyTracks", false, "disable TPConly tracks in V0 legs"}; + Configurable requireITShit{"requireITShit", false, "require ITS hit to V0 legs"}; Configurable maxchi2tpc{"maxchi2tpc", 5.0, "max chi2/NclsTPC"}; // default 4.0 + 1.0 Configurable maxchi2its{"maxchi2its", 6.0, "max chi2/NclsITS"}; // default 5.0 + 1.0 @@ -280,6 +281,10 @@ struct PhotonConversionBuilder { return false; } + if (requireITShit && !track.hasITS()) { + return false; + } + if (track.x() > maxX) { return false; } From 3cacddd111fce066560d8f8cbafad753124766ae Mon Sep 17 00:00:00 2001 From: Jesper Karlsson Gumprecht <113693781+jesgum@users.noreply.github.com> Date: Wed, 23 Jul 2025 07:43:17 +0200 Subject: [PATCH 009/345] [ALICE3] Changes to mcharm datamodel (#12192) --- ALICE3/DataModel/OTFMcTrackExtra.h | 42 --- ALICE3/DataModel/OTFMulticharm.h | 70 ++-- .../TableProducer/alice3-multicharmTable.cxx | 99 +++--- ALICE3/Tasks/alice3-multicharm.cxx | 298 +++++++++++++----- 4 files changed, 325 insertions(+), 184 deletions(-) delete mode 100644 ALICE3/DataModel/OTFMcTrackExtra.h diff --git a/ALICE3/DataModel/OTFMcTrackExtra.h b/ALICE3/DataModel/OTFMcTrackExtra.h deleted file mode 100644 index bb75c86746c..00000000000 --- a/ALICE3/DataModel/OTFMcTrackExtra.h +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// -/// \file OTFMcTrackExtra.h -/// \author Jesper Karlsson Gumprecht -/// \since 05/08/2024 -/// \brief Table to to hold MC information specifically for xi daughters created in the otf-tracker -/// - -#ifndef ALICE3_DATAMODEL_OTFMCTRACKEXTRA_H_ -#define ALICE3_DATAMODEL_OTFMCTRACKEXTRA_H_ - -// O2 includes -#include "Framework/AnalysisDataModel.h" - -namespace o2::aod -{ -namespace otf_mctrack_extra -{ -DECLARE_SOA_COLUMN(NewPdgCode, newPdgCode, int); //! PDG code (duplicate column but needed for particles created in the otf-tracker) -DECLARE_SOA_COLUMN(IsFromXi, isFromXi, bool); //! From Xi decayed in otf-tracker -DECLARE_SOA_COLUMN(IsFromL0, isFromL0, bool); //! From L0 decayed in otf-tracker -} // namespace otf_mctrack_extra -DECLARE_SOA_TABLE(OTFMcExtra, "AOD", "OTFMcExtra", - otf_mctrack_extra::NewPdgCode, - otf_mctrack_extra::IsFromXi, - otf_mctrack_extra::IsFromL0); - -using OTFMcTrackExtra = OTFMcExtra::iterator; - -} // namespace o2::aod - -#endif // ALICE3_DATAMODEL_OTFMCTRACKEXTRA_H_ diff --git a/ALICE3/DataModel/OTFMulticharm.h b/ALICE3/DataModel/OTFMulticharm.h index 955654c5b47..1fca25575d9 100644 --- a/ALICE3/DataModel/OTFMulticharm.h +++ b/ALICE3/DataModel/OTFMulticharm.h @@ -21,6 +21,8 @@ #define ALICE3_DATAMODEL_OTFMULTICHARM_H_ // O2 includes +#include "ALICE3/DataModel/OTFStrangeness.h" + #include "Framework/AnalysisDataModel.h" namespace o2::aod @@ -36,8 +38,8 @@ DECLARE_SOA_COLUMN(XicMass, xicMass, float); DECLARE_SOA_COLUMN(XiccMass, xiccMass, float); // kine vars -DECLARE_SOA_COLUMN(Pt, pt, float); -DECLARE_SOA_COLUMN(Eta, eta, float); +DECLARE_SOA_COLUMN(XiccPt, xiccPt, float); +DECLARE_SOA_COLUMN(XiccEta, xiccEta, float); // topo vars DECLARE_SOA_COLUMN(XiDCAz, xiDCAz, float); @@ -49,18 +51,18 @@ DECLARE_SOA_COLUMN(XiccDauDCA, xiccDauDCA, float); DECLARE_SOA_COLUMN(XiccDCAxy, xiccDCAxy, float); DECLARE_SOA_COLUMN(XiccDCAz, xiccDCAz, float); -DECLARE_SOA_COLUMN(PiFromXiDCAxy, piFromXiDCAxy, float); -DECLARE_SOA_COLUMN(PiFromLaDCAxy, piFromLaDCAxy, float); -DECLARE_SOA_COLUMN(PrFromLaDCAxy, prFromLaDCAxy, float); -DECLARE_SOA_COLUMN(PiFromXiDCAz, piFromXiDCAz, float); -DECLARE_SOA_COLUMN(PiFromLaDCAz, piFromLaDCAz, float); -DECLARE_SOA_COLUMN(PrFromLaDCAz, prFromLaDCAz, float); +DECLARE_SOA_COLUMN(BachDCAxy, bachDCAxy, float); +DECLARE_SOA_COLUMN(BachDCAz, bachDCAz, float); +DECLARE_SOA_COLUMN(PosDCAxy, posDCAxy, float); +DECLARE_SOA_COLUMN(PosDCAz, posDCAz, float); +DECLARE_SOA_COLUMN(NegDCAxy, negDCAxy, float); +DECLARE_SOA_COLUMN(NegDCAz, negDCAz, float); DECLARE_SOA_COLUMN(Pi1cDCAxy, pi1cDCAxy, float); -DECLARE_SOA_COLUMN(Pi2cDCAxy, pi2cDCAxy, float); -DECLARE_SOA_COLUMN(PiccDCAxy, piccDCAxy, float); DECLARE_SOA_COLUMN(Pi1cDCAz, pi1cDCAz, float); +DECLARE_SOA_COLUMN(Pi2cDCAxy, pi2cDCAxy, float); DECLARE_SOA_COLUMN(Pi2cDCAz, pi2cDCAz, float); +DECLARE_SOA_COLUMN(PiccDCAxy, piccDCAxy, float); DECLARE_SOA_COLUMN(PiccDCAz, piccDCAz, float); // Lengths @@ -75,14 +77,25 @@ DECLARE_SOA_COLUMN(Pi1cTofDeltaInner, pi1cTofDeltaInner, float); DECLARE_SOA_COLUMN(Pi1cTofNSigmaInner, pi1cTofNSigmaInner, float); DECLARE_SOA_COLUMN(Pi1cTofDeltaOuter, pi1cTofDeltaOuter, float); DECLARE_SOA_COLUMN(Pi1cTofNSigmaOuter, pi1cTofNSigmaOuter, float); +DECLARE_SOA_COLUMN(Pi1cHasRichSignal, pi1cHasRichSignal, bool); +DECLARE_SOA_COLUMN(Pi1cRichNSigma, pi1cRichNSigma, float); +DECLARE_SOA_COLUMN(Pi1cPdgCode, pi1cPdgCode, int); + DECLARE_SOA_COLUMN(Pi2cTofDeltaInner, pi2cTofDeltaInner, float); DECLARE_SOA_COLUMN(Pi2cTofNSigmaInner, pi2cTofNSigmaInner, float); DECLARE_SOA_COLUMN(Pi2cTofDeltaOuter, pi2cTofDeltaOuter, float); DECLARE_SOA_COLUMN(Pi2cTofNSigmaOuter, pi2cTofNSigmaOuter, float); +DECLARE_SOA_COLUMN(Pi2cHasRichSignal, pi2cHasRichSignal, bool); +DECLARE_SOA_COLUMN(Pi2cRichNSigma, pi2cRichNSigma, float); +DECLARE_SOA_COLUMN(Pi2cPdgCode, pi2cPdgCode, int); + DECLARE_SOA_COLUMN(PiccTofDeltaInner, piccTofDeltaInner, float); DECLARE_SOA_COLUMN(PiccTofNSigmaInner, piccTofNSigmaInner, float); DECLARE_SOA_COLUMN(PiccTofDeltaOuter, piccTofDeltaOuter, float); DECLARE_SOA_COLUMN(PiccTofNSigmaOuter, piccTofNSigmaOuter, float); +DECLARE_SOA_COLUMN(PiccHasRichSignal, piccHasRichSignal, bool); +DECLARE_SOA_COLUMN(PiccRichNSigma, piccRichNSigma, float); +DECLARE_SOA_COLUMN(PiccPdgCode, piccPdgCode, int); // Daughter info DECLARE_SOA_COLUMN(PosPt, posPt, float); @@ -100,6 +113,7 @@ DECLARE_SOA_COLUMN(PiccPt, piccPt, float); DECLARE_SOA_COLUMN(PiccEta, piccEta, float); } // namespace otfmulticharm + DECLARE_SOA_TABLE(MCharmIndices, "AOD", "MCharmIndices", o2::soa::Index<>, otfmulticharm::CascadeId, @@ -112,8 +126,8 @@ DECLARE_SOA_TABLE(MCharmCores, "AOD", "MCharmCores", otfmulticharm::XiccDauDCA, otfmulticharm::XicMass, otfmulticharm::XiccMass, - otfmulticharm::Pt, - otfmulticharm::Eta, + otfmulticharm::XiccPt, + otfmulticharm::XiccEta, otfmulticharm::XiDCAxy, otfmulticharm::XiDCAz, @@ -122,13 +136,6 @@ DECLARE_SOA_TABLE(MCharmCores, "AOD", "MCharmCores", otfmulticharm::XiccDCAxy, otfmulticharm::XiccDCAz, - otfmulticharm::PiFromXiDCAxy, - otfmulticharm::PiFromXiDCAz, - otfmulticharm::PiFromLaDCAxy, - otfmulticharm::PiFromLaDCAz, - otfmulticharm::PrFromLaDCAxy, - otfmulticharm::PrFromLaDCAz, - otfmulticharm::Pi1cDCAxy, otfmulticharm::Pi1cDCAz, otfmulticharm::Pi2cDCAxy, @@ -141,38 +148,53 @@ DECLARE_SOA_TABLE(MCharmCores, "AOD", "MCharmCores", otfmulticharm::XicProperLength, otfmulticharm::XicDistanceFromPV, otfmulticharm::XiccProperLength, + otfmulticharm::Pi1cPt, + otfmulticharm::Pi2cPt, + otfmulticharm::PiccPt); +DECLARE_SOA_TABLE(MCharmPID, "AOD", "MCharmPID", otfmulticharm::Pi1cTofDeltaInner, otfmulticharm::Pi1cTofNSigmaInner, otfmulticharm::Pi1cTofDeltaOuter, otfmulticharm::Pi1cTofNSigmaOuter, + otfmulticharm::Pi1cHasRichSignal, + otfmulticharm::Pi1cRichNSigma, + otfmulticharm::Pi1cPdgCode, otfmulticharm::Pi2cTofDeltaInner, otfmulticharm::Pi2cTofNSigmaInner, otfmulticharm::Pi2cTofDeltaOuter, otfmulticharm::Pi2cTofNSigmaOuter, + otfmulticharm::Pi2cHasRichSignal, + otfmulticharm::Pi2cRichNSigma, + otfmulticharm::Pi2cPdgCode, otfmulticharm::PiccTofDeltaInner, otfmulticharm::PiccTofNSigmaInner, otfmulticharm::PiccTofDeltaOuter, otfmulticharm::PiccTofNSigmaOuter, + otfmulticharm::PiccHasRichSignal, + otfmulticharm::PiccRichNSigma, + otfmulticharm::PiccPdgCode); +DECLARE_SOA_TABLE(MCharmExtra, "AOD", "MCharmExtra", otfmulticharm::BachPt, otfmulticharm::BachEta, + otfmulticharm::BachDCAxy, + otfmulticharm::BachDCAz, otfmulticharm::PosPt, otfmulticharm::PosEta, + otfmulticharm::PosDCAxy, + otfmulticharm::PosDCAz, otfmulticharm::NegPt, otfmulticharm::NegEta, + otfmulticharm::NegDCAxy, + otfmulticharm::NegDCAz, - otfmulticharm::Pi1cPt, otfmulticharm::Pi1cEta, - - otfmulticharm::Pi2cPt, otfmulticharm::Pi2cEta, - - otfmulticharm::PiccPt, otfmulticharm::PiccEta); } // namespace o2::aod diff --git a/ALICE3/TableProducer/alice3-multicharmTable.cxx b/ALICE3/TableProducer/alice3-multicharmTable.cxx index 16b16c666d8..433b6d065a9 100644 --- a/ALICE3/TableProducer/alice3-multicharmTable.cxx +++ b/ALICE3/TableProducer/alice3-multicharmTable.cxx @@ -17,41 +17,43 @@ // HF decays. Work in progress: use at your own risk! // -#include -#include -#include -#include -#include -#include +#include "PWGLF/DataModel/LFParticleIdentification.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" -#include "Framework/runDataProcessing.h" -#include "Framework/RunningWorkflowInfo.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" -#include "DCAFitter/DCAFitterN.h" -#include "ReconstructionDataFormats/Track.h" +#include "ALICE3/DataModel/A3DecayFinderTables.h" +#include "ALICE3/DataModel/OTFMulticharm.h" +#include "ALICE3/DataModel/OTFRICH.h" +#include "ALICE3/DataModel/OTFStrangeness.h" +#include "ALICE3/DataModel/OTFTOF.h" +#include "ALICE3/DataModel/tracksAlice3.h" #include "Common/Core/RecoDecay.h" -#include "Common/Core/trackUtilities.h" -#include "PWGLF/DataModel/LFStrangenessTables.h" -#include "PWGLF/DataModel/LFParticleIdentification.h" #include "Common/Core/TrackSelection.h" +#include "Common/Core/trackUtilities.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "DetectorsBase/Propagator.h" -#include "DetectorsBase/GeometryManager.h" -#include "DataFormatsParameters/GRPObject.h" -#include "DataFormatsParameters/GRPMagField.h" + #include "CCDB/BasicCCDBManager.h" +#include "CommonConstants/PhysicsConstants.h" +#include "DCAFitter/DCAFitterN.h" #include "DataFormatsCalibration/MeanVertexObject.h" -#include "ALICE3/DataModel/OTFTOF.h" -#include "ALICE3/DataModel/RICH.h" -#include "ALICE3/DataModel/A3DecayFinderTables.h" -#include "ALICE3/DataModel/OTFStrangeness.h" -#include "ALICE3/DataModel/OTFMulticharm.h" -#include "ALICE3/DataModel/tracksAlice3.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "DataFormatsParameters/GRPObject.h" +#include "DetectorsBase/GeometryManager.h" +#include "DetectorsBase/Propagator.h" #include "DetectorsVertexing/PVertexer.h" #include "DetectorsVertexing/PVertexerHelpers.h" -#include "CommonConstants/PhysicsConstants.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/Track.h" + +#include +#include +#include +#include +#include +#include using namespace o2; using namespace o2::framework; @@ -68,14 +70,16 @@ using FullTracksExt = soa::Join; // For MC association in pre-selection using labeledTracks = soa::Join; using tofTracks = soa::Join; -using richTracks = soa::Join; -using alice3tracks = soa::Join; +using richTracks = soa::Join; +using alice3tracks = soa::Join; struct alice3multicharmTable { SliceCache cache; Produces multiCharmIdx; Produces multiCharmCore; + Produces multiCharmPID; + Produces multiCharmExtra; // Operation and minimisation criteria Configurable fillDerivedTable{"fillDerivedTable", false, "fill MCharm[] tables (careful: memory)"}; @@ -321,6 +325,13 @@ struct alice3multicharmTable { return true; } + template + int getPdgCodeForTrack(TTrackType track) + { + auto mcParticle = track.template mcParticle_as(); + return mcParticle.pdgCode(); + } + /// function to check if tracks have the same mother in MC template bool checkSameMother(TTrackType1 const& track1, TTrackType2 const& track2) @@ -729,27 +740,43 @@ struct alice3multicharmTable { xi.dcaXY(), xi.dcaZ(), xicdcaXY, xicdcaZ, xiccdcaXY, xiccdcaZ, - piFromXi.dcaXY(), piFromXi.dcaZ(), - piFromLa.dcaXY(), piFromLa.dcaZ(), - prFromLa.dcaXY(), prFromLa.dcaZ(), pi1c.dcaXY(), pi1c.dcaZ(), pi2c.dcaXY(), pi2c.dcaZ(), picc.dcaXY(), picc.dcaZ(), xicDecayRadius2D, xiccDecayRadius2D, - xicProperLength, xicDecayDistanceFromPV, + xicProperLength, + xicDecayDistanceFromPV, xiccProperLength, + pi1c.pt(), + pi2c.pt(), + picc.pt()); + + multiCharmPID( pi1cTOFDiffInner, pi1c.nSigmaPionInnerTOF(), pi1cTOFDiffOuter, pi1c.nSigmaPionOuterTOF(), + pi1c.hasSigPi(), pi1c.nSigmaPionRich(), + getPdgCodeForTrack(pi1c), + pi2cTOFDiffInner, pi2c.nSigmaPionInnerTOF(), pi2cTOFDiffOuter, pi2c.nSigmaPionOuterTOF(), + pi2c.hasSigPi(), pi2c.nSigmaPionRich(), + getPdgCodeForTrack(pi2c), + piccTOFDiffInner, picc.nSigmaPionInnerTOF(), piccTOFDiffOuter, picc.nSigmaPionOuterTOF(), + picc.hasSigPi(), picc.nSigmaPionRich(), + getPdgCodeForTrack(picc)); + + multiCharmExtra( piFromXi.pt(), piFromXi.eta(), + piFromXi.dcaXY(), piFromXi.dcaZ(), prFromLa.pt(), prFromLa.eta(), + prFromLa.dcaXY(), prFromLa.dcaZ(), piFromLa.pt(), piFromLa.eta(), - pi1c.pt(), pi1c.eta(), - pi2c.pt(), pi2c.eta(), - picc.pt(), picc.eta()); + piFromLa.dcaXY(), piFromLa.dcaZ(), + pi1c.eta(), + pi2c.eta(), + picc.eta()); } } histos.fill(HIST("hCombinationsXiCC"), nCombinationsCC); diff --git a/ALICE3/Tasks/alice3-multicharm.cxx b/ALICE3/Tasks/alice3-multicharm.cxx index 2b6ad804ddf..497038f724f 100644 --- a/ALICE3/Tasks/alice3-multicharm.cxx +++ b/ALICE3/Tasks/alice3-multicharm.cxx @@ -17,57 +17,62 @@ // HF decays. Work in progress: use at your own risk! // -#include -#include -#include -#include -#include -#include +#include "PWGLF/DataModel/LFParticleIdentification.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" -#include "Framework/runDataProcessing.h" -#include "Framework/RunningWorkflowInfo.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" -#include "DCAFitter/DCAFitterN.h" -#include "ReconstructionDataFormats/Track.h" +#include "ALICE3/DataModel/A3DecayFinderTables.h" +#include "ALICE3/DataModel/OTFMulticharm.h" +#include "ALICE3/DataModel/OTFRICH.h" +#include "ALICE3/DataModel/OTFStrangeness.h" +#include "ALICE3/DataModel/OTFTOF.h" +#include "ALICE3/DataModel/tracksAlice3.h" #include "Common/Core/RecoDecay.h" -#include "Common/Core/trackUtilities.h" -#include "PWGLF/DataModel/LFStrangenessTables.h" -#include "PWGLF/DataModel/LFParticleIdentification.h" #include "Common/Core/TrackSelection.h" +#include "Common/Core/trackUtilities.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "DetectorsBase/Propagator.h" -#include "DetectorsBase/GeometryManager.h" -#include "DataFormatsParameters/GRPObject.h" -#include "DataFormatsParameters/GRPMagField.h" + #include "CCDB/BasicCCDBManager.h" +#include "CommonConstants/PhysicsConstants.h" +#include "DCAFitter/DCAFitterN.h" #include "DataFormatsCalibration/MeanVertexObject.h" -#include "ALICE3/DataModel/OTFTOF.h" -#include "ALICE3/DataModel/RICH.h" -#include "ALICE3/DataModel/A3DecayFinderTables.h" -#include "ALICE3/DataModel/OTFStrangeness.h" -#include "ALICE3/DataModel/OTFMulticharm.h" -#include "ALICE3/DataModel/tracksAlice3.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "DataFormatsParameters/GRPObject.h" +#include "DetectorsBase/GeometryManager.h" +#include "DetectorsBase/Propagator.h" #include "DetectorsVertexing/PVertexer.h" #include "DetectorsVertexing/PVertexerHelpers.h" -#include "CommonConstants/PhysicsConstants.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/Track.h" + +#include +#include +#include +#include +#include +#include using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; -// using multicharmtracks = soa::Join; +using multiCharmTracksPID = soa::Join; +using multiCharmTracksFull = soa::Join; struct alice3multicharm { - SliceCache cache; + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + std::map pdgToBin; ConfigurableAxis axisEta{"axisEta", {80, -4.0f, +4.0f}, "#eta"}; ConfigurableAxis axisXiccMass{"axisXiccMass", {200, 3.521f, 3.721f}, "Xicc Inv Mass (GeV/c^{2})"}; ConfigurableAxis axisDCA{"axisDCA", {400, 0, 400}, "DCA (#mum)"}; ConfigurableAxis axisRadiusLarge{"axisRadiusLarge", {1000, 0, 20}, "Decay radius (cm)"}; ConfigurableAxis axisRadius{"axisRadius", {10000, 0, 10000}, "Decay radius (#mum)"}; - ConfigurableAxis axisTofTrackDelta{"axisTofTrackDelta", {1000, 0, 5000}, "TOF track time"}; + ConfigurableAxis axisTofTrackDelta{"axisTofTrackDelta", {200, 0, 1000}, "TOF track time"}; + ConfigurableAxis axisNSigma{"axisNSigma", {21, -10, 10}, "nsigma"}; ConfigurableAxis axisDecayLength{"axisDecayLength", {2000, 0, 2000}, "Decay lenght (#mum)"}; ConfigurableAxis axisDcaDaughters{"axisDcaDaughters", {200, 0, 100}, "DCA (mum)"}; ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "pt axis for QA histograms"}; @@ -101,8 +106,6 @@ struct alice3multicharm { Configurable xiccMinProperLength{"xiccMinProperLength", -1, "Minimum proper length for Xicc decay (cm)"}; Configurable xiccMaxProperLength{"xiccMaxProperLength", 1e+4, "Minimum proper length for Xicc decay (cm)"}; - HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; - void init(InitContext&) { histos.add("SelectionQA/hDCAXicDaughters", "hDCAXicDaughters; DCA between Xic daughters (#mum)", kTH1D, {axisDcaDaughters}); @@ -113,88 +116,174 @@ struct alice3multicharm { histos.add("SelectionQA/hDCAzXic", "hDCAzXic; Xic DCAz to PV (#mum)", kTH1D, {axisDCA}); histos.add("SelectionQA/hDCAxyXicc", "hDCAxyXicc; Xicc DCAxy to PV (#mum)", kTH1D, {axisDCA}); histos.add("SelectionQA/hDCAzXicc", "hDCAzXicc; Xicc DCAz to PV (#mum)", kTH1D, {axisDCA}); + histos.add("SelectionQA/hDecayRadiusXic", "hDecayRadiusXic; Distance (#mum)", kTH1D, {axisRadius}); + histos.add("SelectionQA/hDecayRadiusXicc", "hDecayRadiusXicc; Distance (#mum)", kTH1D, {axisRadius}); + histos.add("SelectionQA/hDecayDistanceFromPVXic", "hDecayDistanceFromPVXic; Distance (#mum)", kTH1D, {axisDecayLength}); + histos.add("SelectionQA/hProperLengthXic", "hProperLengthXic; Distance (#mum)", kTH1D, {axisDecayLength}); + histos.add("SelectionQA/hProperLengthXicc", "hProperLengthXicc; Distance (#mum)", kTH1D, {axisDecayLength}); histos.add("SelectionQA/hPi1cPt", "hPi1cPt; Pi1c pT (Gev/#it(c))", kTH1D, {axisPt}); histos.add("SelectionQA/hPi2cPt", "hPi2cPt; Pi2c pT (Gev/#it(c))", kTH1D, {axisPt}); histos.add("SelectionQA/hPiccPt", "hPiccPt; Picc pT (Gev/#it(c))", kTH1D, {axisPt}); - histos.add("SelectionQA/hXicDecayRadius", "hXicDecayRadius; Distance (#mum)", kTH1D, {axisRadius}); - histos.add("SelectionQA/hXiccDecayRadius", "hXiccDecayRadius; Distance (#mum)", kTH1D, {axisRadius}); - histos.add("SelectionQA/hXicDecayDistanceFromPV", "hXicDecayDistanceFromPV; Distance (#mum)", kTH1D, {axisDecayLength}); - histos.add("SelectionQA/hProperLengthXic", "hProperLengthXic; Distance (#mum)", kTH1D, {axisDecayLength}); - histos.add("SelectionQA/hProperLengthXicc", "hProperLengthXicc; Distance (#mum)", kTH1D, {axisDecayLength}); - histos.add("SelectionQA/hInnerTofTimeDeltaPi1c", "hInnerTofTimeDeltaPi1c; Reco - expected pion (ps)", kTH1D, {axisTofTrackDelta}); - histos.add("SelectionQA/hInnerTofTimeDeltaPi2c", "hInnerTofTimeDeltaPi2c; Reco - expected pion (ps)", kTH1D, {axisTofTrackDelta}); - histos.add("SelectionQA/hInnerTofTimeDeltaPicc", "hInnerTofTimeDeltaPicc; Reco - expected pion (ps)", kTH1D, {axisTofTrackDelta}); - - histos.add("XiccProngs/h3dPos", "h3dPos; Xicc pT (GeV/#it(c)); Pos pT (GeV/#it(c)); Pos #eta", kTH3D, {axisPt, axisPt, axisEta}); - histos.add("XiccProngs/h3dNeg", "h3dNeg; Xicc pT (GeV/#it(c)); Neg pT (GeV/#it(c)); Neg #eta", kTH3D, {axisPt, axisPt, axisEta}); - histos.add("XiccProngs/h3dBach", "h3dBach; Xicc pT (GeV/#it(c)); Bach pT (GeV/#it(c)); Bach #eta", kTH3D, {axisPt, axisPt, axisEta}); - histos.add("XiccProngs/h3dPi1c", "h3dPi1c; Xicc pT (GeV/#it(c)); Pi1c pT (GeV/#it(c)); Pi1c #eta", kTH3D, {axisPt, axisPt, axisEta}); - histos.add("XiccProngs/h3dPi2c", "h3dPi2c; Xicc pT (GeV/#it(c)); Pi2c pT (GeV/#it(c)); Pi2c #eta", kTH3D, {axisPt, axisPt, axisEta}); - histos.add("XiccProngs/h3dPicc", "h3dPicc; Xicc pT (GeV/#it(c)); Picc pT (GeV/#it(c)); Picc #eta", kTH3D, {axisPt, axisPt, axisEta}); + + auto hMCharmBuilding = histos.add("hMCharmBuilding", "hMCharmBuilding", kTH1D, {{22, -0.5, 21.5}}); + hMCharmBuilding->GetXaxis()->SetBinLabel(1, "nTotalCandidates"); + hMCharmBuilding->GetXaxis()->SetBinLabel(2, "xicMaxDauDCA"); + hMCharmBuilding->GetXaxis()->SetBinLabel(3, "xiccMaxDauDCA"); + hMCharmBuilding->GetXaxis()->SetBinLabel(4, "xiMinDCAxy"); + hMCharmBuilding->GetXaxis()->SetBinLabel(5, "xiMinDCAz"); + hMCharmBuilding->GetXaxis()->SetBinLabel(6, "picMinDCAxy"); + hMCharmBuilding->GetXaxis()->SetBinLabel(7, "picMinDCAz"); + hMCharmBuilding->GetXaxis()->SetBinLabel(8, "picMinDCAxy"); + hMCharmBuilding->GetXaxis()->SetBinLabel(9, "picMinDCAz"); + hMCharmBuilding->GetXaxis()->SetBinLabel(10, "piccMinDCAxy"); + hMCharmBuilding->GetXaxis()->SetBinLabel(11, "piccMinDCAz"); + hMCharmBuilding->GetXaxis()->SetBinLabel(12, "xicMinDCAxy"); + hMCharmBuilding->GetXaxis()->SetBinLabel(13, "xicMinDCAz"); + hMCharmBuilding->GetXaxis()->SetBinLabel(14, "xiccMaxDCAxy"); + hMCharmBuilding->GetXaxis()->SetBinLabel(15, "xiccMaxDCAz"); + hMCharmBuilding->GetXaxis()->SetBinLabel(16, "xicMinRadius"); + hMCharmBuilding->GetXaxis()->SetBinLabel(17, "xiccMinRadius"); + hMCharmBuilding->GetXaxis()->SetBinLabel(18, "xicMinProperLength"); + hMCharmBuilding->GetXaxis()->SetBinLabel(19, "xicMaxProperLength"); + hMCharmBuilding->GetXaxis()->SetBinLabel(20, "xiccMinProperLength"); + hMCharmBuilding->GetXaxis()->SetBinLabel(21, "xiccMaxProperLength"); + hMCharmBuilding->GetXaxis()->SetBinLabel(22, "xicMinDecayDistanceFromPV"); + + if (doprocessXiccPID || doprocessXiccExtra) { + auto hPdgCodes = histos.add("PIDQA/hPdgCodes", "hPdgCodes", kTH2D, {{3, 0.5, 3.5}, {5, 0.5, 5.5}}); + hPdgCodes->GetXaxis()->SetBinLabel(1, "pi1c"); + hPdgCodes->GetXaxis()->SetBinLabel(2, "pi2c"); + hPdgCodes->GetXaxis()->SetBinLabel(3, "picc"); + hPdgCodes->GetYaxis()->SetBinLabel(1, "el"); + hPdgCodes->GetYaxis()->SetBinLabel(2, "mu"); + hPdgCodes->GetYaxis()->SetBinLabel(3, "pi"); + hPdgCodes->GetYaxis()->SetBinLabel(4, "ka"); + hPdgCodes->GetYaxis()->SetBinLabel(5, "pr"); + pdgToBin.insert({kElectron, 1}); + pdgToBin.insert({kMuonMinus, 2}); + pdgToBin.insert({kPiPlus, 3}); + pdgToBin.insert({kKPlus, 4}); + pdgToBin.insert({kProton, 5}); + + histos.add("PIDQA/hInnerTofTimeDeltaPi1c", "hInnerTofTimeDeltaPi1c; Reco - expected pion (ps)", kTH1D, {axisTofTrackDelta}); + histos.add("PIDQA/hInnerTofTimeDeltaPi2c", "hInnerTofTimeDeltaPi2c; Reco - expected pion (ps)", kTH1D, {axisTofTrackDelta}); + histos.add("PIDQA/hInnerTofTimeDeltaPicc", "hInnerTofTimeDeltaPicc; Reco - expected pion (ps)", kTH1D, {axisTofTrackDelta}); + histos.add("PIDQA/hOuterTofTimeDeltaPi1c", "hOuterTofTimeDeltaPi1c; Reco - expected pion (ps)", kTH1D, {axisTofTrackDelta}); + histos.add("PIDQA/hOuterTofTimeDeltaPi2c", "hOuterTofTimeDeltaPi2c; Reco - expected pion (ps)", kTH1D, {axisTofTrackDelta}); + histos.add("PIDQA/hOuterTofTimeDeltaPicc", "hOuterTofTimeDeltaPicc; Reco - expected pion (ps)", kTH1D, {axisTofTrackDelta}); + + histos.add("PIDQA/hInnerTofNSigmaPi1c", "hInnerTofNSigmaPi1c; TOF NSigma pion", kTH2D, {axisPt, axisNSigma}); + histos.add("PIDQA/hOuterTofNSigmaPi1c", "hOuterTofNSigmaPi1c; TOF NSigma pion", kTH2D, {axisPt, axisNSigma}); + histos.add("PIDQA/hInnerTofNSigmaPi2c", "hInnerTofNSigmaPi2c; TOF NSigma pion", kTH2D, {axisPt, axisNSigma}); + histos.add("PIDQA/hOuterTofNSigmaPi2c", "hOuterTofNSigmaPi2c; TOF NSigma pion", kTH2D, {axisPt, axisNSigma}); + histos.add("PIDQA/hInnerTofNSigmaPicc", "hInnerTofNSigmaPicc; TOF NSigma pion", kTH2D, {axisPt, axisNSigma}); + histos.add("PIDQA/hOuterTofNSigmaPicc", "hOuterTofNSigmaPicc; TOF NSigma pion", kTH2D, {axisPt, axisNSigma}); + histos.add("PIDQA/hRichNSigmaPi1c", "hRichNSigmaPi1c; RICH NSigma pion", kTH2D, {axisPt, axisNSigma}); + histos.add("PIDQA/hRichNSigmaPi2c", "hRichNSigmaPi2c; RICH NSigma pion", kTH2D, {axisPt, axisNSigma}); + histos.add("PIDQA/hRichNSigmaPicc", "hRichNSigmaPicc; RICH NSigma pion", kTH2D, {axisPt, axisNSigma}); + } + + if (doprocessXiccExtra) { + histos.add("XiccProngs/h3dPos", "h3dPos; Xicc pT (GeV/#it(c)); Pos pT (GeV/#it(c)); Pos #eta", kTH3D, {axisPt, axisPt, axisEta}); + histos.add("XiccProngs/h3dNeg", "h3dNeg; Xicc pT (GeV/#it(c)); Neg pT (GeV/#it(c)); Neg #eta", kTH3D, {axisPt, axisPt, axisEta}); + histos.add("XiccProngs/h3dBach", "h3dBach; Xicc pT (GeV/#it(c)); Bach pT (GeV/#it(c)); Bach #eta", kTH3D, {axisPt, axisPt, axisEta}); + histos.add("XiccProngs/h3dPi1c", "h3dPi1c; Xicc pT (GeV/#it(c)); Pi1c pT (GeV/#it(c)); Pi1c #eta", kTH3D, {axisPt, axisPt, axisEta}); + histos.add("XiccProngs/h3dPi2c", "h3dPi2c; Xicc pT (GeV/#it(c)); Pi2c pT (GeV/#it(c)); Pi2c #eta", kTH3D, {axisPt, axisPt, axisEta}); + histos.add("XiccProngs/h3dPicc", "h3dPicc; Xicc pT (GeV/#it(c)); Picc pT (GeV/#it(c)); Picc #eta", kTH3D, {axisPt, axisPt, axisEta}); + } histos.add("h3dXicc", "h3dXicc; Xicc pT (GeV/#it(c)); Xicc #eta; Xicc mass (GeV/#it(c)^{2})", kTH3D, {axisPt, axisEta, axisXiccMass}); } - void processXicc(aod::MCharmCores const& multiCharmTracks) + template + void genericProcessXicc(TMCharmCands xiccCands) { - for (const auto& xiccCand : multiCharmTracks) { - if (xiccCand.xicDauDCA() > xicMaxDauDCA || xiccCand.xiccDauDCA() > xiccMaxDauDCA) + for (const auto& xiccCand : xiccCands) { + + histos.fill(HIST("hMCharmBuilding"), 0); + if (xiccCand.xicDauDCA() > xicMaxDauDCA) continue; - if (std::fabs(xiccCand.xiDCAxy()) < xiMinDCAxy || std::fabs(xiccCand.xiDCAz()) < xiMinDCAz) + histos.fill(HIST("hMCharmBuilding"), 1); + if (xiccCand.xiccDauDCA() > xiccMaxDauDCA) continue; - if (std::fabs(xiccCand.pi1cDCAxy()) < picMinDCAxy || std::fabs(xiccCand.pi1cDCAz()) < picMinDCAz) + histos.fill(HIST("hMCharmBuilding"), 2); + if (std::fabs(xiccCand.xiDCAxy()) < xiMinDCAxy) continue; - if (std::fabs(xiccCand.pi2cDCAxy()) < picMinDCAxy || std::fabs(xiccCand.pi2cDCAz()) < picMinDCAz) + histos.fill(HIST("hMCharmBuilding"), 3); + if (std::fabs(xiccCand.xiDCAz()) < xiMinDCAz) continue; - if (std::fabs(xiccCand.piccDCAxy()) < piccMinDCAxy || std::fabs(xiccCand.piccDCAz()) < piccMinDCAz) + histos.fill(HIST("hMCharmBuilding"), 4); + if (std::fabs(xiccCand.pi1cDCAxy()) < picMinDCAxy) continue; - if (std::fabs(xiccCand.xicDCAxy()) < xicMinDCAxy || std::fabs(xiccCand.xicDCAz()) < xicMinDCAz) + histos.fill(HIST("hMCharmBuilding"), 5); + if (std::fabs(xiccCand.pi1cDCAz()) < picMinDCAz) continue; - if (std::fabs(xiccCand.pi1cDCAxy()) < picMinDCAxy || std::fabs(xiccCand.pi1cDCAz()) < picMinDCAz) + histos.fill(HIST("hMCharmBuilding"), 6); + if (std::fabs(xiccCand.pi2cDCAxy()) < picMinDCAxy) continue; - if (std::fabs(xiccCand.pi2cDCAxy()) < picMinDCAxy || std::fabs(xiccCand.pi2cDCAz()) < picMinDCAz) + histos.fill(HIST("hMCharmBuilding"), 7); + if (std::fabs(xiccCand.pi2cDCAz()) < picMinDCAz) continue; - if (std::fabs(xiccCand.xiccDCAxy()) > xiccMaxDCAxy || std::fabs(xiccCand.xiccDCAz()) > xiccMaxDCAz) + histos.fill(HIST("hMCharmBuilding"), 8); + if (std::fabs(xiccCand.piccDCAxy()) < piccMinDCAxy) continue; - // Cut on time delta as LoI for now - if (xiccCand.pi1cTofDeltaInner() > picMaxTofDiffInner) + histos.fill(HIST("hMCharmBuilding"), 9); + if (std::fabs(xiccCand.piccDCAz()) < piccMinDCAz) continue; - if (xiccCand.pi2cTofDeltaInner() > picMaxTofDiffInner) + histos.fill(HIST("hMCharmBuilding"), 10); + if (std::fabs(xiccCand.xicDCAxy()) < xicMinDCAxy) continue; - if (xiccCand.piccTofDeltaInner() > piccMaxTofDiffInner) + histos.fill(HIST("hMCharmBuilding"), 11); + if (std::fabs(xiccCand.xicDCAz()) < xicMinDCAz) continue; - if (xiccCand.pi1cPt() < picMinPt || xiccCand.pi2cPt() < picMinPt) + histos.fill(HIST("hMCharmBuilding"), 12); + if (std::fabs(xiccCand.xiccDCAxy()) > xiccMaxDCAxy) continue; - if (xiccCand.piccPt() < piccMinPt) + histos.fill(HIST("hMCharmBuilding"), 13); + if (std::fabs(xiccCand.xiccDCAz()) > xiccMaxDCAz) continue; + histos.fill(HIST("hMCharmBuilding"), 14); if (xiccCand.xicDecayRadius2D() < xicMinRadius) continue; + histos.fill(HIST("hMCharmBuilding"), 15); if (xiccCand.xiccDecayRadius2D() < xiccMinRadius) continue; - if (xiccCand.xicProperLength() < xicMinProperLength || xiccCand.xicProperLength() > xicMaxProperLength) + histos.fill(HIST("hMCharmBuilding"), 16); + if (xiccCand.xicProperLength() < xicMinProperLength) + continue; + + histos.fill(HIST("hMCharmBuilding"), 17); + if (xiccCand.xicProperLength() > xicMaxProperLength) + continue; + + histos.fill(HIST("hMCharmBuilding"), 18); + if (xiccCand.xiccProperLength() < xiccMinProperLength) continue; - if (xiccCand.xiccProperLength() < xiccMinProperLength || xiccCand.xiccProperLength() > xiccMaxProperLength) + histos.fill(HIST("hMCharmBuilding"), 19); + if (xiccCand.xiccProperLength() > xiccMaxProperLength) continue; + histos.fill(HIST("hMCharmBuilding"), 20); if (xiccCand.xicDistanceFromPV() < xicMinDecayDistanceFromPV) continue; + histos.fill(HIST("hMCharmBuilding"), 21); histos.fill(HIST("SelectionQA/hDCAXicDaughters"), xiccCand.xicDauDCA() * 1e+4); histos.fill(HIST("SelectionQA/hDCAXiccDaughters"), xiccCand.xiccDauDCA() * 1e+4); histos.fill(HIST("SelectionQA/hDCAxyXi"), std::fabs(xiccCand.xiDCAxy() * 1e+4)); @@ -203,29 +292,74 @@ struct alice3multicharm { histos.fill(HIST("SelectionQA/hDCAzXic"), std::fabs(xiccCand.xicDCAz() * 1e+4)); histos.fill(HIST("SelectionQA/hDCAxyXicc"), std::fabs(xiccCand.xiccDCAxy() * 1e+4)); histos.fill(HIST("SelectionQA/hDCAzXicc"), std::fabs(xiccCand.xiccDCAz() * 1e+4)); + histos.fill(HIST("SelectionQA/hDecayRadiusXic"), xiccCand.xicDecayRadius2D() * 1e+4); + histos.fill(HIST("SelectionQA/hDecayRadiusXicc"), xiccCand.xiccDecayRadius2D() * 1e+4); + histos.fill(HIST("SelectionQA/hDecayDistanceFromPVXic"), xiccCand.xicDistanceFromPV() * 1e+4); + histos.fill(HIST("SelectionQA/hProperLengthXic"), xiccCand.xicProperLength() * 1e+4); + histos.fill(HIST("SelectionQA/hProperLengthXicc"), xiccCand.xiccProperLength() * 1e+4); histos.fill(HIST("SelectionQA/hPi1cPt"), xiccCand.pi1cPt()); histos.fill(HIST("SelectionQA/hPi2cPt"), xiccCand.pi2cPt()); histos.fill(HIST("SelectionQA/hPiccPt"), xiccCand.piccPt()); - histos.fill(HIST("SelectionQA/hXicDecayRadius"), xiccCand.xicDecayRadius2D() * 1e+4); - histos.fill(HIST("SelectionQA/hXiccDecayRadius"), xiccCand.xiccDecayRadius2D() * 1e+4); - histos.fill(HIST("SelectionQA/hXicDecayDistanceFromPV"), xiccCand.xicDistanceFromPV() * 1e+4); - histos.fill(HIST("SelectionQA/hProperLengthXic"), xiccCand.xicProperLength() * 1e+4); - histos.fill(HIST("SelectionQA/hProperLengthXicc"), xiccCand.xiccProperLength() * 1e+4); - histos.fill(HIST("SelectionQA/hInnerTofTimeDeltaPi1c"), xiccCand.pi1cTofDeltaInner()); - histos.fill(HIST("SelectionQA/hInnerTofTimeDeltaPi2c"), xiccCand.pi2cTofDeltaInner()); - histos.fill(HIST("SelectionQA/hInnerTofTimeDeltaPicc"), xiccCand.piccTofDeltaInner()); - - histos.fill(HIST("XiccProngs/h3dNeg"), xiccCand.pt(), xiccCand.negPt(), xiccCand.negEta()); - histos.fill(HIST("XiccProngs/h3dPos"), xiccCand.pt(), xiccCand.posPt(), xiccCand.posEta()); - histos.fill(HIST("XiccProngs/h3dBach"), xiccCand.pt(), xiccCand.bachPt(), xiccCand.bachEta()); - histos.fill(HIST("XiccProngs/h3dPi1c"), xiccCand.pt(), xiccCand.pi1cPt(), xiccCand.pi1cEta()); - histos.fill(HIST("XiccProngs/h3dPi2c"), xiccCand.pt(), xiccCand.pi2cPt(), xiccCand.pi2cEta()); - histos.fill(HIST("XiccProngs/h3dPicc"), xiccCand.pt(), xiccCand.piccPt(), xiccCand.piccEta()); - histos.fill(HIST("h3dXicc"), xiccCand.pt(), xiccCand.eta(), xiccCand.xiccMass()); + + if constexpr (requires { xiccCand.pi1cTofDeltaInner(); }) { // if pid table + histos.fill(HIST("PIDQA/hInnerTofTimeDeltaPi1c"), xiccCand.pi1cTofDeltaInner()); + histos.fill(HIST("PIDQA/hInnerTofTimeDeltaPi2c"), xiccCand.pi2cTofDeltaInner()); + histos.fill(HIST("PIDQA/hInnerTofTimeDeltaPicc"), xiccCand.piccTofDeltaInner()); + histos.fill(HIST("PIDQA/hOuterTofTimeDeltaPi1c"), xiccCand.pi1cTofDeltaOuter()); + histos.fill(HIST("PIDQA/hOuterTofTimeDeltaPi2c"), xiccCand.pi2cTofDeltaOuter()); + histos.fill(HIST("PIDQA/hOuterTofTimeDeltaPicc"), xiccCand.piccTofDeltaOuter()); + histos.fill(HIST("PIDQA/hInnerTofNSigmaPi1c"), xiccCand.pi1cPt(), xiccCand.pi1cTofNSigmaInner()); + histos.fill(HIST("PIDQA/hOuterTofNSigmaPi1c"), xiccCand.pi1cPt(), xiccCand.pi1cTofNSigmaOuter()); + histos.fill(HIST("PIDQA/hInnerTofNSigmaPi2c"), xiccCand.pi2cPt(), xiccCand.pi2cTofNSigmaInner()); + histos.fill(HIST("PIDQA/hOuterTofNSigmaPi2c"), xiccCand.pi2cPt(), xiccCand.pi2cTofNSigmaOuter()); + histos.fill(HIST("PIDQA/hInnerTofNSigmaPicc"), xiccCand.piccPt(), xiccCand.piccTofNSigmaInner()); + histos.fill(HIST("PIDQA/hOuterTofNSigmaPicc"), xiccCand.piccPt(), xiccCand.piccTofNSigmaOuter()); + if (xiccCand.pi1cHasRichSignal()) { + histos.fill(HIST("PIDQA/hRichNSigmaPi1c"), xiccCand.pi1cPt(), xiccCand.pi1cRichNSigma()); + } + if (xiccCand.pi2cHasRichSignal()) { + histos.fill(HIST("PIDQA/hRichNSigmaPi2c"), xiccCand.pi2cPt(), xiccCand.pi2cRichNSigma()); + } + if (xiccCand.piccHasRichSignal()) { + histos.fill(HIST("PIDQA/hRichNSigmaPicc"), xiccCand.piccPt(), xiccCand.piccRichNSigma()); + } + + histos.fill(HIST("PIDQA/hPdgCodes"), 1, pdgToBin.at(std::abs(xiccCand.pi1cPdgCode()))); + histos.fill(HIST("PIDQA/hPdgCodes"), 2, pdgToBin.at(std::abs(xiccCand.pi2cPdgCode()))); + histos.fill(HIST("PIDQA/hPdgCodes"), 3, pdgToBin.at(std::abs(xiccCand.piccPdgCode()))); + } + + if constexpr (requires { xiccCand.negPt(); }) { // if extra table + histos.fill(HIST("XiccProngs/h3dNeg"), xiccCand.xiccPt(), xiccCand.negPt(), xiccCand.negEta()); + histos.fill(HIST("XiccProngs/h3dPos"), xiccCand.xiccPt(), xiccCand.posPt(), xiccCand.posEta()); + histos.fill(HIST("XiccProngs/h3dBach"), xiccCand.xiccPt(), xiccCand.bachPt(), xiccCand.bachEta()); + histos.fill(HIST("XiccProngs/h3dPi1c"), xiccCand.xiccPt(), xiccCand.pi1cPt(), xiccCand.pi1cEta()); + histos.fill(HIST("XiccProngs/h3dPi2c"), xiccCand.xiccPt(), xiccCand.pi2cPt(), xiccCand.pi2cEta()); + histos.fill(HIST("XiccProngs/h3dPicc"), xiccCand.xiccPt(), xiccCand.piccPt(), xiccCand.piccEta()); + } + + histos.fill(HIST("h3dXicc"), xiccCand.xiccPt(), xiccCand.xiccEta(), xiccCand.xiccMass()); } } + void processXicc(aod::MCharmCores const& multiCharmTracks) + { + genericProcessXicc(multiCharmTracks); + } + + void processXiccPID(multiCharmTracksPID const& multiCharmTracks) + { + genericProcessXicc(multiCharmTracks); + } + + void processXiccExtra(multiCharmTracksFull const& multiCharmTracks) + { + genericProcessXicc(multiCharmTracks); + } + PROCESS_SWITCH(alice3multicharm, processXicc, "find Xicc baryons", true); + PROCESS_SWITCH(alice3multicharm, processXiccPID, "find Xicc baryons with more QA from PID information", false); + PROCESS_SWITCH(alice3multicharm, processXiccExtra, "find Xicc baryons with all QA", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From d2820c8baca893ab852ff2a09ade1150900e7c21 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Wed, 23 Jul 2025 08:27:09 +0200 Subject: [PATCH 010/345] [PWGEM/PhotonMeson] add a task for diphoton-hadron 2PC (#12195) --- PWGEM/Dilepton/Utils/EventHistograms.h | 33 +- PWGEM/PhotonMeson/Core/DiphotonHadron2PC.h | 817 ++++++++++++++++++ .../TableProducer/createEMEventPhoton.cxx | 120 ++- .../skimmerPrimaryElectronFromDalitzEE.cxx | 40 + PWGEM/PhotonMeson/Tasks/CMakeLists.txt | 10 + .../Tasks/diphotonHadron2PCPCMDalitzEE.cxx | 36 + .../Tasks/diphotonHadron2PCPCMPCM.cxx | 34 + PWGEM/PhotonMeson/Tasks/prefilterPhoton.cxx | 37 +- PWGEM/PhotonMeson/Utils/EventHistograms.h | 27 +- 9 files changed, 1086 insertions(+), 68 deletions(-) create mode 100644 PWGEM/PhotonMeson/Core/DiphotonHadron2PC.h create mode 100644 PWGEM/PhotonMeson/Tasks/diphotonHadron2PCPCMDalitzEE.cxx create mode 100644 PWGEM/PhotonMeson/Tasks/diphotonHadron2PCPCMPCM.cxx diff --git a/PWGEM/Dilepton/Utils/EventHistograms.h b/PWGEM/Dilepton/Utils/EventHistograms.h index c7940350ac6..afebfff955b 100644 --- a/PWGEM/Dilepton/Utils/EventHistograms.h +++ b/PWGEM/Dilepton/Utils/EventHistograms.h @@ -49,16 +49,34 @@ void addEventHistograms(HistogramRegistry* fRegistry) hCollisionCounter->GetXaxis()->SetBinLabel(20, "Calibrated Q vector"); hCollisionCounter->GetXaxis()->SetBinLabel(21, "accepted"); + const AxisSpec axis_cent_ft0m{{0, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110}, + "centrality FT0M (%)"}; + + const AxisSpec axis_cent_ft0a{{0, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110}, + "centrality FT0A (%)"}; + + const AxisSpec axis_cent_ft0c{{0, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110}, + "centrality FT0C (%)"}; + fRegistry->add("Event/before/hZvtx", "vertex z; Z_{vtx} (cm)", kTH1F, {{100, -50, +50}}, false); fRegistry->add("Event/before/hMultNTracksPV", "hMultNTracksPV; N_{track} to PV", kTH1F, {{6001, -0.5, 6000.5}}, false); fRegistry->add("Event/before/hMultNTracksPVeta1", "hMultNTracksPVeta1; N_{track} to PV", kTH1F, {{6001, -0.5, 6000.5}}, false); fRegistry->add("Event/before/hMultFT0", "hMultFT0;mult. FT0A;mult. FT0C", kTH2F, {{200, 0, 200000}, {60, 0, 60000}}, false); - fRegistry->add("Event/before/hCentFT0A", "hCentFT0A;centrality FT0A (%)", kTH1F, {{110, 0, 110}}, false); - fRegistry->add("Event/before/hCentFT0C", "hCentFT0C;centrality FT0C (%)", kTH1F, {{110, 0, 110}}, false); - fRegistry->add("Event/before/hCentFT0M", "hCentFT0M;centrality FT0M (%)", kTH1F, {{110, 0, 110}}, false); - fRegistry->add("Event/before/hCentFT0A_HMpp", "hCentFT0A for HM pp;centrality FT0A (%)", kTH1F, {{100, 0, 1}}, false); - fRegistry->add("Event/before/hCentFT0C_HMpp", "hCentFT0C for HM pp;centrality FT0C (%)", kTH1F, {{100, 0, 1}}, false); - fRegistry->add("Event/before/hCentFT0M_HMpp", "hCentFT0M for HM pp;centrality FT0M (%)", kTH1F, {{100, 0, 1}}, false); + fRegistry->add("Event/before/hCentFT0A", "hCentFT0A;centrality FT0A (%)", kTH1F, {{axis_cent_ft0m}}, false); + fRegistry->add("Event/before/hCentFT0C", "hCentFT0C;centrality FT0C (%)", kTH1F, {{axis_cent_ft0a}}, false); + fRegistry->add("Event/before/hCentFT0M", "hCentFT0M;centrality FT0M (%)", kTH1F, {{axis_cent_ft0c}}, false); fRegistry->add("Event/before/hCentFT0CvsMultNTracksPV", "hCentFT0CvsMultNTracksPV;centrality FT0C (%);N_{track} to PV", kTH2F, {{110, 0, 110}, {600, 0, 6000}}, false); fRegistry->add("Event/before/hMultFT0CvsMultNTracksPV", "hMultFT0CvsMultNTracksPV;mult. FT0C;N_{track} to PV", kTH2F, {{60, 0, 60000}, {600, 0, 6000}}, false); fRegistry->add("Event/before/hMultFT0CvsOccupancy", "hMultFT0CvsOccupancy;mult. FT0C;N_{track} in time range", kTH2F, {{60, 0, 60000}, {200, 0, 20000}}, false); @@ -198,9 +216,6 @@ void fillEventInfo(HistogramRegistry* fRegistry, TCollision const& collision, co fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCentFT0A"), collision.centFT0A()); fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCentFT0C"), collision.centFT0C()); fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCentFT0M"), collision.centFT0M()); - fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCentFT0A_HMpp"), collision.centFT0A()); - fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCentFT0C_HMpp"), collision.centFT0C()); - fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCentFT0M_HMpp"), collision.centFT0M()); fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCentFT0CvsMultNTracksPV"), collision.centFT0C(), collision.multNTracksPV()); fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hMultFT0CvsMultNTracksPV"), collision.multFT0C(), collision.multNTracksPV()); fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hMultFT0CvsOccupancy"), collision.multFT0C(), collision.trackOccupancyInTimeRange()); diff --git a/PWGEM/PhotonMeson/Core/DiphotonHadron2PC.h b/PWGEM/PhotonMeson/Core/DiphotonHadron2PC.h new file mode 100644 index 00000000000..aa2746f6291 --- /dev/null +++ b/PWGEM/PhotonMeson/Core/DiphotonHadron2PC.h @@ -0,0 +1,817 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// +// ======================== +// +/// \file DiphotonHadron2PC.h +/// \brief This code is to analyze diphoton-hadron correlation. Keep in mind that cumulant method does not require event mixing. +/// +/// \author D. Sekihata, daiki.sekihata@cern.ch + +#ifndef PWGEM_PHOTONMESON_CORE_DIPHOTONHADRON2PC_H_ +#define PWGEM_PHOTONMESON_CORE_DIPHOTONHADRON2PC_H_ + +// #include "PWGEM/Dilepton/Core/EMTrackCut.h" +#include "PWGEM/Dilepton/Utils/EMTrack.h" +#include "PWGEM/Dilepton/Utils/EMTrackUtilities.h" +#include "PWGEM/Dilepton/Utils/EventMixingHandler.h" +#include "PWGEM/PhotonMeson/Core/DalitzEECut.h" +#include "PWGEM/PhotonMeson/Core/EMPhotonEventCut.h" +#include "PWGEM/PhotonMeson/Core/V0PhotonCut.h" +#include "PWGEM/PhotonMeson/DataModel/gammaTables.h" +#include "PWGEM/PhotonMeson/Utils/EventHistograms.h" +#include "PWGEM/PhotonMeson/Utils/NMHistograms.h" +#include "PWGEM/PhotonMeson/Utils/PairUtilities.h" + +#include "Common/CCDB/RCTSelectionFlags.h" +#include "Common/Core/RecoDecay.h" + +#include "CCDB/BasicCCDBManager.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "DataFormatsParameters/GRPObject.h" +#include "DetectorsBase/GeometryManager.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" + +#include "Math/Vector4D.h" +#include "TString.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace o2; +using namespace o2::aod; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::soa; +using namespace o2::aod::pwgem::photonmeson::photonpair; +using namespace o2::aod::pwgem::photon; +using namespace o2::aod::pwgem::dilepton::utils::emtrackutil; +using namespace o2::aod::pwgem::dilepton::utils; + +using MyCollisions = soa::Join; +using MyCollision = MyCollisions::iterator; + +using MyV0Photons = soa::Filtered>; +using MyV0Photon = MyV0Photons::iterator; + +using MyPrimaryElectrons = soa::Filtered>; +using MyPrimaryElectron = MyPrimaryElectrons::iterator; + +using MyTracks = soa::Join; +using MyTrack = MyTracks::iterator; + +template +struct DiphotonHadron2PC { + + Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"}; + Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; + Configurable skipGRPOquery{"skipGRPOquery", true, "skip grpo query"}; + Configurable d_bz_input{"d_bz_input", -999, "bz field in kG, -999 is automatic"}; + + Configurable cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2"}; + Configurable cfgOccupancyEstimator{"cfgOccupancyEstimator", 0, "FT0C:0, Track:1"}; + Configurable cfgCentMin{"cfgCentMin", -1, "min. centrality"}; + Configurable cfgCentMax{"cfgCentMax", 999, "max. centrality"}; + Configurable maxY{"maxY", 0.8, "maximum rapidity for diphoton"}; + Configurable cfgDoMix{"cfgDoMix", true, "flag for event mixing"}; + Configurable ndepth{"ndepth", 100, "depth for event mixing"}; + Configurable ndiff_bc_mix{"ndiff_bc_mix", 594, "difference in global BC required in mixed events"}; + ConfigurableAxis ConfVtxBins{"ConfVtxBins", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"}; + ConfigurableAxis ConfCentBins{"ConfCentBins", {VARIABLE_WIDTH, 0.0f, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f, 100.f, 999.f}, "Mixing bins - centrality"}; + ConfigurableAxis ConfOccupancyBins{"ConfOccupancyBins", {VARIABLE_WIDTH, -1, 1e+10}, "Mixing bins - occupancy"}; + + ConfigurableAxis ConfMggBins{"ConfMggBins", {200, 0.0, 0.8}, "mgg bins for output histograms"}; + ConfigurableAxis ConfPtggBins{"ConfPtggBins", {VARIABLE_WIDTH, 0.0, 0.1, 0.2, 0.3, 0.4, 0.50, 1.00, 1.50, 2.00, 2.50, 3.00, 3.50, 4.00, 4.50, 5.00, 6.00, 7.00, 8.00, 9.00, 10.00}, "pTgg bins for output histograms"}; + + ConfigurableAxis ConfPtHadronBins{"ConfPtHadronBins", {VARIABLE_WIDTH, 0.00, 0.15, 0.2, 0.3, 0.4, 0.50, 1.00, 2.00, 3.00, 4.00, 5.00}, "pT,h bins for output histograms"}; + ConfigurableAxis ConfDEtaBins{"ConfDEtaBins", {60, -3, 3}, "deta bins for output histograms"}; + Configurable cfgNbinsDPhi{"cfgNbinsDPhi", 36, "nbins in dphi for output histograms"}; + Configurable cfgNbinsCosNDPhi{"cfgNbinsCosNDPhi", 100, "nbins in cos(n(dphi)) for output histograms"}; + Configurable cfgNmod{"cfgNmod", 2, "n-th harmonics"}; + + EMPhotonEventCut fEMEventCut; + struct : ConfigurableGroup { + std::string prefix = "eventcut_group"; + Configurable cfgZvtxMin{"cfgZvtxMin", -10.f, "min. Zvtx"}; + Configurable cfgZvtxMax{"cfgZvtxMax", +10.f, "max. Zvtx"}; + Configurable cfgRequireSel8{"cfgRequireSel8", true, "require sel8 in event cut"}; + Configurable cfgRequireFT0AND{"cfgRequireFT0AND", true, "require FT0AND in event cut"}; + Configurable cfgRequireNoTFB{"cfgRequireNoTFB", false, "require No time frame border in event cut"}; + Configurable cfgRequireNoITSROFB{"cfgRequireNoITSROFB", false, "require no ITS readout frame border in event cut"}; + Configurable cfgRequireNoSameBunchPileup{"cfgRequireNoSameBunchPileup", false, "require no same bunch pileup in event cut"}; + Configurable cfgRequireGoodZvtxFT0vsPV{"cfgRequireGoodZvtxFT0vsPV", false, "require good Zvtx between FT0 vs. PV in event cut"}; + Configurable cfgTrackOccupancyMin{"cfgTrackOccupancyMin", -2, "min. occupancy"}; + Configurable cfgTrackOccupancyMax{"cfgTrackOccupancyMax", 1000000000, "max. occupancy"}; + Configurable cfgFT0COccupancyMin{"cfgFT0COccupancyMin", -2, "min. FT0C occupancy"}; + Configurable cfgFT0COccupancyMax{"cfgFT0COccupancyMax", 1000000000, "max. FT0C occupancy"}; + // for RCT + Configurable cfgRequireGoodRCT{"cfgRequireGoodRCT", false, "require good detector flag in run condtion table"}; + Configurable cfgRCTLabel{"cfgRCTLabel", "CBT_hadronPID", "select 1 [CBT, CBT_hadronPID] see O2Physics/Common/CCDB/RCTSelectionFlags.h"}; + Configurable cfgCheckZDC{"cfgCheckZDC", false, "set ZDC flag for PbPb"}; + Configurable cfgTreatLimitedAcceptanceAsBad{"cfgTreatLimitedAcceptanceAsBad", false, "reject all events where the detectors relevant for the specified Runlist are flagged as LimitedAcceptance"}; + } eventcuts; + + V0PhotonCut fV0PhotonCut; + struct : ConfigurableGroup { + std::string prefix = "pcmcut_group"; + Configurable cfg_require_v0_with_itstpc{"cfg_require_v0_with_itstpc", false, "flag to select V0s with ITS-TPC matched tracks"}; + Configurable cfg_require_v0_with_itsonly{"cfg_require_v0_with_itsonly", false, "flag to select V0s with ITSonly tracks"}; + Configurable cfg_require_v0_with_tpconly{"cfg_require_v0_with_tpconly", false, "flag to select V0s with TPConly tracks"}; + Configurable cfg_min_pt_v0{"cfg_min_pt_v0", 0.1, "min pT for v0 photons at PV"}; + Configurable cfg_max_pt_v0{"cfg_max_pt_v0", 1e+10, "max pT for v0 photons at PV"}; + Configurable cfg_min_eta_v0{"cfg_min_eta_v0", -0.8, "min eta for v0 photons at PV"}; + Configurable cfg_max_eta_v0{"cfg_max_eta_v0", 0.8, "max eta for v0 photons at PV"}; + Configurable cfg_min_v0radius{"cfg_min_v0radius", 4.0, "min v0 radius"}; + Configurable cfg_max_v0radius{"cfg_max_v0radius", 90.0, "max v0 radius"}; + Configurable cfg_max_alpha_ap{"cfg_max_alpha_ap", 0.95, "max alpha for AP cut"}; + Configurable cfg_max_qt_ap{"cfg_max_qt_ap", 0.01, "max qT for AP cut"}; + Configurable cfg_min_cospa{"cfg_min_cospa", 0.997, "min V0 CosPA"}; + Configurable cfg_max_pca{"cfg_max_pca", 3.0, "max distance btween 2 legs"}; + Configurable cfg_max_chi2kf{"cfg_max_chi2kf", 1e+10, "max chi2/ndf with KF"}; + Configurable cfg_require_v0_with_correct_xz{"cfg_require_v0_with_correct_xz", false, "flag to select V0s with correct xz"}; + Configurable cfg_reject_v0_on_itsib{"cfg_reject_v0_on_itsib", true, "flag to reject V0s on ITSib"}; + Configurable cfg_apply_cuts_from_prefilter_derived{"cfg_apply_cuts_from_prefilter_derived", false, "flag to apply prefilter to V0"}; + + Configurable cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 0, "min ncluster tpc"}; + Configurable cfg_min_ncrossedrows{"cfg_min_ncrossedrows", 40, "min ncrossed rows"}; + Configurable cfg_max_frac_shared_clusters_tpc{"cfg_max_frac_shared_clusters_tpc", 999.f, "max fraction of shared clusters in TPC"}; + Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; + Configurable cfg_max_chi2its{"cfg_max_chi2its", 36.0, "max chi2/NclsITS"}; + Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -3.0, "min. TPC n sigma for electron"}; + Configurable cfg_max_TPCNsigmaEl{"cfg_max_TPCNsigmaEl", +3.0, "max. TPC n sigma for electron"}; + Configurable cfg_disable_itsonly_track{"cfg_disable_itsonly_track", false, "flag to disable ITSonly tracks"}; + Configurable cfg_disable_tpconly_track{"cfg_disable_tpconly_track", false, "flag to disable TPConly tracks"}; + } pcmcuts; + + DalitzEECut fDileptonCut; + struct : ConfigurableGroup { + std::string prefix = "dileptoncut_group"; + Configurable cfg_min_mass{"cfg_min_mass", 0.0, "min mass"}; + Configurable cfg_max_mass{"cfg_max_mass", 0.04, "max mass"}; + Configurable cfg_apply_phiv{"cfg_apply_phiv", true, "flag to apply phiv cut"}; + Configurable cfg_require_itsib_any{"cfg_require_itsib_any", false, "flag to require ITS ib any hits"}; + Configurable cfg_require_itsib_1st{"cfg_require_itsib_1st", true, "flag to require ITS ib 1st hit"}; + Configurable cfg_phiv_slope{"cfg_phiv_slope", 0.0185, "slope for m vs. phiv"}; + Configurable cfg_phiv_intercept{"cfg_phiv_intercept", -0.0280, "intercept for m vs. phiv"}; + + Configurable cfg_min_pt_track{"cfg_min_pt_track", 0.1, "min pT for single track"}; + Configurable cfg_max_eta_track{"cfg_max_eta_track", 2.0, "max eta for single track"}; + Configurable cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 0, "min ncluster tpc"}; + Configurable cfg_min_ncluster_its{"cfg_min_ncluster_its", 5, "min ncluster its"}; + Configurable cfg_min_ncrossedrows{"cfg_min_ncrossedrows", 70, "min ncrossed rows"}; + Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; + Configurable cfg_max_chi2its{"cfg_max_chi2its", 36.0, "max chi2/NclsITS"}; + Configurable cfg_max_dcaxy{"cfg_max_dcaxy", 0.1, "max dca XY for single track in cm"}; + Configurable cfg_max_dcaz{"cfg_max_dcaz", 0.1, "max dca Z for single track in cm"}; + Configurable cfg_max_dca3dsigma_track{"cfg_max_dca3dsigma_track", 1e+10, "max DCA 3D in sigma"}; + Configurable cfg_max_frac_shared_clusters_tpc{"cfg_max_frac_shared_clusters_tpc", 0.7, "max fraction of shared clusters in TPC"}; + Configurable cfg_apply_cuts_from_prefilter_derived{"cfg_apply_cuts_from_prefilter_derived", false, "flag to apply prefilter to electron"}; + + Configurable cfg_pid_scheme{"cfg_pid_scheme", static_cast(DalitzEECut::PIDSchemes::kTOFif), "pid scheme [kTOFif : 0, kTPConly : 1]"}; + Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -2.0, "min. TPC n sigma for electron inclusion"}; + Configurable cfg_max_TPCNsigmaEl{"cfg_max_TPCNsigmaEl", +3.0, "max. TPC n sigma for electron inclusion"}; + Configurable cfg_min_TPCNsigmaPi{"cfg_min_TPCNsigmaPi", -0.0, "min. TPC n sigma for pion exclusion"}; + Configurable cfg_max_TPCNsigmaPi{"cfg_max_TPCNsigmaPi", +0.0, "max. TPC n sigma for pion exclusion"}; + Configurable cfg_min_TOFNsigmaEl{"cfg_min_TOFNsigmaEl", -3.0, "min. TOF n sigma for electron inclusion"}; + Configurable cfg_max_TOFNsigmaEl{"cfg_max_TOFNsigmaEl", +3.0, "max. TOF n sigma for electron inclusion"}; + } dileptoncuts; + + // EMTrackCut fEMTrackCut; + // struct : ConfigurableGroup { + // std::string prefix = "trackcut_group"; + // Configurable cfg_min_pt_track{"cfg_min_pt_track", 0.15, "min pT for ref. track"}; + // Configurable cfg_max_pt_track{"cfg_max_pt_track", 3.0, "max pT for ref. track"}; + // Configurable cfg_min_eta_track{"cfg_min_eta_track", -1.2, "min eta for ref. track"}; + // Configurable cfg_max_eta_track{"cfg_max_eta_track", +1.2, "max eta for ref. track"}; + // Configurable cfg_min_phi_track{"cfg_min_phi_track", 0., "min phi for ref. track"}; + // Configurable cfg_max_phi_track{"cfg_max_phi_track", 6.3, "max phi for ref. track"}; + // Configurable cfg_min_ncluster_its{"cfg_min_ncluster_its", 5, "min ncluster its"}; + // Configurable cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 0, "min ncluster tpc"}; + // Configurable cfg_min_ncrossedrows{"cfg_min_ncrossedrows", 70, "min ncrossed rows"}; + // Configurable cfg_max_frac_shared_clusters_tpc{"cfg_max_frac_shared_clusters_tpc", 0.7, "max fraction of shared clusters in TPC"}; + // Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; + // Configurable cfg_max_chi2its{"cfg_max_chi2its", 36.0, "max chi2/NclsITS"}; + // Configurable cfg_max_dcaxy{"cfg_max_dcaxy", 1.0, "max dca XY for single track in cm"}; + // Configurable cfg_max_dcaz{"cfg_max_dcaz", 1.0, "max dca Z for single track in cm"}; + // Configurable cfg_require_itsib_any{"cfg_require_itsib_any", true, "flag to require ITS ib any hits"}; + // Configurable cfg_require_itsib_1st{"cfg_require_itsib_1st", false, "flag to require ITS ib 1st hit"}; + // } trackcuts; + + o2::aod::rctsel::RCTFlagsChecker rctChecker; + HistogramRegistry fRegistry{"output", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; + static constexpr std::string_view event_types[2] = {"before/", "after/"}; + static constexpr std::string_view event_pair_types[2] = {"same/", "mix/"}; + + std::vector zvtx_bin_edges; + std::vector cent_bin_edges; + std::vector occ_bin_edges; + + o2::ccdb::CcdbApi ccdbApi; + Service ccdb; + int mRunNumber; + float d_bz; + + void init(InitContext&) + { + zvtx_bin_edges = std::vector(ConfVtxBins.value.begin(), ConfVtxBins.value.end()); + zvtx_bin_edges.erase(zvtx_bin_edges.begin()); + + cent_bin_edges = std::vector(ConfCentBins.value.begin(), ConfCentBins.value.end()); + cent_bin_edges.erase(cent_bin_edges.begin()); + + LOGF(info, "cfgOccupancyEstimator = %d", cfgOccupancyEstimator.value); + occ_bin_edges = std::vector(ConfOccupancyBins.value.begin(), ConfOccupancyBins.value.end()); + occ_bin_edges.erase(occ_bin_edges.begin()); + + emh1 = new MyEMH(ndepth); + emh2 = new MyEMH(ndepth); + + o2::aod::pwgem::photonmeson::utils::eventhistogram::addEventHistograms(&fRegistry); + addHistograms(); + + DefineEMEventCut(); + DefinePCMCut(); + DefineDileptonCut(); + + fRegistry.add("Diphoton/mix/hDiffBC", "diff. global BC in mixed event;|BC_{current} - BC_{mixed}|", kTH1D, {{10001, -0.5, 10000.5}}, true); + + mRunNumber = 0; + d_bz = 0; + + ccdb->setURL(ccdburl); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setFatalWhenNull(false); + rctChecker.init(eventcuts.cfgRCTLabel.value, eventcuts.cfgCheckZDC.value, eventcuts.cfgTreatLimitedAcceptanceAsBad.value); + } + + template + void initCCDB(TCollision const& collision) + { + if (mRunNumber == collision.runNumber()) { + return; + } + + // In case override, don't proceed, please - no CCDB access required + if (d_bz_input > -990) { + d_bz = d_bz_input; + o2::parameters::GRPMagField grpmag; + if (std::fabs(d_bz) > 1e-5) { + grpmag.setL3Current(30000.f / (d_bz / 5.0f)); + } + mRunNumber = collision.runNumber(); + return; + } + + auto run3grp_timestamp = collision.timestamp(); + o2::parameters::GRPObject* grpo = 0x0; + o2::parameters::GRPMagField* grpmag = 0x0; + if (!skipGRPOquery) + grpo = ccdb->getForTimeStamp(grpPath, run3grp_timestamp); + if (grpo) { + // Fetch magnetic field from ccdb for current collision + d_bz = grpo->getNominalL3Field(); + LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; + } else { + grpmag = ccdb->getForTimeStamp(grpmagPath, run3grp_timestamp); + if (!grpmag) { + LOG(fatal) << "Got nullptr from CCDB for path " << grpmagPath << " of object GRPMagField and " << grpPath << " of object GRPObject for timestamp " << run3grp_timestamp; + } + // Fetch magnetic field from ccdb for current collision + d_bz = std::lround(5.f * grpmag->getL3Current() / 30000.f); + LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; + } + mRunNumber = collision.runNumber(); + } + + ~DiphotonHadron2PC() + { + delete emh1; + emh1 = 0x0; + delete emh2; + emh2 = 0x0; + + used_photonIds.clear(); + used_photonIds.shrink_to_fit(); + used_dileptonIds.clear(); + used_dileptonIds.shrink_to_fit(); + map_mixed_eventId_to_globalBC.clear(); + } + + void addHistograms() + { + std::string mass_axis_title = "m_{#gamma#gamma} (GeV/c^{2})"; + std::string pair_pt_axis_title = "p_{T,#gamma#gamma} (GeV/c)"; + std::string deta_axis_title = "#Delta#eta = #eta_{#gamma#gamma} - #eta_{h}"; + std::string dphi_axis_title = "#Delta#varphi = #varphi_{#gamma#gamma} - #varphi_{h} (rad.)"; + std::string cosndphi_axis_title = std::format("cos({0:d}(#varphi_{{#gamma#gamma}} - #varphi_{{h}}))", cfgNmod.value); + + if constexpr (pairtype == PairType::kPCMDalitzEE) { + mass_axis_title = "m_{ee#gamma} (GeV/c^{2})"; + pair_pt_axis_title = "p_{T,ee#gamma} (GeV/c)"; + deta_axis_title = "#Delta#eta = #eta_{ee#gamma} - #eta_{h}"; + dphi_axis_title = "#Delta#varphi = #varphi_{ee#gamma} - #varphi_{h} (rad.)"; + cosndphi_axis_title = std::format("cos({0:d}(#varphi_{{ee#gamma}} - #varphi_{{h}}))", cfgNmod.value); + } + + // photon info + const AxisSpec axis_pt_single{ConfPtggBins, "p_{T,#gamma} (GeV/c)"}; + const AxisSpec axis_eta_single{40, -2, +2, "#eta_{#gamma}"}; + const AxisSpec axis_phi_single{36, 0, 2 * M_PI, "#varphi_{#gamma} (rad.)"}; + const AxisSpec axis_deta_single{ConfDEtaBins, "#Delta#eta = #eta_{#gamma} - #eta_{h}"}; + const AxisSpec axis_cos_ndphi_single{cfgNbinsCosNDPhi, -1, +1, std::format("cos({0:d}(#varphi_{{#gamma}} - #varphi_{{h}}))", cfgNmod.value)}; + + // diphoton info + const AxisSpec axis_mass{ConfMggBins, mass_axis_title}; + const AxisSpec axis_pt{ConfPtggBins, pair_pt_axis_title}; + + // diphoton-hadron info + const AxisSpec axis_pt_ref{ConfPtHadronBins, "p_{T,h}^{ref} (GeV/c)"}; + const AxisSpec axis_deta{ConfDEtaBins, deta_axis_title}; + const AxisSpec axis_cos_ndphi{cfgNbinsCosNDPhi, -1, +1, cosndphi_axis_title}; + + const AxisSpec axis_pt_trg{ConfPtHadronBins, "p_{T,h} (GeV/c)"}; + const AxisSpec axis_eta_trg{40, -2, +2, "#eta_{h}"}; + const AxisSpec axis_phi_trg{36, 0, 2 * M_PI, "#varphi_{h} (rad.)"}; + + fRegistry.add("Hadron/hs", "hadron", kTHnSparseD, {axis_pt_trg, axis_eta_trg, axis_phi_trg}, true); + fRegistry.add("Photon/hs", "photon", kTHnSparseD, {axis_pt_single, axis_eta_single, axis_phi_single}, true); + + fRegistry.add("Diphoton/same/hs", "diphoton", kTHnSparseD, {axis_mass, axis_pt}, true); + fRegistry.addClone("Diphoton/same/", "Diphoton/mix/"); + + fRegistry.add("DiphotonHadron/same/hs", "diphoton-hadron 2PC", kTHnSparseD, {axis_mass, axis_pt, axis_pt_ref, axis_deta, axis_cos_ndphi}, true); + fRegistry.add("PhotonHadron/same/hs", "photon-hadron 2PC", kTHnSparseD, {axis_pt_single, axis_pt_ref, axis_deta_single, axis_cos_ndphi_single}, true); + + // hadron-hadron + const AxisSpec axis_deta_hh{ConfDEtaBins, "#Delta#eta = #eta_{h}^{trg} - #eta_{h}^{ref}"}; + const AxisSpec axis_cosndphi_hh{cfgNbinsCosNDPhi, -1, +1, std::format("cos({0:d}(#varphi_{{h}}^{{trg}} - #varphi_{{h}}^{{ref}}))", cfgNmod.value)}; + fRegistry.add("HadronHadron/same/hs", "hadron-hadron 2PC", kTHnSparseD, {axis_pt_trg, axis_pt_ref, axis_deta_hh, axis_cosndphi_hh}, true); + } + + void DefineEMEventCut() + { + fEMEventCut = EMPhotonEventCut("fEMEventCut", "fEMEventCut"); + fEMEventCut.SetRequireSel8(eventcuts.cfgRequireSel8); + fEMEventCut.SetRequireFT0AND(eventcuts.cfgRequireFT0AND); + fEMEventCut.SetZvtxRange(eventcuts.cfgZvtxMin, +eventcuts.cfgZvtxMax); + fEMEventCut.SetRequireNoTFB(eventcuts.cfgRequireNoTFB); + fEMEventCut.SetRequireNoITSROFB(eventcuts.cfgRequireNoITSROFB); + fEMEventCut.SetRequireNoSameBunchPileup(eventcuts.cfgRequireNoSameBunchPileup); + fEMEventCut.SetRequireGoodZvtxFT0vsPV(eventcuts.cfgRequireGoodZvtxFT0vsPV); + } + + void DefinePCMCut() + { + fV0PhotonCut = V0PhotonCut("fV0PhotonCut", "fV0PhotonCut"); + + // for v0 + fV0PhotonCut.SetV0PtRange(pcmcuts.cfg_min_pt_v0, pcmcuts.cfg_max_pt_v0); + fV0PhotonCut.SetV0EtaRange(pcmcuts.cfg_min_eta_v0, pcmcuts.cfg_max_eta_v0); + fV0PhotonCut.SetMinCosPA(pcmcuts.cfg_min_cospa); + fV0PhotonCut.SetMaxPCA(pcmcuts.cfg_max_pca); + fV0PhotonCut.SetMaxChi2KF(pcmcuts.cfg_max_chi2kf); + fV0PhotonCut.SetRxyRange(pcmcuts.cfg_min_v0radius, pcmcuts.cfg_max_v0radius); + fV0PhotonCut.SetAPRange(pcmcuts.cfg_max_alpha_ap, pcmcuts.cfg_max_qt_ap); + fV0PhotonCut.RejectITSib(pcmcuts.cfg_reject_v0_on_itsib); + + // for track + fV0PhotonCut.SetMinNClustersTPC(pcmcuts.cfg_min_ncluster_tpc); + fV0PhotonCut.SetMinNCrossedRowsTPC(pcmcuts.cfg_min_ncrossedrows); + fV0PhotonCut.SetMinNCrossedRowsOverFindableClustersTPC(0.8); + fV0PhotonCut.SetMaxFracSharedClustersTPC(pcmcuts.cfg_max_frac_shared_clusters_tpc); + fV0PhotonCut.SetChi2PerClusterTPC(0.0, pcmcuts.cfg_max_chi2tpc); + fV0PhotonCut.SetTPCNsigmaElRange(pcmcuts.cfg_min_TPCNsigmaEl, pcmcuts.cfg_max_TPCNsigmaEl); + fV0PhotonCut.SetChi2PerClusterITS(-1e+10, pcmcuts.cfg_max_chi2its); + fV0PhotonCut.SetNClustersITS(0, 7); + fV0PhotonCut.SetMeanClusterSizeITSob(0.0, 16.0); + fV0PhotonCut.SetIsWithinBeamPipe(pcmcuts.cfg_require_v0_with_correct_xz); + fV0PhotonCut.SetDisableITSonly(pcmcuts.cfg_disable_itsonly_track); + fV0PhotonCut.SetDisableTPConly(pcmcuts.cfg_disable_tpconly_track); + fV0PhotonCut.SetRequireITSTPC(pcmcuts.cfg_require_v0_with_itstpc); + fV0PhotonCut.SetRequireITSonly(pcmcuts.cfg_require_v0_with_itsonly); + fV0PhotonCut.SetRequireTPConly(pcmcuts.cfg_require_v0_with_tpconly); + } + + void DefineDileptonCut() + { + fDileptonCut = DalitzEECut("fDileptonCut", "fDileptonCut"); + + // for pair + fDileptonCut.SetMeeRange(dileptoncuts.cfg_min_mass, dileptoncuts.cfg_max_mass); + fDileptonCut.SetMaxPhivPairMeeDep([&](float mll) { return (mll - dileptoncuts.cfg_phiv_intercept) / dileptoncuts.cfg_phiv_slope; }); + fDileptonCut.ApplyPhiV(dileptoncuts.cfg_apply_phiv); + fDileptonCut.RequireITSibAny(dileptoncuts.cfg_require_itsib_any); + fDileptonCut.RequireITSib1st(dileptoncuts.cfg_require_itsib_1st); + + // for track + fDileptonCut.SetTrackPtRange(dileptoncuts.cfg_min_pt_track, 1e+10f); + fDileptonCut.SetTrackEtaRange(-dileptoncuts.cfg_max_eta_track, +dileptoncuts.cfg_max_eta_track); + fDileptonCut.SetMinNClustersTPC(dileptoncuts.cfg_min_ncluster_tpc); + fDileptonCut.SetMinNCrossedRowsTPC(dileptoncuts.cfg_min_ncrossedrows); + fDileptonCut.SetMinNCrossedRowsOverFindableClustersTPC(0.8); + fDileptonCut.SetMaxFracSharedClustersTPC(dileptoncuts.cfg_max_frac_shared_clusters_tpc); + fDileptonCut.SetChi2PerClusterTPC(0.0, dileptoncuts.cfg_max_chi2tpc); + fDileptonCut.SetChi2PerClusterITS(0.0, dileptoncuts.cfg_max_chi2its); + fDileptonCut.SetNClustersITS(dileptoncuts.cfg_min_ncluster_its, 7); + fDileptonCut.SetMaxDcaXY(dileptoncuts.cfg_max_dcaxy); + fDileptonCut.SetMaxDcaZ(dileptoncuts.cfg_max_dcaz); + fDileptonCut.SetTrackDca3DRange(0.f, dileptoncuts.cfg_max_dca3dsigma_track); // in sigma + fDileptonCut.IncludeITSsa(false, 0.15); + + // for eID + fDileptonCut.SetPIDScheme(dileptoncuts.cfg_pid_scheme); + fDileptonCut.SetTPCNsigmaElRange(dileptoncuts.cfg_min_TPCNsigmaEl, dileptoncuts.cfg_max_TPCNsigmaEl); + fDileptonCut.SetTPCNsigmaPiRange(dileptoncuts.cfg_min_TPCNsigmaPi, dileptoncuts.cfg_max_TPCNsigmaPi); + fDileptonCut.SetTOFNsigmaElRange(dileptoncuts.cfg_min_TOFNsigmaEl, dileptoncuts.cfg_max_TOFNsigmaEl); + } + + SliceCache cache; + Preslice perCollision_pcm = aod::v0photonkf::emeventId; + Preslice perCollision_track = aod::emprimarytrack::emeventId; + + Preslice perCollision_electron = aod::emprimaryelectron::emeventId; + Partition positrons = o2::aod::emprimaryelectron::sign > int8_t(0) && static_cast(dileptoncuts.cfg_min_pt_track) < o2::aod::track::pt&& nabs(o2::aod::track::eta) < static_cast(dileptoncuts.cfg_max_eta_track) && static_cast(dileptoncuts.cfg_min_TPCNsigmaEl) < o2::aod::pidtpc::tpcNSigmaEl&& o2::aod::pidtpc::tpcNSigmaEl < static_cast(dileptoncuts.cfg_max_TPCNsigmaEl); + Partition electrons = o2::aod::emprimaryelectron::sign < int8_t(0) && static_cast(dileptoncuts.cfg_min_pt_track) < o2::aod::track::pt && nabs(o2::aod::track::eta) < static_cast(dileptoncuts.cfg_max_eta_track) && static_cast(dileptoncuts.cfg_min_TPCNsigmaEl) < o2::aod::pidtpc::tpcNSigmaEl && o2::aod::pidtpc::tpcNSigmaEl < static_cast(dileptoncuts.cfg_max_TPCNsigmaEl); + + using MyEMH = o2::aod::pwgem::dilepton::utils::EventMixingHandler, std::pair, EMTrack>; + MyEMH* emh1 = nullptr; + MyEMH* emh2 = nullptr; + std::vector> used_photonIds; // + std::vector> used_dileptonIds; // + std::map, uint64_t> map_mixed_eventId_to_globalBC; + + template + void runPairing(TCollisions const& collisions, + TPhotons1 const& photons1, TPhotons2 const& photons2, TSubInfos1 const&, TSubInfos2 const&, TPreslice1 const& perCollision1, TPreslice2 const& perCollision2, TCut1 const& cut1, TCut2 const& cut2, + TRefTracks const& refTracks) + { + for (const auto& collision : collisions) { + initCCDB(collision); + int ndiphoton = 0; + + const float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; + if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { + continue; + } + + o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<0>(&fRegistry, collision, 1.f); + if (!fEMEventCut.IsSelected(collision)) { + continue; + } + if (eventcuts.cfgRequireGoodRCT && !rctChecker.checkTable(collision)) { + continue; + } + o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<1>(&fRegistry, collision, 1.f); + fRegistry.fill(HIST("Event/before/hCollisionCounter"), 12.0, 1.f); // accepted + fRegistry.fill(HIST("Event/after/hCollisionCounter"), 12.0, 1.f); // accepted + + int zbin = lower_bound(zvtx_bin_edges.begin(), zvtx_bin_edges.end(), collision.posZ()) - zvtx_bin_edges.begin() - 1; + if (zbin < 0) { + zbin = 0; + } else if (static_cast(zvtx_bin_edges.size()) - 2 < zbin) { + zbin = static_cast(zvtx_bin_edges.size()) - 2; + } + + float centrality = centralities[cfgCentEstimator]; + int centbin = lower_bound(cent_bin_edges.begin(), cent_bin_edges.end(), centrality) - cent_bin_edges.begin() - 1; + if (centbin < 0) { + centbin = 0; + } else if (static_cast(cent_bin_edges.size()) - 2 < centbin) { + centbin = static_cast(cent_bin_edges.size()) - 2; + } + + int epbin = 0; + + int occbin = -1; + if (cfgOccupancyEstimator == 0) { + occbin = lower_bound(occ_bin_edges.begin(), occ_bin_edges.end(), collision.ft0cOccupancyInTimeRange()) - occ_bin_edges.begin() - 1; + } else if (cfgOccupancyEstimator == 1) { + occbin = lower_bound(occ_bin_edges.begin(), occ_bin_edges.end(), collision.trackOccupancyInTimeRange()) - occ_bin_edges.begin() - 1; + } else { + occbin = lower_bound(occ_bin_edges.begin(), occ_bin_edges.end(), collision.ft0cOccupancyInTimeRange()) - occ_bin_edges.begin() - 1; + } + + if (occbin < 0) { + occbin = 0; + } else if (static_cast(occ_bin_edges.size()) - 2 < occbin) { + occbin = static_cast(occ_bin_edges.size()) - 2; + } + + // LOGF(info, "collision.globalIndex() = %d, collision.posZ() = %f, centrality = %f, ep2 = %f, collision.trackOccupancyInTimeRange() = %d, zbin = %d, centbin = %d, epbin = %d, occbin = %d", collision.globalIndex(), collision.posZ(), centrality, ep2, collision.trackOccupancyInTimeRange(), zbin, centbin, epbin, occbin); + + auto refTracks_per_collision = refTracks.sliceBy(perCollision_track, collision.globalIndex()); + for (const auto& track : refTracks_per_collision) { + fRegistry.fill(HIST("Hadron/hs"), track.pt(), track.eta(), track.phi()); + } + + for (const auto& [trg, ref] : combinations(CombinationsStrictlyUpperIndexPolicy(refTracks_per_collision, refTracks_per_collision))) { + float deta = trg.eta() - ref.eta(); + float dphi = trg.phi() - ref.phi(); + o2::math_utils::bringTo02Pi(dphi); + fRegistry.fill(HIST("HadronHadron/same/hs"), trg.pt(), ref.pt(), deta, std::cos(cfgNmod * dphi)); + } + + std::tuple key_bin = std::make_tuple(zbin, centbin, epbin, occbin); + std::pair key_df_collision = std::make_pair(ndf, collision.globalIndex()); + + if constexpr (pairtype == PairType::kPCMPCM) { // same kinds pairing + auto photons1_per_collision = photons1.sliceBy(perCollision1, collision.globalIndex()); + auto photons2_per_collision = photons2.sliceBy(perCollision2, collision.globalIndex()); + + for (const auto& photon : photons1_per_collision) { // single photon + if (cut1.template IsSelected(photon)) { + fRegistry.fill(HIST("Photon/hs"), photon.pt(), photon.eta(), photon.phi()); + for (const auto& track : refTracks_per_collision) { + float deta = photon.eta() - track.eta(); + float dphi = photon.phi() - track.phi(); + o2::math_utils::bringTo02Pi(dphi); + + fRegistry.fill(HIST("PhotonHadron/same/hs"), photon.pt(), track.pt(), deta, std::cos(cfgNmod * dphi)); + } // end of ref track loop + } + } // end of photon loop + + for (const auto& [g1, g2] : combinations(CombinationsStrictlyUpperIndexPolicy(photons1_per_collision, photons2_per_collision))) { + if (!cut1.template IsSelected(g1) || !cut2.template IsSelected(g2)) { + continue; + } + + ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.); + ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), 0.); + ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; + if (std::fabs(v12.Rapidity()) > maxY) { + continue; + } + + fRegistry.fill(HIST("Diphoton/same/hs"), v12.M(), v12.Pt()); + + for (const auto& track : refTracks_per_collision) { + ROOT::Math::PtEtaPhiMVector v3(track.pt(), track.eta(), track.phi(), 0.139); + float deta = v12.Eta() - v3.Eta(); + float dphi = v12.Phi() - v3.Phi(); + o2::math_utils::bringTo02Pi(dphi); + fRegistry.fill(HIST("DiphotonHadron/same/hs"), v12.M(), v12.Pt(), v3.Pt(), deta, std::cos(cfgNmod * dphi)); + } // end of ref track loop + + std::pair pair_tmp_id1 = std::make_pair(ndf, g1.globalIndex()); + std::pair pair_tmp_id2 = std::make_pair(ndf, g2.globalIndex()); + + if (std::find(used_photonIds.begin(), used_photonIds.end(), pair_tmp_id1) == used_photonIds.end()) { + emh1->AddTrackToEventPool(key_df_collision, EMTrack(-1, g1.globalIndex(), collision.globalIndex(), g1.globalIndex(), g1.pt(), g1.eta(), g1.phi(), 0)); + used_photonIds.emplace_back(pair_tmp_id1); + } + if (std::find(used_photonIds.begin(), used_photonIds.end(), pair_tmp_id2) == used_photonIds.end()) { + emh1->AddTrackToEventPool(key_df_collision, EMTrack(-1, g2.globalIndex(), collision.globalIndex(), g2.globalIndex(), g2.pt(), g2.eta(), g2.phi(), 0)); + used_photonIds.emplace_back(pair_tmp_id2); + } + ndiphoton++; + } // end of pairing loop + } else if constexpr (pairtype == PairType::kPCMDalitzEE) { + auto photons1_per_collision = photons1.sliceBy(perCollision1, collision.globalIndex()); + auto positrons_per_collision = positrons->sliceByCached(o2::aod::emprimaryelectron::emeventId, collision.globalIndex(), cache); + auto electrons_per_collision = electrons->sliceByCached(o2::aod::emprimaryelectron::emeventId, collision.globalIndex(), cache); + + for (const auto& photon : photons1_per_collision) { // single photon + if (cut1.template IsSelected(photon)) { + fRegistry.fill(HIST("Photon/hs"), photon.pt(), photon.eta(), photon.phi()); + for (const auto& track : refTracks_per_collision) { + float deta = photon.eta() - track.eta(); + float dphi = photon.phi() - track.phi(); + o2::math_utils::bringTo02Pi(dphi); + + fRegistry.fill(HIST("PhotonHadron/same/hs"), photon.pt(), track.pt(), deta, std::cos(cfgNmod * dphi)); + } // end of ref track loop + } + } // end of photon loop + + for (const auto& g1 : photons1_per_collision) { + if (!cut1.template IsSelected(g1)) { + continue; + } + auto pos1 = g1.template posTrack_as(); + auto ele1 = g1.template negTrack_as(); + ROOT::Math::PtEtaPhiMVector v_gamma(g1.pt(), g1.eta(), g1.phi(), 0.); + + for (const auto& [pos2, ele2] : combinations(CombinationsFullIndexPolicy(positrons_per_collision, electrons_per_collision))) { + + if (pos2.trackId() == ele2.trackId()) { // this is protection against pairing identical 2 tracks. + continue; + } + if (pos1.trackId() == pos2.trackId() || ele1.trackId() == ele2.trackId()) { + continue; + } + + if (!cut2.template IsSelectedTrack(pos2, collision) || !cut2.template IsSelectedTrack(ele2, collision)) { + continue; + } + + if (!cut2.IsSelectedPair(pos2, ele2, d_bz)) { + continue; + } + + ROOT::Math::PtEtaPhiMVector v_pos(pos2.pt(), pos2.eta(), pos2.phi(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector v_ele(ele2.pt(), ele2.eta(), ele2.phi(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector v_ee = v_pos + v_ele; + ROOT::Math::PtEtaPhiMVector veeg = v_gamma + v_pos + v_ele; + if (std::fabs(veeg.Rapidity()) > maxY) { + continue; + } + + fRegistry.fill(HIST("Diphoton/same/hs"), veeg.M(), veeg.Pt()); + for (const auto& track : refTracks_per_collision) { + ROOT::Math::PtEtaPhiMVector v3(track.pt(), track.eta(), track.phi(), 0.139); + float deta = veeg.Eta() - v3.Eta(); + float dphi = veeg.Phi() - v3.Phi(); + o2::math_utils::bringTo02Pi(dphi); + fRegistry.fill(HIST("DiphotonHadron/same/hs"), veeg.M(), veeg.Pt(), v3.Pt(), deta, std::cos(cfgNmod * dphi)); + } // end of ref track loop + + std::pair pair_tmp_id1 = std::make_pair(ndf, g1.globalIndex()); + std::tuple tuple_tmp_id2 = std::make_tuple(ndf, collision.globalIndex(), pos2.trackId(), ele2.trackId()); + if (std::find(used_photonIds.begin(), used_photonIds.end(), pair_tmp_id1) == used_photonIds.end()) { + emh1->AddTrackToEventPool(key_df_collision, EMTrack(-1, g1.globalIndex(), collision.globalIndex(), -1, g1.pt(), g1.eta(), g1.phi(), 0)); + used_photonIds.emplace_back(pair_tmp_id1); + } + if (std::find(used_dileptonIds.begin(), used_dileptonIds.end(), tuple_tmp_id2) == used_dileptonIds.end()) { + emh2->AddTrackToEventPool(key_df_collision, EMTrack(-1, -1, collision.globalIndex(), -1, v_ee.Pt(), v_ee.Eta(), v_ee.Phi(), v_ee.M())); + used_dileptonIds.emplace_back(tuple_tmp_id2); + } + ndiphoton++; + } // end of dielectron loop + } // end of g1 loop + } // end of pairing in same event + + // event mixing + if (!cfgDoMix || !(ndiphoton > 0)) { + continue; + } + + // make a vector of selected photons in this collision. + auto selected_photons1_in_this_event = emh1->GetTracksPerCollision(key_df_collision); + auto selected_photons2_in_this_event = emh2->GetTracksPerCollision(key_df_collision); + + auto collisionIds1_in_mixing_pool = emh1->GetCollisionIdsFromEventPool(key_bin); + auto collisionIds2_in_mixing_pool = emh2->GetCollisionIdsFromEventPool(key_bin); + + if constexpr (pairtype == PairType::kPCMPCM) { // same kinds pairing + for (const auto& mix_dfId_collisionId : collisionIds1_in_mixing_pool) { + int mix_dfId = mix_dfId_collisionId.first; + int64_t mix_collisionId = mix_dfId_collisionId.second; + + if (collision.globalIndex() == mix_collisionId && ndf == mix_dfId) { // this never happens. only protection. + continue; + } + + auto globalBC_mix = map_mixed_eventId_to_globalBC[mix_dfId_collisionId]; + uint64_t diffBC = std::max(collision.globalBC(), globalBC_mix) - std::min(collision.globalBC(), globalBC_mix); + fRegistry.fill(HIST("Diphoton/mix/hDiffBC"), diffBC); + if (diffBC < ndiff_bc_mix) { + continue; + } + + auto photons1_from_event_pool = emh1->GetTracksPerCollision(mix_dfId_collisionId); + // LOGF(info, "Do event mixing: current event (%d, %d), ngamma = %d | event pool (%d, %d), ngamma = %d", ndf, collision.globalIndex(), selected_photons1_in_this_event.size(), mix_dfId, mix_collisionId, photons1_from_event_pool.size()); + + for (const auto& g1 : selected_photons1_in_this_event) { + for (const auto& g2 : photons1_from_event_pool) { + ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.); + ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), 0.); + ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; + if (std::fabs(v12.Rapidity()) > maxY) { + continue; + } + + fRegistry.fill(HIST("Diphoton/mix/hs"), v12.M(), v12.Pt(), 1.f); + } + } + } // end of loop over mixed event pool + + } else { // [photon1 from event1, photon2 from event2] and [photon1 from event2, photon2 from event1] + for (const auto& mix_dfId_collisionId : collisionIds2_in_mixing_pool) { + int mix_dfId = mix_dfId_collisionId.first; + int64_t mix_collisionId = mix_dfId_collisionId.second; + + if (collision.globalIndex() == mix_collisionId && ndf == mix_dfId) { // this never happens. only protection. + continue; + } + + auto globalBC_mix = map_mixed_eventId_to_globalBC[mix_dfId_collisionId]; + uint64_t diffBC = std::max(collision.globalBC(), globalBC_mix) - std::min(collision.globalBC(), globalBC_mix); + fRegistry.fill(HIST("Diphoton/mix/hDiffBC"), diffBC); + if (diffBC < ndiff_bc_mix) { + continue; + } + + auto photons2_from_event_pool = emh2->GetTracksPerCollision(mix_dfId_collisionId); + // LOGF(info, "Do event mixing: current event (%d, %d), ngamma = %d | event pool (%d, %d), nll = %d", ndf, collision.globalIndex(), selected_photons1_in_this_event.size(), mix_dfId, mix_collisionId, photons2_from_event_pool.size()); + + for (const auto& g1 : selected_photons1_in_this_event) { + for (const auto& g2 : photons2_from_event_pool) { + ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.); + ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), 0.); + if constexpr (pairtype == PairType::kPCMDalitzEE) { //[photon from event1, dilepton from event2] and [photon from event2, dilepton from event1] + v2.SetM(g2.mass()); + } + ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; + if (std::fabs(v12.Rapidity()) > maxY) { + continue; + } + fRegistry.fill(HIST("Diphoton/mix/hs"), v12.M(), v12.Pt(), 1.f); + } + } + } // end of loop over mixed event pool + for (const auto& mix_dfId_collisionId : collisionIds1_in_mixing_pool) { + int mix_dfId = mix_dfId_collisionId.first; + int64_t mix_collisionId = mix_dfId_collisionId.second; + + if (collision.globalIndex() == mix_collisionId && ndf == mix_dfId) { // this never happens. only protection. + continue; + } + + auto globalBC_mix = map_mixed_eventId_to_globalBC[mix_dfId_collisionId]; + uint64_t diffBC = std::max(collision.globalBC(), globalBC_mix) - std::min(collision.globalBC(), globalBC_mix); + fRegistry.fill(HIST("Diphoton/mix/hDiffBC"), diffBC); + if (diffBC < ndiff_bc_mix) { + continue; + } + + auto photons1_from_event_pool = emh1->GetTracksPerCollision(mix_dfId_collisionId); + // LOGF(info, "Do event mixing: current event (%d, %d), nll = %d | event pool (%d, %d), ngamma = %d", ndf, collision.globalIndex(), selected_photons2_in_this_event.size(), mix_dfId, mix_collisionId, photons1_from_event_pool.size()); + + for (const auto& g1 : selected_photons2_in_this_event) { + for (const auto& g2 : photons1_from_event_pool) { + ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.); + ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), 0.); + if constexpr (pairtype == PairType::kPCMDalitzEE) { //[photon from event1, dilepton from event2] and [photon from event2, dilepton from event1] + v1.SetM(g1.mass()); + } + ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; + if (std::fabs(v12.Rapidity()) > maxY) { + continue; + } + fRegistry.fill(HIST("Diphoton/mix/hs"), v12.M(), v12.Pt(), 1.f); + } + } + } // end of loop over mixed event pool + } + + if (ndiphoton > 0) { + emh1->AddCollisionIdAtLast(key_bin, key_df_collision); + emh2->AddCollisionIdAtLast(key_bin, key_df_collision); + map_mixed_eventId_to_globalBC[key_df_collision] = collision.globalBC(); + } + + } // end of collision loop + } + + Filter collisionFilter_occupancy_track = eventcuts.cfgTrackOccupancyMin <= o2::aod::evsel::trackOccupancyInTimeRange && o2::aod::evsel::trackOccupancyInTimeRange < eventcuts.cfgTrackOccupancyMax; + Filter collisionFilter_occupancy_ft0c = eventcuts.cfgFT0COccupancyMin <= o2::aod::evsel::ft0cOccupancyInTimeRange && o2::aod::evsel::ft0cOccupancyInTimeRange < eventcuts.cfgFT0COccupancyMax; + Filter collisionFilter_centrality = (cfgCentMin < o2::aod::cent::centFT0M && o2::aod::cent::centFT0M < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0A && o2::aod::cent::centFT0A < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0C && o2::aod::cent::centFT0C < cfgCentMax); + using FilteredMyCollisions = soa::Filtered; + + Filter prefilter_pcm = ifnode(pcmcuts.cfg_apply_cuts_from_prefilter_derived.node(), o2::aod::v0photonkf::pfbderived == static_cast(0), true); + Filter prefilter_primaryelectron = ifnode(dileptoncuts.cfg_apply_cuts_from_prefilter_derived.node(), o2::aod::emprimaryelectron::pfbderived == static_cast(0), true); + + int ndf = 0; + void processAnalysis(FilteredMyCollisions const& collisions, MyTracks const& refTracks, Types const&... args) + { + // LOGF(info, "ndf = %d", ndf); + if constexpr (pairtype == PairType::kPCMPCM) { + auto v0photons = std::get<0>(std::tie(args...)); + auto v0legs = std::get<1>(std::tie(args...)); + runPairing(collisions, v0photons, v0photons, v0legs, v0legs, perCollision_pcm, perCollision_pcm, fV0PhotonCut, fV0PhotonCut, refTracks); + } else if constexpr (pairtype == PairType::kPCMDalitzEE) { + auto v0photons = std::get<0>(std::tie(args...)); + auto v0legs = std::get<1>(std::tie(args...)); + auto emprimaryelectrons = std::get<2>(std::tie(args...)); + // LOGF(info, "electrons.size() = %d, positrons.size() = %d", electrons.size(), positrons.size()); + runPairing(collisions, v0photons, emprimaryelectrons, v0legs, emprimaryelectrons, perCollision_pcm, perCollision_electron, fV0PhotonCut, fDileptonCut, refTracks); + } + ndf++; + } + PROCESS_SWITCH(DiphotonHadron2PC, processAnalysis, "process pair analysis", false); + + void processDummy(MyCollisions const&) {} + PROCESS_SWITCH(DiphotonHadron2PC, processDummy, "Dummy function", true); +}; +#endif // PWGEM_PHOTONMESON_CORE_DIPHOTONHADRON2PC_H_ diff --git a/PWGEM/PhotonMeson/TableProducer/createEMEventPhoton.cxx b/PWGEM/PhotonMeson/TableProducer/createEMEventPhoton.cxx index fc155fe5502..e1438f423ad 100644 --- a/PWGEM/PhotonMeson/TableProducer/createEMEventPhoton.cxx +++ b/PWGEM/PhotonMeson/TableProducer/createEMEventPhoton.cxx @@ -14,23 +14,22 @@ /// /// \author Daiki Sekihata, daiki.sekihata@cern.ch -#include - -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" -#include "ReconstructionDataFormats/Track.h" +#include "PWGEM/PhotonMeson/DataModel/gammaTables.h" +#include "PWGJE/DataModel/Jet.h" -#include "DetectorsBase/GeometryManager.h" -#include "DataFormatsParameters/GRPObject.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "CCDB/BasicCCDBManager.h" #include "Common/CCDB/TriggerAliases.h" -#include "PWGEM/PhotonMeson/DataModel/gammaTables.h" +#include "CCDB/BasicCCDBManager.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "DataFormatsParameters/GRPObject.h" +#include "DetectorsBase/GeometryManager.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/Track.h" -#include "PWGJE/DataModel/Jet.h" +#include using namespace o2; using namespace o2::framework; @@ -40,10 +39,14 @@ using namespace o2::soa; using MyBCs = soa::Join; using MyQvectors = soa::Join; -using MyCollisions = soa::Join; +using MyCollisions = soa::Join; using MyCollisionsCent = soa::Join; // centrality table has dependency on multiplicity table. using MyCollisionsCentQvec = soa::Join; +using MyCollisionsWithSWT = soa::Join; +using MyCollisionsWithSWT_Cent = soa::Join; // centrality table has dependency on multiplicity table. +using MyCollisionsWithSWT_Cent_Qvec = soa::Join; + using MyCollisionsMC = soa::Join; using MyCollisionsMCCent = soa::Join; // centrality table has dependency on multiplicity table. using MyCollisionsMCCentQvec = soa::Join; @@ -54,12 +57,14 @@ struct CreateEMEventPhoton { Produces eventMult; Produces eventCent; Produces eventQvec; + Produces emswtbit; + Produces event_norm_info; Produces eventWeights; enum class EMEventType : int { kEvent = 0, - kEventCent = 1, - kEventCent_Qvec = 2, + kEvent_Cent = 1, + kEvent_Cent_Qvec = 2, kEvent_JJ = 3, }; @@ -129,7 +134,7 @@ struct CreateEMEventPhoton { mRunNumber = bc.runNumber(); } - template + template void skimEvent(TCollisions const& collisions, TBCs const&) { for (const auto& collision : collisions) { @@ -152,6 +157,26 @@ struct CreateEMEventPhoton { continue; } + if constexpr (eventtype == EMEventType::kEvent) { + event_norm_info(collision.alias_raw(), collision.selection_raw(), collision.rct_raw(), static_cast(10.f * collision.posZ()), 105.f); + } else if constexpr (eventtype == EMEventType::kEvent_Cent || eventtype == EMEventType::kEvent_Cent_Qvec) { + event_norm_info(collision.alias_raw(), collision.selection_raw(), collision.rct_raw(), static_cast(10.f * collision.posZ()), collision.centFT0C()); + } else { + event_norm_info(collision.alias_raw(), collision.selection_raw(), collision.rct_raw(), static_cast(10.f * collision.posZ()), 105.f); + } + + if (!collision.isEoI()) { // events with at least 1 photon for data reduction. + continue; + } + + if constexpr (isTriggerAnalysis) { + if (collision.swtaliastmp_raw() == 0) { + continue; + } else { + emswtbit(collision.swtaliastmp_raw(), collision.nInspectedTVX()); + } + } + const float qDefault = 999.f; // default value for q vectors if not obtained registry.fill(HIST("hEventCounter"), 1); @@ -168,19 +193,19 @@ struct CreateEMEventPhoton { eventMult(collision.multFT0A(), collision.multFT0C(), collision.multNTracksPV(), collision.multNTracksPVeta1(), collision.multNTracksPVetaHalf()); - if constexpr (eventype != EMEventType::kEvent_JJ) { + if constexpr (eventtype != EMEventType::kEvent_JJ) { eventWeights(1.f); } - if constexpr (eventype == EMEventType::kEvent) { + if constexpr (eventtype == EMEventType::kEvent) { eventCent(105.f, 105.f, 105.f); eventQvec(qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault); - } else if constexpr (eventype == EMEventType::kEventCent) { + } else if constexpr (eventtype == EMEventType::kEvent_Cent) { eventCent(collision.centFT0M(), collision.centFT0A(), collision.centFT0C()); eventQvec(qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault, qDefault); - } else if constexpr (eventype == EMEventType::kEventCent_Qvec) { + } else if constexpr (eventtype == EMEventType::kEvent_Cent_Qvec) { eventCent(collision.centFT0M(), collision.centFT0A(), collision.centFT0C()); const size_t qvecSize = collision.qvecFT0CReVec().size(); if (qvecSize >= 2) { // harmonics 2,3 @@ -232,46 +257,66 @@ struct CreateEMEventPhoton { } } + // for data void processEvent(MyCollisions const& collisions, MyBCs const& bcs) { - skimEvent(collisions, bcs); + skimEvent(collisions, bcs); } PROCESS_SWITCH(CreateEMEventPhoton, processEvent, "process event info", false); - void processEventMC(MyCollisionsMC const& collisions, MyBCs const& bcs) + void processEvent_Cent(MyCollisionsCent const& collisions, MyBCs const& bcs) { - skimEvent(collisions, bcs); + skimEvent(collisions, bcs); } - PROCESS_SWITCH(CreateEMEventPhoton, processEventMC, "process event info", false); + PROCESS_SWITCH(CreateEMEventPhoton, processEvent_Cent, "process event info", false); - void processEventJJMC(MyCollisionsMC const& collisions, MyJJCollisions const& mcCollisions, MyBCs const& bcs, aod::FullMCParticleLevelJets const& jets) + void processEvent_Cent_Qvec(MyCollisionsCentQvec const& collisions, MyBCs const& bcs) { - skimEvent(collisions, bcs); - fillEventWeights(collisions, mcCollisions, bcs, jets); + skimEvent(collisions, bcs); } - PROCESS_SWITCH(CreateEMEventPhoton, processEventJJMC, "process event info", false); + PROCESS_SWITCH(CreateEMEventPhoton, processEvent_Cent_Qvec, "process event info", false); - void processEvent_Cent(MyCollisionsCent const& collisions, MyBCs const& bcs) + void processEvent_SWT(MyCollisionsWithSWT const& collisions, MyBCs const& bcs) { - skimEvent(collisions, bcs); + skimEvent(collisions, bcs); } - PROCESS_SWITCH(CreateEMEventPhoton, processEvent_Cent, "process event info", false); + PROCESS_SWITCH(CreateEMEventPhoton, processEvent_SWT, "process event info", false); - void processEvent_Cent_Qvec(MyCollisionsCentQvec const& collisions, MyBCs const& bcs) + void processEvent_SWT_Cent(MyCollisionsWithSWT_Cent const& collisions, MyBCs const& bcs) { - skimEvent(collisions, bcs); + skimEvent(collisions, bcs); } - PROCESS_SWITCH(CreateEMEventPhoton, processEvent_Cent_Qvec, "process event info", false); + PROCESS_SWITCH(CreateEMEventPhoton, processEvent_SWT_Cent, "process event info", false); + + void processEvent_SWT_Cent_Qvec(MyCollisionsWithSWT_Cent_Qvec const& collisions, MyBCs const& bcs) + { + skimEvent(collisions, bcs); + } + PROCESS_SWITCH(CreateEMEventPhoton, processEvent_SWT_Cent_Qvec, "process event info", false); + + // for MC + void processEventMC(MyCollisionsMC const& collisions, MyBCs const& bcs) + { + skimEvent(collisions, bcs); + } + PROCESS_SWITCH(CreateEMEventPhoton, processEventMC, "process event info", false); + + void processEventJJMC(MyCollisionsMC const& collisions, MyJJCollisions const& mcCollisions, MyBCs const& bcs, aod::FullMCParticleLevelJets const& jets) + { + skimEvent(collisions, bcs); + fillEventWeights(collisions, mcCollisions, bcs, jets); + } + PROCESS_SWITCH(CreateEMEventPhoton, processEventJJMC, "process event info", false); void processEventMC_Cent(MyCollisionsMCCent const& collisions, MyBCs const& bcs) { - skimEvent(collisions, bcs); + skimEvent(collisions, bcs); } PROCESS_SWITCH(CreateEMEventPhoton, processEventMC_Cent, "process event info", false); void processEventMC_Cent_Qvec(MyCollisionsMCCentQvec const& collisions, MyBCs const& bcs) { - skimEvent(collisions, bcs); + skimEvent(collisions, bcs); } PROCESS_SWITCH(CreateEMEventPhoton, processEventMC_Cent_Qvec, "process event info", false); @@ -281,7 +326,6 @@ struct CreateEMEventPhoton { struct AssociatePhotonToEMEvent { Produces v0kfeventid; Produces prmeleventid; - Produces prmmueventid; Produces phoseventid; Produces emceventid; diff --git a/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryElectronFromDalitzEE.cxx b/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryElectronFromDalitzEE.cxx index 986bfba6bd6..bdd24cbfd90 100644 --- a/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryElectronFromDalitzEE.cxx +++ b/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryElectronFromDalitzEE.cxx @@ -43,6 +43,8 @@ using namespace o2::constants::physics; using namespace o2::pwgem::photonmeson; using MyCollisions = soa::Join; +using MyCollisionsWithSWT = soa::Join; + using MyCollisionsMC = soa::Join; using MyTracks = soa::Join; using MyTrack = MyTracks::iterator; @@ -97,6 +99,10 @@ struct skimmerPrimaryElectronFromDalitzEE { void init(InitContext&) { + if (doprocessRec && doprocessRec_SWT) { + LOGF(fatal, "Cannot enable doprocessRec and doprocessRec_SWT at the same time. Please choose one."); + } + mRunNumber = 0; d_bz = 0; @@ -457,6 +463,40 @@ struct skimmerPrimaryElectronFromDalitzEE { } PROCESS_SWITCH(skimmerPrimaryElectronFromDalitzEE, processRec, "process reconstructed info only", true); // standalone + void processRec_SWT(MyCollisionsWithSWT const& collisions, aod::BCsWithTimestamps const&, MyFilteredTracks const& tracks) + { + stored_trackIds.reserve(tracks.size()); + + for (const auto& collision : collisions) { + auto bc = collision.template foundBC_as(); + initCCDB(bc); + if (!collision.isSelected()) { + continue; + } + + if (collision.ngpcm() < 1) { + continue; + } + + if (collision.swtaliastmp_raw() == 0) { + continue; + } + + auto posTracks_per_coll = posTracks->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache); + auto negTracks_per_coll = negTracks->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache); + + fillPairInfo(collision, posTracks_per_coll, negTracks_per_coll); // ULS + if (fillLS) { + fillPairInfo(collision, posTracks_per_coll, posTracks_per_coll); // LS++ + fillPairInfo(collision, negTracks_per_coll, negTracks_per_coll); // LS-- + } + } // end of collision loop + + stored_trackIds.clear(); + stored_trackIds.shrink_to_fit(); + } + PROCESS_SWITCH(skimmerPrimaryElectronFromDalitzEE, processRec_SWT, "process reconstructed info with CEFP", false); // with cefp + using MyFilteredTracksMC = soa::Filtered; Partition posTracksMC = o2::aod::track::signed1Pt > 0.f; Partition negTracksMC = o2::aod::track::signed1Pt < 0.f; diff --git a/PWGEM/PhotonMeson/Tasks/CMakeLists.txt b/PWGEM/PhotonMeson/Tasks/CMakeLists.txt index f06ad37b67a..2293f384857 100644 --- a/PWGEM/PhotonMeson/Tasks/CMakeLists.txt +++ b/PWGEM/PhotonMeson/Tasks/CMakeLists.txt @@ -149,3 +149,13 @@ o2physics_add_dpl_workflow(tagging-pi0-mc-pcmdalitzee PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGEMPhotonMesonCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(diphoton-hadron-2pc-pcmpcm + SOURCES diphotonHadron2PCPCMPCM.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGEMPhotonMesonCore + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(diphoton-hadron-2pc-pcmdalitzee + SOURCES diphotonHadron2PCPCMDalitzEE.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGEMPhotonMesonCore + COMPONENT_NAME Analysis) + diff --git a/PWGEM/PhotonMeson/Tasks/diphotonHadron2PCPCMDalitzEE.cxx b/PWGEM/PhotonMeson/Tasks/diphotonHadron2PCPCMDalitzEE.cxx new file mode 100644 index 00000000000..6856ec72227 --- /dev/null +++ b/PWGEM/PhotonMeson/Tasks/diphotonHadron2PCPCMDalitzEE.cxx @@ -0,0 +1,36 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// +// ======================== +// +// This code loops over photons and makes pairs for neutral mesons analyses. +// Please write to: daiki.sekihata@cern.ch + +#include "PWGEM/PhotonMeson/Core/DiphotonHadron2PC.h" +#include "PWGEM/PhotonMeson/DataModel/gammaTables.h" +#include "PWGEM/PhotonMeson/Utils/PairUtilities.h" + +#include "Common/Core/RecoDecay.h" + +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" + +using namespace o2; +using namespace o2::aod; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask>(cfgc, TaskName{"diphoton-hadron-2pc-pcmdalitzee"}), + }; +} diff --git a/PWGEM/PhotonMeson/Tasks/diphotonHadron2PCPCMPCM.cxx b/PWGEM/PhotonMeson/Tasks/diphotonHadron2PCPCMPCM.cxx new file mode 100644 index 00000000000..7597de252ac --- /dev/null +++ b/PWGEM/PhotonMeson/Tasks/diphotonHadron2PCPCMPCM.cxx @@ -0,0 +1,34 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// +// ======================== +// +// This code loops over photons and makes pairs for neutral mesons analyses. +// Please write to: daiki.sekihata@cern.ch + +#include "PWGEM/PhotonMeson/Core/DiphotonHadron2PC.h" +#include "PWGEM/PhotonMeson/DataModel/gammaTables.h" +#include "PWGEM/PhotonMeson/Utils/PairUtilities.h" + +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" + +using namespace o2; +using namespace o2::aod; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask>(cfgc, TaskName{"diphoton-hadron-2pc-pcmpcm"}), + }; +} diff --git a/PWGEM/PhotonMeson/Tasks/prefilterPhoton.cxx b/PWGEM/PhotonMeson/Tasks/prefilterPhoton.cxx index 4b0ce098f6c..ecc1eb34329 100644 --- a/PWGEM/PhotonMeson/Tasks/prefilterPhoton.cxx +++ b/PWGEM/PhotonMeson/Tasks/prefilterPhoton.cxx @@ -14,32 +14,33 @@ // This code produces information on prefilter for photon. // Please write to: daiki.sekihata@cern.ch -#include -#include -#include #include +#include #include +#include +#include // #include "TString.h" -#include "Math/Vector4D.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" #include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" + +#include "Math/Vector4D.h" // #include "Common/Core/RecoDecay.h" +#include "PWGEM/Dilepton/Utils/PairUtilities.h" +#include "PWGEM/PhotonMeson/Core/DalitzEECut.h" +#include "PWGEM/PhotonMeson/Core/EMPhotonEventCut.h" +#include "PWGEM/PhotonMeson/Core/V0PhotonCut.h" +#include "PWGEM/PhotonMeson/DataModel/gammaTables.h" +#include "PWGEM/PhotonMeson/Utils/PairUtilities.h" + #include "Common/Core/trackUtilities.h" -#include "DetectorsBase/Propagator.h" -#include "DetectorsBase/GeometryManager.h" -#include "DataFormatsParameters/GRPObject.h" -#include "DataFormatsParameters/GRPMagField.h" #include "CCDB/BasicCCDBManager.h" - -#include "PWGEM/PhotonMeson/DataModel/gammaTables.h" -#include "PWGEM/PhotonMeson/Utils/PairUtilities.h" -#include "PWGEM/PhotonMeson/Core/V0PhotonCut.h" -#include "PWGEM/PhotonMeson/Core/EMPhotonEventCut.h" -#include "PWGEM/PhotonMeson/Core/DalitzEECut.h" -#include "PWGEM/Dilepton/Utils/PairUtilities.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "DataFormatsParameters/GRPObject.h" +#include "DetectorsBase/GeometryManager.h" +#include "DetectorsBase/Propagator.h" using namespace o2; using namespace o2::aod; @@ -51,7 +52,7 @@ using namespace o2::aod::pwgem::photonmeson::photonpair; using MyCollisions = soa::Join; using MyCollision = MyCollisions::iterator; -using MyV0Photons = soa::Join; +using MyV0Photons = soa::Join; using MyV0Photon = MyV0Photons::iterator; using MyPrimaryElectrons = soa::Join; diff --git a/PWGEM/PhotonMeson/Utils/EventHistograms.h b/PWGEM/PhotonMeson/Utils/EventHistograms.h index 779f2701888..33ea324fc31 100644 --- a/PWGEM/PhotonMeson/Utils/EventHistograms.h +++ b/PWGEM/PhotonMeson/Utils/EventHistograms.h @@ -38,13 +38,34 @@ void addEventHistograms(HistogramRegistry* fRegistry) hCollisionCounter->GetXaxis()->SetBinLabel(11, "EMC L0 Triggered"); hCollisionCounter->GetXaxis()->SetBinLabel(12, "accepted"); + const AxisSpec axis_cent_ft0m{{0, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110}, + "centrality FT0M (%)"}; + + const AxisSpec axis_cent_ft0a{{0, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110}, + "centrality FT0A (%)"}; + + const AxisSpec axis_cent_ft0c{{0, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110}, + "centrality FT0C (%)"}; + fRegistry->add("Event/before/hZvtx", "vertex z; Z_{vtx} (cm)", kTH1F, {{100, -50, +50}}, false); fRegistry->add("Event/before/hMultNTracksPV", "hMultNTracksPV; N_{track} to PV", kTH1F, {{6001, -0.5, 6000.5}}, false); fRegistry->add("Event/before/hMultNTracksPVeta1", "hMultNTracksPVeta1; N_{track} to PV", kTH1F, {{6001, -0.5, 6000.5}}, false); fRegistry->add("Event/before/hMultFT0", "hMultFT0;mult. FT0A;mult. FT0C", kTH2F, {{200, 0, 200000}, {60, 0, 60000}}, false); - fRegistry->add("Event/before/hCentFT0A", "hCentFT0A;centrality FT0A (%)", kTH1F, {{110, 0, 110}}, false); - fRegistry->add("Event/before/hCentFT0C", "hCentFT0C;centrality FT0C (%)", kTH1F, {{110, 0, 110}}, false); - fRegistry->add("Event/before/hCentFT0M", "hCentFT0M;centrality FT0M (%)", kTH1F, {{110, 0, 110}}, false); + fRegistry->add("Event/before/hCentFT0A", "hCentFT0A;centrality FT0A (%)", kTH1F, {{axis_cent_ft0m}}, false); + fRegistry->add("Event/before/hCentFT0C", "hCentFT0C;centrality FT0C (%)", kTH1F, {{axis_cent_ft0a}}, false); + fRegistry->add("Event/before/hCentFT0M", "hCentFT0M;centrality FT0M (%)", kTH1F, {{axis_cent_ft0c}}, false); fRegistry->add("Event/before/hCentFT0CvsMultNTracksPV", "hCentFT0CvsMultNTracksPV;centrality FT0C (%);N_{track} to PV", kTH2F, {{110, 0, 110}, {500, 0, 5000}}, false); fRegistry->add("Event/before/hMultFT0CvsMultNTracksPV", "hMultFT0CvsMultNTracksPV;mult. FT0C;N_{track} to PV", kTH2F, {{60, 0, 60000}, {500, 0, 5000}}, false); fRegistry->add("Event/before/hMultFT0CvsOccupancy", "hMultFT0CvsOccupancy;mult. FT0C;N_{track} in time range", kTH2F, {{60, 0, 60000}, {2000, 0, 20000}}, false); From f55594bf2b3fa7b607c6d3cdfe800d59a8c0da99 Mon Sep 17 00:00:00 2001 From: Sahil Upadhyaya <36447687+sahilupadhyaya92@users.noreply.github.com> Date: Wed, 23 Jul 2025 09:25:38 +0200 Subject: [PATCH 011/345] [PWGDQ] Add 1D histograms for Drell-Yan studies (#12190) Co-authored-by: Sahil Upadhyaya Co-authored-by: ALICE Action Bot --- PWGDQ/Core/HistogramsLibrary.cxx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/PWGDQ/Core/HistogramsLibrary.cxx b/PWGDQ/Core/HistogramsLibrary.cxx index 66f88ba7a6a..3f8bb8f2064 100644 --- a/PWGDQ/Core/HistogramsLibrary.cxx +++ b/PWGDQ/Core/HistogramsLibrary.cxx @@ -1970,6 +1970,13 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h hm->AddHistogram(histClass, "Mass_Pt", "", false, 500, 0.0, 5.0, VarManager::kMassDau, 200, 0.0, 20.0, VarManager::kPt); hm->AddHistogram(histClass, "Rapidity", "", false, 400, -4.0, 4.0, VarManager::kRap); } + + if (subGroupStr.Contains("DY-dimuon")) { + hm->AddHistogram(histClass, "DY_mass", "", false, 5000, 0.0, 50.0, VarManager::kMass); // 10 MeV mass res + hm->AddHistogram(histClass, "DY_pT", "", false, 2000, 0.0, 100.0, VarManager::kPt); // 50 MeV pT res + hm->AddHistogram(histClass, "DY_y", "", false, 20, 2.0, 4.0, VarManager::kRap); + hm->AddHistogram(histClass, "DY_phi", "", false, 180, constants::math::PI, 2 * constants::math::PI, VarManager::kPhi); + } } //__________________________________________________________________ From 1ca730732c57f21018e1dff52fc5e2eacfe581cd Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Wed, 23 Jul 2025 09:42:52 +0200 Subject: [PATCH 012/345] [PWGLF] Add test version of propagation service task (#12151) Co-authored-by: David Dobrigkeit Chinellato Co-authored-by: ALICE Builder --- .../TableProducer/Strangeness/CMakeLists.txt | 5 + .../Strangeness/propagationService.cxx | 150 + PWGLF/Utils/strangenessBuilderModule.h | 2560 +++++++++++++++++ 3 files changed, 2715 insertions(+) create mode 100644 PWGLF/TableProducer/Strangeness/propagationService.cxx create mode 100644 PWGLF/Utils/strangenessBuilderModule.h diff --git a/PWGLF/TableProducer/Strangeness/CMakeLists.txt b/PWGLF/TableProducer/Strangeness/CMakeLists.txt index 55bf4550601..bc8ba1da673 100644 --- a/PWGLF/TableProducer/Strangeness/CMakeLists.txt +++ b/PWGLF/TableProducer/Strangeness/CMakeLists.txt @@ -166,3 +166,8 @@ o2physics_add_dpl_workflow(lambdaspincorrelation SOURCES lambdaspincorrelation.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(propagationservice + SOURCES propagationService.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter KFParticle::KFParticle O2Physics::TPCDriftManager + COMPONENT_NAME Analysis) diff --git a/PWGLF/TableProducer/Strangeness/propagationService.cxx b/PWGLF/TableProducer/Strangeness/propagationService.cxx new file mode 100644 index 00000000000..6140dd2cc8b --- /dev/null +++ b/PWGLF/TableProducer/Strangeness/propagationService.cxx @@ -0,0 +1,150 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file propagationService.cxx +/// \brief +/// \author ALICE + +//=============================================================== +// +// Merged track propagation + strangeness building task +// +// Provides a common task to deal with track propagation and +// strangeness building in a single DPL device that is particularly +// adequate for pipelining. +// +// Currently meant for testing and performance check +// +//=============================================================== + +#include "PWGLF/Utils/strangenessBuilderModule.h" + +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/Tools/StandardCCDBLoader.h" +#include "Common/Tools/TrackPropagationModule.h" + +#include "CCDB/BasicCCDBManager.h" +#include "CCDB/CcdbApi.h" +#include "CommonConstants/GeomConstants.h" +#include "CommonUtils/NameConf.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "DetectorsBase/GeometryManager.h" +#include "DetectorsBase/Propagator.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/DCA.h" + +using namespace o2; +using namespace o2::framework; +// using namespace o2::framework::expressions; + +// use parameters + cov mat non-propagated, aux info + (extension propagated) +using FullTracksExt = soa::Join; +using FullTracksExtIU = soa::Join; +using FullTracksExtWithPID = soa::Join; +using FullTracksExtIUWithPID = soa::Join; +using FullTracksExtLabeled = soa::Join; +using FullTracksExtLabeledIU = soa::Join; +using FullTracksExtLabeledWithPID = soa::Join; +using FullTracksExtLabeledIUWithPID = soa::Join; +using TracksWithExtra = soa::Join; + +// For dE/dx association in pre-selection +using TracksExtraWithPID = soa::Join; + +struct propagationService { + // CCDB boilerplate declarations + o2::framework::Configurable ccdburl{"ccdburl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Service ccdb; + + // propagation stuff + o2::common::StandardCCDBLoaderConfigurables standardCCDBLoaderConfigurables; + o2::common::StandardCCDBLoader ccdbLoader; + + // boilerplate: strangeness builder stuff + o2::pwglf::strangenessbuilder::products products; + o2::pwglf::strangenessbuilder::coreConfigurables baseOpts; + o2::pwglf::strangenessbuilder::v0Configurables v0BuilderOpts; + o2::pwglf::strangenessbuilder::cascadeConfigurables cascadeBuilderOpts; + o2::pwglf::strangenessbuilder::preSelectOpts preSelectOpts; + o2::pwglf::strangenessbuilder::BuilderModule strangenessBuilderModule; + + // track propagation + o2::common::TrackPropagationProducts trackPropagationProducts; + o2::common::TrackPropagationConfigurables trackPropagationConfigurables; + o2::common::TrackPropagationModule trackPropagation; + + // registry + HistogramRegistry histos{"histos"}; + + void init(o2::framework::InitContext& initContext) + { + // CCDB boilerplate init + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setURL(ccdburl.value); + + // task-specific + trackPropagation.init(trackPropagationConfigurables, histos, initContext); + strangenessBuilderModule.init(baseOpts, v0BuilderOpts, cascadeBuilderOpts, preSelectOpts, histos, initContext); + } + + void processRealData(soa::Join const& collisions, aod::V0s const& v0s, aod::Cascades const& cascades, aod::TrackedCascades const& trackedCascades, FullTracksExtIU const& tracks, aod::BCsWithTimestamps const& bcs) + { + ccdbLoader.initCCDBfromBCs(standardCCDBLoaderConfigurables, ccdb, bcs); + trackPropagation.fillTrackTables(trackPropagationConfigurables, ccdbLoader, collisions, tracks, trackPropagationProducts, histos); + strangenessBuilderModule.dataProcess(ccdb, histos, collisions, static_cast(nullptr), v0s, cascades, trackedCascades, tracks, bcs, static_cast(nullptr), products); + } + + void processMonteCarlo(soa::Join const& collisions, aod::McCollisions const& mccollisions, aod::V0s const& v0s, aod::Cascades const& cascades, aod::TrackedCascades const& trackedCascades, FullTracksExtLabeledIU const& tracks, aod::BCsWithTimestamps const& bcs, aod::McParticles const& mcParticles) + { + ccdbLoader.initCCDBfromBCs(standardCCDBLoaderConfigurables, ccdb, bcs); + trackPropagation.fillTrackTables(trackPropagationConfigurables, ccdbLoader, collisions, tracks, trackPropagationProducts, histos); + strangenessBuilderModule.dataProcess(ccdb, histos, collisions, mccollisions, v0s, cascades, trackedCascades, tracks, bcs, mcParticles, products); + } + + // FIXME: the part below is only viable if TPC PID + // switches to using TracksIU (circular dependency) + // + // void processRealDataWithPID(soa::Join const& collisions, aod::V0s const& v0s, aod::Cascades const& cascades, aod::TrackedCascades const& trackedCascades, FullTracksExtIUWithPID const& tracks, aod::BCsWithTimestamps const& bcs) + // { + // ccdbLoader.initCCDBfromBCs(standardCCDBLoaderConfigurables, ccdb, bcs); + // trackPropagation.fillTrackTables(trackPropagationConfigurables, ccdbLoader, collisions, tracks, trackPropagationProducts, histos); + // strangenessBuilderModule.dataProcess(ccdb, histos, collisions, static_cast(nullptr), v0s, cascades, trackedCascades, tracks, bcs, static_cast(nullptr), products); + // } + + // void processMonteCarloWithPID(soa::Join const& collisions, aod::McCollisions const& mccollisions, aod::V0s const& v0s, aod::Cascades const& cascades, aod::TrackedCascades const& trackedCascades, FullTracksExtLabeledIUWithPID const& tracks, aod::BCsWithTimestamps const& bcs, aod::McParticles const& mcParticles) + // { + // ccdbLoader.initCCDBfromBCs(standardCCDBLoaderConfigurables, ccdb, bcs); + // trackPropagation.fillTrackTables(trackPropagationConfigurables, ccdbLoader, collisions, tracks, trackPropagationProducts, histos); + // strangenessBuilderModule.dataProcess(ccdb, histos, collisions, mccollisions, v0s, cascades, trackedCascades, tracks, bcs, mcParticles, products); + // } + + PROCESS_SWITCH(propagationService, processRealData, "process real data", true); + PROCESS_SWITCH(propagationService, processMonteCarlo, "process monte carlo", false); + // PROCESS_SWITCH(propagationService, processRealDataWithPID, "process real data", false); + // PROCESS_SWITCH(propagationService, processMonteCarloWithPID, "process monte carlo", false); +}; + +//**************************************************************************************** +/** + * Workflow definition. + */ +//**************************************************************************************** +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + WorkflowSpec workflow{adaptAnalysisTask(cfgc)}; + return workflow; +} diff --git a/PWGLF/Utils/strangenessBuilderModule.h b/PWGLF/Utils/strangenessBuilderModule.h new file mode 100644 index 00000000000..41d995fbb44 --- /dev/null +++ b/PWGLF/Utils/strangenessBuilderModule.h @@ -0,0 +1,2560 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file strangenessBuilderModule.h +/// \brief strangeness builder module +/// \author ALICE + +// simple checkers, but ensure 8 bit integers +#define BITSET(var, nbit) ((var) |= (static_cast(1) << static_cast(nbit))) + +#ifndef PWGLF_UTILS_STRANGENESSBUILDERMODULE_H_ +#define PWGLF_UTILS_STRANGENESSBUILDERMODULE_H_ + +#include "TableHelper.h" + +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGLF/Utils/strangenessBuilderHelper.h" + +#include "Common/Core/TPCVDriftManager.h" + +#include "DataFormatsCalibration/MeanVertexObject.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisHelpers.h" +#include "Framework/Configurable.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/HistogramSpec.h" + +#include +#include +#include +#include +#include + +//__________________________________________ +// strangeness builder module + +namespace o2 +{ +namespace pwglf +{ +namespace strangenessbuilder // avoid polluting other namespaces +{ + +// statics necessary for the configurables in this namespace +static constexpr int nParameters = 1; +static const std::vector tableNames{ + "V0Indices", //.0 (standard analysis: V0Cores) + "V0CoresBase", //.1 (standard analyses: main table) + "V0Covs", //.2 (joinable with V0Cores) + "CascIndices", //.3 (standard analyses: CascData) + "KFCascIndices", //.4 (standard analyses: KFCascData) + "TraCascIndices", //.5 (standard analyses: TraCascData) + "StoredCascCores", //.6 (standard analyses: CascData, main table) + "StoredKFCascCores", //.7 (standard analyses: KFCascData, main table) + "StoredTraCascCores", //.8 (standard analyses: TraCascData, main table) + "CascCovs", //.9 (joinable with CascData) + "KFCascCovs", //.10 (joinable with KFCascData) + "TraCascCovs", //.11 (joinable with TraCascData) + "V0TrackXs", //.12 (joinable with V0Data) + "CascTrackXs", //.13 (joinable with CascData) + "CascBBs", //.14 (standard, bachelor-baryon vars) + "V0DauCovs", //.15 (requested: tracking studies) + "V0DauCovIUs", //.16 (requested: tracking studies) + "V0TraPosAtDCAs", //.17 (requested: tracking studies) + "V0TraPosAtIUs", //.18 (requested: tracking studies) + "V0Ivanovs", //.19 (requested: tracking studies) + "McV0Labels", //.20 (MC/standard analysis) + "V0MCCores", //.21 (MC, all generated desired V0s) + "V0CoreMCLabels", //.22 (MC, refs V0Cores to V0MCCores) + "V0MCCollRefs", //.23 (MC, refs V0MCCores to McCollisions) + "McCascLabels", //.24 (MC/standard analysis) + "McKFCascLabels", //.25 (MC, refs KFCascCores to CascMCCores) + "McTraCascLabels", //.26 (MC, refs TraCascCores to CascMCCores) + "McCascBBTags", //.27 (MC, joinable with CascCores, tags reco-ed) + "CascMCCores", //.28 (MC, all generated desired cascades) + "CascCoreMCLabels", //.29 (MC, refs CascCores to CascMCCores) + "CascMCCollRefs", // 30 (MC, refs CascMCCores to McCollisions) + "CascToTraRefs", //.31 (interlink CascCores -> TraCascCores) + "CascToKFRefs", //.32 (interlink CascCores -> KFCascCores) + "TraToCascRefs", //.33 (interlink TraCascCores -> CascCores) + "KFToCascRefs", //.34 (interlink KFCascCores -> CascCores) + "V0FoundTags", //.35 (tags found vs findable V0s in findable mode) + "CascFoundTags" //.36 (tags found vs findable Cascades in findable mode) +}; + +static constexpr int nTablesConst = 37; + +static const std::vector parameterNames{"enable"}; +static const int defaultParameters[nTablesConst][nParameters]{ + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, // index 9 + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, // index 19 + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, // index 29 + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}, + {-1}}; + +// table index : match order above +enum tableIndex { kV0Indices = 0, + kV0CoresBase, + kV0Covs, + kCascIndices, + kKFCascIndices, + kTraCascIndices, + kStoredCascCores, + kStoredKFCascCores, + kStoredTraCascCores, + kCascCovs, + kKFCascCovs, + kTraCascCovs, + kV0TrackXs, + kCascTrackXs, + kCascBBs, + kV0DauCovs, + kV0DauCovIUs, + kV0TraPosAtDCAs, + kV0TraPosAtIUs, + kV0Ivanovs, + kMcV0Labels, + kV0MCCores, + kV0CoreMCLabels, + kV0MCCollRefs, + kMcCascLabels, + kMcKFCascLabels, + kMcTraCascLabels, + kMcCascBBTags, + kCascMCCores, + kCascCoreMCLabels, + kCascMCCollRefs, + kCascToTraRefs, + kCascToKFRefs, + kTraToCascRefs, + kKFToCascRefs, + kV0FoundTags, + kCascFoundTags, + nTables }; + +enum V0PreSelection : uint8_t { selGamma = 0, + selK0Short, + selLambda, + selAntiLambda }; + +enum CascPreSelection : uint8_t { selXiMinus = 0, + selXiPlus, + selOmegaMinus, + selOmegaPlus }; + +static constexpr float defaultK0MassWindowParameters[1][4] = {{2.81882e-03, 1.14057e-03, 1.72138e-03, 5.00262e-01}}; +static constexpr float defaultLambdaWindowParameters[1][4] = {{1.17518e-03, 1.24099e-04, 5.47937e-03, 3.08009e-01}}; +static constexpr float defaultXiMassWindowParameters[1][4] = {{1.43210e-03, 2.03561e-04, 2.43187e-03, 7.99668e-01}}; +static constexpr float defaultOmMassWindowParameters[1][4] = {{1.43210e-03, 2.03561e-04, 2.43187e-03, 7.99668e-01}}; + +static constexpr float defaultLifetimeCuts[1][4] = {{20, 60, 40, 20}}; + +struct products : o2::framework::ProducesGroup { + //__________________________________________________ + // V0 tables + o2::framework::Produces v0indices; // standard part of V0Datas + o2::framework::Produces v0cores; // standard part of V0Datas + o2::framework::Produces v0covs; // for decay chain reco + + //__________________________________________________ + // cascade tables + o2::framework::Produces cascidx; // standard part of CascDatas + o2::framework::Produces kfcascidx; // standard part of KFCascDatas + o2::framework::Produces tracascidx; // standard part of TraCascDatas + o2::framework::Produces cascdata; // standard part of CascDatas + o2::framework::Produces kfcascdata; // standard part of KFCascDatas + o2::framework::Produces tracascdata; // standard part of TraCascDatas + o2::framework::Produces casccovs; // for decay chain reco + o2::framework::Produces kfcasccovs; // for decay chain reco + o2::framework::Produces tracasccovs; // for decay chain reco + + //__________________________________________________ + // interlink tables + o2::framework::Produces v0dataLink; // de-refs V0s -> V0Data + o2::framework::Produces cascdataLink; // de-refs Cascades -> CascData + o2::framework::Produces kfcascdataLink; // de-refs Cascades -> KFCascData + o2::framework::Produces tracascdataLink; // de-refs Cascades -> TraCascData + + //__________________________________________________ + // secondary auxiliary tables + o2::framework::Produces v0trackXs; // for decay chain reco + o2::framework::Produces cascTrackXs; // for decay chain reco + + //__________________________________________________ + // further auxiliary / optional if desired + o2::framework::Produces cascbb; + o2::framework::Produces v0daucovs; // covariances of daughter tracks + o2::framework::Produces v0daucovIUs; // covariances of daughter tracks + o2::framework::Produces v0dauPositions; // auxiliary debug information + o2::framework::Produces v0dauPositionsIU; // auxiliary debug information + o2::framework::Produces v0ivanovs; // information for Marian's tests + + //__________________________________________________ + // MC information: V0 + o2::framework::Produces v0labels; // MC labels for V0s + o2::framework::Produces v0mccores; // mc info storage + o2::framework::Produces v0CoreMCLabels; // interlink V0Cores -> V0MCCores + o2::framework::Produces v0mccollref; // references collisions from V0MCCores + + // MC information: Cascades + o2::framework::Produces casclabels; // MC labels for cascades + o2::framework::Produces kfcasclabels; // MC labels for KF cascades + o2::framework::Produces tracasclabels; // MC labels for tracked cascades + o2::framework::Produces bbtags; // bb tags (inv structure tagging in mc) + o2::framework::Produces cascmccores; // mc info storage + o2::framework::Produces cascCoreMClabels; // interlink CascCores -> CascMCCores + o2::framework::Produces cascmccollrefs; // references MC collisions from MC cascades + + //__________________________________________________ + // cascade interlinks + // FIXME: commented out until strangederivedbuilder adjusted accordingly + // o2::framework::Produces cascToTraRefs; // cascades -> tracked + // o2::framework::Produces cascToKFRefs; // cascades -> KF + // o2::framework::Produces traToCascRefs; // tracked -> cascades + // o2::framework::Produces kfToCascRefs; // KF -> cascades + + //__________________________________________________ + // Findable tags + o2::framework::Produces v0FoundTag; + o2::framework::Produces cascFoundTag; +}; + +// strangenessBuilder: 1st-order configurables +struct coreConfigurables : o2::framework::ConfigurableGroup { + o2::framework::Configurable> enabledTables{"enabledTables", + {defaultParameters[0], nTables, nParameters, tableNames, parameterNames}, + "Produce this table: -1 for autodetect; otherwise, 0/1 is false/true"}; + std::vector mEnabledTables; // Vector of enabled tables + + // first order deduplication implementation + // more algorithms to be added as necessary + o2::framework::Configurable deduplicationAlgorithm{"deduplicationAlgorithm", 1, "0: disabled; 1: best pointing angle wins; 2: best DCA daughters wins; 3: best pointing and best DCA wins"}; + + // V0 buffer for V0s used in cascades: master switch + // exchanges CPU (generate V0s again) with memory (save pre-generated V0s) + o2::framework::Configurable useV0BufferForCascades{"useV0BufferForCascades", false, "store array of V0s for cascades or not. False (default): save RAM, use more CPU; true: save CPU, use more RAM"}; + + o2::framework::Configurable mc_findableMode{"mc_findableMode", 0, "0: disabled; 1: add findable-but-not-found to existing V0s from AO2D; 2: reset V0s and generate only findable-but-not-found"}; +}; + +// strangenessBuilder: V0 building options +struct v0Configurables : o2::framework::ConfigurableGroup { + std::string prefix = "v0BuilderOpts"; + o2::framework::Configurable generatePhotonCandidates{"generatePhotonCandidates", false, "generate gamma conversion candidates (V0s using TPC-only tracks)"}; + o2::framework::Configurable moveTPCOnlyTracks{"moveTPCOnlyTracks", true, "if dealing with TPC-only tracks, move them according to TPC drift / time info"}; + + // baseline conditionals of V0 building + o2::framework::Configurable minCrossedRows{"minCrossedRows", 50, "minimum TPC crossed rows for daughter tracks"}; + o2::framework::Configurable dcanegtopv{"dcanegtopv", .1, "DCA Neg To PV"}; + o2::framework::Configurable dcapostopv{"dcapostopv", .1, "DCA Pos To PV"}; + o2::framework::Configurable v0cospa{"v0cospa", 0.95, "V0 CosPA"}; // double -> N.B. dcos(x)/dx = 0 at x=0) + o2::framework::Configurable dcav0dau{"dcav0dau", 1.0, "DCA V0 Daughters"}; + o2::framework::Configurable v0radius{"v0radius", 0.9, "v0radius"}; + o2::framework::Configurable maxDaughterEta{"maxDaughterEta", 5.0, "Maximum daughter eta (in abs value)"}; + + // MC builder options + o2::framework::Configurable mc_populateV0MCCoresSymmetric{"mc_populateV0MCCoresSymmetric", false, "populate V0MCCores table for derived data analysis, keep V0MCCores joinable with V0Cores"}; + o2::framework::Configurable mc_populateV0MCCoresAsymmetric{"mc_populateV0MCCoresAsymmetric", true, "populate V0MCCores table for derived data analysis, create V0Cores -> V0MCCores interlink. Saves only labeled V0s."}; + o2::framework::Configurable mc_treatPiToMuDecays{"mc_treatPiToMuDecays", true, "if true, will correctly capture pi -> mu and V0 label will still point to originating V0 decay in those cases. Nota bene: prong info will still be for the muon!"}; + o2::framework::Configurable mc_rapidityWindow{"mc_rapidityWindow", 0.5, "rapidity window to save non-recoed candidates"}; + o2::framework::Configurable mc_keepOnlyPhysicalPrimary{"mc_keepOnlyPhysicalPrimary", false, "Keep only physical primary generated V0s if not recoed"}; + o2::framework::Configurable mc_addGeneratedK0Short{"mc_addGeneratedK0Short", true, "add V0MCCore entry for generated, not-recoed K0Short"}; + o2::framework::Configurable mc_addGeneratedLambda{"mc_addGeneratedLambda", true, "add V0MCCore entry for generated, not-recoed Lambda"}; + o2::framework::Configurable mc_addGeneratedAntiLambda{"mc_addGeneratedAntiLambda", true, "add V0MCCore entry for generated, not-recoed AntiLambda"}; + o2::framework::Configurable mc_addGeneratedGamma{"mc_addGeneratedGamma", false, "add V0MCCore entry for generated, not-recoed Gamma"}; + o2::framework::Configurable mc_addGeneratedGammaMakeCollinear{"mc_addGeneratedGammaMakeCollinear", true, "when adding findable gammas, mark them as collinear"}; + o2::framework::Configurable mc_findableDetachedV0{"mc_findableDetachedV0", false, "if true, generate findable V0s that have collisionId -1. Caution advised."}; +}; + +// strangenessBuilder: cascade building options +struct cascadeConfigurables : o2::framework::ConfigurableGroup { + std::string prefix = "cascadeBuilderOpts"; + o2::framework::Configurable useCascadeMomentumAtPrimVtx{"useCascadeMomentumAtPrimVtx", false, "use cascade momentum at PV"}; + + // conditionals + o2::framework::Configurable minCrossedRows{"minCrossedRows", 50, "minimum TPC crossed rows for daughter tracks"}; + o2::framework::Configurable dcabachtopv{"dcabachtopv", .05, "DCA Bach To PV"}; + o2::framework::Configurable cascradius{"cascradius", 0.9, "cascradius"}; + o2::framework::Configurable casccospa{"casccospa", 0.95, "casccospa"}; + o2::framework::Configurable dcacascdau{"dcacascdau", 1.0, "DCA cascade Daughters"}; + o2::framework::Configurable lambdaMassWindow{"lambdaMassWindow", .010, "Distance from Lambda mass (does not apply to KF path)"}; + o2::framework::Configurable maxDaughterEta{"maxDaughterEta", 5.0, "Maximum daughter eta (in abs value)"}; + + // KF building specific + o2::framework::Configurable kfTuneForOmega{"kfTuneForOmega", false, "if enabled, take main cascade properties from Omega fit instead of Xi fit (= default)"}; + o2::framework::Configurable kfConstructMethod{"kfConstructMethod", 2, "KF Construct Method"}; + o2::framework::Configurable kfUseV0MassConstraint{"kfUseV0MassConstraint", true, "KF: use Lambda mass constraint"}; + o2::framework::Configurable kfUseCascadeMassConstraint{"kfUseCascadeMassConstraint", false, "KF: use Cascade mass constraint - WARNING: not adequate for inv mass analysis of Xi"}; + o2::framework::Configurable kfDoDCAFitterPreMinimV0{"kfDoDCAFitterPreMinimV0", true, "KF: do DCAFitter pre-optimization before KF fit to include material corrections for V0"}; + o2::framework::Configurable kfDoDCAFitterPreMinimCasc{"kfDoDCAFitterPreMinimCasc", true, "KF: do DCAFitter pre-optimization before KF fit to include material corrections for Xi"}; + + // MC builder options + o2::framework::Configurable mc_populateCascMCCoresSymmetric{"mc_populateCascMCCoresSymmetric", false, "populate CascMCCores table for derived data analysis, keep CascMCCores joinable with CascCores"}; + o2::framework::Configurable mc_populateCascMCCoresAsymmetric{"mc_populateCascMCCoresAsymmetric", true, "populate CascMCCores table for derived data analysis, create CascCores -> CascMCCores interlink. Saves only labeled Cascades."}; + o2::framework::Configurable mc_addGeneratedXiMinus{"mc_addGeneratedXiMinus", true, "add CascMCCore entry for generated, not-recoed XiMinus"}; + o2::framework::Configurable mc_addGeneratedXiPlus{"mc_addGeneratedXiPlus", true, "add CascMCCore entry for generated, not-recoed XiPlus"}; + o2::framework::Configurable mc_addGeneratedOmegaMinus{"mc_addGeneratedOmegaMinus", true, "add CascMCCore entry for generated, not-recoed OmegaMinus"}; + o2::framework::Configurable mc_addGeneratedOmegaPlus{"mc_addGeneratedOmegaPlus", true, "add CascMCCore entry for generated, not-recoed OmegaPlus"}; + o2::framework::Configurable mc_treatPiToMuDecays{"mc_treatPiToMuDecays", true, "if true, will correctly capture pi -> mu and V0 label will still point to originating V0 decay in those cases. Nota bene: prong info will still be for the muon!"}; + o2::framework::Configurable mc_rapidityWindow{"mc_rapidityWindow", 0.5, "rapidity window to save non-recoed candidates"}; + o2::framework::Configurable mc_keepOnlyPhysicalPrimary{"mc_keepOnlyPhysicalPrimary", false, "Keep only physical primary generated cascades if not recoed"}; + o2::framework::Configurable mc_findableDetachedCascade{"mc_findableDetachedCascade", false, "if true, generate findable cascades that have collisionId -1. Caution advised."}; +}; + +// preselection options +struct preSelectOpts : o2::framework::ConfigurableGroup { + std::string prefix = "preSelectOpts"; + o2::framework::Configurable preselectOnlyDesiredV0s{"preselectOnlyDesiredV0s", false, "preselect only V0s with compatible TPC PID and mass info"}; + o2::framework::Configurable preselectOnlyDesiredCascades{"preselectOnlyDesiredCascades", false, "preselect only Cascades with compatible TPC PID and mass info"}; + + // lifetime preselection options + // apply lifetime cuts to V0 and cascade candidates + // unit of measurement: centimeters + // lifetime of K0Short ~2.6844 cm, no feeddown and plenty to cut + // lifetime of Lambda ~7.9 cm but keep in mind feeddown from cascades + // lifetime of Xi ~4.91 cm + // lifetime of Omega ~2.461 cm + o2::framework::Configurable> lifetimeCut{"lifetimeCut", {defaultLifetimeCuts[0], 4, {"lifetimeCutK0S", "lifetimeCutLambda", "lifetimeCutXi", "lifetimeCutOmega"}}, "Lifetime cut for V0s and cascades (cm)"}; + + // mass preselection options + o2::framework::Configurable massCutPhoton{"massCutPhoton", 0.3, "Photon max mass"}; + o2::framework::Configurable> massCutK0{"massCutK0", {defaultK0MassWindowParameters[0], 4, {"constant", "linear", "expoConstant", "expoRelax"}}, "mass parameters for K0"}; + o2::framework::Configurable> massCutLambda{"massCutLambda", {defaultLambdaWindowParameters[0], 4, {"constant", "linear", "expoConstant", "expoRelax"}}, "mass parameters for Lambda"}; + o2::framework::Configurable> massCutXi{"massCutXi", {defaultXiMassWindowParameters[0], 4, {"constant", "linear", "expoConstant", "expoRelax"}}, "mass parameters for Xi"}; + o2::framework::Configurable> massCutOm{"massCutOm", {defaultOmMassWindowParameters[0], 4, {"constant", "linear", "expoConstant", "expoRelax"}}, "mass parameters for Omega"}; + o2::framework::Configurable massWindownumberOfSigmas{"massWindownumberOfSigmas", 20, "number of sigmas around mass peaks to keep"}; + o2::framework::Configurable massWindowSafetyMargin{"massWindowSafetyMargin", 0.001, "Extra mass window safety margin (in GeV/c2)"}; + + // TPC PID preselection options + o2::framework::Configurable maxTPCpidNsigma{"maxTPCpidNsigma", 5.0, "Maximum TPC PID N sigma (in abs value)"}; +}; + +class BuilderModule +{ + public: + BuilderModule() + { + // constructor + } + + // mass windows + float getMassSigmaK0Short(float pt) + { + return preSelectOpts.massCutK0->get("constant") + pt * preSelectOpts.massCutK0->get("linear") + preSelectOpts.massCutK0->get("expoConstant") * TMath::Exp(-pt / preSelectOpts.massCutK0->get("expoRelax")); + } + float getMassSigmaLambda(float pt) + { + return preSelectOpts.massCutLambda->get("constant") + pt * preSelectOpts.massCutLambda->get("linear") + preSelectOpts.massCutLambda->get("expoConstant") * TMath::Exp(-pt / preSelectOpts.massCutLambda->get("expoRelax")); + } + float getMassSigmaXi(float pt) + { + return preSelectOpts.massCutXi->get("constant") + pt * preSelectOpts.massCutXi->get("linear") + preSelectOpts.massCutXi->get("expoConstant") * TMath::Exp(-pt / preSelectOpts.massCutXi->get("expoRelax")); + } + float getMassSigmaOmega(float pt) + { + return preSelectOpts.massCutOm->get("constant") + pt * preSelectOpts.massCutOm->get("linear") + preSelectOpts.massCutOm->get("expoConstant") * TMath::Exp(-pt / preSelectOpts.massCutOm->get("expoRelax")); + } + + int nEnabledTables = 0; + + // helper object + o2::pwglf::strangenessBuilderHelper straHelper; + + // for handling TPC-only tracks (photons) + int mRunNumber; + o2::aod::common::TPCVDriftManager mVDriftMgr; + + // for establishing CascData/KFData/TraCascData interlinks + struct { + std::vector cascCoreToCascades; + std::vector kfCascCoreToCascades; + std::vector traCascCoreToCascades; + std::vector cascadeToCascCores; + std::vector cascadeToKFCascCores; + std::vector cascadeToTraCascCores; + } interlinks; + + //*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+* + // struct to add abstraction layer between V0s, Cascades and build indices + // desirable for adding extra (findable, etc) V0s, Cascades to built list + struct trackEntry { + int globalId = -1; + int originId = -1; + int mcCollisionId = -1; + int pdgCode = -1; + }; + struct v0Entry { + int globalId = -1; + int collisionId = -1; + int posTrackId = -1; + int negTrackId = -1; + int v0Type = 0; + int pdgCode = 0; // undefined if not MC - useful for faster finding + int particleId = -1; // de-reference the V0 particle if necessary + bool isCollinearV0 = false; + bool found = false; + }; + struct cascadeEntry { + int globalId = -1; + int collisionId = -1; + int v0Id = -1; + int posTrackId = -1; + int negTrackId = -1; + int bachTrackId = -1; + bool found = false; + }; + + //*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+* + // Helper struct to contain V0MCCore information prior to filling + struct mcV0info { + int label = -1; + int motherLabel = -1; + int pdgCode = 0; + int pdgCodeMother = 0; + int pdgCodePositive = 0; + int pdgCodeNegative = 0; + int mcCollision = -1; + bool isPhysicalPrimary = false; + int processPositive = -1; + int processNegative = -1; + std::array xyz; + std::array posP; + std::array negP; + std::array momentum; + }; + mcV0info thisInfo; + //*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+* + // Helper struct to contain CascMCCore information prior to filling + struct mcCascinfo { + int label; + int motherLabel; + int mcCollision; + int pdgCode; + int pdgCodeMother; + int pdgCodeV0; + int pdgCodePositive; + int pdgCodeNegative; + int pdgCodeBachelor; + bool isPhysicalPrimary; + int processPositive = -1; + int processNegative = -1; + int processBachelor = -1; + std::array xyz; + std::array lxyz; + std::array posP; + std::array negP; + std::array bachP; + std::array momentum; + int mcParticlePositive; + int mcParticleNegative; + int mcParticleBachelor; + }; + mcCascinfo thisCascInfo; + //*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+* + + std::vector v0List; + std::vector cascadeList; + std::vector sorted_v0; + std::vector sorted_cascade; + + // for tagging V0s used in cascades + std::vector v0sFromCascades; // Vector of v0 candidates used in cascades + std::vector ao2dV0toV0List; // index to relate v0s -> v0List + std::vector v0Map; // index to relate v0List -> v0sFromCascades + + // declaration of structs here + // (N.B.: will be invisible to the outside, create your own copies) + o2::pwglf::strangenessbuilder::coreConfigurables baseOpts; + o2::pwglf::strangenessbuilder::v0Configurables v0BuilderOpts; + o2::pwglf::strangenessbuilder::cascadeConfigurables cascadeBuilderOpts; + o2::pwglf::strangenessbuilder::preSelectOpts preSelectOpts; + + template + void init(TBaseConfigurables const& inputBaseOpts, TV0Configurables const& inputV0BuilderOpts, TCascadeConfigurables const& inputCascadeBuilderOpts, TPreSelOpts const& inputPreSelectOpts, THistoRegistry& histos, TInitContext& context) + { + // read in configurations from the task where it's used + // could be grouped even further, but should work + baseOpts = inputBaseOpts; + v0BuilderOpts = inputV0BuilderOpts; + cascadeBuilderOpts = inputCascadeBuilderOpts; + preSelectOpts = inputPreSelectOpts; + + baseOpts.mEnabledTables.resize(nTables, 0); + + LOGF(info, "Checking if strangeness building is required"); + auto& workflows = context.services().template get(); + + nEnabledTables = 0; + + TString listOfRequestors[nTables]; + for (int i = 0; i < nTables; i++) { + int f = baseOpts.enabledTables->get(tableNames[i].c_str(), "enable"); + if (f == 1) { + baseOpts.mEnabledTables[i] = 1; + listOfRequestors[i] = "manual enabling"; + } + if (f == -1) { + // autodetect this table in other devices + for (o2::framework::DeviceSpec const& device : workflows.devices) { + // Step 1: check if this device subscribed to the V0data table + for (auto const& input : device.inputs) { + if (o2::framework::DataSpecUtils::partialMatch(input.matcher, o2::header::DataOrigin("AOD"))) { + auto&& [origin, description, version] = o2::framework::DataSpecUtils::asConcreteDataMatcher(input.matcher); + std::string tableNameWithVersion = tableNames[i]; + if (version > 0) { + tableNameWithVersion += Form("_%03d", version); + } + if (input.matcher.binding == tableNameWithVersion) { + LOGF(info, "Device %s has subscribed to %s (version %i)", device.name, tableNames[i], version); + listOfRequestors[i].Append(Form("%s ", device.name.c_str())); + baseOpts.mEnabledTables[i] = 1; + nEnabledTables++; + } + } + } + } + } + } + + if (nEnabledTables == 0) { + LOGF(info, "Strangeness building not required. Will suppress all functionality, including logs, from this point forward."); + return; + } + + // setup bookkeeping histogram + auto h = histos.template add("hTableBuildingStatistics", "hTableBuildingStatistics", o2::framework::kTH1D, {{nTablesConst, -0.5f, static_cast(nTablesConst)}}); + auto h2 = histos.template add("hInputStatistics", "hInputStatistics", o2::framework::kTH1D, {{nTablesConst, -0.5f, static_cast(nTablesConst)}}); + h2->SetTitle("Input table sizes"); + + if (v0BuilderOpts.generatePhotonCandidates.value == true) { + auto hDeduplicationStatistics = histos.template add("hDeduplicationStatistics", "hDeduplicationStatistics", o2::framework::kTH1D, {{2, -0.5f, 1.5f}}); + hDeduplicationStatistics->GetXaxis()->SetBinLabel(1, "AO2D V0s"); + hDeduplicationStatistics->GetXaxis()->SetBinLabel(2, "Deduplicated V0s"); + } + + if (preSelectOpts.preselectOnlyDesiredV0s.value == true) { + auto hPreselectionV0s = histos.template add("hPreselectionV0s", "hPreselectionV0s", o2::framework::kTH1D, {{16, -0.5f, 15.5f}}); + hPreselectionV0s->GetXaxis()->SetBinLabel(1, "Not preselected"); + hPreselectionV0s->GetXaxis()->SetBinLabel(2, "#gamma"); + hPreselectionV0s->GetXaxis()->SetBinLabel(3, "K^{0}_{S}"); + hPreselectionV0s->GetXaxis()->SetBinLabel(4, "#gamma, K^{0}_{S}"); + hPreselectionV0s->GetXaxis()->SetBinLabel(5, "#Lambda"); + hPreselectionV0s->GetXaxis()->SetBinLabel(6, "#gamma, #Lambda"); + hPreselectionV0s->GetXaxis()->SetBinLabel(7, "K^{0}_{S}, #Lambda"); + hPreselectionV0s->GetXaxis()->SetBinLabel(8, "#gamma, K^{0}_{S}, #Lambda"); + hPreselectionV0s->GetXaxis()->SetBinLabel(9, "#bar{#Lambda}"); + hPreselectionV0s->GetXaxis()->SetBinLabel(10, "#gamma, #bar{#Lambda}"); + hPreselectionV0s->GetXaxis()->SetBinLabel(11, "K^{0}_{S}, #bar{#Lambda}"); + hPreselectionV0s->GetXaxis()->SetBinLabel(12, "#gamma, K^{0}_{S}, #bar{#Lambda}"); + hPreselectionV0s->GetXaxis()->SetBinLabel(13, "#Lambda, #bar{#Lambda}"); + hPreselectionV0s->GetXaxis()->SetBinLabel(14, "#gamma, #Lambda, #bar{#Lambda}"); + hPreselectionV0s->GetXaxis()->SetBinLabel(15, "K^{0}_{S}, #Lambda, #bar{#Lambda}"); + hPreselectionV0s->GetXaxis()->SetBinLabel(16, "#gamma, K^{0}_{S}, #Lambda, #bar{#Lambda}"); + } + + if (preSelectOpts.preselectOnlyDesiredCascades.value == true) { + auto hPreselectionCascades = histos.template add("hPreselectionCascades", "hPreselectionCascades", o2::framework::kTH1D, {{16, -0.5f, 15.5f}}); + hPreselectionCascades->GetXaxis()->SetBinLabel(1, "Not preselected"); + hPreselectionCascades->GetXaxis()->SetBinLabel(2, "#Xi^{-}"); + hPreselectionCascades->GetXaxis()->SetBinLabel(3, "#Xi^{+}"); + hPreselectionCascades->GetXaxis()->SetBinLabel(4, "#Xi^{-}, #Xi^{+}"); + hPreselectionCascades->GetXaxis()->SetBinLabel(5, "#Omega^{-}"); + hPreselectionCascades->GetXaxis()->SetBinLabel(6, "#Xi^{-}, #Omega^{-}"); + hPreselectionCascades->GetXaxis()->SetBinLabel(7, "#Xi^{+}, #Omega^{-}"); + hPreselectionCascades->GetXaxis()->SetBinLabel(8, "#Xi^{-}, #Xi^{+}, #Omega^{-}"); + hPreselectionCascades->GetXaxis()->SetBinLabel(9, "#Omega^{+}"); + hPreselectionCascades->GetXaxis()->SetBinLabel(10, "#Xi^{-}, #Omega^{+}"); + hPreselectionCascades->GetXaxis()->SetBinLabel(11, "#Xi^{+}, #Omega^{+}"); + hPreselectionCascades->GetXaxis()->SetBinLabel(12, "#Xi^{-}, #Xi^{+}, #Omega^{+}"); + hPreselectionCascades->GetXaxis()->SetBinLabel(13, "#Omega^{-}, #Omega^{+}"); + hPreselectionCascades->GetXaxis()->SetBinLabel(14, "#Xi^{-}, #Omega^{-}, #Omega^{+}"); + hPreselectionCascades->GetXaxis()->SetBinLabel(15, "#Xi^{+}, #Omega^{-}, #Omega^{+}"); + hPreselectionCascades->GetXaxis()->SetBinLabel(16, "#Xi^{-}, #Xi^{+}, #Omega^{-}, #Omega^{+}"); + } + + if (baseOpts.mc_findableMode.value > 0) { + // save statistics of findable candidate processing + auto hFindable = histos.template add("hFindableStatistics", "hFindableStatistics", o2::framework::kTH1D, {{6, -0.5f, 5.5f}}); + hFindable->SetTitle(Form("Findable mode: %i", static_cast(baseOpts.mc_findableMode.value))); + hFindable->GetXaxis()->SetBinLabel(1, "AO2D V0s"); + hFindable->GetXaxis()->SetBinLabel(2, "V0s to be built"); + hFindable->GetXaxis()->SetBinLabel(3, "V0s with collId -1"); + hFindable->GetXaxis()->SetBinLabel(4, "AO2D Cascades"); + hFindable->GetXaxis()->SetBinLabel(5, "Cascades to be built"); + hFindable->GetXaxis()->SetBinLabel(6, "Cascades with collId -1"); + } + + auto hPrimaryV0s = histos.template add("hPrimaryV0s", "hPrimaryV0s", o2::framework::kTH1D, {{2, -0.5f, 1.5f}}); + hPrimaryV0s->GetXaxis()->SetBinLabel(1, "All V0s"); + hPrimaryV0s->GetXaxis()->SetBinLabel(2, "Primary V0s"); + + mRunNumber = 0; + + for (int i = 0; i < nTables; i++) { + // adjust bookkeeping histogram + h->GetXaxis()->SetBinLabel(i + 1, tableNames[i].c_str()); + h2->GetXaxis()->SetBinLabel(i + 1, tableNames[i].c_str()); + if (baseOpts.mEnabledTables[i] == false) { + h->SetBinContent(i + 1, -1); // mark disabled tables, distinguish from zero counts + } + } + + LOGF(info, "*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*"); + LOGF(info, " Strangeness builder: basic configuration listing"); + LOGF(info, "*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*"); + + if (baseOpts.mc_findableMode.value == 1) { + LOGF(info, " ===> findable mode 1 is enabled: complement reco-ed with non-found findable"); + } + if (baseOpts.mc_findableMode.value == 2) { + LOGF(info, " ===> findable mode 2 is enabled: re-generate all findable from scratch"); + } + + // list enabled tables + + for (int i = 0; i < nTables; i++) { + // printout to be improved in the future + if (baseOpts.mEnabledTables[i]) { + LOGF(info, " -~> Table enabled: %s, requested by %s", tableNames[i], listOfRequestors[i].Data()); + h->SetBinContent(i + 1, 0); // mark enabled + } + } + LOGF(info, "*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*"); + // print base cuts + LOGF(info, "-~> V0 | min crossed rows ..............: %i", v0BuilderOpts.minCrossedRows.value); + LOGF(info, "-~> V0 | DCA pos track to PV ...........: %f", v0BuilderOpts.dcapostopv.value); + LOGF(info, "-~> V0 | DCA neg track to PV ...........: %f", v0BuilderOpts.dcanegtopv.value); + LOGF(info, "-~> V0 | V0 cosine of PA ...............: %f", v0BuilderOpts.v0cospa.value); + LOGF(info, "-~> V0 | DCA between V0 daughters ......: %f", v0BuilderOpts.dcav0dau.value); + LOGF(info, "-~> V0 | V0 2D decay radius ............: %f", v0BuilderOpts.v0radius.value); + LOGF(info, "-~> V0 | Maximum daughter eta ..........: %f", v0BuilderOpts.maxDaughterEta.value); + + LOGF(info, "-~> Cascade | min crossed rows .........: %i", cascadeBuilderOpts.minCrossedRows.value); + LOGF(info, "-~> Cascade | DCA bach track to PV .....: %f", cascadeBuilderOpts.dcabachtopv.value); + LOGF(info, "-~> Cascade | Cascade cosine of PA .....: %f", cascadeBuilderOpts.casccospa.value); + LOGF(info, "-~> Cascade | Cascade daughter DCA .....: %f", cascadeBuilderOpts.dcacascdau.value); + LOGF(info, "-~> Cascade | Cascade radius ...........: %f", cascadeBuilderOpts.cascradius.value); + LOGF(info, "-~> Cascade | Lambda mass window .......: %f", cascadeBuilderOpts.lambdaMassWindow.value); + LOGF(info, "-~> Cascade | Maximum daughter eta .....: %f", cascadeBuilderOpts.maxDaughterEta.value); + LOGF(info, "*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*"); + + // set V0 parameters in the helper + straHelper.v0selections.minCrossedRows = v0BuilderOpts.minCrossedRows; + straHelper.v0selections.dcanegtopv = v0BuilderOpts.dcanegtopv; + straHelper.v0selections.dcapostopv = v0BuilderOpts.dcapostopv; + straHelper.v0selections.v0cospa = v0BuilderOpts.v0cospa; + straHelper.v0selections.dcav0dau = v0BuilderOpts.dcav0dau; + straHelper.v0selections.v0radius = v0BuilderOpts.v0radius; + straHelper.v0selections.maxDaughterEta = v0BuilderOpts.maxDaughterEta; + + // set cascade parameters in the helper + straHelper.cascadeselections.minCrossedRows = cascadeBuilderOpts.minCrossedRows; + straHelper.cascadeselections.dcabachtopv = cascadeBuilderOpts.dcabachtopv; + straHelper.cascadeselections.cascradius = cascadeBuilderOpts.cascradius; + straHelper.cascadeselections.casccospa = cascadeBuilderOpts.casccospa; + straHelper.cascadeselections.dcacascdau = cascadeBuilderOpts.dcacascdau; + straHelper.cascadeselections.lambdaMassWindow = cascadeBuilderOpts.lambdaMassWindow; + straHelper.cascadeselections.maxDaughterEta = cascadeBuilderOpts.maxDaughterEta; + } + + // for sorting + template + std::vector sort_indices(const std::vector& v, bool doSorting = false) + { + std::vector idx(v.size()); + std::iota(idx.begin(), idx.end(), 0); + if (doSorting) { + // do sorting only if requested (not always necessary) + std::stable_sort(idx.begin(), idx.end(), + [&v](std::size_t i1, std::size_t i2) { return v[i1].collisionId < v[i2].collisionId; }); + } + return idx; + } + + template + bool initCCDB(TCCDB& ccdb, aod::BCsWithTimestamps const& bcs, TCollisions const& collisions) + { + auto bc = collisions.size() ? collisions.begin().template bc_as() : bcs.begin(); + if (!bcs.size()) { + LOGF(warn, "No BC found, skipping this DF."); + return false; // signal to skip this DF + } + + if (mRunNumber == bc.runNumber()) { + return true; + } + + auto timestamp = bc.timestamp(); + + // Fetch magnetic field from ccdb for current collision + auto magneticField = o2::base::Propagator::Instance()->getNominalBz(); + LOG(info) << "Configuring for timestamp " << timestamp << " with magnetic field of " << magneticField << " kG"; + + // Set magnetic field value once known + straHelper.fitter.setBz(magneticField); + + LOG(info) << "Fully configured for run: " << bc.runNumber(); + // mmark this run as configured + mRunNumber = bc.runNumber(); + + if (v0BuilderOpts.generatePhotonCandidates.value && v0BuilderOpts.moveTPCOnlyTracks.value) { + // initialize only if needed, avoid unnecessary CCDB calls + mVDriftMgr.init(&ccdb->instance()); + mVDriftMgr.update(timestamp); + } + + return true; + } + + //__________________________________________________ + void resetInterlinks() + { + interlinks.cascCoreToCascades.clear(); + interlinks.kfCascCoreToCascades.clear(); + interlinks.traCascCoreToCascades.clear(); + interlinks.cascadeToCascCores.clear(); + interlinks.cascadeToKFCascCores.clear(); + interlinks.cascadeToTraCascCores.clear(); + } + + //__________________________________________________ + void populateCascadeInterlinks() + { + // if (mEnabledTables[kCascToKFRefs]) { + // for (const auto& cascCore : interlinks.cascCoreToCascades) { + // cascToKFRefs(interlinks.cascadeToKFCascCores[cascCore]); + // histos.fill(HIST("hTableBuildingStatistics"), kCascToKFRefs); + // } + // } + // if (mEnabledTables[kCascToTraRefs]) { + // for (const auto& cascCore : interlinks.cascCoreToCascades) { + // cascToTraRefs(interlinks.cascadeToTraCascCores[cascCore]); + // histos.fill(HIST("hTableBuildingStatistics"), kCascToTraRefs); + // } + // } + // if (mEnabledTables[kKFToCascRefs]) { + // for (const auto& kfCascCore : interlinks.kfCascCoreToCascades) { + // kfToCascRefs(interlinks.cascadeToCascCores[kfCascCore]); + // histos.fill(HIST("hTableBuildingStatistics"), kKFToCascRefs); + // } + // } + // if (mEnabledTables[kTraToCascRefs]) { + // for (const auto& traCascCore : interlinks.traCascCoreToCascades) { + // traToCascRefs(interlinks.cascadeToCascCores[traCascCore]); + // histos.fill(HIST("hTableBuildingStatistics"), kTraToCascRefs); + // } + // } + } + + //__________________________________________________ + template + void prepareBuildingLists(THistoRegistry& histos, TCollisions const& collisions, TMCCollisions const& mcCollisions, TV0s const& v0s, TCascades const& cascades, TTracks const& tracks, TMCParticles const& mcParticles) + { + // this function prepares the v0List and cascadeList depending on + // how the task has been set up. Standard operation simply uses + // the existing V0s and Cascades from AO2D, while findable MC + // operation either complements with all findable-but-not-found + // or resets and fills with all findable. + // + // Whenever using findable candidates, they will be appropriately + // marked for posterior analysis using 'tag' variables. + // + // findable mode legend: + // 0: simple passthrough of V0s, Cascades in AO2Ds + // (in data, this is the only mode possible!) + // 1: add extra findable that haven't been found + // 2: generate only findable (no background) + + // redo lists from scratch + v0List.clear(); + cascadeList.clear(); + sorted_v0.clear(); + sorted_cascade.clear(); + ao2dV0toV0List.clear(); + + trackEntry currentTrackEntry; + v0Entry currentV0Entry; + cascadeEntry currentCascadeEntry; + + std::vector bestCollisionArray; // stores McCollision -> Collision map + std::vector bestCollisionNContribsArray; // stores Ncontribs for biggest coll assoc to mccoll + + int collisionLessV0s = 0; + int collisionLessCascades = 0; + + if (baseOpts.mc_findableMode.value > 0) { + if constexpr (soa::is_table) { + // if mcCollisions exist, assemble mcColl -> bestRecoColl map here + bestCollisionArray.clear(); + bestCollisionNContribsArray.clear(); + bestCollisionArray.resize(mcCollisions.size(), -1); // marks not reconstructed + bestCollisionNContribsArray.resize(mcCollisions.size(), -1); // marks not reconstructed + + // single loop over double loop at a small cost in memory for extra array + for (const auto& collision : collisions) { + if (collision.has_mcCollision()) { + if (collision.numContrib() > bestCollisionNContribsArray[collision.mcCollisionId()]) { + bestCollisionArray[collision.mcCollisionId()] = collision.globalIndex(); + bestCollisionNContribsArray[collision.mcCollisionId()] = collision.numContrib(); + } + } + } // end collision loop + } // end is_table + } // end findable mode check + + if (baseOpts.mc_findableMode.value < 2) { + // keep all unless de-duplication active + ao2dV0toV0List.resize(v0s.size(), -1); // -1 means keep, -2 means do not keep + + if (baseOpts.deduplicationAlgorithm > 0 && v0BuilderOpts.generatePhotonCandidates) { + // handle duplicates explicitly: group V0s according to (p,n) indices + // will provide a list of collisionIds (in V0group), allowing for + // easy de-duplication when passing to the v0List + std::vector v0tableGrouped = o2::pwglf::groupDuplicates(v0s); + histos.fill(HIST("hDeduplicationStatistics"), 0.0, v0s.size()); + histos.fill(HIST("hDeduplicationStatistics"), 1.0, v0tableGrouped.size()); + + // process grouped duplicates, remove 'bad' ones + for (size_t iV0 = 0; iV0 < v0tableGrouped.size(); iV0++) { + auto pTrack = tracks.rawIteratorAt(v0tableGrouped[iV0].posTrackId); + auto nTrack = tracks.rawIteratorAt(v0tableGrouped[iV0].negTrackId); + + bool isPosTPCOnly = (pTrack.hasTPC() && !pTrack.hasITS() && !pTrack.hasTRD() && !pTrack.hasTOF()); + bool isNegTPCOnly = (nTrack.hasTPC() && !nTrack.hasITS() && !nTrack.hasTRD() && !nTrack.hasTOF()); + + // skip single copy V0s + if (v0tableGrouped[iV0].collisionIds.size() == 1) { + continue; + } + + // don't try to de-duplicate if no track is TPC only + if (!isPosTPCOnly && !isNegTPCOnly) { + continue; + } + + // fitness criteria defined here + float bestPointingAngle = 10; // a nonsense angle, anything's better + size_t bestPointingAngleIndex = -1; + + float bestDCADaughters = 1e+3; // an excessively large DCA + size_t bestDCADaughtersIndex = -1; + + for (size_t ic = 0; ic < v0tableGrouped[iV0].collisionIds.size(); ic++) { + // get track parametrizations, collisions + auto posTrackPar = getTrackParCov(pTrack); + auto negTrackPar = getTrackParCov(nTrack); + auto const& collision = collisions.rawIteratorAt(v0tableGrouped[iV0].collisionIds[ic]); + + // handle TPC-only tracks properly (photon conversions) + if (v0BuilderOpts.moveTPCOnlyTracks) { + if (isPosTPCOnly) { + // Nota bene: positive is TPC-only -> this entire V0 merits treatment as photon candidate + posTrackPar.setPID(o2::track::PID::Electron); + negTrackPar.setPID(o2::track::PID::Electron); + if (!mVDriftMgr.moveTPCTrack(collision, pTrack, posTrackPar)) { + return; + } + } + if (isNegTPCOnly) { + // Nota bene: negative is TPC-only -> this entire V0 merits treatment as photon candidate + posTrackPar.setPID(o2::track::PID::Electron); + negTrackPar.setPID(o2::track::PID::Electron); + if (!mVDriftMgr.moveTPCTrack(collision, nTrack, negTrackPar)) { + return; + } + } + } // end TPC drift treatment + + // process candidate with helper, generate properties for consulting + // : do not apply selections: do as much as possible to preserve + // candidate at this level and do not select with topo selections + if (straHelper.buildV0Candidate(v0tableGrouped[iV0].collisionIds[ic], collision.posX(), collision.posY(), collision.posZ(), pTrack, nTrack, posTrackPar, negTrackPar, true, false, true)) { + // candidate built, check pointing angle + if (straHelper.v0.pointingAngle < bestPointingAngle) { + bestPointingAngle = straHelper.v0.pointingAngle; + bestPointingAngleIndex = ic; + } + if (straHelper.v0.daughterDCA < bestDCADaughters) { + bestDCADaughters = straHelper.v0.daughterDCA; + bestDCADaughtersIndex = ic; + } + } // end build V0 + } // end candidate loop + + // mark de-duplicated candidates + for (size_t ic = 0; ic < v0tableGrouped[iV0].collisionIds.size(); ic++) { + ao2dV0toV0List[v0tableGrouped[iV0].V0Ids[ic]] = -2; + // algorithm 1: best pointing angle + if (bestPointingAngleIndex == ic && baseOpts.deduplicationAlgorithm.value == 1) { + ao2dV0toV0List[v0tableGrouped[iV0].V0Ids[ic]] = -1; // keep best only + } + if (bestDCADaughtersIndex == ic && baseOpts.deduplicationAlgorithm.value == 2) { + ao2dV0toV0List[v0tableGrouped[iV0].V0Ids[ic]] = -1; // keep best only + } + if (bestDCADaughtersIndex == ic && bestPointingAngleIndex == ic && baseOpts.deduplicationAlgorithm.value == 3) { + ao2dV0toV0List[v0tableGrouped[iV0].V0Ids[ic]] = -1; // keep best only + } + } + } // end V0 loop + } // end de-duplication process + + for (const auto& v0 : v0s) { + if (ao2dV0toV0List[v0.globalIndex()] == -1) { // keep only de-duplicated + ao2dV0toV0List[v0.globalIndex()] = v0List.size(); // maps V0s to the corresponding v0List entry + currentV0Entry.globalId = v0.globalIndex(); + currentV0Entry.collisionId = v0.collisionId(); + currentV0Entry.posTrackId = v0.posTrackId(); + currentV0Entry.negTrackId = v0.negTrackId(); + currentV0Entry.v0Type = v0.v0Type(); + currentV0Entry.pdgCode = 0; + currentV0Entry.particleId = -1; + currentV0Entry.isCollinearV0 = v0.isCollinearV0(); + currentV0Entry.found = true; + v0List.push_back(currentV0Entry); + } + } + } + // any mode other than 0 will require mcParticles + if constexpr (soa::is_table) { + if (baseOpts.mc_findableMode.value > 0) { + // for search if existing or not + int v0ListReconstructedSize = v0List.size(); + + // find extra candidates, step 1: find subset of tracks that interest + std::vector positiveTrackArray; + std::vector negativeTrackArray; + // vector elements: track index, origin index [, mc collision id, pdg code] + int dummy = -1; // unnecessary in this path + for (const auto& track : tracks) { + if (!track.has_mcParticle()) { + continue; // skip this, it's trouble + } + auto particle = track.template mcParticle_as(); + int originParticleIndex = getOriginatingParticle(particle, dummy, v0BuilderOpts.mc_treatPiToMuDecays); + if (originParticleIndex < 0) { + continue; // skip this, it's trouble (2) + } + auto originParticle = mcParticles.rawIteratorAt(originParticleIndex); + + bool trackIsInteresting = false; + if ( + (originParticle.pdgCode() == 310 && v0BuilderOpts.mc_addGeneratedK0Short.value > 0) || + (originParticle.pdgCode() == 3122 && v0BuilderOpts.mc_addGeneratedLambda.value > 0) || + (originParticle.pdgCode() == -3122 && v0BuilderOpts.mc_addGeneratedAntiLambda.value > 0) || + (originParticle.pdgCode() == 22 && v0BuilderOpts.mc_addGeneratedGamma.value > 0)) { + trackIsInteresting = true; + } + if (!trackIsInteresting) { + continue; // skip this, it's uninteresting + } + + currentTrackEntry.globalId = static_cast(track.globalIndex()); + currentTrackEntry.originId = originParticleIndex; + currentTrackEntry.mcCollisionId = originParticle.mcCollisionId(); + currentTrackEntry.pdgCode = originParticle.pdgCode(); + + // now separate according to particle species + if (track.sign() < 0) { + negativeTrackArray.push_back(currentTrackEntry); + } else { + positiveTrackArray.push_back(currentTrackEntry); + } + } + + // Nested loop only with valuable tracks + for (const auto& positiveTrackIndex : positiveTrackArray) { + for (const auto& negativeTrackIndex : negativeTrackArray) { + if (positiveTrackIndex.originId != negativeTrackIndex.originId) { + continue; // not the same originating particle + } + // findable mode 1: add non-reconstructed as v0Type 8 + if (baseOpts.mc_findableMode.value == 1) { + bool detected = false; + for (int ii = 0; ii < v0ListReconstructedSize; ii++) { + // check if this particular combination already exists in v0List + if (v0List[ii].posTrackId == positiveTrackIndex.globalId && + v0List[ii].negTrackId == negativeTrackIndex.globalId) { + detected = true; + // override pdg code with something useful for cascade findable math + v0List[ii].pdgCode = positiveTrackIndex.pdgCode; + break; + } + } + if (detected == false) { + // collision index: from best-version-of-this-mcCollision + // nota bene: this could be negative, caution advised + currentV0Entry.globalId = -1; + currentV0Entry.collisionId = bestCollisionArray[positiveTrackIndex.mcCollisionId]; + currentV0Entry.posTrackId = positiveTrackIndex.globalId; + currentV0Entry.negTrackId = negativeTrackIndex.globalId; + currentV0Entry.v0Type = 1; + currentV0Entry.pdgCode = positiveTrackIndex.pdgCode; + currentV0Entry.particleId = positiveTrackIndex.originId; + currentV0Entry.isCollinearV0 = false; + if (v0BuilderOpts.mc_addGeneratedGammaMakeCollinear.value && currentV0Entry.pdgCode == 22) { + currentV0Entry.isCollinearV0 = true; + } + currentV0Entry.found = false; + if (bestCollisionArray[positiveTrackIndex.mcCollisionId] < 0) { + collisionLessV0s++; + } + if (v0BuilderOpts.mc_findableDetachedV0.value || currentV0Entry.collisionId >= 0) { + v0List.push_back(currentV0Entry); + } + } + } + // findable mode 2 + if (baseOpts.mc_findableMode.value == 2) { + currentV0Entry.globalId = -1; + currentV0Entry.collisionId = bestCollisionArray[positiveTrackIndex.mcCollisionId]; + currentV0Entry.posTrackId = positiveTrackIndex.globalId; + currentV0Entry.negTrackId = negativeTrackIndex.globalId; + currentV0Entry.v0Type = 1; + currentV0Entry.pdgCode = positiveTrackIndex.pdgCode; + currentV0Entry.particleId = positiveTrackIndex.originId; + currentV0Entry.isCollinearV0 = false; + if (v0BuilderOpts.mc_addGeneratedGammaMakeCollinear.value && currentV0Entry.pdgCode == 22) { + currentV0Entry.isCollinearV0 = true; + } + currentV0Entry.found = false; + for (const auto& v0 : v0s) { + if (v0.posTrackId() == positiveTrackIndex.globalId && + v0.negTrackId() == negativeTrackIndex.globalId) { + // this will override type, but not collision index + // N.B.: collision index checks still desirable! + currentV0Entry.globalId = v0.globalIndex(); + currentV0Entry.v0Type = v0.v0Type(); + currentV0Entry.isCollinearV0 = v0.isCollinearV0(); + currentV0Entry.found = true; + break; + } + } + if (v0BuilderOpts.mc_findableDetachedV0.value || currentV0Entry.collisionId >= 0) { + v0List.push_back(currentV0Entry); + } + } + } + } // end positive / negative track loops + + // fill findable statistics table + histos.fill(HIST("hFindableStatistics"), 0.0, v0s.size()); + histos.fill(HIST("hFindableStatistics"), 1.0, v0List.size()); + histos.fill(HIST("hFindableStatistics"), 2.0, collisionLessV0s); + + } // end findableMode > 0 check + } // end soa::is_table + + // determine properly collision-id-sorted index array for later use + // N.B.: necessary also before cascade part + sorted_v0.clear(); + sorted_v0 = sort_indices(v0List, (baseOpts.mc_findableMode.value > 0)); + + // Cascade part if cores are requested, skip otherwise + if (baseOpts.mEnabledTables[kStoredCascCores] || baseOpts.mEnabledTables[kStoredKFCascCores]) { + if (baseOpts.mc_findableMode.value < 2) { + // simple passthrough: copy existing cascades to build list + for (const auto& cascade : cascades) { + auto const& v0 = cascade.v0(); + currentCascadeEntry.globalId = cascade.globalIndex(); + currentCascadeEntry.collisionId = cascade.collisionId(); + currentCascadeEntry.v0Id = ao2dV0toV0List[v0.globalIndex()]; + currentCascadeEntry.posTrackId = v0.posTrackId(); + currentCascadeEntry.negTrackId = v0.negTrackId(); + currentCascadeEntry.bachTrackId = cascade.bachelorId(); + currentCascadeEntry.found = true; + cascadeList.push_back(currentCascadeEntry); + } + } + + // any mode other than 0 will require mcParticles + if constexpr (soa::is_table) { + if (baseOpts.mc_findableMode.value > 0) { + // for search if existing or not + size_t cascadeListReconstructedSize = cascadeList.size(); + + // determine which tracks are of interest + std::vector bachelorTrackArray; + // vector elements: track index, origin index, mc collision id, pdg code] + int dummy = -1; // unnecessary in this path + for (const auto& track : tracks) { + if (!track.has_mcParticle()) { + continue; // skip this, it's trouble + } + auto particle = track.template mcParticle_as(); + int originParticleIndex = getOriginatingParticle(particle, dummy, cascadeBuilderOpts.mc_treatPiToMuDecays); + if (originParticleIndex < 0) { + continue; // skip this, it's trouble (2) + } + auto originParticle = mcParticles.rawIteratorAt(originParticleIndex); + + bool trackIsInteresting = false; + if ( + (originParticle.pdgCode() == 3312 && cascadeBuilderOpts.mc_addGeneratedXiMinus.value > 0) || + (originParticle.pdgCode() == -3312 && cascadeBuilderOpts.mc_addGeneratedXiPlus.value > 0) || + (originParticle.pdgCode() == 3334 && cascadeBuilderOpts.mc_addGeneratedOmegaMinus.value > 0) || + (originParticle.pdgCode() == -3334 && cascadeBuilderOpts.mc_addGeneratedOmegaPlus.value > 0)) { + trackIsInteresting = true; + } + if (!trackIsInteresting) { + continue; // skip this, it's uninteresting + } + + currentTrackEntry.globalId = static_cast(track.globalIndex()); + currentTrackEntry.originId = originParticleIndex; + currentTrackEntry.mcCollisionId = originParticle.mcCollisionId(); + currentTrackEntry.pdgCode = originParticle.pdgCode(); + + // populate list of bachelor tracks to pair + bachelorTrackArray.push_back(currentTrackEntry); + } + + // determine which V0s are of interest to pair and do pairing + for (size_t v0i = 0; v0i < v0List.size(); v0i++) { + auto v0 = v0List[sorted_v0[v0i]]; + + if (std::abs(v0.pdgCode) != 3122) { + continue; // this V0 isn't a lambda, can't come from a cascade: skip + } + if (v0.particleId < 0) { + continue; // no de-referencing possible (e.g. background, ...) + } + auto v0Particle = mcParticles.rawIteratorAt(v0.particleId); + + int v0OriginParticleIndex = -1; + if (v0Particle.has_mothers()) { + auto const& motherList = v0Particle.template mothers_as(); + if (motherList.size() == 1) { + for (const auto& mother : motherList) { + v0OriginParticleIndex = mother.globalIndex(); + } + } + } + if (v0OriginParticleIndex < 0) { + continue; + } + auto v0OriginParticle = mcParticles.rawIteratorAt(v0OriginParticleIndex); + + if (std::abs(v0OriginParticle.pdgCode()) != 3312 && std::abs(v0OriginParticle.pdgCode()) != 3334) { + continue; // this V0 does not come from any particle of interest, don't try + } + for (const auto& bachelorTrackIndex : bachelorTrackArray) { + if (bachelorTrackIndex.originId != v0OriginParticle.globalIndex()) { + continue; + } + // if we are here: v0 origin is 3312 or 3334, bachelor origin matches V0 origin + // findable mode 1: add non-reconstructed as cascadeType 1 + if (baseOpts.mc_findableMode.value == 1) { + bool detected = false; + for (size_t ii = 0; ii < cascadeListReconstructedSize; ii++) { + // check if this particular combination already exists in cascadeList + // caution: use track indices (immutable) but not V0 indices (re-indexing) + if (cascadeList[ii].posTrackId == v0.posTrackId && + cascadeList[ii].negTrackId == v0.negTrackId && + cascadeList[ii].bachTrackId == bachelorTrackIndex.globalId) { + detected = true; + break; + } + } + if (detected == false) { + // collision index: from best-version-of-this-mcCollision + // nota bene: this could be negative, caution advised + currentCascadeEntry.globalId = -1; + currentCascadeEntry.collisionId = bestCollisionArray[bachelorTrackIndex.mcCollisionId]; + currentCascadeEntry.v0Id = v0i; // correct information here + currentCascadeEntry.posTrackId = v0.posTrackId; + currentCascadeEntry.negTrackId = v0.negTrackId; + currentCascadeEntry.bachTrackId = bachelorTrackIndex.globalId; + currentCascadeEntry.found = false; + cascadeList.push_back(currentCascadeEntry); + if (bestCollisionArray[bachelorTrackIndex.mcCollisionId] < 0) { + collisionLessCascades++; + } + if (cascadeBuilderOpts.mc_findableDetachedCascade.value || currentCascadeEntry.collisionId >= 0) { + cascadeList.push_back(currentCascadeEntry); + } + } + } + + // findable mode 2: determine type based on cascade table, + // with type 1 being reserved to findable-but-not-found + if (baseOpts.mc_findableMode.value == 2) { + currentCascadeEntry.globalId = -1; + currentCascadeEntry.collisionId = bestCollisionArray[bachelorTrackIndex.mcCollisionId]; + currentCascadeEntry.v0Id = v0i; // fill this in one go later + currentCascadeEntry.posTrackId = v0.posTrackId; + currentCascadeEntry.negTrackId = v0.negTrackId; + currentCascadeEntry.bachTrackId = bachelorTrackIndex.globalId; + currentCascadeEntry.found = false; + if (bestCollisionArray[bachelorTrackIndex.mcCollisionId] < 0) { + collisionLessCascades++; + } + for (const auto& cascade : cascades) { + auto const& v0fromAOD = cascade.v0(); + if (v0fromAOD.posTrackId() == v0.posTrackId && + v0fromAOD.negTrackId() == v0.negTrackId && + cascade.bachelorId() == bachelorTrackIndex.globalId) { + // this will override type, but not collision index + // N.B.: collision index checks still desirable! + currentCascadeEntry.found = true; + currentCascadeEntry.globalId = cascade.globalIndex(); + break; + } + } + if (cascadeBuilderOpts.mc_findableDetachedCascade.value || currentCascadeEntry.collisionId >= 0) { + cascadeList.push_back(currentCascadeEntry); + } + } + } // end bachelorTrackArray loop + } // end v0List loop + + // at this stage, cascadeList is alright, but the v0 indices are still not + // correct. We'll have to loop over all V0s and find the appropriate matches + // ---> but only in mode 1, and only for AO2D-native V0s + if (baseOpts.mc_findableMode.value == 1) { + for (size_t casci = 0; casci < cascadeListReconstructedSize; casci++) { + // loop over v0List to find corresponding v0 index, but do it in sorted way + for (size_t v0i = 0; v0i < v0List.size(); v0i++) { + auto v0 = v0List[sorted_v0[v0i]]; + if (cascadeList[casci].posTrackId == v0.posTrackId && + cascadeList[casci].negTrackId == v0.negTrackId) { + cascadeList[casci].v0Id = v0i; // fix, point to correct V0 index + break; + } + } + } + } + // we should now be done! collect statistics + histos.fill(HIST("hFindableStatistics"), 3.0, cascades.size()); + histos.fill(HIST("hFindableStatistics"), 4.0, cascadeList.size()); + histos.fill(HIST("hFindableStatistics"), 5.0, collisionLessCascades); + + } // end findable mode check + } // end soa::is_table + + // we need to allow for sorted use of cascadeList + sorted_cascade.clear(); + sorted_cascade = sort_indices(cascadeList, (baseOpts.mc_findableMode.value > 0)); + } + + LOGF(info, "AO2D input: %i V0s, %i cascades. Building list sizes: %i V0s, %i cascades", v0s.size(), cascades.size(), v0List.size(), cascadeList.size()); + } + + //__________________________________________________ + template + void markV0sUsedInCascades(TV0s const& v0s, TCascades const& cascades, TTrackedCascades const& trackedCascades) + { + int v0sUsedInCascades = 0; + v0sFromCascades.clear(); + v0Map.clear(); + v0Map.resize(v0List.size(), -2); // marks not used + if (baseOpts.useV0BufferForCascades.value == false) { + return; // don't attempt to mark needlessly + } + if (baseOpts.mEnabledTables[kStoredCascCores]) { + for (const auto& cascade : cascadeList) { + if (cascade.v0Id < 0) + continue; + if (v0Map[cascade.v0Id] == -2) { + v0sUsedInCascades++; + } + v0Map[cascade.v0Id] = -1; // marks used (but isn't the index of a properly built V0, which would be >= 0) + } + } + int trackedCascadeCount = 0; + if constexpr (soa::is_table) { + // tracked only created outside of findable mode + if (baseOpts.mEnabledTables[kStoredTraCascCores] && baseOpts.mc_findableMode.value == 0) { + trackedCascadeCount = trackedCascades.size(); + for (const auto& trackedCascade : trackedCascades) { + auto const& cascade = trackedCascade.cascade(); + if (v0Map[ao2dV0toV0List[cascade.v0Id()]] == -2) { + v0sUsedInCascades++; + } + v0Map[ao2dV0toV0List[cascade.v0Id()]] = -1; // marks used (but isn't the index of a built V0, which would be >= 0) + } + } + } + LOGF(debug, "V0 total %i, Cascade total %i, Tracked cascade total %i, V0s flagged used in cascades: %i", v0s.size(), cascades.size(), trackedCascadeCount, v0sUsedInCascades); + } + + //__________________________________________________ + template + void buildV0s(THistoRegistry& histos, TCollisions const& collisions, TV0s const& v0s, TTracks const& tracks, TMCParticles const& mcParticles, TProducts& products) + { + // prepare MC containers (not necessarily used) + std::vector mcV0infos; // V0MCCore information + std::vector mcParticleIsReco; + + if constexpr (soa::is_table) { + // do this if provided with a mcParticle table as well + mcParticleIsReco.resize(mcParticles.size(), false); + } + + int nV0s = 0; + // Loops over all V0s in the time frame + histos.fill(HIST("hInputStatistics"), kV0CoresBase, v0s.size()); + for (size_t iv0 = 0; iv0 < v0List.size(); iv0++) { + const auto& v0 = v0List[sorted_v0[iv0]]; + + if (!baseOpts.mEnabledTables[kV0CoresBase] && v0Map[iv0] == -2) { + // this v0 hasn't been used by cascades and we're not generating V0s, so skip it + products.v0dataLink(-1, -1); + continue; + } + + // Get tracks and generate candidate + // if collisionId positive: get vertex, negative: origin + // could be replaced by mean vertex (but without much benefit...) + float pvX = 0.0f, pvY = 0.0f, pvZ = 0.0f; + if (v0.collisionId >= 0) { + auto const& collision = collisions.rawIteratorAt(v0.collisionId); + pvX = collision.posX(); + pvY = collision.posY(); + pvZ = collision.posZ(); + } + auto const& posTrack = tracks.rawIteratorAt(v0.posTrackId); + auto const& negTrack = tracks.rawIteratorAt(v0.negTrackId); + + auto posTrackPar = getTrackParCov(posTrack); + auto negTrackPar = getTrackParCov(negTrack); + + // handle TPC-only tracks properly (photon conversions) + if (v0BuilderOpts.moveTPCOnlyTracks) { + bool isPosTPCOnly = (posTrack.hasTPC() && !posTrack.hasITS() && !posTrack.hasTRD() && !posTrack.hasTOF()); + if (isPosTPCOnly) { + // Nota bene: positive is TPC-only -> this entire V0 merits treatment as photon candidate + posTrackPar.setPID(o2::track::PID::Electron); + negTrackPar.setPID(o2::track::PID::Electron); + + auto const& collision = collisions.rawIteratorAt(v0.collisionId); + if (!mVDriftMgr.moveTPCTrack(collision, posTrack, posTrackPar)) { + return; + } + } + + bool isNegTPCOnly = (negTrack.hasTPC() && !negTrack.hasITS() && !negTrack.hasTRD() && !negTrack.hasTOF()); + if (isNegTPCOnly) { + // Nota bene: negative is TPC-only -> this entire V0 merits treatment as photon candidate + posTrackPar.setPID(o2::track::PID::Electron); + negTrackPar.setPID(o2::track::PID::Electron); + + auto const& collision = collisions.rawIteratorAt(v0.collisionId); + if (!mVDriftMgr.moveTPCTrack(collision, negTrack, negTrackPar)) { + return; + } + } + } + + if (!straHelper.buildV0Candidate(v0.collisionId, pvX, pvY, pvZ, posTrack, negTrack, posTrackPar, negTrackPar, v0.isCollinearV0, baseOpts.mEnabledTables[kV0Covs], true)) { + products.v0dataLink(-1, -1); + continue; + } + if constexpr (requires { posTrack.tpcNSigmaEl(); }) { + if (preSelectOpts.preselectOnlyDesiredV0s) { + float lPt = RecoDecay::sqrtSumOfSquares( + straHelper.v0.positiveMomentum[0] + straHelper.v0.negativeMomentum[0], + straHelper.v0.positiveMomentum[1] + straHelper.v0.negativeMomentum[1]); + + float lPtot = RecoDecay::sqrtSumOfSquares( + straHelper.v0.positiveMomentum[0] + straHelper.v0.negativeMomentum[0], + straHelper.v0.positiveMomentum[1] + straHelper.v0.negativeMomentum[1], + straHelper.v0.positiveMomentum[2] + straHelper.v0.negativeMomentum[2]); + + float lLengthTraveled = RecoDecay::sqrtSumOfSquares( + straHelper.v0.position[0] - pvX, + straHelper.v0.position[1] - pvY, + straHelper.v0.position[2] - pvZ); + + uint8_t maskV0Preselection = 0; + + if ( // photon PID, mass, lifetime selection + std::abs(posTrack.tpcNSigmaEl()) < preSelectOpts.maxTPCpidNsigma && + std::abs(negTrack.tpcNSigmaEl()) < preSelectOpts.maxTPCpidNsigma && + std::abs(straHelper.v0.massGamma) < preSelectOpts.massCutPhoton) { + BITSET(maskV0Preselection, selGamma); + } + + if ( // K0Short PID, mass, lifetime selection + std::abs(posTrack.tpcNSigmaPi()) < preSelectOpts.maxTPCpidNsigma && + std::abs(negTrack.tpcNSigmaPi()) < preSelectOpts.maxTPCpidNsigma && + o2::constants::physics::MassKaonNeutral * lLengthTraveled / (lPtot + 1e-13) < preSelectOpts.lifetimeCut->get("lifetimeCutK0S") && + std::abs(straHelper.v0.massK0Short - o2::constants::physics::MassKaonNeutral) < preSelectOpts.massWindownumberOfSigmas * getMassSigmaK0Short(lPt) + preSelectOpts.massWindowSafetyMargin) { + BITSET(maskV0Preselection, selK0Short); + } + + if ( // Lambda PID, mass, lifetime selection + std::abs(posTrack.tpcNSigmaPr()) < preSelectOpts.maxTPCpidNsigma && + std::abs(negTrack.tpcNSigmaPi()) < preSelectOpts.maxTPCpidNsigma && + o2::constants::physics::MassLambda * lLengthTraveled / (lPtot + 1e-13) < preSelectOpts.lifetimeCut->get("lifetimeCutLambda") && + std::abs(straHelper.v0.massLambda - o2::constants::physics::MassLambda) < preSelectOpts.massWindownumberOfSigmas * getMassSigmaLambda(lPt) + preSelectOpts.massWindowSafetyMargin) { + BITSET(maskV0Preselection, selLambda); + } + + if ( // antiLambda PID, mass, lifetime selection + std::abs(posTrack.tpcNSigmaPi()) < preSelectOpts.maxTPCpidNsigma && + std::abs(negTrack.tpcNSigmaPr()) < preSelectOpts.maxTPCpidNsigma && + o2::constants::physics::MassLambda * lLengthTraveled / (lPtot + 1e-13) < preSelectOpts.lifetimeCut->get("lifetimeCutLambda") && + std::abs(straHelper.v0.massAntiLambda - o2::constants::physics::MassLambda) < preSelectOpts.massWindownumberOfSigmas * getMassSigmaLambda(lPt) + preSelectOpts.massWindowSafetyMargin) { + BITSET(maskV0Preselection, selAntiLambda); + } + + histos.fill(HIST("hPreselectionV0s"), maskV0Preselection); + + if (maskV0Preselection == 0) { + products.v0dataLink(-1, -1); + continue; + } + } + } + if (v0Map[iv0] == -1 && baseOpts.useV0BufferForCascades) { + v0Map[iv0] = v0sFromCascades.size(); // provide actual valid index in buffer + v0sFromCascades.push_back(straHelper.v0); + } + // fill requested cursors only if type is not 0 + if (v0.v0Type == 1 || (v0.v0Type > 1 && v0BuilderOpts.generatePhotonCandidates)) { + nV0s++; + if (baseOpts.mEnabledTables[kV0Indices]) { + // for referencing (especially - but not only - when using derived data) + products.v0indices(v0.posTrackId, v0.negTrackId, + v0.collisionId, iv0); + histos.fill(HIST("hTableBuildingStatistics"), kV0Indices); + } + if (baseOpts.mEnabledTables[kV0TrackXs]) { + // further decay chains may need this + products.v0trackXs(straHelper.v0.positiveTrackX, straHelper.v0.negativeTrackX); + histos.fill(HIST("hTableBuildingStatistics"), kV0TrackXs); + } + if (baseOpts.mEnabledTables[kV0CoresBase]) { + // standard analysis + products.v0cores(straHelper.v0.position[0], straHelper.v0.position[1], straHelper.v0.position[2], + straHelper.v0.positiveMomentum[0], straHelper.v0.positiveMomentum[1], straHelper.v0.positiveMomentum[2], + straHelper.v0.negativeMomentum[0], straHelper.v0.negativeMomentum[1], straHelper.v0.negativeMomentum[2], + straHelper.v0.daughterDCA, + straHelper.v0.positiveDCAxy, + straHelper.v0.negativeDCAxy, + TMath::Cos(straHelper.v0.pointingAngle), + straHelper.v0.dcaToPV, + v0.v0Type); + products.v0dataLink(products.v0cores.lastIndex(), -1); + histos.fill(HIST("hTableBuildingStatistics"), kV0CoresBase); + } + if (baseOpts.mEnabledTables[kV0TraPosAtDCAs]) { + // for tracking studies + products.v0dauPositions(straHelper.v0.positivePosition[0], straHelper.v0.positivePosition[1], straHelper.v0.positivePosition[2], + straHelper.v0.negativePosition[0], straHelper.v0.negativePosition[1], straHelper.v0.negativePosition[2]); + histos.fill(HIST("hTableBuildingStatistics"), kV0TraPosAtDCAs); + } + if (baseOpts.mEnabledTables[kV0TraPosAtIUs]) { + // for tracking studies + std::array positivePositionIU; + std::array negativePositionIU; + o2::track::TrackPar positiveTrackParam = getTrackPar(posTrack); + o2::track::TrackPar negativeTrackParam = getTrackPar(negTrack); + positiveTrackParam.getXYZGlo(positivePositionIU); + negativeTrackParam.getXYZGlo(negativePositionIU); + products.v0dauPositionsIU(positivePositionIU[0], positivePositionIU[1], positivePositionIU[2], + negativePositionIU[0], negativePositionIU[1], negativePositionIU[2]); + histos.fill(HIST("hTableBuildingStatistics"), kV0TraPosAtIUs); + } + if (baseOpts.mEnabledTables[kV0Covs]) { + products.v0covs(straHelper.v0.positionCovariance, straHelper.v0.momentumCovariance); + histos.fill(HIST("hTableBuildingStatistics"), kV0Covs); + } + + //_________________________________________________________ + // MC handling part + if constexpr (soa::is_table) { + // only worry about this if someone else worried about this + if ((baseOpts.mEnabledTables[kV0MCCores] || baseOpts.mEnabledTables[kMcV0Labels] || baseOpts.mEnabledTables[kV0MCCollRefs])) { + thisInfo.label = -1; + thisInfo.motherLabel = -1; + thisInfo.pdgCode = 0; + thisInfo.pdgCodeMother = 0; + thisInfo.pdgCodePositive = 0; + thisInfo.pdgCodeNegative = 0; + thisInfo.mcCollision = -1; + thisInfo.xyz[0] = thisInfo.xyz[1] = thisInfo.xyz[2] = 0.0f; + thisInfo.posP[0] = thisInfo.posP[1] = thisInfo.posP[2] = 0.0f; + thisInfo.negP[0] = thisInfo.negP[1] = thisInfo.negP[2] = 0.0f; + thisInfo.momentum[0] = thisInfo.momentum[1] = thisInfo.momentum[2] = 0.0f; + + // Association check + // There might be smarter ways of doing this in the future + if (negTrack.has_mcParticle() && posTrack.has_mcParticle()) { + auto lMCNegTrack = negTrack.template mcParticle_as(); + auto lMCPosTrack = posTrack.template mcParticle_as(); + + thisInfo.pdgCodePositive = lMCPosTrack.pdgCode(); + thisInfo.pdgCodeNegative = lMCNegTrack.pdgCode(); + thisInfo.processPositive = lMCPosTrack.getProcess(); + thisInfo.processNegative = lMCNegTrack.getProcess(); + thisInfo.posP[0] = lMCPosTrack.px(); + thisInfo.posP[1] = lMCPosTrack.py(); + thisInfo.posP[2] = lMCPosTrack.pz(); + thisInfo.negP[0] = lMCNegTrack.px(); + thisInfo.negP[1] = lMCNegTrack.py(); + thisInfo.negP[2] = lMCNegTrack.pz(); + + // check for pi -> mu + antineutrino decay + // if present, de-reference original V0 correctly and provide label to original object + // NOTA BENE: the prong info will still correspond to a muon, treat carefully! + int negOriginating = -1, posOriginating = -1, particleForDecayPositionIdx = -1; + negOriginating = getOriginatingParticle(lMCNegTrack, particleForDecayPositionIdx, v0BuilderOpts.mc_treatPiToMuDecays); + posOriginating = getOriginatingParticle(lMCPosTrack, particleForDecayPositionIdx, v0BuilderOpts.mc_treatPiToMuDecays); + + if (negOriginating > -1 && negOriginating == posOriginating) { + auto originatingV0 = mcParticles.rawIteratorAt(negOriginating); + auto particleForDecayPosition = mcParticles.rawIteratorAt(particleForDecayPositionIdx); + + thisInfo.label = originatingV0.globalIndex(); + thisInfo.xyz[0] = particleForDecayPosition.vx(); + thisInfo.xyz[1] = particleForDecayPosition.vy(); + thisInfo.xyz[2] = particleForDecayPosition.vz(); + + if (originatingV0.has_mcCollision()) { + thisInfo.mcCollision = originatingV0.mcCollisionId(); // save this reference, please + } + + // acquire information + thisInfo.pdgCode = originatingV0.pdgCode(); + thisInfo.isPhysicalPrimary = originatingV0.isPhysicalPrimary(); + thisInfo.momentum[0] = originatingV0.px(); + thisInfo.momentum[1] = originatingV0.py(); + thisInfo.momentum[2] = originatingV0.pz(); + + if (originatingV0.has_mothers()) { + for (const auto& lV0Mother : originatingV0.template mothers_as()) { + thisInfo.pdgCodeMother = lV0Mother.pdgCode(); + thisInfo.motherLabel = lV0Mother.globalIndex(); + } + } + } + + } // end association check + // Construct label table (note: this will be joinable with V0Datas!) + if (baseOpts.mEnabledTables[kMcV0Labels]) { + products.v0labels(thisInfo.label, thisInfo.motherLabel); + histos.fill(HIST("hTableBuildingStatistics"), kMcV0Labels); + } + + // Construct found tag + if (baseOpts.mEnabledTables[kV0FoundTags]) { + products.v0FoundTag(v0.found); + histos.fill(HIST("hTableBuildingStatistics"), kV0FoundTags); + } + + // Mark mcParticle as recoed (no searching necessary afterwards) + if (thisInfo.label > -1) { + mcParticleIsReco[thisInfo.label] = true; + } + + // ---] Symmetric populate [--- + // in this approach, V0Cores will be joinable with V0MCCores. + // this is the most pedagogical approach, but it is also more limited + // and it might use more disk space unnecessarily. + if (v0BuilderOpts.mc_populateV0MCCoresSymmetric) { + if (baseOpts.mEnabledTables[kV0MCCores]) { + products.v0mccores( + thisInfo.label, thisInfo.pdgCode, + thisInfo.pdgCodeMother, thisInfo.pdgCodePositive, thisInfo.pdgCodeNegative, + thisInfo.isPhysicalPrimary, thisInfo.xyz[0], thisInfo.xyz[1], thisInfo.xyz[2], + thisInfo.posP[0], thisInfo.posP[1], thisInfo.posP[2], + thisInfo.negP[0], thisInfo.negP[1], thisInfo.negP[2], + thisInfo.momentum[0], thisInfo.momentum[1], thisInfo.momentum[2]); + histos.fill(HIST("hTableBuildingStatistics"), kV0MCCores); + histos.fill(HIST("hPrimaryV0s"), 0); + if (thisInfo.isPhysicalPrimary) + histos.fill(HIST("hPrimaryV0s"), 1); + } + if (baseOpts.mEnabledTables[kV0MCCollRefs]) { + products.v0mccollref(thisInfo.mcCollision); + histos.fill(HIST("hTableBuildingStatistics"), kV0MCCollRefs); + } + + // n.b. placing the interlink index here allows for the writing of + // code that is agnostic with respect to the joinability of + // V0Cores and V0MCCores (always dereference -> safe) + if (baseOpts.mEnabledTables[kV0CoreMCLabels]) { + products.v0CoreMCLabels(iv0); // interlink index + histos.fill(HIST("hTableBuildingStatistics"), kV0CoreMCLabels); + } + } + // ---] Asymmetric populate [--- + // in this approach, V0Cores will NOT be joinable with V0MCCores. + // an additional reference to V0MCCore that IS joinable with V0Cores + // will be provided to the user. + if (v0BuilderOpts.mc_populateV0MCCoresAsymmetric) { + int thisV0MCCoreIndex = -1; + // step 1: check if this element is already provided in the table + // using the packedIndices variable calculated above + for (uint32_t ii = 0; ii < mcV0infos.size(); ii++) { + if (thisInfo.label == mcV0infos[ii].label && mcV0infos[ii].label > -1) { + thisV0MCCoreIndex = ii; + break; // this exists already in list + } + } + if (thisV0MCCoreIndex < 0 && thisInfo.label > -1) { + // this V0MCCore does not exist yet. Create it and reference it + thisV0MCCoreIndex = mcV0infos.size(); + mcV0infos.push_back(thisInfo); + } + if (baseOpts.mEnabledTables[kV0CoreMCLabels]) { + products.v0CoreMCLabels(thisV0MCCoreIndex); // interlink index + histos.fill(HIST("hTableBuildingStatistics"), kV0CoreMCLabels); + } + } + } // enabled tables check + } // constexpr requires check + } + } + + // finish populating V0MCCores if in asymmetric mode + if constexpr (soa::is_table) { + if (v0BuilderOpts.mc_populateV0MCCoresAsymmetric && (baseOpts.mEnabledTables[kV0MCCores] || baseOpts.mEnabledTables[kV0MCCollRefs])) { + // first step: add any un-recoed v0mmcores that were requested + for (const auto& mcParticle : mcParticles) { + thisInfo.label = -1; + thisInfo.motherLabel = -1; + thisInfo.pdgCode = 0; + thisInfo.pdgCodeMother = -1; + thisInfo.pdgCodePositive = -1; + thisInfo.pdgCodeNegative = -1; + thisInfo.mcCollision = -1; + thisInfo.xyz[0] = thisInfo.xyz[1] = thisInfo.xyz[2] = 0.0f; + thisInfo.posP[0] = thisInfo.posP[1] = thisInfo.posP[2] = 0.0f; + thisInfo.negP[0] = thisInfo.negP[1] = thisInfo.negP[2] = 0.0f; + thisInfo.momentum[0] = thisInfo.momentum[1] = thisInfo.momentum[2] = 0.0f; + + if (mcParticleIsReco[mcParticle.globalIndex()] == true) + continue; // skip if already created in list + + if (std::fabs(mcParticle.y()) > v0BuilderOpts.mc_rapidityWindow) + continue; // skip outside midrapidity + + if (v0BuilderOpts.mc_keepOnlyPhysicalPrimary && !mcParticle.isPhysicalPrimary()) + continue; // skip secondary MC V0s + + if ( + (v0BuilderOpts.mc_addGeneratedK0Short && mcParticle.pdgCode() == 310) || + (v0BuilderOpts.mc_addGeneratedLambda && mcParticle.pdgCode() == 3122) || + (v0BuilderOpts.mc_addGeneratedAntiLambda && mcParticle.pdgCode() == -3122) || + (v0BuilderOpts.mc_addGeneratedGamma && mcParticle.pdgCode() == 22)) { + thisInfo.pdgCode = mcParticle.pdgCode(); + thisInfo.isPhysicalPrimary = mcParticle.isPhysicalPrimary(); + thisInfo.label = mcParticle.globalIndex(); + + if (mcParticle.has_mcCollision()) { + thisInfo.mcCollision = mcParticle.mcCollisionId(); // save this reference, please + } + + // + thisInfo.momentum[0] = mcParticle.px(); + thisInfo.momentum[1] = mcParticle.py(); + thisInfo.momentum[2] = mcParticle.pz(); + + if (mcParticle.has_mothers()) { + auto const& mother = mcParticle.template mothers_first_as(); + thisInfo.pdgCodeMother = mother.pdgCode(); + thisInfo.motherLabel = mother.globalIndex(); + } + if (mcParticle.has_daughters()) { + auto const& daughters = mcParticle.template daughters_as(); + + for (const auto& dau : daughters) { + if (dau.getProcess() != 4) + continue; + + if (dau.pdgCode() > 0) { + thisInfo.pdgCodePositive = dau.pdgCode(); + thisInfo.processPositive = dau.getProcess(); + thisInfo.posP[0] = dau.px(); + thisInfo.posP[1] = dau.py(); + thisInfo.posP[2] = dau.pz(); + thisInfo.xyz[0] = dau.vx(); + thisInfo.xyz[1] = dau.vy(); + thisInfo.xyz[2] = dau.vz(); + } + if (dau.pdgCode() < 0) { + thisInfo.pdgCodeNegative = dau.pdgCode(); + thisInfo.processNegative = dau.getProcess(); + thisInfo.negP[0] = dau.px(); + thisInfo.negP[1] = dau.py(); + thisInfo.negP[2] = dau.pz(); + } + } + } + + // if I got here, it means this MC particle was not recoed and is of interest. Add it please + mcV0infos.push_back(thisInfo); + } + } + + for (const auto& info : mcV0infos) { + if (baseOpts.mEnabledTables[kV0MCCores]) { + products.v0mccores( + info.label, info.pdgCode, + info.pdgCodeMother, info.pdgCodePositive, info.pdgCodeNegative, + info.isPhysicalPrimary, info.xyz[0], info.xyz[1], info.xyz[2], + info.posP[0], info.posP[1], info.posP[2], + info.negP[0], info.negP[1], info.negP[2], + info.momentum[0], info.momentum[1], info.momentum[2]); + histos.fill(HIST("hTableBuildingStatistics"), kV0MCCores); + histos.fill(HIST("hPrimaryV0s"), 0); + if (info.isPhysicalPrimary) + histos.fill(HIST("hPrimaryV0s"), 1); + } + if (baseOpts.mEnabledTables[kV0MCCollRefs]) { + products.v0mccollref(info.mcCollision); + histos.fill(HIST("hTableBuildingStatistics"), kV0MCCollRefs); + } + } + } // end V0MCCores filling in case of MC + } // end constexpr requires mcParticles + + LOGF(debug, "V0s in DF: %i, V0s built: %i, V0s built and buffered for cascades: %i.", v0s.size(), nV0s, v0sFromCascades.size()); + } + + //__________________________________________________ + template + void extractMonteCarloProperties(TTrack const& posTrack, TTrack const& negTrack, TTrack const& bachTrack, TMCParticles const& mcParticles) + { + // encapsulates acquisition of MC properties from MC + thisCascInfo.pdgCode = -1, thisCascInfo.pdgCodeMother = -1; + thisCascInfo.pdgCodePositive = -1, thisCascInfo.pdgCodeNegative = -1; + thisCascInfo.pdgCodeBachelor = -1, thisCascInfo.pdgCodeV0 = -1; + thisCascInfo.isPhysicalPrimary = false; + thisCascInfo.xyz[0] = -999.0f, thisCascInfo.xyz[1] = -999.0f, thisCascInfo.xyz[2] = -999.0f; + thisCascInfo.lxyz[0] = -999.0f, thisCascInfo.lxyz[1] = -999.0f, thisCascInfo.lxyz[2] = -999.0f; + thisCascInfo.posP[0] = -999.0f, thisCascInfo.posP[1] = -999.0f, thisCascInfo.posP[2] = -999.0f; + thisCascInfo.negP[0] = -999.0f, thisCascInfo.negP[1] = -999.0f, thisCascInfo.negP[2] = -999.0f; + thisCascInfo.bachP[0] = -999.0f, thisCascInfo.bachP[1] = -999.0f, thisCascInfo.bachP[2] = -999.0f; + thisCascInfo.momentum[0] = -999.0f, thisCascInfo.momentum[1] = -999.0f, thisCascInfo.momentum[2] = -999.0f; + thisCascInfo.label = -1, thisCascInfo.motherLabel = -1; + thisCascInfo.mcParticlePositive = -1; + thisCascInfo.mcParticleNegative = -1; + thisCascInfo.mcParticleBachelor = -1; + + // Association check + // There might be smarter ways of doing this in the future + if (negTrack.has_mcParticle() && posTrack.has_mcParticle() && bachTrack.has_mcParticle()) { + auto lMCBachTrack = bachTrack.template mcParticle_as(); + auto lMCNegTrack = negTrack.template mcParticle_as(); + auto lMCPosTrack = posTrack.template mcParticle_as(); + + thisCascInfo.mcParticlePositive = lMCPosTrack.globalIndex(); + thisCascInfo.mcParticleNegative = lMCNegTrack.globalIndex(); + thisCascInfo.mcParticleBachelor = lMCBachTrack.globalIndex(); + thisCascInfo.pdgCodePositive = lMCPosTrack.pdgCode(); + thisCascInfo.pdgCodeNegative = lMCNegTrack.pdgCode(); + thisCascInfo.pdgCodeBachelor = lMCBachTrack.pdgCode(); + thisCascInfo.posP[0] = lMCPosTrack.px(); + thisCascInfo.posP[1] = lMCPosTrack.py(); + thisCascInfo.posP[2] = lMCPosTrack.pz(); + thisCascInfo.negP[0] = lMCNegTrack.px(); + thisCascInfo.negP[1] = lMCNegTrack.py(); + thisCascInfo.negP[2] = lMCNegTrack.pz(); + thisCascInfo.bachP[0] = lMCBachTrack.px(); + thisCascInfo.bachP[1] = lMCBachTrack.py(); + thisCascInfo.bachP[2] = lMCBachTrack.pz(); + thisCascInfo.processPositive = lMCPosTrack.getProcess(); + thisCascInfo.processNegative = lMCNegTrack.getProcess(); + thisCascInfo.processBachelor = lMCBachTrack.getProcess(); + + // Step 0: treat pi -> mu + antineutrino + // if present, de-reference original V0 correctly and provide label to original object + // NOTA BENE: the prong info will still correspond to a muon, treat carefully! + int negOriginating = -1, posOriginating = -1, bachOriginating = -1; + int particleForLambdaDecayPositionIdx = -1, particleForCascadeDecayPositionIdx = -1; + negOriginating = getOriginatingParticle(lMCNegTrack, particleForLambdaDecayPositionIdx, cascadeBuilderOpts.mc_treatPiToMuDecays); + posOriginating = getOriginatingParticle(lMCPosTrack, particleForLambdaDecayPositionIdx, cascadeBuilderOpts.mc_treatPiToMuDecays); + bachOriginating = getOriginatingParticle(lMCBachTrack, particleForCascadeDecayPositionIdx, cascadeBuilderOpts.mc_treatPiToMuDecays); + + if (negOriginating > -1 && negOriginating == posOriginating) { + auto originatingV0 = mcParticles.rawIteratorAt(negOriginating); + auto particleForLambdaDecayPosition = mcParticles.rawIteratorAt(particleForLambdaDecayPositionIdx); + + thisCascInfo.label = originatingV0.globalIndex(); + thisCascInfo.lxyz[0] = particleForLambdaDecayPosition.vx(); + thisCascInfo.lxyz[1] = particleForLambdaDecayPosition.vy(); + thisCascInfo.lxyz[2] = particleForLambdaDecayPosition.vz(); + thisCascInfo.pdgCodeV0 = originatingV0.pdgCode(); + + if (originatingV0.has_mothers()) { + for (const auto& lV0Mother : originatingV0.template mothers_as()) { + if (lV0Mother.globalIndex() == bachOriginating) { // found mother particle + thisCascInfo.label = lV0Mother.globalIndex(); + + if (lV0Mother.has_mcCollision()) { + thisCascInfo.mcCollision = lV0Mother.mcCollisionId(); // save this reference, please + } + + thisCascInfo.pdgCode = lV0Mother.pdgCode(); + thisCascInfo.isPhysicalPrimary = lV0Mother.isPhysicalPrimary(); + thisCascInfo.xyz[0] = originatingV0.vx(); + thisCascInfo.xyz[1] = originatingV0.vy(); + thisCascInfo.xyz[2] = originatingV0.vz(); + thisCascInfo.momentum[0] = lV0Mother.px(); + thisCascInfo.momentum[1] = lV0Mother.py(); + thisCascInfo.momentum[2] = lV0Mother.pz(); + if (lV0Mother.has_mothers()) { + for (const auto& lV0GrandMother : lV0Mother.template mothers_as()) { + thisCascInfo.pdgCodeMother = lV0GrandMother.pdgCode(); + thisCascInfo.motherLabel = lV0GrandMother.globalIndex(); + } + } + } + } // end v0 mother loop + } // end has_mothers check for V0 + } // end conditional of pos/neg originating being the same + } // end association check + } + + //__________________________________________________ + template + void buildCascades(THistoRegistry& histos, TCollisions const& collisions, TCascades const& cascades, TTracks const& tracks, TMCParticles const& mcParticles, TProducts& products) + { + // prepare MC containers (not necessarily used) + std::vector mcCascinfos; // V0MCCore information + std::vector mcParticleIsReco; + + if constexpr (soa::is_table) { + // do this if provided with a mcParticle table as well + mcParticleIsReco.resize(mcParticles.size(), false); + } + + if (!baseOpts.mEnabledTables[kStoredCascCores]) { + return; // don't do if no request for cascades in place + } + int nCascades = 0; + // Loops over all cascades in the time frame + histos.fill(HIST("hInputStatistics"), kStoredCascCores, cascades.size()); + for (size_t icascade = 0; icascade < cascades.size(); icascade++) { + // Get tracks and generate candidate + auto const& cascade = cascades[sorted_cascade[icascade]]; + // if collisionId positive: get vertex, negative: origin + // could be replaced by mean vertex (but without much benefit...) + float pvX = 0.0f, pvY = 0.0f, pvZ = 0.0f; + if (cascade.collisionId >= 0) { + auto const& collision = collisions.rawIteratorAt(cascade.collisionId); + pvX = collision.posX(); + pvY = collision.posY(); + pvZ = collision.posZ(); + } + auto const& posTrack = tracks.rawIteratorAt(cascade.posTrackId); + auto const& negTrack = tracks.rawIteratorAt(cascade.negTrackId); + auto const& bachTrack = tracks.rawIteratorAt(cascade.bachTrackId); + if (baseOpts.useV0BufferForCascades) { + // this processing path uses a buffer of V0s so that no + // additional minimization step is redone. It consumes less + // CPU at the cost of more memory. Since memory is a more + // limited commodity, this isn't the default option. + + // check if cached - if not, skip + if (cascade.v0Id < 0 || v0Map[cascade.v0Id] < 0) { + // this V0 hasn't been stored / cached + products.cascdataLink(-1); + interlinks.cascadeToCascCores.push_back(-1); + continue; // didn't work out, skip + } + + if (!straHelper.buildCascadeCandidate(cascade.collisionId, pvX, pvY, pvZ, + v0sFromCascades[v0Map[cascade.v0Id]], + posTrack, + negTrack, + bachTrack, + baseOpts.mEnabledTables[kCascBBs], + cascadeBuilderOpts.useCascadeMomentumAtPrimVtx, + baseOpts.mEnabledTables[kCascCovs])) { + products.cascdataLink(-1); + interlinks.cascadeToCascCores.push_back(-1); + continue; // didn't work out, skip + } + } else { + // this processing path generates the entire cascade + // from tracks, without any need to have V0s generated. + if (!straHelper.buildCascadeCandidate(cascade.collisionId, pvX, pvY, pvZ, + posTrack, + negTrack, + bachTrack, + baseOpts.mEnabledTables[kCascBBs], + cascadeBuilderOpts.useCascadeMomentumAtPrimVtx, + baseOpts.mEnabledTables[kCascCovs])) { + products.cascdataLink(-1); + interlinks.cascadeToCascCores.push_back(-1); + continue; // didn't work out, skip + } + } + nCascades++; + + if constexpr (requires { posTrack.tpcNSigmaEl(); }) { + if (preSelectOpts.preselectOnlyDesiredCascades) { + float lPt = RecoDecay::sqrtSumOfSquares( + straHelper.cascade.bachelorMomentum[0] + straHelper.cascade.positiveMomentum[0] + straHelper.cascade.negativeMomentum[0], + straHelper.cascade.bachelorMomentum[1] + straHelper.cascade.positiveMomentum[1] + straHelper.cascade.negativeMomentum[1]); + + float lPtot = RecoDecay::sqrtSumOfSquares( + straHelper.cascade.bachelorMomentum[0] + straHelper.cascade.positiveMomentum[0] + straHelper.cascade.negativeMomentum[0], + straHelper.cascade.bachelorMomentum[1] + straHelper.cascade.positiveMomentum[1] + straHelper.cascade.negativeMomentum[1], + straHelper.cascade.bachelorMomentum[2] + straHelper.cascade.positiveMomentum[2] + straHelper.cascade.negativeMomentum[2]); + + float lV0Ptot = RecoDecay::sqrtSumOfSquares( + straHelper.cascade.positiveMomentum[0] + straHelper.cascade.negativeMomentum[0], + straHelper.cascade.positiveMomentum[1] + straHelper.cascade.negativeMomentum[1], + straHelper.cascade.positiveMomentum[2] + straHelper.cascade.negativeMomentum[2]); + + float lLengthTraveled = RecoDecay::sqrtSumOfSquares( + straHelper.cascade.cascadePosition[0] - pvX, + straHelper.cascade.cascadePosition[1] - pvY, + straHelper.cascade.cascadePosition[2] - pvZ); + + float lV0LengthTraveled = RecoDecay::sqrtSumOfSquares( + straHelper.cascade.v0Position[0] - straHelper.cascade.cascadePosition[0], + straHelper.cascade.v0Position[1] - straHelper.cascade.cascadePosition[1], + straHelper.cascade.v0Position[2] - straHelper.cascade.cascadePosition[2]); + + uint8_t maskCascadePreselection = 0; + + if ( // XiMinus PID and mass selection + straHelper.cascade.charge < 0 && + std::abs(posTrack.tpcNSigmaPr()) < preSelectOpts.maxTPCpidNsigma && + std::abs(negTrack.tpcNSigmaPi()) < preSelectOpts.maxTPCpidNsigma && + std::abs(bachTrack.tpcNSigmaPi()) < preSelectOpts.maxTPCpidNsigma && + o2::constants::physics::MassLambda * lV0LengthTraveled / (lV0Ptot + 1e-13) < preSelectOpts.lifetimeCut->get("lifetimeCutLambda") && + o2::constants::physics::MassXiMinus * lLengthTraveled / (lPtot + 1e-13) < preSelectOpts.lifetimeCut->get("lifetimeCutXi") && + std::abs(straHelper.cascade.massXi - o2::constants::physics::MassXiMinus) < preSelectOpts.massWindownumberOfSigmas * getMassSigmaXi(lPt) + preSelectOpts.massWindowSafetyMargin) { + BITSET(maskCascadePreselection, selXiMinus); + } + + if ( // XiPlus PID and mass selection + straHelper.cascade.charge > 0 && + std::abs(posTrack.tpcNSigmaPi()) < preSelectOpts.maxTPCpidNsigma && + std::abs(negTrack.tpcNSigmaPr()) < preSelectOpts.maxTPCpidNsigma && + std::abs(bachTrack.tpcNSigmaPi()) < preSelectOpts.maxTPCpidNsigma && + o2::constants::physics::MassLambda * lV0LengthTraveled / (lV0Ptot + 1e-13) < preSelectOpts.lifetimeCut->get("lifetimeCutLambda") && + o2::constants::physics::MassXiMinus * lLengthTraveled / (lPtot + 1e-13) < preSelectOpts.lifetimeCut->get("lifetimeCutXi") && + std::abs(straHelper.cascade.massXi - o2::constants::physics::MassXiMinus) < preSelectOpts.massWindownumberOfSigmas * getMassSigmaXi(lPt) + preSelectOpts.massWindowSafetyMargin) { + BITSET(maskCascadePreselection, selXiPlus); + } + + if ( // OmegaMinus PID and mass selection + straHelper.cascade.charge < 0 && + std::abs(posTrack.tpcNSigmaPr()) < preSelectOpts.maxTPCpidNsigma && + std::abs(negTrack.tpcNSigmaPi()) < preSelectOpts.maxTPCpidNsigma && + std::abs(bachTrack.tpcNSigmaKa()) < preSelectOpts.maxTPCpidNsigma && + o2::constants::physics::MassLambda * lV0LengthTraveled / (lV0Ptot + 1e-13) < preSelectOpts.lifetimeCut->get("lifetimeCutLambda") && + o2::constants::physics::MassOmegaMinus * lLengthTraveled / (lPtot + 1e-13) < preSelectOpts.lifetimeCut->get("lifetimeCutOmega") && + std::abs(straHelper.cascade.massOmega - o2::constants::physics::MassOmegaMinus) < preSelectOpts.massWindownumberOfSigmas * getMassSigmaOmega(lPt) + preSelectOpts.massWindowSafetyMargin) { + BITSET(maskCascadePreselection, selOmegaMinus); + } + + if ( // OmegaPlus PID and mass selection + straHelper.cascade.charge > 0 && + std::abs(posTrack.tpcNSigmaPi()) < preSelectOpts.maxTPCpidNsigma && + std::abs(negTrack.tpcNSigmaPr()) < preSelectOpts.maxTPCpidNsigma && + std::abs(bachTrack.tpcNSigmaKa()) < preSelectOpts.maxTPCpidNsigma && + o2::constants::physics::MassLambda * lV0LengthTraveled / (lV0Ptot + 1e-13) < preSelectOpts.lifetimeCut->get("lifetimeCutLambda") && + o2::constants::physics::MassOmegaMinus * lLengthTraveled / (lPtot + 1e-13) < preSelectOpts.lifetimeCut->get("lifetimeCutOmega") && + std::abs(straHelper.cascade.massOmega - o2::constants::physics::MassOmegaMinus) < preSelectOpts.massWindownumberOfSigmas * getMassSigmaOmega(lPt) + preSelectOpts.massWindowSafetyMargin) { + BITSET(maskCascadePreselection, selOmegaPlus); + } + + histos.fill(HIST("hPreselectionCascades"), maskCascadePreselection); + + if (maskCascadePreselection == 0) { + products.cascdataLink(-1); + interlinks.cascadeToCascCores.push_back(-1); + continue; + } + } + } + + // generate analysis tables as required + if (baseOpts.mEnabledTables[kCascIndices]) { + products.cascidx(cascade.globalId, + straHelper.cascade.positiveTrack, straHelper.cascade.negativeTrack, + straHelper.cascade.bachelorTrack, straHelper.cascade.collisionId); + histos.fill(HIST("hTableBuildingStatistics"), kCascIndices); + } + if (baseOpts.mEnabledTables[kStoredCascCores]) { + products.cascdata(straHelper.cascade.charge, straHelper.cascade.massXi, straHelper.cascade.massOmega, + straHelper.cascade.cascadePosition[0], straHelper.cascade.cascadePosition[1], straHelper.cascade.cascadePosition[2], + straHelper.cascade.v0Position[0], straHelper.cascade.v0Position[1], straHelper.cascade.v0Position[2], + straHelper.cascade.positiveMomentum[0], straHelper.cascade.positiveMomentum[1], straHelper.cascade.positiveMomentum[2], + straHelper.cascade.negativeMomentum[0], straHelper.cascade.negativeMomentum[1], straHelper.cascade.negativeMomentum[2], + straHelper.cascade.bachelorMomentum[0], straHelper.cascade.bachelorMomentum[1], straHelper.cascade.bachelorMomentum[2], + straHelper.cascade.cascadeMomentum[0], straHelper.cascade.cascadeMomentum[1], straHelper.cascade.cascadeMomentum[2], + straHelper.cascade.v0DaughterDCA, straHelper.cascade.cascadeDaughterDCA, + straHelper.cascade.positiveDCAxy, straHelper.cascade.negativeDCAxy, + straHelper.cascade.bachelorDCAxy, straHelper.cascade.cascadeDCAxy, straHelper.cascade.cascadeDCAz); + histos.fill(HIST("hTableBuildingStatistics"), kStoredCascCores); + + // interlink always produced if cascades generated + products.cascdataLink(products.cascdata.lastIndex()); + interlinks.cascCoreToCascades.push_back(cascade.globalId); + interlinks.cascadeToCascCores.push_back(products.cascdata.lastIndex()); + } + + if (baseOpts.mEnabledTables[kCascTrackXs]) { + products.cascTrackXs(straHelper.cascade.positiveTrackX, straHelper.cascade.negativeTrackX, straHelper.cascade.bachelorTrackX); + histos.fill(HIST("hTableBuildingStatistics"), kCascTrackXs); + } + if (baseOpts.mEnabledTables[kCascBBs]) { + products.cascbb(straHelper.cascade.bachBaryonCosPA, straHelper.cascade.bachBaryonDCAxyToPV); + histos.fill(HIST("hTableBuildingStatistics"), kCascBBs); + } + if (baseOpts.mEnabledTables[kCascCovs]) { + products.casccovs(straHelper.cascade.covariance); + histos.fill(HIST("hTableBuildingStatistics"), kCascCovs); + } + + //_________________________________________________________ + // MC handling part + if constexpr (soa::is_table) { + // only worry about this if someone else worried about this + if ((baseOpts.mEnabledTables[kCascMCCores] || baseOpts.mEnabledTables[kMcCascLabels] || baseOpts.mEnabledTables[kCascMCCollRefs])) { + extractMonteCarloProperties(posTrack, negTrack, bachTrack, mcParticles); + + // Construct label table (note: this will be joinable with CascDatas) + if (baseOpts.mEnabledTables[kMcCascLabels]) { + products.casclabels( + thisCascInfo.label, thisCascInfo.motherLabel); + histos.fill(HIST("hTableBuildingStatistics"), kMcCascLabels); + } + + // Construct found tag + if (baseOpts.mEnabledTables[kCascFoundTags]) { + products.cascFoundTag(cascade.found); + histos.fill(HIST("hTableBuildingStatistics"), kCascFoundTags); + } + + // Mark mcParticle as recoed (no searching necessary afterwards) + if (thisCascInfo.label > -1) { + mcParticleIsReco[thisCascInfo.label] = true; + } + + if (cascadeBuilderOpts.mc_populateCascMCCoresSymmetric) { + if (baseOpts.mEnabledTables[kCascMCCores]) { + products.cascmccores( + thisCascInfo.pdgCode, thisCascInfo.pdgCodeMother, thisCascInfo.pdgCodeV0, thisCascInfo.isPhysicalPrimary, + thisCascInfo.pdgCodePositive, thisCascInfo.pdgCodeNegative, thisCascInfo.pdgCodeBachelor, + thisCascInfo.xyz[0], thisCascInfo.xyz[1], thisCascInfo.xyz[2], + thisCascInfo.lxyz[0], thisCascInfo.lxyz[1], thisCascInfo.lxyz[2], + thisCascInfo.posP[0], thisCascInfo.posP[1], thisCascInfo.posP[2], + thisCascInfo.negP[0], thisCascInfo.negP[1], thisCascInfo.negP[2], + thisCascInfo.bachP[0], thisCascInfo.bachP[1], thisCascInfo.bachP[2], + thisCascInfo.momentum[0], thisCascInfo.momentum[1], thisCascInfo.momentum[2]); + histos.fill(HIST("hTableBuildingStatistics"), kCascMCCores); + } + if (baseOpts.mEnabledTables[kCascMCCollRefs]) { + products.cascmccollrefs(thisCascInfo.mcCollision); + histos.fill(HIST("hTableBuildingStatistics"), kCascMCCollRefs); + } + } + + if (cascadeBuilderOpts.mc_populateCascMCCoresAsymmetric) { + int thisCascMCCoreIndex = -1; + // step 1: check if this element is already provided in the table + // using the packedIndices variable calculated above + for (uint32_t ii = 0; ii < mcCascinfos.size(); ii++) { + if (thisCascInfo.label == mcCascinfos[ii].label && mcCascinfos[ii].label > -1) { + thisCascMCCoreIndex = ii; + break; // this exists already in list + } + } + if (thisCascMCCoreIndex < 0) { + // this CascMCCore does not exist yet. Create it and reference it + thisCascMCCoreIndex = mcCascinfos.size(); + mcCascinfos.push_back(thisCascInfo); + } + if (baseOpts.mEnabledTables[kCascCoreMCLabels]) { + products.cascCoreMClabels(thisCascMCCoreIndex); // interlink: reconstructed -> MC index + histos.fill(HIST("hTableBuildingStatistics"), kCascCoreMCLabels); + } + } + + } // enabled tables check + + // if BB tags requested, generate them now + if (baseOpts.mEnabledTables[kMcCascBBTags]) { + bool bbTag = false; + if (bachTrack.has_mcParticle()) { + auto bachelorParticle = bachTrack.template mcParticle_as(); + if (bachelorParticle.pdgCode() == 211) { // pi+, look for antiproton in negative prong + if (negTrack.has_mcParticle()) { + auto baryonParticle = negTrack.template mcParticle_as(); + if (baryonParticle.has_mothers() && bachelorParticle.has_mothers() && baryonParticle.pdgCode() == -2212) { + for (const auto& baryonMother : baryonParticle.template mothers_as()) { + for (const auto& pionMother : bachelorParticle.template mothers_as()) { + if (baryonMother.globalIndex() == pionMother.globalIndex() && baryonMother.pdgCode() == -3122) { + bbTag = true; + } + } + } + } + } + } // end if-pion + if (bachelorParticle.pdgCode() == -211) { // pi-, look for proton in positive prong + if (posTrack.has_mcParticle()) { + auto baryonParticle = posTrack.template mcParticle_as(); + if (baryonParticle.has_mothers() && bachelorParticle.has_mothers() && baryonParticle.pdgCode() == 2212) { + for (const auto& baryonMother : baryonParticle.template mothers_as()) { + for (const auto& pionMother : bachelorParticle.template mothers_as()) { + if (baryonMother.globalIndex() == pionMother.globalIndex() && baryonMother.pdgCode() == 3122) { + bbTag = true; + } + } + } + } + } + } // end if-pion + } // end bachelor has mcparticle + // Construct label table (note: this will be joinable with CascDatas) + products.bbtags(bbTag); + histos.fill(HIST("hTableBuildingStatistics"), kMcCascBBTags); + } // end BB tag table enabled check + + } // constexpr requires mcParticles check + } // cascades loop + + //_________________________________________________________ + // MC handling part + if constexpr (soa::is_table) { + if ((baseOpts.mEnabledTables[kCascMCCores] || baseOpts.mEnabledTables[kMcCascLabels] || baseOpts.mEnabledTables[kCascMCCollRefs])) { + // now populate V0MCCores if in asymmetric mode + if (cascadeBuilderOpts.mc_populateCascMCCoresAsymmetric) { + // first step: add any un-recoed v0mmcores that were requested + for (const auto& mcParticle : mcParticles) { + thisCascInfo.pdgCode = -1, thisCascInfo.pdgCodeMother = -1; + thisCascInfo.pdgCodePositive = -1, thisCascInfo.pdgCodeNegative = -1; + thisCascInfo.pdgCodeBachelor = -1, thisCascInfo.pdgCodeV0 = -1; + thisCascInfo.isPhysicalPrimary = false; + thisCascInfo.xyz[0] = 0.0f, thisCascInfo.xyz[1] = 0.0f, thisCascInfo.xyz[2] = 0.0f; + thisCascInfo.lxyz[0] = 0.0f, thisCascInfo.lxyz[1] = 0.0f, thisCascInfo.lxyz[2] = 0.0f; + thisCascInfo.posP[0] = 0.0f, thisCascInfo.posP[1] = 0.0f, thisCascInfo.posP[2] = 0.0f; + thisCascInfo.negP[0] = 0.0f, thisCascInfo.negP[1] = 0.0f, thisCascInfo.negP[2] = 0.0f; + thisCascInfo.bachP[0] = 0.0f, thisCascInfo.bachP[1] = 0.0f, thisCascInfo.bachP[2] = 0.0f; + thisCascInfo.momentum[0] = 0.0f, thisCascInfo.momentum[1] = 0.0f, thisCascInfo.momentum[2] = 0.0f; + thisCascInfo.label = -1, thisCascInfo.motherLabel = -1; + thisCascInfo.mcParticlePositive = -1; + thisCascInfo.mcParticleNegative = -1; + thisCascInfo.mcParticleBachelor = -1; + + if (mcParticleIsReco[mcParticle.globalIndex()] == true) + continue; // skip if already created in list + + if (std::fabs(mcParticle.y()) > cascadeBuilderOpts.mc_rapidityWindow) + continue; // skip outside midrapidity + + if (cascadeBuilderOpts.mc_keepOnlyPhysicalPrimary && !mcParticle.isPhysicalPrimary()) + continue; // skip secondary MC cascades + + if ( + (cascadeBuilderOpts.mc_addGeneratedXiMinus && mcParticle.pdgCode() == 3312) || + (cascadeBuilderOpts.mc_addGeneratedXiPlus && mcParticle.pdgCode() == -3312) || + (cascadeBuilderOpts.mc_addGeneratedOmegaMinus && mcParticle.pdgCode() == 3334) || + (cascadeBuilderOpts.mc_addGeneratedOmegaPlus && mcParticle.pdgCode() == -3334)) { + thisCascInfo.pdgCode = mcParticle.pdgCode(); + thisCascInfo.isPhysicalPrimary = mcParticle.isPhysicalPrimary(); + + if (mcParticle.has_mcCollision()) { + thisCascInfo.mcCollision = mcParticle.mcCollisionId(); // save this reference, please + } + thisCascInfo.momentum[0] = mcParticle.px(); + thisCascInfo.momentum[1] = mcParticle.py(); + thisCascInfo.momentum[2] = mcParticle.pz(); + thisCascInfo.label = mcParticle.globalIndex(); + + if (mcParticle.has_daughters()) { + auto const& daughters = mcParticle.template daughters_as(); + for (const auto& dau : daughters) { + if (dau.getProcess() != 4) // check whether the daughter comes from a decay + continue; + + if (std::abs(dau.pdgCode()) == 211 || std::abs(dau.pdgCode()) == 321) { + thisCascInfo.pdgCodeBachelor = dau.pdgCode(); + thisCascInfo.bachP[0] = dau.px(); + thisCascInfo.bachP[1] = dau.py(); + thisCascInfo.bachP[2] = dau.pz(); + thisCascInfo.xyz[0] = dau.vx(); + thisCascInfo.xyz[1] = dau.vy(); + thisCascInfo.xyz[2] = dau.vz(); + thisCascInfo.mcParticleBachelor = dau.globalIndex(); + } + if (std::abs(dau.pdgCode()) == 2212) { + thisCascInfo.pdgCodeV0 = dau.pdgCode(); + + for (const auto& v0Dau : dau.template daughters_as()) { + if (v0Dau.getProcess() != 4) + continue; + + if (v0Dau.pdgCode() > 0) { + thisCascInfo.pdgCodePositive = v0Dau.pdgCode(); + thisCascInfo.processPositive = v0Dau.getProcess(); + thisCascInfo.posP[0] = v0Dau.px(); + thisCascInfo.posP[1] = v0Dau.py(); + thisCascInfo.posP[2] = v0Dau.pz(); + thisCascInfo.lxyz[0] = v0Dau.vx(); + thisCascInfo.lxyz[1] = v0Dau.vy(); + thisCascInfo.lxyz[2] = v0Dau.vz(); + thisCascInfo.mcParticlePositive = v0Dau.globalIndex(); + } + if (v0Dau.pdgCode() < 0) { + thisCascInfo.pdgCodeNegative = v0Dau.pdgCode(); + thisCascInfo.processNegative = v0Dau.getProcess(); + thisCascInfo.negP[0] = v0Dau.px(); + thisCascInfo.negP[1] = v0Dau.py(); + thisCascInfo.negP[2] = v0Dau.pz(); + thisCascInfo.mcParticleNegative = v0Dau.globalIndex(); + } + } + } + } + } + + // if I got here, it means this MC particle was not recoed and is of interest. Add it please + mcCascinfos.push_back(thisCascInfo); + } + } + + for (const auto& thisInfoToFill : mcCascinfos) { + if (baseOpts.mEnabledTables[kCascMCCores]) { + products.cascmccores( // a lot of the info below will be compressed in case of not-recoed MC (good!) + thisInfoToFill.pdgCode, thisInfoToFill.pdgCodeMother, thisInfoToFill.pdgCodeV0, thisInfoToFill.isPhysicalPrimary, + thisInfoToFill.pdgCodePositive, thisInfoToFill.pdgCodeNegative, thisInfoToFill.pdgCodeBachelor, + thisInfoToFill.xyz[0], thisInfoToFill.xyz[1], thisInfoToFill.xyz[2], + thisInfoToFill.lxyz[0], thisInfoToFill.lxyz[1], thisInfoToFill.lxyz[2], + thisInfoToFill.posP[0], thisInfoToFill.posP[1], thisInfoToFill.posP[2], + thisInfoToFill.negP[0], thisInfoToFill.negP[1], thisInfoToFill.negP[2], + thisInfoToFill.bachP[0], thisInfoToFill.bachP[1], thisInfoToFill.bachP[2], + thisInfoToFill.momentum[0], thisInfoToFill.momentum[1], thisInfoToFill.momentum[2]); + histos.fill(HIST("hTableBuildingStatistics"), kCascMCCores); + } + if (baseOpts.mEnabledTables[kCascMCCollRefs]) { + products.cascmccollrefs(thisInfoToFill.mcCollision); + histos.fill(HIST("hTableBuildingStatistics"), kCascMCCollRefs); + } + } + } + } // enabled tables check + } // constexpr requires mcParticles check + + LOGF(debug, "Cascades in DF: %i, cascades built: %i", cascades.size(), nCascades); + } + + //__________________________________________________ + template + void buildKFCascades(THistoRegistry& histos, TCollisions const& collisions, TCascades const& cascades, TTracks const& tracks, TMCParticles const& mcParticles, TProducts& products) + { + if (!baseOpts.mEnabledTables[kStoredKFCascCores]) { + return; // don't do if no request for cascades in place + } + int nCascades = 0; + // Loops over all cascades in the time frame + histos.fill(HIST("hInputStatistics"), kStoredKFCascCores, cascades.size()); + for (size_t icascade = 0; icascade < cascades.size(); icascade++) { + // Get tracks and generate candidate + auto const& cascade = cascades[sorted_cascade[icascade]]; + // if collisionId positive: get vertex, negative: origin + // could be replaced by mean vertex (but without much benefit...) + float pvX = 0.0f, pvY = 0.0f, pvZ = 0.0f; + if (cascade.collisionId >= 0) { + auto const& collision = collisions.rawIteratorAt(cascade.collisionId); + pvX = collision.posX(); + pvY = collision.posY(); + pvZ = collision.posZ(); + } + auto const& posTrack = tracks.rawIteratorAt(cascade.posTrackId); + auto const& negTrack = tracks.rawIteratorAt(cascade.negTrackId); + auto const& bachTrack = tracks.rawIteratorAt(cascade.bachTrackId); + if (!straHelper.buildCascadeCandidateWithKF(cascade.collisionId, pvX, pvY, pvZ, + posTrack, + negTrack, + bachTrack, + baseOpts.mEnabledTables[kCascBBs], + cascadeBuilderOpts.kfConstructMethod, + cascadeBuilderOpts.kfTuneForOmega, + cascadeBuilderOpts.kfUseV0MassConstraint, + cascadeBuilderOpts.kfUseCascadeMassConstraint, + cascadeBuilderOpts.kfDoDCAFitterPreMinimV0, + cascadeBuilderOpts.kfDoDCAFitterPreMinimCasc)) { + products.kfcascdataLink(-1); + interlinks.cascadeToKFCascCores.push_back(-1); + continue; // didn't work out, skip + } + nCascades++; + + // generate analysis tables as required + if (baseOpts.mEnabledTables[kKFCascIndices]) { + products.kfcascidx(cascade.globalId, + straHelper.cascade.positiveTrack, straHelper.cascade.negativeTrack, + straHelper.cascade.bachelorTrack, straHelper.cascade.collisionId); + histos.fill(HIST("hTableBuildingStatistics"), kKFCascIndices); + } + if (baseOpts.mEnabledTables[kStoredKFCascCores]) { + products.kfcascdata(straHelper.cascade.charge, straHelper.cascade.massXi, straHelper.cascade.massOmega, + straHelper.cascade.cascadePosition[0], straHelper.cascade.cascadePosition[1], straHelper.cascade.cascadePosition[2], + straHelper.cascade.v0Position[0], straHelper.cascade.v0Position[1], straHelper.cascade.v0Position[2], + straHelper.cascade.positivePosition[0], straHelper.cascade.positivePosition[1], straHelper.cascade.positivePosition[2], + straHelper.cascade.negativePosition[0], straHelper.cascade.negativePosition[1], straHelper.cascade.negativePosition[2], + straHelper.cascade.positiveMomentum[0], straHelper.cascade.positiveMomentum[1], straHelper.cascade.positiveMomentum[2], + straHelper.cascade.negativeMomentum[0], straHelper.cascade.negativeMomentum[1], straHelper.cascade.negativeMomentum[2], + straHelper.cascade.bachelorMomentum[0], straHelper.cascade.bachelorMomentum[1], straHelper.cascade.bachelorMomentum[2], + straHelper.cascade.v0Momentum[0], straHelper.cascade.v0Momentum[1], straHelper.cascade.v0Momentum[2], + straHelper.cascade.cascadeMomentum[0], straHelper.cascade.cascadeMomentum[1], straHelper.cascade.cascadeMomentum[2], + straHelper.cascade.v0DaughterDCA, straHelper.cascade.cascadeDaughterDCA, + straHelper.cascade.positiveDCAxy, straHelper.cascade.negativeDCAxy, + straHelper.cascade.bachelorDCAxy, straHelper.cascade.cascadeDCAxy, straHelper.cascade.cascadeDCAz, + straHelper.cascade.kfMLambda, straHelper.cascade.kfV0Chi2, straHelper.cascade.kfCascadeChi2); + histos.fill(HIST("hTableBuildingStatistics"), kStoredKFCascCores); + + // interlink always produced if cascades generated + products.kfcascdataLink(products.kfcascdata.lastIndex()); + interlinks.kfCascCoreToCascades.push_back(cascade.globalId); + interlinks.cascadeToKFCascCores.push_back(products.kfcascdata.lastIndex()); + } + if (baseOpts.mEnabledTables[kKFCascCovs]) { + products.kfcasccovs(straHelper.cascade.covariance, straHelper.cascade.kfTrackCovarianceV0, straHelper.cascade.kfTrackCovariancePos, straHelper.cascade.kfTrackCovarianceNeg); + histos.fill(HIST("hTableBuildingStatistics"), kKFCascCovs); + } + + //_________________________________________________________ + // MC handling part (labels only) + if constexpr (soa::is_table) { + // only worry about this if someone else worried about this + if ((baseOpts.mEnabledTables[kMcKFCascLabels])) { + extractMonteCarloProperties(posTrack, negTrack, bachTrack, mcParticles); + + // Construct label table (note: this will be joinable with KFCascDatas) + products.kfcasclabels(thisCascInfo.label); + histos.fill(HIST("hTableBuildingStatistics"), kMcKFCascLabels); + } // enabled tables check + } // constexpr requires mcParticles check + } // end loop over cascades + + LOGF(debug, "KF Cascades in DF: %i, KF cascades built: %i", cascades.size(), nCascades); + } + + //__________________________________________________ + template + void buildTrackedCascades(THistoRegistry& histos, TCollisions const& collisions, TStrangeTracks const& cascadeTracks, TMCParticles const& mcParticles, TProducts& products) + { + if (!baseOpts.mEnabledTables[kStoredTraCascCores] || baseOpts.mc_findableMode.value != 0) { + return; // don't do if no request for cascades in place or findable mode used + } + int nCascades = 0; + // Loops over all V0s in the time frame + histos.fill(HIST("hInputStatistics"), kStoredTraCascCores, cascadeTracks.size()); + for (const auto& cascadeTrack : cascadeTracks) { + // Get tracks and generate candidate + if (!cascadeTrack.has_track()) + continue; // safety (should be fine but depends on future stratrack dev) + + auto const& strangeTrack = cascadeTrack.template track_as(); + + // if collisionId positive: get vertex, negative: origin + // could be replaced by mean vertex (but without much benefit...) + float pvX = 0.0f, pvY = 0.0f, pvZ = 0.0f; + if (strangeTrack.has_collision()) { + auto const& collision = collisions.rawIteratorAt(strangeTrack.collisionId()); + pvX = collision.posX(); + pvY = collision.posY(); + pvZ = collision.posZ(); + } + auto const& cascade = cascadeTrack.cascade(); + auto const& v0 = cascade.v0(); + auto const& posTrack = v0.template posTrack_as(); + auto const& negTrack = v0.template negTrack_as(); + auto const& bachTrack = cascade.template bachelor_as(); + if (!straHelper.buildCascadeCandidate(strangeTrack.collisionId(), pvX, pvY, pvZ, + posTrack, + negTrack, + bachTrack, + baseOpts.mEnabledTables[kCascBBs], + cascadeBuilderOpts.useCascadeMomentumAtPrimVtx, + baseOpts.mEnabledTables[kCascCovs])) { + products.tracascdataLink(-1); + interlinks.cascadeToTraCascCores.push_back(-1); + continue; // didn't work out, skip + } + + // recalculate DCAxy, DCAz with strange track + auto strangeTrackParCov = getTrackParCov(strangeTrack); + std::array dcaInfo; + strangeTrackParCov.setPID(o2::track::PID::XiMinus); // FIXME: not OK for omegas + o2::base::Propagator::Instance()->propagateToDCABxByBz({pvX, pvY, pvZ}, strangeTrackParCov, 2.f, straHelper.fitter.getMatCorrType(), &dcaInfo); + straHelper.cascade.cascadeDCAxy = dcaInfo[0]; + straHelper.cascade.cascadeDCAz = dcaInfo[1]; + + // get momentum from strange track (should not be very different) + strangeTrackParCov.getPxPyPzGlo(straHelper.cascade.cascadeMomentum); + + // accounting + nCascades++; + + // generate analysis tables as required + if (baseOpts.mEnabledTables[kTraCascIndices]) { + products.tracascidx(cascade.globalIndex(), + straHelper.cascade.positiveTrack, straHelper.cascade.negativeTrack, + straHelper.cascade.bachelorTrack, cascadeTrack.trackId(), straHelper.cascade.collisionId); + histos.fill(HIST("hTableBuildingStatistics"), kTraCascIndices); + } + if (baseOpts.mEnabledTables[kStoredTraCascCores]) { + products.tracascdata(straHelper.cascade.charge, cascadeTrack.xiMass(), cascadeTrack.omegaMass(), + cascadeTrack.decayX(), cascadeTrack.decayY(), cascadeTrack.decayZ(), + straHelper.cascade.v0Position[0], straHelper.cascade.v0Position[1], straHelper.cascade.v0Position[2], + straHelper.cascade.positiveMomentum[0], straHelper.cascade.positiveMomentum[1], straHelper.cascade.positiveMomentum[2], + straHelper.cascade.negativeMomentum[0], straHelper.cascade.negativeMomentum[1], straHelper.cascade.negativeMomentum[2], + straHelper.cascade.bachelorMomentum[0], straHelper.cascade.bachelorMomentum[1], straHelper.cascade.bachelorMomentum[2], + straHelper.cascade.cascadeMomentum[0], straHelper.cascade.cascadeMomentum[1], straHelper.cascade.cascadeMomentum[2], + straHelper.cascade.v0DaughterDCA, straHelper.cascade.cascadeDaughterDCA, + straHelper.cascade.positiveDCAxy, straHelper.cascade.negativeDCAxy, + straHelper.cascade.bachelorDCAxy, straHelper.cascade.cascadeDCAxy, straHelper.cascade.cascadeDCAz, + cascadeTrack.matchingChi2(), cascadeTrack.topologyChi2(), cascadeTrack.itsClsSize()); + histos.fill(HIST("hTableBuildingStatistics"), kStoredTraCascCores); + + // interlink always produced if base core table generated + products.tracascdataLink(products.tracascdata.lastIndex()); + interlinks.traCascCoreToCascades.push_back(cascade.globalIndex()); + interlinks.cascadeToTraCascCores.push_back(products.tracascdata.lastIndex()); + } + if (baseOpts.mEnabledTables[kCascCovs]) { + std::array traCovMat = {0.}; + strangeTrackParCov.getCovXYZPxPyPzGlo(traCovMat); + float traCovMatArray[21]; + for (int ii = 0; ii < 21; ii++) { + traCovMatArray[ii] = traCovMat[ii]; + } + products.tracasccovs(traCovMatArray); + histos.fill(HIST("hTableBuildingStatistics"), kCascCovs); + } + + //_________________________________________________________ + // MC handling part (labels only) + if constexpr (soa::is_table) { + // only worry about this if someone else worried about this + if ((baseOpts.mEnabledTables[kMcTraCascLabels])) { + extractMonteCarloProperties(posTrack, negTrack, bachTrack, mcParticles); + + // Construct label table (note: this will be joinable with KFCascDatas) + products.tracasclabels(thisCascInfo.label); + histos.fill(HIST("hTableBuildingStatistics"), kMcTraCascLabels); + } // enabled tables check + } // constexpr requires mcParticles check + } // end loop over cascades + LOGF(debug, "Tracked cascades in DF: %i, tracked cascades built: %i", cascadeTracks.size(), nCascades); + } + + //__________________________________________________ + // MC kink handling + template + int getOriginatingParticle(mcpart const& part, int& indexForPositionOfDecay, bool treatPiToMuDecays) + { + int returnValue = -1; + if (part.has_mothers()) { + auto const& motherList = part.template mothers_as(); + if (motherList.size() == 1) { + for (const auto& mother : motherList) { + if (std::abs(part.pdgCode()) == 13 && treatPiToMuDecays) { + // muon decay, de-ref mother twice + if (mother.has_mothers()) { + auto grandMotherList = mother.template mothers_as(); + if (grandMotherList.size() == 1) { + for (const auto& grandMother : grandMotherList) { + returnValue = grandMother.globalIndex(); + indexForPositionOfDecay = mother.globalIndex(); // for V0 decay position: grab muon + } + } + } + } else { + returnValue = mother.globalIndex(); + indexForPositionOfDecay = part.globalIndex(); + } + } + } + } + return returnValue; + } + + //__________________________________________________ + template + void dataProcess(TCCDB& ccdb, THistoRegistry& histos, TCollisions const& collisions, TMCCollisions const& mccollisions, TV0s const& v0s, TCascades const& cascades, TTrackedCascades const& trackedCascades, TTracks const& tracks, TBCs const& bcs, TMCParticles const& mcParticles, TProducts& products) + { + if (nEnabledTables == 0) { + return; // fully suppressed + } + + if (!initCCDB(ccdb, bcs, collisions)) + return; + + // reset vectors for cascade interlinks + resetInterlinks(); + + // prepare v0List, cascadeList + prepareBuildingLists(histos, collisions, mccollisions, v0s, cascades, tracks, mcParticles); + + // mark V0s that will be buffered for the cascade building + markV0sUsedInCascades(v0List, cascadeList, trackedCascades); + + // build V0s + buildV0s(histos, collisions, v0List, tracks, mcParticles, products); + + // build cascades + buildCascades(histos, collisions, cascadeList, tracks, mcParticles, products); + buildKFCascades(histos, collisions, cascadeList, tracks, mcParticles, products); + + // build tracked cascades only if subscription is Run 3 like (doesn't exist in Run 2) + if constexpr (soa::is_table) { + buildTrackedCascades(histos, collisions, trackedCascades, mcParticles, products); + } + + populateCascadeInterlinks(); + } +}; // end BuilderModule + +} // namespace strangenessbuilder +} // namespace pwglf +} // namespace o2 + +#endif // PWGLF_UTILS_STRANGENESSBUILDERMODULE_H_ From 3ebbdd13df436787eb6685390d7df812114478d5 Mon Sep 17 00:00:00 2001 From: Stefano Cannito <143754257+scannito@users.noreply.github.com> Date: Wed, 23 Jul 2025 10:13:06 +0200 Subject: [PATCH 013/345] [PWGLF] Further studies for dNdEta with phi (#12173) --- .../Tasks/Strangeness/phik0shortanalysis.cxx | 57 ++++++++++++------- 1 file changed, 35 insertions(+), 22 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx b/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx index 0fcc77ce131..598d8f56df4 100644 --- a/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx +++ b/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx @@ -102,6 +102,7 @@ struct Phik0shortanalysis { // Configurables for track selection (not necessarily common for trigger and the two associated particles) struct : ConfigurableGroup { Configurable cfgCutCharge{"cfgCutCharge", 0.0f, "Cut on charge"}; + Configurable cfgMinAbsCharge{"cfgMinAbsCharge", 3.0f, "Cut on absolute charge"}; Configurable cfgGlobalWoDCATrack{"cfgGlobalWoDCATrack", true, "Global track selection without DCA"}; Configurable cfgPVContributor{"cfgPVContributor", true, "PV contributor track selection"}; Configurable cMinKaonPtcut{"cMinKaonPtcut", 0.15f, "Track minimum pt cut"}; @@ -259,7 +260,10 @@ struct Phik0shortanalysis { SliceCache cache; // Preslice for manual slicing - Preslice perMCColl = aod::mcparticle::mcCollisionId; + struct : PresliceGroup { + Preslice perColl = aod::track::collisionId; + Preslice perMCColl = aod::mcparticle::mcCollisionId; + } preslices; // Positive and negative tracks partitions Partition posTracks = aod::track::signed1Pt > trackConfigs.cfgCutCharge; @@ -957,6 +961,21 @@ struct Phik0shortanalysis { return false; } + template + bool isGenParticleCharged(const T& mcParticle) + { + if (!mcParticle.isPhysicalPrimary() || std::abs(mcParticle.eta()) > trackConfigs.etaMax) + return false; + + auto pdgTrack = pdgDB->GetParticle(mcParticle.pdgCode()); + if (pdgTrack == nullptr) + return false; + if (std::abs(pdgTrack->Charge()) < trackConfigs.cfgMinAbsCharge) + return false; + + return true; + } + // Get phi-meson purity functions from CCDB void getPhiPurityFunctionsFromCCDB() { @@ -2436,7 +2455,7 @@ struct Phik0shortanalysis { return; const auto& mcCollision = collision.mcCollision_as(); - auto mcParticlesThisColl = mcParticles.sliceBy(perMCColl, mcCollision.globalIndex()); + auto mcParticlesThisColl = mcParticles.sliceBy(preslices.perMCColl, mcCollision.globalIndex()); if (filterOnMcPhi && !eventHasMCPhi(mcParticlesThisColl)) return; @@ -2456,13 +2475,7 @@ struct Phik0shortanalysis { } for (const auto& mcParticle : mcParticlesThisColl) { - if (!mcParticle.isPhysicalPrimary() || std::abs(mcParticle.eta()) > trackConfigs.etaMax) - continue; - - auto pdgTrack = pdgDB->GetParticle(mcParticle.pdgCode()); - if (pdgTrack == nullptr) - continue; - if (pdgTrack->Charge() == trackConfigs.cfgCutCharge) + if (!isGenParticleCharged(mcParticle)) continue; mcEventHist.fill(HIST("h2GenMCEtaDistributionReco"), genmultiplicity, mcParticle.eta()); @@ -2471,7 +2484,7 @@ struct Phik0shortanalysis { PROCESS_SWITCH(Phik0shortanalysis, processdNdetaWPhiMCReco, "Process function for dN/deta values in MCReco", false); - void processdNdetaWPhiMCGen(MCCollisions::iterator const& mcCollision, soa::SmallGroups const& collisions, aod::McParticles const& mcParticles) + void processdNdetaWPhiMCGen(MCCollisions::iterator const& mcCollision, soa::SmallGroups const& collisions, FilteredMCTracks const& filteredMCTracks, aod::McParticles const& mcParticles) { if (std::abs(mcCollision.posZ()) > cutZVertex) return; @@ -2487,14 +2500,20 @@ struct Phik0shortanalysis { if (acceptEventQA(collision, false)) { mcEventHist.fill(HIST("hGenMCRecoMultiplicityPercent"), genmultiplicity); - for (const auto& mcParticle : mcParticles) { - if (!mcParticle.isPhysicalPrimary() || std::abs(mcParticle.eta()) > trackConfigs.etaMax) + auto filteredMCTracksThisColl = filteredMCTracks.sliceBy(preslices.perColl, collision.globalIndex()); + for (const auto& track : filteredMCTracksThisColl) { + if (!track.has_mcParticle()) continue; - auto pdgTrack = pdgDB->GetParticle(mcParticle.pdgCode()); - if (pdgTrack == nullptr) + auto mcTrack = track.mcParticle(); + if (!mcTrack.isPhysicalPrimary() || std::abs(mcTrack.eta()) > trackConfigs.etaMax) continue; - if (pdgTrack->Charge() == trackConfigs.cfgCutCharge) + + mcEventHist.fill(HIST("h2RecoCheckMCEtaDistribution"), genmultiplicity, mcTrack.eta()); + } + + for (const auto& mcParticle : mcParticles) { + if (!isGenParticleCharged(mcParticle)) continue; mcEventHist.fill(HIST("h2GenMCEtaDistributionRecoCheck"), genmultiplicity, mcParticle.eta()); @@ -2509,13 +2528,7 @@ struct Phik0shortanalysis { mcEventHist.fill(HIST("hGenMCAssocRecoMultiplicityPercent"), genmultiplicity); for (const auto& mcParticle : mcParticles) { - if (!mcParticle.isPhysicalPrimary() || std::abs(mcParticle.eta()) > trackConfigs.etaMax) - continue; - - auto pdgTrack = pdgDB->GetParticle(mcParticle.pdgCode()); - if (pdgTrack == nullptr) - continue; - if (pdgTrack->Charge() == trackConfigs.cfgCutCharge) + if (!isGenParticleCharged(mcParticle)) continue; mcEventHist.fill(HIST("h2GenMCEtaDistribution"), genmultiplicity, mcParticle.eta()); From 4ec51cc5cb3d815dcddff4e13437ea36a2a0cd31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Wed, 23 Jul 2025 12:22:23 +0200 Subject: [PATCH 014/345] [ALICE3] Update onTheFlyRichPid.cxx (#12094) --- ALICE3/DataModel/OTFRICH.h | 16 ++++++----- ALICE3/TableProducer/OTF/onTheFlyRichPid.cxx | 29 ++++++++++++++++---- 2 files changed, 33 insertions(+), 12 deletions(-) diff --git a/ALICE3/DataModel/OTFRICH.h b/ALICE3/DataModel/OTFRICH.h index dcb5934589f..d4d9c5257ce 100644 --- a/ALICE3/DataModel/OTFRICH.h +++ b/ALICE3/DataModel/OTFRICH.h @@ -55,12 +55,13 @@ DECLARE_SOA_DYNAMIC_COLUMN(NSigmaRich, nSigmaRich, //! General f } }); -DECLARE_SOA_COLUMN(HasSig, hasSig, bool); //! Has signal in the barrel rich (is particle over threshold) -DECLARE_SOA_COLUMN(HasSigEl, hasSigEl, bool); //! Has nSigma electron BarrelRich (is electron over threshold) -DECLARE_SOA_COLUMN(HasSigMu, hasSigMu, bool); //! Has nSigma muon BarrelRich (is muon over threshold) -DECLARE_SOA_COLUMN(HasSigPi, hasSigPi, bool); //! Has nSigma pion BarrelRich (is pion over threshold) -DECLARE_SOA_COLUMN(HasSigKa, hasSigKa, bool); //! Has nSigma kaon BarrelRich (is kaon over threshold) -DECLARE_SOA_COLUMN(HasSigPr, hasSigPr, bool); //! Has nSigma proton BarrelRich (is proton over threshold) +DECLARE_SOA_COLUMN(HasSig, hasSig, bool); //! Has signal in the barrel rich (is particle over threshold) +DECLARE_SOA_COLUMN(HasSigInGas, hasSigInGas, bool); //! Has signal in the gas radiator in the barrel rich (is particle over threshold) +DECLARE_SOA_COLUMN(HasSigEl, hasSigEl, bool); //! Has nSigma electron BarrelRich (is electron over threshold) +DECLARE_SOA_COLUMN(HasSigMu, hasSigMu, bool); //! Has nSigma muon BarrelRich (is muon over threshold) +DECLARE_SOA_COLUMN(HasSigPi, hasSigPi, bool); //! Has nSigma pion BarrelRich (is pion over threshold) +DECLARE_SOA_COLUMN(HasSigKa, hasSigKa, bool); //! Has nSigma kaon BarrelRich (is kaon over threshold) +DECLARE_SOA_COLUMN(HasSigPr, hasSigPr, bool); //! Has nSigma proton BarrelRich (is proton over threshold) } // namespace upgrade_rich DECLARE_SOA_TABLE(UpgradeRichs, "AOD", "UPGRADERICH", @@ -83,7 +84,8 @@ DECLARE_SOA_TABLE(UpgradeRichSignals, "AOD", "UPGRADERICHSIG", upgrade_rich::HasSigMu, upgrade_rich::HasSigPi, upgrade_rich::HasSigKa, - upgrade_rich::HasSigPr); + upgrade_rich::HasSigPr, + upgrade_rich::HasSigInGas); using UpgradeRichSignal = UpgradeRichSignals::iterator; diff --git a/ALICE3/TableProducer/OTF/onTheFlyRichPid.cxx b/ALICE3/TableProducer/OTF/onTheFlyRichPid.cxx index 8900d87b331..79279bbc70e 100644 --- a/ALICE3/TableProducer/OTF/onTheFlyRichPid.cxx +++ b/ALICE3/TableProducer/OTF/onTheFlyRichPid.cxx @@ -105,6 +105,8 @@ struct OnTheFlyRichPid { Configurable flagIncludeTrackAngularRes{"flagIncludeTrackAngularRes", true, "flag to include or exclude track time resolution"}; Configurable multiplicityEtaRange{"multiplicityEtaRange", 0.800000012, "eta range to compute the multiplicity"}; Configurable flagRICHLoadDelphesLUTs{"flagRICHLoadDelphesLUTs", false, "flag to load Delphes LUTs for tracking correction (use recoTrack parameters if false)"}; + Configurable gasRadiatorRindex{"gasRadiatorRindex", 1.0006f, "gas radiator refractive index"}; + Configurable gasRichRadiatorThickness{"gasRichRadiatorThickness", 25.f, "gas radiator thickness (cm)"}; Configurable bRichRefractiveIndexSector0{"bRichRefractiveIndexSector0", 1.03, "barrel RICH refractive index central(s)"}; // central(s) Configurable bRichRefractiveIndexSector1{"bRichRefractiveIndexSector1", 1.03, "barrel RICH refractive index central(s)-1 and central(s)+1"}; // central(s)-1 and central(s)+1 Configurable bRichRefractiveIndexSector2{"bRichRefractiveIndexSector2", 1.03, "barrel RICH refractive index central(s)-2 and central(s)+2"}; // central(s)-2 and central(s)+2 @@ -505,6 +507,22 @@ struct OnTheFlyRichPid { return false; // Particle is below the threshold } + bool isOverTrhesholdInGasRadiator(const float momentum, const float mass) + { + if (momentum < mass / std::sqrt(gasRadiatorRindex * gasRadiatorRindex - 1.0)) { // Check if particle is above the threshold + return false; + } + const float angle = std::acos(std::sqrt(momentum * momentum + mass * mass) / (momentum * gasRadiatorRindex)); + const float meanNumberofDetectedPhotons = 230. * std::sin(angle) * std::sin(angle) * gasRichRadiatorThickness; + + // Require at least 3 photons on average for real angle reconstruction + static constexpr float kMinPhotons = 3.f; + if (meanNumberofDetectedPhotons <= kMinPhotons) { + return false; + } + return true; + } + /// returns linear interpolation /// \param x the eta we want the resolution for /// \param x0 the closest smaller available eta @@ -742,9 +760,9 @@ struct OnTheFlyRichPid { for (const auto& track : tracks) { - auto fillDummyValues = [&]() { + auto fillDummyValues = [&](bool gasRich = false) { upgradeRich(kErrorValue, kErrorValue, kErrorValue, kErrorValue, kErrorValue); - upgradeRichSignal(false, false, false, false, false, false); + upgradeRichSignal(false, false, false, false, false, false, gasRich); }; // first step: find precise arrival time (if any) @@ -770,16 +788,17 @@ struct OnTheFlyRichPid { } // find track bRICH sector - int iSecor = findSector(o2track.getEta()); + const int iSecor = findSector(o2track.getEta()); if (iSecor < 0) { fillDummyValues(); continue; } + const bool expectedAngleBarrelGasRichOk = isOverTrhesholdInGasRadiator(o2track.getP(), pdgInfo->Mass()); float expectedAngleBarrelRich = kErrorValue; const bool expectedAngleBarrelRichOk = cherenkovAngle(o2track.getP(), pdgInfo->Mass(), aerogelRindex[iSecor], expectedAngleBarrelRich); if (!expectedAngleBarrelRichOk) { - fillDummyValues(); + fillDummyValues(expectedAngleBarrelGasRichOk); continue; // Particle is below the threshold or not enough photons } // float barrelRICHAngularResolution = angularResolution(o2track.getEta()); @@ -959,7 +978,7 @@ struct OnTheFlyRichPid { // Sigmas have been fully calculated. Please populate the NSigma helper table (once per track) upgradeRich(nSigmaBarrelRich[0], nSigmaBarrelRich[1], nSigmaBarrelRich[2], nSigmaBarrelRich[3], nSigmaBarrelRich[4]); - upgradeRichSignal(expectedAngleBarrelRichOk, signalBarrelRich[0], signalBarrelRich[1], signalBarrelRich[2], signalBarrelRich[3], signalBarrelRich[4]); + upgradeRichSignal(expectedAngleBarrelRichOk, signalBarrelRich[0], signalBarrelRich[1], signalBarrelRich[2], signalBarrelRich[3], signalBarrelRich[4], expectedAngleBarrelGasRichOk); } } }; From 0741771e69c35836b27a8ea286f22d105b287f70 Mon Sep 17 00:00:00 2001 From: Samuele Cattaruzzi <124249902+scattaru@users.noreply.github.com> Date: Wed, 23 Jul 2025 12:25:24 +0200 Subject: [PATCH 015/345] [PWGHF] Ds-h correlation, adding separation in PID (#12095) --- .../DataModel/DerivedDataCorrelationTables.h | 2 ++ .../HFC/TableProducer/correlatorDsHadrons.cxx | 22 +++++++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h b/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h index b9425517913..39a3231977c 100644 --- a/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h +++ b/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h @@ -22,6 +22,7 @@ namespace o2::aod { namespace hf_collisions_reduced { +DECLARE_SOA_COLUMN(NumPvContrib, numPvContrib, int); //! Event multiplicity from PV contributors DECLARE_SOA_COLUMN(Multiplicity, multiplicity, float); //! Event multiplicity DECLARE_SOA_COLUMN(PosZ, posZ, float); //! Primary vertex z position @@ -30,6 +31,7 @@ DECLARE_SOA_COLUMN(PosZ, posZ, float); //! Primary vertex z posi DECLARE_SOA_TABLE(HfcRedCollisions, "AOD", "HFCREDCOLLISION", //! Table with collision info soa::Index<>, aod::hf_collisions_reduced::Multiplicity, + aod::hf_collisions_reduced::NumPvContrib, aod::hf_collisions_reduced::PosZ); using HfcRedCollision = HfcRedCollisions::iterator; diff --git a/PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx index 65423849acb..c788f35dd92 100644 --- a/PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx @@ -21,6 +21,7 @@ #include "PWGHF/DataModel/CandidateSelectionTables.h" #include "PWGHF/HFC/DataModel/CorrelationTables.h" #include "PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h" +#include "PWGHF/HFC/Utils/utilsCorrelations.h" #include "PWGHF/Utils/utilsAnalysis.h" #include "Common/CCDB/EventSelectionParams.h" @@ -58,6 +59,7 @@ using namespace o2::constants::physics; using namespace o2::constants::math; using namespace o2::framework; using namespace o2::framework::expressions; +using namespace o2::analysis::hf_correlations; enum ResonantChannel : int8_t { PhiPi = 1, @@ -179,6 +181,8 @@ struct HfCorrelatorDsHadrons { Configurable removeCollWSplitVtx{"removeCollWSplitVtx", false, "Flag for rejecting the splitted collisions"}; Configurable useSel8{"useSel8", true, "Flag for applying sel8 for collision selection (used only in MC processes)"}; Configurable selNoSameBunchPileUpColl{"selNoSameBunchPileUpColl", true, "Flag for rejecting the collisions associated with the same bunch crossing (used only in MC processes)"}; + Configurable pidTrkApplied{"pidTrkApplied", false, "Apply PID selection for associated tracks"}; + Configurable forceTOF{"forceTOF", false, "force the TOF signal for the PID"}; Configurable selectionFlagDs{"selectionFlagDs", 7, "Selection Flag for Ds (avoid the case of flag = 0, no outputMlScore)"}; Configurable numberEventsMixed{"numberEventsMixed", 5, "Number of events mixed in ME process"}; Configurable decayChannel{"decayChannel", 1, "Resonant decay channels: 1 for Ds->PhiPi->KKpi, 2 for Ds->K0*K->KKPi"}; @@ -193,7 +197,11 @@ struct HfCorrelatorDsHadrons { Configurable ptTrackMin{"ptTrackMin", 0.3, "min. track pT"}; Configurable ptTrackMax{"ptTrackMax", 50., "max. track pT"}; Configurable zVtxMax{"zVtxMax", 10., "max. position-z of the reconstructed collision"}; + Configurable tofPIDThreshold{"tofPIDThreshold", 0.75, "minimum pT after which TOF PID is applicable"}; Configurable> classMl{"classMl", {0, 1, 2}, "Indexes of ML scores to be stored. Three indexes max."}; + Configurable> trkPIDspecies{"trkPIDspecies", std::vector{o2::track::PID::Proton, o2::track::PID::Pion, o2::track::PID::Kaon}, "Trk sel: Particles species for PID, proton, pion, kaon"}; + Configurable> pidTPCMax{"pidTPCMax", std::vector{3., 0., 0.}, "maximum nSigma TPC"}; + Configurable> pidTOFMax{"pidTOFMax", std::vector{3., 0., 0.}, "maximum nSigma TOF"}; Configurable> binsPtD{"binsPtD", std::vector{o2::analysis::hf_cuts_ds_to_k_k_pi::vecBinsPt}, "pT bin limits for candidate mass plots"}; Configurable> binsPtHadron{"binsPtHadron", std::vector{0.3, 2., 4., 8., 12., 50.}, "pT bin limits for assoc particle"}; Configurable> binsPtEfficiencyD{"binsPtEfficiencyD", std::vector{o2::analysis::hf_cuts_ds_to_k_k_pi::vecBinsPt}, "pT bin limits for efficiency"}; @@ -761,18 +769,20 @@ struct HfCorrelatorDsHadrons { // Ds fill histograms and Ds candidates information stored for (const auto& candidate : candsDsThisColl) { std::vector outputMl = {-1., -1., -1.}; + auto prong0 = candidate.template prong0_as(); + int chargeDs = prong0.sign(); // candidate selected if (candidate.isSelDsToKKPi() >= selectionFlagDs) { for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbDsToKKPi()[classMl->at(iclass)]; } - candReduced(indexHfcReducedCollision, candidate.phi(), candidate.eta(), candidate.pt(), hfHelper.invMassDsToKKPi(candidate), candidate.prong0Id(), candidate.prong1Id(), candidate.prong2Id()); + candReduced(indexHfcReducedCollision, candidate.phi(), candidate.eta(), candidate.pt() * chargeDs, hfHelper.invMassDsToKKPi(candidate), candidate.prong0Id(), candidate.prong1Id(), candidate.prong2Id()); candSelInfo(indexHfcReducedCollision, outputMl[0], outputMl[2]); } else if (candidate.isSelDsToPiKK() >= selectionFlagDs) { for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = candidate.mlProbDsToPiKK()[classMl->at(iclass)]; } - candReduced(indexHfcReducedCollision, candidate.phi(), candidate.eta(), candidate.pt(), hfHelper.invMassDsToPiKK(candidate), candidate.prong0Id(), candidate.prong1Id(), candidate.prong2Id()); + candReduced(indexHfcReducedCollision, candidate.phi(), candidate.eta(), candidate.pt() * chargeDs, hfHelper.invMassDsToPiKK(candidate), candidate.prong0Id(), candidate.prong1Id(), candidate.prong2Id()); candSelInfo(indexHfcReducedCollision, outputMl[0], outputMl[2]); } } @@ -782,11 +792,15 @@ struct HfCorrelatorDsHadrons { if (!track.isGlobalTrackWoDCA()) { continue; } - assocTrackReduced(indexHfcReducedCollision, track.globalIndex(), track.phi(), track.eta(), track.pt()); + if (pidTrkApplied) { + if (!passPIDSelection(track, trkPIDspecies, pidTPCMax, pidTOFMax, tofPIDThreshold, forceTOF)) + continue; + } + assocTrackReduced(indexHfcReducedCollision, track.globalIndex(), track.phi(), track.eta(), track.pt() * track.sign()); assocTrackSelInfo(indexHfcReducedCollision, track.tpcNClsCrossedRows(), track.itsClusterMap(), track.itsNCls(), track.dcaXY(), track.dcaZ()); } - collReduced(collision.multFT0M(), collision.posZ()); + collReduced(collision.multFT0M(), collision.numContrib(), collision.posZ()); } } PROCESS_SWITCH(HfCorrelatorDsHadrons, processDerivedDataDs, "Process derived data Ds", false); From e1a05c7cad87b7ecf6e60a53f8bb5ad277864464 Mon Sep 17 00:00:00 2001 From: Jesper Karlsson Gumprecht <113693781+jesgum@users.noreply.github.com> Date: Wed, 23 Jul 2025 13:04:25 +0200 Subject: [PATCH 016/345] [ALICE3] Fix to mcharm pid histograms (#12199) --- ALICE3/Tasks/alice3-multicharm.cxx | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/ALICE3/Tasks/alice3-multicharm.cxx b/ALICE3/Tasks/alice3-multicharm.cxx index 497038f724f..59c1fda5f83 100644 --- a/ALICE3/Tasks/alice3-multicharm.cxx +++ b/ALICE3/Tasks/alice3-multicharm.cxx @@ -83,12 +83,10 @@ struct alice3multicharm { Configurable picMinDCAxy{"picMinDCAxy", -1, "[0] in |DCAz| > [0]+[1]/pT"}; Configurable picMinDCAz{"picMinDCAz", -1, "[0] in |DCAxy| > [0]+[1]/pT"}; - Configurable picMaxTofDiffInner{"picTofDiffInner", 1e+4, "|signal - expected| (ps)"}; Configurable picMinPt{"picMinPt", -1, "Minimum pT for Xic pions"}; Configurable piccMinDCAxy{"piccMinDCAxy", -1, "[0] in |DCAxy| > [0]+[1]/pT"}; Configurable piccMinDCAz{"piccMinDCAz", -1, "[0] in |DCAz| > [0]+[1]/pT"}; - Configurable piccMaxTofDiffInner{"piccMaxTofDiffInner", 1e+4, "|signal - expected| (ps)"}; Configurable piccMinPt{"piccMinPt", -1, "Minimum pT for Xicc pions"}; Configurable xicMaxDauDCA{"xicMaxDauDCA", 1e+4, "DCA between Xic daughters (cm)"}; @@ -150,7 +148,7 @@ struct alice3multicharm { hMCharmBuilding->GetXaxis()->SetBinLabel(22, "xicMinDecayDistanceFromPV"); if (doprocessXiccPID || doprocessXiccExtra) { - auto hPdgCodes = histos.add("PIDQA/hPdgCodes", "hPdgCodes", kTH2D, {{3, 0.5, 3.5}, {5, 0.5, 5.5}}); + auto hPdgCodes = histos.add("PIDQA/hPdgCodes", "hPdgCodes", kTH2D, {{3, 0.5, 3.5}, {7, 0.5, 7.5}}); hPdgCodes->GetXaxis()->SetBinLabel(1, "pi1c"); hPdgCodes->GetXaxis()->SetBinLabel(2, "pi2c"); hPdgCodes->GetXaxis()->SetBinLabel(3, "picc"); @@ -159,11 +157,14 @@ struct alice3multicharm { hPdgCodes->GetYaxis()->SetBinLabel(3, "pi"); hPdgCodes->GetYaxis()->SetBinLabel(4, "ka"); hPdgCodes->GetYaxis()->SetBinLabel(5, "pr"); + hPdgCodes->GetYaxis()->SetBinLabel(6, "xi"); + hPdgCodes->GetYaxis()->SetBinLabel(7, "other"); pdgToBin.insert({kElectron, 1}); pdgToBin.insert({kMuonMinus, 2}); pdgToBin.insert({kPiPlus, 3}); pdgToBin.insert({kKPlus, 4}); pdgToBin.insert({kProton, 5}); + pdgToBin.insert({kXiMinus, 6}); histos.add("PIDQA/hInnerTofTimeDeltaPi1c", "hInnerTofTimeDeltaPi1c; Reco - expected pion (ps)", kTH1D, {axisTofTrackDelta}); histos.add("PIDQA/hInnerTofTimeDeltaPi2c", "hInnerTofTimeDeltaPi2c; Reco - expected pion (ps)", kTH1D, {axisTofTrackDelta}); @@ -194,6 +195,12 @@ struct alice3multicharm { histos.add("h3dXicc", "h3dXicc; Xicc pT (GeV/#it(c)); Xicc #eta; Xicc mass (GeV/#it(c)^{2})", kTH3D, {axisPt, axisEta, axisXiccMass}); } + int getBin(const std::map& pdgToBin, int pdg) + { + auto it = pdgToBin.find(pdg); + return (it != pdgToBin.end()) ? it->second : 7; + } + template void genericProcessXicc(TMCharmCands xiccCands) { @@ -324,9 +331,9 @@ struct alice3multicharm { histos.fill(HIST("PIDQA/hRichNSigmaPicc"), xiccCand.piccPt(), xiccCand.piccRichNSigma()); } - histos.fill(HIST("PIDQA/hPdgCodes"), 1, pdgToBin.at(std::abs(xiccCand.pi1cPdgCode()))); - histos.fill(HIST("PIDQA/hPdgCodes"), 2, pdgToBin.at(std::abs(xiccCand.pi2cPdgCode()))); - histos.fill(HIST("PIDQA/hPdgCodes"), 3, pdgToBin.at(std::abs(xiccCand.piccPdgCode()))); + histos.fill(HIST("PIDQA/hPdgCodes"), 1, getBin(pdgToBin, std::abs(xiccCand.pi1cPdgCode()))); + histos.fill(HIST("PIDQA/hPdgCodes"), 2, getBin(pdgToBin, std::abs(xiccCand.pi2cPdgCode()))); + histos.fill(HIST("PIDQA/hPdgCodes"), 3, getBin(pdgToBin, std::abs(xiccCand.piccPdgCode()))); } if constexpr (requires { xiccCand.negPt(); }) { // if extra table From f28f36730bdf00f4f537a4779d60c1688ee817bb Mon Sep 17 00:00:00 2001 From: nzardosh Date: Wed, 23 Jul 2025 12:08:25 +0100 Subject: [PATCH 017/345] [PWGJE] Adding more multiplicity and centrality estimators (#11981) --- PWGJE/DataModel/JetReducedData.h | 45 +++++++++-- PWGJE/JetFinders/jetFinder.cxx | 2 +- PWGJE/JetFinders/jetFinderHF.cxx | 2 +- PWGJE/JetFinders/jetFinderV0.cxx | 2 +- PWGJE/TableProducer/derivedDataProducer.cxx | 37 ++++++--- PWGJE/TableProducer/derivedDataSelector.cxx | 2 +- PWGJE/TableProducer/derivedDataWriter.cxx | 4 +- PWGJE/TableProducer/rhoEstimator.cxx | 16 ++-- PWGJE/Tasks/fullJetSpectra.cxx | 29 ++++--- PWGJE/Tasks/gammaJetTreeProducer.cxx | 4 +- PWGJE/Tasks/jetBackgroundAnalysis.cxx | 18 ++--- PWGJE/Tasks/jetChargedV2.cxx | 86 ++++++++++----------- PWGJE/Tasks/jetFinderFullQA.cxx | 12 +-- PWGJE/Tasks/jetFinderHFQA.cxx | 38 ++++----- PWGJE/Tasks/jetFinderQA.cxx | 48 ++++++------ PWGJE/Tasks/jetFinderV0QA.cxx | 22 +++--- PWGJE/Tasks/jetHadronRecoil.cxx | 2 +- PWGJE/Tasks/jetPlanarFlow.cxx | 2 +- PWGJE/Tasks/jetShape.cxx | 2 +- PWGJE/Tasks/jetSpectraCharged.cxx | 28 +++---- PWGJE/Tasks/jetSpectraEseTask.cxx | 70 ++++++++--------- PWGJE/Tasks/jetSubstructureHFOutput.cxx | 2 +- PWGJE/Tasks/jetSubstructureOutput.cxx | 2 +- PWGJE/Tasks/nsubjettiness.cxx | 2 +- PWGJE/Tasks/trackEfficiency.cxx | 68 ++++++++-------- 25 files changed, 297 insertions(+), 248 deletions(-) diff --git a/PWGJE/DataModel/JetReducedData.h b/PWGJE/DataModel/JetReducedData.h index 08fba650bfe..fcc3d581862 100644 --- a/PWGJE/DataModel/JetReducedData.h +++ b/PWGJE/DataModel/JetReducedData.h @@ -71,8 +71,20 @@ DECLARE_SOA_INDEX_COLUMN(JBC, bc); DECLARE_SOA_COLUMN(PosX, posX, float); DECLARE_SOA_COLUMN(PosY, posY, float); DECLARE_SOA_COLUMN(PosZ, posZ, float); -DECLARE_SOA_COLUMN(Multiplicity, multiplicity, float); -DECLARE_SOA_COLUMN(Centrality, centrality, float); +DECLARE_SOA_COLUMN(MultFV0A, multFV0A, float); +DECLARE_SOA_COLUMN(MultFV0C, multFV0C, float); +DECLARE_SOA_DYNAMIC_COLUMN(MultFV0M, multFV0M, + [](float multFV0A, float multFV0C) -> float { return multFV0A + multFV0C; }); +DECLARE_SOA_COLUMN(MultFT0A, multFT0A, float); +DECLARE_SOA_COLUMN(MultFT0C, multFT0C, float); +DECLARE_SOA_DYNAMIC_COLUMN(MultFT0M, multFT0M, + [](float multFT0A, float multFT0C) -> float { return multFT0A + multFT0C; }); +DECLARE_SOA_COLUMN(CentFV0A, centFV0A, float); +DECLARE_SOA_COLUMN(CentFV0M, centFV0M, float); // only Run 2 +DECLARE_SOA_COLUMN(CentFT0A, centFT0A, float); +DECLARE_SOA_COLUMN(CentFT0C, centFT0C, float); +DECLARE_SOA_COLUMN(CentFT0M, centFT0M, float); +DECLARE_SOA_COLUMN(CentFT0CVariant1, centFT0CVariant1, float); DECLARE_SOA_COLUMN(CentralityVariant1, centralityVariant1, float); DECLARE_SOA_COLUMN(HadronicRate, hadronicRate, float); DECLARE_SOA_COLUMN(Weight, weight, float); @@ -107,9 +119,18 @@ DECLARE_SOA_TABLE_STAGED(JCollisions, "JCOLLISION", jcollision::PosX, jcollision::PosY, jcollision::PosZ, - jcollision::Multiplicity, - jcollision::Centrality, - jcollision::CentralityVariant1, + jcollision::MultFV0A, + jcollision::MultFV0C, + jcollision::MultFV0M, + jcollision::MultFT0A, + jcollision::MultFT0C, + jcollision::MultFT0M, + jcollision::CentFV0A, + jcollision::CentFV0M, + jcollision::CentFT0A, + jcollision::CentFT0C, + jcollision::CentFT0M, + jcollision::CentFT0CVariant1, jcollision::HadronicRate, jcollision::TrackOccupancyInTimeRange, jcollision::EventSel, @@ -168,6 +189,13 @@ DECLARE_SOA_INDEX_COLUMN(McCollision, mcCollision); DECLARE_SOA_COLUMN(PosX, posX, float); DECLARE_SOA_COLUMN(PosY, posY, float); DECLARE_SOA_COLUMN(PosZ, posZ, float); +DECLARE_SOA_COLUMN(MultFV0A, multFV0A, float); +DECLARE_SOA_COLUMN(MultFT0A, multFT0A, float); +DECLARE_SOA_COLUMN(MultFT0C, multFT0C, float); +DECLARE_SOA_COLUMN(CentFV0A, centFV0A, float); +DECLARE_SOA_COLUMN(CentFT0A, centFT0A, float); +DECLARE_SOA_COLUMN(CentFT0C, centFT0C, float); +DECLARE_SOA_COLUMN(CentFT0M, centFT0M, float); DECLARE_SOA_COLUMN(Weight, weight, float); DECLARE_SOA_COLUMN(SubGeneratorId, subGeneratorId, int); DECLARE_SOA_COLUMN(Accepted, accepted, uint64_t); @@ -182,6 +210,13 @@ DECLARE_SOA_TABLE_STAGED(JMcCollisions, "JMCCOLLISION", jmccollision::PosX, jmccollision::PosY, jmccollision::PosZ, + jmccollision::MultFV0A, + jmccollision::MultFT0A, + jmccollision::MultFT0C, + jmccollision::CentFV0A, + jmccollision::CentFT0A, + jmccollision::CentFT0C, + jmccollision::CentFT0M, jmccollision::Weight, jmccollision::SubGeneratorId, jmccollision::Accepted, diff --git a/PWGJE/JetFinders/jetFinder.cxx b/PWGJE/JetFinders/jetFinder.cxx index 3c624c8969d..990286c61eb 100644 --- a/PWGJE/JetFinders/jetFinder.cxx +++ b/PWGJE/JetFinders/jetFinder.cxx @@ -164,7 +164,7 @@ struct JetFinderTask { } aod::EMCALClusterDefinition clusterDefinition = aod::emcalcluster::getClusterDefinitionFromString(clusterDefinitionS.value); - Filter collisionFilter = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centrality >= centralityMin && aod::jcollision::centrality < centralityMax && aod::jcollision::trackOccupancyInTimeRange <= trackOccupancyInTimeRangeMax && ((skipMBGapEvents.node() == false) || (aod::jcollision::subGeneratorId != static_cast(jetderiveddatautilities::JCollisionSubGeneratorId::mbGap)))); + Filter collisionFilter = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centFT0M >= centralityMin && aod::jcollision::centFT0M < centralityMax && aod::jcollision::trackOccupancyInTimeRange <= trackOccupancyInTimeRangeMax && ((skipMBGapEvents.node() == false) || (aod::jcollision::subGeneratorId != static_cast(jetderiveddatautilities::JCollisionSubGeneratorId::mbGap)))); Filter mcCollisionFilter = ((skipMBGapEvents.node() == false) || (aod::jmccollision::subGeneratorId != static_cast(jetderiveddatautilities::JCollisionSubGeneratorId::mbGap))); // should we add a posZ vtx cut here or leave it to analysers? Filter trackCuts = (aod::jtrack::pt >= trackPtMin && aod::jtrack::pt < trackPtMax && aod::jtrack::eta >= trackEtaMin && aod::jtrack::eta <= trackEtaMax && aod::jtrack::phi >= trackPhiMin && aod::jtrack::phi <= trackPhiMax); // do we need eta cut both here and in globalselection? Filter partCuts = (aod::jmcparticle::pt >= trackPtMin && aod::jmcparticle::pt < trackPtMax && aod::jmcparticle::eta >= trackEtaMin && aod::jmcparticle::eta <= trackEtaMax && aod::jmcparticle::phi >= trackPhiMin && aod::jmcparticle::phi <= trackPhiMax); diff --git a/PWGJE/JetFinders/jetFinderHF.cxx b/PWGJE/JetFinders/jetFinderHF.cxx index 4314498a02a..34409335767 100644 --- a/PWGJE/JetFinders/jetFinderHF.cxx +++ b/PWGJE/JetFinders/jetFinderHF.cxx @@ -168,7 +168,7 @@ struct JetFinderHFTask { } aod::EMCALClusterDefinition clusterDefinition = aod::emcalcluster::getClusterDefinitionFromString(clusterDefinitionS.value); - Filter collisionFilter = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centrality >= centralityMin && aod::jcollision::centrality < centralityMax && aod::jcollision::trackOccupancyInTimeRange <= trackOccupancyInTimeRangeMax && ((skipMBGapEvents.node() == false) || (aod::jcollision::subGeneratorId != static_cast(jetderiveddatautilities::JCollisionSubGeneratorId::mbGap)))); + Filter collisionFilter = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centFT0M >= centralityMin && aod::jcollision::centFT0M < centralityMax && aod::jcollision::trackOccupancyInTimeRange <= trackOccupancyInTimeRangeMax && ((skipMBGapEvents.node() == false) || (aod::jcollision::subGeneratorId != static_cast(jetderiveddatautilities::JCollisionSubGeneratorId::mbGap)))); Filter mcCollisionFilter = ((skipMBGapEvents.node() == false) || (aod::jmccollision::subGeneratorId != static_cast(jetderiveddatautilities::JCollisionSubGeneratorId::mbGap))); // should we add a posZ vtx cut here or leave it to analysers? Filter trackCuts = (aod::jtrack::pt >= trackPtMin && aod::jtrack::pt < trackPtMax && aod::jtrack::eta >= trackEtaMin && aod::jtrack::eta <= trackEtaMax && aod::jtrack::phi >= trackPhiMin && aod::jtrack::phi <= trackPhiMax); Filter partCuts = (aod::jmcparticle::pt >= trackPtMin && aod::jmcparticle::pt < trackPtMax && aod::jmcparticle::eta >= trackEtaMin && aod::jmcparticle::eta <= trackEtaMax && aod::jmcparticle::phi >= trackPhiMin && aod::jmcparticle::phi <= trackPhiMax); diff --git a/PWGJE/JetFinders/jetFinderV0.cxx b/PWGJE/JetFinders/jetFinderV0.cxx index efa00d6a7dc..6d8b94d905a 100644 --- a/PWGJE/JetFinders/jetFinderV0.cxx +++ b/PWGJE/JetFinders/jetFinderV0.cxx @@ -157,7 +157,7 @@ struct JetFinderV0Task { registry.add("hJetMCP", "sparse for mcp jets", {HistType::kTHnC, {{jetRadiiBins, ""}, {jetPtBinNumber, jetPtMinDouble, jetPtMaxDouble}, {40, -1.0, 1.0}, {18, 0.0, 7.0}}}); } - Filter collisionFilter = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centrality >= centralityMin && aod::jcollision::centrality < centralityMax && aod::jcollision::trackOccupancyInTimeRange <= trackOccupancyInTimeRangeMax && ((skipMBGapEvents.node() == false) || (aod::jcollision::subGeneratorId != static_cast(jetderiveddatautilities::JCollisionSubGeneratorId::mbGap)))); + Filter collisionFilter = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centFT0M >= centralityMin && aod::jcollision::centFT0M < centralityMax && aod::jcollision::trackOccupancyInTimeRange <= trackOccupancyInTimeRangeMax && ((skipMBGapEvents.node() == false) || (aod::jcollision::subGeneratorId != static_cast(jetderiveddatautilities::JCollisionSubGeneratorId::mbGap)))); Filter mcCollisionFilter = ((skipMBGapEvents.node() == false) || (aod::jmccollision::subGeneratorId != static_cast(jetderiveddatautilities::JCollisionSubGeneratorId::mbGap))); // should we add a posZ vtx cut here or leave it to analysers? Filter trackCuts = (aod::jtrack::pt >= trackPtMin && aod::jtrack::pt < trackPtMax && aod::jtrack::eta >= trackEtaMin && aod::jtrack::eta <= trackEtaMax && aod::jtrack::phi >= trackPhiMin && aod::jtrack::phi <= trackPhiMax); Filter partCuts = (aod::jmcparticle::pt >= trackPtMin && aod::jmcparticle::pt < trackPtMax && aod::jmcparticle::eta >= trackEtaMin && aod::jmcparticle::eta <= trackEtaMax && aod::jmcparticle::phi >= trackPhiMin && aod::jmcparticle::phi <= trackPhiMax); diff --git a/PWGJE/TableProducer/derivedDataProducer.cxx b/PWGJE/TableProducer/derivedDataProducer.cxx index e4ac527a171..045c2648acd 100644 --- a/PWGJE/TableProducer/derivedDataProducer.cxx +++ b/PWGJE/TableProducer/derivedDataProducer.cxx @@ -26,6 +26,7 @@ #include "PWGJE/DataModel/JetReducedDataHF.h" #include "PWGJE/DataModel/JetReducedDataV0.h" #include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGLF/DataModel/mcCentrality.h" #include "Common/CCDB/ctpRateFetcher.h" #include "Common/Core/RecoDecay.h" @@ -189,7 +190,7 @@ struct JetDerivedDataProducerTask { } PROCESS_SWITCH(JetDerivedDataProducerTask, processBunchCrossings, "produces derived bunch crossing table", false); - void processCollisions(soa::Join::iterator const& collision, soa::Join const&) + void processCollisions(soa::Join::iterator const& collision, soa::Join const&) { auto bc = collision.bc_as>(); if (includeHadronicRate) { @@ -203,7 +204,7 @@ struct JetDerivedDataProducerTask { triggerDecider.initCCDB(ccdb.service, bc.runNumber(), bc.timestamp(), jetderiveddatautilities::JTriggerMasks); triggerBit = jetderiveddatautilities::setTriggerSelectionBit(triggerDecider.getTriggerOfInterestResults(bc.globalBC())); } - products.jCollisionsTable(collision.posX(), collision.posY(), collision.posZ(), collision.multFT0C(), collision.centFT0C(), collision.centFT0CVariant1(), hadronicRate, collision.trackOccupancyInTimeRange(), jetderiveddatautilities::setEventSelectionBit(collision), collision.alias_raw(), triggerBit); // note change multFT0C to multFT0M when problems with multFT0A are fixed + products.jCollisionsTable(collision.posX(), collision.posY(), collision.posZ(), collision.multFV0A(), collision.multFV0C(), collision.multFT0A(), collision.multFT0C(), collision.centFV0A(), -1.0, collision.centFT0A(), collision.centFT0C(), collision.centFT0M(), collision.centFT0CVariant1(), hadronicRate, collision.trackOccupancyInTimeRange(), jetderiveddatautilities::setEventSelectionBit(collision), collision.alias_raw(), triggerBit); // note change multFT0C to multFT0M when problems with multFT0A are fixed products.jCollisionsParentIndexTable(collision.globalIndex()); products.jCollisionsBunchCrossingIndexTable(collision.bcId()); } @@ -217,15 +218,15 @@ struct JetDerivedDataProducerTask { triggerDecider.initCCDB(ccdb.service, bc.runNumber(), bc.timestamp(), jetderiveddatautilities::JTriggerMasks); triggerBit = jetderiveddatautilities::setTriggerSelectionBit(triggerDecider.getTriggerOfInterestResults(bc.globalBC())); } - products.jCollisionsTable(collision.posX(), collision.posY(), collision.posZ(), -1.0, -1.0, -1.0, -1.0, -1, jetderiveddatautilities::setEventSelectionBit(collision), collision.alias_raw(), triggerBit); + products.jCollisionsTable(collision.posX(), collision.posY(), collision.posZ(), -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1, jetderiveddatautilities::setEventSelectionBit(collision), collision.alias_raw(), triggerBit); products.jCollisionsParentIndexTable(collision.globalIndex()); products.jCollisionsBunchCrossingIndexTable(collision.bcId()); } PROCESS_SWITCH(JetDerivedDataProducerTask, processCollisionsWithoutCentralityAndMultiplicity, "produces derived collision tables without centrality or multiplicity", false); - void processCollisionsRun2(soa::Join::iterator const& collision) + void processCollisionsRun2(soa::Join::iterator const& collision) { - products.jCollisionsTable(collision.posX(), collision.posY(), collision.posZ(), collision.multFT0C(), collision.centRun2V0M(), -1.0, -1.0, -1, jetderiveddatautilities::setEventSelectionBit(collision), collision.alias_raw(), 0); // note change multFT0C to multFT0M when problems with multFT0A are fixed + products.jCollisionsTable(collision.posX(), collision.posY(), collision.posZ(), -1.0, -1.0, -1.0, -1.0, collision.centRun2V0A(), collision.centRun2V0M(), -1.0, -1.0, -1.0, -1.0, 1.0, -1, jetderiveddatautilities::setEventSelectionBit(collision), collision.alias_raw(), 0); // note change multFT0C to multFT0M when problems with multFT0A are fixed products.jCollisionsParentIndexTable(collision.globalIndex()); products.jCollisionsBunchCrossingIndexTable(collision.bcId()); } @@ -233,7 +234,7 @@ struct JetDerivedDataProducerTask { void processCollisionsALICE3(aod::Collision const& collision) { - products.jCollisionsTable(collision.posX(), collision.posY(), collision.posZ(), -1.0, -1.0, -1.0, -1.0, -1, -1.0, 0, 0); + products.jCollisionsTable(collision.posX(), collision.posY(), collision.posZ(), -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1, -1.0, 0, 0); products.jCollisionsParentIndexTable(collision.globalIndex()); products.jCollisionsBunchCrossingIndexTable(-1); } @@ -262,19 +263,33 @@ struct JetDerivedDataProducerTask { } PROCESS_SWITCH(JetDerivedDataProducerTask, processMcCollisionLabels, "produces derived MC collision labels table", false); - void processMcCollisions(aod::McCollision const& mcCollision) + void processMcCollisions(soa::Join::iterator const& mcCollision) { - products.jMcCollisionsTable(mcCollision.posX(), mcCollision.posY(), mcCollision.posZ(), mcCollision.weight(), mcCollision.getSubGeneratorId(), 1, 1, 1.0, 1.0, 999.0); + products.jMcCollisionsTable(mcCollision.posX(), mcCollision.posY(), mcCollision.posZ(), mcCollision.multMCFV0A(), mcCollision.multMCFT0A(), mcCollision.multMCFT0C(), mcCollision.centFV0A(), mcCollision.centFT0A(), mcCollision.centFT0C(), mcCollision.centFT0M(), mcCollision.weight(), mcCollision.getSubGeneratorId(), mcCollision.accepted(), mcCollision.attempted(), mcCollision.xsectGen(), mcCollision.xsectErr(), mcCollision.ptHard()); products.jMcCollisionsParentIndexTable(mcCollision.globalIndex()); } PROCESS_SWITCH(JetDerivedDataProducerTask, processMcCollisions, "produces derived MC collision table", false); - void processMcCollisionsWithXsection(soa::Join::iterator const& mcCollision) + void processMcCollisionsWithoutCentralityAndMultiplicity(soa::Join::iterator const& mcCollision) { - products.jMcCollisionsTable(mcCollision.posX(), mcCollision.posY(), mcCollision.posZ(), mcCollision.weight(), mcCollision.getSubGeneratorId(), mcCollision.accepted(), mcCollision.attempted(), mcCollision.xsectGen(), mcCollision.xsectErr(), mcCollision.ptHard()); + products.jMcCollisionsTable(mcCollision.posX(), mcCollision.posY(), mcCollision.posZ(), -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, mcCollision.weight(), mcCollision.getSubGeneratorId(), mcCollision.accepted(), mcCollision.attempted(), mcCollision.xsectGen(), mcCollision.xsectErr(), mcCollision.ptHard()); products.jMcCollisionsParentIndexTable(mcCollision.globalIndex()); } - PROCESS_SWITCH(JetDerivedDataProducerTask, processMcCollisionsWithXsection, "produces derived MC collision table with cross section information", false); + PROCESS_SWITCH(JetDerivedDataProducerTask, processMcCollisionsWithoutCentralityAndMultiplicity, "produces derived MC collision table without centraility and multiplicity", false); + + void processMcCollisionsWithoutXsection(soa::Join::iterator const& mcCollision) + { + products.jMcCollisionsTable(mcCollision.posX(), mcCollision.posY(), mcCollision.posZ(), mcCollision.multMCFV0A(), mcCollision.multMCFT0A(), mcCollision.multMCFT0C(), mcCollision.centFV0A(), mcCollision.centFT0A(), mcCollision.centFT0C(), mcCollision.centFT0M(), mcCollision.weight(), mcCollision.getSubGeneratorId(), 1, 1, 1.0, 1.0, 999.0); + products.jMcCollisionsParentIndexTable(mcCollision.globalIndex()); + } + PROCESS_SWITCH(JetDerivedDataProducerTask, processMcCollisionsWithoutXsection, "produces derived MC collision table without cross section information", false); + + void processMcCollisionsWithoutCentralityAndMultiplicityAndXsection(aod::McCollision const& mcCollision) + { + products.jMcCollisionsTable(mcCollision.posX(), mcCollision.posY(), mcCollision.posZ(), -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, mcCollision.weight(), mcCollision.getSubGeneratorId(), 1, 1, 1.0, 1.0, 999.0); + products.jMcCollisionsParentIndexTable(mcCollision.globalIndex()); + } + PROCESS_SWITCH(JetDerivedDataProducerTask, processMcCollisionsWithoutCentralityAndMultiplicityAndXsection, "produces derived MC collision table without centrality, multiplicity and cross section information", false); void processTracks(soa::Join::iterator const& track, aod::Collisions const&) { diff --git a/PWGJE/TableProducer/derivedDataSelector.cxx b/PWGJE/TableProducer/derivedDataSelector.cxx index 110056d73a1..9e04a6332b4 100644 --- a/PWGJE/TableProducer/derivedDataSelector.cxx +++ b/PWGJE/TableProducer/derivedDataSelector.cxx @@ -183,7 +183,7 @@ struct JetDerivedDataSelector { void processDoCollisionSelections(aod::JCollision const& collision) { // can also add event selection like sel8 but goes a little against the derived data idea - if (collision.centrality() < config.centralityMin || collision.centrality() >= config.centralityMax || collision.trackOccupancyInTimeRange() > config.trackOccupancyInTimeRangeMax || std::abs(collision.posZ()) > config.vertexZCut) { + if (collision.centFT0M() < config.centralityMin || collision.centFT0M() >= config.centralityMax || collision.trackOccupancyInTimeRange() > config.trackOccupancyInTimeRangeMax || std::abs(collision.posZ()) > config.vertexZCut) { collisionFlag[collision.globalIndex()] = false; } } diff --git a/PWGJE/TableProducer/derivedDataWriter.cxx b/PWGJE/TableProducer/derivedDataWriter.cxx index 4c382f9abdd..d583250d49f 100644 --- a/PWGJE/TableProducer/derivedDataWriter.cxx +++ b/PWGJE/TableProducer/derivedDataWriter.cxx @@ -390,7 +390,7 @@ struct JetDerivedDataWriter { for (auto const& collision : collisions) { if (collision.isCollisionSelected()) { - products.storedJCollisionsTable(collision.posX(), collision.posY(), collision.posZ(), collision.multiplicity(), collision.centrality(), collision.centralityVariant1(), collision.hadronicRate(), collision.trackOccupancyInTimeRange(), collision.eventSel(), collision.alias_raw(), collision.triggerSel()); + products.storedJCollisionsTable(collision.posX(), collision.posY(), collision.posZ(), collision.multFV0A(), collision.multFV0C(), collision.multFT0A(), collision.multFT0C(), collision.centFV0A(), collision.centFV0M(), collision.centFT0A(), collision.centFT0C(), collision.centFT0M(), collision.centFT0CVariant1(), collision.hadronicRate(), collision.trackOccupancyInTimeRange(), collision.eventSel(), collision.alias_raw(), collision.triggerSel()); collisionMapping[collision.globalIndex()] = products.storedJCollisionsTable.lastIndex(); products.storedJCollisionMcInfosTable(collision.weight(), collision.subGeneratorId()); products.storedJCollisionsParentIndexTable(collision.collisionId()); @@ -543,7 +543,7 @@ struct JetDerivedDataWriter { mcCollisionMapping.resize(mcCollisions.size(), -1); for (auto const& mcCollision : mcCollisions) { if (mcCollision.isMcCollisionSelected()) { - products.storedJMcCollisionsTable(mcCollision.posX(), mcCollision.posY(), mcCollision.posZ(), mcCollision.weight(), mcCollision.subGeneratorId(), mcCollision.accepted(), mcCollision.attempted(), mcCollision.xsectGen(), mcCollision.xsectErr(), mcCollision.ptHard()); + products.storedJMcCollisionsTable(mcCollision.posX(), mcCollision.posY(), mcCollision.posZ(), mcCollision.multFV0A(), mcCollision.multFT0A(), mcCollision.multFT0C(), mcCollision.centFV0A(), mcCollision.centFT0A(), mcCollision.centFT0C(), mcCollision.centFT0M(), mcCollision.weight(), mcCollision.subGeneratorId(), mcCollision.accepted(), mcCollision.attempted(), mcCollision.xsectGen(), mcCollision.xsectErr(), mcCollision.ptHard()); products.storedJMcCollisionsParentIndexTable(mcCollision.mcCollisionId()); mcCollisionMapping[mcCollision.globalIndex()] = products.storedJMcCollisionsTable.lastIndex(); } diff --git a/PWGJE/TableProducer/rhoEstimator.cxx b/PWGJE/TableProducer/rhoEstimator.cxx index 6cacf12ab69..b6026e46291 100644 --- a/PWGJE/TableProducer/rhoEstimator.cxx +++ b/PWGJE/TableProducer/rhoEstimator.cxx @@ -191,7 +191,7 @@ struct RhoEstimatorTask { void processChargedCollisions(aod::JetCollision const& collision, soa::Filtered const& tracks) { - if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits) || collision.centrality() < config.centralityMin || collision.centrality() >= config.centralityMax || collision.trackOccupancyInTimeRange() > config.trackOccupancyInTimeRangeMax || std::abs(collision.posZ()) > config.vertexZCut) { + if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits) || collision.centFT0M() < config.centralityMin || collision.centFT0M() >= config.centralityMax || collision.trackOccupancyInTimeRange() > config.trackOccupancyInTimeRangeMax || std::abs(collision.posZ()) > config.vertexZCut) { rhoChargedTable(0.0, 0.0); return; } @@ -226,7 +226,7 @@ struct RhoEstimatorTask { void processD0Collisions(aod::JetCollision const& collision, soa::Filtered const& tracks, aod::CandidatesD0Data const& candidates) { for (auto& candidate : candidates) { - if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits) || collision.centrality() < config.centralityMin || collision.centrality() >= config.centralityMax || collision.trackOccupancyInTimeRange() > config.trackOccupancyInTimeRangeMax || std::abs(collision.posZ()) > config.vertexZCut) { + if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits) || collision.centFT0M() < config.centralityMin || collision.centFT0M() >= config.centralityMax || collision.trackOccupancyInTimeRange() > config.trackOccupancyInTimeRangeMax || std::abs(collision.posZ()) > config.vertexZCut) { rhoD0Table(0.0, 0.0); continue; } @@ -254,7 +254,7 @@ struct RhoEstimatorTask { void processDplusCollisions(aod::JetCollision const& collision, soa::Filtered const& tracks, aod::CandidatesDplusData const& candidates) { for (auto& candidate : candidates) { - if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits) || collision.centrality() < config.centralityMin || collision.centrality() >= config.centralityMax || collision.trackOccupancyInTimeRange() > config.trackOccupancyInTimeRangeMax || std::abs(collision.posZ()) > config.vertexZCut) { + if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits) || collision.centFT0M() < config.centralityMin || collision.centFT0M() >= config.centralityMax || collision.trackOccupancyInTimeRange() > config.trackOccupancyInTimeRangeMax || std::abs(collision.posZ()) > config.vertexZCut) { rhoDplusTable(0.0, 0.0); continue; } @@ -282,7 +282,7 @@ struct RhoEstimatorTask { void processDstarCollisions(aod::JetCollision const& collision, soa::Filtered const& tracks, aod::CandidatesDstarData const& candidates) { for (auto& candidate : candidates) { - if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits) || collision.centrality() < config.centralityMin || collision.centrality() >= config.centralityMax || collision.trackOccupancyInTimeRange() > config.trackOccupancyInTimeRangeMax || std::abs(collision.posZ()) > config.vertexZCut) { + if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits) || collision.centFT0M() < config.centralityMin || collision.centFT0M() >= config.centralityMax || collision.trackOccupancyInTimeRange() > config.trackOccupancyInTimeRangeMax || std::abs(collision.posZ()) > config.vertexZCut) { rhoDstarTable(0.0, 0.0); continue; } @@ -310,7 +310,7 @@ struct RhoEstimatorTask { void processLcCollisions(aod::JetCollision const& collision, soa::Filtered const& tracks, aod::CandidatesLcData const& candidates) { for (auto& candidate : candidates) { - if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits) || collision.centrality() < config.centralityMin || collision.centrality() >= config.centralityMax || collision.trackOccupancyInTimeRange() > config.trackOccupancyInTimeRangeMax || std::abs(collision.posZ()) > config.vertexZCut) { + if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits) || collision.centFT0M() < config.centralityMin || collision.centFT0M() >= config.centralityMax || collision.trackOccupancyInTimeRange() > config.trackOccupancyInTimeRangeMax || std::abs(collision.posZ()) > config.vertexZCut) { rhoLcTable(0.0, 0.0); continue; } @@ -338,7 +338,7 @@ struct RhoEstimatorTask { void processB0Collisions(aod::JetCollision const& collision, soa::Filtered const& tracks, aod::CandidatesB0Data const& candidates) { for (auto& candidate : candidates) { - if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits) || collision.centrality() < config.centralityMin || collision.centrality() >= config.centralityMax || collision.trackOccupancyInTimeRange() > config.trackOccupancyInTimeRangeMax || std::abs(collision.posZ()) > config.vertexZCut) { + if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits) || collision.centFT0M() < config.centralityMin || collision.centFT0M() >= config.centralityMax || collision.trackOccupancyInTimeRange() > config.trackOccupancyInTimeRangeMax || std::abs(collision.posZ()) > config.vertexZCut) { rhoB0Table(0.0, 0.0); continue; } @@ -366,7 +366,7 @@ struct RhoEstimatorTask { void processBplusCollisions(aod::JetCollision const& collision, soa::Filtered const& tracks, aod::CandidatesBplusData const& candidates) { for (auto& candidate : candidates) { - if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits) || collision.centrality() < config.centralityMin || collision.centrality() >= config.centralityMax || collision.trackOccupancyInTimeRange() > config.trackOccupancyInTimeRangeMax || std::abs(collision.posZ()) > config.vertexZCut) { + if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits) || collision.centFT0M() < config.centralityMin || collision.centFT0M() >= config.centralityMax || collision.trackOccupancyInTimeRange() > config.trackOccupancyInTimeRangeMax || std::abs(collision.posZ()) > config.vertexZCut) { rhoBplusTable(0.0, 0.0); continue; } @@ -394,7 +394,7 @@ struct RhoEstimatorTask { void processDielectronCollisions(aod::JetCollision const& collision, soa::Filtered const& tracks, aod::CandidatesDielectronData const& candidates) { for (auto& candidate : candidates) { - if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits) || collision.centrality() < config.centralityMin || collision.centrality() >= config.centralityMax || collision.trackOccupancyInTimeRange() > config.trackOccupancyInTimeRangeMax || std::abs(collision.posZ()) > config.vertexZCut) { + if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits) || collision.centFT0M() < config.centralityMin || collision.centFT0M() >= config.centralityMax || collision.trackOccupancyInTimeRange() > config.trackOccupancyInTimeRangeMax || std::abs(collision.posZ()) > config.vertexZCut) { rhoDielectronTable(0.0, 0.0); continue; } diff --git a/PWGJE/Tasks/fullJetSpectra.cxx b/PWGJE/Tasks/fullJetSpectra.cxx index d490cf5959e..bd2deac8148 100644 --- a/PWGJE/Tasks/fullJetSpectra.cxx +++ b/PWGJE/Tasks/fullJetSpectra.cxx @@ -22,7 +22,6 @@ #include "PWGJE/DataModel/JetReducedData.h" #include "Common/CCDB/TriggerAliases.h" -#include "Common/DataModel/Multiplicity.h" #include "Framework/ASoA.h" #include "Framework/AnalysisTask.h" @@ -446,8 +445,8 @@ struct FullJetSpectra { // Applying some cuts(filters) on collisions, tracks, clusters - Filter eventCuts = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centrality >= centralityMin && aod::jcollision::centrality < centralityMax); - // Filter EMCeventCuts = (nabs(aod::collision::posZ) < vertexZCut && aod::collision::centrality >= centralityMin && aod::collision::centrality < centralityMax); + Filter eventCuts = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centFT0M >= centralityMin && aod::jcollision::centFT0M < centralityMax); + // Filter EMCeventCuts = (nabs(aod::collision::posZ) < vertexZCut && aod::collision::v >= centralityMin && aod::collision::centFT0M < centralityMax); Filter trackCuts = (aod::jtrack::pt >= trackpTMin && aod::jtrack::pt < trackpTMax && aod::jtrack::eta > trackEtaMin && aod::jtrack::eta < trackEtaMax && aod::jtrack::phi >= trackPhiMin && aod::jtrack::phi <= trackPhiMax); aod::EMCALClusterDefinition clusterDefinition = aod::emcalcluster::getClusterDefinitionFromString(clusterDefinitionS.value); Filter clusterFilter = (aod::jcluster::definition == static_cast(clusterDefinition) && aod::jcluster::eta > clusterEtaMin && aod::jcluster::eta < clusterEtaMax && aod::jcluster::phi >= clusterPhiMin && aod::jcluster::phi <= clusterPhiMax && aod::jcluster::energy >= clusterEnergyMin && aod::jcluster::time > clusterTimeMin && aod::jcluster::time < clusterTimeMax && (clusterRejectExotics && aod::jcluster::isExotic != true)); @@ -1568,7 +1567,7 @@ struct FullJetSpectra { } PROCESS_SWITCH(FullJetSpectra, processTracksWeighted, "Full Jet tracks weighted", false); - void processCollisionsWeightedWithMultiplicity(soa::Filtered>::iterator const& collision, JetTableMCDWeightedJoined const& mcdjets, aod::JMcCollisions const&, soa::Filtered const& tracks, soa::Filtered const& clusters) + void processCollisionsWeightedWithMultiplicity(soa::Filtered::iterator const& collision, JetTableMCDWeightedJoined const& mcdjets, aod::JMcCollisions const&, soa::Filtered const& tracks, soa::Filtered const& clusters) { bool eventAccepted = false; float eventWeight = collision.mcCollision().weight(); @@ -1619,7 +1618,7 @@ struct FullJetSpectra { } } registry.fill(HIST("hEventmultiplicityCounter"), 7.5, eventWeight); // EMCAcceptedWeightedCollAfterTrackSel - registry.fill(HIST("h_FT0Mults_occupancy"), collision.multiplicity(), eventWeight); + registry.fill(HIST("h_FT0Mults_occupancy"), collision.multFT0M(), eventWeight); for (auto const& mcdjet : mcdjets) { float pTHat = 10. / (std::pow(eventWeight, 1.0 / pTHatExponent)); @@ -1635,18 +1634,18 @@ struct FullJetSpectra { if (!isAcceptedJet(mcdjet)) { continue; } - registry.fill(HIST("h2_full_jet_jetpTDetVsFT0Mults"), mcdjet.pt(), collision.multiplicity(), eventWeight); + registry.fill(HIST("h2_full_jet_jetpTDetVsFT0Mults"), mcdjet.pt(), collision.multFT0M(), eventWeight); for (auto const& cluster : clusters) { neutralEnergy += cluster.energy(); } auto nef = neutralEnergy / mcdjet.energy(); - registry.fill(HIST("h3_full_jet_jetpTDet_FT0Mults_nef"), mcdjet.pt(), collision.multiplicity(), nef, eventWeight); + registry.fill(HIST("h3_full_jet_jetpTDet_FT0Mults_nef"), mcdjet.pt(), collision.multFT0M(), nef, eventWeight); } } PROCESS_SWITCH(FullJetSpectra, processCollisionsWeightedWithMultiplicity, "Weighted Collisions for Full Jets Multiplicity Studies", false); - void processMBCollisionsWithMultiplicity(soa::Filtered>::iterator const& collision, JetTableMCDJoined const& mcdjets, aod::JMcCollisions const&, soa::Filtered const& tracks, soa::Filtered const& clusters) + void processMBCollisionsWithMultiplicity(soa::Filtered::iterator const& collision, JetTableMCDJoined const& mcdjets, aod::JMcCollisions const&, soa::Filtered const& tracks, soa::Filtered const& clusters) { bool eventAccepted = false; float pTHat = 10. / (std::pow(1.0, 1.0 / pTHatExponent)); @@ -1694,7 +1693,7 @@ struct FullJetSpectra { } } registry.fill(HIST("hEventmultiplicityCounter"), 7.5); // EMCAcceptedCollAfterTrackSel - registry.fill(HIST("h_FT0Mults_occupancy"), collision.multiplicity()); + registry.fill(HIST("h_FT0Mults_occupancy"), collision.multFT0M()); for (auto const& mcdjet : mcdjets) { if (mcdjet.pt() > pTHatMaxMCD * pTHat || pTHat < pTHatAbsoluteMin) { // MCD (Detector Level) Outlier Rejection @@ -1709,18 +1708,18 @@ struct FullJetSpectra { if (!isAcceptedJet(mcdjet)) { continue; } - registry.fill(HIST("h2_full_jet_jetpTDetVsFT0Mults"), mcdjet.pt(), collision.multiplicity(), 1.0); + registry.fill(HIST("h2_full_jet_jetpTDetVsFT0Mults"), mcdjet.pt(), collision.multFT0M(), 1.0); for (auto const& cluster : clusters) { neutralEnergy += cluster.energy(); } auto nef = neutralEnergy / mcdjet.energy(); - registry.fill(HIST("h3_full_jet_jetpTDet_FT0Mults_nef"), mcdjet.pt(), collision.multiplicity(), nef, 1.0); + registry.fill(HIST("h3_full_jet_jetpTDet_FT0Mults_nef"), mcdjet.pt(), collision.multFT0M(), nef, 1.0); } } PROCESS_SWITCH(FullJetSpectra, processMBCollisionsWithMultiplicity, "MB MCD Collisions for Full Jets Multiplicity Studies", false); - void processMBCollisionsDATAWithMultiplicity(soa::Filtered>::iterator const& collision, FullJetTableDataJoined const& jets, soa::Filtered const& tracks, soa::Filtered const& clusters) + void processMBCollisionsDATAWithMultiplicity(soa::Filtered::iterator const& collision, FullJetTableDataJoined const& jets, soa::Filtered const& tracks, soa::Filtered const& clusters) { bool eventAccepted = false; float neutralEnergy = 0.0; @@ -1766,7 +1765,7 @@ struct FullJetSpectra { } } registry.fill(HIST("hEventmultiplicityCounter"), 7.5); // EMCAcceptedCollAfterTrackSel - registry.fill(HIST("h_FT0Mults_occupancy"), collision.multiplicity()); + registry.fill(HIST("h_FT0Mults_occupancy"), collision.multFT0M()); for (auto const& jet : jets) { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { @@ -1778,13 +1777,13 @@ struct FullJetSpectra { if (!isAcceptedJet(jet)) { continue; } - registry.fill(HIST("h2_full_jet_jetpTDetVsFT0Mults"), jet.pt(), collision.multiplicity(), 1.0); + registry.fill(HIST("h2_full_jet_jetpTDetVsFT0Mults"), jet.pt(), collision.multFT0M(), 1.0); for (auto const& cluster : clusters) { neutralEnergy += cluster.energy(); } auto nef = neutralEnergy / jet.energy(); - registry.fill(HIST("h3_full_jet_jetpTDet_FT0Mults_nef"), jet.pt(), collision.multiplicity(), nef, 1.0); + registry.fill(HIST("h3_full_jet_jetpTDet_FT0Mults_nef"), jet.pt(), collision.multFT0M(), nef, 1.0); } } PROCESS_SWITCH(FullJetSpectra, processMBCollisionsDATAWithMultiplicity, "MB DATA Collisions for Full Jets Multiplicity Studies", false); diff --git a/PWGJE/Tasks/gammaJetTreeProducer.cxx b/PWGJE/Tasks/gammaJetTreeProducer.cxx index b233989630c..a054a8e97b8 100644 --- a/PWGJE/Tasks/gammaJetTreeProducer.cxx +++ b/PWGJE/Tasks/gammaJetTreeProducer.cxx @@ -941,7 +941,7 @@ struct GammaJetTreeProducer { return; } - eventsTable(collision.multiplicity(), collision.centrality(), collision.rho(), collision.eventSel(), collision.trackOccupancyInTimeRange(), collision.alias_raw()); + eventsTable(collision.multFT0M(), collision.centFT0M(), collision.rho(), collision.eventSel(), collision.trackOccupancyInTimeRange(), collision.alias_raw()); collisionMapping[collision.globalIndex()] = eventsTable.lastIndex(); } PROCESS_SWITCH(GammaJetTreeProducer, processEventData, "Process event data", true); @@ -971,7 +971,7 @@ struct GammaJetTreeProducer { mHistograms.fill(HIST("eventQA"), 7); // fill rec collision table - eventsTable(collision.multiplicity(), collision.centrality(), collision.rho(), collision.eventSel(), collision.trackOccupancyInTimeRange(), collision.alias_raw()); + eventsTable(collision.multFT0M(), collision.centFT0M(), collision.rho(), collision.eventSel(), collision.trackOccupancyInTimeRange(), collision.alias_raw()); // fill collision mapping collisionMapping[collision.globalIndex()] = eventsTable.lastIndex(); diff --git a/PWGJE/Tasks/jetBackgroundAnalysis.cxx b/PWGJE/Tasks/jetBackgroundAnalysis.cxx index 596bfc14b73..8e93fc305d0 100644 --- a/PWGJE/Tasks/jetBackgroundAnalysis.cxx +++ b/PWGJE/Tasks/jetBackgroundAnalysis.cxx @@ -99,7 +99,7 @@ struct JetBackgroundAnalysisTask { } Filter trackCuts = (aod::jtrack::pt >= trackPtMin && aod::jtrack::pt < trackPtMax && aod::jtrack::eta > trackEtaMin && aod::jtrack::eta < trackEtaMax); - Filter eventCuts = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centrality >= centralityMin && aod::jcollision::centrality < centralityMax); + Filter eventCuts = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centFT0M >= centralityMin && aod::jcollision::centFT0M < centralityMax); template bool trackIsInJet(TTracks const& track, TJets const& jet) @@ -128,7 +128,7 @@ struct JetBackgroundAnalysisTask { } } } - registry.fill(HIST("h2_centrality_rhorandomcone"), collision.centrality(), randomConePt - M_PI * randomConeR * randomConeR * collision.rho()); + registry.fill(HIST("h2_centrality_rhorandomcone"), collision.centFT0M(), randomConePt - M_PI * randomConeR * randomConeR * collision.rho()); // randomised eta,phi for tracks, to assess part of fluctuations coming from statistically independently emitted particles randomConePt = 0; @@ -141,7 +141,7 @@ struct JetBackgroundAnalysisTask { } } } - registry.fill(HIST("h2_centrality_rhorandomconerandomtrackdirection"), collision.centrality(), randomConePt - M_PI * randomConeR * randomConeR * collision.rho()); + registry.fill(HIST("h2_centrality_rhorandomconerandomtrackdirection"), collision.centFT0M(), randomConePt - M_PI * randomConeR * randomConeR * collision.rho()); // removing the leading jet from the random cone if (jets.size() > 0) { // if there are no jets in the acceptance (from the jetfinder cuts) then there can be no leading jet @@ -169,7 +169,7 @@ struct JetBackgroundAnalysisTask { } } } - registry.fill(HIST("h2_centrality_rhorandomconewithoutleadingjet"), collision.centrality(), randomConePt - M_PI * randomConeR * randomConeR * collision.rho()); + registry.fill(HIST("h2_centrality_rhorandomconewithoutleadingjet"), collision.centFT0M(), randomConePt - M_PI * randomConeR * randomConeR * collision.rho()); // randomised eta,phi for tracks, to assess part of fluctuations coming from statistically independently emitted particles, removing tracks from 2 leading jets double randomConePtWithoutOneLeadJet = 0; @@ -190,8 +190,8 @@ struct JetBackgroundAnalysisTask { } } } - registry.fill(HIST("h2_centrality_rhorandomconerandomtrackdirectionwithoutoneleadingjets"), collision.centrality(), randomConePtWithoutOneLeadJet - M_PI * randomConeR * randomConeR * collision.rho()); - registry.fill(HIST("h2_centrality_rhorandomconerandomtrackdirectionwithouttwoleadingjets"), collision.centrality(), randomConePtWithoutTwoLeadJet - M_PI * randomConeR * randomConeR * collision.rho()); + registry.fill(HIST("h2_centrality_rhorandomconerandomtrackdirectionwithoutoneleadingjets"), collision.centFT0M(), randomConePtWithoutOneLeadJet - M_PI * randomConeR * randomConeR * collision.rho()); + registry.fill(HIST("h2_centrality_rhorandomconerandomtrackdirectionwithouttwoleadingjets"), collision.centFT0M(), randomConePtWithoutTwoLeadJet - M_PI * randomConeR * randomConeR * collision.rho()); } void processRho(soa::Filtered>::iterator const& collision, soa::Filtered const& tracks) @@ -208,11 +208,11 @@ struct JetBackgroundAnalysisTask { nTracks++; } } - registry.fill(HIST("h2_centrality_ntracks"), collision.centrality(), nTracks); + registry.fill(HIST("h2_centrality_ntracks"), collision.centFT0M(), nTracks); registry.fill(HIST("h2_ntracks_rho"), nTracks, collision.rho()); registry.fill(HIST("h2_ntracks_rhom"), nTracks, collision.rhoM()); - registry.fill(HIST("h2_centrality_rho"), collision.centrality(), collision.rho()); - registry.fill(HIST("h2_centrality_rhom"), collision.centrality(), collision.rhoM()); + registry.fill(HIST("h2_centrality_rho"), collision.centFT0M(), collision.rho()); + registry.fill(HIST("h2_centrality_rhom"), collision.centFT0M(), collision.rhoM()); } PROCESS_SWITCH(JetBackgroundAnalysisTask, processRho, "QA for rho-area subtracted jets", false); diff --git a/PWGJE/Tasks/jetChargedV2.cxx b/PWGJE/Tasks/jetChargedV2.cxx index e5199048f49..4c5cd82ed25 100644 --- a/PWGJE/Tasks/jetChargedV2.cxx +++ b/PWGJE/Tasks/jetChargedV2.cxx @@ -403,7 +403,7 @@ struct JetChargedV2 { registry.add("h2_track_eta_track_phi", "track eta vs. track phi; #eta; #phi; counts", {HistType::kTH2F, {trackEtaAxis, phiAxis}}); } Filter trackCuts = (aod::jtrack::pt >= trackPtMin && aod::jtrack::pt < trackPtMax && aod::jtrack::eta > trackEtaMin && aod::jtrack::eta < trackEtaMax); - Filter eventCuts = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centrality >= centralityMin && aod::jcollision::centrality < centralityMax); + Filter eventCuts = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centFT0M >= centralityMin && aod::jcollision::centFT0M < centralityMax); Preslice tracksPerJCollision = o2::aod::jtrack::collisionId; Preslice mcdjetsPerJCollision = o2::aod::jet::collisionId; PresliceUnsorted> collisionsPerMCPCollision = aod::jmccollisionlb::mcCollisionId; @@ -584,9 +584,9 @@ struct JetChargedV2 { registry.fill(HIST("h_mcp_fitparaRho_evtnum"), evtnum, temppara[0]); registry.fill(HIST("h_mcp_fitparaPsi2_evtnum"), evtnum, temppara[2]); registry.fill(HIST("h_mcp_fitparaPsi3_evtnum"), evtnum, temppara[4]); - registry.fill(HIST("h_mcp_v2obs_centrality"), collision.centrality(), temppara[1]); - registry.fill(HIST("h_mcp_v3obs_centrality"), collision.centrality(), temppara[3]); - registry.fill(HIST("h_mcp_evtnum_centrlity"), evtnum, collision.centrality()); + registry.fill(HIST("h_mcp_v2obs_centrality"), collision.centFT0M(), temppara[1]); + registry.fill(HIST("h_mcp_v3obs_centrality"), collision.centFT0M(), temppara[3]); + registry.fill(HIST("h_mcp_evtnum_centrlity"), evtnum, collision.centFT0M()); for (uint i = 0; i < cfgnMods->size(); i++) { int nmode = cfgnMods->at(i); @@ -606,7 +606,7 @@ struct JetChargedV2 { double integralValue = fFitModulationV2v3P->Integral(jet.phi() - jetRadius, jet.phi() + jetRadius); double rholocal = collision.rho() / (2 * jetRadius * temppara[0]) * integralValue; registry.fill(HIST("h2_mcp_phi_rholocal"), jet.phi() - ep2, rholocal, weight); - registry.fill(HIST("h2_mcp_centrality_rholocal"), collision.centrality(), rholocal, weight); + registry.fill(HIST("h2_mcp_centrality_rholocal"), collision.centFT0M(), rholocal, weight); if (nmode == cfgNmodA) { registry.fill(HIST("h_mcp_jet_pt_rholocal"), jet.pt() - (rholocal * jet.area()), weight); @@ -617,10 +617,10 @@ struct JetChargedV2 { phiMinusPsi2 = jet.phi() - ep2; if ((phiMinusPsi2 < o2::constants::math::PIQuarter) || (phiMinusPsi2 >= evtPlnAngleA * o2::constants::math::PIQuarter) || (phiMinusPsi2 >= evtPlnAngleB * o2::constants::math::PIQuarter && phiMinusPsi2 < evtPlnAngleC * o2::constants::math::PIQuarter)) { registry.fill(HIST("h_mcp_jet_pt_in_plane_v2_rho"), jet.pt() - (rholocal * jet.area()), weight); - registry.fill(HIST("h2_mcp_centrality_jet_pt_in_plane_v2_rho"), collision.centrality(), jet.pt() - (rholocal * jet.area()), weight); + registry.fill(HIST("h2_mcp_centrality_jet_pt_in_plane_v2_rho"), collision.centFT0M(), jet.pt() - (rholocal * jet.area()), weight); } else { registry.fill(HIST("h_mcp_jet_pt_out_of_plane_v2_rho"), jet.pt() - (rholocal * jet.area()), weight); - registry.fill(HIST("h2_mcp_centrality_jet_pt_out_of_plane_v2_rho"), collision.centrality(), jet.pt() - (rholocal * jet.area()), weight); + registry.fill(HIST("h2_mcp_centrality_jet_pt_out_of_plane_v2_rho"), collision.centFT0M(), jet.pt() - (rholocal * jet.area()), weight); } } else if (nmode == cfgNmodB) { double phiMinusPsi3; @@ -632,10 +632,10 @@ struct JetChargedV2 { if ((phiMinusPsi3 < o2::constants::math::PIQuarter) || (phiMinusPsi3 >= evtPlnAngleA * o2::constants::math::PIQuarter) || (phiMinusPsi3 >= evtPlnAngleB * o2::constants::math::PIQuarter && phiMinusPsi3 < evtPlnAngleC * o2::constants::math::PIQuarter)) { registry.fill(HIST("h_mcp_jet_pt_in_plane_v3_rho"), jet.pt() - (rholocal * jet.area()), weight); - registry.fill(HIST("h2_mcp_centrality_jet_pt_in_plane_v3_rho"), collision.centrality(), jet.pt() - (rholocal * jet.area()), weight); + registry.fill(HIST("h2_mcp_centrality_jet_pt_in_plane_v3_rho"), collision.centFT0M(), jet.pt() - (rholocal * jet.area()), weight); } else { registry.fill(HIST("h_mcp_jet_pt_out_of_plane_v3_rho"), jet.pt() - (rholocal * jet.area()), weight); - registry.fill(HIST("h2_mcp_centrality_jet_pt_out_of_plane_v3_rho"), collision.centrality(), jet.pt() - (rholocal * jet.area()), weight); + registry.fill(HIST("h2_mcp_centrality_jet_pt_out_of_plane_v3_rho"), collision.centFT0M(), jet.pt() - (rholocal * jet.area()), weight); } } } @@ -663,7 +663,7 @@ struct JetChargedV2 { } } } - registry.fill(HIST("h3_mcp_centrality_deltapT_RandomCornPhi_localrhovsphi"), collision.centrality(), randomConePt - o2::constants::math::PI * randomConeR * randomConeR * rholocalRC, rcPhiPsi2, weight); + registry.fill(HIST("h3_mcp_centrality_deltapT_RandomCornPhi_localrhovsphi"), collision.centFT0M(), randomConePt - o2::constants::math::PI * randomConeR * randomConeR * rholocalRC, rcPhiPsi2, weight); // removing the leading jet from the random cone if (jets.size() > 0) { // if there are no jets in the acceptance (from the jetfinder cuts) then there can be no leading jet @@ -691,8 +691,8 @@ struct JetChargedV2 { } } } - registry.fill(HIST("h3_mcp_centrality_deltapT_RandomCornPhi_localrhovsphiwithoutleadingjet"), collision.centrality(), randomConePt - o2::constants::math::PI * randomConeR * randomConeR * rholocalRC, rcPhiPsi2, weight); - registry.fill(HIST("h3_mcp_centrality_deltapT_RandomCornPhi_rhorandomconewithoutleadingjet"), collision.centrality(), randomConePt - o2::constants::math::PI * randomConeR * randomConeR * collision.rho(), rcPhiPsi2, weight); + registry.fill(HIST("h3_mcp_centrality_deltapT_RandomCornPhi_localrhovsphiwithoutleadingjet"), collision.centFT0M(), randomConePt - o2::constants::math::PI * randomConeR * randomConeR * rholocalRC, rcPhiPsi2, weight); + registry.fill(HIST("h3_mcp_centrality_deltapT_RandomCornPhi_rhorandomconewithoutleadingjet"), collision.centFT0M(), randomConePt - o2::constants::math::PI * randomConeR * randomConeR * collision.rho(), rcPhiPsi2, weight); } else if (nmode == cfgNmodB) { continue; } @@ -855,10 +855,10 @@ struct JetChargedV2 { phiMinusPsi2 = jet.phi() - ep2; if ((phiMinusPsi2 < o2::constants::math::PIQuarter) || (phiMinusPsi2 >= evtPlnAngleA * o2::constants::math::PIQuarter) || (phiMinusPsi2 >= evtPlnAngleB * o2::constants::math::PIQuarter && phiMinusPsi2 < evtPlnAngleC * o2::constants::math::PIQuarter)) { registry.fill(HIST("h_jet_pt_in_plane_v2"), jet.pt() - (collision.rho() * jet.area()), 1.0); - registry.fill(HIST("h2_centrality_jet_pt_in_plane_v2"), collision.centrality(), jet.pt() - (collision.rho() * jet.area()), 1.0); + registry.fill(HIST("h2_centrality_jet_pt_in_plane_v2"), collision.centFT0M(), jet.pt() - (collision.rho() * jet.area()), 1.0); } else { registry.fill(HIST("h_jet_pt_out_of_plane_v2"), jet.pt() - (collision.rho() * jet.area()), 1.0); - registry.fill(HIST("h2_centrality_jet_pt_out_of_plane_v2"), collision.centrality(), jet.pt() - (collision.rho() * jet.area()), 1.0); + registry.fill(HIST("h2_centrality_jet_pt_out_of_plane_v2"), collision.centFT0M(), jet.pt() - (collision.rho() * jet.area()), 1.0); } } } else if (nmode == cfgNmodB) { @@ -969,10 +969,10 @@ struct JetChargedV2 { phiMinusPsi2 = jet.phi() - ep2; if ((phiMinusPsi2 < o2::constants::math::PIQuarter) || (phiMinusPsi2 >= evtPlnAngleA * o2::constants::math::PIQuarter) || (phiMinusPsi2 >= evtPlnAngleB * o2::constants::math::PIQuarter && phiMinusPsi2 < evtPlnAngleC * o2::constants::math::PIQuarter)) { registry.fill(HIST("h_jet_pt_in_plane_v2"), jet.pt() - (collision.rho() * jet.area()), 1.0); - registry.fill(HIST("h2_centrality_jet_pt_in_plane_v2"), collision.centrality(), jet.pt() - (collision.rho() * jet.area()), 1.0); + registry.fill(HIST("h2_centrality_jet_pt_in_plane_v2"), collision.centFT0M(), jet.pt() - (collision.rho() * jet.area()), 1.0); } else { registry.fill(HIST("h_jet_pt_out_of_plane_v2"), jet.pt() - (collision.rho() * jet.area()), 1.0); - registry.fill(HIST("h2_centrality_jet_pt_out_of_plane_v2"), collision.centrality(), jet.pt() - (collision.rho() * jet.area()), 1.0); + registry.fill(HIST("h2_centrality_jet_pt_out_of_plane_v2"), collision.centFT0M(), jet.pt() - (collision.rho() * jet.area()), 1.0); } } } else if (nmode == cfgNmodB) { @@ -1085,9 +1085,9 @@ struct JetChargedV2 { registry.fill(HIST("h_fitparaRho_evtnum"), evtnum, temppara[0]); registry.fill(HIST("h_fitparaPsi2_evtnum"), evtnum, temppara[2]); registry.fill(HIST("h_fitparaPsi3_evtnum"), evtnum, temppara[4]); - registry.fill(HIST("h_v2obs_centrality"), collision.centrality(), temppara[1]); - registry.fill(HIST("h_v3obs_centrality"), collision.centrality(), temppara[3]); - registry.fill(HIST("h_evtnum_centrlity"), evtnum, collision.centrality()); + registry.fill(HIST("h_v2obs_centrality"), collision.centFT0M(), temppara[1]); + registry.fill(HIST("h_v3obs_centrality"), collision.centFT0M(), temppara[3]); + registry.fill(HIST("h_evtnum_centrlity"), evtnum, collision.centFT0M()); if (temppara[0] == 0) { return; @@ -1115,11 +1115,11 @@ struct JetChargedV2 { int evtCentAreaMax = 5; int evtMidAreaMin = 30; int evtMidAreaMax = 50; - double evtcent = collision.centrality(); + double evtcent = collision.centFT0M(); if (cfgChkFitQuality) { registry.fill(HIST("h_PvalueCDF_CombinFit"), cDF); - registry.fill(HIST("h2_PvalueCDFCent_CombinFit"), collision.centrality(), cDF); - registry.fill(HIST("h2_Chi2Cent_CombinFit"), collision.centrality(), chiSqr / (static_cast(nDF))); + registry.fill(HIST("h2_PvalueCDFCent_CombinFit"), collision.centFT0M(), cDF); + registry.fill(HIST("h2_Chi2Cent_CombinFit"), collision.centFT0M(), chiSqr / (static_cast(nDF))); registry.fill(HIST("h2_PChi2_CombinFit"), cDF, chiSqr / (static_cast(nDF))); if (evtcent >= evtCentAreaMin && evtcent <= evtCentAreaMax) { registry.fill(HIST("h2_PChi2_CombinFitA"), cDF, chiSqr / (static_cast(nDF))); @@ -1152,7 +1152,7 @@ struct JetChargedV2 { double integralValue = fFitModulationV2v3->Integral(jet.phi() - jetRadius, jet.phi() + jetRadius); double rholocal = collision.rho() / (2 * jetRadius * temppara[0]) * integralValue; - registry.fill(HIST("h2_rholocal_cent"), collision.centrality(), rholocal, 1.0); + registry.fill(HIST("h2_rholocal_cent"), collision.centFT0M(), rholocal, 1.0); if (nmode == cfgNmodA) { double phiMinusPsi2; @@ -1166,10 +1166,10 @@ struct JetChargedV2 { if ((phiMinusPsi2 < o2::constants::math::PIQuarter) || (phiMinusPsi2 >= evtPlnAngleA * o2::constants::math::PIQuarter) || (phiMinusPsi2 >= evtPlnAngleB * o2::constants::math::PIQuarter && phiMinusPsi2 < evtPlnAngleC * o2::constants::math::PIQuarter)) { registry.fill(HIST("h_jet_pt_in_plane_v2_rho"), jet.pt() - (rholocal * jet.area()), 1.0); - registry.fill(HIST("h2_centrality_jet_pt_in_plane_v2_rho"), collision.centrality(), jet.pt() - (rholocal * jet.area()), 1.0); + registry.fill(HIST("h2_centrality_jet_pt_in_plane_v2_rho"), collision.centFT0M(), jet.pt() - (rholocal * jet.area()), 1.0); } else { registry.fill(HIST("h_jet_pt_out_of_plane_v2_rho"), jet.pt() - (rholocal * jet.area()), 1.0); - registry.fill(HIST("h2_centrality_jet_pt_out_of_plane_v2_rho"), collision.centrality(), jet.pt() - (rholocal * jet.area()), 1.0); + registry.fill(HIST("h2_centrality_jet_pt_out_of_plane_v2_rho"), collision.centFT0M(), jet.pt() - (rholocal * jet.area()), 1.0); } } else if (nmode == cfgNmodB) { double phiMinusPsi3; @@ -1210,7 +1210,7 @@ struct JetChargedV2 { } } } - registry.fill(HIST("h3_centrality_deltapT_RandomCornPhi_localrhovsphi"), collision.centrality(), randomConePt - o2::constants::math::PI * randomConeR * randomConeR * rholocalRC, rcPhiPsi2, 1.0); + registry.fill(HIST("h3_centrality_deltapT_RandomCornPhi_localrhovsphi"), collision.centFT0M(), randomConePt - o2::constants::math::PI * randomConeR * randomConeR * rholocalRC, rcPhiPsi2, 1.0); // removing the leading jet from the random cone if (jets.size() > 0) { // if there are no jets in the acceptance (from the jetfinder cuts) then there can be no leading jet @@ -1238,8 +1238,8 @@ struct JetChargedV2 { } } } - registry.fill(HIST("h3_centrality_deltapT_RandomCornPhi_localrhovsphiwithoutleadingjet"), collision.centrality(), randomConePt - o2::constants::math::PI * randomConeR * randomConeR * rholocalRC, rcPhiPsi2, 1.0); - registry.fill(HIST("h3_centrality_deltapT_RandomCornPhi_rhorandomconewithoutleadingjet"), collision.centrality(), randomConePt - o2::constants::math::PI * randomConeR * randomConeR * collision.rho(), rcPhiPsi2, 1.0); + registry.fill(HIST("h3_centrality_deltapT_RandomCornPhi_localrhovsphiwithoutleadingjet"), collision.centFT0M(), randomConePt - o2::constants::math::PI * randomConeR * randomConeR * rholocalRC, rcPhiPsi2, 1.0); + registry.fill(HIST("h3_centrality_deltapT_RandomCornPhi_rhorandomconewithoutleadingjet"), collision.centFT0M(), randomConePt - o2::constants::math::PI * randomConeR * randomConeR * collision.rho(), rcPhiPsi2, 1.0); } else if (nmode == cfgNmodB) { continue; } @@ -1342,9 +1342,9 @@ struct JetChargedV2 { registry.fill(HIST("h_fitparaRho_evtnum"), evtnum, temppara[0]); registry.fill(HIST("h_fitparaPsi2_evtnum"), evtnum, temppara[2]); registry.fill(HIST("h_fitparaPsi3_evtnum"), evtnum, temppara[4]); - registry.fill(HIST("h_v2obs_centrality"), collision.centrality(), temppara[1]); - registry.fill(HIST("h_v3obs_centrality"), collision.centrality(), temppara[3]); - registry.fill(HIST("h_evtnum_centrlity"), evtnum, collision.centrality()); + registry.fill(HIST("h_v2obs_centrality"), collision.centFT0M(), temppara[1]); + registry.fill(HIST("h_v3obs_centrality"), collision.centFT0M(), temppara[3]); + registry.fill(HIST("h_evtnum_centrlity"), evtnum, collision.centFT0M()); if (temppara[0] == 0) { return; @@ -1372,11 +1372,11 @@ struct JetChargedV2 { int evtCentAreaMax = 5; int evtMidAreaMin = 30; int evtMidAreaMax = 50; - double evtcent = collision.centrality(); + double evtcent = collision.centFT0M(); if (cfgChkFitQuality) { registry.fill(HIST("h_PvalueCDF_CombinFit"), cDF); - registry.fill(HIST("h2_PvalueCDFCent_CombinFit"), collision.centrality(), cDF); - registry.fill(HIST("h2_Chi2Cent_CombinFit"), collision.centrality(), chiSqr / (static_cast(nDF))); + registry.fill(HIST("h2_PvalueCDFCent_CombinFit"), collision.centFT0M(), cDF); + registry.fill(HIST("h2_Chi2Cent_CombinFit"), collision.centFT0M(), chiSqr / (static_cast(nDF))); registry.fill(HIST("h2_PChi2_CombinFit"), cDF, chiSqr / (static_cast(nDF))); if (evtcent >= evtCentAreaMin && evtcent <= evtCentAreaMax) { registry.fill(HIST("h2_PChi2_CombinFitA"), cDF, chiSqr / (static_cast(nDF))); @@ -1403,7 +1403,7 @@ struct JetChargedV2 { double integralValue = fFitModulationV2v3->Integral(jet.phi() - jetRadius, jet.phi() + jetRadius); double rholocal = collision.rho() / (2 * jetRadius * temppara[0]) * integralValue; - registry.fill(HIST("h2_rholocal_cent"), collision.centrality(), rholocal, 1.0); + registry.fill(HIST("h2_rholocal_cent"), collision.centFT0M(), rholocal, 1.0); if (nmode == cfgNmodA) { double phiMinusPsi2; @@ -1417,10 +1417,10 @@ struct JetChargedV2 { if ((phiMinusPsi2 < o2::constants::math::PIQuarter) || (phiMinusPsi2 >= evtPlnAngleA * o2::constants::math::PIQuarter) || (phiMinusPsi2 >= evtPlnAngleB * o2::constants::math::PIQuarter && phiMinusPsi2 < evtPlnAngleC * o2::constants::math::PIQuarter)) { registry.fill(HIST("h_jet_pt_in_plane_v2_rho"), jet.pt() - (rholocal * jet.area()), 1.0); - registry.fill(HIST("h2_centrality_jet_pt_in_plane_v2_rho"), collision.centrality(), jet.pt() - (rholocal * jet.area()), 1.0); + registry.fill(HIST("h2_centrality_jet_pt_in_plane_v2_rho"), collision.centFT0M(), jet.pt() - (rholocal * jet.area()), 1.0); } else { registry.fill(HIST("h_jet_pt_out_of_plane_v2_rho"), jet.pt() - (rholocal * jet.area()), 1.0); - registry.fill(HIST("h2_centrality_jet_pt_out_of_plane_v2_rho"), collision.centrality(), jet.pt() - (rholocal * jet.area()), 1.0); + registry.fill(HIST("h2_centrality_jet_pt_out_of_plane_v2_rho"), collision.centFT0M(), jet.pt() - (rholocal * jet.area()), 1.0); } } else if (nmode == cfgNmodB) { double phiMinusPsi3; @@ -1461,7 +1461,7 @@ struct JetChargedV2 { } } } - registry.fill(HIST("h3_centrality_deltapT_RandomCornPhi_localrhovsphi"), collision.centrality(), randomConePt - o2::constants::math::PI * randomConeR * randomConeR * rholocalRC, rcPhiPsi2, 1.0); + registry.fill(HIST("h3_centrality_deltapT_RandomCornPhi_localrhovsphi"), collision.centFT0M(), randomConePt - o2::constants::math::PI * randomConeR * randomConeR * rholocalRC, rcPhiPsi2, 1.0); // removing the leading jet from the random cone if (jets.size() > 0) { // if there are no jets in the acceptance (from the jetfinder cuts) then there can be no leading jet @@ -1489,8 +1489,8 @@ struct JetChargedV2 { } } } - registry.fill(HIST("h3_centrality_deltapT_RandomCornPhi_localrhovsphiwithoutleadingjet"), collision.centrality(), randomConePt - o2::constants::math::PI * randomConeR * randomConeR * rholocalRC, rcPhiPsi2, 1.0); - registry.fill(HIST("h3_centrality_deltapT_RandomCornPhi_rhorandomconewithoutleadingjet"), collision.centrality(), randomConePt - o2::constants::math::PI * randomConeR * randomConeR * collision.rho(), rcPhiPsi2, 1.0); + registry.fill(HIST("h3_centrality_deltapT_RandomCornPhi_localrhovsphiwithoutleadingjet"), collision.centFT0M(), randomConePt - o2::constants::math::PI * randomConeR * randomConeR * rholocalRC, rcPhiPsi2, 1.0); + registry.fill(HIST("h3_centrality_deltapT_RandomCornPhi_rhorandomconewithoutleadingjet"), collision.centFT0M(), randomConePt - o2::constants::math::PI * randomConeR * randomConeR * collision.rho(), rcPhiPsi2, 1.0); } else if (nmode == cfgNmodB) { continue; } @@ -1531,7 +1531,7 @@ struct JetChargedV2 { if (jetderiveddatautilities::selectCollision(collisions.begin(), eventSelectionBits, skipMBGapEvents)) { hasSel8Coll = true; } - if ((centralityMin < collisions.begin().centrality()) && (collisions.begin().centrality() < centralityMax)) { + if ((centralityMin < collisions.begin().centFT0M()) && (collisions.begin().centFT0M() < centralityMax)) { centralityIsGood = true; } if ((trackOccupancyInTimeRangeMin < collisions.begin().trackOccupancyInTimeRange()) && (collisions.begin().trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMax)) { @@ -1542,7 +1542,7 @@ struct JetChargedV2 { if (jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents)) { hasSel8Coll = true; } - if ((centralityMin < collision.centrality()) && (collision.centrality() < centralityMax)) { + if ((centralityMin < collision.centFT0M()) && (collision.centFT0M() < centralityMax)) { centralityIsGood = true; } if ((trackOccupancyInTimeRangeMin < collision.trackOccupancyInTimeRange()) && (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMax)) { @@ -1635,7 +1635,7 @@ struct JetChargedV2 { continue; } registry.fill(HIST("h_mcd_events_matched"), 1.5); - if (collision.centrality() < centralityMin || collision.centrality() > centralityMax) { + if (collision.centFT0M() < centralityMin || collision.centFT0M() > centralityMax) { continue; } registry.fill(HIST("h_mcd_events_matched"), 2.5); diff --git a/PWGJE/Tasks/jetFinderFullQA.cxx b/PWGJE/Tasks/jetFinderFullQA.cxx index 0a95900c39b..85989036f3e 100644 --- a/PWGJE/Tasks/jetFinderFullQA.cxx +++ b/PWGJE/Tasks/jetFinderFullQA.cxx @@ -252,7 +252,7 @@ struct JetFinderFullQATask { using JetTableMCPMatchedWeightedJoined = soa::Join; Filter trackCuts = (aod::jtrack::pt >= trackPtMin && aod::jtrack::pt < trackPtMax && aod::jtrack::eta > trackEtaMin && aod::jtrack::eta < trackEtaMax); - Filter eventCuts = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centrality >= centralityMin && aod::jcollision::centrality < centralityMax); + Filter eventCuts = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centFT0M >= centralityMin && aod::jcollision::centFT0M < centralityMax); aod::EMCALClusterDefinition clusterDefinition = aod::emcalcluster::getClusterDefinitionFromString(clusterDefinitionS.value); Filter clusterFilter = (aod::jcluster::definition == static_cast(clusterDefinition) && aod::jcluster::eta > clusterEtaMin && aod::jcluster::eta < clusterEtaMax && aod::jcluster::phi >= clusterPhiMin && aod::jcluster::phi <= clusterPhiMax && aod::jcluster::energy >= clusterEnergyMin && aod::jcluster::time > clusterTimeMin && aod::jcluster::time < clusterTimeMax && (clusterRejectExotics && aod::jcluster::isExotic != true)); @@ -480,7 +480,7 @@ struct JetFinderFullQATask { if (!isAcceptedJet(jet)) { continue; } - fillHistograms(jet, collision.centrality()); + fillHistograms(jet, collision.centFT0M()); } } PROCESS_SWITCH(JetFinderFullQATask, processJetsData, "jet finder HF QA data", false); @@ -494,7 +494,7 @@ struct JetFinderFullQATask { if (!isAcceptedJet(jet)) { continue; } - fillHistograms(jet, collision.centrality()); + fillHistograms(jet, collision.centFT0M()); } } PROCESS_SWITCH(JetFinderFullQATask, processJetsMCD, "jet finder HF QA mcd", false); @@ -508,7 +508,7 @@ struct JetFinderFullQATask { if (!isAcceptedJet(jet)) { continue; } - fillHistograms(jet, collision.centrality(), jet.eventWeight()); + fillHistograms(jet, collision.centFT0M(), jet.eventWeight()); } } PROCESS_SWITCH(JetFinderFullQATask, processJetsMCDWeighted, "jet finder HF QA mcd on weighted events", false); @@ -594,12 +594,12 @@ struct JetFinderFullQATask { return; } registry.fill(HIST("h_collisions"), 0.5); - registry.fill(HIST("h_centrality_collisions"), collision.centrality(), 0.5); + registry.fill(HIST("h_centrality_collisions"), collision.centFT0M(), 0.5); if (!jetderiveddatautilities::eventEMCAL(collision)) { return; } registry.fill(HIST("h_collisions"), 1.5); - registry.fill(HIST("h_centrality_collisions"), collision.centrality(), 1.5); + registry.fill(HIST("h_centrality_collisions"), collision.centFT0M(), 1.5); fillTrackHistograms(tracks, clusters); } PROCESS_SWITCH(JetFinderFullQATask, processTracks, "QA for charged tracks", false); diff --git a/PWGJE/Tasks/jetFinderHFQA.cxx b/PWGJE/Tasks/jetFinderHFQA.cxx index 6aa912d0828..fee889a62ea 100644 --- a/PWGJE/Tasks/jetFinderHFQA.cxx +++ b/PWGJE/Tasks/jetFinderHFQA.cxx @@ -485,7 +485,7 @@ struct JetFinderHFQATask { using JetTableMCPMatchedWeightedJoined = soa::Join; Filter trackCuts = (aod::jtrack::pt >= trackPtMin && aod::jtrack::pt < trackPtMax && aod::jtrack::eta > trackEtaMin && aod::jtrack::eta < trackEtaMax); - Filter eventCuts = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centrality >= centralityMin && aod::jcollision::centrality < centralityMax); + Filter eventCuts = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centFT0M >= centralityMin && aod::jcollision::centFT0M < centralityMax); // Filter candidateCutsD0 = (aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagD0bar); // Filter candidateCutsLc = (aod::hf_sel_candidate_lc::isSelLcToPKPi >= selectionFlagLcToPKPi || aod::hf_sel_candidate_lc::isSelLcToPiKP >= selectionFlagLcToPiPK); @@ -945,8 +945,8 @@ struct JetFinderHFQATask { if (!jetderiveddatautilities::selectTrack(track, trackSelection)) { continue; } - registry.fill(HIST("h3_centrality_track_pt_track_phi"), collision.centrality(), track.pt(), track.phi(), weight); - registry.fill(HIST("h3_centrality_track_pt_track_eta"), collision.centrality(), track.pt(), track.eta(), weight); + registry.fill(HIST("h3_centrality_track_pt_track_phi"), collision.centFT0M(), track.pt(), track.phi(), weight); + registry.fill(HIST("h3_centrality_track_pt_track_eta"), collision.centFT0M(), track.pt(), track.eta(), weight); registry.fill(HIST("h3_track_pt_track_eta_track_phi"), track.pt(), track.eta(), track.phi(), weight); } } @@ -972,7 +972,7 @@ struct JetFinderHFQATask { } } } - registry.fill(HIST("h2_centrality_rhorandomcone"), collision.centrality(), randomConePt - M_PI * randomConeR * randomConeR * candidate.rho()); + registry.fill(HIST("h2_centrality_rhorandomcone"), collision.centFT0M(), randomConePt - M_PI * randomConeR * randomConeR * candidate.rho()); // removing the leading jet from the random cone if (jets.size() > 0) { // if there are no jets in the acceptance (from the jetfinder cuts) then there can be no leading jet @@ -1000,7 +1000,7 @@ struct JetFinderHFQATask { } } } - registry.fill(HIST("h2_centrality_rhorandomconewithoutleadingjet"), collision.centrality(), randomConePt - M_PI * randomConeR * randomConeR * candidate.rho()); + registry.fill(HIST("h2_centrality_rhorandomconewithoutleadingjet"), collision.centFT0M(), randomConePt - M_PI * randomConeR * randomConeR * candidate.rho()); break; // currently only fills it for the first candidate in the event (not pT ordered). Jet is pT ordered so results for excluding leading jet might not be as expected } } @@ -1019,7 +1019,7 @@ struct JetFinderHFQATask { if (!isAcceptedJet(jet)) { continue; } - fillHistograms(jet, collision.centrality()); + fillHistograms(jet, collision.centFT0M()); } } PROCESS_SWITCH(JetFinderHFQATask, processJetsData, "jet finder HF QA data", false); @@ -1037,7 +1037,7 @@ struct JetFinderHFQATask { continue; } auto const candidate = jet.template candidates_first_as>(); - fillRhoAreaSubtractedHistograms(jet, collision.centrality(), candidate.rho()); + fillRhoAreaSubtractedHistograms(jet, collision.centFT0M(), candidate.rho()); } } PROCESS_SWITCH(JetFinderHFQATask, processJetsRhoAreaSubData, "jet finder HF QA for rho-area subtracted jets", false); @@ -1055,7 +1055,7 @@ struct JetFinderHFQATask { continue; } auto const candidate = jet.template candidates_first_as>(); - fillRhoAreaSubtractedHistograms(jet, collision.centrality(), candidate.rho()); + fillRhoAreaSubtractedHistograms(jet, collision.centFT0M(), candidate.rho()); } } PROCESS_SWITCH(JetFinderHFQATask, processJetsRhoAreaSubMCD, "jet finder HF QA for rho-area subtracted mcd jets", false); @@ -1069,7 +1069,7 @@ struct JetFinderHFQATask { if (!isAcceptedJet(jet)) { continue; } - fillEventWiseConstituentSubtractedHistograms(jet, collision.centrality()); + fillEventWiseConstituentSubtractedHistograms(jet, collision.centFT0M()); } } PROCESS_SWITCH(JetFinderHFQATask, processEvtWiseConstSubJetsData, "jet finder HF QA for eventwise constituent-subtracted jets data", false); @@ -1100,7 +1100,7 @@ struct JetFinderHFQATask { if (!isAcceptedJet(jet)) { continue; } - fillHistograms(jet, collision.centrality()); + fillHistograms(jet, collision.centFT0M()); } } PROCESS_SWITCH(JetFinderHFQATask, processJetsMCD, "jet finder HF QA mcd", false); @@ -1114,7 +1114,7 @@ struct JetFinderHFQATask { if (!isAcceptedJet(jet)) { continue; } - fillHistograms(jet, collision.centrality(), jet.eventWeight()); + fillHistograms(jet, collision.centFT0M(), jet.eventWeight()); } } PROCESS_SWITCH(JetFinderHFQATask, processJetsMCDWeighted, "jet finder HF QA mcd on weighted events", false); @@ -1482,12 +1482,12 @@ struct JetFinderHFQATask { return; } registry.fill(HIST("h_collisions"), 0.5); - registry.fill(HIST("h2_centrality_collisions"), collision.centrality(), 0.5); + registry.fill(HIST("h2_centrality_collisions"), collision.centFT0M(), 0.5); if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { return; } registry.fill(HIST("h_collisions"), 1.5); - registry.fill(HIST("h2_centrality_collisions"), collision.centrality(), 1.5); + registry.fill(HIST("h2_centrality_collisions"), collision.centFT0M(), 1.5); fillTrackHistograms(collision, tracks); } PROCESS_SWITCH(JetFinderHFQATask, processTracks, "QA for charged tracks", false); @@ -1524,8 +1524,8 @@ struct JetFinderHFQATask { for (auto const& candidate : candidates) { for (auto const& track : jetcandidateutilities::slicedPerCandidate(tracks, candidate, perD0CandidateTracks, perDplusCandidateTracks, perDstarCandidateTracks, perLcCandidateTracks, perB0CandidateTracks, perBplusCandidateTracks, perDielectronCandidateTracks)) { - registry.fill(HIST("h3_centrality_track_pt_track_phi_eventwiseconstituentsubtracted"), collision.centrality(), track.pt(), track.phi()); - registry.fill(HIST("h3_centrality_track_pt_track_eta_eventwiseconstituentsubtracted"), collision.centrality(), track.pt(), track.eta()); + registry.fill(HIST("h3_centrality_track_pt_track_phi_eventwiseconstituentsubtracted"), collision.centFT0M(), track.pt(), track.phi()); + registry.fill(HIST("h3_centrality_track_pt_track_eta_eventwiseconstituentsubtracted"), collision.centFT0M(), track.pt(), track.eta()); registry.fill(HIST("h3_track_pt_track_eta_track_phi_eventwiseconstituentsubtracted"), track.pt(), track.eta(), track.phi()); } break; // currently only fills it for the first candidate in the event (not pT ordered) @@ -1548,11 +1548,11 @@ struct JetFinderHFQATask { nTracks++; } } - registry.fill(HIST("h2_centrality_ntracks"), collision.centrality(), nTracks); + registry.fill(HIST("h2_centrality_ntracks"), collision.centFT0M(), nTracks); registry.fill(HIST("h2_ntracks_rho"), nTracks, candidate.rho()); registry.fill(HIST("h2_ntracks_rhom"), nTracks, candidate.rhoM()); - registry.fill(HIST("h2_centrality_rho"), collision.centrality(), candidate.rho()); - registry.fill(HIST("h2_centrality_rhom"), collision.centrality(), candidate.rhoM()); + registry.fill(HIST("h2_centrality_rho"), collision.centFT0M(), candidate.rho()); + registry.fill(HIST("h2_centrality_rhom"), collision.centFT0M(), candidate.rhoM()); break; // currently only fills it for the first candidate in the event (not pT ordered) } } @@ -1584,7 +1584,7 @@ struct JetFinderHFQATask { registry.fill(HIST("h_candidate_pt"), candidate.pt()); registry.fill(HIST("h_candidate_y"), candidate.y()); } - registry.fill(HIST("h2_centrality_ncandidates"), collision.centrality(), candidates.size()); + registry.fill(HIST("h2_centrality_ncandidates"), collision.centFT0M(), candidates.size()); } PROCESS_SWITCH(JetFinderHFQATask, processCandidates, "HF candidate QA", false); }; diff --git a/PWGJE/Tasks/jetFinderQA.cxx b/PWGJE/Tasks/jetFinderQA.cxx index a054005cef7..4273efd027c 100644 --- a/PWGJE/Tasks/jetFinderQA.cxx +++ b/PWGJE/Tasks/jetFinderQA.cxx @@ -372,7 +372,7 @@ struct JetFinderQATask { } Filter trackCuts = (aod::jtrack::pt >= trackPtMin && aod::jtrack::pt < trackPtMax && aod::jtrack::eta > trackEtaMin && aod::jtrack::eta < trackEtaMax); - Filter eventCuts = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centrality >= centralityMin && aod::jcollision::centrality < centralityMax); + Filter eventCuts = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centFT0M >= centralityMin && aod::jcollision::centFT0M < centralityMax); PresliceUnsorted> CollisionsPerMCPCollision = aod::jmccollisionlb::mcCollisionId; template @@ -678,9 +678,9 @@ struct JetFinderQATask { if (!jetderiveddatautilities::selectTrack(track, trackSelection)) { continue; } - registry.fill(HIST("h3_centrality_track_pt_track_phi"), collision.centrality(), track.pt(), track.phi(), weight); - registry.fill(HIST("h3_centrality_track_pt_track_eta"), collision.centrality(), track.pt(), track.eta(), weight); - registry.fill(HIST("h3_centrality_track_pt_track_dcaxy"), collision.centrality(), track.pt(), track.dcaXY(), weight); + registry.fill(HIST("h3_centrality_track_pt_track_phi"), collision.centFT0M(), track.pt(), track.phi(), weight); + registry.fill(HIST("h3_centrality_track_pt_track_eta"), collision.centFT0M(), track.pt(), track.eta(), weight); + registry.fill(HIST("h3_centrality_track_pt_track_dcaxy"), collision.centFT0M(), track.pt(), track.dcaXY(), weight); registry.fill(HIST("h3_track_pt_track_eta_track_phi"), track.pt(), track.eta(), track.phi(), weight); } } @@ -707,7 +707,7 @@ struct JetFinderQATask { } } } - registry.fill(HIST("h2_centrality_rhorandomcone"), collision.centrality(), randomConePt - M_PI * randomConeR * randomConeR * collision.rho()); + registry.fill(HIST("h2_centrality_rhorandomcone"), collision.centFT0M(), randomConePt - M_PI * randomConeR * randomConeR * collision.rho()); // randomised eta,phi for tracks, to assess part of fluctuations coming from statistically independently emitted particles randomConePt = 0; @@ -720,7 +720,7 @@ struct JetFinderQATask { } } } - registry.fill(HIST("h2_centrality_rhorandomconerandomtrackdirection"), collision.centrality(), randomConePt - M_PI * randomConeR * randomConeR * collision.rho()); + registry.fill(HIST("h2_centrality_rhorandomconerandomtrackdirection"), collision.centFT0M(), randomConePt - M_PI * randomConeR * randomConeR * collision.rho()); // removing the leading jet from the random cone if (jets.size() > 0) { // if there are no jets in the acceptance (from the jetfinder cuts) then there can be no leading jet @@ -749,7 +749,7 @@ struct JetFinderQATask { } } - registry.fill(HIST("h2_centrality_rhorandomconewithoutleadingjet"), collision.centrality(), randomConePt - M_PI * randomConeR * randomConeR * collision.rho()); + registry.fill(HIST("h2_centrality_rhorandomconewithoutleadingjet"), collision.centFT0M(), randomConePt - M_PI * randomConeR * randomConeR * collision.rho()); // randomised eta,phi for tracks, to assess part of fluctuations coming from statistically independently emitted particles, removing tracks from 2 leading jets double randomConePtWithoutOneLeadJet = 0; @@ -768,8 +768,8 @@ struct JetFinderQATask { } } } - registry.fill(HIST("h2_centrality_rhorandomconerandomtrackdirectionwithoutoneleadingjets"), collision.centrality(), randomConePtWithoutOneLeadJet - M_PI * randomConeR * randomConeR * collision.rho()); - registry.fill(HIST("h2_centrality_rhorandomconerandomtrackdirectionwithouttwoleadingjets"), collision.centrality(), randomConePtWithoutTwoLeadJet - M_PI * randomConeR * randomConeR * collision.rho()); + registry.fill(HIST("h2_centrality_rhorandomconerandomtrackdirectionwithoutoneleadingjets"), collision.centFT0M(), randomConePtWithoutOneLeadJet - M_PI * randomConeR * randomConeR * collision.rho()); + registry.fill(HIST("h2_centrality_rhorandomconerandomtrackdirectionwithouttwoleadingjets"), collision.centFT0M(), randomConePtWithoutTwoLeadJet - M_PI * randomConeR * randomConeR * collision.rho()); } void processJetsData(soa::Filtered::iterator const& collision, soa::Join const& jets, aod::JetTracks const&) @@ -784,7 +784,7 @@ struct JetFinderQATask { if (!isAcceptedJet(jet)) { continue; } - fillHistograms(jet, collision.centrality(), collision.trackOccupancyInTimeRange(), collision.hadronicRate()); + fillHistograms(jet, collision.centFT0M(), collision.trackOccupancyInTimeRange(), collision.hadronicRate()); } } PROCESS_SWITCH(JetFinderQATask, processJetsData, "jet finder QA data", false); @@ -803,7 +803,7 @@ struct JetFinderQATask { if (!isAcceptedJet(jet)) { continue; } - fillRhoAreaSubtractedHistograms(jet, collision.centrality(), collision.trackOccupancyInTimeRange(), collision.rho()); + fillRhoAreaSubtractedHistograms(jet, collision.centFT0M(), collision.trackOccupancyInTimeRange(), collision.rho()); } } PROCESS_SWITCH(JetFinderQATask, processJetsRhoAreaSubData, "jet finder QA for rho-area subtracted jets", false); @@ -822,7 +822,7 @@ struct JetFinderQATask { if (!isAcceptedJet(jet)) { continue; } - fillRhoAreaSubtractedHistograms(jet, collision.centrality(), collision.trackOccupancyInTimeRange(), collision.rho()); + fillRhoAreaSubtractedHistograms(jet, collision.centFT0M(), collision.trackOccupancyInTimeRange(), collision.rho()); } } PROCESS_SWITCH(JetFinderQATask, processJetsRhoAreaSubMCD, "jet finder QA for rho-area subtracted mcd jets", false); @@ -839,7 +839,7 @@ struct JetFinderQATask { if (!isAcceptedJet(jet)) { continue; } - fillEventWiseConstituentSubtractedHistograms(jet, collision.centrality()); + fillEventWiseConstituentSubtractedHistograms(jet, collision.centFT0M()); } } PROCESS_SWITCH(JetFinderQATask, processEvtWiseConstSubJetsData, "jet finder QA for eventwise constituent-subtracted jets data", false); @@ -856,7 +856,7 @@ struct JetFinderQATask { if (!isAcceptedJet(jet)) { continue; } - fillEventWiseConstituentSubtractedHistograms(jet, collision.centrality()); + fillEventWiseConstituentSubtractedHistograms(jet, collision.centFT0M()); } } PROCESS_SWITCH(JetFinderQATask, processEvtWiseConstSubJetsMCD, "jet finder QA for eventwise constituent-subtracted mcd jets", false); @@ -899,7 +899,7 @@ struct JetFinderQATask { if (!isAcceptedJet(jet)) { continue; } - fillHistograms(jet, collision.centrality(), collision.trackOccupancyInTimeRange(), collision.hadronicRate()); + fillHistograms(jet, collision.centFT0M(), collision.trackOccupancyInTimeRange(), collision.hadronicRate()); } } PROCESS_SWITCH(JetFinderQATask, processJetsMCD, "jet finder QA mcd", false); @@ -922,7 +922,7 @@ struct JetFinderQATask { registry.fill(HIST("h_jet_ptcut"), jet.pt(), N * 0.25, jet.eventWeight()); } } - fillHistograms(jet, collision.centrality(), collision.trackOccupancyInTimeRange(), collision.hadronicRate(), jet.eventWeight()); + fillHistograms(jet, collision.centFT0M(), collision.trackOccupancyInTimeRange(), collision.hadronicRate(), jet.eventWeight()); } } PROCESS_SWITCH(JetFinderQATask, processJetsMCDWeighted, "jet finder QA mcd with weighted events", false); @@ -1173,17 +1173,17 @@ struct JetFinderQATask { return; } registry.fill(HIST("h_collisions"), 0.5); - registry.fill(HIST("h2_centrality_collisions"), collision.centrality(), 0.5); + registry.fill(HIST("h2_centrality_collisions"), collision.centFT0M(), 0.5); if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { return; } registry.fill(HIST("h_collisions"), 1.5); - registry.fill(HIST("h2_centrality_collisions"), collision.centrality(), 1.5); + registry.fill(HIST("h2_centrality_collisions"), collision.centFT0M(), 1.5); if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { return; } registry.fill(HIST("h_collisions"), 2.5); - registry.fill(HIST("h2_centrality_collisions"), collision.centrality(), 2.5); + registry.fill(HIST("h2_centrality_collisions"), collision.centFT0M(), 2.5); fillTrackHistograms(collision, tracks); } PROCESS_SWITCH(JetFinderQATask, processTracks, "QA for charged tracks", false); @@ -1225,8 +1225,8 @@ struct JetFinderQATask { return; } for (auto const& track : tracks) { - registry.fill(HIST("h3_centrality_track_pt_track_phi_eventwiseconstituentsubtracted"), collision.centrality(), track.pt(), track.phi()); - registry.fill(HIST("h3_centrality_track_pt_track_eta_eventwiseconstituentsubtracted"), collision.centrality(), track.pt(), track.eta()); + registry.fill(HIST("h3_centrality_track_pt_track_phi_eventwiseconstituentsubtracted"), collision.centFT0M(), track.pt(), track.phi()); + registry.fill(HIST("h3_centrality_track_pt_track_eta_eventwiseconstituentsubtracted"), collision.centFT0M(), track.pt(), track.eta()); registry.fill(HIST("h3_track_pt_track_eta_track_phi_eventwiseconstituentsubtracted"), track.pt(), track.eta(), track.phi()); } } @@ -1249,11 +1249,11 @@ struct JetFinderQATask { nTracks++; } } - registry.fill(HIST("h2_centrality_ntracks"), collision.centrality(), nTracks); + registry.fill(HIST("h2_centrality_ntracks"), collision.centFT0M(), nTracks); registry.fill(HIST("h2_ntracks_rho"), nTracks, collision.rho()); registry.fill(HIST("h2_ntracks_rhom"), nTracks, collision.rhoM()); - registry.fill(HIST("h2_centrality_rho"), collision.centrality(), collision.rho()); - registry.fill(HIST("h2_centrality_rhom"), collision.centrality(), collision.rhoM()); + registry.fill(HIST("h2_centrality_rho"), collision.centFT0M(), collision.rho()); + registry.fill(HIST("h2_centrality_rhom"), collision.centFT0M(), collision.rhoM()); } PROCESS_SWITCH(JetFinderQATask, processRho, "QA for rho-area subtracted jets", false); diff --git a/PWGJE/Tasks/jetFinderV0QA.cxx b/PWGJE/Tasks/jetFinderV0QA.cxx index a62e7f6b1cf..a80ee0eea25 100644 --- a/PWGJE/Tasks/jetFinderV0QA.cxx +++ b/PWGJE/Tasks/jetFinderV0QA.cxx @@ -159,7 +159,7 @@ struct JetFinderV0QATask { using JetTableMCPMatchedWeightedJoined = soa::Join; Filter trackCuts = (aod::jtrack::pt >= trackPtMin && aod::jtrack::pt < trackPtMax && aod::jtrack::eta > trackEtaMin && aod::jtrack::eta < trackEtaMax); - Filter eventCuts = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centrality >= centralityMin && aod::jcollision::centrality < centralityMax); + Filter eventCuts = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centFT0M >= centralityMin && aod::jcollision::centFT0M < centralityMax); template bool isAcceptedJet(V const& jet) @@ -292,10 +292,10 @@ struct JetFinderV0QATask { if (!jetderiveddatautilities::selectTrack(track, trackSelection)) { continue; } - registry.fill(HIST("h2_centrality_track_pt"), collision.centrality(), track.pt(), weight); - registry.fill(HIST("h2_centrality_track_eta"), collision.centrality(), track.eta(), weight); - registry.fill(HIST("h2_centrality_track_phi"), collision.centrality(), track.phi(), weight); - registry.fill(HIST("h2_centrality_track_energy"), collision.centrality(), track.energy(), weight); + registry.fill(HIST("h2_centrality_track_pt"), collision.centFT0M(), track.pt(), weight); + registry.fill(HIST("h2_centrality_track_eta"), collision.centFT0M(), track.eta(), weight); + registry.fill(HIST("h2_centrality_track_phi"), collision.centFT0M(), track.phi(), weight); + registry.fill(HIST("h2_centrality_track_energy"), collision.centFT0M(), track.energy(), weight); } } @@ -313,7 +313,7 @@ struct JetFinderV0QATask { if (!isAcceptedJet(jet)) { continue; } - fillHistograms(jet, collision.centrality()); + fillHistograms(jet, collision.centFT0M()); } } PROCESS_SWITCH(JetFinderV0QATask, processJetsData, "jet finder HF QA data", false); @@ -327,7 +327,7 @@ struct JetFinderV0QATask { if (!isAcceptedJet(jet)) { continue; } - fillHistograms(jet, collision.centrality()); + fillHistograms(jet, collision.centFT0M()); } } PROCESS_SWITCH(JetFinderV0QATask, processJetsMCD, "jet finder HF QA mcd", false); @@ -341,7 +341,7 @@ struct JetFinderV0QATask { if (!isAcceptedJet(jet)) { continue; } - fillHistograms(jet, collision.centrality(), jet.eventWeight()); + fillHistograms(jet, collision.centFT0M(), jet.eventWeight()); } } PROCESS_SWITCH(JetFinderV0QATask, processJetsMCDWeighted, "jet finder HF QA mcd on weighted events", false); @@ -380,12 +380,12 @@ struct JetFinderV0QATask { soa::Filtered const& tracks) { registry.fill(HIST("h_collisions"), 0.5); - registry.fill(HIST("h2_centrality_collisions"), collision.centrality(), 0.5); + registry.fill(HIST("h2_centrality_collisions"), collision.centFT0M(), 0.5); if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { return; } registry.fill(HIST("h_collisions"), 1.5); - registry.fill(HIST("h2_centrality_collisions"), collision.centrality(), 1.5); + registry.fill(HIST("h2_centrality_collisions"), collision.centFT0M(), 1.5); fillTrackHistograms(collision, tracks); } PROCESS_SWITCH(JetFinderV0QATask, processTracks, "QA for charged tracks", false); @@ -416,7 +416,7 @@ struct JetFinderV0QATask { registry.fill(HIST("h_candidate_pt"), candidate.pt()); registry.fill(HIST("h_candidate_y"), candidate.y()); } - registry.fill(HIST("h2_centrality_ncandidates"), collision.centrality(), candidates.size()); + registry.fill(HIST("h2_centrality_ncandidates"), collision.centFT0M(), candidates.size()); } PROCESS_SWITCH(JetFinderV0QATask, processCandidates, "HF candidate QA", false); }; diff --git a/PWGJE/Tasks/jetHadronRecoil.cxx b/PWGJE/Tasks/jetHadronRecoil.cxx index 9f461565c74..211e7c1f7ed 100644 --- a/PWGJE/Tasks/jetHadronRecoil.cxx +++ b/PWGJE/Tasks/jetHadronRecoil.cxx @@ -89,7 +89,7 @@ struct JetHadronRecoil { Filter jetCuts = aod::jet::r == nround(jetR.node() * 100.0f); Filter trackCuts = (aod::jtrack::pt >= trackPtMin && aod::jtrack::pt < trackPtMax && aod::jtrack::eta > trackEtaMin && aod::jtrack::eta < trackEtaMax); Filter particleCuts = (aod::jmcparticle::pt >= trackPtMin && aod::jmcparticle::pt < trackPtMax && aod::jmcparticle::eta > trackEtaMin && aod::jmcparticle::eta < trackEtaMax); - Filter eventCuts = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centrality >= centralityMin && aod::jcollision::centrality < centralityMax); + Filter eventCuts = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centFT0M >= centralityMin && aod::jcollision::centFT0M < centralityMax); std::vector ptBinningPart = {0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 15.0, 20.0, 25.0, 30.0, 35.0, 40.0, 45.0, 50.0, 55.0, 60.0, diff --git a/PWGJE/Tasks/jetPlanarFlow.cxx b/PWGJE/Tasks/jetPlanarFlow.cxx index ec4fc39b870..673d4eebffe 100644 --- a/PWGJE/Tasks/jetPlanarFlow.cxx +++ b/PWGJE/Tasks/jetPlanarFlow.cxx @@ -131,7 +131,7 @@ struct JetPlanarFlowTask { } // jet pT, tau2/tau1, jetdR, track pt, phi', eta', dR, isInJet - Filter collisionFilter = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centrality >= centralityMin && aod::jcollision::centrality < centralityMax); + Filter collisionFilter = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centFT0M >= centralityMin && aod::jcollision::centFT0M < centralityMax); template void fillHistograms(T const& collision, U const& jet, V const& tracks) diff --git a/PWGJE/Tasks/jetShape.cxx b/PWGJE/Tasks/jetShape.cxx index c8fa7866785..3fe14ba6490 100644 --- a/PWGJE/Tasks/jetShape.cxx +++ b/PWGJE/Tasks/jetShape.cxx @@ -187,7 +187,7 @@ struct JetShapeTask { float distance = std::sqrt(deltaEta * deltaEta + deltaPhi1 * deltaPhi1); registry.fill(HIST("ptCorrVsDistance"), distance, ptCorr); - registry.fill(HIST("ptVsCentrality"), collision.centrality(), track.pt()); + registry.fill(HIST("ptVsCentrality"), collision.centFT0M(), track.pt()); // calculate compornents of jetshapefunction rho(r) std::vector trackPtSum(distanceCategory->size() - 1, 0.f); diff --git a/PWGJE/Tasks/jetSpectraCharged.cxx b/PWGJE/Tasks/jetSpectraCharged.cxx index 3bbd6b8196c..70f73484b79 100644 --- a/PWGJE/Tasks/jetSpectraCharged.cxx +++ b/PWGJE/Tasks/jetSpectraCharged.cxx @@ -244,7 +244,7 @@ struct JetSpectraCharged { } Filter trackCuts = (aod::jtrack::pt >= trackPtMin && aod::jtrack::pt < trackPtMax && aod::jtrack::eta > trackEtaMin && aod::jtrack::eta < trackEtaMax); - Filter eventCuts = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centrality >= centralityMin && aod::jcollision::centrality < centralityMax); + Filter eventCuts = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centFT0M >= centralityMin && aod::jcollision::centFT0M < centralityMax); Preslice mcdjetsPerJCollision = o2::aod::jet::collisionId; template @@ -572,7 +572,7 @@ struct JetSpectraCharged { return; } registry.fill(HIST("h_collisions"), 2.5); - registry.fill(HIST("h2_centrality_occupancy"), collision.centrality(), collision.trackOccupancyInTimeRange()); + registry.fill(HIST("h2_centrality_occupancy"), collision.centFT0M(), collision.trackOccupancyInTimeRange()); registry.fill(HIST("h_collisions_Zvertex"), collision.posZ()); } PROCESS_SWITCH(JetSpectraCharged, processCollisions, "collisions Data and MCD", true); @@ -596,7 +596,7 @@ struct JetSpectraCharged { } registry.fill(HIST("h_collisions"), 2.5); registry.fill(HIST("h_collisions_weighted"), 2.5, eventWeight); - registry.fill(HIST("h2_centrality_occupancy"), collision.centrality(), collision.trackOccupancyInTimeRange()); + registry.fill(HIST("h2_centrality_occupancy"), collision.centFT0M(), collision.trackOccupancyInTimeRange()); registry.fill(HIST("h_collisions_Zvertex"), collision.posZ(), eventWeight); } PROCESS_SWITCH(JetSpectraCharged, processCollisionsWeighted, "weighted collsions for MCD", false); @@ -618,7 +618,7 @@ struct JetSpectraCharged { if (!isAcceptedJet(jet)) { continue; } - fillJetHistograms(jet, collision.centrality()); + fillJetHistograms(jet, collision.centFT0M()); } } PROCESS_SWITCH(JetSpectraCharged, processSpectraData, "jet spectra for Data", false); @@ -640,7 +640,7 @@ struct JetSpectraCharged { if (!isAcceptedJet(jet)) { continue; } - fillJetHistograms(jet, collision.centrality()); + fillJetHistograms(jet, collision.centFT0M()); } } PROCESS_SWITCH(JetSpectraCharged, processSpectraMCD, "jet spectra for MCD", false); @@ -662,7 +662,7 @@ struct JetSpectraCharged { if (!isAcceptedJet(jet)) { continue; } - fillJetAreaSubHistograms(jet, collision.centrality(), collision.rho()); + fillJetAreaSubHistograms(jet, collision.centFT0M(), collision.rho()); } } PROCESS_SWITCH(JetSpectraCharged, processSpectraAreaSubData, "jet spectra with rho-area subtraction for Data", false); @@ -684,7 +684,7 @@ struct JetSpectraCharged { if (!isAcceptedJet(jet)) { continue; } - fillJetAreaSubHistograms(jet, collision.centrality(), collision.rho()); + fillJetAreaSubHistograms(jet, collision.centFT0M(), collision.rho()); } } PROCESS_SWITCH(JetSpectraCharged, processSpectraAreaSubMCD, "jet spectra with rho-area subtraction for MCD", false); @@ -713,7 +713,7 @@ struct JetSpectraCharged { } registry.fill(HIST("h_jet_phat"), pTHat); registry.fill(HIST("h_jet_phat_weighted"), pTHat, jetweight); - fillJetHistograms(jet, collision.centrality(), jetweight); + fillJetHistograms(jet, collision.centFT0M(), jetweight); } } PROCESS_SWITCH(JetSpectraCharged, processSpectraMCDWeighted, "jet finder QA mcd with weighted events", false); @@ -746,7 +746,7 @@ struct JetSpectraCharged { if (jetderiveddatautilities::selectCollision(collisions.begin(), eventSelectionBits, skipMBGapEvents)) { hasSel8Coll = true; } - if ((centralityMin < collisions.begin().centrality()) && (collisions.begin().centrality() < centralityMax)) { + if ((centralityMin < collisions.begin().centFT0M()) && (collisions.begin().centFT0M() < centralityMax)) { centralityIsGood = true; } if ((trackOccupancyInTimeRangeMin < collisions.begin().trackOccupancyInTimeRange()) && (collisions.begin().trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMax)) { @@ -757,7 +757,7 @@ struct JetSpectraCharged { if (jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents)) { hasSel8Coll = true; } - if ((centralityMin < collision.centrality()) && (collision.centrality() < centralityMax)) { + if ((centralityMin < collision.centFT0M()) && (collision.centFT0M() < centralityMax)) { centralityIsGood = true; } if ((trackOccupancyInTimeRangeMin < collision.trackOccupancyInTimeRange()) && (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMax)) { @@ -816,7 +816,7 @@ struct JetSpectraCharged { if (jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents)) { hasSel8Coll = true; } - if ((centralityMin < collision.centrality()) && (collision.centrality() < centralityMax)) { + if ((centralityMin < collision.centFT0M()) && (collision.centFT0M() < centralityMax)) { centralityIsGood = true; } if ((trackOccupancyInTimeRangeMin < collision.trackOccupancyInTimeRange()) && (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMax)) { @@ -920,7 +920,7 @@ struct JetSpectraCharged { if (!isAcceptedJet(jet)) { continue; } - fillEventWiseConstituentSubtractedHistograms(jet, collision.centrality()); + fillEventWiseConstituentSubtractedHistograms(jet, collision.centFT0M()); } } PROCESS_SWITCH(JetSpectraCharged, processEvtWiseConstSubJetsData, "jet spectrum for eventwise constituent-subtracted jets data", false); @@ -942,7 +942,7 @@ struct JetSpectraCharged { if (!isAcceptedJet(jet)) { continue; } - fillEventWiseConstituentSubtractedHistograms(jet, collision.centrality()); + fillEventWiseConstituentSubtractedHistograms(jet, collision.centFT0M()); } } PROCESS_SWITCH(JetSpectraCharged, processEvtWiseConstSubJetsMCD, "jet spectrum for eventwise constituent-subtracted mcd jets", false); @@ -1011,7 +1011,7 @@ struct JetSpectraCharged { continue; } registry.fill(HIST("h_mcd_events_matched"), 1.5); - if (collision.centrality() < centralityMin || collision.centrality() > centralityMax) { + if (collision.centFT0M() < centralityMin || collision.centFT0M() > centralityMax) { continue; } registry.fill(HIST("h_mcd_events_matched"), 2.5); diff --git a/PWGJE/Tasks/jetSpectraEseTask.cxx b/PWGJE/Tasks/jetSpectraEseTask.cxx index cc8a84f8f1d..007b2ea511d 100644 --- a/PWGJE/Tasks/jetSpectraEseTask.cxx +++ b/PWGJE/Tasks/jetSpectraEseTask.cxx @@ -311,7 +311,7 @@ struct JetSpectraEseTask { return; registry.fill(HIST("hEventCounter"), counter++); - auto centrality = cfgCentVariant ? collision.centralityVariant1() : collision.centrality(); + auto centrality = cfgCentVariant ? collision.centFT0CVariant1() : collision.centFT0M(); if (cfgSelCentrality && !isCentralitySelected(centrality)) return; registry.fill(HIST("hCentralitySel"), centrality); @@ -394,7 +394,7 @@ struct JetSpectraEseTask { const auto qPerc{collision.qPERCFT0C()}; auto occupancy{collision.trackOccupancyInTimeRange()}; - registry.fill(HIST("hPsiOccupancy"), collision.centrality(), psi.psi2, occupancy); + registry.fill(HIST("hPsiOccupancy"), collision.centFT0M(), psi.psi2, occupancy); registry.fill(HIST("hOccupancy"), occupancy); if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) @@ -405,11 +405,11 @@ struct JetSpectraEseTask { if (!jetderiveddatautilities::selectTrack(track, trackSelection)) continue; - registry.fill(HIST("hTrackPt"), collision.centrality(), track.pt(), qPerc[0], occupancy); + registry.fill(HIST("hTrackPt"), collision.centFT0M(), track.pt(), qPerc[0], occupancy); if (track.pt() < cfgOccupancyPtCut->at(0) || track.pt() > cfgOccupancyPtCut->at(1)) continue; - registry.fill(HIST("hTrackEta"), collision.centrality(), track.eta(), occupancy); - registry.fill(HIST("hTrackPhi"), collision.centrality(), track.phi(), occupancy); + registry.fill(HIST("hTrackEta"), collision.centFT0M(), track.eta(), occupancy); + registry.fill(HIST("hTrackPhi"), collision.centFT0M(), track.phi(), occupancy); } } PROCESS_SWITCH(JetSpectraEseTask, processESEOccupancy, "process occupancy", false); @@ -435,7 +435,7 @@ struct JetSpectraEseTask { bool eventSel = true; for (const auto& col : collisions) { if (cfgisPbPb) - centrality = col.centrality(); + centrality = col.centFT0M(); if (cfgEvSelOccupancy && !isOccupancyAccepted(col)) fOccupancy = false; if (!jetderiveddatautilities::selectCollision(col, eventSelectionBits)) @@ -474,7 +474,7 @@ struct JetSpectraEseTask { return; } - auto centrality = cfgisPbPb ? collision.centrality() : -1; + auto centrality = cfgisPbPb ? collision.centFT0M() : -1; registry.fill(HIST("mcd/hCentralitySel"), centrality); jetLoopMCD(mcdjets, centrality, collision.rho()); @@ -519,7 +519,7 @@ struct JetSpectraEseTask { return; registry.fill(HIST("mcm/hMCDMatchedEventCounter"), secCount++); - auto centrality = cfgisPbPb ? collision.centrality() : -1; + auto centrality = cfgisPbPb ? collision.centFT0M() : -1; if (cfgisPbPb) if (centrality < centRange->at(0) || centrality > centRange->at(1)) registry.fill(HIST("mcm/hMCDMatchedEventCounter"), secCount++); @@ -572,9 +572,9 @@ struct JetSpectraEseTask { { // static constexpr std::string CosList[] = {"hCosPsi2AmC", "hCosPsi2AmB", "hCosPsi2BmC"}; // (registry.fill(HIST(CosList[Idx]), col.centrality(), Corr[Idx], col.qPERCFT0C()[0]), ...); - registry.fill(HIST("hCosPsi2AmC"), col.centrality(), Corr[0], col.qPERCFT0C()[0]); - registry.fill(HIST("hCosPsi2AmB"), col.centrality(), Corr[1], col.qPERCFT0C()[0]); - registry.fill(HIST("hCosPsi2BmC"), col.centrality(), Corr[2], col.qPERCFT0C()[0]); + registry.fill(HIST("hCosPsi2AmC"), col.centFT0M(), Corr[0], col.qPERCFT0C()[0]); + registry.fill(HIST("hCosPsi2AmB"), col.centFT0M(), Corr[1], col.qPERCFT0C()[0]); + registry.fill(HIST("hCosPsi2BmC"), col.centFT0M(), Corr[2], col.qPERCFT0C()[0]); } template @@ -582,11 +582,11 @@ struct JetSpectraEseTask { { // static constexpr std::string_view EpList[] = {"hPsi2FT0A", "hPsi2FV0A", "hPsi2FT0C", "hPsi2TPCpos", "hPsi2TPCneg"}; // (registry.fill(HIST(EpList[Idx]), col.centrality(), epMap.at(std::string(RemovePrefix(EpList[Idx])))), ...); - registry.fill(HIST("hPsi2FT0A"), col.centrality(), epMap.at("FT0A")); - registry.fill(HIST("hPsi2FV0A"), col.centrality(), epMap.at("FV0A")); - registry.fill(HIST("hPsi2FT0C"), col.centrality(), epMap.at("FT0C")); - registry.fill(HIST("hPsi2TPCpos"), col.centrality(), epMap.at("TPCpos")); - registry.fill(HIST("hPsi2TPCneg"), col.centrality(), epMap.at("TPCneg")); + registry.fill(HIST("hPsi2FT0A"), col.centFT0M(), epMap.at("FT0A")); + registry.fill(HIST("hPsi2FV0A"), col.centFT0M(), epMap.at("FV0A")); + registry.fill(HIST("hPsi2FT0C"), col.centFT0M(), epMap.at("FT0C")); + registry.fill(HIST("hPsi2TPCpos"), col.centFT0M(), epMap.at("TPCpos")); + registry.fill(HIST("hPsi2TPCneg"), col.centFT0M(), epMap.at("TPCneg")); } constexpr std::string_view RemovePrefix(std::string_view str) { @@ -623,13 +623,13 @@ struct JetSpectraEseTask { int detInd{detId * 4 + cfgnTotalSystem * 4 * (nmode - 2)}; if constexpr (fill) { if (collision.qvecAmp()[detInd] > 1e-8) { - registry.fill(HIST("hQvecUncorV2"), collision.centrality(), collision.qvecRe()[detInd], collision.qvecIm()[detInd]); - registry.fill(HIST("hQvecRectrV2"), collision.centrality(), collision.qvecRe()[detInd + 1], collision.qvecIm()[detInd + 1]); - registry.fill(HIST("hQvecTwistV2"), collision.centrality(), collision.qvecRe()[detInd + 2], collision.qvecIm()[detInd + 2]); - registry.fill(HIST("hQvecFinalV2"), collision.centrality(), collision.qvecRe()[detInd + 3], collision.qvecIm()[detInd + 3]); - registry.fill(HIST("hEPUncorV2"), collision.centrality(), 0.5 * std::atan2(collision.qvecIm()[detInd], collision.qvecRe()[detInd])); - registry.fill(HIST("hEPRectrV2"), collision.centrality(), 0.5 * std::atan2(collision.qvecIm()[detInd + 1], collision.qvecRe()[detInd + 1])); - registry.fill(HIST("hEPTwistV2"), collision.centrality(), 0.5 * std::atan2(collision.qvecIm()[detInd + 2], collision.qvecRe()[detInd + 2])); + registry.fill(HIST("hQvecUncorV2"), collision.centFT0M(), collision.qvecRe()[detInd], collision.qvecIm()[detInd]); + registry.fill(HIST("hQvecRectrV2"), collision.centFT0M(), collision.qvecRe()[detInd + 1], collision.qvecIm()[detInd + 1]); + registry.fill(HIST("hQvecTwistV2"), collision.centFT0M(), collision.qvecRe()[detInd + 2], collision.qvecIm()[detInd + 2]); + registry.fill(HIST("hQvecFinalV2"), collision.centFT0M(), collision.qvecRe()[detInd + 3], collision.qvecIm()[detInd + 3]); + registry.fill(HIST("hEPUncorV2"), collision.centFT0M(), 0.5 * std::atan2(collision.qvecIm()[detInd], collision.qvecRe()[detInd])); + registry.fill(HIST("hEPRectrV2"), collision.centFT0M(), 0.5 * std::atan2(collision.qvecIm()[detInd + 1], collision.qvecRe()[detInd + 1])); + registry.fill(HIST("hEPTwistV2"), collision.centFT0M(), 0.5 * std::atan2(collision.qvecIm()[detInd + 2], collision.qvecRe()[detInd + 2])); } } std::vector qVec{}; @@ -709,11 +709,11 @@ struct JetSpectraEseTask { hPhiPt->Fit(modulationFit.get(), "Q", "", 0, o2::constants::math::TwoPI); if constexpr (fillHist) { - registry.fill(HIST("hfitPar0"), col.centrality(), modulationFit->GetParameter(0)); - registry.fill(HIST("hfitPar1"), col.centrality(), modulationFit->GetParameter(1)); - registry.fill(HIST("hfitPar2"), col.centrality(), modulationFit->GetParameter(2)); - registry.fill(HIST("hfitPar3"), col.centrality(), modulationFit->GetParameter(3)); - registry.fill(HIST("hfitPar4"), col.centrality(), modulationFit->GetParameter(4)); + registry.fill(HIST("hfitPar0"), col.centFT0M(), modulationFit->GetParameter(0)); + registry.fill(HIST("hfitPar1"), col.centFT0M(), modulationFit->GetParameter(1)); + registry.fill(HIST("hfitPar2"), col.centFT0M(), modulationFit->GetParameter(2)); + registry.fill(HIST("hfitPar3"), col.centFT0M(), modulationFit->GetParameter(3)); + registry.fill(HIST("hfitPar4"), col.centFT0M(), modulationFit->GetParameter(4)); } if (modulationFit->GetParameter(0) <= 0) @@ -735,8 +735,8 @@ struct JetSpectraEseTask { auto cDF = 1. - TMath::Gamma(nDF, chi2); if constexpr (fillHist) { - registry.fill(HIST("hPValueCentCDF"), col.centrality(), cDF); - registry.fill(HIST("hCentChi2Ndf"), col.centrality(), chi2 / (static_cast(nDF))); + registry.fill(HIST("hPValueCentCDF"), col.centFT0M(), cDF); + registry.fill(HIST("hCentChi2Ndf"), col.centFT0M(), chi2 / (static_cast(nDF))); } return modulationFit; @@ -777,7 +777,7 @@ struct JetSpectraEseTask { } } } - registry.fill(HIST("hCentRhoRandomCone"), collision.centrality(), randomConePt - o2::constants::math::PI * randomConeR * randomConeR * collision.rho()); + registry.fill(HIST("hCentRhoRandomCone"), collision.centFT0M(), randomConePt - o2::constants::math::PI * randomConeR * randomConeR * collision.rho()); randomConePt = 0; for (auto const& track : tracks) { @@ -789,7 +789,7 @@ struct JetSpectraEseTask { } } } - registry.fill(HIST("hCentRhoRandomConeRandomTrackDir"), collision.centrality(), randomConePt - o2::constants::math::PI * randomConeR * randomConeR * collision.rho()); + registry.fill(HIST("hCentRhoRandomConeRandomTrackDir"), collision.centFT0M(), randomConePt - o2::constants::math::PI * randomConeR * randomConeR * collision.rho()); if (jets.size() > 0) { float dPhiLeadingJet = RecoDecay::constrainAngle(jets.iteratorAt(0).phi() - randomConePhi, -o2::constants::math::PI); @@ -825,7 +825,7 @@ struct JetSpectraEseTask { rho = evalRho(rhoFit.get(), randomConeR, randomConePhi, rho); } float dPhi{RecoDecay::constrainAngle(randomConePhi - psi.psi2, -o2::constants::math::PI)}; - registry.fill(HIST("hCentRhoRandomConewoLeadingJet"), collision.centrality(), randomConePt - o2::constants::math::PI * randomConeR * randomConeR * rho, dPhi, qPerc[0]); + registry.fill(HIST("hCentRhoRandomConewoLeadingJet"), collision.centFT0M(), randomConePt - o2::constants::math::PI * randomConeR * randomConeR * rho, dPhi, qPerc[0]); double randomConePtWithoutOneLeadJet = 0; double randomConePtWithoutTwoLeadJet = 0; @@ -845,8 +845,8 @@ struct JetSpectraEseTask { } } } - registry.fill(HIST("hCentRhoRandomConeRndTrackDirwoOneLeadingJet"), collision.centrality(), randomConePtWithoutOneLeadJet - o2::constants::math::PI * randomConeR * randomConeR * rho, dPhi, qPerc[0]); - registry.fill(HIST("hCentRhoRandomConeRndTrackDirwoTwoLeadingJet"), collision.centrality(), randomConePtWithoutTwoLeadJet - o2::constants::math::PI * randomConeR * randomConeR * rho, dPhi, qPerc[0]); + registry.fill(HIST("hCentRhoRandomConeRndTrackDirwoOneLeadingJet"), collision.centFT0M(), randomConePtWithoutOneLeadJet - o2::constants::math::PI * randomConeR * randomConeR * rho, dPhi, qPerc[0]); + registry.fill(HIST("hCentRhoRandomConeRndTrackDirwoTwoLeadingJet"), collision.centFT0M(), randomConePtWithoutTwoLeadJet - o2::constants::math::PI * randomConeR * randomConeR * rho, dPhi, qPerc[0]); } template bool isTrackInJet(TTracks const& track, TJets const& jet) diff --git a/PWGJE/Tasks/jetSubstructureHFOutput.cxx b/PWGJE/Tasks/jetSubstructureHFOutput.cxx index d1460d53fc9..ee3aaebc142 100644 --- a/PWGJE/Tasks/jetSubstructureHFOutput.cxx +++ b/PWGJE/Tasks/jetSubstructureHFOutput.cxx @@ -330,7 +330,7 @@ struct JetSubstructureHFOutputTask { float centrality = -1.0; uint8_t eventSel = 0.0; if constexpr (!isMCP) { - centrality = collision.centrality(); + centrality = collision.centFT0M(); eventSel = collision.eventSel(); } collisionOutputTable(collision.posZ(), centrality, eventSel, eventWeight); diff --git a/PWGJE/Tasks/jetSubstructureOutput.cxx b/PWGJE/Tasks/jetSubstructureOutput.cxx index 6a907482a58..39f1e1518cd 100644 --- a/PWGJE/Tasks/jetSubstructureOutput.cxx +++ b/PWGJE/Tasks/jetSubstructureOutput.cxx @@ -220,7 +220,7 @@ struct JetSubstructureOutputTask { float centrality = -1.0; uint8_t eventSel = 0.0; if constexpr (!isMCP) { - centrality = collision.centrality(); + centrality = collision.centFT0M(); eventSel = collision.eventSel(); } collisionOutputTable(collision.posZ(), centrality, eventSel, eventWeight); diff --git a/PWGJE/Tasks/nsubjettiness.cxx b/PWGJE/Tasks/nsubjettiness.cxx index e80219c0f82..133e1e6323b 100644 --- a/PWGJE/Tasks/nsubjettiness.cxx +++ b/PWGJE/Tasks/nsubjettiness.cxx @@ -181,7 +181,7 @@ struct NSubjettinessTask { } Filter jetCuts = aod::jet::r == nround(jetR.node() * 100.0f); - Filter collisionFilter = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centrality >= centralityMin && aod::jcollision::centrality < centralityMax); + Filter collisionFilter = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centFT0M >= centralityMin && aod::jcollision::centFT0M < centralityMax); template void processJet(T const& jet, U const& tracks, float weight = 1.0) diff --git a/PWGJE/Tasks/trackEfficiency.cxx b/PWGJE/Tasks/trackEfficiency.cxx index bb2683b0918..b82a1ee229a 100644 --- a/PWGJE/Tasks/trackEfficiency.cxx +++ b/PWGJE/Tasks/trackEfficiency.cxx @@ -118,15 +118,15 @@ struct TrackEfficiency { continue; } - registry.fill(HIST("h2_centrality_track_pt"), collision.centrality(), track.pt(), weight); - registry.fill(HIST("h2_centrality_track_eta"), collision.centrality(), track.eta(), weight); - registry.fill(HIST("h2_centrality_track_phi"), collision.centrality(), track.phi(), weight); - registry.fill(HIST("h2_centrality_track_energy"), collision.centrality(), track.energy(), weight); + registry.fill(HIST("h2_centrality_track_pt"), collision.centFT0M(), track.pt(), weight); + registry.fill(HIST("h2_centrality_track_eta"), collision.centFT0M(), track.eta(), weight); + registry.fill(HIST("h2_centrality_track_phi"), collision.centFT0M(), track.phi(), weight); + registry.fill(HIST("h2_centrality_track_energy"), collision.centFT0M(), track.energy(), weight); registry.fill(HIST("h2_track_pt_track_sigma1overpt"), track.pt(), track.sigma1Pt(), weight); registry.fill(HIST("h2_track_pt_track_sigmapt"), track.pt(), track.sigma1Pt() * track.pt(), weight); registry.fill(HIST("h2_track_pt_high_track_sigma1overpt"), track.pt(), track.sigma1Pt(), weight); registry.fill(HIST("h2_track_pt_high_track_sigmapt"), track.pt(), track.sigma1Pt() * track.pt(), weight); - registry.fill(HIST("h3_intrate_centrality_track_pt"), collision.hadronicRate(), collision.centrality(), track.pt(), weight); + registry.fill(HIST("h3_intrate_centrality_track_pt"), collision.hadronicRate(), collision.centFT0M(), track.pt(), weight); } } @@ -134,11 +134,11 @@ struct TrackEfficiency { void fillParticlesHistograms(TCollision const& collision, TParticles const& mcparticles, TTracks tracks, float weight = 1.0) { for (auto const& mcparticle : mcparticles) { - registry.fill(HIST("h2_centrality_particle_pt"), collision.centrality(), mcparticle.pt(), weight); - registry.fill(HIST("h2_centrality_particle_eta"), collision.centrality(), mcparticle.eta(), weight); - registry.fill(HIST("h2_centrality_particle_phi"), collision.centrality(), mcparticle.phi(), weight); - registry.fill(HIST("h2_centrality_particle_energy"), collision.centrality(), mcparticle.energy(), weight); - registry.fill(HIST("h3_intrate_centrality_particle_pt"), collision.hadronicRate(), collision.centrality(), mcparticle.pt(), weight); + registry.fill(HIST("h2_centrality_particle_pt"), collision.centFT0M(), mcparticle.pt(), weight); + registry.fill(HIST("h2_centrality_particle_eta"), collision.centFT0M(), mcparticle.eta(), weight); + registry.fill(HIST("h2_centrality_particle_phi"), collision.centFT0M(), mcparticle.phi(), weight); + registry.fill(HIST("h2_centrality_particle_energy"), collision.centFT0M(), mcparticle.energy(), weight); + registry.fill(HIST("h3_intrate_centrality_particle_pt"), collision.hadronicRate(), collision.centFT0M(), mcparticle.pt(), weight); for (auto const& track : tracks) { registry.fill(HIST("h2_particle_pt_track_pt_deltapt"), mcparticle.pt(), mcparticle.pt() - track.pt(), weight); registry.fill(HIST("h2_particle_pt_track_pt_deltaptoverparticlept"), mcparticle.pt(), (mcparticle.pt() - track.pt()) / mcparticle.pt(), weight); @@ -286,7 +286,7 @@ struct TrackEfficiency { // filters for processTracks QA functions only: Filter trackCuts = (aod::jtrack::pt >= trackQAPtMin && aod::jtrack::pt < trackQAPtMax && aod::jtrack::eta > trackQAEtaMin && aod::jtrack::eta < trackQAEtaMax); Filter particleCuts = (aod::jmcparticle::pt >= trackQAPtMin && aod::jmcparticle::pt < trackQAPtMax && aod::jmcparticle::eta > trackQAEtaMin && aod::jmcparticle::eta < trackQAEtaMax); - Filter eventCuts = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centrality >= centralityMin && aod::jcollision::centrality < centralityMax); + Filter eventCuts = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centFT0M >= centralityMin && aod::jcollision::centFT0M < centralityMax); void processEFficiencyPurity(soa::Join::iterator const& mcCollision, soa::Join const&, @@ -324,7 +324,7 @@ struct TrackEfficiency { if (jetderiveddatautilities::selectCollision(collisions.begin(), eventSelectionBits, skipMBGapEvents)) { // Skipping MC events that have not a single selected reconstructed collision ; effect unclear if mcColl is split hasSel8Coll = true; } - if (!checkCentrality || ((centralityMin < collisions.begin().centrality()) && (collisions.begin().centrality() < centralityMax))) { // effect unclear if mcColl is split + if (!checkCentrality || ((centralityMin < collisions.begin().centFT0M()) && (collisions.begin().centFT0M() < centralityMax))) { // effect unclear if mcColl is split centralityCheck = true; } if (!checkOccupancy || ((trackOccupancyInTimeRangeMin < collisions.begin().trackOccupancyInTimeRange()) && (collisions.begin().trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMax))) { // check occupancy only in GP Pb-Pb MC @@ -335,7 +335,7 @@ struct TrackEfficiency { if (jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents)) { // Skipping MC events that have not a single selected reconstructed collision ; effect unclear if mcColl is split hasSel8Coll = true; } - if (!checkCentrality || ((centralityMin < collision.centrality()) && (collision.centrality() < centralityMax))) { // effect unclear if mcColl is split + if (!checkCentrality || ((centralityMin < collision.centFT0M()) && (collision.centFT0M() < centralityMax))) { // effect unclear if mcColl is split centralityCheck = true; } if (!checkOccupancy || ((trackOccupancyInTimeRangeMin < collisions.begin().trackOccupancyInTimeRange()) && (collisions.begin().trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMax))) { // check occupancy only in GP Pb-Pb MC @@ -504,7 +504,7 @@ struct TrackEfficiency { if (jetderiveddatautilities::selectCollision(collisions.begin(), eventSelectionBits, skipMBGapEvents)) { // Skipping MC events that have not a single selected reconstructed collision ; effect unclear if mcColl is split hasSel8Coll = true; } - if (!checkCentrality || ((centralityMin < collisions.begin().centrality()) && (collisions.begin().centrality() < centralityMax))) { // effect unclear if mcColl is split + if (!checkCentrality || ((centralityMin < collisions.begin().centFT0M()) && (collisions.begin().centFT0M() < centralityMax))) { // effect unclear if mcColl is split centralityCheck = true; } } else if (acceptSplitCollisions == SplitOkCheckAnyAssocColl) { // check that at least one of the reconstructed collisions passes the checks @@ -512,7 +512,7 @@ struct TrackEfficiency { if (jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents)) { // Skipping MC events that have not a single selected reconstructed collision ; effect unclear if mcColl is split hasSel8Coll = true; } - if (!checkCentrality || ((centralityMin < collision.centrality()) && (collision.centrality() < centralityMax))) { // effect unclear if mcColl is split + if (!checkCentrality || ((centralityMin < collision.centFT0M()) && (collision.centFT0M() < centralityMax))) { // effect unclear if mcColl is split centralityCheck = true; } } @@ -738,7 +738,7 @@ struct TrackEfficiency { if (jetderiveddatautilities::selectCollision(collisions.begin(), eventSelectionBits, skipMBGapEvents)) { // Skipping MC events that have not a single selected reconstructed collision ; effect unclear if mcColl is split hasSel8Coll = true; } - if (!checkCentrality || ((centralityMin < collisions.begin().centrality()) && (collisions.begin().centrality() < centralityMax))) { // effect unclear if mcColl is split + if (!checkCentrality || ((centralityMin < collisions.begin().centFT0M()) && (collisions.begin().centFT0M() < centralityMax))) { // effect unclear if mcColl is split centralityCheck = true; } } else if (acceptSplitCollisions == SplitOkCheckAnyAssocColl) { // check that at least one of the reconstructed collisions passes the checks @@ -746,7 +746,7 @@ struct TrackEfficiency { if (jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents)) { // Skipping MC events that have not a single selected reconstructed collision ; effect unclear if mcColl is split hasSel8Coll = true; } - if (!checkCentrality || ((centralityMin < collision.centrality()) && (collision.centrality() < centralityMax))) { // effect unclear if mcColl is split + if (!checkCentrality || ((centralityMin < collision.centFT0M()) && (collision.centFT0M() < centralityMax))) { // effect unclear if mcColl is split centralityCheck = true; } } @@ -795,7 +795,7 @@ struct TrackEfficiency { if (jetderiveddatautilities::selectCollision(collisions.begin(), eventSelectionBits, skipMBGapEvents)) { // Skipping MC events that have not a single selected reconstructed collision ; effect unclear if mcColl is split hasSel8Coll = true; } - if (!checkCentrality || ((centralityMin < collisions.begin().centrality()) && (collisions.begin().centrality() < centralityMax))) { // effect unclear if mcColl is split + if (!checkCentrality || ((centralityMin < collisions.begin().centFT0M()) && (collisions.begin().centFT0M() < centralityMax))) { // effect unclear if mcColl is split centralityCheck = true; } } else if (acceptSplitCollisions == SplitOkCheckAnyAssocColl) { // check that at least one of the reconstructed collisions passes the checks @@ -803,7 +803,7 @@ struct TrackEfficiency { if (jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents)) { // Skipping MC events that have not a single selected reconstructed collision ; effect unclear if mcColl is split hasSel8Coll = true; } - if (!checkCentrality || ((centralityMin < collision.centrality()) && (collision.centrality() < centralityMax))) { // effect unclear if mcColl is split + if (!checkCentrality || ((centralityMin < collision.centFT0M()) && (collision.centFT0M() < centralityMax))) { // effect unclear if mcColl is split centralityCheck = true; } } @@ -822,17 +822,17 @@ struct TrackEfficiency { void processCollisionsFromData(soa::Filtered::iterator const& collision) { registry.fill(HIST("h_collisions"), 0.5); - registry.fill(HIST("h2_centrality_collisions"), collision.centrality(), 0.5); + registry.fill(HIST("h2_centrality_collisions"), collision.centFT0M(), 0.5); if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents)) { return; } registry.fill(HIST("h_collisions"), 1.5); - registry.fill(HIST("h2_centrality_collisions"), collision.centrality(), 1.5); + registry.fill(HIST("h2_centrality_collisions"), collision.centFT0M(), 1.5); if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { return; } registry.fill(HIST("h_collisions"), 2.5); - registry.fill(HIST("h2_centrality_collisions"), collision.centrality(), 2.5); + registry.fill(HIST("h2_centrality_collisions"), collision.centFT0M(), 2.5); } PROCESS_SWITCH(TrackEfficiency, processCollisionsFromData, "QA for reconstructed collisions in data", false); @@ -845,24 +845,24 @@ struct TrackEfficiency { return; } registry.fill(HIST("h_collisions"), 0.5); - registry.fill(HIST("h2_centrality_collisions"), collision.centrality(), 0.5); + registry.fill(HIST("h2_centrality_collisions"), collision.centFT0M(), 0.5); if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents)) { return; } registry.fill(HIST("h_collisions"), 1.5); - registry.fill(HIST("h2_centrality_collisions"), collision.centrality(), 1.5); + registry.fill(HIST("h2_centrality_collisions"), collision.centFT0M(), 1.5); if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { return; } registry.fill(HIST("h_collisions"), 2.5); - registry.fill(HIST("h2_centrality_collisions"), collision.centrality(), 2.5); + registry.fill(HIST("h2_centrality_collisions"), collision.centFT0M(), 2.5); float pTHat = getPtHatFromHepMCXSection ? collision.mcCollision_as>().mcCollision_as>().ptHard() : 10. / (std::pow(collision.mcCollision().weight(), 1.0 / pTHatExponent)); if (pTHat < ptHatMin || pTHat > ptHatMax) { // only allows mcCollisions with weight in between min and max return; } registry.fill(HIST("h_collisions"), 3.5); - registry.fill(HIST("h2_centrality_collisions"), collision.centrality(), 3.5); + registry.fill(HIST("h2_centrality_collisions"), collision.centFT0M(), 3.5); } PROCESS_SWITCH(TrackEfficiency, processCollisionsFromMc, "QA for reconstructed collisions in MC without weights", false); @@ -893,7 +893,7 @@ struct TrackEfficiency { return; } registry.fill(HIST("h_collisions"), 3.5); - registry.fill(HIST("h2_centrality_collisions"), collision.centrality(), 3.5, eventWeight); + registry.fill(HIST("h2_centrality_collisions"), collision.centFT0M(), 3.5, eventWeight); } PROCESS_SWITCH(TrackEfficiency, processCollisionsFromMcWeighted, "QA for reconstructed collisions in weighted MC", false); @@ -906,7 +906,7 @@ struct TrackEfficiency { registry.fill(HIST("h2_mccollision_pthardfromweight_pthardfromhepmcxsection"), 10. / (std::pow(eventWeight, 1.0 / pTHatExponent)), mcCollision.mcCollision_as>().ptHard()); registry.fill(HIST("h_mccollisions"), 0.5); - registry.fill(HIST("h2_centrality_mccollisions"), collisions.begin().centrality(), 0.5); + registry.fill(HIST("h2_centrality_mccollisions"), collisions.begin().centFT0M(), 0.5); if (!(std::abs(mcCollision.posZ()) < vertexZCut)) { return; @@ -922,7 +922,7 @@ struct TrackEfficiency { return; } registry.fill(HIST("h_mccollisions"), 1.5); - registry.fill(HIST("h2_centrality_mccollisions"), collisions.begin().centrality(), 1.5); + registry.fill(HIST("h2_centrality_mccollisions"), collisions.begin().centFT0M(), 1.5); bool hasSel8Coll = false; bool centralityCheck = false; @@ -930,7 +930,7 @@ struct TrackEfficiency { if (jetderiveddatautilities::selectCollision(collisions.begin(), eventSelectionBits, skipMBGapEvents)) { // Skipping MC events that have not a single selected reconstructed collision ; effect unclear if mcColl is split hasSel8Coll = true; } - if (!checkCentrality || ((centralityMin < collisions.begin().centrality()) && (collisions.begin().centrality() < centralityMax))) { // effect unclear if mcColl is split + if (!checkCentrality || ((centralityMin < collisions.begin().centFT0M()) && (collisions.begin().centFT0M() < centralityMax))) { // effect unclear if mcColl is split centralityCheck = true; } } else if (acceptSplitCollisions == SplitOkCheckAnyAssocColl) { // check that at least one of the reconstructed collisions passes the checks @@ -938,7 +938,7 @@ struct TrackEfficiency { if (jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents)) { // Skipping MC events that have not a single selected reconstructed collision ; effect unclear if mcColl is split hasSel8Coll = true; } - if (!checkCentrality || ((centralityMin < collision.centrality()) && (collision.centrality() < centralityMax))) { // effect unclear if mcColl is split + if (!checkCentrality || ((centralityMin < collision.centFT0M()) && (collision.centFT0M() < centralityMax))) { // effect unclear if mcColl is split centralityCheck = true; } } @@ -950,7 +950,7 @@ struct TrackEfficiency { return; } registry.fill(HIST("h_mccollisions"), 2.5); - registry.fill(HIST("h2_centrality_mccollisions"), collisions.begin().centrality(), 2.5); + registry.fill(HIST("h2_centrality_mccollisions"), collisions.begin().centFT0M(), 2.5); } PROCESS_SWITCH(TrackEfficiency, processMcCollisions, "QA for McCollisions in MC without weights", false); @@ -992,7 +992,7 @@ struct TrackEfficiency { if (jetderiveddatautilities::selectCollision(collisions.begin(), eventSelectionBits, skipMBGapEvents)) { // Skipping MC events that have not a single selected reconstructed collision ; effect unclear if mcColl is split hasSel8Coll = true; } - if (!checkCentrality || ((centralityMin < collisions.begin().centrality()) && (collisions.begin().centrality() < centralityMax))) { // effect unclear if mcColl is split + if (!checkCentrality || ((centralityMin < collisions.begin().centFT0M()) && (collisions.begin().centFT0M() < centralityMax))) { // effect unclear if mcColl is split centralityCheck = true; } } else if (acceptSplitCollisions == SplitOkCheckAnyAssocColl) { // check that at least one of the reconstructed collisions passes the checks @@ -1000,7 +1000,7 @@ struct TrackEfficiency { if (jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents)) { // Skipping MC events that have not a single selected reconstructed collision ; effect unclear if mcColl is split hasSel8Coll = true; } - if (!checkCentrality || ((centralityMin < collision.centrality()) && (collision.centrality() < centralityMax))) { // effect unclear if mcColl is split + if (!checkCentrality || ((centralityMin < collision.centFT0M()) && (collision.centFT0M() < centralityMax))) { // effect unclear if mcColl is split centralityCheck = true; } } From bed48e0782e05f8da611b6c79749c76d6164c815 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Wed, 23 Jul 2025 14:24:26 +0200 Subject: [PATCH 018/345] [PWGLF] Optimization: skip V0s not satisfying configuration earlier (#12196) --- PWGLF/TableProducer/Strangeness/strangenessbuilder.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGLF/TableProducer/Strangeness/strangenessbuilder.cxx b/PWGLF/TableProducer/Strangeness/strangenessbuilder.cxx index 800b1105732..0cf07e8de4d 100644 --- a/PWGLF/TableProducer/Strangeness/strangenessbuilder.cxx +++ b/PWGLF/TableProducer/Strangeness/strangenessbuilder.cxx @@ -1425,7 +1425,7 @@ struct StrangenessBuilder { } } - if (!straHelper.buildV0Candidate(v0.collisionId, pvX, pvY, pvZ, posTrack, negTrack, posTrackPar, negTrackPar, v0.isCollinearV0, mEnabledTables[kV0Covs], true)) { + if (!straHelper.buildV0Candidate(v0.collisionId, pvX, pvY, pvZ, posTrack, negTrack, posTrackPar, negTrackPar, v0.isCollinearV0, mEnabledTables[kV0Covs], v0BuilderOpts.generatePhotonCandidates)) { products.v0dataLink(-1, -1); continue; } From 7a9d1b012b7d802e9ee1dbd63208572311bf2208 Mon Sep 17 00:00:00 2001 From: Sandeep Dudi <69388148+sdudi123@users.noreply.github.com> Date: Wed, 23 Jul 2025 14:45:49 +0200 Subject: [PATCH 019/345] [PWGUD] RCT flag added (#12194) Co-authored-by: sandeep dudi --- PWGUD/Tasks/sginclusivePhiKstarSD.cxx | 162 ++++++++++++++++++++++---- 1 file changed, 138 insertions(+), 24 deletions(-) diff --git a/PWGUD/Tasks/sginclusivePhiKstarSD.cxx b/PWGUD/Tasks/sginclusivePhiKstarSD.cxx index 628818bd553..dad2b4d7a7d 100644 --- a/PWGUD/Tasks/sginclusivePhiKstarSD.cxx +++ b/PWGUD/Tasks/sginclusivePhiKstarSD.cxx @@ -51,6 +51,7 @@ struct SginclusivePhiKstarSD { HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + Configurable cutRCTflag{"cutRCTflag", 0, {"0 = off, 1 = CBT, 2 = CBT+ZDC, 3 = CBThadron, 4 = CBThadron+ZDC"}}; Configurable fv0Cut{"fv0Cut", 50., "FV0A threshold"}; Configurable ft0aCut{"ft0aCut", 100., "FT0A threshold"}; Configurable ft0cCut{"ft0cCut", 50., "FT0C threshold"}; @@ -68,6 +69,7 @@ struct SginclusivePhiKstarSD { Configurable useSbp{"useSbp", -1, "kNoSameBunchPileup cut"}; Configurable useZvtxftovpv{"useZvtxftovpv", -1, "kIsGoodZvtxFT0vsPV cut"}; Configurable useVtxItsTpc{"useVtxItsTpc", -1, "kIsVertexITSTPC cut"}; + Configurable upcflag{"upcflag", -1, "upc run selection, 0 = std, 1= upc"}; // Track Selections Configurable pvCut{"pvCut", 1.0, "Use Only PV tracks"}; @@ -89,7 +91,6 @@ struct SginclusivePhiKstarSD { Configurable nsigmaTpcCut1{"nsigmaTpcCut1", 3.0, "nsigma tpc cut1"}; Configurable nsigmaTpcCut2{"nsigmaTpcCut2", 3.0, "nsigma tpc cut2"}; Configurable nsigmaTpcCut3{"nsigmaTpcCut3", 3.0, "nsigma tpc cut3"}; - Configurable nsigmaTpcCut4{"nsigmaTpcCut4", 3.0, "nsigma tpc cut4"}; Configurable nsigmaTpcCut{"nsigmaTpcCut", 3.0, "nsigma tpc cut"}; Configurable nsigmaTofCut{"nsigmaTofCut", 9.0, "nsigma tpc+tof cut"}; Configurable nsigmaTofCut1{"nsigmaTofCut1", 3.0, "nsigma tof cut"}; @@ -120,8 +121,24 @@ struct SginclusivePhiKstarSD { Configurable reconstruction{"reconstruction", true, ""}; Configurable generatedId{"generatedId", 31, ""}; + // Configurable axes for histogram + ConfigurableAxis dcaAxisConfig{"dcaAxisConfig", {600, -0.3f, 0.3f}, "DCAxy & DCAz axis"}; + ConfigurableAxis etaAxisConfig{"etaAxisConfig", {400, -1.0f, 1.0f}, "Pseudorapidity & Rapidity axis"}; + ConfigurableAxis VrtxXAxisConfig{"VrtxXAxisConfig", {400, -0.1f, 0.1f}, "Vertex X axis"}; + ConfigurableAxis VrtxYAxisConfig{"VrtxYAxisConfig", {200, -0.05f, 0.05f}, "Vertex Y axis"}; + ConfigurableAxis VrtxZAxisConfig{"VrtxZAxisConfig", {600, -15.0f, 15.0f}, "Vertex Z axis"}; + void init(InitContext const& context) { + // Axes + AxisSpec dcaxyAxis = {dcaAxisConfig, "DCAxy (cm)"}; + AxisSpec dcazAxis = {dcaAxisConfig, "DCAz (cm)"}; + AxisSpec etaAxis = {etaAxisConfig, "#eta"}; + AxisSpec rapAxis = {etaAxisConfig, "y"}; + AxisSpec VrtxXAxis = {VrtxXAxisConfig, "Vertex X (cm)"}; + AxisSpec VrtxYAxis = {VrtxYAxisConfig, "Vertex Y (cm)"}; + AxisSpec VrtxZAxis = {VrtxZAxisConfig, "Vertex Z (cm)"}; + registry.add("GapSide", "Gap Side; Entries", kTH1F, {{4, -1.5, 2.5}}); registry.add("TrueGapSide", "Gap Side; Entries", kTH1F, {{4, -1.5, 2.5}}); registry.add("nPVContributors_data", "Multiplicity_dist_before track cut gap A", kTH1F, {{110, 0, 110}}); @@ -130,56 +147,56 @@ struct SginclusivePhiKstarSD { if (phi) { registry.add("os_KK_pT_0", "pt kaon pair", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); registry.add("os_KK_pT_1", "pt kaon pair", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_KK_pT_2", "pt kaon pair", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_KK_pT_2", "pt kaon pair", kTH3F, {{305, 0.98, 2.2}, {80, -2.0, 2.0}, {100, 0, 10}}); registry.add("os_KK_ls_pT_0", "kaon pair like sign", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); registry.add("os_KK_ls_pT_1", "kaon pair like sign", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_KK_ls_pT_2", "kaon pair like sign", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_KK_ls_pT_2", "kaon pair like sign", kTH3F, {{305, 0.98, 2.2}, {80, -2.0, 2.0}, {100, 0, 10}}); registry.add("os_KK_mix_pT_0", "kaon pair mix event", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); registry.add("os_KK_mix_pT_1", "kaon pair mix event", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_KK_mix_pT_2", "kaon pair mix event", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_KK_mix_pT_2", "kaon pair mix event", kTH3F, {{305, 0.98, 2.2}, {80, -2.0, 2.0}, {100, 0, 10}}); registry.add("os_KK_rot_pT_0", "kaon pair mix event", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); registry.add("os_KK_rot_pT_1", "kaon pair mix event", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_KK_rot_pT_2", "kaon pair mix event", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_KK_rot_pT_2", "kaon pair mix event", kTH3F, {{305, 0.98, 2.2}, {80, -2.0, 2.0}, {100, 0, 10}}); } if (rho) { - registry.add("os_pp_pT_0", "pt pion pair", kTH3F, {{120, 1.44, 2.04}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_pp_pT_1", "pt pion pair", kTH3F, {{120, 1.44, 2.04}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_pp_pT_2", "pt pion pair", kTH3F, {{120, 1.44, 2.04}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_pp_ls_pT_0", "pion pair like sign", kTH3F, {{120, 1.44, 2.04}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_pp_ls_pT_1", "pion pair like sign", kTH3F, {{120, 1.44, 2.04}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_pp_ls_pT_2", "pion pair like sign", kTH3F, {{120, 1.44, 2.04}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_pp_pT_0", "pt pion pair", kTH3F, {{200, 1.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_pp_pT_1", "pt pion pair", kTH3F, {{200, 1.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_pp_pT_2", "pt pion pair", kTH3F, {{200, 1.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_pp_ls_pT_0", "pion pair like sign", kTH3F, {{200, 1.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_pp_ls_pT_1", "pion pair like sign", kTH3F, {{200, 1.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_pp_ls_pT_2", "pion pair like sign", kTH3F, {{200, 1.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); } if (kstar) { registry.add("os_pk_pT_0", "pion-kaon pair", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); registry.add("os_pk_pT_1", "pion-kaon pair", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_pk_pT_2", "pion-kaon pair", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_pk_pT_2", "pion-kaon pair", kTH3F, {{600, 0.0, 3.0}, {80, -2.0, 2.0}, {1000, 0, 10}}); registry.add("os_pk_mix_pT_0", "pion-kaon mix pair", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); registry.add("os_pk_mix_pT_1", "pion-kaon mix pair", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_pk_mix_pT_2", "pion-kaon mix pair", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_pk_mix_pT_2", "pion-kaon mix pair", kTH3F, {{600, 0.0, 3.0}, {80, -2.0, 2.0}, {1000, 0, 10}}); registry.add("os_pk_rot_pT_0", "pion-kaon rotional pair", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); registry.add("os_pk_rot_pT_1", "pion-kaon rotional pair", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_pk_rot_pT_2", "pion-kaon rotional pair", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_pk_rot_pT_2", "pion-kaon rotional pair", kTH3F, {{600, 0.0, 3.0}, {80, -2.0, 2.0}, {1000, 0, 10}}); registry.add("os_pk_ls_pT_0", "pion-kaon pair like sign", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); registry.add("os_pk_ls_pT_1", "pion-kaon like sign", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_pk_ls_pT_2", "pion-kaon like sign", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_pk_ls_pT_2", "pion-kaon like sign", kTH3F, {{600, 0.0, 3.0}, {80, -2.0, 2.0}, {1000, 0, 10}}); registry.add("hRotation", "hRotation", kTH1F, {{360, 0.0, o2::constants::math::TwoPI}}); } // qa plots if (qa) { - registry.add("tpc_dedx", "p vs dE/dx", kTH2F, {{100, 0.0, 10.0}, {10000, 0.0, 2500.0}}); - registry.add("tof_beta", "p vs beta", kTH2F, {{100, 0.0, 10.0}, {100, 0.0, 5.0}}); - - registry.add("tpc_dedx_kaon", "p#k dE/dx", kTH2F, {{100, 0.0, 10.0}, {10000, 0.0, 2500.0}}); - registry.add("tpc_dedx_pion", "p#pi dE/dx", kTH2F, {{100, 0.0, 10.0}, {10000, 0.0, 2500.0}}); - registry.add("tpc_dedx_kaon_1", "tpc+tof pid cut p#k dE/dx", kTH2F, {{100, 0.0, 10.0}, {10000, 0.0, 2500.0}}); - registry.add("tpc_dedx_kaon_2", "tpc+tof pid cut1 p#k dE/dx", kTH2F, {{100, 0.0, 10.0}, {10000, 0.0, 2500.0}}); - registry.add("tpc_dedx_pion_1", "tpc+tof pid cut p#pi dE/dx", kTH2F, {{100, 0.0, 10.0}, {10000, 0.0, 25000.0}}); + registry.add("tpc_dedx", "p vs dE/dx", kTH2F, {{500, 0.0, 10.0}, {5000, 0.0, 5000.0}}); + registry.add("tof_beta", "p vs beta", kTH2F, {{500, 0.0, 10.0}, {500, 0.0, 1.0}}); + + registry.add("tpc_dedx_kaon", "p#k dE/dx", kTH2F, {{500, 0.0, 10.0}, {5000, 0.0, 5000.0}}); + registry.add("tpc_dedx_pion", "p#pi dE/dx", kTH2F, {{500, 0.0, 10.0}, {5000, 0.0, 5000.0}}); + registry.add("tpc_dedx_kaon_1", "tpc+tof pid cut p#k dE/dx", kTH2F, {{500, 0.0, 10.0}, {5000, 0.0, 5000.0}}); + registry.add("tpc_dedx_kaon_2", "tpc+tof pid cut1 p#k dE/dx", kTH2F, {{500, 0.0, 10.0}, {5000, 0.0, 5000.0}}); + registry.add("tpc_dedx_pion_1", "tpc+tof pid cut p#pi dE/dx", kTH2F, {{500, 0.0, 10.0}, {5000, 0.0, 5000.0}}); registry.add("tpc_nsigma_kaon", "p#k n#sigma", kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}); registry.add("tpc_nsigma_pion", "p#pi n#sigma", kTH2F, {{100, 0.0, 10.0}, {100, -10.0, 10.0}}); registry.add("tpc_tof_nsigma_kaon", "p#k n#sigma TPC vs TOF", kTH2F, {{100, -10.0, 10.0}, {100, -10.0, 10.0}}); @@ -208,6 +225,31 @@ struct SginclusivePhiKstarSD { registry.add("V0A_0", "V0A amplitude", kTH1F, {{1000, 0.0, 1000.0}}); registry.add("V0A_1", "V0A amplitude", kTH1F, {{1000, 0.0, 1000.0}}); + registry.add("hDcaxy_all_before", "DCAxy Distribution of all tracks before track selection; DCAxy (cm); Counts", kTH1F, {dcaxyAxis}); + registry.add("hDcaz_all_before", "DCAz Distribution of all tracks before track selection; DCAz (cm); Counts", kTH1F, {dcazAxis}); + + registry.add("hDcaxy_all_after", "DCAxy Distribution of all tracks after track selection; DCAxy (cm); Counts", kTH1F, {dcaxyAxis}); + registry.add("hDcaz_all_after", "DCAz Distribution of all tracks after track selection; DCAz (cm); Counts", kTH1F, {dcazAxis}); + + registry.add("hDcaxy_pi", "DCAxy Distribution of selected pions; DCAxy (cm); Counts", kTH1F, {dcaxyAxis}); + registry.add("hDcaz_pi", "DCAz Distribution of selected pions; DCAz (cm); Counts", kTH1F, {dcazAxis}); + + registry.add("hDcaxy_ka", "DCAxy Distribution of selected kaons; DCAxy (cm); Counts", kTH1F, {dcaxyAxis}); + registry.add("hDcaz_ka", "DCAz Distribution of selected kaons; DCAz (cm); Counts", kTH1F, {dcazAxis}); + + registry.add("hVertexX", "Vertex X distribution; Vertex X (cm); Counts", kTH1F, {VrtxXAxis}); + registry.add("hVertexY", "Vertex Y distribution; Vertex Y (cm); Counts", kTH1F, {VrtxYAxis}); + registry.add("hVertexZ", "VertexZ distribution; Vertex Z (cm); Counts", kTH1F, {VrtxZAxis}); + + registry.add("hEta_all_after", "Pseudorapidity of all tracks after track selection; #eta; Counts", kTH1F, {etaAxis}); + registry.add("hRap_all_after", "Rapidity of all tracks after track selection; y; Counts", kTH1F, {rapAxis}); + + registry.add("hEta_pi", "Pseudorapidity of selected Pions; #eta; Counts", kTH1F, {etaAxis}); + registry.add("hRap_pi", "Rapidity of selected Pions; y; Counts", kTH1F, {rapAxis}); + + registry.add("hEta_ka", "Pseudorapidity of selected Kaons; #eta; Counts", kTH1F, {etaAxis}); + registry.add("hRap_ka", "Rapidity of selected Kaons; y; Counts", kTH1F, {rapAxis}); + if (rapidityGap) { registry.add("mult_0", "mult0", kTH1F, {{150, 0, 150}}); registry.add("mult_1", "mult1", kTH1F, {{150, 0, 150}}); @@ -432,6 +474,23 @@ struct SginclusivePhiKstarSD { return cosThetaCs; } + template + bool isGoodRCTflag(C const& coll) + { + switch (cutRCTflag) { + case 1: + return sgSelector.isCBTOk(coll); + case 2: + return sgSelector.isCBTZdcOk(coll); + case 3: + return sgSelector.isCBTHadronOk(coll); + case 4: + return sgSelector.isCBTHadronZdcOk(coll); + default: + return true; + } + } + template bool selectionPIDKaon1(const T& candidate) { @@ -575,7 +634,10 @@ struct SginclusivePhiKstarSD { return; if (useVtxItsTpc != -1 && collision.vtxITSTPC() != useVtxItsTpc) return; - + if (!isGoodRCTflag(collision)) + return; + if (upcflag != -1 && collision.flags() != upcflag) + return; int mult = collision.numContrib(); if (gapSide == 0) { registry.fill(HIST("gap_mult0"), mult); @@ -597,6 +659,12 @@ struct SginclusivePhiKstarSD { int trackextra = 0; int trackextraDG = 0; + if (qa) { + registry.fill(HIST("hVertexX"), collision.posX()); + registry.fill(HIST("hVertexY"), collision.posY()); + registry.fill(HIST("hVertexZ"), collision.posZ()); + } + /* Partition pvContributors1 = aod::udtrack::isPVContributor == true; pvContributors1.bindTable(tracks); if (gapSide == 0) { @@ -607,9 +675,24 @@ struct SginclusivePhiKstarSD { } */ for (const auto& track1 : tracks) { + + if (qa) { + registry.fill(HIST("hDcaxy_all_before"), track1.dcaXY()); + registry.fill(HIST("hDcaz_all_before"), track1.dcaZ()); + } + if (!trackselector(track1, parameters)) continue; + v0.SetCoordinates(track1.px(), track1.py(), track1.pz(), o2::constants::physics::MassPionCharged); + + if (qa) { + registry.fill(HIST("hDcaxy_all_after"), track1.dcaXY()); + registry.fill(HIST("hDcaz_all_after"), track1.dcaZ()); + registry.fill(HIST("hEta_all_after"), v0.Eta()); + registry.fill(HIST("hRap_all_after"), v0.Rapidity()); + } + if (selectionPIDPion1(track1)) { onlyPionTrackspm.push_back(v0); rawPionTrackspm.push_back(track1); @@ -660,6 +743,10 @@ struct SginclusivePhiKstarSD { registry.fill(HIST("tpc_nsigma_kaon"), v0.Pt(), track1.tpcNSigmaKa()); registry.fill(HIST("tof_nsigma_kaon"), v0.Pt(), track1.tofNSigmaKa()); registry.fill(HIST("tpc_tof_nsigma_kaon"), track1.tpcNSigmaKa(), track1.tofNSigmaKa()); + registry.fill(HIST("hEta_ka"), v0.Eta()); + registry.fill(HIST("hRap_ka"), v0.Rapidity()); + registry.fill(HIST("hDcaxy_ka"), track1.dcaXY()); + registry.fill(HIST("hDcaz_ka"), track1.dcaZ()); } if (selectionPIDPion1(track1)) { @@ -667,6 +754,10 @@ struct SginclusivePhiKstarSD { registry.fill(HIST("tpc_nsigma_pion"), v0.Pt(), track1.tpcNSigmaPi()); registry.fill(HIST("tof_nsigma_pion"), v0.Pt(), track1.tofNSigmaPi()); registry.fill(HIST("tpc_tof_nsigma_pion"), track1.tpcNSigmaPi(), track1.tofNSigmaPi()); + registry.fill(HIST("hEta_pi"), v0.Eta()); + registry.fill(HIST("hRap_pi"), v0.Rapidity()); + registry.fill(HIST("hDcaxy_pi"), track1.dcaXY()); + registry.fill(HIST("hDcaz_pi"), track1.dcaZ()); } } } @@ -1384,6 +1475,29 @@ struct SginclusivePhiKstarSD { return; if (std::abs(collision.occupancyInTime()) > occCut) return; + if (std::abs(collision.hadronicRate()) > hadronicRate) + return; + if (useTrs != -1 && collision.trs() != useTrs) + return; + if (useTrofs != -1 && collision.trofs() != useTrofs) + return; + if (useHmpr != -1 && collision.hmpr() != useHmpr) + return; + if (useTfb != -1 && collision.tfb() != useTfb) + return; + if (useItsrofb != -1 && collision.itsROFb() != useItsrofb) + return; + if (useSbp != -1 && collision.sbp() != useSbp) + return; + if (useZvtxftovpv != -1 && collision.zVtxFT0vPV() != useZvtxftovpv) + return; + if (useVtxItsTpc != -1 && collision.vtxITSTPC() != useVtxItsTpc) + return; + if (!isGoodRCTflag(collision)) + return; + if (upcflag != -1 && collision.flags() != upcflag) + return; + registry.get(HIST("Reco/Stat"))->Fill(truegapSide, 1.); if (truegapSide != gapsideMC) return; From 02293e501fa42e8ab6c6364f78ddddf46231aba7 Mon Sep 17 00:00:00 2001 From: Gyula Bencedi Date: Wed, 23 Jul 2025 14:46:50 +0200 Subject: [PATCH 020/345] [PWGLF] Added configuragble for chi2 track selection (#12174) Co-authored-by: ALICE Action Bot --- PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx | 174 ++++++++++++++--------------- 1 file changed, 82 insertions(+), 92 deletions(-) diff --git a/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx b/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx index 4cc9a98d524..6baa84ee4ea 100644 --- a/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx +++ b/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx @@ -15,15 +15,19 @@ /// \author Gyula Bencedi, gyula.bencedi@cern.ch /// \since Nov 2024 -#include -#include -#include -#include -#include -#include +#include "Functions.h" +#include "Index.h" +#include "bestCollisionTable.h" -#include "CCDB/BasicCCDBManager.h" +#include "Common/CCDB/ctpRateFetcher.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/CollisionAssociationTables.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "CCDB/BasicCCDBManager.h" +#include "CommonConstants/MathConstants.h" #include "Framework/ASoAHelpers.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" @@ -31,22 +35,18 @@ #include "Framework/O2DatabasePDGPlugin.h" #include "Framework/RuntimeError.h" #include "Framework/runDataProcessing.h" - -#include "Common/CCDB/ctpRateFetcher.h" -#include "Common/DataModel/Centrality.h" -#include "Common/DataModel/CollisionAssociationTables.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "CommonConstants/MathConstants.h" - #include "MathUtils/Utils.h" #include "ReconstructionDataFormats/GlobalTrackID.h" + #include "TPDGCode.h" -#include "Functions.h" -#include "Index.h" -#include "bestCollisionTable.h" +#include +#include +#include +#include +#include +#include +#include using namespace o2; using namespace o2::framework; @@ -65,6 +65,7 @@ AxisSpec dcaxyAxis = {500, -1, 50}; AxisSpec phiAxis = {629, 0, TwoPI, "Rad", "#phi"}; AxisSpec etaAxis = {20, -4., -2.}; AxisSpec centAxis{100, 0, 100, "centrality"}; +AxisSpec chiSqAxis = {100, 0., 1000.}; struct DndetaMFTPbPb { SliceCache cache; @@ -83,6 +84,11 @@ struct DndetaMFTPbPb { false, true}; + Configurable cfgDoIR{"cfgDoIR", false, "Flag to retrieve Interaction rate from CCDB"}; + Configurable cfgUseIRCut{"cfgUseIRCut", false, "Flag to cut on IR rate"}; + Configurable cfgIRCrashOnNull{"cfgIRCrashOnNull", false, "Flag to avoid CTP RateFetcher crash"}; + Configurable cfgIRSource{"cfgIRSource", "T0VTX", "Estimator of the interaction rate (Pb-Pb: ZNC hadronic)"}; + struct : ConfigurableGroup { Configurable usephiCut{"usephiCut", false, "use azimuthal angle cut"}; Configurable phiCut{"phiCut", 0.1f, @@ -93,6 +99,7 @@ struct DndetaMFTPbPb { Configurable maxEta{"maxEta", -2.5f, ""}; Configurable minNclusterMft{"minNclusterMft", 5, "minimum number of MFT clusters"}; + Configurable useChi2Cut{"useChi2Cut", false, "use track chi2 cut"}; Configurable maxChi2{"maxChi2", 10.f, ""}; Configurable minPt{"minPt", 0., "minimum pT of the MFT tracks"}; Configurable requireCA{ @@ -127,7 +134,6 @@ struct DndetaMFTPbPb { "minOccupancy", -1, "minimum occupancy from neighbouring collisions"}; Configurable maxOccupancy{ "maxOccupancy", -1, "maximum occupancy from neighbouring collisions"}; - Configurable cfgSelInteractionRate{"cfgSelInteractionRate", false, " Get Interaction rate from CCDB"}; Configurable minIR{"minIR", -1, "minimum IR (kHz) collisions"}; Configurable maxIR{"maxIR", -1, "maximum IR (kHz) collisions"}; } eventCuts; @@ -154,7 +160,13 @@ struct DndetaMFTPbPb { "latest acceptable timestamp of creation for the object"}; Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + + int mRunNumber{-1}; + uint64_t mSOR{0}; + double mMinSeconds{-1.}; + std::unordered_map gHadronicRate; ctpRateFetcher rateFetcher; + TH2* gCurrentHadronicRate; /// @brief init function, definition of histograms void init(InitContext&) @@ -221,7 +233,7 @@ struct DndetaMFTPbPb { } auto hev = registry.add("hEvtSel", "hEvtSel", HistType::kTH1F, - {{16, -0.5f, +15.5f}}); + {{14, -0.5f, +13.5f}}); hev->GetXaxis()->SetBinLabel(1, "All collisions"); hev->GetXaxis()->SetBinLabel(2, "Ev. sel."); hev->GetXaxis()->SetBinLabel(3, "kIsGoodZvtxFT0vsPV"); @@ -235,8 +247,6 @@ struct DndetaMFTPbPb { hev->GetXaxis()->SetBinLabel(11, "kNoHighMultCollInPrevRof"); hev->GetXaxis()->SetBinLabel(12, "Below min occup."); hev->GetXaxis()->SetBinLabel(13, "Above max occup."); - hev->GetXaxis()->SetBinLabel(14, "Below min IR (kHz)"); - hev->GetXaxis()->SetBinLabel(15, "Above max IR (kHz)"); auto hBcSel = registry.add("hBcSel", "hBcSel", HistType::kTH1F, {{3, -0.5f, +2.5f}}); @@ -257,9 +267,6 @@ struct DndetaMFTPbPb { x->SetBinLabel(1, "All"); x->SetBinLabel(2, "Selected"); - qaregistry.add("hOccIRate", "hOccIRate", HistType::kTH2F, - {occupancyAxis, irBins}); - registry.add({"Events/NtrkZvtx", "; N_{trk}; Z_{vtx} (cm); occupancy", {HistType::kTHnSparseF, {multAxis, zAxis, occupancyAxis}}}); @@ -274,10 +281,10 @@ struct DndetaMFTPbPb { qaregistry.add( {"Tracks/Chi2Eta", "; #chi^{2}; #it{#eta}; occupancy", - {HistType::kTHnSparseF, {{600, 0, 20}, etaAxis, occupancyAxis}}}); + {HistType::kTHnSparseF, {chiSqAxis, etaAxis, occupancyAxis}}}); qaregistry.add({"Tracks/Chi2", "; #chi^{2};", - {HistType::kTH2F, {{600, 0, 20}, occupancyAxis}}}); + {HistType::kTH2F, {chiSqAxis, occupancyAxis}}}); qaregistry.add( {"Tracks/NclustersEta", "; nClusters; #eta; occupancy", @@ -343,9 +350,6 @@ struct DndetaMFTPbPb { hstat->GetAxis(0)->SetBinLabel(1, "All"); hstat->GetAxis(0)->SetBinLabel(2, "Selected"); - qaregistry.add("hCentOccIRate", "hCentOccIRate", HistType::kTHnSparseF, - {centralityAxis, occupancyAxis, irBins}); - qaregistry.add({"Events/Centrality/hCent", "; centrality; occupancy", {HistType::kTH2F, {centAxis, occupancyAxis}}, @@ -375,11 +379,11 @@ struct DndetaMFTPbPb { {"Tracks/Centrality/Chi2Eta", "; #chi^{2}; #it{#eta}; centrality; occupancy", {HistType::kTHnSparseF, - {{600, 0, 20}, etaAxis, centralityAxis, occupancyAxis}}}); + {chiSqAxis, etaAxis, centralityAxis, occupancyAxis}}}); qaregistry.add({"Tracks/Centrality/Chi2", "; #chi^{2}; centrality; occupancy", {HistType::kTHnSparseF, - {{600, 0, 20}, centralityAxis, occupancyAxis}}}); + {chiSqAxis, centralityAxis, occupancyAxis}}}); qaregistry.add({"Tracks/Centrality/NclustersEta", "; nClusters; #eta; centrality; occupancy", {HistType::kTHnSparseF, @@ -735,35 +739,15 @@ struct DndetaMFTPbPb { using FiltBestTracks = soa::Filtered; using FiltParticles = soa::Filtered; - bool isIRSelected(CollBCs::iterator const& bc, bool fillHis = false) - { - double ir = (eventCuts.minIR >= 0 || eventCuts.maxIR >= 0) - ? rateFetcher.fetch(ccdb.service, bc.timestamp(), - bc.runNumber(), "ZNC hadronic") * - 1.e-3 - : -1; - if (eventCuts.minIR >= 0 && ir < eventCuts.minIR) { - return false; - } - if (fillHis) { - registry.fill(HIST("hEvtSel"), 13); - } - if (eventCuts.maxIR >= 0 && ir > eventCuts.maxIR) { - return false; - } - if (fillHis) { - registry.fill(HIST("hEvtSel"), 14); - } - return true; - } - template bool isTrackSelected(const T& track) { if (track.eta() < trackCuts.minEta || track.eta() > trackCuts.maxEta) return false; - if (track.chi2() > trackCuts.maxChi2) - return false; + if (trackCuts.useChi2Cut) { + if (track.chi2() > trackCuts.maxChi2) + return false; + } if (trackCuts.requireCA && !track.isCA()) return false; if (track.nClusters() < trackCuts.minNclusterMft) @@ -928,6 +912,24 @@ struct DndetaMFTPbPb { return -1.f; } + void initHadronicRate(CollBCs::iterator const& bc) + { + if (mRunNumber == bc.runNumber()) { + return; + } + mRunNumber = bc.runNumber(); + if (gHadronicRate.find(mRunNumber) == gHadronicRate.end()) { + auto runDuration = ccdb->getRunDuration(mRunNumber); + mSOR = runDuration.first; + mMinSeconds = std::floor(mSOR * 1.e-3); /// round tsSOR to the highest integer lower than tsSOR + double maxSec = std::ceil(runDuration.second * 1.e-3); /// round tsEOR to the lowest integer higher than tsEOR + const AxisSpec axisSeconds{static_cast((maxSec - mMinSeconds) / 20.f), 0, maxSec - mMinSeconds, "Seconds since SOR"}; + int hadronicRateBins = static_cast(eventCuts.maxIR - eventCuts.minIR); + gHadronicRate[mRunNumber] = registry.add(Form("HadronicRate/%i", mRunNumber), ";Time since SOR (s);Hadronic rate (kHz)", kTH2D, {axisSeconds, {hadronicRateBins, eventCuts.minIR, eventCuts.maxIR}}).get(); + } + gCurrentHadronicRate = gHadronicRate[mRunNumber]; + } + template bool isGoodEvent(C const& collision) { @@ -1110,10 +1112,6 @@ struct DndetaMFTPbPb { auto occ = getOccupancy(collision, eventCuts.occupancyEstimator); float c = getRecoCent(collision); auto bc = collision.template foundBC_as(); - double ir = rateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), - "ZNC hadronic") * - 1.e-3; - if constexpr (has_reco_cent) { registry.fill(HIST("Events/Centrality/Selection"), 1., c, occ); } else { @@ -1123,10 +1121,15 @@ struct DndetaMFTPbPb { if (!isGoodEvent(collision)) { return; } - if (eventCuts.cfgSelInteractionRate) { - if (!isIRSelected(bc, true)) { + + if (cfgDoIR) { + initHadronicRate(bc); + double ir = rateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), cfgIRSource, cfgIRCrashOnNull) * 1.e-3; + double seconds = bc.timestamp() * 1.e-3 - mMinSeconds; + if (cfgUseIRCut && (ir < eventCuts.minIR || ir > eventCuts.maxIR)) { // cut on hadronic rate return; } + gCurrentHadronicRate->Fill(seconds, ir); } auto z = collision.posZ(); @@ -1134,10 +1137,7 @@ struct DndetaMFTPbPb { registry.fill(HIST("Events/Centrality/Selection"), 2., c, occ); qaregistry.fill(HIST("Events/Centrality/hZvtxCent"), z, c, occ); qaregistry.fill(HIST("Events/Centrality/hCent"), c, occ); - qaregistry.fill(HIST("hCentOccIRate"), c, occ, ir); - } else { - qaregistry.fill(HIST("hOccIRate"), occ, ir); registry.fill(HIST("Events/Selection"), 2., occ); } @@ -1155,16 +1155,11 @@ struct DndetaMFTPbPb { template void processDatawBestTracks( typename C::iterator const& collision, FiltMftTracks const& tracks, - soa::SmallGroups const& besttracks, - CollBCs const& /*bcs*/) + soa::SmallGroups const& besttracks, CollBCs const& /*bcs*/) { auto occ = getOccupancy(collision, eventCuts.occupancyEstimator); float c = getRecoCent(collision); auto bc = collision.template foundBC_as(); - double ir = rateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), - "ZNC hadronic") * - 1.e-3; - if constexpr (has_reco_cent) { registry.fill(HIST("Events/Centrality/Selection"), 1., c, occ); } else { @@ -1174,19 +1169,22 @@ struct DndetaMFTPbPb { if (!isGoodEvent(collision)) { return; } - if (eventCuts.cfgSelInteractionRate) { - if (!isIRSelected(bc, true)) { + + if (cfgDoIR) { + initHadronicRate(bc); + double ir = rateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), cfgIRSource, cfgIRCrashOnNull) * 1.e-3; + double seconds = bc.timestamp() * 1.e-3 - mMinSeconds; + if (cfgUseIRCut && (ir < eventCuts.minIR || ir > eventCuts.maxIR)) { // cut on hadronic rate return; } + gCurrentHadronicRate->Fill(seconds, ir); } auto z = collision.posZ(); if constexpr (has_reco_cent) { registry.fill(HIST("Events/Centrality/Selection"), 2., c, occ); - qaregistry.fill(HIST("hCentOccIRate"), c, occ, ir); } else { registry.fill(HIST("Events/Selection"), 2., occ); - qaregistry.fill(HIST("hOccIRate"), occ, ir); } auto nBestTrks = countBestTracks(tracks, besttracks, z, c, occ); @@ -1256,8 +1254,7 @@ struct DndetaMFTPbPb { void processDatawBestTracksInclusive( Colls::iterator const& collision, FiltMftTracks const& tracks, - soa::SmallGroups const& besttracks, - CollBCs const& bcs) + soa::SmallGroups const& besttracks, CollBCs const& bcs) { processDatawBestTracks(collision, tracks, besttracks, bcs); } @@ -1268,8 +1265,7 @@ struct DndetaMFTPbPb { void processDatawBestTracksCentFT0C( CollsCentFT0C::iterator const& collision, FiltMftTracks const& tracks, - soa::SmallGroups const& besttracks, - CollBCs const& bcs) + soa::SmallGroups const& besttracks, CollBCs const& bcs) { processDatawBestTracks(collision, tracks, besttracks, bcs); } @@ -1281,11 +1277,9 @@ struct DndetaMFTPbPb { void processDatawBestTracksCentFT0CVariant1( CollsCentFT0CVariant1::iterator const& collision, FiltMftTracks const& tracks, - soa::SmallGroups const& besttracks, - CollBCs const& bcs) + soa::SmallGroups const& besttracks, CollBCs const& bcs) { - processDatawBestTracks(collision, tracks, besttracks, - bcs); + processDatawBestTracks(collision, tracks, besttracks, bcs); } PROCESS_SWITCH(DndetaMFTPbPb, processDatawBestTracksCentFT0CVariant1, @@ -1295,8 +1289,7 @@ struct DndetaMFTPbPb { void processDatawBestTracksCentFT0M( CollsCentFT0M::iterator const& collision, FiltMftTracks const& tracks, - soa::SmallGroups const& besttracks, - CollBCs const& bcs) + soa::SmallGroups const& besttracks, CollBCs const& bcs) { processDatawBestTracks(collision, tracks, besttracks, bcs); } @@ -1307,11 +1300,9 @@ struct DndetaMFTPbPb { void processDatawBestTracksCentNGlobal( CollsCentNGlobal::iterator const& collision, FiltMftTracks const& tracks, - soa::SmallGroups const& besttracks, - CollBCs const& bcs) + soa::SmallGroups const& besttracks, CollBCs const& bcs) { - processDatawBestTracks(collision, tracks, besttracks, - bcs); + processDatawBestTracks(collision, tracks, besttracks, bcs); } PROCESS_SWITCH(DndetaMFTPbPb, processDatawBestTracksCentNGlobal, @@ -1321,8 +1312,7 @@ struct DndetaMFTPbPb { void processDatawBestTracksCentMFT( CollsCentMFT::iterator const& collision, FiltMftTracks const& tracks, - soa::SmallGroups const& besttracks, - CollBCs const& bcs) + soa::SmallGroups const& besttracks, CollBCs const& bcs) { processDatawBestTracks(collision, tracks, besttracks, bcs); } From 4e4f16d57ebb356333746e08d725c3fa7197badb Mon Sep 17 00:00:00 2001 From: Nicolas Strangmann <77485327+nstrangm@users.noreply.github.com> Date: Wed, 23 Jul 2025 15:35:16 +0200 Subject: [PATCH 021/345] [PWGEM/PhotonMeson] Add omega EMC task and extend gg histograms (#12184) Co-authored-by: Nicolas Strangmann --- PWGEM/PhotonMeson/Tasks/CMakeLists.txt | 5 + PWGEM/PhotonMeson/Tasks/OmegaMesonEMC.cxx | 342 ++++++++++++++++++ .../Tasks/emcalBcWiseGammaGamma.cxx | 46 +-- PWGEM/PhotonMeson/Utils/HNMUtilities.h | 16 + 4 files changed, 386 insertions(+), 23 deletions(-) create mode 100644 PWGEM/PhotonMeson/Tasks/OmegaMesonEMC.cxx diff --git a/PWGEM/PhotonMeson/Tasks/CMakeLists.txt b/PWGEM/PhotonMeson/Tasks/CMakeLists.txt index 2293f384857..49b16a1b843 100644 --- a/PWGEM/PhotonMeson/Tasks/CMakeLists.txt +++ b/PWGEM/PhotonMeson/Tasks/CMakeLists.txt @@ -64,6 +64,11 @@ o2physics_add_dpl_workflow(heavy-neutral-meson PUBLIC_LINK_LIBRARIES O2::Framework O2::EMCALBase O2::EMCALCalib O2Physics::AnalysisCore O2Physics::PWGEMPhotonMesonCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(omega-meson-emc + SOURCES OmegaMesonEMC.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2::EMCALBase O2::EMCALCalib O2Physics::AnalysisCore O2Physics::PWGEMPhotonMesonCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(phos-qc SOURCES phosQC.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2Physics::AnalysisCore O2Physics::PWGEMPhotonMesonCore diff --git a/PWGEM/PhotonMeson/Tasks/OmegaMesonEMC.cxx b/PWGEM/PhotonMeson/Tasks/OmegaMesonEMC.cxx new file mode 100644 index 00000000000..6ac2788f549 --- /dev/null +++ b/PWGEM/PhotonMeson/Tasks/OmegaMesonEMC.cxx @@ -0,0 +1,342 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +/// +/// \file OmegaMesonEMC.cxx +/// +/// \brief This code loops over collisions to reconstruct heavy mesons (omega or eta') using EMCal clusters +/// +/// \author Nicolas Strangmann (nicolas.strangmann@cern.ch) - Goethe University Frankfurt +/// + +#include "PWGEM/PhotonMeson/Utils/HNMUtilities.h" +#include "PWGJE/DataModel/EMCALMatchedCollisions.h" + +#include "Common/Core/TrackSelection.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "CommonConstants/MathConstants.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/Configurable.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/runDataProcessing.h" + +#include "Math/GenVector/Boost.h" +#include "Math/Vector4D.h" +#include "TMath.h" +#include "TRandom3.h" + +#include "fairlogger/Logger.h" + +#include +#include +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::aod::pwgem::photonmeson; + +namespace o2::aod +{ +using MyBCs = soa::Join; +using MyCollisions = soa::Filtered>; +using MyCollision = MyCollisions::iterator; +using SelectedTracks = soa::Filtered>; +} // namespace o2::aod + +namespace hnm +{ + +enum TrackCuts { kpT, + kEta, + kTPCSigma, + kTrackCuts +}; + +const std::vector chargedPionMinMaxName{"Min", "Max"}; +const std::vector chargedPionCutsName{"pT", "eta", "TPC sigma"}; +const float chargedPionCutsTable[kTrackCuts][2]{{0.35f, 20.f}, {-.8f, .8f}, {-4.f, 4.f}}; + +} // namespace hnm + +struct OmegaMesonEMC { + + // --------------------------------> Configurables <------------------------------------ + // - Event selection cuts + // - Track selection cuts + // - Cluster shifts + // - HNM mass selection windows + // ------------------------------------------------------------------------------------- + // ---> Event selection + Configurable confEvtSelectZvtx{"confEvtSelectZvtx", true, "Event selection includes max. z-Vertex"}; + Configurable confEvtZvtx{"confEvtZvtx", 10.f, "Evt sel: Max. z-Vertex (cm)"}; + Configurable confEvtRequireSel8{"confEvtRequireSel8", true, "Evt sel: check for sel8 trigger bit"}; + Configurable confEvtRequirekTVXinEMC{"confEvtRequirekTVXinEMC", false, "Evt sel: check for EMCal MB trigger kTVXinEMC"}; + + // ---> Track selection + Configurable> cfgChargedPionCuts{"cfgChargedPionCuts", {hnm::chargedPionCutsTable[0], 3, 2, hnm::chargedPionCutsName, hnm::chargedPionMinMaxName}, "Charged pion track cuts"}; + Configurable cfgTPCNClustersMin{"cfgTPCNClustersMin", 80, "Mininum of TPC Clusters"}; + Configurable cfgTrkTPCfCls{"cfgTrkTPCfCls", 0.83, "Minimum fraction of crossed rows over findable clusters"}; + Configurable cfgTrkTPCcRowsMin{"cfgTrkTPCcRowsMin", 70, "Minimum number of crossed TPC rows"}; + Configurable cfgTrkTPCsClsSharedFrac{"cfgTrkTPCsClsSharedFrac", 1.f, "Fraction of shared TPC clusters"}; + Configurable cfgTrkITSnclsMin{"cfgTrkITSnclsMin", 4, "Minimum number of ITS clusters"}; + Configurable cfgTrkDCAxyMax{"cfgTrkDCAxyMax", 0.15, "Maximum DCA_xy"}; + Configurable cfgTrkDCAzMax{"cfgTrkDCAzMax", 0.3, "Maximum DCA_z"}; + Configurable cfgTrkMaxChi2PerClusterTPC{"cfgTrkMaxChi2PerClusterTPC", 4.0f, "Minimal track selection: max allowed chi2 per TPC cluster"}; // 4.0 is default of global tracks on 20.01.2023 + Configurable cfgTrkMaxChi2PerClusterITS{"cfgTrkMaxChi2PerClusterITS", 36.0f, "Minimal track selection: max allowed chi2 per ITS cluster"}; // 36.0 is default of global tracks on 20.01.2023 + + // ---> Configurables to allow for a shift in eta/phi of EMCal clusters to better align with extrapolated TPC tracks + Configurable cfgDoEMCShift{"cfgDoEMCShift", false, "Apply SM-wise shift in eta and phi to EMCal clusters to align with TPC tracks"}; + Configurable> cfgEMCEtaShift{"cfgEMCEtaShift", {0.f}, "values for SM-wise shift in eta to be added to EMCal clusters to align with TPC tracks"}; + Configurable> cfgEMCPhiShift{"cfgEMCPhiShift", {0.f}, "values for SM-wise shift in phi to be added to EMCal clusters to align with TPC tracks"}; + static const int nSMs = 20; + std::array emcEtaShift = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + std::array emcPhiShift = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + + // ---> Shift the omega/eta' mass based on the difference of the reconstructed mass of the pi0/eta to its PDG mass to reduce smearing caused by EMCal/PCM in photon measurement + Configurable cfgHNMMassCorrection{"cfgHNMMassCorrection", 1, "Use GG PDG mass to correct HNM mass (0 = off, 1 = subDeltaPi0, 2 = subLambda)"}; + + // ---> Mass windows for the selection of heavy neutral mesons (also based on mass of their light neutral meson decay daughter) + static constexpr float DefaultMassWindows[2] = {0.11, 0.16}; + Configurable> cfgMassWindowPi0{"cfgMassWindowPi0", {DefaultMassWindows, 2, {"min", "max"}}, "Mass window for selected decay pi0"}; + + Configurable cfgMaxMultiplicity{"cfgMaxMultiplicity", 5000, "Maximum number of tracks in a collision (can be used to increase the S/B -> Very experimental)"}; + Configurable cfgMinGGPtOverHNMPt{"cfgMinGGPtOverHNMPt", 0., "Minimum ratio of the pT of the gamma gamma pair over the pT of the HNM (can be used to increase the S/B)"}; + + Filter collisionZVtxFilter = nabs(aod::collision::posZ) < confEvtZvtx; + Filter collisionMultFilter = (o2::aod::mult::multNTracksPV <= cfgMaxMultiplicity); + + Filter trackPtFilter = (o2::aod::track::pt > cfgChargedPionCuts->get(hnm::kpT, "Min")) && (o2::aod::track::pt < cfgChargedPionCuts->get(hnm::kpT, "Max")); + Filter trackEtaFilter = (o2::aod::track::eta > cfgChargedPionCuts->get(hnm::kEta, "Min")) && (o2::aod::track::eta < cfgChargedPionCuts->get(hnm::kEta, "Max")); + Filter trackDCAXYFilter = nabs(o2::aod::track::dcaXY) < cfgTrkDCAxyMax; + Filter trackDCAZFilter = nabs(o2::aod::track::dcaZ) < cfgTrkDCAzMax; + + Filter trackTPCChi2Filter = o2::aod::track::tpcChi2NCl < cfgTrkMaxChi2PerClusterTPC; + Filter trackITSChi2Filter = o2::aod::track::itsChi2NCl < cfgTrkMaxChi2PerClusterITS; + + Filter trackTPCSigmaFilterTPC = (o2::aod::pidtpc::tpcNSigmaPi > cfgChargedPionCuts->get(hnm::kTPCSigma, "Min")) && (o2::aod::pidtpc::tpcNSigmaPi < cfgChargedPionCuts->get(hnm::kTPCSigma, "Max")); + + template + bool isSelectedTrack(T const& track) + { + if (track.tpcNClsFound() < cfgTPCNClustersMin) + return false; + if (track.tpcCrossedRowsOverFindableCls() < cfgTrkTPCfCls) + return false; + if (track.tpcNClsCrossedRows() < cfgTrkTPCcRowsMin) + return false; + if (track.tpcFractionSharedCls() > cfgTrkTPCsClsSharedFrac) + return false; + if (track.itsNCls() < cfgTrkITSnclsMin) + return false; + return true; + } + + HistogramRegistry mHistManager{"HeavyNeutralMesonHistograms", {}, OutputObjHandlingPolicy::AnalysisObject}; + + // Prepare vectors for different species + std::vector vGGs; + std::vector vHNMs; + std::vector pion, antipion; + + Preslice perCollisionEMC = aod::skimmedcluster::collisionId; + + void init(InitContext const&) + { + mHistManager.add("Event/nEMCalEvents", "Number of collisions with a certain combination of EMCal triggers;;#bf{#it{N}_{collisions}}", HistType::kTH1F, {{5, -0.5, 4.5}}); + std::vector nEventTitles = {"Cells & kTVXinEMC", "Cells & L0", "Cells & !kTVXinEMC & !L0", "!Cells & kTVXinEMC", "!Cells & L0"}; + for (size_t iBin = 0; iBin < nEventTitles.size(); iBin++) + mHistManager.get(HIST("Event/nEMCalEvents"))->GetXaxis()->SetBinLabel(iBin + 1, nEventTitles[iBin].data()); + mHistManager.add("Event/fMultiplicity", "Multiplicity after event cuts;#bf{#it{N}_{tracks}};#bf{#it{N}_{collisions}}", HistType::kTH1F, {{500, 0, 500}}); + mHistManager.add("Event/fZvtx", "Zvtx after event cuts;#bf{z_{vtx} (cm)};#bf{#it{N}_{collisions}}", HistType::kTH1F, {{300, -15, 15}}); + + mHistManager.add("GG/invMassVsPt", "Invariant mass and pT of gg candidates;#bf{#it{M}^{#gamma#gamma} (GeV/#it{c}^{2})};#bf{#it{p}_{T}^{#gamma#gamma} (GeV/#it{c})}", HistType::kTH2F, {{400, 0., 0.8}, {250, 0., 25.}}); + mHistManager.add("GG/invMassVsPt_selected", "Invariant mass and pT of gg candidates;#bf{#it{M}^{#gamma#gamma} (GeV/#it{c}^{2})};#bf{#it{p}_{T}^{#gamma#gamma} (GeV/#it{c})}", HistType::kTH2F, {{400, 0., 0.8}, {250, 0., 25.}}); + + const int nTrackSpecies = 2; // x2 because of anti particles + const char* particleSpecies[nTrackSpecies] = {"Pion", "AntiPion"}; + const char* particleSpeciesLatex[nTrackSpecies] = {"#pi^{+}", "#pi^{-}"}; + + for (int iParticle = 0; iParticle < nTrackSpecies; iParticle++) { + mHistManager.add(Form("TrackCuts/%s/fPt", particleSpecies[iParticle]), Form("%s transverse momentum;#bf{#it{p}_{T}^{%s} (GeV/#it{c})};#bf{#it{N}^{%s}}", particleSpecies[iParticle], particleSpeciesLatex[iParticle], particleSpeciesLatex[iParticle]), HistType::kTH1F, {{500, 0, 10}}); + mHistManager.add(Form("TrackCuts/%s/fEta", particleSpecies[iParticle]), Form("%s pseudorapidity distribution;#eta;#bf{#it{N}^{%s}}", particleSpecies[iParticle], particleSpeciesLatex[iParticle]), HistType::kTH1F, {{500, -2, 2}}); + mHistManager.add(Form("TrackCuts/%s/fPhi", particleSpecies[iParticle]), Form("%s azimuthal angle distribution;#phi;#bf{#it{N}^{%s}}", particleSpecies[iParticle], particleSpeciesLatex[iParticle]), HistType::kTH1F, {{720, 0, constants::math::TwoPI}}); + + mHistManager.add(Form("TrackCuts/%s/fNsigmaTPCvsP", particleSpecies[iParticle]), Form("NSigmaTPC %s P;#bf{#it{p}^{%s} (GeV/#it{c})};n#sigma_{TPC}^{%s}", particleSpecies[iParticle], particleSpeciesLatex[iParticle], particleSpeciesLatex[iParticle]), {HistType::kTH2F, {{100, 0.0f, 10.0f}, {100, -10.f, 10.f}}}); + + mHistManager.add(Form("TrackCuts/%s/fDCAxy", particleSpecies[iParticle]), Form("fDCAxy %s;#bf{DCA_{xy}};#bf{#it{N}^{%s}}", particleSpecies[iParticle], particleSpeciesLatex[iParticle]), HistType::kTH1F, {{500, -0.5f, 0.5f}}); + mHistManager.add(Form("TrackCuts/%s/fDCAz", particleSpecies[iParticle]), Form("fDCAz %s;#bf{DCA_{z}};#bf{#it{N}^{%s}}", particleSpecies[iParticle], particleSpeciesLatex[iParticle]), HistType::kTH1F, {{500, -0.5f, 0.5f}}); + mHistManager.add(Form("TrackCuts/%s/fTPCsCls", particleSpecies[iParticle]), Form("fTPCsCls %s;#bf{TPC Shared Clusters};#bf{#it{N}^{%s}}", particleSpecies[iParticle], particleSpeciesLatex[iParticle]), HistType::kTH1F, {{163, -1.0f, 162.0f}}); + mHistManager.add(Form("TrackCuts/%s/fTPCcRows", particleSpecies[iParticle]), Form("fTPCcRows %s;#bf{TPC Crossed Rows};#bf{#it{N}^{%s}}", particleSpecies[iParticle], particleSpeciesLatex[iParticle]), HistType::kTH1F, {{163, -1.0f, 162.0f}}); + mHistManager.add(Form("TrackCuts/%s/fTrkTPCfCls", particleSpecies[iParticle]), Form("fTrkTPCfCls %s;#bf{TPC Findable/CrossedRows};#bf{#it{N}^{%s}}", particleSpecies[iParticle], particleSpeciesLatex[iParticle]), HistType::kTH1F, {{500, 0.0f, 3.0f}}); + mHistManager.add(Form("TrackCuts/%s/fTPCncls", particleSpecies[iParticle]), Form("fTPCncls %s;#bf{TPC Clusters};#bf{#it{N}^{%s}}", particleSpecies[iParticle], particleSpeciesLatex[iParticle]), HistType::kTH1F, {{163, -1.0f, 162.0f}}); + } + + // --> HNM QA + // Properties of the pi+pi- pair + mHistManager.add("Omega/Before/PiPlPiMi/fInvMassVsPt", "Invariant mass and pT of #pi^+pi^- pairs;#bf{#it{M}^{#pi^{+}#pi^{-}} (GeV/#it{c}^{2})};#bf{#it{p}_{T}^{#pi^{+}#pi^{-}} (GeV/#it{c})}", HistType::kTH2F, {{400, 0.2, 1.}, {250, 0., 25.}}); + mHistManager.add("Omega/Before/PiPlPiMi/fEta", "Pseudorapidity of HMNCand;#eta;#bf{#it{N}^{#pi^{+}#pi^{-}}}", HistType::kTH1F, {{500, -2, 2}}); + mHistManager.add("Omega/Before/PiPlPiMi/fPhi", "Azimuthal angle of HMNCand;#phi;#bf{#it{N}^{#pi^{+}#pi^{-}}}", HistType::kTH1F, {{720, 0, constants::math::TwoPI}}); + + for (const auto& BeforeAfterString : {"Before", "After"}) { + mHistManager.add(Form("Omega/%s/fInvMassVsPt", BeforeAfterString), "Invariant mass and pT of heavy neutral meson candidates;#bf{#it{M}^{#pi^{+}#pi^{-}#gamma#gamma} (GeV/#it{c}^{2})};#bf{#it{p}_{T}^{#pi^{+}#pi^{-}#gamma#gamma} (GeV/#it{c})}", HistType::kTH2F, {{800, 0.4, 1.2}, {250, 0., 25.}}); + mHistManager.add(Form("Omega/%s/fEta", BeforeAfterString), "Pseudorapidity of HNM candidate;#eta;#bf{#it{N}^{#pi^{+}#pi^{-}#gamma#gamma}}", HistType::kTH1F, {{500, -2, 2}}); + mHistManager.add(Form("Omega/%s/fPhi", BeforeAfterString), "Azimuthal angle of HNM candidate;#phi;#bf{#it{N}^{#pi^{+}#pi^{-}#gamma#gamma}}", HistType::kTH1F, {{720, 0, constants::math::TwoPI}}); + } + if (cfgDoEMCShift.value) { + for (int iSM = 0; iSM < nSMs; iSM++) { + emcEtaShift[iSM] = cfgEMCEtaShift.value[iSM]; + emcPhiShift[iSM] = cfgEMCPhiShift.value[iSM]; + LOG(info) << "SM-wise shift in eta/phi for SM " << iSM << ": " << emcEtaShift[iSM] << " / " << emcPhiShift[iSM]; + } + } + } + + void process(aod::MyCollision const& collision, aod::MyBCs const&, aod::SkimEMCClusters const& clusters, aod::SelectedTracks const& tracks) + { + // clean vecs + pion.clear(); + antipion.clear(); + vHNMs.clear(); + + // ---------------------------------> EMCal event QA <---------------------------------- + // - Fill Event/nEMCalEvents histogram for EMCal event QA + // ------------------------------------------------------------------------------------- + bool bcHasEMCCells = collision.isemcreadout(); + auto foundBC = collision.foundBC_as(); + bool iskTVXinEMC = foundBC.alias_bit(kTVXinEMC); + bool isL0Triggered = foundBC.alias_bit(kEMC7) || foundBC.alias_bit(kDMC7) || foundBC.alias_bit(kEG1) || foundBC.alias_bit(kEG2); + + if (confEvtRequireSel8 && !collision.sel8()) + return; // Skip this collision if sel8 trigger bit is not set + if (confEvtRequirekTVXinEMC && !iskTVXinEMC) + return; // Skip this collision if kTVXinEMC trigger bit is not set + + if (bcHasEMCCells && iskTVXinEMC) + mHistManager.fill(HIST("Event/nEMCalEvents"), 0); + if (bcHasEMCCells && isL0Triggered) + mHistManager.fill(HIST("Event/nEMCalEvents"), 1); + if (bcHasEMCCells && !iskTVXinEMC && !isL0Triggered) + mHistManager.fill(HIST("Event/nEMCalEvents"), 2); + if (!bcHasEMCCells && iskTVXinEMC) + mHistManager.fill(HIST("Event/nEMCalEvents"), 3); + if (!bcHasEMCCells && isL0Triggered) + mHistManager.fill(HIST("Event/nEMCalEvents"), 4); + + mHistManager.fill(HIST("Event/fMultiplicity"), collision.multNTracksPV()); + mHistManager.fill(HIST("Event/fZvtx"), collision.posZ()); + + // --------------------------------> Process Photons <---------------------------------- + // - Slice clusters and V0s by collision ID to get the ones in this collision + // - Store the clusters and V0s in the vGammas vector + // - Reconstruct gamma-gamma pairs + // ------------------------------------------------------------------------------------- + auto clustersInThisCollision = clusters.sliceBy(perCollisionEMC, collision.globalIndex()); + + std::vector vGammas; + hnmutilities::storeGammasInVector(clustersInThisCollision, vGammas, emcEtaShift, emcPhiShift); + hnmutilities::reconstructGGs(vGammas, vGGs); + vGammas.clear(); + + for (unsigned int iGG = 0; iGG < vGGs.size(); iGG++) { + auto lightMeson = &vGGs.at(iGG); + + mHistManager.fill(HIST("GG/invMassVsPt"), lightMeson->m(), lightMeson->pT()); + + if (lightMeson->m() > cfgMassWindowPi0->get("min") && lightMeson->m() < cfgMassWindowPi0->get("max")) { + lightMeson->isPi0 = true; + mHistManager.fill(HIST("GG/invMassVsPt_selected"), lightMeson->m(), lightMeson->pT()); + } else { + vGGs.erase(vGGs.begin() + iGG); + iGG--; + } + } + + // ------------------------------> Loop over all tracks <------------------------------- + // - Fill QA histograms for all tracks and per particle species + // ------------------------------------------------------------------------------------- + for (const auto& track : tracks) { + if (!isSelectedTrack(track)) + continue; // Skip tracks that do not pass the selection criteria + if (track.sign() > 0) { // Positive charge -> Particles + pion.emplace_back(track.pt(), track.eta(), track.phi(), constants::physics::MassPionCharged); + + mHistManager.fill(HIST("TrackCuts/Pion/fPt"), track.pt()); + mHistManager.fill(HIST("TrackCuts/Pion/fEta"), track.eta()); + mHistManager.fill(HIST("TrackCuts/Pion/fPhi"), track.phi()); + + mHistManager.fill(HIST("TrackCuts/Pion/fNsigmaTPCvsP"), track.p(), track.tpcNSigmaPi()); + + mHistManager.fill(HIST("TrackCuts/Pion/fDCAxy"), track.dcaXY()); + mHistManager.fill(HIST("TrackCuts/Pion/fDCAz"), track.dcaZ()); + mHistManager.fill(HIST("TrackCuts/Pion/fTPCsCls"), track.tpcNClsShared()); + mHistManager.fill(HIST("TrackCuts/Pion/fTPCcRows"), track.tpcNClsCrossedRows()); + mHistManager.fill(HIST("TrackCuts/Pion/fTrkTPCfCls"), track.tpcCrossedRowsOverFindableCls()); + mHistManager.fill(HIST("TrackCuts/Pion/fTPCncls"), track.tpcNClsFound()); + } else { // Negative charge -> Anti-particles + antipion.emplace_back(track.pt(), track.eta(), track.phi(), constants::physics::MassPionCharged); + + mHistManager.fill(HIST("TrackCuts/AntiPion/fPt"), track.pt()); + mHistManager.fill(HIST("TrackCuts/AntiPion/fEta"), track.eta()); + mHistManager.fill(HIST("TrackCuts/AntiPion/fPhi"), track.phi()); + + mHistManager.fill(HIST("TrackCuts/AntiPion/fNsigmaTPCvsP"), track.p(), track.tpcNSigmaPi()); + + mHistManager.fill(HIST("TrackCuts/AntiPion/fDCAxy"), track.dcaXY()); + mHistManager.fill(HIST("TrackCuts/AntiPion/fDCAz"), track.dcaZ()); + mHistManager.fill(HIST("TrackCuts/AntiPion/fTPCsCls"), track.tpcNClsShared()); + mHistManager.fill(HIST("TrackCuts/AntiPion/fTPCcRows"), track.tpcNClsCrossedRows()); + mHistManager.fill(HIST("TrackCuts/AntiPion/fTrkTPCfCls"), track.tpcCrossedRowsOverFindableCls()); + mHistManager.fill(HIST("TrackCuts/AntiPion/fTPCncls"), track.tpcNClsFound()); + } + } + + // -------------------------> Reconstruct HNM candidates <------------------------------ + // - Based on the previously filled (anti)pion vectors + // - Fill QA histograms for kinematics of the pions and their combinations + // ------------------------------------------------------------------------------------- + for (const auto& posPion : pion) { + for (const auto& negPion : antipion) { + ROOT::Math::PtEtaPhiMVector vecPiPlPiMi = posPion + negPion; + hnmutilities::reconstructHeavyNeutralMesons(vecPiPlPiMi, vGGs, vHNMs); + + mHistManager.fill(HIST("Omega/Before/PiPlPiMi/fInvMassVsPt"), vecPiPlPiMi.M(), vecPiPlPiMi.pt()); + mHistManager.fill(HIST("Omega/Before/PiPlPiMi/fEta"), vecPiPlPiMi.eta()); + mHistManager.fill(HIST("Omega/Before/PiPlPiMi/fPhi"), RecoDecay::constrainAngle(vecPiPlPiMi.phi())); + } + } + + // ---------------------------> Process HNM candidates <-------------------------------- + // - Fill invMassVsPt histograms separated into HNM types (based on GG mass) and gamma reco method + // ------------------------------------------------------------------------------------- + for (unsigned int iHNM = 0; iHNM < vHNMs.size(); iHNM++) { + auto heavyNeutralMeson = vHNMs.at(iHNM); + float massHNM = heavyNeutralMeson.m(cfgHNMMassCorrection); + + mHistManager.fill(HIST("Omega/Before/fInvMassVsPt"), massHNM, heavyNeutralMeson.pT()); + mHistManager.fill(HIST("Omega/Before/fEta"), heavyNeutralMeson.eta()); + mHistManager.fill(HIST("Omega/Before/fPhi"), RecoDecay::constrainAngle(heavyNeutralMeson.phi())); + + if (heavyNeutralMeson.gg->pT() / heavyNeutralMeson.pT() > cfgMinGGPtOverHNMPt) { + mHistManager.fill(HIST("Omega/After/fInvMassVsPt"), massHNM, heavyNeutralMeson.pT()); + mHistManager.fill(HIST("Omega/After/fEta"), heavyNeutralMeson.eta()); + mHistManager.fill(HIST("Omega/After/fPhi"), RecoDecay::constrainAngle(heavyNeutralMeson.phi())); + } + } + } +}; + +WorkflowSpec defineDataProcessing(o2::framework::ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc, TaskName{"omega-meson-emc"})}; } diff --git a/PWGEM/PhotonMeson/Tasks/emcalBcWiseGammaGamma.cxx b/PWGEM/PhotonMeson/Tasks/emcalBcWiseGammaGamma.cxx index b1ba71397ce..0aacd233324 100644 --- a/PWGEM/PhotonMeson/Tasks/emcalBcWiseGammaGamma.cxx +++ b/PWGEM/PhotonMeson/Tasks/emcalBcWiseGammaGamma.cxx @@ -85,8 +85,8 @@ struct EmcalBcWiseGammaGamma { mHistManager.add("Event/nCollPerBC", "Number of collisions per BC;#bf{#it{N}_{coll}};#bf{FT0M centrality (%)};#bf{#it{N}_{BC}}", HistType::kTH2F, {{5, -0.5, 4.5}, cfgCentralityBinning}); mHistManager.add("Event/Z1VsZ2", "Z vertex positions for BCs with two collisions;#bf{#it{z}_{vtx}^{1} (cm)};#bf{#it{z}_{vtx}^{2} (cm)}", HistType::kTH2F, {{150, -15, 15}, {150, -15, 15}}); mHistManager.add("Event/dZ", "Distance between vertices for BCs with two collisions;#bf{#Delta #it{z}_{vtx} (cm)};#bf{#it{N}_{BC}}", HistType::kTH1F, {{600, -30, 30}}); - mHistManager.add("Event/Mu", "Probablity of a collision in the BC;#bf{#mu};#bf{#it{N}_{BC}}", HistType::kTH1F, {{1000, 0., 0.1}}); - mHistManager.add("Event/TimeSinceSOF", "Time of BC since the start of fill;#bf{t-t_{SOF} (min)};#bf{#it{N}_{BC}}", HistType::kTH1F, {{1200, 0., 600}}); + mHistManager.add("Event/Mu", "Probablity of a collision in the BC;#bf{#mu};#bf{#it{N}_{BC}}", HistType::kTH1F, {{2000, 0., 0.4}}); + mHistManager.add("Event/TimeSinceSOF", "Time of BC since the start of fill;#bf{t-t_{SOF} (min)};#bf{#it{N}_{BC}}", HistType::kTH1F, {{2400, 0., 1200}}); mHistManager.add("Event/Centrality", "FT0M centrality;FT0M centrality (%);#bf{#it{N}_{BC}}", HistType::kTH1F, {cfgCentralityBinning}); mHistManager.add("Event/CentralityVsAmplitude", "FT0M AmplitudeVsCentrality;FT0M Centrality;FT0M Amplitude", HistType::kTH2F, {cfgCentralityBinning, {600, 0, 300000}}); @@ -98,30 +98,30 @@ struct EmcalBcWiseGammaGamma { mHistManager.add("Cluster/Exotic", "Is cluster exotic?;#bf{Exotic?};#bf{FT0M centrality (%)};#bf{#it{N}_{clusters}}", HistType::kTH2F, {{2, -0.5, 1.5}, cfgCentralityBinning}); mHistManager.add("Cluster/EtaPhi", "Eta/Phi distribution of clusters;#eta;#phi;#bf{FT0M centrality (%)};#bf{#it{N}_{clusters}}", HistType::kTH3F, {{400, -0.8, 0.8}, {400, 0, constants::math::TwoPI}, cfgCentralityBinning}); - mHistManager.add("GG/invMassVsPt", "Invariant mass and pT of meson candidates;#bf{#it{M}^{#gamma#gamma} (GeV/#it{c}^{2})};#bf{#it{p}_{T}^{#gamma#gamma} (GeV/#it{c})};#bf{FT0M centrality (%)}", HistType::kTH3F, {{400, 0., 0.8}, {200, 0., 20.}, cfgCentralityBinning}); - mHistManager.add("GG/invMassVsPtBackground", "Invariant mass and pT of background meson candidates;#bf{#it{M}^{#gamma#gamma} (GeV/#it{c}^{2})};#bf{#it{p}_{T}^{#gamma#gamma} (GeV/#it{c})};#bf{FT0M centrality (%)}", HistType::kTH3F, {{400, 0., 0.8}, {200, 0., 20.}, cfgCentralityBinning}); + mHistManager.add("GG/invMassVsPt", "Invariant mass and pT of meson candidates;#bf{#it{M}^{#gamma#gamma} (GeV/#it{c}^{2})};#bf{#it{p}_{T}^{#gamma#gamma} (GeV/#it{c})};#bf{FT0M centrality (%)}", HistType::kTH3F, {{400, 0., 0.8}, {300, 0, 30}, cfgCentralityBinning}); + mHistManager.add("GG/invMassVsPtBackground", "Invariant mass and pT of background meson candidates;#bf{#it{M}^{#gamma#gamma} (GeV/#it{c}^{2})};#bf{#it{p}_{T}^{#gamma#gamma} (GeV/#it{c})};#bf{FT0M centrality (%)}", HistType::kTH3F, {{400, 0., 0.8}, {300, 0, 30}, cfgCentralityBinning}); if (cfgIsMC) { mHistManager.add("True/clusterERecVsETrue", "True vs reconstructed energy of cluster inducing particle;#bf{#it{E}_{rec} (GeV)};#bf{#it{E}_{true}^{cls inducing part} (GeV)};#bf{FT0M centrality (%)}", HistType::kTH3F, {{200, 0, 20}, {200, 0, 20}, cfgCentralityBinning}); - mHistManager.add("True/pi0_PtRecVsPtTrue", "True vs reconstructed pT of true pi0s;#bf{#it{p}_{T}^{rec} (GeV/#it{c})};#bf{#it{p}_{T}^{true} (GeV/#it{c})};#bf{FT0M centrality (%)}", HistType::kTH3F, {{200, 0., 20.}, {200, 0., 20.}, cfgCentralityBinning}); - mHistManager.add("True/pi0_invMassVsPt_Primary", "Reconstructed validated primary pi0;#bf{#it{M}^{#gamma#gamma} (GeV/#it{c}^{2})};#bf{#it{p}_{T}^{#gamma#gamma} (GeV/#it{c})};#bf{FT0M centrality (%)}", HistType::kTH3F, {{400, 0., 0.8}, {200, 0., 20.}, cfgCentralityBinning}); - mHistManager.add("True/pi0_invMassVsPt_Secondary", "Reconstructed validated pi0 from secondary decay;#bf{#it{M}^{#gamma#gamma} (GeV/#it{c}^{2})};#bf{#it{p}_{T}^{#gamma#gamma} (GeV/#it{c})};#bf{FT0M centrality (%)}", HistType::kTH3F, {{400, 0., 0.8}, {200, 0., 20.}, cfgCentralityBinning}); - mHistManager.add("True/pi0_invMassVsPt_HadronicShower", "Reconstructed validated pi0 from hadronic shower;#bf{#it{M}^{#gamma#gamma} (GeV/#it{c}^{2})};#bf{#it{p}_{T}^{#gamma#gamma} (GeV/#it{c})};#bf{FT0M centrality (%)}", HistType::kTH3F, {{400, 0., 0.8}, {200, 0., 20.}, cfgCentralityBinning}); - mHistManager.add("True/eta_PtRecVsPtTrue", "True vs reconstructed pT of true eta meson;#bf{#it{p}_{T}^{rec} (GeV/#it{c})};#bf{#it{p}_{T}^{true} (GeV/#it{c})};#bf{FT0M centrality (%)}", HistType::kTH3F, {{200, 0., 20.}, {200, 0., 20.}, cfgCentralityBinning}); - mHistManager.add("True/eta_invMassVsPt_Primary", "Reconstructed validated primary eta meson;#bf{#it{M}^{#gamma#gamma} (GeV/#it{c}^{2})};#bf{#it{p}_{T}^{#gamma#gamma} (GeV/#it{c})};#bf{FT0M centrality (%)}", HistType::kTH3F, {{400, 0., 0.8}, {200, 0., 20.}, cfgCentralityBinning}); - mHistManager.add("True/eta_invMassVsPt_Secondary", "Reconstructed validated eta meson from secondary decay;#bf{#it{M}^{#gamma#gamma} (GeV/#it{c}^{2})};#bf{#it{p}_{T}^{#gamma#gamma} (GeV/#it{c})};#bf{FT0M centrality (%)}", HistType::kTH3F, {{400, 0., 0.8}, {200, 0., 20.}, cfgCentralityBinning}); - mHistManager.add("True/eta_invMassVsPt_HadronicShower", "Reconstructed validated eta meson from hadronic shower;#bf{#it{M}^{#gamma#gamma} (GeV/#it{c}^{2})};#bf{#it{p}_{T}^{#gamma#gamma} (GeV/#it{c})};#bf{FT0M centrality (%)}", HistType::kTH3F, {{400, 0., 0.8}, {200, 0., 20.}, cfgCentralityBinning}); - - mHistManager.add("Generated/pi0_AllBCs", "pT spectrum of generated pi0s in all BCs;#bf{#it{p}_{T} (GeV/#it{c})};#bf{FT0M centrality (%)};#bf{#it{N}_{#pi^{0}}^{gen}}", HistType::kTH2F, {{200, 0, 20}, cfgCentralityBinning}); - mHistManager.add("Generated/pi0_FT0", "pT spectrum of generated pi0s in BCs with found FT0;#bf{#it{p}_{T} (GeV/#it{c})};#bf{FT0M centrality (%)};#bf{#it{N}_{#pi^{0}}^{gen}}", HistType::kTH2F, {{200, 0, 20}, cfgCentralityBinning}); - mHistManager.add("Generated/pi0_TVX", "pT spectrum of generated pi0s in TVX triggered BCs;#bf{#it{p}_{T} (GeV/#it{c})};#bf{FT0M centrality (%)};#bf{#it{N}_{#pi^{0}}^{gen}}", HistType::kTH2F, {{200, 0, 20}, cfgCentralityBinning}); - mHistManager.add("Generated/pi0_kTVXinEMC", "pT spectrum of generated pi0s in kTVXinEMC triggered BCs;#bf{#it{p}_{T} (GeV/#it{c})};#bf{FT0M centrality (%)};#bf{#it{N}_{#pi^{0}}^{gen}}", HistType::kTH2F, {{200, 0, 20}, cfgCentralityBinning}); - mHistManager.add("Accepted/pi0_kTVXinEMC", "pT spectrum of accepted pi0s in kTVXinEMC triggered BCs;#bf{#it{p}_{T} (GeV/#it{c})};#bf{FT0M centrality (%)};#bf{#it{N}_{#pi^{0}}^{acc}}", HistType::kTH2F, {{200, 0, 20}, cfgCentralityBinning}); - mHistManager.add("Generated/eta_AllBCs", "pT spectrum of generated eta mesons in all BCs;#bf{#it{p}_{T} (GeV/#it{c})};#bf{FT0M centrality (%)};#bf{#it{N}_{#eta}^{gen}}", HistType::kTH2F, {{200, 0, 20}, cfgCentralityBinning}); - mHistManager.add("Generated/eta_FT0", "pT spectrum of generated eta mesons in BCs with found FT0;#bf{#it{p}_{T} (GeV/#it{c})};#bf{FT0M centrality (%)};#bf{#it{N}_{#eta}^{gen}}", HistType::kTH2F, {{200, 0, 20}, cfgCentralityBinning}); - mHistManager.add("Generated/eta_TVX", "pT spectrum of generated eta mesons in TVX triggered BCs;#bf{#it{p}_{T} (GeV/#it{c})};#bf{FT0M centrality (%)};#bf{#it{N}_{#eta}^{gen}}", HistType::kTH2F, {{200, 0, 20}, cfgCentralityBinning}); - mHistManager.add("Generated/eta_kTVXinEMC", "pT spectrum of generated eta mesons in kTVXinEMC triggered BCs;#bf{#it{p}_{T} (GeV/#it{c})};#bf{FT0M centrality (%)};#bf{#it{N}_{#eta}^{gen}}", HistType::kTH2F, {{200, 0, 20}, cfgCentralityBinning}); - mHistManager.add("Accepted/eta_kTVXinEMC", "pT spectrum of accepted eta mesons in kTVXinEMC triggered BCs;#bf{#it{p}_{T} (GeV/#it{c})};#bf{FT0M centrality (%)};#bf{#it{N}_{#eta}^{acc}}", HistType::kTH2F, {{200, 0, 20}, cfgCentralityBinning}); + mHistManager.add("True/pi0_PtRecVsPtTrue", "True vs reconstructed pT of true pi0s;#bf{#it{p}_{T}^{rec} (GeV/#it{c})};#bf{#it{p}_{T}^{true} (GeV/#it{c})};#bf{FT0M centrality (%)}", HistType::kTH3F, {{300, 0, 30}, {300, 0, 30}, cfgCentralityBinning}); + mHistManager.add("True/pi0_invMassVsPt_Primary", "Reconstructed validated primary pi0;#bf{#it{M}^{#gamma#gamma} (GeV/#it{c}^{2})};#bf{#it{p}_{T}^{#gamma#gamma} (GeV/#it{c})};#bf{FT0M centrality (%)}", HistType::kTH3F, {{400, 0., 0.8}, {300, 0, 30}, cfgCentralityBinning}); + mHistManager.add("True/pi0_invMassVsPt_Secondary", "Reconstructed validated pi0 from secondary decay;#bf{#it{M}^{#gamma#gamma} (GeV/#it{c}^{2})};#bf{#it{p}_{T}^{#gamma#gamma} (GeV/#it{c})};#bf{FT0M centrality (%)}", HistType::kTH3F, {{400, 0., 0.8}, {300, 0, 30}, cfgCentralityBinning}); + mHistManager.add("True/pi0_invMassVsPt_HadronicShower", "Reconstructed validated pi0 from hadronic shower;#bf{#it{M}^{#gamma#gamma} (GeV/#it{c}^{2})};#bf{#it{p}_{T}^{#gamma#gamma} (GeV/#it{c})};#bf{FT0M centrality (%)}", HistType::kTH3F, {{400, 0., 0.8}, {300, 0, 30}, cfgCentralityBinning}); + mHistManager.add("True/eta_PtRecVsPtTrue", "True vs reconstructed pT of true eta meson;#bf{#it{p}_{T}^{rec} (GeV/#it{c})};#bf{#it{p}_{T}^{true} (GeV/#it{c})};#bf{FT0M centrality (%)}", HistType::kTH3F, {{300, 0, 30}, {300, 0, 30}, cfgCentralityBinning}); + mHistManager.add("True/eta_invMassVsPt_Primary", "Reconstructed validated primary eta meson;#bf{#it{M}^{#gamma#gamma} (GeV/#it{c}^{2})};#bf{#it{p}_{T}^{#gamma#gamma} (GeV/#it{c})};#bf{FT0M centrality (%)}", HistType::kTH3F, {{400, 0., 0.8}, {300, 0, 30}, cfgCentralityBinning}); + mHistManager.add("True/eta_invMassVsPt_Secondary", "Reconstructed validated eta meson from secondary decay;#bf{#it{M}^{#gamma#gamma} (GeV/#it{c}^{2})};#bf{#it{p}_{T}^{#gamma#gamma} (GeV/#it{c})};#bf{FT0M centrality (%)}", HistType::kTH3F, {{400, 0., 0.8}, {300, 0, 30}, cfgCentralityBinning}); + mHistManager.add("True/eta_invMassVsPt_HadronicShower", "Reconstructed validated eta meson from hadronic shower;#bf{#it{M}^{#gamma#gamma} (GeV/#it{c}^{2})};#bf{#it{p}_{T}^{#gamma#gamma} (GeV/#it{c})};#bf{FT0M centrality (%)}", HistType::kTH3F, {{400, 0., 0.8}, {300, 0, 30}, cfgCentralityBinning}); + + mHistManager.add("Generated/pi0_AllBCs", "pT spectrum of generated pi0s in all BCs;#bf{#it{p}_{T} (GeV/#it{c})};#bf{FT0M centrality (%)};#bf{#it{N}_{#pi^{0}}^{gen}}", HistType::kTH2F, {{300, 0, 30}, cfgCentralityBinning}); + mHistManager.add("Generated/pi0_FT0", "pT spectrum of generated pi0s in BCs with found FT0;#bf{#it{p}_{T} (GeV/#it{c})};#bf{FT0M centrality (%)};#bf{#it{N}_{#pi^{0}}^{gen}}", HistType::kTH2F, {{300, 0, 30}, cfgCentralityBinning}); + mHistManager.add("Generated/pi0_TVX", "pT spectrum of generated pi0s in TVX triggered BCs;#bf{#it{p}_{T} (GeV/#it{c})};#bf{FT0M centrality (%)};#bf{#it{N}_{#pi^{0}}^{gen}}", HistType::kTH2F, {{300, 0, 30}, cfgCentralityBinning}); + mHistManager.add("Generated/pi0_kTVXinEMC", "pT spectrum of generated pi0s in kTVXinEMC triggered BCs;#bf{#it{p}_{T} (GeV/#it{c})};#bf{FT0M centrality (%)};#bf{#it{N}_{#pi^{0}}^{gen}}", HistType::kTH2F, {{300, 0, 30}, cfgCentralityBinning}); + mHistManager.add("Accepted/pi0_kTVXinEMC", "pT spectrum of accepted pi0s in kTVXinEMC triggered BCs;#bf{#it{p}_{T} (GeV/#it{c})};#bf{FT0M centrality (%)};#bf{#it{N}_{#pi^{0}}^{acc}}", HistType::kTH2F, {{300, 0, 30}, cfgCentralityBinning}); + mHistManager.add("Generated/eta_AllBCs", "pT spectrum of generated eta mesons in all BCs;#bf{#it{p}_{T} (GeV/#it{c})};#bf{FT0M centrality (%)};#bf{#it{N}_{#eta}^{gen}}", HistType::kTH2F, {{300, 0, 30}, cfgCentralityBinning}); + mHistManager.add("Generated/eta_FT0", "pT spectrum of generated eta mesons in BCs with found FT0;#bf{#it{p}_{T} (GeV/#it{c})};#bf{FT0M centrality (%)};#bf{#it{N}_{#eta}^{gen}}", HistType::kTH2F, {{300, 0, 30}, cfgCentralityBinning}); + mHistManager.add("Generated/eta_TVX", "pT spectrum of generated eta mesons in TVX triggered BCs;#bf{#it{p}_{T} (GeV/#it{c})};#bf{FT0M centrality (%)};#bf{#it{N}_{#eta}^{gen}}", HistType::kTH2F, {{300, 0, 30}, cfgCentralityBinning}); + mHistManager.add("Generated/eta_kTVXinEMC", "pT spectrum of generated eta mesons in kTVXinEMC triggered BCs;#bf{#it{p}_{T} (GeV/#it{c})};#bf{FT0M centrality (%)};#bf{#it{N}_{#eta}^{gen}}", HistType::kTH2F, {{300, 0, 30}, cfgCentralityBinning}); + mHistManager.add("Accepted/eta_kTVXinEMC", "pT spectrum of accepted eta mesons in kTVXinEMC triggered BCs;#bf{#it{p}_{T} (GeV/#it{c})};#bf{FT0M centrality (%)};#bf{#it{N}_{#eta}^{acc}}", HistType::kTH2F, {{300, 0, 30}, cfgCentralityBinning}); } } diff --git a/PWGEM/PhotonMeson/Utils/HNMUtilities.h b/PWGEM/PhotonMeson/Utils/HNMUtilities.h index bb985686285..80101807641 100644 --- a/PWGEM/PhotonMeson/Utils/HNMUtilities.h +++ b/PWGEM/PhotonMeson/Utils/HNMUtilities.h @@ -158,6 +158,22 @@ void storeGammasInVector(C clusters, V v0s, std::vector& vPhotons, std:: vPhotons.push_back(Photon::fromPxPyPz(v0.px(), v0.py(), v0.pz())); } +/// \brief Store photons from EMC clusters in a vector and possibly add a eta and phi offset for alignment of EMCal clusters +template +void storeGammasInVector(C clusters, std::vector& vPhotons, std::array EMCEtaShift, std::array EMCPhiShift) +{ + vPhotons.clear(); + for (const auto& cluster : clusters) { + float eta = cluster.eta(); + float phi = cluster.phi(); + int smNumber = getSMNumber(eta, phi); + // LOG(info) << "Shifting in sm " << smNumber << ", eta/phi = " << eta << " / " << phi << " to eta/phi = " << eta + EMCEtaShift[getSMNumber(eta, phi)] << " / " << phi + EMCPhiShift[getSMNumber(eta, phi)]; + eta += EMCEtaShift[smNumber]; + phi += EMCPhiShift[smNumber]; + vPhotons.push_back(Photon::fromEtaPhiEnergy(eta, phi, cluster.e())); + } +} + /// \brief Reconstruct light neutral mesons from photons and fill them into the vGGs vector void reconstructGGs(std::vector vPhotons, std::vector& vGGs) { From d1fa639a08440822c4240e8713a9b72b6c415be2 Mon Sep 17 00:00:00 2001 From: Marvin Hemmer <53471402+mhemmer-cern@users.noreply.github.com> Date: Wed, 23 Jul 2025 16:16:26 +0200 Subject: [PATCH 022/345] [PWGJE,EMCAL-1154] Add crosstalk emulation (#11538) --- PWGJE/Core/CMakeLists.txt | 4 +- PWGJE/Core/emcalCrossTalkEmulation.cxx | 604 ++++++++++++++++++++ PWGJE/Core/emcalCrossTalkEmulation.h | 210 +++++++ PWGJE/TableProducer/CMakeLists.txt | 2 +- PWGJE/TableProducer/emcalCorrectionTask.cxx | 116 +++- 5 files changed, 909 insertions(+), 27 deletions(-) create mode 100644 PWGJE/Core/emcalCrossTalkEmulation.cxx create mode 100644 PWGJE/Core/emcalCrossTalkEmulation.h diff --git a/PWGJE/Core/CMakeLists.txt b/PWGJE/Core/CMakeLists.txt index 95895ddc442..7eb4bc8ea97 100644 --- a/PWGJE/Core/CMakeLists.txt +++ b/PWGJE/Core/CMakeLists.txt @@ -14,7 +14,8 @@ o2physics_add_library(PWGJECore SOURCES FastJetUtilities.cxx JetFinder.cxx JetBkgSubUtils.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore FastJet::FastJet FastJet::Contrib ONNXRuntime::ONNXRuntime) + emcalCrossTalkEmulation.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore FastJet::FastJet FastJet::Contrib ONNXRuntime::ONNXRuntime O2::EMCALBase O2::EMCALReconstruction) o2physics_target_root_dictionary(PWGJECore HEADERS JetFinder.h @@ -23,5 +24,6 @@ o2physics_target_root_dictionary(PWGJECore JetTaggingUtilities.h JetBkgSubUtils.h JetDerivedDataUtilities.h + emcalCrossTalkEmulation.h LINKDEF PWGJECoreLinkDef.h) endif() diff --git a/PWGJE/Core/emcalCrossTalkEmulation.cxx b/PWGJE/Core/emcalCrossTalkEmulation.cxx new file mode 100644 index 00000000000..9fe9b679461 --- /dev/null +++ b/PWGJE/Core/emcalCrossTalkEmulation.cxx @@ -0,0 +1,604 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file emcalCrossTalkEmulation.cxx +/// \brief emulation of emcal cross talk for simulations +/// \author Marvin Hemmer , Goethe-University + +#include "emcalCrossTalkEmulation.h" + +#include +#include +#include +#include +#include +#include +#include + +#include // std::find_if +#include +#include // size_t +#include // std::abs +#include // setw +#include // left and right +#include +#include +#include +#include +#include +// #include "Framework/OutputObjHeader.h" + +// #include "Common/CCDB/EventSelectionParams.h" +#include +#include + +#include + +using namespace o2; +using namespace o2::emccrosstalk; +using namespace o2::framework; + +template +auto printArray(std::array const& arr) +{ + std::stringstream ss; + ss << "\n[SM0: " << arr[0]; + for (auto i = 1u; i < N; ++i) { + ss << ", SM" << i << ": " << arr[i]; + } + ss << "]"; + return ss.str(); +} + +template +auto printMatrix(Array2D const& m) +{ + std::stringstream ss; + // Print column headers + ss << std::endl + << std::setw(6) << " " << std::setw(10) << "value1" + << std::setw(10) << "value2" + << std::setw(10) << "value3" + << std::setw(10) << "value4" << std::endl; + + // Print rows with SM labels + for (size_t i = 0; i < m.rows; ++i) { + ss << "SM" << std::left << std::setw(3) << i; // e.g., SM0, SM1... + for (size_t j = 0; j < m.cols; ++j) { + ss << std::right << std::setw(10) << m(i, j); + } + ss << std::endl; + } + + return ss.str(); +} + +void init2DElement(Array2D& matrix, const Array2D& config, const char* name) +{ + int rows = config.rows; + int cols = config.cols; + + if (rows == 0 && cols == 0) { + LOG(info) << name << " has size 0 x 0, so it is disabled!"; + } else if (cols != NNeighbourCases || (rows != 1 && rows != NSM)) { + LOG(error) << name << " must have 4 columns and either 1 or 20 rows!"; + } else { + for (int sm = 0; sm < NSM; ++sm) { + const int row = (rows == 1) ? 0 : sm; + + for (int i = 0; i < cols; ++i) { + matrix[sm][i] = config(row, i); + } + } + } +} + +void init1DElement(std::array& arr, const std::vector& config, const char* name) +{ + size_t confSize = config.size(); + if (confSize == 0) { + LOG(info) << name << " has size 0, so it is disabled!"; + } else if (config.size() != 1 && confSize != NSM) { + LOG(error) << name << " must have either size 1 or 20!"; + } else { + for (int sm = 0; sm < NSM; ++sm) { + const int row = (confSize == 1) ? 0 : sm; + arr[sm] = config[row]; + } + } +} + +o2::framework::AxisSpec axisEnergy = {7000, 0.f, 70.f, "#it{E}_{cell} (GeV)"}; +// For each of the following configurables we will use: +// empty vector == disabled +// vector of size 4 == same for all SM +// vector of vectors with size nSM * 4 == each SM has its own setting +// the 4 values (0-3) correspond to in relative [row,col]: 0: [+-1,0], 1: [+-1,+or-1], 2: [0,+or-1], 3: [+-2, 0 AND +or-1] +// +---+---+-----+---+---+--+--+--+ +// | 3 | 0 | Hit | 0 | 3 | | | | +// +---+---+-----+---+---+--+--+--+ +// | 3 | 1 | 2 | 1 | 3 | | | | +// +---+---+-----+---+---+--+--+--+ + +void EMCCrossTalk::initObjects(const EmcCrossTalkConf& config) +{ + const int run3RunNumber = 223409; + mGeometry = o2::emcal::Geometry::GetInstanceFromRunNumber(run3RunNumber); + if (!mGeometry) { + LOG(error) << "Failure accessing mGeometry"; + } + + // first set the simple run time variables + mTCardCorrClusEnerConserv = config.conserveEnergy.value; + mRandomizeTCard = config.randomizeTCardInducedEnergy.value; + mTCardCorrMinAmp = config.inducedTCardMinimumCellEnergy.value; + mTCardCorrMinInduced = config.inducedTCardMinimum.value; + mTCardCorrMaxInducedELeak = config.inducedTCardMaximumELeak.value; + mTCardCorrMaxInduced = config.inducedTCardMaximum.value; + + // 2nd define the NSM x NNeighbourCases matrices + mTCardCorrInduceEner = Array2D(std::vector(NSM * 4, 0.f), NSM, 4); + mTCardCorrInduceEnerFrac = Array2D(std::vector(NSM * 4, 0.f), NSM, 4); + mTCardCorrInduceEnerFracP1 = Array2D(std::vector(NSM * 4, 0.f), NSM, 4); + mTCardCorrInduceEnerFracWidth = Array2D(std::vector(NSM * 4, 0.f), NSM, 4); + + // now properly init the NSM x NNeighbourCases matrices + // ------------------------------------------------------------------------ + // mTCardCorrInduceEner + init2DElement(mTCardCorrInduceEner, config.inducedEnergyLossConstant.value, "inducedEnergyLossConstant"); + + // mTCardCorrInduceEnerFrac + init2DElement(mTCardCorrInduceEnerFrac, config.inducedEnergyLossFraction.value, "inducedEnergyLossFraction"); + + // mTCardCorrInduceEnerFracP1 + init2DElement(mTCardCorrInduceEnerFracP1, config.inducedEnergyLossFractionP1.value, "inducedEnergyLossFractionP1"); + + // mTCardCorrInduceEnerFracWidth + init2DElement(mTCardCorrInduceEnerFracWidth, config.inducedEnergyLossFractionWidth.value, "inducedEnergyLossFractionWidth"); + // ------------------------------------------------------------------------ + + init1DElement(mTCardCorrInduceEnerFracMax, config.inducedEnergyLossMaximumFraction.value, "inducedEnergyLossMaximumFraction"); + init1DElement(mTCardCorrInduceEnerFracMin, config.inducedEnergyLossMinimumFraction.value, "inducedEnergyLossMinimumFraction"); + init1DElement(mTCardCorrInduceEnerFracMinCentralEta, config.inducedEnergyLossMinimumFractionCentralEta.value, "inducedEnergyLossMinimumFractionCentralEta"); + init1DElement(mTCardCorrInduceEnerProb, config.inducedEnergyLossProbability.value, "inducedEnergyLossProbability"); + + resetArrays(); + + // Print the full matrices and vectors that will be used: + if (config.printConfiguration.value) { + LOGF(info, "inducedEnergyLossConstant: %s", printMatrix((mTCardCorrInduceEner))); + LOGF(info, "inducedEnergyLossFraction: %s", printMatrix((mTCardCorrInduceEnerFrac))); + LOGF(info, "inducedEnergyLossFractionP1: %s", printMatrix((mTCardCorrInduceEnerFracP1))); + LOGF(info, "inducedEnergyLossFractionWidth: %s", printMatrix((mTCardCorrInduceEnerFracWidth))); + LOGF(info, "inducedEnergyLossMaximumFraction: %s", printArray(mTCardCorrInduceEnerFracMax).c_str()); + LOGF(info, "inducedEnergyLossMinimumFraction: %s", printArray(mTCardCorrInduceEnerFracMin).c_str()); + LOGF(info, "inducedEnergyLossMinimumFractionCentralEta: %s", printArray(mTCardCorrInduceEnerFracMinCentralEta).c_str()); + LOGF(info, "inducedEnergyLossProbability: %s", printArray(mTCardCorrInduceEnerProb).c_str()); + } +} + +void EMCCrossTalk::resetArrays() +{ + for (size_t j = 0; j < NCells; j++) { + mTCardCorrCellsEner[j] = 0.; + mTCardCorrCellsNew[j] = false; + } + + mCellsTmp.clear(); +} + +void EMCCrossTalk::setCells(std::vector& cells, std::vector& cellLabels) +{ + mCells = &cells; + mCellsTmp = cells; // a copy since we will need one vector with the changed energies and one with the original ones + mCellLabels = &cellLabels; +} + +void EMCCrossTalk::calculateInducedEnergyInTCardCell(int absId, int absIdRef, int iSM, float ampRef, int cellCase) +{ + // Check that the cell exists + if (absId < 0) { + return; + } + + // Get the fraction + float frac = mTCardCorrInduceEnerFrac[iSM][cellCase] + ampRef * mTCardCorrInduceEnerFracP1[iSM][cellCase]; + + // Use an absolute minimum and maximum fraction if calculated one is out of range + if (frac < mTCardCorrInduceEnerFracMin[iSM]) { + frac = mTCardCorrInduceEnerFracMin[iSM]; + } else if (frac > mTCardCorrInduceEnerFracMax[iSM]) { + frac = mTCardCorrInduceEnerFracMax[iSM]; + } + + // If active, use different absolute minimum fraction for central eta, exclude DCal 2/3 SM + if (mTCardCorrInduceEnerFracMinCentralEta[iSM] > 0 && (iSM < FirstDCal23SM || iSM > LastDCal23SM)) { + // Odd SM + int ietaMin = 32; + int ietaMax = 47; + + // Even SM + if (iSM % 2) { + ietaMin = 0; + ietaMax = 15; + } + + // First get the SM, col-row of this tower + // int imod = -1, iphi =-1, ieta=-1,iTower = -1, iIphi = -1, iIeta = -1; + auto [iSM, iMod, iIphi, iIeta] = mGeometry->GetCellIndex(absId); + auto [iphi, ieta] = mGeometry->GetCellPhiEtaIndexInSModule(iSM, iMod, iIphi, iIeta); + + if (ieta >= ietaMin && ieta <= ietaMax) { + if (frac < mTCardCorrInduceEnerFracMinCentralEta[iSM]) + frac = mTCardCorrInduceEnerFracMinCentralEta[iSM]; + } + } // central eta + + LOGF(debug, "\t fraction %2.3f", frac); + + // Randomize the induced fraction, if requested + if (mRandomizeTCard) { + frac = mRandom.Gaus(frac, mTCardCorrInduceEnerFracWidth[iSM][cellCase]); + LOGF(debug, "\t randomized fraction %2.3f", frac); + } + + // If fraction too small or negative, do nothing else + if (frac < Epsilon) { + return; + } + + // Calculate induced energy + float inducedE = mTCardCorrInduceEner[iSM][cellCase] + ampRef * frac; + + // Check if we induce too much energy, in such case use a constant value + if (mTCardCorrMaxInduced < inducedE) + inducedE = mTCardCorrMaxInduced; + + LOGF(debug, "\t induced E %2.3f", inducedE); + + // Try to find the cell that will get energy induced + float amp = 0.f; + auto itCell = std::find_if((*mCells).begin(), (*mCells).end(), [absId](const o2::emcal::Cell& cell) { + return cell.getTower() == absId; + }); + + if (itCell != (*mCells).end()) { + // We found a cell, so let's get the amplitude of that cell + amp = itCell->getAmplitude(); + } else { + amp = 0.f; // this is a new cell, so the base amp is 0.f + } + + // Check that the induced+amp is large enough to avoid extra linearity effects + // typically of the order of the clusterization cell energy cut + // if inducedTCardMaximumELeak was set to a positive value, then induce the energy as long as its smaller than that value + if ((amp + inducedE) > mTCardCorrMinInduced || inducedE < mTCardCorrMaxInducedELeak) { + mTCardCorrCellsEner[absId] += inducedE; + + // If original energy of cell was null, create new one + if (amp <= Epsilon) { + mTCardCorrCellsNew[absId] = true; + } + } else { + return; + } + + LOGF(debug, "Cell %d is with amplitude %2.3f GeV is inducing %1.3f GeV energy to cell %d which already has %2.3f GeV energy with fraction %1.5f", absIdRef, ampRef, inducedE, absId, amp, frac); + + // Subtract the added energy to main cell, if energy conservation is requested + if (mTCardCorrClusEnerConserv) { + mTCardCorrCellsEner[absIdRef] -= inducedE; + } +} + +void EMCCrossTalk::makeCellTCardCorrelation() +{ + int id = -1; + float amp = -1; + + // Loop on all cells with signal + for (const auto& cell : (*mCells)) { + id = cell.getTower(); + amp = cell.getAmplitude(); + + if (amp <= mTCardCorrMinAmp) { + continue; + } + + // First get the SM, col-row of this tower + auto [iSM, iMod, iIphi, iIeta] = mGeometry->GetCellIndex(id); + auto [iphi, ieta] = mGeometry->GetCellPhiEtaIndexInSModule(iSM, iMod, iIphi, iIeta); + + // Determine randomly if we want to create a correlation for this cell, + // depending the SM number of the cell + if (mTCardCorrInduceEnerProb[iSM] < 1) { + if (mRandom.Uniform(0, 1) > mTCardCorrInduceEnerProb[iSM]) { + continue; + } + } + + LOGF(debug, "Reference cell absId %d, iEta %d, iPhi %d, amp %2.3f", id, ieta, iphi, amp); + + // Get the absId of the cells in the cross and same T-Card + int absIDup = -1; + int absIDdo = -1; + int absIDlr = -1; + int absIDuplr = -1; + int absIDdolr = -1; + + int absIDup2 = -1; + int absIDup2lr = -1; + int absIDdo2 = -1; + int absIDdo2lr = -1; + + // Only 2 columns in the T-Card, +1 for even and -1 for odd with respect reference cell + // Sine we only have full T-Cards, we do not need to make any edge case checks + // There is always either a column (eta direction) below or above + int colShift = +1; + if (ieta % 2) { + colShift = -1; + } + + absIDlr = mGeometry->GetAbsCellIdFromCellIndexes(iSM, iphi, ieta + colShift); + + // Check if up / down cells from reference cell are not out of SM + // First check if there is space one above + if (iphi < emcal::EMCAL_ROWS - 1) { + absIDup = mGeometry->GetAbsCellIdFromCellIndexes(iSM, iphi + 1, ieta); + absIDuplr = mGeometry->GetAbsCellIdFromCellIndexes(iSM, iphi + 1, ieta + colShift); + } + + // 2nd check if there is space one below + if (iphi > 0) { + absIDdo = mGeometry->GetAbsCellIdFromCellIndexes(iSM, iphi - 1, ieta); + absIDdolr = mGeometry->GetAbsCellIdFromCellIndexes(iSM, iphi - 1, ieta + colShift); + } + + // 3rd check if there is space two above + if (iphi < emcal::EMCAL_ROWS - 2) { + absIDup2 = mGeometry->GetAbsCellIdFromCellIndexes(iSM, iphi + 2, ieta); + absIDup2lr = mGeometry->GetAbsCellIdFromCellIndexes(iSM, iphi + 2, ieta + colShift); + } + + // 4th check if there is space two below + if (iphi > 1) { + absIDdo2 = mGeometry->GetAbsCellIdFromCellIndexes(iSM, iphi - 2, ieta); + absIDdo2lr = mGeometry->GetAbsCellIdFromCellIndexes(iSM, iphi - 2, ieta + colShift); + } + + // Check if those cells are in the same T-Card + int tCard = iphi / 8; + if (tCard != (iphi + 1) / 8) { + absIDup = -1; + absIDuplr = -1; + } + if (tCard != (iphi - 1) / 8) { + absIDdo = -1; + absIDdolr = -1; + } + if (tCard != (iphi + 2) / 8) { + absIDup2 = -1; + absIDup2lr = -1; + } + if (tCard != (iphi - 2) / 8) { + absIDdo2 = -1; + absIDdo2lr = -1; + } + + // Calculate induced energy to T-Card cells + // first check if for the given cell case we actually do induce some energy + if (((std::abs(mTCardCorrInduceEner[iSM][0]) > Epsilon) || (std::abs(mTCardCorrInduceEnerFrac[iSM][0]) > Epsilon)) && (std::abs(mTCardCorrInduceEnerFracP1[iSM][0]) > Epsilon) && (std::abs(mTCardCorrInduceEnerFracWidth[iSM][0]) > Epsilon)) { + if (absIDup >= 0) { + LOGF(debug, "cell up %d:", absIDup); + calculateInducedEnergyInTCardCell(absIDup, id, iSM, amp, 0); + } + if (absIDdo >= 0) { + LOGF(debug, "cell down %d:", absIDdo); + calculateInducedEnergyInTCardCell(absIDdo, id, iSM, amp, 0); + } + } + if (((std::abs(mTCardCorrInduceEner[iSM][1]) > Epsilon) || (std::abs(mTCardCorrInduceEnerFrac[iSM][1]) > Epsilon)) && (std::abs(mTCardCorrInduceEnerFracP1[iSM][1]) > Epsilon) && (std::abs(mTCardCorrInduceEnerFracWidth[iSM][1]) > Epsilon)) { + if (absIDuplr >= 0) { + LOGF(debug, "cell up left-right %d:", absIDuplr); + calculateInducedEnergyInTCardCell(absIDuplr, id, iSM, amp, 1); + } + if (absIDdolr >= 0) { + LOGF(debug, "cell down left-right %d:", absIDdolr); + calculateInducedEnergyInTCardCell(absIDdolr, id, iSM, amp, 1); + } + } + if (((std::abs(mTCardCorrInduceEner[iSM][2]) > Epsilon) || (std::abs(mTCardCorrInduceEnerFrac[iSM][2]) > Epsilon)) && (std::abs(mTCardCorrInduceEnerFracP1[iSM][2]) > Epsilon) && (std::abs(mTCardCorrInduceEnerFracWidth[iSM][2]) > Epsilon)) { + if (absIDlr >= 0) { + LOGF(debug, "cell left-right %d:", absIDlr); + calculateInducedEnergyInTCardCell(absIDlr, id, iSM, amp, 2); + } + } + if (((std::abs(mTCardCorrInduceEner[iSM][3]) > Epsilon) || (std::abs(mTCardCorrInduceEnerFrac[iSM][3]) > Epsilon)) && (std::abs(mTCardCorrInduceEnerFracP1[iSM][3]) > Epsilon) && (std::abs(mTCardCorrInduceEnerFracWidth[iSM][3]) > Epsilon)) { + if (absIDup2 >= 0) { + LOGF(debug, "cell up 2nd row %d:", absIDup2); + calculateInducedEnergyInTCardCell(absIDup2, id, iSM, amp, 3); + } + if (absIDdo2 >= 0) { + LOGF(debug, "cell down 2nd row %d:", absIDdo2); + calculateInducedEnergyInTCardCell(absIDdo2, id, iSM, amp, 3); + } + if (absIDup2lr >= 0) { + LOGF(debug, "cell up left-right 2nd row %d:", absIDup2lr); + calculateInducedEnergyInTCardCell(absIDup2lr, id, iSM, amp, 3); + } + if (absIDdo2lr >= 0) { + LOGF(debug, "cell down left-right 2nd row %d:", absIDdo2lr); + calculateInducedEnergyInTCardCell(absIDdo2lr, id, iSM, amp, 3); + } + } + } // cell loop +} + +void EMCCrossTalk::addInducedEnergiesToExistingCells() +{ + // Add the induced energy to the cells and copy them into a new temporal container + // used in AddInducedEnergiesToNewCells() to refill the default cells list fCaloCells + // Create the data member only once. Done here, not sure where to do this properly in the framework. + + for (auto& cell : mCellsTmp) { // o2-linter: disable=const-ref-in-for-loop (we are changing a value here) + float amp = cell.getAmplitude() + mTCardCorrCellsEner[cell.getTower()]; + // Set new amplitude in new temporal container + cell.setAmplitude(amp); + } +} + +void EMCCrossTalk::addInducedEnergiesToNewCells() +{ + // count how many new cells + size_t nCells = (*mCells).size(); + int nCellsNew = 0; + for (size_t j = 0; j < NCells; j++) { + // Newly created? + if (!mTCardCorrCellsNew[j]) { + continue; + } + // Accept only if at least 10 MeV + if (mTCardCorrCellsEner[j] < MinCellEnergy) { + continue; + } + nCellsNew++; + } + + // reserve more space for new cell entries in original cells and celllabels + (*mCells).reserve(nCells + nCellsNew); + (*mCellLabels).reserve(nCells + nCellsNew); + + // change the amplitude of the original cells using + for (size_t iCell = 0; iCell < mCellsTmp.size(); ++iCell) { + (*mCells)[iCell].setAmplitude(mCellsTmp[iCell].getAmplitude()); + } + + // Add the new cells + int absId = -1; + float amp = -1; + float time = 0; + std::vector mclabel; + + for (size_t j = 0; j < NCells; j++) { + // Newly created? + if (!mTCardCorrCellsNew[j]) { + continue; + } + + // Accept only if at least 10 MeV + if (mTCardCorrCellsEner[j] < MinCellEnergy) { + continue; + } + + // Add new cell + absId = j; + amp = mTCardCorrCellsEner[j]; + time = 615.e-9f; + mclabel = {-1}; + + // Assign as MC label the label of the neighboring cell with highest energy + // within the same T-Card. Follow same approach for time. + // Simplest assumption, not fully correct. + // Still assign 0 as fraction of energy. + + // First get the iphi and ieta of this tower + auto [iSM, iMod, iIphi, iIeta] = mGeometry->GetCellIndex(absId); + auto [iphi, ieta] = mGeometry->GetCellPhiEtaIndexInSModule(iSM, iMod, iIphi, iIeta); + + LOGF(debug, "Trying to add cell %d \t ieta = %d\t iphi = %d\t amplitude = %1.3f", absId, ieta, iphi, amp); + + // Loop on the nearest cells around, check the highest energy one, + // and assign its MC label and the time + float ampMax = 0.f; + for (int ietai = ieta - 1; ietai <= ieta + 1; ++ietai) { + for (int iphii = iphi - 1; iphii <= iphi + 1; ++iphii) { + + // Avoid same cell + if (iphii == iphi && ietai == ieta) { + continue; + } + + // Avoid cells out of SM + if (ietai < 0 || ietai >= emcal::EMCAL_COLS || iphii < 0 || iphii >= emcal::EMCAL_ROWS) { + continue; + } + + int absIDi = mGeometry->GetAbsCellIdFromCellIndexes(iSM, iphii, ietai); + // Try to find the cell that will get energy induced + float ampi = 0.f; + size_t indexInCells = 0; + auto itCell = std::find_if((*mCells).begin(), (*mCells).begin() + nCells, [absIDi](const o2::emcal::Cell& cell) { + return cell.getTower() == absIDi; + }); + + if (itCell != (*mCells).begin() + nCells) { + // We found a cell, so let's get the amplitude of that cell + ampi = itCell->getAmplitude(); + if (ampi <= ampMax) { + continue; // early continue if the new amplitude is not the biggest one + } + indexInCells = std::distance((*mCells).begin(), itCell); + LOGF(debug, "Found cell with index %d", indexInCells); + } else { + continue; + } + + // Remove cells with no energy + if (ampi <= MinCellEnergy) { + continue; + } + + // Only same TCard + if (!std::get<0>(mGeometry->areAbsIDsFromSameTCard(absId, absIDi))) { + continue; + } + + std::vector mclabeli = {(*mCellLabels)[indexInCells].GetLeadingMCLabel()}; + float timei = (*mCells)[indexInCells].getTimeStamp(); + + ampMax = ampi; + mclabel = mclabeli; + time = timei; + } // loop phi + } // loop eta + // End Assign MC label + LOGF(debug, "Final ampMax %1.2f\n", ampMax); + LOGF(debug, "--- End : Added cell ID %d, ieta %d, iphi %d, E %1.3f, time %1.3e, mc label %d\n", absId, ieta, iphi, amp, time, mclabel[0]); + + // Add the new cell + (*mCells).emplace_back(absId, amp, time, o2::emcal::intToChannelType(1)); + (*mCellLabels).emplace_back(std::vector{mclabel[0]}, std::vector{0.f}); + } // loop over cells +} + +bool EMCCrossTalk::run() +{ + // START PROCESSING + // Test if cells present + if ((*mCells).size() == 0) { + LOGF(error, "No EMCAL cells found, exiting EMCCrossTalk::run()!"); + return false; + } + + // CELL CROSSTALK EMULATION + // Compute the induced cell energies by T-Card correlation emulation, ONLY MC + makeCellTCardCorrelation(); + + // Add to existing cells the found induced energies in MakeCellTCardCorrelation() if new signal is larger than 10 MeV. + addInducedEnergiesToExistingCells(); + + // Add new cells with found induced energies in MakeCellTCardCorrelation() if new signal is larger than 10 MeV. + addInducedEnergiesToNewCells(); + + resetArrays(); + + return true; +} diff --git a/PWGJE/Core/emcalCrossTalkEmulation.h b/PWGJE/Core/emcalCrossTalkEmulation.h new file mode 100644 index 00000000000..7d83b95d19e --- /dev/null +++ b/PWGJE/Core/emcalCrossTalkEmulation.h @@ -0,0 +1,210 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file emcalCrossTalkEmulation.h +/// \brief emulation of emcal cross talk for simulations +/// \author Marvin Hemmer , Goethe-University + +#ifndef PWGJE_CORE_EMCALCROSSTALKEMULATION_H_ +#define PWGJE_CORE_EMCALCROSSTALKEMULATION_H_ + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +namespace o2::emccrosstalk +{ +// cell types for enegery induction +enum InductionCellType { + UpDown = 0, + UpDownLeftRight, + LeftRight, + Up2Down2, + NInductionCellType +}; + +// default values for cross talk emulation +// small value to use for comarison equal to 0, std::abs(x) > epsilon +static constexpr float Epsilon = 1e-6f; + +// default for inducedEnergyLossConstant +// static constexpr float DefaultIELC[1][4] = {{0.02f, 0.02f, 0.02f, 0.f}}; // default from https://github.com/alisw/AliPhysics/blob/master/PWG/EMCAL/config/AliEmcalCorrectionConfiguration.yaml (but is deactivated per default) +static constexpr float DefaultIELC[1][4] = {{0.f, 0.f, 0.f, 0.f}}; // default from pp 13 TeV + +// default for inducedEnergyLossFraction, default from https://github.com/alisw/AliPhysics/blob/master/PWG/EMCAL/config/AliEmcalCorrectionConfiguration.yaml same as in https://cds.cern.ch/record/2910556/ +static constexpr float DefaultIELF[20][4] = {{1.15e-02, 1.15e-02, 1.15e-02, 0.f}, + {1.20e-02, 1.20e-02, 1.20e-02, 0.f}, + {1.15e-02, 1.15e-02, 1.15e-02, 0.f}, + {1.20e-02, 1.20e-02, 1.20e-02, 0.f}, + {1.15e-02, 1.15e-02, 1.15e-02, 0.f}, + {1.15e-02, 1.15e-02, 1.15e-02, 0.f}, + {1.15e-02, 1.15e-02, 1.15e-02, 0.f}, + {1.20e-02, 1.20e-02, 1.20e-02, 0.f}, + {0.80e-02, 0.80e-02, 0.80e-02, 0.f}, + {0.80e-02, 0.80e-02, 0.80e-02, 0.f}, + {1.20e-02, 1.20e-02, 1.20e-02, 0.f}, + {1.15e-02, 1.15e-02, 1.15e-02, 0.f}, + {1.15e-02, 1.15e-02, 1.15e-02, 0.f}, + {1.15e-02, 1.15e-02, 1.15e-02, 0.f}, + {0.80e-02, 0.80e-02, 0.80e-02, 0.f}, + {0.80e-02, 0.80e-02, 0.80e-02, 0.f}, + {1.15e-02, 1.15e-02, 1.15e-02, 0.f}, + {0.80e-02, 0.80e-02, 0.80e-02, 0.f}, + {0.80e-02, 0.80e-02, 0.80e-02, 0.f}, + {0.80e-02, 0.80e-02, 0.80e-02, 0.f}}; + +// default for inducedEnergyLossFractionP1, default from https://github.com/alisw/AliPhysics/blob/master/PWG/EMCAL/config/AliEmcalCorrectionConfiguration.yaml same as in https://cds.cern.ch/record/2910556/ +static constexpr float DefaultIELFP1[1][4] = {{-1.1e-03, -1.1e-03, -1.1e-03, 0.f}}; + +// default for inducedEnergyLossFractionWidth, default from https://github.com/alisw/AliPhysics/blob/master/PWG/EMCAL/config/AliEmcalCorrectionConfiguration.yaml same as in https://cds.cern.ch/record/2910556/ +static constexpr float DefaultIELFWidth[1][4] = {{5.0e-03, 5.0e-03, 5.0e-03, 0.f}}; + +// default for inducedEnergyLossMinimumFractionCentralEta, IF someone wants to try it. This is purely to document those test numbers from AliEmcalCorrectionConfiguration.yaml! Default is to not use this! Values from default from https://github.com/alisw/AliPhysics/blob/master/PWG/EMCAL/config/AliEmcalCorrectionConfiguration.yaml +// std::vector DefaultIELMFCE = {6.8e-3, 7.5e-3, 6.8e-3, 9.0e-3, 6.8e-3, 6.8e-3, 6.8e-3, 9.0e-3, 5.2e-3, 5.2e-3, 7.5e-3, 6.8e-3, 6.8e-3, 6.8e-3, 5.2e-3, 5.2e-3, 6.8e-3, 5.2e-3, 5.2e-3, 5.2e-3}; + +struct EmcCrossTalkConf : o2::framework::ConfigurableGroup { + std::string prefix = "emccrosstalk"; + o2::framework::Configurable enableCrossTalk{"enableCrossTalk", false, "Flag to enable cross talk emulation. This should only ever be used for MC!"}; + o2::framework::Configurable createHistograms{"createHistograms", false, "Flag to enable QA histograms."}; + o2::framework::Configurable printConfiguration{"printConfiguration", true, "Flag to print the configuration after initialization."}; + o2::framework::Configurable conserveEnergy{"conserveEnergy", true, "Flag to enable cluster energy conservation."}; + o2::framework::Configurable randomizeTCardInducedEnergy{"randomizeTCardInducedEnergy", true, "Flag to randomize the energy fraction induced by the TCard."}; + o2::framework::Configurable inducedTCardMinimumCellEnergy{"inducedTCardMinimumCellEnergy", 0.01f, "Minimum cell energy in GeV induced by the TCard."}; + o2::framework::Configurable inducedTCardMaximum{"inducedTCardMaximum", 100.f, "Maximum energy in GeV induced by the TCard."}; + o2::framework::Configurable inducedTCardMinimum{"inducedTCardMinimum", 0.1f, "Minimum energy in GeV induced by the TCard + cell energy, IMPORTANT use the same value as the clusterization cell E threshold or not too far from it."}; + o2::framework::Configurable inducedTCardMaximumELeak{"inducedTCardMaximumELeak", 0.f, "Maximum energy in GeV that is going to be leaked independently of what is set with inducedTCardMinimum."}; + // For each of the following Array2D configurables we will use: + // empty vector == disabled + // vector of size 4 == same for all SM + // vector of vectors with size nSM * 4 == each SM has its own setting + // the 4 values (0-3) correspond to in relative [row,col]: 0: [+-1,0], 1: [+-1,+or-1], 2: [0,+or-1], 3: [+-2, 0 AND +or-1] + // +---+---+-----+---+---+--+--+--+ + // | 3 | 0 | Hit | 0 | 3 | | | | + // +---+---+-----+---+---+--+--+--+ + // | 3 | 1 | 2 | 1 | 3 | | | | + // +---+---+-----+---+---+--+--+--+ + // For the std::vector it is similar, empty vector means not used, single value means one value for all SM and 20 values means specifiyng a value for all SM + o2::framework::Configurable> inducedEnergyLossConstant{"inducedEnergyLossConstant", {DefaultIELC[0], 1, 4}, "Constant energy lost by max energy cell in one of T-Card cells. Empty vector == disabled, size 4 vector == enabled. For information on the exact formatting please check the header file."}; + o2::framework::Configurable> inducedEnergyLossFraction{"inducedEnergyLossFraction", {DefaultIELF[0], 20, 4}, "Fraction of energy lost by max energy cell in one of T-Card cells."}; + o2::framework::Configurable> inducedEnergyLossFractionP1{"inducedEnergyLossFractionP1", {DefaultIELFP1[0], 1, 4}, "Slope parameter of fraction of energy lost by max energy cell in one of T-Card cells."}; + o2::framework::Configurable> inducedEnergyLossFractionWidth{"inducedEnergyLossFractionWidth", {DefaultIELFWidth[0], 1, 4}, "Fraction of energy lost by max energy cell in one of T-Card cells, width of random gaussian."}; + // default from https://github.com/alisw/AliPhysics/blob/master/PWG/EMCAL/config/AliEmcalCorrectionConfiguration.yaml : + // o2::framework::Configurable> inducedEnergyLossMinimumFraction{"inducedEnergyLossMinimumFraction", {3.5e-3f, 5.0e-3f, 4.5e-3f, 6.0e-3f, 3.5e-3f, 3.5e-3f, 3.5e-3f, 6.0e-3f, 3.5e-3f, 3.5e-3f, 5.0e-3f, 5.0e-3f, 3.5e-3f, 3.5e-3f, 3.5e-3f, 3.5e-3f, 3.5e-3f, 3.5e-3f, 3.5e-3f, 3.5e-3f}, "Minimum induced energy fraction when linear dependency is set."}; + // value from https://cds.cern.ch/record/2910556/: + o2::framework::Configurable> inducedEnergyLossMinimumFraction{"inducedEnergyLossMinimumFraction", {2.35e-3f, 2.5e-3f, 2.35e-3f, 3.0e-3f, 2.35e-3f, 2.35e-3f, 2.35e-3f, 3.0e-3f, 1.75e-3f, 1.75e-3f, 2.5e-3f, 2.35e-3f, 2.35e-3f, 2.35e-3f, 1.75e-3f, 1.75e-3f, 2.35e-3f, 1.75e-3f, 1.75e-3f, 1.75e-3f}, "Minimum induced energy fraction when linear dependency is set."}; + + o2::framework::Configurable> inducedEnergyLossMinimumFractionCentralEta{"inducedEnergyLossMinimumFractionCentralEta", {}, "Minimum induced energy fraction when linear dependency is set. For |eta| < 0.22, if empty no difference in eta. NOT TUNED for TESTING!"}; + + // default from https://github.com/alisw/AliPhysics/blob/master/PWG/EMCAL/config/AliEmcalCorrectionConfiguration.yaml : + // o2::framework::Configurable> inducedEnergyLossMaximumFraction{"inducedEnergyLossMaximumFraction", {0.018f}, "Maximum induced energy fraction when linear dependency is set."}; + // value from https://cds.cern.ch/record/2910556/: + o2::framework::Configurable> inducedEnergyLossMaximumFraction{"inducedEnergyLossMaximumFraction", {0.016f, 0.016f, 0.016f, 0.018f, 0.016f, 0.016f, 0.016f, 0.018f, 0.016f, 0.016f, 0.016f, 0.016f, 0.016f, 0.016f, 0.016f, 0.016f, 0.016f, 0.016f, 0.016f, 0.016f}, "Maximum induced energy fraction when linear dependency is set."}; + o2::framework::Configurable> inducedEnergyLossProbability{"inducedEnergyLossProbability", {1.0f}, "Fraction of times max cell energy correlates with cross cells."}; +}; + +static constexpr int NSM = 20; // Number of Supermodules (12 for EMCal + 8 for DCal) +static constexpr int NCells = 17664; // Number of cells in the EMCal +static constexpr int NNeighbourCases = 4; // 0-same row, diff col, 1-up/down cells left/right col 2-left/righ col, and 2nd row cells +static constexpr int FirstDCal23SM = 12; // index of the first 2/3 DCal SM +static constexpr int LastDCal23SM = 17; // index of the last 2/3 DCal SM +static constexpr float MinCellEnergy = 0.01f; // Minimum energy a new cell needs to be added + +// these labels are for later once labeledArrays work on hyperloop. Currently they sadly only allow fixed size not variable size. +// static const std::vector labelsSM{"SM0/all", "SM1", "SM2", "SM3", "SM4", "SM5", "SM6", "SM7", "SM8", "SM9", "SM10", "SM11", "SM12", "SM13", "SM14", "SM15", "SM16", "SM17", "SM18", "SM19"}; +// static const std::vector labelsCells = {"Up&Down", "Up&Down x Left|Right", "Left|Right", "2Up&Down + 2Up&Down xLeft|Right"}; + +class EMCCrossTalk +{ + + public: + ~EMCCrossTalk() + { + LOG(info) << "Destroying EMCCrossTalk"; + } + + /// \brief Basic init function. + /// \param config configurable group containing the config for the cross talk emulation + void initObjects(const EmcCrossTalkConf& config); + + /// \brief Reset arrays containing information for all possible cells. + /// \details mTCardCorrCellsEner and mTCardCorrCellsNew + void resetArrays(); + + /// \brief Sets the pointer the current vector of cells. + /// \param cells pointer to emcal cells of the current event + /// \param cellLabels pointer to emcal cell labels of the current event + void setCells(std::vector& cells, std::vector& cellLabels); + + /// \brief Main function to call later to perform the full cross talk emulation + /// \return flag if everything went well or not + bool run(); + + /// \brief Recover each cell amplitude and absId and induce energy in cells in cross of the same T-Card + void makeCellTCardCorrelation(); + + /// \brief Add to existing cells the found induced energies in makeCellTCardCorrelation() if new signal is larger than 10 MeV. + /// \details Need to destroy/create the default cells list and do a copy from the old to the new via a temporal array fAODCellsTmp. Not too nice or fast, but it works. + void addInducedEnergiesToExistingCells(); + + /// \brief Add new cells with found induced energies in makeCellTCardCorrelation() if new signal is larger than 10 MeV. + void addInducedEnergiesToNewCells(); + + /// \brief Calculate the induced energy in a cell belonging to thesame T-Card as the reference cell. Used in makeCellTCardCorrelation() + /// \param absId Id number of cell in same T-Card as reference cell + /// \param absIdRef Id number of reference cell + /// \param iSM Supermodule number of cell + /// \param ampRef Amplitude of the reference cell + /// \param cellCase Type of cell with respect reference cell 0: up or down, 1: up or down on the diagonal, 2: left or right, 3: 2nd row up/down both left/right + void calculateInducedEnergyInTCardCell(int absId, int absIdRef, int iSM, float ampRef, int cellCase); + + private: + // T-Card correlation emulation, do on MC + bool mTCardCorrClusEnerConserv; // When making correlation, subtract from the reference cell the induced energy on the neighbour cells + std::array mTCardCorrCellsEner; // Array with induced cell energy in T-Card neighbour cells + std::array mTCardCorrCellsNew; // Array with induced cell energy in T-Card neighbour cells, that before had no signal + + o2::framework::Array2D mTCardCorrInduceEner; // Induced energy loss gauss constant on 0-same row, diff col, 1-up/down cells left/right col 2-left/righ col, and 2nd row cells, param 0 + o2::framework::Array2D mTCardCorrInduceEnerFrac; // Induced energy loss gauss fraction param0 on 0-same row, diff col, 1-up/down cells left/right col 2-left/righ col, and 2nd row cells, param 0 + o2::framework::Array2D mTCardCorrInduceEnerFracP1; // Induced energy loss gauss fraction param1 on 0-same row, diff col, 1-up/down cells left/right col 2-left/righ col, and 2nd row cells, param1 + o2::framework::Array2D mTCardCorrInduceEnerFracWidth; // Induced energy loss gauss witdth on 0-same row, diff col, 1-up/down cells left/right col 2-left/righ col, and 2nd row cells + std::array mTCardCorrInduceEnerFracMax; // In case fTCardCorrInduceEnerFracP1 is non null, restrict the maximum fraction of induced energy per SM + std::array mTCardCorrInduceEnerFracMin; // In case fTCardCorrInduceEnerFracP1 is non null, restrict the minimum fraction of induced energy per SM + std::array mTCardCorrInduceEnerFracMinCentralEta; // In case fTCardCorrInduceEnerFracP1 is non null, restrict the minimum fraction of induced energy per SM. Different at central |eta| < 0.22 + std::array mTCardCorrInduceEnerProb; // Probability to induce energy loss per SM + + TRandom3 mRandom; // Random generator + bool mRandomizeTCard; // Use random induced energy + + float mTCardCorrMinAmp; // Minimum cell energy to induce signal on adjacent cells + float mTCardCorrMinInduced; // Minimum induced energy signal on adjacent cells, sum of induced plus original energy, use same as cell energy clusterization cut + float mTCardCorrMaxInducedELeak; // Maximum value of induced energy signal that is always leaked, ~5-10 MeV + float mTCardCorrMaxInduced; // Maximum induced energy signal on adjacent cells + + std::vector* mCells = nullptr; // Pointer to the original cells of the current event + std::vector* mCellLabels = nullptr; // Pointer to the original cell labels of the current event + std::vector mCellsTmp; // Temporal vector of cells (copy) + + o2::emcal::Geometry* mGeometry; // EMCal geometry +}; + +} // namespace o2::emccrosstalk + +#endif // PWGJE_CORE_EMCALCROSSTALKEMULATION_H_ diff --git a/PWGJE/TableProducer/CMakeLists.txt b/PWGJE/TableProducer/CMakeLists.txt index 31e50dab3cf..4644106c740 100644 --- a/PWGJE/TableProducer/CMakeLists.txt +++ b/PWGJE/TableProducer/CMakeLists.txt @@ -93,7 +93,7 @@ endif() o2physics_add_dpl_workflow(emcal-correction-task SOURCES emcalCorrectionTask.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsBase O2::EMCALBase O2::EMCALReconstruction O2::EMCALCalibration + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsBase O2::EMCALBase O2::EMCALReconstruction O2::EMCALCalibration O2Physics::PWGJECore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(emcal-matchedtracks-writer diff --git a/PWGJE/TableProducer/emcalCorrectionTask.cxx b/PWGJE/TableProducer/emcalCorrectionTask.cxx index 06084023eaa..33efa53dad7 100644 --- a/PWGJE/TableProducer/emcalCorrectionTask.cxx +++ b/PWGJE/TableProducer/emcalCorrectionTask.cxx @@ -19,6 +19,7 @@ /// #include "PWGJE/Core/JetUtilities.h" +#include "PWGJE/Core/emcalCrossTalkEmulation.h" #include "PWGJE/DataModel/EMCALClusterDefinition.h" #include "PWGJE/DataModel/EMCALClusters.h" #include "PWGJE/DataModel/EMCALMatchedCollisions.h" @@ -26,38 +27,42 @@ #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "CCDB/BasicCCDBManager.h" -#include "DataFormatsEMCAL/AnalysisCluster.h" -#include "DataFormatsEMCAL/Cell.h" -#include "DataFormatsEMCAL/CellLabel.h" -#include "DataFormatsEMCAL/Constants.h" -#include "DetectorsBase/GeometryManager.h" -#include "EMCALBase/ClusterFactory.h" -#include "EMCALBase/Geometry.h" -#include "EMCALBase/NonlinearityHandler.h" -#include "EMCALCalib/GainCalibrationFactors.h" -#include "EMCALCalibration/EMCALTempCalibExtractor.h" -#include "EMCALReconstruction/Clusterizer.h" -#include "Framework/ASoA.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" +#include +#include +#include +#include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include +#include #include +#include #include #include #include -#include +#include #include -#include "TVector2.h" #include +#include + +#include #include #include #include #include +#include #include #include #include @@ -70,6 +75,7 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; +using namespace o2::emccrosstalk; using MyGlobTracks = o2::soa::Join; using BcEvSels = o2::soa::Join; using CollEventSels = o2::soa::Join; @@ -122,6 +128,12 @@ struct EmcalCorrectionTask { Configurable mcCellEnergyResolutionBroadening{"mcCellEnergyResolutionBroadening", 0., "Relative widening of the MC cell energy resolution. 0 for no widening, 0.1 for 10% widening, etc. Only applied to MC."}; Configurable applyGainCalibShift{"applyGainCalibShift", false, "Apply shift for cell gain calibration to use values before cell format change (Sept. 2023)"}; + // cross talk emulation configs + EmcCrossTalkConf emcCrossTalkConf; + + // cross talk emulation class for handling the cross talk + emccrosstalk::EMCCrossTalk emcCrossTalk; + // Require EMCAL cells (CALO type 1) Filter emccellfilter = aod::calo::caloType == selectedCellType; @@ -162,6 +174,8 @@ struct EmcalCorrectionTask { // Current run number int runNumber{0}; + static constexpr float TrackNotOnEMCal = -900.f; + void init(InitContext const&) { LOG(debug) << "Start init!"; @@ -239,12 +253,15 @@ struct EmcalCorrectionTask { // Define the cell energy binning std::vector cellEnergyBins; - for (int i = 0; i < 51; i++) + for (int i = 0; i < 51; i++) { // o2-linter: disable=magic-number (just numbers for binning) cellEnergyBins.emplace_back(0.1 * (i - 0) + 0.0); // from 0 to 5 GeV/c, every 0.1 GeV - for (int i = 51; i < 76; i++) + } + for (int i = 51; i < 76; i++) { // o2-linter: disable=magic-number (just numbers for binning) cellEnergyBins.emplace_back(0.2 * (i - 51) + 5.2); // from 5.2 to 10.0 GeV, every 0.2 GeV - for (int i = 76; i < 166; i++) + } + for (int i = 76; i < 166; i++) { // o2-linter: disable=magic-number (just numbers for binning) cellEnergyBins.emplace_back(1. * (i - 76) + 11.); // from 11.0 to 100. GeV, every 1 GeV + } // Setup QA hists. // NOTE: This is not comprehensive. @@ -257,7 +274,8 @@ struct EmcalCorrectionTask { fCrossAxis{100, 0., 1., "F_{+}"}, sigmaLongAxis{100, 0., 1.0, "#sigma^{2}_{long}"}, sigmaShortAxis{100, 0., 1.0, "#sigma^{2}_{short}"}, - nCellAxis{60, -0.5, 59.5, "#it{n}_{cells}"}; + nCellAxis{60, -0.5, 59.5, "#it{n}_{cells}"}, + energyDenseAxis = {7000, 0.f, 70.f, "#it{E}_{cell} (GeV)"}; mHistManager.add("hCellE", "hCellE", O2HistType::kTH1D, {energyAxis}); mHistManager.add("hCellTowerID", "hCellTowerID", O2HistType::kTH1D, {{20000, 0, 20000}}); mHistManager.add("hCellEtaPhi", "hCellEtaPhi", O2HistType::kTH2F, {etaAxis, phiAxis}); @@ -310,6 +328,14 @@ struct EmcalCorrectionTask { mHistManager.add("hClusterFCrossSigmaShortE", "hClusterFCrossSigmaShortE", O2HistType::kTH3F, {energyAxis, fCrossAxis, sigmaShortAxis}); } + if (isMC.value && emcCrossTalkConf.enableCrossTalk.value) { + emcCrossTalk.initObjects(emcCrossTalkConf); + if (emcCrossTalkConf.createHistograms.value) { + mHistManager.add("hCellEnergyDistBefore", "Cell energy before cross-talk emulation", {o2::framework::HistType::kTH1D, {energyDenseAxis}}); + mHistManager.add("hCellEnergyDistAfter", "Cell energy after cross-talk emulation", {o2::framework::HistType::kTH1D, {energyDenseAxis}}); + } + } + // For some runs, LG cells require an extra time shift of 2 * 8.8ns due to problems in the time calibration // Affected run ranges (inclusive) are initialised here (min,max) mExtraTimeShiftRunRanges.emplace_back(535365, 535645); // LHC23g-LHC23h @@ -500,6 +526,13 @@ struct EmcalCorrectionTask { mHistManager.fill(HIST("hContributors"), cell.mcParticle_as().size()); auto cellParticles = cell.mcParticle_as(); for (const auto& cellparticle : cellParticles) { + const auto& ids = cell.mcParticleIds(); + const auto& amps = cell.amplitudeA(); + + if (ids.empty() || amps.empty()) { + LOGF(warning, "Skipping cell with empty MC info: absId=%d", cell.cellNumber()); + continue; + } mHistManager.fill(HIST("hMCParticleEnergy"), cellparticle.e()); } auto amplitude = cell.amplitude(); @@ -517,7 +550,39 @@ struct EmcalCorrectionTask { cell.time() + getCellTimeShift(cell.cellNumber(), amplitude, o2::emcal::intToChannelType(cell.cellType()), runNumber), o2::emcal::intToChannelType(cell.cellType())); cellIndicesBC.emplace_back(cell.globalIndex()); - cellLabels.emplace_back(cell.mcParticleIds(), cell.amplitudeA()); + cellLabels.emplace_back(std::vector{cell.mcParticleIds().begin(), cell.mcParticleIds().end()}, std::vector{cell.amplitudeA().begin(), cell.amplitudeA().end()}); + } + if (isMC.value && emcCrossTalkConf.enableCrossTalk.value) { + if (emcCrossTalkConf.createHistograms.value) { + for (const auto& cell : cellsBC) { + mHistManager.fill(HIST("hCellEnergyDistBefore"), cell.getAmplitude()); + } + } + emcCrossTalk.setCells(cellsBC, cellLabels); + bool isOkCrossTalk = emcCrossTalk.run(); + if (!isOkCrossTalk) { + LOG(info) << "Cross talk emulation failed!"; + } else { + // When we get new cells we also need to add additional entries into cellIndicesBC. + // Adding -1 and later when filling the clusterID<->cellID table skip all cases where this is -1 + if (cellIndicesBC.size() < cellsBC.size()) { + cellIndicesBC.reserve(cellsBC.size()); + for (size_t iMissing = 0; iMissing < (cellsBC.size() - cellIndicesBC.size()); ++iMissing) { + cellIndicesBC.emplace_back(-1); + } + } + if (emcCrossTalkConf.createHistograms.value) { + for (const auto& cell : cellsBC) { + mHistManager.fill(HIST("hCellEnergyDistAfter"), cell.getAmplitude()); + } + } + } // cross talk emulation was okay + } // if (isMC.value && emcCrossTalkConf.enableCrossTalk.value) + // shaper correction has to come AFTER cross talk + for (auto& cell : cellsBC) { // o2-linter: disable=const-ref-in-for-loop (we are changing a value here) + if (cell.getLowGain()) { + cell.setAmplitude(o2::emcal::NonlinearityHandler::evaluateShaperCorrectionCellEnergy(cell.getAmplitude())); + } } LOG(detail) << "Number of cells for BC (CF): " << cellsBC.size(); nCellsProcessed += cellsBC.size(); @@ -786,7 +851,9 @@ struct EmcalCorrectionTask { for (int ncell = 0; ncell < cluster.getNCells(); ncell++) { cellindex = cluster.getCellIndex(ncell); LOG(debug) << "trying to find cell index " << cellindex << " in map"; - clustercells(clusters.lastIndex(), cellIndicesBC[cellindex]); + if (cellIndicesBC[cellindex] >= 0) { + clustercells(clusters.lastIndex(), cellIndicesBC[cellindex]); + } } // end of cells of cluser loop // fill histograms mHistManager.fill(HIST("hClusterE"), energy); @@ -907,13 +974,12 @@ struct EmcalCorrectionTask { { int nTrack = 0; for (const auto& track : tracks) { - // TODO only consider tracks in current emcal/dcal acceptanc if (!track.isGlobalTrack()) { // only global tracks continue; } // Tracks that do not point to the EMCal/DCal/PHOS get default values of -999 // This way we can cut out tracks that do not point to the EMCal+DCal - if (track.trackEtaEmcal() < -900 || track.trackPhiEmcal() < -900) { + if (track.trackEtaEmcal() < TrackNotOnEMCal || track.trackPhiEmcal() < TrackNotOnEMCal) { continue; } if (trackMinPt > 0 && track.pt() < trackMinPt) { From 59bf24882c875b8f8d8a8417cb77558bdad2102c Mon Sep 17 00:00:00 2001 From: dyx-11 <1260971129@qq.com> Date: Wed, 23 Jul 2025 22:39:32 +0800 Subject: [PATCH 023/345] [PWGUD] change ptorder in flowCorrelationUpc of PWGUD (#12130) --- PWGUD/Tasks/flowCorrelationsUpc.cxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/PWGUD/Tasks/flowCorrelationsUpc.cxx b/PWGUD/Tasks/flowCorrelationsUpc.cxx index 11f7820a071..baf24af6f94 100644 --- a/PWGUD/Tasks/flowCorrelationsUpc.cxx +++ b/PWGUD/Tasks/flowCorrelationsUpc.cxx @@ -101,6 +101,8 @@ struct FlowCorrelationsUpc { O2_DEFINE_CONFIGURABLE(cfgMinMult, int, 0, "Minimum multiplicity for collision") O2_DEFINE_CONFIGURABLE(cfgMaxMult, int, 10, "Maximum multiplicity for collision") O2_DEFINE_CONFIGURABLE(cfgSampleSize, double, 10, "Sample size for mixed event") + O2_DEFINE_CONFIGURABLE(cfgUsePtOrder, bool, true, "enable trigger pT < associated pT cut") + O2_DEFINE_CONFIGURABLE(cfgUsePtOrderInMixEvent, bool, true, "enable trigger pT < associated pT cut in mixed event") ConfigurableAxis axisVertex{"axisVertex", {10, -10, 10}, "vertex axis for histograms"}; ConfigurableAxis axisEta{"axisEta", {40, -1., 1.}, "eta axis for histograms"}; @@ -208,8 +210,10 @@ struct FlowCorrelationsUpc { for (auto const& track2 : tracks2) { - if (track1.pt() <= track2.pt()) - continue; // skip if the trigger pt is less than the associate p + if (track1.globalIndex() == track2.globalIndex()) + continue; // For pt-differential correlations, skip if the trigger and associate are the same track + if (system == SameEvent && track1.pt() <= track2.pt()) + continue; // Without pt-differential correlations, skip if the trigger pt is less than the associate pt auto momentum1 = std::array{track1.px(), track1.py(), track1.pz()}; auto momentum2 = std::array{track2.px(), track2.py(), track2.pz()}; From 343f8d68eda9503b32e0dd10fcc26ff71708fdfa Mon Sep 17 00:00:00 2001 From: EmilGorm <50658075+EmilGorm@users.noreply.github.com> Date: Wed, 23 Jul 2025 17:56:03 +0200 Subject: [PATCH 024/345] [PWGCF] Add flag for eventconsistency, add pt-dep dcaxy to eff task (#12171) Co-authored-by: ALICE Action Bot --- .../Tasks/flowGfwLightIons.cxx | 81 +++++++++++++++++-- 1 file changed, 73 insertions(+), 8 deletions(-) diff --git a/PWGCF/GenericFramework/Tasks/flowGfwLightIons.cxx b/PWGCF/GenericFramework/Tasks/flowGfwLightIons.cxx index 834c2070ce3..91f9194ef32 100644 --- a/PWGCF/GenericFramework/Tasks/flowGfwLightIons.cxx +++ b/PWGCF/GenericFramework/Tasks/flowGfwLightIons.cxx @@ -123,6 +123,7 @@ struct FlowGfwLightIons { O2_DEFINE_CONFIGURABLE(cfgFixedMultMin, int, 1, "Minimum for fixed nch range"); O2_DEFINE_CONFIGURABLE(cfgFixedMultMax, int, 3000, "Maximum for fixed nch range"); O2_DEFINE_CONFIGURABLE(cfgUseMultiplicityFlowWeights, bool, true, "Enable or disable the use of multiplicity-based event weighting"); + O2_DEFINE_CONFIGURABLE(cfgConsistentEventFlag, int, 0, "Flag to select consistent events - 0: off, 1: v2{2} gap calculable, 2: v2{4} full calculable, 4: v2{4} gap calculable, 8: v2{4} 3sub calculable"); O2_DEFINE_CONFIGURABLE(cfgUseDensityDependentCorrection, bool, false, "Use density dependent efficiency correction based on Run 2 measurements"); Configurable> cfgTrackDensityP0{"cfgTrackDensityP0", std::vector{0.7217476707, 0.7384792571, 0.7542625668, 0.7640680200, 0.7701951667, 0.7755299053, 0.7805901710, 0.7849446786, 0.7957356586, 0.8113039262, 0.8211968966, 0.8280558878, 0.8329342135}, "parameter 0 for track density efficiency correction"}; Configurable> cfgTrackDensityP1{"cfgTrackDensityP1", std::vector{-2.169488e-05, -2.191913e-05, -2.295484e-05, -2.556538e-05, -2.754463e-05, -2.816832e-05, -2.846502e-05, -2.843857e-05, -2.705974e-05, -2.477018e-05, -2.321730e-05, -2.203315e-05, -2.109474e-05}, "parameter 1 for track density efficiency correction"}; @@ -183,7 +184,6 @@ struct FlowGfwLightIons { kCentNGlobal, kCentMFT }; - enum EventSelFlags { kFilteredEvent = 1, kSel8, @@ -226,6 +226,12 @@ struct FlowGfwLightIons { DensityCorr() : psi2Est(0.), psi3Est(0.), psi4Est(0.), v2(0.), v3(0.), v4(0.), density(0) {} }; + // region indices for consistency flag + int posRegionIndex = -1; + int negRegionIndex = -1; + int fullRegionIndex = -1; + int midRegionIndex = -1; + // Event selection cuts - Alex TF1* fMultPVCutLow = nullptr; TF1* fMultPVCutHigh = nullptr; @@ -276,7 +282,6 @@ struct FlowGfwLightIons { cfgGFWBinning->Print(); o2::analysis::gfw::multGlobalCorrCutPars = cfgMultGlobalCutPars; o2::analysis::gfw::multPVCorrCutPars = cfgMultPVCutPars; - o2::analysis::gfw::firstRunsOfFill = cfgFirstRunsOfFill; if (cfgTimeDependent && !std::is_sorted(o2::analysis::gfw::firstRunsOfFill.begin(), o2::analysis::gfw::firstRunsOfFill.end())) { std::sort(o2::analysis::gfw::firstRunsOfFill.begin(), o2::analysis::gfw::firstRunsOfFill.end()); @@ -458,7 +463,6 @@ struct FlowGfwLightIons { fPtDepDCAxy = new TF1("ptDepDCAxy", Form("[0]*%s", cfgDCAxy->c_str()), 0.001, 100); fPtDepDCAxy->SetParameter(0, cfgDCAxyNSigma); LOGF(info, "DCAxy pt-dependence function: %s", Form("[0]*%s", cfgDCAxy->c_str())); - if (cfgUseAdditionalEventCut) { fMultPVCutLow = new TF1("fMultPVCutLow", cfgMultCorrLowCutFunction->c_str(), 0, 100); fMultPVCutLow->SetParameters(&(o2::analysis::gfw::multPVCorrCutPars[0])); @@ -487,6 +491,32 @@ struct FlowGfwLightIons { funcV4 = new TF1("funcV4", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x", 0, 100); funcV4->SetParameters(0.008845, 0.000259668, -3.24435e-06, 4.54837e-08, -6.01825e-10); } + if (cfgConsistentEventFlag) { + posRegionIndex = [&]() { + auto begin = cfgRegions->GetNames().begin(); + auto end = cfgRegions->GetNames().end(); + auto it = std::find(begin, end, "refP"); + return (it != end) ? std::distance(begin, it) : -1; + }(); + negRegionIndex = [&]() { + auto begin = cfgRegions->GetNames().begin(); + auto end = cfgRegions->GetNames().end(); + auto it = std::find(begin, end, "refN"); + return (it != end) ? std::distance(begin, it) : -1; + }(); + fullRegionIndex = [&]() { + auto begin = cfgRegions->GetNames().begin(); + auto end = cfgRegions->GetNames().end(); + auto it = std::find(begin, end, "refFull"); + return (it != end) ? std::distance(begin, it) : -1; + }(); + midRegionIndex = [&]() { + auto begin = cfgRegions->GetNames().begin(); + auto end = cfgRegions->GetNames().end(); + auto it = std::find(begin, end, "refMid"); + return (it != end) ? std::distance(begin, it) : -1; + }(); + } } static constexpr std::string_view FillTimeName[] = {"before/", "after/"}; @@ -757,6 +787,13 @@ struct FlowGfwLightIons { double time; }; + struct AcceptedTracks { + int nPos; + int nNeg; + int nFull; + int nMid; + }; + template void processCollision(TCollision collision, TTracks tracks, const XAxis& xaxis, const int& run) { @@ -819,9 +856,21 @@ struct FlowGfwLightIons { densitycorrections.v4 = v4; densitycorrections.density = tracks.size(); } - + AcceptedTracks acceptedTracks{0, 0, 0, 0}; for (const auto& track : tracks) { - processTrack(track, vtxz, xaxis.multiplicity, run, densitycorrections); + processTrack(track, vtxz, xaxis.multiplicity, run, densitycorrections, acceptedTracks); + if (cfgConsistentEventFlag & 1) + if (!acceptedTracks.nPos || !acceptedTracks.nNeg) + return; + if (cfgConsistentEventFlag & 2) + if (acceptedTracks.nFull < 4) // o2-linter: disable=magic-number (at least four tracks in full acceptance) + return; + if (cfgConsistentEventFlag & 4) + if (acceptedTracks.nPos < 2 || acceptedTracks.nNeg < 2) // o2-linter: disable=magic-number (at least two tracks in each subevent) + return; + if (cfgConsistentEventFlag & 8) + if (acceptedTracks.nPos < 2 || acceptedTracks.nMid < 2 || acceptedTracks.nNeg < 2) // o2-linter: disable=magic-number (at least two tracks in all three subevents) + return; } if (!cfgFillWeights) fillOutputContainers
((cfgTimeDependent) ? xaxis.time : (cfgUseNch) ? xaxis.multiplicity @@ -845,7 +894,20 @@ struct FlowGfwLightIons { } template - inline void processTrack(TTrack const& track, const float& vtxz, const int& multiplicity, const int& run, DensityCorr densitycorrections) + void fillAcceptedTracks(TTrack track, AcceptedTracks& acceptedTracks) + { + if (posRegionIndex >= 0 && track.eta() > o2::analysis::gfw::regions.GetEtaMin()[posRegionIndex] && track.eta() < o2::analysis::gfw::regions.GetEtaMax()[posRegionIndex]) + ++acceptedTracks.nPos; + if (negRegionIndex >= 0 && track.eta() > o2::analysis::gfw::regions.GetEtaMin()[negRegionIndex] && track.eta() < o2::analysis::gfw::regions.GetEtaMax()[negRegionIndex]) + ++acceptedTracks.nNeg; + if (fullRegionIndex >= 0 && track.eta() > o2::analysis::gfw::regions.GetEtaMin()[fullRegionIndex] && track.eta() < o2::analysis::gfw::regions.GetEtaMax()[fullRegionIndex]) + ++acceptedTracks.nFull; + if (midRegionIndex >= 0 && track.eta() > o2::analysis::gfw::regions.GetEtaMin()[midRegionIndex] && track.eta() < o2::analysis::gfw::regions.GetEtaMax()[midRegionIndex]) + ++acceptedTracks.nMid; + } + + template + inline void processTrack(TTrack const& track, const float& vtxz, const int& multiplicity, const int& run, DensityCorr densitycorrections, AcceptedTracks& acceptedTracks) { if constexpr (framework::has_type_v) { if (track.mcParticleId() < 0 || !(track.has_mcParticle())) @@ -868,6 +930,7 @@ struct FlowGfwLightIons { } else { fillPtSums(track); fillGFW(track, vtxz, densitycorrections); + fillAcceptedTracks(track, acceptedTracks); } if (cfgFillQA) { @@ -885,7 +948,7 @@ struct FlowGfwLightIons { fillPtSums(track); fillGFW(track, vtxz, densitycorrections); - + fillAcceptedTracks(track, acceptedTracks); if (cfgFillQA) { fillTrackQA(track, vtxz); registry.fill(HIST("MCGen/trackQA/nch_pt"), multiplicity, track.pt()); @@ -903,6 +966,7 @@ struct FlowGfwLightIons { } else { fillPtSums(track); fillGFW(track, vtxz, densitycorrections); + fillAcceptedTracks(track, acceptedTracks); } if (cfgFillQA) { fillTrackQA(track, vtxz); @@ -914,6 +978,7 @@ struct FlowGfwLightIons { } } } + return; } template @@ -954,7 +1019,7 @@ struct FlowGfwLightIons { double weff = (dt == kGen) ? 1. : getEfficiency(track); if (weff < 0) return; - if (std::abs(track.eta()) < cfgEtaPtPt) { + if (std::abs(track.eta()) < cfgEtaPtPt && track.pt() > o2::analysis::gfw::ptreflow && track.pt() < o2::analysis::gfw::ptrefup) { (dt == kGen) ? fFCptgen->fill(1., track.pt()) : fFCpt->fill(weff, track.pt()); } } From 167ed2a6a9d7d55ebba659239dbe12e15bde690c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= Date: Wed, 23 Jul 2025 19:44:03 +0200 Subject: [PATCH 025/345] [PWGHF] Add derived-data creator for Ds+ (#12142) --- PWGHF/DataModel/DerivedTables.h | 78 +++- PWGHF/TableProducer/CMakeLists.txt | 5 + .../derivedDataCreatorDsToKKPi.cxx | 412 ++++++++++++++++++ 3 files changed, 494 insertions(+), 1 deletion(-) create mode 100644 PWGHF/TableProducer/derivedDataCreatorDsToKKPi.cxx diff --git a/PWGHF/DataModel/DerivedTables.h b/PWGHF/DataModel/DerivedTables.h index 009dd02c14d..e3602a0ba63 100644 --- a/PWGHF/DataModel/DerivedTables.h +++ b/PWGHF/DataModel/DerivedTables.h @@ -35,7 +35,7 @@ namespace o2::aod // D0 → K− π+ // Λc → p K− π+ // D+ → K− π+ π+ -// Ds+ → K− K+ π+ (todo) +// Ds+ → K− K+ π+ // composite species // B0 → D− π+ @@ -306,6 +306,7 @@ DECLARE_SOA_COLUMN(FlagMcDecayChanGen, flagMcDecayChanGen, int8_t); //! resonant DECLARE_TABLES_2P(D0, "D0", d0, 2); DECLARE_TABLES_3P(Lc, "LC", lc, 3); DECLARE_TABLES_3P(Dplus, "DP", dplus, 4); +DECLARE_TABLES_3P(Ds, "DS", ds, 9); DECLARE_TABLES_3P(Bplus, "BP", bplus, 5); DECLARE_TABLES_3P(Dstar, "DST", dstar, 6); // Workaround for the existing B0 macro in termios.h @@ -868,6 +869,81 @@ DECLARE_SOA_TABLE_STAGED(HfDplusMcs, "HFDPMC", //! Table with MC candidate info hf_cand_mc::FlagMcDecayChanRec, o2::soa::Marker); +// ---------------- +// Ds+ +// ---------------- + +DECLARE_SOA_TABLE_STAGED(HfDsPars, "HFDSPAR", //! Table with candidate properties used for selection + hf_cand::Chi2PCA, + hf_cand::NProngsContributorsPV, + hf_cand_par::Cpa, + hf_cand_par::CpaXY, + hf_cand_par::DecayLength, + hf_cand_par::DecayLengthXY, + hf_cand_par::DecayLengthNormalised, + hf_cand_par::DecayLengthXYNormalised, + hf_cand_par::PtProng0, + hf_cand_par::PtProng1, + hf_cand_par::PtProng2, + hf_cand::ImpactParameter0, + hf_cand::ImpactParameter1, + hf_cand::ImpactParameter2, + hf_cand_par::ImpactParameterNormalised0, + hf_cand_par::ImpactParameterNormalised1, + hf_cand_par::ImpactParameterNormalised2, + hf_cand_par::NSigTpcPi0, + hf_cand_par::NSigTpcKa0, + hf_cand_par::NSigTofPi0, + hf_cand_par::NSigTofKa0, + hf_cand_par::NSigTpcTofPi0, + hf_cand_par::NSigTpcTofKa0, + hf_cand_par::NSigTpcKa1, + hf_cand_par::NSigTofKa1, + hf_cand_par::NSigTpcTofKa1, + hf_cand_par::NSigTpcPi2, + hf_cand_par::NSigTpcKa2, + hf_cand_par::NSigTofPi2, + hf_cand_par::NSigTofKa2, + hf_cand_par::NSigTpcTofPi2, + hf_cand_par::NSigTpcTofKa2, + o2::soa::Marker); + +DECLARE_SOA_TABLE_STAGED(HfDsParEs, "HFDSPARE", //! Table with additional candidate properties used for selection + hf_cand::XSecondaryVertex, + hf_cand::YSecondaryVertex, + hf_cand::ZSecondaryVertex, + hf_cand::ErrorDecayLength, + hf_cand::ErrorDecayLengthXY, + hf_cand_par::RSecondaryVertex, + hf_cand_par::PProng0, + hf_cand_par::PProng1, + hf_cand_par::PProng2, + hf_cand::PxProng0, + hf_cand::PyProng0, + hf_cand::PzProng0, + hf_cand::PxProng1, + hf_cand::PyProng1, + hf_cand::PzProng1, + hf_cand::PxProng2, + hf_cand::PyProng2, + hf_cand::PzProng2, + hf_cand::ErrorImpactParameter0, + hf_cand::ErrorImpactParameter1, + hf_cand::ErrorImpactParameter2, + hf_cand_par::Ct, + o2::soa::Marker); + +DECLARE_SOA_TABLE_STAGED(HfDsMls, "HFDSML", //! Table with candidate selection ML scores + hf_cand_mc::MlScores, + o2::soa::Marker); + +DECLARE_SOA_TABLE_STAGED(HfDsMcs, "HFDSMC", //! Table with MC candidate info + hf_cand_mc::FlagMcMatchRec, + hf_cand_mc::OriginMcRec, + hf_cand_mc::IsCandidateSwapped, + hf_cand_mc::FlagMcDecayChanRec, + o2::soa::Marker); + // ---------------- // D*+ // ---------------- diff --git a/PWGHF/TableProducer/CMakeLists.txt b/PWGHF/TableProducer/CMakeLists.txt index b831d2f9532..e57147f6cfc 100644 --- a/PWGHF/TableProducer/CMakeLists.txt +++ b/PWGHF/TableProducer/CMakeLists.txt @@ -320,6 +320,11 @@ o2physics_add_dpl_workflow(derived-data-creator-dplus-to-pi-k-pi PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(derived-data-creator-ds-to-k-k-pi + SOURCES derivedDataCreatorDsToKKPi.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(derived-data-creator-dstar-to-d0-pi SOURCES derivedDataCreatorDstarToD0Pi.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore diff --git a/PWGHF/TableProducer/derivedDataCreatorDsToKKPi.cxx b/PWGHF/TableProducer/derivedDataCreatorDsToKKPi.cxx new file mode 100644 index 00000000000..d63294ff14d --- /dev/null +++ b/PWGHF/TableProducer/derivedDataCreatorDsToKKPi.cxx @@ -0,0 +1,412 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file derivedDataCreatorDsToKKPi.cxx +/// \brief Producer of derived tables of Ds candidates, collisions and MC particles +/// \note Based on derivedDataCreatorDplusToPiKPi.cxx +/// +/// \author Vít Kučera , Inha University + +#include "PWGHF/Core/DecayChannels.h" +#include "PWGHF/Core/HfHelper.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/DataModel/DerivedTables.h" +#include "PWGHF/Utils/utilsDerivedData.h" +#include "PWGLF/DataModel/mcCentrality.h" + +#include "Common/Core/RecoDecay.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/Multiplicity.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::analysis::hf_derived; + +/// Writes the full information in an output TTree +struct HfDerivedDataCreatorDsToKKPi { + HfProducesDerivedData< + o2::aod::HfDsBases, + o2::aod::HfDsCollBases, + o2::aod::HfDsCollIds, + o2::aod::HfDsMcCollBases, + o2::aod::HfDsMcCollIds, + o2::aod::HfDsMcRCollIds, + o2::aod::HfDsPBases, + o2::aod::HfDsPIds> + rowsCommon; + // Candidates + Produces rowCandidatePar; + Produces rowCandidateParE; + Produces rowCandidateSel; + Produces rowCandidateMl; + Produces rowCandidateId; + Produces rowCandidateMc; + + // Switches for filling tables + HfConfigurableDerivedData confDerData; + Configurable fillCandidatePar{"fillCandidatePar", true, "Fill candidate parameters"}; + Configurable fillCandidateParE{"fillCandidateParE", true, "Fill candidate extended parameters"}; + Configurable fillCandidateSel{"fillCandidateSel", true, "Fill candidate selection flags"}; + Configurable fillCandidateMl{"fillCandidateMl", true, "Fill candidate selection ML scores"}; + Configurable fillCandidateId{"fillCandidateId", true, "Fill original indices from the candidate table"}; + Configurable fillCandidateMc{"fillCandidateMc", true, "Fill candidate MC info"}; + // Parameters for production of training samples + Configurable downSampleBkgFactor{"downSampleBkgFactor", 1., "Fraction of background candidates to keep for ML trainings"}; + Configurable ptMaxForDownSample{"ptMaxForDownSample", 10., "Maximum pt for the application of the downsampling factor"}; + + HfHelper hfHelper; + SliceCache cache; + static constexpr double Mass{o2::constants::physics::MassDS}; + + using CollisionsWCentMult = soa::Join; + using CollisionsWMcCentMult = soa::Join; + using TracksWPid = soa::Join; + using SelectedCandidates = soa::Filtered>; + using SelectedCandidatesMc = soa::Filtered>; + using SelectedCandidatesMl = soa::Filtered>; + using SelectedCandidatesMcMl = soa::Filtered>; + using MatchedGenCandidatesMc = soa::Filtered>; + using TypeMcCollisions = soa::Join; + + Filter filterSelectCandidates = (aod::hf_sel_candidate_ds::isSelDsToKKPi & static_cast(BIT(aod::SelectionStep::RecoMl - 1))) != 0; // select candidates which passed all cuts at least up to RecoMl - 1 + Filter filterMcGenMatching = nabs(aod::hf_cand_3prong::flagMcMatchGen) == static_cast(hf_decay::hf_cand_3prong::DecayChannelMain::DsToPiKK); + + Preslice candidatesPerCollision = aod::hf_cand::collisionId; + Preslice candidatesMcPerCollision = aod::hf_cand::collisionId; + Preslice candidatesMlPerCollision = aod::hf_cand::collisionId; + Preslice candidatesMcMlPerCollision = aod::hf_cand::collisionId; + Preslice mcParticlesPerMcCollision = aod::mcparticle::mcCollisionId; + + // trivial partitions for all candidates to allow "->sliceByCached" inside processCandidates + Partition candidatesAll = aod::hf_sel_candidate_ds::isSelDsToKKPi >= 0; + Partition candidatesMcAll = aod::hf_sel_candidate_ds::isSelDsToKKPi >= 0; + Partition candidatesMlAll = aod::hf_sel_candidate_ds::isSelDsToKKPi >= 0; + Partition candidatesMcMlAll = aod::hf_sel_candidate_ds::isSelDsToKKPi >= 0; + // partitions for signal and background + Partition candidatesMcSig = nabs(aod::hf_cand_3prong::flagMcMatchRec) == static_cast(hf_decay::hf_cand_3prong::DecayChannelMain::DsToPiKK); + Partition candidatesMcBkg = nabs(aod::hf_cand_3prong::flagMcMatchRec) != static_cast(hf_decay::hf_cand_3prong::DecayChannelMain::DsToPiKK); + Partition candidatesMcMlSig = nabs(aod::hf_cand_3prong::flagMcMatchRec) == static_cast(hf_decay::hf_cand_3prong::DecayChannelMain::DsToPiKK); + Partition candidatesMcMlBkg = nabs(aod::hf_cand_3prong::flagMcMatchRec) != static_cast(hf_decay::hf_cand_3prong::DecayChannelMain::DsToPiKK); + + void init(InitContext const&) + { + std::array doprocess{doprocessData, doprocessMcSig, doprocessMcBkg, doprocessMcAll, doprocessDataMl, doprocessMcMlSig, doprocessMcMlBkg, doprocessMcMlAll, doprocessMcGenOnly}; + if (std::accumulate(doprocess.begin(), doprocess.end(), 0) != 1) { + LOGP(fatal, "Only one process function can be enabled at a time."); + } + rowsCommon.init(confDerData); + } + + template + void fillTablesCandidate(const T& candidate, int candFlag, double invMass, + double ct, double y, int8_t flagMc, int8_t origin, int8_t swapping, int8_t flagDecayChan, const std::vector& mlScores) + { + rowsCommon.fillTablesCandidate(candidate, invMass, y); + if (fillCandidatePar) { + rowCandidatePar( + candidate.chi2PCA(), + candidate.nProngsContributorsPV(), + candidate.cpa(), + candidate.cpaXY(), + candidate.decayLength(), + candidate.decayLengthXY(), + candidate.decayLengthNormalised(), + candidate.decayLengthXYNormalised(), + candidate.ptProng0(), + candidate.ptProng1(), + candidate.ptProng2(), + candidate.impactParameter0(), + candidate.impactParameter1(), + candidate.impactParameter2(), + candidate.impactParameterNormalised0(), + candidate.impactParameterNormalised1(), + candidate.impactParameterNormalised2(), + candidate.nSigTpcPi0(), + candidate.nSigTpcKa0(), + candidate.nSigTofPi0(), + candidate.nSigTofKa0(), + candidate.tpcTofNSigmaPi0(), + candidate.tpcTofNSigmaKa0(), + candidate.nSigTpcKa1(), + candidate.nSigTofKa1(), + candidate.tpcTofNSigmaKa1(), + candidate.nSigTpcPi2(), + candidate.nSigTpcKa2(), + candidate.nSigTofPi2(), + candidate.nSigTofKa2(), + candidate.tpcTofNSigmaPi2(), + candidate.tpcTofNSigmaKa2()); + } + if (fillCandidateParE) { + rowCandidateParE( + candidate.xSecondaryVertex(), + candidate.ySecondaryVertex(), + candidate.zSecondaryVertex(), + candidate.errorDecayLength(), + candidate.errorDecayLengthXY(), + candidate.rSecondaryVertex(), + RecoDecay::p(candidate.pxProng0(), candidate.pyProng0(), candidate.pzProng0()), + RecoDecay::p(candidate.pxProng1(), candidate.pyProng1(), candidate.pzProng1()), + RecoDecay::p(candidate.pxProng2(), candidate.pyProng2(), candidate.pzProng2()), + candidate.pxProng0(), + candidate.pyProng0(), + candidate.pzProng0(), + candidate.pxProng1(), + candidate.pyProng1(), + candidate.pzProng1(), + candidate.pxProng2(), + candidate.pyProng2(), + candidate.pzProng2(), + candidate.errorImpactParameter0(), + candidate.errorImpactParameter1(), + candidate.errorImpactParameter2(), + ct); + } + if (fillCandidateSel) { + rowCandidateSel( + BIT(candFlag)); + } + if (fillCandidateMl) { + rowCandidateMl( + mlScores); + } + if (fillCandidateId) { + rowCandidateId( + candidate.collisionId(), + candidate.prong0Id(), + candidate.prong1Id(), + candidate.prong2Id()); + } + if (fillCandidateMc) { + rowCandidateMc( + flagMc, + origin, + swapping, + flagDecayChan); + } + } + + template + void processCandidates(CollType const& collisions, + Partition& candidates, + TracksWPid const&, + aod::BCs const&) + { + // Fill collision properties + if constexpr (isMc) { + if (confDerData.fillMcRCollId) { + rowsCommon.matchedCollisions.clear(); + } + } + auto sizeTableColl = collisions.size(); + rowsCommon.reserveTablesColl(sizeTableColl); + for (const auto& collision : collisions) { + auto thisCollId = collision.globalIndex(); + auto candidatesThisColl = candidates->sliceByCached(aod::hf_cand::collisionId, thisCollId, cache); // FIXME + auto sizeTableCand = candidatesThisColl.size(); + LOGF(debug, "Rec. collision %d has %d candidates", thisCollId, sizeTableCand); + // Skip collisions without HF candidates (and without HF particles in matched MC collisions if saving indices of reconstructed collisions matched to MC collisions) + bool mcCollisionHasMcParticles{false}; + if constexpr (isMc) { + mcCollisionHasMcParticles = confDerData.fillMcRCollId && collision.has_mcCollision() && rowsCommon.hasMcParticles[collision.mcCollisionId()]; + LOGF(debug, "Rec. collision %d has MC collision %d with MC particles? %s", thisCollId, collision.mcCollisionId(), mcCollisionHasMcParticles ? "yes" : "no"); + } + if (sizeTableCand == 0 && (!confDerData.fillMcRCollId || !mcCollisionHasMcParticles)) { + LOGF(debug, "Skipping rec. collision %d", thisCollId); + continue; + } + LOGF(debug, "Filling rec. collision %d at derived index %d", thisCollId, rowsCommon.rowCollBase.lastIndex() + 1); + rowsCommon.fillTablesCollision(collision); + + // Fill candidate properties + rowsCommon.reserveTablesCandidates(sizeTableCand); + reserveTable(rowCandidatePar, fillCandidatePar, sizeTableCand); + reserveTable(rowCandidateParE, fillCandidateParE, sizeTableCand); + reserveTable(rowCandidateSel, fillCandidateSel, sizeTableCand); + reserveTable(rowCandidateMl, fillCandidateMl, sizeTableCand); + reserveTable(rowCandidateId, fillCandidateId, sizeTableCand); + if constexpr (isMc) { + reserveTable(rowCandidateMc, fillCandidateMc, sizeTableCand); + } + int8_t flagMcRec = 0, origin = 0, swapping = 0, flagDecayChanRec = 0; + for (const auto& candidate : candidatesThisColl) { + if constexpr (isMl) { + if (!TESTBIT(candidate.isSelDsToKKPi(), aod::SelectionStep::RecoMl)) { + continue; + } + } + if constexpr (isMc) { + flagMcRec = candidate.flagMcMatchRec(); + origin = candidate.originMcRec(); + swapping = candidate.isCandidateSwapped(); + flagDecayChanRec = candidate.flagMcDecayChanRec(); + if constexpr (onlyBkg) { + if (std::abs(flagMcRec) == hf_decay::hf_cand_3prong::DecayChannelMain::DsToPiKK) { + continue; + } + if (downSampleBkgFactor < 1.) { + float pseudoRndm = candidate.ptProng0() * 1000. - static_cast(candidate.ptProng0() * 1000); + if (candidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) { + continue; + } + } + } + if constexpr (onlySig) { + if (std::abs(flagMcRec) != hf_decay::hf_cand_3prong::DecayChannelMain::DsToPiKK) { + continue; + } + } + } + double ct = hfHelper.ctDs(candidate); + double y = hfHelper.yDs(candidate); + float massDsToKKPi = hfHelper.invMassDsToKKPi(candidate); + std::vector mlScoresDsToKKPi; + if constexpr (isMl) { + std::copy(candidate.mlProbDsToKKPi().begin(), candidate.mlProbDsToKKPi().end(), std::back_inserter(mlScoresDsToKKPi)); + } + fillTablesCandidate(candidate, 0, massDsToKKPi, ct, y, flagMcRec, origin, swapping, flagDecayChanRec, mlScoresDsToKKPi); + } + } + } + + void processData(CollisionsWCentMult const& collisions, + SelectedCandidates const&, + TracksWPid const& tracks, + aod::BCs const& bcs) + { + processCandidates(collisions, candidatesAll, tracks, bcs); + } + PROCESS_SWITCH(HfDerivedDataCreatorDsToKKPi, processData, "Process data", true); + + void processMcSig(CollisionsWMcCentMult const& collisions, + SelectedCandidatesMc const&, + TypeMcCollisions const& mcCollisions, + MatchedGenCandidatesMc const& mcParticles, + TracksWPid const& tracks, + aod::BCs const& bcs) + { + rowsCommon.preProcessMcCollisions(mcCollisions, mcParticlesPerMcCollision, mcParticles); + processCandidates(collisions, candidatesMcSig, tracks, bcs); + rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass); + } + PROCESS_SWITCH(HfDerivedDataCreatorDsToKKPi, processMcSig, "Process MC only for signals", false); + + void processMcBkg(CollisionsWMcCentMult const& collisions, + SelectedCandidatesMc const&, + TypeMcCollisions const& mcCollisions, + MatchedGenCandidatesMc const& mcParticles, + TracksWPid const& tracks, + aod::BCs const& bcs) + { + rowsCommon.preProcessMcCollisions(mcCollisions, mcParticlesPerMcCollision, mcParticles); + processCandidates(collisions, candidatesMcBkg, tracks, bcs); + rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass); + } + PROCESS_SWITCH(HfDerivedDataCreatorDsToKKPi, processMcBkg, "Process MC only for background", false); + + void processMcAll(CollisionsWMcCentMult const& collisions, + SelectedCandidatesMc const&, + TypeMcCollisions const& mcCollisions, + MatchedGenCandidatesMc const& mcParticles, + TracksWPid const& tracks, + aod::BCs const& bcs) + { + rowsCommon.preProcessMcCollisions(mcCollisions, mcParticlesPerMcCollision, mcParticles); + processCandidates(collisions, candidatesMcAll, tracks, bcs); + rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass); + } + PROCESS_SWITCH(HfDerivedDataCreatorDsToKKPi, processMcAll, "Process MC", false); + + // ML versions + + void processDataMl(CollisionsWCentMult const& collisions, + SelectedCandidatesMl const&, + TracksWPid const& tracks, + aod::BCs const& bcs) + { + processCandidates(collisions, candidatesMlAll, tracks, bcs); + } + PROCESS_SWITCH(HfDerivedDataCreatorDsToKKPi, processDataMl, "Process data with ML", false); + + void processMcMlSig(CollisionsWMcCentMult const& collisions, + SelectedCandidatesMcMl const&, + TypeMcCollisions const& mcCollisions, + MatchedGenCandidatesMc const& mcParticles, + TracksWPid const& tracks, + aod::BCs const& bcs) + { + rowsCommon.preProcessMcCollisions(mcCollisions, mcParticlesPerMcCollision, mcParticles); + processCandidates(collisions, candidatesMcMlSig, tracks, bcs); + rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass); + } + PROCESS_SWITCH(HfDerivedDataCreatorDsToKKPi, processMcMlSig, "Process MC with ML only for signals", false); + + void processMcMlBkg(CollisionsWMcCentMult const& collisions, + SelectedCandidatesMcMl const&, + TypeMcCollisions const& mcCollisions, + MatchedGenCandidatesMc const& mcParticles, + TracksWPid const& tracks, + aod::BCs const& bcs) + { + rowsCommon.preProcessMcCollisions(mcCollisions, mcParticlesPerMcCollision, mcParticles); + processCandidates(collisions, candidatesMcMlBkg, tracks, bcs); + rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass); + } + PROCESS_SWITCH(HfDerivedDataCreatorDsToKKPi, processMcMlBkg, "Process MC with ML only for background", false); + + void processMcMlAll(CollisionsWMcCentMult const& collisions, + SelectedCandidatesMcMl const&, + TypeMcCollisions const& mcCollisions, + MatchedGenCandidatesMc const& mcParticles, + TracksWPid const& tracks, + aod::BCs const& bcs) + { + rowsCommon.preProcessMcCollisions(mcCollisions, mcParticlesPerMcCollision, mcParticles); + processCandidates(collisions, candidatesMcMlAll, tracks, bcs); + rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass); + } + PROCESS_SWITCH(HfDerivedDataCreatorDsToKKPi, processMcMlAll, "Process MC with ML", false); + + void processMcGenOnly(TypeMcCollisions const& mcCollisions, + MatchedGenCandidatesMc const& mcParticles) + { + rowsCommon.processMcParticles(mcCollisions, mcParticlesPerMcCollision, mcParticles, Mass); + } + PROCESS_SWITCH(HfDerivedDataCreatorDsToKKPi, processMcGenOnly, "Process MC gen. only", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} From f909c9feb9e67b0180ba9953ccd570333d6458dd Mon Sep 17 00:00:00 2001 From: Zhiyong <71517277+Luzhiyongg@users.noreply.github.com> Date: Thu, 24 Jul 2025 01:12:58 +0200 Subject: [PATCH 026/345] [PWGCF] pt container should be initialized after eta region (#12198) --- PWGCF/Flow/Tasks/flowTask.cxx | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowTask.cxx b/PWGCF/Flow/Tasks/flowTask.cxx index 14d93e28935..6e038784277 100644 --- a/PWGCF/Flow/Tasks/flowTask.cxx +++ b/PWGCF/Flow/Tasks/flowTask.cxx @@ -352,19 +352,6 @@ struct FlowTask { } delete oba; - gfwConfigs.SetCorrs(cfgUserPtVnCorrConfig->GetCorrs()); - gfwConfigs.SetHeads(cfgUserPtVnCorrConfig->GetHeads()); - gfwConfigs.SetpTDifs(cfgUserPtVnCorrConfig->GetpTDifs()); - // Mask 1: vn-[pT], 2: vn-[pT^2], 4: vn-[pT^3] - gfwConfigs.SetpTCorrMasks(cfgUserPtVnCorrConfig->GetpTCorrMasks()); - gfwConfigs.Print(); - fFCpt->setUseCentralMoments(cfgUseCentralMoments); - fFCpt->setUseGapMethod(true); - fFCpt->initialise(axisIndependent, cfgMpar, gfwConfigs, cfgNbootstrap); - for (auto i = 0; i < gfwConfigs.GetSize(); ++i) { - corrconfigsPtVn.push_back(fGFW->GetCorrelatorConfig(gfwConfigs.GetCorrs()[i], gfwConfigs.GetHeads()[i], gfwConfigs.GetpTDifs()[i])); - } - // eta region fGFW->AddRegion("full", -0.8, 0.8, 1, 1); fGFW->AddRegion("refN00", -0.8, 0., 1, 1); // gap0 negative region @@ -448,6 +435,19 @@ struct FlowTask { } fGFW->CreateRegions(); + gfwConfigs.SetCorrs(cfgUserPtVnCorrConfig->GetCorrs()); + gfwConfigs.SetHeads(cfgUserPtVnCorrConfig->GetHeads()); + gfwConfigs.SetpTDifs(cfgUserPtVnCorrConfig->GetpTDifs()); + // Mask 1: vn-[pT], 2: vn-[pT^2], 4: vn-[pT^3] + gfwConfigs.SetpTCorrMasks(cfgUserPtVnCorrConfig->GetpTCorrMasks()); + gfwConfigs.Print(); + fFCpt->setUseCentralMoments(cfgUseCentralMoments); + fFCpt->setUseGapMethod(true); + fFCpt->initialise(axisIndependent, cfgMpar, gfwConfigs, cfgNbootstrap); + for (auto i = 0; i < gfwConfigs.GetSize(); ++i) { + corrconfigsPtVn.push_back(fGFW->GetCorrelatorConfig(gfwConfigs.GetCorrs()[i], gfwConfigs.GetHeads()[i], gfwConfigs.GetpTDifs()[i])); + } + if (cfgUseAdditionalEventCut) { fMultPVCutLow = new TF1("fMultPVCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x - 3.5*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", 0, 100); fMultPVCutLow->SetParameters(3257.29, -121.848, 1.98492, -0.0172128, 6.47528e-05, 154.756, -1.86072, -0.0274713, 0.000633499, -3.37757e-06); From ecc9e7f2744dc088b2cee8236d6a15c09b5eb20e Mon Sep 17 00:00:00 2001 From: Mario Ciacco Date: Thu, 24 Jul 2025 05:27:16 +0200 Subject: [PATCH 027/345] [PWGLF] add momentum cuts to charged tracks (#12200) --- PWGLF/TableProducer/Nuspex/ebyeMaker.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PWGLF/TableProducer/Nuspex/ebyeMaker.cxx b/PWGLF/TableProducer/Nuspex/ebyeMaker.cxx index 454c12bfff4..bdb0c4a2058 100644 --- a/PWGLF/TableProducer/Nuspex/ebyeMaker.cxx +++ b/PWGLF/TableProducer/Nuspex/ebyeMaker.cxx @@ -571,8 +571,8 @@ struct EbyeMaker { continue; } histos.fill(HIST("QA/tpcSignal"), track.tpcInnerParam(), track.tpcSignal()); - - nTracksColl++; + if (trackPt > ptMin[0] && trackPt < ptMax[0]) + nTracksColl++; for (int iP{0}; iP < kNpart; ++iP) { if (trackPt < ptMin[iP] || trackPt > ptMax[iP]) { @@ -853,7 +853,8 @@ struct EbyeMaker { if ((((mcPart.flags() & 0x8) || (mcPart.flags() & 0x2)) && (doprocessMcRun2 || doprocessMiniMcRun2)) || ((mcPart.flags() & 0x1) && !doprocessMiniMcRun2)) continue; auto pdgCode = mcPart.pdgCode(); - if ((std::abs(pdgCode) == PDG_t::kPiPlus || std::abs(pdgCode) == PDG_t::kElectron || std::abs(pdgCode) == PDG_t::kMuonMinus || std::abs(pdgCode) == PDG_t::kKPlus || std::abs(pdgCode) == PDG_t::kProton) && mcPart.isPhysicalPrimary()) + auto genPt = std::hypot(mcPart.px(), mcPart.py()); + if ((std::abs(pdgCode) == PDG_t::kPiPlus || std::abs(pdgCode) == PDG_t::kElectron || std::abs(pdgCode) == PDG_t::kMuonMinus || std::abs(pdgCode) == PDG_t::kKPlus || std::abs(pdgCode) == PDG_t::kProton) && mcPart.isPhysicalPrimary() && genPt > ptMin[0] && genPt < ptMax[0]) nChPartGen++; if (std::abs(pdgCode) == PDG_t::kLambda0) { if (!mcPart.isPhysicalPrimary() && !mcPart.has_mothers()) @@ -868,7 +869,6 @@ struct EbyeMaker { if (!foundPr) { continue; } - auto genPt = std::hypot(mcPart.px(), mcPart.py()); CandidateV0 candV0; candV0.genpt = genPt; candV0.geneta = mcPart.eta(); From 4879d254831fa322c3bf7162adb77c899ecfee30 Mon Sep 17 00:00:00 2001 From: "Paul Veen (paveen)" <80593165+ppoava@users.noreply.github.com> Date: Thu, 24 Jul 2025 05:53:46 +0200 Subject: [PATCH 028/345] [Common] Added dimuon-muon correlations to muonQA (#12204) Co-authored-by: ALICE Action Bot --- Common/Tasks/qaMuon.cxx | 68 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 63 insertions(+), 5 deletions(-) diff --git a/Common/Tasks/qaMuon.cxx b/Common/Tasks/qaMuon.cxx index f757036814e..86bc40b2aef 100644 --- a/Common/Tasks/qaMuon.cxx +++ b/Common/Tasks/qaMuon.cxx @@ -45,7 +45,12 @@ #include "Math/Vector4D.h" #include "TGeoGlobalMagField.h" +#include #include +#include +#include +#include +#include using namespace std; using namespace o2; @@ -562,12 +567,34 @@ struct muonQa { } if (configQAs.fEnableQADimuon) { + // single muons + AxisSpec transverseMomentumAxis = {1000, 0, 100, "p_{T} (GeV/c)"}; + AxisSpec etaAxis = {80, -5, -1, "#eta"}; + AxisSpec rAbsAxis = {100, 0., 100.0, "R_{abs} (cm)"}; + AxisSpec dcaAxis = {400, 0.0, 20.0, "DCA"}; + AxisSpec phiAxis = {360, -180.0, 180.0, "#phi (degrees)"}; + // dimuons AxisSpec invMassAxis = {400, 1, 5, "M_{#mu^{+}#mu^{-}} (GeV/c^{2})"}; AxisSpec invMassCorrelationAxis = {80, 0, 8, "M_{#mu^{+}#mu^{-}} (GeV/c^{2})"}; AxisSpec invMassAxisFull = {5000, 0, 100, "M_{#mu^{+}#mu^{-}} (GeV/c^{2})"}; AxisSpec yPairAxis = {120, 0.0, 6.0, "#y_{pair}"}; AxisSpec invMassAxis2D = {750, 0, 15, "M_{#mu^{+}#mu^{-}} (GeV/c^{2})"}; AxisSpec pTAxis2D = {120, 0, 30, "p_{T} (GeV/c)"}; + // Single muons - dimuons correlations + registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuPosPt_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{+}", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, transverseMomentumAxis}}); + registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuNegPt_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{-}", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, transverseMomentumAxis}}); + // + registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuPosEta_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{+}", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, etaAxis}}); + registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuNegEta_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{-}", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, etaAxis}}); + // + registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuPosRabs_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{+}", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, rAbsAxis}}); + registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuNegRabs_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{-}", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, rAbsAxis}}); + // + registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuPosDca_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{+}", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuNegDca_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{-}", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, dcaAxis}}); + // + registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuPosPhi_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{+}", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, phiAxis}}); + registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuNegPhi_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{-}", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, phiAxis}}); // MCH-MID tracks with MCH acceptance cuts registryDimuon.add("dimuon/same-event/invariantMass_MuonKine_MuonCuts", "#mu^{+}#mu^{-} invariant mass", {HistType::kTH1F, {invMassAxis}}); registryDimuon.add("dimuon/same-event/invariantMassFull_MuonKine_MuonCuts", "#mu^{+}#mu^{-} invariant mass", {HistType::kTH1F, {invMassAxisFull}}); @@ -1796,7 +1823,7 @@ struct muonQa { std::vector> yPos; std::vector> thetax; std::vector> thetay; - for (int zi = 0; zi < int(zRefPlane.size()); zi++) { + for (int zi = 0; zi < static_cast(zRefPlane.size()); zi++) { xPos.emplace_back(std::array{fgVectorsMCH[zi].x, fgVectorsMFT[zi].x}); yPos.emplace_back(std::array{fgVectorsMCH[zi].y, fgVectorsMFT[zi].y}); thetax.emplace_back(std::array{ @@ -1807,7 +1834,7 @@ struct muonQa { std::atan2(fgVectorsMFT[zi].py, -1.0 * fgVectorsMFT[zi].pz) * 180 / TMath::Pi()}); } - for (int i = 0; i < int(zRefPlane.size()); i++) { + for (int i = 0; i < static_cast(zRefPlane.size()); i++) { if (same) { std::get>(trackResidualsHistos[i][quadrant]["dx_vs_x"])->Fill(std::fabs(xPos[i][1]), xPos[i][0] - xPos[i][1]); std::get>(trackResidualsHistos[i][quadrant]["dx_vs_y"])->Fill(std::fabs(yPos[i][1]), xPos[i][0] - xPos[i][1]); @@ -2180,7 +2207,7 @@ struct muonQa { } // Loop over attached clusters - for (int iCls = 0; iCls < int(fgValuesClsTmp.posClusters.size()); iCls++) { + for (int iCls = 0; iCls < static_cast(fgValuesClsTmp.posClusters.size()); iCls++) { double phiCls = std::atan2(fgValuesClsTmp.posClusters[iCls][1], fgValuesClsTmp.posClusters[iCls][0]) * 180 / TMath::Pi(); int quadrantCls = GetQuadrantPhi(phiCls); @@ -2327,7 +2354,7 @@ struct muonQa { FillMatching(muontrack, fgValuesMCH, fgValuesMFT); //// Fill global informations - registry.get(HIST("global-muons/NCandidates"))->Fill(int(globalMuonsVector.size())); + registry.get(HIST("global-muons/NCandidates"))->Fill(static_cast(globalMuonsVector.size())); for (size_t candidateIndex = 0; candidateIndex < globalMuonsVector.size(); candidateIndex++) { auto const& muon = muons.rawIteratorAt(globalMuonsVector[candidateIndex]); registry.get(HIST("global-muons/MatchChi2"))->Fill(muon.chi2MatchMCHMFT(), candidateIndex); @@ -2369,7 +2396,7 @@ struct muonQa { } //// Fill global muon candidates info - for (int i = 0; i < int(globalMuonsVector.size()); i++) { + for (int i = 0; i < static_cast(globalMuonsVector.size()); i++) { VarTrack fgValuesTmp; auto muonCandidate = muons.rawIteratorAt(globalMuonsVector[i]); FillTrack<0>(muonCandidate, fgValuesTmp); @@ -2473,6 +2500,21 @@ struct muonQa { if ((sign1 * sign2) >= 0) continue; + const auto& muonPos = fgValuesMuon1.sign > 0 ? fgValuesMuon1 : fgValuesMuon2; + const auto& muonNeg = fgValuesMuon1.sign < 0 ? fgValuesMuon1 : fgValuesMuon2; + // μ⁺ variables + double muPosPt = muonPos.pT; + double muPosEta = muonPos.eta; + double muPosRabs = muonPos.rabs; + double muPosPhi = muonPos.phi * 180.0 / TMath::Pi(); + double muPosDca = std::sqrt(muonPos.dcaX * muonPos.dcaX + muonPos.dcaY * muonPos.dcaY); + // μ⁻ variables + double muNegPt = muonNeg.pT; + double muNegEta = muonNeg.eta; + double muNegRabs = muonNeg.rabs; + double muNegPhi = muonNeg.phi * 180.0 / TMath::Pi(); + double muNegDca = std::sqrt(muonNeg.dcaX * muonNeg.dcaX + muonNeg.dcaY * muonNeg.dcaY); + int Quadrant1 = GetQuadrantPhi(muonTrack1.phi() * 180.0 / TMath::Pi()); int Quadrant2 = GetQuadrantPhi(muonTrack2.phi() * 180.0 / TMath::Pi()); int TopBottom1 = (Quadrant1 == 0 || Quadrant1 == 1) ? 0 : 1; @@ -2491,6 +2533,22 @@ struct muonQa { if (goodMuonTracks) { if (sameEvent) { // same-event case + // single muons + registryDimuon.get(HIST("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuPosPt_MuonKine_MuonCuts"))->Fill(mass, pT, muPosPt); + registryDimuon.get(HIST("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuNegPt_MuonKine_MuonCuts"))->Fill(mass, pT, muNegPt); + // + registryDimuon.get(HIST("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuPosEta_MuonKine_MuonCuts"))->Fill(mass, pT, muPosEta); + registryDimuon.get(HIST("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuNegEta_MuonKine_MuonCuts"))->Fill(mass, pT, muNegEta); + // + registryDimuon.get(HIST("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuPosRabs_MuonKine_MuonCuts"))->Fill(mass, pT, muPosRabs); + registryDimuon.get(HIST("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuNegRabs_MuonKine_MuonCuts"))->Fill(mass, pT, muNegRabs); + // + registryDimuon.get(HIST("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuPosDca_MuonKine_MuonCuts"))->Fill(mass, pT, muPosDca); + registryDimuon.get(HIST("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuNegDca_MuonKine_MuonCuts"))->Fill(mass, pT, muNegDca); + // + registryDimuon.get(HIST("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuPosPhi_MuonKine_MuonCuts"))->Fill(mass, pT, muPosPhi); + registryDimuon.get(HIST("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuNegPhi_MuonKine_MuonCuts"))->Fill(mass, pT, muNegPhi); + // dimuons registryDimuon.get(HIST("dimuon/same-event/invariantMass_MuonKine_MuonCuts"))->Fill(mass); registryDimuon.get(HIST("dimuon/same-event/invariantMassFull_MuonKine_MuonCuts"))->Fill(mass); registryDimuon.get(HIST("dimuon/same-event/invariantMass_pT_MuonKine_MuonCuts"))->Fill(mass, pT); From 387e6264e64916b9615afb5abd4a159f375cd434 Mon Sep 17 00:00:00 2001 From: sawan <124118453+sawankumawat@users.noreply.github.com> Date: Thu, 24 Jul 2025 09:51:35 +0530 Subject: [PATCH 029/345] [PWGLF] inel check added (#12081) Co-authored-by: Sawan Sawan --- PWGLF/Tasks/Resonances/kstarqa.cxx | 261 +++++++++++++++++++++-------- 1 file changed, 191 insertions(+), 70 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarqa.cxx b/PWGLF/Tasks/Resonances/kstarqa.cxx index dcc4c60633c..08c1b4173d9 100644 --- a/PWGLF/Tasks/Resonances/kstarqa.cxx +++ b/PWGLF/Tasks/Resonances/kstarqa.cxx @@ -49,6 +49,7 @@ #include #include +#include #include #include @@ -78,6 +79,7 @@ struct Kstarqa { HistogramRegistry hOthers{"hOthers", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; // Confugrable for QA histograms + Configurable isINELgt0{"isINELgt0", true, "INEL>0 selection"}; Configurable calcLikeSign{"calcLikeSign", true, "Calculate Like Sign"}; Configurable calcRotational{"calcRotational", false, "Calculate Rotational"}; Configurable cQAplots{"cQAplots", true, "cQAplots"}; @@ -118,11 +120,14 @@ struct Kstarqa { Configurable nsigmaCutTPCKa{"nsigmaCutTPCKa", 3.0, "TPC Nsigma cut for kaons"}; Configurable nsigmaCutTOFPi{"nsigmaCutTOFPi", 3.0, "TOF Nsigma cut for pions"}; Configurable nsigmaCutTOFKa{"nsigmaCutTOFKa", 3.0, "TOF Nsigma cut for kaons"}; - Configurable nsigmaCutCombined{"nsigmaCutCombined", 3.0, "Combined Nsigma cut"}; + Configurable nsigmaCutCombinedKa{"nsigmaCutCombinedKa", 3.0, "Combined Nsigma cut for kaon"}; + Configurable nsigmaCutCombinedPi{"nsigmaCutCombinedPi", 3.0, "Combined Nsigma cut for pion"}; // Event selection configurables // Configurable timFrameEvsel{"timFrameEvsel", true, "TPC Time frame boundary cut"}; // Configurable cTVXEvsel{"cTVXEvsel", true, "Triggger selection"}; + Configurable isTriggerTVX{"isTriggerTVX", false, "TriggerTVX"}; + Configurable isGoodZvtxFT0vsPV{"isGoodZvtxFT0vsPV", false, "IsGoodZvtxFT0vsPV"}; Configurable cutzvertex{"cutzvertex", 10.0f, "Accepted z-vertex range (cm)"}; // Configurable cMID{"cMID", false, "Misidentification of tracks"}; @@ -134,7 +139,7 @@ struct Kstarqa { ConfigurableAxis axisPtfordEbydx{"axisPtfordEbydx", {1, 0, 20}, "pT (GeV/c)"}; ConfigurableAxis axisMultdist{"axisMultdist", {1, 0, 70000}, "Multiplicity distribution"}; ConfigurableAxis configThnAxisPOL{"configThnAxisPOL", {20, -1.0, 1.0}, "Costheta axis"}; - ConfigurableAxis invMassKstarAxis{"invMassKstar", {300, 0.7f, 1.3f}, "Kstar invariant mass axis"}; + ConfigurableAxis invMassKstarAxis{"invMassKstarAxis", {300, 0.7f, 1.3f}, "Kstar invariant mass axis"}; ConfigurableAxis ptAxisKstar{"ptAxisKstar", {200, 0.0f, 20.0f}, "Kstar pT axis"}; // Event plane configurables @@ -161,6 +166,18 @@ struct Kstarqa { // Event selection rEventSelection.add("hVertexZRec", "hVertexZRec", {HistType::kTH1F, {vertexZAxis}}); rEventSelection.add("hMultiplicity", "Multiplicity percentile", kTH1F, {{110, 0, 110}}); + rEventSelection.add("hEventCutFlow", "No. of event after cuts", kTH1I, {{10, 0, 10}}); + std::shared_ptr hCutFlow = rEventSelection.get(HIST("hEventCutFlow")); + hCutFlow->GetXaxis()->SetBinLabel(1, "All Events"); + hCutFlow->GetXaxis()->SetBinLabel(2, "|Vz| < cut"); + hCutFlow->GetXaxis()->SetBinLabel(3, "sel8"); + hCutFlow->GetXaxis()->SetBinLabel(4, "kNoTimeFrameBorder"); + hCutFlow->GetXaxis()->SetBinLabel(5, "kNoITSROFrameBorder"); + hCutFlow->GetXaxis()->SetBinLabel(6, "kNoSameBunchPileup"); + hCutFlow->GetXaxis()->SetBinLabel(7, "kIsGoodITSLayersAll"); + hCutFlow->GetXaxis()->SetBinLabel(8, "rctChecker"); + hCutFlow->GetXaxis()->SetBinLabel(9, "kIsTriggerTVX"); + hCutFlow->GetXaxis()->SetBinLabel(10, "kIsGoodZvtxFT0vsPV"); // for primary tracksbinsMultPlot if (cQAplots) { @@ -186,19 +203,35 @@ struct Kstarqa { hPID.add("Before/h1PID_TOF_neg_kaon", "Kaon PID distribution in data", kTH1F, {{100, -10.0f, 10.0f}}); hPID.add("Before/h1PID_TOF_neg_pion", "Pion PID distribution in data", kTH1F, {{100, -10.0f, 10.0f}}); + hPID.add("Before/hTPCnsigKa_mult_pt", "TPC nsigma of Kaon brfore PID with pt and multiplicity", kTH3F, {{100, -10.0f, 10.0f}, multiplicityAxis, ptAxis}); + hPID.add("Before/hTPCnsigPi_mult_pt", "TPC nsigma of Pion brfore PID with pt and multiplicity", kTH3F, {{100, -10.0f, 10.0f}, multiplicityAxis, ptAxis}); + hPID.add("Before/hTOFnsigKa_mult_pt", "TPC nsigma of Kaon brfore PID with pt and multiplicity", kTH3F, {{100, -10.0f, 10.0f}, multiplicityAxis, ptAxis}); + hPID.add("Before/hTOFnsigPi_mult_pt", "TPC nsigma of Pion brfore PID with pt and multiplicity", kTH3F, {{100, -10.0f, 10.0f}, multiplicityAxis, ptAxis}); + hPID.add("After/hNsigmaPionTPC_after", "N #Pi TPC after", kTH2F, {{50, 0.0f, 10.0f}, {100, -10.0f, 10.0f}}); hPID.add("After/hNsigmaPionTOF_after", "N #Pi TOF after", kTH2F, {{50, 0.0f, 10.0f}, {100, -10.0f, 10.0f}}); hPID.add("After/hNsigmaKaonTPC_after", "N #sigma Kaon TPC after", kTH2F, {{50, 0.0f, 10.0f}, {100, -10.0f, 10.0f}}); hPID.add("After/hNsigmaKaonTOF_after", "N #sigma Kaon TOF after", kTH2F, {{50, 0.0f, 10.0f}, {100, -10.0f, 10.0f}}); hPID.add("After/hNsigma_TPC_TOF_Ka_after", "N #sigma Kaon TOF after", kTH2F, {{50, -5.0f, 5.0f}, {50, -5.0f, 5.0f}}); hPID.add("After/hNsigma_TPC_TOF_Pi_after", "N #sigma Pion TOF after", kTH2F, {{50, -5.0f, 5.0f}, {50, -5.0f, 5.0f}}); + hPID.add("After/hDcaxyPi", "Dcaxy distribution of selected Pions", kTH1F, {{200, -1.0f, 1.0f}}); + hPID.add("After/hDcaxyKa", "Dcaxy distribution of selected Kaons", kTH1F, {{200, -1.0f, 1.0f}}); + hPID.add("After/hDcazPi", "Dcaz distribution of selected Pions", kTH1F, {{200, -1.0f, 1.0f}}); + hPID.add("After/hDcazKa", "Dcaz distribution of selected Kaons", kTH1F, {{200, -1.0f, 1.0f}}); + + hPID.add("After/hTPCnsigKa_mult_pt", "TPC nsigma of Kaon after PID with pt and multiplicity", kTH3F, {{100, -10.0f, 10.0f}, multiplicityAxis, ptAxis}); + hPID.add("After/hTPCnsigPi_mult_pt", "TPC nsigma of Pion after PID with pt and multiplicity", kTH3F, {{100, -10.0f, 10.0f}, multiplicityAxis, ptAxis}); + hPID.add("After/hTOFnsigKa_mult_pt", "TPC nsigma of Kaon after PID with pt and multiplicity", kTH3F, {{100, -10.0f, 10.0f}, multiplicityAxis, ptAxis}); + hPID.add("After/hTOFnsigPi_mult_pt", "TPC nsigma of Pion after PID with pt and multiplicity", kTH3F, {{100, -10.0f, 10.0f}, multiplicityAxis, ptAxis}); } // KStar histograms hInvMass.add("h3KstarInvMassUnlikeSign", "kstar Unlike Sign", kTHnSparseF, {multiplicityAxis, ptAxis, invmassAxis, thnAxisPOL}); hInvMass.add("h3KstarInvMassMixed", "kstar Mixed", kTHnSparseF, {multiplicityAxis, ptAxis, invmassAxis, thnAxisPOL}); - if (calcLikeSign) - hInvMass.add("h3KstarInvMasslikeSign", "kstar like Sign", kTHnSparseF, {multiplicityAxis, ptAxis, invmassAxis, thnAxisPOL}); + if (calcLikeSign) { + hInvMass.add("h3KstarInvMasslikeSignPP", "kstar like Sign", kTHnSparseF, {multiplicityAxis, ptAxis, invmassAxis, thnAxisPOL}); + hInvMass.add("h3KstarInvMasslikeSignMM", "kstar like Sign", kTHnSparseF, {multiplicityAxis, ptAxis, invmassAxis, thnAxisPOL}); + } if (calcRotational) hInvMass.add("h3KstarInvMassRotated", "kstar rotated", kTHnSparseF, {multiplicityAxis, ptAxis, invmassAxis, thnAxisPOL}); @@ -234,38 +267,69 @@ struct Kstarqa { double massKa = o2::constants::physics::MassKPlus; template - bool selectionEvent(const Coll& collision) + bool selectionEvent(const Coll& collision, bool fillHist = true) { + if (fillHist) + rEventSelection.fill(HIST("hEventCutFlow"), 0); + if (std::abs(collision.posZ()) > cutzvertex) return false; + if (fillHist) + rEventSelection.fill(HIST("hEventCutFlow"), 1); + if (!collision.sel8()) return false; - if (!collision.selection_bit(aod::evsel::kIsTriggerTVX)) { + if (fillHist) + rEventSelection.fill(HIST("hEventCutFlow"), 2); + + if (!collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) return false; - } - if (!collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(aod::evsel::kNoITSROFrameBorder)) { + if (fillHist) + rEventSelection.fill(HIST("hEventCutFlow"), 3); + + if (!collision.selection_bit(aod::evsel::kNoITSROFrameBorder)) return false; - } - if (rctCut.requireRCTFlagChecker && !rctChecker(collision)) { + if (fillHist) + rEventSelection.fill(HIST("hEventCutFlow"), 4); + + if (ispileupGoodvtxCut && (!collision.selection_bit(aod::evsel::kNoSameBunchPileup))) return false; - } - if (ispileupGoodvtxCut && (!collision.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { + if (fillHist) + rEventSelection.fill(HIST("hEventCutFlow"), 5); + + if (allLayersGoodITS && !collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) return false; - } - if (allLayersGoodITS && !collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + if (fillHist) + rEventSelection.fill(HIST("hEventCutFlow"), 6); + + if (rctCut.requireRCTFlagChecker && !rctChecker(collision)) return false; - } + if (fillHist) + rEventSelection.fill(HIST("hEventCutFlow"), 7); + + if (isTriggerTVX && !collision.selection_bit(aod::evsel::kIsTriggerTVX)) + return false; + if (fillHist) + rEventSelection.fill(HIST("hEventCutFlow"), 8); + + if (isGoodZvtxFT0vsPV && !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) + return false; + if (fillHist) + rEventSelection.fill(HIST("hEventCutFlow"), 9); + return true; } template bool selectionTrack(const T& candidate) { - if (isGlobalTracks && !(candidate.isGlobalTrackWoDCA() && candidate.isPVContributor() && std::abs(candidate.dcaXY()) < cfgCutDCAxy && std::abs(candidate.dcaZ()) < cfgCutDCAz && candidate.itsNCls() > cfgITScluster) && candidate.tpcNClsFound() > cfgTPCcluster) { + if (isGlobalTracks && !(candidate.isGlobalTrackWoDCA() && candidate.isPVContributor() && std::abs(candidate.dcaXY()) < cfgCutDCAxy && std::abs(candidate.dcaZ()) < cfgCutDCAz && candidate.itsNCls() > cfgITScluster && candidate.tpcNClsFound() > cfgTPCcluster && std::abs(candidate.eta()) < cfgCutEta && std::abs(candidate.pt()) > cfgCutPT)) { return false; } else if (!isGlobalTracks) { if (std::abs(candidate.pt()) < cfgCutPT) return false; + if (std::abs(candidate.eta()) > cfgCutEta) + return false; if (std::abs(candidate.dcaXY()) > cfgCutDCAxy) return false; if (std::abs(candidate.dcaZ()) > cfgCutDCAz) @@ -323,7 +387,7 @@ struct Kstarqa { return true; } } else { - if (candidate.hasTOF() && (candidate.tofNSigmaPi() * candidate.tofNSigmaPi() + candidate.tpcNSigmaPi() * candidate.tpcNSigmaPi()) < (nsigmaCutCombined * nsigmaCutCombined) && candidate.beta() > cBetaCutTOF) { + if (candidate.hasTOF() && (candidate.tofNSigmaPi() * candidate.tofNSigmaPi() + candidate.tpcNSigmaPi() * candidate.tpcNSigmaPi()) < (nsigmaCutCombinedPi * nsigmaCutCombinedPi) && candidate.beta() > cBetaCutTOF) { return true; } if (!candidate.hasTOF() && std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPCPi) { @@ -347,7 +411,7 @@ struct Kstarqa { return true; } } else { - if (candidate.hasTOF() && (candidate.tofNSigmaKa() * candidate.tofNSigmaKa() + candidate.tpcNSigmaKa() * candidate.tpcNSigmaKa()) < (nsigmaCutCombined * nsigmaCutCombined) && candidate.beta() > cBetaCutTOF) { + if (candidate.hasTOF() && (candidate.tofNSigmaKa() * candidate.tofNSigmaKa() + candidate.tpcNSigmaKa() * candidate.tpcNSigmaKa()) < (nsigmaCutCombinedKa * nsigmaCutCombinedKa) && candidate.beta() > cBetaCutTOF) { return true; } if (!candidate.hasTOF() && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPCKa) { @@ -362,23 +426,23 @@ struct Kstarqa { bool selectionPIDNew(const T& candidate, int PID) { if (PID == 0) { - if (candidate.pt() < 0.5 && TMath::Abs(candidate.tpcNSigmaPi()) < nsigmaCutTPCPi) { + if (candidate.pt() < 0.5 && std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPCPi) { return true; } - if (candidate.pt() >= 0.5 && TMath::Abs(candidate.tpcNSigmaPi()) < nsigmaCutTPCPi && candidate.hasTOF() && TMath::Abs(candidate.tofNSigmaPi()) < nsigmaCutTOFPi) { + if (candidate.pt() >= 0.5 && std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPCPi && candidate.hasTOF() && std::abs(candidate.tofNSigmaPi()) < nsigmaCutTOFPi) { return true; } - if (candidate.pt() >= 0.5 && TMath::Abs(candidate.tpcNSigmaPi()) < nsigmaCutTPCPi && !candidate.hasTOF()) { + if (candidate.pt() >= 0.5 && std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPCPi && !candidate.hasTOF()) { return true; } } else if (PID == 1) { - if (candidate.pt() < 0.5 && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPCKa) { + if (candidate.pt() < 0.5 && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPCKa) { return true; } - if (candidate.pt() >= 0.5 && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPCKa && candidate.hasTOF() && TMath::Abs(candidate.tofNSigmaKa()) < nsigmaCutTOFKa) { + if (candidate.pt() >= 0.5 && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPCKa && candidate.hasTOF() && std::abs(candidate.tofNSigmaKa()) < nsigmaCutTOFKa) { return true; } - if (candidate.pt() >= 0.5 && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPCKa && !candidate.hasTOF()) { + if (candidate.pt() >= 0.5 && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPCKa && !candidate.hasTOF()) { return true; } } @@ -478,9 +542,10 @@ struct Kstarqa { Filter acceptanceFilter = (nabs(aod::track::eta) < cfgCutEta && nabs(aod::track::pt) > cfgCutPT); Filter fDCAcutFilter = (nabs(aod::track::dcaXY) < cfgCutDCAxy) && (nabs(aod::track::dcaZ) < cfgCutDCAz); - using EventCandidates = soa::Filtered>; + using EventCandidates = soa::Join; // aod::CentNGlobals, aod::CentNTPVs, aod::CentMFTs + using EventCandidatesMix = soa::Filtered>; // aod::CentNGlobals, aod::CentNTPVs, aod::CentMFTs using TrackCandidates = soa::Filtered>; - using EventCandidatesMC = soa::Join; + using EventCandidatesMC = soa::Join; using TrackCandidatesMC = soa::Filtered>; @@ -527,8 +592,13 @@ struct Kstarqa { } } else { if (!isMix) { - if (calcLikeSign && std::abs(mother.Rapidity()) < 0.5) - hInvMass.fill(HIST("h3KstarInvMasslikeSign"), multiplicity, mother.Pt(), mother.M(), cosThetaStarHelicity); + if (calcLikeSign && std::abs(mother.Rapidity()) < 0.5) { + if (track1.sign() > 0 && track2.sign() > 0) { + hInvMass.fill(HIST("h3KstarInvMasslikeSignPP"), multiplicity, mother.Pt(), mother.M(), cosThetaStarHelicity); + } else if (track1.sign() < 0 && track2.sign() < 0) { + hInvMass.fill(HIST("h3KstarInvMasslikeSignMM"), multiplicity, mother.Pt(), mother.M(), cosThetaStarHelicity); + } + } } } @@ -546,7 +616,7 @@ struct Kstarqa { daughterRot = ROOT::Math::PxPyPzMVector(daughter1.Px() * std::cos(theta2) - daughter1.Py() * std::sin(theta2), daughter1.Px() * std::sin(theta2) + daughter1.Py() * std::cos(theta2), daughter1.Pz(), daughter1.M()); motherRot = daughterRot + daughter2; - if (calcRotational && abs(motherRot.Rapidity()) < 0.5) + if (calcRotational && std::abs(motherRot.Rapidity()) < 0.5) hInvMass.fill(HIST("h3KstarInvMassRotated"), multiplicity, motherRot.Pt(), motherRot.M(), cosThetaStarProduction); } } else if (isMix && std::abs(mother.Rapidity()) < 0.5) { @@ -554,8 +624,13 @@ struct Kstarqa { } } else { if (!isMix) { - if (calcLikeSign && std::abs(mother.Rapidity()) < 0.5) - hInvMass.fill(HIST("h3KstarInvMasslikeSign"), multiplicity, mother.Pt(), mother.M(), cosThetaStarProduction); + if (calcLikeSign && std::abs(mother.Rapidity()) < 0.5) { + if (track1.sign() > 0 && track2.sign() > 0) { + hInvMass.fill(HIST("h3KstarInvMasslikeSignPP"), multiplicity, mother.Pt(), mother.M(), cosThetaStarProduction); + } else if (track1.sign() < 0 && track2.sign() < 0) { + hInvMass.fill(HIST("h3KstarInvMasslikeSignMM"), multiplicity, mother.Pt(), mother.M(), cosThetaStarProduction); + } + } } } } else if (activateTHnSparseCosThStarBeam) { @@ -579,8 +654,13 @@ struct Kstarqa { hInvMass.fill(HIST("h3KstarInvMassMixed"), multiplicity, mother.Pt(), mother.M(), cosThetaStarBeam); } } else { - if (calcLikeSign && std::abs(mother.Rapidity()) < 0.5) - hInvMass.fill(HIST("h3KstarInvMasslikeSign"), multiplicity, mother.Pt(), mother.M(), cosThetaStarBeam); + if (calcLikeSign && std::abs(mother.Rapidity()) < 0.5) { + if (track1.sign() > 0 && track2.sign() > 0) { + hInvMass.fill(HIST("h3KstarInvMasslikeSignPP"), multiplicity, mother.Pt(), mother.M(), cosThetaStarBeam); + } else if (track1.sign() < 0 && track2.sign() < 0) { + hInvMass.fill(HIST("h3KstarInvMasslikeSignMM"), multiplicity, mother.Pt(), mother.M(), cosThetaStarBeam); + } + } } } else if (activateTHnSparseCosThStarRandom) { auto phiRandom = gRandom->Uniform(0.f, constants::math::TwoPI); @@ -607,8 +687,13 @@ struct Kstarqa { } } else { if (!isMix) { - if (calcLikeSign && std::abs(mother.Rapidity()) < 0.5) - hInvMass.fill(HIST("h3KstarInvMasslikeSign"), multiplicity, mother.Pt(), mother.M(), cosThetaStarRandom); + if (calcLikeSign && std::abs(mother.Rapidity()) < 0.5) { + if (track1.sign() > 0 && track2.sign() > 0) { + hInvMass.fill(HIST("h3KstarInvMasslikeSignPP"), multiplicity, mother.Pt(), mother.M(), cosThetaStarRandom); + } else if (track1.sign() < 0 && track2.sign() < 0) { + hInvMass.fill(HIST("h3KstarInvMasslikeSignMM"), multiplicity, mother.Pt(), mother.M(), cosThetaStarRandom); + } + } } } } @@ -650,9 +735,20 @@ struct Kstarqa { multiplicity = collision.centFT0A(); } else if (cSelectMultEstimator == 2) { multiplicity = collision.centFT0C(); + } else if (cSelectMultEstimator == 3) { + multiplicity = collision.centFV0A(); } else { multiplicity = collision.centFT0M(); } + /* else if (cSelectMultEstimator == 4) { + multiplicity = collision.centMFT(); + } */ + /* else if (cSelectMultEstimator == 5) { + multiplicity = collision.centNGlobal(); + } */ + /* else if (cSelectMultEstimator == 6) { + multiplicity = collision.centNTPV(); + } */ // Fill the event counter if (cQAevents) { @@ -680,6 +776,10 @@ struct Kstarqa { hPID.fill(HIST("Before/hNsigmaTOF_Pi_before"), track2.pt(), track2.tofNSigmaPi()); hPID.fill(HIST("Before/hNsigma_TPC_TOF_Ka_before"), track1.tpcNSigmaKa(), track1.tofNSigmaKa()); hPID.fill(HIST("Before/hNsigma_TPC_TOF_Pi_before"), track2.tpcNSigmaPi(), track2.tofNSigmaPi()); + hPID.fill(HIST("Before/hTPCnsigKa_mult_pt"), track1.tpcNSigmaKa(), multiplicity, track1.pt()); + hPID.fill(HIST("Before/hTPCnsigPi_mult_pt"), track2.tpcNSigmaPi(), multiplicity, track2.pt()); + hPID.fill(HIST("Before/hTOFnsigKa_mult_pt"), track1.tofNSigmaKa(), multiplicity, track1.pt()); + hPID.fill(HIST("Before/hTOFnsigPi_mult_pt"), track2.tofNSigmaKa(), multiplicity, track2.pt()); hOthers.fill(HIST("hCRFC_before"), track1.tpcCrossedRowsOverFindableCls()); hOthers.fill(HIST("dE_by_dx_TPC"), track1.p(), track1.tpcSignal()); @@ -738,6 +838,15 @@ struct Kstarqa { rEventSelection.fill(HIST("events_check_data"), 7.5); if (cQAplots) { + hPID.fill(HIST("After/hDcaxyPi"), track2.dcaXY()); + hPID.fill(HIST("After/hDcaxyKa"), track1.dcaXY()); + hPID.fill(HIST("After/hDcazPi"), track2.dcaZ()); + hPID.fill(HIST("After/hDcazKa"), track1.dcaZ()); + + hPID.fill(HIST("After/hTPCnsigKa_mult_pt"), track1.tpcNSigmaKa(), multiplicity, track1.pt()); + hPID.fill(HIST("After/hTPCnsigPi_mult_pt"), track2.tpcNSigmaPi(), multiplicity, track2.pt()); + hPID.fill(HIST("After/hTOFnsigKa_mult_pt"), track1.tofNSigmaKa(), multiplicity, track1.pt()); + hPID.fill(HIST("After/hTOFnsigPi_mult_pt"), track2.tofNSigmaKa(), multiplicity, track2.pt()); hOthers.fill(HIST("hEta_after"), track1.eta()); hOthers.fill(HIST("hCRFC_after"), track1.tpcCrossedRowsOverFindableCls()); hPID.fill(HIST("After/hNsigmaKaonTPC_after"), track1.pt(), track1.tpcNSigmaKa()); @@ -771,16 +880,19 @@ struct Kstarqa { using BinningTypeCentralityM = ColumnBinningPolicy; using BinningTypeVertexContributor = ColumnBinningPolicy; using BinningTypeFT0A = ColumnBinningPolicy; + using BinningTypeFV0A = ColumnBinningPolicy; BinningTypeVertexContributor binningOnPositions{{axisVertex, axisMultiplicity}, true}; BinningTypeCentralityM binningOnCentrality{{axisVertex, axisMultiplicity}, true}; BinningTypeFT0A binningOnFT0A{{axisVertex, axisMultiplicity}, true}; + BinningTypeFV0A binningOnFV0A{{axisVertex, axisMultiplicity}, true}; SameKindPair pair1{binningOnPositions, cfgNoMixedEvents, -1, &cache}; SameKindPair pair2{binningOnCentrality, cfgNoMixedEvents, -1, &cache}; SameKindPair pair3{binningOnFT0A, cfgNoMixedEvents, -1, &cache}; + SameKindPair pair4{binningOnFV0A, cfgNoMixedEvents, -1, &cache}; - void processME(EventCandidates const&, TrackCandidates const&) + void processME(EventCandidatesMix const&, TrackCandidates const&) { // Map estimator to pair and multiplicity accessor auto runMixing = [&](auto& pair, auto multiplicityGetter) { @@ -821,6 +933,8 @@ struct Kstarqa { runMixing(pair2, [](const auto& c) { return c.centFT0A(); }); } else if (cSelectMultEstimator == 2) { runMixing(pair3, [](const auto& c) { return c.centFT0C(); }); + } else if (cSelectMultEstimator == 3) { + runMixing(pair4, [](const auto& c) { return c.centFV0A(); }); } } @@ -863,6 +977,9 @@ struct Kstarqa { if (!collision.sel8()) { continue; } + if (isINELgt0 && !collision.isInelGt0()) { + continue; + } if (ispileupGoodvtxCut && (!collision.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { continue; } @@ -924,41 +1041,41 @@ struct Kstarqa { } PROCESS_SWITCH(Kstarqa, processGen, "Process Generated", false); - void processEvtLossSigLossMC(aod::McCollisions::iterator const&, aod::McParticles const& mcParticles, const soa::SmallGroups& recCollisions) - { - - bool isSel = false; - // auto multiplicity1 = -999.; - for (const auto& RecCollision : recCollisions) { - if (!selectionEvent(RecCollision)) - continue; - - // if (cSelectMultEstimator == 0) { - // multiplicity1 = RecCollision.centFT0M(); - // } else if (cSelectMultEstimator == 1) { - // multiplicity1 = RecCollision.centFT0A(); - // } else if (cSelectMultEstimator == 2) { - // multiplicity1 = RecCollision.centFT0C(); - // } else { - // multiplicity1 = RecCollision.centFT0M(); - // } + // void processEvtLossSigLossMC(aod::McCollisions::iterator const&, aod::McParticles const& mcParticles, const soa::SmallGroups& recCollisions) + // { - isSel = true; - } + // bool isSel = false; + // // auto multiplicity1 = -999.; + // for (const auto& RecCollision : recCollisions) { + // if (!selectionEvent(RecCollision)) + // continue; + + // // if (cSelectMultEstimator == 0) { + // // multiplicity1 = RecCollision.centFT0M(); + // // } else if (cSelectMultEstimator == 1) { + // // multiplicity1 = RecCollision.centFT0A(); + // // } else if (cSelectMultEstimator == 2) { + // // multiplicity1 = RecCollision.centFT0C(); + // // } else { + // // multiplicity1 = RecCollision.centFT0M(); + // // } + + // isSel = true; + // } - // Generated MC - for (const auto& mcPart : mcParticles) { - if (std::abs(mcPart.y()) >= 0.5 || std::abs(mcPart.pdgCode()) != 313) - continue; + // // Generated MC + // for (const auto& mcPart : mcParticles) { + // if (std::abs(mcPart.y()) >= 0.5 || std::abs(mcPart.pdgCode()) != 313) + // continue; - // signal loss estimation - hInvMass.fill(HIST("kstargenBeforeEvtSel"), mcPart.pt()); - if (isSel) { - hInvMass.fill(HIST("kstargenAfterEvtSel"), mcPart.pt()); - } - } // end loop on gen particles - } - PROCESS_SWITCH(Kstarqa, processEvtLossSigLossMC, "Process Signal Loss, Event Loss", false); + // // signal loss estimation + // hInvMass.fill(HIST("kstargenBeforeEvtSel"), mcPart.pt()); + // if (isSel) { + // hInvMass.fill(HIST("kstargenAfterEvtSel"), mcPart.pt()); + // } + // } // end loop on gen particles + // } + // PROCESS_SWITCH(Kstarqa, processEvtLossSigLossMC, "Process Signal Loss, Event Loss", false); void processRec(EventCandidatesMC::iterator const& collision, TrackCandidatesMC const& tracks, aod::McParticles const&, aod::McCollisions const& /*mcCollisions*/) { @@ -970,6 +1087,10 @@ struct Kstarqa { } rEventSelection.fill(HIST("events_checkrec"), 1.5); + if (isINELgt0 && !collision.isInelGt0()) { + return; + } + // if (std::abs(collision.mcCollision().posZ()) > cutzvertex || !collision.sel8()) { if (std::abs(collision.mcCollision().posZ()) > cutzvertex) { return; @@ -1059,7 +1180,7 @@ struct Kstarqa { hPID.fill(HIST("Before/hNsigmaTPC_Ka_before"), track2.pt(), track2.tpcNSigmaKa()); hPID.fill(HIST("Before/hNsigmaTOF_Ka_before"), track2.pt(), track2.tofNSigmaKa()); } - if (cQAplots && (abs(mctrack1.pdgCode()) == 321 && abs(mctrack2.pdgCode()) == 211)) { + if (cQAplots && (std::abs(mctrack1.pdgCode()) == 321 && std::abs(mctrack2.pdgCode()) == 211)) { hPID.fill(HIST("Before/hNsigma_TPC_TOF_Ka_before"), track1.tpcNSigmaKa(), track1.tofNSigmaKa()); hPID.fill(HIST("Before/hNsigma_TPC_TOF_Pi_before"), track2.tpcNSigmaPi(), track2.tofNSigmaPi()); } @@ -1136,7 +1257,7 @@ struct Kstarqa { daughter2 = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massPi); mother = daughter1 + daughter2; // Kstar meson - hInvMass.fill(HIST("h2KstarRecpt2"), mothertrack1.pt(), multiplicity, TMath::Sqrt(mothertrack1.e() * mothertrack1.e() - mothertrack1.p() * mothertrack1.p())); + hInvMass.fill(HIST("h2KstarRecpt2"), mothertrack1.pt(), multiplicity, std::sqrt(mothertrack1.e() * mothertrack1.e() - mothertrack1.p() * mothertrack1.p())); if (applyRecMotherRapidity && mother.Rapidity() >= 0) { continue; From 7149126cbf1115f7f6baaa3d00780f1b8b17e697 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Thu, 24 Jul 2025 06:52:32 +0200 Subject: [PATCH 030/345] [PWGEM/Dilepton] fix header file names (#12206) --- .../{DileptonHadron.h => DileptonHadronMPC.h} | 115 +++++----- PWGEM/Dilepton/Tasks/CMakeLists.txt | 9 +- ...nHadron2PC.cxx => dielectronHadronMPC.cxx} | 4 +- PWGEM/Dilepton/Tasks/dimuonHadronMPC.cxx | 27 +++ ...iphotonHadron2PC.h => DiphotonHadronMPC.h} | 208 ++++++++++++------ PWGEM/PhotonMeson/Tasks/CMakeLists.txt | 8 +- ...E.cxx => diphotonHadronMPCPCMDalitzEE.cxx} | 4 +- ...PCMPCM.cxx => diphotonHadronMPCPCMPCM.cxx} | 4 +- 8 files changed, 246 insertions(+), 133 deletions(-) rename PWGEM/Dilepton/Core/{DileptonHadron.h => DileptonHadronMPC.h} (95%) rename PWGEM/Dilepton/Tasks/{dielectronHadron2PC.cxx => dielectronHadronMPC.cxx} (77%) create mode 100644 PWGEM/Dilepton/Tasks/dimuonHadronMPC.cxx rename PWGEM/PhotonMeson/Core/{DiphotonHadron2PC.h => DiphotonHadronMPC.h} (82%) rename PWGEM/PhotonMeson/Tasks/{diphotonHadron2PCPCMDalitzEE.cxx => diphotonHadronMPCPCMDalitzEE.cxx} (88%) rename PWGEM/PhotonMeson/Tasks/{diphotonHadron2PCPCMPCM.cxx => diphotonHadronMPCPCMPCM.cxx} (85%) diff --git a/PWGEM/Dilepton/Core/DileptonHadron.h b/PWGEM/Dilepton/Core/DileptonHadronMPC.h similarity index 95% rename from PWGEM/Dilepton/Core/DileptonHadron.h rename to PWGEM/Dilepton/Core/DileptonHadronMPC.h index 026d52458c6..176cfcdb740 100644 --- a/PWGEM/Dilepton/Core/DileptonHadron.h +++ b/PWGEM/Dilepton/Core/DileptonHadronMPC.h @@ -14,8 +14,8 @@ // This code runs loop over leptons. // Please write to: daiki.sekihata@cern.ch -#ifndef PWGEM_DILEPTON_CORE_DILEPTONHADRON_H_ -#define PWGEM_DILEPTON_CORE_DILEPTONHADRON_H_ +#ifndef PWGEM_DILEPTON_CORE_DILEPTONHADRONMPC_H_ +#define PWGEM_DILEPTON_CORE_DILEPTONHADRONMPC_H_ #include "PWGEM/Dilepton/Core/DielectronCut.h" #include "PWGEM/Dilepton/Core/DimuonCut.h" @@ -97,7 +97,7 @@ using MyEMH_dimuon = o2::aod::pwgem::dilepton::utils::EventMixingHandler, std::pair, EMTrack>; // for charged track template -struct DileptonHadron { +struct DileptonHadronMPC { // Configurables Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; @@ -133,7 +133,7 @@ struct DileptonHadron { ConfigurableAxis ConfRapidityBins{"ConfRapidityBins", {20, -1, 1}, "rapidity bins for output histograms"}; ConfigurableAxis ConfDEtaBins{"ConfDEtaBins", {60, -3, 3}, "deta bins for output histograms"}; Configurable cfgNbinsDPhi{"cfgNbinsDPhi", 36, "nbins in dphi for output histograms"}; - Configurable cfgNbinsCosNDPhi{"cfgNbinsCosNDPhi", 100, "nbins in cos(n(dphi)) for output histograms"}; + Configurable cfgNbinsCosNDPhi{"cfgNbinsCosNDPhi", 200, "nbins in cos(n(dphi)) for output histograms"}; Configurable cfgNmod{"cfgNmod", 2, "n-th harmonics"}; EMEventCut fEMEventCut; @@ -397,10 +397,7 @@ struct DileptonHadron { leptonM2 = o2::constants::physics::MassMuon; } - fRegistry.add("DileptonHadron/mix/hDiffBC", "diff. global BC in mixed event;|BC_{current} - BC_{mixed}|", kTH1D, {{10001, -0.5, 10000.5}}, true); - fRegistry.addClone("DileptonHadron/mix/hDiffBC", "HadronHadron/mix/hDiffBC"); - - if (doprocessTriggerAnalysis) { + if (doprocess2PCwithTrigger) { fRegistry.add("Event/hNInspectedTVX", "N inspected TVX;run number;N_{TVX}", kTProfile, {{80000, 520000.5, 600000.5}}, true); } } @@ -453,7 +450,7 @@ struct DileptonHadron { } } - ~DileptonHadron() + ~DileptonHadronMPC() { delete emh_pos; emh_pos = 0x0; @@ -466,6 +463,9 @@ struct DileptonHadron { void addhistograms() { + // event info + o2::aod::pwgem::dilepton::utils::eventhistogram::addEventHistograms<-1>(&fRegistry); + std::string mass_axis_title = "m_{ll} (GeV/c^{2})"; std::string pair_pt_axis_title = "p_{T,ll}^{trg} (GeV/c)"; std::string pair_dca_axis_title = "DCA_{ll} (#sigma)"; @@ -525,6 +525,13 @@ struct DileptonHadron { fRegistry.addClone("Dilepton/same/uls/", "Dilepton/same/lspp/"); fRegistry.addClone("Dilepton/same/uls/", "Dilepton/same/lsmm/"); fRegistry.addClone("Dilepton/same/", "Dilepton/mix/"); + + // hadron-hadron + const AxisSpec axis_deta_hh{ConfDEtaBins, "#Delta#eta = #eta_{h}^{trg} - #eta_{h}^{ref}"}; + // const AxisSpec axis_dphi_hh{cfgNbinsDPhi, -M_PI/2, 3 * M_PI/2, "#Delta#varphi = #varphi_{h}^{trg} - #varphi_{h}^{ref} (rad.)"}; + const AxisSpec axis_cosndphi_hh{cfgNbinsCosNDPhi, -1, +1, std::format("cos({0:d}(#varphi_{{h}}^{{trg}} - #varphi_{{h}}^{{ref}}))", cfgNmod.value)}; + fRegistry.add("HadronHadron/same/hs", "hadron-hadron 2PC", kTHnSparseD, {axis_pt_trg, axis_pt_ref, axis_deta_hh, axis_cosndphi_hh}, true); + // fRegistry.addClone("HadronHadron/same/", "HadronHadron/mix/"); } else { // same as kCumulant to avoid seg. fault fRegistry.add("Hadron/hs", "hadron", kTHnSparseD, {axis_pt_trg, axis_eta_trg, axis_phi_trg}, true); @@ -537,17 +544,15 @@ struct DileptonHadron { fRegistry.addClone("Dilepton/same/uls/", "Dilepton/same/lspp/"); fRegistry.addClone("Dilepton/same/uls/", "Dilepton/same/lsmm/"); fRegistry.addClone("Dilepton/same/", "Dilepton/mix/"); - } - - // hadron-hadron - const AxisSpec axis_deta_hh{ConfDEtaBins, "#Delta#eta = #eta_{h}^{trg} - #eta_{h}^{ref}"}; - // const AxisSpec axis_dphi_hh{cfgNbinsDPhi, -M_PI/2, 3 * M_PI/2, "#Delta#varphi = #varphi_{h}^{trg} - #varphi_{h}^{ref} (rad.)"}; - const AxisSpec axis_cosndphi_hh{cfgNbinsCosNDPhi, -1, +1, std::format("cos({0:d}(#varphi_{{h}}^{{trg}} - #varphi_{{h}}^{{ref}}))", cfgNmod.value)}; - fRegistry.add("HadronHadron/same/hs", "hadron-hadron 2PC", kTHnSparseD, {axis_pt_trg, axis_pt_ref, axis_deta_hh, axis_cosndphi_hh}, true); - fRegistry.addClone("HadronHadron/same/", "HadronHadron/mix/"); - // event info - o2::aod::pwgem::dilepton::utils::eventhistogram::addEventHistograms<-1>(&fRegistry); + // hadron-hadron + const AxisSpec axis_deta_hh{ConfDEtaBins, "#Delta#eta = #eta_{h}^{trg} - #eta_{h}^{ref}"}; + // const AxisSpec axis_dphi_hh{cfgNbinsDPhi, -M_PI/2, 3 * M_PI/2, "#Delta#varphi = #varphi_{h}^{trg} - #varphi_{h}^{ref} (rad.)"}; + const AxisSpec axis_cosndphi_hh{cfgNbinsCosNDPhi, -1, +1, std::format("cos({0:d}(#varphi_{{h}}^{{trg}} - #varphi_{{h}}^{{ref}}))", cfgNmod.value)}; + fRegistry.add("HadronHadron/same/hs", "hadron-hadron 2PC", kTHnSparseD, {axis_pt_trg, axis_pt_ref, axis_deta_hh, axis_cosndphi_hh}, true); + // fRegistry.addClone("HadronHadron/same/", "HadronHadron/mix/"); + } + fRegistry.add("Dilepton/mix/hDiffBC", "diff. global BC in mixed event;|BC_{current} - BC_{mixed}|", kTH1D, {{10001, -0.5, 10000.5}}, true); } void DefineEMEventCut() @@ -1053,6 +1058,8 @@ struct DileptonHadron { if (!fEMTrackCut.IsSelected(t1) || !fEMTrackCut.IsSelected(t2)) { // for charged track return false; } + } else { + return false; // mixed event is not necessary for cumulant method. } float weight = 1.f; @@ -1063,21 +1070,9 @@ struct DileptonHadron { float cosndphi = std::cos(cfgNmod * dphi); if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonHadronAnalysisType::kCumulant)) { - if (t1.sign() * t2.sign() < 0) { // ULS - fRegistry.fill(HIST("HadronHadron/") + HIST(event_pair_types[ev_id]) + HIST("hs"), t1.pt(), t2.pt(), deta, cosndphi, weight); - } else if (t1.sign() > 0 && t2.sign() > 0) { // LS++ - fRegistry.fill(HIST("HadronHadron/") + HIST(event_pair_types[ev_id]) + HIST("hs"), t1.pt(), t2.pt(), deta, cosndphi, weight); - } else if (t1.sign() < 0 && t2.sign() < 0) { // LS- - fRegistry.fill(HIST("HadronHadron/") + HIST(event_pair_types[ev_id]) + HIST("hs"), t1.pt(), t2.pt(), deta, cosndphi, weight); - } - } else { // same as kCumulant to avoid seg. fault - if (t1.sign() * t2.sign() < 0) { // ULS - fRegistry.fill(HIST("HadronHadron/") + HIST(event_pair_types[ev_id]) + HIST("hs"), t1.pt(), t2.pt(), deta, cosndphi, weight); - } else if (t1.sign() > 0 && t2.sign() > 0) { // LS++ - fRegistry.fill(HIST("HadronHadron/") + HIST(event_pair_types[ev_id]) + HIST("hs"), t1.pt(), t2.pt(), deta, cosndphi, weight); - } else if (t1.sign() < 0 && t2.sign() < 0) { // LS-- - fRegistry.fill(HIST("HadronHadron/") + HIST(event_pair_types[ev_id]) + HIST("hs"), t1.pt(), t2.pt(), deta, cosndphi, weight); - } + fRegistry.fill(HIST("HadronHadron/") + HIST(event_pair_types[ev_id]) + HIST("hs"), t1.pt(), t2.pt(), deta, cosndphi, weight); + } else { // same as kCumulant to avoid seg. fault + fRegistry.fill(HIST("HadronHadron/") + HIST(event_pair_types[ev_id]) + HIST("hs"), t1.pt(), t2.pt(), deta, cosndphi, weight); } // // store tracks for event mixing without double counting @@ -1199,7 +1194,7 @@ struct DileptonHadron { int ndf = 0; template - void runPairing(TCollisions const& collisions, TLeptons const& posTracks, TLeptons const& negTracks, TPresilce const& perCollision, TCut const& cut, TAllTracks const& tracks, TRefTracks const& refTracks) + void run2PC(TCollisions const& collisions, TLeptons const& posTracks, TLeptons const& negTracks, TPresilce const& perCollision, TCut const& cut, TAllTracks const& tracks, TRefTracks const& refTracks) { for (const auto& collision : collisions) { initCCDB(collision); @@ -1230,8 +1225,8 @@ struct DileptonHadron { auto refTracks_per_coll = refTracks.sliceBy(perCollision_track, collision.globalIndex()); for (const auto& track : refTracks_per_coll) { - if (fEMTrackCut.IsSelected(track)) { // for charged track - fRegistry.fill(HIST("Hadron/hs"), track.pt(), track.eta(), track.phi()); // accepted + if (fEMTrackCut.IsSelected(track)) { + fRegistry.fill(HIST("Hadron/hs"), track.pt(), track.eta(), track.phi()); } } @@ -1244,32 +1239,34 @@ struct DileptonHadron { bool is_pair_ok = fillDilepton<0>(collision, pos, neg, cut, tracks); if (is_pair_ok) { nuls++; - } - for (const auto& reftrack : refTracks_per_coll) { - fillDileptonHadron<0>(collision, pos, neg, cut, tracks, reftrack); + for (const auto& reftrack : refTracks_per_coll) { + fillDileptonHadron<0>(collision, pos, neg, cut, tracks, reftrack); + } } } for (const auto& [pos1, pos2] : combinations(CombinationsStrictlyUpperIndexPolicy(posTracks_per_coll, posTracks_per_coll))) { // LS++ bool is_pair_ok = fillDilepton<0>(collision, pos1, pos2, cut, tracks); if (is_pair_ok) { nlspp++; - } - for (const auto& reftrack : refTracks_per_coll) { - fillDileptonHadron<0>(collision, pos1, pos2, cut, tracks, reftrack); + for (const auto& reftrack : refTracks_per_coll) { + fillDileptonHadron<0>(collision, pos1, pos2, cut, tracks, reftrack); + } } } for (const auto& [neg1, neg2] : combinations(CombinationsStrictlyUpperIndexPolicy(negTracks_per_coll, negTracks_per_coll))) { // LS-- bool is_pair_ok = fillDilepton<0>(collision, neg1, neg2, cut, tracks); if (is_pair_ok) { nlsmm++; - } - for (const auto& reftrack : refTracks_per_coll) { - fillDileptonHadron<0>(collision, neg1, neg2, cut, tracks, reftrack); + for (const auto& reftrack : refTracks_per_coll) { + fillDileptonHadron<0>(collision, neg1, neg2, cut, tracks, reftrack); + } } } - for (const auto& [trg, ref] : combinations(CombinationsStrictlyUpperIndexPolicy(refTracks_per_coll, refTracks_per_coll))) { - fillHadronHadron<0>(trg, ref); + if (nuls > 0 || nlspp > 0 || nlsmm > 0) { // at least 1 pair exists. + for (const auto& [trg, ref] : combinations(CombinationsStrictlyUpperIndexPolicy(refTracks_per_coll, refTracks_per_coll))) { + fillHadronHadron<0>(trg, ref); + } } if (!cfgDoMix || !(nuls > 0 || nlspp > 0 || nlsmm > 0)) { @@ -1328,7 +1325,7 @@ struct DileptonHadron { auto globalBC_mix = map_mixed_eventId_to_globalBC[mix_dfId_collisionId]; uint64_t diffBC = std::max(collision.globalBC(), globalBC_mix) - std::min(collision.globalBC(), globalBC_mix); - fRegistry.fill(HIST("DileptonHadron/mix/hDiffBC"), diffBC); + fRegistry.fill(HIST("Dilepton/mix/hDiffBC"), diffBC); if (diffBC < ndiff_bc_mix) { continue; } @@ -1491,49 +1488,49 @@ struct DileptonHadron { passed_pairIds.shrink_to_fit(); } - void processAnalysis(FilteredMyCollisions const& collisions, MyTracks const& refTracks, Types const&... args) + void process2PC(FilteredMyCollisions const& collisions, MyTracks const& refTracks, Types const&... args) { if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { auto electrons = std::get<0>(std::tie(args...)); if (cfgApplyWeightTTCA) { fillPairWeightMap(collisions, positive_electrons, negative_electrons, o2::aod::emprimaryelectron::emeventId, fDielectronCut, electrons); } - runPairing(collisions, positive_electrons, negative_electrons, o2::aod::emprimaryelectron::emeventId, fDielectronCut, electrons, refTracks); + run2PC(collisions, positive_electrons, negative_electrons, o2::aod::emprimaryelectron::emeventId, fDielectronCut, electrons, refTracks); } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { auto muons = std::get<0>(std::tie(args...)); if (cfgApplyWeightTTCA) { fillPairWeightMap(collisions, positive_muons, negative_muons, o2::aod::emprimarymuon::emeventId, fDimuonCut, muons); } - runPairing(collisions, positive_muons, negative_muons, o2::aod::emprimarymuon::emeventId, fDimuonCut, muons, refTracks); + run2PC(collisions, positive_muons, negative_muons, o2::aod::emprimarymuon::emeventId, fDimuonCut, muons, refTracks); } map_weight.clear(); ndf++; } - PROCESS_SWITCH(DileptonHadron, processAnalysis, "run dilepton analysis", true); + PROCESS_SWITCH(DileptonHadronMPC, process2PC, "run dilepton analysis", true); using FilteredMyCollisionsWithSWT = soa::Filtered; - void processTriggerAnalysis(FilteredMyCollisionsWithSWT const& collisions, MyTracks const& refTracks, Types const&... args) + void process2PCwithTrigger(FilteredMyCollisionsWithSWT const& collisions, MyTracks const& refTracks, Types const&... args) { if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { auto electrons = std::get<0>(std::tie(args...)); if (cfgApplyWeightTTCA) { fillPairWeightMap(collisions, positive_electrons, negative_electrons, o2::aod::emprimaryelectron::emeventId, fDielectronCut, electrons); } - runPairing(collisions, positive_electrons, negative_electrons, o2::aod::emprimaryelectron::emeventId, fDielectronCut, electrons, refTracks); + run2PC(collisions, positive_electrons, negative_electrons, o2::aod::emprimaryelectron::emeventId, fDielectronCut, electrons, refTracks); } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { auto muons = std::get<0>(std::tie(args...)); if (cfgApplyWeightTTCA) { fillPairWeightMap(collisions, positive_muons, negative_muons, o2::aod::emprimarymuon::emeventId, fDimuonCut, muons); } - runPairing(collisions, positive_muons, negative_muons, o2::aod::emprimarymuon::emeventId, fDimuonCut, muons, refTracks); + run2PC(collisions, positive_muons, negative_muons, o2::aod::emprimarymuon::emeventId, fDimuonCut, muons, refTracks); } map_weight.clear(); ndf++; } - PROCESS_SWITCH(DileptonHadron, processTriggerAnalysis, "run dilepton analysis on triggered data", false); + PROCESS_SWITCH(DileptonHadronMPC, process2PCwithTrigger, "run dilepton analysis on triggered data", false); void processDummy(MyCollisions const&) {} - PROCESS_SWITCH(DileptonHadron, processDummy, "Dummy function", false); + PROCESS_SWITCH(DileptonHadronMPC, processDummy, "Dummy function", false); }; -#endif // PWGEM_DILEPTON_CORE_DILEPTONHADRON_H_ +#endif // PWGEM_DILEPTON_CORE_DILEPTONHADRONMPC_H_ diff --git a/PWGEM/Dilepton/Tasks/CMakeLists.txt b/PWGEM/Dilepton/Tasks/CMakeLists.txt index b7cb367ecbb..fd976b5e79f 100644 --- a/PWGEM/Dilepton/Tasks/CMakeLists.txt +++ b/PWGEM/Dilepton/Tasks/CMakeLists.txt @@ -151,8 +151,13 @@ o2physics_add_dpl_workflow(qvector-dummy-otf PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(dielectron-hadron-2pc - SOURCES dielectronHadron2PC.cxx +o2physics_add_dpl_workflow(dielectron-hadron-mpc + SOURCES dielectronHadronMPC.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2Physics::AnalysisCore O2Physics::MLCore O2Physics::PWGEMDileptonCore + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(dimuon-hadron-mpc + SOURCES dimuonHadronMPC.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2Physics::AnalysisCore O2Physics::MLCore O2Physics::PWGEMDileptonCore COMPONENT_NAME Analysis) diff --git a/PWGEM/Dilepton/Tasks/dielectronHadron2PC.cxx b/PWGEM/Dilepton/Tasks/dielectronHadronMPC.cxx similarity index 77% rename from PWGEM/Dilepton/Tasks/dielectronHadron2PC.cxx rename to PWGEM/Dilepton/Tasks/dielectronHadronMPC.cxx index fb3b63f1b33..42cfa2eac28 100644 --- a/PWGEM/Dilepton/Tasks/dielectronHadron2PC.cxx +++ b/PWGEM/Dilepton/Tasks/dielectronHadronMPC.cxx @@ -14,7 +14,7 @@ // This code is for dielectron analyses. // Please write to: daiki.sekihata@cern.ch -#include "PWGEM/Dilepton/Core/DileptonHadron.h" +#include "PWGEM/Dilepton/Core/DileptonHadronMPC.h" #include "Framework/ASoAHelpers.h" #include "Framework/AnalysisTask.h" @@ -23,5 +23,5 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ - adaptAnalysisTask>(cfgc, TaskName{"dielectron-hadron-2pc"})}; + adaptAnalysisTask>(cfgc, TaskName{"dielectron-hadron-2pc"})}; } diff --git a/PWGEM/Dilepton/Tasks/dimuonHadronMPC.cxx b/PWGEM/Dilepton/Tasks/dimuonHadronMPC.cxx new file mode 100644 index 00000000000..2e0cf5f5e59 --- /dev/null +++ b/PWGEM/Dilepton/Tasks/dimuonHadronMPC.cxx @@ -0,0 +1,27 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// +// ======================== +// +// This code is for dimuon analyses. +// Please write to: daiki.sekihata@cern.ch + +#include "PWGEM/Dilepton/Core/DileptonHadronMPC.h" + +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask>(cfgc, TaskName{"dimuon-hadron-mpc"})}; +} diff --git a/PWGEM/PhotonMeson/Core/DiphotonHadron2PC.h b/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h similarity index 82% rename from PWGEM/PhotonMeson/Core/DiphotonHadron2PC.h rename to PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h index aa2746f6291..499b3fe1184 100644 --- a/PWGEM/PhotonMeson/Core/DiphotonHadron2PC.h +++ b/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h @@ -11,15 +11,15 @@ // // ======================== // -/// \file DiphotonHadron2PC.h +/// \file DiphotonHadronMPC.h /// \brief This code is to analyze diphoton-hadron correlation. Keep in mind that cumulant method does not require event mixing. /// /// \author D. Sekihata, daiki.sekihata@cern.ch -#ifndef PWGEM_PHOTONMESON_CORE_DIPHOTONHADRON2PC_H_ -#define PWGEM_PHOTONMESON_CORE_DIPHOTONHADRON2PC_H_ +#ifndef PWGEM_PHOTONMESON_CORE_DIPHOTONHADRONMPC_H_ +#define PWGEM_PHOTONMESON_CORE_DIPHOTONHADRONMPC_H_ -// #include "PWGEM/Dilepton/Core/EMTrackCut.h" +#include "PWGEM/Dilepton/Core/EMTrackCut.h" #include "PWGEM/Dilepton/Utils/EMTrack.h" #include "PWGEM/Dilepton/Utils/EMTrackUtilities.h" #include "PWGEM/Dilepton/Utils/EventMixingHandler.h" @@ -69,6 +69,9 @@ using namespace o2::aod::pwgem::dilepton::utils; using MyCollisions = soa::Join; using MyCollision = MyCollisions::iterator; +using MyCollisionsWithSWT = soa::Join; +using MyCollisionWithSWT = MyCollisionsWithSWT::iterator; + using MyV0Photons = soa::Filtered>; using MyV0Photon = MyV0Photons::iterator; @@ -79,13 +82,14 @@ using MyTracks = soa::Join; using MyTrack = MyTracks::iterator; template -struct DiphotonHadron2PC { +struct DiphotonHadronMPC { Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"}; Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; Configurable skipGRPOquery{"skipGRPOquery", true, "skip grpo query"}; Configurable d_bz_input{"d_bz_input", -999, "bz field in kG, -999 is automatic"}; + Configurable cfg_swt_name{"cfg_swt_name", "fHighTrackMult", "desired software trigger name"}; // 1 trigger name per 1 task. fHighTrackMult, fHighFt0Mult Configurable cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2"}; Configurable cfgOccupancyEstimator{"cfgOccupancyEstimator", 0, "FT0C:0, Track:1"}; @@ -105,7 +109,7 @@ struct DiphotonHadron2PC { ConfigurableAxis ConfPtHadronBins{"ConfPtHadronBins", {VARIABLE_WIDTH, 0.00, 0.15, 0.2, 0.3, 0.4, 0.50, 1.00, 2.00, 3.00, 4.00, 5.00}, "pT,h bins for output histograms"}; ConfigurableAxis ConfDEtaBins{"ConfDEtaBins", {60, -3, 3}, "deta bins for output histograms"}; Configurable cfgNbinsDPhi{"cfgNbinsDPhi", 36, "nbins in dphi for output histograms"}; - Configurable cfgNbinsCosNDPhi{"cfgNbinsCosNDPhi", 100, "nbins in cos(n(dphi)) for output histograms"}; + Configurable cfgNbinsCosNDPhi{"cfgNbinsCosNDPhi", 200, "nbins in cos(n(dphi)) for output histograms"}; Configurable cfgNmod{"cfgNmod", 2, "n-th harmonics"}; EMPhotonEventCut fEMEventCut; @@ -195,26 +199,26 @@ struct DiphotonHadron2PC { Configurable cfg_max_TOFNsigmaEl{"cfg_max_TOFNsigmaEl", +3.0, "max. TOF n sigma for electron inclusion"}; } dileptoncuts; - // EMTrackCut fEMTrackCut; - // struct : ConfigurableGroup { - // std::string prefix = "trackcut_group"; - // Configurable cfg_min_pt_track{"cfg_min_pt_track", 0.15, "min pT for ref. track"}; - // Configurable cfg_max_pt_track{"cfg_max_pt_track", 3.0, "max pT for ref. track"}; - // Configurable cfg_min_eta_track{"cfg_min_eta_track", -1.2, "min eta for ref. track"}; - // Configurable cfg_max_eta_track{"cfg_max_eta_track", +1.2, "max eta for ref. track"}; - // Configurable cfg_min_phi_track{"cfg_min_phi_track", 0., "min phi for ref. track"}; - // Configurable cfg_max_phi_track{"cfg_max_phi_track", 6.3, "max phi for ref. track"}; - // Configurable cfg_min_ncluster_its{"cfg_min_ncluster_its", 5, "min ncluster its"}; - // Configurable cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 0, "min ncluster tpc"}; - // Configurable cfg_min_ncrossedrows{"cfg_min_ncrossedrows", 70, "min ncrossed rows"}; - // Configurable cfg_max_frac_shared_clusters_tpc{"cfg_max_frac_shared_clusters_tpc", 0.7, "max fraction of shared clusters in TPC"}; - // Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; - // Configurable cfg_max_chi2its{"cfg_max_chi2its", 36.0, "max chi2/NclsITS"}; - // Configurable cfg_max_dcaxy{"cfg_max_dcaxy", 1.0, "max dca XY for single track in cm"}; - // Configurable cfg_max_dcaz{"cfg_max_dcaz", 1.0, "max dca Z for single track in cm"}; - // Configurable cfg_require_itsib_any{"cfg_require_itsib_any", true, "flag to require ITS ib any hits"}; - // Configurable cfg_require_itsib_1st{"cfg_require_itsib_1st", false, "flag to require ITS ib 1st hit"}; - // } trackcuts; + EMTrackCut fEMTrackCut; + struct : ConfigurableGroup { + std::string prefix = "trackcut_group"; + Configurable cfg_min_pt_track{"cfg_min_pt_track", 0.15, "min pT for ref. track"}; + Configurable cfg_max_pt_track{"cfg_max_pt_track", 3.0, "max pT for ref. track"}; + Configurable cfg_min_eta_track{"cfg_min_eta_track", -1.2, "min eta for ref. track"}; + Configurable cfg_max_eta_track{"cfg_max_eta_track", +1.2, "max eta for ref. track"}; + Configurable cfg_min_phi_track{"cfg_min_phi_track", 0., "min phi for ref. track"}; + Configurable cfg_max_phi_track{"cfg_max_phi_track", 6.3, "max phi for ref. track"}; + Configurable cfg_min_ncluster_its{"cfg_min_ncluster_its", 5, "min ncluster its"}; + Configurable cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 0, "min ncluster tpc"}; + Configurable cfg_min_ncrossedrows{"cfg_min_ncrossedrows", 70, "min ncrossed rows"}; + Configurable cfg_max_frac_shared_clusters_tpc{"cfg_max_frac_shared_clusters_tpc", 0.7, "max fraction of shared clusters in TPC"}; + Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; + Configurable cfg_max_chi2its{"cfg_max_chi2its", 36.0, "max chi2/NclsITS"}; + Configurable cfg_max_dcaxy{"cfg_max_dcaxy", 1.0, "max dca XY for single track in cm"}; + Configurable cfg_max_dcaz{"cfg_max_dcaz", 1.0, "max dca Z for single track in cm"}; + Configurable cfg_require_itsib_any{"cfg_require_itsib_any", true, "flag to require ITS ib any hits"}; + Configurable cfg_require_itsib_1st{"cfg_require_itsib_1st", false, "flag to require ITS ib 1st hit"}; + } trackcuts; o2::aod::rctsel::RCTFlagsChecker rctChecker; HistogramRegistry fRegistry{"output", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; @@ -249,10 +253,14 @@ struct DiphotonHadron2PC { addHistograms(); DefineEMEventCut(); + DefineEMTrackCut(); DefinePCMCut(); DefineDileptonCut(); fRegistry.add("Diphoton/mix/hDiffBC", "diff. global BC in mixed event;|BC_{current} - BC_{mixed}|", kTH1D, {{10001, -0.5, 10000.5}}, true); + if (doprocess2PCwithTrigger) { + fRegistry.add("Event/hNInspectedTVX", "N inspected TVX;run number;N_{TVX}", kTProfile, {{80000, 520000.5, 600000.5}}, true); + } mRunNumber = 0; d_bz = 0; @@ -264,7 +272,7 @@ struct DiphotonHadron2PC { rctChecker.init(eventcuts.cfgRCTLabel.value, eventcuts.cfgCheckZDC.value, eventcuts.cfgTreatLimitedAcceptanceAsBad.value); } - template + template void initCCDB(TCollision const& collision) { if (mRunNumber == collision.runNumber()) { @@ -301,9 +309,15 @@ struct DiphotonHadron2PC { LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; } mRunNumber = collision.runNumber(); + + if constexpr (isTriggerAnalysis) { + LOGF(info, "Trigger analysis is enabled. Desired trigger name = %s", cfg_swt_name.value); + LOGF(info, "total inspected TVX events = %d in run number %d", collision.nInspectedTVX(), collision.runNumber()); + fRegistry.fill(HIST("Event/hNInspectedTVX"), collision.runNumber(), collision.nInspectedTVX()); + } } - ~DiphotonHadron2PC() + ~DiphotonHadronMPC() { delete emh1; emh1 = 0x0; @@ -365,7 +379,8 @@ struct DiphotonHadron2PC { // hadron-hadron const AxisSpec axis_deta_hh{ConfDEtaBins, "#Delta#eta = #eta_{h}^{trg} - #eta_{h}^{ref}"}; const AxisSpec axis_cosndphi_hh{cfgNbinsCosNDPhi, -1, +1, std::format("cos({0:d}(#varphi_{{h}}^{{trg}} - #varphi_{{h}}^{{ref}}))", cfgNmod.value)}; - fRegistry.add("HadronHadron/same/hs", "hadron-hadron 2PC", kTHnSparseD, {axis_pt_trg, axis_pt_ref, axis_deta_hh, axis_cosndphi_hh}, true); + fRegistry.add("HadronHadron_for_Diphoton/same/hs", "hadron-hadron 2PC", kTHnSparseD, {axis_pt_trg, axis_pt_ref, axis_deta_hh, axis_cosndphi_hh}, true); + fRegistry.addClone("HadronHadron_for_Diphoton/same/hs", "HadronHadron_for_Photon/same/hs"); } void DefineEMEventCut() @@ -445,6 +460,25 @@ struct DiphotonHadron2PC { fDileptonCut.SetTOFNsigmaElRange(dileptoncuts.cfg_min_TOFNsigmaEl, dileptoncuts.cfg_max_TOFNsigmaEl); } + void DefineEMTrackCut() + { + fEMTrackCut = EMTrackCut("fEMTrackCut", "fEMTrackCut"); + fEMTrackCut.SetTrackPtRange(trackcuts.cfg_min_pt_track, trackcuts.cfg_max_pt_track); + fEMTrackCut.SetTrackEtaRange(trackcuts.cfg_min_eta_track, trackcuts.cfg_max_eta_track); + fEMTrackCut.SetTrackPhiRange(trackcuts.cfg_min_phi_track, trackcuts.cfg_max_phi_track); + fEMTrackCut.SetMinNClustersTPC(trackcuts.cfg_min_ncluster_tpc); + fEMTrackCut.SetMinNCrossedRowsTPC(trackcuts.cfg_min_ncrossedrows); + fEMTrackCut.SetMinNCrossedRowsOverFindableClustersTPC(0.8); + fEMTrackCut.SetMaxFracSharedClustersTPC(trackcuts.cfg_max_frac_shared_clusters_tpc); + fEMTrackCut.SetChi2PerClusterTPC(0.0, trackcuts.cfg_max_chi2tpc); + fEMTrackCut.SetChi2PerClusterITS(0.0, trackcuts.cfg_max_chi2its); + fEMTrackCut.SetNClustersITS(trackcuts.cfg_min_ncluster_its, 7); + fEMTrackCut.SetTrackMaxDcaXY(trackcuts.cfg_max_dcaxy); + fEMTrackCut.SetTrackMaxDcaZ(trackcuts.cfg_max_dcaz); + fEMTrackCut.RequireITSibAny(trackcuts.cfg_require_itsib_any); + fEMTrackCut.RequireITSib1st(trackcuts.cfg_require_itsib_1st); + } + SliceCache cache; Preslice perCollision_pcm = aod::v0photonkf::emeventId; Preslice perCollision_track = aod::emprimarytrack::emeventId; @@ -460,20 +494,27 @@ struct DiphotonHadron2PC { std::vector> used_dileptonIds; // std::map, uint64_t> map_mixed_eventId_to_globalBC; - template - void runPairing(TCollisions const& collisions, - TPhotons1 const& photons1, TPhotons2 const& photons2, TSubInfos1 const&, TSubInfos2 const&, TPreslice1 const& perCollision1, TPreslice2 const& perCollision2, TCut1 const& cut1, TCut2 const& cut2, - TRefTracks const& refTracks) + template + void run2PC(TCollisions const& collisions, + TPhotons1 const& photons1, TPhotons2 const& photons2, TSubInfos1 const&, TSubInfos2 const&, TPreslice1 const& perCollision1, TPreslice2 const& perCollision2, TCut1 const& cut1, TCut2 const& cut2, + TRefTracks const& refTracks) { for (const auto& collision : collisions) { - initCCDB(collision); + initCCDB(collision); int ndiphoton = 0; + int nphoton = 0; const float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { continue; } + if constexpr (isTriggerAnalysis) { + if (!collision.swtalias_bit(o2::aod::pwgem::dilepton::swt::aliasLabels.at(cfg_swt_name.value))) { + continue; + } + } + o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<0>(&fRegistry, collision, 1.f); if (!fEMEventCut.IsSelected(collision)) { continue; @@ -521,14 +562,9 @@ struct DiphotonHadron2PC { auto refTracks_per_collision = refTracks.sliceBy(perCollision_track, collision.globalIndex()); for (const auto& track : refTracks_per_collision) { - fRegistry.fill(HIST("Hadron/hs"), track.pt(), track.eta(), track.phi()); - } - - for (const auto& [trg, ref] : combinations(CombinationsStrictlyUpperIndexPolicy(refTracks_per_collision, refTracks_per_collision))) { - float deta = trg.eta() - ref.eta(); - float dphi = trg.phi() - ref.phi(); - o2::math_utils::bringTo02Pi(dphi); - fRegistry.fill(HIST("HadronHadron/same/hs"), trg.pt(), ref.pt(), deta, std::cos(cfgNmod * dphi)); + if (fEMTrackCut.IsSelected(track)) { + fRegistry.fill(HIST("Hadron/hs"), track.pt(), track.eta(), track.phi()); + } } std::tuple key_bin = std::make_tuple(zbin, centbin, epbin, occbin); @@ -541,12 +577,15 @@ struct DiphotonHadron2PC { for (const auto& photon : photons1_per_collision) { // single photon if (cut1.template IsSelected(photon)) { fRegistry.fill(HIST("Photon/hs"), photon.pt(), photon.eta(), photon.phi()); + nphoton++; for (const auto& track : refTracks_per_collision) { - float deta = photon.eta() - track.eta(); - float dphi = photon.phi() - track.phi(); - o2::math_utils::bringTo02Pi(dphi); + if (fEMTrackCut.IsSelected(track)) { + float deta = photon.eta() - track.eta(); + float dphi = photon.phi() - track.phi(); + o2::math_utils::bringTo02Pi(dphi); - fRegistry.fill(HIST("PhotonHadron/same/hs"), photon.pt(), track.pt(), deta, std::cos(cfgNmod * dphi)); + fRegistry.fill(HIST("PhotonHadron/same/hs"), photon.pt(), track.pt(), deta, std::cos(cfgNmod * dphi)); + } } // end of ref track loop } } // end of photon loop @@ -564,13 +603,14 @@ struct DiphotonHadron2PC { } fRegistry.fill(HIST("Diphoton/same/hs"), v12.M(), v12.Pt()); - for (const auto& track : refTracks_per_collision) { - ROOT::Math::PtEtaPhiMVector v3(track.pt(), track.eta(), track.phi(), 0.139); - float deta = v12.Eta() - v3.Eta(); - float dphi = v12.Phi() - v3.Phi(); - o2::math_utils::bringTo02Pi(dphi); - fRegistry.fill(HIST("DiphotonHadron/same/hs"), v12.M(), v12.Pt(), v3.Pt(), deta, std::cos(cfgNmod * dphi)); + if (fEMTrackCut.IsSelected(track)) { + ROOT::Math::PtEtaPhiMVector v3(track.pt(), track.eta(), track.phi(), 0.139); + float deta = v12.Eta() - v3.Eta(); + float dphi = v12.Phi() - v3.Phi(); + o2::math_utils::bringTo02Pi(dphi); + fRegistry.fill(HIST("DiphotonHadron/same/hs"), v12.M(), v12.Pt(), v3.Pt(), deta, std::cos(cfgNmod * dphi)); + } } // end of ref track loop std::pair pair_tmp_id1 = std::make_pair(ndf, g1.globalIndex()); @@ -594,12 +634,15 @@ struct DiphotonHadron2PC { for (const auto& photon : photons1_per_collision) { // single photon if (cut1.template IsSelected(photon)) { fRegistry.fill(HIST("Photon/hs"), photon.pt(), photon.eta(), photon.phi()); + nphoton++; for (const auto& track : refTracks_per_collision) { - float deta = photon.eta() - track.eta(); - float dphi = photon.phi() - track.phi(); - o2::math_utils::bringTo02Pi(dphi); + if (fEMTrackCut.IsSelected(track)) { + float deta = photon.eta() - track.eta(); + float dphi = photon.phi() - track.phi(); + o2::math_utils::bringTo02Pi(dphi); - fRegistry.fill(HIST("PhotonHadron/same/hs"), photon.pt(), track.pt(), deta, std::cos(cfgNmod * dphi)); + fRegistry.fill(HIST("PhotonHadron/same/hs"), photon.pt(), track.pt(), deta, std::cos(cfgNmod * dphi)); + } } // end of ref track loop } } // end of photon loop @@ -661,6 +704,28 @@ struct DiphotonHadron2PC { } // end of g1 loop } // end of pairing in same event + if (nphoton > 0) { + for (const auto& [trg, ref] : combinations(CombinationsStrictlyUpperIndexPolicy(refTracks_per_collision, refTracks_per_collision))) { + if (fEMTrackCut.IsSelected(trg) && fEMTrackCut.IsSelected(ref)) { + float deta = trg.eta() - ref.eta(); + float dphi = trg.phi() - ref.phi(); + o2::math_utils::bringTo02Pi(dphi); + fRegistry.fill(HIST("HadronHadron_for_Photon/same/hs"), trg.pt(), ref.pt(), deta, std::cos(cfgNmod * dphi)); + } + } + } + + if (ndiphoton > 0) { + for (const auto& [trg, ref] : combinations(CombinationsStrictlyUpperIndexPolicy(refTracks_per_collision, refTracks_per_collision))) { + if (fEMTrackCut.IsSelected(trg) && fEMTrackCut.IsSelected(ref)) { + float deta = trg.eta() - ref.eta(); + float dphi = trg.phi() - ref.phi(); + o2::math_utils::bringTo02Pi(dphi); + fRegistry.fill(HIST("HadronHadron_for_Diphoton/same/hs"), trg.pt(), ref.pt(), deta, std::cos(cfgNmod * dphi)); + } + } + } + // event mixing if (!cfgDoMix || !(ndiphoton > 0)) { continue; @@ -793,25 +858,44 @@ struct DiphotonHadron2PC { Filter prefilter_primaryelectron = ifnode(dileptoncuts.cfg_apply_cuts_from_prefilter_derived.node(), o2::aod::emprimaryelectron::pfbderived == static_cast(0), true); int ndf = 0; - void processAnalysis(FilteredMyCollisions const& collisions, MyTracks const& refTracks, Types const&... args) + void process2PC(FilteredMyCollisions const& collisions, MyTracks const& refTracks, Types const&... args) + { + // LOGF(info, "ndf = %d", ndf); + if constexpr (pairtype == PairType::kPCMPCM) { + auto v0photons = std::get<0>(std::tie(args...)); + auto v0legs = std::get<1>(std::tie(args...)); + run2PC(collisions, v0photons, v0photons, v0legs, v0legs, perCollision_pcm, perCollision_pcm, fV0PhotonCut, fV0PhotonCut, refTracks); + } else if constexpr (pairtype == PairType::kPCMDalitzEE) { + auto v0photons = std::get<0>(std::tie(args...)); + auto v0legs = std::get<1>(std::tie(args...)); + auto emprimaryelectrons = std::get<2>(std::tie(args...)); + // LOGF(info, "electrons.size() = %d, positrons.size() = %d", electrons.size(), positrons.size()); + run2PC(collisions, v0photons, emprimaryelectrons, v0legs, emprimaryelectrons, perCollision_pcm, perCollision_electron, fV0PhotonCut, fDileptonCut, refTracks); + } + ndf++; + } + PROCESS_SWITCH(DiphotonHadronMPC, process2PC, "process pair analysis", true); + + using FilteredMyCollisionsWithSWT = soa::Filtered; + void process2PCwithTrigger(FilteredMyCollisionsWithSWT const& collisions, MyTracks const& refTracks, Types const&... args) { // LOGF(info, "ndf = %d", ndf); if constexpr (pairtype == PairType::kPCMPCM) { auto v0photons = std::get<0>(std::tie(args...)); auto v0legs = std::get<1>(std::tie(args...)); - runPairing(collisions, v0photons, v0photons, v0legs, v0legs, perCollision_pcm, perCollision_pcm, fV0PhotonCut, fV0PhotonCut, refTracks); + run2PC(collisions, v0photons, v0photons, v0legs, v0legs, perCollision_pcm, perCollision_pcm, fV0PhotonCut, fV0PhotonCut, refTracks); } else if constexpr (pairtype == PairType::kPCMDalitzEE) { auto v0photons = std::get<0>(std::tie(args...)); auto v0legs = std::get<1>(std::tie(args...)); auto emprimaryelectrons = std::get<2>(std::tie(args...)); // LOGF(info, "electrons.size() = %d, positrons.size() = %d", electrons.size(), positrons.size()); - runPairing(collisions, v0photons, emprimaryelectrons, v0legs, emprimaryelectrons, perCollision_pcm, perCollision_electron, fV0PhotonCut, fDileptonCut, refTracks); + run2PC(collisions, v0photons, emprimaryelectrons, v0legs, emprimaryelectrons, perCollision_pcm, perCollision_electron, fV0PhotonCut, fDileptonCut, refTracks); } ndf++; } - PROCESS_SWITCH(DiphotonHadron2PC, processAnalysis, "process pair analysis", false); + PROCESS_SWITCH(DiphotonHadronMPC, process2PCwithTrigger, "process pair analysis", false); void processDummy(MyCollisions const&) {} - PROCESS_SWITCH(DiphotonHadron2PC, processDummy, "Dummy function", true); + PROCESS_SWITCH(DiphotonHadronMPC, processDummy, "Dummy function", false); }; -#endif // PWGEM_PHOTONMESON_CORE_DIPHOTONHADRON2PC_H_ +#endif // PWGEM_PHOTONMESON_CORE_DIPHOTONHADRONMPC_H_ diff --git a/PWGEM/PhotonMeson/Tasks/CMakeLists.txt b/PWGEM/PhotonMeson/Tasks/CMakeLists.txt index 49b16a1b843..e839592246a 100644 --- a/PWGEM/PhotonMeson/Tasks/CMakeLists.txt +++ b/PWGEM/PhotonMeson/Tasks/CMakeLists.txt @@ -154,13 +154,13 @@ o2physics_add_dpl_workflow(tagging-pi0-mc-pcmdalitzee PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGEMPhotonMesonCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(diphoton-hadron-2pc-pcmpcm - SOURCES diphotonHadron2PCPCMPCM.cxx +o2physics_add_dpl_workflow(diphoton-hadron-mpc-pcmpcm + SOURCES diphotonHadronMPCPCMPCM.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGEMPhotonMesonCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(diphoton-hadron-2pc-pcmdalitzee - SOURCES diphotonHadron2PCPCMDalitzEE.cxx +o2physics_add_dpl_workflow(diphoton-hadron-mpc-pcmdalitzee + SOURCES diphotonHadronMPCPCMDalitzEE.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGEMPhotonMesonCore COMPONENT_NAME Analysis) diff --git a/PWGEM/PhotonMeson/Tasks/diphotonHadron2PCPCMDalitzEE.cxx b/PWGEM/PhotonMeson/Tasks/diphotonHadronMPCPCMDalitzEE.cxx similarity index 88% rename from PWGEM/PhotonMeson/Tasks/diphotonHadron2PCPCMDalitzEE.cxx rename to PWGEM/PhotonMeson/Tasks/diphotonHadronMPCPCMDalitzEE.cxx index 6856ec72227..a3a7b548894 100644 --- a/PWGEM/PhotonMeson/Tasks/diphotonHadron2PCPCMDalitzEE.cxx +++ b/PWGEM/PhotonMeson/Tasks/diphotonHadronMPCPCMDalitzEE.cxx @@ -14,7 +14,7 @@ // This code loops over photons and makes pairs for neutral mesons analyses. // Please write to: daiki.sekihata@cern.ch -#include "PWGEM/PhotonMeson/Core/DiphotonHadron2PC.h" +#include "PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h" #include "PWGEM/PhotonMeson/DataModel/gammaTables.h" #include "PWGEM/PhotonMeson/Utils/PairUtilities.h" @@ -31,6 +31,6 @@ using namespace o2::aod; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ - adaptAnalysisTask>(cfgc, TaskName{"diphoton-hadron-2pc-pcmdalitzee"}), + adaptAnalysisTask>(cfgc, TaskName{"diphoton-hadron-mpc-pcmdalitzee"}), }; } diff --git a/PWGEM/PhotonMeson/Tasks/diphotonHadron2PCPCMPCM.cxx b/PWGEM/PhotonMeson/Tasks/diphotonHadronMPCPCMPCM.cxx similarity index 85% rename from PWGEM/PhotonMeson/Tasks/diphotonHadron2PCPCMPCM.cxx rename to PWGEM/PhotonMeson/Tasks/diphotonHadronMPCPCMPCM.cxx index 7597de252ac..6f0dfff7c2f 100644 --- a/PWGEM/PhotonMeson/Tasks/diphotonHadron2PCPCMPCM.cxx +++ b/PWGEM/PhotonMeson/Tasks/diphotonHadronMPCPCMPCM.cxx @@ -14,7 +14,7 @@ // This code loops over photons and makes pairs for neutral mesons analyses. // Please write to: daiki.sekihata@cern.ch -#include "PWGEM/PhotonMeson/Core/DiphotonHadron2PC.h" +#include "PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h" #include "PWGEM/PhotonMeson/DataModel/gammaTables.h" #include "PWGEM/PhotonMeson/Utils/PairUtilities.h" @@ -29,6 +29,6 @@ using namespace o2::aod; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ - adaptAnalysisTask>(cfgc, TaskName{"diphoton-hadron-2pc-pcmpcm"}), + adaptAnalysisTask>(cfgc, TaskName{"diphoton-hadron-mpc-pcmpcm"}), }; } From ec78aab6bee065301de1855a8ab058d804a01cea Mon Sep 17 00:00:00 2001 From: Roman Lietava Date: Thu, 24 Jul 2025 08:05:25 +0200 Subject: [PATCH 031/345] [Trigger] ZorroSummary fix (#12157) --- EventFiltering/Zorro.cxx | 13 ++++--------- EventFiltering/ZorroSummary.h | 12 +++++++++--- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/EventFiltering/Zorro.cxx b/EventFiltering/Zorro.cxx index 2b78c157399..ccdf063307d 100644 --- a/EventFiltering/Zorro.cxx +++ b/EventFiltering/Zorro.cxx @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -198,24 +199,18 @@ std::vector Zorro::initCCDB(o2::ccdb::BasicCCDBManager* ccdb, int runNumber mLastSelectedIdx = 0; mTOIs.clear(); mTOIidx.clear(); - while (!tois.empty()) { - size_t pos = tois.find(","); - pos = (pos == std::string::npos) ? tois.size() : pos; - std::string token = tois.substr(0, pos); - // Trim leading and trailing whitespaces from the token - token.erase(0, token.find_first_not_of(" ")); - token.erase(token.find_last_not_of(" ") + 1); + std::vector tokens = o2::utils::Str::tokenize(tois, ','); // tokens are trimmed + for (auto const& token : tokens) { int bin = findBin(mSelections, token) - 2; mTOIs.push_back(token); mTOIidx.push_back(bin); - tois = tois.erase(0, pos + 1); } mTOIcounts.resize(mTOIs.size(), 0); LOGF(info, "Zorro initialized for run %d, triggers of interest:", runNumber); for (size_t i{0}; i < mTOIs.size(); ++i) { LOGF(info, ">>> %s : %i", mTOIs[i].data(), mTOIidx[i]); } - mZorroSummary.setupTOIs(mTOIs.size(), tois); + mZorroSummary.setupTOIs(mTOIs.size(), mTOIs); std::vector toiCounters(mTOIs.size(), 0.); for (size_t i{0}; i < mTOIs.size(); ++i) { toiCounters[i] = mSelections->GetBinContent(mTOIidx[i] + 2); diff --git a/EventFiltering/ZorroSummary.h b/EventFiltering/ZorroSummary.h index 8987d8cd5cd..51019aeef18 100644 --- a/EventFiltering/ZorroSummary.h +++ b/EventFiltering/ZorroSummary.h @@ -31,10 +31,16 @@ class ZorroSummary : public TNamed virtual void Copy(TObject& c) const; // NOLINT: Making this override breaks compilation for unknown reason virtual Long64_t Merge(TCollection* list); - void setupTOIs(int ntois, const std::string& toinames) + void setupTOIs(int ntois, const std::vector& toinames) { mNtois = ntois; - mTOInames = toinames; + if (toinames.size() == 0) { + return; + } + mTOInames = toinames[0]; + for (size_t i = 1; i < toinames.size(); i++) { + mTOInames += "," + toinames[i]; + } } void setupRun(int runNumber, double tvxCountes, const std::vector& toiCounters) { @@ -56,7 +62,7 @@ class ZorroSummary : public TNamed mCurrentAnalysedTOIcounters->at(toiId)++; } - std::string getTOInames() const { return mTOInames; } + const auto& getTOInames() const { return mTOInames; } const auto& getTOIcounters() const { return mTOIcounters; } const auto& getTVXcounters() const { return mTVXcounters; } const auto& getAnalysedTOIcounters() const { return mAnalysedTOIcounters; } From 9f3585628018ed26cb632bbb4d69103fc864b103 Mon Sep 17 00:00:00 2001 From: arossi81 Date: Thu, 24 Jul 2025 09:04:28 +0200 Subject: [PATCH 032/345] [DPG] Modify master (#12201) Co-authored-by: Andrea --- DPG/Tasks/ITS/filterTracks.cxx | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/DPG/Tasks/ITS/filterTracks.cxx b/DPG/Tasks/ITS/filterTracks.cxx index 0a535e1607b..dc9c8ef777f 100644 --- a/DPG/Tasks/ITS/filterTracks.cxx +++ b/DPG/Tasks/ITS/filterTracks.cxx @@ -92,6 +92,26 @@ DECLARE_SOA_TABLE(FilterColl, "AOD", "FILTERCOLL", o2::aod::collision::NumContrib, o2::aod::collision::CollisionTime, o2::aod::collision::CollisionTimeRes); +DECLARE_SOA_TABLE(FilterCollLite, "AOD", "FILTERCOLLLITE", + o2::aod::collision::PosX, + o2::aod::collision::PosY, + o2::aod::collision::PosZ, + o2::aod::collision::CovXX, + o2::aod::collision::CovXY, + o2::aod::collision::CovYY, + o2::aod::collision::CovXZ, + o2::aod::collision::CovYZ, + o2::aod::collision::CovZZ, + o2::aod::collision::Chi2, + o2::aod::collision::NumContrib, + o2::aod::collision::CollisionTime); +DECLARE_SOA_TABLE(FilterCollPos, "AOD", "FILTERCOLLPOS", + o2::aod::collision::PosX, + o2::aod::collision::PosY, + o2::aod::collision::PosZ, + o2::aod::collision::Chi2, + o2::aod::collision::NumContrib, + o2::aod::collision::CollisionTime); DECLARE_SOA_TABLE(FilterTrack, "AOD", "FILTERTRACK", o2::aod::track::CollisionId, aod::filtertracks::IsInsideBeamPipe, @@ -152,12 +172,17 @@ struct FilterTracks { Produces filteredTracksMC; Produces selectedGenParticles; Produces filterCollTable; + Produces filterCollLiteTable; + Produces filterCollPosTable; SliceCache cache; // Configurable dummy{"dummy", 0, "dummy"}; Configurable minTrackPt{"minTrackPt", 0.25, "min track pt"}; Configurable trackDcaXyMax{"trackDcaXyMax", 0.5, "max track pt"}; Configurable trackPtSampling{"trackPtSampling", 0, "track sampling mode"}; + Configurable produceCollTableFull{"produceCollTableFull", false, "produce full collision table"}; + Configurable produceCollTableLite{"produceCollTableLite", false, "produce lite collision table"}; + Configurable produceCollTableExtraLite{"produceCollTableExtraLite", true, "produce extra lite collision table"}; Configurable trackPtWeightLowPt{"trackPtWeightLowPt", 0.01f, "trackPtWeightLowPt"}; Configurable trackPtWeightMidPt{"trackPtWeightMidPt", 0.10f, "trackPtWeightMidPt"}; Configurable collFilterFraction{"collFilterFraction", 0.05f, "collFilterFraction"}; @@ -296,7 +321,12 @@ struct FilterTracks { PROCESS_SWITCH(FilterTracks, processData, "process data", true); void processCollisions(FilterCollisionsWithEvSel::iterator const& collision) { - filterCollTable(collision.bcId(), collision.posX(), collision.posY(), collision.posZ(), collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ(), collision.flags(), collision.chi2(), collision.numContrib(), collision.collisionTime(), collision.collisionTimeRes()); + if (produceCollTableFull) + filterCollTable(collision.bcId(), collision.posX(), collision.posY(), collision.posZ(), collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ(), collision.flags(), collision.chi2(), collision.numContrib(), collision.collisionTime(), collision.collisionTimeRes()); + if (produceCollTableLite) + filterCollLiteTable(collision.posX(), collision.posY(), collision.posZ(), collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ(), collision.chi2(), collision.numContrib(), collision.collisionTime()); + if (produceCollTableExtraLite) + filterCollPosTable(collision.posX(), collision.posY(), collision.posZ(), collision.chi2(), collision.numContrib(), collision.collisionTime()); } PROCESS_SWITCH(FilterTracks, processCollisions, "process collisions", true); From 9550b56ab2b803729aff928506e1bf9601496f40 Mon Sep 17 00:00:00 2001 From: Giorgio Alberto Lucia <87222843+GiorgioAlbertoLucia@users.noreply.github.com> Date: Thu, 24 Jul 2025 09:52:37 +0200 Subject: [PATCH 033/345] [PWGLF] Lighter tables and syntax and new configurables for the ITS cluster studies (#12189) --- PWGLF/DataModel/LFClusterStudiesTable.h | 28 +- .../Nuspex/LFTreeCreatorClusterStudies.cxx | 637 ++++++++---------- 2 files changed, 279 insertions(+), 386 deletions(-) diff --git a/PWGLF/DataModel/LFClusterStudiesTable.h b/PWGLF/DataModel/LFClusterStudiesTable.h index 88ca35a85d3..5c4755bbfcc 100644 --- a/PWGLF/DataModel/LFClusterStudiesTable.h +++ b/PWGLF/DataModel/LFClusterStudiesTable.h @@ -11,8 +11,8 @@ // // Author: Giorgio Alberto Lucia -#include "Framework/AnalysisDataModel.h" #include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" #ifndef PWGLF_DATAMODEL_LFCLUSTERSTUDIESTABLE_H_ #define PWGLF_DATAMODEL_LFCLUSTERSTUDIESTABLE_H_ @@ -79,36 +79,10 @@ DECLARE_SOA_TABLE( DECLARE_SOA_TABLE( ClStTableMc, "AOD", "CLSTTABLEMC", - LFClusterStudiesTables::P, - LFClusterStudiesTables::Eta, - LFClusterStudiesTables::Phi, - LFClusterStudiesTables::ItsClusterSize, - LFClusterStudiesTables::PartID, LFClusterStudiesTables::PartIDMc); DECLARE_SOA_TABLE( ClStTableExtra, "AOD", "CLSTTABLEEXTRA", - LFClusterStudiesTables::P, - LFClusterStudiesTables::Eta, - LFClusterStudiesTables::Phi, - LFClusterStudiesTables::ItsClusterSize, - LFClusterStudiesTables::PartID, - LFClusterStudiesTables::PTPC, - LFClusterStudiesTables::PIDinTrk, - LFClusterStudiesTables::TpcNSigma, - LFClusterStudiesTables::TofNSigma, - LFClusterStudiesTables::TofMass, - LFClusterStudiesTables::CosPAMother, - LFClusterStudiesTables::MassMother); - -DECLARE_SOA_TABLE( - ClStTableMcExt, "AOD", "CLSTTABLEMCEXT", - LFClusterStudiesTables::P, - LFClusterStudiesTables::Eta, - LFClusterStudiesTables::Phi, - LFClusterStudiesTables::ItsClusterSize, - LFClusterStudiesTables::PartID, - LFClusterStudiesTables::PartIDMc, LFClusterStudiesTables::PTPC, LFClusterStudiesTables::PIDinTrk, LFClusterStudiesTables::TpcNSigma, diff --git a/PWGLF/TableProducer/Nuspex/LFTreeCreatorClusterStudies.cxx b/PWGLF/TableProducer/Nuspex/LFTreeCreatorClusterStudies.cxx index d8df6f0bbf6..efb6a15543e 100644 --- a/PWGLF/TableProducer/Nuspex/LFTreeCreatorClusterStudies.cxx +++ b/PWGLF/TableProducer/Nuspex/LFTreeCreatorClusterStudies.cxx @@ -14,45 +14,45 @@ // // Author: Giorgio Alberto Lucia -#include -#include -#include -#include -#include -#include -#include - -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" -#include "ReconstructionDataFormats/Track.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/Core/TrackSelection.h" -#include "Common/DataModel/Centrality.h" -#include "Common/DataModel/Multiplicity.h" -#include "Common/Core/RecoDecay.h" -#include "Common/Core/trackUtilities.h" -#include "Common/DataModel/EventSelection.h" +#include "PWGLF/DataModel/LFClusterStudiesTable.h" #include "PWGLF/DataModel/LFStrangenessTables.h" -#include "DetectorsBase/Propagator.h" -#include "DetectorsBase/GeometryManager.h" -#include "DataFormatsParameters/GRPObject.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "CCDB/BasicCCDBManager.h" #include "Common/Core/PID/PIDTOF.h" -#include "Common/TableProducer/PID/pidTOFBase.h" #include "Common/Core/PID/TPCPIDResponse.h" +#include "Common/Core/RecoDecay.h" +#include "Common/Core/TrackSelection.h" +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/PIDResponseITS.h" -#include "DCAFitter/DCAFitterN.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/TableProducer/PID/pidTOFBase.h" -#include "PWGLF/DataModel/LFClusterStudiesTable.h" +#include "CCDB/BasicCCDBManager.h" +#include "DCAFitter/DCAFitterN.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "DataFormatsParameters/GRPObject.h" +#include "DetectorsBase/GeometryManager.h" +#include "DetectorsBase/Propagator.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/Track.h" #include "TDatabasePDG.h" #include "TPDGCode.h" +#include +#include +#include +#include +#include +#include +#include + using namespace ::o2; using namespace o2::framework; using namespace o2::framework::expressions; @@ -138,6 +138,22 @@ enum PartID { he }; +struct Candidate { + float p = -999.f; // momentum * charge + float eta = -999.f; + float phi = -999.f; + uint32_t itsClusterSize = 0; + uint8_t partID = PartID::none; + float pTPC = -999.f; + uint32_t pidInTrk = 0; // PID in tracking + float nsigmaTPC = -999.f; + float nsigmaTOF = -999.f; + float tofMass = -999.f; + float cosPAMother = -999.f; // Cosine of the pointing angle of the mother + float massMother = -999.f; // Invariant mass of the mother + int pdgCode = 0; +}; + struct LfTreeCreatorClusterStudies { Service m_ccdb; @@ -180,6 +196,8 @@ struct LfTreeCreatorClusterStudies { Configurable v0setting_nsigmatpcPr{"v0setting_nsigmaTPCPr", 2.f, "Number of sigmas for the TPC PID for protons"}; Configurable lambdasetting_qtAPcut{"lambdasetting_qtAPcut", 0.02f, "Cut on the qt for the Armenteros-Podolanski plot for photon rejection"}; Configurable lambdasetting_pmin{"lambdasetting_pmin", 0.0f, "Minimum momentum for the V0 daughters"}; + Configurable electronsetting_conversion_rmin{"electron_conversion_rmin", 1.76f, "Minimum radius for the photon conversion (cm)"}; + Configurable electronsetting_conversion_rmax{"electron_conversion_rmax", 19.77f, "Maximum radius for the photon conversion (cm)"}; Configurable cascsetting_dcaCascDaughters{"casc_setting_dcaV0daughters", 0.1f, "DCA between the V0 daughters"}; Configurable cascsetting_cosPA{"casc_setting_cosPA", 0.99f, "Cosine of the pointing angle of the V0"}; @@ -256,7 +274,6 @@ struct LfTreeCreatorClusterStudies { Produces m_ClusterStudiesTable; Produces m_ClusterStudiesTableExtra; Produces m_ClusterStudiesTableMc; - Produces m_ClusterStudiesTableMcExtra; struct V0TrackParCov { int64_t globalIndex; @@ -414,6 +431,155 @@ struct LfTreeCreatorClusterStudies { return true; } + uint8_t selectV0MotherHypothesis(float massK0sV0, float massLambdaV0, float massAntiLambdaV0, float alphaAP, const o2::aod::V0& v0) + { + uint8_t v0Bitmask(0); + if (v0.isPhotonV0()) { + SETBIT(v0Bitmask, Photon); + } + if (std::abs(massK0sV0 - o2::constants::physics::MassK0Short) < v0setting_massWindowK0s) { + SETBIT(v0Bitmask, K0s); + } + if ((std::abs(massLambdaV0 - o2::constants::physics::MassLambda0) < v0setting_massWindowLambda) && (alphaAP > 0)) { + SETBIT(v0Bitmask, Lambda); + } + if ((std::abs(massAntiLambdaV0 - o2::constants::physics::MassLambda0) < v0setting_massWindowLambda) && (alphaAP < 0)) { + SETBIT(v0Bitmask, AntiLambda); + } + return v0Bitmask; + } + + template + bool selectPidV0Daughters(Candidate& candidatePos, Candidate& candidateNeg, const T& posTrack, + const T& negTrack, const std::array& momMother, const std::array& decayVtx, + float qtAP, float radiusV0, uint8_t v0Bitmask) + { + if (TESTBIT(v0Bitmask, Lambda)) { + if (qtAP < lambdasetting_qtAPcut) + return false; + if (std::abs(posTrack.tpcNSigmaPr()) > v0setting_nsigmatpcPr || std::abs(negTrack.tpcNSigmaPi()) > v0setting_nsigmatpcPi) + return false; + if (std::hypot(momMother[0], momMother[1], momMother[2]) < lambdasetting_pmin) + return false; + candidatePos.partID = PartID::pr; + candidateNeg.partID = PartID::pi; + candidatePos.nsigmaTPC = posTrack.tpcNSigmaPr(); + candidateNeg.nsigmaTPC = negTrack.tpcNSigmaPi(); + m_hAnalysis.fill(HIST("v0_type"), V0Type::Lambda); + + } else if (TESTBIT(v0Bitmask, AntiLambda)) { + if (qtAP < lambdasetting_qtAPcut) + return false; + if (std::abs(posTrack.tpcNSigmaPi()) > v0setting_nsigmatpcPi || std::abs(negTrack.tpcNSigmaPr()) > v0setting_nsigmatpcPr) + return false; + if (std::hypot(momMother[0], momMother[1], momMother[2]) < lambdasetting_pmin) + return false; + candidatePos.partID = PartID::pi; + candidateNeg.partID = PartID::pr; + candidatePos.nsigmaTPC = posTrack.tpcNSigmaPi(); + candidateNeg.nsigmaTPC = negTrack.tpcNSigmaPr(); + m_hAnalysis.fill(HIST("v0_type"), V0Type::AntiLambda); + + } else if (TESTBIT(v0Bitmask, K0s)) { + m_hAnalysis.fill(HIST("v0_type"), V0Type::K0s); + return false; // K0s not implemented + + } else if (TESTBIT(v0Bitmask, Photon)) { + // require photon conversion to happen in one of the Inner Tracker layers (± 0.5 cm resolution) + m_hAnalysis.fill(HIST("photon_conversion_position"), decayVtx[0], decayVtx[1]); + m_hAnalysis.fill(HIST("photon_radiusV0"), radiusV0); + if (!(radiusV0 > electronsetting_conversion_rmin && radiusV0 < electronsetting_conversion_rmax)) + return false; + if (std::abs(posTrack.tpcNSigmaEl()) > v0setting_nsigmatpcEl || std::abs(negTrack.tpcNSigmaEl()) > v0setting_nsigmatpcEl) + return false; + m_hAnalysis.fill(HIST("photon_conversion_position_layer"), decayVtx[0], decayVtx[1]); + candidatePos.partID = PartID::el; + candidateNeg.partID = PartID::el; + candidatePos.nsigmaTPC = posTrack.tpcNSigmaEl(); + candidateNeg.nsigmaTPC = negTrack.tpcNSigmaEl(); + m_hAnalysis.fill(HIST("v0_type"), V0Type::Photon); + + } else { + return false; + } + + return true; + } + + /** + * Fill the histograms for the V0 candidate and return the mass of the V0 + */ + float fillHistogramsV0(float massLambdaV0, float massAntiLambdaV0, + const std::array& momMother, + const Candidate& candidatePos, const Candidate& candidateNeg, float alphaAP, float qtAP, float radiusV0, uint8_t v0Bitmask) + { + float massV0{0.f}; + m_hAnalysis.fill(HIST("v0_selections"), V0Selections::kV0DaughterDCAtoPV); + if (TESTBIT(v0Bitmask, Lambda)) { + massV0 = massLambdaV0; + m_hAnalysis.fill(HIST("massLambda"), std::hypot(momMother[0], momMother[1], momMother[2]), massLambdaV0); + m_hAnalysis.fill(HIST("armenteros_plot_lambda"), alphaAP, qtAP); + m_hAnalysis.fill(HIST("nSigmaTPCPr"), candidatePos.p, candidatePos.nsigmaTPC); + m_hAnalysis.fill(HIST("nSigmaITSPr"), candidatePos.p, m_responseITS.nSigmaITS(candidatePos.itsClusterSize, candidatePos.p, candidatePos.eta)); + m_hAnalysis.fill(HIST("nSigmaTPCPi"), candidateNeg.p, candidateNeg.nsigmaTPC); + m_hAnalysis.fill(HIST("nSigmaITSPi"), candidateNeg.p, m_responseITS.nSigmaITS(candidateNeg.itsClusterSize, candidateNeg.p, candidateNeg.eta)); + m_hAnalysis.fill(HIST("pmatchingPr"), candidatePos.pTPC, (candidatePos.pTPC - candidatePos.p) / candidatePos.pTPC); + m_hAnalysis.fill(HIST("pmatchingPi"), -candidateNeg.pTPC, (candidateNeg.pTPC - candidateNeg.p) / candidateNeg.pTPC); + + } else if (TESTBIT(v0Bitmask, AntiLambda)) { + massV0 = massAntiLambdaV0; + m_hAnalysis.fill(HIST("massLambda"), std::hypot(momMother[0], momMother[1], momMother[2]) * -1.f, massAntiLambdaV0); + // "signed" pt for antimatter + m_hAnalysis.fill(HIST("armenteros_plot_lambda"), alphaAP, qtAP); + m_hAnalysis.fill(HIST("nSigmaTPCPi"), candidatePos.p, candidatePos.nsigmaTPC); + m_hAnalysis.fill(HIST("nSigmaITSPi"), candidatePos.p, m_responseITS.nSigmaITS(candidatePos.itsClusterSize, candidatePos.p, candidatePos.eta)); + m_hAnalysis.fill(HIST("nSigmaTPCPr"), candidateNeg.p, candidateNeg.nsigmaTPC); + m_hAnalysis.fill(HIST("nSigmaITSPr"), candidateNeg.p, m_responseITS.nSigmaITS(candidateNeg.itsClusterSize, candidateNeg.p, candidateNeg.eta)); + m_hAnalysis.fill(HIST("pmatchingPi"), candidatePos.pTPC, (candidatePos.pTPC - candidatePos.p) / candidatePos.pTPC); + m_hAnalysis.fill(HIST("pmatchingPr"), -candidateNeg.pTPC, (candidateNeg.pTPC - candidateNeg.p) / candidateNeg.pTPC); + + } else if (TESTBIT(v0Bitmask, Photon)) { + massV0 = 0.f; + m_hAnalysis.fill(HIST("nSigmaTPCEl"), candidatePos.p, candidatePos.nsigmaTPC); + m_hAnalysis.fill(HIST("nSigmaTPCEl"), candidateNeg.p, candidateNeg.nsigmaTPC); + m_hAnalysis.fill(HIST("nSigmaITSEl"), candidatePos.p, m_responseITS.nSigmaITS(candidatePos.itsClusterSize, candidatePos.p, candidatePos.eta)); + m_hAnalysis.fill(HIST("nSigmaITSEl"), candidateNeg.p, m_responseITS.nSigmaITS(candidateNeg.itsClusterSize, candidateNeg.p, candidateNeg.eta)); + m_hAnalysis.fill(HIST("armenteros_plot_gamma"), alphaAP, qtAP); + m_hAnalysis.fill(HIST("pmatchingEl"), candidatePos.pTPC, (candidatePos.pTPC - candidatePos.p) / candidatePos.pTPC); + m_hAnalysis.fill(HIST("pmatchingEl"), -candidateNeg.pTPC, (candidateNeg.pTPC - candidateNeg.p) / candidateNeg.pTPC); + } + m_hAnalysis.fill(HIST("radiusV0"), radiusV0); + m_hAnalysis.fill(HIST("armenteros_plot"), alphaAP, qtAP); + + return massV0; + } + + template + void fillTable(const Candidate& candidate) + { + m_ClusterStudiesTable( + candidate.p, // p + candidate.eta, // eta + candidate.phi, // phi + candidate.itsClusterSize, // itsClsize + static_cast(candidate.partID)); // partID + if (!setting_smallTable) { + m_ClusterStudiesTableExtra( + candidate.pTPC, // pTPC + candidate.pidInTrk, // pidInTrk + candidate.nsigmaTPC, // TpcNSigma + candidate.nsigmaTOF, // TofNSigma + candidate.tofMass, // TofMass + candidate.cosPAMother, // cosPA + candidate.massMother); // massMother + } + + if constexpr (isMC) { + m_ClusterStudiesTableMc( + candidate.pdgCode); // pdgCod + } + } + // ========================================================================================================= template @@ -622,61 +788,22 @@ struct LfTreeCreatorClusterStudies { m_hAnalysis.fill(HIST("Lambda_vs_K0s"), massK0sV0, massLambdaV0); // float massPhotonV0 = computeMassMother(o2::constants::physics::MassElectron, o2::constants::physics::MassElectron, momPos, momNeg, momMother); - uint8_t v0Bitmask(0); - if (v0.isPhotonV0()) { - SETBIT(v0Bitmask, Photon); - } - if (std::abs(massK0sV0 - o2::constants::physics::MassK0Short) < v0setting_massWindowK0s) { - SETBIT(v0Bitmask, K0s); - } - if ((std::abs(massLambdaV0 - o2::constants::physics::MassLambda0) < v0setting_massWindowLambda) && (alphaAP > 0)) { - SETBIT(v0Bitmask, Lambda); - } - if ((std::abs(massAntiLambdaV0 - o2::constants::physics::MassLambda0) < v0setting_massWindowLambda) && (alphaAP < 0)) { - SETBIT(v0Bitmask, AntiLambda); - } + uint8_t v0Bitmask = selectV0MotherHypothesis(massK0sV0, massLambdaV0, massAntiLambdaV0, alphaAP, v0); if (v0Bitmask == 0 || (v0Bitmask & (v0Bitmask - 1)) != 0) { return; } m_hAnalysis.fill(HIST("v0_selections"), V0Selections::kV0PID); - uint8_t partID_pos{0}, partID_neg{0}; - if (TESTBIT(v0Bitmask, Lambda)) { - if (qtAP < lambdasetting_qtAPcut) - return; - if (std::abs(posTrack.tpcNSigmaPr()) > v0setting_nsigmatpcPr || std::abs(negTrack.tpcNSigmaPi()) > v0setting_nsigmatpcPi) - return; - if (std::hypot(momMother[0], momMother[1], momMother[2]) < lambdasetting_pmin) - return; - partID_pos = PartID::pr; - partID_neg = PartID::pi; - m_hAnalysis.fill(HIST("v0_type"), V0Type::Lambda); - } else if (TESTBIT(v0Bitmask, AntiLambda)) { - if (qtAP < lambdasetting_qtAPcut) - return; - if (std::abs(posTrack.tpcNSigmaPi()) > v0setting_nsigmatpcPr || std::abs(negTrack.tpcNSigmaPr()) > v0setting_nsigmatpcPi) - return; - if (std::hypot(momMother[0], momMother[1], momMother[2]) < lambdasetting_pmin) - return; - partID_pos = PartID::pi; - partID_neg = PartID::pr; - m_hAnalysis.fill(HIST("v0_type"), V0Type::AntiLambda); - } else if (TESTBIT(v0Bitmask, K0s)) { - m_hAnalysis.fill(HIST("v0_type"), V0Type::K0s); - return; // K0s not implemented - } else if (TESTBIT(v0Bitmask, Photon)) { - // require photon conversion to happen in one of the Inner Tracker layers (± 0.5 cm resolution) - m_hAnalysis.fill(HIST("photon_conversion_position"), decayVtx[0], decayVtx[1]); - m_hAnalysis.fill(HIST("photon_radiusV0"), radiusV0); - if (!(radiusV0 > 1.76 && radiusV0 < 4.71)) - return; - if (std::abs(posTrack.tpcNSigmaEl()) > v0setting_nsigmatpcEl || std::abs(negTrack.tpcNSigmaEl()) > v0setting_nsigmatpcEl) - return; - m_hAnalysis.fill(HIST("photon_conversion_position_layer"), decayVtx[0], decayVtx[1]); - partID_pos = PartID::el; - partID_neg = PartID::el; - m_hAnalysis.fill(HIST("v0_type"), V0Type::Photon); - } else { + Candidate candidatePos(std::hypot(momPos[0], momPos[1], momPos[2]) * posTrack.sign(), + RecoDecay::eta(momPos), RecoDecay::phi(momPos), posTrack.itsClusterSizes(), + 0, posTrack.tpcInnerParam() * posTrack.sign(), posTrack.pidForTracking(), + -999.f, -999.f, -999.f, cosPA, -999.f, 0); + Candidate candidateNeg(std::hypot(momNeg[0], momNeg[1], momNeg[2]) * negTrack.sign(), + RecoDecay::eta(momNeg), RecoDecay::phi(momNeg), negTrack.itsClusterSizes(), + 0, negTrack.tpcInnerParam() * negTrack.sign(), negTrack.pidForTracking(), + -999.f, -999.f, -999.f, cosPA, -999.f, 0); + + if (!selectPidV0Daughters(candidatePos, candidateNeg, posTrack, negTrack, momMother, decayVtx, qtAP, radiusV0, v0Bitmask)) { return; } @@ -689,44 +816,9 @@ struct LfTreeCreatorClusterStudies { return; } - float massV0{0.f}; - m_hAnalysis.fill(HIST("v0_selections"), V0Selections::kV0DaughterDCAtoPV); - if (TESTBIT(v0Bitmask, Lambda)) { - massV0 = massLambdaV0; - m_hAnalysis.fill(HIST("massLambda"), std::hypot(momMother[0], momMother[1], momMother[2]), massLambdaV0); - m_hAnalysis.fill(HIST("armenteros_plot_lambda"), alphaAP, qtAP); - m_hAnalysis.fill(HIST("nSigmaTPCPr"), std::hypot(momPos[0], momPos[1], momPos[2]), posTrack.tpcNSigmaPr()); - m_hAnalysis.fill(HIST("nSigmaITSPr"), std::hypot(momPos[0], momPos[1], momPos[2]), m_responseITS.nSigmaITS(posTrack.itsClusterSizes(), posTrack.p(), posTrack.eta())); - m_hAnalysis.fill(HIST("nSigmaTPCPi"), std::hypot(momNeg[0], momNeg[1], momNeg[2]) * -1.f, negTrack.tpcNSigmaPi()); - m_hAnalysis.fill(HIST("nSigmaITSPi"), std::hypot(momNeg[0], momNeg[1], momNeg[2]) * -1.f, m_responseITS.nSigmaITS(negTrack.itsClusterSizes(), negTrack.p(), negTrack.eta())); - m_hAnalysis.fill(HIST("pmatchingPr"), posTrack.tpcInnerParam(), (posTrack.tpcInnerParam() - posTrack.p()) / posTrack.tpcInnerParam()); - m_hAnalysis.fill(HIST("pmatchingPi"), -negTrack.tpcInnerParam(), (negTrack.tpcInnerParam() - negTrack.p()) / negTrack.tpcInnerParam()); - - } else if (TESTBIT(v0Bitmask, AntiLambda)) { - massV0 = massAntiLambdaV0; - m_hAnalysis.fill(HIST("massLambda"), std::hypot(momMother[0], momMother[1], momMother[2]) * -1.f, massAntiLambdaV0); - // "signed" pt for antimatter - m_hAnalysis.fill(HIST("armenteros_plot_lambda"), alphaAP, qtAP); - m_hAnalysis.fill(HIST("nSigmaTPCPi"), std::hypot(momPos[0], momPos[1], momPos[2]), posTrack.tpcNSigmaPi()); - m_hAnalysis.fill(HIST("nSigmaITSPi"), std::hypot(momPos[0], momPos[1], momPos[2]), m_responseITS.nSigmaITS(posTrack.itsClusterSizes(), posTrack.p(), posTrack.eta())); - m_hAnalysis.fill(HIST("nSigmaTPCPr"), std::hypot(momNeg[0], momNeg[1], momNeg[2]) * -1.f, negTrack.tpcNSigmaPr()); - m_hAnalysis.fill(HIST("nSigmaITSPr"), std::hypot(momNeg[0], momNeg[1], momNeg[2]) * -1.f, m_responseITS.nSigmaITS(negTrack.itsClusterSizes(), negTrack.p(), negTrack.eta())); - m_hAnalysis.fill(HIST("pmatchingPi"), posTrack.tpcInnerParam(), (posTrack.tpcInnerParam() - posTrack.p()) / posTrack.tpcInnerParam()); - m_hAnalysis.fill(HIST("pmatchingPr"), -negTrack.tpcInnerParam(), (negTrack.tpcInnerParam() - negTrack.p()) / negTrack.tpcInnerParam()); - - } else if (TESTBIT(v0Bitmask, Photon)) { - massV0 = 0.f; - m_hAnalysis.fill(HIST("nSigmaTPCEl"), std::hypot(momPos[0], momPos[1], momPos[2]), posTrack.tpcNSigmaEl()); - m_hAnalysis.fill(HIST("nSigmaTPCEl"), std::hypot(momNeg[0], momNeg[1], momNeg[2]) * -1.f, negTrack.tpcNSigmaEl()); - m_hAnalysis.fill(HIST("nSigmaITSEl"), std::hypot(momPos[0], momPos[1], momPos[2]), m_responseITS.nSigmaITS(posTrack.itsClusterSizes(), posTrack.p(), posTrack.eta())); - m_hAnalysis.fill(HIST("nSigmaITSEl"), std::hypot(momNeg[0], momNeg[1], momNeg[2]) * -1.f, m_responseITS.nSigmaITS(negTrack.itsClusterSizes(), negTrack.p(), negTrack.eta())); - m_hAnalysis.fill(HIST("armenteros_plot_gamma"), alphaAP, qtAP); - m_hAnalysis.fill(HIST("pmatchingEl"), posTrack.tpcInnerParam(), (posTrack.tpcInnerParam() - posTrack.p()) / posTrack.tpcInnerParam()); - m_hAnalysis.fill(HIST("pmatchingEl"), -negTrack.tpcInnerParam(), (negTrack.tpcInnerParam() - negTrack.p()) / negTrack.tpcInnerParam()); - } - m_hAnalysis.fill(HIST("radiusV0"), radiusV0); - m_hAnalysis.fill(HIST("armenteros_plot"), alphaAP, qtAP); - m_v0TrackParCovs.push_back(v0TrackParCov); + float massV0 = fillHistogramsV0(massLambdaV0, massAntiLambdaV0, momMother, candidatePos, candidateNeg, alphaAP, qtAP, radiusV0, v0Bitmask); + candidatePos.massMother = massV0; + candidateNeg.massMother = massV0; if (!setting_fillV0) { return; @@ -740,95 +832,13 @@ struct LfTreeCreatorClusterStudies { auto posMcParticle = posTrack.mcParticle(); auto negMcParticle = negTrack.mcParticle(); - if (setting_smallTable) { - m_ClusterStudiesTableMc( - std::hypot(momPos[0], momPos[1], momPos[2]) * posTrack.sign(), // p_pos - RecoDecay::eta(momPos), // eta_pos - RecoDecay::phi(momPos), // phi_pos - posTrack.itsClusterSizes(), // itsClsize_pos - partID_pos, // partID_pos - posMcParticle.pdgCode()); // pdgCode_pos - m_ClusterStudiesTableMc( - std::hypot(momNeg[0], momNeg[1], momNeg[2]) * negTrack.sign(), // p_neg - RecoDecay::eta(momNeg), // eta_neg - RecoDecay::phi(momNeg), // phi_neg - negTrack.itsClusterSizes(), // itsClsize_neg - partID_neg, // partID_neg - negMcParticle.pdgCode()); // pdgCode_neg - } else { - m_ClusterStudiesTableMcExtra( - std::hypot(momPos[0], momPos[1], momPos[2]) * posTrack.sign(), // p_pos - RecoDecay::eta(momPos), // eta_pos - RecoDecay::phi(momPos), // phi_pos - posTrack.itsClusterSizes(), // itsClsize_pos - partID_pos, // partID_pos - posMcParticle.pdgCode(), // pdgCode_pos - posTrack.tpcInnerParam() * posTrack.sign(), // pTPC_pos - posTrack.pidForTracking(), // pidInTrk_pos - -999.f, // TpcNSigma_pos - -999.f, // TofNSigma_pos - -999.f, // TofMass_pos - cosPA, // cosPA - massV0); // massV0 - m_ClusterStudiesTableMcExtra( - std::hypot(momNeg[0], momNeg[1], momNeg[2]) * negTrack.sign(), // p_neg - RecoDecay::eta(momNeg), // eta_neg - RecoDecay::phi(momNeg), // phi_neg - negTrack.itsClusterSizes(), // itsClsize_neg - partID_neg, // partID_neg - negMcParticle.pdgCode(), // pdgCode_pos - negTrack.tpcInnerParam() * negTrack.sign(), // pTPC_neg - negTrack.pidForTracking(), // pidInTrk_neg - -999.f, // TpcNSigma_neg - -999.f, // TofNSigma_neg - -999.f, // TofMass_neg - cosPA, // cosPA - massV0); // massV0 - } - } else { // data - if (setting_smallTable) { - m_ClusterStudiesTable( - std::hypot(momPos[0], momPos[1], momPos[2]) * posTrack.sign(), // p_pos - RecoDecay::eta(momPos), // eta_pos - RecoDecay::phi(momPos), // phi_pos - posTrack.itsClusterSizes(), // itsClsize_pos - partID_pos); // partID_pos - m_ClusterStudiesTable( - std::hypot(momNeg[0], momNeg[1], momNeg[2]) * negTrack.sign(), // p_neg - RecoDecay::eta(momNeg), // eta_neg - RecoDecay::phi(momNeg), // phi_neg - negTrack.itsClusterSizes(), // itsClsize_neg - partID_neg); // partID_neg - } else { - m_ClusterStudiesTableExtra( - std::hypot(momPos[0], momPos[1], momPos[2]) * posTrack.sign(), // p_pos - RecoDecay::eta(momPos), // eta_pos - RecoDecay::phi(momPos), // phi_pos - posTrack.itsClusterSizes(), // itsClsize_pos - partID_pos, // partID_pos - posTrack.tpcInnerParam() * posTrack.sign(), // pTPC_pos - posTrack.pidForTracking(), // pidInTrk_pos - -999.f, // TpcNSigma_pos - -999.f, // TofNSigma_pos - -999.f, // TofMass_pos - cosPA, // cosPA - massV0); // massV0 - m_ClusterStudiesTableExtra( - std::hypot(momNeg[0], momNeg[1], momNeg[2]) * negTrack.sign(), // p_neg - RecoDecay::eta(momNeg), // eta_neg - RecoDecay::phi(momNeg), // phi_neg - negTrack.itsClusterSizes(), // itsClsize_neg - partID_neg, // partID_neg - negTrack.tpcInnerParam() * negTrack.sign(), // pTPC_neg - negTrack.pidForTracking(), // pidInTrk_neg - -999.f, // TpcNSigma_neg - -999.f, // TofNSigma_neg - -999.f, // TofMass_neg - cosPA, // cosPA - massV0); // massV0 - } + candidatePos.pdgCode = posMcParticle.pdgCode(); + candidateNeg.pdgCode = negMcParticle.pdgCode(); } + fillTable(candidatePos); + fillTable(candidateNeg); + m_hAnalysis.fill(HIST("isPositive"), true); m_hAnalysis.fill(HIST("isPositive"), false); } @@ -891,59 +901,31 @@ struct LfTreeCreatorClusterStudies { uint8_t partID_bachelor = PartID::ka; + m_ClusterStudiesTable( + std::hypot(momBachelor[0], momBachelor[1], momBachelor[2]) * bachelorTrack.sign(), // p_K + RecoDecay::eta(momBachelor), // eta_K + RecoDecay::phi(momBachelor), // phi_K + bachelorTrack.itsClusterSizes(), // itsClSize_K + partID_bachelor); // partID_K + if (!setting_smallTable) { + m_ClusterStudiesTableExtra( + bachelorTrack.tpcInnerParam() * bachelorTrack.sign(), // pTPC_K + bachelorTrack.pidForTracking(), // PIDinTrk_K + -999.f, // TpcNSigma_K + -999.f, // TofNSigma_K + -999.f, // TofMass_K + cosPA, // cosPA + massOmega); + } + if constexpr (isMC) { if (!bachelorTrack.has_mcParticle()) { return; } auto mcParticle = bachelorTrack.mcParticle(); - if (setting_smallTable) { - m_ClusterStudiesTableMc( - std::hypot(momBachelor[0], momBachelor[1], momBachelor[2]) * bachelorTrack.sign(), // p_K - RecoDecay::eta(momBachelor), // eta_K - RecoDecay::phi(momBachelor), // phi_K - bachelorTrack.itsClusterSizes(), // itsClSize_K - partID_bachelor, // partID_K - mcParticle.pdgCode()); // pdgCode_K - } else { - m_ClusterStudiesTableMcExtra( - std::hypot(momBachelor[0], momBachelor[1], momBachelor[2]) * bachelorTrack.sign(), // p_K - RecoDecay::eta(momBachelor), // eta_K - RecoDecay::phi(momBachelor), // phi_K - bachelorTrack.itsClusterSizes(), // itsClSize_K - partID_bachelor, // partID_K - mcParticle.pdgCode(), // pdgCode_K - bachelorTrack.tpcInnerParam() * bachelorTrack.sign(), // pTPC_K - bachelorTrack.pidForTracking(), // PIDinTrk_K - -999.f, // TpcNSigma_K - -999.f, // TofNSigma_K - -999.f, // TofMass_K - cosPA, // cosPA - massOmega); // massMother - } - } else { - if (setting_smallTable) { - m_ClusterStudiesTable( - std::hypot(momBachelor[0], momBachelor[1], momBachelor[2]) * bachelorTrack.sign(), // p_K - RecoDecay::eta(momBachelor), // eta_K - RecoDecay::phi(momBachelor), // phi_K - bachelorTrack.itsClusterSizes(), // itsClSize_K - partID_bachelor); // partID_K - } else { - m_ClusterStudiesTableExtra( - std::hypot(momBachelor[0], momBachelor[1], momBachelor[2]) * bachelorTrack.sign(), // p_K - RecoDecay::eta(momBachelor), // eta_K - RecoDecay::phi(momBachelor), // phi_K - bachelorTrack.itsClusterSizes(), // itsClSize_K - partID_bachelor, // partID_K - bachelorTrack.tpcInnerParam() * bachelorTrack.sign(), // pTPC_K - bachelorTrack.pidForTracking(), // PIDinTrk_K - -999.f, // TpcNSigma_K - -999.f, // TofNSigma_K - -999.f, // TofMass_K - cosPA, // cosPA - massOmega); - } + m_ClusterStudiesTableMc( + mcParticle.pdgCode()); // pdgCode_K } m_hAnalysis.fill(HIST("isPositive"), bachelorTrack.p() > 0); @@ -976,6 +958,23 @@ struct LfTreeCreatorClusterStudies { uint8_t partID = PartID::de; + m_ClusterStudiesTable( + track.p() * track.sign(), // p_De, + track.eta(), // eta_De, + track.phi(), // phi_De, + track.itsClusterSizes(), // itsClSize_De, + partID); // partID_De + if (!setting_smallTable) { + m_ClusterStudiesTableExtra( + track.tpcInnerParam() * track.sign(), // pTPC_De, + track.pidForTracking(), // PIDinTrk_De, + computeNSigmaDe(track), // TpcNSigma_De, + track.tofNSigmaDe(), // TofNSigma_De, + computeTOFmassDe(track), // TofMass_De, + -999.f, // cosPA, + -999.f); // massMother + } + if constexpr (isMC) { if (!track.has_mcParticle() || track.sign() > 0) { return; @@ -983,53 +982,8 @@ struct LfTreeCreatorClusterStudies { auto mcParticle = track.mcParticle(); - if (setting_smallTable) { - m_ClusterStudiesTableMc( - track.p() * track.sign(), // p_De, - track.eta(), // eta_De, - track.phi(), // phi_De, - track.itsClusterSizes(), // itsClSize_De, - partID, // pdgCode_De, - mcParticle.pdgCode()); // pdgCodeMc_De - } else { - m_ClusterStudiesTableMcExtra( - track.p() * track.sign(), // p_De, - track.eta(), // eta_De, - track.phi(), // phi_De, - track.itsClusterSizes(), // itsClSize_De, - partID, // pdgCode_De, - mcParticle.pdgCode(), // pdgCodeMc_De - track.tpcInnerParam() * track.sign(), // pTPC_De, - track.pidForTracking(), // PIDinTrk_De, - computeNSigmaDe(track), // TpcNSigma_De, - track.tofNSigmaDe(), // TofNSigma_De, - computeTOFmassDe(track), // TofMass_De, - -999.f, // cosPA, - -999.f); // massMother - } - } else { - if (setting_smallTable) { - m_ClusterStudiesTable( - track.p() * track.sign(), // p_De, - track.eta(), // eta_De, - track.phi(), // phi_De, - track.itsClusterSizes(), // itsClSize_De, - partID); // pdgCode_De - } else { - m_ClusterStudiesTableExtra( - track.p() * track.sign(), // p_De, - track.eta(), // eta_De, - track.phi(), // phi_De, - track.itsClusterSizes(), // itsClSize_De, - partID, // pdgCode_De, - track.tpcInnerParam() * track.sign(), // pTPC_De, - track.pidForTracking(), // PIDinTrk_De, - computeNSigmaDe(track), // TpcNSigma_De, - track.tofNSigmaDe(), // TofNSigma_De, - computeTOFmassDe(track), // TofMass_De, - -999.f, // cosPA, - -999.f); // massMother - } + m_ClusterStudiesTableMc( + mcParticle.pdgCode()); // pdgCode_De } m_hAnalysis.fill(HIST("isPositive"), track.sign() > 0); @@ -1062,60 +1016,31 @@ struct LfTreeCreatorClusterStudies { m_hAnalysis.fill(HIST("TOFmassHe"), track.p() * track.sign(), tofMass); m_hAnalysis.fill(HIST("pmatchingHe"), track.sign() * correctedTPCinnerParam, (correctedTPCinnerParam - track.p()) / correctedTPCinnerParam); + m_ClusterStudiesTable( + track.p() * track.sign(), // p_He3, + track.eta(), // eta_He3, + track.phi(), // phi_He3, + track.itsClusterSizes(), // itsClSize_He3, + partID); // partID_He3 + if (!setting_smallTable) { + m_ClusterStudiesTableExtra( + correctedTPCinnerParam * track.sign(), // pTPC_He3, + track.pidForTracking(), // PIDinTrk_He3, + computeNSigmaHe3(track), // TpcNSigma_He3, + -999.f, // TofNSigma_He3, + tofMass, // TofMass_He3, + -999.f, // cosPA, + -999.f); // massMother + } + if constexpr (isMC) { if (!track.has_mcParticle()) { return; } auto mcParticle = track.mcParticle(); - if (setting_smallTable) { - m_ClusterStudiesTableMc( - track.p() * track.sign(), // p_He3, - track.eta(), // eta_He3, - track.phi(), // phi_He3, - track.itsClusterSizes(), // itsClSize_He3, - partID, // pdgCode_He3, - mcParticle.pdgCode()); // pdgCodeMc_He3 - } else { - m_ClusterStudiesTableMcExtra( - track.p() * track.sign(), // p_He3 - track.eta(), // eta_He3 - track.phi(), // phi_He3 - track.itsClusterSizes(), // itsClSize_He3 - partID, // pdgCode_He3 - mcParticle.pdgCode(), // pdgCodeMc_He3 - correctedTPCinnerParam * track.sign(), // pTPC_He3 - track.pidForTracking(), // PIDinTrk_He3 - computeNSigmaHe3(track), // TpcNSigma_He3 - -999.f, // TofNSigma_He3 - tofMass, // TofMass_He3 - -999.f, // cosPA_He3 - -999.f); // massMother_He3 - } - - } else { - if (setting_smallTable) { - m_ClusterStudiesTable( - track.p() * track.sign(), // p_He3, - track.eta(), // eta_He3, - track.phi(), // phi_He3, - track.itsClusterSizes(), // itsClSize_He3, - partID); // pdgCode_He3 - } else { - m_ClusterStudiesTableExtra( - track.p() * track.sign(), // p_He3, - track.eta(), // eta_He3, - track.phi(), // phi_He3, - track.itsClusterSizes(), // itsClSize_He3, - partID, // pdgCode_He3, - correctedTPCinnerParam * track.sign(), // pTPC_He3, - track.pidForTracking(), // PIDinTrk_He3, - computeNSigmaHe3(track), // TpcNSigma_He3, - -999.f, // TofNSigma_He3, - tofMass, // TofMass_He3, - -999.f, // cosPA, - -999.f); // massMother - } + m_ClusterStudiesTableMc( + mcParticle.pdgCode()); // pdgCodeMc_He3 } m_hAnalysis.fill(HIST("isPositive"), track.sign() > 0); @@ -1141,20 +1066,14 @@ struct LfTreeCreatorClusterStudies { return; } - if (setting_smallTable) { - m_ClusterStudiesTable( - track.p() * track.sign(), - track.eta(), - track.phi(), - track.itsClusterSizes(), - partID); - } else { + m_ClusterStudiesTable( + track.p() * track.sign(), + track.eta(), + track.phi(), + track.itsClusterSizes(), + partID); + if (!setting_smallTable) { m_ClusterStudiesTableExtra( - track.p() * track.sign(), // p, - track.eta(), // eta, - track.phi(), // phi, - track.itsClusterSizes(), // itsClSize, - partID, // pdgCode, track.tpcInnerParam() * track.sign(), // pTPC, track.pidForTracking(), // PIDinTrk, tpcNSigma, // TpcNSigma, From ad7f1e41b45ef0c21d8a0f4569f955e57e23b732 Mon Sep 17 00:00:00 2001 From: yuanzhe <90246048+wang-yuanzhe@users.noreply.github.com> Date: Thu, 24 Jul 2025 09:53:09 +0200 Subject: [PATCH 034/345] [PWGLF] Update datamodel for hypernuclei kink analysis (#12186) --- PWGLF/DataModel/LFHyperNucleiKinkTables.h | 120 +++++ PWGLF/DataModel/LFHyperhelium4sigmaTables.h | 110 ----- .../Nuspex/hyperhelium4sigmaRecoTask.cxx | 419 +++++++++--------- 3 files changed, 331 insertions(+), 318 deletions(-) create mode 100644 PWGLF/DataModel/LFHyperNucleiKinkTables.h delete mode 100644 PWGLF/DataModel/LFHyperhelium4sigmaTables.h diff --git a/PWGLF/DataModel/LFHyperNucleiKinkTables.h b/PWGLF/DataModel/LFHyperNucleiKinkTables.h new file mode 100644 index 00000000000..797a1d3c109 --- /dev/null +++ b/PWGLF/DataModel/LFHyperNucleiKinkTables.h @@ -0,0 +1,120 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// +/// \file LFHyperNucleiKinkTables.h +/// \brief Slim hypernuclei kink tables +/// \author Yuanzhe Wang + +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" + +#ifndef PWGLF_DATAMODEL_LFHYPERNUCLEIKINKTABLES_H_ +#define PWGLF_DATAMODEL_LFHYPERNUCLEIKINKTABLES_H_ + +namespace o2::aod +{ + +namespace hyperkink +{ +DECLARE_SOA_COLUMN(XPV, xPV, float); //! Primary vertex of the candidate (x direction) +DECLARE_SOA_COLUMN(YPV, yPV, float); //! Primary vertex of the candidate (y direction) +DECLARE_SOA_COLUMN(ZPV, zPV, float); //! Primary vertex of the candidate (z direction) +DECLARE_SOA_COLUMN(XSV, xSV, float); //! Decay vertex of the candidate (x direction) +DECLARE_SOA_COLUMN(YSV, ySV, float); //! Decay vertex of the candidate (y direction) +DECLARE_SOA_COLUMN(ZSV, zSV, float); //! Decay vertex of the candidate (z direction) +DECLARE_SOA_COLUMN(XMothIU, xMothIU, float); //! X of the mother track at the radii of ITS layer which has the outermost update +DECLARE_SOA_COLUMN(YMothIU, yMothIU, float); //! Y of the mother track at the radii of ITS layer which has the outermost update +DECLARE_SOA_COLUMN(ZMothIU, zMothIU, float); //! Z of the mother track at the radii of ITS layer which has the outermost update +DECLARE_SOA_COLUMN(PxMothSV, pxMothSV, float); //! Px of the mother track at the decay vertex +DECLARE_SOA_COLUMN(PyMothSV, pyMothSV, float); //! Py of the mother track at the decay vertex +DECLARE_SOA_COLUMN(PzMothSV, pzMothSV, float); //! Pz of the mother track at the decay vertex +DECLARE_SOA_COLUMN(RefitPxMothPV, refitPxMothPV, float); //! Refit Px of the mother track at the primary vertex +DECLARE_SOA_COLUMN(RefitPyMothPV, refitPyMothPV, float); //! Refit Py of the mother track at the primary vertex +DECLARE_SOA_COLUMN(RefitPzMothPV, refitPzMothPV, float); //! Refit Pz of the mother track at the primary vertex +DECLARE_SOA_COLUMN(RefitPxMothSV, refitPxMothSV, float); //! Refit Px of the mother track at the decay vertex +DECLARE_SOA_COLUMN(RefitPyMothSV, refitPyMothSV, float); //! Refit Py of the mother track at the decay vertex +DECLARE_SOA_COLUMN(RefitPzMothSV, refitPzMothSV, float); //! Refit Pz of the mother track at the decay vertex +DECLARE_SOA_COLUMN(PxDaugSV, pxDaugSV, float); //! Px of the daughter track at the decay vertex +DECLARE_SOA_COLUMN(PyDaugSV, pyDaugSV, float); //! Py of the daughter track at the decay vertex +DECLARE_SOA_COLUMN(PzDaugSV, pzDaugSV, float); //! Pz of the daughter track at the decay vertex +DECLARE_SOA_COLUMN(IsMatter, isMatter, bool); //! bool: true for matter +DECLARE_SOA_COLUMN(DcaMothPv, dcaMothPv, float); //! DCA of the mother to the primary vertex +DECLARE_SOA_COLUMN(DcaDaugPv, dcaDaugPv, float); //! DCA of the daughter kink to the primary vertex +DECLARE_SOA_COLUMN(DcaKinkTopo, dcaKinkTopo, float); //! DCA of the kink topology +DECLARE_SOA_COLUMN(ItsChi2Moth, itsChi2Moth, float); //! ITS chi2 of the mother track +DECLARE_SOA_COLUMN(ItsClusterSizesMoth, itsClusterSizesMoth, uint32_t); //! ITS cluster size of the mother track +DECLARE_SOA_COLUMN(ItsClusterSizesDaug, itsClusterSizesDaug, uint32_t); //! ITS cluster size of the daughter track +DECLARE_SOA_COLUMN(NSigmaTPCDaug, nSigmaTPCDaug, float); //! Number of tpc sigmas of the daughter track +DECLARE_SOA_COLUMN(NSigmaITSDaug, nSigmaITSDaug, float); //! Number of ITS sigmas of the daughter track + +DECLARE_SOA_COLUMN(IsSignal, isSignal, bool); //! bool: true for hyperhelium4signal +DECLARE_SOA_COLUMN(IsSignalReco, isSignalReco, bool); //! bool: true if the signal is reconstructed +DECLARE_SOA_COLUMN(IsCollReco, isCollReco, bool); //! bool: true if the collision is reconstructed +DECLARE_SOA_COLUMN(IsSurvEvSelection, isSurvEvSelection, bool); //! bool: true for the collision passed the event selection +DECLARE_SOA_COLUMN(TrueXSV, trueXSV, float); //! true x decay vertex +DECLARE_SOA_COLUMN(TrueYSV, trueYSV, float); //! true y decay vertex +DECLARE_SOA_COLUMN(TrueZSV, trueZSV, float); //! true z decay vertex +DECLARE_SOA_COLUMN(TruePxMothPV, truePxMothPV, float); //! Generated px of the mother track +DECLARE_SOA_COLUMN(TruePyMothPV, truePyMothPV, float); //! Generated py of the mother track +DECLARE_SOA_COLUMN(TruePzMothPV, truePzMothPV, float); //! Generated pz of the mother track +DECLARE_SOA_COLUMN(TruePxMothSV, truePxMothSV, float); //! true px of the mother track at the decay vertex +DECLARE_SOA_COLUMN(TruePyMothSV, truePyMothSV, float); //! true py of the mother track at the decay vertex +DECLARE_SOA_COLUMN(TruePzMothSV, truePzMothSV, float); //! true pz of the mother track at the decay vertex +DECLARE_SOA_COLUMN(TruePxDaugSV, truePxDaugSV, float); //! true px of the daughter track at the decay vertex +DECLARE_SOA_COLUMN(TruePyDaugSV, truePyDaugSV, float); //! true py of the daughter track at the decay vertex +DECLARE_SOA_COLUMN(TruePzDaugSV, truePzDaugSV, float); //! true pz of the daughter track at the decay vertex +DECLARE_SOA_COLUMN(IsMothReco, isMothReco, bool); //! bool: true if the mother track is reconstructed +DECLARE_SOA_COLUMN(PxMothPV, pxMothPV, float); //! reconstructed px of the mother track at the primary vertex +DECLARE_SOA_COLUMN(PyMothPV, pyMothPV, float); //! reconstructed py of the mother track at the primary vertex +DECLARE_SOA_COLUMN(PzMothPV, pzMothPV, float); //! reconstructed pz of the mother track at the primary vertex +DECLARE_SOA_COLUMN(UpdatePxMothPV, updatePxMothPV, float); //! updated px of the mother track at the primary vertex after update using PV +DECLARE_SOA_COLUMN(UpdatePyMothPV, updatePyMothPV, float); //! updated py of the mother track at the primary vertex after update using PV +DECLARE_SOA_COLUMN(UpdatePzMothPV, updatePzMothPV, float); //! updated pz of the mother track at the primary vertex after update using PV +} // namespace hyperkink + +DECLARE_SOA_TABLE(HypKinkCand, "AOD", "HYPKINKCANDS", + o2::soa::Index<>, + hyperkink::XPV, hyperkink::YPV, hyperkink::ZPV, + hyperkink::XSV, hyperkink::YSV, hyperkink::ZSV, + hyperkink::IsMatter, + hyperkink::XMothIU, hyperkink::YMothIU, hyperkink::ZMothIU, + hyperkink::PxMothSV, hyperkink::PyMothSV, hyperkink::PzMothSV, + hyperkink::RefitPxMothPV, hyperkink::RefitPyMothPV, hyperkink::RefitPzMothPV, + hyperkink::RefitPxMothSV, hyperkink::RefitPyMothSV, hyperkink::RefitPzMothSV, + hyperkink::PxDaugSV, hyperkink::PyDaugSV, hyperkink::PzDaugSV, + hyperkink::DcaMothPv, hyperkink::DcaDaugPv, hyperkink::DcaKinkTopo, + hyperkink::ItsChi2Moth, hyperkink::ItsClusterSizesMoth, hyperkink::ItsClusterSizesDaug, + hyperkink::NSigmaTPCDaug, hyperkink::NSigmaITSDaug); + +DECLARE_SOA_TABLE(MCHypKinkCand, "AOD", "MCHYPKINKCANDS", + o2::soa::Index<>, + hyperkink::XPV, hyperkink::YPV, hyperkink::ZPV, + hyperkink::XSV, hyperkink::YSV, hyperkink::ZSV, + hyperkink::IsMatter, + hyperkink::XMothIU, hyperkink::YMothIU, hyperkink::ZMothIU, + hyperkink::PxMothSV, hyperkink::PyMothSV, hyperkink::PzMothSV, + hyperkink::RefitPxMothPV, hyperkink::RefitPyMothPV, hyperkink::RefitPzMothPV, + hyperkink::RefitPxMothSV, hyperkink::RefitPyMothSV, hyperkink::RefitPzMothSV, + hyperkink::PxDaugSV, hyperkink::PyDaugSV, hyperkink::PzDaugSV, + hyperkink::DcaMothPv, hyperkink::DcaDaugPv, hyperkink::DcaKinkTopo, + hyperkink::ItsChi2Moth, hyperkink::ItsClusterSizesMoth, hyperkink::ItsClusterSizesDaug, + hyperkink::NSigmaTPCDaug, hyperkink::NSigmaITSDaug, + hyperkink::IsSignal, hyperkink::IsSignalReco, hyperkink::IsCollReco, hyperkink::IsSurvEvSelection, + hyperkink::TrueXSV, hyperkink::TrueYSV, hyperkink::TrueZSV, + hyperkink::TruePxMothPV, hyperkink::TruePyMothPV, hyperkink::TruePzMothPV, + hyperkink::TruePxMothSV, hyperkink::TruePyMothSV, hyperkink::TruePzMothSV, + hyperkink::TruePxDaugSV, hyperkink::TruePyDaugSV, hyperkink::TruePzDaugSV, + hyperkink::IsMothReco, hyperkink::PxMothPV, hyperkink::PyMothPV, hyperkink::PzMothPV, + hyperkink::UpdatePxMothPV, hyperkink::UpdatePyMothPV, hyperkink::UpdatePzMothPV); + +} // namespace o2::aod + +#endif // PWGLF_DATAMODEL_LFHYPERNUCLEIKINKTABLES_H_ diff --git a/PWGLF/DataModel/LFHyperhelium4sigmaTables.h b/PWGLF/DataModel/LFHyperhelium4sigmaTables.h deleted file mode 100644 index 3d083f446d5..00000000000 --- a/PWGLF/DataModel/LFHyperhelium4sigmaTables.h +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. -// -/// \file LFHyperhelium4sigmaTables.h -/// \brief Slim hyperhelium4sigma tables -/// \author Yuanzhe Wang - -#include "Framework/ASoAHelpers.h" -#include "Framework/AnalysisDataModel.h" - -#ifndef PWGLF_DATAMODEL_LFHYPERHELIUM4SIGMATABLES_H_ -#define PWGLF_DATAMODEL_LFHYPERHELIUM4SIGMATABLES_H_ - -namespace o2::aod -{ - -namespace he4scand -{ -DECLARE_SOA_COLUMN(XPrimVtx, xPrimVtx, float); // Primary vertex of the candidate (x direction) -DECLARE_SOA_COLUMN(YPrimVtx, yPrimVtx, float); // Primary vertex of the candidate (y direction) -DECLARE_SOA_COLUMN(ZPrimVtx, zPrimVtx, float); // Primary vertex of the candidate (z direction) -DECLARE_SOA_COLUMN(XDecVtx, xDecVtx, float); // Decay vertex of the candidate (x direction) -DECLARE_SOA_COLUMN(YDecVtx, yDecVtx, float); // Decay vertex of the candidate (y direction) -DECLARE_SOA_COLUMN(ZDecVtx, zDecVtx, float); // Decay vertex of the candidate (z direction) -DECLARE_SOA_COLUMN(XMoth, xMoth, float); // X of the mother track at the radii of ITS layer which has the outermost update -DECLARE_SOA_COLUMN(YMoth, yMoth, float); // Y of the mother track at the radii of ITS layer which has the outermost update -DECLARE_SOA_COLUMN(ZMoth, zMoth, float); // Z of the mother track at the radii of ITS layer which has the outermost update -DECLARE_SOA_COLUMN(PxMoth, pxMoth, float); //! Px of the mother track at the decay vertex -DECLARE_SOA_COLUMN(PyMoth, pyMoth, float); //! Py of the mother track at the decay vertex -DECLARE_SOA_COLUMN(PzMoth, pzMoth, float); //! Pz of the mother track at the decay vertex -DECLARE_SOA_COLUMN(RefitPxMoth, refitPxMoth, float); //! Refit Px of the mother track at the decay vertex -DECLARE_SOA_COLUMN(RefitPyMoth, refitPyMoth, float); //! Refit Py of the mother track at the decay vertex -DECLARE_SOA_COLUMN(RefitPzMoth, refitPzMoth, float); //! Refit Pz of the mother track at the decay vertex -DECLARE_SOA_COLUMN(PxAlpha, pxAlpha, float); //! Px of the daughter alpha track at the decay vertex -DECLARE_SOA_COLUMN(PyAlpha, pyAlpha, float); //! Py of the daughter alpha track at the decay vertex -DECLARE_SOA_COLUMN(PzAlpha, pzAlpha, float); //! Pz of the daughter alpha track at the decay vertex -DECLARE_SOA_COLUMN(IsMatter, isMatter, bool); // bool: true for matter -DECLARE_SOA_COLUMN(DcaMothPv, dcaMothPv, float); //! DCA of the mother to the primary vertex -DECLARE_SOA_COLUMN(DcaAlphaPv, dcaAlphaPv, float); //! DCA of the daughter kink to the primary vertex -DECLARE_SOA_COLUMN(DcaKinkTopo, dcaKinkTopo, float); //! DCA of the kink topology -DECLARE_SOA_COLUMN(ItsChi2Moth, itsChi2Moth, float); // ITS chi2 of the mother track -DECLARE_SOA_COLUMN(ItsClusterSizesMoth, itsClusterSizesMoth, uint32_t); // ITS cluster size of the mother track -DECLARE_SOA_COLUMN(ItsClusterSizesAlpha, itsClusterSizesAlpha, uint32_t); // ITS cluster size of the daughter alpha track -DECLARE_SOA_COLUMN(NSigmaTPCAlpha, nSigmaTPCAlpha, float); // Number of tpc sigmas of the daughter alpha track -DECLARE_SOA_COLUMN(NSigmaITSAlpha, nSigmaITSAlpha, float); // Number of ITS sigmas of the daughter alpha track - -DECLARE_SOA_COLUMN(IsSignal, isSignal, bool); // bool: true for hyperhelium4signal -DECLARE_SOA_COLUMN(IsSignalReco, isSignalReco, bool); // bool: true if the signal is reconstructed -DECLARE_SOA_COLUMN(IsCollReco, isCollReco, bool); // bool: true if the collision is reconstructed -DECLARE_SOA_COLUMN(IsSurvEvSelection, isSurvEvSelection, bool); // bool: true for the collision passed the event selection -DECLARE_SOA_COLUMN(TrueXDecVtx, trueXDecVtx, float); // true x decay vertex -DECLARE_SOA_COLUMN(TrueYDecVtx, trueYDecVtx, float); // true y decay vertex -DECLARE_SOA_COLUMN(TrueZDecVtx, trueZDecVtx, float); // true z decay vertex -DECLARE_SOA_COLUMN(GenPxMoth, genPxMoth, float); // Generated px of the mother track -DECLARE_SOA_COLUMN(GenPyMoth, genPyMoth, float); // Generated py of the mother track -DECLARE_SOA_COLUMN(GenPzMoth, genPzMoth, float); // Generated pz of the mother track -DECLARE_SOA_COLUMN(TruePxMoth, truePxMoth, float); // true px of the mother track at the decay vertex -DECLARE_SOA_COLUMN(TruePyMoth, truePyMoth, float); // true py of the mother track at the decay vertex -DECLARE_SOA_COLUMN(TruePzMoth, truePzMoth, float); // true pz of the mother track at the decay vertex -DECLARE_SOA_COLUMN(GenPxAlpha, genPxAlpha, float); // true px of the daughter alpha track -DECLARE_SOA_COLUMN(GenPyAlpha, genPyAlpha, float); // true py of the daughter alpha track -DECLARE_SOA_COLUMN(GenPzAlpha, genPzAlpha, float); // true pz of the daughter alpha track -DECLARE_SOA_COLUMN(IsMothReco, isMothReco, bool); // bool: true if the mother track is reconstructed -DECLARE_SOA_COLUMN(RecoPtMoth, recoPtMoth, float); // reconstructed pt of the mother track -DECLARE_SOA_COLUMN(RecoPzMoth, recoPzMoth, float); // reconstructed pz of the mother track -} // namespace he4scand - -DECLARE_SOA_TABLE(He4S2BCands, "AOD", "HE4S2BCANDS", - o2::soa::Index<>, - he4scand::XPrimVtx, he4scand::YPrimVtx, he4scand::ZPrimVtx, - he4scand::XDecVtx, he4scand::YDecVtx, he4scand::ZDecVtx, - he4scand::IsMatter, - he4scand::XMoth, he4scand::YMoth, he4scand::ZMoth, - he4scand::PxMoth, he4scand::PyMoth, he4scand::PzMoth, - he4scand::RefitPxMoth, he4scand::RefitPyMoth, he4scand::RefitPzMoth, - he4scand::PxAlpha, he4scand::PyAlpha, he4scand::PzAlpha, - he4scand::DcaMothPv, he4scand::DcaAlphaPv, he4scand::DcaKinkTopo, - he4scand::ItsChi2Moth, he4scand::ItsClusterSizesMoth, he4scand::ItsClusterSizesAlpha, - he4scand::NSigmaTPCAlpha, he4scand::NSigmaITSAlpha); - -DECLARE_SOA_TABLE(MCHe4S2BCands, "AOD", "MCHE4S2BCANDS", - o2::soa::Index<>, - he4scand::XPrimVtx, he4scand::YPrimVtx, he4scand::ZPrimVtx, - he4scand::XDecVtx, he4scand::YDecVtx, he4scand::ZDecVtx, - he4scand::IsMatter, - he4scand::XMoth, he4scand::YMoth, he4scand::ZMoth, - he4scand::PxMoth, he4scand::PyMoth, he4scand::PzMoth, - he4scand::RefitPxMoth, he4scand::RefitPyMoth, he4scand::RefitPzMoth, - he4scand::PxAlpha, he4scand::PyAlpha, he4scand::PzAlpha, - he4scand::DcaMothPv, he4scand::DcaAlphaPv, he4scand::DcaKinkTopo, - he4scand::ItsChi2Moth, he4scand::ItsClusterSizesMoth, he4scand::ItsClusterSizesAlpha, - he4scand::NSigmaTPCAlpha, he4scand::NSigmaITSAlpha, - he4scand::IsSignal, he4scand::IsSignalReco, he4scand::IsCollReco, he4scand::IsSurvEvSelection, - he4scand::TrueXDecVtx, he4scand::TrueYDecVtx, he4scand::TrueZDecVtx, - he4scand::GenPxMoth, he4scand::GenPyMoth, he4scand::GenPzMoth, - he4scand::TruePxMoth, he4scand::TruePyMoth, he4scand::TruePzMoth, - he4scand::GenPxAlpha, he4scand::GenPyAlpha, he4scand::GenPzAlpha, - he4scand::IsMothReco, he4scand::RecoPtMoth, he4scand::RecoPzMoth); - -} // namespace o2::aod - -#endif // PWGLF_DATAMODEL_LFHYPERHELIUM4SIGMATABLES_H_ diff --git a/PWGLF/TableProducer/Nuspex/hyperhelium4sigmaRecoTask.cxx b/PWGLF/TableProducer/Nuspex/hyperhelium4sigmaRecoTask.cxx index bf6ca1a6203..300fe513e8e 100644 --- a/PWGLF/TableProducer/Nuspex/hyperhelium4sigmaRecoTask.cxx +++ b/PWGLF/TableProducer/Nuspex/hyperhelium4sigmaRecoTask.cxx @@ -10,10 +10,10 @@ // or submit itself to any jurisdiction. // /// \file hyperhelium4sigmaRecoTask.cxx -/// \brief QA and analysis task for hyper-helium4sigma (He4S) +/// \brief QA and analysis task for hyper-helium4sigma (HyperHe4S) /// \author Yuanzhe Wang -#include "PWGLF/DataModel/LFHyperhelium4sigmaTables.h" +#include "PWGLF/DataModel/LFHyperNucleiKinkTables.h" #include "PWGLF/DataModel/LFKinkDecayTables.h" #include "Common/Core/RecoDecay.h" @@ -56,14 +56,14 @@ enum Channel { }; enum DaughterType { - kDauAlpha = 0, - kDauTriton, - kDauProton, - kDauChargedPion, - kDauNeutron, - kDauPion0, + kDaugAlpha = 0, + kDaugTriton, + kDaugProton, + kDaugChargedPion, + kDaugNeutron, + kDaugPion0, kNDaughterType, - kNChargedDaughterType = kDauNeutron + kNChargedDaughterType = kDaugNeutron }; namespace @@ -72,7 +72,7 @@ constexpr std::array LayerRadii{2.33959f, 3.14076f, 3.91924f, 19.6213f constexpr int kITSLayers = 7; constexpr int kITSInnerBarrelLayers = 3; // constexpr int kITSOuterBarrelLayers = 4; -constexpr std::array kDaughterPDG = { +constexpr std::array kDaugghterPDG = { o2::constants::physics::Pdg::kAlpha, o2::constants::physics::Pdg::kTriton, PDG_t::kProton, @@ -82,12 +82,12 @@ constexpr std::array kDaughterPDG = { const std::array covPosSV{6.4462712107237135f, 0.1309793068144521f, 6.626654155592929f, -0.4510297694023185f, 0.16996629627762413f, 4.109195981415627f}; -std::shared_ptr hMotherCounter; -std::shared_ptr hMother2BCounter; -std::shared_ptr hDauCounter[kNChargedDaughterType]; -std::shared_ptr hDauTPCNSigma[kNChargedDaughterType]; -std::shared_ptr hRecoMotherCounter; -std::shared_ptr hRecoDauAlphaCounter; +std::shared_ptr hMothCounter; +std::shared_ptr hMoth2BCounter; +std::shared_ptr hDaugCounter[kNChargedDaughterType]; +std::shared_ptr hDaugTPCNSigma[kNChargedDaughterType]; +std::shared_ptr hRecoMothCounter; +std::shared_ptr hRecoDaugAlphaCounter; } // namespace //-------------------------------------------------------------- @@ -167,13 +167,13 @@ Channel getDecayChannelHe4S(TMCParticle const& particle, std::vector& list) //-------------------------------------------------------------- // Extract track parameters from a mcparticle, use global coordinates as the local one template -o2::track::TrackParametrization getTrackParFromMC(const T& mcparticle) +o2::track::TrackParametrization getTrackParFromMC(const T& mcparticle, int charge = 1) { int sign = mcparticle.pdgCode() > 0 ? 1 : -1; // ok for hyperhelium4sigma TrackPrecision snp = mcparticle.py() / (mcparticle.pt() + 1.e-10f); TrackPrecision tgl = mcparticle.pz() / (mcparticle.pt() + 1.e-10f); std::array arraypar = {mcparticle.vy(), mcparticle.vz(), snp, - tgl, 2 * sign / (mcparticle.pt() + 1.e-10f)}; + tgl, charge * sign / (mcparticle.pt() + 1.e-10f)}; return o2::track::TrackParametrization(mcparticle.vx(), 0, std::move(arraypar)); } @@ -208,16 +208,16 @@ float getTPCNSigma(const TTrack& track, const int daughterType) { float nSigma = -999.f; switch (daughterType) { - case kDauAlpha: + case kDaugAlpha: nSigma = track.tpcNSigmaAl(); break; - case kDauTriton: + case kDaugTriton: nSigma = track.tpcNSigmaTr(); break; - case kDauProton: + case kDaugProton: nSigma = track.tpcNSigmaPr(); break; - case kDauChargedPion: + case kDaugChargedPion: nSigma = track.tpcNSigmaPi(); break; default: @@ -228,37 +228,31 @@ float getTPCNSigma(const TTrack& track, const int daughterType) //-------------------------------------------------------------- // Refit the momentum of the mother track -template -std::array refitMotherTrack(TCollision& collision, TTrack& track, std::array posSV) +template +bool refitMotherTrack(const TTrack& track, o2::track::TrackParametrizationWithError& trackPar, const o2::dataformats::VertexBase& primaryVtx, const o2::dataformats::VertexBase& secondaryVtx) { - auto trackPar = getTrackParCov(track); - float trackIUPos[2] = {track.y(), track.z()}; float trackIUCov[3] = {track.cYY(), track.cZY(), track.cZZ()}; - o2::dataformats::VertexBase primaryVtx = {{collision.posX(), collision.posY(), collision.posZ()}, {collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()}}; - o2::dataformats::VertexBase secondaryVtx = {{posSV[0], posSV[1], posSV[2]}, {covPosSV[0], covPosSV[1], covPosSV[2], covPosSV[3], covPosSV[4], covPosSV[5]}}; o2::base::Propagator::Instance()->propagateToDCABxByBz(primaryVtx, trackPar, 2.f, o2::base::Propagator::MatCorrType::USEMatCorrLUT); - trackPar.resetCovariance(999.f); - std::array refitP = {-999.f, -999.f, -999.f}; - if (!trackPar.update(primaryVtx, 999.f)) { - return refitP; + trackPar.resetCovariance(1e15); + if (!trackPar.update(primaryVtx)) { + return false; } trackPar.rotate(track.alpha()); o2::base::Propagator::Instance()->PropagateToXBxByBz(trackPar, track.x()); if (!trackPar.update(trackIUPos, trackIUCov)) { - return refitP; + return false; } o2::base::Propagator::Instance()->propagateToDCABxByBz(secondaryVtx, trackPar, 2.f, o2::base::Propagator::MatCorrType::USEMatCorrLUT); - if (!trackPar.update(secondaryVtx, 999.f)) { - return refitP; + if (!trackPar.update(secondaryVtx)) { + return false; } - trackPar.getPxPyPzGlo(refitP); - return refitP; + return true; } //-------------------------------------------------------------- @@ -266,21 +260,21 @@ struct Hyphe4sCandidate { bool isMatter = false; - std::array primVtx = {0.0f, 0.0f, 0.0f}; - std::array decVtx = {0.0f, 0.0f, 0.0f}; + std::array posPV = {0.0f, 0.0f, 0.0f}; + std::array posSV = {0.0f, 0.0f, 0.0f}; std::array lastPosMoth = {0.0f, 0.0f, 0.0f}; // last position of mother track at the radii of ITS layer which has the outermost update - std::array momMoth = {0.0f, 0.0f, 0.0f}; - std::array momDaug = {0.0f, 0.0f, 0.0f}; + std::array momMothSV = {0.0f, 0.0f, 0.0f}; + std::array momDaugSV = {0.0f, 0.0f, 0.0f}; float dcaXYMothPv = -999.f; - float dcaXYDauPv = -999.f; + float dcaXYDaugPv = -999.f; float dcaKinkTopo = -999.f; float chi2ITSMoth = 0.0f; uint32_t itsClusterSizeMoth = 0u; - uint32_t itsClusterSizeDau = 0u; - float nSigmaTPCDau = -999.f; - float nSigmaITSDau = -999.f; + uint32_t itsClusterSizeDaug = 0u; + float nSigmaTPCDaug = -999.f; + float nSigmaITSDaug = -999.f; // mc information bool isSignal = false; @@ -288,25 +282,25 @@ struct Hyphe4sCandidate { bool isCollReco = false; bool isSurvEvSelection = false; - std::array trueDecVtx = {0.0f, 0.0f, 0.0f}; - std::array gMomMoth = {0.0f, 0.0f, 0.0f}; // generated mother momentum - std::array trueMomMoth = {0.0f, 0.0f, 0.0f}; // true mother momentum at decay vertex - std::array gMomDau = {0.0f, 0.0f, 0.0f}; + std::array truePosSV = {0.0f, 0.0f, 0.0f}; + std::array trueMomMothPV = {0.0f, 0.0f, 0.0f}; // generated mother momentum at primary vertex + std::array trueMomMothSV = {0.0f, 0.0f, 0.0f}; // true mother momentum at decay vertex + std::array trueMomDaugSV = {0.0f, 0.0f, 0.0f}; // true daughter momentum at decay vertex bool isMothReco = false; - float ptMoth = -999.f; - float pzMoth = -999.f; + std::array momMothPV = {0.0f, 0.0f, 0.0f}; + std::array updateMomMothPV = {0.0f, 0.0f, 0.0f}; // mother momentum at primary vertex after update using PV }; //-------------------------------------------------------------- // analysis task for hyperhelium4sigma 2-body decay struct Hyperhelium4sigmaRecoTask { - Produces outputDataTable; - Produces outputMCTable; + Produces outputDataTable; + Produces outputMCTable; Service ccdb; - o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE; + o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT; std::vector mcHe4sIndices; @@ -321,10 +315,8 @@ struct Hyperhelium4sigmaRecoTask { // CCDB options Configurable inputBz{"inputBz", -999, "bz field, -999 is automatic"}; Configurable ccdbPath{"ccdbPath", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Configurable grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"}; Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; Configurable lutPath{"lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"}; - Configurable geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; int mRunNumber; float mBz; @@ -371,11 +363,6 @@ struct Hyperhelium4sigmaRecoTask { registry.add("hDCAXYMothToRecSV", "hDCAXYMothToRecSV", HistType::kTH1F, {{200, -10, 10}}); registry.add("hDCAZMothToRecSV", "hDCAZMothToRecSV", HistType::kTH1F, {{200, -10, 10}}); - - registry.add("h2TrueMotherDiffPtVsKinkAngle", ";cos(#theta);#Delta p_{T} / p_{T};", HistType::kTH2F, {{100, 0.8f, 1.f}, {100, -5.f, 5.f}}); - registry.add("h2TrueMotherDiffPtVsKinkAngleSV", ";cos(#theta);#Delta p_{T} / p_{T};", HistType::kTH2F, {{100, 0.8f, 1.f}, {100, -5.f, 5.f}}); - registry.add("h2TrueMotherDiffPtVsKinkAngleXY", ";cos(#theta);#Delta p_{T} / p_{T};", HistType::kTH2F, {{100, 0.8f, 1.f}, {100, -5.f, 5.f}}); - registry.add("h2TrueMotherDiffPtVsKinkAngleXYSV", ";cos(#theta);#Delta p_{T} / p_{T};", HistType::kTH2F, {{100, 0.8f, 1.f}, {100, -5.f, 5.f}}); } registry.add("h2MassHyperhelium4sigmaPt", "h2MassHyperhelium4sigmaPt", HistType::kTH2F, {{ptAxis, massAxis}}); @@ -385,7 +372,6 @@ struct Hyperhelium4sigmaRecoTask { ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); ccdb->setFatalWhenNull(false); - lut = o2::base::MatLayerCylSet::rectifyPtrFromFile(ccdb->get(lutPath)); } void initCCDB(aod::BCs::iterator const& bc) @@ -394,6 +380,7 @@ struct Hyperhelium4sigmaRecoTask { return; } mRunNumber = bc.runNumber(); + ccdb->clearCache(grpmagPath.value.data()); LOG(info) << "Initializing CCDB for run " << mRunNumber; o2::parameters::GRPMagField* grpmag = ccdb->getForRun(grpmagPath, mRunNumber); o2::base::Propagator::initFieldFromGRP(grpmag); @@ -407,32 +394,32 @@ struct Hyperhelium4sigmaRecoTask { } template - void fillCandidate(Hyphe4sCandidate& hyphe4sCand, TCollision const& collision, TKindCandidate const& kinkCand, TTrack const& trackMoth, TTrack const& trackDau) + void fillCandidate(Hyphe4sCandidate& hyphe4sCand, TCollision const& collision, TKindCandidate const& kinkCand, TTrack const& trackMoth, TTrack const& trackDaug) { hyphe4sCand.isMatter = kinkCand.mothSign() > 0; - hyphe4sCand.primVtx[0] = collision.posX(); - hyphe4sCand.primVtx[1] = collision.posY(); - hyphe4sCand.primVtx[2] = collision.posZ(); - hyphe4sCand.decVtx[0] = kinkCand.xDecVtx() + collision.posX(); - hyphe4sCand.decVtx[1] = kinkCand.yDecVtx() + collision.posY(); - hyphe4sCand.decVtx[2] = kinkCand.zDecVtx() + collision.posZ(); - - hyphe4sCand.momMoth[0] = kinkCand.pxMoth(); - hyphe4sCand.momMoth[1] = kinkCand.pyMoth(); - hyphe4sCand.momMoth[2] = kinkCand.pzMoth(); - hyphe4sCand.momDaug[0] = kinkCand.pxDaug(); - hyphe4sCand.momDaug[1] = kinkCand.pyDaug(); - hyphe4sCand.momDaug[2] = kinkCand.pzDaug(); + hyphe4sCand.posPV[0] = collision.posX(); + hyphe4sCand.posPV[1] = collision.posY(); + hyphe4sCand.posPV[2] = collision.posZ(); + hyphe4sCand.posSV[0] = kinkCand.xDecVtx() + collision.posX(); + hyphe4sCand.posSV[1] = kinkCand.yDecVtx() + collision.posY(); + hyphe4sCand.posSV[2] = kinkCand.zDecVtx() + collision.posZ(); + + hyphe4sCand.momMothSV[0] = kinkCand.pxMoth(); + hyphe4sCand.momMothSV[1] = kinkCand.pyMoth(); + hyphe4sCand.momMothSV[2] = kinkCand.pzMoth(); + hyphe4sCand.momDaugSV[0] = kinkCand.pxDaug(); + hyphe4sCand.momDaugSV[1] = kinkCand.pyDaug(); + hyphe4sCand.momDaugSV[2] = kinkCand.pzDaug(); hyphe4sCand.dcaXYMothPv = kinkCand.dcaMothPv(); - hyphe4sCand.dcaXYDauPv = kinkCand.dcaDaugPv(); + hyphe4sCand.dcaXYDaugPv = kinkCand.dcaDaugPv(); hyphe4sCand.dcaKinkTopo = kinkCand.dcaKinkTopo(); - fillCandidateRecoMoth(hyphe4sCand, trackMoth); + fillCandidateRecoMoth(hyphe4sCand, collision, trackMoth); - hyphe4sCand.itsClusterSizeDau = trackDau.itsClusterSizes(); - hyphe4sCand.nSigmaTPCDau = trackDau.tpcNSigmaAl(); - hyphe4sCand.nSigmaITSDau = itsResponse.nSigmaITS(trackDau); + hyphe4sCand.itsClusterSizeDaug = trackDaug.itsClusterSizes(); + hyphe4sCand.nSigmaTPCDaug = trackDaug.tpcNSigmaAl(); + hyphe4sCand.nSigmaITSDaug = itsResponse.nSigmaITS(trackDaug); int lastLayerMoth = 0; for (int i = 6; i >= 0; i--) { @@ -443,39 +430,54 @@ struct Hyperhelium4sigmaRecoTask { } auto trackparMother = getTrackParCov(trackMoth); o2::base::Propagator::Instance()->PropagateToXBxByBz(trackparMother, LayerRadii[lastLayerMoth]); - std::array vecLab{0.f}; - if (trackparMother.getPosDirGlo(vecLab)) { - hyphe4sCand.lastPosMoth[0] = vecLab[0]; - hyphe4sCand.lastPosMoth[1] = vecLab[1]; - hyphe4sCand.lastPosMoth[2] = vecLab[2]; - } + std::array posLastHit{-999.f}; + trackparMother.getXYZGlo(posLastHit); + hyphe4sCand.lastPosMoth[0] = posLastHit[0]; + hyphe4sCand.lastPosMoth[1] = posLastHit[1]; + hyphe4sCand.lastPosMoth[2] = posLastHit[2]; } - template - void fillCandidateRecoMoth(Hyphe4sCandidate& hyphe4sCand, TTrack const& trackMoth) + template + void fillCandidateRecoMoth(Hyphe4sCandidate& hyphe4sCand, TCollision const& collision, TTrack const& trackMoth) { hyphe4sCand.isMothReco = true; hyphe4sCand.chi2ITSMoth = trackMoth.itsChi2NCl(); hyphe4sCand.itsClusterSizeMoth = trackMoth.itsClusterSizes(); - hyphe4sCand.ptMoth = trackMoth.pt(); - hyphe4sCand.pzMoth = trackMoth.pz(); + + auto motherTrackPar = getTrackParCov(trackMoth); + o2::dataformats::VertexBase primaryVtx = {{collision.posX(), collision.posY(), collision.posZ()}, {collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()}}; + std::array pMotherPv = {-999.f}; + if (o2::base::Propagator::Instance()->propagateToDCABxByBz(primaryVtx, motherTrackPar, 2.f, o2::base::Propagator::MatCorrType::USEMatCorrLUT)) { + motherTrackPar.getPxPyPzGlo(pMotherPv); + } + hyphe4sCand.momMothPV[0] = pMotherPv[0]; + hyphe4sCand.momMothPV[1] = pMotherPv[1]; + hyphe4sCand.momMothPV[2] = pMotherPv[2]; + + std::array updatePMotherPv = {-999.f}; + if (motherTrackPar.update(primaryVtx)) { + motherTrackPar.getPxPyPzGlo(updatePMotherPv); + } + hyphe4sCand.updateMomMothPV[0] = updatePMotherPv[0]; + hyphe4sCand.updateMomMothPV[1] = updatePMotherPv[1]; + hyphe4sCand.updateMomMothPV[2] = updatePMotherPv[2]; } template void fillCandidateMCInfo(Hyphe4sCandidate& hyphe4sCand, TMCParticle const& mcMothTrack, TMCParticle const& mcDauTrack, TMCParticle const& mcNeutDauTrack) { - hyphe4sCand.trueDecVtx[0] = mcDauTrack.vx(); - hyphe4sCand.trueDecVtx[1] = mcDauTrack.vy(); - hyphe4sCand.trueDecVtx[2] = mcDauTrack.vz(); - hyphe4sCand.gMomMoth[0] = mcMothTrack.px(); - hyphe4sCand.gMomMoth[1] = mcMothTrack.py(); - hyphe4sCand.gMomMoth[2] = mcMothTrack.pz(); - hyphe4sCand.trueMomMoth[0] = mcDauTrack.px() + mcNeutDauTrack.px(); - hyphe4sCand.trueMomMoth[1] = mcDauTrack.py() + mcNeutDauTrack.py(); - hyphe4sCand.trueMomMoth[2] = mcDauTrack.pz() + mcNeutDauTrack.pz(); - hyphe4sCand.gMomDau[0] = mcDauTrack.px(); - hyphe4sCand.gMomDau[1] = mcDauTrack.py(); - hyphe4sCand.gMomDau[2] = mcDauTrack.pz(); + hyphe4sCand.truePosSV[0] = mcDauTrack.vx(); + hyphe4sCand.truePosSV[1] = mcDauTrack.vy(); + hyphe4sCand.truePosSV[2] = mcDauTrack.vz(); + hyphe4sCand.trueMomMothPV[0] = mcMothTrack.px(); + hyphe4sCand.trueMomMothPV[1] = mcMothTrack.py(); + hyphe4sCand.trueMomMothPV[2] = mcMothTrack.pz(); + hyphe4sCand.trueMomMothSV[0] = mcDauTrack.px() + mcNeutDauTrack.px(); + hyphe4sCand.trueMomMothSV[1] = mcDauTrack.py() + mcNeutDauTrack.py(); + hyphe4sCand.trueMomMothSV[2] = mcDauTrack.pz() + mcNeutDauTrack.pz(); + hyphe4sCand.trueMomDaugSV[0] = mcDauTrack.px(); + hyphe4sCand.trueMomDaugSV[1] = mcDauTrack.py(); + hyphe4sCand.trueMomDaugSV[2] = mcDauTrack.pz(); } void processData(CollisionsFull const& collisions, aod::KinkCands const& KinkCands, FullTracksExtIU const&, aod::BCs const&) @@ -512,23 +514,29 @@ struct Hyperhelium4sigmaRecoTask { Hyphe4sCandidate hyphe4sCand; fillCandidate(hyphe4sCand, collision, kinkCand, motherTrack, dauTrack); - std::array posDecVtx = {kinkCand.xDecVtx() + collision.posX(), kinkCand.yDecVtx() + collision.posY(), kinkCand.zDecVtx() + collision.posZ()}; - auto refitP = refitMotherTrack(collision, motherTrack, posDecVtx); - for (size_t i = 0; i < refitP.size(); ++i) { - refitP[i] *= 2.f; + o2::dataformats::VertexBase primaryVtx = {{collision.posX(), collision.posY(), collision.posZ()}, {collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()}}; + o2::dataformats::VertexBase secondaryVtx = {{kinkCand.xDecVtx() + collision.posX(), kinkCand.yDecVtx() + collision.posY(), kinkCand.zDecVtx() + collision.posZ()}, {covPosSV[0], covPosSV[1], covPosSV[2], covPosSV[3], covPosSV[4], covPosSV[5]}}; + std::array refitPPV = {-999.f}; + std::array refitPSV = {-999.f}; + auto motherTrackPar = getTrackParCov(motherTrack); + if (refitMotherTrack(motherTrack, motherTrackPar, primaryVtx, secondaryVtx)) { + motherTrackPar.getPxPyPzGlo(refitPSV); + o2::base::Propagator::Instance()->propagateToDCABxByBz(primaryVtx, motherTrackPar, 2.f, o2::base::Propagator::MatCorrType::USEMatCorrLUT); + motherTrackPar.getPxPyPzGlo(refitPPV); } outputDataTable( - hyphe4sCand.primVtx[0], hyphe4sCand.primVtx[1], hyphe4sCand.primVtx[2], - hyphe4sCand.decVtx[0], hyphe4sCand.decVtx[1], hyphe4sCand.decVtx[2], + hyphe4sCand.posPV[0], hyphe4sCand.posPV[1], hyphe4sCand.posPV[2], + hyphe4sCand.posSV[0], hyphe4sCand.posSV[1], hyphe4sCand.posSV[2], hyphe4sCand.isMatter, hyphe4sCand.lastPosMoth[0], hyphe4sCand.lastPosMoth[1], hyphe4sCand.lastPosMoth[2], - hyphe4sCand.momMoth[0], hyphe4sCand.momMoth[1], hyphe4sCand.momMoth[2], - refitP[0], refitP[1], refitP[2], - hyphe4sCand.momDaug[0], hyphe4sCand.momDaug[1], hyphe4sCand.momDaug[2], - hyphe4sCand.dcaXYMothPv, hyphe4sCand.dcaXYDauPv, hyphe4sCand.dcaKinkTopo, - hyphe4sCand.chi2ITSMoth, hyphe4sCand.itsClusterSizeMoth, hyphe4sCand.itsClusterSizeDau, - hyphe4sCand.nSigmaTPCDau, hyphe4sCand.nSigmaITSDau); + hyphe4sCand.momMothSV[0], hyphe4sCand.momMothSV[1], hyphe4sCand.momMothSV[2], + refitPPV[0], refitPPV[1], refitPPV[2], + refitPSV[0], refitPSV[1], refitPSV[2], + hyphe4sCand.momDaugSV[0], hyphe4sCand.momDaugSV[1], hyphe4sCand.momDaugSV[2], + hyphe4sCand.dcaXYMothPv, hyphe4sCand.dcaXYDaugPv, hyphe4sCand.dcaKinkTopo, + hyphe4sCand.chi2ITSMoth, hyphe4sCand.itsClusterSizeMoth, hyphe4sCand.itsClusterSizeDaug, + hyphe4sCand.nSigmaTPCDaug, hyphe4sCand.nSigmaITSDaug); } } PROCESS_SWITCH(Hyperhelium4sigmaRecoTask, processData, "process data", true); @@ -599,9 +607,16 @@ struct Hyperhelium4sigmaRecoTask { fillCandidate(hyphe4sCand, collision, kinkCand, motherTrack, dauTrack); std::array posDecVtx = {kinkCand.xDecVtx() + collision.posX(), kinkCand.yDecVtx() + collision.posY(), kinkCand.zDecVtx() + collision.posZ()}; - auto refitP = refitMotherTrack(collision, motherTrack, posDecVtx); - for (size_t i = 0; i < refitP.size(); ++i) { - refitP[i] *= 2.f; + + o2::dataformats::VertexBase primaryVtx = {{collision.posX(), collision.posY(), collision.posZ()}, {collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()}}; + o2::dataformats::VertexBase secondaryVtx = {{posDecVtx[0], posDecVtx[1], posDecVtx[2]}, {covPosSV[0], covPosSV[1], covPosSV[2], covPosSV[3], covPosSV[4], covPosSV[5]}}; + std::array refitPPV = {-999.f}; + std::array refitPSV = {-999.f}; + auto motherTrackPar = getTrackParCov(motherTrack); + if (refitMotherTrack(motherTrack, motherTrackPar, primaryVtx, secondaryVtx)) { + motherTrackPar.getPxPyPzGlo(refitPSV); + o2::base::Propagator::Instance()->propagateToDCABxByBz(primaryVtx, motherTrackPar, 2.f, o2::base::Propagator::MatCorrType::USEMatCorrLUT); + motherTrackPar.getPxPyPzGlo(refitPPV); } // qa for true signal @@ -609,7 +624,6 @@ struct Hyperhelium4sigmaRecoTask { auto mcMotherTrack = motherTrack.mcParticle_as(); auto mcDauTrack = dauTrack.mcParticle_as(); auto mcNeutTrack = particlesMC.rawIteratorAt(dauIDList[2]); - float posDecVtx[3] = {kinkCand.xDecVtx() + collision.posX(), kinkCand.yDecVtx() + collision.posY(), kinkCand.zDecVtx() + collision.posZ()}; float recSVR = std::sqrt(posDecVtx[0] * posDecVtx[0] + posDecVtx[1] * posDecVtx[1]); registry.fill(HIST("hDiffSVx"), posDecVtx[0] - mcDauTrack.vx()); registry.fill(HIST("hDiffSVy"), posDecVtx[1] - mcDauTrack.vy()); @@ -633,54 +647,35 @@ struct Hyperhelium4sigmaRecoTask { mcHe4sIndices.push_back(mcMotherTrack.globalIndex()); std::array dcaInfo; - auto mcMotherTrackPar = getTrackParFromMC(mcMotherTrack); + auto mcMotherTrackPar = getTrackParFromMC(mcMotherTrack, 2); o2::base::Propagator::Instance()->propagateToDCABxByBz({posDecVtx[0], posDecVtx[1], posDecVtx[2]}, mcMotherTrackPar, 2.f, matCorr, &dcaInfo); registry.fill(HIST("hDCAXYMothToRecSV"), dcaInfo[0]); registry.fill(HIST("hDCAZMothToRecSV"), dcaInfo[1]); - std::array pMotherAtSV = {-999.f, -999.f, -999.f}; - mcMotherTrackPar.getPxPyPzGlo(pMotherAtSV); - registry.fill(HIST("h2TrueMotherDiffPxVsRecSVR"), recSVR, pMotherAtSV[0] - kinkCand.pxMoth()); - registry.fill(HIST("h2TrueMotherDiffPyVsRecSVR"), recSVR, pMotherAtSV[1] - kinkCand.pyMoth()); - - float spKinkXY = kinkCand.pxMoth() * kinkCand.pxDaug() + kinkCand.pyMoth() * kinkCand.pyDaug(); - float spKink = spKinkXY + kinkCand.pzMoth() * kinkCand.pzDaug(); - float pMoth = std::hypot(kinkCand.pxMoth(), kinkCand.pyMoth(), kinkCand.pzMoth()); - float pDaug = std::hypot(kinkCand.pxDaug(), kinkCand.pyDaug(), kinkCand.pzDaug()); - - float mothPDir[3] = {kinkCand.xDecVtx(), kinkCand.yDecVtx(), kinkCand.zDecVtx()}; - float magMothPDirXY = std::hypot(mothPDir[0], mothPDir[1]); - float magMothPDir = std::hypot(mothPDir[0], mothPDir[1], mothPDir[2]); - float spKinkSV = mothPDir[0] * kinkCand.pxDaug() + mothPDir[1] * kinkCand.pyDaug() + mothPDir[2] * kinkCand.pzDaug(); - float sptKinkSV = mothPDir[0] * kinkCand.pxDaug() + mothPDir[1] * kinkCand.pyDaug(); - - float kinkAngle = spKink / (pMoth * pDaug); - float kinkAngleSV = spKinkSV / (magMothPDir * pDaug); - float kinkAngleXY = spKinkXY / (kinkCand.ptMoth() * kinkCand.ptDaug()); - float kinkAngleXYSV = sptKinkSV / (magMothPDirXY * kinkCand.ptDaug()); - - registry.fill(HIST("h2TrueMotherDiffPtVsKinkAngle"), kinkAngle, (mcMotherTrack.pt() - kinkCand.ptMoth()) / kinkCand.ptMoth()); - registry.fill(HIST("h2TrueMotherDiffPtVsKinkAngleSV"), kinkAngleSV, (mcMotherTrack.pt() - kinkCand.ptMoth()) / kinkCand.ptMoth()); - registry.fill(HIST("h2TrueMotherDiffPtVsKinkAngleXY"), kinkAngleXY, (mcMotherTrack.pt() - kinkCand.ptMoth()) / kinkCand.ptMoth()); - registry.fill(HIST("h2TrueMotherDiffPtVsKinkAngleXYSV"), kinkAngleXYSV, (mcMotherTrack.pt() - kinkCand.ptMoth()) / kinkCand.ptMoth()); + std::array mcPMotherSV = {-999.f, -999.f, -999.f}; + mcMotherTrackPar.getPxPyPzGlo(mcPMotherSV); + registry.fill(HIST("h2TrueMotherDiffPxVsRecSVR"), recSVR, mcPMotherSV[0] - kinkCand.pxMoth()); + registry.fill(HIST("h2TrueMotherDiffPyVsRecSVR"), recSVR, mcPMotherSV[1] - kinkCand.pyMoth()); } outputMCTable( - hyphe4sCand.primVtx[0], hyphe4sCand.primVtx[1], hyphe4sCand.primVtx[2], - hyphe4sCand.decVtx[0], hyphe4sCand.decVtx[1], hyphe4sCand.decVtx[2], + hyphe4sCand.posPV[0], hyphe4sCand.posPV[1], hyphe4sCand.posPV[2], + hyphe4sCand.posSV[0], hyphe4sCand.posSV[1], hyphe4sCand.posSV[2], hyphe4sCand.isMatter, hyphe4sCand.lastPosMoth[0], hyphe4sCand.lastPosMoth[1], hyphe4sCand.lastPosMoth[2], - hyphe4sCand.momMoth[0], hyphe4sCand.momMoth[1], hyphe4sCand.momMoth[2], - refitP[0], refitP[1], refitP[2], - hyphe4sCand.momDaug[0], hyphe4sCand.momDaug[1], hyphe4sCand.momDaug[2], - hyphe4sCand.dcaXYMothPv, hyphe4sCand.dcaXYDauPv, hyphe4sCand.dcaKinkTopo, - hyphe4sCand.chi2ITSMoth, hyphe4sCand.itsClusterSizeMoth, hyphe4sCand.itsClusterSizeDau, - hyphe4sCand.nSigmaTPCDau, hyphe4sCand.nSigmaITSDau, + hyphe4sCand.momMothSV[0], hyphe4sCand.momMothSV[1], hyphe4sCand.momMothSV[2], + refitPPV[0], refitPPV[1], refitPPV[2], + refitPSV[0], refitPSV[1], refitPSV[2], + hyphe4sCand.momDaugSV[0], hyphe4sCand.momDaugSV[1], hyphe4sCand.momDaugSV[2], + hyphe4sCand.dcaXYMothPv, hyphe4sCand.dcaXYDaugPv, hyphe4sCand.dcaKinkTopo, + hyphe4sCand.chi2ITSMoth, hyphe4sCand.itsClusterSizeMoth, hyphe4sCand.itsClusterSizeDaug, + hyphe4sCand.nSigmaTPCDaug, hyphe4sCand.nSigmaITSDaug, hyphe4sCand.isSignal, hyphe4sCand.isSignalReco, hyphe4sCand.isCollReco, hyphe4sCand.isSurvEvSelection, - hyphe4sCand.trueDecVtx[0], hyphe4sCand.trueDecVtx[1], hyphe4sCand.trueDecVtx[2], - hyphe4sCand.gMomMoth[0], hyphe4sCand.gMomMoth[1], hyphe4sCand.gMomMoth[2], - hyphe4sCand.trueMomMoth[0], hyphe4sCand.trueMomMoth[1], hyphe4sCand.trueMomMoth[2], - hyphe4sCand.gMomDau[0], hyphe4sCand.gMomDau[1], hyphe4sCand.gMomDau[2], - hyphe4sCand.isMothReco, hyphe4sCand.ptMoth, hyphe4sCand.pzMoth); + hyphe4sCand.truePosSV[0], hyphe4sCand.truePosSV[1], hyphe4sCand.truePosSV[2], + hyphe4sCand.trueMomMothPV[0], hyphe4sCand.trueMomMothPV[1], hyphe4sCand.trueMomMothPV[2], + hyphe4sCand.trueMomMothSV[0], hyphe4sCand.trueMomMothSV[1], hyphe4sCand.trueMomMothSV[2], + hyphe4sCand.trueMomDaugSV[0], hyphe4sCand.trueMomDaugSV[1], hyphe4sCand.trueMomDaugSV[2], + hyphe4sCand.isMothReco, hyphe4sCand.momMothPV[0], hyphe4sCand.momMothPV[1], hyphe4sCand.momMothPV[2], + hyphe4sCand.updateMomMothPV[0], hyphe4sCand.updateMomMothPV[1], hyphe4sCand.updateMomMothPV[2]); } // fill hyperhelium4sigma signals which are not reconstructed @@ -700,7 +695,12 @@ struct Hyperhelium4sigmaRecoTask { if (mcPartIndices[mcparticle.globalIndex()] != -1) { auto mothTrack = tracks.rawIteratorAt(mcPartIndices[mcparticle.globalIndex()]); - fillCandidateRecoMoth(hyphe4sCand, mothTrack); + if (mothTrack.has_collision()) { + auto collision = mothTrack.collision_as(); + auto bc = collision.template bc_as(); + initCCDB(bc); + fillCandidateRecoMoth(hyphe4sCand, collision, mothTrack); + } } outputMCTable( @@ -713,13 +713,15 @@ struct Hyperhelium4sigmaRecoTask { -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, true, false, isReconstructedMCCollisions[mcparticle.mcCollisionId()], isSelectedMCCollisions[mcparticle.mcCollisionId()], - hyphe4sCand.trueDecVtx[0], hyphe4sCand.trueDecVtx[1], hyphe4sCand.trueDecVtx[2], - hyphe4sCand.gMomMoth[0], hyphe4sCand.gMomMoth[1], hyphe4sCand.gMomMoth[2], - hyphe4sCand.trueMomMoth[0], hyphe4sCand.trueMomMoth[1], hyphe4sCand.trueMomMoth[2], - hyphe4sCand.gMomDau[0], hyphe4sCand.gMomDau[1], hyphe4sCand.gMomDau[2], - hyphe4sCand.isMothReco, hyphe4sCand.ptMoth, hyphe4sCand.pzMoth); + hyphe4sCand.truePosSV[0], hyphe4sCand.truePosSV[1], hyphe4sCand.truePosSV[2], + hyphe4sCand.trueMomMothPV[0], hyphe4sCand.trueMomMothPV[1], hyphe4sCand.trueMomMothPV[2], + hyphe4sCand.trueMomMothSV[0], hyphe4sCand.trueMomMothSV[1], hyphe4sCand.trueMomMothSV[2], + hyphe4sCand.trueMomDaugSV[0], hyphe4sCand.trueMomDaugSV[1], hyphe4sCand.trueMomDaugSV[2], + hyphe4sCand.isMothReco, hyphe4sCand.momMothPV[0], hyphe4sCand.momMothPV[1], hyphe4sCand.momMothPV[2], + hyphe4sCand.updateMomMothPV[0], hyphe4sCand.updateMomMothPV[1], hyphe4sCand.updateMomMothPV[2]); } } PROCESS_SWITCH(Hyperhelium4sigmaRecoTask, processMC, "process MC", false); @@ -788,9 +790,9 @@ struct Hyperhelium4sigmaQa { genQAHist.add("hMcRecoInvMass", "", HistType::kTH1F, {invMassAxis}); // efficiency/criteria studies for tracks which are true candidates - hMotherCounter = recoQAHist.add("hMotherCounter", "", HistType::kTH1F, {{9, 0.f, 9.f}}); - hMother2BCounter = recoQAHist.add("hMother2BCounter", "", HistType::kTH1F, {{9, 0.f, 9.f}}); - for (const auto& hist : {hMotherCounter, hMother2BCounter}) { + hMothCounter = recoQAHist.add("hMothCounter", "", HistType::kTH1F, {{9, 0.f, 9.f}}); + hMoth2BCounter = recoQAHist.add("hMoth2BCounter", "", HistType::kTH1F, {{9, 0.f, 9.f}}); + for (const auto& hist : {hMothCounter, hMoth2BCounter}) { hist->GetXaxis()->SetBinLabel(1, "Generated"); hist->GetXaxis()->SetBinLabel(2, "Reconstructed"); hist->GetXaxis()->SetBinLabel(3, "eta"); @@ -808,19 +810,19 @@ struct Hyperhelium4sigmaQa { recoQAHist.add("h2GoodMotherDiffPtVsTrueSVR", ";Decay Vertex R (cm);#Delta p_{T} (GeV/#it{c});", HistType::kTH2F, {svRadiuAxis, diffPtAxis}); recoQAHist.add("h2GoodMotherDiffPzVsTrueSVR", ";Decay Vertex R (cm);#Delta p_{z} (GeV/#it{c});", HistType::kTH2F, {svRadiuAxis, diffPzAxis}); - hDauCounter[kDauAlpha] = recoQAHist.add("hDauAlphaCounter", "", HistType::kTH1F, {{9, 0.f, 9.f}}); - hDauCounter[kDauTriton] = recoQAHist.add("hDauTritonCounter", "", HistType::kTH1F, {{9, 0.f, 9.f}}); - hDauCounter[kDauProton] = recoQAHist.add("hDauProtonCounter", "", HistType::kTH1F, {{9, 0.f, 9.f}}); - hDauCounter[kDauChargedPion] = recoQAHist.add("hDauPionCounter", "", HistType::kTH1F, {{9, 0.f, 9.f}}); - hDauTPCNSigma[kDauAlpha] = recoQAHist.add("hDauAlphaTPCNSigma", "", HistType::kTH2F, {rigidityAxis, nsigmaAxis}); - hDauTPCNSigma[kDauTriton] = recoQAHist.add("hDauTritonTPCNSigma", "", HistType::kTH2F, {rigidityAxis, nsigmaAxis}); - hDauTPCNSigma[kDauProton] = recoQAHist.add("hDauProtonTPCNSigma", "", HistType::kTH2F, {rigidityAxis, nsigmaAxis}); - hDauTPCNSigma[kDauChargedPion] = recoQAHist.add("hDauPionTPCNSigma", "", HistType::kTH2F, {rigidityAxis, nsigmaAxis}); - recoQAHist.add("hDauAlphaITSNSigmaCheck", "", HistType::kTH2F, {rigidityAxis, itsnsigmaAxis}); - - hRecoMotherCounter = recoQAHist.add("hRecoMotherCounter", "", HistType::kTH1F, {{9, 0.f, 9.f}}); - hRecoDauAlphaCounter = recoQAHist.add("hRecoDauAlphaCounter", "", HistType::kTH1F, {{9, 0.f, 9.f}}); - for (const auto& hist : {hDauCounter[kDauAlpha], hDauCounter[kDauTriton], hDauCounter[kDauProton], hDauCounter[kDauChargedPion], hRecoMotherCounter, hRecoDauAlphaCounter}) { + hDaugCounter[kDaugAlpha] = recoQAHist.add("hDaugAlphaCounter", "", HistType::kTH1F, {{9, 0.f, 9.f}}); + hDaugCounter[kDaugTriton] = recoQAHist.add("hDaugTritonCounter", "", HistType::kTH1F, {{9, 0.f, 9.f}}); + hDaugCounter[kDaugProton] = recoQAHist.add("hDaugProtonCounter", "", HistType::kTH1F, {{9, 0.f, 9.f}}); + hDaugCounter[kDaugChargedPion] = recoQAHist.add("hDaugPionCounter", "", HistType::kTH1F, {{9, 0.f, 9.f}}); + hDaugTPCNSigma[kDaugAlpha] = recoQAHist.add("hDaugAlphaTPCNSigma", "", HistType::kTH2F, {rigidityAxis, nsigmaAxis}); + hDaugTPCNSigma[kDaugTriton] = recoQAHist.add("hDaugTritonTPCNSigma", "", HistType::kTH2F, {rigidityAxis, nsigmaAxis}); + hDaugTPCNSigma[kDaugProton] = recoQAHist.add("hDaugProtonTPCNSigma", "", HistType::kTH2F, {rigidityAxis, nsigmaAxis}); + hDaugTPCNSigma[kDaugChargedPion] = recoQAHist.add("hDaugPionTPCNSigma", "", HistType::kTH2F, {rigidityAxis, nsigmaAxis}); + recoQAHist.add("hDaugAlphaITSNSigmaCheck", "", HistType::kTH2F, {rigidityAxis, itsnsigmaAxis}); + + hRecoMothCounter = recoQAHist.add("hRecoMothCounter", "", HistType::kTH1F, {{9, 0.f, 9.f}}); + hRecoDaugAlphaCounter = recoQAHist.add("hRecoDaugAlphaCounter", "", HistType::kTH1F, {{9, 0.f, 9.f}}); + for (const auto& hist : {hDaugCounter[kDaugAlpha], hDaugCounter[kDaugTriton], hDaugCounter[kDaugProton], hDaugCounter[kDaugChargedPion], hRecoMothCounter, hRecoDaugAlphaCounter}) { hist->GetXaxis()->SetBinLabel(1, "Generated"); hist->GetXaxis()->SetBinLabel(2, "Reconstructed"); hist->GetXaxis()->SetBinLabel(3, "eta"); @@ -832,11 +834,11 @@ struct Hyperhelium4sigmaQa { hist->GetXaxis()->SetBinLabel(9, "has TOF)"); } - recoQAHist.add("hMotherIsPVContributer", "", HistType::kTH1F, {{2, 0.f, 2.f}}); - recoQAHist.add("hMotherITSCls", "", HistType::kTH1F, {{8, 0.f, 8.f}}); - recoQAHist.add("hDauAlphaIsPVContributer", "", HistType::kTH1F, {{2, 0.f, 2.f}}); - recoQAHist.add("hDauAlphaITSCls", "", HistType::kTH1F, {{8, 0.f, 8.f}}); - recoQAHist.add("hDauAlphaITSNSigma", "", HistType::kTH2F, {rigidityAxis, itsnsigmaAxis}); + recoQAHist.add("hMothIsPVContributer", "", HistType::kTH1F, {{2, 0.f, 2.f}}); + recoQAHist.add("hMothITSCls", "", HistType::kTH1F, {{8, 0.f, 8.f}}); + recoQAHist.add("hDaugAlphaIsPVContributer", "", HistType::kTH1F, {{2, 0.f, 2.f}}); + recoQAHist.add("hDaugAlphaITSCls", "", HistType::kTH1F, {{8, 0.f, 8.f}}); + recoQAHist.add("hDaugAlphaITSNSigma", "", HistType::kTH2F, {rigidityAxis, itsnsigmaAxis}); recoQAHist.add("hReco2BDauAlphaPVsITSNSigma", "", HistType::kTH2F, {rigidityAxis, itsnsigmaAxis}); recoQAHist.add("hReco2BCandidateCount", "", HistType::kTH1F, {{4, 0.f, 4.f}}); } @@ -996,13 +998,13 @@ struct Hyperhelium4sigmaQa { // qa for mother tracks if (dChannel == k2body) { - recoQAHist.fill(HIST("hMother2BCounter"), 0); + recoQAHist.fill(HIST("hMoth2BCounter"), 0); } else { if (only2BodyDecay) { continue; // skip 3-body decays } } - recoQAHist.fill(HIST("hMotherCounter"), 0); + recoQAHist.fill(HIST("hMothCounter"), 0); genQAHist.fill(HIST("hGenHyperHelium4SigmaCounter"), 0.5); genQAHist.fill(HIST("hGenHyperHelium4SigmaCounter"), isMatter ? 1.5 : 2.5); @@ -1015,29 +1017,29 @@ struct Hyperhelium4sigmaQa { std::vector> dauMom(kNDaughterType, std::vector(3, -999.0f)); for (const auto& mcparticleDaughter : mcparticle.daughters_as()) { for (int type = 0; type < kNDaughterType; type++) { - if (std::abs(mcparticleDaughter.pdgCode()) == kDaughterPDG[type]) { + if (std::abs(mcparticleDaughter.pdgCode()) == kDaugghterPDG[type]) { dauMom[type][0] = mcparticleDaughter.px(); dauMom[type][1] = mcparticleDaughter.py(); dauMom[type][2] = mcparticleDaughter.pz(); - if (type <= kDauTriton) { + if (type <= kDaugTriton) { svPos[0] = mcparticleDaughter.vx(); svPos[1] = mcparticleDaughter.vy(); svPos[2] = mcparticleDaughter.vz(); } if (type < kNChargedDaughterType) { - hDauCounter[type]->Fill(0.f); + hDaugCounter[type]->Fill(0.f); // if daughter track is reconstructed if (type <= kNChargedDaughterType && mcPartIndices[mcparticleDaughter.globalIndex()] != -1) { auto track = tracks.rawIteratorAt(mcPartIndices[mcparticleDaughter.globalIndex()]); float tpcNSigma = getTPCNSigma(track, type); - daughterTrackCheck(track, hDauCounter[type], tpcNSigma); + daughterTrackCheck(track, hDaugCounter[type], tpcNSigma); if (track.hasTPC()) { - hDauTPCNSigma[type]->Fill(track.p() * track.sign(), tpcNSigma); + hDaugTPCNSigma[type]->Fill(track.p() * track.sign(), tpcNSigma); } - if (type == kDauAlpha && track.itsNCls() > kITSLayers - 2) { - recoQAHist.fill(HIST("hDauAlphaITSNSigmaCheck"), track.p() * track.sign(), itsResponse.nSigmaITS(track)); + if (type == kDaugAlpha && track.itsNCls() > kITSLayers - 2) { + recoQAHist.fill(HIST("hDaugAlphaITSNSigmaCheck"), track.p() * track.sign(), itsResponse.nSigmaITS(track)); } } } @@ -1053,9 +1055,9 @@ struct Hyperhelium4sigmaQa { // if mother track is reconstructed if (mcPartIndices[mcparticle.globalIndex()] != -1) { auto motherTrack = tracks.rawIteratorAt(mcPartIndices[mcparticle.globalIndex()]); - bool isGoodMother = motherTrackCheck(motherTrack, hMotherCounter); + bool isGoodMother = motherTrackCheck(motherTrack, hMothCounter); if (dChannel == k2body) { - motherTrackCheck(motherTrack, hMother2BCounter); + motherTrackCheck(motherTrack, hMoth2BCounter); } float svR = RecoDecay::sqrtSumOfSquares(svPos[0], svPos[1]); float diffpt = mcparticle.pt() - 2 * motherTrack.pt(); @@ -1069,6 +1071,7 @@ struct Hyperhelium4sigmaQa { recoQAHist.fill(HIST("h2GoodMotherDiffPtVsTrueSVR"), svR, diffpt); recoQAHist.fill(HIST("h2GoodMotherDiffPzVsTrueSVR"), svR, diffpz); } + // if mother track and charged daughters are all reconstructed bool isDauReconstructed = mcPartIndices[dauIDList[0]] != -1 && (dChannel == k2body ? true : mcPartIndices[dauIDList[1]] != -1); if (isDauReconstructed) { @@ -1077,20 +1080,20 @@ struct Hyperhelium4sigmaQa { // qa for bc matching for reconstructed tracks if (dChannel == k2body) { auto daughterTrack = tracks.rawIteratorAt(mcPartIndices[dauIDList[0]]); - bool isMoth = motherTrackCheck(motherTrack, hRecoMotherCounter); - bool isDaug = daughterTrackCheck(daughterTrack, hRecoDauAlphaCounter, daughterTrack.tpcNSigmaAl()); + bool isMoth = motherTrackCheck(motherTrack, hRecoMothCounter); + bool isDaug = daughterTrackCheck(daughterTrack, hRecoDaugAlphaCounter, daughterTrack.tpcNSigmaAl()); recoQAHist.fill(HIST("hReco2BCandidateCount"), 0.5); - recoQAHist.fill(HIST("hRecoMotherCounter"), 0.5); - recoQAHist.fill(HIST("hMotherITSCls"), motherTrack.itsNCls()); - recoQAHist.fill(HIST("hRecoDauAlphaCounter"), 0.5); - recoQAHist.fill(HIST("hMotherIsPVContributer"), motherTrack.isPVContributor() ? 1.5 : 0.5); - recoQAHist.fill(HIST("hDauAlphaIsPVContributer"), daughterTrack.isPVContributor() ? 1.5 : 0.5); + recoQAHist.fill(HIST("hRecoMothCounter"), 0.5); + recoQAHist.fill(HIST("hMothITSCls"), motherTrack.itsNCls()); + recoQAHist.fill(HIST("hRecoDaugAlphaCounter"), 0.5); + recoQAHist.fill(HIST("hMothIsPVContributer"), motherTrack.isPVContributor() ? 1.5 : 0.5); + recoQAHist.fill(HIST("hDaugAlphaIsPVContributer"), daughterTrack.isPVContributor() ? 1.5 : 0.5); float itsNSigma = itsResponse.nSigmaITS(daughterTrack); if (daughterTrack.hasITS()) { - recoQAHist.fill(HIST("hDauAlphaITSNSigma"), daughterTrack.sign() * daughterTrack.p(), itsNSigma); - recoQAHist.fill(HIST("hDauAlphaITSCls"), daughterTrack.itsNCls()); + recoQAHist.fill(HIST("hDaugAlphaITSNSigma"), daughterTrack.sign() * daughterTrack.p(), itsNSigma); + recoQAHist.fill(HIST("hDaugAlphaITSCls"), daughterTrack.itsNCls()); } if (motherTrack.has_collision() && daughterTrack.has_collision()) { @@ -1111,15 +1114,15 @@ struct Hyperhelium4sigmaQa { // qa for branching ratios and invariant mass if (dChannel == k2body) { genQAHist.fill(HIST("hGenHyperHelium4SigmaCounter"), isMatter ? 3.5 : 4.5); - float hyperHelium4SigmaMCMass = RecoDecay::m(std::array{std::array{dauMom[kDauAlpha][0], dauMom[kDauAlpha][1], dauMom[kDauAlpha][2]}, std::array{dauMom[kDauPion0][0], dauMom[kDauPion0][1], dauMom[kDauPion0][2]}}, std::array{o2::constants::physics::MassAlpha, o2::constants::physics::MassPi0}); + float hyperHelium4SigmaMCMass = RecoDecay::m(std::array{std::array{dauMom[kDaugAlpha][0], dauMom[kDaugAlpha][1], dauMom[kDaugAlpha][2]}, std::array{dauMom[kDaugPion0][0], dauMom[kDaugPion0][1], dauMom[kDaugPion0][2]}}, std::array{o2::constants::physics::MassAlpha, o2::constants::physics::MassPi0}); genQAHist.fill(HIST("hMcRecoInvMass"), hyperHelium4SigmaMCMass); } else if (dChannel == k3body_p) { genQAHist.fill(HIST("hGenHyperHelium4SigmaCounter"), isMatter ? 5.5 : 6.5); - float hyperHelium4SigmaMCMass = RecoDecay::m(std::array{std::array{dauMom[kDauTriton][0], dauMom[kDauTriton][1], dauMom[kDauTriton][2]}, std::array{dauMom[kDauProton][0], dauMom[kDauProton][1], dauMom[kDauProton][2]}, std::array{dauMom[kDauPion0][0], dauMom[kDauPion0][1], dauMom[kDauPion0][2]}}, std::array{o2::constants::physics::MassTriton, o2::constants::physics::MassProton, o2::constants::physics::MassPi0}); + float hyperHelium4SigmaMCMass = RecoDecay::m(std::array{std::array{dauMom[kDaugTriton][0], dauMom[kDaugTriton][1], dauMom[kDaugTriton][2]}, std::array{dauMom[kDaugProton][0], dauMom[kDaugProton][1], dauMom[kDaugProton][2]}, std::array{dauMom[kDaugPion0][0], dauMom[kDaugPion0][1], dauMom[kDaugPion0][2]}}, std::array{o2::constants::physics::MassTriton, o2::constants::physics::MassProton, o2::constants::physics::MassPi0}); genQAHist.fill(HIST("hMcRecoInvMass"), hyperHelium4SigmaMCMass); } else if (dChannel == k3body_n) { genQAHist.fill(HIST("hGenHyperHelium4SigmaCounter"), isMatter ? 7.5 : 8.5); - float hyperHelium4SigmaMCMass = RecoDecay::m(std::array{std::array{dauMom[kDauTriton][0], dauMom[kDauTriton][1], dauMom[kDauTriton][2]}, std::array{dauMom[kDauNeutron][0], dauMom[kDauNeutron][1], dauMom[kDauNeutron][2]}, std::array{dauMom[kDauChargedPion][0], dauMom[kDauChargedPion][1], dauMom[kDauChargedPion][2]}}, std::array{o2::constants::physics::MassTriton, o2::constants::physics::MassNeutron, o2::constants::physics::MassPiPlus}); + float hyperHelium4SigmaMCMass = RecoDecay::m(std::array{std::array{dauMom[kDaugTriton][0], dauMom[kDaugTriton][1], dauMom[kDaugTriton][2]}, std::array{dauMom[kDaugNeutron][0], dauMom[kDaugNeutron][1], dauMom[kDaugNeutron][2]}, std::array{dauMom[kDaugChargedPion][0], dauMom[kDaugChargedPion][1], dauMom[kDaugChargedPion][2]}}, std::array{o2::constants::physics::MassTriton, o2::constants::physics::MassNeutron, o2::constants::physics::MassPiPlus}); genQAHist.fill(HIST("hMcRecoInvMass"), hyperHelium4SigmaMCMass); } } From d8ec5d57fff2babd03314d8b0530dbaae4954aa9 Mon Sep 17 00:00:00 2001 From: omvazque Date: Thu, 24 Jul 2025 03:56:06 -0500 Subject: [PATCH 035/345] [PWGLF] Debugging in the QA and Analysis functions (#12211) --- PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx | 1046 +++++++++++------- 1 file changed, 631 insertions(+), 415 deletions(-) diff --git a/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx b/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx index 86b12e219cc..e1e9821ddb2 100644 --- a/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx @@ -36,7 +36,6 @@ #include #include "TPDGCode.h" -#include #include #include @@ -71,11 +70,30 @@ static constexpr int kSizeBootStrapEnsemble{8}; std::array, kSizeBootStrapEnsemble> hPoisson{}; std::array, kSizeBootStrapEnsemble> hNch{}; -std::array, kSizeBootStrapEnsemble> pNchVsOneParCorr{}; std::array, kSizeBootStrapEnsemble> pNchVsOneParCorrVsZN{}; std::array, kSizeBootStrapEnsemble> pNchVsTwoParCorrVsZN{}; std::array, kSizeBootStrapEnsemble> pNchVsThreeParCorrVsZN{}; -std::array, kSizeBootStrapEnsemble> pNchVsFourParCorrVsZN{}; + +std::array, kSizeBootStrapEnsemble> pOneParCorrVsT0M{}; +std::array, kSizeBootStrapEnsemble> pTwoParCorrVsT0M{}; +std::array, kSizeBootStrapEnsemble> pThreeParCorrVsT0M{}; + +std::array, kSizeBootStrapEnsemble> pOneParCorrVsV0A{}; +std::array, kSizeBootStrapEnsemble> pTwoParCorrVsV0A{}; +std::array, kSizeBootStrapEnsemble> pThreeParCorrVsV0A{}; + +std::array, kSizeBootStrapEnsemble> hPoissonMC{}; +std::array, kSizeBootStrapEnsemble> hNchGen{}; +std::array, kSizeBootStrapEnsemble> pNchvsOneParCorrGen{}; +std::array, kSizeBootStrapEnsemble> pNchvsTwoParCorrGen{}; +std::array, kSizeBootStrapEnsemble> pNchvsThreeParCorrGen{}; +std::array, kSizeBootStrapEnsemble> pNchvsFourParCorrGen{}; + +std::array, kSizeBootStrapEnsemble> hNchRec{}; +std::array, kSizeBootStrapEnsemble> pNchvsOneParCorrRec{}; +std::array, kSizeBootStrapEnsemble> pNchvsTwoParCorrRec{}; +std::array, kSizeBootStrapEnsemble> pNchvsThreeParCorrRec{}; +std::array, kSizeBootStrapEnsemble> pNchvsFourParCorrRec{}; struct UccZdc { @@ -121,26 +139,31 @@ struct UccZdc { Configurable maxEta{"maxEta", +0.8, "maximum eta"}; // Configurables, binning - Configurable nBinsITSTrack{"nBinsITSTrack", 2000, "N bins ITS tracks"}; - Configurable minITSTrack{"minITSTrack", 0., "Min ITS tracks"}; - Configurable maxITSTrack{"maxITSTrack", 6000., "Min ITS tracks"}; - Configurable maxAmpFV0{"maxAmpFV0", 2000, "Max FV0 amp"}; - Configurable nBinsAmpFT0{"nBinsAmpFT0", 100, "N bins FT0 amp"}; - Configurable nBinsAmpFT0Fine{"nBinsAmpFT0Fine", 1000, "N bins FT0 amp"}; - Configurable maxAmpFT0{"maxAmpFT0", 2500, "Max FT0 amp"}; - Configurable nBinsNch{"nBinsNch", 2501, "N bins Nch (|eta|<0.8)"}; - Configurable nBinsNchFine{"nBinsNchFine", 3000, "N bins Nch (|eta|<0.8)"}; Configurable minNch{"minNch", 0, "Min Nch (|eta|<0.8)"}; + Configurable minZN{"minZN", -0.5, "Min ZN signal"}; + Configurable minTdc{"minTdc", -15.0, "minimum TDC"}; + Configurable maxNch{"maxNch", 3000, "Max Nch (|eta|<0.8)"}; - Configurable nBinsZN{"nBinsZN", 400, "N bins ZN"}; - Configurable nBinsZP{"nBinsZP", 160, "N bins ZP"}; - Configurable minZN{"minZN", 0, "Min ZN signal"}; + Configurable maxITSTrack{"maxITSTrack", 6000., "Min ITS tracks"}; + Configurable maxAmpV0A{"maxAmpV0A", 2000, "Max FV0 amp"}; + Configurable maxAmpFT0{"maxAmpFT0", 2500, "Max FT0 amp"}; + Configurable maxAmpFT0A{"maxAmpFT0A", 200, "Max FT0 amp"}; + Configurable maxAmpFT0C{"maxAmpFT0C", 60, "Max FT0 amp"}; Configurable maxZN{"maxZN", 150, "Max ZN signal"}; Configurable maxZP{"maxZP", 60, "Max ZP signal"}; Configurable maxZEM{"maxZEM", 2200, "Max ZEM signal"}; - Configurable nBinsTDC{"nBinsTDC", 150, "nbinsTDC"}; - Configurable minTdc{"minTdc", -15.0, "minimum TDC"}; Configurable maxTdc{"maxTdc", 15.0, "maximum TDC"}; + + Configurable nBinsNch{"nBinsNch", 2501, "N bins Nch (|eta|<0.8)"}; + Configurable nBinsITSTrack{"nBinsITSTrack", 2000, "N bins ITS tracks"}; + Configurable nBinsAmpV0A{"nBinsAmpV0A", 100, "N bins V0A amp"}; + Configurable nBinsAmpFT0{"nBinsAmpFT0", 100, "N bins FT0 amp"}; + Configurable nBinsAmpFT0A{"nBinsAmpFT0A", 100, "N bins FT0A amp"}; + Configurable nBinsAmpFT0C{"nBinsAmpFT0C", 100, "N bins FT0C amp"}; + Configurable nBinsZN{"nBinsZN", 400, "N bins ZN"}; + Configurable nBinsZP{"nBinsZP", 160, "N bins ZP"}; + Configurable nBinsTDC{"nBinsTDC", 150, "nbinsTDC"}; + ConfigurableAxis binsPt{"binsPt", {VARIABLE_WIDTH, 0.0, 0.1, 0.12}, "pT binning"}; ConfigurableAxis binsCent{"binsCent", {VARIABLE_WIDTH, 0., 10., 20., 30., 40., 50., 60., 70., 80., 90., 100.}, "T0C binning"}; @@ -181,8 +204,32 @@ struct UccZdc { HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; Service ccdb; + struct Config { + TH2F* hEfficiency = nullptr; + TH2F* hFeedDown = nullptr; + bool correctionsLoaded = false; + } cfg; + + struct NchConfig { + TH1F* hMeanNch = nullptr; + TH1F* hSigmaNch = nullptr; + bool calibrationsLoaded = false; + } cfgNch; + void init(InitContext const&) { + const char* tiT0A{"T0A (#times 1/100, 3.5 < #eta < 4.9)"}; + const char* tiT0C{"T0C (#times 1/100, -3.3 < #eta < -2.1)"}; + const char* tiT0M{"T0A+T0C (#times 1/100, -3.3 < #eta < -2.1 and 3.5 < #eta < 4.9)"}; + const char* tiNch{"#it{N}_{ch} (|#eta| < 0.8)"}; + const char* tiV0A{"V0A (#times 1/100, 2.2 < #eta < 5)"}; + const char* tiZNs{"ZNA + ZNC"}; + const char* tiZPs{"ZPA + ZPC"}; + const char* tiPt{"#it{p}_{T} (GeV/#it{c})"}; + const char* tiOneParCorr{"#LT[#it{p}_{T}^{(1)}]#GT (GeV/#it{c})"}; + const char* tiTwoParCorr{"Two-Particle #it{p}_{T} correlation"}; + const char* tiThreeParCorr{"Three-Particle #it{p}_{T} correlation"}; + // define axes you want to use const AxisSpec axisZpos{48, -12., 12., "Vtx_{z} (cm)"}; const AxisSpec axisEvent{18, 0.5, 18.5, ""}; @@ -193,19 +240,12 @@ struct UccZdc { const AxisSpec axisAmpCh{250, 0., 2500., "Amplitude of non-zero channels"}; const AxisSpec axisEneCh{300, 0., 300., "Energy of non-zero channels"}; - registry.add("zPos", ";;Entries;", kTH1F, {axisZpos}); - registry.add("T0Ccent", ";;Entries", kTH1F, {axisCent}); - registry.add("NchUncorrected", ";#it{N}_{ch} (|#eta| < 0.8);Entries;", kTH1F, {{nBinsNch, minNch, maxNch}}); + registry.add("NchUncorrected", Form(";%s;Entries;", tiNch), kTH1F, {{nBinsNch, minNch, maxNch}}); registry.add("hEventCounter", ";;Events", kTH1F, {axisEvent}); - registry.add("ZNamp", ";ZNA+ZNC;Entries;", kTH1F, {{nBinsZN, -0.5, maxZN}}); - registry.add("ExcludedEvtVsFT0M", ";T0A+T0C (#times 1/100, -3.3 < #eta < -2.1 and 3.5 < #eta < 4.9);Entries;", kTH1F, {{nBinsAmpFT0, 0., maxAmpFT0}}); - registry.add("ExcludedEvtVsNch", ";#it{N}_{ch} (|#eta|<0.8);Entries;", kTH1F, {{nBinsNch, minNch, maxNch}}); - registry.add("Nch", ";#it{N}_{ch} (|#eta| < 0.8, Corrected);", kTH1F, {{nBinsNch, minNch, maxNch}}); - registry.add("NchVsOneParCorr", ";#it{N}_{ch} (|#eta| < 0.8, Corrected);#LT[#it{p}_{T}^{(1)}]#GT (GeV/#it{c})", kTProfile, {{nBinsNch, minNch, maxNch}}); - registry.add("EtaVsPhi", ";#eta;#varphi", kTH2F, {{{axisEta}, {100, -0.1 * PI, +2.1 * PI}}}); - registry.add("ZposVsEta", "", kTProfile, {axisZpos}); - registry.add("sigma1Pt", ";;#sigma(p_{T})/p_{T};", kTProfile, {axisPt}); - registry.add("dcaXYvspT", ";DCA_{xy} (cm);;", kTH2F, {{{50, -1., 1.}, {axisPt}}}); + registry.add("ExcludedEvtVsFT0M", Form(";%s;Entries;", tiT0M), kTH1F, {{nBinsAmpFT0, 0., maxAmpFT0}}); + registry.add("ExcludedEvtVsNch", Form(";%s;Entries;", tiNch), kTH1F, {{nBinsNch, minNch, maxNch}}); + registry.add("Nch", Form(";%s;Entries;", tiNch), kTH1F, {{nBinsNch, minNch, maxNch}}); + registry.add("NchVsOneParCorr", Form(";%s;%s;", tiNch, tiOneParCorr), kTProfile, {{nBinsNch, minNch, maxNch}}); auto hstat = registry.get(HIST("hEventCounter")); auto* x = hstat->GetXaxis(); @@ -228,32 +268,45 @@ struct UccZdc { x->SetBinLabel(17, "Within ZEM cut?"); if (doprocessZdcCollAss) { - registry.add("NchVsZN", ";#it{N}_{ch} (|#eta| < 0.8); ZNA+ZNC;", kTH2F, {{{nBinsNchFine, minNch, maxNch}, {nBinsZN, -0.5, maxZN}}}); - registry.add("NchVsZP", ";#it{N}_{ch} (|#eta| < 0.8); ZPA+ZPC;", kTH2F, {{{nBinsNchFine, minNch, maxNch}, {nBinsZP, -0.5, maxZP}}}); - registry.add("NITSTacksVsZN", ";ITS tracks; ZNA+ZNC;", kTH2F, {{{nBinsITSTrack, minITSTrack, maxITSTrack}, {nBinsZN, -0.5, maxZN}}}); - registry.add("NITSTacksVsZP", ";ITS tracks; ZPA+ZPC;", kTH2F, {{{nBinsITSTrack, minITSTrack, maxITSTrack}, {nBinsZP, -0.5, maxZP}}}); - registry.add("T0MVsZN", ";T0A+T0C amp (#times 1/100); ZNA+ZNC;", kTH2F, {{{nBinsAmpFT0Fine, 0., maxAmpFT0}, {nBinsZN, -0.5, maxZN}}}); - registry.add("T0MVsZP", ";T0A+T0C amp (#times 1/100); ZPA+ZPC;", kTH2F, {{{nBinsAmpFT0Fine, 0., maxAmpFT0}, {nBinsZP, -0.5, maxZP}}}); - registry.add("NchVsZNVsPt", ";#it{N}_{ch} (|#eta| < 0.8); ZNA+ZNC;#it{p}_{T} (GeV/#it{c})", kTH3F, {{{nBinsNch, minNch, maxNch}, {nBinsZN, -0.5, maxZN}, {axisPt}}}); - registry.add("NchVsOneParCorrVsZN", ";#it{N}_{ch} (|#eta| < 0.8, Corrected); ZNA+ZNC; #LT[#it{p}_{T}^{(1)}]#G (GeV/#it{c})T", kTProfile2D, {{{nBinsNch, minNch, maxNch}, {nBinsZN, -0.5, maxZN}}}); - registry.add("NchVsTwoParCorrVsZN", ";#it{N}_{ch} (|#eta| < 0.8, Corrected);ZNA+ZNC;#LT[#it{p}_{T}^{(2)}]#GT", kTProfile2D, {{{nBinsNch, minNch, maxNch}, {nBinsZN, -0.5, maxZN}}}); - registry.add("NchVsThreeParCorrVsZN", ";#it{N}_{ch} (|#eta| < 0.8, Corrected);ZNA+ZNC;#LT[#it{p}_{T}^{(3)}]#GT", kTProfile2D, {{{nBinsNch, minNch, maxNch}, {nBinsZN, -0.5, maxZN}}}); - registry.add("NchVsFourParCorrVsZN", ";#it{N}_{ch} (|#eta| < 0.8, Corrected);ZNA+ZNC;#LT[#it{p}_{T}^{(4)}]#GT", kTProfile2D, {{{nBinsNch, minNch, maxNch}, {nBinsZN, -0.5, maxZN}}}); - } + registry.add("NchVsT0Mamp", Form(";%s;%s;", tiNch, tiT0M), kTH2F, {{{nBinsNch, minNch, maxNch}, {nBinsAmpFT0, 0., maxAmpFT0}}}); + registry.add("NchVsV0Aamp", Form(";%s;%s;", tiNch, tiV0A), kTH2F, {{{nBinsNch, minNch, maxNch}, {nBinsAmpV0A, 0., maxAmpV0A}}}); + registry.add("NchVsZN", Form(";%s;%s;", tiNch, tiZNs), kTH2F, {{{nBinsNch, minNch, maxNch}, {nBinsZN, minZN, maxZN}}}); + registry.add("NchVsZP", Form(";%s;%s;", tiNch, tiZPs), kTH2F, {{{nBinsNch, minNch, maxNch}, {nBinsZP, minZN, maxZP}}}); + registry.add("NchVsZNVsPt", Form(";%s;%s;%s", tiNch, tiZNs, tiPt), kTH3F, {{{nBinsNch, minNch, maxNch}, {nBinsZN, minZN, maxZN}, {axisPt}}}); + registry.add("NchVsOneParCorrVsZN", Form(";%s;%s;%s", tiNch, tiZNs, tiOneParCorr), kTProfile2D, {{{nBinsNch, minNch, maxNch}, {nBinsZN, minZN, maxZN}}}); + registry.add("NchVsTwoParCorrVsZN", Form(";%s;%s;%s", tiNch, tiZNs, tiTwoParCorr), kTProfile2D, {{{nBinsNch, minNch, maxNch}, {nBinsZN, minZN, maxZN}}}); + registry.add("NchVsThreeParCorrVsZN", Form(";%s;%s;%s", tiNch, tiZNs, tiThreeParCorr), kTProfile2D, {{{nBinsNch, minNch, maxNch}, {nBinsZN, minZN, maxZN}}}); + registry.add("OneParCorrVsT0M", Form(";%s;%s;", tiT0M, tiOneParCorr), kTProfile, {{nBinsAmpFT0, 0., maxAmpFT0}}); + registry.add("TwoParCorrVsT0M", Form(";%s;%s;", tiT0M, tiTwoParCorr), kTProfile, {{nBinsAmpFT0, 0., maxAmpFT0}}); + registry.add("ThreeParCorrVsT0M", Form(";%s;%s;", tiT0M, tiThreeParCorr), kTProfile, {{nBinsAmpFT0, 0., maxAmpFT0}}); + registry.add("OneParCorrVsV0A", Form(";%s;%s;", tiV0A, tiOneParCorr), kTProfile, {{nBinsAmpV0A, 0., maxAmpV0A}}); + registry.add("TwoParCorrVsV0A", Form(";%s;%s;", tiV0A, tiTwoParCorr), kTProfile, {{nBinsAmpV0A, 0., maxAmpV0A}}); + registry.add("ThreeParCorrVsV0A", Form(";%s;%s;", tiV0A, tiThreeParCorr), kTProfile, {{nBinsAmpV0A, 0., maxAmpV0A}}); - if (doprocessEventSampling) { for (int i = 0; i < kSizeBootStrapEnsemble; i++) { - hNch[i] = registry.add(Form("Nch_Replica%d", i), ";#it{N}_{ch} (|#eta| < 0.8);Entries", kTH1F, {{nBinsNch, minNch, maxNch}}); - hPoisson[i] = registry.add(Form("Poisson_Replica%d", i), ";#it{k};Entries", kTH1F, {{21, -0.5, 20.5}}); - pNchVsOneParCorrVsZN[i] = registry.add(Form("NchVsOneParCorrVsZN_Replica%d", i), ";#it{N}_{ch}, |#eta| < 0.8; ZNA+ZNC; #LT[#it{p}_{T}^{(1)}]#GT (GeV/#it{c})", kTProfile2D, {{{nBinsNch, minNch, maxNch}, {nBinsZN, -0.5, maxZN}}}); - pNchVsTwoParCorrVsZN[i] = registry.add(Form("NchVsTwoParCorrVsZN_Replica%d", i), ";#it{N}_{ch}, |#eta| < 0.8; ZNA+ZNC; #LT[#it{p}_{T}^{(1)}]#GT (GeV/#it{c})", kTProfile2D, {{{nBinsNch, minNch, maxNch}, {nBinsZN, -0.5, maxZN}}}); - pNchVsThreeParCorrVsZN[i] = registry.add(Form("NchVsThreeParCorrVsZN_Replica%d", i), ";#it{N}_{ch}, |#eta| < 0.8; ZNA+ZNC; #LT[#it{p}_{T}^{(1)}]#GT (GeV/#it{c})", kTProfile2D, {{{nBinsNch, minNch, maxNch}, {nBinsZN, -0.5, maxZN}}}); - pNchVsFourParCorrVsZN[i] = registry.add(Form("NchVsFourParCorrVsZN_Replica%d", i), ";#it{N}_{ch}, |#eta| < 0.8; ZNA+ZNC; #LT[#it{p}_{T}^{(1)}]#GT (GeV/#it{c})", kTProfile2D, {{{nBinsNch, minNch, maxNch}, {nBinsZN, -0.5, maxZN}}}); - pNchVsOneParCorr[i] = registry.add(Form("NchVsOneParCorr_Replica%d", i), ";#it{N}_{ch}, |#eta| < 0.8;#LT[#it{p}_{T}^{(1)}]#GT (GeV/#it{c})", kTProfile, {{nBinsNch, minNch, maxNch}}); + hNch[i] = registry.add(Form("Nch_Replica%d", i), Form(";%s;Entries", tiNch), kTH1F, {{nBinsNch, minNch, maxNch}}); + hPoisson[i] = registry.add(Form("Poisson_Replica%d", i), ";#it{k};Entries", kTH1F, {{11, -0.5, 10.5}}); + pNchVsOneParCorrVsZN[i] = registry.add(Form("NchVsOneParCorrVsZN_Replica%d", i), Form(";%s;%s;%s", tiNch, tiZNs, tiOneParCorr), kTProfile2D, {{{nBinsNch, minNch, maxNch}, {nBinsZN, minZN, maxZN}}}); + pNchVsTwoParCorrVsZN[i] = registry.add(Form("NchVsTwoParCorrVsZN_Replica%d", i), Form(";%s;%s;%s", tiNch, tiZNs, tiTwoParCorr), kTProfile2D, {{{nBinsNch, minNch, maxNch}, {nBinsZN, minZN, maxZN}}}); + pNchVsThreeParCorrVsZN[i] = registry.add(Form("NchVsThreeParCorrVsZN_Replica%d", i), Form(";%s;%s;%s", tiNch, tiZNs, tiThreeParCorr), kTProfile2D, {{{nBinsNch, minNch, maxNch}, {nBinsZN, minZN, maxZN}}}); + + pOneParCorrVsT0M[i] = registry.add(Form("OneParCorrVsT0M_Replica%d", i), Form(";%s;%s;", tiT0M, tiOneParCorr), kTProfile, {{nBinsAmpFT0, 0., maxAmpFT0}}); + pTwoParCorrVsT0M[i] = registry.add(Form("TwoParCorrVsT0M_Replica%d", i), Form(";%s;%s;", tiT0M, tiTwoParCorr), kTProfile, {{nBinsAmpFT0, 0., maxAmpFT0}}); + pThreeParCorrVsT0M[i] = registry.add(Form("ThreeParCorrVsT0M_Replica%d", i), Form(";%s;%s;", tiT0M, tiThreeParCorr), kTProfile, {{nBinsAmpFT0, 0., maxAmpFT0}}); + + pOneParCorrVsV0A[i] = registry.add(Form("OneParCorrVsV0A_Replica%d", i), Form(";%s;%s;", tiV0A, tiOneParCorr), kTProfile, {{nBinsAmpV0A, 0., maxAmpV0A}}); + pTwoParCorrVsV0A[i] = registry.add(Form("TwoParCorrVsV0A_Replica%d", i), Form(";%s;%s;", tiV0A, tiTwoParCorr), kTProfile, {{nBinsAmpV0A, 0., maxAmpV0A}}); + pThreeParCorrVsV0A[i] = registry.add(Form("ThreeParCorrVsV0A_Replica%d", i), Form(";%s;%s;", tiV0A, tiThreeParCorr), kTProfile, {{nBinsAmpV0A, 0., maxAmpV0A}}); } } if (doprocessMCclosure) { + registry.add("zPos", ";;Entries;", kTH1F, {axisZpos}); + registry.add("T0Ccent", ";;Entries", kTH1F, {axisCent}); + registry.add("EtaVsPhi", ";#eta;#varphi", kTH2F, {{{axisEta}, {100, -0.1 * PI, +2.1 * PI}}}); + registry.add("ZposVsEta", "", kTProfile, {axisZpos}); + registry.add("sigma1Pt", ";;#sigma(p_{T})/p_{T};", kTProfile, {axisPt}); + registry.add("dcaXYvspT", ";DCA_{xy} (cm);;", kTH2F, {{{50, -1., 1.}, {axisPt}}}); registry.add("RandomNumber", "", kTH1F, {{50, 0., 1.}}); registry.add("EvtsDivided", ";Event type;Entries;", kTH1F, {{2, -0.5, 1.5}}); auto hEvtsDiv = registry.get(HIST("EvtsDivided")); @@ -294,33 +347,53 @@ struct UccZdc { auto* x = hECMC->GetXaxis(); x->SetBinLabel(1, "All"); x->SetBinLabel(13, "VtxZ cut"); + + for (int i = 0; i < kSizeBootStrapEnsemble; i++) { + hPoissonMC[i] = registry.add(Form("PoissonMC_Replica%d", i), ";#it{k};Entries", kTH1F, {{21, -0.5, 20.5}}); + hNchGen[i] = registry.add(Form("NchGen_Replica%d", i), ";#it{N}_{ch} (|#eta| < 0.8);Entries", kTH1F, {{nBinsNch, minNch, maxNch}}); + pNchvsOneParCorrGen[i] = registry.add(Form("NchvsOneParCorrGen_Replica%d", i), ";#it{N}_{ch}, |#eta| < 0.8; One-particle #it{p}_{T} correlator", kTProfile, {{nBinsNch, minNch, maxNch}}); + pNchvsTwoParCorrGen[i] = registry.add(Form("NchvsTwoParCorrGen_Replica%d", i), ";#it{N}_{ch}, |#eta| < 0.8; Two-particle #it{p}_{T} correlator", kTProfile, {{nBinsNch, minNch, maxNch}}); + pNchvsThreeParCorrGen[i] = registry.add(Form("NchvsThreeParCorrGen_Replica%d", i), ";#it{N}_{ch}, |#eta| < 0.8; Three-particle #it{p}_{T} correlator", kTProfile, {{nBinsNch, minNch, maxNch}}); + pNchvsFourParCorrGen[i] = registry.add(Form("NchvsFourParCorrGen_Replica%d", i), ";#it{N}_{ch}, |#eta| < 0.8; Four-particle #it{p}_{T} correlator", kTProfile, {{nBinsNch, minNch, maxNch}}); + + hNchRec[i] = registry.add(Form("NchRec_Replica%d", i), ";#it{N}_{ch} (|#eta| < 0.8);Entries", kTH1F, {{nBinsNch, minNch, maxNch}}); + pNchvsOneParCorrRec[i] = registry.add(Form("NchvsOneParCorrRec_Replica%d", i), ";#it{N}_{ch}, |#eta| < 0.8; One-particle #it{p}_{T} correlator", kTProfile, {{nBinsNch, minNch, maxNch}}); + pNchvsTwoParCorrRec[i] = registry.add(Form("NchvsTwoParCorrRec_Replica%d", i), ";#it{N}_{ch}, |#eta| < 0.8; Two-particle #it{p}_{T} correlator", kTProfile, {{nBinsNch, minNch, maxNch}}); + pNchvsThreeParCorrRec[i] = registry.add(Form("NchvsThreeParCorrRec_Replica%d", i), ";#it{N}_{ch}, |#eta| < 0.8; Three-particle #it{p}_{T} correlator", kTProfile, {{nBinsNch, minNch, maxNch}}); + pNchvsFourParCorrRec[i] = registry.add(Form("NchvsFourParCorrRec_Replica%d", i), ";#it{N}_{ch}, |#eta| < 0.8; Four-particle #it{p}_{T} correlator", kTProfile, {{nBinsNch, minNch, maxNch}}); + } } if (doprocessQA) { + registry.add("zPos", ";;Entries;", kTH1F, {axisZpos}); + registry.add("T0Ccent", ";;Entries", kTH1F, {axisCent}); + registry.add("EtaVsPhi", ";#eta;#varphi", kTH2F, {{{axisEta}, {100, -0.1 * PI, +2.1 * PI}}}); + registry.add("ZposVsEta", "", kTProfile, {axisZpos}); + registry.add("sigma1Pt", ";;#sigma(p_{T})/p_{T};", kTProfile, {axisPt}); + registry.add("dcaXYvspT", ";DCA_{xy} (cm);;", kTH2F, {{{50, -1., 1.}, {axisPt}}}); registry.add("Debunch", ";t_{ZDC}-t_{ZDA};t_{ZDC}+t_{ZDA}", kTH2F, {{{nBinsTDC, minTdc, maxTdc}, {nBinsTDC, minTdc, maxTdc}}}); - registry.add("NchVsFT0M", ";T0A+T0C (#times 1/100, -3.3 < #eta < -2.1 and 3.5 < #eta < 4.9);#it{N}_{ch} (|#eta|<0.8);", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsNch, minNch, maxNch}}}); - registry.add("NchVsFT0A", ";T0A (#times 1/100, 3.5 < #eta < 4.9);#it{N}_{ch} (|#eta|<0.8);", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsNch, minNch, maxNch}}}); - registry.add("NchVsFT0C", ";T0C (#times 1/100, -3.3 < #eta < -2.1);#it{N}_{ch} (|#eta|<0.8);", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsNch, minNch, maxNch}}}); - registry.add("NchVsFV0A", ";V0A (#times 1/100, 2.2 < #eta < 5);#it{N}_{ch} (|#eta|<0.8);", kTH2F, {{{80, 0., maxAmpFV0}, {nBinsNch, minNch, maxNch}}}); - registry.add("NchVsEt", ";#it{E}_{T} (|#eta|<0.8);#LTITS+TPC tracks#GT (|#eta|<0.8);", kTH2F, {{{nBinsNch, minNch, maxNch}, {nBinsNch, minNch, maxNch}}}); - registry.add("NchVsNPV", ";#it{N}_{PV} (|#eta|<1);ITS+TPC tracks (|#eta|<0.8);", kTH2F, {{{nBinsITSTrack, minITSTrack, maxITSTrack}, {nBinsNch, minNch, maxNch}}}); - registry.add("NchVsITStracks", ";ITS tracks nCls >= 5;TITS+TPC tracks (|#eta|<0.8);", kTH2F, {{{nBinsITSTrack, minITSTrack, maxITSTrack}, {nBinsNch, minNch, maxNch}}}); - registry.add("ZNVsFT0A", ";T0A (#times 1/100);ZNA+ZNC;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsZN, -0.5, maxZN}}}); - registry.add("ZNVsFT0C", ";T0C (#times 1/100);ZNA+ZNC;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsZN, -0.5, maxZN}}}); - registry.add("ZNVsFT0M", ";T0A+T0C (#times 1/100);ZNA+ZNC;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsZN, -0.5, maxZN}}}); - registry.add("ZNAamp", ";ZNA;Entries;", kTH1F, {{nBinsZN, -0.5, maxZN}}); - registry.add("ZPAamp", ";ZPA;Entries;", kTH1F, {{nBinsZP, -0.5, maxZP}}); - registry.add("ZNCamp", ";ZNC;Entries;", kTH1F, {{nBinsZN, -0.5, maxZN}}); - registry.add("ZPCamp", ";ZPC;Entries;", kTH1F, {{nBinsZP, -0.5, maxZP}}); - registry.add("ZNAVsZNC", ";ZNC;ZNA", kTH2F, {{{nBinsZN, -0.5, maxZN}, {nBinsZN, -0.5, maxZN}}}); - registry.add("ZPAVsZPC", ";ZPC;ZPA;", kTH2F, {{{nBinsZP, -0.5, maxZP}, {nBinsZP, -0.5, maxZP}}}); - registry.add("ZNAVsZPA", ";ZPA;ZNA;", kTH2F, {{{nBinsZP, -0.5, maxZP}, {nBinsZN, -0.5, maxZN}}}); - registry.add("ZNCVsZPC", ";ZPC;ZNC;", kTH2F, {{{nBinsZP, -0.5, maxZP}, {nBinsZN, -0.5, maxZN}}}); - registry.add("ZNVsZEM", ";ZEM;ZNA+ZNC;", kTH2F, {{{nBinsZN, -0.5, maxZEM}, {nBinsZN, -0.5, maxZN}}}); - registry.add("ZNCVsNch", ";#it{N}_{ch} (|#eta|<0.8);ZNC;", kTH2F, {{{nBinsNch, minNch, maxNch}, {nBinsZN, minZN, maxZN}}}); - registry.add("ZNAVsNch", ";#it{N}_{ch} (|#eta|<0.8);ZNA;", kTH2F, {{{nBinsNch, minNch, maxNch}, {nBinsZN, minZN, maxZN}}}); - registry.add("ZNVsNch", ";#it{N}_{ch} (|#eta|<0.8);ZNA+ZNC;", kTH2F, {{{nBinsNch, minNch, maxNch}, {nBinsZN, minZN, maxZN}}}); - registry.add("ZNDifVsNch", ";#it{N}_{ch} (|#eta|<0.8);ZNA-ZNC;", kTH2F, {{{nBinsNch, minNch, maxNch}, {100, -50., 50.}}}); + registry.add("NchVsFT0M", Form(";%s;%s;", tiT0M, tiNch), kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsNch, minNch, maxNch}}}); + registry.add("NchVsFT0A", Form(";%s;%s;", tiT0A, tiNch), kTH2F, {{{nBinsAmpFT0A, 0., maxAmpFT0A}, {nBinsNch, minNch, maxNch}}}); + registry.add("NchVsFT0C", Form(";%s;%s;", tiT0C, tiNch), kTH2F, {{{nBinsAmpFT0C, 0., maxAmpFT0C}, {nBinsNch, minNch, maxNch}}}); + registry.add("NchVsFV0A", Form(";%s;%s;", tiV0A, tiNch), kTH2F, {{{nBinsAmpV0A, 0., maxAmpV0A}, {nBinsNch, minNch, maxNch}}}); + registry.add("NchVsNPV", ";#it{N}_{PV} (|#eta|<1);ITS+TPC tracks (|#eta|<0.8);", kTH2F, {{{nBinsITSTrack, 0, maxITSTrack}, {nBinsNch, minNch, maxNch}}}); + registry.add("NchVsITStracks", ";ITS trks (|#eta|<0.8);TITS+TPC tracks (|#eta|<0.8);", kTH2F, {{{nBinsITSTrack, 0, maxITSTrack}, {nBinsNch, minNch, maxNch}}}); + registry.add("ZNVsFT0A", Form(";%s;%s;", tiT0A, tiZNs), kTH2F, {{{nBinsAmpFT0A, 0., maxAmpFT0A}, {nBinsZN, minZN, maxZN}}}); + registry.add("ZNVsFT0C", Form(";%s;%s;", tiT0C, tiZNs), kTH2F, {{{nBinsAmpFT0C, 0., maxAmpFT0C}, {nBinsZN, minZN, maxZN}}}); + registry.add("ZNVsFT0M", Form(";%s;%s;", tiT0M, tiZNs), kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsZN, minZN, maxZN}}}); + registry.add("ZNAamp", ";ZNA;Entries;", kTH1F, {{nBinsZN, minZN, maxZN}}); + registry.add("ZPAamp", ";ZPA;Entries;", kTH1F, {{nBinsZP, minZN, maxZP}}); + registry.add("ZNCamp", ";ZNC;Entries;", kTH1F, {{nBinsZN, minZN, maxZN}}); + registry.add("ZPCamp", ";ZPC;Entries;", kTH1F, {{nBinsZP, minZN, maxZP}}); + registry.add("ZNAVsZNC", ";ZNC;ZNA", kTH2F, {{{nBinsZN, minZN, maxZN}, {nBinsZN, minZN, maxZN}}}); + registry.add("ZPAVsZPC", ";ZPC;ZPA;", kTH2F, {{{nBinsZP, minZN, maxZP}, {nBinsZP, minZN, maxZP}}}); + registry.add("ZNAVsZPA", ";ZPA;ZNA;", kTH2F, {{{nBinsZP, minZN, maxZP}, {nBinsZN, minZN, maxZN}}}); + registry.add("ZNCVsZPC", ";ZPC;ZNC;", kTH2F, {{{nBinsZP, minZN, maxZP}, {nBinsZN, minZN, maxZN}}}); + registry.add("ZNVsZEM", ";ZEM;ZNA+ZNC;", kTH2F, {{{nBinsZN, minZN, maxZEM}, {nBinsZN, minZN, maxZN}}}); + registry.add("ZNCVsNch", Form(";%s;ZNC;", tiNch), kTH2F, {{{nBinsNch, minNch, maxNch}, {nBinsZN, minZN, maxZN}}}); + registry.add("ZNAVsNch", Form(";%s;ZNA;", tiNch), kTH2F, {{{nBinsNch, minNch, maxNch}, {nBinsZN, minZN, maxZN}}}); + registry.add("ZNVsNch", Form(";%s;%s;", tiNch, tiZNs), kTH2F, {{{nBinsNch, minNch, maxNch}, {nBinsZN, minZN, maxZN}}}); + registry.add("ZNDifVsNch", Form(";%s;ZNA-ZNC;", tiNch), kTH2F, {{{nBinsNch, minNch, maxNch}, {100, -50., 50.}}}); } LOG(info) << "\tccdbNoLaterThan=" << ccdbNoLaterThan.value; @@ -338,18 +411,10 @@ struct UccZdc { LOG(info) << "\tmaxPtSpectra=" << maxPtSpectra.value; ccdb->setURL("http://alice-ccdb.cern.ch"); - // Enabling object caching, otherwise each call goes to the CCDB server ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); ccdb->setFatalWhenNull(false); - // Not later than now, will be replaced by the value of the train creation - // This avoids that users can replace objects **while** a train is running ccdb->setCreatedNotAfter(ccdbNoLaterThan.value); - // Feed Down is the same for all runs -> use a global object - // fd = ccdb->getForTimeStamp(paTHFD.value,ccdbNoLaterThan.value); - // if (!fd) { - // LOGF(fatal, "Feed Down object not found!"); - // } } template @@ -435,7 +500,6 @@ struct UccZdc { return true; } - void processQA(o2::aod::ColEvSels::iterator const& collision, o2::aod::BCsRun3 const& /**/, aod::Zdcs const& /**/, aod::FV0As const& /**/, aod::FT0s const& /**/, TheFilteredTracks const& tracks) { // LOG(info) << " Collisions size: " << collisions.size() << " Table's size: " << collisions.tableSize() << "\n"; @@ -452,7 +516,8 @@ struct UccZdc { registry.fill(HIST("hEventCounter"), EvCutLabel::Zdc); auto zdc = foundBC.zdc(); - float aT0A = 0., aT0C = 0., aV0A = 0.; + double aT0A{-999.}; + double aT0C{-999.}; if (foundBC.has_ft0()) { for (const auto& amplitude : foundBC.ft0().amplitudeA()) { aT0A += amplitude; @@ -464,15 +529,18 @@ struct UccZdc { return; } registry.fill(HIST("hEventCounter"), EvCutLabel::TZero); + + double aV0A{-999.}; if (foundBC.has_fv0a()) { for (const auto& amplitude : foundBC.fv0a().amplitude()) { aV0A += amplitude; } - } else { - aV0A = -999.; } const double normT0M{(aT0A + aT0C) / 100.}; + const double normV0A{aV0A / 100.}; + const double normT0A{aT0A / 100.}; + const double normT0C{aT0C / 100.}; float znA{zdc.amplitudeZNA()}; float znC{zdc.amplitudeZNC()}; float zpA{zdc.amplitudeZPA()}; @@ -509,7 +577,7 @@ struct UccZdc { int itsTracks = 0, glbTracks = 0; for (const auto& track : tracks) { - if (track.hasITS()) { + if (track.hasITS() && ((track.eta() > minEta) && (track.eta() < maxEta))) { itsTracks++; } // Track Selection @@ -519,25 +587,21 @@ struct UccZdc { if ((track.pt() < minPt) || (track.pt() > maxPt)) { continue; } + if ((track.eta() < minEta) || (track.eta() > maxEta)) { + continue; + } glbTracks++; } bool skipEvent{false}; if (useMidRapNchSel) { - auto hMeanNch = ccdb->getForTimeStamp(paTHmeanNch.value, foundBC.timestamp()); - auto hSigmaNch = ccdb->getForTimeStamp(paTHsigmaNch.value, foundBC.timestamp()); - if (!hMeanNch) { - LOGF(info, "hMeanNch NOT LOADED!"); + loadNchCalibrations(foundBC.timestamp()); + if (!(cfgNch.hMeanNch && cfgNch.hSigmaNch)) return; - } - if (!hSigmaNch) { - LOGF(info, "hSigmaNch NOT LOADED!"); - return; - } - const int binT0M{hMeanNch->FindBin(normT0M)}; - const double meanNch{hMeanNch->GetBinContent(binT0M)}; - const double sigmaNch{hSigmaNch->GetBinContent(binT0M)}; + const int binT0M{cfgNch.hMeanNch->FindBin(normT0M)}; + const double meanNch{cfgNch.hMeanNch->GetBinContent(binT0M)}; + const double sigmaNch{cfgNch.hSigmaNch->GetBinContent(binT0M)}; const double nSigmaSelection{nSigmaNchCut * sigmaNch}; const double diffMeanNch{meanNch - glbTracks}; @@ -552,7 +616,7 @@ struct UccZdc { return; } - float et = 0., meanpt = 0.; + double meanpt{0.}; for (const auto& track : tracks) { // Track Selection if (!track.isGlobalTrack()) { @@ -561,12 +625,14 @@ struct UccZdc { if ((track.pt() < minPt) || (track.pt() > maxPtSpectra)) { continue; } + if ((track.eta() < minEta) || (track.eta() > maxEta)) { + continue; + } registry.fill(HIST("ZposVsEta"), collision.posZ(), track.eta()); registry.fill(HIST("EtaVsPhi"), track.eta(), track.phi()); registry.fill(HIST("sigma1Pt"), track.pt(), track.sigma1Pt()); registry.fill(HIST("dcaXYvspT"), track.dcaXY(), track.pt()); - et += std::sqrt(std::pow(track.pt(), 2.) + std::pow(o2::constants::physics::MassPionCharged, 2.)); meanpt += track.pt(); } @@ -576,23 +642,21 @@ struct UccZdc { registry.fill(HIST("ZNCamp"), znC); registry.fill(HIST("ZPAamp"), zpA); registry.fill(HIST("ZPCamp"), zpC); - registry.fill(HIST("ZNamp"), sumZNs); registry.fill(HIST("ZNAVsZNC"), znC, znA); registry.fill(HIST("ZNAVsZPA"), zpA, znA); registry.fill(HIST("ZNCVsZPC"), zpC, znC); registry.fill(HIST("ZPAVsZPC"), zpC, zpA); registry.fill(HIST("ZNVsZEM"), sumZEMs, sumZNs); registry.fill(HIST("Debunch"), tZDCdif, tZDCsum); - registry.fill(HIST("ZNVsFT0A"), aT0A / 100., sumZNs); - registry.fill(HIST("ZNVsFT0C"), aT0C / 100., sumZNs); + registry.fill(HIST("ZNVsFT0A"), normT0A, sumZNs); + registry.fill(HIST("ZNVsFT0C"), normT0C, sumZNs); registry.fill(HIST("ZNVsFT0M"), normT0M, sumZNs); - registry.fill(HIST("NchVsFV0A"), aV0A / 100., glbTracks); - registry.fill(HIST("NchVsFT0A"), aT0A / 100., glbTracks); - registry.fill(HIST("NchVsFT0C"), aT0C / 100., glbTracks); + registry.fill(HIST("NchVsFV0A"), normV0A, glbTracks); + registry.fill(HIST("NchVsFT0A"), normT0A, glbTracks); + registry.fill(HIST("NchVsFT0C"), normT0C, glbTracks); registry.fill(HIST("NchVsFT0M"), normT0M, glbTracks); registry.fill(HIST("NchUncorrected"), glbTracks); registry.fill(HIST("Nch"), glbTracks); - registry.fill(HIST("NchVsEt"), et, glbTracks); registry.fill(HIST("NchVsNPV"), collision.multNTracksPVeta1(), glbTracks); registry.fill(HIST("NchVsITStracks"), itsTracks, glbTracks); registry.fill(HIST("ZNAVsNch"), glbTracks, znA); @@ -603,7 +667,6 @@ struct UccZdc { registry.fill(HIST("NchVsOneParCorr"), glbTracks, meanpt / glbTracks); } PROCESS_SWITCH(UccZdc, processQA, "Process QA", true); - void processZdcCollAss(o2::aod::ColEvSels::iterator const& collision, o2::aod::BCsRun3 const& /*bcs*/, aod::Zdcs const& /*zdcs*/, aod::FV0As const& /*fv0as*/, aod::FT0s const& /*ft0s*/, TheFilteredTracks const& tracks) { if (!isEventSelected(collision)) { @@ -619,7 +682,8 @@ struct UccZdc { } registry.fill(HIST("hEventCounter"), EvCutLabel::Zdc); - float aT0A = 0., aT0C = 0.; + double aT0A{-999.}; + double aT0C{-999.}; if (foundBC.has_ft0()) { for (const auto& amplitude : foundBC.ft0().amplitudeA()) { aT0A += amplitude; @@ -632,7 +696,15 @@ struct UccZdc { } registry.fill(HIST("hEventCounter"), EvCutLabel::TZero); + double aV0A{-999.}; + if (foundBC.has_fv0a()) { + for (const auto& amplitude : foundBC.fv0a().amplitude()) { + aV0A += amplitude; + } + } + const double normT0M{(aT0A + aT0C) / 100.}; + const double normV0A{aV0A / 100.}; float znA{foundBC.zdc().amplitudeZNA()}; float znC{foundBC.zdc().amplitudeZNC()}; float zpA{foundBC.zdc().amplitudeZPA()}; @@ -649,9 +721,9 @@ struct UccZdc { znC /= kCollEnergy; zpA /= kCollEnergy; zpC /= kCollEnergy; - float sumZNs{znA + znC}; - float sumZPs{zpA + zpC}; - float sumZEMs{aZEM1 + aZEM2}; + const double sumZNs{znA + znC}; + const double sumZPs{zpA + zpC}; + const double sumZEMs{aZEM1 + aZEM2}; // TDC cut if (isTDCcut) { @@ -669,68 +741,48 @@ struct UccZdc { registry.fill(HIST("hEventCounter"), EvCutLabel::Zem); } - registry.fill(HIST("zPos"), collision.posZ()); - registry.fill(HIST("T0Ccent"), collision.centFT0C()); - // Nch-based selection - int itsTracks = 0, glbTracks = 0; + int glbTracks = 0; for (const auto& track : tracks) { // Track Selection - if (track.hasITS()) { - itsTracks++; - } if (!track.isGlobalTrack()) { continue; } if ((track.pt() < minPt) || (track.pt() > maxPt)) { continue; } - registry.fill(HIST("ZposVsEta"), collision.posZ(), track.eta()); - registry.fill(HIST("EtaVsPhi"), track.eta(), track.phi()); - registry.fill(HIST("sigma1Pt"), track.pt(), track.sigma1Pt()); - registry.fill(HIST("dcaXYvspT"), track.dcaXY(), track.pt()); + if ((track.eta() < minEta) || (track.eta() > maxEta)) { + continue; + } glbTracks++; } + if (glbTracks < minNchSel) { + return; + } + bool skipEvent{false}; if (useMidRapNchSel) { - auto hMeanNch = ccdb->getForTimeStamp(paTHmeanNch.value, foundBC.timestamp()); - auto hSigmaNch = ccdb->getForTimeStamp(paTHsigmaNch.value, foundBC.timestamp()); - if (!hMeanNch) { - LOGF(info, "hMeanNch NOT LOADED!"); - return; - } - if (!hSigmaNch) { - LOGF(info, "hSigmaNch NOT LOADED!"); + + loadNchCalibrations(foundBC.timestamp()); + if (!(cfgNch.hMeanNch && cfgNch.hSigmaNch)) return; - } - const int binT0M{hMeanNch->FindBin(normT0M)}; - const double meanNch{hMeanNch->GetBinContent(binT0M)}; - const double sigmaNch{hSigmaNch->GetBinContent(binT0M)}; + const int binT0M{cfgNch.hMeanNch->FindBin(normT0M)}; + const double meanNch{cfgNch.hMeanNch->GetBinContent(binT0M)}; + const double sigmaNch{cfgNch.hSigmaNch->GetBinContent(binT0M)}; const double nSigmaSelection{nSigmaNchCut * sigmaNch}; const double diffMeanNch{meanNch - glbTracks}; - if (!(std::abs(diffMeanNch) < nSigmaSelection)) { + if (std::abs(diffMeanNch) > nSigmaSelection) { registry.fill(HIST("ExcludedEvtVsFT0M"), normT0M); registry.fill(HIST("ExcludedEvtVsNch"), glbTracks); - } else { skipEvent = true; } } // Skip event based on number of Nch sigmas - if (!skipEvent) { - return; - } - - auto efficiency = ccdb->getForTimeStamp(paTHEff.value, foundBC.timestamp()); - if (!efficiency) { - return; - } - - auto feedDown = ccdb->getForTimeStamp(paTHFD.value, foundBC.timestamp()); - if (!feedDown) { + if (useMidRapNchSel && skipEvent) { return; } @@ -739,72 +791,93 @@ struct UccZdc { std::vector vecFD; std::vector vecEff; - // Calculates the Nch multiplicity - for (const auto& track : tracks) { - // Track Selection - if (!track.isGlobalTrack()) { - continue; - } - if ((track.pt() < minPt) || (track.pt() > maxPt)) { - continue; - } + // apply corrections + if (applyEff || applyFD) { - float pt{track.pt()}; - int foundNchBin{efficiency->GetXaxis()->FindBin(glbTracks)}; - int foundPtBin{efficiency->GetYaxis()->FindBin(pt)}; - float effValue{1.}; - float fdValue{1.}; - if (applyEff) { - effValue = efficiency->GetBinContent(foundNchBin, foundPtBin); - } - if (applyFD) { - fdValue = feedDown->GetBinContent(foundNchBin, foundPtBin); - } - if ((effValue > 0.) && (fdValue > 0.)) { - nchMult += (std::pow(effValue, -1.) * fdValue); - } - } + loadCorrections(foundBC.timestamp()); + if (!(cfg.hEfficiency && cfg.hFeedDown)) + return; - if (!applyEff) - nchMult = static_cast(glbTracks); - if (applyEff && !correctNch) - nchMult = static_cast(glbTracks); - if (nchMult < minNchSel) { - return; - } + const int foundNchBin{cfg.hEfficiency->GetXaxis()->FindBin(glbTracks)}; - // Fill vectors for [pT] measurement - pTs.clear(); - vecFD.clear(); - vecEff.clear(); - for (const auto& track : tracks) { - // Track Selection - if (!track.isGlobalTrack()) { - continue; - } - if ((track.pt() < minPt) || (track.pt() > maxPtSpectra)) { - continue; - } + // Calculates the Corrected Nch + for (const auto& track : tracks) { + // Track Selection + if (!track.isGlobalTrack()) { + continue; + } + if ((track.pt() < minPt) || (track.pt() > maxPt)) { + continue; + } + if ((track.eta() < minEta) || (track.eta() > maxEta)) { + continue; + } + + const float pt{track.pt()}; + const int foundPtBin{cfg.hEfficiency->GetYaxis()->FindBin(pt)}; + const double effValue{cfg.hEfficiency->GetBinContent(foundNchBin, foundPtBin)}; + double fdValue{1.}; - float pt{track.pt()}; - int foundNchBin{efficiency->GetXaxis()->FindBin(glbTracks)}; - int foundPtBin{efficiency->GetYaxis()->FindBin(pt)}; - float effValue{1.}; - float fdValue{1.}; - if (applyEff) { - effValue = efficiency->GetBinContent(foundNchBin, foundPtBin); - fdValue = feedDown->GetBinContent(foundNchBin, foundPtBin); + if (applyFD) + fdValue = cfg.hFeedDown->GetBinContent(foundNchBin, foundPtBin); + + if ((effValue > 0.) && (fdValue > 0.)) { + nchMult += (std::pow(effValue, -1.) * fdValue); + } } - if (applyEff && !applyFD) { - fdValue = 1.0; + + if (applyEff && !correctNch) + nchMult = static_cast(glbTracks); + + // Fill vectors for [pT] measurement + for (const auto& track : tracks) { + // Track Selection + if (!track.isGlobalTrack()) { + continue; + } + if ((track.pt() < minPt) || (track.pt() > maxPtSpectra)) { + continue; + } + if ((track.eta() < minEta) || (track.eta() > maxEta)) { + continue; + } + + const float pt{track.pt()}; + const int foundPtBin{cfg.hEfficiency->GetYaxis()->FindBin(pt)}; + const double effValue{cfg.hEfficiency->GetBinContent(foundNchBin, foundPtBin)}; + double fdValue{1.}; + + if (applyFD) + fdValue = cfg.hFeedDown->GetBinContent(foundNchBin, foundPtBin); + + if ((effValue > 0.) && (fdValue > 0.)) { + pTs.emplace_back(pt); + vecEff.emplace_back(effValue); + vecFD.emplace_back(fdValue); + // To calculate event-averaged + registry.fill(HIST("NchVsZNVsPt"), nchMult, sumZNs, pt * (fdValue / effValue)); + } } - if ((effValue > 0.) && (fdValue > 0.)) { - pTs.emplace_back(pt); - vecEff.emplace_back(effValue); - vecFD.emplace_back(fdValue); + } else { + // Fill vectors for [pT] measurement + for (const auto& track : tracks) { + // Track Selection + if (!track.isGlobalTrack()) { + continue; + } + if ((track.pt() < minPt) || (track.pt() > maxPtSpectra)) { + continue; + } + if ((track.eta() < minEta) || (track.eta() > maxEta)) { + continue; + } + + pTs.emplace_back(track.pt()); + vecEff.emplace_back(1.); + vecFD.emplace_back(1.); + // To calculate event-averaged + registry.fill(HIST("NchVsZNVsPt"), nchMult, sumZNs, track.pt()); } - // To calculate event-averaged - registry.fill(HIST("NchVsZNVsPt"), nchMult, sumZNs, track.pt()); } double p1, p2, p3, p4, w1, w2, w3, w4; @@ -825,159 +898,45 @@ struct UccZdc { double threeParCorr{numThreeParCorr / denThreeParCorr}; // EbE four-particle pT correlation - double denFourParCorr{std::pow(w1, 4.) - 6. * w2 * std::pow(w1, 2.) + 3. * std::pow(w2, 2.) + 8 * w3 * w1 - 6. * w4}; - double numFourParCorr{std::pow(p1, 4.) - 6. * p2 * std::pow(p1, 2.) + 3. * std::pow(p2, 2.) + 8 * p3 * p1 - 6. * p4}; - double fourParCorr{numFourParCorr / denFourParCorr}; + // double denFourParCorr{std::pow(w1, 4.) - 6. * w2 * std::pow(w1, 2.) + 3. * std::pow(w2, 2.) + 8 * w3 * w1 - 6. * w4}; + // double numFourParCorr{std::pow(p1, 4.) - 6. * p2 * std::pow(p1, 2.) + 3. * std::pow(p2, 2.) + 8 * p3 * p1 - 6. * p4}; + // double fourParCorr{numFourParCorr / denFourParCorr}; + // One-dimensional distributions registry.fill(HIST("Nch"), nchMult); - registry.fill(HIST("ZNamp"), sumZNs); + registry.fill(HIST("NchUncorrected"), glbTracks); + + registry.fill(HIST("NchVsV0Aamp"), nchMult, normV0A); + registry.fill(HIST("NchVsT0Mamp"), nchMult, normT0M); registry.fill(HIST("NchVsZN"), nchMult, sumZNs); registry.fill(HIST("NchVsZP"), nchMult, sumZPs); - registry.fill(HIST("NITSTacksVsZN"), itsTracks, sumZNs); - registry.fill(HIST("NITSTacksVsZP"), itsTracks, sumZPs); - registry.fill(HIST("T0MVsZN"), normT0M, sumZNs); - registry.fill(HIST("T0MVsZP"), normT0M, sumZPs); - registry.fill(HIST("NchUncorrected"), glbTracks); + registry.fill(HIST("NchVsOneParCorr"), nchMult, oneParCorr, w1); + registry.fill(HIST("NchVsOneParCorrVsZN"), nchMult, sumZNs, oneParCorr, w1); registry.fill(HIST("NchVsTwoParCorrVsZN"), nchMult, sumZNs, twoParCorr, denTwoParCorr); registry.fill(HIST("NchVsThreeParCorrVsZN"), nchMult, sumZNs, threeParCorr, denThreeParCorr); - registry.fill(HIST("NchVsFourParCorrVsZN"), nchMult, sumZNs, fourParCorr, denFourParCorr); - } - PROCESS_SWITCH(UccZdc, processZdcCollAss, "Process ZDC W/Coll Ass.", true); - void processEventSampling(o2::aod::ColEvSels::iterator const& collision, o2::aod::BCsRun3 const& /*bcs*/, aod::Zdcs const& /*zdcs*/, aod::FV0As const& /*fv0as*/, aod::FT0s const& /*ft0s*/, TheFilteredTracks const& tracks) - { - if (!isEventSelected(collision)) { - return; - } - - const auto& foundBC = collision.foundBC_as(); + registry.fill(HIST("OneParCorrVsT0M"), normT0M, oneParCorr, w1); + registry.fill(HIST("TwoParCorrVsT0M"), normT0M, twoParCorr, denTwoParCorr); + registry.fill(HIST("ThreeParCorrVsT0M"), normT0M, threeParCorr, denThreeParCorr); - // has ZDC? - if (!foundBC.has_zdc()) { - return; - } - registry.fill(HIST("hEventCounter"), EvCutLabel::Zdc); + registry.fill(HIST("OneParCorrVsV0A"), normV0A, oneParCorr, w1); + registry.fill(HIST("TwoParCorrVsV0A"), normV0A, twoParCorr, denTwoParCorr); + registry.fill(HIST("ThreeParCorrVsV0A"), normV0A, threeParCorr, denThreeParCorr); - float aT0A = 0., aT0C = 0.; - if (foundBC.has_ft0()) { - for (const auto& amplitude : foundBC.ft0().amplitudeA()) { - aT0A += amplitude; - } - for (const auto& amplitude : foundBC.ft0().amplitudeC()) { - aT0C += amplitude; - } - } else { - return; - } - - registry.fill(HIST("hEventCounter"), EvCutLabel::TZero); - - const double normT0M{(aT0A + aT0C) / 100.}; - float znA{foundBC.zdc().amplitudeZNA()}; - float znC{foundBC.zdc().amplitudeZNC()}; - float aZEM1{foundBC.zdc().amplitudeZEM1()}; - float aZEM2{foundBC.zdc().amplitudeZEM2()}; - float tZNA{foundBC.zdc().timeZNA()}; - float tZNC{foundBC.zdc().timeZNC()}; - float tZPA{foundBC.zdc().timeZPA()}; - float tZPC{foundBC.zdc().timeZPC()}; - float tZDCdif{tZNC + tZPC - tZNA - tZPA}; - float tZDCsum{tZNC + tZPC + tZNA + tZPA}; - znA /= kCollEnergy; - znC /= kCollEnergy; - float sumZNs{znA + znC}; - float sumZEMs{aZEM1 + aZEM2}; - - // TDC cut - if (isTDCcut) { - if (std::sqrt(std::pow(tZDCdif, 2.) + std::pow(tZDCsum, 2.)) > tdcCut) { - return; - } - registry.fill(HIST("hEventCounter"), EvCutLabel::Tdc); - } - - // ZEM cut - if (isZEMcut) { - if (sumZEMs < zemCut) { - return; - } - registry.fill(HIST("hEventCounter"), EvCutLabel::Zem); - } - - registry.fill(HIST("zPos"), collision.posZ()); - registry.fill(HIST("T0Ccent"), collision.centFT0C()); - - // Nch-based selection - int glbTracks = 0; - for (const auto& track : tracks) { - // Track Selection - // if (track.hasITS()) { itsTracks++; } - if (!track.isGlobalTrack()) { - continue; - } - if ((track.pt() < minPt) || (track.pt() > maxPt)) { - continue; - } - registry.fill(HIST("ZposVsEta"), collision.posZ(), track.eta()); - registry.fill(HIST("EtaVsPhi"), track.eta(), track.phi()); - registry.fill(HIST("sigma1Pt"), track.pt(), track.sigma1Pt()); - registry.fill(HIST("dcaXYvspT"), track.dcaXY(), track.pt()); - glbTracks++; - } - - bool skipEvent{false}; - if (useMidRapNchSel) { - auto hMeanNch = ccdb->getForTimeStamp(paTHmeanNch.value, foundBC.timestamp()); - auto hSigmaNch = ccdb->getForTimeStamp(paTHsigmaNch.value, foundBC.timestamp()); - if (!hMeanNch) { - LOGF(info, "hMeanNch NOT LOADED!"); - return; - } - if (!hSigmaNch) { - LOGF(info, "hSigmaNch NOT LOADED!"); - return; - } - - const int binT0M{hMeanNch->FindBin(normT0M)}; - const double meanNch{hMeanNch->GetBinContent(binT0M)}; - const double sigmaNch{hSigmaNch->GetBinContent(binT0M)}; - const double nSigmaSelection{nSigmaNchCut * sigmaNch}; - const double diffMeanNch{meanNch - glbTracks}; - - if (!(std::abs(diffMeanNch) < nSigmaSelection)) { - registry.fill(HIST("ExcludedEvtVsFT0M"), normT0M); - registry.fill(HIST("ExcludedEvtVsNch"), glbTracks); - } else { - skipEvent = true; - } - } - - // Skip event based on number of Nch sigmas - if (!skipEvent) { - return; - } - - auto efficiency = ccdb->getForTimeStamp(paTHEff.value, foundBC.timestamp()); - if (!efficiency) { - return; - } - - auto feedDown = ccdb->getForTimeStamp(paTHFD.value, foundBC.timestamp()); - if (!feedDown) { - return; - } - - //--------------------------------------------------- - - uint64_t timeStamp{foundBC.timestamp()}; + const uint64_t timeStamp{foundBC.timestamp()}; + eventSampling(tracks, normV0A, normT0M, sumZNs, timeStamp); + } + PROCESS_SWITCH(UccZdc, processZdcCollAss, "Process ZDC W/Coll Ass.", true); + template + void eventSampling(const T& tracks, const U& normV0A, const U& normT0M, const U& sumZNs, const V& timeStamp) + { TRandom3 rndGen(timeStamp); std::vector vPoisson; - for (int replica = 0; replica < kSizeBootStrapEnsemble; ++replica) { + for (int replica = 0; replica < kSizeBootStrapEnsemble; ++replica) vPoisson.emplace_back(rndGen.Poisson(1.)); - } for (int replica = 0; replica < kSizeBootStrapEnsemble; ++replica) { @@ -986,11 +945,12 @@ struct UccZdc { for (uint64_t evtRep = 0; evtRep < vPoisson.at(replica); ++evtRep) { double nchMult{0.}; + int glbTracks{0}; std::vector pTs; std::vector vecFD; std::vector vecEff; - // Calculates the Nch multiplicity + // Calculates the uncorrected Nch multiplicity for (const auto& track : tracks) { // Track Selection if (!track.isGlobalTrack()) { @@ -999,20 +959,41 @@ struct UccZdc { if ((track.pt() < minPt) || (track.pt() > maxPt)) { continue; } - - float pt{track.pt()}; - int foundNchBin{efficiency->GetXaxis()->FindBin(glbTracks)}; - int foundPtBin{efficiency->GetYaxis()->FindBin(pt)}; - float effValue{1.}; - float fdValue{1.}; - if (applyEff) { - effValue = efficiency->GetBinContent(foundNchBin, foundPtBin); - } - if (applyFD) { - fdValue = feedDown->GetBinContent(foundNchBin, foundPtBin); + if ((track.eta() < minEta) || (track.eta() > maxEta)) { + continue; } - if ((effValue > 0.) && (fdValue > 0.)) { - nchMult += (std::pow(effValue, -1.) * fdValue); + glbTracks++; + } + + if (glbTracks < minNchSel) { + continue; + } + + // Calculates the Nch multiplicity if corrections are loaded + if (cfg.correctionsLoaded) { + const int foundNchBin{cfg.hEfficiency->GetXaxis()->FindBin(glbTracks)}; + for (const auto& track : tracks) { + // Track Selection + if (!track.isGlobalTrack()) { + continue; + } + if ((track.pt() < minPt) || (track.pt() > maxPt)) { + continue; + } + if ((track.eta() < minEta) || (track.eta() > maxEta)) { + continue; + } + + float pt{track.pt()}; + double fdValue{1.}; + int foundPtBin{cfg.hEfficiency->GetYaxis()->FindBin(pt)}; + double effValue{cfg.hEfficiency->GetBinContent(foundNchBin, foundPtBin)}; + + if (applyFD) + fdValue = cfg.hFeedDown->GetBinContent(foundNchBin, foundPtBin); + if ((effValue > 0.) && (fdValue > 0.)) { + nchMult += (std::pow(effValue, -1.) * fdValue); + } } } @@ -1020,39 +1001,55 @@ struct UccZdc { nchMult = static_cast(glbTracks); if (applyEff && !correctNch) nchMult = static_cast(glbTracks); - if (nchMult < minNchSel) { - return; - } // Fill vectors for [pT] measurement - pTs.clear(); - vecFD.clear(); - vecEff.clear(); - for (const auto& track : tracks) { - // Track Selection - if (!track.isGlobalTrack()) { - continue; - } - if ((track.pt() < minPt) || (track.pt() > maxPtSpectra)) { - continue; - } - - float pt{track.pt()}; - int foundNchBin{efficiency->GetXaxis()->FindBin(glbTracks)}; - int foundPtBin{efficiency->GetYaxis()->FindBin(pt)}; - float effValue{1.}; - float fdValue{1.}; - if (applyEff) { - effValue = efficiency->GetBinContent(foundNchBin, foundPtBin); - fdValue = feedDown->GetBinContent(foundNchBin, foundPtBin); + if (cfg.correctionsLoaded) { + const int foundNchBin{cfg.hEfficiency->GetXaxis()->FindBin(glbTracks)}; + // Fill vectors for [pT] measurement + for (const auto& track : tracks) { + // Track Selection + if (!track.isGlobalTrack()) { + continue; + } + if ((track.pt() < minPt) || (track.pt() > maxPtSpectra)) { + continue; + } + if ((track.eta() < minEta) || (track.eta() > maxEta)) { + continue; + } + + float pt{track.pt()}; + double fdValue{1.}; + int foundPtBin{cfg.hEfficiency->GetYaxis()->FindBin(pt)}; + double effValue{cfg.hEfficiency->GetBinContent(foundNchBin, foundPtBin)}; + + if (applyFD) + fdValue = cfg.hFeedDown->GetBinContent(foundNchBin, foundPtBin); + + if ((effValue > 0.) && (fdValue > 0.)) { + pTs.emplace_back(pt); + vecEff.emplace_back(effValue); + vecFD.emplace_back(fdValue); + // To calculate event-averaged + registry.fill(HIST("NchVsZNVsPt"), nchMult, sumZNs, pt * (fdValue / effValue)); + } } - if (applyEff && !applyFD) { - fdValue = 1.0; - } - if ((effValue > 0.) && (fdValue > 0.)) { - pTs.emplace_back(pt); - vecEff.emplace_back(effValue); - vecFD.emplace_back(fdValue); + } else { + for (const auto& track : tracks) { + // Track Selection + if (!track.isGlobalTrack()) { + continue; + } + if ((track.pt() < minPt) || (track.pt() > maxPtSpectra)) { + continue; + } + + pTs.emplace_back(track.pt()); + vecEff.emplace_back(1.); + vecFD.emplace_back(1.); + + // To calculate event-averaged + registry.fill(HIST("NchVsZNVsPt"), nchMult, sumZNs, track.pt()); } } @@ -1061,45 +1058,39 @@ struct UccZdc { getPTpowers(pTs, vecEff, vecFD, p1, w1, p2, w2, p3, w3, p4, w4); // EbE one-particle pT correlation - double oneParCorr{p1 / w1}; + const double oneParCorr{p1 / w1}; // EbE two-particle pT correlation - double denTwoParCorr{std::pow(w1, 2.) - w2}; - double numTwoParCorr{std::pow(p1, 2.) - p2}; - double twoParCorr{numTwoParCorr / denTwoParCorr}; + const double denTwoParCorr{std::pow(w1, 2.) - w2}; + const double numTwoParCorr{std::pow(p1, 2.) - p2}; + const double twoParCorr{numTwoParCorr / denTwoParCorr}; // EbE three-particle pT correlation - double denThreeParCorr{std::pow(w1, 3.) - 3. * w2 * w1 + 2. * w3}; - double numThreeParCorr{std::pow(p1, 3.) - 3. * p2 * p1 + 2. * p3}; - double threeParCorr{numThreeParCorr / denThreeParCorr}; - - // EbE four-particle pT correlation - double denFourParCorr{std::pow(w1, 4.) - 6. * w2 * std::pow(w1, 2.) + 3. * std::pow(w2, 2.) + 8 * w3 * w1 - 6. * w4}; - double numFourParCorr{std::pow(p1, 4.) - 6. * p2 * std::pow(p1, 2.) + 3. * std::pow(p2, 2.) + 8 * p3 * p1 - 6. * p4}; - double fourParCorr{numFourParCorr / denFourParCorr}; + const double denThreeParCorr{std::pow(w1, 3.) - 3. * w2 * w1 + 2. * w3}; + const double numThreeParCorr{std::pow(p1, 3.) - 3. * p2 * p1 + 2. * p3}; + const double threeParCorr{numThreeParCorr / denThreeParCorr}; hNch[replica]->Fill(nchMult); - pNchVsOneParCorr[replica]->Fill(nchMult, oneParCorr, w1); pNchVsOneParCorrVsZN[replica]->Fill(nchMult, sumZNs, oneParCorr, w1); pNchVsTwoParCorrVsZN[replica]->Fill(nchMult, sumZNs, twoParCorr, denTwoParCorr); pNchVsThreeParCorrVsZN[replica]->Fill(nchMult, sumZNs, threeParCorr, denThreeParCorr); - pNchVsFourParCorrVsZN[replica]->Fill(nchMult, sumZNs, fourParCorr, denFourParCorr); - } - } + + pOneParCorrVsV0A[replica]->Fill(normV0A, oneParCorr, w1); + pTwoParCorrVsV0A[replica]->Fill(normV0A, twoParCorr, denTwoParCorr); + pThreeParCorrVsV0A[replica]->Fill(normV0A, threeParCorr, denThreeParCorr); + + pOneParCorrVsT0M[replica]->Fill(normT0M, oneParCorr, w1); + pTwoParCorrVsT0M[replica]->Fill(normT0M, twoParCorr, denTwoParCorr); + pThreeParCorrVsT0M[replica]->Fill(normT0M, threeParCorr, denThreeParCorr); + } // event per replica + } // replica's loop } - PROCESS_SWITCH(UccZdc, processEventSampling, "Process Event Sampling 4 Bootstrap", true); - // Preslice perMCCollision = aod::mcparticle::mcCollisionId; Preslice perCollision = aod::track::collisionId; Service pdg; - TRandom* randPointer = new TRandom(); void processMCclosure(aod::McCollisions::iterator const& mccollision, soa::SmallGroups const& collisions, o2::aod::BCsRun3 const& /*bcs*/, aod::FT0s const& /*ft0s*/, aod::McParticles const& mcParticles, TheFilteredSimTracks const& simTracks) { - float rndNum = randPointer->Uniform(0.0, 1.0); - registry.fill(HIST("RandomNumber"), rndNum); - for (const auto& collision : collisions) { - // Event selection if (!isEventSelected(collision)) { continue; @@ -1117,6 +1108,11 @@ struct UccZdc { const auto& foundBC = collision.foundBC_as(); + uint64_t timeStamp{foundBC.timestamp()}; + TRandom3 rndGen(timeStamp); + const double rndNum{rndGen.Uniform(0.0, 1.0)}; + registry.fill(HIST("RandomNumber"), rndNum); + float aT0A = 0., aT0C = 0.; if (foundBC.has_ft0()) { for (const auto& amplitude : foundBC.ft0().amplitudeA()) { @@ -1131,7 +1127,7 @@ struct UccZdc { double nchRaw{0.}; double nchMult{0.}; - double nchMC{0}; + double nchMC{0.}; double normT0M{0.}; normT0M = (aT0A + aT0C) / 100.; @@ -1148,8 +1144,11 @@ struct UccZdc { const auto& cent{collision.centFT0C()}; registry.fill(HIST("T0Ccent"), cent); + const auto& groupedTracks{simTracks.sliceBy(perCollision, collision.globalIndex())}; + // Half of the statistics for MC closure if (rndNum >= kZero && rndNum < evtFracMCcl) { + registry.fill(HIST("EvtsDivided"), 0); // To use run-by-run efficiency @@ -1167,8 +1166,6 @@ struct UccZdc { std::vector vecFD; std::vector vecEff; - const auto& groupedTracks{simTracks.sliceBy(perCollision, collision.globalIndex())}; - // Calculates the event's Nch to evaluate the efficiency for (const auto& track : groupedTracks) { // Track Selection @@ -1328,10 +1325,191 @@ struct UccZdc { registry.fill(HIST("NchvsTwoParCorrGen"), nchMC, twoParCorrMC, denTwoParCorrMC); registry.fill(HIST("NchvsThreeParCorrGen"), nchMC, threeParCorrMC, denThreeParCorrMC); registry.fill(HIST("NchvsFourParCorrGen"), nchMC, fourParCorrMC, denFourParCorrMC); + + //------------------ Poisson sampling + std::vector vPoisson; + for (int replica = 0; replica < kSizeBootStrapEnsemble; ++replica) { + vPoisson.emplace_back(rndGen.Poisson(1.)); + } + + for (int replica = 0; replica < kSizeBootStrapEnsemble; ++replica) { + hPoissonMC[replica]->Fill(vPoisson.at(replica)); + + for (uint64_t evtRep = 0; evtRep < vPoisson.at(replica); ++evtRep) { + + double nchRaw{0.0}; + double nchMult{0.0}; + std::vector pTs; + std::vector vecFD; + std::vector vecEff; + + // const auto& groupedTracks{simTracks.sliceBy(perCollision, collision.globalIndex())}; + + // Calculates the event's Nch to evaluate the efficiency + for (const auto& track : groupedTracks) { + // Track Selection + if (track.eta() < minEta || track.eta() > maxEta) { + continue; + } + if (track.pt() < minPt || track.pt() > maxPt) { + continue; + } + if (!track.isGlobalTrack()) { + continue; + } + nchRaw++; + } + + // Calculates the event weight, W_k + const int foundNchBin{efficiency->GetXaxis()->FindBin(nchRaw)}; + + for (const auto& track : groupedTracks) { + // Track Selection + if (track.eta() < minEta || track.eta() > maxEta) { + continue; + } + if (track.pt() < minPt || track.pt() > maxPt) { + continue; + } + if (!track.isGlobalTrack()) { + continue; + } + if (!track.has_mcParticle()) { + continue; + } + const auto& particle{track.mcParticle()}; + + auto charge{0.}; + // Get the MC particle + auto* pdgParticle = pdg->GetParticle(particle.pdgCode()); + if (pdgParticle != nullptr) { + charge = pdgParticle->Charge(); + } else { + continue; + } + + // Is it a charged particle? + if (std::abs(charge) < kMinCharge) { + continue; + } + // Is it a primary particle? + // if (!particle.isPhysicalPrimary()) { continue; } + + const double pt{static_cast(track.pt())}; + const int foundPtBin{efficiency->GetYaxis()->FindBin(pt)}; + double effValue{1.}; + double fdValue{1.}; + + if (applyEff) { + effValue = efficiency->GetBinContent(foundNchBin, foundPtBin); + fdValue = feedDown->GetBinContent(foundNchBin, foundPtBin); + } + if ((effValue > 0.) && (fdValue > 0.)) { + pTs.emplace_back(pt); + vecEff.emplace_back(effValue); + vecFD.emplace_back(fdValue); + nchMult += (std::pow(effValue, -1.0) * fdValue); + } + } + + if (nchMult < minNchSel) { + return; + } + + double p1, p2, p3, p4, w1, w2, w3, w4; + p1 = p2 = p3 = p4 = w1 = w2 = w3 = w4 = 0.0; + getPTpowers(pTs, vecEff, vecFD, p1, w1, p2, w2, p3, w3, p4, w4); + + const double denTwoParCorr{std::pow(w1, 2.) - w2}; + const double numTwoParCorr{std::pow(p1, 2.) - p2}; + const double denThreeParCorr{std::pow(w1, 3.) - 3. * w2 * w1 + 2. * w3}; + const double numThreeParCorr{std::pow(p1, 3.) - 3. * p2 * p1 + 2. * p3}; + const double denFourParCorr{std::pow(w1, 4.) - 6. * w2 * std::pow(w1, 2.) + 3. * std::pow(w2, 2.) + 8 * w3 * w1 - 6. * w4}; + const double numFourParCorr{std::pow(p1, 4.) - 6. * p2 * std::pow(p1, 2.) + 3. * std::pow(p2, 2.) + 8 * p3 * p1 - 6. * p4}; + + const double oneParCorr{p1 / w1}; + const double twoParCorr{numTwoParCorr / denTwoParCorr}; + const double threeParCorr{numThreeParCorr / denThreeParCorr}; + const double fourParCorr{numFourParCorr / denFourParCorr}; + + hNchRec[replica]->Fill(nchMult); + pNchvsOneParCorrRec[replica]->Fill(nchMult, oneParCorr, w1); + pNchvsTwoParCorrRec[replica]->Fill(nchMult, twoParCorr, denTwoParCorr); + pNchvsThreeParCorrRec[replica]->Fill(nchMult, threeParCorr, denThreeParCorr); + pNchvsFourParCorrRec[replica]->Fill(nchMult, fourParCorr, denFourParCorr); + + //--------------------------- Generated MC --------------------------- + double nchMC{0.0}; + std::vector pTsMC; + std::vector vecFullEff; + std::vector vecFDEqualOne; + + // Calculates the event weight, W_k + for (const auto& particle : mcParticles) { + if (particle.eta() < minEta || particle.eta() > maxEta) { + continue; + } + if (particle.pt() < minPt || particle.pt() > maxPt) { + continue; + } + + auto charge{0.}; + // Get the MC particle + auto* pdgParticle = pdg->GetParticle(particle.pdgCode()); + if (pdgParticle != nullptr) { + charge = pdgParticle->Charge(); + } else { + continue; + } + + // Is it a charged particle? + if (std::abs(charge) < kMinCharge) { + continue; + } + // Is it a primary particle? + if (!particle.isPhysicalPrimary()) { + continue; + } + + float pt{particle.pt()}; + pTsMC.emplace_back(pt); + vecFullEff.emplace_back(1.); + vecFDEqualOne.emplace_back(1.); + nchMC++; + } + + if (nchMC < minNchSel) { + continue; + } + // printf("nchMult = %f | nchMC = %f | nchMult/nchMc = %f\n",nchMult,nchMC,nchMult/nchMC); + + double p1MC, p2MC, p3MC, p4MC, w1MC, w2MC, w3MC, w4MC; + p1MC = p2MC = p3MC = p4MC = w1MC = w2MC = w3MC = w4MC = 0.0; + getPTpowers(pTsMC, vecFullEff, vecFDEqualOne, p1MC, w1MC, p2MC, w2MC, p3MC, w3MC, p4MC, w4MC); + + const double denTwoParCorrMC{std::pow(w1MC, 2.) - w2MC}; + const double numTwoParCorrMC{std::pow(p1MC, 2.) - p2MC}; + const double denThreeParCorrMC{std::pow(w1MC, 3.) - 3. * w2MC * w1MC + 2. * w3MC}; + const double numThreeParCorrMC{std::pow(p1MC, 3.) - 3. * p2MC * p1MC + 2. * p3MC}; + const double denFourParCorrMC{std::pow(w1MC, 4.) - 6. * w2MC * std::pow(w1MC, 2.) + 3. * std::pow(w2MC, 2.) + 8 * w3MC * w1MC - 6. * w4MC}; + const double numFourParCorrMC{std::pow(p1MC, 4.) - 6. * p2MC * std::pow(p1MC, 2.) + 3. * std::pow(p2MC, 2.) + 8 * p3MC * p1MC - 6. * p4MC}; + + const double oneParCorrMC{p1MC / w1MC}; + const double twoParCorrMC{numTwoParCorrMC / denTwoParCorrMC}; + const double threeParCorrMC{numThreeParCorrMC / denThreeParCorrMC}; + const double fourParCorrMC{numFourParCorrMC / denFourParCorrMC}; + + hNchGen[replica]->Fill(nchMC); + pNchvsOneParCorrGen[replica]->Fill(nchMC, oneParCorrMC, w1MC); + pNchvsTwoParCorrGen[replica]->Fill(nchMC, twoParCorrMC, w1MC); + pNchvsThreeParCorrGen[replica]->Fill(nchMC, threeParCorrMC, w1MC); + pNchvsFourParCorrGen[replica]->Fill(nchMC, fourParCorrMC, w1MC); + } // events per replica + } // replica's loop } else { // Correction with the remaining half of the sample registry.fill(HIST("EvtsDivided"), 1); //----- MC reconstructed -----// - const auto& groupedTracks{simTracks.sliceBy(perCollision, collision.globalIndex())}; + // const auto& groupedTracks{simTracks.sliceBy(perCollision, collision.globalIndex())}; for (const auto& track : groupedTracks) { // Track Selection if (track.eta() < minEta || track.eta() > maxEta) { @@ -1468,6 +1646,44 @@ struct UccZdc { wFour += std::pow(wEighti, 4.); } } + + void loadCorrections(uint64_t timeStamp) + { + // if (cfg.correctionsLoaded) return; + + if (paTHEff.value.empty() == false) { + cfg.hEfficiency = ccdb->getForTimeStamp(paTHEff, timeStamp); + if (cfg.hEfficiency == nullptr) { + LOGF(fatal, "Could not load efficiency histogram from %s", paTHEff.value.c_str()); + } + } + + if (paTHFD.value.empty() == false) { + cfg.hFeedDown = ccdb->getForTimeStamp(paTHFD, timeStamp); + if (cfg.hFeedDown == nullptr) { + LOGF(fatal, "Could not load feed down histogram from %s", paTHFD.value.c_str()); + } + } + cfg.correctionsLoaded = true; + } + + void loadNchCalibrations(uint64_t timeStamp) + { + if (paTHmeanNch.value.empty() == false) { + cfgNch.hMeanNch = ccdb->getForTimeStamp(paTHmeanNch, timeStamp); + if (cfgNch.hMeanNch == nullptr) { + LOGF(fatal, "Could not load hMeanNch histogram from %s", paTHmeanNch.value.c_str()); + } + } + + if (paTHsigmaNch.value.empty() == false) { + cfgNch.hSigmaNch = ccdb->getForTimeStamp(paTHsigmaNch, timeStamp); + if (cfgNch.hSigmaNch == nullptr) { + LOGF(fatal, "Could not load hSigmaNch histogram from %s", paTHsigmaNch.value.c_str()); + } + } + cfgNch.calibrationsLoaded = true; + } }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 6a4a27edec6e292a97e3aca8d3c011e35e56e542 Mon Sep 17 00:00:00 2001 From: Dukhishyam Mallick <160018357+dmallick2@users.noreply.github.com> Date: Thu, 24 Jul 2025 11:07:47 +0200 Subject: [PATCH 036/345] =?UTF-8?q?[PWGDQ]=20=E2=80=9CAdd=20histograms=20f?= =?UTF-8?q?or=20promptvsnonprompt=20jpsi=20polarization=E2=80=9D=20(#12185?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PWGDQ/Core/HistogramsLibrary.cxx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/PWGDQ/Core/HistogramsLibrary.cxx b/PWGDQ/Core/HistogramsLibrary.cxx index 3f8bb8f2064..b9618a4c64e 100644 --- a/PWGDQ/Core/HistogramsLibrary.cxx +++ b/PWGDQ/Core/HistogramsLibrary.cxx @@ -1075,6 +1075,22 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h hm->AddHistogram(histClass, "CosPointingAngle", "", false, 200, -1.0, 1.0, VarManager::kCosPointingAngle); hm->AddHistogram(histClass, "VtxingChi2PCA", "", false, 100, 0.0, 10.0, VarManager::kVertexingChi2PCA); } + if (subGroupStr.Contains("tauxy-midy-pol-he")) { + int varspTHE[4] = {VarManager::kMass, VarManager::kPt, VarManager::kCosThetaHE, VarManager::kVertexingTauxyProjectedPoleJPsiMass}; + int binspT[4] = {50, 10, 20, 1000}; + double xminpT[4] = {2., 0., -1., -0.03}; + double xmaxpT[4] = {4., 20., 1., 0.03}; + hm->AddHistogram(histClass, "Tauxy_Mass_Pt_CosthetaHE", "", 4, varspTHE, binspT, xminpT, xmaxpT, 0, -1, kFALSE); + } + + if (subGroupStr.Contains("tauxy-midy-pol-rand")) { + int varspTRand[4] = {VarManager::kMass, VarManager::kPt, VarManager::kCosThetaRM, VarManager::kVertexingTauxyProjectedPoleJPsiMass}; + + int binspT[4] = {50, 10, 20, 1000}; + double xminpT[4] = {2., 0., -1., -0.03}; + double xmaxpT[4] = {4., 20., 1., 0.03}; + hm->AddHistogram(histClass, "Tauxy_Mass_Pt_CosthetaRand", "", 4, varspTRand, binspT, xminpT, xmaxpT, 0, -1, kFALSE); + } if (subGroupStr.Contains("kalman-filter")) { hm->AddHistogram(histClass, "LxyErr", "", false, 100, 0.0, 10.0, VarManager::kVertexingLxyErr); From dc281de71da3c963c7d6179e49030a2d88c530e8 Mon Sep 17 00:00:00 2001 From: altsybee Date: Thu, 24 Jul 2025 11:42:40 +0200 Subject: [PATCH 037/345] [Common,DPG] automatic extraction of orbitsPerTF from ccdb by LPMProductionTag in bc- and event-selection (#12202) --- Common/TableProducer/eventSelection.cxx | 18 ++++++---- .../TableProducer/eventSelectionService.cxx | 4 +-- Common/Tools/EventSelectionTools.h | 21 ++++++----- DPG/Tasks/AOTEvent/eventSelectionQa.cxx | 36 +++++++++++++++---- 4 files changed, 57 insertions(+), 22 deletions(-) diff --git a/Common/TableProducer/eventSelection.cxx b/Common/TableProducer/eventSelection.cxx index 5ead8e80493..b517bb90010 100644 --- a/Common/TableProducer/eventSelection.cxx +++ b/Common/TableProducer/eventSelection.cxx @@ -84,6 +84,8 @@ struct BcSelectionTask { int mITSROFrameEndBorderMargin = 20; // default value int mTimeFrameStartBorderMargin = 300; // default value int mTimeFrameEndBorderMargin = 4000; // default value + std::string strLPMProductionTag = ""; // MC production tag to be retrieved from AO2D metadata + TriggerAliases* aliases = nullptr; EventSelectionParams* par = nullptr; std::map* mapRCT = nullptr; @@ -99,6 +101,8 @@ struct BcSelectionTask { ccdb->setURL("http://alice-ccdb.cern.ch"); ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); + strLPMProductionTag = metadataInfo.get("LPMProductionTag"); // to extract info from ccdb by the tag + histos.add("hCounterInvalidBCTimestamp", "", kTH1D, {{1, 0., 1.}}); } @@ -256,7 +260,7 @@ struct BcSelectionTask { // duration of TF in bcs nBCsPerTF = 32; // hard-coded for Run3 MC (no info from ccdb at the moment) } else { - auto runInfo = o2::parameters::AggregatedRunInfo::buildAggregatedRunInfo(o2::ccdb::BasicCCDBManager::instance(), run); + auto runInfo = o2::parameters::AggregatedRunInfo::buildAggregatedRunInfo(o2::ccdb::BasicCCDBManager::instance(), run, strLPMProductionTag); // SOR and EOR timestamps sorTimestamp = runInfo.sor; eorTimestamp = runInfo.eor; @@ -511,10 +515,11 @@ struct EventSelectionTask { int lastRun = -1; // last run number (needed to access ccdb only if run!=lastRun) std::bitset bcPatternB; // bc pattern of colliding bunches - int64_t bcSOR = -1; // global bc of the start of the first orbit - int64_t nBCsPerTF = -1; // duration of TF in bcs, should be 128*3564 or 32*3564 - int rofOffset = -1; // ITS ROF offset, in bc - int rofLength = -1; // ITS ROF length, in bc + int64_t bcSOR = -1; // global bc of the start of the first orbit + int64_t nBCsPerTF = -1; // duration of TF in bcs, should be 128*3564 or 32*3564 + int rofOffset = -1; // ITS ROF offset, in bc + int rofLength = -1; // ITS ROF length, in bc + std::string strLPMProductionTag = ""; // MC production tag to be retrieved from AO2D metadata int32_t findClosest(int64_t globalBC, std::map& bcs) { @@ -580,6 +585,7 @@ struct EventSelectionTask { } } } + strLPMProductionTag = metadataInfo.get("LPMProductionTag"); // to extract info from ccdb by the tag ccdb->setURL("http://alice-ccdb.cern.ch"); ccdb->setCaching(true); @@ -678,7 +684,7 @@ struct EventSelectionTask { int run3min = 500000; if (run != lastRun && run >= run3min) { lastRun = run; - auto runInfo = o2::parameters::AggregatedRunInfo::buildAggregatedRunInfo(o2::ccdb::BasicCCDBManager::instance(), run); + auto runInfo = o2::parameters::AggregatedRunInfo::buildAggregatedRunInfo(o2::ccdb::BasicCCDBManager::instance(), run, strLPMProductionTag); // first bc of the first orbit bcSOR = runInfo.orbitSOR * nBCsPerOrbit; // duration of TF in bcs diff --git a/Common/TableProducer/eventSelectionService.cxx b/Common/TableProducer/eventSelectionService.cxx index 54175683abc..fd713773c86 100644 --- a/Common/TableProducer/eventSelectionService.cxx +++ b/Common/TableProducer/eventSelectionService.cxx @@ -91,7 +91,7 @@ struct eventselectionRun2 { // task-specific timestampMod.init(timestampConfigurables, metadataInfo); - bcselmodule.init(context, bcselOpts, histos); + bcselmodule.init(context, bcselOpts, histos, metadataInfo); evselmodule.init(context, evselOpts, histos, metadataInfo); } @@ -154,7 +154,7 @@ struct eventselectionRun3 { // task-specific timestampMod.init(timestampConfigurables, metadataInfo); - bcselmodule.init(context, bcselOpts, histos); + bcselmodule.init(context, bcselOpts, histos, metadataInfo); evselmodule.init(context, evselOpts, histos, metadataInfo); lumimodule.init(context, lumiOpts, histos); } diff --git a/Common/Tools/EventSelectionTools.h b/Common/Tools/EventSelectionTools.h index 8b7ab1e4dfd..d32cc2dcbcc 100644 --- a/Common/Tools/EventSelectionTools.h +++ b/Common/Tools/EventSelectionTools.h @@ -138,6 +138,8 @@ class BcSelectionModule int mITSROFrameEndBorderMargin = 20; // default value int mTimeFrameStartBorderMargin = 300; // default value int mTimeFrameEndBorderMargin = 4000; // default value + std::string strLPMProductionTag = ""; // MC production tag to be retrieved from AO2D metadata + TriggerAliases* aliases = nullptr; EventSelectionParams* par = nullptr; std::map* mapRCT = nullptr; @@ -148,8 +150,8 @@ class BcSelectionModule bool isGoodITSLayer0123 = true; // default value bool isGoodITSLayersAll = true; // default value - template - void init(TContext& context, TBcSelOpts const& external_bcselopts, THistoRegistry& histos) + template + void init(TContext& context, TBcSelOpts const& external_bcselopts, THistoRegistry& histos, TMetadataInfo const& metadataInfo) { // read in configurations from the task where it's used bcselOpts = external_bcselopts; @@ -172,6 +174,7 @@ class BcSelectionModule return; } } + strLPMProductionTag = metadataInfo.get("LPMProductionTag"); // to extract info from ccdb by the tag // add counter histos.add("bcselection/hCounterInvalidBCTimestamp", "", o2::framework::kTH1D, {{1, 0., 1.}}); @@ -199,7 +202,7 @@ class BcSelectionModule // duration of TF in bcs nBCsPerTF = 32; // hard-coded for Run3 MC (no info from ccdb at the moment) } else { - auto runInfo = o2::parameters::AggregatedRunInfo::buildAggregatedRunInfo(o2::ccdb::BasicCCDBManager::instance(), run); + auto runInfo = o2::parameters::AggregatedRunInfo::buildAggregatedRunInfo(o2::ccdb::BasicCCDBManager::instance(), run, strLPMProductionTag); // SOR and EOR timestamps sorTimestamp = runInfo.sor; eorTimestamp = runInfo.eor; @@ -600,10 +603,11 @@ class EventSelectionModule int lastRun = -1; // last run number (needed to access ccdb only if run!=lastRun) std::bitset bcPatternB; // bc pattern of colliding bunches - int64_t bcSOR = -1; // global bc of the start of the first orbit - int64_t nBCsPerTF = -1; // duration of TF in bcs, should be 128*3564 or 32*3564 - int rofOffset = -1; // ITS ROF offset, in bc - int rofLength = -1; // ITS ROF length, in bc + int64_t bcSOR = -1; // global bc of the start of the first orbit + int64_t nBCsPerTF = -1; // duration of TF in bcs, should be 128*3564 or 32*3564 + int rofOffset = -1; // ITS ROF offset, in bc + int rofLength = -1; // ITS ROF length, in bc + std::string strLPMProductionTag = ""; // MC production tag to be retrieved from AO2D metadata int32_t findClosest(int64_t globalBC, std::map& bcs) { @@ -687,6 +691,7 @@ class EventSelectionModule } } } + strLPMProductionTag = metadataInfo.get("LPMProductionTag"); // to extract info from ccdb by the tag histos.add("eventselection/hColCounterAll", "", framework::kTH1D, {{1, 0., 1.}}); histos.add("eventselection/hColCounterTVX", "", framework::kTH1D, {{1, 0., 1.}}); @@ -701,7 +706,7 @@ class EventSelectionModule // extract bc pattern from CCDB for data or anchored MC only if (run != lastRun && run >= run3min) { lastRun = run; - auto runInfo = o2::parameters::AggregatedRunInfo::buildAggregatedRunInfo(o2::ccdb::BasicCCDBManager::instance(), run); + auto runInfo = o2::parameters::AggregatedRunInfo::buildAggregatedRunInfo(o2::ccdb::BasicCCDBManager::instance(), run, strLPMProductionTag); // first bc of the first orbit bcSOR = runInfo.orbitSOR * nBCsPerOrbit; // duration of TF in bcs diff --git a/DPG/Tasks/AOTEvent/eventSelectionQa.cxx b/DPG/Tasks/AOTEvent/eventSelectionQa.cxx index 52ec04b0f2e..9626e628b1f 100644 --- a/DPG/Tasks/AOTEvent/eventSelectionQa.cxx +++ b/DPG/Tasks/AOTEvent/eventSelectionQa.cxx @@ -12,7 +12,7 @@ /// \file eventSelectionQa.cxx /// \brief Event selection QA task /// -/// \author Evgeny Kryshen +/// \author Evgeny Kryshen and Igor Altsybeev #include #include @@ -361,7 +361,17 @@ struct EventSelectionQaTask { // requested by TPC experts: nTPConly tracks vs occupancy histos.add("occupancyQA/hNumTracksTPConly_vs_V0A_vs_occupancy", "", kTH3F, {axisMultV0AForOccup, axisNtracksTPConly, axisOccupancyTracks}); histos.add("occupancyQA/hNumTracksTPConlyNoITS_vs_V0A_vs_occupancy", "", kTH3F, {axisMultV0AForOccup, axisNtracksTPConly, axisOccupancyTracks}); - + // request from experts to add track properties vs occupancy, to compare data vs MC + const AxisSpec axisOccupancyForTrackQA{60, 0., 15000, "occupancy (n ITS tracks weighted)"}; + const AxisSpec axisNTPCcls{150, 0, 150, "n TPC clusters"}; + histos.add("occupancyQA/tpcNClsFound_vs_V0A_vs_occupancy", "", kTH3F, {axisMultV0AForOccup, axisNTPCcls, axisOccupancyForTrackQA}); + histos.add("occupancyQA/tpcNClsFindable_vs_V0A_vs_occupancy", "", kTH3F, {axisMultV0AForOccup, axisNTPCcls, axisOccupancyForTrackQA}); + histos.add("occupancyQA/tpcNClsShared_vs_V0A_vs_occupancy", "", kTH3F, {axisMultV0AForOccup, axisNTPCcls, axisOccupancyForTrackQA}); + histos.add("occupancyQA/tpcNCrossedRows_vs_V0A_vs_occupancy", "", kTH3F, {axisMultV0AForOccup, axisNTPCcls, axisOccupancyForTrackQA}); + const AxisSpec axisChi2TPC{150, 0, 15, "chi2Ncl TPC"}; + histos.add("occupancyQA/tpcChi2_vs_V0A_vs_occupancy", "", kTH3F, {axisMultV0AForOccup, axisChi2TPC, axisOccupancyForTrackQA}); + + // ITS in-ROF occupancy histos.add("occupancyQA/hITSTracks_ev1_vs_ev2_2coll_in_ROF", ";nITStracks event #1;nITStracks event #2", kTH2D, {{200, 0., 6000}, {200, 0., 6000}}); histos.add("occupancyQA/hITSTracks_ev1_vs_ev2_2coll_in_ROF_UPC", ";nITStracks event #1;nITStracks event #2", kTH2D, {{41, -0.5, 40.5}, {41, -0.5, 40.5}}); histos.add("occupancyQA/hITSTracks_ev1_vs_ev2_2coll_in_ROF_nonUPC", ";nITStracks event #1;nITStracks event #2", kTH2D, {{200, 0., 6000}, {200, 0., 6000}}); @@ -1128,6 +1138,10 @@ struct EventSelectionQaTask { int nTracksITSTPC = 0; bool isTVX = col.selection_bit(kIsTriggerTVX); + + int occupancyByTracks = col.trackOccupancyInTimeRange(); + float occupancyByFT0C = col.ft0cOccupancyInTimeRange(); + for (const auto& track : tracksGrouped) { int trackBcDiff = bcDiff + track.trackTime() / o2::constants::lhc::LHCBunchSpacingNS; @@ -1158,7 +1172,19 @@ struct EventSelectionQaTask { nPV++; if (track.hasTPC()) { nContributorsAfterEtaTPCLooseCuts++; - } + + if (!isLowFlux && col.sel8() && col.selection_bit(kNoSameBunchPileup) && fabs(col.posZ()) < 10 && occupancyByTracks >= 0) { + histos.fill(HIST("occupancyQA/tpcNClsFound_vs_V0A_vs_occupancy"), multV0A, track.tpcNClsFound(), occupancyByTracks); + histos.fill(HIST("occupancyQA/tpcNClsFindable_vs_V0A_vs_occupancy"), multV0A, track.tpcNClsFindable(), occupancyByTracks); + histos.fill(HIST("occupancyQA/tpcNClsShared_vs_V0A_vs_occupancy"), multV0A, track.tpcNClsShared(), occupancyByTracks); + histos.fill(HIST("occupancyQA/tpcChi2_vs_V0A_vs_occupancy"), multV0A, track.tpcChi2NCl(), occupancyByTracks); + int tpcNClsFindableMinusCrossedRowsCorrected = track.tpcNClsFindableMinusCrossedRows(); + // correct for a buggy behaviour due to int8 and uint8 difference: + if (tpcNClsFindableMinusCrossedRowsCorrected < -70) + tpcNClsFindableMinusCrossedRowsCorrected += 256; + histos.fill(HIST("occupancyQA/tpcNCrossedRows_vs_V0A_vs_occupancy"), multV0A, track.tpcNClsFindable() - tpcNClsFindableMinusCrossedRowsCorrected, occupancyByTracks); + } + } // end of hasTPC if (track.tpcNClsFound() > 70 && track.tpcNClsCrossedRows() > 80 && track.itsChi2NCl() < 36 && track.tpcChi2NCl() < 4) { nContributorsAfterEtaTPCCuts++; // ROF border QA @@ -1183,10 +1209,8 @@ struct EventSelectionQaTask { histos.fill(HIST("hNcontribAfterCutsVsBcInTF"), bcInTF, nContributorsAfterEtaTPCCuts); - if (!isLowFlux && col.sel8() && fabs(col.posZ()) < 10) { - int occupancyByTracks = col.trackOccupancyInTimeRange(); + if (!isLowFlux && col.sel8() && col.selection_bit(kNoSameBunchPileup) && fabs(col.posZ()) < 10) { histos.fill(HIST("occupancyQA/hOccupancyByTracks"), occupancyByTracks); - float occupancyByFT0C = col.ft0cOccupancyInTimeRange(); histos.fill(HIST("occupancyQA/hOccupancyByFT0C"), occupancyByFT0C); if (occupancyByTracks >= 0) { histos.fill(HIST("occupancyQA/hOccupancyByFT0CvsByTracks"), occupancyByTracks, occupancyByFT0C); From 9f8189a3def90344a1e861723c47775b78afb5f5 Mon Sep 17 00:00:00 2001 From: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Date: Thu, 24 Jul 2025 11:57:15 +0200 Subject: [PATCH 038/345] [PWGLF] Add task to produce binned information about V0s/cascades (#12212) Co-authored-by: ALICE Action Bot --- PWGLF/Tasks/Strangeness/CMakeLists.txt | 5 + .../strangenessderivedbinnedinfo.cxx | 798 ++++++++++++++++++ 2 files changed, 803 insertions(+) create mode 100644 PWGLF/Tasks/Strangeness/strangenessderivedbinnedinfo.cxx diff --git a/PWGLF/Tasks/Strangeness/CMakeLists.txt b/PWGLF/Tasks/Strangeness/CMakeLists.txt index a6bc1f60334..2b261cecd1a 100644 --- a/PWGLF/Tasks/Strangeness/CMakeLists.txt +++ b/PWGLF/Tasks/Strangeness/CMakeLists.txt @@ -150,3 +150,8 @@ o2physics_add_dpl_workflow(lambdaspincorrderived SOURCES lambdaspincorrderived.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(strangenessderivedbinnedinfo + SOURCES strangenessderivedbinnedinfo.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::AnalysisCCDB O2Physics::EventFilteringUtils + COMPONENT_NAME Analysis) \ No newline at end of file diff --git a/PWGLF/Tasks/Strangeness/strangenessderivedbinnedinfo.cxx b/PWGLF/Tasks/Strangeness/strangenessderivedbinnedinfo.cxx new file mode 100644 index 00000000000..88ca53fb19c --- /dev/null +++ b/PWGLF/Tasks/Strangeness/strangenessderivedbinnedinfo.cxx @@ -0,0 +1,798 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// +/// \file strangenessderivedbinnedinfo.cxx +/// \brief analysis task producing V0/cascade info in binned format +/// +/// \author Romain Schotter , Austrian Academy of Sciences & SMI +// +// ================ +// +// This code loops over V0Cores and CascCores tables and produces some +// standard analysis output. It is meant to be run over +// derived data. +// +// +// Comments, questions, complaints, suggestions? +// Please write to: +// romain.schotter@cern.ch +// + +#include "PWGLF/DataModel/LFStrangenessPIDTables.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" + +#include "Common/CCDB/ctpRateFetcher.h" +#include "Common/Core/TrackSelection.h" +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "EventFiltering/Zorro.h" +#include "EventFiltering/ZorroSummary.h" + +#include "CCDB/BasicCCDBManager.h" +#include "CommonConstants/PhysicsConstants.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/O2DatabasePDGPlugin.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/Track.h" + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +// constants +const float ctauXiPDG = 4.91; // Xi PDG lifetime +const float ctauOmegaPDG = 2.461; // Omega PDG lifetime + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using std::array; + +using namespace o2::aod::rctsel; + +using DauTracks = soa::Join; +using V0Candidates = soa::Join; +using CascadeCandidates = soa::Join; + +struct strangenessderivedbinnedinfo { + HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + // master analysis switches + Configurable analyseK0Short{"analyseK0Short", true, "process K0Short-like candidates"}; + Configurable analyseLambda{"analyseLambda", false, "process Lambda-like candidates"}; + Configurable analyseAntiLambda{"analyseAntiLambda", false, "process AntiLambda-like candidates"}; + Configurable analyseXi{"analyseXi", false, "process Xi-like candidates"}; + Configurable analyseOmega{"analyseOmega", false, "process Omega-like candidates"}; + Configurable isPP{"isPP", true, "If running on pp collision, switch it on true"}; + + // for running over skimmed dataset + Configurable doPPAnalysis{"doPPAnalysis", false, "if in pp, set to true"}; + Configurable cfgSkimmedProcessing{"cfgSkimmedProcessing", false, "If running over skimmed data, switch it on true"}; + Configurable cfgSkimmedTrigger{"cfgSkimmedTrigger", "fDoubleXi,fTripleXi,fQuadrupleXi", "(std::string) Comma separated list of triggers of interest"}; + Configurable irSource{"irSource", "T0VTX", "Estimator of the interaction rate (Recommended: pp --> T0VTX, Pb-Pb --> ZNC hadronic)"}; + + struct : ConfigurableGroup { + Configurable requireSel8{"requireSel8", true, "require sel8 event selection"}; + Configurable requireTriggerTVX{"requireTriggerTVX", true, "require FT0 vertex (acceptable FT0C-FT0A time difference) at trigger level"}; + Configurable rejectITSROFBorder{"rejectITSROFBorder", true, "reject events at ITS ROF border (Run 3 only)"}; + Configurable rejectTFBorder{"rejectTFBorder", true, "reject events at TF border (Run 3 only)"}; + Configurable requireIsVertexITSTPC{"requireIsVertexITSTPC", false, "require events with at least one ITS-TPC track (Run 3 only)"}; + Configurable requireIsGoodZvtxFT0VsPV{"requireIsGoodZvtxFT0VsPV", true, "require events with PV position along z consistent (within 1 cm) between PV reconstructed using tracks and PV using FT0 A-C time difference (Run 3 only)"}; + Configurable requireIsVertexTOFmatched{"requireIsVertexTOFmatched", false, "require events with at least one of vertex contributors matched to TOF (Run 3 only)"}; + Configurable requireIsVertexTRDmatched{"requireIsVertexTRDmatched", false, "require events with at least one of vertex contributors matched to TRD (Run 3 only)"}; + Configurable rejectSameBunchPileup{"rejectSameBunchPileup", true, "reject collisions in case of pileup with another collision in the same foundBC (Run 3 only)"}; + Configurable requireNoCollInTimeRangeStd{"requireNoCollInTimeRangeStd", false, "reject collisions corrupted by the cannibalism, with other collisions within +/- 2 microseconds or mult above a certain threshold in -4 - -2 microseconds (Run 3 only)"}; + Configurable requireNoCollInTimeRangeStrict{"requireNoCollInTimeRangeStrict", false, "reject collisions corrupted by the cannibalism, with other collisions within +/- 10 microseconds (Run 3 only)"}; + Configurable requireNoCollInTimeRangeNarrow{"requireNoCollInTimeRangeNarrow", false, "reject collisions corrupted by the cannibalism, with other collisions within +/- 2 microseconds (Run 3 only)"}; + Configurable requireNoCollInROFStd{"requireNoCollInROFStd", false, "reject collisions corrupted by the cannibalism, with other collisions within the same ITS ROF with mult. above a certain threshold (Run 3 only)"}; + Configurable requireNoCollInROFStrict{"requireNoCollInROFStrict", false, "reject collisions corrupted by the cannibalism, with other collisions within the same ITS ROF (Run 3 only)"}; + Configurable requireINEL0{"requireINEL0", true, "require INEL>0 event selection"}; + Configurable requireINEL1{"requireINEL1", false, "require INEL>1 event selection"}; + + Configurable maxZVtxPosition{"maxZVtxPosition", 10., "max Z vtx position"}; + + Configurable useFT0CbasedOccupancy{"useFT0CbasedOccupancy", false, "Use sum of FT0-C amplitudes for estimating occupancy? (if not, use track-based definition)"}; + // fast check on occupancy + Configurable minOccupancy{"minOccupancy", -1, "minimum occupancy from neighbouring collisions"}; + Configurable maxOccupancy{"maxOccupancy", -1, "maximum occupancy from neighbouring collisions"}; + // fast check on interaction rate + Configurable minIR{"minIR", -1, "minimum IR collisions"}; + Configurable maxIR{"maxIR", -1, "maximum IR collisions"}; + } eventSelections; + + struct : ConfigurableGroup { + Configurable v0TypeSelection{"v0Selections.v0TypeSelection", 1, "select on a certain V0 type (leave negative if no selection desired)"}; + + // Selection criteria: acceptance + Configurable rapidityCut{"v0Selections.rapidityCut", 0.5, "rapidity"}; + Configurable daughterEtaCut{"v0Selections.daughterEtaCut", 0.8, "max eta for daughters"}; + + // Standard 6 topological criteria + Configurable v0cospa{"v0Selections.v0cospa", 0.97, "min V0 CosPA"}; + Configurable dcav0dau{"v0Selections.dcav0dau", 1.0, "max DCA V0 Daughters (cm)"}; + Configurable dcav0topv{"v0Selections.dcav0topv", .05, "min DCA V0 to PV (cm)"}; + Configurable dcapiontopv{"v0Selections.dcapiontopv", .05, "min DCA Pion To PV (cm)"}; + Configurable dcaprotontopv{"v0Selections.dcaprotontopv", .05, "min DCA Proton To PV (cm)"}; + Configurable v0radius{"v0Selections.v0radius", 1.2, "minimum V0 radius (cm)"}; + Configurable v0radiusMax{"v0Selections.v0radiusMax", 1E5, "maximum V0 radius (cm)"}; + + // invariant mass selection + Configurable v0MassWindow{"v0Selections.v0MassWindow", 0.008, "#Lambda mass (GeV/#it{c}^{2})"}; + Configurable compMassRejection{"v0Selections.compMassRejection", 0.008, "Competing mass rejection (GeV/#it{c}^{2})"}; + + // Additional selection on the AP plot (exclusive for K0Short) + // original equation: lArmPt*5>TMath::Abs(lArmAlpha) + Configurable armPodCut{"v0Selections.armPodCut", 5.0f, "pT * (cut) > |alpha|, AP cut. Negative: no cut"}; + + // Track quality + Configurable minTPCrows{"v0Selections.minTPCrows", 70, "minimum TPC crossed rows"}; + Configurable minITSclusters{"v0Selections.minITSclusters", -1, "minimum ITS clusters"}; + Configurable requireTPConly{"v0Selections.requireTPConly", false, "require V0s comprised of at least one TPC only prong"}; + Configurable requirePosITSonly{"v0Selections.requirePosITSonly", false, "require that positive track is ITSonly (overrides TPC quality)"}; + Configurable requireNegITSonly{"v0Selections.requireNegITSonly", false, "require that negative track is ITSonly (overrides TPC quality)"}; + + // PID (TPC) + Configurable tpcPidNsigmaCut{"v0Selections.tpcPidNsigmaCut", 5, "tpcPidNsigmaCut"}; + } v0Selections; + + struct : ConfigurableGroup { + // Selection criteria: acceptance + Configurable rapidityCut{"cascSelections.rapidityCut", 0.5, "rapidity"}; + Configurable daughterEtaCut{"cascSelections.daughterEtaCut", 0.8, "max eta for daughters"}; + + // Standard 6 topological criteria on V0 + Configurable v0cospa{"cascSelections.v0cospa", 0.97, "min V0 CosPA"}; + Configurable dcav0dau{"cascSelections.dcav0dau", 1.0, "max DCA V0 Daughters (cm)"}; + Configurable dcav0topv{"cascSelections.dcav0topv", .05, "min DCA V0 to PV (cm)"}; + Configurable dcapiontopv{"cascSelections.dcapiontopv", .05, "min DCA Pion To PV (cm)"}; + Configurable dcaprotontopv{"cascSelections.dcaprotontopv", .05, "min DCA Proton To PV (cm)"}; + Configurable v0radius{"cascSelections.v0radius", 1.2, "minimum V0 radius (cm)"}; + Configurable v0radiusMax{"cascSelections.v0radiusMax", 1E5, "maximum V0 radius (cm)"}; + + // Standard 6 topological criteria on cascades + Configurable casccospa{"cascSelections.casccospa", 0.97, "min Cascade CosPA"}; + Configurable dcacascdau{"cascSelections.dcacascdau", 1.0, "max DCA Cascade Daughters (cm)"}; + Configurable dcaxybachbaryontopv{"cascSelections.dcaxybachbaryontopv", -1, "DCAxy Bachelor-Baryon to PV (cm)"}; + Configurable bachbaryoncospa{"cascSelections.bachbaryoncospa", -1, "Bachelor-Baryon CosPA"}; + Configurable dcabachtopv{"cascSelections.dcabachtopv", .05, "min DCA Bachelor To PV (cm)"}; + Configurable cascradius{"cascSelections.cascradius", 0.5, "minimum Cascade radius (cm)"}; + Configurable cascradiusMax{"cascSelections.cascradiusMax", 1E5, "maximum Cascade radius (cm)"}; + Configurable cascProperLifeTime{"cascSelections.cascProperLifeTime", 3, "maximum lifetime (ctau)"}; + + // invariant mass selection + Configurable v0MassWindow{"cascSelections.v0MassWindow", 0.008, "#Lambda mass (GeV/#it{c}^{2})"}; + Configurable cascMassWindow{"cascSelections.cascMassWindow", 0.008, "#Lambda mass (GeV/#it{c}^{2})"}; + Configurable compMassRejection{"cascSelections.compMassRejection", 0.008, "Competing mass rejection (GeV/#it{c}^{2})"}; + + // Track quality + Configurable minTPCrows{"cascSelections.minTPCrows", 70, "minimum TPC crossed rows"}; + Configurable minITSclusters{"cascSelections.minITSclusters", -1, "minimum ITS clusters"}; + Configurable skipTPConly{"cascSelections.skipTPConly", false, "skip V0s comprised of at least one TPC only prong"}; + Configurable requireBachITSonly{"cascSelections.requireBachITSonly", false, "require that bachelor track is ITSonly (overrides TPC quality)"}; + Configurable requirePosITSonly{"cascSelections.requirePosITSonly", false, "require that positive track is ITSonly (overrides TPC quality)"}; + Configurable requireNegITSonly{"cascSelections.requireNegITSonly", false, "require that negative track is ITSonly (overrides TPC quality)"}; + + // PID (TPC) + Configurable tpcPidNsigmaCut{"cascSelections.tpcPidNsigmaCut", 5, "tpcPidNsigmaCut"}; + } cascSelections; + + struct : ConfigurableGroup { + std::string prefix = "rctConfigurations"; // JSON group name + Configurable cfgRCTLabel{"cfgRCTLabel", "", "Which detector condition requirements? (CBT, CBT_hadronPID, CBT_electronPID, CBT_calo, CBT_muon, CBT_muon_glo)"}; + Configurable cfgCheckZDC{"cfgCheckZDC", false, "Include ZDC flags in the bit selection (for Pb-Pb only)"}; + Configurable cfgTreatLimitedAcceptanceAsBad{"cfgTreatLimitedAcceptanceAsBad", false, "reject all events where the detectors relevant for the specified Runlist are flagged as LimitedAcceptance"}; + } rctConfigurations; + + RCTFlagsChecker rctFlagsChecker{rctConfigurations.cfgRCTLabel.value}; + + // CCDB options + struct : ConfigurableGroup { + Configurable ccdburl{"ccdbConfigurations.ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable grpPath{"ccdbConfigurations.grpPath", "GLO/GRP/GRP", "Path of the grp file"}; + Configurable grpmagPath{"ccdbConfigurations.grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; + Configurable lutPath{"ccdbConfigurations.lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"}; + Configurable geoPath{"ccdbConfigurations.geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; + Configurable mVtxPath{"ccdbConfigurations.mVtxPath", "GLO/Calib/MeanVertex", "Path of the mean vertex file"}; + } ccdbConfigurations; + + Service ccdb; + o2::ccdb::CcdbApi ccdbApi; + ctpRateFetcher rateFetcher; + int mRunNumber; + std::map metadata; + + Zorro zorro; + OutputObj zorroSummary{"zorroSummary"}; + + static constexpr float defaultLifetimeCuts[1][2] = {{30., 20.}}; + Configurable> lifetimecut{"lifetimecut", {defaultLifetimeCuts[0], 2, {"lifetimecutLambda", "lifetimecutK0S"}}, "lifetimecut"}; + + ConfigurableAxis axisCentrality{"axisCentrality", {VARIABLE_WIDTH, 0.0f, 20.0f, 40.0f, 60.0f, 80.0f, 100.0f}, "Centrality"}; + ConfigurableAxis axisOccupancy{"axisOccupancy", {VARIABLE_WIDTH, 0.0f, 1000.0f, 3000.0f, 10000.0f, 30000.0f}, "Occupancy"}; + + // topological variable QA axes + ConfigurableAxis axisMass{"axisV0Mass", {25, 0.45, 0.55f}, "Invariant mass (GeV/#it{c}^{2})"}; + ConfigurableAxis axisPhi{"axisPhi", {36, 0.0f, constants::math::TwoPI}, "#varphi (rad)"}; + ConfigurableAxis axisEta{"axisEta", {10, -1.0f, 1.0f}, "Pseudo-rapidity #eta"}; + ConfigurableAxis axisRadius{"axisRadius", {10, 0.0f, 250.0f}, "Decay radius (cm)"}; + ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0.0f, 0.2f, 0.4f, 0.6f, 0.8f, 1.0f, 1.5f, 2.0f, 2.5f, 3.0f, 4.0f, 5.0f, 7.0f, 9.0f, 11.0f, 15.0f, 30.0f}, "#it{p}_{T} (GeV/#it{c})"}; + + // PDG database + Service pdgDB; + + void init(InitContext const&) + { + if (analyseK0Short + analyseLambda + analyseAntiLambda + analyseXi + analyseOmega > 1) { + LOGF(fatal, "Cannot enable several particles at the same time. Please choose one."); + } + + // Initialise the RCTFlagsChecker + rctFlagsChecker.init(rctConfigurations.cfgRCTLabel.value, rctConfigurations.cfgCheckZDC, rctConfigurations.cfgTreatLimitedAcceptanceAsBad); + + // Event Counters + histos.add("hEventSelection", "hEventSelection", kTH1D, {{21, -0.5f, +20.5f}}); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(1, "All collisions"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(2, "sel8 cut"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(3, "kIsTriggerTVX"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(4, "kNoITSROFrameBorder"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(5, "kNoTimeFrameBorder"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(6, "posZ cut"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(7, "kIsVertexITSTPC"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(8, "kIsGoodZvtxFT0vsPV"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(9, "kIsVertexTOFmatched"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(10, "kIsVertexTRDmatched"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(11, "kNoSameBunchPileup"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(12, "kNoCollInTimeRangeStd"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(13, "kNoCollInTimeRangeStrict"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(14, "kNoCollInTimeRangeNarrow"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(15, "kNoCollInRofStd"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(16, "kNoCollInRofStrict"); + if (doPPAnalysis) { + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(17, "INEL>0"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(18, "INEL>1"); + } else { + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(17, "Below min occup."); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(18, "Above max occup."); + } + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(19, "Below min IR"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(20, "Above max IR"); + histos.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(21, "RCT flags"); + + histos.add("hEventCentrality", "hEventCentrality", kTH1F, {{100, 0.0f, +100.0f}}); + histos.add("hEventOccupancy", "hEventOccupancy", kTH1F, {axisOccupancy}); + + histos.add("h7dCentOccQoverPtMassRadiusPhiEta", "h7dCentOccQoverPtMassRadiusPhiEta", kTHnD, {axisCentrality, axisOccupancy, axisPt, axisMass, axisRadius, axisPhi, axisEta}); + + if (cfgSkimmedProcessing) { + zorroSummary.setObject(zorro.getZorroSummary()); + } + + // inspect histogram sizes, please + histos.print(); + } + + template // TCollision should be of the type: soa::Join::iterator or so + void initCCDB(TCollision const& collision) + { + if (mRunNumber == collision.runNumber()) { + return; + } + + mRunNumber = collision.runNumber(); + if (cfgSkimmedProcessing) { + ccdb->setURL(ccdbConfigurations.ccdburl); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setFatalWhenNull(false); + + zorro.initCCDB(ccdb.service, collision.runNumber(), collision.timestamp(), cfgSkimmedTrigger.value); + zorro.populateHistRegistry(histos, collision.runNumber()); + } + } + + template + bool isEventAccepted(TCollision collision, bool fillHists) + // check whether the collision passes our collision selections + { + if (fillHists) + histos.fill(HIST("hEventSelection"), 0. /* all collisions */); + + if (eventSelections.requireSel8 && !collision.sel8()) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 1 /* sel8 collisions */); + + if (eventSelections.requireTriggerTVX && !collision.selection_bit(aod::evsel::kIsTriggerTVX)) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 2 /* FT0 vertex (acceptable FT0C-FT0A time difference) collisions */); + + if (eventSelections.rejectITSROFBorder && !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 3 /* Not at ITS ROF border */); + + if (eventSelections.rejectTFBorder && !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 4 /* Not at TF border */); + + if (std::abs(collision.posZ()) > eventSelections.maxZVtxPosition) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 5 /* vertex-Z selected */); + + if (eventSelections.requireIsVertexITSTPC && !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 6 /* Contains at least one ITS-TPC track */); + + if (eventSelections.requireIsGoodZvtxFT0VsPV && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 7 /* PV position consistency check */); + + if (eventSelections.requireIsVertexTOFmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTOFmatched)) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 8 /* PV with at least one contributor matched with TOF */); + + if (eventSelections.requireIsVertexTRDmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTRDmatched)) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 9 /* PV with at least one contributor matched with TRD */); + + if (eventSelections.rejectSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 10 /* Not at same bunch pile-up */); + + if (eventSelections.requireNoCollInTimeRangeStd && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 11 /* No other collision within +/- 2 microseconds or mult above a certain threshold in -4 - -2 microseconds*/); + + if (eventSelections.requireNoCollInTimeRangeStrict && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStrict)) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 12 /* No other collision within +/- 10 microseconds */); + + if (eventSelections.requireNoCollInTimeRangeNarrow && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeNarrow)) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 13 /* No other collision within +/- 2 microseconds */); + + if (eventSelections.requireNoCollInROFStd && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStandard)) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 14 /* No other collision within the same ITS ROF with mult. above a certain threshold */); + + if (eventSelections.requireNoCollInROFStrict && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStrict)) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 15 /* No other collision within the same ITS ROF */); + + if (doPPAnalysis) { // we are in pp + if (eventSelections.requireINEL0 && collision.multNTracksPVeta1() < 1) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 16 /* INEL > 0 */); + + if (eventSelections.requireINEL1 && collision.multNTracksPVeta1() < 2) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 17 /* INEL > 1 */); + + } else { // we are in Pb-Pb + float collisionOccupancy = eventSelections.useFT0CbasedOccupancy ? collision.ft0cOccupancyInTimeRange() : collision.trackOccupancyInTimeRange(); + if (eventSelections.minOccupancy >= 0 && collisionOccupancy < eventSelections.minOccupancy) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 16 /* Below min occupancy */); + + if (eventSelections.maxOccupancy >= 0 && collisionOccupancy > eventSelections.maxOccupancy) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 17 /* Above max occupancy */); + } + + // Fetch interaction rate only if required (in order to limit ccdb calls) + double interactionRate = (eventSelections.minIR >= 0 || eventSelections.maxIR >= 0) ? rateFetcher.fetch(ccdb.service, collision.timestamp(), collision.runNumber(), irSource) * 1.e-3 : -1; + if (eventSelections.minIR >= 0 && interactionRate < eventSelections.minIR) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 18 /* Below min IR */); + + if (eventSelections.maxIR >= 0 && interactionRate > eventSelections.maxIR) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 19 /* Above max IR */); + + if (!rctConfigurations.cfgRCTLabel.value.empty() && !rctFlagsChecker(collision)) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 20 /* Pass CBT condition */); + + return true; + } + + template + void fillEventHistograms(TCollision collision, float& centrality, float& occupancy) + { + if (isPP) { // + centrality = collision.centFT0M(); + } else { + centrality = collision.centFT0C(); + occupancy = eventSelections.useFT0CbasedOccupancy ? collision.ft0cOccupancyInTimeRange() : collision.trackOccupancyInTimeRange(); + } + histos.fill(HIST("hEventCentrality"), centrality); + histos.fill(HIST("hEventOccupancy"), occupancy); + + return; + } + + template + bool isV0Selected(TV0 v0, TCollision collision, float rapidity) + // precalculate this information so that a check is one mask operation, not many + { + // + // Base topological variables + // + + // v0 radius min/max selections + if (v0.v0radius() < v0Selections.v0radius) + return false; + if (v0.v0radius() > v0Selections.v0radiusMax) + return false; + // DCA proton and pion to PV for Lambda and AntiLambda decay hypotheses + if (analyseK0Short) { + if (std::fabs(v0.dcapostopv()) < v0Selections.dcapiontopv) + return false; + if (std::fabs(v0.dcanegtopv()) < v0Selections.dcapiontopv) + return false; + } + if (analyseLambda) { + if (std::fabs(v0.dcapostopv()) < v0Selections.dcaprotontopv) + return false; + if (std::fabs(v0.dcanegtopv()) < v0Selections.dcapiontopv) + return false; + } + if (analyseAntiLambda) { + if (std::fabs(v0.dcapostopv()) < v0Selections.dcapiontopv) + return false; + if (std::fabs(v0.dcanegtopv()) < v0Selections.dcaprotontopv) + return false; + } + // V0 cosine of pointing angle + if (v0.v0cosPA() < v0Selections.v0cospa) + return false; + // DCA between v0 daughters + if (v0.dcaV0daughters() > v0Selections.dcav0dau) + return false; + // DCA V0 to prim vtx + if (v0.dcav0topv() < v0Selections.dcav0topv) + return false; + + // + // rapidity + // + if (std::fabs(rapidity) > v0Selections.rapidityCut) + return false; + + // + // competing mass rejection + // + if ((analyseLambda || analyseAntiLambda) && std::fabs(v0.mK0Short() - o2::constants::physics::MassK0Short) < v0Selections.compMassRejection) + return false; + if (analyseK0Short && std::fabs(v0.mLambda() - o2::constants::physics::MassLambda0) < v0Selections.compMassRejection) + return false; + + auto posTrackExtra = v0.template posTrackExtra_as(); + auto negTrackExtra = v0.template negTrackExtra_as(); + + // + // ITS quality flags + // + if (posTrackExtra.itsNCls() < v0Selections.minITSclusters) + return false; + if (negTrackExtra.itsNCls() < v0Selections.minITSclusters) + return false; + + // + // TPC quality flags + // + if (posTrackExtra.tpcCrossedRows() < v0Selections.minTPCrows) + return false; + if (negTrackExtra.tpcCrossedRows() < v0Selections.minTPCrows) + return false; + + // + // TPC PID + // + if (analyseK0Short) { + if (std::fabs(posTrackExtra.tpcNSigmaPi()) > v0Selections.tpcPidNsigmaCut) + return false; + if (std::fabs(negTrackExtra.tpcNSigmaPi()) > v0Selections.tpcPidNsigmaCut) + return false; + } + if (analyseLambda) { + if (std::fabs(posTrackExtra.tpcNSigmaPr()) > v0Selections.tpcPidNsigmaCut) + return false; + if (std::fabs(negTrackExtra.tpcNSigmaPi()) > v0Selections.tpcPidNsigmaCut) + return false; + } + if (analyseAntiLambda) { + if (std::fabs(posTrackExtra.tpcNSigmaPi()) > v0Selections.tpcPidNsigmaCut) + return false; + if (std::fabs(negTrackExtra.tpcNSigmaPr()) > v0Selections.tpcPidNsigmaCut) + return false; + } + + // + // ITS only tag + if (v0Selections.requirePosITSonly && posTrackExtra.tpcCrossedRows() > 0) + return false; + if (v0Selections.requireNegITSonly && negTrackExtra.tpcCrossedRows() > 0) + return false; + + // + // TPC only tag + if (v0Selections.requireTPConly && posTrackExtra.detectorMap() != o2::aod::track::TPC) + return false; + if (v0Selections.requireTPConly && negTrackExtra.detectorMap() != o2::aod::track::TPC) + return false; + + // + // proper lifetime + if ((analyseLambda || analyseAntiLambda) && + v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0 > lifetimecut->get("lifetimecutLambda")) + return false; + if (analyseK0Short && + v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short > lifetimecut->get("lifetimecutK0S")) + return false; + + // + // armenteros + if (v0Selections.armPodCut > 1e-4 && v0.qtarm() * v0Selections.armPodCut < std::fabs(v0.alpha())) + return false; + + return true; + } + + template + bool isCascadeSelected(TCascade casc, TCollision collision, float rapidity) + // precalculate this information so that a check is one mask operation, not many + { + // + // Base topological variables + // + + // v0 radius min/max selections + if (casc.v0radius() < cascSelections.v0radius) + return false; + if (casc.v0radius() > cascSelections.v0radiusMax) + return false; + // DCA proton and pion to PV for Lambda and AntiLambda decay hypotheses + if (casc.sign() < 0) { // Xi- or Omega- --> positive/negative daughter = proton/pion + if (std::fabs(casc.dcapostopv()) < cascSelections.dcaprotontopv) + return false; + if (std::fabs(casc.dcanegtopv()) < cascSelections.dcapiontopv) + return false; + } else { // Xi+ or Omega+ --> positive/negative daughter = pion/proton + if (std::fabs(casc.dcapostopv()) < cascSelections.dcapiontopv) + return false; + if (std::fabs(casc.dcanegtopv()) < cascSelections.dcaprotontopv) + return false; + } + // V0 cosine of pointing angle + if (casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ()) < cascSelections.v0cospa) + return false; + // DCA between v0 daughters + if (casc.dcaV0daughters() > cascSelections.dcav0dau) + return false; + // DCA V0 to prim vtx + if (casc.dcav0topv(collision.posX(), collision.posY(), collision.posZ()) < cascSelections.dcav0topv) + return false; + + // casc radius min/max selections + if (casc.cascradius() < cascSelections.cascradius) + return false; + if (casc.cascradius() > cascSelections.cascradiusMax) + return false; + // DCA bachelor selection + if (std::fabs(casc.dcabachtopv()) < cascSelections.dcabachtopv) + return false; + // Bachelor-baryon cosPA selection + if (casc.bachBaryonCosPA() < cascSelections.bachbaryoncospa) + return false; + // DCA bachelor-baryon selection + if (std::fabs(casc.bachBaryonDCAxyToPV()) < cascSelections.dcaxybachbaryontopv) + return false; + // casc cosine of pointing angle + if (casc.casccosPA(collision.posX(), collision.posY(), collision.posZ()) < cascSelections.casccospa) + return false; + // DCA between casc daughters + if (casc.dcacascdaughters() > cascSelections.dcacascdau) + return false; + + // + // rapidity + // + if (std::fabs(rapidity) > cascSelections.rapidityCut) + return false; + + // + // competing mass rejection + // + if (analyseXi && std::fabs(casc.mOmega() - o2::constants::physics::MassOmegaMinus) < cascSelections.compMassRejection) + return false; + if (analyseOmega && std::fabs(casc.mXi() - o2::constants::physics::MassXiMinus) < cascSelections.compMassRejection) + return false; + + auto bachTrackExtra = casc.template bachTrackExtra_as(); + auto posTrackExtra = casc.template posTrackExtra_as(); + auto negTrackExtra = casc.template negTrackExtra_as(); + + // + // ITS quality flags + // + if (bachTrackExtra.itsNCls() < cascSelections.minITSclusters) + return false; + if (posTrackExtra.itsNCls() < cascSelections.minITSclusters) + return false; + if (negTrackExtra.itsNCls() < cascSelections.minITSclusters) + return false; + + // + // TPC quality flags + // + if (bachTrackExtra.tpcCrossedRows() < cascSelections.minTPCrows) + return false; + if (posTrackExtra.tpcCrossedRows() < cascSelections.minTPCrows) + return false; + if (negTrackExtra.tpcCrossedRows() < cascSelections.minTPCrows) + return false; + + // + // TPC PID + // + if (analyseXi && std::fabs(bachTrackExtra.tpcNSigmaPi()) > cascSelections.tpcPidNsigmaCut) + return false; + if (analyseOmega && std::fabs(bachTrackExtra.tpcNSigmaKa()) > cascSelections.tpcPidNsigmaCut) + return false; + if (casc.sign() < 0) { // Xi- or Omega- --> positive/negative daughter = proton/pion + if (std::fabs(posTrackExtra.tpcNSigmaPr()) > cascSelections.tpcPidNsigmaCut) + return false; + if (std::fabs(negTrackExtra.tpcNSigmaPi()) > cascSelections.tpcPidNsigmaCut) + return false; + } else { // Xi+ or Omega+ --> positive/negative daughter = pion/proton + if (std::fabs(posTrackExtra.tpcNSigmaPi()) > cascSelections.tpcPidNsigmaCut) + return false; + if (std::fabs(negTrackExtra.tpcNSigmaPr()) > cascSelections.tpcPidNsigmaCut) + return false; + } + + // + // proper lifetime + float distOverTotMom = std::sqrt(std::pow(casc.x() - collision.posX(), 2) + std::pow(casc.y() - collision.posY(), 2) + std::pow(casc.z() - collision.posZ(), 2)) / (casc.p() + 1E-10); + if (analyseXi && distOverTotMom * o2::constants::physics::MassXiMinus / ctauXiPDG > cascSelections.cascProperLifeTime) + return false; + if (analyseOmega && distOverTotMom * o2::constants::physics::MassOmegaMinus / ctauOmegaPDG > cascSelections.cascProperLifeTime) + return false; + + return true; + } + + // ______________________________________________________ + // Real data processing - no MC subscription + void process(soa::Join::iterator const& collision, V0Candidates const& fullV0s, CascadeCandidates const& fullCascades, DauTracks const&) + { + // Fire up CCDB + if (cfgSkimmedProcessing) { + initCCDB(collision); + } + + if (!isEventAccepted(collision, true)) { + return; + } + + if (cfgSkimmedProcessing) { + zorro.isSelected(collision.globalBC()); /// Just let Zorro do the accounting + } + + float centrality = -1; + float occupancy = -1; + fillEventHistograms(collision, centrality, occupancy); + + // __________________________________________ + // perform main analysis + // + if (analyseK0Short || analyseLambda || analyseAntiLambda) { // Look at V0s + for (const auto& v0 : fullV0s) { + if (std::abs(v0.negativeeta()) > v0Selections.daughterEtaCut || std::abs(v0.positiveeta()) > v0Selections.daughterEtaCut) + continue; // remove acceptance that's badly reproduced by MC / superfluous in future + + if (v0.v0Type() != v0Selections.v0TypeSelection && v0Selections.v0TypeSelection > -1) + continue; // skip V0s that are not standard + + if (analyseK0Short && isV0Selected(v0, collision, v0.yK0Short())) { + histos.fill(HIST("h7dCentOccQoverPtMassRadiusPhiEta"), centrality, occupancy, v0.pt(), v0.mK0Short(), v0.v0radius(), v0.phi(), v0.eta()); + } + if (analyseLambda && isV0Selected(v0, collision, v0.yLambda())) { + histos.fill(HIST("h7dCentOccQoverPtMassRadiusPhiEta"), centrality, occupancy, v0.pt(), v0.mLambda(), v0.v0radius(), v0.phi(), v0.eta()); + } + if (analyseAntiLambda && isV0Selected(v0, collision, v0.yLambda())) { + histos.fill(HIST("h7dCentOccQoverPtMassRadiusPhiEta"), centrality, occupancy, v0.pt(), v0.mAntiLambda(), v0.v0radius(), v0.phi(), v0.eta()); + } + } // end v0 loop + } + + if (analyseXi || analyseOmega) { // Look at Cascades + for (const auto& cascade : fullCascades) { + if (std::abs(cascade.negativeeta()) > cascSelections.daughterEtaCut || + std::abs(cascade.positiveeta()) > cascSelections.daughterEtaCut || + std::abs(cascade.bacheloreta()) > cascSelections.daughterEtaCut) + continue; // remove acceptance that's badly reproduced by MC / superfluous in future + + if (analyseXi && isCascadeSelected(cascade, collision, cascade.yXi())) { + histos.fill(HIST("h7dCentOccQoverPtMassRadiusPhiEta"), centrality, occupancy, cascade.pt(), cascade.m(1), cascade.cascradius(), cascade.phi(), cascade.eta()); + } + if (analyseOmega && isCascadeSelected(cascade, collision, cascade.yOmega())) { + histos.fill(HIST("h7dCentOccQoverPtMassRadiusPhiEta"), centrality, occupancy, cascade.pt(), cascade.m(2), cascade.cascradius(), cascade.phi(), cascade.eta()); + } + } // end cascade loop + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} From 2f34546a51dcdbd8666ba008159282ff8bb919d9 Mon Sep 17 00:00:00 2001 From: Giovanni Malfattore <89481844+giovannimalfattore@users.noreply.github.com> Date: Thu, 24 Jul 2025 13:22:43 +0200 Subject: [PATCH 039/345] [PWGLF] NucleiTask - Added missing histo (#12203) --- PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx b/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx index 14e08e7cce1..8e5f159d331 100644 --- a/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx +++ b/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx @@ -2163,7 +2163,7 @@ struct LFNucleiBATask { if (evselOptions.removeTFBorder && !event.selection_bit(aod::evsel::kNoTimeFrameBorder)) return; } - if (event.centFT0M() < cfgMultCutLow || event.centFT0M() > cfgMultCutHigh) { + if (event.centFT0M() <= cfgMultCutLow || event.centFT0M() > cfgMultCutHigh) { return; } histos.fill(HIST("event/eventSelection"), 7); @@ -4519,6 +4519,7 @@ struct LFNucleiBATask { } histos.fill(HIST("tracks/deuteron/h1DeuteronSpectra"), DPt); histos.fill(HIST("tracks/deuteron/h2DeuteronYvsPt"), track.rapidity(o2::track::PID::getMass2Z(o2::track::PID::Deuteron)), DPt); + histos.fill(HIST("tracks/deuteron/h2DeuteronEtavsPt"), track.eta(), DPt); histos.fill(HIST("tracks/deuteron/h2DeuteronVspNSigmaITSDe_wTPCpid"), track.p(), nITSDe); if (outFlagOptions.enablePIDplot) @@ -4531,6 +4532,7 @@ struct LFNucleiBATask { } histos.fill(HIST("tracks/deuteron/h1antiDeuteronSpectra"), antiDPt); histos.fill(HIST("tracks/deuteron/h2antiDeuteronYvsPt"), track.rapidity(o2::track::PID::getMass2Z(o2::track::PID::Deuteron)), antiDPt); + histos.fill(HIST("tracks/deuteron/h2antiDeuteronEtavsPt"), track.eta(), antiDPt); histos.fill(HIST("tracks/deuteron/h2antiDeuteronVspNSigmaITSDe_wTPCpid"), track.p(), nITSDe); if (outFlagOptions.enablePIDplot) From 9f36bc4d50ee3324d07b6ce16e490e874df5ce30 Mon Sep 17 00:00:00 2001 From: Fabio Catalano Date: Thu, 24 Jul 2025 15:52:57 +0200 Subject: [PATCH 040/345] [PWGHF] Fix filling of MC collision info in OmegaC creator (#12208) --- PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx b/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx index 573d9fb7db4..9d7413d75d1 100644 --- a/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx +++ b/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx @@ -2726,18 +2726,22 @@ struct HfCandidateCreatorXic0Omegac0Mc { const auto mcParticlesPerMcColl = mcParticles.sliceBy(mcParticlesPerMcCollision, mcCollision.globalIndex()); // Slice the collisions table to get the collision info for the current MC collision float centrality{-1.f}; - uint16_t rejectionMask{0}; + uint32_t rejectionMask{0u}; + int nSplitColl = 0; if constexpr (centEstimator == CentralityEstimator::FT0C) { const auto collSlice = collsWithMcLabels.sliceBy(colPerMcCollisionFT0C, mcCollision.globalIndex()); rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + nSplitColl = collSlice.size(); } else if constexpr (centEstimator == CentralityEstimator::FT0M) { const auto collSlice = collsWithMcLabels.sliceBy(colPerMcCollisionFT0M, mcCollision.globalIndex()); rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + nSplitColl = collSlice.size(); } else if constexpr (centEstimator == CentralityEstimator::None) { const auto collSlice = collsWithMcLabels.sliceBy(colPerMcCollision, mcCollision.globalIndex()); rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centrality); + nSplitColl = collSlice.size(); } - hfEvSelMc.fillHistograms(mcCollision, rejectionMask); + hfEvSelMc.fillHistograms(mcCollision, rejectionMask, nSplitColl); if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject all particles from this collision for (unsigned int i = 0; i < mcParticlesPerMcColl.size(); ++i) { From 7f8cd69b1725aff3175fc4ce0182aa94d14aa39b Mon Sep 17 00:00:00 2001 From: Fabio Catalano Date: Thu, 24 Jul 2025 16:06:06 +0200 Subject: [PATCH 041/345] [PWGHF] Fix misleading histogram in event selection utils (#12215) --- PWGHF/Utils/utilsEvSelHf.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/PWGHF/Utils/utilsEvSelHf.h b/PWGHF/Utils/utilsEvSelHf.h index 057e21039f0..5103d5c4d77 100644 --- a/PWGHF/Utils/utilsEvSelHf.h +++ b/PWGHF/Utils/utilsEvSelHf.h @@ -438,8 +438,8 @@ struct HfEventSelectionMc { std::shared_ptr hRecCollisionsCentMc; static constexpr char NameHistNSplitVertices[] = "hNSplitVertices"; std::shared_ptr hNSplitVertices; - static constexpr char NameHistParticles[] = "hParticles"; - std::shared_ptr hParticles; + static constexpr char NameHistGenCollisions[] = "hGenCollisions"; + std::shared_ptr hGenCollisions; /// \brief Adds collision monitoring histograms in the histogram registry. /// \param registry reference to the histogram registry @@ -448,9 +448,9 @@ struct HfEventSelectionMc { hGenCollisionsCent = registry.add(NameHistGenCollisionsCent, "HF event counter;T0M;# of generated collisions", {o2::framework::HistType::kTH1D, {{100, 0., 100.}}}); hRecCollisionsCentMc = registry.add(NameHistRecCollisionsCentMc, "HF event counter;T0M;# of reconstructed collisions", {o2::framework::HistType::kTH1D, {{100, 0., 100.}}}); hNSplitVertices = registry.add(NameHistNSplitVertices, "HF split vertices counter;;# of reconstructed collisions per mc collision", {o2::framework::HistType::kTH1D, {{4, 1., 5.}}}); - hParticles = registry.add(NameHistParticles, "HF particle counter;;# of accepted particles", {o2::framework::HistType::kTH1D, {axisEvents}}); + hGenCollisions = registry.add(NameHistGenCollisions, "HF event counter;;# of accepted collisions", {o2::framework::HistType::kTH1D, {axisEvents}}); // Puts labels on the collision monitoring histogram. - setEventRejectionLabels(hParticles); + setEventRejectionLabels(hGenCollisions); } /// \brief Configures the object from the reco workflow @@ -563,7 +563,7 @@ struct HfEventSelectionMc { template void fillHistograms(Coll const& mcCollision, const uint32_t rejectionMask, int nSplitColl = 0) { - hParticles->Fill(EventRejection::None); + hGenCollisions->Fill(EventRejection::None); if constexpr (centEstimator == o2::hf_centrality::CentralityEstimator::FT0M) { if (!TESTBIT(rejectionMask, EventRejection::TimeFrameBorderCut) && !TESTBIT(rejectionMask, EventRejection::ItsRofBorderCut) && !TESTBIT(rejectionMask, EventRejection::PositionZ)) { @@ -575,7 +575,7 @@ struct HfEventSelectionMc { if (TESTBIT(rejectionMask, reason)) { return; } - hParticles->Fill(reason); + hGenCollisions->Fill(reason); } if constexpr (centEstimator == o2::hf_centrality::CentralityEstimator::FT0M) { From 32b8a29625014dcadbabfa73bc870367d5c3d100 Mon Sep 17 00:00:00 2001 From: Zhiyong <71517277+Luzhiyongg@users.noreply.github.com> Date: Thu, 24 Jul 2025 17:08:57 +0200 Subject: [PATCH 042/345] [PWGCF] flowTask: small fix; diHadron: add PID (#12216) --- PWGCF/Flow/Tasks/flowTask.cxx | 2 +- .../Tasks/diHadronCor.cxx | 129 ++++++++++++++---- 2 files changed, 104 insertions(+), 27 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowTask.cxx b/PWGCF/Flow/Tasks/flowTask.cxx index 6e038784277..b552add5223 100644 --- a/PWGCF/Flow/Tasks/flowTask.cxx +++ b/PWGCF/Flow/Tasks/flowTask.cxx @@ -433,7 +433,6 @@ struct FlowTask { corrconfigs.push_back(fGFW->GetCorrelatorConfig(userDefineGFWCorr.at(i).c_str(), userDefineGFWName.at(i).c_str(), kFALSE)); } } - fGFW->CreateRegions(); gfwConfigs.SetCorrs(cfgUserPtVnCorrConfig->GetCorrs()); gfwConfigs.SetHeads(cfgUserPtVnCorrConfig->GetHeads()); @@ -447,6 +446,7 @@ struct FlowTask { for (auto i = 0; i < gfwConfigs.GetSize(); ++i) { corrconfigsPtVn.push_back(fGFW->GetCorrelatorConfig(gfwConfigs.GetCorrs()[i], gfwConfigs.GetHeads()[i], gfwConfigs.GetpTDifs()[i])); } + fGFW->CreateRegions(); if (cfgUseAdditionalEventCut) { fMultPVCutLow = new TF1("fMultPVCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x - 3.5*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", 0, 100); diff --git a/PWGCF/TwoParticleCorrelations/Tasks/diHadronCor.cxx b/PWGCF/TwoParticleCorrelations/Tasks/diHadronCor.cxx index e3eb978e08f..6a1b61718f2 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/diHadronCor.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/diHadronCor.cxx @@ -14,39 +14,44 @@ /// \author Zhiyong Lu (zhiyong.lu@cern.ch) /// \since May/03/2025 -#include -#include "TRandom3.h" -#include "TF1.h" -#include -#include - -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/StepTHn.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/RunningWorkflowInfo.h" -#include "CommonConstants/MathConstants.h" -#include "Common/Core/RecoDecay.h" - -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/Centrality.h" -#include "PWGCF/DataModel/CorrelationsDerived.h" -#include "Common/DataModel/CollisionAssociationTables.h" -#include "Common/DataModel/PIDResponse.h" #include "PWGCF/Core/CorrelationContainer.h" #include "PWGCF/Core/PairCuts.h" -#include "PWGCF/GenericFramework/Core/GFWPowerArray.h" +#include "PWGCF/DataModel/CorrelationsDerived.h" #include "PWGCF/GenericFramework/Core/GFW.h" #include "PWGCF/GenericFramework/Core/GFWCumulant.h" +#include "PWGCF/GenericFramework/Core/GFWPowerArray.h" #include "PWGCF/GenericFramework/Core/GFWWeights.h" -#include "DataFormatsParameters/GRPObject.h" + +#include "Common/Core/RecoDecay.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/CollisionAssociationTables.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/PIDResponseITS.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "CommonConstants/MathConstants.h" #include "DataFormatsParameters/GRPMagField.h" +#include "DataFormatsParameters/GRPObject.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/StepTHn.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/PID.h" +#include "ReconstructionDataFormats/Track.h" +#include + +#include "TF1.h" +#include "TRandom3.h" #include +#include +#include + using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; @@ -98,6 +103,9 @@ struct DiHadronCor { O2_DEFINE_CONFIGURABLE(cfgUseEventWeights, bool, false, "Use event weights for mixed event") O2_DEFINE_CONFIGURABLE(cfgUsePtOrder, bool, true, "enable trigger pT < associated pT cut") O2_DEFINE_CONFIGURABLE(cfgUsePtOrderInMixEvent, bool, true, "enable trigger pT < associated pT cut in mixed event") + O2_DEFINE_CONFIGURABLE(cfgPIDUseITSPID, bool, true, "Use ITS PID for particle identification") + O2_DEFINE_CONFIGURABLE(cfgPIDTofPtCut, float, 0.5f, "Minimum pt to use TOF N-sigma") + O2_DEFINE_CONFIGURABLE(cfgPIDParticle, int, 0, "1 = pion, 2 = kaon, 3 = proton, 0 for no PID") SliceCache cache; @@ -112,6 +120,9 @@ struct DiHadronCor { ConfigurableAxis axisVtxMix{"axisVtxMix", {VARIABLE_WIDTH, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, "vertex axis for mixed event histograms"}; ConfigurableAxis axisMultMix{"axisMultMix", {VARIABLE_WIDTH, 0, 10, 20, 40, 60, 80, 100, 120, 140, 160, 180, 200, 220, 240, 260}, "multiplicity / centrality axis for mixed event histograms"}; ConfigurableAxis axisSample{"axisSample", {cfgSampleSize, 0, cfgSampleSize}, "sample axis for histograms"}; + Configurable> pidTofNsigmaCut{"pidTofNsigmaCut", std::vector{1.5, 1.5, 1.5, -1.5, -1.5, -1.5}, "TOF n-sigma cut for pions_posNsigma, kaons_posNsigma, protons_posNsigma, pions_negNsigma, kaons_negNsigma, protons_negNsigma"}; + Configurable> pidItsNsigmaCut{"pidItsNsigmaCut", std::vector{3, 3, 3, -3, -3, -3}, "ITS n-sigma cut for pions_posNsigma, kaons_posNsigma, protons_posNsigma, pions_negNsigma, kaons_negNsigma, protons_negNsigma"}; + Configurable> pidTpcNsigmaCut{"pidTpcNsigmaCut", std::vector{10, 10, 10, -10, -10, -10}, "TOF n-sigma cut for pions_posNsigma, kaons_posNsigma, protons_posNsigma, pions_negNsigma, kaons_negNsigma, protons_negNsigma"}; ConfigurableAxis axisVertexEfficiency{"axisVertexEfficiency", {10, -10, 10}, "vertex axis for efficiency histograms"}; ConfigurableAxis axisEtaEfficiency{"axisEtaEfficiency", {20, -1.0, 1.0}, "eta axis for efficiency histograms"}; @@ -121,7 +132,7 @@ struct DiHadronCor { Filter collisionFilter = (nabs(aod::collision::posZ) < cfgCutVtxZ); Filter trackFilter = (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtMin) && (aod::track::pt < cfgCutPtMax) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t) true)) && (aod::track::tpcChi2NCl < cfgCutChi2prTPCcls) && (nabs(aod::track::dcaZ) < cfgCutDCAz); using FilteredCollisions = soa::Filtered>; - using FilteredTracks = soa::Filtered>; + using FilteredTracks = soa::Filtered>; using FilteredTracksWithMCLabels = soa::Filtered>; // Filter for MCParticle @@ -160,6 +171,15 @@ struct DiHadronCor { SameEvent = 1, MixedEvent = 3 }; + std::vector tofNsigmaCut; + std::vector itsNsigmaCut; + std::vector tpcNsigmaCut; + o2::aod::ITSResponse itsResponse; + enum Particles { + PIONS, + KAONS, + PROTONS + }; // persistent caches std::vector efficiencyAssociatedCache; @@ -290,6 +310,10 @@ struct DiHadronCor { same.setObject(new CorrelationContainer("sameEvent", "sameEvent", corrAxis, effAxis, userAxis)); mixed.setObject(new CorrelationContainer("mixedEvent", "mixedEvent", corrAxis, effAxis, userAxis)); + tofNsigmaCut = pidTofNsigmaCut; + itsNsigmaCut = pidItsNsigmaCut; + tpcNsigmaCut = pidTpcNsigmaCut; + LOGF(info, "End of init"); } @@ -334,6 +358,9 @@ struct DiHadronCor { template bool trackSelected(TTrack track) { + if (cfgPIDParticle && getNsigmaPID(track) != cfgPIDParticle) { + return false; + } return ((track.tpcNClsFound() >= cfgCutTPCclu) && (track.tpcNClsCrossedRows() >= cfgCutTPCCrossedRows) && (track.itsNCls() >= cfgCutITSclu)); } @@ -962,6 +989,56 @@ struct DiHadronCor { } } PROCESS_SWITCH(DiHadronCor, processOntheflyMixed, "Process on-the-fly mixed events", false); + + template + int getNsigmaPID(TTrack track) + { + // Computing Nsigma arrays for pion, kaon, and protons + std::array nSigmaTPC = {track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr()}; + std::array nSigmaTOF = {track.tofNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPr()}; + std::array nSigmaITS = {itsResponse.nSigmaITS(track), itsResponse.nSigmaITS(track), itsResponse.nSigmaITS(track)}; + int pid = -1; + + std::array nSigmaToUse = cfgPIDUseITSPID ? nSigmaITS : nSigmaTPC; // Choose which nSigma to use: TPC or ITS + std::vector detectorNsigmaCut = cfgPIDUseITSPID ? itsNsigmaCut : tpcNsigmaCut; // Choose which nSigma to use: TPC or ITS + + bool isPion, isKaon, isProton; + bool isDetectedPion = nSigmaToUse[0] < detectorNsigmaCut[0] && nSigmaToUse[0] > detectorNsigmaCut[0 + 3]; + bool isDetectedKaon = nSigmaToUse[1] < detectorNsigmaCut[1] && nSigmaToUse[1] > detectorNsigmaCut[1 + 3]; + bool isDetectedProton = nSigmaToUse[2] < detectorNsigmaCut[2] && nSigmaToUse[2] > detectorNsigmaCut[2 + 3]; + + bool isTofPion = nSigmaTOF[0] < tofNsigmaCut[0] && nSigmaTOF[0] > tofNsigmaCut[0 + 3]; + bool isTofKaon = nSigmaTOF[1] < tofNsigmaCut[1] && nSigmaTOF[1] > tofNsigmaCut[1 + 3]; + bool isTofProton = nSigmaTOF[2] < tofNsigmaCut[2] && nSigmaTOF[2] > tofNsigmaCut[2 + 3]; + + if (track.pt() > cfgPIDTofPtCut && !track.hasTOF()) { + return 0; + } else if (track.pt() > cfgPIDTofPtCut && track.hasTOF()) { + isPion = isTofPion && isDetectedPion; + isKaon = isTofKaon && isDetectedKaon; + isProton = isTofProton && isDetectedProton; + } else { + isPion = isDetectedPion; + isKaon = isDetectedKaon; + isProton = isDetectedProton; + } + + if ((isPion && isKaon) || (isPion && isProton) || (isKaon && isProton)) { + return 0; // more than one particle satisfy the criteria + } + + if (isPion) { + pid = PIONS; + } else if (isKaon) { + pid = KAONS; + } else if (isProton) { + pid = PROTONS; + } else { + return 0; // no particle satisfies the criteria + } + + return pid + 1; // shift the pid by 1, 1 = pion, 2 = kaon, 3 = proton + } }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From f5814ff0f78c0917931271dea663c889375fead4 Mon Sep 17 00:00:00 2001 From: Jesper Karlsson Gumprecht <113693781+jesgum@users.noreply.github.com> Date: Thu, 24 Jul 2025 17:53:10 +0200 Subject: [PATCH 043/345] [Common] Update centrality task with run dependant histograms (#12209) --- Common/DataModel/Multiplicity.h | 1 + Common/Tasks/centralityStudy.cxx | 191 ++++++++++++++++++++++++++----- 2 files changed, 164 insertions(+), 28 deletions(-) diff --git a/Common/DataModel/Multiplicity.h b/Common/DataModel/Multiplicity.h index 0ac2a0074c6..d2db60732f2 100644 --- a/Common/DataModel/Multiplicity.h +++ b/Common/DataModel/Multiplicity.h @@ -125,6 +125,7 @@ DECLARE_SOA_TABLE(MFTMults, "AOD", "MFTMULT", //! Multiplicity with MFT mult::MFTNalltracks, mult::MFTNtracks); using BarrelMults = soa::Join; using Mults = soa::Join; +using MultsRun3 = soa::Join; using FT0Mult = FT0Mults::iterator; using MFTMult = MFTMults::iterator; using Mult = Mults::iterator; diff --git a/Common/Tasks/centralityStudy.cxx b/Common/Tasks/centralityStudy.cxx index 0ada553645d..a24b4410c12 100644 --- a/Common/Tasks/centralityStudy.cxx +++ b/Common/Tasks/centralityStudy.cxx @@ -30,18 +30,23 @@ #include "TH2F.h" #include "TProfile.h" +#include #include using namespace o2; using namespace o2::framework; using BCsWithRun3Matchings = soa::Join; +#define getHist(type, name) std::get>(histPointers[name]) struct centralityStudy { // Raw multiplicities HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + std::map histPointers; + std::string histPath; Service ccdb; ctpRateFetcher mRateFetcher; + int mRunNumber; // Configurables Configurable do2DPlots{"do2DPlots", true, "0 - no, 1 - yes"}; @@ -50,6 +55,7 @@ struct centralityStudy { Configurable doOccupancyStudyVsCentrality3d{"doOccupancyStudyVsCentrality3d", false, "0 - no, 1 - yes"}; Configurable doOccupancyStudyVsRawValues3d{"doOccupancyStudyVsRawValues3d", false, "0 - no, 1 - yes"}; Configurable doTimeStudies{"doTimeStudies", true, "0 - no, 1 - yes"}; + Configurable doTimeStudyFV0AOuterVsFT0A3d{"doTimeStudyFV0AOuterVsFT0A3d", false, "0 - no, 1 - yes"}; Configurable doNGlobalTracksVsRawSignals{"doNGlobalTracksVsRawSignals", true, "0 - no, 1 - yes"}; Configurable applySel8{"applySel8", true, "0 - no, 1 - yes"}; Configurable applyVtxZ{"applyVtxZ", true, "0 - no, 1 - yes"}; @@ -85,6 +91,7 @@ struct centralityStudy { Configurable pathGRPECSObject{"pathGRPECSObject", "GLO/Config/GRPECS", "Path to GRPECS object"}; Configurable irSource{"irSource", "ZNC hadronic", "Source of the interaction rate: (Recommended: pp --> T0VTX, Pb-Pb --> ZNC hadronic)"}; Configurable irCrashOnNull{"irCrashOnNull", false, "Flag to avoid CTP RateFetcher crash."}; + Configurable irDoRateVsTime{"irDoRateVsTime", true, "Do IR plots"}; // _______________________________________ // upc rejection criteria @@ -129,8 +136,10 @@ struct centralityStudy { ConfigurableAxis axisCentrality{"axisCentrality", {100, 0, 100}, "FT0C percentile"}; ConfigurableAxis axisPVChi2{"axisPVChi2", {300, 0, 30}, "FT0C percentile"}; ConfigurableAxis axisDeltaTime{"axisDeltaTime", {300, 0, 300}, "#Delta time"}; + ConfigurableAxis axisDeltaTimestamp{"axisDeltaTimestamp", {1440, 0, 24}, "#Delta timestamp - sor (hours)"}; ConfigurableAxis axisInteractionRate{"axisInteractionRate", {500, 0, 100}, "Binning for the interaction rate (kHz)"}; + ConfigurableAxis axisMultCoarseFV0A{"axisMultCoarseFV0A", {350, 0, 70000}, "FV0A amplitude"}; // For profile Z ConfigurableAxis axisPVz{"axisPVz", {400, -20.0f, +20.0f}, "PVz (cm)"}; @@ -250,17 +259,90 @@ struct centralityStudy { ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); ccdb->setFatalWhenNull(false); + if (doTimeStudyFV0AOuterVsFT0A3d) { + histos.add((histPath + "h3dFV0AVsTime").c_str(), "", {kTH3F, {{axisDeltaTimestamp, axisMultCoarseFV0A, axisMultCoarseFV0A}}}); + } + } + } - histos.add("hFT0AvsTime", "hFT0AvsTime", kTH2F, {axisDeltaTimestamp, axisMultFT0A}); - histos.add("hFT0CvsTime", "hFT0CvsTime", kTH2F, {axisDeltaTimestamp, axisMultFT0C}); - histos.add("hFT0MvsTime", "hFT0MvsTime", kTH2F, {axisDeltaTimestamp, axisMultFT0M}); - histos.add("hFV0AvsTime", "hFV0AvsTime", kTH2F, {axisDeltaTimestamp, axisMultFV0A}); - histos.add("hMFTTracksvsTime", "hMFTTracksvsTime", kTH2F, {axisDeltaTimestamp, axisMultMFTTracks}); - histos.add("hNGlobalVsTime", "hNGlobalVsTime", kTH2F, {axisDeltaTimestamp, axisMultGlobalTracks}); - histos.add("hNTPVContributorsvsTime", "hNTPVContributorsvsTime", kTH2F, {axisDeltaTimestamp, axisMultPVContributors}); - histos.add("hIRProfileVsTime", "hIRProfileVsTime", kTProfile, {axisDeltaTimestamp}); - histos.add("hPVzProfileCoVsTime", "hPVzProfileCoVsTime", kTProfile, {axisDeltaTimestamp}); - histos.add("hPVzProfileBcVsTime", "hPVzProfileBcVsTime", kTProfile, {axisDeltaTimestamp}); + template + void initRun(TCollision collision) + { + if (mRunNumber == collision.multRunNumber()) { + return; + } + + mRunNumber = collision.multRunNumber(); + histPath = std::format("Run_{}/", mRunNumber); + + if (doprocessCollisions || doprocessCollisionsWithCentrality) { + histPointers.insert({histPath + "hCollisionSelection", histos.add((histPath + "hCollisionSelection").c_str(), "hCollisionSelection", {kTH1D, {{20, -0.5f, +19.5f}}})}); + getHist(TH1, histPath + "hCollisionSelection")->GetXaxis()->SetBinLabel(1, "All collisions"); + getHist(TH1, histPath + "hCollisionSelection")->GetXaxis()->SetBinLabel(2, "sel8 cut"); + getHist(TH1, histPath + "hCollisionSelection")->GetXaxis()->SetBinLabel(3, "posZ cut"); + getHist(TH1, histPath + "hCollisionSelection")->GetXaxis()->SetBinLabel(4, "kNoITSROFrameBorder"); + getHist(TH1, histPath + "hCollisionSelection")->GetXaxis()->SetBinLabel(5, "kNoTimeFrameBorder"); + getHist(TH1, histPath + "hCollisionSelection")->GetXaxis()->SetBinLabel(6, "kIsVertexITSTPC"); + getHist(TH1, histPath + "hCollisionSelection")->GetXaxis()->SetBinLabel(7, "kIsGoodZvtxFT0vsPV"); + getHist(TH1, histPath + "hCollisionSelection")->GetXaxis()->SetBinLabel(8, "kIsVertexTOFmatched"); + getHist(TH1, histPath + "hCollisionSelection")->GetXaxis()->SetBinLabel(9, "kIsVertexTRDmatched"); + getHist(TH1, histPath + "hCollisionSelection")->GetXaxis()->SetBinLabel(10, "kNoSameBunchPileup"); + getHist(TH1, histPath + "hCollisionSelection")->GetXaxis()->SetBinLabel(11, "Neighbour rejection"); + getHist(TH1, histPath + "hCollisionSelection")->GetXaxis()->SetBinLabel(12, "no ITS in-ROF pileup (standard)"); + getHist(TH1, histPath + "hCollisionSelection")->GetXaxis()->SetBinLabel(13, "no ITS in-ROF pileup (strict)"); + + histPointers.insert({histPath + "hFT0C_Collisions", histos.add((histPath + "hFT0C_Collisions").c_str(), "hFT0C_Collisions", {kTH1D, {{axisMultUltraFineFT0C}}})}); + histPointers.insert({histPath + "hFT0M_Collisions", histos.add((histPath + "hFT0M_Collisions").c_str(), "hFT0M_Collisions", {kTH1D, {{axisMultUltraFineFT0M}}})}); + histPointers.insert({histPath + "hFV0A_Collisions", histos.add((histPath + "hFV0A_Collisions").c_str(), "hFV0A_Collisions", {kTH1D, {{axisMultUltraFineFV0A}}})}); + histPointers.insert({histPath + "hNGlobalTracks", histos.add((histPath + "hNGlobalTracks").c_str(), "hNGlobalTracks", {kTH1D, {{axisMultUltraFineGlobalTracks}}})}); + histPointers.insert({histPath + "hNMFTTracks", histos.add((histPath + "hNMFTTracks").c_str(), "hNMFTTracks", {kTH1D, {{axisMultUltraFineMFTTracks}}})}); + histPointers.insert({histPath + "hNPVContributors", histos.add((histPath + "hNPVContributors").c_str(), "hNPVContributors", {kTH1D, {{axisMultUltraFinePVContributors}}})}); + + histPointers.insert({histPath + "hFT0CvsPVz_Collisions_All", histos.add((histPath + "hFT0CvsPVz_Collisions_All").c_str(), "hFT0CvsPVz_Collisions_All", {kTProfile, {{axisPVz}}})}); + histPointers.insert({histPath + "hFT0CvsPVz_Collisions", histos.add((histPath + "hFT0CvsPVz_Collisions").c_str(), "hFT0CvsPVz_Collisions", {kTProfile, {{axisPVz}}})}); + histPointers.insert({histPath + "hFV0AvsPVz_Collisions", histos.add((histPath + "hFV0AvsPVz_Collisions").c_str(), "hFV0AvsPVz_Collisions", {kTProfile, {{axisPVz}}})}); + histPointers.insert({histPath + "hNGlobalTracksvsPVz_Collisions", histos.add((histPath + "hNGlobalTracksvsPVz_Collisions").c_str(), "hNGlobalTracksvsPVz_Collisions", {kTProfile, {{axisPVz}}})}); + histPointers.insert({histPath + "hNMFTTracksvsPVz_Collisions", histos.add((histPath + "hNMFTTracksvsPVz_Collisions").c_str(), "hNMFTTracksvsPVz_Collisions", {kTProfile, {{axisPVz}}})}); + } + + if (do2DPlots) { + histPointers.insert({histPath + "hNContribsVsFT0C", histos.add((histPath + "hNContribsVsFT0C").c_str(), "hNContribsVsFT0C", {kTH2F, {{axisMultFT0C, axisMultPVContributors}}})}); + histPointers.insert({histPath + "hNContribsVsFV0A", histos.add((histPath + "hNContribsVsFV0A").c_str(), "hNContribsVsFV0A", {kTH2F, {{axisMultFV0A, axisMultPVContributors}}})}); + histPointers.insert({histPath + "hMatchedVsITSOnly", histos.add((histPath + "hMatchedVsITSOnly").c_str(), "hMatchedVsITSOnly", {kTH2F, {{axisMultITSOnly, axisMultITSTPC}}})}); + + // 2d correlation of fit signals + histPointers.insert({histPath + "hFT0AVsFT0C", histos.add((histPath + "hFT0AVsFT0C").c_str(), "hFT0AVsFT0C", {kTH2F, {{axisMultFT0C, axisMultFT0A}}})}); + histPointers.insert({histPath + "hFV0AVsFT0C", histos.add((histPath + "hFV0AVsFT0C").c_str(), "hFV0AVsFT0C", {kTH2F, {{axisMultFT0C, axisMultFV0A}}})}); + histPointers.insert({histPath + "hFDDAVsFT0C", histos.add((histPath + "hFDDAVsFT0C").c_str(), "hFDDAVsFT0C", {kTH2F, {{axisMultFT0C, axisMultFDDA}}})}); + histPointers.insert({histPath + "hFDDCVsFT0C", histos.add((histPath + "hFDDCVsFT0C").c_str(), "hFDDCVsFT0C", {kTH2F, {{axisMultFT0C, axisMultFDDC}}})}); + } + + if (doprocessCollisionsWithCentrality) { + // in case requested: do vs centrality debugging + histPointers.insert({histPath + "hCentrality", histos.add((histPath + "hCentrality").c_str(), "hCentrality", {kTH1F, {{axisCentrality}}})}); + histPointers.insert({histPath + "hNContribsVsCentrality", histos.add((histPath + "hNContribsVsCentrality").c_str(), "hNContribsVsCentrality", {kTH2F, {{axisCentrality, axisMultPVContributors}}})}); + histPointers.insert({histPath + "hNITSTPCTracksVsCentrality", histos.add((histPath + "hNITSTPCTracksVsCentrality").c_str(), "hNITSTPCTracksVsCentrality", {kTH2F, {{axisCentrality, axisMultPVContributors}}})}); + histPointers.insert({histPath + "hNITSOnlyTracksVsCentrality", histos.add((histPath + "hNITSOnlyTracksVsCentrality").c_str(), "hNITSOnlyTracksVsCentrality", {kTH2F, {{axisCentrality, axisMultPVContributors}}})}); + histPointers.insert({histPath + "hNGlobalTracksVsCentrality", histos.add((histPath + "hNGlobalTracksVsCentrality").c_str(), "hNGlobalTracksVsCentrality", {kTH2F, {{axisCentrality, axisMultPVContributors}}})}); + histPointers.insert({histPath + "hNMFTTracksVsCentrality", histos.add((histPath + "hNMFTTracksVsCentrality").c_str(), "hNMFTTracksVsCentrality", {kTH2F, {{axisCentrality, axisMultMFTTracks}}})}); + histPointers.insert({histPath + "hPVChi2VsCentrality", histos.add((histPath + "hPVChi2VsCentrality").c_str(), "hPVChi2VsCentrality", {kTH2F, {{axisCentrality, axisPVChi2}}})}); + histPointers.insert({histPath + "hDeltaTimeVsCentrality", histos.add((histPath + "hDeltaTimeVsCentrality").c_str(), "hDeltaTimeVsCentrality", {kTH2F, {{axisCentrality, axisDeltaTime}}})}); + } + + if (doTimeStudies) { + histPointers.insert({histPath + "hFT0AVsTime", histos.add((histPath + "hFT0AVsTime").c_str(), "hFT0AVsTime", {kTH2D, {{axisDeltaTimestamp, axisMultFT0A}}})}); + histPointers.insert({histPath + "hFT0CVsTime", histos.add((histPath + "hFT0CVsTime").c_str(), "hFT0CVsTime", {kTH2D, {{axisDeltaTimestamp, axisMultFT0C}}})}); + histPointers.insert({histPath + "hFT0MVsTime", histos.add((histPath + "hFT0MVsTime").c_str(), "hFT0MVsTime", {kTH2D, {{axisDeltaTimestamp, axisMultFT0M}}})}); + histPointers.insert({histPath + "hFV0AVsTime", histos.add((histPath + "hFV0AVsTime").c_str(), "hFV0AVsTime", {kTH2D, {{axisDeltaTimestamp, axisMultFV0A}}})}); + histPointers.insert({histPath + "hFV0AOuterVsTime", histos.add((histPath + "hFV0AOuterVsTime").c_str(), "hFV0AOuterVsTime", {kTH2D, {{axisDeltaTimestamp, axisMultFV0A}}})}); + histPointers.insert({histPath + "hMFTTracksVsTime", histos.add((histPath + "hMFTTracksVsTime").c_str(), "hMFTTracksVsTime", {kTH2D, {{axisDeltaTimestamp, axisMultMFTTracks}}})}); + histPointers.insert({histPath + "hNGlobalVsTime", histos.add((histPath + "hNGlobalVsTime").c_str(), "hNGlobalVsTime", {kTH2D, {{axisDeltaTimestamp, axisMultGlobalTracks}}})}); + histPointers.insert({histPath + "hNTPVContributorsVsTime", histos.add((histPath + "hNTPVContributorsVsTime").c_str(), "hNTPVContributorsVsTime", {kTH2D, {{axisDeltaTimestamp, axisMultPVContributors}}})}); + histPointers.insert({histPath + "hPVzProfileCoVsTime", histos.add((histPath + "hPVzProfileCoVsTime").c_str(), "hPVzProfileCoVsTime", {kTProfile, {{axisDeltaTimestamp}}})}); + histPointers.insert({histPath + "hPVzProfileBcVsTime", histos.add((histPath + "hPVzProfileBcVsTime").c_str(), "hPVzProfileBcVsTime", {kTProfile, {{axisDeltaTimestamp}}})}); + if (irDoRateVsTime) { + histPointers.insert({histPath + "hIRProfileVsTime", histos.add((histPath + "hIRProfileVsTime").c_str(), "hIRProfileVsTime", {kTProfile, {{axisDeltaTimestamp}}})}); + } } } @@ -268,13 +350,19 @@ struct centralityStudy { void genericProcessCollision(TCollision collision) // process this collisions { + initRun(collision); histos.fill(HIST("hCollisionSelection"), 0); // all collisions + getHist(TH1, histPath + "hCollisionSelection")->Fill(0); + if (applySel8 && !collision.multSel8()) return; histos.fill(HIST("hCollisionSelection"), 1); + getHist(TH1, histPath + "hCollisionSelection")->Fill(1); + if (applyVtxZ && TMath::Abs(collision.multPVz()) > 10) return; histos.fill(HIST("hCollisionSelection"), 2); + getHist(TH1, histPath + "hCollisionSelection")->Fill(2); // _______________________________________________________ // Extra event selections start here @@ -282,36 +370,43 @@ struct centralityStudy { return; } histos.fill(HIST("hCollisionSelection"), 3 /* Not at ITS ROF border */); + getHist(TH1, histPath + "hCollisionSelection")->Fill(3); if (rejectTFBorder && !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { return; } histos.fill(HIST("hCollisionSelection"), 4 /* Not at TF border */); + getHist(TH1, histPath + "hCollisionSelection")->Fill(4); if (requireIsVertexITSTPC && !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { return; } histos.fill(HIST("hCollisionSelection"), 5 /* Contains at least one ITS-TPC track */); + getHist(TH1, histPath + "hCollisionSelection")->Fill(5); if (requireIsGoodZvtxFT0VsPV && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { return; } histos.fill(HIST("hCollisionSelection"), 6 /* PV position consistency check */); + getHist(TH1, histPath + "hCollisionSelection")->Fill(6); if (requireIsVertexTOFmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTOFmatched)) { return; } histos.fill(HIST("hCollisionSelection"), 7 /* PV with at least one contributor matched with TOF */); + getHist(TH1, histPath + "hCollisionSelection")->Fill(7); if (requireIsVertexTRDmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTRDmatched)) { return; } histos.fill(HIST("hCollisionSelection"), 8 /* PV with at least one contributor matched with TRD */); + getHist(TH1, histPath + "hCollisionSelection")->Fill(8); if (rejectSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { return; } histos.fill(HIST("hCollisionSelection"), 9 /* Not at same bunch pile-up */); + getHist(TH1, histPath + "hCollisionSelection")->Fill(9); // do this only if information is available if constexpr (requires { collision.timeToNext(); }) { @@ -323,27 +418,32 @@ struct centralityStudy { return; } histos.fill(HIST("hCollisionSelection"), 10 /* has suspicious neighbour */); + getHist(TH1, histPath + "hCollisionSelection")->Fill(10); } if (rejectITSinROFpileupStandard && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStandard)) { return; } histos.fill(HIST("hCollisionSelection"), 11 /* Not ITS ROF pileup (standard) */); + getHist(TH1, histPath + "hCollisionSelection")->Fill(11); if (rejectITSinROFpileupStrict && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStrict)) { return; } histos.fill(HIST("hCollisionSelection"), 12 /* Not ITS ROF pileup (strict) */); + getHist(TH1, histPath + "hCollisionSelection")->Fill(12); if (selectUPCcollisions && collision.flags() < 1) { // if zero then NOT upc, otherwise UPC return; } histos.fill(HIST("hCollisionSelection"), 13 /* is UPC event */); + getHist(TH1, histPath + "hCollisionSelection")->Fill(13); if (rejectCollInTimeRangeNarrow && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeNarrow)) { return; } histos.fill(HIST("hCollisionSelection"), 14 /* Not ITS ROF pileup (strict) */); + getHist(TH1, histPath + "hCollisionSelection")->Fill(14); if (collision.multFT0C() < upcRejection.maxFT0CforZNACselection && collision.multZNA() < upcRejection.minZNACsignal && @@ -359,6 +459,7 @@ struct centralityStudy { return; } histos.fill(HIST("hCollisionSelection"), 15 /* pass em/upc rejection */); + getHist(TH1, histPath + "hCollisionSelection")->Fill(15); // if we got here, we also finally fill the FT0C histogram, please histos.fill(HIST("hNPVContributors"), collision.multNTracksPV()); @@ -371,19 +472,39 @@ struct centralityStudy { histos.fill(HIST("hFV0AvsPVz_Collisions"), collision.multPVz(), collision.multFV0A() * scaleSignalFV0A); histos.fill(HIST("hNGlobalTracksvsPVz_Collisions"), collision.multPVz(), collision.multNTracksGlobal()); histos.fill(HIST("hNMFTTracksvsPVz_Collisions"), collision.multPVz(), collision.mftNtracks()); + + getHist(TH1, histPath + "hNPVContributors")->Fill(collision.multNTracksPV()); + getHist(TH1, histPath + "hFT0C_Collisions")->Fill(collision.multFT0C() * scaleSignalFT0C); + getHist(TH1, histPath + "hFT0M_Collisions")->Fill((collision.multFT0A() + collision.multFT0C()) * scaleSignalFT0M); + getHist(TH1, histPath + "hFV0A_Collisions")->Fill(collision.multFV0A() * scaleSignalFV0A); + getHist(TH1, histPath + "hNGlobalTracks")->Fill(collision.multNTracksGlobal()); + getHist(TH1, histPath + "hNMFTTracks")->Fill(collision.mftNtracks()); + getHist(TProfile, histPath + "hFT0CvsPVz_Collisions_All")->Fill(collision.multPVz(), collision.multFT0C() * scaleSignalFT0C); + getHist(TProfile, histPath + "hFV0AvsPVz_Collisions")->Fill(collision.multPVz(), collision.multFV0A() * scaleSignalFV0A); + getHist(TProfile, histPath + "hNGlobalTracksvsPVz_Collisions")->Fill(collision.multPVz(), collision.multNTracksGlobal()); + getHist(TProfile, histPath + "hNMFTTracksvsPVz_Collisions")->Fill(collision.multPVz(), collision.mftNtracks()); + if (collision.multFT0C() > minFT0CforVertexZ) { histos.fill(HIST("hFT0CvsPVz_Collisions"), collision.multPVz(), collision.multFT0C() * scaleSignalFT0C); + getHist(TProfile, histPath + "hFT0CvsPVz_Collisions")->Fill(collision.multPVz(), collision.multFT0C() * scaleSignalFT0C); } if (do2DPlots) { histos.fill(HIST("hNContribsVsFT0C"), collision.multFT0C() * scaleSignalFT0C, collision.multPVTotalContributors()); histos.fill(HIST("hNContribsVsFV0A"), collision.multFV0A() * scaleSignalFV0A, collision.multPVTotalContributors()); histos.fill(HIST("hMatchedVsITSOnly"), collision.multNTracksITSOnly(), collision.multNTracksITSTPC()); + getHist(TH2, histPath + "hNContribsVsFT0C")->Fill(collision.multFT0C() * scaleSignalFT0C, collision.multPVTotalContributors()); + getHist(TH2, histPath + "hNContribsVsFV0A")->Fill(collision.multFV0A() * scaleSignalFV0A, collision.multPVTotalContributors()); + getHist(TH2, histPath + "hMatchedVsITSOnly")->Fill(collision.multNTracksITSOnly(), collision.multNTracksITSTPC()); // correlate also FIT detector signals histos.fill(HIST("hFT0AVsFT0C"), collision.multFT0C() * scaleSignalFT0C, collision.multFT0A()); histos.fill(HIST("hFV0AVsFT0C"), collision.multFT0C() * scaleSignalFT0C, collision.multFV0A()); histos.fill(HIST("hFDDAVsFT0C"), collision.multFT0C() * scaleSignalFT0C, collision.multFDDA()); histos.fill(HIST("hFDDCVsFT0C"), collision.multFT0C() * scaleSignalFT0C, collision.multFDDC()); + getHist(TH2, histPath + "hFT0AVsFT0C")->Fill(collision.multFT0C() * scaleSignalFT0C, collision.multFT0A()); + getHist(TH2, histPath + "hFV0AVsFT0C")->Fill(collision.multFT0C() * scaleSignalFT0C, collision.multFV0A()); + getHist(TH2, histPath + "hFDDAVsFT0C")->Fill(collision.multFT0C() * scaleSignalFT0C, collision.multFDDA()); + getHist(TH2, histPath + "hFDDCVsFT0C")->Fill(collision.multFT0C() * scaleSignalFT0C, collision.multFDDC()); } if (doOccupancyStudyVsCentrality2d) { @@ -422,6 +543,13 @@ struct centralityStudy { histos.fill(HIST("hNGlobalTracksVsCentrality"), collision.centFT0C(), collision.multNTracksGlobal()); histos.fill(HIST("hNMFTTracksVsCentrality"), collision.centFT0C(), collision.mftNtracks()); histos.fill(HIST("hPVChi2VsCentrality"), collision.centFT0C(), collision.multPVChi2()); + getHist(TH1, histPath + "hCentrality")->Fill(collision.centFT0C()); + getHist(TH2, histPath + "hNContribsVsCentrality")->Fill(collision.centFT0C(), collision.multPVTotalContributors()); + getHist(TH2, histPath + "hNITSTPCTracksVsCentrality")->Fill(collision.centFT0C(), collision.multNTracksITSTPC()); + getHist(TH2, histPath + "hNITSOnlyTracksVsCentrality")->Fill(collision.centFT0C(), collision.multNTracksITSOnly()); + getHist(TH2, histPath + "hNGlobalTracksVsCentrality")->Fill(collision.centFT0C(), collision.multNTracksGlobal()); + getHist(TH2, histPath + "hNMFTTracksVsCentrality")->Fill(collision.centFT0C(), collision.mftNtracks()); + getHist(TH2, histPath + "hPVChi2VsCentrality")->Fill(collision.centFT0C(), collision.multPVChi2()); if (doOccupancyStudyVsCentrality2d) { histos.fill(HIST("hNcontribsProfileVsTrackOccupancyVsCentrality"), collision.trackOccupancyInTimeRange(), collision.centFT0C(), collision.multPVTotalContributors()); @@ -439,43 +567,50 @@ struct centralityStudy { } if (doTimeStudies && collision.has_multBC()) { + initRun(collision); auto multbc = collision.template multBC_as(); uint64_t bcTimestamp = multbc.timestamp(); o2::parameters::GRPECSObject* grpo = ccdb->getForTimeStamp(pathGRPECSObject, bcTimestamp); uint64_t startOfRunTimestamp = grpo->getTimeStart(); - float hoursAfterStartOfRun = static_cast(bcTimestamp - startOfRunTimestamp) / 3600000.0; - float interactionRate = mRateFetcher.fetch(ccdb.service, bcTimestamp, collision.multRunNumber(), irSource.value, irCrashOnNull) / 1000.; // kHz - - histos.fill(HIST("hFT0AvsTime"), hoursAfterStartOfRun, collision.multFT0A()); - histos.fill(HIST("hFT0CvsTime"), hoursAfterStartOfRun, collision.multFT0C()); - histos.fill(HIST("hFT0MvsTime"), hoursAfterStartOfRun, collision.multFT0M()); - histos.fill(HIST("hFV0AvsTime"), hoursAfterStartOfRun, collision.multFV0A()); - histos.fill(HIST("hMFTTracksvsTime"), hoursAfterStartOfRun, collision.mftNtracks()); - histos.fill(HIST("hNGlobalVsTime"), hoursAfterStartOfRun, collision.multNTracksGlobal()); - histos.fill(HIST("hNTPVContributorsvsTime"), hoursAfterStartOfRun, collision.multPVTotalContributors()); - histos.fill(HIST("hPVzProfileCoVsTime"), hoursAfterStartOfRun, collision.multPVz()); - histos.fill(HIST("hPVzProfileBcVsTime"), hoursAfterStartOfRun, multbc.multFT0PosZ()); - histos.fill(HIST("hIRProfileVsTime"), hoursAfterStartOfRun, interactionRate); + + getHist(TH2, histPath + "hFT0AVsTime")->Fill(hoursAfterStartOfRun, collision.multFT0A()); + getHist(TH2, histPath + "hFT0CVsTime")->Fill(hoursAfterStartOfRun, collision.multFT0C()); + getHist(TH2, histPath + "hFT0MVsTime")->Fill(hoursAfterStartOfRun, collision.multFT0M()); + getHist(TH2, histPath + "hFV0AVsTime")->Fill(hoursAfterStartOfRun, collision.multFV0A()); + getHist(TH2, histPath + "hFV0AOuterVsTime")->Fill(hoursAfterStartOfRun, collision.multFV0AOuter()); + getHist(TH2, histPath + "hMFTTracksVsTime")->Fill(hoursAfterStartOfRun, collision.mftNtracks()); + getHist(TH2, histPath + "hNGlobalVsTime")->Fill(hoursAfterStartOfRun, collision.multNTracksGlobal()); + getHist(TH2, histPath + "hNTPVContributorsVsTime")->Fill(hoursAfterStartOfRun, collision.multPVTotalContributors()); + getHist(TProfile, histPath + "hPVzProfileCoVsTime")->Fill(hoursAfterStartOfRun, collision.multPVz()); + getHist(TProfile, histPath + "hPVzProfileBcVsTime")->Fill(hoursAfterStartOfRun, multbc.multFT0PosZ()); + if (doTimeStudyFV0AOuterVsFT0A3d) { + histos.fill(HIST("h3dFV0AVsTime"), hoursAfterStartOfRun, collision.multFV0A(), collision.multFV0AOuter()); + } + + if (irDoRateVsTime) { + float interactionRate = mRateFetcher.fetch(ccdb.service, bcTimestamp, mRunNumber, irSource.value, irCrashOnNull) / 1000.; // kHz + getHist(TProfile, histPath + "hIRProfileVsTime")->Fill(hoursAfterStartOfRun, interactionRate); + } } } - void processCollisions(soa::Join::iterator const& collision, aod::MultBCs const&) + void processCollisions(soa::Join::iterator const& collision, aod::MultBCs const&) { genericProcessCollision(collision); } - void processCollisionsWithCentrality(soa::Join::iterator const& collision, aod::MultBCs const&) + void processCollisionsWithCentrality(soa::Join::iterator const& collision, aod::MultBCs const&) { genericProcessCollision(collision); } - void processCollisionsWithCentralityWithNeighbours(soa::Join::iterator const& collision, aod::MultBCs const&) + void processCollisionsWithCentralityWithNeighbours(soa::Join::iterator const& collision, aod::MultBCs const&) { genericProcessCollision(collision); } - void processBCs(soa::Join::iterator const& multbc, soa::Join const&) + void processBCs(soa::Join::iterator const& multbc, soa::Join const&) { // process BCs, calculate FT0C distribution // conditionals suggested by FIT team (Jacek O. et al) @@ -530,7 +665,7 @@ struct centralityStudy { } if (multbc.has_ft0Mult()) { - auto multco = multbc.ft0Mult_as>(); + auto multco = multbc.ft0Mult_as>(); if (multbc.multFT0PosZValid()) { histos.fill(HIST("hVertexZ_BCvsCO"), multco.multPVz(), multbc.multFT0PosZ()); } From b3167c80f62aa811bba9a8ae48eac423af0cc078 Mon Sep 17 00:00:00 2001 From: arvindkhuntia <31609955+arvindkhuntia@users.noreply.github.com> Date: Thu, 24 Jul 2025 21:37:37 +0530 Subject: [PATCH 044/345] [PWGJE] Added process function for inc particles (#12172) Co-authored-by: Arvind Khuntia --- PWGJE/Tasks/nucleiInJets.cxx | 282 ++++++++++++++++++++++++++++++++++- 1 file changed, 276 insertions(+), 6 deletions(-) diff --git a/PWGJE/Tasks/nucleiInJets.cxx b/PWGJE/Tasks/nucleiInJets.cxx index 4873e892054..298850f5bf5 100644 --- a/PWGJE/Tasks/nucleiInJets.cxx +++ b/PWGJE/Tasks/nucleiInJets.cxx @@ -112,6 +112,7 @@ struct nucleiInJets { Configurable isWithJetEvents{"isWithJetEvents", true, "Events with at least one jet"}; Configurable isWithLeadingJet{"isWithLeadingJet", true, "Events with leading jet"}; Configurable useLfTpcPid{"useLfTpcPid", true, "Events with custom TPC parameters"}; + Configurable centralityType{"centralityType", 0, "0: FT0M, 1: FT0C, 2: FV0A"}; Configurable cfgtrkMinPt{"cfgtrkMinPt", 0.15, "set track min pT"}; Configurable cfgtrkMaxEta{"cfgtrkMaxEta", 0.8, "set track max Eta"}; @@ -178,7 +179,9 @@ struct nucleiInJets { static constexpr int PDGTriton = 1000010030; static constexpr int PDGHelium = 1000020030; - using EventCandidates = soa::Join; // , aod::CentFT0Ms, aod::CentFT0As, aod::CentFT0Cs + // using EventTable = soa::Join; + using EventTable = aod::JetCollisions; + using EventTableMC = soa::Join; using TrackCandidates = soa::Join; @@ -190,6 +193,11 @@ struct nucleiInJets { aod::pidTOFFullKa, aod::pidTOFFullPr, aod::pidTOFFullDe, aod::pidTOFFullTr, aod::pidTOFFullHe, aod::TOFSignal /*, aod::McTrackLabels*/>; + using TrackCandidatesIncMC = soa::Join; + Filter jetCuts = aod::jet::pt > cfgjetPtMin&& aod::jet::r == nround(cfgjetR.node() * 100.0f); using chargedJetstrack = soa::Filtered>; @@ -203,7 +211,6 @@ struct nucleiInJets { OutputObj zorroSummary{"zorroSummary"}; Service ccdb; TRandom3 randUniform; - void init(o2::framework::InitContext&) { @@ -214,6 +221,7 @@ struct nucleiInJets { const AxisSpec PtJetAxis = {100, 0, 100.0}; const AxisSpec MultAxis = {100, 0, 100}; const AxisSpec dRAxis = {100, 0, 3.6}; + const AxisSpec CentAxis = {100, 0, 100}; const AxisSpec dcaxyAxis{binsDCA, "DCAxy (cm)"}; const AxisSpec dcazAxis{binsDCA, "DCAz (cm)"}; const AxisSpec dedxAxis{binsdEdx, "d#it{E}/d#it{x} A.U."}; @@ -233,6 +241,17 @@ struct nucleiInJets { jetHist.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(4, "Sel8+|Vz|<10"); jetHist.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(5, "nJets>0"); + jetHist.add("hNEventsInc", "hNEventsInc", {HistType::kTH1D, {{4, 0.f, 4.f}}}); + jetHist.get(HIST("hNEventsInc"))->GetXaxis()->SetBinLabel(1, "All"); + jetHist.get(HIST("hNEventsInc"))->GetXaxis()->SetBinLabel(2, "Sel8"); + jetHist.get(HIST("hNEventsInc"))->GetXaxis()->SetBinLabel(3, "|Vz|<10"); + + // TPC nSigma vs pT (inclusive) + jetHist.add("tracksInc/proton/h3PtVsProtonNSigmaTPCVsPt", "pT(p) vs NSigmaTPC (p) vs centrality; #it{p}_{T} (GeV/#it{c}); NSigmaTPC; centrality", HistType::kTH3F, {PtAxis, {200, -10, 10}, CentAxis}); + jetHist.add("tracksInc/antiProton/h3PtVsantiProtonNSigmaTPCVsPt", "pT(#bar{p}) vs NSigmaTPC (#bar{p}) vs centrality; #it{p}_{T} (GeV/#it{c}); NSigmaTPC; centrality", HistType::kTH3F, {PtAxis, {200, -10, 10}, CentAxis}); + jetHist.add("tracksInc/deuteron/h3PtVsDeuteronNSigmaTPCVsPt", "pT(d) vs NSigmaTPC (d) vs centrality; #it{p}_{T} (GeV/#it{c}); NSigmaTPC; centrality", HistType::kTH3F, {PtAxis, {200, -10, 10}, CentAxis}); + jetHist.add("tracksInc/antiDeuteron/h3PtVsantiDeuteronNSigmaTPCVsPt", "pT(#bar{d}) vs NSigmaTPC (#bar{d}) vs centrality; #it{p}_{T} (GeV/#it{c}); NSigmaTPC; centrality", HistType::kTH3F, {PtAxis, {200, -10, 10}, CentAxis}); + // jet property jetHist.add("jet/h1JetPt", "jet_{p_{T}}", kTH1F, {PtJetAxis}); jetHist.add("jet/h1JetEvents", "NumbeOfJetEvents", kTH1F, {{1, 0, 1}}); @@ -396,14 +415,18 @@ struct nucleiInJets { if (cEnableProtonQA) { jetHist.add("tracks/proton/dca/after/hDCAxyVsPtProton", "DCAxy vs Pt (p)", HistType::kTH2F, {{dcaxyAxis}, {PtAxis}}); + jetHist.add("tracksInc/proton/dca/after/hDCAxyVsPtProton", "DCAxy vs Pt (p)", HistType::kTH2F, {{dcaxyAxis}, {PtAxis}}); jetHist.add("tracks/antiProton/dca/after/hDCAxyVsPtantiProton", "DCAxy vs Pt (#bar{p})", HistType::kTH2F, {{dcaxyAxis}, {PtAxis}}); jetHist.add("tracks/proton/dca/after/hDCAzVsPtProton", "DCAz vs Pt (p)", HistType::kTH2F, {{dcazAxis}, {PtAxis}}); + jetHist.add("tracksInc/proton/dca/after/hDCAzVsPtProton", "DCAz vs Pt (p)", HistType::kTH2F, {{dcazAxis}, {PtAxis}}); jetHist.add("tracks/antiProton/dca/after/hDCAzVsPtantiProton", "DCAz vs Pt (#bar{p})", HistType::kTH2F, {{dcazAxis}, {PtAxis}}); } if (cEnableDeuteronQA) { jetHist.add("tracks/deuteron/dca/after/hDCAxyVsPtDeuteron", "DCAxy vs Pt (d)", HistType::kTH2F, {{dcaxyAxis}, {PtAxis}}); + jetHist.add("tracksInc/deuteron/dca/after/hDCAxyVsPtDeuteron", "DCAxy vs Pt (d)", HistType::kTH2F, {{dcaxyAxis}, {PtAxis}}); jetHist.add("tracks/antiDeuteron/dca/after/hDCAxyVsPtantiDeuteron", "DCAxy vs Pt (#bar{d})", HistType::kTH2F, {{dcaxyAxis}, {PtAxis}}); jetHist.add("tracks/deuteron/dca/after/hDCAzVsPtDeuteron", "DCAz vs Pt (d)", HistType::kTH2F, {{dcazAxis}, {PtAxis}}); + jetHist.add("tracksInc/deuteron/dca/after/hDCAzVsPtDeuteron", "DCAz vs Pt (d)", HistType::kTH2F, {{dcazAxis}, {PtAxis}}); jetHist.add("tracks/antiDeuteron/dca/after/hDCAzVsPtantiDeuteron", "DCAz vs Pt (#bar{d})", HistType::kTH2F, {{dcazAxis}, {PtAxis}}); } if (cEnableTritonQA) { @@ -440,6 +463,21 @@ struct nucleiInJets { jetHist.add("tracks/helium/h2TOFmass2HeliumVsPt", "#Delta M^{2} (t) vs #it{p}_{T}t; TOFmass2; #it{p}_{T}/z (GeV)", HistType::kTH2F, {{massHeAxis}, {ptZHeAxis}}); jetHist.add("tracks/antiHelium/h2TOFmass2antiHeliumVsPt", "#Delta M^{2} (t) vs #it{p}_{T}; TOFmass2; #it{p}_{T}/z (GeV)", HistType::kTH2F, {{massHeAxis}, {ptZHeAxis}}); + jetHist.add("tracksInc/proton/h2TOFmassProtonVsPt", "h2TOFmassProtonVsPt; TOFmass; #it{p}_{T} (GeV)", HistType::kTH2F, {{80, 0.4, 4.}, {50, 0., 5.}}); + jetHist.add("tracksInc/antiProton/h2TOFmassantiProtonVsPt", "h2TOFmassantiProtonVsPt; TOFmass; #it{p}_{T} (GeV)", HistType::kTH2F, {{80, 0.4, 4.}, {50, 0., 5.}}); + jetHist.add("tracksInc/deuteron/h2TOFmassDeuteronVsPt", "h2TOFmassDeuteronVsPt; TOFmass; #it{p}_{T} (GeV)", HistType::kTH2F, {{80, 0.4, 4.}, {50, 0., 5.}}); + jetHist.add("tracksInc/antiDeuteron/h2TOFmassantiDeuteronVsPt", "h2TOFmassantiDeuteronVsPt; TOFmass; #it{p}_{T} (GeV)", HistType::kTH2F, {{80, 0.4, 4.}, {50, 0., 5.}}); + + jetHist.add("tracksInc/proton/h2TOFmass2ProtonVsPt", "#Delta M^{2} (t) vs #it{p}_{T}; TOFmass2; #it{p}_{T} (GeV)", HistType::kTH2F, {{massPrAxis}, {250, 0., 5.}}); + jetHist.add("tracksInc/antiProton/h2TOFmass2antiProtonVsPt", "#Delta M^{2} (t) vs #it{p}_{T}; TOFmass2; #it{p}_{T} (GeV)", HistType::kTH2F, {{massPrAxis}, {250, 0., 5.}}); + jetHist.add("tracksInc/deuteron/h2TOFmass2DeuteronVsPt", "#Delta M^{2} (t) vs #it{p}_{T}; TOFmass2; #it{p}_{T} (GeV)", HistType::kTH2F, {{massDeAxis}, {250, 0., 5.}}); + jetHist.add("tracksInc/antiDeuteron/h2TOFmass2antiDeuteronVsPt", "#Delta M^{2} (t) vs #it{p}_{T}; TOFmass2; #it{p}_{T} (GeV)", HistType::kTH2F, {{massDeAxis}, {250, 0., 5.}}); + + jetHist.add("tracksInc/proton/h2TofNsigmaProtonVsPt", "h2TofNsigmaProtonVsPt; TofNsigma; #it{p}_{T} (GeV)", HistType::kTH2F, {{100, -5, 5}, {100, 0., 10.}}); + jetHist.add("tracksInc/antiProton/h2TofNsigmaantiProtonVsPt", "h2TofNsigmaantiProtonVsPt; TofNsigma; #it{p}_{T} (GeV)", HistType::kTH2F, {{100, -5, 5}, {100, 0., 10.}}); + jetHist.add("tracksInc/deuteron/h2TofNsigmaDeuteronVsPt", "h2TofNsigmaDeuteronVsPt; TofNsigma; #it{p}_{T} (GeV)", HistType::kTH2F, {{100, -5, 5}, {100, 0., 10.}}); + jetHist.add("tracksInc/antiDeuteron/h2TofNsigmaantiDeuteronVsPt", "h2TofNsigmaantiDeuteronVsPt; TofNsigma; #it{p}_{T} (GeV)", HistType::kTH2F, {{100, -5, 5}, {100, 0., 10.}}); + // TOF hist nSigma jetHist.add("tracks/proton/h2TofNsigmaProtonVsPt", "h2TofNsigmaProtonVsPt; TofNsigma; #it{p}_{T} (GeV)", HistType::kTH2F, {{100, -5, 5}, {50, 0., 5.}}); jetHist.add("tracks/antiProton/h2TofNsigmaantiProtonVsPt", "h2TofNsigmaantiProtonVsPt; TofNsigma; #it{p}_{T} (GeV)", HistType::kTH2F, {{100, -5, 5}, {50, 0., 5.}}); @@ -451,6 +489,17 @@ struct nucleiInJets { jetHist.add("tracks/antiHelium/h2TofNsigmaantiHeliumVsPt", "h2TofNsigmaantiHeliumVsPt; TofNsigma; #it{p}_{T}/z (GeV)", HistType::kTH2F, {{100, -5, 5}, {50, 0., 5.}}); if (isMC) { + // inc + jetHist.add("recInc/eventStat", "Event statistics (inclusive)", HistType::kTH1F, {{6, 0.f, 6.f}}); + jetHist.get(HIST("recInc/eventStat"))->GetXaxis()->SetBinLabel(1, "All"); + jetHist.get(HIST("recInc/eventStat"))->GetXaxis()->SetBinLabel(2, "Sel8"); + jetHist.get(HIST("recInc/eventStat"))->GetXaxis()->SetBinLabel(3, "|Vz|<10"); + + jetHist.add("recInc/vertexZ", "vertexZ (inclusive)", HistType::kTH1F, {{100, -15.0, 15.0}}); + jetHist.add("recInc/pt/PtParticleTypeTPC", "Pt vs ParticleType vs Centrality (TPC)", HistType::kTH3F, {{100, 0.f, 10.f}, {14, -7, 7}, {100, 0, 100}}); + jetHist.add("recInc/pt/PtParticleTypeTPCTOF", "Pt vs ParticleType vs Centrality (TPC+TOF)", HistType::kTH3F, {{100, 0.f, 10.f}, {14, -7, 7}, {100, 0, 100}}); + jetHist.add("recInc/pt/PtParticleTypeTPCTOFVeto", "Pt vs ParticleType vs Centrality (TPC+TOF Veto)", HistType::kTH3F, {{100, 0.f, 10.f}, {14, -7, 7}, {100, 0, 100}}); + jetHist.add("genInc/pt/PtParticleType", "Pt vs ParticleType vs Centrality (gen)", HistType::kTH3F, {{100, 0.f, 10.f}, {14, -7, 7}, {100, 0, 100}}); // inside jet jetHist.add("tracks/mc/proton/h3PtVsProtonNSigmaTPCVsPtJet_jet", "pT(p) vs NSigmaTPC (p) vs jet pT; #it{p}_{T} (GeV/#it{c}; NSigmaTPC; p^{jet}_{T}", HistType::kTH3F, {{PtAxis}, {200, -10, 10}, {PtJetAxis}}); jetHist.add("tracks/mc/antiProton/h3PtVsantiProtonNSigmaTPCVsPtJet_jet", "pT(#bar{p}) vs NSigmaTPC (#bar{p}) vs jet pT; #it{p}_{T} (GeV/#it{c}; NSigmaTPC; p^{jet}_{T}", HistType::kTH3F, {{PtAxis}, {200, -10, 10}, {PtJetAxis}}); @@ -553,13 +602,15 @@ struct nucleiInJets { jetHist.add("eff/recmatched/pt/PtParticleTypeTPC", "Pt (p) vs jetflag vs particletype", HistType::kTH3D, {{100, 0.f, 10.f}, {2, 0, 2}, {14, -7, 7}}); jetHist.add("eff/recmatched/pt/PtParticleTypeTOF", "Pt (p) vs jetflag vs particletype", HistType::kTH3D, {{100, 0.f, 10.f}, {2, 0, 2}, {14, -7, 7}}); jetHist.add("eff/recmatched/pt/PtParticleTypeTPCTOF", "Pt (p) vs jetflag vs particletype", HistType::kTH3D, {{100, 0.f, 10.f}, {2, 0, 2}, {14, -7, 7}}); + jetHist.add("eff/recmatched/pt/PtParticleTypeTPCTOFVeto", "Pt (p) vs jetflag vs particletype", HistType::kTH3D, {{100, 0.f, 10.f}, {2, 0, 2}, {14, -7, 7}}); + jetHist.add("eff/recmatched/perpCone/pt/PtParticleType", "Pt (p) vs particletype", HistType::kTH2D, {{100, 0.f, 10.f}, {14, -7, 7}}); jetHist.add("eff/recmatched/perpCone/mcC/pt/PtParticleType", "Pt (rec) vs Pt (true) vs particletype", HistType::kTH3D, {{100, 0.f, 10.f}, {100, 0.f, 10.f}, {14, -7, 7}}); jetHist.add("eff/recmatched/perpCone/mcCSpectra/pt/PtParticleType", "Pt (rec) vs Pt (true) vs particletype", HistType::kTH3D, {{100, 0.f, 10.f}, {100, 0.f, 10.f}, {14, -7, 7}}); jetHist.add("eff/recmatched/perpCone/pt/PtParticleTypeTPC", "Pt (p) vs particletype", HistType::kTH2D, {{100, 0.f, 10.f}, {14, -7, 7}}); jetHist.add("eff/recmatched/perpCone/pt/PtParticleTypeTOF", "Pt (p) vs particletype", HistType::kTH2D, {{100, 0.f, 10.f}, {14, -7, 7}}); jetHist.add("eff/recmatched/perpCone/pt/PtParticleTypeTPCTOF", "Pt (p) vs particletype", HistType::kTH2D, {{100, 0.f, 10.f}, {14, -7, 7}}); - + jetHist.add("eff/recmatched/perpCone/pt/PtParticleTypeTPCTOFVeto", "Pt (p) vs particletype", HistType::kTH2D, {{100, 0.f, 10.f}, {14, -7, 7}}); jetHist.add("eff/recmatched/gen/pt/PtParticleType", "Pt (p) vs jetflag vs particletype", HistType::kTH3D, {{100, 0.f, 10.f}, {2, 0, 2}, {14, -7, 7}}); jetHist.add("eff/recmatched/gen/perpCone/pt/PtParticleType", "Pt (p) vs particletype", HistType::kTH2D, {{100, 0.f, 10.f}, {14, -7, 7}}); // gen matched @@ -1293,6 +1344,156 @@ struct nucleiInJets { } } + void processDataInc(EventTable::iterator const& coll, soa::Join const& tracks, TrackCandidates const&) + { + jetHist.fill(HIST("hNEventsInc"), 0.5); + + if (!jetderiveddatautilities::selectCollision(coll, jetderiveddatautilities::initialiseEventSelectionBits("sel8"))) + return; + + jetHist.fill(HIST("hNEventsInc"), 1.5); + if (std::abs(coll.posZ()) > 10) // bad vertex + return; + jetHist.fill(HIST("hNEventsInc"), 2.5); + float centrality = -999; + switch (centralityType) { + case 0: // FT0M + centrality = coll.centFT0M(); + break; + case 1: // FT0C + centrality = coll.centFT0C(); + break; + case 2: // V0A + centrality = coll.centFV0A(); + break; + default: + centrality = -999; + } + + for (const auto& track : tracks) { + auto trk = track.track_as(); + if (!isTrackSelected(trk)) { + continue; + } + if (std::fabs(trk.eta()) > cfgtrkMaxEta) + continue; + if (trk.sign() > 0) { // particle info + if (useTOFNsigmaPreSel && trk.hasTOF()) { + if (std::abs(trk.tofNSigmaPr()) < cfgnTPCPIDPrTOF) + jetHist.fill(HIST("tracksInc/proton/h3PtVsProtonNSigmaTPCVsPt"), trk.pt(), trk.tpcNSigmaPr(), centrality); + if (std::abs(trk.tofNSigmaDe()) < cfgnTPCPIDDeTOF) + jetHist.fill(HIST("tracksInc/deuteron/h3PtVsDeuteronNSigmaTPCVsPt"), trk.pt(), trk.tpcNSigmaDe(), centrality); + } else if (!useTOFNsigmaPreSel && !useTOFVeto) { + jetHist.fill(HIST("tracksInc/proton/h3PtVsProtonNSigmaTPCVsPt"), trk.pt(), trk.tpcNSigmaPr(), centrality); + jetHist.fill(HIST("tracksInc/deuteron/h3PtVsDeuteronNSigmaTPCVsPt"), trk.pt(), trk.tpcNSigmaDe(), centrality); + + } else if (!useTOFNsigmaPreSel && useTOFVeto) { + if (trk.hasTOF()) { + if (std::abs(trk.tofNSigmaPr()) < cfgnTPCPIDPrTOF) { + jetHist.fill(HIST("tracksInc/proton/h3PtVsProtonNSigmaTPCVsPt"), trk.pt(), trk.tpcNSigmaPr(), centrality); + } + } else { + jetHist.fill(HIST("tracksInc/proton/h3PtVsProtonNSigmaTPCVsPt"), trk.pt(), trk.tpcNSigmaPr(), centrality); + } + if (trk.hasTOF()) { + if (std::abs(trk.tofNSigmaDe()) < cfgnTPCPIDDeTOF) { + jetHist.fill(HIST("tracksInc/deuteron/h3PtVsDeuteronNSigmaTPCVsPt"), trk.pt(), trk.tpcNSigmaDe(), centrality); + } + } else { + jetHist.fill(HIST("tracksInc/deuteron/h3PtVsDeuteronNSigmaTPCVsPt"), trk.pt(), trk.tpcNSigmaDe(), centrality); + } + } + float massTOF = -999; + if (addTOFplots && trk.hasTOF()) { + massTOF = trk.p() * TMath::Sqrt(1.f / (trk.beta() * trk.beta()) - 1.f); + if (!useTPCpreSel) { + jetHist.fill(HIST("tracksInc/proton/h2TOFmassProtonVsPt"), massTOF, trk.pt()); + jetHist.fill(HIST("tracksInc/proton/h2TOFmass2ProtonVsPt"), massTOF * massTOF - gMassProton * gMassProton, trk.pt()); + jetHist.fill(HIST("tracksInc/proton/h2TofNsigmaProtonVsPt"), trk.tofNSigmaPr(), trk.pt()); + + jetHist.fill(HIST("tracksInc/deuteron/h2TOFmassDeuteronVsPt"), massTOF, trk.pt()); + jetHist.fill(HIST("tracksInc/deuteron/h2TOFmass2DeuteronVsPt"), massTOF * massTOF - gMassDeuteron * gMassDeuteron, trk.pt()); + jetHist.fill(HIST("tracksInc/deuteron/h2TofNsigmaDeuteronVsPt"), trk.tofNSigmaDe(), trk.pt()); + } else { + if (std::abs(trk.tpcNSigmaPr()) < cfgnTPCPIDPr) { + jetHist.fill(HIST("tracksInc/proton/h2TOFmassProtonVsPt"), massTOF, trk.pt()); + jetHist.fill(HIST("tracksInc/proton/h2TOFmass2ProtonVsPt"), massTOF * massTOF - gMassProton * gMassProton, trk.pt()); + jetHist.fill(HIST("tracksInc/proton/h2TofNsigmaProtonVsPt"), trk.tofNSigmaPr(), trk.pt()); + } + if (std::abs(trk.tpcNSigmaDe()) < cfgnTPCPIDDe) { + jetHist.fill(HIST("tracksInc/deuteron/h2TOFmassDeuteronVsPt"), massTOF, trk.pt()); + jetHist.fill(HIST("tracksInc/deuteron/h2TOFmass2DeuteronVsPt"), massTOF * massTOF - gMassDeuteron * gMassDeuteron, trk.pt()); + jetHist.fill(HIST("tracksInc/deuteron/h2TofNsigmaDeuteronVsPt"), trk.tofNSigmaDe(), trk.pt()); + } + } + } + + if (cEnableProtonQA && std::abs(trk.tpcNSigmaPr()) < cfgnTPCPIDPr) { + jetHist.fill(HIST("tracksInc/proton/dca/after/hDCAxyVsPtProton"), trk.dcaXY(), trk.pt()); + jetHist.fill(HIST("tracksInc/proton/dca/after/hDCAzVsPtProton"), trk.dcaZ(), trk.pt()); + } + if (cEnableDeuteronQA && std::abs(trk.tpcNSigmaDe()) < cfgnTPCPIDDe) { + jetHist.fill(HIST("tracksInc/deuteron/dca/after/hDCAxyVsPtDeuteron"), trk.dcaXY(), trk.pt()); + jetHist.fill(HIST("tracksInc/deuteron/dca/after/hDCAzVsPtDeuteron"), trk.dcaZ(), trk.pt()); + } + + } else { // anti-particle info + if (useTOFNsigmaPreSel && trk.hasTOF()) { + if (std::abs(trk.tofNSigmaPr()) < cfgnTPCPIDPrTOF) + jetHist.fill(HIST("tracksInc/antiProton/h3PtVsantiProtonNSigmaTPCVsPt"), trk.pt(), trk.tpcNSigmaPr(), centrality); + if (std::abs(trk.tofNSigmaDe()) < cfgnTPCPIDDeTOF) + jetHist.fill(HIST("tracksInc/antiDeuteron/h3PtVsantiDeuteronNSigmaTPCVsPt"), trk.pt(), trk.tpcNSigmaDe(), centrality); + } else if (!useTOFNsigmaPreSel && !useTOFVeto) { + jetHist.fill(HIST("tracksInc/antiProton/h3PtVsantiProtonNSigmaTPCVsPt"), trk.pt(), trk.tpcNSigmaPr(), centrality); + jetHist.fill(HIST("tracksInc/antiDeuteron/h3PtVsantiDeuteronNSigmaTPCVsPt"), trk.pt(), trk.tpcNSigmaDe(), centrality); + } else if (!useTOFNsigmaPreSel && useTOFVeto) { + if (trk.hasTOF()) { + if (std::abs(trk.tofNSigmaPr()) < cfgnTPCPIDPrTOF) { + jetHist.fill(HIST("tracksInc/antiProton/h3PtVsantiProtonNSigmaTPCVsPt"), trk.pt(), trk.tpcNSigmaPr(), centrality); + } + } else { + jetHist.fill(HIST("tracksInc/antiProton/h3PtVsantiProtonNSigmaTPCVsPt"), trk.pt(), trk.tpcNSigmaPr(), centrality); + } + if (trk.hasTOF()) { + if (std::abs(trk.tofNSigmaDe()) < cfgnTPCPIDDeTOF) { + jetHist.fill(HIST("tracksInc/antiDeuteron/h3PtVsantiDeuteronNSigmaTPCVsPt"), trk.pt(), trk.tpcNSigmaDe(), centrality); + } + } else { + jetHist.fill(HIST("tracksInc/antiDeuteron/h3PtVsantiDeuteronNSigmaTPCVsPt"), trk.pt(), trk.tpcNSigmaDe(), centrality); + } + } + float massTOF = -999; + if (addTOFplots && trk.hasTOF()) { + massTOF = trk.p() * TMath::Sqrt(1.f / (trk.beta() * trk.beta()) - 1.f); + if (!useTPCpreSel) { + jetHist.fill(HIST("tracksInc/antiProton/h2TOFmassantiProtonVsPt"), massTOF, trk.pt()); + jetHist.fill(HIST("tracksInc/antiProton/h2TOFmass2antiProtonVsPt"), massTOF * massTOF - gMassProton * gMassProton, trk.pt()); + jetHist.fill(HIST("tracksInc/antiProton/h2TofNsigmaantiProtonVsPt"), trk.tofNSigmaPr(), trk.pt()); + + jetHist.fill(HIST("tracksInc/antiDeuteron/h2TOFmassantiDeuteronVsPt"), massTOF, trk.pt()); + jetHist.fill(HIST("tracksInc/antiDeuteron/h2TOFmass2antiDeuteronVsPt"), massTOF * massTOF - gMassDeuteron * gMassDeuteron, trk.pt()); + jetHist.fill(HIST("tracksInc/antiDeuteron/h2TofNsigmaantiDeuteronVsPt"), trk.tofNSigmaDe(), trk.pt()); + } else { + if (std::abs(trk.tpcNSigmaPr()) < cfgnTPCPIDPr) { + jetHist.fill(HIST("tracksInc/antiProton/h2TOFmassantiProtonVsPt"), massTOF, trk.pt()); + jetHist.fill(HIST("tracksInc/antiProton/h2TOFmass2antiProtonVsPt"), massTOF * massTOF - gMassProton * gMassProton, trk.pt()); + jetHist.fill(HIST("tracksInc/antiProton/h2TofNsigmaantiProtonVsPt"), trk.tofNSigmaPr(), trk.pt()); + } + if (std::abs(trk.tpcNSigmaDe()) < cfgnTPCPIDDe) { + jetHist.fill(HIST("tracksInc/antiDeuteron/h2TOFmassantiDeuteronVsPt"), massTOF, trk.pt()); + jetHist.fill(HIST("tracksInc/antiDeuteron/h2TOFmass2antiDeuteronVsPt"), massTOF * massTOF - gMassDeuteron * gMassDeuteron, trk.pt()); + jetHist.fill(HIST("tracksInc/antiDeuteron/h2TofNsigmaantiDeuteronVsPt"), trk.tofNSigmaDe(), trk.pt()); + } else { + jetHist.fill(HIST("tracksInc/antiDeuteron/h2TOFmassantiDeuteronVsPt"), massTOF, trk.pt()); + jetHist.fill(HIST("tracksInc/antiDeuteron/h2TOFmass2antiDeuteronVsPt"), massTOF * massTOF - gMassDeuteron * gMassDeuteron, trk.pt()); + jetHist.fill(HIST("tracksInc/antiDeuteron/h2TofNsigmaantiDeuteronVsPt"), trk.tofNSigmaDe(), trk.pt()); + } + } + } + } // anti-particle info end + } // track + } + void processMCGen(o2::aod::JetMcCollision const& collision, /*soa::SmallGroups> const& recoColls,*/ aod::JetParticles const& mcParticles, soa::Filtered const& mcpjets) { jetHist.fill(HIST("mcpJet/eventStat"), 0.5); @@ -1541,8 +1742,8 @@ struct nucleiInJets { bool isTpcPassed(true); bool isTof(completeTrack.hasTOF()); bool isTOFAndTPCPreSel(completeTrack.hasTOF() && - (completeTrack.tpcNSigmaPr() < cfgnTPCPIDPrTOF || completeTrack.tpcNSigmaDe() < cfgnTPCPIDDeTOF || - completeTrack.tpcNSigmaHe() < cfgnTPCPIDHeTOF || completeTrack.tpcNSigmaTr() < cfgnTPCPIDTrTOF)); + (std::abs(completeTrack.tpcNSigmaPr()) < cfgnTPCPIDPrTOF || std::abs(completeTrack.tpcNSigmaDe()) < cfgnTPCPIDDeTOF || + std::abs(completeTrack.tpcNSigmaHe()) < cfgnTPCPIDHeTOF || std::abs(completeTrack.tpcNSigmaTr()) < cfgnTPCPIDTrTOF)); bool jetFlag = false; bool jetFlagPerpCone = false; @@ -1560,7 +1761,6 @@ struct nucleiInJets { if (RPerpCone1 < cfgjetR || RPerpCone2 < cfgjetR) jetFlagPerpCone = true; } else { - for (std::size_t iDJet = 0; iDJet < mcdJetPt.size(); iDJet++) { double delPhi = TVector2::Phi_mpi_pi(mcdJetPhi[iDJet] - track.phi()); double delEta = mcdJetEta[iDJet] - track.eta(); @@ -1763,8 +1963,78 @@ struct nucleiInJets { } // jet constituents } // process + void processRecInc(EventTableMC::iterator const& coll, TrackCandidatesIncMC const& tracks, aod::JetParticles const& particleTracks, aod::JMcCollisions const&) + { + jetHist.fill(HIST("recInc/eventStat"), 0.5); + if (!jetderiveddatautilities::selectCollision(coll, jetderiveddatautilities::initialiseEventSelectionBits("sel8"))) + return; + jetHist.fill(HIST("recInc/eventStat"), 1.5); + if (std::abs(coll.posZ()) > 10) // bad vertex + return; + + jetHist.fill(HIST("recInc/vertexZ"), coll.posZ()); + jetHist.fill(HIST("recInc/eventStat"), 2.5); + + float centrality = -999; + switch (centralityType) { + case 0: // FT0M + centrality = coll.centFT0M(); + break; + case 1: // FT0C + centrality = coll.centFT0C(); + break; + case 2: // FV0A + centrality = coll.centFV0A(); + break; + default: + centrality = -999; + } + + for (const auto& track : tracks) { + if (!isTrackSelected(track)) { + continue; + } + if (!track.has_mcParticle()) + continue; + if (std::fabs(track.eta()) > cfgtrkMaxEta) + continue; + auto mcTrack = track.mcParticle_as(); + if (!mcTrack.isPhysicalPrimary()) + continue; + bool isTOFAndTPCPreSel(track.hasTOF() && + (std::abs(track.tpcNSigmaPr()) < cfgnTPCPIDPrTOF || std::abs(track.tpcNSigmaDe()) < cfgnTPCPIDDeTOF)); + + if (mapPDGToValue(mcTrack.pdgCode()) != 0) { + jetHist.fill(HIST("recInc/pt/PtParticleTypeTPC"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode()), centrality); + + if (isTOFAndTPCPreSel) { + jetHist.fill(HIST("recInc/pt/PtParticleTypeTPCTOF"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode()), centrality); + jetHist.fill(HIST("recInc/pt/PtParticleTypeTPCTOFVeto"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode()), centrality); + } else { + jetHist.fill(HIST("recInc/pt/PtParticleTypeTPCTOFVeto"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode()), centrality); + } + } + } // track + + // loop over particles + auto mcParticles_per_coll = particleTracks.sliceBy(perMCCol, coll.mcCollision().globalIndex()); + for (const auto& mcParticle : mcParticles_per_coll) { + if (!mcParticle.isPhysicalPrimary()) + continue; + if (std::fabs(mcParticle.eta()) > cfgtrkMaxEta) + continue; + if (std::fabs(mcParticle.y()) > cfgtrkMaxRap) + continue; + if (mapPDGToValue(mcParticle.pdgCode()) != 0) { + jetHist.fill(HIST("genInc/pt/PtParticleType"), mcParticle.pt(), mapPDGToValue(mcParticle.pdgCode()), centrality); + } + } // mc particles + } + PROCESS_SWITCH(nucleiInJets, processJetTracksData, "nuclei in Jets data", true); PROCESS_SWITCH(nucleiInJets, processJetTracksDataLfPid, "nuclei in Jets data", false); + PROCESS_SWITCH(nucleiInJets, processDataInc, "nuclei-data", false); + PROCESS_SWITCH(nucleiInJets, processRecInc, "nuclei MC", false); PROCESS_SWITCH(nucleiInJets, processMCRec, "nuclei in Jets for detectorlevel Jets", false); PROCESS_SWITCH(nucleiInJets, processMCGen, "nuclei in Jets MC particlelevel Jets", false); PROCESS_SWITCH(nucleiInJets, processRecMatched, "nuclei in Jets rec matched", false); From 94ad0cebd2d3f3f0051f5209144b8fc0e389850f Mon Sep 17 00:00:00 2001 From: GijsvWeelden <55794847+GijsvWeelden@users.noreply.github.com> Date: Thu, 24 Jul 2025 18:08:04 +0200 Subject: [PATCH 045/345] [PWGJE] Jet Fragmentation & V0 QA (#12170) --- PWGJE/Tasks/jetFragmentation.cxx | 211 ++++++++++++++++++------------- PWGJE/Tasks/v0QA.cxx | 152 ++++++++++------------ 2 files changed, 190 insertions(+), 173 deletions(-) diff --git a/PWGJE/Tasks/jetFragmentation.cxx b/PWGJE/Tasks/jetFragmentation.cxx index 6d84df3fb04..ce9bfa6fcb0 100644 --- a/PWGJE/Tasks/jetFragmentation.cxx +++ b/PWGJE/Tasks/jetFragmentation.cxx @@ -37,6 +37,8 @@ #include #include +#include + #include #include #include @@ -83,6 +85,15 @@ struct JetFragmentation { Configurable nV0Classes{"nV0Classes", 2, "Must be 2 or 4! Number of V0 signal/bkg classes"}; Configurable doCorrectionWithTracks{"doCorrectionWithTracks", false, "add tracks during background subtraction"}; + Configurable> ptBinsK0S{"ptBinsK0S", {0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 10.0, 15.0, 20.0, 25.0, 30.0, 40.0}, "K0S pt Vals"}; + Configurable> ptBinsLambda{"ptBinsLambda", {0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 10.0, 15.0, 20.0, 25.0}, "Lambda pt Vals"}; + Configurable> ptBinsAntiLambda{"ptBinsAntiLambda", {0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 10.0, 15.0, 20.0, 25.0}, "AntiLambda pt Vals"}; + + // NB: these must be one shorter than ptbin vectors! + Configurable> purityK0S{"purityK0S", {0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9}, "K0S purity per pt bin"}; + Configurable> purityLambda{"purityLambda", {0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9}, "Lambda purity per pt bin"}; + Configurable> purityAntiLambda{"purityAntiLambda", {0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9}, "AntiLambda purity per pt bin"}; + Configurable vertexZCut{"vertexZCut", 10.f, "vertex z cut"}; Configurable v0EtaMin{"v0EtaMin", -0.75, "minimum data V0 eta"}; Configurable v0EtaMax{"v0EtaMax", 0.75, "maximum data V0 eta"}; @@ -130,7 +141,7 @@ struct JetFragmentation { ConfigurableAxis binK0SMass{"binK0SMass", {400, 0.400f, 0.600f}, "Inv. Mass (GeV/c^{2})"}; ConfigurableAxis binK0SMassWide{"binK0SMassWide", {400, 0.400f, 0.800f}, "Inv. Mass (GeV/c^{2})"}; // Wider version for high pt - ConfigurableAxis binLambdaMass{"binLambdaMass", {200, 1.015f, 1.215f}, "Inv. Mass (GeV/c^{2})"}; + ConfigurableAxis binLambdaMass{"binLambdaMass", {200, 1.075f, 1.215f}, "Inv. Mass (GeV/c^{2})"}; ConfigurableAxis binLambdaMassDiff{"binLambdaMassDiff", {200, -0.199f, 0.201f}, "M(#Lambda) - M(#bar{#Lambda})"}; ConfigurableAxis binLambdaMassRatio{"binLambdaMassRatio", {50, -0.05f, 4.95f}, "M(#bar{#Lambda}) / M(#Lambda)"}; ConfigurableAxis binLambdaMassRelDiff{"binLambdaMassRelDiff", {200, -0.995f, 1.005f}, "(M(#Lambda) - M(#bar{#Lambda})) / M(#Lambda)"}; @@ -1070,26 +1081,45 @@ struct JetFragmentation { // Implementation of background subtraction at runtime // --------------------------------------------------- - // Return probability for a V0 to be signal (or background) + int getPtBin(float pt, std::vector ptBins) + { + if (pt < ptBins.at(0)) + return -1; + if (pt > ptBins.at(ptBins.size() - 1)) + return -2; + + for (unsigned int i = 0; i < ptBins.size() - 1; i++) { + if (pt >= ptBins.at(i) && pt < ptBins.at(i + 1)) { + return i; + } + } + return -3; + } + + // Return probability for a V0 to be signal + // Assumes V0 can only be of one type! + // Assumes V0 is not rejected! template float getV0SignalProb(V const& v0) { - // TODO: This is filled with dummy values for now - // Assumes a V0 can only be of one type! - // Should be made to return purity for a V0 based on species and pt + double purity = 0.; if (v0.isK0SCandidate()) { - // return 1.; - return 0.5; - } - if (v0.isLambdaCandidate()) { - // return 1.; - return 0.5; - } - if (v0.isAntiLambdaCandidate()) { - // return 1.; - return 0.5; + int ptBin = getPtBin(v0.pt(), ptBinsK0S); + if (ptBin >= 0) { + purity = purityK0S->at(ptBin); + } + } else if (v0.isLambdaCandidate()) { + int ptBin = getPtBin(v0.pt(), ptBinsLambda); + if (ptBin >= 0) { + purity = purityLambda->at(ptBin); + } + } else if (v0.isAntiLambdaCandidate()) { + int ptBin = getPtBin(v0.pt(), ptBinsAntiLambda); + if (ptBin >= 0) { + purity = purityAntiLambda->at(ptBin); + } } - return 0.; // Background + return purity; } // Return a 2-length std::vector of probabilities for a particle to correspond to signal or background template @@ -1270,20 +1300,17 @@ struct JetFragmentation { // If V0 is Lambda, posTrack = proton, negTrack = pion // In that case, we assign pion mass to posTrack and proton mass to negTrack to calculate the reflection // Vice versa for AntiLambda - double negM = (isLambda ? constants::physics::MassProton : constants::physics::MassPionCharged); - double posM = (isLambda ? constants::physics::MassPionCharged : constants::physics::MassProton); - double negPsq = v0.pxneg() * v0.pxneg() + v0.pyneg() * v0.pyneg() + v0.pzneg() * v0.pzneg(); - double posPsq = v0.pxpos() * v0.pxpos() + v0.pypos() * v0.pypos() + v0.pzpos() * v0.pzpos(); - double negE = std::sqrt(negM * negM + negPsq); - double posE = std::sqrt(posM * posM + posPsq); - double Esquared = (negE + posE) * (negE + posE); - double psquared = v0.p() * v0.p(); - return std::sqrt(Esquared - psquared); + float negM = (isLambda ? constants::physics::MassProton : constants::physics::MassPionCharged); + float posM = (isLambda ? constants::physics::MassPionCharged : constants::physics::MassProton); + std::array, 2> momenta = {std::array{v0.pxpos(), v0.pypos(), v0.pzpos()}, std::array{v0.pxneg(), v0.pyneg(), v0.pzneg()}}; + std::array masses = {posM, negM}; + return RecoDecay::m(momenta, masses); } template double getMomFrac(Jet const& jet, Constituent const& constituent) { - if (jet.pt() < 1e-5) + double divByZeroProtect = 1e-5; + if (jet.pt() < divByZeroProtect) return -1.; else return constituent.pt() / jet.pt(); @@ -1291,7 +1318,8 @@ struct JetFragmentation { template double getMomProj(Jet const& jet, Constituent const& constituent) { - if (jet.p() < 1e-5) + double divByZeroProtect = 1e-5; + if (jet.p() < divByZeroProtect) return -1.; double trackProj = constituent.px() * jet.px() + constituent.py() * jet.py() + constituent.pz() * jet.pz(); @@ -1506,18 +1534,19 @@ struct JetFragmentation { template void fillDataPerpConeHists(T const& coll, U const& jet, V const& v0s) { + const int nCones = 2; double perpConeR = jet.r() * 1e-2; - double conePhi[2] = {RecoDecay::constrainAngle(jet.phi() - constants::math::PIHalf, -constants::math::PI), - RecoDecay::constrainAngle(jet.phi() + constants::math::PIHalf, -constants::math::PI)}; - double conePt[2] = {0., 0.}; - int nV0sinCone[2] = {0, 0}; + double conePhi[nCones] = {RecoDecay::constrainAngle(jet.phi() - constants::math::PIHalf, -constants::math::PI), + RecoDecay::constrainAngle(jet.phi() + constants::math::PIHalf, -constants::math::PI)}; + double conePt[nCones] = {0., 0.}; + int nV0sinCone[nCones] = {0, 0}; for (const auto& v0 : v0s) { // Need to check if v0 passed jet finder selection/preselector cuts bool v0InCones = false; double dEta = v0.eta() - jet.eta(); - double dPhi[2] = {RecoDecay::constrainAngle(v0.phi() - conePhi[0], -constants::math::PI), - RecoDecay::constrainAngle(v0.phi() - conePhi[1], -constants::math::PI)}; - for (int i = 0; i < 2; i++) { + double dPhi[nCones] = {RecoDecay::constrainAngle(v0.phi() - conePhi[0], -constants::math::PI), + RecoDecay::constrainAngle(v0.phi() - conePhi[1], -constants::math::PI)}; + for (int i = 0; i < nCones; i++) { if (std::sqrt(dEta * dEta + dPhi[i] * dPhi[i]) < perpConeR) { conePt[i] += v0.pt(); nV0sinCone[i]++; @@ -1572,8 +1601,8 @@ struct JetFragmentation { registry.fill(HIST("data/PC/K0SPtDCAd"), v0.pt(), v0.dcaV0daughters()); } } - // Fill hist for Ncones: nv0s, conePt, coneEta, conePhi - for (int i = 0; i < 2; i++) { + // Fill hist for nCones: nv0s, conePt, coneEta, conePhi + for (int i = 0; i < nCones; i++) { registry.fill(HIST("data/PC/nV0sConePtEta"), nV0sinCone[i], conePt[i], jet.eta()); registry.fill(HIST("data/PC/ConePtEtaPhi"), conePt[i], jet.eta(), conePhi[i]); registry.fill(HIST("data/PC/JetPtEtaConePt"), jet.pt(), jet.eta(), conePt[i]); @@ -1773,13 +1802,13 @@ struct JetFragmentation { int pdg = pv0.pdgCode(); nV0s += 1; registry.fill(HIST("mcp/V0/V0PtEtaPhi"), pv0.pt(), pv0.eta(), pv0.phi(), weight); - if (std::abs(pdg) == 310) + if (std::abs(pdg) == PDG_t::kK0Short) registry.fill(HIST("mcp/V0/K0SPtEtaPhi"), pv0.pt(), pv0.eta(), pv0.phi(), weight); - if (pdg == 3122) + if (pdg == PDG_t::kLambda0) registry.fill(HIST("mcp/V0/LambdaPtEtaPhi"), pv0.pt(), pv0.eta(), pv0.phi(), weight); - if (pdg == -3122) + if (pdg == PDG_t::kLambda0Bar) registry.fill(HIST("mcp/V0/AntiLambdaPtEtaPhi"), pv0.pt(), pv0.eta(), pv0.phi(), weight); } registry.fill(HIST("mcp/V0/nV0sEventAcc"), nV0s); @@ -1869,19 +1898,20 @@ struct JetFragmentation { template void fillMcPerpConeHists(T const& coll, U const& mcdjet, V const& v0s, W const& /* V0 particles */, double weight = 1.) { + const int nCones = 2; double perpConeR = mcdjet.r() * 1e-2; - double conePhi[2] = {RecoDecay::constrainAngle(mcdjet.phi() - constants::math::PIHalf, -constants::math::PI), - RecoDecay::constrainAngle(mcdjet.phi() + constants::math::PIHalf, -constants::math::PI)}; - double coneMatchedPt[2] = {0., 0.}; - double coneFakePt[2] = {0., 0.}; - int nMatchedV0sinCone[2] = {0, 0}; - int nFakeV0sinCone[2] = {0, 0}; + double conePhi[nCones] = {RecoDecay::constrainAngle(mcdjet.phi() - constants::math::PIHalf, -constants::math::PI), + RecoDecay::constrainAngle(mcdjet.phi() + constants::math::PIHalf, -constants::math::PI)}; + double coneMatchedPt[nCones] = {0., 0.}; + double coneFakePt[nCones] = {0., 0.}; + int nMatchedV0sinCone[nCones] = {0, 0}; + int nFakeV0sinCone[nCones] = {0, 0}; for (const auto& v0 : v0s) { double dEta = v0.eta() - mcdjet.eta(); - double dPhi[2] = {RecoDecay::constrainAngle(v0.phi() - conePhi[0], -constants::math::PI), - RecoDecay::constrainAngle(v0.phi() - conePhi[1], -constants::math::PI)}; - for (int i = 0; i < 2; i++) { + double dPhi[nCones] = {RecoDecay::constrainAngle(v0.phi() - conePhi[0], -constants::math::PI), + RecoDecay::constrainAngle(v0.phi() - conePhi[1], -constants::math::PI)}; + for (int i = 0; i < nCones; i++) { if (std::sqrt(dEta * dEta + dPhi[i] * dPhi[i]) > perpConeR) { continue; } @@ -1914,17 +1944,17 @@ struct JetFragmentation { registry.fill(HIST("mcd/PC/matchedV0PtDCAd"), v0.pt(), v0.dcaV0daughters(), weight); auto particle = v0.template mcParticle_as(); - if (std::abs(particle.pdgCode()) == 310) { // K0S + if (std::abs(particle.pdgCode()) == PDG_t::kK0Short) { // K0S registry.fill(HIST("mcd/PC/matchedJetPtK0SPtMass"), mcdjet.pt(), v0.pt(), v0.mK0Short(), weight); - } else if (particle.pdgCode() == 3122) { // Lambda + } else if (particle.pdgCode() == PDG_t::kLambda0) { // Lambda registry.fill(HIST("mcd/PC/matchedJetPtLambdaPtMass"), mcdjet.pt(), v0.pt(), v0.mLambda(), weight); - } else if (particle.pdgCode() == -3122) { + } else if (particle.pdgCode() == PDG_t::kLambda0Bar) { registry.fill(HIST("mcd/PC/matchedJetPtAntiLambdaPtMass"), mcdjet.pt(), v0.pt(), v0.mAntiLambda(), weight); } } // if v0 has mcParticle } // for cone } // for v0s - for (int i = 0; i < 2; i++) { + for (int i = 0; i < nCones; i++) { registry.fill(HIST("mcd/PC/matchednV0sConePtEta"), nMatchedV0sinCone[i], coneMatchedPt[i], mcdjet.eta(), weight); registry.fill(HIST("mcd/PC/matchedConePtEtaPhi"), coneMatchedPt[i], mcdjet.eta(), conePhi[i], weight); registry.fill(HIST("mcd/PC/matchedJetPtEtaConePt"), mcdjet.pt(), mcdjet.eta(), coneMatchedPt[i], weight); @@ -1938,19 +1968,20 @@ struct JetFragmentation { template void fillMcPerpConeHists(T const& coll, U const& mcdjet, V const& mcpjet, W const& v0s, X const& /* V0 particles */, double weight = 1.) { + const int nCones = 2; double perpConeR = mcdjet.r() * 1e-2; - double conePhi[2] = {RecoDecay::constrainAngle(mcdjet.phi() - constants::math::PIHalf, -constants::math::PI), - RecoDecay::constrainAngle(mcdjet.phi() + constants::math::PIHalf, -constants::math::PI)}; - double coneMatchedPt[2] = {0., 0.}; - double coneFakePt[2] = {0., 0.}; - int nMatchedV0sinCone[2] = {0, 0}; - int nFakeV0sinCone[2] = {0, 0}; + double conePhi[nCones] = {RecoDecay::constrainAngle(mcdjet.phi() - constants::math::PIHalf, -constants::math::PI), + RecoDecay::constrainAngle(mcdjet.phi() + constants::math::PIHalf, -constants::math::PI)}; + double coneMatchedPt[nCones] = {0., 0.}; + double coneFakePt[nCones] = {0., 0.}; + int nMatchedV0sinCone[nCones] = {0, 0}; + int nFakeV0sinCone[nCones] = {0, 0}; for (const auto& v0 : v0s) { double dEta = v0.eta() - mcdjet.eta(); - double dPhi[2] = {RecoDecay::constrainAngle(v0.phi() - conePhi[0], -constants::math::PI), - RecoDecay::constrainAngle(v0.phi() - conePhi[1], -constants::math::PI)}; - for (int i = 0; i < 2; i++) { + double dPhi[nCones] = {RecoDecay::constrainAngle(v0.phi() - conePhi[0], -constants::math::PI), + RecoDecay::constrainAngle(v0.phi() - conePhi[1], -constants::math::PI)}; + for (int i = 0; i < nCones; i++) { if (std::sqrt(dEta * dEta + dPhi[i] * dPhi[i]) > perpConeR) { continue; } @@ -1985,20 +2016,20 @@ struct JetFragmentation { registry.fill(HIST("matching/PC/matchedV0PtDCAd"), v0.pt(), v0.dcaV0daughters(), weight); auto particle = v0.template mcParticle_as(); - if (std::abs(particle.pdgCode()) == 310) { // K0S + if (std::abs(particle.pdgCode()) == PDG_t::kK0Short) { // K0S registry.fill(HIST("matching/PC/matchedJetPtK0SPtMass"), mcdjet.pt(), v0.pt(), v0.mK0Short(), weight); registry.fill(HIST("matching/PC/matchedJetsPtK0SPtMass"), mcpjet.pt(), mcdjet.pt(), v0.pt(), v0.mK0Short(), weight); - } else if (particle.pdgCode() == 3122) { // Lambda + } else if (particle.pdgCode() == PDG_t::kLambda0) { // Lambda registry.fill(HIST("matching/PC/matchedJetPtLambdaPtMass"), mcdjet.pt(), v0.pt(), v0.mLambda(), weight); registry.fill(HIST("matching/PC/matchedJetsPtLambdaPtMass"), mcpjet.pt(), mcdjet.pt(), v0.pt(), v0.mLambda(), weight); - } else if (particle.pdgCode() == -3122) { + } else if (particle.pdgCode() == PDG_t::kLambda0Bar) { registry.fill(HIST("matching/PC/matchedJetPtAntiLambdaPtMass"), mcdjet.pt(), v0.pt(), v0.mAntiLambda(), weight); registry.fill(HIST("matching/PC/matchedJetsPtAntiLambdaPtMass"), mcpjet.pt(), mcdjet.pt(), v0.pt(), v0.mAntiLambda(), weight); } } // if v0 has mcParticle } // for cone } // for v0s - for (int i = 0; i < 2; i++) { + for (int i = 0; i < nCones; i++) { registry.fill(HIST("matching/PC/matchednV0sConePtEta"), nMatchedV0sinCone[i], coneMatchedPt[i], mcdjet.eta(), weight); registry.fill(HIST("matching/PC/matchedConePtEtaPhi"), coneMatchedPt[i], mcdjet.eta(), conePhi[i], weight); registry.fill(HIST("matching/PC/matchedJetPtEtaConePt"), mcdjet.pt(), mcdjet.eta(), coneMatchedPt[i], weight); @@ -2021,14 +2052,14 @@ struct JetFragmentation { registry.fill(HIST("matching/V0/V0PartPtDetPt"), particle.pt(), v0.pt(), weight); registry.fill(HIST("matching/V0/V0PartPtRatioPtRelDiffPt"), particle.pt(), v0.pt() / particle.pt(), (v0.pt() - particle.pt()) / particle.pt(), weight); - if (std::abs(particle.pdgCode()) == 310) { // K0S + if (std::abs(particle.pdgCode()) == PDG_t::kK0Short) { // K0S registry.fill(HIST("matching/V0/K0SPtEtaPhi"), particle.pt(), v0.pt(), v0.eta(), v0.phi(), weight); registry.fill(HIST("matching/V0/K0SPtCtauMass"), particle.pt(), v0.pt(), ctauK0s, v0.mK0Short(), weight); registry.fill(HIST("matching/V0/K0SPtRadiusCosPA"), particle.pt(), v0.pt(), v0.v0radius(), v0.v0cosPA(), weight); registry.fill(HIST("matching/V0/K0SPtDCAposneg"), particle.pt(), v0.pt(), v0.dcapostopv(), v0.dcanegtopv(), weight); registry.fill(HIST("matching/V0/K0SPtDCAd"), particle.pt(), v0.pt(), v0.dcaV0daughters(), weight); registry.fill(HIST("matching/V0/K0SPtMass"), particle.pt(), v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); - } else if (particle.pdgCode() == 3122) { // Lambda + } else if (particle.pdgCode() == PDG_t::kLambda0) { // Lambda registry.fill(HIST("matching/V0/LambdaPtEtaPhi"), particle.pt(), v0.pt(), v0.eta(), v0.phi(), weight); registry.fill(HIST("matching/V0/LambdaPtCtauMass"), particle.pt(), v0.pt(), ctauLambda, v0.mLambda(), weight); registry.fill(HIST("matching/V0/LambdaPtRadiusCosPA"), particle.pt(), v0.pt(), v0.v0radius(), v0.v0cosPA(), weight); @@ -2039,7 +2070,7 @@ struct JetFragmentation { // Reflection double reflectedMass = getReflectedMass(v0, true); registry.fill(HIST("matching/V0/LambdaReflection"), particle.pt(), v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), reflectedMass, weight); - } else if (particle.pdgCode() == -3122) { // AntiLambda + } else if (particle.pdgCode() == PDG_t::kLambda0Bar) { // AntiLambda registry.fill(HIST("matching/V0/AntiLambdaPtEtaPhi"), particle.pt(), v0.pt(), v0.eta(), v0.phi(), weight); registry.fill(HIST("matching/V0/AntiLambdaPtCtauMass"), particle.pt(), v0.pt(), ctauAntiLambda, v0.mAntiLambda(), weight); registry.fill(HIST("matching/V0/AntiLambdaPtRadiusCosPA"), particle.pt(), v0.pt(), v0.v0radius(), v0.v0cosPA(), weight); @@ -2062,11 +2093,11 @@ struct JetFragmentation { registry.fill(HIST("matching/V0/V0PosPartPtRatioPtRelDiffPt"), posPart.pt(), posTrack.pt() / posPart.pt(), (posTrack.pt() - posPart.pt()) / posPart.pt(), weight); registry.fill(HIST("matching/V0/V0NegPartPtRatioPtRelDiffPt"), negPart.pt(), negTrack.pt() / negPart.pt(), (negTrack.pt() - negPart.pt()) / negPart.pt(), weight); - if (std::abs(v0.pdgCode()) == 310) { // K0S + if (std::abs(v0.pdgCode()) == PDG_t::kK0Short) { // K0S registry.fill(HIST("matching/V0/K0SPosNegPtMass"), pv0.pt(), posPart.pt(), negPart.pt(), v0.mK0Short(), weight); - } else if (v0.pdgCode() == 3122) { // Lambda + } else if (v0.pdgCode() == PDG_t::kLambda0) { // Lambda registry.fill(HIST("matching/V0/LambdaPosNegPtMass"), pv0.pt(), posPart.pt(), negPart.pt(), v0.mLambda(), weight); - } else if (v0.pdgCode() == -3122) { // AntiLambda + } else if (v0.pdgCode() == PDG_t::kLambda0Bar) { // AntiLambda registry.fill(HIST("matching/V0/AntiLambdaPosNegPtMass"), pv0.pt(), posPart.pt(), negPart.pt(), v0.mAntiLambda(), weight); } } @@ -2126,7 +2157,7 @@ struct JetFragmentation { registry.fill(HIST("matching/jets/V0/partJetPtV0TrackProjDetJetPtV0TrackProjDCAposneg"), partJet.pt(), partTrackProj, detJet.pt(), detTrackProj, v0.dcapostopv(), v0.dcanegtopv(), weight); registry.fill(HIST("matching/jets/V0/partJetPtV0TrackProjDetJetPtV0TrackProjDCAd"), partJet.pt(), partTrackProj, detJet.pt(), detTrackProj, v0.dcaV0daughters(), weight); - if (std::abs(particle.pdgCode()) == 310) { // K0S + if (std::abs(particle.pdgCode()) == PDG_t::kK0Short) { // K0S registry.fill(HIST("matching/jets/V0/matchDetJetPtK0STrackProjPartJetPtK0STrackProj"), detJet.pt(), detTrackProj, partJet.pt(), partTrackProj, weight); registry.fill(HIST("matching/jets/V0/partJetPtK0SPtDetJetPtK0SPt"), partJet.pt(), particle.pt(), detJet.pt(), v0.pt(), weight); @@ -2153,7 +2184,7 @@ struct JetFragmentation { registry.fill(HIST("matching/jets/V0/partJetPtK0STrackProjDetJetPtK0STrackProjCosPA"), partJet.pt(), partTrackProj, detJet.pt(), detTrackProj, v0.v0cosPA(), weight); registry.fill(HIST("matching/jets/V0/partJetPtK0STrackProjDetJetPtK0STrackProjDCAposneg"), partJet.pt(), partTrackProj, detJet.pt(), detTrackProj, v0.dcapostopv(), v0.dcanegtopv(), weight); registry.fill(HIST("matching/jets/V0/partJetPtK0STrackProjDetJetPtK0STrackProjDCAd"), partJet.pt(), partTrackProj, detJet.pt(), detTrackProj, v0.dcaV0daughters(), weight); - } else if (particle.pdgCode() == 3122) { // Lambda + } else if (particle.pdgCode() == PDG_t::kLambda0) { // Lambda registry.fill(HIST("matching/jets/V0/matchDetJetPtLambdaTrackProjPartJetPtLambdaTrackProj"), detJet.pt(), detTrackProj, partJet.pt(), partTrackProj, weight); registry.fill(HIST("matching/jets/V0/partJetPtLambdaPtDetJetPtLambdaPt"), partJet.pt(), particle.pt(), detJet.pt(), v0.pt(), weight); @@ -2185,7 +2216,7 @@ struct JetFragmentation { double reflectedMass = getReflectedMass(v0, true); registry.fill(HIST("matching/jets/V0/partJetPtLambdaPtDetJetPtLambdaPtLambdaReflection"), partJet.pt(), particle.pt(), detJet.pt(), v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), reflectedMass, weight); registry.fill(HIST("matching/jets/V0/partJetPtLambdaTrackProjDetJetPtLambdaTrackProjLambdaReflection"), partJet.pt(), partTrackProj, detJet.pt(), detTrackProj, v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), reflectedMass, weight); - } else if (particle.pdgCode() == -3122) { // AntiLambda + } else if (particle.pdgCode() == PDG_t::kLambda0Bar) { // AntiLambda registry.fill(HIST("matching/jets/V0/matchDetJetPtAntiLambdaTrackProjPartJetPtAntiLambdaTrackProj"), detJet.pt(), detTrackProj, partJet.pt(), partTrackProj, weight); registry.fill(HIST("matching/jets/V0/partJetPtAntiLambdaPtDetJetPtAntiLambdaPt"), partJet.pt(), particle.pt(), detJet.pt(), v0.pt(), weight); @@ -2235,11 +2266,11 @@ struct JetFragmentation { { int pdg = pv0.pdgCode(); registry.fill(HIST("matching/V0/missV0PtEtaPhi"), pv0.pt(), pv0.eta(), pv0.phi(), weight); - if (std::abs(pdg) == 310) { // K0S + if (std::abs(pdg) == PDG_t::kK0Short) { // K0S registry.fill(HIST("matching/V0/missK0SPtEtaPhi"), pv0.pt(), pv0.eta(), pv0.phi(), weight); - } else if (pdg == 3122) { // Lambda + } else if (pdg == PDG_t::kLambda0) { // Lambda registry.fill(HIST("matching/V0/missLambdaPtEtaPhi"), pv0.pt(), pv0.eta(), pv0.phi(), weight); - } else if (pdg == -3122) { // AntiLambda + } else if (pdg == PDG_t::kLambda0Bar) { // AntiLambda registry.fill(HIST("matching/V0/missAntiLambdaPtEtaPhi"), pv0.pt(), pv0.eta(), pv0.phi(), weight); } } @@ -2250,13 +2281,13 @@ struct JetFragmentation { registry.fill(HIST("matching/jets/V0/missJetPtV0TrackProj"), jet.pt(), trackProj, weight); registry.fill(HIST("matching/jets/V0/missJetPtV0PtEtaPhi"), jet.pt(), v0.pt(), v0.eta(), v0.phi(), weight); - if (std::abs(v0.pdgCode()) == 310) { // K0S + if (std::abs(v0.pdgCode()) == PDG_t::kK0Short) { // K0S registry.fill(HIST("matching/jets/V0/missJetPtK0SPtEtaPhi"), jet.pt(), v0.pt(), v0.eta(), v0.phi(), weight); registry.fill(HIST("matching/jets/V0/missJetPtK0STrackProj"), jet.pt(), trackProj, weight); - } else if (v0.pdgCode() == 3122) { // Lambda + } else if (v0.pdgCode() == PDG_t::kLambda0) { // Lambda registry.fill(HIST("matching/jets/V0/missJetPtLambdaPtEtaPhi"), jet.pt(), v0.pt(), v0.eta(), v0.phi(), weight); registry.fill(HIST("matching/jets/V0/missJetPtLambdaTrackProj"), jet.pt(), trackProj, weight); - } else if (v0.pdgCode() == -3122) { // AntiLambda + } else if (v0.pdgCode() == PDG_t::kLambda0Bar) { // AntiLambda registry.fill(HIST("matching/jets/V0/missJetPtAntiLambdaPtEtaPhi"), jet.pt(), v0.pt(), v0.eta(), v0.phi(), weight); registry.fill(HIST("matching/jets/V0/missJetPtAntiLambdaTrackProj"), jet.pt(), trackProj, weight); } @@ -2394,11 +2425,11 @@ struct JetFragmentation { double pt = posDecayed ? negMom.pt() : posMom.pt(); int pdg = posDecayed ? negMom.pdgCode() : posMom.pdgCode(); - if (std::abs(pdg) == 310) { + if (std::abs(pdg) == PDG_t::kK0Short) { registry.fill(HIST("matching/V0/decayedK0SV0PtMass"), pt, v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); - } else if (pdg == 3122) { + } else if (pdg == PDG_t::kLambda0) { registry.fill(HIST("matching/V0/decayedLambdaV0PtMass"), pt, v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); - } else if (pdg == -3122) { + } else if (pdg == PDG_t::kLambda0Bar) { registry.fill(HIST("matching/V0/decayedAntiLambdaV0PtMass"), pt, v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); } else { registry.fill(HIST("matching/V0/decayedOtherPtV0PtMass"), pt, v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); @@ -2552,17 +2583,17 @@ struct JetFragmentation { } } - if (std::abs(pdg) == 310) { + if (std::abs(pdg) == PDG_t::kK0Short) { registry.fill(HIST("matching/jets/V0/decayedK0SV0PtMass"), partJet.pt(), detJet.pt(), pt, v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); if (partIsInJet) { registry.fill(HIST("matching/jets/V0/decayedK0SV0TrackProjMass"), partJet.pt(), detJet.pt(), z, zv0, v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); } - } else if (pdg == 3122) { + } else if (pdg == PDG_t::kLambda0) { registry.fill(HIST("matching/jets/V0/decayedLambdaV0PtMass"), partJet.pt(), detJet.pt(), pt, v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); if (partIsInJet) { registry.fill(HIST("matching/jets/V0/decayedLambdaV0TrackProjMass"), partJet.pt(), detJet.pt(), z, zv0, v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); } - } else if (pdg == -3122) { + } else if (pdg == PDG_t::kLambda0Bar) { registry.fill(HIST("matching/jets/V0/decayedAntiLambdaV0PtMass"), partJet.pt(), detJet.pt(), pt, v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); if (partIsInJet) { registry.fill(HIST("matching/jets/V0/decayedAntiLambdaV0TrackProjMass"), partJet.pt(), detJet.pt(), z, zv0, v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); @@ -2778,11 +2809,11 @@ struct JetFragmentation { fillMatchingV0FragHistograms(jcoll, detJet, partJet, detV0, partV0, weight); fillMatchingV0DauJetHistograms(detJet, partJet, detV0, partV0, weight); - if (std::abs(partV0.pdgCode()) == 310) { + if (std::abs(partV0.pdgCode()) == PDG_t::kK0Short) { nK0SinJet++; - } else if (partV0.pdgCode() == 3122) { + } else if (partV0.pdgCode() == PDG_t::kLambda0) { nLambdainJet++; - } else if (partV0.pdgCode() == -3122) { + } else if (partV0.pdgCode() == PDG_t::kLambda0Bar) { nAntiLambdainJet++; } break; @@ -2840,7 +2871,7 @@ struct JetFragmentation { } PROCESS_SWITCH(JetFragmentation, processMcMatchedV0JetsFrag, "Matched V0 jets fragmentation", false); - void processMcV0PerpCone(soa::Filtered::iterator const& jcoll, aod::JetMcCollisions const&, MatchedMCDV0Jets const& v0jets, CandidatesV0MCDWithLabelsAndFlags const& v0s, aod::McParticles const& particles) + void processMcV0PerpCone(soa::Filtered::iterator const& jcoll, aod::JetMcCollisions const&, MatchedMCDV0Jets const& v0jets, CandidatesV0MCDWithLabelsAndFlags const& v0s, aod::McParticles const& particles, MatchedMCPV0Jets const&) { if (!jetderiveddatautilities::selectCollision(jcoll, eventSelectionBits)) { return; diff --git a/PWGJE/Tasks/v0QA.cxx b/PWGJE/Tasks/v0QA.cxx index 2ad01dd572b..9cd648beafd 100644 --- a/PWGJE/Tasks/v0QA.cxx +++ b/PWGJE/Tasks/v0QA.cxx @@ -34,6 +34,8 @@ #include #include +#include + #include #include #include @@ -59,43 +61,33 @@ struct V0QA { HistogramRegistry registry{"registry"}; Configurable evSel{"evSel", "sel8WithoutTimeFrameBorderCut", "choose event selection"}; - Configurable v0cospaMin{"v0cospaMin", 0.995, "Minimum V0 cosine of pointing angle"}; - Configurable v0radiusMin{"v0radiusMin", 0.5, "Minimum V0 radius (cm)"}; - Configurable dcav0dauMax{"dcav0dauMax", 1.0, "Maximum DCA between V0 daughters (cm)"}; - Configurable dcapiMin{"dcapiMin", 0.1, "Minimum DCA of pion daughter to PV (cm)"}; - Configurable dcaprMin{"dcaprMin", 0.1, "Minimum DCA of proton daughter to PV (cm)"}; - Configurable yK0SMax{"yK0SMax", 0.5, "Maximum rapidity of K0S"}; - Configurable yLambdaMax{"yLambdaMax", 0.5, "Maximum rapidity of Lambda(bar)"}; - Configurable lifetimeK0SMax{"lifetimeK0SMax", 20.0, "Maximum lifetime of K0S (cm)"}; - Configurable lifetimeLambdaMax{"lifetimeLambdaMax", 30.0, "Maximum lifetime of Lambda (cm)"}; Configurable yPartMax{"yPartMax", 0.5, "Maximum rapidity of particles"}; Configurable vertexZCut{"vertexZCut", 10.0, "Vertex Z cut"}; - Configurable v0Fraction{"v0Fraction", 0.5, "Fraction of V0s to accept randomly"}; Filter jetCollisionFilter = nabs(aod::jcollision::posZ) < vertexZCut; - ConfigurableAxis binPtJet{"ptJet", {100., 0.0f, 50.0f}, ""}; - ConfigurableAxis binPtV0{"ptV0", {100., 0.0f, 50.0f}, ""}; - ConfigurableAxis binZV0{"zV0", {100., 1e-3f, 1 + 1e-3f}, ""}; + ConfigurableAxis binPtJet{"binPtJet", {100., 0.0f, 50.0f}, ""}; + ConfigurableAxis binPtV0{"binPtV0", {100., 0.0f, 50.0f}, ""}; + ConfigurableAxis binZV0{"binZV0", {100., 1e-3f, 1 + 1e-3f}, ""}; ConfigurableAxis binEta{"binEta", {100, -1.0f, 1.0f}, ""}; ConfigurableAxis binPhi{"binPhi", {constants::math::PI * 10 / 2, 0.0f, constants::math::TwoPI}, ""}; ConfigurableAxis binInvMassK0S{"binInvMassK0S", {200, 0.4f, 0.6f}, ""}; ConfigurableAxis binInvMassLambda{"binInvMassLambda", {200, 1.07f, 1.17f}, ""}; - ConfigurableAxis binV0Radius{"R", {100., 0.0f, 50.0f}, ""}; - ConfigurableAxis binV0CosPA{"cosPA", {50., 0.95f, 1.0f}, ""}; + ConfigurableAxis binV0Radius{"binV0Radius", {100., 0.0f, 50.0f}, ""}; + ConfigurableAxis binV0CosPA{"binV0CosPA", {50., 0.95f, 1.0f}, ""}; ConfigurableAxis binsDcaXY{"binsDcaXY", {100, -0.5f, 0.5f}, ""}; ConfigurableAxis binsDcaZ{"binsDcaZ", {100, -5.f, 5.f}, ""}; - ConfigurableAxis binPtDiff{"ptdiff", {200., -49.5f, 50.5f}, ""}; - ConfigurableAxis binPtRelDiff{"ptreldiff", {100., -1.0f, 1.0f}, ""}; - ConfigurableAxis binITSNCl{"ITSNCl", {8, -0.5, 7.5}, ""}; - ConfigurableAxis binITSChi2NCl{"ITSChi2NCl", {100, 0, 40}, ""}; + ConfigurableAxis binPtDiff{"binPtDiff", {200., -49.5f, 50.5f}, ""}; + ConfigurableAxis binPtRelDiff{"binPtRelDiff", {100., -1.0f, 1.0f}, ""}; + ConfigurableAxis binITSNCl{"binITSNCl", {8, -0.5, 7.5}, ""}; + ConfigurableAxis binITSChi2NCl{"binITSChi2NCl", {100, 0, 40}, ""}; - ConfigurableAxis binTPCNCl{"TPCNCl", {165, -0.5, 164.5}, ""}; - ConfigurableAxis binTPCChi2NCl{"TPCChi2NCl", {100, 0, 10}, ""}; - ConfigurableAxis binTPCNClSharedFraction{"sharedFraction", {100, 0., 1.}, ""}; - ConfigurableAxis binTPCCrossedRowsOverFindableCl{"crossedOverFindable", {120, 0.0, 1.2}, ""}; + ConfigurableAxis binTPCNCl{"binTPCNCl", {165, -0.5, 164.5}, ""}; + ConfigurableAxis binTPCChi2NCl{"binTPCChi2NCl", {100, 0, 10}, ""}; + ConfigurableAxis binTPCNClSharedFraction{"binTPCNClSharedFraction", {100, 0., 1.}, ""}; + ConfigurableAxis binTPCCrossedRowsOverFindableCl{"binTPCCrossedRowsOverFindableCl", {120, 0.0, 1.2}, ""}; std::vector eventSelectionBits; @@ -737,17 +729,16 @@ struct V0QA { continue; int pdg = v0.mcParticle().pdgCode(); - // K0S - if (std::abs(pdg) == 310) { + if (std::abs(pdg) == PDG_t::kK0Short) { registry.fill(HIST("inclusive/K0SPtEtaMass"), v0.pt(), v0.eta(), v0.mK0Short(), weight); registry.fill(HIST("inclusive/InvMassK0STrue"), v0.pt(), v0.v0radius(), v0.mK0Short(), weight); } // Lambda - if (pdg == 3122) { + if (pdg == PDG_t::kLambda0) { registry.fill(HIST("inclusive/LambdaPtEtaMass"), v0.pt(), v0.eta(), v0.mLambda(), weight); registry.fill(HIST("inclusive/InvMassLambdaTrue"), v0.pt(), v0.v0radius(), v0.mLambda(), weight); } - if (pdg == -3122) { + if (pdg == PDG_t::kLambda0Bar) { registry.fill(HIST("inclusive/AntiLambdaPtEtaMass"), v0.pt(), v0.eta(), v0.mAntiLambda(), weight); registry.fill(HIST("inclusive/InvMassAntiLambdaTrue"), v0.pt(), v0.v0radius(), v0.mAntiLambda(), weight); } @@ -785,16 +776,16 @@ struct V0QA { continue; // Can calculate this from aod::CandidatesV0MCD (contains decay vertex) - double r_Decay = 1.0; + double rDecay = 1.0; - if (pv0.pdgCode() == 310) { - registry.fill(HIST("inclusive/GeneratedK0S"), pv0.pt(), pv0.eta(), r_Decay, weight); + if (pv0.pdgCode() == PDG_t::kK0Short) { + registry.fill(HIST("inclusive/GeneratedK0S"), pv0.pt(), pv0.eta(), rDecay, weight); } - if (pv0.pdgCode() == 3122) { - registry.fill(HIST("inclusive/GeneratedLambda"), pv0.pt(), pv0.eta(), r_Decay, weight); + if (pv0.pdgCode() == PDG_t::kLambda0) { + registry.fill(HIST("inclusive/GeneratedLambda"), pv0.pt(), pv0.eta(), rDecay, weight); } - if (pv0.pdgCode() == -3122) { - registry.fill(HIST("inclusive/GeneratedAntiLambda"), pv0.pt(), pv0.eta(), r_Decay, weight); + if (pv0.pdgCode() == PDG_t::kLambda0Bar) { + registry.fill(HIST("inclusive/GeneratedAntiLambda"), pv0.pt(), pv0.eta(), rDecay, weight); } } } @@ -822,16 +813,16 @@ struct V0QA { continue; // K0S - if (std::abs(pdg) == 310) { + if (std::abs(pdg) == PDG_t::kK0Short) { registry.fill(HIST("jets/JetPtEtaK0SPt"), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); registry.fill(HIST("jets/InvMassJetK0STrue"), mcdjet.pt(), v0.pt(), v0.mK0Short(), weight); } // Lambda - if (pdg == 3122) { + if (pdg == PDG_t::kLambda0) { registry.fill(HIST("jets/JetPtEtaLambdaPt"), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); registry.fill(HIST("jets/InvMassJetLambdaTrue"), mcdjet.pt(), v0.pt(), v0.mLambda(), weight); } - if (pdg == -3122) { + if (pdg == PDG_t::kLambda0Bar) { registry.fill(HIST("jets/JetPtEtaAntiLambdaPt"), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); registry.fill(HIST("jets/InvMassJetAntiLambdaTrue"), mcdjet.pt(), v0.pt(), v0.mAntiLambda(), weight); } @@ -866,16 +857,16 @@ struct V0QA { continue; // K0S - if (std::abs(pdg) == 310) { + if (std::abs(pdg) == PDG_t::kK0Short) { registry.fill(HIST("jets/JetsPtEtaK0SPt"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); registry.fill(HIST("jets/InvMassJetsK0STrue"), mcpjet.pt(), mcdjet.pt(), v0.pt(), v0.mK0Short(), weight); } // Lambda - if (pdg == 3122) { + if (pdg == PDG_t::kLambda0) { registry.fill(HIST("jets/JetsPtEtaLambdaPt"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); registry.fill(HIST("jets/InvMassJetsLambdaTrue"), mcpjet.pt(), mcdjet.pt(), v0.pt(), v0.mLambda(), weight); } - if (pdg == -3122) { + if (pdg == PDG_t::kLambda0Bar) { registry.fill(HIST("jets/JetsPtEtaAntiLambdaPt"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); registry.fill(HIST("jets/InvMassJetsAntiLambdaTrue"), mcpjet.pt(), mcdjet.pt(), v0.pt(), v0.mAntiLambda(), weight); } @@ -917,13 +908,13 @@ struct V0QA { if (!pv0.isPhysicalPrimary()) continue; - if (pv0.pdgCode() == 310) { + if (pv0.pdgCode() == PDG_t::kK0Short) { registry.fill(HIST("jets/GeneratedJetK0S"), jet.pt(), jet.eta(), pv0.pt(), weight); } - if (pv0.pdgCode() == 3122) { + if (pv0.pdgCode() == PDG_t::kLambda0) { registry.fill(HIST("jets/GeneratedJetLambda"), jet.pt(), jet.eta(), pv0.pt(), weight); } - if (pv0.pdgCode() == -3122) { + if (pv0.pdgCode() == PDG_t::kLambda0Bar) { registry.fill(HIST("jets/GeneratedJetAntiLambda"), jet.pt(), jet.eta(), pv0.pt(), weight); } } @@ -956,19 +947,19 @@ struct V0QA { if (!correctCollision) { registry.fill(HIST("collisions/V0PtEtaWrongColl"), pv0.pt(), pv0.eta(), weight); } - if (std::abs(pdg) == 310) { + if (std::abs(pdg) == PDG_t::kK0Short) { registry.fill(HIST("collisions/K0SPtEtaMass"), pv0.pt(), pv0.eta(), v0.mK0Short(), weight); if (!correctCollision) { registry.fill(HIST("collisions/K0SPtEtaMassWrongColl"), pv0.pt(), pv0.eta(), v0.mK0Short(), weight); } } - if (pdg == 3122) { + if (pdg == PDG_t::kLambda0) { registry.fill(HIST("collisions/LambdaPtEtaMass"), pv0.pt(), pv0.eta(), v0.mLambda(), weight); if (!correctCollision) { registry.fill(HIST("collisions/LambdaPtEtaMassWrongColl"), pv0.pt(), pv0.eta(), v0.mLambda(), weight); } } - if (pdg == -3122) { + if (pdg == PDG_t::kLambda0Bar) { registry.fill(HIST("collisions/AntiLambdaPtEtaMass"), pv0.pt(), pv0.eta(), v0.mAntiLambda(), weight); if (!correctCollision) { registry.fill(HIST("collisions/AntiLambdaPtEtaMassWrongColl"), pv0.pt(), pv0.eta(), v0.mAntiLambda(), weight); @@ -982,13 +973,13 @@ struct V0QA { pdg = mother.pdgCode(); correctCollision = (mcColl.mcCollisionId() == mother.mcCollisionId()); - if (pdg == 3312) { // Xi- + if (pdg == PDG_t::kXiMinus) { registry.fill(HIST("collisions/XiMinusPtYLambdaPt"), mother.pt(), mother.y(), pv0.pt(), weight); if (!correctCollision) { registry.fill(HIST("collisions/XiMinusPtYLambdaPtWrongColl"), mother.pt(), mother.y(), pv0.pt(), weight); } } - if (pdg == -3312) { // Xi+ + if (pdg == PDG_t::kXiPlusBar) { registry.fill(HIST("collisions/XiPlusPtYAntiLambdaPt"), mother.pt(), mother.y(), pv0.pt(), weight); if (!correctCollision) { registry.fill(HIST("collisions/XiPlusPtYAntiLambdaPtWrongColl"), mother.pt(), mother.y(), pv0.pt(), weight); @@ -1024,19 +1015,19 @@ struct V0QA { if (!correctCollision) { registry.fill(HIST("collisions/JetPtEtaV0PtWrongColl"), mcdjet.pt(), mcdjet.eta(), pv0.pt(), weight); } - if (std::abs(pdg) == 310) { + if (std::abs(pdg) == PDG_t::kK0Short) { registry.fill(HIST("collisions/JetPtEtaK0SPtMass"), mcdjet.pt(), mcdjet.eta(), pv0.pt(), v0.mK0Short(), weight); if (!correctCollision) { registry.fill(HIST("collisions/JetPtEtaK0SPtMassWrongColl"), mcdjet.pt(), mcdjet.eta(), pv0.pt(), v0.mK0Short(), weight); } } - if (pdg == 3122) { + if (pdg == PDG_t::kLambda0) { registry.fill(HIST("collisions/JetPtEtaLambdaPtMass"), mcdjet.pt(), mcdjet.eta(), pv0.pt(), v0.mLambda(), weight); if (!correctCollision) { registry.fill(HIST("collisions/JetPtEtaLambdaPtMassWrongColl"), mcdjet.pt(), mcdjet.eta(), pv0.pt(), v0.mLambda(), weight); } } - if (pdg == -3122) { + if (pdg == PDG_t::kLambda0Bar) { registry.fill(HIST("collisions/JetPtEtaAntiLambdaPtMass"), mcdjet.pt(), mcdjet.eta(), pv0.pt(), v0.mAntiLambda(), weight); if (!correctCollision) { registry.fill(HIST("collisions/JetPtEtaAntiLambdaPtMassWrongColl"), mcdjet.pt(), mcdjet.eta(), pv0.pt(), v0.mAntiLambda(), weight); @@ -1049,13 +1040,13 @@ struct V0QA { auto mother = v0.mcMotherParticle(); pdg = mother.pdgCode(); correctCollision = (mcColl.mcCollisionId() == mother.mcCollisionId()); - if (pdg == 3312) { // Xi- + if (pdg == PDG_t::kXiMinus) { registry.fill(HIST("collisions/JetPtEtaXiMinusPtLambdaPt"), mcdjet.pt(), mcdjet.eta(), mother.pt(), pv0.pt(), weight); if (!correctCollision) { registry.fill(HIST("collisions/JetPtEtaXiMinusPtLambdaPtWrongColl"), mcdjet.pt(), mcdjet.eta(), mother.pt(), pv0.pt(), weight); } } - if (pdg == -3312) { // Xi+ + if (pdg == PDG_t::kXiPlusBar) { registry.fill(HIST("collisions/JetPtEtaXiPlusPtAntiLambdaPt"), mcdjet.pt(), mcdjet.eta(), mother.pt(), pv0.pt(), weight); if (!correctCollision) { registry.fill(HIST("collisions/JetPtEtaXiPlusPtAntiLambdaPtWrongColl"), mcdjet.pt(), mcdjet.eta(), mother.pt(), pv0.pt(), weight); @@ -1095,19 +1086,19 @@ struct V0QA { if (!correctCollision) { registry.fill(HIST("collisions/JetsPtEtaV0PtWrongColl"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), pv0.pt(), weight); } - if (std::abs(pdg) == 310) { + if (std::abs(pdg) == PDG_t::kK0Short) { registry.fill(HIST("collisions/JetsPtEtaK0SPtMass"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), pv0.pt(), v0.mK0Short(), weight); if (!correctCollision) { registry.fill(HIST("collisions/JetsPtEtaK0SPtMassWrongColl"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), pv0.pt(), v0.mK0Short(), weight); } } - if (pdg == 3122) { + if (pdg == PDG_t::kLambda0) { registry.fill(HIST("collisions/JetsPtEtaLambdaPtMass"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), pv0.pt(), v0.mLambda(), weight); if (!correctCollision) { registry.fill(HIST("collisions/JetsPtEtaLambdaPtMassWrongColl"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), pv0.pt(), v0.mLambda(), weight); } } - if (pdg == -3122) { + if (pdg == PDG_t::kLambda0Bar) { registry.fill(HIST("collisions/JetsPtEtaAntiLambdaPtMass"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), pv0.pt(), v0.mAntiLambda(), weight); if (!correctCollision) { registry.fill(HIST("collisions/JetsPtEtaAntiLambdaPtMassWrongColl"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), pv0.pt(), v0.mAntiLambda(), weight); @@ -1120,13 +1111,13 @@ struct V0QA { auto mother = v0.mcMotherParticle(); pdg = mother.pdgCode(); correctCollision = (mcColl.mcCollisionId() == mother.mcCollisionId()); - if (pdg == 3312) { // Xi- + if (pdg == PDG_t::kXiMinus) { registry.fill(HIST("collisions/JetsPtEtaXiMinusPtLambdaPt"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), mother.pt(), pv0.pt(), weight); if (!correctCollision) { registry.fill(HIST("collisions/JetsPtEtaXiMinusPtLambdaPtWrongColl"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), mother.pt(), pv0.pt(), weight); } } - if (pdg == -3312) { // Xi+ + if (pdg == PDG_t::kXiPlusBar) { registry.fill(HIST("collisions/JetsPtEtaXiPlusPtAntiLambdaPt"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), mother.pt(), pv0.pt(), weight); if (!correctCollision) { registry.fill(HIST("collisions/JetsPtEtaXiPlusPtAntiLambdaPtWrongColl"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), mother.pt(), pv0.pt(), weight); @@ -1165,10 +1156,10 @@ struct V0QA { auto mother = v0.mcMotherParticle(); pdg = mother.pdgCode(); - if (pdg == 3312) { // Xi- + if (pdg == PDG_t::kXiMinus) { registry.fill(HIST("feeddown/XiMinusPtYLambdaPt"), mother.pt(), mother.y(), pv0.pt(), weight); } - if (pdg == -3312) { // Xi+ + if (pdg == PDG_t::kXiPlusBar) { registry.fill(HIST("feeddown/XiPlusPtYAntiLambdaPt"), mother.pt(), mother.y(), pv0.pt(), weight); } } @@ -1202,10 +1193,10 @@ struct V0QA { auto mother = v0.mcMotherParticle(); pdg = mother.pdgCode(); - if (pdg == 3312) { // Xi- + if (pdg == PDG_t::kXiMinus) { registry.fill(HIST("feeddown/JetPtXiMinusPtLambdaPt"), mcdjet.pt(), mother.pt(), pv0.pt(), weight); } - if (pdg == -3312) { // Xi+ + if (pdg == PDG_t::kXiPlusBar) { registry.fill(HIST("feeddown/JetPtXiPlusPtAntiLambdaPt"), mcdjet.pt(), mother.pt(), pv0.pt(), weight); } } @@ -1242,10 +1233,10 @@ struct V0QA { auto mother = v0.mcMotherParticle(); pdg = mother.pdgCode(); - if (pdg == 3312) { // Xi- + if (pdg == PDG_t::kXiMinus) { registry.fill(HIST("feeddown/JetsPtXiMinusPtLambdaPt"), mcpjet.pt(), mcdjet.pt(), mother.pt(), pv0.pt(), weight); } - if (pdg == -3312) { // Xi+ + if (pdg == PDG_t::kXiPlusBar) { registry.fill(HIST("feeddown/JetsPtXiPlusPtAntiLambdaPt"), mcpjet.pt(), mcdjet.pt(), mother.pt(), pv0.pt(), weight); } } @@ -1299,13 +1290,10 @@ struct V0QA { registry.fill(HIST("tests/nosub/JetPtEtaPhi"), jet.pt(), jet.eta(), jet.phi()); std::vector v0Pt; - std::vector v0Type; // 0: K0S, 1: Lambda, 2: AntiLambda + std::vector v0Type; double ptjetsub = jet.pt(); for (const auto& v0 : jet.template candidates_as()) { - if (v0.isRejectedCandidate()) - continue; - double z = v0.pt() / jet.pt(); registry.fill(HIST("tests/nosub/JetPtEtaV0Pt"), jet.pt(), jet.eta(), v0.pt()); @@ -1324,24 +1312,22 @@ struct V0QA { registry.fill(HIST("tests/nosub/JetPtEtaAntiLambdaZ"), jet.pt(), jet.eta(), z); } - double r = gRandom->Uniform(); - if (r < v0Fraction) { // Accepted + if (v0.isRejectedCandidate()) { + ptjetsub -= v0.pt(); + } else { // Accepted V0 v0Pt.push_back(v0.pt()); if (v0.isK0SCandidate()) { - v0Type.push_back(0); + v0Type.push_back(PDG_t::kK0Short); } else if (v0.isLambdaCandidate()) { - v0Type.push_back(1); + v0Type.push_back(PDG_t::kLambda0); } else if (v0.isAntiLambdaCandidate()) { - v0Type.push_back(2); + v0Type.push_back(PDG_t::kLambda0Bar); } - } else { // Subtracted - ptjetsub -= v0.pt(); } - } + } // V0s in jet loop + registry.fill(HIST("tests/sub/JetPtEtaPhi"), ptjetsub, jet.eta(), jet.phi()); for (unsigned int i = 0; i < v0Pt.size(); ++i) { - registry.fill(HIST("tests/sub/JetPtEtaPhi"), ptjetsub, jet.eta(), jet.phi()); - int type = v0Type[i]; double pt = v0Pt[i]; double z = pt / ptjetsub; @@ -1349,18 +1335,18 @@ struct V0QA { registry.fill(HIST("tests/sub/JetPtEtaV0Pt"), ptjetsub, jet.eta(), pt); registry.fill(HIST("tests/sub/JetPtEtaV0Z"), ptjetsub, jet.eta(), z); - if (type == 0) { // K0S + if (type == PDG_t::kK0Short) { registry.fill(HIST("tests/sub/JetPtEtaK0SPt"), ptjetsub, jet.eta(), pt); registry.fill(HIST("tests/sub/JetPtEtaK0SZ"), ptjetsub, jet.eta(), z); - } else if (type == 1) { // Lambda + } else if (type == PDG_t::kLambda0) { registry.fill(HIST("tests/sub/JetPtEtaLambdaPt"), ptjetsub, jet.eta(), pt); registry.fill(HIST("tests/sub/JetPtEtaLambdaZ"), ptjetsub, jet.eta(), z); - } else if (type == 2) { // AntiLambda + } else if (type == PDG_t::kLambda0Bar) { registry.fill(HIST("tests/sub/JetPtEtaAntiLambdaPt"), ptjetsub, jet.eta(), pt); registry.fill(HIST("tests/sub/JetPtEtaAntiLambdaZ"), ptjetsub, jet.eta(), z); } - } - } + } // Accepted V0s in jet loop + } // Jets loop } PROCESS_SWITCH(V0QA, processTestSubtractedJetFinder, "Test subtracted jet finder", false); From 969ffa02f0387ec332d8fcb8bb60f368cb488ad8 Mon Sep 17 00:00:00 2001 From: Gyula Bencedi Date: Thu, 24 Jul 2025 18:11:47 +0200 Subject: [PATCH 046/345] [PWGLF] Add changes in track selection (#12217) --- .../GlobalEventProperties/flattenictyPikp.cxx | 109 ++++++++++-------- 1 file changed, 63 insertions(+), 46 deletions(-) diff --git a/PWGLF/Tasks/GlobalEventProperties/flattenictyPikp.cxx b/PWGLF/Tasks/GlobalEventProperties/flattenictyPikp.cxx index cf9c401c16b..51511ece0cf 100644 --- a/PWGLF/Tasks/GlobalEventProperties/flattenictyPikp.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/flattenictyPikp.cxx @@ -90,7 +90,6 @@ static constexpr std::string_view kSpeciesAll[Npart] = {"El", "Mu", "Pi", "Ka", // histogram naming static constexpr std::string_view kCharge[] = {"all/", "pos/", "neg/"}; static constexpr std::string_view kPrefix = "Tracks/"; -static constexpr std::string_view kQA = "QA/"; static constexpr std::string_view kPrefixCleanTof = "Tracks/CleanTof/"; static constexpr std::string_view kPrefixCleanV0 = "Tracks/CleanV0/"; static constexpr std::string_view kStatus[] = {"preSel/", "postSel/"}; @@ -122,6 +121,7 @@ enum TrkSelNoFilt { trkSelEta, trkSelPt, trkSelDCA, + trkNRowsTPC, trkSelNCls, trkSelTPCBndr, nTrkSel @@ -226,7 +226,7 @@ struct FlattenictyPikp { } flatSelOpt; struct : ConfigurableGroup { - ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0.0, 0.1, 0.12, 0.14, 0.16, 0.18, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0, 3.2, 3.4, 3.6, 3.8, 4.0, 4.2, 4.4, 4.6, 4.8, 5.0}, "pT binning"}; + ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0.1, 0.12, 0.14, 0.16, 0.18, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.2, 3.4, 3.6, 3.8, 4.0, 4.5, 5.0, 5.5, 6.0, 6.5, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 18.0, 20.0}, "pT binning"}; ConfigurableAxis axisMultPerc{"axisMultPerc", {100, 0, 100}, "Multiplicity percentiles binning"}; ConfigurableAxis axisVertexZ{"axisVertexZ", {60, -15., 15.}, "Vertex z binning"}; ConfigurableAxis axisMult{"axisMult", {301, -0.5, 300.5}, "Multiplicity binning"}; @@ -244,9 +244,12 @@ struct FlattenictyPikp { Configurable cfgTrkEtaMax{"cfgTrkEtaMax", 0.8f, "Eta range for tracks"}; Configurable cfgRapMax{"cfgRapMax", 0.5f, "Maximum range of rapidity for tracks"}; Configurable cfgTrkPtMin{"cfgTrkPtMin", 0.15f, "Minimum pT of tracks"}; + Configurable cfgNclTPCMin{"cfgNclTPCMin", 100.0f, "Minimum of number of TPC clusters"}; Configurable cfgPhiCutPtMin{"cfgPhiCutPtMin", 2.0f, "Minimum pT for phi cut"}; Configurable cfgTOFBetaPion{"cfgTOFBetaPion", 1.0f, "Minimum beta for TOF pions"}; Configurable cfgUseExtraTrkCut{"cfgUseExtraTrkCut", true, "Use extra track cut"}; + Configurable cfgGeoTrkCutMin{"cfgGeoTrkCutMin", "0.06/x+pi/18.0-0.06", "ROOT TF1 formula for minimum phi cut in TPC"}; + Configurable cfgGeoTrkCutMax{"cfgGeoTrkCutMax", "0.1/x+pi/18.0+0.06", "ROOT TF1 formula for maximum phi cut in TPC"}; Configurable cfgMomMIPMax{"cfgMomMIPMax", 0.6f, "Maximum momentum of MIP pions"}; Configurable cfgMomMIPMin{"cfgMomMIPMin", 0.4f, "Minimum momentum of MIP pions"}; Configurable cfgDeDxMIPMax{"cfgDeDxMIPMax", 60.0f, "Maximum range of MIP dedx"}; @@ -301,7 +304,7 @@ struct FlattenictyPikp { Configurable minITSnClusters{"minITSnClusters", 5, "minimum number of found ITS clusters"}; Configurable maxDcaXYFactor{"maxDcaXYFactor", 1.f, "Multiplicative factor on the maximum value of the DCA xy"}; Configurable maxDcaZ{"maxDcaZ", 2.f, "Additional cut on the maximum value of the DCA z"}; - Configurable minTPCNClsFound{"minTPCNClsFound", 0.f, "Additional cut on the minimum value of the number of found clusters in the TPC"}; + Configurable minTPCNClsFound{"minTPCNClsFound", 70.0f, "Additional cut on the minimum value of the number of found clusters in the TPC"}; TF1* fPhiCutLow = nullptr; TF1* fPhiCutHigh = nullptr; @@ -398,12 +401,13 @@ struct FlattenictyPikp { flatchrg.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelEta + 1, "Eta"); flatchrg.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelPt + 1, "Pt"); flatchrg.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelDCA + 1, "DCA"); - flatchrg.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelNCls + 1, "NCls"); + flatchrg.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkNRowsTPC + 1, "trkNRowsTPC"); + flatchrg.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelNCls + 1, "NClsTPC"); flatchrg.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelTPCBndr + 1, "TPC Boundary"); if (trkSelOpt.cfgUseExtraTrkCut) { - fPhiCutLow = new TF1("fPhiCutLow", "0.06/x+pi/18.0-0.06", 0, 100); - fPhiCutHigh = new TF1("fPhiCutHigh", "0.1/x+pi/18.0+0.06", 0, 100); + fPhiCutLow = new TF1("fPhiCutLow", trkSelOpt.cfgGeoTrkCutMin.value.c_str(), 0, 100); + fPhiCutHigh = new TF1("fPhiCutHigh", trkSelOpt.cfgGeoTrkCutMax.value.c_str(), 0, 100); } if (doprocessFlat) { @@ -413,25 +417,26 @@ struct FlattenictyPikp { if (cfgFillTrackQaHist || cfgFilldEdxQaHist || cfgFillNsigmaQAHist) { if (cfgFillTrackQaHist) { flatchrg.add("Tracks/postSel/hPtPhi", "; #it{p}_{T} (GeV/#it{c}); fmod(#varphi,#pi/9)", {HistType::kTH2D, {ptAxis, phiAxisMod}}); - flatchrg.add("Tracks/QA/hPtVsWOcutDCA", "hPtVsWOcutDCA", HistType::kTH2D, {ptAxis, dcaXYAxis}); - flatchrg.add("Tracks/QA/hPt", "", HistType::kTH1D, {ptAxis}); - flatchrg.add("Tracks/QA/hPhi", "", HistType::kTH1D, {phiAxis}); - flatchrg.add("Tracks/QA/hEta", "", HistType::kTH1D, {etaAxis}); - flatchrg.add("Tracks/QA/hDCAXYvsPt", "", HistType::kTH2D, {ptAxis, dcaXYAxis}); - flatchrg.add("Tracks/QA/hDCAZvsPt", "", HistType::kTH2D, {ptAxis, dcaZAxis}); + flatchrg.add("Tracks/postSel/hPtVsWOcutDCA", "hPtVsWOcutDCA", HistType::kTH2D, {ptAxis, dcaXYAxis}); + flatchrg.add("Tracks/postSel/hPt", "", HistType::kTH1D, {ptAxis}); + flatchrg.add("Tracks/postSel/hPhi", "", HistType::kTH1D, {phiAxis}); + flatchrg.add("Tracks/postSel/hEta", "", HistType::kTH1D, {etaAxis}); + flatchrg.add("Tracks/postSel/hDCAXYvsPt", "", HistType::kTH2D, {ptAxis, dcaXYAxis}); + flatchrg.add("Tracks/postSel/hDCAZvsPt", "", HistType::kTH2D, {ptAxis, dcaZAxis}); // tpc - flatchrg.add("Tracks/QA/hShTpcClvsPt", "", {HistType::kTH2D, {ptAxis, shCluserAxis}}); - flatchrg.add("Tracks/QA/hCrossTPCvsPt", "", {HistType::kTH2D, {ptAxis, clTpcAxis}}); - flatchrg.add("Tracks/QA/hTPCCluster", "N_{cluster}", HistType::kTH1D, {{200, -0.5, 199.5}}); - flatchrg.add("Tracks/QA/tpcNClsShared", " ; # shared TPC clusters TPC", HistType::kTH1D, {{165, -0.5, 164.5}}); - flatchrg.add("Tracks/QA/tpcCrossedRows", " ; # crossed TPC rows", HistType::kTH1D, {{165, -0.5, 164.5}}); - flatchrg.add("Tracks/QA/tpcCrossedRowsOverFindableCls", " ; crossed rows / findable TPC clusters", HistType::kTH1D, {{60, 0.7, 1.3}}); + flatchrg.add("Tracks/postSel/hPtPhiTPCCluster", "; #it{p}_{T} (GeV/#it{c}); fmod(#varphi,#pi/9); N_{cluster}", {HistType::kTHnSparseD, {ptAxis, phiAxisMod, clTpcAxis}}); + flatchrg.add("Tracks/postSel/hShTpcClvsPt", "", {HistType::kTH2D, {ptAxis, shCluserAxis}}); + flatchrg.add("Tracks/postSel/hCrossTPCvsPt", "", {HistType::kTH2D, {ptAxis, clTpcAxis}}); + flatchrg.add("Tracks/postSel/hTPCCluster", "N_{cluster}", HistType::kTH1D, {clTpcAxis}); + flatchrg.add("Tracks/postSel/tpcNClsShared", " ; # shared TPC clusters TPC", HistType::kTH1D, {{165, -0.5, 164.5}}); + flatchrg.add("Tracks/postSel/tpcCrossedRows", " ; # crossed TPC rows", HistType::kTH1D, {{165, -0.5, 164.5}}); + flatchrg.add("Tracks/postSel/tpcCrossedRowsOverFindableCls", " ; crossed rows / findable TPC clusters", HistType::kTH1D, {{60, 0.7, 1.3}}); // its - flatchrg.add("Tracks/QA/itsNCls", " ; # ITS clusters", HistType::kTH1D, {{8, -0.5, 7.5}}); - flatchrg.add("Tracks/QA/hChi2ITSTrkSegment", "chi2ITS", HistType::kTH1D, {{100, -0.5, 99.5}}); + flatchrg.add("Tracks/postSel/itsNCls", " ; # ITS clusters", HistType::kTH1D, {{8, -0.5, 7.5}}); + flatchrg.add("Tracks/postSel/hChi2ITSTrkSegment", "chi2ITS", HistType::kTH1D, {{100, -0.5, 99.5}}); // tof - flatchrg.add("Tracks/QA/hTOFPvsBeta", "Beta from TOF; #it{p} (GeV/#it{c}); #beta", {HistType::kTH2D, {pAxis, {120, 0.0, 1.2}}}); - flatchrg.add("Tracks/QA/hTOFpi", "Primary Pions from TOF; #eta; #it{p} (GeV/#it{c}); dEdx", {HistType::kTHnSparseD, {etaAxis, pAxis, dEdxAxis}}); + flatchrg.add("Tracks/postSel/hTOFPvsBeta", "Beta from TOF; #it{p} (GeV/#it{c}); #beta", {HistType::kTH2D, {pAxis, {120, 0.0, 1.2}}}); + flatchrg.add("Tracks/postSel/hTOFpi", "Primary Pions from TOF; #eta; #it{p} (GeV/#it{c}); dEdx", {HistType::kTHnSparseD, {etaAxis, pAxis, dEdxAxis}}); } if (cfgFilldEdxQaHist) { flatchrg.add("Tracks/postCalib/all/hMIP", "; mult; flat; #eta; #LT dE/dx #GT_{MIP, primary tracks};", {HistType::kTHnSparseD, {multAxis, flatAxis, etaAxis, dEdxAxis}}); @@ -707,22 +712,22 @@ struct FlattenictyPikp { fillTrackQA(track); } if (cfgFilldEdxQaHist) { - filldEdxQA(track, collision); + filldEdxQA(track, collision, dEdx); if (posP) { - filldEdxQA(track, collision); + filldEdxQA(track, collision, dEdx); } else { - filldEdxQA(track, collision); + filldEdxQA(track, collision, dEdx); } } if (applyCalibDeDx) { dEdx *= (50.0 / getCalibration(true, track.eta())); } if (cfgFilldEdxQaHist) { - filldEdxQA(track, collision); + filldEdxQA(track, collision, dEdx); if (posP) { - filldEdxQA(track, collision); + filldEdxQA(track, collision, dEdx); } else { - filldEdxQA(track, collision); + filldEdxQA(track, collision, dEdx); } } @@ -788,6 +793,7 @@ struct FlattenictyPikp { if (eta < 0.) { if (isMIP) { valCalib = fDeDxVsEtaNeg->Eval(eta); + // LOGF(info, "--------> \t fDeDxVsEtaNeg->Eval(%f) = %f", eta, valCalib); } else { valCalib = fEDeDxVsEtaNeg->Eval(eta); } @@ -830,12 +836,18 @@ struct FlattenictyPikp { if (cfgFillTrackQaHist) { flatchrg.fill(HIST("Tracks/preSel/hPtPhi"), track.pt(), phimodn); + if (track.hasTPC() && track.hasITS()) { + flatchrg.fill(HIST("Tracks/preSel/hPtPhiTPCCluster"), track.pt(), phimodn, track.tpcNClsFindable() - track.tpcNClsFindableMinusFound()); + } } if (phimodn < fphiCutHigh->Eval(track.pt()) && phimodn > fphiCutLow->Eval(track.pt())) { return false; } if (cfgFillTrackQaHist) { flatchrg.fill(HIST("Tracks/postSel/hPtPhi"), track.pt(), phimodn); + if (track.hasTPC() && track.hasITS()) { + flatchrg.fill(HIST("Tracks/postSel/hPtPhiTPCCluster"), track.pt(), phimodn, track.tpcNClsFindable() - track.tpcNClsFindableMinusFound()); + } } return true; } @@ -858,6 +870,11 @@ struct FlattenictyPikp { if (track.tpcNClsCrossedRows() < minNCrossedRowsTPC) { return false; } + flatchrg.fill(HIST("Tracks/hTrkSel"), trkNRowsTPC); + auto nClusterTPC = track.tpcNClsFindable() - track.tpcNClsFindableMinusFound(); + if (nClusterTPC < trkSelOpt.cfgNclTPCMin) { + return false; + } flatchrg.fill(HIST("Tracks/hTrkSel"), trkSelNCls); if (trkSelOpt.cfgUseExtraTrkCut && !phiCut(track, magfield, fPhiCutLow, fPhiCutHigh)) { return false; @@ -1009,34 +1026,34 @@ struct FlattenictyPikp { inline void fillTrackQA(T const& track) { if constexpr (fillHist) { - flatchrg.fill(HIST(kPrefix) + HIST(kQA) + HIST("hPt"), track.pt()); - flatchrg.fill(HIST(kPrefix) + HIST(kQA) + HIST("hPhi"), track.phi()); - flatchrg.fill(HIST(kPrefix) + HIST(kQA) + HIST("hEta"), track.eta()); - flatchrg.fill(HIST(kPrefix) + HIST(kQA) + HIST("hDCAXYvsPt"), track.pt(), track.dcaXY()); - flatchrg.fill(HIST(kPrefix) + HIST(kQA) + HIST("hDCAZvsPt"), track.pt(), track.dcaZ()); + flatchrg.fill(HIST(kPrefix) + HIST(kStatus[ft]) + HIST("hPt"), track.pt()); + flatchrg.fill(HIST(kPrefix) + HIST(kStatus[ft]) + HIST("hPhi"), track.phi()); + flatchrg.fill(HIST(kPrefix) + HIST(kStatus[ft]) + HIST("hEta"), track.eta()); + flatchrg.fill(HIST(kPrefix) + HIST(kStatus[ft]) + HIST("hDCAXYvsPt"), track.pt(), track.dcaXY()); + flatchrg.fill(HIST(kPrefix) + HIST(kStatus[ft]) + HIST("hDCAZvsPt"), track.pt(), track.dcaZ()); if (track.hasTPC() && track.hasITS()) { int nFindable = track.tpcNClsFindable(); int nMinusFound = track.tpcNClsFindableMinusFound(); int nCluster = nFindable - nMinusFound; - flatchrg.fill(HIST(kPrefix) + HIST(kQA) + HIST("hTPCCluster"), nCluster); - flatchrg.fill(HIST(kPrefix) + HIST(kQA) + HIST("hShTpcClvsPt"), track.pt(), track.tpcFractionSharedCls()); - flatchrg.fill(HIST(kPrefix) + HIST(kQA) + HIST("hCrossTPCvsPt"), track.pt(), track.tpcNClsFound()); - flatchrg.fill(HIST(kPrefix) + HIST(kQA) + HIST("tpcNClsShared"), track.tpcNClsShared()); - flatchrg.fill(HIST(kPrefix) + HIST(kQA) + HIST("tpcCrossedRows"), track.tpcNClsCrossedRows()); - flatchrg.fill(HIST(kPrefix) + HIST(kQA) + HIST("tpcCrossedRowsOverFindableCls"), track.tpcCrossedRowsOverFindableCls()); - flatchrg.fill(HIST(kPrefix) + HIST(kQA) + HIST("hChi2ITSTrkSegment"), track.itsChi2NCl()); - flatchrg.fill(HIST(kPrefix) + HIST(kQA) + HIST("itsNCls"), track.itsNCls()); + flatchrg.fill(HIST(kPrefix) + HIST(kStatus[ft]) + HIST("hTPCCluster"), nCluster); + flatchrg.fill(HIST(kPrefix) + HIST(kStatus[ft]) + HIST("hShTpcClvsPt"), track.pt(), track.tpcFractionSharedCls()); + flatchrg.fill(HIST(kPrefix) + HIST(kStatus[ft]) + HIST("hCrossTPCvsPt"), track.pt(), track.tpcNClsFound()); + flatchrg.fill(HIST(kPrefix) + HIST(kStatus[ft]) + HIST("tpcNClsShared"), track.tpcNClsShared()); + flatchrg.fill(HIST(kPrefix) + HIST(kStatus[ft]) + HIST("tpcCrossedRows"), track.tpcNClsCrossedRows()); + flatchrg.fill(HIST(kPrefix) + HIST(kStatus[ft]) + HIST("tpcCrossedRowsOverFindableCls"), track.tpcCrossedRowsOverFindableCls()); + flatchrg.fill(HIST(kPrefix) + HIST(kStatus[ft]) + HIST("hChi2ITSTrkSegment"), track.itsChi2NCl()); + flatchrg.fill(HIST(kPrefix) + HIST(kStatus[ft]) + HIST("itsNCls"), track.itsNCls()); } - flatchrg.fill(HIST(kPrefix) + HIST(kQA) + HIST("hTOFPvsBeta"), track.tpcInnerParam(), track.beta()); + flatchrg.fill(HIST(kPrefix) + HIST(kStatus[ft]) + HIST("hTOFPvsBeta"), track.tpcInnerParam(), track.beta()); if (track.beta() > trkSelOpt.cfgTOFBetaPion && track.beta() < trkSelOpt.cfgTOFBetaPion + 0.05) { // TOF pions - flatchrg.fill(HIST(kPrefix) + HIST(kQA) + HIST("hTOFpi"), track.eta(), track.tpcInnerParam(), track.tpcSignal()); + flatchrg.fill(HIST(kPrefix) + HIST(kStatus[ft]) + HIST("hTOFpi"), track.eta(), track.tpcInnerParam(), track.tpcSignal()); } if (std::abs(track.eta()) < trkSelOpt.cfgTrkEtaMax) { if (isDCAxyWoCut(track)) { - flatchrg.fill(HIST(kPrefix) + HIST(kQA) + HIST("hPtVsWOcutDCA"), track.pt(), track.dcaXY()); + flatchrg.fill(HIST(kPrefix) + HIST(kStatus[ft]) + HIST("hPtVsWOcutDCA"), track.pt(), track.dcaXY()); } } } @@ -1044,11 +1061,11 @@ struct FlattenictyPikp { } template - inline void filldEdxQA(T const& track, C const& collision) + inline void filldEdxQA(T const& track, C const& collision, const float dEdx) { const float mult = getMult(collision); const float flat = fillFlat(collision); - float dEdx = track.tpcSignal(); + // float dEdx = track.tpcSignal(); if constexpr (fillHist) { if (track.tpcInnerParam() >= trkSelOpt.cfgMomMIPMin && track.tpcInnerParam() <= trkSelOpt.cfgMomMIPMax) { if (dEdx > trkSelOpt.cfgDeDxMIPMin && dEdx < trkSelOpt.cfgDeDxMIPMax) { // MIP pions From 528c1694feeff1db39a0748217dc025f280f8618 Mon Sep 17 00:00:00 2001 From: "Maja Karwowska (Kabus)" Date: Thu, 24 Jul 2025 19:35:28 +0200 Subject: [PATCH 047/345] [PWGHF] D2H fitter: Add possibility to set fixed manual mean and second sigma for double gauss (#12060) --- PWGHF/D2H/Macros/HFInvMassFitter.cxx | 19 ++++- PWGHF/D2H/Macros/config_massfitter.json | 19 +++++ PWGHF/D2H/Macros/runMassFitter.C | 101 +++++++++++++----------- 3 files changed, 90 insertions(+), 49 deletions(-) diff --git a/PWGHF/D2H/Macros/HFInvMassFitter.cxx b/PWGHF/D2H/Macros/HFInvMassFitter.cxx index dd05a7de2f9..fba3d7c67a1 100644 --- a/PWGHF/D2H/Macros/HFInvMassFitter.cxx +++ b/PWGHF/D2H/Macros/HFInvMassFitter.cxx @@ -588,7 +588,16 @@ void HFInvMassFitter::drawFit(TVirtualPad* pad, Int_t writeFitInfo) } else { textInfoRight->AddText(Form("mean(free) = %.3f #pm %.3f", mRooMeanSgn->getVal(), mRooMeanSgn->getError())); } - if (mFixedSigma) { + if (mTypeOfSgnPdf == DoubleGaus) { + auto const& baseSigmaSgn = mWorkspace->var("sigma"); + if (mFixedSigmaDoubleGaus) { + textInfoRight->AddText(Form("sigma(fixed) = %.3f #pm %.3f", baseSigmaSgn->getVal(), baseSigmaSgn->getError())); + textInfoRight->AddText(Form("sigma 2(fixed) = %.3f #pm %.3f", mRooSigmaSgn->getVal(), mRooSigmaSgn->getError())); + } else { + textInfoRight->AddText(Form("sigma(free) = %.3f #pm %.3f", baseSigmaSgn->getVal(), baseSigmaSgn->getError())); + textInfoRight->AddText(Form("sigma 2(free) = %.3f #pm %.3f", mRooSigmaSgn->getVal(), mRooSigmaSgn->getError())); + } + } else if (mFixedSigma) { textInfoRight->AddText(Form("sigma(fixed) = %.3f #pm %.3f", mRooSigmaSgn->getVal(), mRooSigmaSgn->getError())); } else { textInfoRight->AddText(Form("sigma(free) = %.3f #pm %.3f", mRooSigmaSgn->getVal(), mRooSigmaSgn->getError())); @@ -619,7 +628,13 @@ void HFInvMassFitter::drawResidual(TVirtualPad* pad) textInfo->AddText(Form("S = %.0f #pm %.0f ", mRawYield, mRawYieldErr)); textInfo->AddText(Form("S_{count} = %.0f #pm %.0f ", mRawYieldCounted, mRawYieldCountedErr)); textInfo->AddText(Form("mean = %.3f #pm %.3f", mRooMeanSgn->getVal(), mRooMeanSgn->getError())); - textInfo->AddText(Form("sigma = %.3f #pm %.3f", mRooSigmaSgn->getVal(), mRooSigmaSgn->getError())); + if (mTypeOfSgnPdf == DoubleGaus) { + auto const& baseSigmaSgn = mWorkspace->var("sigma"); + textInfo->AddText(Form("sigma = %.3f #pm %.3f", baseSigmaSgn->getVal(), baseSigmaSgn->getError())); + textInfo->AddText(Form("sigma 2 = %.3f #pm %.3f", mRooSigmaSgn->getVal(), mRooSigmaSgn->getError())); + } else { + textInfo->AddText(Form("sigma = %.3f #pm %.3f", mRooSigmaSgn->getVal(), mRooSigmaSgn->getError())); + } mResidualFrame->addObject(textInfo); mResidualFrame->Draw(); highlightPeakRegion(mResidualFrame); diff --git a/PWGHF/D2H/Macros/config_massfitter.json b/PWGHF/D2H/Macros/config_massfitter.json index e91ea222f6c..43e67b76f5d 100644 --- a/PWGHF/D2H/Macros/config_massfitter.json +++ b/PWGHF/D2H/Macros/config_massfitter.json @@ -50,6 +50,25 @@ "FixMean": false, "MeanFile": "", "_MeanFile": "fix mean from file", + "FixMeanManual": [ + 0, + 0, + 0, + 0, + 0 + ], + "_FixMeanManual": "fix mean mannually", + "FixSecondSigma": false, + "SecondSigmaFile": "", + "_SecondSigmaFile": "fix second sigma for double gauss from file", + "FixSecondSigmaManual": [ + 0, + 0, + 0, + 0, + 0 + ], + "_FixSecondSigmaManual": "fix second sigma for double gauss manually", "SliceVarName": "T", "SliceVarUnit": "ps", "_SliceVarName, _SliceVarUnit": "e.g. pT, GeV/c or something else depending on user's needs", diff --git a/PWGHF/D2H/Macros/runMassFitter.C b/PWGHF/D2H/Macros/runMassFitter.C index 3fc451a3558..e6cb569f4b0 100644 --- a/PWGHF/D2H/Macros/runMassFitter.C +++ b/PWGHF/D2H/Macros/runMassFitter.C @@ -99,6 +99,8 @@ int runMassFitter(const TString& configFileName) std::vector massMin; std::vector massMax; std::vector fixSigmaManual; + std::vector fixSecondSigmaManual; + std::vector fixMeanManual; std::vector nRebin; std::vector bkgFuncConfig; std::vector sgnFuncConfig; @@ -121,15 +123,24 @@ int runMassFitter(const TString& configFileName) const Value& fdSecPeakHistoNameValue = config["FDSecPeakHistoName"]; parseStringArray(fdSecPeakHistoNameValue, fdSecPeakHistoName); - bool fixSigma = config["FixSigma"].GetBool(); - std::string sigmaFile = config["SigmaFile"].GetString(); + const bool fixSigma = config["FixSigma"].GetBool(); + const std::string sigmaFile = config["SigmaFile"].GetString(); - bool fixMean = config["FixMean"].GetBool(); - std::string meanFile = config["MeanFile"].GetString(); + const bool fixMean = config["FixMean"].GetBool(); + const std::string meanFile = config["MeanFile"].GetString(); const Value& fixSigmaManualValue = config["FixSigmaManual"]; readArray(fixSigmaManualValue, fixSigmaManual); + const bool fixSecondSigma = config["FixSecondSigma"].GetBool(); + const std::string secondSigmaFile = config["SecondSigmaFile"].GetString(); + + const Value& fixSecondSigmaManualValue = config["FixSecondSigmaManual"]; + readArray(fixSecondSigmaManualValue, fixSecondSigmaManual); + + const Value& fixMeanManualValue = config["FixMeanManual"]; + readArray(fixMeanManualValue, fixMeanManual); + sliceVarName = config["SliceVarName"].GetString(); sliceVarUnit = config["SliceVarUnit"].GetString(); @@ -295,35 +306,29 @@ int runMassFitter(const TString& configFileName) setHistoStyle(hRawYieldsChiSquareTotal); setHistoStyle(hReflectionOverSignal, kRed + 1); - TH1* hSigmaToFix = nullptr; - if (fixSigma) { - if (fixSigmaManual.empty()) { - auto inputFileSigma = TFile::Open(sigmaFile.data()); - if (!inputFileSigma) { - return -2; - } - hSigmaToFix = inputFileSigma->Get("hRawYieldsSigma"); - hSigmaToFix->SetDirectory(0); - if (static_cast(hSigmaToFix->GetNbinsX()) != nSliceVarBins) { - printf("WARNING: Different number of bins for this analysis and histo for fix sigma!\n"); + auto getHistToFix = [&nSliceVarBins](bool const& isFix, std::vector const& fixManual, std::string const& fixFileName, std::string const& var) -> TH1* { + TH1* histToFix = nullptr; + if (isFix) { + if (fixManual.empty()) { + auto fixInputFile = TFile::Open(fixFileName.data()); + if (!fixInputFile) { + throw std::runtime_error("Cannot open file for fixed " + var); + } + const std::string histName = "hRawYields" + var; + histToFix = fixInputFile->Get(histName.data()); + histToFix->SetDirectory(nullptr); + if (static_cast(histToFix->GetNbinsX()) != nSliceVarBins) { + throw std::runtime_error("Different number of bins for this analysis and histo for fixed " + var); + } + fixInputFile->Close(); } - inputFileSigma->Close(); } - } + return histToFix; + }; - TH1* hMeanToFix = nullptr; - if (fixMean) { - auto inputFileMean = TFile::Open(meanFile.data()); - if (!inputFileMean) { - return -3; - } - hMeanToFix = inputFileMean->Get("hRawYieldsMean"); - hMeanToFix->SetDirectory(0); - if (static_cast(hMeanToFix->GetNbinsX()) != nSliceVarBins) { - printf("WARNING: Different number of bins for this analysis and histo for fix mean\n"); - } - inputFileMean->Close(); - } + TH1* hSigmaToFix = getHistToFix(fixSigma, fixSigmaManual, sigmaFile, "Sigma"); + TH1* hMeanToFix = getHistToFix(fixMean, fixMeanManual, meanFile, "Mean"); + TH1* hSecondSigmaToFix = getHistToFix(fixSecondSigma, fixSecondSigmaManual, secondSigmaFile, "Sigma"); // fit histograms @@ -433,24 +438,26 @@ int runMassFitter(const TString& configFileName) if (useLikelihood) { massFitter->setUseLikelihoodFit(); } - if (fixMean) { - massFitter->setFixGaussianMean(hMeanToFix->GetBinContent(iSliceVar + 1)); - } - if (fixSigma) { - if (fixSigmaManual.empty()) { - massFitter->setFixGaussianSigma(hSigmaToFix->GetBinContent(iSliceVar + 1)); - printf("*****************************\n"); - printf("FIXED SIGMA: %f\n", hSigmaToFix->GetBinContent(iSliceVar + 1)); - printf("*****************************\n"); - } else if (!fixSigmaManual.empty()) { - massFitter->setFixGaussianSigma(fixSigmaManual[iSliceVar]); - printf("*****************************\n"); - printf("FIXED SIGMA: %f\n", fixSigmaManual[iSliceVar]); - printf("*****************************\n"); - } else { - printf("WARNING: impossible to fix sigma! Wrong fix sigma file or value!\n"); + + auto setFixedValue = [&massFitter, &iSliceVar](bool const& isFix, std::vector const& fixManual, const TH1* histToFix, std::function setFunc, std::string const& var) -> void { + if (isFix) { + if (fixManual.empty()) { + setFunc(histToFix->GetBinContent(iSliceVar + 1)); + printf("*****************************\n"); + printf("FIXED %s: %f\n", var.data(), histToFix->GetBinContent(iSliceVar + 1)); + printf("*****************************\n"); + } else { + setFunc(fixManual[iSliceVar]); + printf("*****************************\n"); + printf("FIXED %s: %f\n", var.data(), fixManual[iSliceVar]); + printf("*****************************\n"); + } } - } + }; + + setFixedValue(fixMean, fixMeanManual, hMeanToFix, std::bind(&HFInvMassFitter::setFixGaussianMean, massFitter, std::placeholders::_1), "MEAN"); + setFixedValue(fixSigma, fixSigmaManual, hSigmaToFix, std::bind(&HFInvMassFitter::setFixGaussianSigma, massFitter, std::placeholders::_1), "SIGMA"); + setFixedValue(fixSecondSigma, fixSecondSigmaManual, hSecondSigmaToFix, std::bind(&HFInvMassFitter::setFixSecondGaussianSigma, massFitter, std::placeholders::_1), "SECOND SIGMA"); if (enableRefl) { reflOverSgn = hMassForSgn[iSliceVar]->Integral(hMassForSgn[iSliceVar]->FindBin(massMin[iSliceVar] * 1.0001), hMassForSgn[iSliceVar]->FindBin(massMax[iSliceVar] * 0.999)); From 80dc165b5167f705ba1409eb9c03e74259c8f80b Mon Sep 17 00:00:00 2001 From: mherzer <96999709+mherzer28@users.noreply.github.com> Date: Thu, 24 Jul 2025 19:53:57 +0200 Subject: [PATCH 048/345] [PWGLF] fixing bb implementation and adding cfg for tof mass cut (#12183) Co-authored-by: ALICE Action Bot --- PWGLF/TableProducer/Nuspex/trHeAnalysis.cxx | 44 ++++++++++++++------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/PWGLF/TableProducer/Nuspex/trHeAnalysis.cxx b/PWGLF/TableProducer/Nuspex/trHeAnalysis.cxx index 40378ba6df4..3d3e2b61d2c 100644 --- a/PWGLF/TableProducer/Nuspex/trHeAnalysis.cxx +++ b/PWGLF/TableProducer/Nuspex/trHeAnalysis.cxx @@ -194,6 +194,8 @@ struct TrHeAnalysis { Configurable cfgTPCPidMethod{"cfgTPCPidMethod", false, "Using own or built in bethe parametrization"}; // false for built in Configurable cfgMassMethod{"cfgMassMethod", 0, "0: Using built in 1: mass calculated with beta 2: mass calculated with the event time"}; Configurable cfgEnableItsClusterSizeCut{"cfgEnableItsClusterSizeCut", false, "Enable ITS cluster size cut"}; + Configurable cfgEnableTofMassCut{"cfgEnableTofMassCut", false, "Enable TOF mass cut"}; + Configurable cfgTofMassCutPt{"cfgTofMassCutPt", 1.6f, "Pt value for which the TOF-cut starts to be used"}; // Set the multiplity event limits Configurable cfgLowMultCut{"cfgLowMultCut", 0.0f, "Accepted multiplicity percentage lower limit"}; Configurable cfgHighMultCut{"cfgHighMultCut", 100.0f, "Accepted multiplicity percentage higher limit"}; @@ -219,8 +221,11 @@ struct TrHeAnalysis { Configurable cfgCutMinItsClusterSizeHe{"cfgCutMinItsClusterSizeHe", 1.f, "Minimum ITS Cluster Size for He"}; Configurable cfgCutMaxItsClusterSizeH3{"cfgCutMaxItsClusterSizeH3", 4.f, "Maximum ITS Cluster Size for Tr"}; Configurable cfgCutMinItsClusterSizeH3{"cfgCutMinItsClusterSizeH3", 1.f, "Minimum ITS Cluster Size for Tr"}; - Configurable cfgCutMinTofMassH3{"cfgCutMinTofMassH3", 2.24f, "Minimum Tof mass H3"}; - Configurable cfgCutMaxTofMassH3{"cfgCutMaxTofMassH3", 3.32f, "Maximum TOF mass H3"}; + Configurable cfgCutMinTofMassH3{"cfgCutMinTofMassH3", 5.f, "Minimum Tof mass H3"}; + Configurable cfgCutMaxTofMassH3{"cfgCutMaxTofMassH3", 11.f, "Maximum TOF mass H3"}; + Configurable cfgMaxRigidity{"cfgMaxRigidity", 10.f, "Maximum rigidity value"}; + Configurable cfgMaxPt{"cfgMaxPt", 10.f, "Maximum pT value"}; + // Set the kinematic and PID cuts for tracks struct : ConfigurableGroup { Configurable pCut{"pCut", 0.6f, "Value of the p selection for spectra (default 0.3)"}; @@ -345,6 +350,9 @@ struct TrHeAnalysis { histos.fill(HIST("histogram/cuts"), 2); continue; } + if (track.pt() > cfgMaxPt || getRigidity(track) > cfgMaxRigidity) { + continue; + } if (track.tpcNClsFound() < cfgCutTpcClusters) { histos.fill(HIST("histogram/cuts"), 3); continue; @@ -399,9 +407,11 @@ struct TrHeAnalysis { continue; } } - if (getMass(track) < cfgCutMinTofMassH3 || getMass(track) > cfgCutMaxTofMassH3) { - histos.fill(HIST("histogram/cuts"), 13); - continue; + if (cfgEnableTofMassCut && track.pt() > cfgTofMassCutPt) { + if (getMass(track) < cfgCutMinTofMassH3 || getMass(track) > cfgCutMaxTofMassH3) { + histos.fill(HIST("histogram/cuts"), 13); + continue; + } } histos.fill(HIST("histogram/H3/H3-TPCsignVsTPCmomentum"), getRigidity(track) * track.sign(), @@ -510,6 +520,9 @@ struct TrHeAnalysis { histos.fill(HIST("histogram/cuts"), 2); continue; } + if (track.pt() > cfgMaxPt || getRigidity(track) > cfgMaxRigidity) { + continue; + } if (track.tpcNClsFound() < cfgCutTpcClusters) { histos.fill(HIST("histogram/cuts"), 3); continue; @@ -562,9 +575,11 @@ struct TrHeAnalysis { continue; } } - if (getMass(track) < cfgCutMinTofMassH3 || getMass(track) > cfgCutMaxTofMassH3) { - histos.fill(HIST("histogram/cuts"), 13); - continue; + if (cfgEnableTofMassCut && track.pt() > cfgTofMassCutPt) { + if (getMass(track) < cfgCutMinTofMassH3 || getMass(track) > cfgCutMaxTofMassH3) { + histos.fill(HIST("histogram/cuts"), 13); + continue; + } } histos.fill(HIST("histogram/H3/H3-TPCsignVsTPCmomentum"), getRigidity(track) * (1.f * track.sign()), @@ -709,14 +724,15 @@ struct TrHeAnalysis { float getMass(const T& track) { if (cfgMassMethod == 0) { - return track.mass(); + float m = track.mass(); + return m * m; } if (cfgMassMethod == 1) { const float beta = track.beta(); const float rigidity = getRigidity(track); - float gamma = 1 / std::sqrt(1 - beta * beta); - float mass = (rigidity / std::sqrt(gamma * gamma - 1.f)); - return mass; + float gamma = 1.f / std::sqrt(1.f - beta * beta); + float mass = rigidity / std::sqrt(gamma * gamma - 1.f); + return mass * mass; } if (cfgMassMethod == 2) { const float rigidity = getRigidity(track); @@ -727,9 +743,9 @@ struct TrHeAnalysis { float time = tofTime - tofStartTime; if (time > 0.f && length > 0.f) { float beta = length / (CInCmPs * time); - float gamma = 1 / std::sqrt(1 - beta * beta); + float gamma = 1.f / std::sqrt(1.f - beta * beta); float mass = rigidity / std::sqrt(gamma * gamma - 1.f); - return mass; + return mass * mass; } return -1.f; } From efbadf59903b5eb20a766c680d3663afe34e89ba Mon Sep 17 00:00:00 2001 From: SuJeong Ji <120470463+SuJeong-Ji@users.noreply.github.com> Date: Thu, 24 Jul 2025 21:22:33 +0200 Subject: [PATCH 049/345] [PWGLF] Add rotational bkg and configurables for secondary selections for 'chk892pp.cxx' (#12224) Co-authored-by: ALICE Action Bot --- PWGLF/Tasks/Resonances/chk892pp.cxx | 663 ++++++++++++++-------------- 1 file changed, 330 insertions(+), 333 deletions(-) diff --git a/PWGLF/Tasks/Resonances/chk892pp.cxx b/PWGLF/Tasks/Resonances/chk892pp.cxx index 269e8d0845d..410643d6c6b 100644 --- a/PWGLF/Tasks/Resonances/chk892pp.cxx +++ b/PWGLF/Tasks/Resonances/chk892pp.cxx @@ -63,6 +63,7 @@ #include "Common/Core/RecoDecay.h" #include "CommonConstants/PhysicsConstants.h" +#include "CommonConstants/MathConstants.h" #include "ReconstructionDataFormats/Track.h" @@ -80,23 +81,16 @@ using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::soa; using namespace o2::constants::physics; +using namespace o2::aod::rctsel; -struct chk892pp { - enum binType : unsigned int { +struct Chk892pp { + enum BinType : unsigned int { kKstarP = 0, kKstarN, kKstarP_Mix, kKstarN_Mix, - kKstarP_GenINEL10, - kKstarN_GenINEL10, - kKstarP_GenINELgt10, - kKstarN_GenINELgt10, - kKstarP_GenTrig10, - kKstarN_GenTrig10, - kKstarP_GenEvtSel, - kKstarN_GenEvtSel, - kKstarP_Rec, - kKstarN_Rec, + kKstarP_Rot, + kKstarN_Rot, kTYEnd }; @@ -118,35 +112,45 @@ struct chk892pp { Service pdg; o2::ccdb::CcdbApi ccdbApi; - Configurable cfgURL{"cfgURL", "http://alice-ccdb.cern.ch", "Address of the CCDB to browse"}; - Configurable nolaterthan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "Latest acceptable timestamp of creation for the object"}; + struct : ConfigurableGroup { + Configurable cfgURL{"cfgURL", "http://alice-ccdb.cern.ch", "Address of the CCDB to browse"}; + } CCDBConfig; + // Configurable nolaterthan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "Latest acceptable timestamp of creation for the object"}; // Configurables - ConfigurableAxis cfgBinsPt{"cfgBinsPt", {VARIABLE_WIDTH, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8, 4.9, 5.0, 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 5.9, 6.0, 6.1, 6.2, 6.3, 6.4, 6.5, 6.6, 6.7, 6.8, 6.9, 7.0, 7.1, 7.2, 7.3, 7.4, 7.5, 7.6, 7.7, 7.8, 7.9, 8.0, 8.1, 8.2, 8.3, 8.4, 8.5, 8.6, 8.7, 8.8, 8.9, 9.0, 9.1, 9.2, 9.3, 9.4, 9.5, 9.6, 9.7, 9.8, 9.9, 10.0, 10.1, 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 11.0, 11.1, 11.2, 11.3, 11.4, 11.5, 11.6, 11.7, 11.8, 11.9, 12.0, 12.1, 12.2, 12.3, 12.4, 12.5, 12.6, 12.7, 12.8, 12.9, 13.0, 13.1, 13.2, 13.3, 13.4, 13.5, 13.6, 13.7, 13.8, 13.9, 14.0, 14.1, 14.2, 14.3, 14.4, 14.5, 14.6, 14.7, 14.8, 14.9, 15.0}, "Binning of the pT axis"}; - ConfigurableAxis cfgBinsPtQA{"cfgBinsPtQA", {VARIABLE_WIDTH, 0.0, 0.2, 0.4, 0.6, 0.8, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0, 3.2, 3.4, 3.6, 3.8, 4.0, 4.2, 4.4, 4.6, 4.8, 5.0, 5.2, 5.4, 5.6, 5.8, 6.0, 6.2, 6.4, 6.6, 6.8, 7.0, 7.2, 7.4, 7.6, 7.8, 8.0, 8.2, 8.4, 8.6, 8.8, 9.0, 9.2, 9.4, 9.6, 9.8, 10.0}, "Binning of the pT axis"}; - ConfigurableAxis cfgBinsCent{"cfgBinsCent", {VARIABLE_WIDTH, 0.0, 1.0, 5.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 110.0}, "Binning of the centrality axis"}; - ConfigurableAxis cfgBinsVtxZ{"cfgBinsVtxZ", {VARIABLE_WIDTH, -10.0, -9.0, -8.0, -7.0, -6.0, -5.0, -4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0}, "Binning of the z-vertex axis"}; - Configurable cNbinsDiv{"cNbinsDiv", 1, "Integer to divide the number of bins"}; + struct : ConfigurableGroup { + ConfigurableAxis cfgBinsPt{"cfgBinsPt", {VARIABLE_WIDTH, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8, 4.9, 5.0, 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 5.9, 6.0, 6.1, 6.2, 6.3, 6.4, 6.5, 6.6, 6.7, 6.8, 6.9, 7.0, 7.1, 7.2, 7.3, 7.4, 7.5, 7.6, 7.7, 7.8, 7.9, 8.0, 8.1, 8.2, 8.3, 8.4, 8.5, 8.6, 8.7, 8.8, 8.9, 9.0, 9.1, 9.2, 9.3, 9.4, 9.5, 9.6, 9.7, 9.8, 9.9, 10.0, 10.1, 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 11.0, 11.1, 11.2, 11.3, 11.4, 11.5, 11.6, 11.7, 11.8, 11.9, 12.0, 12.1, 12.2, 12.3, 12.4, 12.5, 12.6, 12.7, 12.8, 12.9, 13.0, 13.1, 13.2, 13.3, 13.4, 13.5, 13.6, 13.7, 13.8, 13.9, 14.0, 14.1, 14.2, 14.3, 14.4, 14.5, 14.6, 14.7, 14.8, 14.9, 15.0}, "Binning of the pT axis"}; + ConfigurableAxis cfgBinsPtQA{"cfgBinsPtQA", {VARIABLE_WIDTH, 0.0, 0.2, 0.4, 0.6, 0.8, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0, 3.2, 3.4, 3.6, 3.8, 4.0, 4.2, 4.4, 4.6, 4.8, 5.0, 5.2, 5.4, 5.6, 5.8, 6.0, 6.2, 6.4, 6.6, 6.8, 7.0, 7.2, 7.4, 7.6, 7.8, 8.0, 8.2, 8.4, 8.6, 8.8, 9.0, 9.2, 9.4, 9.6, 9.8, 10.0}, "Binning of the pT axis"}; + ConfigurableAxis cfgBinsCent{"cfgBinsCent", {VARIABLE_WIDTH, 0.0, 1.0, 5.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 110.0}, "Binning of the centrality axis"}; + ConfigurableAxis cfgBinsVtxZ{"cfgBinsVtxZ", {VARIABLE_WIDTH, -10.0, -9.0, -8.0, -7.0, -6.0, -5.0, -4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0}, "Binning of the z-vertex axis"}; + Configurable cNbinsDiv{"cNbinsDiv", 1, "Integer to divide the number of bins"}; + Configurable cNbinsDivQA{"cNbinsDivQA", 1, "Integer to divide the number of bins for QA"}; + } AxisConfig; /// Event cuts o2::analysis::CollisonCuts colCuts; - Configurable ConfEvtZvtx{"ConfEvtZvtx", 10.f, "Evt sel: Max. z-Vertex (cm)"}; - Configurable ConfEvtOccupancyInTimeRangeMax{"ConfEvtOccupancyInTimeRangeMax", -1, "Evt sel: maximum track occupancy"}; - Configurable ConfEvtOccupancyInTimeRangeMin{"ConfEvtOccupancyInTimeRangeMin", -1, "Evt sel: minimum track occupancy"}; - Configurable ConfEvtTriggerCheck{"ConfEvtTriggerCheck", false, "Evt sel: check for trigger"}; - Configurable ConfEvtOfflineCheck{"ConfEvtOfflineCheck", true, "Evt sel: check for offline selection"}; - Configurable ConfEvtTriggerTVXSel{"ConfEvtTriggerTVXSel", false, "Evt sel: triggerTVX selection (MB)"}; - Configurable ConfEvtTFBorderCut{"ConfEvtTFBorderCut", false, "Evt sel: apply TF border cut"}; - Configurable ConfEvtUseITSTPCvertex{"ConfEvtUseITSTPCvertex", false, "Evt sel: use at lease on ITS-TPC track for vertexing"}; - Configurable ConfEvtZvertexTimedifference{"ConfEvtZvertexTimedifference", true, "Evt sel: apply Z-vertex time difference"}; - Configurable ConfEvtPileupRejection{"ConfEvtPileupRejection", true, "Evt sel: apply pileup rejection"}; - Configurable ConfEvtNoITSROBorderCut{"ConfEvtNoITSROBorderCut", false, "Evt sel: apply NoITSRO border cut"}; - Configurable ConfincludeCentralityMC{"ConfincludeCentralityMC", false, "Include centrality in MC"}; - Configurable ConfEvtCollInTimeRangeStandard{"ConfEvtCollInTimeRangeStandard", true, "Evt sel: apply NoCollInTimeRangeStandard"}; - - /// Track selections - Configurable cMinPtcut{"cMinPtcut", 0.15, "Track minium pt cut"}; - Configurable cMaxEtacut{"cMaxEtacut", 0.8, "Track maximum eta cut"}; + struct : ConfigurableGroup { + Configurable cfgEvtZvtx{"cfgEvtZvtx", 10.f, "Evt sel: Max. z-Vertex (cm)"}; + Configurable cfgEvtOccupancyInTimeRangeMax{"cfgEvtOccupancyInTimeRangeMax", -1, "Evt sel: maximum track occupancy"}; + Configurable cfgEvtOccupancyInTimeRangeMin{"cfgEvtOccupancyInTimeRangeMin", -1, "Evt sel: minimum track occupancy"}; + Configurable cfgEvtTriggerCheck{"cfgEvtTriggerCheck", false, "Evt sel: check for trigger"}; + Configurable cfgEvtOfflineCheck{"cfgEvtOfflineCheck", true, "Evt sel: check for offline selection"}; + Configurable cfgEvtTriggerTVXSel{"cfgEvtTriggerTVXSel", false, "Evt sel: triggerTVX selection (MB)"}; + Configurable cfgEvtTFBorderCut{"cfgEvtTFBorderCut", false, "Evt sel: apply TF border cut"}; + Configurable cfgEvtUseITSTPCvertex{"cfgEvtUseITSTPCvertex", false, "Evt sel: use at lease on ITS-TPC track for vertexing"}; + Configurable cfgEvtZvertexTimedifference{"cfgEvtZvertexTimedifference", true, "Evt sel: apply Z-vertex time difference"}; + Configurable cfgEvtPileupRejection{"cfgEvtPileupRejection", true, "Evt sel: apply pileup rejection"}; + Configurable cfgEvtNoITSROBorderCut{"cfgEvtNoITSROBorderCut", false, "Evt sel: apply NoITSRO border cut"}; + Configurable cfgincludeCentralityMC{"cfgincludeCentralityMC", false, "Include centrality in MC"}; + Configurable cfgEvtCollInTimeRangeStandard{"cfgEvtCollInTimeRangeStandard", true, "Evt sel: apply NoCollInTimeRangeStandard"}; + Configurable cfgEventCentralityMin{"cfgEventCentralityMin", 0.0f, "Event sel: minimum centrality"}; + Configurable cfgEventCentralityMax{"cfgEventCentralityMax", 80.0f, "Event sel: maximum centrality"}; + Configurable cfgEvtUseRCTFlagChecker{"cfgEvtUseRCTFlagChecker", false, "Evt sel: use RCT flag checker"}; + Configurable cfgEvtRCTFlagCheckerLabel{"cfgEvtRCTFlagCheckerLabel", "CBT_hadronPID", "Evt sel: RCT flag checker label"}; + Configurable cfgEvtRCTFlagCheckerZDCCheck{"cfgEvtRCTFlagCheckerZDCCheck", false, "Evt sel: RCT flag checker ZDC check"}; + Configurable cfgEvtRCTFlagCheckerLimitAcceptAsBad{"cfgEvtRCTFlagCheckerLimitAcceptAsBad", false, "Evt sel: RCT flag checker treat Limited Acceptance As Bad"}; + } EventCuts; + RCTFlagsChecker rctChecker; /* // Cuts from polarization analysis @@ -157,86 +161,111 @@ struct chk892pp { */ Configurable cfgCentEst{"cfgCentEst", 1, "Centrality estimator, 1: FT0C, 2: FT0M"}; - // DCAr to PV - Configurable cMaxbDCArToPVcut{"cMaxbDCArToPVcut", 0.1, "Track DCAr cut to PV Maximum"}; - // DCAz to PV - Configurable cMaxbDCAzToPVcut{"cMaxbDCAzToPVcut", 0.1, "Track DCAz cut to PV Maximum"}; - /// PID Selections, pion - Configurable cTPConly{"cTPConly", true, "Use only TPC for PID"}; // bool - Configurable cMaxTPCnSigmaPion{"cMaxTPCnSigmaPion", 3.0, "TPC nSigma cut for Pion"}; // TPC - Configurable cMaxTOFnSigmaPion{"cMaxTOFnSigmaPion", 3.0, "TOF nSigma cut for Pion"}; // TOF - Configurable nsigmaCutCombinedPion{"nsigmaCutCombinedPion", -999, "Combined nSigma cut for Pion"}; // Combined - Configurable cTOFVeto{"cTOFVeto", true, "TOF Veto, if false, TOF is nessessary for PID selection"}; // TOF Veto + struct : ConfigurableGroup { + Configurable cfgTPConly{"cfgTPConly", true, "Use only TPC for PID"}; // bool + Configurable cfgMaxTPCnSigmaPion{"cfgMaxTPCnSigmaPion", 3.0, "TPC nSigma cut for Pion"}; // TPC + Configurable cfgMaxTOFnSigmaPion{"cfgMaxTOFnSigmaPion", 3.0, "TOF nSigma cut for Pion"}; // TOF + Configurable cfgNsigmaCutCombinedPion{"cfgNsigmaCutCombinedPion", -999, "Combined nSigma cut for Pion"}; // Combined + Configurable cfgTOFVeto{"cfgTOFVeto", true, "TOF Veto, if false, TOF is nessessary for PID selection"}; // TOF Veto + } PIDCuts; // Track selections - Configurable cfgPrimaryTrack{"cfgPrimaryTrack", true, "Primary track selection"}; // kGoldenChi2 | kDCAxy | kDCAz - Configurable cfgGlobalWoDCATrack{"cfgGlobalWoDCATrack", true, "Global track selection without DCA"}; // kQualityTracks (kTrackType | kTPCNCls | kTPCCrossedRows | kTPCCrossedRowsOverNCls | kTPCChi2NDF | kTPCRefit | kITSNCls | kITSChi2NDF | kITSRefit | kITSHits) | kInAcceptanceTracks (kPtRange | kEtaRange) - Configurable cfgGlobalTrack{"cfgGlobalTrack", false, "Global track selection"}; // kGoldenChi2 | kDCAxy | kDCAz - Configurable cfgPVContributor{"cfgPVContributor", false, "PV contributor track selection"}; // PV Contriuibutor - - Configurable cfgITScluster{"cfgITScluster", 0, "Number of ITS cluster"}; - Configurable cfgTPCcluster{"cfgTPCcluster", 0, "Number of TPC cluster"}; - Configurable cfgRatioTPCRowsOverFindableCls{"cfgRatioTPCRowsOverFindableCls", 0.0f, "TPC Crossed Rows to Findable Clusters"}; - Configurable cfgITSChi2NCl{"cfgITSChi2NCl", 999.0, "ITS Chi2/NCl"}; - Configurable cfgTPCChi2NCl{"cfgTPCChi2NCl", 999.0, "TPC Chi2/NCl"}; - Configurable cfgUseTPCRefit{"cfgUseTPCRefit", false, "Require TPC Refit"}; - Configurable cfgUseITSRefit{"cfgUseITSRefit", false, "Require ITS Refit"}; - Configurable cfgHasITS{"cfgHasITS", false, "Require ITS"}; - Configurable cfgHasTPC{"cfgHasTPC", false, "Require TPC"}; - Configurable cfgHasTOF{"cfgHasTOF", false, "Require TOF"}; + struct : ConfigurableGroup { + Configurable cfgMinPtcut{"cfgMinPtcut", 0.15, "Track minium pt cut"}; + Configurable cfgMaxEtacut{"cfgMaxEtacut", 0.8, "Track maximum eta cut"}; + Configurable cfgPrimaryTrack{"cfgPrimaryTrack", true, "Primary track selection"}; // kGoldenChi2 | kDCAxy | kDCAz + Configurable cfgGlobalWoDCATrack{"cfgGlobalWoDCATrack", true, "Global track selection without DCA"}; // kQualityTracks (kTrackType | kTPCNCls | kTPCCrossedRows | kTPCCrossedRowsOverNCls | kTPCChi2NDF | kTPCRefit | kITSNCls | kITSChi2NDF | kITSRefit | kITSHits) | kInAcceptanceTracks (kPtRange | kEtaRange) + Configurable cfgGlobalTrack{"cfgGlobalTrack", false, "Global track selection"}; // kGoldenChi2 | kDCAxy | kDCAz + Configurable cfgPVContributor{"cfgPVContributor", false, "PV contributor track selection"}; // PV Contriuibutor + + Configurable cfgpTdepDCAxyCut{"cfgpTdepDCAxyCut", false, "pT-dependent DCAxy cut"}; + Configurable cfgITScluster{"cfgITScluster", 0, "Number of ITS cluster"}; + Configurable cfgTPCcluster{"cfgTPCcluster", 0, "Number of TPC cluster"}; + Configurable cfgRatioTPCRowsOverFindableCls{"cfgRatioTPCRowsOverFindableCls", 0.0f, "TPC Crossed Rows to Findable Clusters"}; + Configurable cfgITSChi2NCl{"cfgITSChi2NCl", 999.0, "ITS Chi2/NCl"}; + Configurable cfgTPCChi2NCl{"cfgTPCChi2NCl", 999.0, "TPC Chi2/NCl"}; + Configurable cfgUseTPCRefit{"cfgUseTPCRefit", false, "Require TPC Refit"}; + Configurable cfgUseITSRefit{"cfgUseITSRefit", false, "Require ITS Refit"}; + Configurable cfgHasITS{"cfgHasITS", false, "Require ITS"}; + Configurable cfgHasTPC{"cfgHasTPC", false, "Require TPC"}; + Configurable cfgHasTOF{"cfgHasTOF", false, "Require TOF"}; + // DCAr to PV + Configurable cfgMaxbDCArToPVcut{"cfgMaxbDCArToPVcut", 0.1, "Track DCAr cut to PV Maximum"}; + // DCAz to PV + Configurable cfgMaxbDCAzToPVcut{"cfgMaxbDCAzToPVcut", 0.1, "Track DCAz cut to PV Maximum"}; + } TrackCuts; // Secondary Selection - Configurable cfgReturnFlag{"boolReturnFlag", false, "Return Flag for debugging"}; - Configurable cSecondaryRequire{"bool", true, "Secondary cuts on/off"}; - Configurable cSecondaryArmenterosCut{"boolArmenterosCut", true, "cut on Armenteros-Podolanski graph"}; - - Configurable cfgByPassDauPIDSelection{"cfgByPassDauPIDSelection", true, "Bypass Daughters PID selection"}; - Configurable cSecondaryDauDCAMax{"cSecondaryDauDCAMax", 1., "Maximum DCA Secondary daughters to PV"}; - Configurable cSecondaryDauPosDCAtoPVMin{"cSecondaryDauPosDCAtoPVMin", 0.0, "Minimum DCA Secondary positive daughters to PV"}; - Configurable cSecondaryDauNegDCAtoPVMin{"cSecondaryDauNegDCAtoPVMin", 0.0, "Minimum DCA Secondary negative daughters to PV"}; - - Configurable cSecondaryPtMin{"cSecondaryPtMin", 0.f, "Minimum transverse momentum of Secondary"}; - Configurable cSecondaryRapidityMax{"cSecondaryRapidityMax", 0.5, "Maximum rapidity of Secondary"}; - Configurable cSecondaryRadiusMin{"cSecondaryRadiusMin", 1.2, "Minimum transverse radius of Secondary"}; - Configurable cSecondaryCosPAMin{"cSecondaryCosPAMin", 0.995, "Mininum cosine pointing angle of Secondary"}; - Configurable cSecondaryDCAtoPVMax{"cSecondaryDCAtoPVMax", 0.3, "Maximum DCA Secondary to PV"}; - Configurable cSecondaryProperLifetimeMax{"cSecondaryProperLifetimeMax", 20, "Maximum Secondary Lifetime"}; - Configurable cSecondaryparamArmenterosCut{"paramArmenterosCut", 0.2, "parameter for Armenteros Cut"}; - Configurable cSecondaryMassWindow{"cSecondaryMassWindow", 0.075, "Secondary inv mass selciton window"}; + struct : ConfigurableGroup { + Configurable cfgReturnFlag{"cfgReturnFlag", false, "Return Flag for debugging"}; + Configurable cfgSecondaryRequire{"cfgSecondaryRequire", true, "Secondary cuts on/off"}; + Configurable cfgSecondaryArmenterosCut{"cfgSecondaryArmenterosCut", true, "cut on Armenteros-Podolanski graph"}; + Configurable cfgSecondaryCrossMassHypothesisCut{"cfgSecondaryCrossMassHypothesisCut", false, "Apply cut based on the lambda mass hypothesis"}; + + Configurable cfgByPassDauPIDSelection{"cfgByPassDauPIDSelection", true, "Bypass Daughters PID selection"}; + Configurable cfgSecondaryDauDCAMax{"cfgSecondaryDauDCAMax", 1., "Maximum DCA Secondary daughters to PV"}; + Configurable cfgSecondaryDauPosDCAtoPVMin{"cfgSecondaryDauPosDCAtoPVMin", 0.0, "Minimum DCA Secondary positive daughters to PV"}; + Configurable cfgSecondaryDauNegDCAtoPVMin{"cfgSecondaryDauNegDCAtoPVMin", 0.0, "Minimum DCA Secondary negative daughters to PV"}; + + Configurable cfgSecondaryPtMin{"cfgSecondaryPtMin", 0.f, "Minimum transverse momentum of Secondary"}; + Configurable cfgSecondaryRapidityMax{"cfgSecondaryRapidityMax", 0.8, "Maximum rapidity of Secondary"}; + Configurable cfgSecondaryRadiusMin{"cfgSecondaryRadiusMin", 1.2, "Minimum transverse radius of Secondary"}; + Configurable cfgSecondaryRadiusMax{"cfgSecondaryRadiusMax", 999.9, "Maximum transverse radius of Secondary"}; + Configurable cfgSecondaryCosPAMin{"cfgSecondaryCosPAMin", 0.995, "Mininum cosine pointing angle of Secondary"}; + Configurable cfgSecondaryDCAtoPVMax{"cfgSecondaryDCAtoPVMax", 0.3, "Maximum DCA Secondary to PV"}; + Configurable cfgSecondaryProperLifetimeMax{"cfgSecondaryProperLifetimeMax", 20, "Maximum Secondary Lifetime"}; + Configurable cfgSecondaryparamArmenterosCut{"cfgSecondaryparamArmenterosCut", 0.2, "parameter for Armenteros Cut"}; + Configurable cfgSecondaryMassWindow{"cfgSecondaryMassWindow", 0.03, "Secondary inv mass selciton window"}; + Configurable cfgSecondaryCrossMassCutWindow{"cfgSecondaryCrossMassCutWindow", 0.05, "Secondary inv mass selection window with (anti)lambda hypothesis"}; + } SecondaryCuts; // K* selection - Configurable cKstarMaxRap{"cKstarMaxRap", 0.5, "Kstar maximum rapidity"}; - Configurable cKstarMinRap{"cKstarMinRap", -0.5, "Kstar minimum rapidity"}; - - float centrality; + struct : ConfigurableGroup { + Configurable cfgKstarMaxRap{"cfgKstarMaxRap", 0.5, "Kstar maximum rapidity"}; + Configurable cfgKstarMinRap{"cfgKstarMinRap", -0.5, "Kstar minimum rapidity"}; + } KstarCuts; + + // Bkg estimation + struct : ConfigurableGroup { + Configurable cfgFillRotBkg{"cfgFillRotBkg", true, "Fill rotated background"}; + Configurable cfgMinRot{"cfgMinRot", 5.0 * constants::math::PI / 6.0, "Minimum of rotation"}; + Configurable cfgMaxRot{"cfgMaxRot", 7.0 * constants::math::PI / 6.0, "Maximum of rotation"}; + Configurable cfgRotPion{"cfgRotPion", true, "Rotate pion"}; + Configurable cfgNrotBkg{"cfgNrotBkg", 4, "Number of rotated copies (background) per each original candidate"}; + } BkgEstimationConfig; + + float lCentrality; // PDG code - int kPDGK0s = 310; - int kPDGK0 = 311; - int kKstarPlus = 323; - int kPiPlus = 211; + int kPDGK0s = kK0Short; + int kPDGK0 = kK0; + int kKstarPlus = o2::constants::physics::Pdg::kKPlusStar892; + // int kPiPlus = 211; void init(o2::framework::InitContext&) { - centrality = -999; + lCentrality = -999; - colCuts.setCuts(ConfEvtZvtx, ConfEvtTriggerCheck, ConfEvtOfflineCheck, /*checkRun3*/ true, /*triggerTVXsel*/ false, ConfEvtOccupancyInTimeRangeMax, ConfEvtOccupancyInTimeRangeMin); + colCuts.setCuts(EventCuts.cfgEvtZvtx, EventCuts.cfgEvtTriggerCheck, EventCuts.cfgEvtOfflineCheck, /*checkRun3*/ true, /*triggerTVXsel*/ false, EventCuts.cfgEvtOccupancyInTimeRangeMax, EventCuts.cfgEvtOccupancyInTimeRangeMin); colCuts.init(&histos); - colCuts.setTriggerTVX(ConfEvtTriggerTVXSel); - colCuts.setApplyTFBorderCut(ConfEvtTFBorderCut); - colCuts.setApplyITSTPCvertex(ConfEvtUseITSTPCvertex); - colCuts.setApplyZvertexTimedifference(ConfEvtZvertexTimedifference); - colCuts.setApplyPileupRejection(ConfEvtPileupRejection); - colCuts.setApplyNoITSROBorderCut(ConfEvtNoITSROBorderCut); - colCuts.setApplyCollInTimeRangeStandard(ConfEvtCollInTimeRangeStandard); - - AxisSpec centAxis = {cfgBinsCent, "T0M (%)"}; - AxisSpec vtxzAxis = {cfgBinsVtxZ, "Z Vertex (cm)"}; + colCuts.setTriggerTVX(EventCuts.cfgEvtTriggerTVXSel); + colCuts.setApplyTFBorderCut(EventCuts.cfgEvtTFBorderCut); + colCuts.setApplyITSTPCvertex(EventCuts.cfgEvtUseITSTPCvertex); + colCuts.setApplyZvertexTimedifference(EventCuts.cfgEvtZvertexTimedifference); + colCuts.setApplyPileupRejection(EventCuts.cfgEvtPileupRejection); + colCuts.setApplyNoITSROBorderCut(EventCuts.cfgEvtNoITSROBorderCut); + colCuts.setApplyCollInTimeRangeStandard(EventCuts.cfgEvtCollInTimeRangeStandard); + colCuts.printCuts(); + + rctChecker.init(EventCuts.cfgEvtRCTFlagCheckerLabel, EventCuts.cfgEvtRCTFlagCheckerZDCCheck, EventCuts.cfgEvtRCTFlagCheckerLimitAcceptAsBad); + + AxisSpec centAxis = {AxisConfig.cfgBinsCent, "T0M (%)"}; + AxisSpec vtxzAxis = {AxisConfig.cfgBinsVtxZ, "Z Vertex (cm)"}; AxisSpec epAxis = {100, -1.0 * constants::math::PI, constants::math::PI}; AxisSpec epresAxis = {100, -1.02, 1.02}; - AxisSpec ptAxis = {cfgBinsPt, "#it{p}_{T} (GeV/#it{c})"}; - AxisSpec ptAxisQA = {cfgBinsPtQA, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec ptAxis = {AxisConfig.cfgBinsPt, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec ptAxisQA = {AxisConfig.cfgBinsPtQA, "#it{p}_{T} (GeV/#it{c})"}; AxisSpec radiusAxis = {50, 0, 5, "Radius (cm)"}; AxisSpec cpaAxis = {50, 0.95, 1.0, "CPA"}; AxisSpec tauAxis = {250, 0, 25, "Lifetime (cm)"}; @@ -244,15 +273,14 @@ struct chk892pp { AxisSpec dcaxyAxis = {200, 0, 2, "DCA_{#it{xy}} (cm)"}; AxisSpec dcazAxis = {200, 0, 2, "DCA_{#it{z}} (cm)"}; AxisSpec yAxis = {100, -1, 1, "Rapidity"}; - AxisSpec invMassAxisK0s = {400 / cNbinsDiv, 0.3, 0.7, "Invariant Mass (GeV/#it{c}^2)"}; // K0s ~497.611 - AxisSpec invMassAxisReso = {900 / cNbinsDiv, 0.5f, 1.4f, "Invariant Mass (GeV/#it{c}^2)"}; // chK(892) ~892 - AxisSpec invMassAxisScan = {150, 0, 1.5, "Invariant Mass (GeV/#it{c}^2)"}; // For selection - AxisSpec pidQAAxis = {130, -6.5, 6.5}; + AxisSpec invMassAxisK0s = {800 / AxisConfig.cNbinsDiv, 0.46, 0.54, "Invariant Mass (GeV/#it{c}^2)"}; // K0s ~497.611 + AxisSpec invMassAxisReso = {900 / AxisConfig.cNbinsDiv, 0.5f, 1.4f, "Invariant Mass (GeV/#it{c}^2)"}; // chK(892) ~892 + AxisSpec pidQAAxis = {130 / AxisConfig.cNbinsDivQA, -6.5, 6.5}; AxisSpec dataTypeAxis = {9, 0, 9, "Histogram types"}; AxisSpec mcTypeAxis = {4, 0, 4, "Histogram types"}; // THnSparse - AxisSpec axisType = {binType::kTYEnd, 0, binType::kTYEnd, "Type of bin with charge and mix"}; + AxisSpec axisType = {BinType::kTYEnd, 0, BinType::kTYEnd, "Type of bin with charge and mix"}; AxisSpec mcLabelAxis = {5, -0.5, 4.5, "MC Label"}; histos.add("QA/K0sCutCheck", "Check K0s cut", HistType::kTH1D, {AxisSpec{12, -0.5, 11.5, "Check"}}); @@ -397,7 +425,7 @@ struct chk892pp { histos.add("hInvmass_Kstar_MC", "Invariant mass of unlike chK(892)", HistType::kTHnSparseD, {axisType, centAxis, ptAxis, invMassAxisReso}); - ccdb->setURL(cfgURL); + ccdb->setURL(CCDBConfig.cfgURL); ccdbApi.init("http://alice-ccdb.cern.ch"); ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); @@ -410,7 +438,7 @@ struct chk892pp { } template - float GetCentrality(CollisionType const& collision) + float getCentrality(CollisionType const& collision) { if (cfgCentEst == 1) { return collision.multFT0C(); @@ -422,7 +450,7 @@ struct chk892pp { } template - int GetDetId(DetNameType const& name) + int getlDetId(DetNameType const& name) { LOGF(info, "GetDetID running"); if (name.value == "FT0C") { @@ -447,41 +475,47 @@ struct chk892pp { bool trackCut(TrackType const& track) { // basic track cuts - if (std::abs(track.pt()) < cMinPtcut) - return false; - if (std::abs(track.eta()) > cMaxEtacut) + if (std::abs(track.pt()) < TrackCuts.cfgMinPtcut) return false; - if (track.itsNCls() < cfgITScluster) + if (std::abs(track.eta()) > TrackCuts.cfgMaxEtacut) return false; - if (track.tpcNClsFound() < cfgTPCcluster) + if (track.itsNCls() < TrackCuts.cfgITScluster) return false; - if (track.tpcCrossedRowsOverFindableCls() < cfgRatioTPCRowsOverFindableCls) + if (track.tpcNClsFound() < TrackCuts.cfgTPCcluster) return false; - if (track.itsChi2NCl() >= cfgITSChi2NCl) + if (track.tpcCrossedRowsOverFindableCls() < TrackCuts.cfgRatioTPCRowsOverFindableCls) return false; - if (track.tpcChi2NCl() >= cfgTPCChi2NCl) + if (track.itsChi2NCl() >= TrackCuts.cfgITSChi2NCl) return false; - if (cfgHasITS && !track.hasITS()) + if (track.tpcChi2NCl() >= TrackCuts.cfgTPCChi2NCl) return false; - if (cfgHasTPC && !track.hasTPC()) + if (TrackCuts.cfgHasITS && !track.hasITS()) return false; - if (cfgHasTOF && !track.hasTOF()) + if (TrackCuts.cfgHasTPC && !track.hasTPC()) return false; - if (cfgUseITSRefit && !track.passedITSRefit()) + if (TrackCuts.cfgHasTOF && !track.hasTOF()) return false; - if (cfgUseTPCRefit && !track.passedTPCRefit()) + if (TrackCuts.cfgUseITSRefit && !track.passedITSRefit()) return false; - if (cfgPVContributor && !track.isPVContributor()) + if (TrackCuts.cfgUseTPCRefit && !track.passedTPCRefit()) return false; - if (cfgGlobalWoDCATrack && !track.isGlobalTrackWoDCA()) + if (TrackCuts.cfgPVContributor && !track.isPVContributor()) return false; - if (cfgGlobalTrack && !track.isGlobalTrack()) + if (TrackCuts.cfgGlobalWoDCATrack && !track.isGlobalTrackWoDCA()) return false; - if (cfgPrimaryTrack && !track.isPrimaryTrack()) + if (TrackCuts.cfgGlobalTrack && !track.isGlobalTrack()) return false; - if (std::abs(track.dcaXY()) > cMaxbDCArToPVcut) + if (TrackCuts.cfgPrimaryTrack && !track.isPrimaryTrack()) return false; - if (std::abs(track.dcaZ()) > cMaxbDCAzToPVcut) + if (TrackCuts.cfgpTdepDCAxyCut) { + // Tuned on the LHC22f anchored MC LHC23d1d on primary pions. 7 Sigmas of the resolution + if (std::abs(track.dcaXY()) > (0.004 + (0.013 / track.pt()))) + return false; + } else { + if (std::abs(track.dcaXY()) > TrackCuts.cfgMaxbDCArToPVcut) + return false; + } + if (std::abs(track.dcaZ()) > TrackCuts.cfgMaxbDCAzToPVcut) return false; return true; } @@ -490,217 +524,158 @@ struct chk892pp { template bool selectionPIDPion(TrackType const& candidate) { - bool tpcPIDPassed{false}, tofPIDPassed{false}; - - if (cTPConly) { + bool tpcPIDPassed = std::abs(candidate.tpcNSigmaPi()) < PIDCuts.cfgMaxTPCnSigmaPion; + bool tofPIDPassed = false; - if (std::abs(candidate.tpcNSigmaPi()) < cMaxTPCnSigmaPion) { - tpcPIDPassed = true; - } else { - return false; - } - tofPIDPassed = true; + if (PIDCuts.cfgTPConly) { + return tpcPIDPassed; + } + if (candidate.hasTOF()) { + tofPIDPassed = std::abs(candidate.tofNSigmaPi()) < PIDCuts.cfgMaxTOFnSigmaPion || + (PIDCuts.cfgNsigmaCutCombinedPion > 0 && + candidate.tpcNSigmaPi() * candidate.tpcNSigmaPi() + + candidate.tofNSigmaPi() * candidate.tofNSigmaPi() < + PIDCuts.cfgNsigmaCutCombinedPion * PIDCuts.cfgNsigmaCutCombinedPion); } else { - - if (std::abs(candidate.tpcNSigmaPi()) < cMaxTPCnSigmaPion) { - tpcPIDPassed = true; - } else { - return false; - } - if (candidate.hasTOF()) { - if (std::abs(candidate.tofNSigmaPi()) < cMaxTOFnSigmaPion) { - tofPIDPassed = true; - } - if ((nsigmaCutCombinedPion > 0) && (candidate.tpcNSigmaPi() * candidate.tpcNSigmaPi() + candidate.tofNSigmaPi() * candidate.tofNSigmaPi() < nsigmaCutCombinedPion * nsigmaCutCombinedPion)) { - tofPIDPassed = true; - } - } else { - if (!cTOFVeto) { - return false; - } - tofPIDPassed = true; - } + tofPIDPassed = PIDCuts.cfgTOFVeto; } - if (tpcPIDPassed && tofPIDPassed) { - return true; - } - return false; + return tpcPIDPassed && tofPIDPassed; } template bool selectionK0s(CollisionType const& collision, K0sType const& candidate) { - auto DauDCA = candidate.dcaV0daughters(); - auto DauPosDCAtoPV = candidate.dcapostopv(); - auto DauNegDCAtoPV = candidate.dcanegtopv(); - auto pT = candidate.pt(); - auto Rapidity = candidate.yK0Short(); - auto Radius = candidate.v0radius(); - auto DCAtoPV = candidate.dcav0topv(); - auto CPA = candidate.v0cosPA(); - auto PropTauK0s = candidate.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * MassK0Short; - auto mK0s = candidate.mK0Short(); - - if (cfgReturnFlag) { - bool returnFlag = true; - - if (cSecondaryRequire) { - histos.fill(HIST("QA/K0sCutCheck"), 0); - if (DauDCA > cSecondaryDauDCAMax) { - histos.fill(HIST("QA/K0sCutCheck"), 1); - returnFlag = false; - } - if (DauPosDCAtoPV < cSecondaryDauPosDCAtoPVMin) { - histos.fill(HIST("QA/K0sCutCheck"), 2); - returnFlag = false; - } - if (DauNegDCAtoPV < cSecondaryDauNegDCAtoPVMin) { - histos.fill(HIST("QA/K0sCutCheck"), 3); - returnFlag = false; - } - if (pT < cSecondaryPtMin) { - histos.fill(HIST("QA/K0sCutCheck"), 4); - returnFlag = false; - } - if (Rapidity > cSecondaryRapidityMax) { - histos.fill(HIST("QA/K0sCutCheck"), 5); - returnFlag = false; - } - if (Radius < cSecondaryRadiusMin) { - histos.fill(HIST("QA/K0sCutCheck"), 6); - returnFlag = false; - } - if (DCAtoPV > cSecondaryDCAtoPVMax) { - histos.fill(HIST("QA/K0sCutCheck"), 7); - returnFlag = false; - } - if (CPA < cSecondaryCosPAMin) { - histos.fill(HIST("QA/K0sCutCheck"), 8); - returnFlag = false; - } - if (PropTauK0s > cSecondaryProperLifetimeMax) { - histos.fill(HIST("QA/K0sCutCheck"), 9); - returnFlag = false; - } - if (candidate.qtarm() < cSecondaryparamArmenterosCut * TMath::Abs(candidate.alpha())) { - histos.fill(HIST("QA/K0sCutCheck"), 11); - returnFlag = false; - } - if (fabs(mK0s - MassK0Short) > cSecondaryMassWindow) { - histos.fill(HIST("QA/K0sCutCheck"), 10); - returnFlag = false; - } - - return returnFlag; - - } else { - if (fabs(mK0s - MassK0Short) > cSecondaryMassWindow) { - histos.fill(HIST("QA/K0sCutCheck"), 10); - returnFlag = false; - } + auto lDauDCA = candidate.dcaV0daughters(); + auto lDauPosDCAtoPV = candidate.dcapostopv(); + auto lDauNegDCAtoPV = candidate.dcanegtopv(); + auto lPt = candidate.pt(); + auto lRapidity = candidate.yK0Short(); + auto lRadius = candidate.v0radius(); + auto lDCAtoPV = candidate.dcav0topv(); + auto lCPA = candidate.v0cosPA(); + auto lPropTauK0s = candidate.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * MassK0Short; + auto lMk0s = candidate.mK0Short(); + auto lMLambda = candidate.mLambda(); + auto lMALambda = candidate.mAntiLambda(); + + auto checkCommonCuts = [&]() { + if (lDauDCA > SecondaryCuts.cfgSecondaryDauDCAMax) + return false; + if (lDauPosDCAtoPV < SecondaryCuts.cfgSecondaryDauPosDCAtoPVMin) + return false; + if (lDauNegDCAtoPV < SecondaryCuts.cfgSecondaryDauNegDCAtoPVMin) + return false; + if (lPt < SecondaryCuts.cfgSecondaryPtMin) + return false; + if (std::fabs(lRapidity) > SecondaryCuts.cfgSecondaryRapidityMax) + return false; + if (lRadius < SecondaryCuts.cfgSecondaryRadiusMin || lRadius > SecondaryCuts.cfgSecondaryRadiusMax) + return false; + if (lDCAtoPV > SecondaryCuts.cfgSecondaryDCAtoPVMax) + return false; + if (lCPA < SecondaryCuts.cfgSecondaryCosPAMin) + return false; + if (lPropTauK0s > SecondaryCuts.cfgSecondaryProperLifetimeMax) + return false; + if (candidate.qtarm() < SecondaryCuts.cfgSecondaryparamArmenterosCut * std::abs(candidate.alpha())) + return false; + if (std::fabs(lMk0s - MassK0Short) > SecondaryCuts.cfgSecondaryMassWindow) + return false; + if (SecondaryCuts.cfgSecondaryCrossMassHypothesisCut && + ((std::fabs(lMLambda - MassLambda0) < SecondaryCuts.cfgSecondaryCrossMassCutWindow) || (std::fabs(lMALambda - MassLambda0Bar) < SecondaryCuts.cfgSecondaryCrossMassCutWindow))) + return false; + return true; + }; - return returnFlag; + if (SecondaryCuts.cfgReturnFlag) { // For cut study + bool returnFlag = true; + histos.fill(HIST("QA/K0sCutCheck"), 0); + if (lDauDCA > SecondaryCuts.cfgSecondaryDauDCAMax) { + histos.fill(HIST("QA/K0sCutCheck"), 1); + returnFlag = false; } - - } else { - if (cSecondaryRequire) { - - histos.fill(HIST("QA/K0sCutCheck"), 0); - if (DauDCA > cSecondaryDauDCAMax) { - histos.fill(HIST("QA/K0sCutCheck"), 1); - return false; - } - if (DauPosDCAtoPV < cSecondaryDauPosDCAtoPVMin) { - histos.fill(HIST("QA/K0sCutCheck"), 2); - return false; - } - if (DauNegDCAtoPV < cSecondaryDauNegDCAtoPVMin) { - histos.fill(HIST("QA/K0sCutCheck"), 3); - return false; - } - if (pT < cSecondaryPtMin) { - histos.fill(HIST("QA/K0sCutCheck"), 4); - return false; - } - if (Rapidity > cSecondaryRapidityMax) { - histos.fill(HIST("QA/K0sCutCheck"), 5); - return false; - } - if (Radius < cSecondaryRadiusMin) { - histos.fill(HIST("QA/K0sCutCheck"), 6); - return false; - } - if (DCAtoPV > cSecondaryDCAtoPVMax) { - histos.fill(HIST("QA/K0sCutCheck"), 7); - return false; - } - if (CPA < cSecondaryCosPAMin) { - histos.fill(HIST("QA/K0sCutCheck"), 8); - return false; - } - if (PropTauK0s > cSecondaryProperLifetimeMax) { - histos.fill(HIST("QA/K0sCutCheck"), 9); - return false; - } - if (candidate.qtarm() < cSecondaryparamArmenterosCut * TMath::Abs(candidate.alpha())) { - histos.fill(HIST("QA/K0sCutCheck"), 11); - return false; - } - if (fabs(mK0s - MassK0Short) > cSecondaryMassWindow) { - histos.fill(HIST("QA/K0sCutCheck"), 10); - return false; - } - return true; - + if (lDauPosDCAtoPV < SecondaryCuts.cfgSecondaryDauPosDCAtoPVMin) { + histos.fill(HIST("QA/K0sCutCheck"), 2); + returnFlag = false; + } + if (lDauNegDCAtoPV < SecondaryCuts.cfgSecondaryDauNegDCAtoPVMin) { + histos.fill(HIST("QA/K0sCutCheck"), 3); + returnFlag = false; + } + if (lPt < SecondaryCuts.cfgSecondaryPtMin) { + histos.fill(HIST("QA/K0sCutCheck"), 4); + returnFlag = false; + } + if (std::fabs(lRapidity) > SecondaryCuts.cfgSecondaryRapidityMax) { + histos.fill(HIST("QA/K0sCutCheck"), 5); + returnFlag = false; + } + if (lRadius < SecondaryCuts.cfgSecondaryRadiusMin || lRadius > SecondaryCuts.cfgSecondaryRadiusMax) { + histos.fill(HIST("QA/K0sCutCheck"), 6); + returnFlag = false; + } + if (lDCAtoPV > SecondaryCuts.cfgSecondaryDCAtoPVMax) { + histos.fill(HIST("QA/K0sCutCheck"), 7); + returnFlag = false; + } + if (lCPA < SecondaryCuts.cfgSecondaryCosPAMin) { + histos.fill(HIST("QA/K0sCutCheck"), 8); + returnFlag = false; + } + if (lPropTauK0s > SecondaryCuts.cfgSecondaryProperLifetimeMax) { + histos.fill(HIST("QA/K0sCutCheck"), 9); + returnFlag = false; + } + if (candidate.qtarm() < SecondaryCuts.cfgSecondaryparamArmenterosCut * std::abs(candidate.alpha())) { + histos.fill(HIST("QA/K0sCutCheck"), 10); + returnFlag = false; + } + if (std::fabs(lMk0s - MassK0Short) > SecondaryCuts.cfgSecondaryMassWindow) { + histos.fill(HIST("QA/K0sCutCheck"), 11); + returnFlag = false; + } + if (SecondaryCuts.cfgSecondaryCrossMassHypothesisCut && + ((std::fabs(lMLambda - MassLambda0) < SecondaryCuts.cfgSecondaryCrossMassCutWindow) || (std::fabs(lMALambda - MassLambda0Bar) < SecondaryCuts.cfgSecondaryCrossMassCutWindow))) { + histos.fill(HIST("QA/K0sCutCheck"), 12); + returnFlag = false; + } + return returnFlag; + } else { // normal usage + if (SecondaryCuts.cfgSecondaryRequire) { + return checkCommonCuts(); } else { - if (fabs(mK0s - MassK0Short) > cSecondaryMassWindow) { - histos.fill(HIST("QA/K0sCutCheck"), 10); - return false; - } - return true; + return std::fabs(lMk0s - MassK0Short) <= SecondaryCuts.cfgSecondaryMassWindow; // always apply mass window cut } } } // selectionK0s - double GetPhiInRange(double phi) - { - double result = phi; - while (result < 0) { - result = result + 2. * TMath::Pi() / 2; - } - while (result > 2. * TMath::Pi() / 2) { - result = result - 2. * TMath::Pi() / 2; - } - return result; - } - template bool isTrueKstar(const TrackTemplate& bTrack, const V0Template& K0scand) { - if (abs(bTrack.PDGCode()) != kPiPlus) // Are you pion? + if (std::abs(bTrack.PDGCode()) != kPiPlus) // Are you pion? return false; - if (abs(K0scand.PDGCode()) != kPDGK0s) // Are you K0s? + if (std::abs(K0scand.PDGCode()) != kPDGK0s) // Are you K0s? return false; auto motherbTrack = bTrack.template mothers_as(); auto motherkV0 = K0scand.template mothers_as(); // Check bTrack first - if (abs(motherbTrack.pdgCode()) != kKstarPlus) // Are you charged Kstar's daughter? + if (std::abs(motherbTrack.pdgCode()) != kKstarPlus) // Are you charged Kstar's daughter? return false; // Apply first since it's more restrictive - if (abs(motherkV0.pdgCode()) != 310) // Is it K0s? + if (std::abs(motherkV0.pdgCode()) != 310) // Is it K0s? return false; // Check if K0s's mother is K0 (311) auto motherK0 = motherkV0.template mothers_as(); - if (abs(motherK0.pdgCode()) != 311) + if (std::abs(motherK0.pdgCode()) != 311) return false; // Check if K0's mother is Kstar (323) auto motherKstar = motherK0.template mothers_as(); - if (abs(motherKstar.pdgCode()) != 323) + if (std::abs(motherKstar.pdgCode()) != 323) return false; // Check if bTrack and K0 have the same mother (global index) @@ -715,9 +690,9 @@ struct chk892pp { template void fillHistograms(const CollisionType& collision, const TracksType& dTracks1, const TracksTypeK0s& dTracks2) { - histos.fill(HIST("QA/before/CentDist"), centrality); + histos.fill(HIST("QA/before/CentDist"), lCentrality); - TLorentzVector lDecayDaughter1, lDecayDaughter2, lResoSecondary, lDecayDaughter_bach, lResoKstar; + TLorentzVector lDecayDaughter1, lDecayDaughter2, lResoSecondary, lDecayDaughter_bach, lResoKstar, lDaughterRot, lResonanceRot; std::vector trackIndicies = {}; std::vector k0sIndicies = {}; @@ -758,9 +733,9 @@ struct chk892pp { trackIndicies.push_back(bTrack.index()); } - for (auto& K0scand : dTracks2) { - auto posDauTrack = K0scand.template posTrack_as(); - auto negDauTrack = K0scand.template negTrack_as(); + for (auto& k0sCand : dTracks2) { + auto posDauTrack = k0sCand.template posTrack_as(); + auto negDauTrack = k0sCand.template negTrack_as(); /// Daughters // Positve pion @@ -775,16 +750,16 @@ struct chk892pp { auto trknNSigmaPiTOF = (istrknhasTOF) ? negDauTrack.tofNSigmaPi() : -999.; /// K0s - auto trkkDauDCA = K0scand.dcaV0daughters(); - auto trkkDauDCAPostoPV = K0scand.dcapostopv(); - auto trkkDauDCANegtoPV = K0scand.dcanegtopv(); - auto trkkpt = K0scand.pt(); - auto trkky = K0scand.yK0Short(); - auto trkkRadius = K0scand.v0radius(); - auto trkkDCAtoPV = K0scand.dcav0topv(); - auto trkkCPA = K0scand.v0cosPA(); - auto trkkPropTau = K0scand.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * MassK0Short; - auto trkkMass = K0scand.mK0Short(); + auto trkkDauDCA = k0sCand.dcaV0daughters(); + auto trkky = k0sCand.yK0Short(); + auto trkkDCAtoPV = k0sCand.dcav0topv(); + auto trkkCPA = k0sCand.v0cosPA(); + auto trkkPropTau = k0sCand.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * MassK0Short; + auto trkkMass = k0sCand.mK0Short(); + auto trkkDauDCAPostoPV = k0sCand.dcapostopv(); + auto trkkDauDCANegtoPV = k0sCand.dcanegtopv(); + auto trkkpt = k0sCand.pt(); + auto trkkRadius = k0sCand.v0radius(); if constexpr (!IsMix) { // Seconddary QA plots @@ -819,13 +794,11 @@ struct chk892pp { histos.fill(HIST("QA/before/hInvmassSecondary"), trkkMass); } - // if (!trackCut(posDauTrack) || !trackCut(negDauTrack)) // Too tight cut for K0s daugthers - // continue; - if (!cfgByPassDauPIDSelection && !selectionPIDPion(posDauTrack)) // Perhaps it's already applied in trackCut (need to check QA plots) + if (!SecondaryCuts.cfgByPassDauPIDSelection && !selectionPIDPion(posDauTrack)) continue; - if (!cfgByPassDauPIDSelection && !selectionPIDPion(negDauTrack)) + if (!SecondaryCuts.cfgByPassDauPIDSelection && !selectionPIDPion(negDauTrack)) continue; - if (!selectionK0s(collision, K0scand)) + if (!selectionK0s(collision, k0sCand)) continue; if constexpr (!IsMix) { @@ -860,17 +833,19 @@ struct chk892pp { histos.fill(HIST("QA/after/hCPASecondary"), trkkCPA); histos.fill(HIST("QA/after/hPropTauSecondary"), trkkPropTau); histos.fill(HIST("QA/after/hInvmassSecondary"), trkkMass); + histos.fill(HIST("hInvmass_K0s"), lCentrality, lResoSecondary.Pt(), lResoSecondary.M()); } - k0sIndicies.push_back(K0scand.index()); + k0sIndicies.push_back(k0sCand.index()); } for (auto& trackIndex : trackIndicies) { for (auto& k0sIndex : k0sIndicies) { auto bTrack = dTracks1.rawIteratorAt(trackIndex); - auto K0scand = dTracks2.rawIteratorAt(k0sIndex); + auto k0sCand = dTracks2.rawIteratorAt(k0sIndex); + auto trkkMass = k0sCand.mK0Short(); lDecayDaughter_bach.SetXYZM(bTrack.px(), bTrack.py(), bTrack.pz(), MassPionCharged); - lResoSecondary.SetXYZM(K0scand.px(), K0scand.py(), K0scand.pz(), MassK0Short); + lResoSecondary.SetXYZM(k0sCand.px(), k0sCand.py(), k0sCand.pz(), trkkMass); lResoKstar = lResoSecondary + lDecayDaughter_bach; // QA plots @@ -879,16 +854,33 @@ struct chk892pp { histos.fill(HIST("QA/before/kstarinvmass"), lResoKstar.M()); } - if (lResoKstar.Rapidity() > cKstarMaxRap || lResoKstar.Rapidity() < cKstarMinRap) + if (lResoKstar.Rapidity() > KstarCuts.cfgKstarMaxRap || lResoKstar.Rapidity() < KstarCuts.cfgKstarMinRap) continue; if constexpr (!IsMix) { - unsigned int typeKstar = bTrack.sign() > 0 ? binType::kKstarP : binType::kKstarN; + unsigned int typeKstar = bTrack.sign() > 0 ? BinType::kKstarP : BinType::kKstarN; histos.fill(HIST("QA/after/KstarRapidity"), lResoKstar.Rapidity()); histos.fill(HIST("QA/after/kstarinvmass"), lResoKstar.M()); - histos.fill(HIST("hInvmass_Kstar"), typeKstar, centrality, lResoKstar.Pt(), lResoKstar.M()); - + histos.fill(HIST("hInvmass_Kstar"), typeKstar, lCentrality, lResoKstar.Pt(), lResoKstar.M()); + + if (BkgEstimationConfig.cfgFillRotBkg) { + for (int i = 0; i < BkgEstimationConfig.cfgNrotBkg; i++) { + auto lRotAngle = BkgEstimationConfig.cfgMinRot + i * ((BkgEstimationConfig.cfgMaxRot - BkgEstimationConfig.cfgMinRot) / (BkgEstimationConfig.cfgNrotBkg - 1)); + histos.fill(HIST("QA/RotBkg/hRotBkg"), lRotAngle); + if (BkgEstimationConfig.cfgRotPion) { + lDaughterRot = lDecayDaughter_bach; + lDaughterRot.RotateZ(lRotAngle); + lResonanceRot = lDaughterRot + lResoSecondary; + } else { + lDaughterRot = lResoSecondary; + lDaughterRot.RotateZ(lRotAngle); + lResonanceRot = lDecayDaughter_bach + lDaughterRot; + } + typeKstar = bTrack.sign() > 0 ? BinType::kKstarP_Rot : BinType::kKstarN_Rot; + histos.fill(HIST("hInvmass_Kstar"), typeKstar, lCentrality, lResonanceRot.Pt(), lResonanceRot.M()); + } + } } // IsMix } // K0scand } // bTrack @@ -905,12 +897,17 @@ struct chk892pp { { if (!colCuts.isSelected(collision)) // Default event selection return; + if (EventCuts.cfgEvtUseRCTFlagChecker && !rctChecker(collision)) { + return; + } + lCentrality = getCentrality(collision); + if (lCentrality < EventCuts.cfgEventCentralityMin || lCentrality > EventCuts.cfgEventCentralityMax) + return; colCuts.fillQA(collision); - centrality = GetCentrality(collision); fillHistograms(collision, tracks, v0s); // second order } - PROCESS_SWITCH(chk892pp, processData, "Process Event for data without Partitioning", true); + PROCESS_SWITCH(Chk892pp, processData, "Process Event for data without Partitioning", true); // process MC reconstructed level void processMC(EventCandidates::iterator const& collision, @@ -922,9 +919,9 @@ struct chk892pp { fillHistograms(collision, tracks, v0s); } - PROCESS_SWITCH(chk892pp, processMC, "Process Event for MC", false); + PROCESS_SWITCH(Chk892pp, processMC, "Process Event for MC", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { - return WorkflowSpec{adaptAnalysisTask(cfgc, TaskName{"lf-chk892pp"})}; + return WorkflowSpec{adaptAnalysisTask(cfgc)}; } From dfa967c19d69642d17fa5156198858be37c4417e Mon Sep 17 00:00:00 2001 From: navneetkumar231295 <71565461+navneetkumar231295@users.noreply.github.com> Date: Fri, 25 Jul 2025 03:25:20 +0530 Subject: [PATCH 050/345] [PWGLF] To add Charged K* production task without ResoInitializer, with ME and rotational backgrounds, and MC processing (#12214) Co-authored-by: Navneet --- .../Tasks/Resonances/chargedkstaranalysis.cxx | 1244 +++++++++++------ 1 file changed, 825 insertions(+), 419 deletions(-) diff --git a/PWGLF/Tasks/Resonances/chargedkstaranalysis.cxx b/PWGLF/Tasks/Resonances/chargedkstaranalysis.cxx index 8286f876bc8..536d7a2d030 100644 --- a/PWGLF/Tasks/Resonances/chargedkstaranalysis.cxx +++ b/PWGLF/Tasks/Resonances/chargedkstaranalysis.cxx @@ -14,26 +14,12 @@ /// /// /// \author Protay +/// \author Navneet -#include "TF1.h" -// #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGLF/Utils/collisionCuts.h" -#include "CCDB/BasicCCDBManager.h" -#include "CCDB/CcdbApi.h" +#include "Common/Core/RecoDecay.h" #include "Common/Core/TrackSelection.h" #include "Common/Core/trackUtilities.h" #include "Common/DataModel/Centrality.h" @@ -41,110 +27,177 @@ #include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/TrackSelectionTables.h" + +#include "CCDB/BasicCCDBManager.h" +#include "CCDB/CcdbApi.h" #include "CommonConstants/PhysicsConstants.h" +#include "DCAFitter/DCAFitterN.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "DataFormatsParameters/GRPObject.h" #include "Framework/ASoAHelpers.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" +#include "Framework/O2DatabasePDGPlugin.h" +#include "Framework/StaticFor.h" #include "Framework/StepTHn.h" #include "Framework/runDataProcessing.h" -#include "PWGLF/DataModel/LFStrangenessTables.h" #include "ReconstructionDataFormats/Track.h" -// For charged kstarpp analysis -#include "PWGLF/DataModel/LFResonanceTables.h" +#include "Math/GenVector/Boost.h" +#include "Math/Vector3D.h" +#include "Math/Vector4D.h" +#include "TF1.h" +#include "TRandom3.h" +#include "TVector2.h" +// #include // FIXME +#include +#include +#include +#include +#include +#include +#include +#include +#include // FIXME + +#include +#include +#include +#include +#include +#include using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::soa; -using std::array; +using namespace o2::constants::physics; struct chargedkstaranalysis { - - // Connect to ccdb SliceCache cache; - Preslice perRCol = aod::resodaughter::resoCollisionId; Preslice perCollision = aod::track::collisionId; - // For charged Kstarpp analysis use Resonance Initalizer and THnSparse - ConfigurableAxis binsCent{"binsCent", {VARIABLE_WIDTH, 0., 1., 5., 10., 30., 50., 70., 100., 110.}, "Binning of the centrality axis"}; - ConfigurableAxis binsPt{"binsPt", - {VARIABLE_WIDTH, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8, 4.9, 5.0, 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 5.9, 6.0, 6.1, 6.2, 6.3, 6.4, 6.5, 6.6, 6.7, 6.8, 6.9, 7.0, 7.1, 7.2, 7.3, 7.4, 7.5, 7.6, 7.7, 7.8, 7.9, 8.0, 8.1, 8.2, 8.3, 8.4, 8.5, 8.6, 8.7, 8.8, 8.9, 9.0, 9.1, 9.2, 9.3, 9.4, 9.5, 9.6, 9.7, 9.8, 9.9, 10.0, 10.1, 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 11.0, 11.1, 11.2, 11.3, 11.4, 11.5, 11.6, 11.7, 11.8, 11.9, 12.0, 12.1, 12.2, 12.3, 12.4, 12.5, 12.6, 12.7, 12.8, 12.9, 13.0, 13.1, 13.2, 13.3, 13.4, 13.5, 13.6, 13.7, 13.8, 13.9, 14.0, 14.1, 14.2, 14.3, 14.4, 14.5, 14.6, 14.7, 14.8, 14.9, 15.0}, - "Binning of the pT axis"}; - ConfigurableAxis etabins{"etabins", - {VARIABLE_WIDTH, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0}, - "Eta Binning"}; - Configurable cDCABinsQA{"cDCABinsQA", 150, "DCA binning"}; - ConfigurableAxis binsPtQA{"binsPtQA", - {VARIABLE_WIDTH, 0.0, 0.2, 0.4, 0.6, 0.8, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0, 3.2, 3.4, 3.6, 3.8, 4.0, 4.2, 4.4, 4.6, 4.8, 5.0, 5.2, 5.4, 5.6, 5.8, 6.0, 6.2, 6.4, 6.6, 6.8, 7.0, 7.2, 7.4, 7.6, 7.8, 8.0, 8.2, 8.4, 8.6, 8.8, 9.0, 9.2, 9.4, 9.6, 9.8, 10.0}, - "Binning of the pT axis"}; - - AxisSpec k892pmCountAxis = {2, 0., 2., "K*^{+}(892) = 1, K*^{-}(892) = 2"}; - - HistogramRegistry histos1{ - "histos1", - {}, - OutputObjHandlingPolicy::AnalysisObject, - true, - true}; - - // Pre-selection cuts - Configurable cMinPtcut{"cMinPtcut", 0.15, "Track minimum pt cut"}; - Configurable confevtcollintimerangestandard{"confevtcollintimerangestandard", true, "Evt sel: apply NoCollInTimeRangeStandard"}; - /// PID Selections - Configurable nsigmaCutCombinedPion{"nsigmaCutCombinedPion", -999, - "Combined nSigma cut for Pion"}; // Combined - // DCAr to PV - Configurable cMaxDCArToPVcut{"cMaxDCArToPVcut", 0.5, - "Track DCAr cut to PV Maximum"}; - // DCAz to PV - Configurable cMaxDCAzToPVcut{"cMaxDCAzToPVcut", 2.0, - "Track DCAz cut to PV Maximum"}; - // Track selections - Configurable cfgPrimaryTrack{"cfgPrimaryTrack", true, - "Primary track selection"}; // kGoldenChi2 | kDCAxy | kDCAz - Configurable cfgGlobalWoDCATrack{"cfgGlobalWoDCATrack", true, - "Global track selection without DCA"}; // kQualityTracks (kTrackType | - // kTPCNCls | kTPCCrossedRows | - // kTPCCrossedRowsOverNCls | - // kTPCChi2NDF | kTPCRefit | - // kITSNCls | kITSChi2NDF | - // kITSRefit | kITSHits) | - // kInAcceptanceTracks (kPtRange | - // kEtaRange) - Configurable cfgPVContributor{"cfgPVContributor", true, - "PV contributor track selection"}; // PV Contributor - // V0 selections - Configurable cV0MinCosPA{"cV0MinCosPA", 0.97, - "V0 minimum pointing angle cosine"}; - Configurable cV0MaxDaughDCA{"cV0MaxDaughDCA", 1.0, - "V0 daughter DCA Maximum"}; - // Competing V0 rejection - Configurable cV0MassWindow{"cV0MassWindow", 0.0043, "Mass window for competing Lambda0 rejection"}; - Configurable cInvMassStart{"cInvMassStart", 0.6, "Invariant mass start"}; - Configurable cInvMassEnd{"cInvMassEnd", 1.5, "Invariant mass end"}; - Configurable cInvMassBins{"cInvMassBins", 900, "Invariant mass binning"}; - - // Rapidity Cut - Configurable confRapidity{"confRapidity", 0.5, "Rapidity cut"}; - - // Event mixing + using EventCandidates = soa::Join; + // using EventCandidates = soa::Join; + // using TrackCandidates = soa::Join; + // using TrackCandidates = soa::Join; + using TrackCandidates = soa::Join; + using V0Candidates = aod::V0Datas; + + using MCEventCandidates = soa::Join; + using MCTrackCandidates = soa::Join; + using MCV0Candidates = soa::Join; + + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + Configurable nEvtMixing{"nEvtMixing", 5, "Number of events to mix"}; ConfigurableAxis cfgvtxbins{"cfgvtxbins", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"}; ConfigurableAxis cfgmultbins{"cfgmultbins", {VARIABLE_WIDTH, 0., 1., 5., 10., 30., 50., 70., 100., 110.}, "Mixing bins - multiplicity"}; - Configurable cTpcNsigmaPionBinsQA{"cTpcNsigmaPionBinsQA", 140, "tpcNSigmaPi binning"}; - // Configurable for histograms - Configurable nBins{"nBins", 100, "N bins in all histos"}; + Service ccdb; + Service pdg; + o2::ccdb::CcdbApi ccdbApi; + + Configurable cfgURL{"cfgURL", "http://alice-ccdb.cern.ch", "Address of the CCDB to browse"}; + Configurable nolaterthan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "Latest acceptable timestamp of creation for the object"}; + + // DCAr to PV + Configurable cMaxDCArToPVcut{"cMaxDCArToPVcut", 2.0, "Track DCAr cut to PV Maximum"}; + // DCAz to PV + Configurable cMaxDCAzToPVcut{"cMaxDCAzToPVcut", 2.0, "Track DCAz cut to PV Maximum"}; + Configurable cMinDCAzToPVcut{"cMinDCAzToPVcut", 0.0, "Track DCAz cut to PV Minimum"}; + + Configurable cfgCutEta{"cfgCutEta", 0.8f, "Eta range for tracks"}; + + Configurable trackSelection{"trackSelection", 0, "Track selection: 0 -> No Cut, 1 -> kGlobalTrack, 2 -> kGlobalTrackWoPtEta, 3 -> kGlobalTrackWoDCA, 4 -> kQ ualityTracks, 5 -> kInAcceptanceTracks"}; + // + // Filter trackFilter = (trackSelection.node() == 0) || // from tpcSkimsTableCreator + // ((trackSelection.node() == 1) && requireGlobalTrackInFilter()) || + // ((trackSelection.node() == 2) && requireGlobalTrackWoPtEtaInFilter()) || + // ((trackSelection.node() == 3) && requireGlobalTrackWoDCAInFilter()) || + // ((trackSelection.node() == 4) && requireQualityTracksInFilter()) || + // ((trackSelection.node() == 5) && requireTrackCutInFilter(TrackSelectionFlags::kInAcceptanceTracks)); + // Filter trackEtaFilter = nabs(aod::track::eta) < cfgCutEta; // Eta cut + // + // Configurables + ConfigurableAxis cfgBinsPt{"cfgBinsPt", {VARIABLE_WIDTH, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8, 4.9, 5.0, 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 5.9, 6.0, 6.1, 6.2, 6.3, 6.4, 6.5, 6.6, 6.7, 6.8, 6.9, 7.0, 7.1, 7.2, 7.3, 7.4, 7.5, 7.6, 7.7, 7.8, 7.9, 8.0, 8.1, 8.2, 8.3, 8.4, 8.5, 8.6, 8.7, 8.8, 8.9, 9.0, 9.1, 9.2, 9.3, 9.4, 9.5, 9.6, 9.7, 9.8, 9.9, 10.0, 10.1, 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 11.0, 11.1, 11.2, 11.3, 11.4, 11.5, 11.6, 11.7, 11.8, 11.9, 12.0, 12.1, 12.2, 12.3, 12.4, 12.5, 12.6, 12.7, 12.8, 12.9, 13.0, 13.1, 13.2, 13.3, 13.4, 13.5, 13.6, 13.7, 13.8, 13.9, 14.0, 14.1, 14.2, 14.3, 14.4, 14.5, 14.6, 14.7, 14.8, 14.9, 15.0}, "Binning of the pT axis"}; + ConfigurableAxis cfgBinsPtQA{"cfgBinsPtQA", {VARIABLE_WIDTH, 0.0, 0.2, 0.4, 0.6, 0.8, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0, 3.2, 3.4, 3.6, 3.8, 4.0, 4.2, 4.4, 4.6, 4.8, 5.0, 5.2, 5.4, 5.6, 5.8, 6.0, 6.2, 6.4, 6.6, 6.8, 7.0, 7.2, 7.4, 7.6, 7.8, 8.0, 8.2, 8.4, 8.6, 8.8, 9.0, 9.2, 9.4, 9.6, 9.8, 10.0}, "Binning of the pT axis"}; + ConfigurableAxis cfgBinsCent{"cfgBinsCent", {VARIABLE_WIDTH, 0.0, 1.0, 5.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 110.0}, "Binning of the centrality axis"}; + ConfigurableAxis cfgBinsVtxZ{"cfgBinsVtxZ", {VARIABLE_WIDTH, -10.0, -9.0, -8.0, -7.0, -6.0, -5.0, -4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0}, "Binning of the z-vertex axis"}; + Configurable cNbinsDiv{"cNbinsDiv", 1, "Integer to divide the number of bins"}; + + /// Event cuts + o2::analysis::CollisonCuts colCuts; + Configurable confEvtZvtx{"confEvtZvtx", 10.f, "Evt sel: Max. z-Vertex (cm)"}; + Configurable confEvtOccupancyInTimeRangeMax{"confEvtOccupancyInTimeRangeMax", -1, "Evt sel: maximum track occupancy"}; + Configurable confEvtOccupancyInTimeRangeMin{"confEvtOccupancyInTimeRangeMin", -1, "Evt sel: minimum track occupancy"}; + Configurable confEvtTriggerCheck{"confEvtTriggerCheck", false, "Evt sel: check for trigger"}; + Configurable confEvtOfflineCheck{"confEvtOfflineCheck", true, "Evt sel: check for offline selection"}; + Configurable confEvtTriggerTVXSel{"confEvtTriggerTVXSel", false, "Evt sel: triggerTVX selection (MB)"}; + Configurable confEvtTFBorderCut{"confEvtTFBorderCut", false, "Evt sel: apply TF border cut"}; + Configurable confEvtUseITSTPCvertex{"confEvtUseITSTPCvertex", false, "Evt sel: use at lease on ITS-TPC track for vertexing"}; + Configurable confEvtZvertexTimedifference{"confEvtZvertexTimedifference", true, "Evt sel: apply Z-vertex time difference"}; + Configurable confEvtPileupRejection{"confEvtPileupRejection", true, "Evt sel: apply pileup rejection"}; + Configurable confEvtNoITSROBorderCut{"confEvtNoITSROBorderCut", false, "Evt sel: apply NoITSRO border cut"}; + Configurable confincludeCentralityMC{"confincludeCentralityMC", false, "Include centrality in MC"}; + Configurable confEvtCollInTimeRangeStandard{"confEvtCollInTimeRangeStandard", true, "Evt sel: apply NoCollInTimeRangeStandard"}; + + /// Track selections + Configurable cMinPtcut{"cMinPtcut", 0.15, "Track minium pt cut"}; + Configurable cMaxEtacut{"cMaxEtacut", 0.8, "Track maximum eta cut"}; + + Configurable cfgCentEst{"cfgCentEst", 1, "Centrality estimator, 1: FT0C, 2: FT0M"}; + + // DCAr to PV + Configurable cMaxbDCArToPVcut{"cMaxbDCArToPVcut", 0.1, "Track DCAr cut to PV Maximum"}; + // DCAz to PV + Configurable cMaxbDCAzToPVcut{"cMaxbDCAzToPVcut", 0.1, "Track DCAz cut to PV Maximum"}; - // Configurable parameters for V0 selection - Configurable confdaugheta{"confdaugheta", 0.8f, "V0 Daugh sel: max eta"}; - Configurable nSigmaCutTPC{"nSigmaCutTPC", 3.0, "Value of the TPC Nsigma cut"}; - Configurable nSigmaCutTOF{"nSigmaCutTOF", 3.0, - "Value of the TOF Nsigma cut"}; - Configurable nsigmaCutCombined{"nsigmaCutCombined", 3.0, "Value of the Combined Nsigma cut"}; - Configurable cfgNoMixedEvents{"cfgNoMixedEvents", 5, "Number of mixed events per event"}; + /// PID Selections, pion + Configurable cTPConly{"cTPConly", true, "Use only TPC for PID"}; // bool + Configurable cMaxTPCnSigmaPion{"cMaxTPCnSigmaPion", 3.0, "TPC nSigma cut for Pion"}; // TPC + Configurable cMaxTOFnSigmaPion{"cMaxTOFnSigmaPion", 3.0, "TOF nSigma cut for Pion"}; // TOF + Configurable nsigmaCutCombinedPion{"nsigmaCutCombinedPion", -999, "Combined nSigma cut for Pion"}; // Combined + Configurable cTOFVeto{"cTOFVeto", true, "TOF Veto, if false, TOF is nessessary for PID selection"}; // TOF Veto + + // Track selections + Configurable cfgPrimaryTrack{"cfgPrimaryTrack", true, "Primary track selection"}; // kGoldenChi2 | kDCAxy | kDCAz + Configurable cfgGlobalWoDCATrack{"cfgGlobalWoDCATrack", true, "Global track selection without DCA"}; // kQualityTracks (kTrackType | kTPCNCls | kTPCCrossedRows | kTPCCrossedRowsOverNCls | kTPCChi2NDF | kTPCRefit | kITSNCls | kITSChi2NDF | kITSRefit | kITSHits) | kInAcceptanceTracks (kPtRange | kEtaRange) + Configurable cfgGlobalTrack{"cfgGlobalTrack", false, "Global track selection"}; // kGoldenChi2 | kDCAxy | kDCAz + Configurable cfgPVContributor{"cfgPVContributor", false, "PV contributor track selection"}; // PV Contriuibutor + + Configurable cfgITScluster{"cfgITScluster", 0, "Number of ITS cluster"}; + Configurable cfgTPCcluster{"cfgTPCcluster", 0, "Number of TPC cluster"}; + Configurable cfgRatioTPCRowsOverFindableCls{"cfgRatioTPCRowsOverFindableCls", 0.0f, "TPC Crossed Rows to Findable Clusters"}; + Configurable cfgITSChi2NCl{"cfgITSChi2NCl", 999.0, "ITS Chi2/NCl"}; + Configurable cfgTPCChi2NCl{"cfgTPCChi2NCl", 999.0, "TPC Chi2/NCl"}; + Configurable cfgUseTPCRefit{"cfgUseTPCRefit", false, "Require TPC Refit"}; + Configurable cfgUseITSRefit{"cfgUseITSRefit", false, "Require ITS Refit"}; + Configurable cfgHasITS{"cfgHasITS", false, "Require ITS"}; + Configurable cfgHasTPC{"cfgHasTPC", false, "Require TPC"}; + Configurable cfgHasTOF{"cfgHasTOF", false, "Require TOF"}; + + // Secondary Selection + Configurable cfgReturnFlag{"cfgReturnFlag", false, "Return Flag for debugging"}; + Configurable cSecondaryRequire{"cSecondaryRequire", true, "Secondary cuts on/off"}; + + Configurable cfgByPassDauPIDSelection{"cfgByPassDauPIDSelection", true, "Bypass Daughters PID selection"}; + Configurable cSecondaryDauDCAMax{"cSecondaryDauDCAMax", 1., "Maximum DCA Secondary daughters to PV"}; + Configurable cSecondaryDauPosDCAtoPVMin{"cSecondaryDauPosDCAtoPVMin", 0.0, "Minimum DCA Secondary positive daughters to PV"}; + Configurable cSecondaryDauNegDCAtoPVMin{"cSecondaryDauNegDCAtoPVMin", 0.0, "Minimum DCA Secondary negative daughters to PV"}; + + Configurable cSecondaryPtMin{"cSecondaryPtMin", 0.f, "Minimum transverse momentum of Secondary"}; + Configurable cSecondaryRapidityMax{"cSecondaryRapidityMax", 0.5, "Maximum rapidity of Secondary"}; + Configurable cSecondaryRadiusMin{"cSecondaryRadiusMin", 1.2, "Minimum transverse radius of Secondary"}; + Configurable cSecondaryCosPAMin{"cSecondaryCosPAMin", 0.995, "Mininum cosine pointing angle of Secondary"}; + Configurable cSecondaryDCAtoPVMax{"cSecondaryDCAtoPVMax", 0.3, "Maximum DCA Secondary to PV"}; + Configurable cSecondaryProperLifetimeMax{"cSecondaryProperLifetimeMax", 20, "Maximum Secondary Lifetime"}; + Configurable cSecondaryMassWindow{"cSecondaryMassWindow", 0.075, "Secondary inv mass selciton window"}; + + // K* selection + Configurable cKstarMaxRap{"cKstarMaxRap", 0.5, "Kstar maximum rapidity"}; + Configurable cKstarMinRap{"cKstarMinRap", -0.5, "Kstar minimum rapidity"}; // For rotational background Configurable fillRotation{"fillRotation", true, "fill rotation"}; @@ -152,382 +205,735 @@ struct chargedkstaranalysis { Configurable confMaxRot{"confMaxRot", 7.0 * o2::constants::math::PI / 6.0, "Maximum of rotation"}; Configurable nBkgRotations{"nBkgRotations", 9, "Number of rotated copies (background) per each original candidate"}; - void init(InitContext const&) + float centrality; + + // PDG code + int kPDGK0s = 310; + int kKstarPlus = static_cast(o2::constants::physics::Pdg::kKPlusStar892); + int kPiPlus = 211; + int kPDGK0 = 311; + + void init(o2::framework::InitContext&) { - AxisSpec dcaxyAxisQA = {cDCABinsQA, 0.0, 3.0, "DCA_{#it{xy}} (cm)"}; - AxisSpec dcazAxisQA = {cDCABinsQA, 0.0, 3.0, "DCA_{#it{xy}} (cm)"}; - AxisSpec ptAxisQA = {binsPtQA, "#it{p}_{T} (GeV/#it{c})"}; - AxisSpec tpcNSigmaPiAxisQA = {cTpcNsigmaPionBinsQA, -7.0, 7.0, - "N#sigma_{TPC}"}; + centrality = -999; + + colCuts.setCuts(confEvtZvtx, confEvtTriggerCheck, confEvtOfflineCheck, /*checkRun3*/ true, /*triggerTVXsel*/ false, confEvtOccupancyInTimeRangeMax, confEvtOccupancyInTimeRangeMin); + colCuts.init(&histos); + colCuts.setTriggerTVX(confEvtTriggerTVXSel); + colCuts.setApplyTFBorderCut(confEvtTFBorderCut); + colCuts.setApplyITSTPCvertex(confEvtUseITSTPCvertex); + colCuts.setApplyZvertexTimedifference(confEvtZvertexTimedifference); + colCuts.setApplyPileupRejection(confEvtPileupRejection); + colCuts.setApplyNoITSROBorderCut(confEvtNoITSROBorderCut); + colCuts.setApplyCollInTimeRangeStandard(confEvtCollInTimeRangeStandard); + + AxisSpec centAxis = {cfgBinsCent, "T0M (%)"}; + AxisSpec vtxzAxis = {cfgBinsVtxZ, "Z Vertex (cm)"}; + AxisSpec ptAxis = {cfgBinsPt, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec ptAxisQA = {cfgBinsPtQA, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec radiusAxis = {50, 0, 5, "Radius (cm)"}; + AxisSpec cpaAxis = {50, 0.95, 1.0, "CPA"}; + AxisSpec tauAxis = {250, 0, 25, "Lifetime (cm)"}; + AxisSpec dcaAxis = {200, 0, 2, "DCA (cm)"}; + AxisSpec dcaxyAxis = {200, 0, 2, "DCA_{#it{xy}} (cm)"}; + AxisSpec dcazAxis = {200, 0, 2, "DCA_{#it{z}} (cm)"}; + AxisSpec yAxis = {100, -1, 1, "Rapidity"}; + AxisSpec invMassAxisK0s = {400 / cNbinsDiv, 0.3, 0.7, "Invariant Mass (GeV/#it{c}^2)"}; // K0s ~497.611 + AxisSpec invMassAxisReso = {900 / cNbinsDiv, 0.5f, 1.4f, "Invariant Mass (GeV/#it{c}^2)"}; // chK(892) ~892 + AxisSpec invMassAxisScan = {150, 0, 1.5, "Invariant Mass (GeV/#it{c}^2)"}; // For selection AxisSpec pidQAAxis = {130, -6.5, 6.5}; - AxisSpec centAxis = {binsCent, "V0M (%)"}; - AxisSpec ptAxis = {binsPt, "#it{p}_{T} (GeV/#it{c})"}; - AxisSpec invMassAxis = {cInvMassBins, cInvMassStart, cInvMassEnd, - "Invariant Mass (GeV/#it{c}^2)"}; - AxisSpec etaAxis = {etabins, "#eta"}; - AxisSpec goodTrackCountAxis = { - 3, 0., 3., "Passed track = 1, Passed V0 = 2, Passed track and V0 = 3"}; - // register histograms - histos1.add("hVertexZ", "hVertexZ", HistType::kTH1F, {{nBins, -15., 15.}}); - // Multiplicity and accepted events QA - histos1.add("QAbefore/collMult", "Collision multiplicity", HistType::kTH1F, - {centAxis}); - // QA before - histos1.add("QAbefore/pi_Eta", "Primary pion track eta", kTH1F, {etaAxis}); - histos1.add("QAbefore/k0s_Eta", "K0short track eta", kTH1F, {etaAxis}); - histos1.add("QAbefore/chargedkstarpmRapidity", - "Reconstructed K*^{#pm} rapidity", kTH1F, {etaAxis}); - histos1.add("QAbefore/trkpionTOFPID", "TOF PID of bachelor pion candidates", HistType::kTH2D, {ptAxisQA, pidQAAxis}); - histos1.add("QAbefore/trkpionTPCTOFPID", "TPC-TOF PID map of bachelor pion candidates", HistType::kTH2D, {pidQAAxis, pidQAAxis}); - - histos1.add("QAbefore/DCAxy_pi", - "DCAxy distribution of pion track candidates", HistType::kTH1F, - {dcaxyAxisQA}); - histos1.add("QAbefore/DCAz_pi", - "DCAz distribution of pion track candidates", HistType::kTH1F, - {dcazAxisQA}); - histos1.add("QAbefore/pT_pi", "pT distribution of pion track candidates", - kTH1F, {ptAxisQA}); - histos1.add("QAbefore/tpcNsigmaPionQA", - "NsigmaTPC distribution of primary pion candidates", kTH2F, - {ptAxisQA, tpcNSigmaPiAxisQA}); - - // QA after - histos1.add("QAAfter/DCAxy_pi", - "DCAxy distribution of pion track candidates", HistType::kTH1F, - {dcaxyAxisQA}); - histos1.add("QAAfter/DCAz_pi", "DCAz distribution of pion track candidates", - HistType::kTH1F, {dcazAxisQA}); - histos1.add("QAAfter/pT_pi", "pT distribution of pion track candidates", - kTH1F, {ptAxisQA}); - histos1.add("QAAfter/tpcNsigmaPionQA", - "NsigmaTPC distribution of primary pion candidates", kTH2F, - {ptAxisQA, tpcNSigmaPiAxisQA}); - histos1.add("QAAfter/pi_Eta", "Primary pion track eta", kTH1F, {etaAxis}); - - // Good tracks and V0 counts QA - histos1.add("QAafter/hGoodTracksV0s", "Number of good track and V0 passed", - kTH1F, {goodTrackCountAxis}); - histos1.add("chargedkstarinvmassUlikeSign", - "Invariant mass of charged K*(892)", kTH1F, {invMassAxis}); - histos1.add("chargedkstarinvmassMixedEvent", - "Invariant mass of charged K*(892)", kTH1F, {invMassAxis}); - - // Mass vs Pt vs Multiplicity 3-dimensional histogram - // histos1.add("chargekstarMassPtMult", "Charged K*(892) mass vs pT vs V0 - // multiplicity distribution", kTH3F, {invMassAxis, ptAxis, centAxis}); - - histos1.add("chargekstarMassPtMultPtUnlikeSign", - "Invariant mass of CKS meson Unlike Sign", kTHnSparseF, - {invMassAxis, ptAxis, centAxis}, true); - histos1.add("hSparseChargeKstarSameEventRotational", "hSparseChargeKstarSameEventRotational", HistType::kTHnSparseF, {invMassAxis, ptAxis, centAxis}, true); - - histos1.add("chargekstarMassPtMultPtMixedEvent", - "Invariant mass of CKS meson MixedEvent Sign", kTHnSparseF, - {invMassAxis, ptAxis, centAxis}, true); + AxisSpec dataTypeAxis = {9, 0, 9, "Histogram types"}; + AxisSpec mcTypeAxis = {4, 0, 4, "Histogram types"}; + + // THnSparse + AxisSpec mcLabelAxis = {5, -0.5, 4.5, "MC Label"}; + + histos.add("QA/K0sCutCheck", "Check K0s cut", HistType::kTH1D, {AxisSpec{12, -0.5, 11.5, "Check"}}); + + histos.add("QA/before/CentDist", "Centrality distribution", {HistType::kTH1D, {centAxis}}); + histos.add("QA/before/CentDist1", "Centrality distribution", o2::framework::kTH1F, {{110, 0, 110}}); + histos.add("QA/before/VtxZ", "Centrality distribution", {HistType::kTH1D, {vtxzAxis}}); + histos.add("QA/before/hEvent", "Number of Events", HistType::kTH1F, {{1, 0.5, 1.5}}); + + histos.add("QA/trkbpionTPCPIDME", "TPC PID of bachelor pion candidates", HistType::kTH2D, {ptAxisQA, pidQAAxis}); + + // Bachelor pion + histos.add("QA/before/trkbpionDCAxy", "DCAxy distribution of bachelor pion candidates", HistType::kTH1D, {dcaxyAxis}); + histos.add("QA/before/trkbpionDCAz", "DCAz distribution of bachelor pion candidates", HistType::kTH1D, {dcazAxis}); + histos.add("QA/before/trkbpionpT", "pT distribution of bachelor pion candidates", HistType::kTH1D, {ptAxisQA}); + histos.add("QA/before/trkbpionTPCPID", "TPC PID of bachelor pion candidates", HistType::kTH2D, {ptAxisQA, pidQAAxis}); + histos.add("QA/before/trkbpionTOFPID", "TOF PID of bachelor pion candidates", HistType::kTH2D, {ptAxisQA, pidQAAxis}); + histos.add("QA/before/trkbpionTPCTOFPID", "TPC-TOF PID map of bachelor pion candidates", HistType::kTH2D, {pidQAAxis, pidQAAxis}); + + histos.add("QA/after/trkbpionDCAxy", "DCAxy distribution of bachelor pion candidates", HistType::kTH1D, {dcaxyAxis}); + histos.add("QA/after/trkbpionDCAz", "DCAz distribution of bachelor pion candidates", HistType::kTH1D, {dcazAxis}); + histos.add("QA/after/trkbpionpT", "pT distribution of bachelor pion candidates", HistType::kTH1D, {ptAxisQA}); + histos.add("QA/after/trkbpionTPCPID", "TPC PID of bachelor pion candidates", HistType::kTH2D, {ptAxisQA, pidQAAxis}); + histos.add("QA/after/trkbpionTOFPID", "TOF PID of bachelor pion candidates", HistType::kTH2D, {ptAxisQA, pidQAAxis}); + histos.add("QA/after/trkbpionTPCTOFPID", "TPC-TOF PID map of bachelor pion candidates", HistType::kTH2D, {pidQAAxis, pidQAAxis}); + + // Secondary pion 1 + histos.add("QA/before/trkppionTPCPID", "TPC PID of secondary pion 1 (positive) candidates", HistType::kTH2D, {ptAxisQA, pidQAAxis}); + histos.add("QA/before/trkppionTOFPID", "TOF PID of secondary pion 1 (positive) candidates", HistType::kTH2D, {ptAxisQA, pidQAAxis}); + histos.add("QA/before/trkppionTPCTOFPID", "TPC-TOF PID map of secondary pion 1 (positive) candidates", HistType::kTH2D, {pidQAAxis, pidQAAxis}); + histos.add("QA/before/trkppionpT", "pT distribution of secondary pion 1 (positive) candidates", HistType::kTH1D, {ptAxisQA}); + histos.add("QA/before/trkppionDCAxy", "DCAxy distribution of secondary pion 1 (positive) candidates", HistType::kTH1D, {dcaxyAxis}); + histos.add("QA/before/trkppionDCAz", "DCAz distribution of secondary pion 1 (positive) candidates", HistType::kTH1D, {dcazAxis}); + + histos.add("QA/after/trkppionTPCPID", "TPC PID of secondary pion 1 (positive) candidates", HistType::kTH2D, {ptAxisQA, pidQAAxis}); + histos.add("QA/after/trkppionTOFPID", "TOF PID of secondary pion 1 (positive) candidates", HistType::kTH2D, {ptAxisQA, pidQAAxis}); + histos.add("QA/after/trkppionTPCTOFPID", "TPC-TOF PID map of secondary pion 1 (positive) candidates", HistType::kTH2D, {pidQAAxis, pidQAAxis}); + histos.add("QA/after/trkppionpT", "pT distribution of secondary pion 1 (positive) candidates", HistType::kTH1D, {ptAxisQA}); + histos.add("QA/after/trkppionDCAxy", "DCAxy distribution of secondary pion 1 (positive) candidates", HistType::kTH1D, {dcaxyAxis}); + histos.add("QA/after/trkppionDCAz", "DCAz distribution of secondary pion 1 (positive) candidates", HistType::kTH1D, {dcazAxis}); + + // Secondary pion 2 + histos.add("QA/before/trknpionTPCPID", "TPC PID of secondary pion 2 (negative) candidates", HistType::kTH2D, {ptAxisQA, pidQAAxis}); + histos.add("QA/before/trknpionTOFPID", "TOF PID of secondary pion 2 (negative) candidates", HistType::kTH2D, {ptAxisQA, pidQAAxis}); + histos.add("QA/before/trknpionTPCTOFPID", "TPC-TOF PID map of secondary pion 2 (negative) candidates", HistType::kTH2D, {pidQAAxis, pidQAAxis}); + histos.add("QA/before/trknpionpT", "pT distribution of secondary pion 2 (negative) candidates", HistType::kTH1D, {ptAxisQA}); + histos.add("QA/before/trknpionDCAxy", "DCAxy distribution of secondary pion 2 (negative) candidates", HistType::kTH1D, {dcaxyAxis}); + histos.add("QA/before/trknpionDCAz", "DCAz distribution of secondary pion 2 (negative) candidates", HistType::kTH1D, {dcazAxis}); + + histos.add("QA/after/trknpionTPCPID", "TPC PID of secondary pion 2 (negative) candidates", HistType::kTH2D, {ptAxisQA, pidQAAxis}); + histos.add("QA/after/trknpionTOFPID", "TOF PID of secondary pion 2 (negative) candidates", HistType::kTH2D, {ptAxisQA, pidQAAxis}); + histos.add("QA/after/trknpionTPCTOFPID", "TPC-TOF PID map of secondary pion 2 (negative) candidates", HistType::kTH2D, {pidQAAxis, pidQAAxis}); + histos.add("QA/after/trknpionpT", "pT distribution of secondary pion 2 (negative) candidates", HistType::kTH1D, {ptAxisQA}); + histos.add("QA/after/trknpionDCAxy", "DCAxy distribution of secondary pion 2 (negative) candidates", HistType::kTH1D, {dcaxyAxis}); + histos.add("QA/after/trknpionDCAz", "DCAz distribution of secondary pion 2 (negative) candidates", HistType::kTH1D, {dcazAxis}); + + // K0s + histos.add("QA/before/hDauDCASecondary", "DCA of daughters of secondary resonance", HistType::kTH1D, {dcaAxis}); + histos.add("QA/before/hDauPosDCAtoPVSecondary", "Pos DCA to PV of daughters secondary resonance", HistType::kTH1D, {dcaAxis}); + histos.add("QA/before/hDauNegDCAtoPVSecondary", "Neg DCA to PV of daughters secondary resonance", HistType::kTH1D, {dcaAxis}); + histos.add("QA/before/hpT_Secondary", "pT distribution of secondary resonance", HistType::kTH1D, {ptAxisQA}); + histos.add("QA/before/hy_Secondary", "Rapidity distribution of secondary resonance", HistType::kTH1D, {yAxis}); + histos.add("QA/before/hRadiusSecondary", "Radius distribution of secondary resonance", HistType::kTH1D, {radiusAxis}); + histos.add("QA/before/hCPASecondary", "Cosine pointing angle distribution of secondary resonance", HistType::kTH1D, {cpaAxis}); + histos.add("QA/before/hDCAtoPVSecondary", "DCA to PV distribution of secondary resonance", HistType::kTH1D, {dcaAxis}); + histos.add("QA/before/hPropTauSecondary", "Proper Lifetime distribution of secondary resonance", HistType::kTH1D, {tauAxis}); + histos.add("QA/before/hPtAsymSecondary", "pT asymmetry distribution of secondary resonance", HistType::kTH1D, {AxisSpec{100, -1, 1, "Pair asymmetry"}}); + histos.add("QA/before/hInvmassSecondary", "Invariant mass of unlike-sign secondary resonance", HistType::kTH1D, {invMassAxisK0s}); + + histos.add("QA/after/hDauDCASecondary", "DCA of daughters of secondary resonance", HistType::kTH1D, {dcaAxis}); + histos.add("QA/after/hDauPosDCAtoPVSecondary", "Pos DCA to PV of daughters secondary resonance", HistType::kTH1D, {dcaAxis}); + histos.add("QA/after/hDauNegDCAtoPVSecondary", "Neg DCA to PV of daughters secondary resonance", HistType::kTH1D, {dcaAxis}); + histos.add("QA/after/hpT_Secondary", "pT distribution of secondary resonance", HistType::kTH1D, {ptAxisQA}); + histos.add("QA/after/hy_Secondary", "Rapidity distribution of secondary resonance", HistType::kTH1D, {yAxis}); + histos.add("QA/after/hRadiusSecondary", "Radius distribution of secondary resonance", HistType::kTH1D, {radiusAxis}); + histos.add("QA/after/hCPASecondary", "Cosine pointing angle distribution of secondary resonance", HistType::kTH1D, {cpaAxis}); + histos.add("QA/after/hDCAtoPVSecondary", "DCA to PV distribution of secondary resonance", HistType::kTH1D, {dcaAxis}); + histos.add("QA/after/hPropTauSecondary", "Proper Lifetime distribution of secondary resonance", HistType::kTH1D, {tauAxis}); + histos.add("QA/after/hPtAsymSecondary", "pT asymmetry distribution of secondary resonance", HistType::kTH1D, {AxisSpec{100, -1, 1, "Pair asymmetry"}}); + histos.add("QA/after/hInvmassSecondary", "Invariant mass of unlike-sign secondary resonance", HistType::kTH1D, {invMassAxisK0s}); + + // Kstar + // Invariant mass nSparse + histos.add("QA/before/KstarRapidity", "Rapidity distribution of chK(892)", HistType::kTH1D, {yAxis}); + histos.add("hInvmass_Kstar", "Invariant mass of unlike-sign chK(892)", HistType::kTHnSparseD, {centAxis, ptAxis, invMassAxisReso}); + histos.add("hInvmass_KstarME", "Invariant mass of unlike-sign chK(892)ME", HistType::kTHnSparseD, {centAxis, ptAxis, invMassAxisReso}); + histos.add("hInvmass_KstarRotated", "Invariant mass of unlike-sign chK(892)Rota", HistType::kTHnSparseD, {centAxis, ptAxis, invMassAxisReso}); + + // Mass QA (quick check) + histos.add("QA/before/kstarinvmass", "Invariant mass of unlike-sign chK(892)", HistType::kTH1D, {invMassAxisReso}); + histos.add("QA/before/kstarinvmass_Mix", "Invariant mass of unlike-sign chK(892) from mixed event", HistType::kTH1D, {invMassAxisReso}); + + histos.add("QA/after/KstarRapidity", "Rapidity distribution of chK(892)", HistType::kTH1D, {yAxis}); + histos.add("QA/after/kstarinvmass", "Invariant mass of unlike-sign chK(892)", HistType::kTH1D, {invMassAxisReso}); + histos.add("QA/after/kstarinvmass_Mix", "Invariant mass of unlike-sign chK(892) from mixed event", HistType::kTH1D, {invMassAxisReso}); + if (fillRotation) { - histos1.add("hRotation", "hRotation", kTH1F, {{360, 0.0, o2::constants::math::TwoPI}}); + histos.add("hRotation", "hRotation", kTH1F, {{360, 0.0, o2::constants::math::TwoPI}}); + } + // MC + if (doprocessMC) { + + histos.add("QAMC/hEvent", "Number of Events", HistType::kTH1F, {{1, 0.5, 1.5}}); + // Bachelor pion + histos.add("QAMC/trkbpionDCAxy", "DCAxy distribution of bachelor pion candidates", HistType::kTH1D, {dcaxyAxis}); + histos.add("QAMC/trkbpionDCAz", "DCAz distribution of bachelor pion candidates", HistType::kTH1D, {dcazAxis}); + histos.add("QAMC/trkbpionpT", "pT distribution of bachelor pion candidates", HistType::kTH1D, {ptAxis}); + histos.add("QAMC/trkbpionTPCPID", "TPC PID of bachelor pion candidates", HistType::kTH2D, {ptAxis, pidQAAxis}); + histos.add("QAMC/trkbpionTOFPID", "TOF PID of bachelor pion candidates", HistType::kTH2D, {ptAxis, pidQAAxis}); + histos.add("QAMC/trkbpionTPCTOFPID", "TPC-TOF PID map of bachelor pion candidates", HistType::kTH2D, {pidQAAxis, pidQAAxis}); + + // Secondary pion 1 + histos.add("QAMC/trkppionDCAxy", "DCAxy distribution of secondary pion 1 (positive) candidates", HistType::kTH1D, {dcaxyAxis}); + histos.add("QAMC/trkppionDCAz", "DCAz distribution of secondary pion 1 (positive) candidates", HistType::kTH1D, {dcazAxis}); + histos.add("QAMC/trkppionpT", "pT distribution of secondary pion 1 (positive) candidates", HistType::kTH1D, {ptAxis}); + histos.add("QAMC/trkppionTPCPID", "TPC PID of secondary pion 1 (positive) candidates", HistType::kTH2D, {ptAxis, pidQAAxis}); + histos.add("QAMC/trkppionTOFPID", "TOF PID of secondary pion 1 (positive) candidates", HistType::kTH2D, {ptAxis, pidQAAxis}); + histos.add("QAMC/trkppionTPCTOFPID", "TPC-TOF PID map of secondary pion 1 (positive) candidates", HistType::kTH2D, {pidQAAxis, pidQAAxis}); + + // Secondary pion 2 + histos.add("QAMC/trknpionTPCPID", "TPC PID of secondary pion 2 (negative) candidates", HistType::kTH2D, {ptAxis, pidQAAxis}); + histos.add("QAMC/trknpionTOFPID", "TOF PID of secondary pion 2 (negative) candidates", HistType::kTH2D, {ptAxis, pidQAAxis}); + histos.add("QAMC/trknpionTPCTOFPID", "TPC-TOF PID map of secondary pion 2 (negative) candidates", HistType::kTH2D, {pidQAAxis, pidQAAxis}); + histos.add("QAMC/trknpionpT", "pT distribution of secondary pion 2 (negative) candidates", HistType::kTH1D, {ptAxis}); + histos.add("QAMC/trknpionDCAxy", "DCAxy distribution of secondary pion 2 (negative) candidates", HistType::kTH1D, {dcaxyAxis}); + histos.add("QAMC/trknpionDCAz", "DCAz distribution of secondary pion 2 (negative) candidates", HistType::kTH1D, {dcazAxis}); + + // Secondary Resonance (K0s cand) + histos.add("QAMC/hDauDCASecondary", "DCA of daughters of secondary resonance", HistType::kTH1D, {dcaAxis}); + histos.add("QAMC/hDauPosDCAtoPVSecondary", "Pos DCA to PV of daughters secondary resonance", HistType::kTH1D, {dcaAxis}); + histos.add("QAMC/hDauNegDCAtoPVSecondary", "Neg DCA to PV of daughters secondary resonance", HistType::kTH1D, {dcaAxis}); + + histos.add("QAMC/hpT_Secondary", "pT distribution of secondary resonance", HistType::kTH1D, {ptAxis}); + histos.add("QAMC/hy_Secondary", "Rapidity distribution of secondary resonance", HistType::kTH1D, {yAxis}); + histos.add("QAMC/hRadiusSecondary", "Radius distribution of secondary resonance", HistType::kTH1D, {radiusAxis}); + histos.add("QAMC/hCPASecondary", "Cosine pointing angle distribution of secondary resonance", HistType::kTH1D, {cpaAxis}); + histos.add("QAMC/hDCAtoPVSecondary", "DCA to PV distribution of secondary resonance", HistType::kTH1D, {dcaAxis}); + histos.add("QAMC/hPropTauSecondary", "Proper Lifetime distribution of secondary resonance", HistType::kTH1D, {tauAxis}); + histos.add("QAMC/hPtAsymSecondary", "pT asymmetry distribution of secondary resonance", HistType::kTH1D, {AxisSpec{100, -1, 1, "Pair asymmetry"}}); + histos.add("QAMC/hInvmassSecondary", "Invariant mass of unlike-sign secondary resonance", HistType::kTH1D, {invMassAxisK0s}); + + // K892 + histos.add("QAMC/KstarOA", "Opening angle of chK(892)", HistType::kTH1D, {AxisSpec{100, 0, 3.14, "Opening angle"}}); + histos.add("QAMC/KstarRapidity", "Rapidity distribution of chK(892)", HistType::kTH1D, {yAxis}); + + histos.add("QAMC/kstarinvmass", "Invariant mass of unlike-sign chK(892)", HistType::kTH1D, {invMassAxisReso}); + histos.add("QAMC/kstarinvmass_noKstar", "Invariant mass of unlike-sign no chK(892)", HistType::kTH1D, {invMassAxisReso}); + + histos.add("hInvmass_Kstar_MC", "Invariant mass of unlike chK(892)", HistType::kTHnSparseD, {centAxis, ptAxis, invMassAxisReso}); + + ccdb->setURL(cfgURL); + ccdbApi.init("http://alice-ccdb.cern.ch"); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); } - // for MC production - if (doprocessMCTrue) { - // DEBUG HISTOGRAMS - histos1.add("hK892pmCounter", "Generated MC resonances", kTH1F, {k892pmCountAxis}); - histos1.add("k892pmPtGen", "pT distribution of True MC charged K*(892)", kTH1F, {ptAxis}); - histos1.add("k892pPtGen", "pT distribution of True MC K*(892) Plus", kTH1F, {ptAxis}); - histos1.add("k892mPtGen", "pT distribution of True MC K*(892) Minus", kTH1F, {ptAxis}); + // Print output histograms statistics + LOG(info) << "Size of the histograms in chK(892) Analysis Task"; + histos.print(); + } + + // Track selection + template + bool trackCut(TrackType const& track) + { + // basic track cuts + if (std::abs(track.pt()) < cMinPtcut) + return false; + if (std::abs(track.eta()) > cMaxEtacut) + return false; + if (track.itsNCls() < cfgITScluster) + return false; + if (track.tpcNClsFound() < cfgTPCcluster) + return false; + if (track.tpcCrossedRowsOverFindableCls() < cfgRatioTPCRowsOverFindableCls) + return false; + if (track.itsChi2NCl() >= cfgITSChi2NCl) + return false; + if (track.tpcChi2NCl() >= cfgTPCChi2NCl) + return false; + if (cfgHasITS && !track.hasITS()) + return false; + if (cfgHasTPC && !track.hasTPC()) + return false; + if (cfgHasTOF && !track.hasTOF()) + return false; + if (cfgUseITSRefit && !track.passedITSRefit()) + return false; + if (cfgUseTPCRefit && !track.passedTPCRefit()) + return false; + if (cfgPVContributor && !track.isPVContributor()) + return false; + if (cfgGlobalWoDCATrack && !track.isGlobalTrackWoDCA()) + return false; + if (cfgGlobalTrack && !track.isGlobalTrack()) + return false; + if (cfgPrimaryTrack && !track.isPrimaryTrack()) + return false; + if (std::abs(track.dcaXY()) > cMaxbDCArToPVcut) + return false; + if (std::abs(track.dcaZ()) > cMaxbDCAzToPVcut) + return false; + return true; + } + + template + bool isTrackSelected(TrackType const& track) + { + // Track selection + // These are the track selection for the resotracks this cut is to compare the no. of tracks after reso-initializer + // MC case can be handled here + // DCAxy cut + if (std::fabs(track.dcaXY()) > cMaxDCArToPVcut) + return false; + // DCAz cut + if (std::fabs(track.dcaZ()) > cMaxDCAzToPVcut || std::fabs(track.dcaZ()) < cMinDCAzToPVcut) + return false; + return true; + } + + // PID selection tools + template + bool selectionPIDPion(TrackType const& candidate) + { + bool tpcPIDPassed{false}, tofPIDPassed{false}; + + if (cTPConly) { + + if (std::abs(candidate.tpcNSigmaPi()) < cMaxTPCnSigmaPion) { + tpcPIDPassed = true; + } else { + return false; + } + tofPIDPassed = true; + + } else { + + if (std::abs(candidate.tpcNSigmaPi()) < cMaxTPCnSigmaPion) { + tpcPIDPassed = true; + } else { + return false; + } + if (candidate.hasTOF()) { + if (std::abs(candidate.tofNSigmaPi()) < cMaxTOFnSigmaPion) { + tofPIDPassed = true; + } + if ((nsigmaCutCombinedPion > 0) && (candidate.tpcNSigmaPi() * candidate.tpcNSigmaPi() + candidate.tofNSigmaPi() * candidate.tofNSigmaPi() < nsigmaCutCombinedPion * nsigmaCutCombinedPion)) { + tofPIDPassed = true; + } + } else { + if (!cTOFVeto) { + return false; + } + tofPIDPassed = true; + } + } - // histos.add("hDaughterCounter", "Generated MC resonance daughters", kTH1F, {daughterCountAxis}); + if (tpcPIDPassed && tofPIDPassed) { + return true; } - if (doprocessMCLight) { - // MC QA - histos1.add("k892pmPtRec", "pT distribution of Reconstructed MC charged K*(892)", kTH1F, {ptAxis}); + return false; + } + + template + bool selectionK0s(CollisionType const& collision, K0sType const& candidate) + { + auto dauDCA = candidate.dcaV0daughters(); + auto dauPosDCAtoPV = candidate.dcapostopv(); + auto dauNegDCAtoPV = candidate.dcanegtopv(); + auto pT = candidate.pt(); + auto rapidity = candidate.yK0Short(); + auto v0Radius = candidate.v0radius(); + auto DCAtoPV = candidate.dcav0topv(); + auto cosPA = candidate.v0cosPA(); + auto PropTauK0s = candidate.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * massK0s; + auto mK0s = candidate.mK0Short(); + + if (cfgReturnFlag) { + bool returnFlag = true; + + if (cSecondaryRequire) { + histos.fill(HIST("QA/K0sCutCheck"), 0); + if (dauDCA > cSecondaryDauDCAMax) { + histos.fill(HIST("QA/K0sCutCheck"), 1); + returnFlag = false; + } + if (dauPosDCAtoPV < cSecondaryDauPosDCAtoPVMin) { + histos.fill(HIST("QA/K0sCutCheck"), 2); + returnFlag = false; + } + if (dauNegDCAtoPV < cSecondaryDauNegDCAtoPVMin) { + histos.fill(HIST("QA/K0sCutCheck"), 3); + returnFlag = false; + } + if (pT < cSecondaryPtMin) { + histos.fill(HIST("QA/K0sCutCheck"), 4); + returnFlag = false; + } + if (rapidity > cSecondaryRapidityMax) { + histos.fill(HIST("QA/K0sCutCheck"), 5); + returnFlag = false; + } + if (v0Radius < cSecondaryRadiusMin) { + histos.fill(HIST("QA/K0sCutCheck"), 6); + returnFlag = false; + } + if (DCAtoPV > cSecondaryDCAtoPVMax) { + histos.fill(HIST("QA/K0sCutCheck"), 7); + returnFlag = false; + } + if (cosPA < cSecondaryCosPAMin) { + histos.fill(HIST("QA/K0sCutCheck"), 8); + returnFlag = false; + } + if (PropTauK0s > cSecondaryProperLifetimeMax) { + histos.fill(HIST("QA/K0sCutCheck"), 9); + returnFlag = false; + } + if (std::fabs(mK0s - massK0s) > cSecondaryMassWindow) { + histos.fill(HIST("QA/K0sCutCheck"), 10); + returnFlag = false; + } + + return returnFlag; + + } else { + if (std::fabs(mK0s - massK0s) > cSecondaryMassWindow) { + histos.fill(HIST("QA/K0sCutCheck"), 10); + returnFlag = false; + } + + return returnFlag; + } + + } else { + if (cSecondaryRequire) { + + histos.fill(HIST("QA/K0sCutCheck"), 0); + if (dauDCA > cSecondaryDauDCAMax) { + histos.fill(HIST("QA/K0sCutCheck"), 1); + return false; + } + if (dauPosDCAtoPV < cSecondaryDauPosDCAtoPVMin) { + histos.fill(HIST("QA/K0sCutCheck"), 2); + return false; + } + if (dauNegDCAtoPV < cSecondaryDauNegDCAtoPVMin) { + histos.fill(HIST("QA/K0sCutCheck"), 3); + return false; + } + if (pT < cSecondaryPtMin) { + histos.fill(HIST("QA/K0sCutCheck"), 4); + return false; + } + if (rapidity > cSecondaryRapidityMax) { + histos.fill(HIST("QA/K0sCutCheck"), 5); + return false; + } + if (v0Radius < cSecondaryRadiusMin) { + histos.fill(HIST("QA/K0sCutCheck"), 6); + return false; + } + if (DCAtoPV > cSecondaryDCAtoPVMax) { + histos.fill(HIST("QA/K0sCutCheck"), 7); + return false; + } + if (cosPA < cSecondaryCosPAMin) { + histos.fill(HIST("QA/K0sCutCheck"), 8); + return false; + } + if (PropTauK0s > cSecondaryProperLifetimeMax) { + histos.fill(HIST("QA/K0sCutCheck"), 9); + return false; + } + if (std::fabs(mK0s - massK0s) > cSecondaryMassWindow) { + histos.fill(HIST("QA/K0sCutCheck"), 10); + return false; + } + return true; + + } else { + if (std::fabs(mK0s - massK0s) > cSecondaryMassWindow) { + histos.fill(HIST("QA/K0sCutCheck"), 10); + return false; + } + return true; + } } + } // selectionK0s + + template + bool isTrueKstar(const TrackTemplate& bTrack, const V0Template& K0scand) + { + if (std::abs(bTrack.PDGCode()) != kPiPlus) // Are you pion? + return false; + if (std::abs(K0scand.PDGCode()) != kPDGK0s) // Are you K0s? + return false; + + auto motherbTrack = bTrack.template mothers_as(); + auto motherkV0 = K0scand.template mothers_as(); + + // Check bTrack first + if (std::abs(motherbTrack.pdgCode()) != kKstarPlus) // Are you charged Kstar's daughter? + return false; // Apply first since it's more restrictive + + if (std::abs(motherkV0.pdgCode()) != kPDGK0) // Is it K0s? + return false; + // Check if K0s's mother is K0 (311) + auto motherK0 = motherkV0.template mothers_as(); + if (std::abs(motherK0.pdgCode()) != kPDGK0) + return false; + + // Check if K0's mother is Kstar (323) + auto motherKstar = motherK0.template mothers_as(); + if (std::abs(motherKstar.pdgCode()) != kKstarPlus) + return false; + + // Check if bTrack and K0 have the same mother (global index) + if (motherbTrack.globalIndex() != motherK0.globalIndex()) + return false; + + return true; } + + int count = 0; double massPi = o2::constants::physics::MassPionCharged; double massK0s = o2::constants::physics::MassK0Short; - double massKa = o2::constants::physics::MassKPlus; - ROOT::Math::PtEtaPhiMVector cksvector; - - double massK0 = o2::constants::physics::MassK0Short; - double massPicharged = o2::constants::physics::MassPionCharged; - double massLambda0 = o2::constants::physics::MassLambda; - double massAntiLambda0 = o2::constants::physics::MassLambda0Bar; - // Fill histograms (main function) - template - void fillHistograms(const CollisionType& collision, const TracksType& dTracks, - const V0sType& dV0s) + + template + void fillHistograms(const CollisionType& collision, const TracksType& dTracks1, const TracksTypeK0s& dTracks2) { - // auto multiplicity = collision.cent(); - auto multiplicity = collision.cent(); - histos1.fill(HIST("QAbefore/collMult"), multiplicity); - TLorentzVector lDecayDaughter, lDecayV0, lResonance, pionrot, chargekstarrot; - - for (const auto& track : dTracks) { // loop over all dTracks1 to find the bachelor pion - auto trackId = track.index(); - auto trackptPi = track.pt(); - auto tracketaPi = track.eta(); - auto istrkhasTOF = track.hasTOF(); - auto trkNSigmaPiTPC = track.tpcNSigmaPi(); - auto trkNSigmaPiTOF = (istrkhasTOF) ? track.tofNSigmaPi() : -999.; - - histos1.fill(HIST("QAbefore/pi_Eta"), tracketaPi); - - if (!IsMix) { - // TPC PID (before cuts) - histos1.fill(HIST("QAbefore/tpcNsigmaPionQA"), trackptPi, trkNSigmaPiTPC); - if (istrkhasTOF) { - histos1.fill(HIST("QAbefore/trkpionTOFPID"), trackptPi, trkNSigmaPiTOF); - histos1.fill(HIST("QAbefore/trkpionTPCTOFPID"), trkNSigmaPiTPC, trkNSigmaPiTOF); - } - // DCA QA (before cuts) - histos1.fill(HIST("QAbefore/DCAxy_pi"), track.dcaXY()); - histos1.fill(HIST("QAbefore/DCAz_pi"), track.dcaZ()); - // Pseudo-rapidity QA (before cuts) - histos1.fill(HIST("QAbefore/pi_Eta"), tracketaPi); - // pT QA (before cuts) - histos1.fill(HIST("QAbefore/pT_pi"), trackptPi); + histos.fill(HIST("QA/before/CentDist"), collision.centFT0M()); + histos.fill(HIST("QA/before/CentDist1"), collision.centFT0M()); + ROOT::Math::PxPyPzMVector lDecayDaughter1, lDecayDaughter2, lResoSecondary, lDecayDaughter_bach, lResoKstar, chargekstarrot; + std::vector trackIndicies = {}; + std::vector k0sIndicies = {}; + + for (const auto& bTrack : dTracks1) { + auto trkbpt = bTrack.pt(); + auto istrkbhasTOF = bTrack.hasTOF(); + auto trkbNSigmaPiTPC = bTrack.tpcNSigmaPi(); + auto trkbNSigmaPiTOF = (istrkbhasTOF) ? bTrack.tofNSigmaPi() : -999.; + + if (!isTrackSelected(bTrack)) + continue; + if constexpr (!IsMix) { + // Bachelor pion QA plots + histos.fill(HIST("QA/before/trkbpionTPCPID"), trkbpt, trkbNSigmaPiTPC); + if (istrkbhasTOF) { + histos.fill(HIST("QA/before/trkbpionTOFPID"), trkbpt, trkbNSigmaPiTOF); + histos.fill(HIST("QA/before/trkbpionTPCTOFPID"), trkbNSigmaPiTPC, trkbNSigmaPiTOF); + } + histos.fill(HIST("QA/before/trkbpionpT"), trkbpt); + histos.fill(HIST("QA/before/trkbpionDCAxy"), bTrack.dcaXY()); + histos.fill(HIST("QA/before/trkbpionDCAz"), bTrack.dcaZ()); + } else { + + histos.fill(HIST("QA/trkbpionTPCPIDME"), trkbpt, trkbNSigmaPiTPC); } - // apply the track cut - if (!trackCutpp(track) || !selectionPIDpp(track)) + if (!trackCut(bTrack)) + continue; + if (!selectionPIDPion(bTrack)) continue; - histos1.fill(HIST("QAafter/hGoodTracksV0s"), 0.5); - - if (!IsMix) { - // DCA QA (before cuts) - histos1.fill(HIST("QAAfter/DCAxy_pi"), track.dcaXY()); - histos1.fill(HIST("QAAfter/DCAz_pi"), track.dcaZ()); - // Pseudo-rapidity QA (before cuts) - histos1.fill(HIST("QAAfter/pi_Eta"), tracketaPi); - // pT QA (before cuts) - histos1.fill(HIST("QAAfter/pT_pi"), trackptPi); - // TPC PID (before cuts) - histos1.fill(HIST("QAAfter/tpcNsigmaPionQA"), trackptPi, - track.tpcNSigmaPi()); + if constexpr (!IsMix) { + // Bachelor pion QA plots after applying cuts + histos.fill(HIST("QA/after/trkbpionTPCPID"), trkbpt, trkbNSigmaPiTPC); + if (istrkbhasTOF) { + histos.fill(HIST("QA/after/trkbpionTOFPID"), trkbpt, trkbNSigmaPiTOF); + histos.fill(HIST("QA/after/trkbpionTPCTOFPID"), trkbNSigmaPiTPC, trkbNSigmaPiTOF); + } + histos.fill(HIST("QA/after/trkbpionpT"), trkbpt); + histos.fill(HIST("QA/after/trkbpionDCAxy"), bTrack.dcaXY()); + histos.fill(HIST("QA/after/trkbpionDCAz"), bTrack.dcaZ()); } + trackIndicies.push_back(bTrack.index()); + } - for (const auto& v0 : dV0s) { + for (const auto& K0scand : dTracks2) { + auto posDauTrack = K0scand.template posTrack_as(); + auto negDauTrack = K0scand.template negTrack_as(); + + /// Daughters + // Positve pion + auto trkppt = posDauTrack.pt(); + auto istrkphasTOF = posDauTrack.hasTOF(); + auto trkpNSigmaPiTPC = posDauTrack.tpcNSigmaPi(); + auto trkpNSigmaPiTOF = (istrkphasTOF) ? posDauTrack.tofNSigmaPi() : -999.; + // Negative pion + auto trknpt = negDauTrack.pt(); + auto istrknhasTOF = negDauTrack.hasTOF(); + auto trknNSigmaPiTPC = negDauTrack.tpcNSigmaPi(); + auto trknNSigmaPiTOF = (istrknhasTOF) ? negDauTrack.tofNSigmaPi() : -999.; + + /// K0s + auto trkkDauDCA = K0scand.dcaV0daughters(); + auto trkkDauDCAPostoPV = K0scand.dcapostopv(); + auto trkkDauDCANegtoPV = K0scand.dcanegtopv(); + auto trkkpt = K0scand.pt(); + auto trkky = K0scand.yK0Short(); + auto trkkRadius = K0scand.v0radius(); + auto trkkDCAtoPV = K0scand.dcav0topv(); + auto trkkCPA = K0scand.v0cosPA(); + auto trkkMass = K0scand.mK0Short(); + + if constexpr (!IsMix) { + // Seconddary QA plots + histos.fill(HIST("QA/before/trkppionTPCPID"), trkppt, trkpNSigmaPiTPC); + if (istrkphasTOF) { + histos.fill(HIST("QA/before/trkppionTOFPID"), trkppt, trkpNSigmaPiTOF); + histos.fill(HIST("QA/before/trkppionTPCTOFPID"), trkpNSigmaPiTPC, trkpNSigmaPiTOF); + } + histos.fill(HIST("QA/before/trkppionpT"), trkppt); + histos.fill(HIST("QA/before/trkppionDCAxy"), posDauTrack.dcaXY()); + histos.fill(HIST("QA/before/trkppionDCAz"), posDauTrack.dcaZ()); + + histos.fill(HIST("QA/before/trknpionTPCPID"), trknpt, trknNSigmaPiTPC); + if (istrknhasTOF) { + histos.fill(HIST("QA/before/trknpionTOFPID"), trknpt, trknNSigmaPiTOF); + histos.fill(HIST("QA/before/trknpionTPCTOFPID"), trknNSigmaPiTPC, trknNSigmaPiTOF); + } + histos.fill(HIST("QA/before/trknpionpT"), trknpt); + histos.fill(HIST("QA/before/trknpionDCAxy"), negDauTrack.dcaXY()); + histos.fill(HIST("QA/before/trknpionDCAz"), negDauTrack.dcaZ()); + + histos.fill(HIST("QA/before/hDauDCASecondary"), trkkDauDCA); + histos.fill(HIST("QA/before/hDauPosDCAtoPVSecondary"), trkkDauDCAPostoPV); + histos.fill(HIST("QA/before/hDauNegDCAtoPVSecondary"), trkkDauDCANegtoPV); + + histos.fill(HIST("QA/before/hpT_Secondary"), trkkpt); + histos.fill(HIST("QA/before/hy_Secondary"), trkky); + histos.fill(HIST("QA/before/hRadiusSecondary"), trkkRadius); + histos.fill(HIST("QA/before/hDCAtoPVSecondary"), trkkDCAtoPV); + histos.fill(HIST("QA/before/hCPASecondary"), trkkCPA); + histos.fill(HIST("QA/before/hInvmassSecondary"), trkkMass); + } - // Full index policy is needed to consider all possible combinations - if (v0.indices()[0] == trackId || v0.indices()[1] == trackId) - continue; // To avoid combining secondary and primary pions - //// Initialize variables - // trk: Pion, v0: K0s - // apply the track cut - if (!v0cut(v0)) - continue; - histos1.fill(HIST("QAafter/hGoodTracksV0s"), 1.5); + // if (!trackCut(posDauTrack) || !trackCut(negDauTrack)) // Too tight cut for K0s daugthers + // continue; + if (!cfgByPassDauPIDSelection && !selectionPIDPion(posDauTrack)) // Perhaps it's already applied in trackCut (need to check QA plots) + continue; + if (!cfgByPassDauPIDSelection && !selectionPIDPion(negDauTrack)) + continue; + if (!selectionK0s(collision, K0scand)) + continue; + + if constexpr (!IsMix) { + // Seconddary QA plots after applying cuts - lDecayDaughter.SetXYZM(track.px(), track.py(), track.pz(), massPi); - lDecayV0.SetXYZM(v0.px(), v0.py(), v0.pz(), massK0); - lResonance = lDecayDaughter + lDecayV0; - // Counting how many resonances passed - histos1.fill(HIST("QAafter/hGoodTracksV0s"), 2.5); + histos.fill(HIST("QA/after/trkppionTPCPID"), trkppt, trkpNSigmaPiTPC); + if (istrkphasTOF) { + histos.fill(HIST("QA/after/trkppionTOFPID"), trkppt, trkpNSigmaPiTOF); + histos.fill(HIST("QA/after/trkppionTPCTOFPID"), trkpNSigmaPiTPC, trkpNSigmaPiTOF); + } + histos.fill(HIST("QA/after/trkppionpT"), trkppt); + histos.fill(HIST("QA/after/trkppionDCAxy"), posDauTrack.dcaXY()); + histos.fill(HIST("QA/after/trkppionDCAz"), posDauTrack.dcaZ()); + + histos.fill(HIST("QA/after/trknpionTPCPID"), trknpt, trknNSigmaPiTPC); + if (istrknhasTOF) { + histos.fill(HIST("QA/after/trknpionTOFPID"), trknpt, trknNSigmaPiTOF); + histos.fill(HIST("QA/after/trknpionTPCTOFPID"), trknNSigmaPiTPC, trknNSigmaPiTOF); + } + histos.fill(HIST("QA/after/trknpionpT"), trknpt); + histos.fill(HIST("QA/after/trknpionDCAxy"), negDauTrack.dcaXY()); + histos.fill(HIST("QA/after/trknpionDCAz"), negDauTrack.dcaZ()); + + histos.fill(HIST("QA/after/hDauDCASecondary"), trkkDauDCA); + histos.fill(HIST("QA/after/hDauPosDCAtoPVSecondary"), trkkDauDCAPostoPV); + histos.fill(HIST("QA/after/hDauNegDCAtoPVSecondary"), trkkDauDCANegtoPV); + + histos.fill(HIST("QA/after/hpT_Secondary"), trkkpt); + histos.fill(HIST("QA/after/hy_Secondary"), trkky); + histos.fill(HIST("QA/after/hRadiusSecondary"), trkkRadius); + histos.fill(HIST("QA/after/hDCAtoPVSecondary"), trkkDCAtoPV); + histos.fill(HIST("QA/after/hCPASecondary"), trkkCPA); + histos.fill(HIST("QA/after/hInvmassSecondary"), trkkMass); + } + k0sIndicies.push_back(K0scand.index()); + } - // Checking whether the mid-rapidity condition is met - if (std::abs(lResonance.Rapidity()) > confRapidity) + for (const auto& trackIndex : trackIndicies) { + for (const auto& k0sIndex : k0sIndicies) { + auto bTrack = dTracks1.rawIteratorAt(trackIndex); + auto K0scand = dTracks2.rawIteratorAt(k0sIndex); + + lDecayDaughter_bach = ROOT::Math::PxPyPzMVector(bTrack.px(), bTrack.py(), bTrack.pz(), massPi); + lResoSecondary = ROOT::Math::PxPyPzMVector(K0scand.px(), K0scand.py(), K0scand.pz(), massK0s); + lResoKstar = lResoSecondary + lDecayDaughter_bach; + + // QA plots + if constexpr (!IsMix) { + histos.fill(HIST("QA/before/KstarRapidity"), lResoKstar.Rapidity()); + histos.fill(HIST("QA/before/kstarinvmass"), lResoKstar.M()); + } + + if (lResoKstar.Rapidity() > cKstarMaxRap || lResoKstar.Rapidity() < cKstarMinRap) continue; + if constexpr (!IsMix) { - histos1.fill(HIST("chargedkstarinvmassUlikeSign"), lResonance.M()); - // Reconstructed K*(892)pm 3d mass, pt, multiplicity histogram - histos1.fill(HIST("chargekstarMassPtMultPtUnlikeSign"), - lResonance.M(), lResonance.Pt(), multiplicity); - if constexpr (IsMC) { - bool pass1 = false; - bool pass2 = false; - // LOG(info) << "track PDG:\t" << trk.pdgCode() << "\tV0 PDG:\t" << v0.pdgCode(); - if ((track.pdgCode() != PDG_t::kPiPlus) && (v0.pdgCode() != PDG_t::kK0Short)) { // One decay to K0s and the other to pi+ (K*(892)+ mother) - Particle pass - pass1 = true; - } - if ((track.pdgCode() != PDG_t::kPiMinus) && (v0.pdgCode() != -310)) { // One decay to K0s and the other to pi+ (K*(892)+ mother) - Particle pass - pass2 = true; - } - if (!pass1 && !pass2) // Go on only if we have both decay products, else skip to next iteration - continue; - if (track.motherPDG() != v0.motherPDG()) - continue; - // LOG(info) << "track PDG:\t" << trk.pdgCode() << "\tV0 PDG:\t" << v0.pdgCode(); - if (track.motherPDG() != o2::constants::physics::Pdg::kKPlusStar892) - continue; - histos1.fill(HIST("k892pmPtRec"), lResonance.Pt()); - } + + histos.fill(HIST("QA/after/KstarRapidity"), lResoKstar.Rapidity()); + histos.fill(HIST("QA/after/kstarinvmass"), lResoKstar.M()); + histos.fill(HIST("hInvmass_Kstar"), collision.centFT0M(), lResoKstar.Pt(), lResoKstar.M()); + } else { - histos1.fill(HIST("chargedkstarinvmassMixedEvent"), lResonance.M()); - // Reconstructed K*(892)pm 3d mass, pt, multiplicity histogram - histos1.fill(HIST("chargekstarMassPtMultPtMixedEvent"), - lResonance.M(), lResonance.Pt(), multiplicity); + + histos.fill(HIST("hInvmass_KstarME"), collision.centFT0M(), lResoKstar.Pt(), lResoKstar.M()); } if constexpr (!IsMix) { if (fillRotation) { for (int nrotbkg = 0; nrotbkg < nBkgRotations; nrotbkg++) { - auto rotangle = o2::constants::math::PI; + auto rotangle = o2::constants::math::PI; // If there is only one rotation then it should be pi ): if (nBkgRotations > 1) { auto anglestart = confMinRot; auto angleend = confMaxRot; auto anglestep = (angleend - anglestart) / (1.0 * (nBkgRotations - 1)); rotangle = anglestart + nrotbkg * anglestep; } - histos1.fill(HIST("hRotation"), rotangle); - auto rotpionPx = lDecayDaughter.Px() * std::cos(rotangle) - lDecayDaughter.Py() * std::sin(rotangle); - auto rotpionPy = lDecayDaughter.Px() * std::sin(rotangle) + lDecayDaughter.Py() * std::cos(rotangle); - pionrot.SetXYZM(rotpionPx, rotpionPy, lDecayDaughter.Pz(), massPi); - chargekstarrot = pionrot + lDecayV0; - if (std::abs(chargekstarrot.Rapidity()) > confRapidity) { + histos.fill(HIST("hRotation"), rotangle); + auto rotpionPx = lDecayDaughter_bach.Px() * std::cos(rotangle) - lDecayDaughter_bach.Py() * std::sin(rotangle); + auto rotpionPy = lDecayDaughter_bach.Px() * std::sin(rotangle) + lDecayDaughter_bach.Py() * std::cos(rotangle); + ROOT::Math::PtEtaPhiMVector pionrot; + pionrot = ROOT::Math::PxPyPzMVector(rotpionPx, rotpionPy, lDecayDaughter_bach.Pz(), massPi); + chargekstarrot = pionrot + lResoSecondary; + if (chargekstarrot.Rapidity() > cKstarMaxRap || chargekstarrot.Rapidity() < cKstarMinRap) continue; - } - histos1.fill(HIST("hSparseChargeKstarSameEventRotational"), chargekstarrot.M(), chargekstarrot.Pt(), multiplicity); + histos.fill(HIST("hInvmass_KstarRotated"), collision.centFT0M(), chargekstarrot.Pt(), chargekstarrot.M()); } } } - } - } - } + } // K0scand + } // bTrack - template - bool selectionPIDpp(const T& candidate) - { - bool tpcPIDPassed{false}, tofPIDPassed{false}; - if (std::abs(candidate.tpcNSigmaPi()) < nSigmaCutTPC) { - tpcPIDPassed = true; - } - if (candidate.hasTOF()) { - if (std::abs(candidate.tofNSigmaPi()) < nSigmaCutTOF) { - tofPIDPassed = true; - } - if ((nsigmaCutCombinedPion > 0) && - (candidate.tpcNSigmaPi() * candidate.tpcNSigmaPi() + - candidate.tofNSigmaPi() * candidate.tofNSigmaPi() < - nsigmaCutCombinedPion * nsigmaCutCombinedPion)) { - tofPIDPassed = true; - } - } else { - tofPIDPassed = true; - } - if (tpcPIDPassed && tofPIDPassed) { - return true; - } - return false; - } + count++; - template - bool trackCutpp(const TrackType track) - { - // basic track cuts - if (std::abs(track.pt()) < cMinPtcut) - return false; - if (std::abs(track.eta()) > confdaugheta) - return false; - if (std::abs(track.dcaXY()) > cMaxDCArToPVcut) - return false; - if (std::abs(track.dcaZ()) > cMaxDCAzToPVcut) - return false; - if (cfgPrimaryTrack && !track.isPrimaryTrack()) - return false; - if (cfgGlobalWoDCATrack && !track.isGlobalTrackWoDCA()) - return false; - if (cfgPVContributor && !track.isPVContributor()) - return false; + } // fillHistograms - return true; - } - template - bool v0cut(const V0Type v0) + // process data + void processDataSE(EventCandidates::iterator const& collision, + TrackCandidates const& tracks, + V0Candidates const& v0s, + aod::BCsWithTimestamps const&) { - // V0 track cuts - if (std::abs(v0.eta()) > confdaugheta) - return false; - if (v0.v0CosPA() < cV0MinCosPA) - return false; - if (v0.daughDCA() > cV0MaxDaughDCA) - return false; - - // apply the competing V0 rejection cut (excluding Lambda0 candidates, - // massLambdaPDG = 1115.683 MeV/c2) - - if (std::abs(v0.mLambda() - massLambda0) < cV0MassWindow) - return false; - if (std::abs(v0.mAntiLambda() - massAntiLambda0) < cV0MassWindow) - return false; - - return true; + if (!colCuts.isSelected(collision)) // Default event selection + return; + colCuts.fillQA(collision); + fillHistograms(collision, tracks, v0s); } + PROCESS_SWITCH(chargedkstaranalysis, processDataSE, "Process Event for data without Partitioning", true); - /* - SameKindPair - pair{binningOnPositions, cfgNoMixedEvents, -1, &cache}; - */ + using BinningTypeVtxZT0M = ColumnBinningPolicy; - void processSEnew(aod::ResoCollision const& collision, - aod::ResoTracks const& resotracks, - aod::ResoV0s const& resov0s) - { - // Fill the event counter - histos1.fill(HIST("hVertexZ"), collision.posZ()); - fillHistograms(collision, resotracks, - resov0s); // Fill histograms, no MC, no mixing - } - PROCESS_SWITCH(chargedkstaranalysis, processSEnew, "Process Same event new", - true); - - using BinningTypeVtxZT0M = - ColumnBinningPolicy; - void processMEnew(aod::ResoCollisions const& collisions, - aod::ResoTracks const& resotracks, - aod::ResoV0s const& resov0s) + // using BinningTypeVtxZT0M = ColumnBinningPolicy>; + BinningTypeVtxZT0M colBinning{{cfgvtxbins, cfgmultbins}, true}; + void processDataME(EventCandidates const& collisions, TrackCandidates const& tracks, V0Candidates const& v0s) { - auto tracksV0sTuple = std::make_tuple(resotracks, resov0s); - auto v0stuple = std::make_tuple(resov0s); - BinningTypeVtxZT0M colBinning{{cfgvtxbins, cfgmultbins}, true}; - Pair - pairs{colBinning, nEvtMixing, -1, collisions, - tracksV0sTuple, &cache}; // -1 is the number of the bin to skip - for (const auto& [c1, restrk1, c2, resov0s2] : pairs) { + auto tracksV0sTuple = std::make_tuple(tracks, v0s); + + Pair pair{colBinning, nEvtMixing, -1, collisions, tracksV0sTuple, &cache}; + // restrk1 is a TrackCandidates table of tracks belonging to collision c1 (aod::Collision::iterator) + // resov0s2 is a V0Candidates table of V0s belonging to collision c2 (aod::Collision::iterator) + for (const auto& [c1, restrk1, c2, resov0s2] : pair) { + if (!colCuts.isSelected(c1) || !colCuts.isSelected(c2)) { + // Default event selection + continue; + } + colCuts.fillQA(c1); fillHistograms(c1, restrk1, resov0s2); } + // fillHistograms(collision, tracks, v0s); // second order } - PROCESS_SWITCH(chargedkstaranalysis, processMEnew, "Process Mixed events new", - true); + PROCESS_SWITCH(chargedkstaranalysis, processDataME, "Process Event for data without Partitioning", true); - void processMCTrue(aod::ResoMCParents const& resoParents) + // process MC reconstructed level + void processMC(MCEventCandidates::iterator const& collision, + MCTrackCandidates const& tracks, + MCV0Candidates const& v0s) { - for (const auto& part : resoParents) { // loop over all pre-filtered MC particles - if (std::abs(part.pdgCode()) != o2::constants::physics::Pdg::kKPlusStar892) // K*892(pm) - continue; - if (std::abs(part.y()) > 0.5) // rapidity cut - continue; - bool pass1 = false; - bool pass2 = false; - if (part.daughterPDG1() == PDG_t::kPiPlus && part.daughterPDG2() == PDG_t::kK0Short) { // One decay to K0s and the other to pi+ (K*(892)+ mother) - Particle pass - pass1 = true; - histos1.fill(HIST("hK892pmCounter"), 0.5); - histos1.fill(HIST("k892pPtGen"), part.pt()); - } - if (part.daughterPDG1() == PDG_t::kPiMinus && part.daughterPDG2() == -310) { // One decay to AntiK0s and the other to pi- (K*(892)- mother) - Antiparticle pass - pass2 = true; - histos1.fill(HIST("hK892pmCounter"), 1.5); - histos1.fill(HIST("k892mPtGen"), part.pt()); - } - if (!pass1 && !pass2) // Go on only if we have both decay products, else skip to next iteration - continue; - histos1.fill(HIST("k892pmPtGen"), part.pt()); - } - } - PROCESS_SWITCH(chargedkstaranalysis, processMCTrue, "Process Event for MC", false); + // histos.fill(HIST("QAMC/hEvent"), 1.0); - void processMCLight(aod::ResoCollision const& collision, - soa::Join const& resotracks, - soa::Join const& resov0s) - { - fillHistograms(collision, resotracks, resov0s); + fillHistograms(collision, tracks, v0s); } - PROCESS_SWITCH(chargedkstaranalysis, processMCLight, "Process Event for MC", false); + PROCESS_SWITCH(chargedkstaranalysis, processMC, "Process Event for MC", false); }; - WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; From 48c86b5a31f0c55a37f6bfcfda58661cd2ff7be8 Mon Sep 17 00:00:00 2001 From: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Date: Fri, 25 Jul 2025 00:21:52 +0200 Subject: [PATCH 051/345] [PWGLF] Switch from THnD to THnSparse (#12228) Co-authored-by: ALICE Action Bot --- PWGLF/Tasks/Strangeness/strangenessderivedbinnedinfo.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGLF/Tasks/Strangeness/strangenessderivedbinnedinfo.cxx b/PWGLF/Tasks/Strangeness/strangenessderivedbinnedinfo.cxx index 88ca53fb19c..025341d279f 100644 --- a/PWGLF/Tasks/Strangeness/strangenessderivedbinnedinfo.cxx +++ b/PWGLF/Tasks/Strangeness/strangenessderivedbinnedinfo.cxx @@ -285,7 +285,7 @@ struct strangenessderivedbinnedinfo { histos.add("hEventCentrality", "hEventCentrality", kTH1F, {{100, 0.0f, +100.0f}}); histos.add("hEventOccupancy", "hEventOccupancy", kTH1F, {axisOccupancy}); - histos.add("h7dCentOccQoverPtMassRadiusPhiEta", "h7dCentOccQoverPtMassRadiusPhiEta", kTHnD, {axisCentrality, axisOccupancy, axisPt, axisMass, axisRadius, axisPhi, axisEta}); + histos.add("h7dCentOccQoverPtMassRadiusPhiEta", "h7dCentOccQoverPtMassRadiusPhiEta", kTHnSparseF, {axisCentrality, axisOccupancy, axisPt, axisMass, axisRadius, axisPhi, axisEta}); if (cfgSkimmedProcessing) { zorroSummary.setObject(zorro.getZorroSummary()); From d29411f5e8348d2a15b5fa568be9081578657894 Mon Sep 17 00:00:00 2001 From: creetz16 <79141119+creetz16@users.noreply.github.com> Date: Fri, 25 Jul 2025 01:55:33 +0200 Subject: [PATCH 052/345] [PWGLF] Fix MC info resetting in decay3bodybuilder (#12219) --- PWGLF/DataModel/Vtx3BodyTables.h | 2 ++ PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx | 16 ++++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/PWGLF/DataModel/Vtx3BodyTables.h b/PWGLF/DataModel/Vtx3BodyTables.h index df07fbc0c97..352687192eb 100644 --- a/PWGLF/DataModel/Vtx3BodyTables.h +++ b/PWGLF/DataModel/Vtx3BodyTables.h @@ -122,6 +122,7 @@ DECLARE_SOA_COLUMN(GenPtPi, genPtPi, float); //! generated transverse DECLARE_SOA_COLUMN(GenPtDe, genPtDe, float); //! generated transverse momentum deuteron daughter particle DECLARE_SOA_COLUMN(IsTrueH3L, isTrueH3l, bool); //! flag for true hypertriton candidate DECLARE_SOA_COLUMN(IsTrueAntiH3L, isTrueAntiH3l, bool); //! flag for true anti-hypertriton candidate +DECLARE_SOA_COLUMN(MotherPdgCode, motherPdgCode, int); //! PDG code of the mother particle DECLARE_SOA_COLUMN(PrPdgCode, prPdgCode, int); //! MC particle proton PDG code DECLARE_SOA_COLUMN(PiPdgCode, piPdgCode, int); //! MC particle pion PDG code DECLARE_SOA_COLUMN(DePdgCode, dePdgCode, int); //! MC particle deuteron PDG code @@ -276,6 +277,7 @@ DECLARE_SOA_TABLE(McVtx3BodyDatas, "AOD", "MC3BODYDATA", //! vtx3body::GenPtPr, vtx3body::GenPtPi, vtx3body::GenPtDe, vtx3body::IsTrueH3L, vtx3body::IsTrueAntiH3L, vtx3body::IsReco, + vtx3body::MotherPdgCode, vtx3body::PrPdgCode, vtx3body::PiPdgCode, vtx3body::DePdgCode, vtx3body::IsDePrimary, vtx3body::IsSurvEvSel, diff --git a/PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx b/PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx index 318e2874068..a113a8ecbd8 100644 --- a/PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx +++ b/PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx @@ -231,6 +231,7 @@ struct decay3bodyBuilder { bool isTrueH3L; bool isTrueAntiH3L; bool isReco; + int motherPdgCode; int daughterPrPdgCode; int daughterPiPdgCode; int daughterDePdgCode; @@ -849,7 +850,7 @@ struct decay3bodyBuilder { // get generated mother MC info if (motherID > 0) { auto mcTrackH3L = mcParticles.rawIteratorAt(motherID); - int chargeFactor = mcTrackH3L.pdgCode() > 0 ? 1 : -1; + this3BodyMCInfo.motherPdgCode = mcTrackH3L.pdgCode(); this3BodyMCInfo.label = motherID; this3BodyMCInfo.genMomentum = {mcTrackH3L.px(), mcTrackH3L.py(), mcTrackH3L.pz()}; this3BodyMCInfo.genDecVtx = {mcTrackProton.vx(), mcTrackProton.vy(), mcTrackProton.vz()}; @@ -857,8 +858,8 @@ struct decay3bodyBuilder { this3BodyMCInfo.genPhi = mcTrackH3L.phi(); this3BodyMCInfo.genEta = mcTrackH3L.eta(); this3BodyMCInfo.genRapidity = mcTrackH3L.y(); - this3BodyMCInfo.isTrueH3L = chargeFactor > 0; - this3BodyMCInfo.isTrueAntiH3L = chargeFactor < 0; + this3BodyMCInfo.isTrueH3L = this3BodyMCInfo.motherPdgCode > 0 ? true : false; + this3BodyMCInfo.isTrueAntiH3L = this3BodyMCInfo.motherPdgCode < 0 ? true : false; } // fill analysis tables (only McVtx3BodyDatas is filled here) @@ -878,12 +879,12 @@ struct decay3bodyBuilder { for (const auto& mcparticle : mcParticles) { // MC info resetMCInfo(this3BodyMCInfo); - this3BodyMCInfo.isReco = false; // skip MC particle if reconstructed and already filled previously if (mcParticleIsReco[mcparticle.globalIndex()] == true) { continue; } + this3BodyMCInfo.isReco = false; // set flag if corresponding MC collision has matched reconstructed collision which passed event selection this3BodyMCInfo.survivedEventSel = isGoodCollision[mcparticle.mcCollisionId()]; @@ -912,7 +913,7 @@ struct decay3bodyBuilder { } // check if hypertriton decayed via 3-body decay and is particle or anti-particle - if ((haveProton && haveAntiPion && haveDeuteron) || (haveAntiProton && havePion && haveAntiDeuteron)) { + if ((haveProton && haveAntiPion && haveDeuteron && !(haveAntiProton || havePion || haveAntiDeuteron)) || (haveAntiProton && havePion && haveAntiDeuteron && !(haveProton || haveAntiPion || haveDeuteron))) { if (mcparticle.pdgCode() > 0) { this3BodyMCInfo.isTrueH3L = true; } else if (mcparticle.pdgCode() < 0) { @@ -973,6 +974,7 @@ struct decay3bodyBuilder { this3BodyMCInfo.genPtProton, this3BodyMCInfo.genPtPion, this3BodyMCInfo.genPtDeuteron, this3BodyMCInfo.isTrueH3L, this3BodyMCInfo.isTrueAntiH3L, this3BodyMCInfo.isReco, + mcparticle.pdgCode(), this3BodyMCInfo.daughterPrPdgCode, this3BodyMCInfo.daughterPiPdgCode, this3BodyMCInfo.daughterDePdgCode, this3BodyMCInfo.isDeuteronPrimary, this3BodyMCInfo.survivedEventSel); @@ -1160,6 +1162,7 @@ struct decay3bodyBuilder { this3BodyMCInfo.genPtProton, this3BodyMCInfo.genPtPion, this3BodyMCInfo.genPtDeuteron, this3BodyMCInfo.isTrueH3L, this3BodyMCInfo.isTrueAntiH3L, this3BodyMCInfo.isReco, + this3BodyMCInfo.motherPdgCode, this3BodyMCInfo.daughterPrPdgCode, this3BodyMCInfo.daughterPiPdgCode, this3BodyMCInfo.daughterDePdgCode, this3BodyMCInfo.isDeuteronPrimary, this3BodyMCInfo.survivedEventSel); @@ -1240,7 +1243,7 @@ struct decay3bodyBuilder { // ______________________________________________________________ // function to reset MCInfo - void resetMCInfo(mc3Bodyinfo mcInfo) + void resetMCInfo(mc3Bodyinfo& mcInfo) { mcInfo.label = -1; mcInfo.genMomentum[0] = -1., mcInfo.genMomentum[1] = -1., mcInfo.genMomentum[2] = -1.; @@ -1251,6 +1254,7 @@ struct decay3bodyBuilder { mcInfo.genPtProton = -1., mcInfo.genPtPion = -1., mcInfo.genPtDeuteron = -1.; mcInfo.isTrueH3L = false, mcInfo.isTrueAntiH3L = false; mcInfo.isReco = false; + mcInfo.motherPdgCode = -1; mcInfo.daughterPrPdgCode = -1, mcInfo.daughterPiPdgCode = -1, mcInfo.daughterDePdgCode = -1; mcInfo.isDeuteronPrimary = false; mcInfo.survivedEventSel = false; From 6c0537eef0df16df614f0bb0586c758610bd8d14 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Fri, 25 Jul 2025 02:00:31 +0200 Subject: [PATCH 053/345] [Common] Add disabling of track propagation if not needed (#12160) Co-authored-by: ALICE Builder --- Common/Tools/TrackPropagationModule.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Common/Tools/TrackPropagationModule.h b/Common/Tools/TrackPropagationModule.h index fb957a87b9d..61ee995b367 100644 --- a/Common/Tools/TrackPropagationModule.h +++ b/Common/Tools/TrackPropagationModule.h @@ -10,7 +10,7 @@ // or submit itself to any jurisdiction. /// \file TrackPropagationModule.h -/// \brief track propagation module functionality to be used in tasks +/// \brief track propagation module functionality to be used in core services /// \author ALICE #ifndef COMMON_TOOLS_TRACKPROPAGATIONMODULE_H_ @@ -73,6 +73,7 @@ class TrackPropagationModule } // controls behaviour + bool fillTracks = false; bool fillTracksCov = false; bool fillTracksDCA = false; bool fillTracksDCACov = false; @@ -93,10 +94,15 @@ class TrackPropagationModule void init(TConfigurableGroup const& cGroup, THistoRegistry& registry, TInitContext& initContext) { // Checking if the tables are requested in the workflow and enabling them + fillTracks = isTableRequiredInWorkflow(initContext, "Tracks"); fillTracksCov = isTableRequiredInWorkflow(initContext, "TracksCov"); fillTracksDCA = isTableRequiredInWorkflow(initContext, "TracksDCA"); fillTracksDCACov = isTableRequiredInWorkflow(initContext, "TracksDCACov"); + if (!fillTracks) { + LOGF(info, "Track propagation to PV not required. Suppressing all further processing and logs."); + } + /// TrackTuner initialization if (cGroup.useTrackTuner.value) { std::string outputStringParams = ""; @@ -129,6 +135,10 @@ class TrackPropagationModule template void fillTrackTables(TConfigurableGroup const& cGroup, TCCDBLoader const& ccdbLoader, TCollisions const& collisions, TTracks const& tracks, TOutputGroup& cursors, THistoRegistry& registry) { + if (!fillTracks) { + return; // suppress everything + } + if (fillTracksCov) { cursors.tracksParCovPropagated.reserve(tracks.size()); cursors.tracksParCovExtensionPropagated.reserve(tracks.size()); From 36fc433a9b1a76df6d792e3af3557a1a1e6dbc12 Mon Sep 17 00:00:00 2001 From: omvazque Date: Thu, 24 Jul 2025 20:59:09 -0500 Subject: [PATCH 054/345] [PWGLF] Add flag to use T0M or V0A-based Nch rejection (#12232) --- PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx | 37 ++++++++++++++++---- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx b/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx index e1e9821ddb2..584c3ecfc1b 100644 --- a/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx @@ -37,6 +37,7 @@ #include "TPDGCode.h" #include +#include #include #include @@ -118,6 +119,7 @@ struct UccZdc { Configurable applyFD{"applyFD", false, "Apply track-by-track feed down correction"}; Configurable correctNch{"correctNch", true, "Correct also Nch"}; Configurable skipRecoColGTOne{"skipRecoColGTOne", true, "Remove collisions if reconstructed more than once"}; + Configurable detector4Calibration{"detector4Calibration", "T0M", "Detector for nSigma-Nch rejection"}; // Event selection Configurable posZcut{"posZcut", +10.0, "z-vertex position cut"}; @@ -243,6 +245,7 @@ struct UccZdc { registry.add("NchUncorrected", Form(";%s;Entries;", tiNch), kTH1F, {{nBinsNch, minNch, maxNch}}); registry.add("hEventCounter", ";;Events", kTH1F, {axisEvent}); registry.add("ExcludedEvtVsFT0M", Form(";%s;Entries;", tiT0M), kTH1F, {{nBinsAmpFT0, 0., maxAmpFT0}}); + registry.add("ExcludedEvtVsFV0A", Form(";%s;Entries;", tiT0M), kTH1F, {{nBinsAmpV0A, 0., maxAmpV0A}}); registry.add("ExcludedEvtVsNch", Form(";%s;Entries;", tiNch), kTH1F, {{nBinsNch, minNch, maxNch}}); registry.add("Nch", Form(";%s;Entries;", tiNch), kTH1F, {{nBinsNch, minNch, maxNch}}); registry.add("NchVsOneParCorr", Form(";%s;%s;", tiNch, tiOneParCorr), kTProfile, {{nBinsNch, minNch, maxNch}}); @@ -403,6 +406,7 @@ struct UccZdc { LOG(info) << "\tpaTHEff=" << paTHEff.value; LOG(info) << "\tpaTHFD=" << paTHFD.value; LOG(info) << "\tuseMidRapNchSel=" << useMidRapNchSel.value; + LOG(info) << "\tdetector4Calibration=" << detector4Calibration.value; LOG(info) << "\tnSigmaNchCut=" << nSigmaNchCut.value; LOG(info) << "\tpaTHmeanNch=" << paTHmeanNch.value; LOG(info) << "\tpaTHsigmaNch=" << paTHsigmaNch.value; @@ -599,14 +603,24 @@ struct UccZdc { if (!(cfgNch.hMeanNch && cfgNch.hSigmaNch)) return; - const int binT0M{cfgNch.hMeanNch->FindBin(normT0M)}; - const double meanNch{cfgNch.hMeanNch->GetBinContent(binT0M)}; - const double sigmaNch{cfgNch.hSigmaNch->GetBinContent(binT0M)}; + TString s1 = TString(detector4Calibration.value); + double xEval{1.}; + if (s1 == "T0M") { + xEval = normT0M; + } + if (s1 == "V0A") { + xEval = normV0A; + } + + const int bin4Calibration{cfgNch.hMeanNch->FindBin(xEval)}; + const double meanNch{cfgNch.hMeanNch->GetBinContent(bin4Calibration)}; + const double sigmaNch{cfgNch.hSigmaNch->GetBinContent(bin4Calibration)}; const double nSigmaSelection{nSigmaNchCut * sigmaNch}; const double diffMeanNch{meanNch - glbTracks}; if (std::abs(diffMeanNch) > nSigmaSelection) { registry.fill(HIST("ExcludedEvtVsFT0M"), normT0M); + registry.fill(HIST("ExcludedEvtVsFV0A"), normV0A); registry.fill(HIST("ExcludedEvtVsNch"), glbTracks); skipEvent = true; } @@ -763,19 +777,28 @@ struct UccZdc { bool skipEvent{false}; if (useMidRapNchSel) { - loadNchCalibrations(foundBC.timestamp()); if (!(cfgNch.hMeanNch && cfgNch.hSigmaNch)) return; - const int binT0M{cfgNch.hMeanNch->FindBin(normT0M)}; - const double meanNch{cfgNch.hMeanNch->GetBinContent(binT0M)}; - const double sigmaNch{cfgNch.hSigmaNch->GetBinContent(binT0M)}; + TString s1 = TString(detector4Calibration.value); + double xEval{1.}; + if (s1 == "T0M") { + xEval = normT0M; + } + if (s1 == "V0A") { + xEval = normV0A; + } + + const int bin4Calibration{cfgNch.hMeanNch->FindBin(xEval)}; + const double meanNch{cfgNch.hMeanNch->GetBinContent(bin4Calibration)}; + const double sigmaNch{cfgNch.hSigmaNch->GetBinContent(bin4Calibration)}; const double nSigmaSelection{nSigmaNchCut * sigmaNch}; const double diffMeanNch{meanNch - glbTracks}; if (std::abs(diffMeanNch) > nSigmaSelection) { registry.fill(HIST("ExcludedEvtVsFT0M"), normT0M); + registry.fill(HIST("ExcludedEvtVsFV0A"), normV0A); registry.fill(HIST("ExcludedEvtVsNch"), glbTracks); skipEvent = true; } From ff8d946a8135478afce3ee7a4f2cf5d4a646176a Mon Sep 17 00:00:00 2001 From: Hirak Koley Date: Fri, 25 Jul 2025 08:28:05 +0530 Subject: [PATCH 055/345] [PWGLF] Added new process function for rotational method (#12164) Co-authored-by: ALICE Action Bot --- .../Resonances/lambda1520analysisinpp.cxx | 893 ++++++++++-------- PWGLF/Utils/collisionCuts.h | 68 +- 2 files changed, 531 insertions(+), 430 deletions(-) diff --git a/PWGLF/Tasks/Resonances/lambda1520analysisinpp.cxx b/PWGLF/Tasks/Resonances/lambda1520analysisinpp.cxx index d280d3c1da3..0348751dae9 100644 --- a/PWGLF/Tasks/Resonances/lambda1520analysisinpp.cxx +++ b/PWGLF/Tasks/Resonances/lambda1520analysisinpp.cxx @@ -9,18 +9,10 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// \file lstaranalysis.cxx +/// \file lambda1520analysisinpp.cxx /// \brief This standalone task reconstructs track-track decay of lambda(1520) resonance candidate /// \author Hirak Kumar Koley -// 1. Own header (doesn't exist) - -// 2. C system headers (none) - -// 3. C++ system headers -#include - -// 4. Other includes: O2 framework, ROOT, etc. #include "PWGLF/Utils/collisionCuts.h" #include "Common/DataModel/Centrality.h" @@ -36,7 +28,9 @@ #include "Math/Vector4D.h" #include "TPDGCode.h" #include "TRandom.h" -#include "TVector3.h" + +#include +#include using namespace o2; using namespace o2::soa; @@ -48,25 +42,39 @@ using namespace o2::constants::physics; using LorentzVectorPtEtaPhiMass = ROOT::Math::PtEtaPhiMVector; enum { - kINEL = 1, - kINEL10, - kINELg0, - kINELg010, - kTrig, - kTrig10, - kTrigINELg0, - kTrigINELg010, - kSel8, - kSel810, - kSel8INELg0, - kSel8INELg010, - kAllCuts, - kAllCuts10, - kAllCutsINELg0, - kAllCutsINELg010, + Inel = 1, + Inel10, + Inelg0, + Inelg010, + Trig, + Trig10, + TrigINELg0, + TrigINELg010, + Sel8, + Sel810, + Sel8INELg0, + Sel8INELg010, + AllCuts, + AllCuts10, + AllCutsINELg0, + AllCutsINELg010, }; -struct Lstaranalysis { +enum TrackSelectionType { + AllTracks = 0, + GlobalTracks, + GlobalTracksWoPtEta, + GlobalTracksWoDCA, + QualityTracks, + InAcceptanceTracks, +}; + +enum PIDCutType { + SquareType = 1, + CircularType, +}; + +struct Lambda1520analysisinpp { // Define slice per Resocollision SliceCache cache; Preslice perCollision = o2::aod::track::collisionId; @@ -79,118 +87,132 @@ struct Lstaranalysis { /// Event cuts o2::analysis::CollisonCuts colCuts; - Configurable cfgEvtZvtx{"cfgEvtZvtx", 10.f, "Evt sel: Max. z-Vertex (cm)"}; - Configurable cfgEvtOccupancyInTimeRangeMax{"cfgEvtOccupancyInTimeRangeMax", -1, "Evt sel: maximum track occupancy"}; - Configurable cfgEvtOccupancyInTimeRangeMin{"cfgEvtOccupancyInTimeRangeMin", -1, "Evt sel: minimum track occupancy"}; - Configurable cfgEvtTriggerCheck{"cfgEvtTriggerCheck", false, "Evt sel: check for trigger"}; - Configurable cfgEvtOfflineCheck{"cfgEvtOfflineCheck", true, "Evt sel: check for offline selection"}; - Configurable cfgEvtTriggerTVXSel{"cfgEvtTriggerTVXSel", false, "Evt sel: triggerTVX selection (MB)"}; - Configurable cfgEvtTFBorderCut{"cfgEvtTFBorderCut", false, "Evt sel: apply TF border cut"}; - Configurable cfgEvtUseITSTPCvertex{"cfgEvtUseITSTPCvertex", false, "Evt sel: use at lease on ITS-TPC track for vertexing"}; - Configurable cfgEvtZvertexTimedifference{"cfgEvtZvertexTimedifference", false, "Evt sel: apply Z-vertex time difference"}; - Configurable cfgEvtPileupRejection{"cfgEvtPileupRejection", false, "Evt sel: apply pileup rejection"}; - Configurable cfgEvtNoITSROBorderCut{"cfgEvtNoITSROBorderCut", false, "Evt sel: apply NoITSRO border cut"}; - Configurable cfgEvtCollInTimeRangeStandard{"cfgEvtCollInTimeRangeStandard", false, "Evt sel: apply NoCollInTimeRangeStandard"}; - - Configurable cfgEventCentralityMin{"cfgEventCentralityMin", 0.0f, "Event sel: minimum centrality"}; - Configurable cfgEventCentralityMax{"cfgEventCentralityMax", 100.0f, "Event sel: maximum centrality"}; - - // Configurables - // Pre-selection Track cuts - Configurable trackSelection{"trackSelection", 0, "Track selection: 0 -> No Cut, 1 -> kGlobalTrack, 2 -> kGlobalTrackWoPtEta, 3 -> kGlobalTrackWoDCA, 4 -> kQualityTracks, 5 -> kInAcceptanceTracks"}; - Configurable cMinPtcut{"cMinPtcut", 0.15f, "Minimal pT for tracks"}; - Configurable cMinTPCNClsFound{"cMinTPCNClsFound", 120, "minimum TPCNClsFound value for good track"}; - Configurable cfgCutEta{"cfgCutEta", 0.8f, "Eta range for tracks"}; - Configurable cfgMinCrossedRows{"cfgMinCrossedRows", 70, "min crossed rows for good track"}; - - // DCA Selections - // DCAr to PV - Configurable cMaxDCArToPVcut{"cMaxDCArToPVcut", 0.1f, "Track DCAr cut to PV Maximum"}; - // DCAz to PV - Configurable cMaxDCAzToPVcut{"cMaxDCAzToPVcut", 0.1f, "Track DCAz cut to PV Maximum"}; - - // Track selections - Configurable cfgPrimaryTrack{"cfgPrimaryTrack", true, "Primary track selection"}; // kGoldenChi2 | kDCAxy | kDCAz - Configurable cfgGlobalWoDCATrack{"cfgGlobalWoDCATrack", true, "Global track selection without DCA"}; // kQualityTracks (kTrackType | kTPCNCls | kTPCCrossedRows | kTPCCrossedRowsOverNCls | kTPCChi2NDF | kTPCRefit | kITSNCls | kITSChi2NDF | kITSRefit | kITSHits) | kInAcceptanceTracks (kPtRange | kEtaRange) - Configurable cfgGlobalTrack{"cfgGlobalTrack", false, "Global track selection"}; // kGoldenChi2 | kDCAxy | kDCAz - Configurable cfgPVContributor{"cfgPVContributor", false, "PV contributor track selection"}; // PV Contriuibutor - Configurable cfgHasTOF{"cfgHasTOF", false, "Require TOF"}; - Configurable cfgUseTPCRefit{"cfgUseTPCRefit", false, "Require TPC Refit"}; - Configurable cfgUseITSRefit{"cfgUseITSRefit", false, "Require ITS Refit"}; - Configurable cTPCNClsFound{"cTPCNClsFound", false, "Switch to turn on/off TPCNClsFound cut"}; - Configurable cDCAr7SigCut{"cDCAr7SigCut", false, "Track DCAr 7 Sigma cut to PV Maximum"}; - - /// PID Selections - Configurable cByPassTOF{"cByPassTOF", false, "By pass TOF PID selection"}; // By pass TOF PID selection - Configurable cPIDcutType{"cPIDcutType", 2, "cPIDcutType = 1 for square cut, 2 for circular cut"}; // By pass TOF PID selection - - // Kaon - Configurable> kaonTPCPIDpTintv{"kaonTPCPIDpTintv", {0.5}, "pT intervals for Kaon TPC PID cuts"}; - Configurable> kaonTPCPIDcuts{"kaonTPCPIDcuts", {2}, "nSigma list for Kaon TPC PID cuts"}; - Configurable> kaonTOFPIDpTintv{"kaonTOFPIDpTintv", {999.}, "pT intervals for Kaon TOF PID cuts"}; - Configurable> kaonTOFPIDcuts{"kaonTOFPIDcuts", {2}, "nSigma list for Kaon TOF PID cuts"}; - Configurable> kaonTPCTOFCombinedpTintv{"kaonTPCTOFCombinedpTintv", {999.}, "pT intervals for Kaon TPC-TOF PID cuts"}; - Configurable> kaonTPCTOFCombinedPIDcuts{"kaonTPCTOFCombinedPIDcuts", {2}, "nSigma list for Kaon TPC-TOF PID cuts"}; - - // Proton - Configurable> protonTPCPIDpTintv{"protonTPCPIDpTintv", {0.9}, "pT intervals for Kaon TPC PID cuts"}; - Configurable> protonTPCPIDcuts{"protonTPCPIDcuts", {2}, "nSigma list for Kaon TPC PID cuts"}; - Configurable> protonTOFPIDpTintv{"protonTOFPIDpTintv", {999.}, "pT intervals for Kaon TOF PID cuts"}; - Configurable> protonTOFPIDcuts{"protonTOFPIDcuts", {2}, "nSigma list for Kaon TOF PID cuts"}; - Configurable> protonTPCTOFCombinedpTintv{"protonTPCTOFCombinedpTintv", {999.}, "pT intervals for Proton TPC-TOF PID cuts"}; - Configurable> protonTPCTOFCombinedPIDcuts{"protonTPCTOFCombinedPIDcuts", {2}, "nSigma list for Proton TPC-TOF PID cuts"}; + struct : ConfigurableGroup { + Configurable cfgEvtZvtx{"cfgEvtZvtx", 10.0f, "Evt sel: Max. z-Vertex (cm)"}; + Configurable cfgEvtOccupancyInTimeRangeMax{"cfgEvtOccupancyInTimeRangeMax", -1, "Evt sel: maximum track occupancy"}; + Configurable cfgEvtOccupancyInTimeRangeMin{"cfgEvtOccupancyInTimeRangeMin", -1, "Evt sel: minimum track occupancy"}; + Configurable cfgEvtTriggerCheck{"cfgEvtTriggerCheck", false, "Evt sel: check for trigger"}; + Configurable cfgEvtOfflineCheck{"cfgEvtOfflineCheck", true, "Evt sel: check for offline selection"}; + Configurable cfgEvtTriggerTVXSel{"cfgEvtTriggerTVXSel", false, "Evt sel: triggerTVX selection (MB)"}; + Configurable cfgEvtTFBorderCut{"cfgEvtTFBorderCut", false, "Evt sel: apply TF border cut"}; + Configurable cfgEvtUseITSTPCvertex{"cfgEvtUseITSTPCvertex", false, "Evt sel: use at lease on ITS-TPC track for vertexing"}; + Configurable cfgEvtZvertexTimedifference{"cfgEvtZvertexTimedifference", false, "Evt sel: apply Z-vertex time difference"}; + Configurable cfgEvtPileupRejection{"cfgEvtPileupRejection", false, "Evt sel: apply pileup rejection"}; + Configurable cfgEvtNoITSROBorderCut{"cfgEvtNoITSROBorderCut", false, "Evt sel: apply NoITSRO border cut"}; + Configurable cfgEvtCollInTimeRangeStandard{"cfgEvtCollInTimeRangeStandard", false, "Evt sel: apply NoCollInTimeRangeStandard"}; + } configEvents; + + struct : ConfigurableGroup { + // Pre-selection Track cuts + Configurable trackSelection{"trackSelection", 0, "Track selection: 0 -> No Cut, 1 -> kGlobalTrack, 2 -> kGlobalTrackWoPtEta, 3 -> kGlobalTrackWoDCA, 4 -> kQualityTracks, 5 -> kInAcceptanceTracks"}; + Configurable cMinPtcut{"cMinPtcut", 0.15f, "Minimal pT for tracks"}; + Configurable cMinTPCNClsFound{"cMinTPCNClsFound", 120, "minimum TPCNClsFound value for good track"}; + Configurable cfgCutEta{"cfgCutEta", 0.8f, "Eta range for tracks"}; + Configurable cfgCutRapidity{"cfgCutRapidity", 0.5f, "rapidity range for particles"}; + Configurable cfgMinCrossedRows{"cfgMinCrossedRows", 70, "min crossed rows for good track"}; + + // DCA Selections + // DCAr to PV + Configurable cMaxDCArToPVcut{"cMaxDCArToPVcut", 0.1f, "Track DCAr cut to PV Maximum"}; + // DCAz to PV + Configurable cMaxDCAzToPVcut{"cMaxDCAzToPVcut", 0.1f, "Track DCAz cut to PV Maximum"}; + + // Track selections + Configurable cfgPrimaryTrack{"cfgPrimaryTrack", true, "Primary track selection"}; // kGoldenChi2 | kDCAxy | kDCAz + Configurable cfgGlobalWoDCATrack{"cfgGlobalWoDCATrack", true, "Global track selection without DCA"}; // kQualityTracks (kTrackType | kTPCNCls | kTPCCrossedRows | kTPCCrossedRowsOverNCls | kTPCChi2NDF | kTPCRefit | kITSNCls | kITSChi2NDF | kITSRefit | kITSHits) | kInAcceptanceTracks (kPtRange | kEtaRange) + Configurable cfgGlobalTrack{"cfgGlobalTrack", false, "Global track selection"}; // kGoldenChi2 | kDCAxy | kDCAz + Configurable cfgPVContributor{"cfgPVContributor", false, "PV contributor track selection"}; // PV Contriuibutor + Configurable cfgHasTOF{"cfgHasTOF", false, "Require TOF"}; + Configurable cfgUseTPCRefit{"cfgUseTPCRefit", false, "Require TPC Refit"}; + Configurable cfgUseITSRefit{"cfgUseITSRefit", false, "Require ITS Refit"}; + Configurable cTPCNClsFound{"cTPCNClsFound", false, "Switch to turn on/off TPCNClsFound cut"}; + Configurable cDCAr7SigCut{"cDCAr7SigCut", false, "Track DCAr 7 Sigma cut to PV Maximum"}; + } configTracks; + + struct : ConfigurableGroup { + /// PID Selections + Configurable pidnSigmaPreSelectionCut{"pidnSigmaPreSelectionCut", 4.0f, "pidnSigma Cut for pre-selection of tracks"}; + Configurable cByPassTOF{"cByPassTOF", false, "By pass TOF PID selection"}; // By pass TOF PID selection + Configurable cPIDcutType{"cPIDcutType", 2, "cPIDcutType = 1 for square cut, 2 for circular cut"}; // By pass TOF PID selection + + // Kaon + Configurable> kaonTPCPIDpTintv{"kaonTPCPIDpTintv", {0.5f}, "pT intervals for Kaon TPC PID cuts"}; + Configurable> kaonTPCPIDcuts{"kaonTPCPIDcuts", {2}, "nSigma list for Kaon TPC PID cuts"}; + Configurable> kaonTOFPIDpTintv{"kaonTOFPIDpTintv", {999.0f}, "pT intervals for Kaon TOF PID cuts"}; + Configurable> kaonTOFPIDcuts{"kaonTOFPIDcuts", {2}, "nSigma list for Kaon TOF PID cuts"}; + Configurable> kaonTPCTOFCombinedpTintv{"kaonTPCTOFCombinedpTintv", {999.0f}, "pT intervals for Kaon TPC-TOF PID cuts"}; + Configurable> kaonTPCTOFCombinedPIDcuts{"kaonTPCTOFCombinedPIDcuts", {2}, "nSigma list for Kaon TPC-TOF PID cuts"}; + + // Proton + Configurable> protonTPCPIDpTintv{"protonTPCPIDpTintv", {0.9f}, "pT intervals for Kaon TPC PID cuts"}; + Configurable> protonTPCPIDcuts{"protonTPCPIDcuts", {2}, "nSigma list for Kaon TPC PID cuts"}; + Configurable> protonTOFPIDpTintv{"protonTOFPIDpTintv", {999.0f}, "pT intervals for Kaon TOF PID cuts"}; + Configurable> protonTOFPIDcuts{"protonTOFPIDcuts", {2}, "nSigma list for Kaon TOF PID cuts"}; + Configurable> protonTPCTOFCombinedpTintv{"protonTPCTOFCombinedpTintv", {999.0f}, "pT intervals for Proton TPC-TOF PID cuts"}; + Configurable> protonTPCTOFCombinedPIDcuts{"protonTPCTOFCombinedPIDcuts", {2}, "nSigma list for Proton TPC-TOF PID cuts"}; + } configPID; + + struct : ConfigurableGroup { + /// Event Mixing + Configurable nEvtMixing{"nEvtMixing", 10, "Number of events to mix"}; + ConfigurableAxis cfgVtxBins{"cfgVtxBins", {VARIABLE_WIDTH, -10.0f, -8.0f, -6.0f, -4.0f, -2.0f, 0.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f}, "Mixing bins - z-vertex"}; + ConfigurableAxis cfgMultBins{"cfgMultBins", {VARIABLE_WIDTH, 0.0f, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f, 100.0f, 110.0f}, "Mixing bins - multiplicity"}; + + // Rotational background + Configurable rotationalcut{"rotationalcut", 10, "Cut value (Rotation angle pi - pi/cut and pi + pi/cut)"}; + Configurable cNofRotations{"cNofRotations", 3, "Number of random rotations in the rotational background"}; + Configurable cfgRotPr{"cfgRotPr", true, "rotate Proton"}; + } configBkg; // Additional purity check Configurable crejectPion{"crejectPion", false, "Switch to turn on/off pion contamination"}; - Configurable cApplyOpeningAngle{"cApplyOpeningAngle", false, "Kinematic Cuts for p-K pair opening angle"}; - Configurable cMinOpeningAngle{"cMinOpeningAngle", 1.4, "Maximum deltaEta between daughters"}; - Configurable cMaxOpeningAngle{"cMaxOpeningAngle", 2.4, "Maximum deltaPhi between daughters"}; - - /// Event Mixing - Configurable nEvtMixing{"nEvtMixing", 10, "Number of events to mix"}; - ConfigurableAxis cfgVtxBins{"cfgVtxBins", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"}; - ConfigurableAxis cfgMultBins{"cfgMultBins", {VARIABLE_WIDTH, 0.0f, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f, 100.0f, 110.0f}, "Mixing bins - multiplicity"}; - - // Rotational background - Configurable isCalcRotBkg{"isCalcRotBkg", true, "Calculate rotational background"}; - Configurable rotationalcut{"rotationalcut", 10, "Cut value (Rotation angle pi - pi/cut and pi + pi/cut)"}; - Configurable cNofRotations{"cNofRotations", 3, "Number of random rotations in the rotational background"}; + Configurable cUseOpeningAngleCut{"cUseOpeningAngleCut", false, "Kinematic Cuts for p-K pair opening angle"}; + Configurable cMinOpeningAngle{"cMinOpeningAngle", 1.4f, "Minimum opening angle between daughters"}; + Configurable cMaxOpeningAngle{"cMaxOpeningAngle", 2.4f, "Maximum opening angle between daughters"}; + Configurable cfgUseDeltaEtaPhiCuts{"cfgUseDeltaEtaPhiCuts", false, "Switch to turn on/off delta eta and delta phi cuts"}; + Configurable cfgUseDaughterEtaCutMC{"cfgUseDaughterEtaCutMC", false, "Switch to turn on/off eta cuts for daughters in MC"}; // MC selection cut - Configurable cZvertCutMC{"cZvertCutMC", 10.0, "MC Z-vertex cut"}; - Configurable cEtacutMC{"cEtacutMC", 0.5, "MC eta cut"}; + Configurable cZvertCutMC{"cZvertCutMC", 10.0f, "MC Z-vertex cut"}; + Configurable cEtacutMC{"cEtacutMC", 0.5f, "MC eta cut"}; Configurable cUseRapcutMC{"cUseRapcutMC", true, "MC eta cut"}; Configurable cUseEtacutMC{"cUseEtacutMC", true, "MC eta cut"}; // cuts on mother - Configurable cfgCutsOnMother{"cfgCutsOnMother", false, "Enable additional cuts on mother"}; - Configurable cMaxPtMotherCut{"cMaxPtMotherCut", 10.0, "Maximum pt of mother cut"}; - Configurable cMaxMinvMotherCut{"cMaxMinvMotherCut", 3.0, "Maximum Minv of mother cut"}; - Configurable cMaxDeltaEtaCut{"cMaxDeltaEtaCut", 0.7, "Maximum deltaEta between daughters"}; - Configurable cMaxDeltaPhiCut{"cMaxDeltaPhiCut", 1.5, "Maximum deltaPhi between daughters"}; + Configurable cfgUseCutsOnMother{"cfgUseCutsOnMother", false, "Enable additional cuts on mother"}; + Configurable cMaxPtMotherCut{"cMaxPtMotherCut", 10.0f, "Maximum pt of mother cut"}; + Configurable cMaxMinvMotherCut{"cMaxMinvMotherCut", 3.0f, "Maximum Minv of mother cut"}; + Configurable cMaxDeltaEtaCut{"cMaxDeltaEtaCut", 0.7f, "Maximum deltaEta between daughters"}; + Configurable cMaxDeltaPhiCut{"cMaxDeltaPhiCut", 1.5f, "Maximum deltaPhi between daughters"}; // switches Configurable cFillMultQA{"cFillMultQA", false, "Turn on/off additional QA plots"}; Configurable cFilladditionalQAeventPlots{"cFilladditionalQAeventPlots", false, "Additional QA event plots"}; Configurable cFilladditionalMEPlots{"cFilladditionalMEPlots", false, "Additional Mixed event plots"}; Configurable cFilldeltaEtaPhiPlots{"cFilldeltaEtaPhiPlots", false, "Enamble additional cuts on daughters"}; - Configurable cFillinvmass1DPlots{"cFillinvmass1DPlots", false, "Invariant mass 1D"}; - Configurable multEstimator{"multEstimator", 0, "Select multiplicity estimator: 0 - FT0M, 1 - FT0A, 2 - FT0C"}; - - Configurable cfgCentEst{"cfgCentEst", 2, "Centrality estimator, 1: FT0C, 2: FT0M"}; + Configurable cFill1DQAs{"cFill1DQAs", false, "Invariant mass 1D"}; + Configurable centEstimator{"centEstimator", 0, "Select centrality estimator: 0 - FT0M, 1 - FT0A, 2 - FT0C"}; TRandom* rn = new TRandom(); // Pre-filters for efficient process - // Filter tofPIDFilter = aod::track::tofExpMom < 0.f || ((aod::track::tofExpMom > 0.f) && ((nabs(aod::pidtof::tofNSigmaPi) < pidnSigmaPreSelectionCut) || (nabs(aod::pidtof::tofNSigmaKa) < pidnSigmaPreSelectionCut) || (nabs(aod::pidtof::tofNSigmaPr) < pidnSigmaPreSelectionCut))); // TOF - // Filter tpcPIDFilter = nabs(aod::pidtpc::tpcNSigmaPi) < pidnSigmaPreSelectionCut || nabs(aod::pidtpc::tpcNSigmaKa) < pidnSigmaPreSelectionCut || nabs(aod::pidtpc::tpcNSigmaPr) < pidnSigmaPreSelectionCut; // TPC - /* Filter trackFilter = (trackSelection == 0) || - ((trackSelection == 1) && requireGlobalTrackInFilter()) || - ((trackSelection == 2) && requireGlobalTrackWoPtEtaInFilter()) || - ((trackSelection == 3) && requireGlobalTrackWoDCAInFilter()) || - ((trackSelection == 4) && requireQualityTracksInFilter()) || - ((trackSelection == 5) && requireTrackCutInFilter(TrackSelectionFlags::kInAcceptanceTracks)); */ - Filter trackEtaFilter = nabs(aod::track::eta) < cfgCutEta; // Eta cut + Filter zVtxFilter = (nabs(o2::aod::collision::posZ) <= configEvents.cfgEvtZvtx); + Filter collisionFilterMC = nabs(aod::mccollision::posZ) <= configEvents.cfgEvtZvtx; + // Filter centralityFilter = nabs(aod::cent::centFT0C) <= cfg_Event_CentralityMax; + // Filter triggerFilter = (o2::aod::evsel::sel8 == true); + + Filter tofPIDFilter = aod::track::tofExpMom < 0.0f || ((aod::track::tofExpMom > 0.0f) && (/* (nabs(aod::pidtof::tofNSigmaPi) < configPID.pidnSigmaPreSelectionCut) || */ (nabs(aod::pidtof::tofNSigmaKa) < configPID.pidnSigmaPreSelectionCut) || (nabs(aod::pidtof::tofNSigmaPr) < configPID.pidnSigmaPreSelectionCut))); // TOF + Filter tpcPIDFilter = /* nabs(aod::pidtpc::tpcNSigmaPi) < configPID.pidnSigmaPreSelectionCut || */ nabs(aod::pidtpc::tpcNSigmaKa) < configPID.pidnSigmaPreSelectionCut || nabs(aod::pidtpc::tpcNSigmaPr) < configPID.pidnSigmaPreSelectionCut; // TPC + Filter trackFilter = (configTracks.trackSelection == AllTracks) || + ((configTracks.trackSelection == GlobalTracks) && requireGlobalTrackInFilter()) || + ((configTracks.trackSelection == GlobalTracksWoPtEta) && requireGlobalTrackWoPtEtaInFilter()) || + ((configTracks.trackSelection == GlobalTracksWoDCA) && requireGlobalTrackWoDCAInFilter()) || + ((configTracks.trackSelection == QualityTracks) && requireQualityTracksInFilter()) || + ((configTracks.trackSelection == InAcceptanceTracks) && requireTrackCutInFilter(TrackSelectionFlags::kInAcceptanceTracks)); + + Filter acceptanceFilter = (nabs(aod::track::eta) < configTracks.cfgCutEta && nabs(aod::track::pt) > configTracks.cMinPtcut); + // Filter DCAcutFilter = (nabs(aod::track::dcaXY) < configTracks.cfgCutDCAxy) && (nabs(aod::track::dcaZ) < configTracks.cfgCutDCAz); + // Filter primarytrackFilter = requirePVContributor() && requirePrimaryTrack() && requireGlobalTrackWoDCA(); using EventCandidates = soa::Join; using TrackCandidates = soa::Filtered>; @@ -199,34 +221,30 @@ struct Lstaranalysis { using MCTrackCandidates = soa::Filtered>; /// Figures - ConfigurableAxis binsPt{"binsPt", {VARIABLE_WIDTH, 0.0, 0.1, 0.12, 0.14, 0.16, 0.18, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1.0, 1.1, 1.2, 1.25, 1.3, 1.4, 1.5, 1.6, 1.7, 1.75, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.6, 3.7, 3.8, 3.9, 4.0, 4.1, 4.2, 4.5, 4.6, 4.8, 4.9, 5.0, 5.5, 5.6, 6.0, 6.4, 6.5, 7.0, 7.2, 8.0, 9.0, 9.5, 9.6, 10.0, 11.0, 11.5, 12.0, 13.0, 14.0, 14.4, 15.0, 16.0, 18.0, 19.2, 20.}, "Binning of the pT axis"}; - ConfigurableAxis binsPtQA{"binsPtQA", {VARIABLE_WIDTH, 0.0, 0.2, 0.4, 0.6, 0.8, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0, 3.2, 3.4, 3.6, 3.8, 4.0, 4.2, 4.4, 4.6, 4.8, 5.0, 5.2, 5.4, 5.6, 5.8, 6.0, 6.2, 6.4, 6.6, 6.8, 7.0, 7.2, 7.4, 7.6, 7.8, 8.0, 8.2, 8.4, 8.6, 8.8, 9.0, 9.2, 9.4, 9.6, 9.8, 10.0, 10.2, 10.4, 10.6, 10.8, 11, 11.2, 11.4, 11.6, 11.8, 12, 12.2, 12.4, 12.6, 12.8, 13, 13.2, 13.4, 13.6, 13.8, 14, 14.2, 14.4, 14.6, 14.8, 15, 15.2, 15.4, 15.6, 15.8, 16, 16.2, 16.4, 16.6, 16.8, 17, 17.2, 17.4, 17.6, 17.8, 18, 18.2, 18.4, 18.6, 18.8, 19, 19.2, 19.4, 19.6, 19.8, 20}, "Binning of the pT axis"}; - ConfigurableAxis binsEta{"binsEta", {150, -1.5, 1.5}, ""}; - ConfigurableAxis binsMass{"binsMass", {70, 1.3, 2.0}, "Invariant Mass (GeV/#it{c}^2)"}; - ConfigurableAxis binsMult{"binsMult", {105, 0.0, 105.0}, "mult_{FT0M}"}; - ConfigurableAxis binsDCAz{"binsDCAz", {40, -0.2, 0.2}, ""}; - ConfigurableAxis binsDCAxy{"binsDCAxy", {40, -0.2, 0.2}, ""}; + ConfigurableAxis binsPt{"binsPt", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.12f, 0.14f, 0.16f, 0.18f, 0.2f, 0.25f, 0.3f, 0.35f, 0.4f, 0.45f, 0.5f, 0.55f, 0.6f, 0.65f, 0.7f, 0.75f, 0.8f, 0.85f, 0.9f, 0.95f, 1.0f, 1.1f, 1.2f, 1.25f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.75f, 1.8f, 1.9f, 2.0f, 2.1f, 2.2f, 2.3f, 2.4f, 2.5f, 2.6f, 2.7f, 2.8f, 2.9f, 3.0f, 3.1f, 3.2f, 3.3f, 3.4f, 3.6f, 3.7f, 3.8f, 3.9f, 4.0f, 4.1f, 4.2f, 4.5f, 4.6f, 4.8f, 4.9f, 5.0f, 5.5f, 5.6f, 6.0f, 6.4f, 6.5f, 7.0f, 7.2f, 8.0f, 9.0f, 9.5f, 9.6f, 10.0f, 11.0f, 11.5f, 12.0f, 13.0f, 14.0f, 14.4f, 15.0f, 16.0f, 18.0f, 19.2f, 20.0f}, "Binning of the pT axis"}; + ConfigurableAxis binsPtQA{"binsPtQA", {VARIABLE_WIDTH, 0.0f, 0.2f, 0.4f, 0.6f, 0.8f, 1.0f, 1.2f, 1.4f, 1.6f, 1.8f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.2f, 4.4f, 4.6f, 4.8f, 5.0f, 5.2f, 5.4f, 5.6f, 5.8f, 6.0f, 6.2f, 6.4f, 6.6f, 6.8f, 7.0f, 7.2f, 7.4f, 7.6f, 7.8f, 8.0f, 8.2f, 8.4f, 8.6f, 8.8f, 9.0f, 9.2f, 9.4f, 9.6f, 9.8f, 10.0f, 10.2f, 10.4f, 10.6f, 10.8f, 11.0f, 11.2f, 11.4f, 11.6f, 11.8f, 12.0f, 12.2f, 12.4f, 12.6f, 12.8f, 13.0f, 13.2f, 13.4f, 13.6f, 13.8f, 14.0f, 14.2f, 14.4f, 14.6f, 14.8f, 15.0f, 15.2f, 15.4f, 15.6f, 15.8f, 16.0f, 16.2f, 16.4f, 16.6f, 16.8f, 17.0f, 17.2f, 17.4f, 17.6f, 17.8f, 18.0f, 18.2f, 18.4f, 18.6f, 18.8f, 19.0f, 19.2f, 19.4f, 19.6f, 19.8f, 20.0f}, "Binning of the pT axis"}; + ConfigurableAxis binsEta{"binsEta", {150, -1.5f, 1.5f}, ""}; + ConfigurableAxis binsMass{"binsMass", {70, 1.3f, 2.0f}, "Invariant Mass (GeV/#it{c}^2)"}; + ConfigurableAxis binsMult{"binsMult", {105, 0.0f, 105.0f}, "mult_{FT0M}"}; + ConfigurableAxis binsDCAz{"binsDCAz", {40, -0.2f, 0.2f}, ""}; + ConfigurableAxis binsDCAxy{"binsDCAxy", {40, -0.2f, 0.2f}, ""}; ConfigurableAxis binsTPCXrows{"binsTPCXrows", {100, 60, 160}, ""}; - ConfigurableAxis binsnSigma{"binsnSigma", {130, -6.5, 6.5}, ""}; + ConfigurableAxis binsnSigma{"binsnSigma", {130, -6.5f, 6.5f}, ""}; ConfigurableAxis binsnTPCSignal{"binsnTPCSignal", {1000, 0, 1000}, ""}; - ConfigurableAxis binsEtaPhi{"binsEtaPhi", {350, -3.5, 3.5}, ""}; - - float centrality; + ConfigurableAxis binsEtaPhi{"binsEtaPhi", {350, -3.5f, 3.5f}, ""}; void init(framework::InitContext&) { - centrality = -999; - - colCuts.setCuts(cfgEvtZvtx, cfgEvtTriggerCheck, cfgEvtOfflineCheck, /*checkRun3*/ true, /*triggerTVXsel*/ false, cfgEvtOccupancyInTimeRangeMax, cfgEvtOccupancyInTimeRangeMin); + colCuts.setCuts(configEvents.cfgEvtZvtx, configEvents.cfgEvtTriggerCheck, configEvents.cfgEvtOfflineCheck, /*checkRun3*/ true, /*triggerTVXsel*/ false, configEvents.cfgEvtOccupancyInTimeRangeMax, configEvents.cfgEvtOccupancyInTimeRangeMin); colCuts.init(&histos); - colCuts.setTriggerTVX(cfgEvtTriggerTVXSel); - colCuts.setApplyTFBorderCut(cfgEvtTFBorderCut); - colCuts.setApplyITSTPCvertex(cfgEvtUseITSTPCvertex); - colCuts.setApplyZvertexTimedifference(cfgEvtZvertexTimedifference); - colCuts.setApplyPileupRejection(cfgEvtPileupRejection); - colCuts.setApplyNoITSROBorderCut(cfgEvtNoITSROBorderCut); - colCuts.setApplyCollInTimeRangeStandard(cfgEvtCollInTimeRangeStandard); + colCuts.setTriggerTVX(configEvents.cfgEvtTriggerTVXSel); + colCuts.setApplyTFBorderCut(configEvents.cfgEvtTFBorderCut); + colCuts.setApplyITSTPCvertex(configEvents.cfgEvtUseITSTPCvertex); + colCuts.setApplyZvertexTimedifference(configEvents.cfgEvtZvertexTimedifference); + colCuts.setApplyPileupRejection(configEvents.cfgEvtPileupRejection); + colCuts.setApplyNoITSROBorderCut(configEvents.cfgEvtNoITSROBorderCut); + colCuts.setApplyCollInTimeRangeStandard(configEvents.cfgEvtCollInTimeRangeStandard); colCuts.printCuts(); // axes @@ -241,22 +259,18 @@ struct Lstaranalysis { AxisSpec axisTPCXrow{binsTPCXrows, "#Xrows_{TPC}"}; AxisSpec axisPIDQA{binsnSigma, "#sigma"}; AxisSpec axisTPCSignal{binsnTPCSignal, ""}; - AxisSpec axisMClabel{6, -1.5, 5.5, "MC Label"}; + AxisSpec axisMClabel{6, -1.5f, 5.5f, "MC Label"}; AxisSpec axisEtaPhi{binsEtaPhi, ""}; AxisSpec axisPhi{350, 0, 7, "#Phi"}; - AxisSpec axisMultMix{cfgMultBins, "Multiplicity"}; - AxisSpec axisVtxMix{cfgVtxBins, "Vertex Z (cm)"}; - AxisSpec idxMCAxis = {26, -0.5, 25.5, "Index"}; + AxisSpec axisMultMix{configBkg.cfgMultBins, "Multiplicity"}; + AxisSpec axisVtxMix{configBkg.cfgVtxBins, "Vertex Z (cm)"}; + AxisSpec idxMCAxis = {26, -0.5f, 25.5f, "Index"}; if (cFilladditionalQAeventPlots) { // event histograms if (doprocessData) { - histos.add("TestME/hPairsCounterSameE", "tot n pairs sameE", HistType::kTH1F, {{1, 0.5f, 1.5f}}); - histos.add("QAevent/hEvtCounterSameE", "Number of analyzed Same Events", HistType::kTH1F, {{1, 0.5, 1.5}}); - histos.add("QAevent/hVertexZSameE", "Collision Vertex Z position", HistType::kTH1F, {{100, -15., 15.}}); - histos.add("QAevent/hMultiplicityPercentSameE", "Multiplicity percentile of collision", HistType::kTH1F, {{120, 0.0f, 120.0f}}); - histos.add("TestME/hCollisionIndexSameE", "coll index sameE", HistType::kTH1F, {{500, 0.0f, 500.0f}}); - histos.add("TestME/hnTrksSameE", "n tracks per event SameE", HistType::kTH1F, {{1000, 0.0f, 1000.0f}}); + histos.add("QAevent/hPairsCounterSameE", "total valid no. of pairs sameE", HistType::kTH1F, {{1, 0.5f, 1.5f}}); + histos.add("QAevent/hnTrksSameE", "n tracks per event SameE", HistType::kTH1F, {{1000, 0.0, 1000.0}}); } // Test on Mixed event if (doprocessME) { @@ -266,12 +280,10 @@ struct Lstaranalysis { histos.add("QAevent/hMixPool_Multiplicity", "Mixed Event Pool: Multiplicity;Multiplicity;Counts", HistType::kTH1F, {axisMultMix}); histos.add("QAevent/hMixPool_VtxZ_vs_Multiplicity", "Mixed Event Pool: Vertex Z vs Multiplicity;Counts", HistType::kTH2F, {axisVtxMix, axisMultMix}); - histos.add("TestME/hPairsCounterMixedE", "tot n pairs mixedE", HistType::kTH1F, {{1, 0.5f, 1.5f}}); - histos.add("QAevent/hEvtCounterMixedE", "Number of analyzed Mixed Events", HistType::kTH1F, {{1, 0.5, 1.5}}); - histos.add("QAevent/hVertexZMixedE", "Collision Vertex Z position", HistType::kTH1F, {{100, -15., 15.}}); + histos.add("QAevent/hPairsCounterMixedE", "total valid no. of pairs mixedE", HistType::kTH1F, {{1, 0.5f, 1.5f}}); + histos.add("QAevent/hVertexZMixedE", "Collision Vertex Z position", HistType::kTH1F, {{100, -15.0f, 15.0f}}); histos.add("QAevent/hMultiplicityPercentMixedE", "Multiplicity percentile of collision", HistType::kTH1F, {{120, 0.0f, 120.0f}}); - histos.add("TestME/hCollisionIndexMixedE", "coll index mixedE", HistType::kTH1F, {{500, 0.0f, 500.0f}}); - histos.add("TestME/hnTrksMixedE", "n tracks per event MixedE", HistType::kTH1F, {{1000, 0.0f, 1000.0f}}); + histos.add("QAevent/hnTrksMixedE", "n tracks per event MixedE", HistType::kTH1F, {{1000, 0.0f, 1000.0f}}); } } @@ -310,7 +322,7 @@ struct Lstaranalysis { histos.add("QA/QAafter/Kaon/pT", "pT distribution of Kaons; #it{p}_{T} (GeV/#it{c}); Counts;", {HistType::kTH1F, {axisPt}}); histos.add("QA/QAafter/Kaon/eta", "#eta distribution of Kaons; #eta; Counts;", {HistType::kTH1F, {axisEta}}); histos.add("QA/QAafter/Kaon/TPC_Signal_ka_all", "TPC Signal for Kaon;#it{p} (GeV/#it{c});TPC Signal (A.U.)", {HistType::kTH2F, {axisPt, axisTPCSignal}}); - histos.add("QA/QAafter/Kaon/TPCnclusterPhika", "TPC ncluster vs phi", kTHnSparseF, {{160, 0, 160, "TPC nCluster"}, {63, 0, 6.28, "#phi"}}); + histos.add("QA/QAafter/Kaon/TPCnclusterPhika", "TPC ncluster vs phi", kTHnSparseF, {{160, 0, 160, "TPC nCluster"}, {63, 0.0f, 6.28f, "#phi"}}); // --- Proton histos.add("QA/QAafter/Proton/TOF_TPC_Map_pr_all", "TOF + TPC Combined PID for Proton;{#sigma_{TOF}^{Proton}};{#sigma_{TPC}^{Proton}}", {HistType::kTH2F, {axisPIDQA, axisPIDQA}}); @@ -323,10 +335,10 @@ struct Lstaranalysis { histos.add("QA/QAafter/Proton/pT", "pT distribution of Protons; #it{p}_{T} (GeV/#it{c}); Counts;", {HistType::kTH1F, {axisPt}}); histos.add("QA/QAafter/Proton/eta", "#eta distribution of Protons; #eta; Counts;", {HistType::kTH1F, {axisEta}}); histos.add("QA/QAafter/Proton/TPC_Signal_pr_all", "TPC Signal for Proton;#it{p} (GeV/#it{c});TPC Signal (A.U.)", {HistType::kTH2F, {axisPt, axisTPCSignal}}); - histos.add("QA/QAafter/Proton/TPCnclusterPhipr", "TPC ncluster vs phi", kTHnSparseF, {{160, 0, 160, "TPC nCluster"}, {63, 0, 6.28, "#phi"}}); + histos.add("QA/QAafter/Proton/TPCnclusterPhipr", "TPC ncluster vs phi", kTHnSparseF, {{160, 0, 160, "TPC nCluster"}, {63, 0.0f, 6.28f, "#phi"}}); // Mass QA 1D for quick check - if (cFillinvmass1DPlots) { + if (cFill1DQAs) { histos.add("Result/Data/lambda1520invmass", "Invariant mass of #Lambda(1520) K^{#pm}p^{#mp}; Invariant Mass (GeV/#it{c}^2); Counts;", {HistType::kTH1F, {axisMassLambda1520}}); histos.add("Result/Data/antilambda1520invmass", "Invariant mass of #Lambda(1520) K^{#mp}p^{#pm}; Invariant Mass (GeV/#it{c}^2); Counts;", {HistType::kTH1F, {axisMassLambda1520}}); histos.add("Result/Data/lambda1520invmassLSPP", "Invariant mass of #Lambda(1520) Like Sign Method K^{#plus}p^{#plus}; Invariant Mass (GeV/#it{c}^2); Counts;", {HistType::kTH1F, {axisMassLambda1520}}); // K+ + Pr @@ -340,33 +352,41 @@ struct Lstaranalysis { histos.add("QAafter/deltaEta", "deltaEta of kaon and proton candidates", HistType::kTH1F, {axisEtaPhi}); histos.add("QAafter/deltaPhi", "deltaPhi of kaon and proton candidates", HistType::kTH1F, {axisEtaPhi}); - histos.add("QAafter/deltaEtaafter", "deltaEta of kaon and proton candidates", HistType::kTH1F, {axisEtaPhi}); - histos.add("QAafter/deltaPhiafter", "deltaPhi of kaon and proton candidates", HistType::kTH1F, {axisEtaPhi}); - histos.add("QAafter/EtaPrafter", "Eta of proton candidates", HistType::kTH1F, {axisEta}); histos.add("QAafter/PhiPrafter", "Phi of proton candidates", HistType::kTH1F, {axisPhi}); - histos.add("QAafter/EtaKaafter", "Eta of kaon candidates", HistType::kTH1F, {axisEta}); histos.add("QAafter/PhiKaafter", "Phi of kaon candidates", HistType::kTH1F, {axisPhi}); } - if (isCalcRotBkg) { - histos.add("Result/Data/h3lambda1520InvMassRotation", "Invariant mass of #Lambda(1520) rotation", kTHnSparseF, {axisMult, axisPt, axisMassLambda1520}); - } - // 3d histogram histos.add("Result/Data/h3lambda1520invmass", "Invariant mass of #Lambda(1520) K^{#pm}p^{#mp}", HistType::kTHnSparseF, {axisMult, axisPt, axisMassLambda1520}); histos.add("Result/Data/h3antilambda1520invmass", "Invariant mass of #Lambda(1520) K^{#mp}p^{#pm}", HistType::kTHnSparseF, {axisMult, axisPt, axisMassLambda1520}); histos.add("Result/Data/h3lambda1520invmassLSPP", "Invariant mass of #Lambda(1520) Like Sign Method K^{#plus}p^{#plus}", HistType::kTHnSparseF, {axisMult, axisPt, axisMassLambda1520}); // K+ + Pr histos.add("Result/Data/h3lambda1520invmassLSMM", "Invariant mass of #Lambda(1520) Like Sign Method K^{#minus}p^{#minus}", HistType::kTHnSparseF, {axisMult, axisPt, axisMassLambda1520}); // K- + anti-Pr } + + if (doprocessRotational) { + if (cFill1DQAs) { + histos.add("Result/Data/lambda1520InvMassRotation", "Invariant mass of #Lambda(1520) Like Sign Method K^{#plus}p^{#plus}; Invariant Mass (GeV/#it{c}^2); Counts;", {HistType::kTH1F, {axisMassLambda1520}}); // K+ + Pr + histos.add("Result/Data/antilambda1520InvMassRotation", "Invariant mass of #Lambda(1520) Like Sign Method K^{#minus}p^{#minus}; Invariant Mass (GeV/#it{c}^2); Counts;", {HistType::kTH1F, {axisMassLambda1520}}); // K- + anti-Pr + } + histos.add("Result/Data/h3lambda1520InvMassRotation", "Invariant mass of #Lambda(1520) rotation", kTHnSparseF, {axisMult, axisPt, axisMassLambda1520}); + histos.add("Result/Data/h3antilambda1520InvMassRotation", "Invariant mass of #Lambda(1520) rotation", kTHnSparseF, {axisMult, axisPt, axisMassLambda1520}); + } + // Mixed event histograms if (doprocessME) { - if (cFillinvmass1DPlots) { - histos.add("Result/Data/lambda1520invmassME", "Invariant mass of #Lambda(1520) mixed event K^{#pm}p^{#mp}; Invariant Mass (GeV/#it{c}^2); Counts;", {HistType::kTH1F, {axisMassLambda1520}}); + if (cFill1DQAs) { + histos.add("Result/Data/lambda1520invmassME_UnlikeSign", "Invariant mass of #Lambda(1520) mixed event K^{#pm}p^{#mp}; Invariant Mass (GeV/#it{c}^2); Counts;", {HistType::kTH1F, {axisMassLambda1520}}); + histos.add("Result/Data/antilambda1520invmassME_UnlikeSign", "Invariant mass of #Lambda(1520) mixed event K^{#pm}p^{#mp}; Invariant Mass (GeV/#it{c}^2); Counts;", {HistType::kTH1F, {axisMassLambda1520}}); } - histos.add("Result/Data/h3lambda1520invmassME", "Invariant mass of #Lambda(1520) mixed event K^{#pm}p^{#mp}", HistType::kTHnSparseF, {axisMult, axisPt, axisMassLambda1520}); + histos.add("Result/Data/h3lambda1520invmassME_UnlikeSign", "Invariant mass of #Lambda(1520) mixed event K^{#pm}p^{#mp}", HistType::kTHnSparseF, {axisMult, axisPt, axisMassLambda1520}); + histos.add("Result/Data/h3antilambda1520invmassME_UnlikeSign", "Invariant mass of #Lambda(1520) mixed event K^{#pm}p^{#mp}", HistType::kTHnSparseF, {axisMult, axisPt, axisMassLambda1520}); if (cFilladditionalMEPlots) { - histos.add("Result/Data/h3lambda1520invmassME_DS", "Invariant mass of #Lambda(1520) mixed event DS", kTHnSparseF, {axisMult, axisPt, axisMassLambda1520}); - histos.add("Result/Data/h3lambda1520invmassME_DSAnti", "Invariant mass of #Lambda(1520) mixed event DSAnti", kTHnSparseF, {axisMult, axisPt, axisMassLambda1520}); + if (cFill1DQAs) { + histos.add("Result/Data/lambda1520invmassME_LSPP", "Invariant mass of #Lambda(1520) Like Sign Method K^{#plus}p^{#plus}; Invariant Mass (GeV/#it{c}^2); Counts;", {HistType::kTH1F, {axisMassLambda1520}}); // K+ + Pr + histos.add("Result/Data/lambda1520invmassME_LSMM", "Invariant mass of #Lambda(1520) Like Sign Method K^{#minus}p^{#minus}; Invariant Mass (GeV/#it{c}^2); Counts;", {HistType::kTH1F, {axisMassLambda1520}}); // K- + anti-Pr + } + histos.add("Result/Data/h3lambda1520invmassME_LSPP", "Invariant mass of #Lambda(1520) mixed event Like Sign Method K^{#plus}p^{#plus}", HistType::kTHnSparseF, {axisMult, axisPt, axisMassLambda1520}); // K+ + Pr + histos.add("Result/Data/h3lambda1520invmassME_LSMM", "Invariant mass of #Lambda(1520) mixed event Like Sign Method K^{#minus}p^{#minus}", HistType::kTHnSparseF, {axisMult, axisPt, axisMassLambda1520}); // K- + anti-Pr } } @@ -401,49 +421,37 @@ struct Lstaranalysis { } // Print output histograms statistics - LOG(info) << "Size of the histograms in LstarAnalysis:"; + LOG(info) << "Size of the histograms in Lambda1520analysisinpp:"; histos.print(); } float massKa = MassKaonCharged; float massPr = MassProton; - int kLambda1520PDG = static_cast(102134); // PDG code for Lambda(1520) - - template - float getCentrality(CollisionType const& collision) - { - if (cfgCentEst == static_cast(1)) { - return collision.multFT0C(); - } else if (cfgCentEst == static_cast(2)) { - return collision.multFT0M(); - } else { - return -999; - } - } - // Centralicity estimator selection - template - float centEst(ResoColl ResoEvents) + template + float centEst(Coll collisions) { - float returnValue = -999.0; - switch (multEstimator) { + float returnValue = -999.0f; + switch (centEstimator) { case 0: - returnValue = ResoEvents.centFT0M(); + returnValue = collisions.centFT0M(); break; case 1: - returnValue = ResoEvents.centFT0A(); + returnValue = collisions.centFT0A(); break; case 2: - returnValue = ResoEvents.centFT0C(); + returnValue = collisions.centFT0C(); break; default: - returnValue = ResoEvents.centFT0M(); + returnValue = collisions.centFT0M(); break; } return returnValue; } + auto static constexpr TripleCharge = 3.0f; + // Check if the collision is INEL>0 template bool isTrueINEL0(MCColl const& /*mccoll*/, MCPart const& mcparts) @@ -453,8 +461,8 @@ struct Lstaranalysis { continue; auto p = pdg->GetParticle(mcparticle.pdgCode()); if (p != nullptr) { - if (std::abs(p->Charge()) >= 3) { - if (std::abs(mcparticle.eta()) < 1) + if (std::abs(p->Charge()) >= TripleCharge) { // check if the particle is charged + if (std::abs(mcparticle.eta()) < 1.0f) return true; } } @@ -466,34 +474,34 @@ struct Lstaranalysis { bool trackCut(const TrackType track) { // basic track cuts - if (std::abs(track.pt()) < cMinPtcut) + if (std::abs(track.pt()) < configTracks.cMinPtcut) return false; - if (cDCAr7SigCut) { - if (std::abs(track.dcaXY()) > (0.004f + 0.0130f / (track.pt()))) // 7 - Sigma cut + if (configTracks.cDCAr7SigCut) { + if (std::abs(track.dcaXY()) > (0.004f + 0.013f / (track.pt()))) // 7 - Sigma cut return false; } else { - if (std::abs(track.dcaXY()) > cMaxDCArToPVcut) + if (std::abs(track.dcaXY()) > configTracks.cMaxDCArToPVcut) return false; } - if (std::abs(track.dcaZ()) > cMaxDCAzToPVcut) + if (std::abs(track.dcaZ()) > configTracks.cMaxDCAzToPVcut) return false; - if (cTPCNClsFound && (track.tpcNClsFound() < cMinTPCNClsFound)) + if (configTracks.cTPCNClsFound && (track.tpcNClsFound() < configTracks.cMinTPCNClsFound)) return false; - if (track.tpcNClsCrossedRows() < cfgMinCrossedRows) + if (track.tpcNClsCrossedRows() < configTracks.cfgMinCrossedRows) return false; - if (cfgHasTOF && !track.hasTOF()) + if (configTracks.cfgHasTOF && !track.hasTOF()) return false; - if (cfgPrimaryTrack && !track.isPrimaryTrack()) + if (configTracks.cfgPrimaryTrack && !track.isPrimaryTrack()) return false; - if (cfgGlobalWoDCATrack && !track.isGlobalTrackWoDCA()) + if (configTracks.cfgGlobalWoDCATrack && !track.isGlobalTrackWoDCA()) return false; - if (cfgPVContributor && !track.isPVContributor()) + if (configTracks.cfgPVContributor && !track.isPVContributor()) return false; - if (cfgGlobalTrack && !track.isGlobalTrack()) + if (configTracks.cfgGlobalTrack && !track.isGlobalTrack()) return false; - if (cfgUseITSRefit && !track.passedITSRefit()) + if (configTracks.cfgUseITSRefit && !track.passedITSRefit()) return false; - if (cfgUseTPCRefit && !track.passedTPCRefit()) + if (configTracks.cfgUseTPCRefit && !track.passedTPCRefit()) return false; return true; @@ -503,32 +511,34 @@ struct Lstaranalysis { // candidate.tpcNSigmaPr(), candidate.tofNSigmaPr(), tpcPIDPassed, tofPIDPassed, tpcPIDPassed || tofPIDPassed); template - bool pTdependentPIDProton(const T& candidate) + bool ptDependentPidProton(const T& candidate) { - auto vProtonTPCPIDpTintv = static_cast>(protonTPCPIDpTintv); - vProtonTPCPIDpTintv.insert(vProtonTPCPIDpTintv.begin(), cMinPtcut); - auto vProtonTPCPIDcuts = static_cast>(protonTPCPIDcuts); - auto vProtonTOFPIDpTintv = static_cast>(protonTOFPIDpTintv); - auto vProtonTPCTOFCombinedpTintv = static_cast>(protonTPCTOFCombinedpTintv); - auto vProtonTPCTOFCombinedPIDcuts = static_cast>(protonTPCTOFCombinedPIDcuts); - auto vProtonTOFPIDcuts = static_cast>(protonTOFPIDcuts); + auto vProtonTPCPIDpTintv = configPID.protonTPCPIDpTintv.value; + vProtonTPCPIDpTintv.insert(vProtonTPCPIDpTintv.begin(), configTracks.cMinPtcut); + auto vProtonTPCPIDcuts = configPID.protonTPCPIDcuts.value; + auto vProtonTOFPIDpTintv = configPID.protonTOFPIDpTintv.value; + auto vProtonTPCTOFCombinedpTintv = configPID.protonTPCTOFCombinedpTintv.value; + auto vProtonTPCTOFCombinedPIDcuts = configPID.protonTPCTOFCombinedPIDcuts.value; + auto vProtonTOFPIDcuts = configPID.protonTOFPIDcuts.value; float pt = candidate.pt(); float ptSwitchToTOF = vProtonTPCPIDpTintv.back(); + float tpcNsigmaPr = candidate.tpcNSigmaPr(); + float tofNsigmaPr = candidate.tofNSigmaPr(); bool tpcPIDPassed = false; // TPC PID (interval check) for (size_t i = 0; i < vProtonTPCPIDpTintv.size() - 1; ++i) { if (pt > vProtonTPCPIDpTintv[i] && pt < vProtonTPCPIDpTintv[i + 1]) { - if (std::abs(candidate.tpcNSigmaPr()) < vProtonTPCPIDcuts[i]) + if (std::abs(tpcNsigmaPr) < vProtonTPCPIDcuts[i]) tpcPIDPassed = true; } } // TOF bypass option (for QA or MC) - if (cByPassTOF) { - return std::abs(candidate.tpcNSigmaPr()) < vProtonTPCPIDcuts.back(); + if (configPID.cByPassTOF) { + return std::abs(tpcNsigmaPr) < vProtonTPCPIDcuts.back(); } // Case 1: No TOF and pt ≤ threshold → accept only via TPC PID @@ -543,22 +553,22 @@ struct Lstaranalysis { // Case 3: Has TOF → use TPC + TOF (square or circular) if (candidate.hasTOF()) { - if (cPIDcutType == 1) { + if (configPID.cPIDcutType == SquareType) { // Rectangular cut for (size_t i = 0; i < vProtonTOFPIDpTintv.size(); ++i) { if (pt < vProtonTOFPIDpTintv[i]) { - if (std::abs(candidate.tofNSigmaPr()) < vProtonTOFPIDcuts[i] && - std::abs(candidate.tpcNSigmaPr()) < vProtonTPCPIDcuts.back()) + if (std::abs(tofNsigmaPr) < vProtonTOFPIDcuts[i] && + std::abs(tpcNsigmaPr) < vProtonTPCPIDcuts.back()) return true; } } - } else if (cPIDcutType == 2) { + } else if (configPID.cPIDcutType == CircularType) { // Circular cut for (size_t i = 0; i < vProtonTPCTOFCombinedpTintv.size(); ++i) { if (pt < vProtonTPCTOFCombinedpTintv[i]) { float combinedSigma2 = - candidate.tpcNSigmaPr() * candidate.tpcNSigmaPr() + - candidate.tofNSigmaPr() * candidate.tofNSigmaPr(); + tpcNsigmaPr * tpcNsigmaPr + + tofNsigmaPr * tofNsigmaPr; if (combinedSigma2 < vProtonTPCTOFCombinedPIDcuts[i] * vProtonTPCTOFCombinedPIDcuts[i]) return true; } @@ -570,25 +580,27 @@ struct Lstaranalysis { } template - bool pTdependentPIDKaon(const T& candidate) + bool ptDependentPidKaon(const T& candidate) { - auto vKaonTPCPIDpTintv = static_cast>(kaonTPCPIDpTintv); - vKaonTPCPIDpTintv.insert(vKaonTPCPIDpTintv.begin(), cMinPtcut); - auto vKaonTPCPIDcuts = static_cast>(kaonTPCPIDcuts); - auto vKaonTOFPIDpTintv = static_cast>(kaonTOFPIDpTintv); - auto vKaonTPCTOFCombinedpTintv = static_cast>(kaonTPCTOFCombinedpTintv); - auto vKaonTPCTOFCombinedPIDcuts = static_cast>(kaonTPCTOFCombinedPIDcuts); - auto vKaonTOFPIDcuts = static_cast>(kaonTOFPIDcuts); + auto vKaonTPCPIDpTintv = configPID.kaonTPCPIDpTintv.value; + vKaonTPCPIDpTintv.insert(vKaonTPCPIDpTintv.begin(), configTracks.cMinPtcut); + auto vKaonTPCPIDcuts = configPID.kaonTPCPIDcuts.value; + auto vKaonTOFPIDpTintv = configPID.kaonTOFPIDpTintv.value; + auto vKaonTPCTOFCombinedpTintv = configPID.kaonTPCTOFCombinedpTintv.value; + auto vKaonTPCTOFCombinedPIDcuts = configPID.kaonTPCTOFCombinedPIDcuts.value; + auto vKaonTOFPIDcuts = configPID.kaonTOFPIDcuts.value; float pt = candidate.pt(); float ptSwitchToTOF = vKaonTPCPIDpTintv.back(); + float tpcNsigmaKa = candidate.tpcNSigmaKa(); + float tofNsigmaKa = candidate.tofNSigmaKa(); bool tpcPIDPassed = false; // TPC PID interval-based check for (size_t i = 0; i < vKaonTPCPIDpTintv.size() - 1; ++i) { if (pt > vKaonTPCPIDpTintv[i] && pt < vKaonTPCPIDpTintv[i + 1]) { - if (std::abs(candidate.tpcNSigmaKa()) < vKaonTPCPIDcuts[i]) { + if (std::abs(tpcNsigmaKa) < vKaonTPCPIDcuts[i]) { tpcPIDPassed = true; break; } @@ -596,8 +608,8 @@ struct Lstaranalysis { } // TOF bypass option - if (cByPassTOF) { - return std::abs(candidate.tpcNSigmaKa()) < vKaonTPCPIDcuts.back(); + if (configPID.cByPassTOF) { + return std::abs(tpcNsigmaKa) < vKaonTPCPIDcuts.back(); } // Case 1: No TOF and pt ≤ ptSwitch → use TPC-only @@ -612,22 +624,22 @@ struct Lstaranalysis { // Case 3: TOF is available → apply TPC+TOF PID logic if (candidate.hasTOF()) { - if (cPIDcutType == 1) { + if (configPID.cPIDcutType == SquareType) { // Rectangular cut for (size_t i = 0; i < vKaonTOFPIDpTintv.size(); ++i) { if (pt < vKaonTOFPIDpTintv[i]) { - if (std::abs(candidate.tofNSigmaKa()) < vKaonTOFPIDcuts[i] && - std::abs(candidate.tpcNSigmaKa()) < vKaonTPCPIDcuts.back()) { + if (std::abs(tofNsigmaKa) < vKaonTOFPIDcuts[i] && + std::abs(tpcNsigmaKa) < vKaonTPCPIDcuts.back()) { return true; } } } - } else if (cPIDcutType == 2) { + } else if (configPID.cPIDcutType == CircularType) { // Circular cut for (size_t i = 0; i < vKaonTPCTOFCombinedpTintv.size(); ++i) { if (pt < vKaonTPCTOFCombinedpTintv[i]) { - float combinedSigma2 = candidate.tpcNSigmaKa() * candidate.tpcNSigmaKa() + - candidate.tofNSigmaKa() * candidate.tofNSigmaKa(); + float combinedSigma2 = tpcNsigmaKa * tpcNsigmaKa + + tofNsigmaKa * tofNsigmaKa; if (combinedSigma2 < vKaonTPCTOFCombinedPIDcuts[i] * vKaonTPCTOFCombinedPIDcuts[i]) { return true; } @@ -639,92 +651,100 @@ struct Lstaranalysis { return false; } + auto static constexpr MinPtforPionRejection = 1.0f; + auto static constexpr MaxPtforPionRejection = 2.0f; + auto static constexpr MaxnSigmaforPionRejection = 2.0f; + template bool rejectPion(const T& candidate) { - if (candidate.pt() > static_cast(1.0) && candidate.pt() < static_cast(2.0) && !candidate.hasTOF() && candidate.tpcNSigmaPi() < static_cast(2)) { + if (candidate.pt() > MinPtforPionRejection && candidate.pt() < MaxPtforPionRejection && !candidate.hasTOF() && candidate.tpcNSigmaPi() < MaxnSigmaforPionRejection) { return false; } return true; } - template + auto static constexpr MaxNoLambda1520Daughters = 2; + + template void fillHistograms(const CollisionType& collision, const TracksType& dTracks1, const TracksType& dTracks2) { - auto multiplicity = collision.centFT0M(); + auto centrality = centEst(collision); // Multiplicity correlation calibration plots if (cFillMultQA) { if constexpr (IsData) { - histos.fill(HIST("MultCalib/centGloPVpr"), multiplicity, dTracks1.size(), collision.multNTracksPV()); - histos.fill(HIST("MultCalib/centGloPVka"), multiplicity, dTracks2.size(), collision.multNTracksPV()); + histos.fill(HIST("MultCalib/centGloPVpr"), centrality, dTracks1.size(), collision.multNTracksPV()); + histos.fill(HIST("MultCalib/centGloPVka"), centrality, dTracks2.size(), collision.multNTracksPV()); } } if (cFilladditionalQAeventPlots) { - if constexpr (!IsMix) { - histos.fill(HIST("QAevent/hVertexZSameE"), collision.posZ()); - histos.fill(HIST("QAevent/hMultiplicityPercentSameE"), multiplicity); - histos.fill(HIST("TestME/hCollisionIndexSameE"), collision.globalIndex()); - histos.fill(HIST("TestME/hnTrksSameE"), dTracks1.size()); - } else { + if constexpr (IsData) { + histos.fill(HIST("QAevent/hnTrksSameE"), dTracks1.size()); + } else if constexpr (IsMix) { histos.fill(HIST("QAevent/hVertexZMixedE"), collision.posZ()); - histos.fill(HIST("QAevent/hMultiplicityPercentMixedE"), multiplicity); - histos.fill(HIST("TestME/hCollisionIndexMixedE"), collision.globalIndex()); - histos.fill(HIST("TestME/hnTrksMixedE"), dTracks1.size()); + histos.fill(HIST("QAevent/hMultiplicityPercentMixedE"), centrality); + histos.fill(HIST("QAevent/hnTrksMixedE"), dTracks1.size()); } } // LOG(info) << "After pass, Collision index:" << collision.index() << "multiplicity: " << collision.centFT0M() << endl; - LorentzVectorPtEtaPhiMass lDecayDaughter1, lDecayDaughter2, lResonance, ldaughterRot, lresonanceRot; + LorentzVectorPtEtaPhiMass lDecayDaughter1, lDecayDaughter2, lResonance, ldaughterRot, lResonanceRot; for (const auto& [trk1, trk2] : combinations(CombinationsFullIndexPolicy(dTracks1, dTracks2))) { // Full index policy is needed to consider all possible combinations if (trk1.index() == trk2.index()) continue; // We need to run (0,1), (1,0) pairs as well. but same id pairs are not needed. - if (cFilladditionalQAeventPlots) { - if constexpr (IsData) { - histos.fill(HIST("TestME/hPairsCounterSameE"), 1.0); - } else if (IsMix) { - histos.fill(HIST("TestME/hPairsCounterMixedE"), 1.0); - } - } - // apply the track cut if (!trackCut(trk1) || !trackCut(trk2)) continue; //// Initialize variables - // Trk1: Proton, Trk2: Kaon + // Trk1: Proton auto isTrk1hasTOF = trk1.hasTOF(); - auto isTrk2hasTOF = trk2.hasTOF(); - auto trk1ptPr = trk1.pt(); + auto trk1etaPr = trk1.eta(); + auto trk1phiPr = trk1.phi(); auto trk1NSigmaPrTPC = trk1.tpcNSigmaPr(); - auto trk1NSigmaPrTOF = (isTrk1hasTOF) ? trk1.tofNSigmaPr() : -999.; + auto trk1NSigmaPrTOF = (isTrk1hasTOF) ? trk1.tofNSigmaPr() : -999.0f; + + // Trk2: Kaon + auto isTrk2hasTOF = trk2.hasTOF(); auto trk2ptKa = trk2.pt(); + auto trk2etaKa = trk2.eta(); + auto trk2phiKa = trk2.phi(); auto trk2NSigmaKaTPC = trk2.tpcNSigmaKa(); - auto trk2NSigmaKaTOF = (isTrk2hasTOF) ? trk2.tofNSigmaKa() : -999.; + auto trk2NSigmaKaTOF = (isTrk2hasTOF) ? trk2.tofNSigmaKa() : -999.0f; - auto deltaEta = std::abs(trk1.eta() - trk2.eta()); - auto deltaPhi = std::abs(trk1.phi() - trk2.phi()); - deltaPhi = (deltaPhi > constants::math::PI) ? (constants::math::TwoPI - deltaPhi) : deltaPhi; + auto deltaEta = 0.0f; + auto deltaPhi = 0.0f; + + if (cfgUseDeltaEtaPhiCuts) { + deltaEta = std::abs(trk1etaPr - trk2etaKa); + deltaPhi = std::abs(trk1phiPr - trk2phiKa); + deltaPhi = (deltaPhi > o2::constants::math::PI) ? (o2::constants::math::TwoPI - deltaPhi) : deltaPhi; + if (deltaEta >= cMaxDeltaEtaCut) + continue; + if (deltaPhi >= cMaxDeltaPhiCut) + continue; + } //// QA plots before the selection // --- Track QA all if constexpr (IsData) { - histos.fill(HIST("QA/QAbefore/Track/TPC_Nsigma_pr_all"), multiplicity, trk1ptPr, trk1NSigmaPrTPC); + histos.fill(HIST("QA/QAbefore/Track/TPC_Nsigma_pr_all"), centrality, trk1ptPr, trk1NSigmaPrTPC); if (isTrk1hasTOF) { - histos.fill(HIST("QA/QAbefore/Track/TOF_Nsigma_pr_all"), multiplicity, trk1ptPr, trk1NSigmaPrTOF); + histos.fill(HIST("QA/QAbefore/Track/TOF_Nsigma_pr_all"), centrality, trk1ptPr, trk1NSigmaPrTOF); histos.fill(HIST("QA/QAbefore/Track/TOF_TPC_Map_pr_all"), trk1NSigmaPrTOF, trk1NSigmaPrTPC); } if (!isTrk1hasTOF) { histos.fill(HIST("QA/QAbefore/Track/TPConly_Nsigma_pr"), trk1ptPr, trk1NSigmaPrTPC); } - histos.fill(HIST("QA/QAbefore/Track/TPC_Nsigma_ka_all"), multiplicity, trk2ptKa, trk2NSigmaKaTPC); + histos.fill(HIST("QA/QAbefore/Track/TPC_Nsigma_ka_all"), centrality, trk2ptKa, trk2NSigmaKaTPC); if (isTrk2hasTOF) { - histos.fill(HIST("QA/QAbefore/Track/TOF_Nsigma_ka_all"), multiplicity, trk2ptKa, trk2NSigmaKaTOF); + histos.fill(HIST("QA/QAbefore/Track/TOF_Nsigma_ka_all"), centrality, trk2ptKa, trk2NSigmaKaTOF); histos.fill(HIST("QA/QAbefore/Track/TOF_TPC_Map_ka_all"), trk2NSigmaKaTOF, trk2NSigmaKaTPC); } if (!isTrk2hasTOF) { @@ -735,7 +755,7 @@ struct Lstaranalysis { histos.fill(HIST("QA/QAbefore/Track/dcaXY"), trk1ptPr, trk1.dcaXY()); histos.fill(HIST("QA/QAbefore/Track/TPC_CR"), trk1ptPr, trk1.tpcNClsCrossedRows()); histos.fill(HIST("QA/QAbefore/Track/pT"), trk1ptPr); - histos.fill(HIST("QA/QAbefore/Track/eta"), trk1.eta()); + histos.fill(HIST("QA/QAbefore/Track/eta"), trk1etaPr); if (cFilldeltaEtaPhiPlots) { histos.fill(HIST("QAbefore/deltaEta"), deltaEta); histos.fill(HIST("QAbefore/deltaPhi"), deltaPhi); @@ -743,18 +763,18 @@ struct Lstaranalysis { } //// Apply the pid selection - if (crejectPion && rejectPion(trk2)) + if (crejectPion && rejectPion(trk2)) // to remove pion contamination from the kaon track continue; - if (!pTdependentPIDProton(trk1) || !pTdependentPIDKaon(trk2)) + if (!ptDependentPidProton(trk1) || !ptDependentPidKaon(trk2)) continue; //// QA plots after the selection if constexpr (IsData) { // --- PID QA Proton - histos.fill(HIST("QA/QAafter/Proton/TPC_Nsigma_pr_all"), multiplicity, trk1ptPr, trk1NSigmaPrTPC); + histos.fill(HIST("QA/QAafter/Proton/TPC_Nsigma_pr_all"), centrality, trk1ptPr, trk1NSigmaPrTPC); histos.fill(HIST("QA/QAafter/Proton/TPC_Signal_pr_all"), trk1.tpcInnerParam(), trk1.tpcSignal()); if (isTrk1hasTOF) { - histos.fill(HIST("QA/QAafter/Proton/TOF_Nsigma_pr_all"), multiplicity, trk1ptPr, trk1NSigmaPrTOF); + histos.fill(HIST("QA/QAafter/Proton/TOF_Nsigma_pr_all"), centrality, trk1ptPr, trk1NSigmaPrTOF); histos.fill(HIST("QA/QAafter/Proton/TOF_TPC_Map_pr_all"), trk1NSigmaPrTOF, trk1NSigmaPrTPC); } if (!isTrk1hasTOF) { @@ -764,14 +784,14 @@ struct Lstaranalysis { histos.fill(HIST("QA/QAafter/Proton/dcaXY"), trk1ptPr, trk1.dcaXY()); histos.fill(HIST("QA/QAafter/Proton/TPC_CR"), trk1ptPr, trk1.tpcNClsCrossedRows()); histos.fill(HIST("QA/QAafter/Proton/pT"), trk1ptPr); - histos.fill(HIST("QA/QAafter/Proton/eta"), trk1.eta()); - histos.fill(HIST("QA/QAafter/Proton/TPCnclusterPhipr"), trk1.tpcNClsFound(), trk1.phi()); + histos.fill(HIST("QA/QAafter/Proton/eta"), trk1etaPr); + histos.fill(HIST("QA/QAafter/Proton/TPCnclusterPhipr"), trk1.tpcNClsFound(), trk1phiPr); // --- PID QA Kaon - histos.fill(HIST("QA/QAafter/Kaon/TPC_Nsigma_ka_all"), multiplicity, trk2ptKa, trk2NSigmaKaTPC); + histos.fill(HIST("QA/QAafter/Kaon/TPC_Nsigma_ka_all"), centrality, trk2ptKa, trk2NSigmaKaTPC); histos.fill(HIST("QA/QAafter/Kaon/TPC_Signal_ka_all"), trk2.tpcInnerParam(), trk2.tpcSignal()); if (isTrk2hasTOF) { - histos.fill(HIST("QA/QAafter/Kaon/TOF_Nsigma_ka_all"), multiplicity, trk2ptKa, trk2NSigmaKaTOF); + histos.fill(HIST("QA/QAafter/Kaon/TOF_Nsigma_ka_all"), centrality, trk2ptKa, trk2NSigmaKaTOF); histos.fill(HIST("QA/QAafter/Kaon/TOF_TPC_Map_ka_all"), trk2NSigmaKaTOF, trk2NSigmaKaTPC); } if (!isTrk2hasTOF) { @@ -781,98 +801,124 @@ struct Lstaranalysis { histos.fill(HIST("QA/QAafter/Kaon/dcaXY"), trk2ptKa, trk2.dcaXY()); histos.fill(HIST("QA/QAafter/Kaon/TPC_CR"), trk2ptKa, trk2.tpcNClsCrossedRows()); histos.fill(HIST("QA/QAafter/Kaon/pT"), trk2ptKa); - histos.fill(HIST("QA/QAafter/Kaon/eta"), trk2.eta()); - histos.fill(HIST("QA/QAafter/Kaon/TPCnclusterPhika"), trk2.tpcNClsFound(), trk2.phi()); + histos.fill(HIST("QA/QAafter/Kaon/eta"), trk2etaKa); + histos.fill(HIST("QA/QAafter/Kaon/TPCnclusterPhika"), trk2.tpcNClsFound(), trk2phiKa); if (cFilldeltaEtaPhiPlots) { + histos.fill(HIST("QAafter/PhiPrafter"), trk1phiPr); + histos.fill(HIST("QAafter/PhiKaafter"), trk2phiKa); histos.fill(HIST("QAafter/deltaEta"), deltaEta); histos.fill(HIST("QAafter/deltaPhi"), deltaPhi); } } + //// Resonance reconstruction + lDecayDaughter1 = LorentzVectorPtEtaPhiMass(trk1ptPr, trk1etaPr, trk1phiPr, massPr); + lDecayDaughter2 = LorentzVectorPtEtaPhiMass(trk2ptKa, trk2etaKa, trk2phiKa, massKa); + // Apply kinematic opening angle cut - if (cApplyOpeningAngle) { - TVector3 v1(trk1.px(), trk1.py(), trk1.pz()); - TVector3 v2(trk2.px(), trk2.py(), trk2.pz()); - float alpha = v1.Angle(v2); + if (cUseOpeningAngleCut) { + auto v1 = lDecayDaughter1.Vect(); + auto v2 = lDecayDaughter2.Vect(); + float alpha = std::acos(v1.Dot(v2) / (v1.R() * v2.R())); if (alpha > cMinOpeningAngle && alpha < cMaxOpeningAngle) continue; } - //// Resonance reconstruction - lDecayDaughter1 = LorentzVectorPtEtaPhiMass(trk1.pt(), trk1.eta(), trk1.phi(), massPr); - lDecayDaughter2 = LorentzVectorPtEtaPhiMass(trk2.pt(), trk2.eta(), trk2.phi(), massKa); lResonance = lDecayDaughter1 + lDecayDaughter2; + auto resonanceMass = lResonance.M(); + auto resonancePt = lResonance.Pt(); + auto resonanceRapidity = lResonance.Rapidity(); + if constexpr (IsData || IsMix) { // Rapidity cut - if (std::abs(lResonance.Rapidity()) > static_cast(0.5)) + if (std::abs(resonanceRapidity) > configTracks.cfgCutRapidity) continue; } - if (cfgCutsOnMother) { - if (lResonance.Pt() >= cMaxPtMotherCut) // excluding candidates in overflow + if (cfgUseCutsOnMother) { + if (resonancePt >= cMaxPtMotherCut) // excluding candidates in overflow continue; - if (lResonance.M() >= cMaxMinvMotherCut) // excluding candidates in overflow + if (resonanceMass >= cMaxMinvMotherCut) // excluding candidates in overflow continue; } - if (cFilldeltaEtaPhiPlots) { - if (deltaEta >= cMaxDeltaEtaCut) - continue; - if (deltaPhi >= cMaxDeltaPhiCut) - continue; - - if constexpr (!IsMix) { - histos.fill(HIST("QAafter/EtaPrafter"), trk1.eta()); - histos.fill(HIST("QAafter/PhiPrafter"), trk1.phi()); - histos.fill(HIST("QAafter/EtaKaafter"), trk2.eta()); - histos.fill(HIST("QAafter/PhiKaafter"), trk2.phi()); - histos.fill(HIST("QAafter/deltaEtaafter"), deltaEta); - histos.fill(HIST("QAafter/deltaPhiafter"), deltaPhi); + if (cFilladditionalQAeventPlots) { + if constexpr (IsData) { + histos.fill(HIST("QAevent/hPairsCounterSameE"), 1.0f); + } else if (IsMix) { + histos.fill(HIST("QAevent/hPairsCounterMixedE"), 1.0f); } } //// Un-like sign pair only if (trk1.sign() * trk2.sign() < 0) { - if constexpr (IsData) { - if (isCalcRotBkg) { - for (int i = 0; i < cNofRotations; i++) { - float theta2 = rn->Uniform(constants::math::PI - constants::math::PI / rotationalcut, constants::math::PI + constants::math::PI / rotationalcut); - ldaughterRot = LorentzVectorPtEtaPhiMass(trk2.pt(), trk2.eta(), trk2.phi() + theta2, massKa); // for rotated background - lresonanceRot = lDecayDaughter1 + ldaughterRot; - histos.fill(HIST("Result/Data/h3lambda1520InvMassRotation"), multiplicity, lresonanceRot.Pt(), lresonanceRot.M()); + if constexpr (IsRot) { + for (int i = 0; i < configBkg.cNofRotations; i++) { + float theta = rn->Uniform(o2::constants::math::PI - o2::constants::math::PI / configBkg.rotationalcut, o2::constants::math::PI + o2::constants::math::PI / configBkg.rotationalcut); + if (configBkg.cfgRotPr) { + ldaughterRot = LorentzVectorPtEtaPhiMass(trk1ptPr, trk1etaPr, trk1phiPr + theta, massPr); + lResonanceRot = ldaughterRot + lDecayDaughter2; + } else { + ldaughterRot = LorentzVectorPtEtaPhiMass(trk2ptKa, trk2etaKa, trk2phiKa + theta, massKa); + lResonanceRot = lDecayDaughter1 + ldaughterRot; + } + auto resonanceRotMass = lResonanceRot.M(); + auto resonanceRotPt = lResonanceRot.Pt(); + + // Rapidity cut + if (std::abs(lResonanceRot.Rapidity()) >= configTracks.cfgCutRapidity) + continue; + + if (cfgUseCutsOnMother) { + if (resonanceRotPt >= cMaxPtMotherCut) // excluding candidates in overflow + continue; + if (resonanceRotMass >= cMaxMinvMotherCut) // excluding candidates in overflow + continue; + } + if (trk1.sign() < 0) { + if (cFill1DQAs) { + histos.fill(HIST("Result/Data/lambda1520InvMassRotation"), resonanceRotMass); + } + histos.fill(HIST("Result/Data/h3lambda1520InvMassRotation"), centrality, resonanceRotPt, resonanceRotMass); + } else if (trk1.sign() > 0) { + if (cFill1DQAs) { + histos.fill(HIST("Result/Data/antilambda1520InvMassRotation"), resonanceRotMass); + } + histos.fill(HIST("Result/Data/h3antilambda1520InvMassRotation"), centrality, resonanceRotPt, resonanceRotMass); } } - + } + if constexpr (IsData) { if (trk1.sign() < 0) { - if (cFillinvmass1DPlots) { - histos.fill(HIST("Result/Data/lambda1520invmass"), lResonance.M()); + if (cFill1DQAs) { + histos.fill(HIST("Result/Data/lambda1520invmass"), resonanceMass); } - histos.fill(HIST("Result/Data/h3lambda1520invmass"), multiplicity, lResonance.Pt(), lResonance.M()); + histos.fill(HIST("Result/Data/h3lambda1520invmass"), centrality, resonancePt, resonanceMass); } else if (trk1.sign() > 0) { - if (cFillinvmass1DPlots) { - histos.fill(HIST("Result/Data/antilambda1520invmass"), lResonance.M()); + if (cFill1DQAs) { + histos.fill(HIST("Result/Data/antilambda1520invmass"), resonanceMass); } - histos.fill(HIST("Result/Data/h3antilambda1520invmass"), multiplicity, lResonance.Pt(), lResonance.M()); + histos.fill(HIST("Result/Data/h3antilambda1520invmass"), centrality, resonancePt, resonanceMass); } } else if (IsMix) { - if (cFillinvmass1DPlots) { - histos.fill(HIST("Result/Data/lambda1520invmassME"), lResonance.M()); - } - histos.fill(HIST("Result/Data/h3lambda1520invmassME"), multiplicity, lResonance.Pt(), lResonance.M()); - if (cFilladditionalMEPlots) { - if (trk1.sign() < 0) { - histos.fill(HIST("Result/Data/h3lambda1520invmassME_DS"), multiplicity, lResonance.Pt(), lResonance.M()); - } else if (trk1.sign() > 0) { - histos.fill(HIST("Result/Data/h3lambda1520invmassME_DSAnti"), multiplicity, lResonance.Pt(), lResonance.M()); + if (trk1.sign() < 0) { + if (cFill1DQAs) { + histos.fill(HIST("Result/Data/lambda1520invmassME_UnlikeSign"), resonanceMass); } + histos.fill(HIST("Result/Data/h3lambda1520invmassME_UnlikeSign"), centrality, resonancePt, resonanceMass); + } else if (trk1.sign() > 0) { + if (cFill1DQAs) { + histos.fill(HIST("Result/Data/antilambda1520invmassME_UnlikeSign"), resonanceMass); + } + histos.fill(HIST("Result/Data/h3antilambda1520invmassME_UnlikeSign"), centrality, resonancePt, resonanceMass); } } // MC if constexpr (IsMC) { - + // now we do mc true // ------ Temporal lambda function to prevent error in build auto getMothersIndeces = [&](auto const& theMcParticle) { std::vector lMothersIndeces{}; @@ -904,7 +950,7 @@ struct Lstaranalysis { motherstrk1 = getMothersIndeces(mctrk1); mothersPDGtrk1 = getMothersPDGCodes(mctrk1); } - while (motherstrk1.size() > 2) { + while (motherstrk1.size() > MaxNoLambda1520Daughters) { motherstrk1.pop_back(); mothersPDGtrk1.pop_back(); } @@ -914,18 +960,18 @@ struct Lstaranalysis { motherstrk2 = getMothersIndeces(mctrk2); mothersPDGtrk2 = getMothersPDGCodes(mctrk2); } - while (motherstrk2.size() > 2) { + while (motherstrk2.size() > MaxNoLambda1520Daughters) { motherstrk2.pop_back(); mothersPDGtrk2.pop_back(); } - if (std::abs(mctrk1.pdgCode()) != 2212 || std::abs(mctrk2.pdgCode()) != 321) + if (std::abs(mctrk1.pdgCode()) != kProton || std::abs(mctrk2.pdgCode()) != kKPlus) continue; if (motherstrk1[0] != motherstrk2[0]) // Same mother continue; - if (std::abs(mothersPDGtrk1[0]) != 102134) + if (std::abs(mothersPDGtrk1[0]) != Pdg::kLambda1520_Py) continue; // LOGF(info, "mother trk1 id: %d, mother trk1: %d, trk1 id: %d, trk1 pdgcode: %d, mother trk2 id: %d, mother trk2: %d, trk2 id: %d, trk2 pdgcode: %d", motherstrk1[0], mothersPDGtrk1[0], trk1.globalIndex(), mctrk1.pdgCode(), motherstrk2[0], mothersPDGtrk2[0], trk2.globalIndex(), mctrk2.pdgCode()); @@ -933,11 +979,11 @@ struct Lstaranalysis { if (cUseEtacutMC && std::abs(lResonance.Eta()) > cEtacutMC) // eta cut continue; - if (cUseRapcutMC && std::abs(lResonance.Rapidity()) > static_cast(0.5)) // rapidity cut + if (cUseRapcutMC && std::abs(resonanceRapidity) > configTracks.cfgCutRapidity) // rapidity cut continue; - histos.fill(HIST("QA/MC/h2RecoEtaPt_after"), lResonance.Eta(), lResonance.Pt()); - histos.fill(HIST("QA/MC/h2RecoPhiRapidity_after"), lResonance.Phi(), lResonance.Rapidity()); + histos.fill(HIST("QA/MC/h2RecoEtaPt_after"), lResonance.Eta(), resonancePt); + histos.fill(HIST("QA/MC/h2RecoPhiRapidity_after"), lResonance.Phi(), resonanceRapidity); // Track selection check. histos.fill(HIST("QA/MC/trkDCAxy_pr"), trk1ptPr, trk1.dcaXY()); @@ -945,35 +991,50 @@ struct Lstaranalysis { histos.fill(HIST("QA/MC/trkDCAz_pr"), trk1ptPr, trk1.dcaZ()); histos.fill(HIST("QA/MC/trkDCAz_ka"), trk2ptKa, trk2.dcaZ()); - histos.fill(HIST("QA/MC/TPC_Nsigma_pr_all"), multiplicity, trk1ptPr, trk1NSigmaPrTPC); + histos.fill(HIST("QA/MC/TPC_Nsigma_pr_all"), centrality, trk1ptPr, trk1NSigmaPrTPC); if (isTrk1hasTOF) { - histos.fill(HIST("QA/MC/TOF_Nsigma_pr_all"), multiplicity, trk1ptPr, trk1NSigmaPrTOF); + histos.fill(HIST("QA/MC/TOF_Nsigma_pr_all"), centrality, trk1ptPr, trk1NSigmaPrTOF); } - histos.fill(HIST("QA/MC/TPC_Nsigma_ka_all"), multiplicity, trk2ptKa, trk2NSigmaKaTPC); + histos.fill(HIST("QA/MC/TPC_Nsigma_ka_all"), centrality, trk2ptKa, trk2NSigmaKaTPC); if (isTrk2hasTOF) { - histos.fill(HIST("QA/MC/TOF_Nsigma_ka_all"), multiplicity, trk2ptKa, trk2NSigmaKaTOF); + histos.fill(HIST("QA/MC/TOF_Nsigma_ka_all"), centrality, trk2ptKa, trk2NSigmaKaTOF); } // MC histograms if (mothersPDGtrk1[0] > 0) { - histos.fill(HIST("Result/MC/h3lambda1520Recoinvmass"), multiplicity, lResonance.Pt(), lResonance.M()); + histos.fill(HIST("Result/MC/h3lambda1520Recoinvmass"), centrality, resonancePt, resonanceMass); } else { - histos.fill(HIST("Result/MC/h3antilambda1520Recoinvmass"), multiplicity, lResonance.Pt(), lResonance.M()); + histos.fill(HIST("Result/MC/h3antilambda1520Recoinvmass"), centrality, resonancePt, resonanceMass); } } } else { if constexpr (IsData) { // Like sign pair ++ if (trk1.sign() > 0) { - if (cFillinvmass1DPlots) { - histos.fill(HIST("Result/Data/lambda1520invmassLSPP"), lResonance.M()); + if (cFill1DQAs) { + histos.fill(HIST("Result/Data/lambda1520invmassLSPP"), resonanceMass); } - histos.fill(HIST("Result/Data/h3lambda1520invmassLSPP"), multiplicity, lResonance.Pt(), lResonance.M()); + histos.fill(HIST("Result/Data/h3lambda1520invmassLSPP"), centrality, resonancePt, resonanceMass); } else { // Like sign pair -- - if (cFillinvmass1DPlots) { - histos.fill(HIST("Result/Data/lambda1520invmassLSMM"), lResonance.M()); + if (cFill1DQAs) { + histos.fill(HIST("Result/Data/lambda1520invmassLSMM"), resonanceMass); + } + histos.fill(HIST("Result/Data/h3lambda1520invmassLSMM"), centrality, resonancePt, resonanceMass); + } + } else if (IsMix) { + if (cFilladditionalMEPlots) { + // Like sign pair ++ + if (trk1.sign() > 0) { + if (cFill1DQAs) { + histos.fill(HIST("Result/Data/lambda1520invmassME_LSPP"), resonanceMass); + } + histos.fill(HIST("Result/Data/h3lambda1520invmassME_LSPP"), centrality, resonancePt, resonanceMass); + } else { // Like sign pair -- + if (cFill1DQAs) { + histos.fill(HIST("Result/Data/lambda1520invmassME_LSMM"), resonanceMass); + } + histos.fill(HIST("Result/Data/h3lambda1520invmassME_LSMM"), centrality, resonancePt, resonanceMass); } - histos.fill(HIST("Result/Data/h3lambda1520invmassLSMM"), multiplicity, lResonance.Pt(), lResonance.M()); } } } @@ -988,11 +1049,18 @@ struct Lstaranalysis { colCuts.fillQA(collision); - if (cFilladditionalQAeventPlots) - histos.fill(HIST("QAevent/hEvtCounterSameE"), 1.0); - fillHistograms(collision, tracks, tracks); + fillHistograms(collision, tracks, tracks); } - PROCESS_SWITCH(Lstaranalysis, processData, "Process Event for data without partition", false); + PROCESS_SWITCH(Lambda1520analysisinpp, processData, "Process Event for data without partition", false); + + void processRotational(EventCandidates::iterator const& collision, TrackCandidates const& tracks) + { + if (!colCuts.isSelected(collision, false)) // Default event selection + return; + + fillHistograms(collision, tracks, tracks); + } + PROCESS_SWITCH(Lambda1520analysisinpp, processRotational, "Process Rotational Background", false); void processMC(MCEventCandidates::iterator const& collision, aod::McCollisions const&, @@ -1003,31 +1071,26 @@ struct Lstaranalysis { if (std::abs(collision.posZ()) > cZvertCutMC) // Z-vertex cut return; - fillHistograms(collision, tracks, tracks); + fillHistograms(collision, tracks, tracks); } - PROCESS_SWITCH(Lstaranalysis, processMC, "Process Event for MC Light without partition", false); + PROCESS_SWITCH(Lambda1520analysisinpp, processMC, "Process Event for MC Light without partition", false); - Partition selectedMCParticles = (nabs(aod::mcparticle::pdgCode) == 102134); // Lambda(1520) + Partition selectedMCParticles = (nabs(aod::mcparticle::pdgCode) == static_cast(Pdg::kLambda1520_Py)); // Lambda(1520) void processMCTrue(MCEventCandidates::iterator const& collision, aod::McCollisions const&, aod::McParticles const& mcParticles) { bool isInAfterAllCuts = colCuts.isSelected(collision); - bool inVtx10 = (std::abs(collision.mcCollision().posZ()) > 10.) ? false : true; + bool inVtx10 = (std::abs(collision.mcCollision().posZ()) > configEvents.cfgEvtZvtx) ? false : true; bool isTriggerTVX = collision.selection_bit(aod::evsel::kIsTriggerTVX); bool isSel8 = collision.sel8(); bool isTrueINELgt0 = isTrueINEL0(collision, mcParticles); - centrality = centEst(collision); - - auto multiplicity = collision.centFT0M(); + auto centrality = centEst(collision); auto mcParts = selectedMCParticles->sliceBy(perMcCollision, collision.mcCollision().globalIndex()); // Not related to the real collisions for (const auto& part : mcParts) { // loop over all MC particles - if (std::abs(part.pdgCode()) != kLambda1520PDG) // Lambda1520(0) - continue; - std::vector daughterPDGs; if (part.has_daughters()) { auto daughter01 = mcParticles.rawIteratorAt(part.daughtersIds()[0] - mcParticles.offset()); @@ -1049,9 +1112,16 @@ struct Lstaranalysis { histos.fill(HIST("QA/MC/h2GenEtaPt_beforeanycut"), part.eta(), part.pt()); histos.fill(HIST("QA/MC/h2GenPhiRapidity_beforeanycut"), part.phi(), part.y()); - if (cUseRapcutMC && std::abs(part.y()) > static_cast(0.5)) // rapidity cut + if (cUseRapcutMC && std::abs(part.y()) > configTracks.cfgCutRapidity) // rapidity cut continue; + if (cfgUseDaughterEtaCutMC) { + for (auto const& daughters : part.daughters_as()) { + if (std::fabs(daughters.eta()) > configTracks.cfgCutEta) + continue; // eta cut for daughters + } // loop over daughters + } + histos.fill(HIST("QA/MC/h2GenEtaPt_afterRapcut"), part.eta(), part.pt()); histos.fill(HIST("QA/MC/h2GenPhiRapidity_afterRapcut"), part.phi(), part.y()); @@ -1063,90 +1133,91 @@ struct Lstaranalysis { // without any event selection if (part.pdgCode() > 0) - histos.fill(HIST("Result/MC/Genlambda1520pt"), 0, part.pt(), multiplicity); + histos.fill(HIST("Result/MC/Genlambda1520pt"), 0, part.pt(), centrality); else - histos.fill(HIST("Result/MC/Genantilambda1520pt"), 0, part.pt(), multiplicity); + histos.fill(HIST("Result/MC/Genantilambda1520pt"), 0, part.pt(), centrality); if (inVtx10) // INEL10 { if (part.pdgCode() > 0) - histos.fill(HIST("Result/MC/Genlambda1520pt"), 1, part.pt(), multiplicity); + histos.fill(HIST("Result/MC/Genlambda1520pt"), 1, part.pt(), centrality); else - histos.fill(HIST("Result/MC/Genantilambda1520pt"), 1, part.pt(), multiplicity); + histos.fill(HIST("Result/MC/Genantilambda1520pt"), 1, part.pt(), centrality); } if (inVtx10 && isSel8) // INEL>10, vtx10 { if (part.pdgCode() > 0) - histos.fill(HIST("Result/MC/Genlambda1520pt"), 2, part.pt(), multiplicity); + histos.fill(HIST("Result/MC/Genlambda1520pt"), 2, part.pt(), centrality); else - histos.fill(HIST("Result/MC/Genantilambda1520pt"), 2, part.pt(), multiplicity); + histos.fill(HIST("Result/MC/Genantilambda1520pt"), 2, part.pt(), centrality); } if (inVtx10 && isTriggerTVX) // vtx10, TriggerTVX { if (part.pdgCode() > 0) - histos.fill(HIST("Result/MC/Genlambda1520pt"), 3, part.pt(), multiplicity); + histos.fill(HIST("Result/MC/Genlambda1520pt"), 3, part.pt(), centrality); else - histos.fill(HIST("Result/MC/Genantilambda1520pt"), 3, part.pt(), multiplicity); + histos.fill(HIST("Result/MC/Genantilambda1520pt"), 3, part.pt(), centrality); } if (isInAfterAllCuts) // after all event selection { if (part.pdgCode() > 0) - histos.fill(HIST("Result/MC/Genlambda1520pt"), 4, part.pt(), multiplicity); + histos.fill(HIST("Result/MC/Genlambda1520pt"), 4, part.pt(), centrality); else - histos.fill(HIST("Result/MC/Genantilambda1520pt"), 4, part.pt(), multiplicity); + histos.fill(HIST("Result/MC/Genantilambda1520pt"), 4, part.pt(), centrality); } } // QA for Trigger efficiency - histos.fill(HIST("Event/hMCEventIndices"), centrality, kINEL); + histos.fill(HIST("Event/hMCEventIndices"), centrality, Inel); if (inVtx10) - histos.fill(HIST("Event/hMCEventIndices"), centrality, kINEL10); + histos.fill(HIST("Event/hMCEventIndices"), centrality, Inel10); if (isTrueINELgt0) - histos.fill(HIST("Event/hMCEventIndices"), centrality, kINELg0); + histos.fill(HIST("Event/hMCEventIndices"), centrality, Inelg0); if (inVtx10 && isTrueINELgt0) - histos.fill(HIST("Event/hMCEventIndices"), centrality, kINELg010); + histos.fill(HIST("Event/hMCEventIndices"), centrality, Inelg010); // TVX MB trigger if (isTriggerTVX) - histos.fill(HIST("Event/hMCEventIndices"), centrality, kTrig); + histos.fill(HIST("Event/hMCEventIndices"), centrality, Trig); if (isTriggerTVX && inVtx10) - histos.fill(HIST("Event/hMCEventIndices"), centrality, kTrig10); + histos.fill(HIST("Event/hMCEventIndices"), centrality, Trig10); if (isTriggerTVX && isTrueINELgt0) - histos.fill(HIST("Event/hMCEventIndices"), centrality, kTrigINELg0); + histos.fill(HIST("Event/hMCEventIndices"), centrality, TrigINELg0); if (isTriggerTVX && isTrueINELgt0 && inVtx10) - histos.fill(HIST("Event/hMCEventIndices"), centrality, kTrigINELg010); + histos.fill(HIST("Event/hMCEventIndices"), centrality, TrigINELg010); // Sel8 event selection if (isSel8) - histos.fill(HIST("Event/hMCEventIndices"), centrality, kSel8); + histos.fill(HIST("Event/hMCEventIndices"), centrality, Sel8); if (isSel8 && inVtx10) - histos.fill(HIST("Event/hMCEventIndices"), centrality, kSel810); + histos.fill(HIST("Event/hMCEventIndices"), centrality, Sel810); if (isSel8 && isTrueINELgt0) - histos.fill(HIST("Event/hMCEventIndices"), centrality, kSel8INELg0); + histos.fill(HIST("Event/hMCEventIndices"), centrality, Sel8INELg0); if (isSel8 && isTrueINELgt0 && inVtx10) - histos.fill(HIST("Event/hMCEventIndices"), centrality, kSel8INELg010); + histos.fill(HIST("Event/hMCEventIndices"), centrality, Sel8INELg010); // CollisionCuts selection if (isInAfterAllCuts) - histos.fill(HIST("Event/hMCEventIndices"), centrality, kAllCuts); + histos.fill(HIST("Event/hMCEventIndices"), centrality, AllCuts); if (isInAfterAllCuts && inVtx10) - histos.fill(HIST("Event/hMCEventIndices"), centrality, kAllCuts10); + histos.fill(HIST("Event/hMCEventIndices"), centrality, AllCuts10); if (isInAfterAllCuts && isTrueINELgt0) - histos.fill(HIST("Event/hMCEventIndices"), centrality, kAllCutsINELg0); + histos.fill(HIST("Event/hMCEventIndices"), centrality, AllCutsINELg0); if (isInAfterAllCuts && isTrueINELgt0 && inVtx10) - histos.fill(HIST("Event/hMCEventIndices"), centrality, kAllCutsINELg010); + histos.fill(HIST("Event/hMCEventIndices"), centrality, AllCutsINELg010); } - PROCESS_SWITCH(Lstaranalysis, processMCTrue, "Process Event for MC only", false); + PROCESS_SWITCH(Lambda1520analysisinpp, processMCTrue, "Process Event for MC only", false); // Processing Event Mixing using BinningTypeVtxZT0M = ColumnBinningPolicy; - BinningTypeVtxZT0M colBinning{{cfgVtxBins, cfgMultBins}, true}; void processME(EventCandidates const& collision, TrackCandidates const& tracks) { auto tracksTuple = std::make_tuple(tracks); - SameKindPair pairs{colBinning, nEvtMixing, -1, collision, tracksTuple, &cache}; // -1 is the number of the bin to skip + + BinningTypeVtxZT0M colBinning{{configBkg.cfgVtxBins, configBkg.cfgMultBins}, true}; + SameKindPair pairs{colBinning, configBkg.nEvtMixing, -1, collision, tracksTuple, &cache}; // -1 is the number of the bin to skip for (const auto& [collision1, tracks1, collision2, tracks2] : pairs) { // LOGF(info, "Mixed event collisions: (%d, %d)", collision1.globalIndex(), collision2.globalIndex()); @@ -1158,24 +1229,24 @@ struct Lstaranalysis { if (cFilladditionalQAeventPlots) { // Fill histograms for the characteristics of the *mixed* events (collision1 and collision2) // This will show the distribution of events that are actually being mixed. - histos.fill(HIST("QAevent/hMixPool_VtxZ"), collision1.posZ()); - histos.fill(HIST("QAevent/hMixPool_Multiplicity"), collision1.centFT0M()); // Assuming getCentrality() gives multiplicity + if (cFill1DQAs) { + histos.fill(HIST("QAevent/hMixPool_VtxZ"), collision1.posZ()); + histos.fill(HIST("QAevent/hMixPool_Multiplicity"), collision1.centFT0M()); + } histos.fill(HIST("QAevent/hMixPool_VtxZ_vs_Multiplicity"), collision1.posZ(), collision1.centFT0M()); // You might also want to fill for collision2 if you want to see both partners' distributions // histos.fill(HIST("QAevent/hMixPool_VtxZ"), collision2.posZ()); - // histos.fill(HIST("QAevent/hMixPool_Multiplicity"), collision2.getCentrality()); - // histos.fill(HIST("QAevent/hMixPool_VtxZ_vs_Multiplicity"), collision2.posZ(), collision2.getCentrality()); - - histos.fill(HIST("QAevent/hEvtCounterMixedE"), 1.f); + // histos.fill(HIST("QAevent/hMixPool_Multiplicity"), collision2.centFT0M()); + // histos.fill(HIST("QAevent/hMixPool_VtxZ_vs_Multiplicity"), collision2.posZ(), collision2.centFT0M()); } - fillHistograms(collision1, tracks1, tracks2); + fillHistograms(collision1, tracks1, tracks2); } } - PROCESS_SWITCH(Lstaranalysis, processME, "Process EventMixing light without partition", false); + PROCESS_SWITCH(Lambda1520analysisinpp, processME, "Process EventMixing light without partition", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { - return WorkflowSpec{adaptAnalysisTask(cfgc)}; + return WorkflowSpec{adaptAnalysisTask(cfgc)}; } diff --git a/PWGLF/Utils/collisionCuts.h b/PWGLF/Utils/collisionCuts.h index 399454e9368..b1a80cfe075 100644 --- a/PWGLF/Utils/collisionCuts.h +++ b/PWGLF/Utils/collisionCuts.h @@ -16,15 +16,17 @@ /// original author: Laura Serksnyte, TU München /// /// \author Bong-Hwi Lim +/// \author Hirak Kumar Koley #ifndef PWGLF_UTILS_COLLISIONCUTS_H_ #define PWGLF_UTILS_COLLISIONCUTS_H_ -#include +#include "Common/DataModel/EventSelection.h" #include "Framework/HistogramRegistry.h" #include "Framework/Logger.h" -#include "Common/DataModel/EventSelection.h" + +#include namespace o2::analysis { @@ -185,13 +187,15 @@ class CollisonCuts /// \param col Collision /// \return whether or not the collisions fulfills the specified selections template - bool isSelected(T const& col) + bool isSelected(T const& col, const bool QA = true) { - mHistogramRegistry->fill(HIST("Event/posZ_noCut"), col.posZ()); - if (mCheckIsRun3) { - mHistogramRegistry->fill(HIST("Event/trackOccupancyInTimeRange_noCut"), col.trackOccupancyInTimeRange()); + if (QA) { + mHistogramRegistry->fill(HIST("Event/posZ_noCut"), col.posZ()); + if (mCheckIsRun3) { + mHistogramRegistry->fill(HIST("Event/trackOccupancyInTimeRange_noCut"), col.trackOccupancyInTimeRange()); + } + mHistogramRegistry->fill(HIST("CollCutCounts"), EvtSel::kAllEvent); } - mHistogramRegistry->fill(HIST("CollCutCounts"), EvtSel::kAllEvent); if (std::abs(col.posZ()) > mZvtxMax) { LOGF(debug, "Vertex out of range"); return false; @@ -204,48 +208,66 @@ class CollisonCuts } mInitialColBitScan = false; } - mHistogramRegistry->fill(HIST("CollCutCounts"), EvtSel::kFlagZvertex); + if (QA) { + mHistogramRegistry->fill(HIST("CollCutCounts"), EvtSel::kFlagZvertex); + } if (mCheckIsRun3) { // Run3 case if (!col.selection_bit(aod::evsel::kIsTriggerTVX) && mTriggerTVXselection) { LOGF(debug, "Offline selection TVX failed (Run3)"); return false; } - mHistogramRegistry->fill(HIST("CollCutCounts"), EvtSel::kFlagTrigerTVX); + if (QA) { + mHistogramRegistry->fill(HIST("CollCutCounts"), EvtSel::kFlagTrigerTVX); + } if (!col.selection_bit(aod::evsel::kNoTimeFrameBorder) && mApplyTFBorderCut) { LOGF(debug, "Time frame border cut failed"); return false; } - mHistogramRegistry->fill(HIST("CollCutCounts"), EvtSel::kFlagTimeFrameBorder); + if (QA) { + mHistogramRegistry->fill(HIST("CollCutCounts"), EvtSel::kFlagTimeFrameBorder); + } if (!col.selection_bit(aod::evsel::kNoITSROFrameBorder) && mApplyNoITSROBorderCut) { LOGF(debug, "NoITSRO frame border cut failed"); return false; } - mHistogramRegistry->fill(HIST("CollCutCounts"), EvtSel::kFlagITSROFrameBorder); + if (QA) { + mHistogramRegistry->fill(HIST("CollCutCounts"), EvtSel::kFlagITSROFrameBorder); + } if (!col.sel8() && mCheckOffline) { LOGF(debug, "Offline selection failed (Run3)"); return false; } - mHistogramRegistry->fill(HIST("CollCutCounts"), EvtSel::kFlagSel8); + if (QA) { + mHistogramRegistry->fill(HIST("CollCutCounts"), EvtSel::kFlagSel8); + } if (!col.selection_bit(o2::aod::evsel::kIsVertexITSTPC) && mApplyITSTPCvertex) { LOGF(debug, "ITS-TPC matching cut failed"); return false; } - mHistogramRegistry->fill(HIST("CollCutCounts"), EvtSel::kFlagVertexITSTPC); + if (QA) { + mHistogramRegistry->fill(HIST("CollCutCounts"), EvtSel::kFlagVertexITSTPC); + } if (!col.selection_bit(o2::aod::evsel::kNoSameBunchPileup) && mApplyPileupRejection) { LOGF(debug, "Pileup rejection failed"); return false; } - mHistogramRegistry->fill(HIST("CollCutCounts"), EvtSel::kFlagBunchPileup); + if (QA) { + mHistogramRegistry->fill(HIST("CollCutCounts"), EvtSel::kFlagBunchPileup); + } if (!col.selection_bit(o2::aod::evsel::kNoCollInTimeRangeNarrow) && mApplyCollInTimeRangeNarrow) { LOGF(debug, "NoCollInTimeRangeNarrow selection failed"); return false; } - mHistogramRegistry->fill(HIST("CollCutCounts"), EvtSel::kNoCollInTimeRangeNarrow); + if (QA) { + mHistogramRegistry->fill(HIST("CollCutCounts"), EvtSel::kNoCollInTimeRangeNarrow); + } if (!col.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV) && mApplyZvertexTimedifference) { LOGF(debug, "Z-vertex time difference cut failed"); return false; } - mHistogramRegistry->fill(HIST("CollCutCounts"), EvtSel::kFlagZvtxFT0vsPV); + if (QA) { + mHistogramRegistry->fill(HIST("CollCutCounts"), EvtSel::kFlagZvtxFT0vsPV); + } if (mtrackOccupancyInTimeRangeMax > 0 && col.trackOccupancyInTimeRange() > mtrackOccupancyInTimeRangeMax) { LOGF(debug, "trackOccupancyInTimeRange selection failed"); return false; @@ -254,12 +276,16 @@ class CollisonCuts LOGF(debug, "trackOccupancyInTimeRange selection failed"); return false; } - mHistogramRegistry->fill(HIST("CollCutCounts"), EvtSel::kFlagOccupancy); + if (QA) { + mHistogramRegistry->fill(HIST("CollCutCounts"), EvtSel::kFlagOccupancy); + } if ((!col.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) && mApplyCollInTimeRangeStandard) { LOGF(debug, "NoCollInTimeRangeStandard selection failed"); return false; } - mHistogramRegistry->fill(HIST("CollCutCounts"), EvtSel::kNoCollInTimeRangeStandard); + if (QA) { + mHistogramRegistry->fill(HIST("CollCutCounts"), EvtSel::kNoCollInTimeRangeStandard); + } } else { // Run2 case if (mCheckOffline && !col.sel7()) { LOGF(debug, "Offline selection failed (sel7)"); @@ -275,9 +301,13 @@ class CollisonCuts LOGF(debug, "INELgtZERO selection failed"); return false; } + if (QA) { + mHistogramRegistry->fill(HIST("CollCutCounts"), EvtSel::kAllpassed); + } + } + if (QA) { mHistogramRegistry->fill(HIST("CollCutCounts"), EvtSel::kAllpassed); } - mHistogramRegistry->fill(HIST("CollCutCounts"), EvtSel::kAllpassed); return true; } From 4ad16d46806fe3630f7af5263b69da323f5e5489 Mon Sep 17 00:00:00 2001 From: JimunLee Date: Fri, 25 Jul 2025 13:07:18 +0900 Subject: [PATCH 056/345] [PWGLF] Added the part of same event of KstarInOO.cxx (#12197) Co-authored-by: jimun_lee --- PWGLF/Tasks/Resonances/kstarInOO.cxx | 426 ++++++++++++++++++--------- 1 file changed, 281 insertions(+), 145 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index 159bfff2963..83f233d5112 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -10,66 +10,112 @@ // or submit itself to any jurisdiction. /// \file kstarInOO.cxx +/// \brief the pT spectra of k*0(892) resonance analysis in OO collisions /// \author Jimun Lee -#include "PWGLF/DataModel/LFResonanceTables.h" - -#include "Common/Core/RecoDecay.h" -#include "Common/Core/TrackSelection.h" -#include "Common/Core/TrackSelectionDefaults.h" -#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/PIDResponseTOF.h" +#include "Common/DataModel/PIDResponseTPC.h" #include "Common/DataModel/TrackSelectionTables.h" #include "CommonConstants/PhysicsConstants.h" #include "DataFormatsParameters/GRPObject.h" #include "Framework/ASoA.h" -#include "Framework/ASoAHelpers.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" -#include "Framework/runDataProcessing.h" #include "ReconstructionDataFormats/Track.h" - -#include "TF1.h" +#include +#include +#include +#include +#include +#include + +#include "TRandom.h" #include +#include +#include #include +#include + #include +#include +#include +#include +#include #include #include +#include #include +#include + using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; struct kstarInOO { SliceCache cache; + Preslice perCollision = aod::track::collisionId; HistogramRegistry OOhistos{"OOhistos", {}, OutputObjHandlingPolicy::AnalysisObject}; - Configurable cfgeventSelections{"cfgeventSelections", "sel8", "choose event selection"}; - Configurable cfgtrackSelections{"cfgtrackSelections", "globalTracks", "set track selections"}; - - Configurable cfgtrkMinPt{"cfgtrkMinPt", 0.15, "set track min pT"}; - Configurable cfgtrkMaxEta{"cfgtrkMaxEta", 0.9, "set track max Eta"}; - Configurable cfgMaxDCArToPVcut{"cfgMaxDCArToPVcut", 0.5, "Track DCAr cut to PV Maximum"}; - Configurable cfgMaxDCAzToPVcut{"cfgMaxDCAzToPVcut", 2.0, "Track DCAz cut to PV Maximum"}; - Configurable cfgPrimaryTrack{"cfgPrimaryTrack", true, "Primary track selection"}; // kGoldenChi2 | kDCAxy | kDCAz - Configurable cfgConnectedToPV{"cfgConnectedToPV", true, "PV contributor track selection"}; // PV Contriuibutor - Configurable cfgGlobalWoDCATrack{"cfgGlobalWoDCATrack", true, "Global track selection without DCA"}; // kQualityTracks (kTrackType | kTPCNCls | kTPCCrossedRows | kTPCCrossedRowsOverNCls | kTPCChi2NDF | kTPCRefit | kITSNCls | kITSChi2NDF | kITSRefit | kITSHits) | kInAcceptanceTracks (kPtRange | kEtaRange) - Configurable cfgnFindableTPCClusters{"cfgnFindableTPCClusters", 50, "nFindable TPC Clusters"}; - Configurable cfgnTPCCrossedRows{"cfgnTPCCrossedRows", 70, "nCrossed TPC Rows"}; - Configurable cfgnRowsOverFindable{"cfgnRowsOverFindable", 1.2, "nRowsOverFindable TPC CLusters"}; - Configurable cfgnTPCChi2{"cfgnTPChi2", 4.0, "nTPC Chi2 per Cluster"}; - Configurable cfgnITSChi2{"cfgnITShi2", 36.0, "nITS Chi2 per Cluster"}; - Configurable cfgnTPCPID{"cfgnTPCPID", 4, "nTPC PID"}; - Configurable cfgnTOFPID{"cfgnTOFPID", 4, "nTOF PID"}; - Configurable cfgVtxCut{"cfgVtxCut", 10.0, "V_z cut selection"}; + //================================== + //|| + //|| Selection + //|| + //================================== + + // Event Selection + Configurable cfg_Event_Selections{"cfg_Event_Selections", "sel8", "choose event selection"}; + Configurable cfg_Event_VtxCut{"cfg_Event_VtxCut", 10.0, "V_z cut selection"}; + + ConfigurableAxis cfg_CentAxis{"cfg_CentAxis", {VARIABLE_WIDTH, 0.0, 1.0, 5.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 110.0}, "Binning of the centrality axis"}; + + // Track Selection + // General + Configurable cfg_Track_Selections{"cfg_Track_Selections", "globalTracks", "set track selections"}; + Configurable cfg_Track_MinPt{"cfg_Track_MinPt", 0.15, "set track min pT"}; + Configurable cfg_Track_MaxEta{"cfg_Track_MaxEta", 0.9, "set track max Eta"}; + Configurable cfg_Track_MaxDCArToPVcut{"cfg_Track_MaxDCArToPVcut", 0.5, "Track DCAr cut to PV Maximum"}; + Configurable cfg_Track_MaxDCAzToPVcut{"cfg_Track_MaxDCAzToPVcut", 2.0, "Track DCAz cut to PV Maximum"}; + Configurable cfg_Track_PrimaryTrack{"cfg_Track_PrimaryTrack", true, "Primary track selection"}; // kGoldenChi2 | kDCAxy | kDCAz + Configurable cfg_Track_ConnectedToPV{"cfg_Track_ConnectedToPV", true, "PV contributor track selection"}; // PV Contriuibutor + Configurable cfg_Track_GlobalWoDCATrack{"cfg_Track_GlobalWoDCATrack", true, "Global track selection without DCA"}; // kQualityTracks (kTrackType | kTPCNCls | kTPCCrossedRows | kTPCCrossedRowsOverNCls | kTPCChi2NDF | kTPCRefit | kITSNCls | kITSChi2NDF | kITSRefit | kITSHits) | kInAcceptanceTracks (kPtRange | kEtaRange) + // TPC + Configurable cfg_Track_nFindableTPCClusters{"cfg_Track_FindableTPCClusters", 50, "nFindable TPC Clusters"}; + Configurable cfg_Track_nTPCCrossedRows{"cfg_Track_TPCCrossedRows", 70, "nCrossed TPC Rows"}; + Configurable cfg_Track_nRowsOverFindable{"cfg_Track_RowsOverFindable", 1.2, "nRowsOverFindable TPC CLusters"}; + Configurable cfg_Track_nTPCChi2{"cfg_Track_TPCChi2", 4.0, "nTPC Chi2 per Cluster"}; + + // ITS + Configurable cfg_Track_nITSChi2{"cfg_Track_ITSChi2", 36.0, "nITS Chi2 per Cluster"}; + + // PID + Configurable cfg_Track_TPCPID{"cfg_Track_TPCPID", true, "Enables TPC PID"}; + Configurable cfg_Track_TOFPID{"cfg_Track_TOFPID", true, "Enables TOF PID"}; + Configurable cfg_Track_TPCPID_nSig{"cfg_Track_TPCPID_nSig", 4.0, "nTPC PID sigma"}; + Configurable cfg_Track_TOFPID_nSig{"cfg_Track_TOFPID_nSig", 4.0, "nTOF PID sigma"}; Configurable cDebugLevel{"cDebugLevel", 0, "Resolution of Debug"}; + // Mixing + ConfigurableAxis cfg_bins_MixVtx{"cfg_bins_MixVtx", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"}; + ConfigurableAxis cfg_bins_MixMult{"cfg_bins_MixMult", {VARIABLE_WIDTH, 0.0f, 1.0f, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f}, "Mixing bins - z-vertex"}; + Configurable cfg_Mix_NMixedEvents{"cfg_Mix_NMixedEvents", 5, "Number of mixed events per event"}; + + // Pair + Configurable cfg_MinvNBins{"cfg_MinvNBins", 300, "Number of bins for Minv axis"}; + Configurable cfg_MinvMin{"cfg_MinvMin", 0.60, "Minimum Minv value"}; + Configurable cfg_MinvMax{"cfg_MinvMax", 1.20, "Maximum Minv value"}; + + // Histogram + Configurable cfg_Track_CutQA{"cfg_Track_CutQA", false, "Enable Track QA Hists"}; + + // std::vector eventSelectionBits; + void init(o2::framework::InitContext&) { // HISTOGRAMS @@ -77,92 +123,139 @@ struct kstarInOO { const AxisSpec axisPhi{200, -1, +7, "#phi"}; const AxisSpec PtAxis = {200, 0, 20.0}; const AxisSpec PIDAxis = {120, -6, 6}; + const AxisSpec MinvAxis = {cfg_MinvNBins, cfg_MinvMin, cfg_MinvMax}; + + if (cfg_Track_CutQA) { + OOhistos.add("h_rawpT", "h_rawpT", kTH1F, {{1000, 0.0, 10.0}}); + OOhistos.add("h_rawpT_Kaon", "h_rawpT_Kaon", kTH1F, {{1000, 0.0, 10.0}}); + OOhistos.add("h_rawpT_Pion", "h_rawpT_Pion", kTH1F, {{1000, 0.0, 10.0}}); + OOhistos.add("h_eta", "h_eta", kTH1F, {axisEta}); + OOhistos.add("h_phi", "h_phi", kTH1F, {axisPhi}); + + OOhistos.add("QA_nSigma_pion_TPC", "QA_nSigma_pion_TPC", {HistType::kTH2F, {PtAxis, PIDAxis}}); + OOhistos.add("QA_nSigma_pion_TOF", "QA_nSigma_pion_TOF", {HistType::kTH2F, {PtAxis, PIDAxis}}); + OOhistos.add("QA_pion_TPC_TOF", "QA_pion_TPC_TOF", {HistType::kTH2F, {PIDAxis, PIDAxis}}); + OOhistos.add("QA_nSigma_kaon_TPC", "QA_nSigma_kaon_TPC", {HistType::kTH2F, {PtAxis, PIDAxis}}); + OOhistos.add("QA_nSigma_kaon_TOF", "QA_nSigma_kaon_TOF", {HistType::kTH2F, {PtAxis, PIDAxis}}); + OOhistos.add("QA_kaon_TPC_TOF", "QA_kaon_TPC_TOF", {HistType::kTH2F, {PIDAxis, PIDAxis}}); + } + + // MC histos + OOhistos.add("hMC_USS", "hMC_USS", kTHnSparseF, {cfg_CentAxis, PtAxis, MinvAxis}); + OOhistos.add("hMC_LSS", "hMC_LSS", kTHnSparseF, {cfg_CentAxis, PtAxis, MinvAxis}); + OOhistos.add("hMC_USS_Mix", "hMC_USS_Mix", kTHnSparseF, {cfg_CentAxis, PtAxis, MinvAxis}); + OOhistos.add("hMC_LSS_Mix", "hMC_LSS_Mix", kTHnSparseF, {cfg_CentAxis, PtAxis, MinvAxis}); - OOhistos.add("nEvents", "nEvents", kTH1F, {{4, 0.0, 4.0}}); - OOhistos.add("h_rawpT", "h_rawpT", kTH1F, {{1000, 0.0, 10.0}}); - OOhistos.add("h_rawpT_Kaon", "h_rawpT_Kaon", kTH1F, {{1000, 0.0, 10.0}}); - OOhistos.add("h_eta", "h_eta", kTH1F, {axisEta}); - OOhistos.add("h_phi", "h_phi", kTH1F, {axisPhi}); + // OOhistos.add("hMC_pt_Pion", "hMC_pt_Pion", kTH1F, {PtAxis}); + // OOhistos.add("hMC_pt_Kaon", "hMC_pt_Kaon", kTH1F, {PtAxis}); + // OOhistos.add("hMC_pt_Proton", "hMC_pt_Proton", kTH1F, {PtAxis}); - OOhistos.add("QA_nSigma_pion_TPC", "QA_nSigma_pion_TPC", {HistType::kTH2F, {PtAxis, PIDAxis}}); - OOhistos.add("QA_nSigma_pion_TOF", "QA_nSigma_pion_TOF", {HistType::kTH2F, {PtAxis, PIDAxis}}); - OOhistos.add("QA_pion_TPC_TOF", "QA_pion_TPC_TOF", {HistType::kTH2F, {PIDAxis, PIDAxis}}); - OOhistos.add("QA_nSigma_kaon_TPC", "QA_nSigma_kaon_TPC", {HistType::kTH2F, {PtAxis, PIDAxis}}); - OOhistos.add("QA_nSigma_kaon_TOF", "QA_nSigma_kaon_TOF", {HistType::kTH2F, {PtAxis, PIDAxis}}); - OOhistos.add("QA_kaon_TPC_TOF", "QA_kaon_TPC_TOF", {HistType::kTH2F, {PIDAxis, PIDAxis}}); + // Event Histograms + OOhistos.add("nEvents_MC", "nEvents_MC", kTH1F, {{4, 0.0, 4.0}}); + OOhistos.add("nEvents_MC_Mix", "nEvents_MC_Mix", kTH1F, {{4, 0.0, 4.0}}); } // end of init + using EventCandidates = soa::Join; //, aod::CentFT0Ms, aod::CentFT0As + using TrackCandidates = soa::Join; + using TrackCandidates_MC = soa::Join; + + // For Mixed Event + using BinningType = ColumnBinningPolicy; + + Partition Kaon_MC = (!cfg_Track_TPCPID || (nabs(aod::pidtpc::tpcNSigmaKa) <= cfg_Track_TPCPID_nSig)); + Partition Pion_MC = (!cfg_Track_TPCPID || (nabs(aod::pidtpc::tpcNSigmaPi) <= cfg_Track_TPCPID_nSig)); + double massKa = o2::constants::physics::MassKPlus; double massPi = o2::constants::physics::MassPiMinus; - using EventCandidates = soa::Join; // , aod::CentFT0Ms, aod::CentFT0As, aod::CentFT0Cs - using TrackCandidates = soa::Join; - //================================== - // 0. Track quality cuts + //|| + //|| Helper Templates + //|| //================================== - // for PID QA TrackType - template - bool trackSelection(const TrackType track) + template + bool eventSelection(const EventType event) + { + if (!event.sel8()) + return false; + + if (!event.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) + return false; + if (!event.selection_bit(aod::evsel::kNoSameBunchPileup)) + return false; + + if (!event.selection_bit(aod::evsel::kNoTimeFrameBorder)) + return false; + if (!event.selection_bit(aod::evsel::kNoITSROFrameBorder)) + return false; + + if (!event.selection_bit(aod::evsel::kNoCollInTimeRangeStandard)) + return false; + + return true; + }; + + template + bool trackSelection(const TracksType track) { + if (track.pt() < cfg_Track_MinPt) + return false; - if (track.pt() < cfgtrkMinPt) + if (std::abs(track.eta()) > cfg_Track_MaxEta) return false; - if (std::abs(track.eta()) > cfgtrkMaxEta) + if (std::abs(track.dcaXY()) > cfg_Track_MaxDCArToPVcut) return false; - if (std::abs(track.dcaXY()) > cfgMaxDCArToPVcut) + if (std::abs(track.dcaZ()) > cfg_Track_MaxDCAzToPVcut) return false; - if (std::abs(track.dcaZ()) > cfgMaxDCAzToPVcut) + if (cfg_Track_PrimaryTrack && !track.isPrimaryTrack()) return false; - if (cfgPrimaryTrack && !track.isPrimaryTrack()) + if (cfg_Track_GlobalWoDCATrack && !track.isGlobalTrackWoDCA()) return false; - if (track.tpcNClsFindable() < cfgnFindableTPCClusters) + if (track.tpcNClsFindable() < cfg_Track_nFindableTPCClusters) return false; - if (track.tpcNClsCrossedRows() < cfgnTPCCrossedRows) + if (track.tpcNClsCrossedRows() < cfg_Track_nTPCCrossedRows) return false; - if (track.tpcCrossedRowsOverFindableCls() > cfgnRowsOverFindable) + if (track.tpcCrossedRowsOverFindableCls() > cfg_Track_nRowsOverFindable) return false; - if (track.tpcChi2NCl() > cfgnTPCChi2) + if (track.tpcChi2NCl() > cfg_Track_nTPCChi2) return false; - if (track.itsChi2NCl() > cfgnITSChi2) + if (track.itsChi2NCl() > cfg_Track_nITSChi2) return false; - if (cfgConnectedToPV && !track.isPVContributor()) + if (cfg_Track_ConnectedToPV && !track.isPVContributor()) return false; return true; }; - //--------------------------------------- - // 1-2. Check whether it passes tpc&tof - //--------------------------------------- - // Kaon - template - bool trackPIDKaon(const T& candidate, bool QA = false) + template + bool trackPIDKaon(const TrackPID& candidate) { bool tpcPIDPassed{false}, tofPIDPassed{false}; // TPC - if (QA) { + if (cfg_Track_CutQA) { OOhistos.fill(HIST("QA_nSigma_kaon_TPC"), candidate.pt(), candidate.tpcNSigmaKa()); OOhistos.fill(HIST("QA_nSigma_kaon_TOF"), candidate.pt(), candidate.tofNSigmaKa()); + OOhistos.fill(HIST("QA_kaon_TPC_TOF"), candidate.tpcNSigmaKa(), candidate.tofNSigmaKa()); } - if (std::abs(candidate.tpcNSigmaKa()) < cfgnTPCPID) + if (std::abs(candidate.tpcNSigmaKa()) < cfg_Track_TPCPID_nSig) tpcPIDPassed = true; // TOF if (candidate.hasTOF()) { - if (std::abs(candidate.tofNSigmaKa()) < cfgnTOFPID) + if (std::abs(candidate.tofNSigmaKa()) < cfg_Track_TOFPID_nSig) tofPIDPassed = true; else tofPIDPassed = true; @@ -175,119 +268,162 @@ struct kstarInOO { return false; } - // Pion - template - bool trackPIDPion(const T& candidate) + template + bool trackPIDPion(const TrackPID& candidate) { bool tpcPIDPassed{false}, tofPIDPassed{false}; - if (std::abs(candidate.tpcNSigmaPi()) < cfgnTPCPID) + // TPC + if (cfg_Track_CutQA) { + OOhistos.fill(HIST("QA_nSigma_pion_TPC"), candidate.pt(), candidate.tpcNSigmaPi()); + OOhistos.fill(HIST("QA_nSigma_pion_TOF"), candidate.pt(), candidate.tofNSigmaPi()); + OOhistos.fill(HIST("QA_pion_TPC_TOF"), candidate.tpcNSigmaPi(), candidate.tofNSigmaPi()); + } + + if (std::abs(candidate.tpcNSigmaPi()) < cfg_Track_TPCPID_nSig) tpcPIDPassed = true; if (candidate.hasTOF()) { - if (std::abs(candidate.tofNSigmaPi()) < cfgnTOFPID) + if (std::abs(candidate.tofNSigmaPi()) < cfg_Track_TOFPID_nSig) tofPIDPassed = true; else tofPIDPassed = true; } + // TPC & TOF if (tpcPIDPassed && tofPIDPassed) return true; return false; } - //================================ - // 3. Basic PID QA (Pion, Kaon) - //================================ - // template - // void fillHistograms(TrackType const& dTracks1, TrackType const& dTracks2) - // { - // for (auto& [trk1, trk2] : combinations(CombinationsFullIndexPolicy(dTracks1, dTracks2))) - // { - // // Full index policy is needed to consider all possible combinations - // if (trk1.index() == trk2.index()) - // continue; // We need to run (0,1), (1,0) pairs as well. but same id pairs are not needed. - - // //// Initialize variables - // // trk1: Pion, trk2: Kaon - // // apply the track cut - // if (!trackSelection(trk1) || !trackSelection(trk2)) - // continue; - - // auto isTrk1hasTOF = trk1.hasTOF(); - // auto isTrk2hasTOF = trk2.hasTOF(); - // auto trk1ptPi = trk1.pt(); - // auto trk1NSigmaPiTPC = trk1.tpcNSigmaPi(); - // auto trk1NSigmaPiTOF = (isTrk1hasTOF) ? trk1.tofNSigmaPi() : -999.; - // auto trk2ptKa = trk2.pt(); - // auto trk2NSigmaKaTPC = trk2.tpcNSigmaKa(); - // auto trk2NSigmaKaTOF = (isTrk2hasTOF) ? trk2.tofNSigmaKa() : -999.; - - // if (!trackPIDPion(trk1) || !trackPIDKaon(trk2)) - // continue; - - // // PID QA Pion - // OOhistos.fill(HIST("QA_nSigma_pion_TPC"), trk1ptPi, trk1NSigmaPiTPC); - // OOhistos.fill(HIST("QA_nSigma_pion_TOF"), trk1ptPi, trk1NSigmaPiTOF); - // OOhistos.fill(HIST("QA_pion_TPC_TOF"), trk1NSigmaPiTOF, trk1NSigmaPiTPC); - - // // PID QA Kaon - // OOhistos.fill(HIST("QA_nSigma_kaon_TPC"), trk2ptKa, trk2NSigmaKaTPC); - // OOhistos.fill(HIST("QA_nSigma_kaon_TOF"), trk2ptKa, trk2NSigmaKaTOF); - // OOhistos.fill(HIST("QA_kaon_TPC_TOF"), trk2NSigmaKaTOF, trk2NSigmaKaTPC); - // } - // } - - //================================= - // 1. nEvents Selection - //================================= - int nprocessEvents = 0; - void processEvents(EventCandidates::iterator const& collision, TrackCandidates const& tracks) + template + void TrackSlicing_MC(const CollisionType& collision1, const TracksType&, const CollisionType& collision2, const TracksType&, const bool IsMix) + { + auto tracks1 = Kaon_MC->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); + auto tracks2 = Pion_MC->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); + auto centrality = collision1.centFT0C(); + + for (auto& [trk1, trk2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { + auto [KstarPt, Minv] = minvReconstruction(trk1, trk2); + if (Minv < 0) + continue; + + double conjugate = trk1.sign() * trk2.sign(); + if (!IsMix) { + if (conjugate < 0) { + OOhistos.fill(HIST("hMC_USS"), centrality, KstarPt, Minv); + } else if (conjugate > 0) { + OOhistos.fill(HIST("hMC_LSS"), centrality, KstarPt, Minv); + } + } else { + if (conjugate < 0) { + OOhistos.fill(HIST("hMC_USS_Mix"), centrality, KstarPt, Minv); + } else if (conjugate > 0) { + OOhistos.fill(HIST("hMC_LSS_Mix"), centrality, KstarPt, Minv); + } + } + } + } + + template + std::pair minvReconstruction(const TracksType& trk1, const TracksType& trk2) + { + TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance; + + if (!trackSelection(trk1) || !trackSelection(trk2)) + return {-1.0, -1.0}; + if (!trackPIDKaon(trk1) || !trackPIDPion(trk2)) + return {-1.0, -1.0}; + + if (trk1.globalIndex() == trk2.globalIndex()) + return {-1.0, -1.0}; // For Kstar, we need to run (0,1), (1,0) pairs as well. but same id pairs are not neede. + + lDecayDaughter1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massKa); + lDecayDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massPi); + lResonance = lDecayDaughter1 + lDecayDaughter2; + + if (std::abs(lResonance.Eta()) > cfg_Track_MaxEta) + return {-1.0, -1.0}; + + return {lResonance.Pt(), lResonance.M()}; + } + + //======================================================= + //| + //| MC STUFF (SE) + //| + //======================================================= + + int nEvents_MC = 0; + void processSameEvent_MC(EventCandidates::iterator const& collision, TrackCandidates_MC const& tracks, aod::McParticles const&) { - // 1. All events if (cDebugLevel > 0) { - nprocessEvents++; - if ((nprocessEvents + 1) % 10000 == 0) { - std::cout << "Processed Events: " << nprocessEvents << std::endl; + nEvents_MC++; + if ((nEvents_MC + 1) % 10000 == 0) { + double histmem = OOhistos.getSize(); + std::cout << histmem << std::endl; + std::cout << "process_SameEvent_MC: " << nEvents_MC << std::endl; } } - OOhistos.fill(HIST("nEvents"), 0.5); - if (std::fabs(collision.posZ()) > cfgVtxCut) + + auto goodEv = eventSelection(collision); + OOhistos.fill(HIST("nEvents_MC"), 0.5); + if (!goodEv) + return; + + if (std::fabs(collision.posZ()) > cfg_Event_VtxCut) return; - // 2. The events passed a condition bool INELgt0 = false; for (const auto& track : tracks) { - if (std::fabs(track.eta()) < cfgtrkMaxEta) { + if (std::fabs(track.eta()) < cfg_Track_MaxEta) { INELgt0 = true; break; } } - if (!INELgt0) // not INEL + if (!INELgt0) return; - OOhistos.fill(HIST("nEvents"), 1.5); + OOhistos.fill(HIST("nEvents_MC"), 1.5); - //===================================== - // 2. Basic track QA ( pt, phi, eta ) - //===================================== - for (auto& track : tracks) { - // auto originalTrack = track_as(); + TrackSlicing_MC(collision, tracks, collision, tracks, false); - if (!trackSelection(track)) - continue; + } // processSameEvents_MC + PROCESS_SWITCH(kstarInOO, processSameEvent_MC, "process Same Event MC", true); + + //======================================================= + //| + //| MC STUFF (ME) + //| + //======================================================= + + int nEvents_MC_Mix = 0; + void processMixedEvent_MC(EventCandidates const& collisions, TrackCandidates_MC const& tracks, aod::McParticles const&) + { + auto tracksTuple = std::make_tuple(tracks); + BinningType colBinning{{cfg_bins_MixVtx, cfg_bins_MixMult}, true}; // true is for 'ignore overflows' (true by default) + SameKindPair pairs{colBinning, cfg_Mix_NMixedEvents, -1, collisions, tracksTuple, &cache}; + for (const auto& [collision1, tracks1, collision2, tracks2] : pairs) { + if (cDebugLevel > 0) { + nEvents_MC_Mix++; + if ((nEvents_MC_Mix + 1) % 10000 == 0) { + std::cout << "Processed Mixed Events: " << nEvents_MC_Mix << std::endl; + } + } - OOhistos.fill(HIST("h_rawpT"), track.pt()); - OOhistos.fill(HIST("h_eta"), track.eta()); - OOhistos.fill(HIST("h_phi"), track.phi()); + auto goodEv1 = eventSelection(collision1); + auto goodEv2 = eventSelection(collision2); + OOhistos.fill(HIST("nEvents_MC_Mix"), 0.5); - if (!trackPIDKaon(track, true)) // Once it sets the value is true, but later, should be change to false + if (!goodEv1 || !goodEv2) continue; - OOhistos.fill(HIST("h_rawpT_Kaon"), track.pt()); - } - } - PROCESS_SWITCH(kstarInOO, processEvents, "Jimun Code Go!", true); + OOhistos.fill(HIST("nEvents_MC_Mix"), 1.5); + + TrackSlicing_MC(collision1, tracks1, collision2, tracks2, true); + } // mixing + } // processMixedEvent_MC + PROCESS_SWITCH(kstarInOO, processMixedEvent_MC, "process Mixed Event MC", false); void processEventsDummy(EventCandidates::iterator const&, TrackCandidates const&) { From db24d82d124a2b2d453c63752cdb9e5c05283404 Mon Sep 17 00:00:00 2001 From: tutripat <73981392+tutripat@users.noreply.github.com> Date: Fri, 25 Jul 2025 06:33:18 +0200 Subject: [PATCH 057/345] [PWGLF] Update in track and event selection cuts (#12227) Co-authored-by: ALICE Action Bot --- .../GlobalEventProperties/dndeta-mft-pp.cxx | 47 +++++++++++++++---- 1 file changed, 38 insertions(+), 9 deletions(-) diff --git a/PWGLF/Tasks/GlobalEventProperties/dndeta-mft-pp.cxx b/PWGLF/Tasks/GlobalEventProperties/dndeta-mft-pp.cxx index eaaa5b1e815..c90a3d89474 100644 --- a/PWGLF/Tasks/GlobalEventProperties/dndeta-mft-pp.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/dndeta-mft-pp.cxx @@ -83,16 +83,20 @@ struct PseudorapidityDensityMFT { Configurable useEvSel{"useEvSel", true, "use event selection"}; Configurable disableITSROFCut{"disableITSROFCut", false, "Disable ITS ROF cut for event selection"}; ConfigurableAxis multBinning{"multBinning", {701, -0.5, 700.5}, ""}; - ConfigurableAxis EtaAxis = {"etaBinning", {18, -4.6, -1.}, ""}; + ConfigurableAxis EtaAxis = {"etaBinning", {36, -4.6, -1.}, ""}; Configurable useZDiffCut{"useZDiffCut", true, "use Z difference cut"}; Configurable maxZDiff{ "maxZDiff", 1.0f, "max allowed Z difference for reconstructed collisions (cm)"}; - Configurable usePhiCut{"usePhiCut", false, "use azimuthal angle cut"}; + Configurable usePhiCut{"usePhiCut", true, "use azimuthal angle cut"}; Configurable cfgPhiCut{"cfgPhiCut", 0.1f, "Cut on azimuthal angle of MFT tracks"}; + Configurable cfgPhiCut1{"cfgPhiCut1", 0.0f, + "low Cut on azimuthal angle of MFT tracks"}; + Configurable cfgPhiCut2{"cfgPhiCut2", 6.3f, + "high Cut on azimuthal angle of MFT tracks"}; Configurable cfgVzCut1{"cfgVzCut1", -30.0f, "Cut1 on vertex position of MFT tracks"}; Configurable cfgVzCut2{"cfgVzCut2", 30.0f, @@ -576,7 +580,15 @@ struct PseudorapidityDensityMFT { registry.fill(HIST("EventSelection"), 2.); for (const auto& retrack : retracks) { auto track = retrack.mfttrack(); - if ((cfgnEta1 < track.eta()) && (track.eta() < cfgnEta2) && track.nClusters() >= cfgnCluster && retrack.ambDegree() > 0) { + float ndf = std::max(2.0f * track.nClusters() - 5.0f, 1.0f); + float chi2ndf = track.chi2() / ndf; + float phi = track.phi(); + o2::math_utils::bringTo02Pi(phi); + if (usePhiCut) { + if ((phi <= 0.02) || ((phi >= 3.10) && (phi <= 3.23)) || (phi >= 6.21)) + continue; + } + if ((cfgnEta1 < track.eta()) && (track.eta() < cfgnEta2) && track.nClusters() >= cfgnCluster && retrack.ambDegree() > 0 && chi2ndf < cfgChi2NDFMax && (phi > cfgPhiCut1 && phi < cfgPhiCut2)) { registry.fill(HIST("Tracks/2Danalysis/EtaZvtx"), track.eta(), z); } } @@ -584,7 +596,7 @@ struct PseudorapidityDensityMFT { return; } registry.fill(HIST("EventSelection"), 3.); - if (!useEvSel || (useEvSel && collision.selection_bit(aod::evsel::kIsTriggerTVX) && collision.selection_bit(aod::evsel::kNoTimeFrameBorder))) { + if (!useEvSel || (useEvSel && collision.selection_bit(aod::evsel::kIsTriggerTVX) && collision.selection_bit(aod::evsel::kNoTimeFrameBorder) && collision.selection_bit(aod::evsel::kNoSameBunchPileup))) { registry.fill(HIST("EventSelection"), 4.); registry.fill(HIST("Tracks/2Danalysis/EventsNtrkZvtx_sel8"), Ntrk, z); std::unordered_set uniqueEvents; @@ -610,7 +622,13 @@ struct PseudorapidityDensityMFT { auto track = retrack.mfttrack(); float ndf = std::max(2.0f * track.nClusters() - 5.0f, 1.0f); float chi2ndf = track.chi2() / ndf; - if ((cfgnEta1 < track.eta()) && (track.eta() < cfgnEta2) && track.nClusters() >= cfgnCluster && retrack.ambDegree() > 0 && chi2ndf < cfgChi2NDFMax) { + float phi = track.phi(); + o2::math_utils::bringTo02Pi(phi); + if (usePhiCut) { + if ((phi <= 0.02) || ((phi >= 3.10) && (phi <= 3.23)) || (phi >= 6.21)) + continue; + } + if ((cfgnEta1 < track.eta()) && (track.eta() < cfgnEta2) && track.nClusters() >= cfgnCluster && retrack.ambDegree() > 0 && chi2ndf < cfgChi2NDFMax && (phi > cfgPhiCut1 && phi < cfgPhiCut2)) { registry.fill(HIST("Tracks/Control/Chi2NDF"), chi2ndf); registry.fill(HIST("Tracks/2Danalysis/EtaZvtx_sel8"), track.eta(), z); if (midtracks.size() > 0 && retrack.ambDegree() > 0) { @@ -627,8 +645,13 @@ struct PseudorapidityDensityMFT { auto track = retrack.mfttrack(); float ndf = std::max(2.0f * track.nClusters() - 5.0f, 1.0f); float chi2ndf = track.chi2() / ndf; - - if ((cfgnEta1 < track.eta()) && (track.eta() < cfgnEta2) && track.nClusters() >= cfgnCluster && chi2ndf < cfgChi2NDFMax) { + float phi = track.phi(); + o2::math_utils::bringTo02Pi(phi); + if ((cfgnEta1 < track.eta()) && (track.eta() < cfgnEta2) && track.nClusters() >= cfgnCluster && chi2ndf < cfgChi2NDFMax && (phi > cfgPhiCut1 && phi < cfgPhiCut2)) { + if (usePhiCut) { + if ((phi <= 0.02) || ((phi >= 3.10) && (phi <= 3.23)) || (phi >= 6.21)) + continue; + } registry.fill(HIST("TracksEtaZvtx"), track.eta(), z); if (midtracks.size() > 0 && retrack.ambDegree() > 0) { registry.fill(HIST("Tracks/EtaZvtx_gt0"), track.eta(), z); @@ -866,7 +889,7 @@ struct PseudorapidityDensityMFT { if (!disableITSROFCut && !collision.selection_bit(aod::evsel::kNoITSROFrameBorder)) { return; } - if (!useEvSel || (useEvSel && collision.selection_bit(aod::evsel::kIsTriggerTVX) && collision.selection_bit(aod::evsel::kNoTimeFrameBorder))) { + if (!useEvSel || (useEvSel && collision.selection_bit(aod::evsel::kIsTriggerTVX) && collision.selection_bit(aod::evsel::kNoTimeFrameBorder) && collision.selection_bit(aod::evsel::kNoSameBunchPileup))) { atLeastOne = true; auto perCollisionSample = sample->sliceByCached( o2::aod::fwdtrack::collisionId, collision.globalIndex(), cache); @@ -912,7 +935,13 @@ struct PseudorapidityDensityMFT { if (std::abs(charge) < 3.) { continue; } - if (cfgnEta1 < particle.eta() && particle.eta() < cfgnEta2) { + float phi = particle.phi(); + o2::math_utils::bringTo02Pi(phi); + if (usePhiCut) { + if ((phi <= 0.02) || ((phi >= 3.10) && (phi <= 3.23)) || (phi >= 6.21)) + continue; + } + if (cfgnEta1 < particle.eta() && particle.eta() < cfgnEta2 && (phi > cfgPhiCut1 && phi < cfgPhiCut2)) { registry.fill(HIST("TracksEtaZvtxGen_t"), particle.eta(), mcCollision.posZ()); if (perCollisionMCSampleCentral.size() > 0) { From c3ea4409e1c27ddc8651a173b4278d50e060549e Mon Sep 17 00:00:00 2001 From: Gyula Bencedi Date: Fri, 25 Jul 2025 08:01:53 +0200 Subject: [PATCH 058/345] [PWGLF] Added configurable for event selection (#12235) --- PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx b/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx index 6baa84ee4ea..d61047e6a76 100644 --- a/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx +++ b/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx @@ -114,6 +114,8 @@ struct DndetaMFTPbPb { Configurable maxZvtxDiff{ "maxZvtxDiff", 1.0f, "max allowed Z vtx difference for reconstruced collisions (cm)"}; + Configurable requireIsGoodZvtxFT0VsPV{"requireIsGoodZvtxFT0VsPV", true, "require events with PV position along z consistent (within 1 cm) between PV reconstructed using tracks and PV using FT0 A-C time difference"}; + Configurable requireRejectSameBunchPileup{"requireRejectSameBunchPileup", true, "reject collisions in case of pileup with another collision in the same foundBC"}; Configurable requireNoCollInTimeRangeStrict{"requireNoCollInTimeRangeStrict", true, " requireNoCollInTimeRangeStrict"}; Configurable requireNoCollInRofStrict{"requireNoCollInRofStrict", true, "requireNoCollInRofStrict"}; Configurable requireNoCollInRofStandard{"requireNoCollInRofStandard", false, "requireNoCollInRofStandard"}; @@ -942,13 +944,13 @@ struct DndetaMFTPbPb { if constexpr (fillHis) { registry.fill(HIST("hEvtSel"), 1); } - if (!collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { + if (eventCuts.requireIsGoodZvtxFT0VsPV && !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { return false; } if constexpr (fillHis) { registry.fill(HIST("hEvtSel"), 2); } - if (!collision.selection_bit(aod::evsel::kNoSameBunchPileup)) { + if (eventCuts.requireRejectSameBunchPileup && !collision.selection_bit(aod::evsel::kNoSameBunchPileup)) { return false; } if constexpr (fillHis) { From 596b3ce54b77bac7e0c90ea2d37ac42c3b13b57c Mon Sep 17 00:00:00 2001 From: samrangy Date: Fri, 25 Jul 2025 09:23:15 +0200 Subject: [PATCH 059/345] [PWGHF] D0 reflection removal (#11926) --- .../HFC/TableProducer/correlatorD0Hadrons.cxx | 11 +++--- PWGHF/HFC/Tasks/taskCorrelationD0Hadrons.cxx | 34 +++++++++---------- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx index 98a3e1ece81..afe123a2386 100644 --- a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx @@ -282,6 +282,7 @@ struct HfCorrelatorD0Hadrons { AxisSpec axisTrkCount = {5, 0., 5.}; AxisSpec axisBdtScoreBkg = {100, 0., 1., "Bdt score background"}; AxisSpec axisBdtScorePrompt = {100, 0., 1., "Bdt score prompt"}; + AxisSpec axisOrigin = {10, 0., 10., "Candidate origin"}; // Histograms for Data registry.add("hPtCand", "D0, D0bar candidates", {HistType::kTH1F, {axisPtD}}); @@ -297,7 +298,7 @@ struct HfCorrelatorD0Hadrons { registry.add("hMass1D", "D0, D0bar candidates mass", {HistType::kTH1F, {axisMassD}}); registry.add("hMassD01D", "D0 candidates mass", {HistType::kTH1F, {axisMassD}}); registry.add("hMassD0bar1D", "D0bar candidates mass", {HistType::kTH1F, {axisMassD}}); - registry.add("hMLScoresVsMassVsPt", "D0, D0bar candidates massVsPt", {HistType::kTHnSparseD, {{axisBdtScoreBkg}, {axisBdtScorePrompt}, {axisMassD}, {axisPtD}}}); + registry.add("hMLScoresVsMassVsPtVsOrigin", "D0, D0bar candidates massVsPt", {HistType::kTHnSparseD, {{axisBdtScoreBkg}, {axisBdtScorePrompt}, {axisMassD}, {axisPtD}, {axisOrigin}}}); // Histograms for MC Reco registry.add("hPtCandRec", "D0, D0bar candidates - MC reco", {HistType::kTH1F, {axisPtD}}); registry.add("hPtProng0Rec", "D0, D0bar candidates prong 0 - MC reco", {HistType::kTH1F, {axisPtD}}); @@ -313,8 +314,8 @@ struct HfCorrelatorD0Hadrons { registry.add("hMassD0barRecSig", "D0bar signal candidates massVsPt - MC reco", {HistType::kTH2F, {{axisMassD}, {axisPtD}}}); registry.add("hMassD0barRecRef", "D0bar reflection candidates massVsPt - MC reco", {HistType::kTH2F, {{axisMassD}, {axisPtD}}}); registry.add("hMassD0barRecBg", "D0bar background candidates massVsPt - MC reco", {HistType::kTH2F, {{axisMassD}, {axisPtD}}}); - registry.add("hPtCandRecSigPrompt", "D+,Hadron candidates Prompt - MC Reco", {HistType::kTH1F, {axisPtD}}); - registry.add("hPtCandRecSigNonPrompt", "D+,Hadron candidates Non Prompt - MC Reco", {HistType::kTH1F, {axisPtD}}); + registry.add("hPtCandRecSigPrompt", "D0,Hadron candidates Prompt - MC Reco", {HistType::kTH1F, {axisPtD}}); + registry.add("hPtCandRecSigNonPrompt", "D0,Hadron candidates Non Prompt - MC Reco", {HistType::kTH1F, {axisPtD}}); registry.add("hPtVsMultiplicityRecPrompt", "Multiplicity FT0M - MC Rec Prompt", {HistType::kTH2F, {{axisPtD}, {axisMultFT0M}}}); registry.add("hPtVsMultiplicityRecNonPrompt", "Multiplicity FT0M - MC Rec Non Prompt", {HistType::kTH2F, {{axisPtD}, {axisMultFT0M}}}); registry.add("hPtParticleAssocVsCandRec", "Associated Particle - MC reco", {HistType::kTH2F, {{axisPtHadron}, {axisPtD}}}); @@ -406,7 +407,7 @@ struct HfCorrelatorD0Hadrons { for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMlD0[iclass] = candidate.mlProbD0()[classMl->at(iclass)]; } - registry.fill(HIST("hMLScoresVsMassVsPt"), outputMlD0[0], outputMlD0[2], hfHelper.invMassD0ToPiK(candidate), candidate.pt()); + registry.fill(HIST("hMLScoresVsMassVsPtVsOrigin"), outputMlD0[0], outputMlD0[2], hfHelper.invMassD0ToPiK(candidate), candidate.pt(), candidate.isSelD0bar() ? o2::aod::hf_correlation_d0_hadron::D0D0barBoth : o2::aod::hf_correlation_d0_hadron::D0Only); } if (candidate.isSelD0bar() >= selectionFlagD0bar) { registry.fill(HIST("hMass"), hfHelper.invMassD0barToKPi(candidate), candidate.pt(), efficiencyWeight); @@ -415,7 +416,7 @@ struct HfCorrelatorD0Hadrons { for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMlD0bar[iclass] = candidate.mlProbD0bar()[classMl->at(iclass)]; } - registry.fill(HIST("hMLScoresVsMassVsPt"), outputMlD0bar[0], outputMlD0bar[2], hfHelper.invMassD0barToKPi(candidate), candidate.pt()); + registry.fill(HIST("hMLScoresVsMassVsPtVsOrigin"), outputMlD0bar[0], outputMlD0bar[2], hfHelper.invMassD0barToKPi(candidate), candidate.pt(), candidate.isSelD0() ? o2::aod::hf_correlation_d0_hadron::D0D0barBoth : o2::aod::hf_correlation_d0_hadron::D0barOnly); } entryD0CandRecoInfo(hfHelper.invMassD0ToPiK(candidate), hfHelper.invMassD0barToKPi(candidate), candidate.pt(), outputMlD0[0], outputMlD0[2], outputMlD0bar[0], outputMlD0bar[2]); diff --git a/PWGHF/HFC/Tasks/taskCorrelationD0Hadrons.cxx b/PWGHF/HFC/Tasks/taskCorrelationD0Hadrons.cxx index 44fa0e0635b..a7eead5aeb3 100644 --- a/PWGHF/HFC/Tasks/taskCorrelationD0Hadrons.cxx +++ b/PWGHF/HFC/Tasks/taskCorrelationD0Hadrons.cxx @@ -386,7 +386,7 @@ struct HfTaskCorrelationD0Hadrons { } } // check if correlation entry belongs to signal region, sidebands or is outside both, and fill correlation plots - if ((massD > signalRegionLeft->at(ptBinD) && massD < signalRegionRight->at(ptBinD)) && ((signalStatus == ParticleTypeData::D0Only) || (signalStatus == ParticleTypeData::D0D0barBoth))) { + if ((massD > signalRegionLeft->at(ptBinD) && massD < signalRegionRight->at(ptBinD)) && (signalStatus == ParticleTypeData::D0Only)) { // in signal region registry.fill(HIST("hCorrel2DVsPtSignalRegion"), deltaPhi, deltaEta, ptD, ptHadron, poolBin, efficiencyWeight); registry.fill(HIST("hCorrel2DPtIntSignalRegion"), deltaPhi, deltaEta, efficiencyWeight); @@ -394,7 +394,7 @@ struct HfTaskCorrelationD0Hadrons { registry.fill(HIST("hDeltaPhiPtIntSignalRegion"), deltaPhi, efficiencyWeight); } - if ((massD > signalRegionLeft->at(ptBinD) && massD < signalRegionRight->at(ptBinD)) && ((signalStatus == ParticleTypeData::D0OnlySoftPi) || (signalStatus >= ParticleTypeData::D0D0barBothSoftPi))) { + if ((massD > signalRegionLeft->at(ptBinD) && massD < signalRegionRight->at(ptBinD)) && (signalStatus == ParticleTypeData::D0OnlySoftPi)) { // in signal region, fills for soft pion only in ME registry.fill(HIST("hCorrel2DVsPtSignalRegionSoftPi"), deltaPhi, deltaEta, ptD, ptHadron, poolBin, efficiencyWeight); registry.fill(HIST("hCorrel2DPtIntSignalRegionSoftPi"), deltaPhi, deltaEta, efficiencyWeight); @@ -402,7 +402,7 @@ struct HfTaskCorrelationD0Hadrons { registry.fill(HIST("hDeltaPhiPtIntSignalRegionSoftPi"), deltaPhi, efficiencyWeight); } - if ((massDbar > signalRegionLeft->at(ptBinD) && massDbar < signalRegionRight->at(ptBinD)) && ((signalStatus == ParticleTypeData::D0barOnly) || (signalStatus == ParticleTypeData::D0D0barBoth))) { + if ((massDbar > signalRegionLeft->at(ptBinD) && massDbar < signalRegionRight->at(ptBinD)) && (signalStatus == ParticleTypeData::D0barOnly)) { // in signal region registry.fill(HIST("hCorrel2DVsPtSignalRegion"), deltaPhi, deltaEta, ptD, ptHadron, poolBin, efficiencyWeight); registry.fill(HIST("hCorrel2DPtIntSignalRegion"), deltaPhi, deltaEta, efficiencyWeight); @@ -420,7 +420,7 @@ struct HfTaskCorrelationD0Hadrons { if (((massD > sidebandLeftOuter->at(ptBinD) && massD < sidebandLeftInner->at(ptBinD)) || (massD > sidebandRightInner->at(ptBinD) && massD < sidebandRightOuter->at(ptBinD))) && - ((signalStatus == ParticleTypeData::D0Only) || (signalStatus == ParticleTypeData::D0D0barBoth))) { + (signalStatus == ParticleTypeData::D0Only)) { // in sideband region registry.fill(HIST("hCorrel2DVsPtSidebands"), deltaPhi, deltaEta, ptD, ptHadron, poolBin, efficiencyWeight); registry.fill(HIST("hCorrel2DPtIntSidebands"), deltaPhi, deltaEta, efficiencyWeight); @@ -430,7 +430,7 @@ struct HfTaskCorrelationD0Hadrons { if (((massD > sidebandLeftOuter->at(ptBinD) && massD < sidebandLeftInner->at(ptBinD)) || (massD > sidebandRightInner->at(ptBinD) && massD < sidebandRightOuter->at(ptBinD))) && - ((signalStatus == ParticleTypeData::D0OnlySoftPi) || (signalStatus >= ParticleTypeData::D0D0barBothSoftPi))) { + (signalStatus == ParticleTypeData::D0OnlySoftPi)) { // in sideband region, fills for soft pion only in ME registry.fill(HIST("hCorrel2DVsPtSidebandsSoftPi"), deltaPhi, deltaEta, ptD, ptHadron, poolBin, efficiencyWeight); registry.fill(HIST("hCorrel2DPtIntSidebandsSoftPi"), deltaPhi, deltaEta, efficiencyWeight); @@ -440,7 +440,7 @@ struct HfTaskCorrelationD0Hadrons { if (((massDbar > sidebandLeftOuter->at(ptBinD) && massDbar < sidebandLeftInner->at(ptBinD)) || (massDbar > sidebandRightInner->at(ptBinD) && massDbar < sidebandRightOuter->at(ptBinD))) && - ((signalStatus == ParticleTypeData::D0barOnly) || (signalStatus == ParticleTypeData::D0D0barBoth))) { + (signalStatus == ParticleTypeData::D0barOnly)) { // in sideband region registry.fill(HIST("hCorrel2DVsPtSidebands"), deltaPhi, deltaEta, ptD, ptHadron, poolBin, efficiencyWeight); registry.fill(HIST("hCorrel2DPtIntSidebands"), deltaPhi, deltaEta, efficiencyWeight); @@ -503,7 +503,7 @@ struct HfTaskCorrelationD0Hadrons { float bdtScorePromptD0bar = pairEntry.mlScorePromptD0bar(); float bdtScoreBkgD0bar = pairEntry.mlScoreBkgD0bar(); bool isPhysicalPrimary = pairEntry.isPhysicalPrimary(); - int statusD0Prompt = static_cast(pairEntry.isPrompt()); + bool isD0Prompt = pairEntry.isPrompt(); int statusPromptHadron = pairEntry.trackOrigin(); if (bdtScorePromptD0 < mlOutputPromptD0->at(ptBinD) || bdtScoreBkgD0 > mlOutputBkgD0->at(ptBinD) || @@ -550,15 +550,15 @@ struct HfTaskCorrelationD0Hadrons { // ---------------------- Fill plots for signal case, D0 ->1, D0bar ->8 --------------------------------------------- if ((massD > signalRegionLeft->at(ptBinD) && massD < signalRegionRight->at(ptBinD)) && (TESTBIT(signalStatus, ParticleTypeMcRec::D0Sig))) { // in signal region, tests bit ParticleTypeMcRec::D0Sig, SE-> softpi removed, ME-> inclusive - registry.fill(HIST("hCorrel2DVsPtSignalRegionRecSig"), deltaPhi, deltaEta, ptD, ptHadron, statusD0Prompt, poolBin, efficiencyWeight); + registry.fill(HIST("hCorrel2DVsPtSignalRegionRecSig"), deltaPhi, deltaEta, ptD, ptHadron, static_cast(isD0Prompt), poolBin, efficiencyWeight); registry.fill(HIST("hCorrel2DPtIntSignalRegionRecSig"), deltaPhi, deltaEta, efficiencyWeight); registry.fill(HIST("hDeltaEtaPtIntSignalRegionRecSig"), deltaEta, efficiencyWeight); registry.fill(HIST("hDeltaPhiPtIntSignalRegionRecSig"), deltaPhi, efficiencyWeight); if (isPhysicalPrimary) { - registry.fill(HIST("hCorrel2DVsPtPhysicalPrimaryRecSig"), deltaPhi, deltaEta, ptD, ptHadron, statusD0Prompt, poolBin, efficiencyWeight); - if (statusD0Prompt == 1 && statusPromptHadron == 1) { + registry.fill(HIST("hCorrel2DVsPtPhysicalPrimaryRecSig"), deltaPhi, deltaEta, ptD, ptHadron, static_cast(isD0Prompt), poolBin, efficiencyWeight); + if (isD0Prompt && statusPromptHadron == RecoDecay::OriginType::Prompt) { registry.fill(HIST("hCorrel2DVsPtSignalRegionPromptD0PromptHadronRecSig"), deltaPhi, deltaEta, ptD, ptHadron, poolBin, efficiencyWeight); - } else if (statusD0Prompt == 0 && statusPromptHadron == 2) { + } else if (!isD0Prompt && statusPromptHadron == RecoDecay::OriginType::NonPrompt) { registry.fill(HIST("hCorrel2DVsPtSignalRegionNonPromptD0NonPromptHadronRecSig"), deltaPhi, deltaEta, ptD, ptHadron, poolBin, efficiencyWeight); } } @@ -566,15 +566,15 @@ struct HfTaskCorrelationD0Hadrons { if ((massDbar > signalRegionLeft->at(ptBinD) && massDbar < signalRegionRight->at(ptBinD)) && (TESTBIT(signalStatus, ParticleTypeMcRec::D0barSig))) { // in signal region, tests bit ParticleTypeMcRec::D0barSig, SE-> softpi removed, ME-> inclusive - registry.fill(HIST("hCorrel2DVsPtSignalRegionRecSig"), deltaPhi, deltaEta, ptD, ptHadron, statusD0Prompt, poolBin, efficiencyWeight); + registry.fill(HIST("hCorrel2DVsPtSignalRegionRecSig"), deltaPhi, deltaEta, ptD, ptHadron, static_cast(isD0Prompt), poolBin, efficiencyWeight); registry.fill(HIST("hCorrel2DPtIntSignalRegionRecSig"), deltaPhi, deltaEta, efficiencyWeight); registry.fill(HIST("hDeltaEtaPtIntSignalRegionRecSig"), deltaEta, efficiencyWeight); registry.fill(HIST("hDeltaPhiPtIntSignalRegionRecSig"), deltaPhi, efficiencyWeight); if (isPhysicalPrimary) { - registry.fill(HIST("hCorrel2DVsPtPhysicalPrimaryRecSig"), deltaPhi, deltaEta, ptD, ptHadron, statusD0Prompt, poolBin, efficiencyWeight); - if (statusD0Prompt == 1 && statusPromptHadron == 1) { + registry.fill(HIST("hCorrel2DVsPtPhysicalPrimaryRecSig"), deltaPhi, deltaEta, ptD, ptHadron, static_cast(isD0Prompt), poolBin, efficiencyWeight); + if (isD0Prompt && statusPromptHadron == RecoDecay::OriginType::Prompt) { registry.fill(HIST("hCorrel2DVsPtSignalRegionPromptD0PromptHadronRecSig"), deltaPhi, deltaEta, ptD, ptHadron, poolBin, efficiencyWeight); - } else if (statusD0Prompt == 0 && statusPromptHadron == 2) { + } else if (!isD0Prompt && statusPromptHadron == RecoDecay::OriginType::NonPrompt) { registry.fill(HIST("hCorrel2DVsPtSignalRegionNonPromptD0NonPromptHadronRecSig"), deltaPhi, deltaEta, ptD, ptHadron, poolBin, efficiencyWeight); } } @@ -772,12 +772,12 @@ struct HfTaskCorrelationD0Hadrons { } if (isD0Prompt) { registry.fill(HIST("hCorrel2DVsPtGenPrompt"), deltaPhi, deltaEta, ptD, ptHadron, poolBin); - if (statusPromptHadron == 1) { + if (statusPromptHadron == RecoDecay::OriginType::Prompt) { registry.fill(HIST("hCorrel2DVsPtGenPromptD0PromptHadron"), deltaPhi, deltaEta, ptD, ptHadron, poolBin); } } else { registry.fill(HIST("hCorrel2DVsPtGenNonPrompt"), deltaPhi, deltaEta, ptD, ptHadron, poolBin); - if (statusPromptHadron == 2) { + if (statusPromptHadron == RecoDecay::OriginType::NonPrompt) { registry.fill(HIST("hCorrel2DVsPtGenNonPromptD0NonPromptHadron"), deltaPhi, deltaEta, ptD, ptHadron, poolBin); } } From 3187175ba7fb8ced0232a270bb7cc1858d7a6c47 Mon Sep 17 00:00:00 2001 From: Anantha Padmanabhan M Nair <82643666+ananthapadmanabhan18@users.noreply.github.com> Date: Fri, 25 Jul 2025 13:44:36 +0530 Subject: [PATCH 060/345] [PWGUD] Removed filters for Event and track counts (#12146) --- PWGUD/Tasks/exclusiveRhoTo4Pi.cxx | 370 +++++++++++++++++++++++------- 1 file changed, 286 insertions(+), 84 deletions(-) diff --git a/PWGUD/Tasks/exclusiveRhoTo4Pi.cxx b/PWGUD/Tasks/exclusiveRhoTo4Pi.cxx index bd1811a0c56..b12b4d2a228 100644 --- a/PWGUD/Tasks/exclusiveRhoTo4Pi.cxx +++ b/PWGUD/Tasks/exclusiveRhoTo4Pi.cxx @@ -50,6 +50,8 @@ namespace branch { // Run Number DECLARE_SOA_COLUMN(RunNumber, runNumber, int); +// Check UPC mode +DECLARE_SOA_COLUMN(IfCheckUPCmode, ifCheckUPCmode, uint16_t); // vertex Position DECLARE_SOA_COLUMN(PosX, posX, double); DECLARE_SOA_COLUMN(PosY, posY, double); @@ -159,6 +161,8 @@ DECLARE_SOA_COLUMN(FourPionCosThetaPair2, fourPionCosThetaPair2, double); DECLARE_SOA_TABLE(SignalData, "AOD", "signalData", branch::RunNumber, + branch::IfCheckUPCmode, + branch::PosX, branch::PosY, branch::PosZ, @@ -263,6 +267,9 @@ DECLARE_SOA_TABLE(SignalData, "AOD", "signalData", DECLARE_SOA_TABLE(BkgroundData, "AOD", "bkgroundData", branch::RunNumber, + + branch::IfCheckUPCmode, + branch::PosX, branch::PosY, branch::PosZ, @@ -374,30 +381,50 @@ struct ExclusiveRhoTo4Pi { Produces bkgFromData; // Histogram Registry HistogramRegistry histosData{"histosData", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - // Configurable parameters + // Configurable Event parameters + Configurable ifCheckUPCmode{"ifCheckUPCmode", false, "Enable UPC reconstruction only"}; Configurable vZCut{"vZCut", 10., "Vertex Cut"}; Configurable fv0Cut{"fv0Cut", 50., "FV0A threshold"}; Configurable ft0aCut{"ft0aCut", 150., "FT0A threshold"}; Configurable ft0cCut{"ft0cCut", 50., "FT0C threshold"}; Configurable zdcCut{"zdcCut", 0., "ZDC threshold"}; - Configurable occupancyCut{"occupancyCut", 20000, "Occupancy Cut"}; Configurable numPVContrib{"numPVContrib", 4, "Number of PV Contributors"}; + Configurable gapSideCut{"gapSideCut", 2, "Gap Side"}; Configurable sbpCut{"sbpCut", 1, "Sbp"}; Configurable itsROFbCut{"itsROFbCut", 1, "itsROFbCut"}; Configurable vtxITSTPCcut{"vtxITSTPCcut", 1, "vtxITSTPCcut"}; Configurable tfbCut{"tfbCut", 1, "tfbCut"}; - Configurable pvCut{"pvCut", 1.0, "Use Only PV tracks"}; - Configurable dcaZcut{"dcaZcut", 2, "dcaZ cut"}; - Configurable dcaXYcut{"dcaXYcut", 0, "dcaXY cut"}; - Configurable tpcChi2Cut{"tpcChi2Cut", 4, "Max tpcChi2NCl"}; - Configurable tpcNClsFindableCut{"tpcNClsFindableCut", 70, "Min tpcNClsFindable"}; - Configurable itsChi2Cut{"itsChi2Cut", 36, "Max itsChi2NCl"}; + // track Selection mode + Configurable trackSelectionMode{"trackSelectionMode", 0, "Different modes of track selection"}; + // Configurable Track parameters common to mode 0 and 1 + Configurable useOnlyPVtracks{"useOnlyPVtracks", true, "Use Only PV tracks"}; + Configurable useITS{"useITS", true, "only use tracks with hit in ITS"}; + Configurable useTPC{"useTPC", true, "has TPC hit"}; + Configurable tpcNClsFindableCut{"tpcNClsFindableCut", 70, "Min TPC Findable Clusters"}; + Configurable pTcut{"pTcut", 0.1, "Track Pt"}; + Configurable dcaZcut{"dcaZcut", 1, "dcaZ cut"}; Configurable etaCut{"etaCut", 0.9, "Track Pseudorapidity"}; - Configurable pTcut{"pTcut", 0.15, "Track Pt"}; + // Configurable Track parameters for mode 0 only + Configurable itsNClsCut{"itsNClsCut", 4, "Min No of itsNCls"}; + Configurable itsClusterMapCut{"itsClusterMapCut", 1, "min no of ITS clusters in cluster map"}; + Configurable itsChi2NClCut{"itsChi2NClCut", 3.0, "Max ITS Chi2/NCl"}; + Configurable minFoundTPCclusters{"minFoundTPCclusters", 120, "Min TPC Findable Clusters"}; + Configurable tpcChi2NClsMin{"tpcChi2NClsMin", 1.0, "Min TPC Chi2/NCls"}; + Configurable tpcChi2NClsMax{"tpcChi2NClsMax", 3.0, "Max TPC Chi2/NCls"}; + Configurable tpcNClsCrossedRowsCut{"tpcNClsCrossedRowsCut", 130, "Min TPC Crossed Rows"}; + Configurable tpcCrossedRowsOverFindableCut{"tpcCrossedRowsOverFindableCut", 1.0, "Min TPC Crossed Rows over Findable Clusters"}; + // Configurable Track parameters for mode: 1 only + Configurable itsChi2Cut{"itsChi2Cut", 36, "ITS Chi2"}; + Configurable tpcChi2Cut{"tpcChi2Cut", 4.0, "TPC Chi2"}; + // Configurable PID parameters + Configurable useTOF{"useTOF", true, "has TOF for PID"}; Configurable nSigmaTPCcut{"nSigmaTPCcut", 3, "TPC cut"}; Configurable nSigmaTOFcut{"nSigmaTOFcut", 3, "TOF cut"}; + // Configurable Rho parameters Configurable rhoRapCut{"rhoRapCut", 0.5, "Max abs Rapidity of rho"}; Configurable rhoPtCut{"rhoPtCut", 0.15, "Min Pt of rho"}; + Configurable rhoMassMin{"rhoMassMin", 1, "Min Mass of rho"}; + Configurable rhoMassMax{"rhoMassMax", 2.5, "Max Mass of rho"}; // Axis Configurations ConfigurableAxis pTAxis{"pTAxis", {1000, 0, 2}, "Axis for pT histograms"}; ConfigurableAxis etaAxis{"etaAxis", {1000, -1.1, 1.1}, "Axis for Eta histograms"}; @@ -408,9 +435,9 @@ struct ExclusiveRhoTo4Pi { void init(InitContext const&) { - // QA plots: Event Counter - histosData.add("EventsCounts_vs_runNo", "Number of Selected 4-Pion Events per Run; Run Number; Number of Events", kTH2F, {{1355, 544013, 545367}, {10, 0, 10}}); + histosData.add("EventsCounts_vs_runNo", "Number of Selected 4-Pion Events per Run; Run Number; Number of Events", kTH2F, {{1355, 544013, 545367}, {21, -1, 20}}); + histosData.add("TracksCounts_vs_runNo", "Number of Selected Tracks per Run; Run Number; Number of Tracks", kTH2F, {{1355, 544013, 545367}, {20, 0, 20}}); // QA plots: event selection histosData.add("FT0A", "T0A amplitude", kTH1F, {{2000, 0.0, 500.0}}); histosData.add("FT0C", "T0C amplitude", kTH1F, {{2000, 0.0, 500.0}}); @@ -431,6 +458,7 @@ struct ExclusiveRhoTo4Pi { histosData.add("tpcChi2NCl", "TPC Chi2/NCl; Chi2/NCl; Counts", kTH1F, {{250, 0, 50}}); histosData.add("itsChi2NCl", "ITS Chi2/NCl; Chi2/NCl; Counts", kTH1F, {{250, 0, 50}}); histosData.add("tpcNClsFindable", "TPC N Cls Findable; N Cls Findable; Counts", kTH1F, {{200, 0, 200}}); + histosData.add("itsClusterMap", "ITS Cluster Map; itsClusterMap; Counts", kTH1F, {{200, 0, 200}}); // QA plots: PID histosData.add("tpcSignal", "TPC dEdx vs p; p [GeV/c]; dEdx [a.u.]", kTH2F, {{500, 0, 10}, {5000, 0.0, 5000.0}}); histosData.add("tpcSignal_pions", "TPC dEdx vs p for pions; p [GeV/c]; dEdx [a.u.]", kTH2F, {{500, 0, 10}, {5000, 0.0, 5000.0}}); @@ -448,17 +476,6 @@ struct ExclusiveRhoTo4Pi { histosData.add("tofNSigmaPr_pions", "TOF nSigma Proton with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); histosData.add("tofNSigmaEl_pions", "TOF nSigma Electron with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); histosData.add("tofNSigmaMu_pions", "TOF nSigma Muon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); - // QA averages - histosData.add("avg_pT_pi_vs_runNo", "Average pion p_{T} vs run number; Run Number; p_{T} [GeV/c]", kTH2F, {{1355, 544013, 545367}, {1000, -0.1, 2}}); - histosData.add("avg_eta_pi_vs_runNo", "Average pion #eta vs run number; Run Number; #eta", kTH2F, {{1355, 544013, 545367}, {etaAxis}}); - histosData.add("avg_phi_pi_vs_runNo", "Average pion #phi vs run number; Run Number; #phi [rad]", kTH2F, {{1355, 544013, 545367}, {1000, -1 * o2::constants::math::PI, o2::constants::math::PI}}); - histosData.add("avg_dcaxy_vs_runNo", "Average pion DCA XY vs run number; Run Number; DCA XY [cm]", kTH2F, {{1355, 544013, 545367}, {1000, -0.2, 0.2}}); - histosData.add("avg_dcaz_vs_runNo", "Average pion DCA Z vs run number; Run Number; DCA Z [cm]", kTH2F, {{1355, 544013, 545367}, {1000, -0.2, 0.2}}); - histosData.add("avg_pT_pi_vs_runNo_selected4piEvents", "Average pion p_{T} vs run number; Run Number; p_{T} [GeV/c]", kTH2F, {{1355, 544013, 545367}, {1000, -0.1, 2}}); - histosData.add("avg_eta_pi_vs_runNo_selected4piEvents", "Average pion #eta vs run number; Run Number; #eta", kTH2F, {{1355, 544013, 545367}, {etaAxis}}); - histosData.add("avg_phi_pi_vs_runNo_selected4piEvents", "Average pion #phi vs run number; Run Number; #phi [rad]", kTH2F, {{1355, 544013, 545367}, {1000, -1 * o2::constants::math::PI, o2::constants::math::PI}}); - histosData.add("avg_dcaxy_vs_runNo_selected4piEvents", "Average pion DCA XY vs run number; Run Number; DCA XY [cm]", kTH2F, {{1355, 544013, 545367}, {1000, -0.2, 0.2}}); - histosData.add("avg_dcaz_vs_runNo_selected4piEvents", "Average pion DCA Z vs run number; Run Number; DCA Z [cm]", kTH2F, {{1355, 544013, 545367}, {1000, -0.2, 0.2}}); // Track Transverse Momentum histosData.add("pT_track_all", "pT with track selection; pT [GeV/c]; Counts", kTH1F, {pTAxis}); histosData.add("pT_track_pions", "pT with track selection and PID selection of Pi; pT [GeV/c]; Events", kTH1F, {pTAxis}); @@ -528,30 +545,89 @@ struct ExclusiveRhoTo4Pi { histosData.add("phi_vs_costheta_large_mass", "Phi vs cosTheta for large mass; #phi; cos(#theta)", kTH2F, {phiAxis, cosThetaAxis}); } // End of init function - //--------------------------------------------------------------------------------------------------------------------------------------------- - Filter vertexCut = (nabs(o2::aod::collision::posZ) <= vZCut) && (o2::aod::collision::numContrib == numPVContrib); - Filter fitcuts = o2::aod::udcollision::totalFV0AmplitudeA < fv0Cut && o2::aod::udcollision::totalFT0AmplitudeA < ft0aCut && o2::aod::udcollision::totalFT0AmplitudeC < ft0cCut; - Filter zdcCuts = (o2::aod::udzdc::energyCommonZNA < zdcCut) && (o2::aod::udzdc::energyCommonZNC < zdcCut); - Filter bcSelectionCuts = (o2::aod::udcollision::sbp == sbpCut) && (o2::aod::udcollision::itsROFb == itsROFbCut) && (o2::aod::udcollision::vtxITSTPC == vtxITSTPCcut) && (o2::aod::udcollision::tfb == tfbCut); - Filter occupCut = nabs(o2::aod::udcollision::occupancyInTime) < occupancyCut; - Filter onlyPVtracks = o2::aod::udtrack::isPVContributor == true; - //--------------------------------------------------------------------------------------------------------------------------------------------- - - using UDtracks = soa::Filtered>; - using UDCollisions = soa::Filtered>; + using UDtracks = soa::Join; + using UDCollisions = soa::Join; void processData(UDCollisions::iterator const& collision, UDtracks const& tracks) { - histosData.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 0); + // no cuts + histosData.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), -1); - int gapSide = collision.gapSide(); - std::vector parameters = {pvCut, dcaZcut, dcaXYcut, tpcChi2Cut, tpcNClsFindableCut, itsChi2Cut, etaCut, pTcut}; - int truegapSide = sgSelector.trueGap(collision, fv0Cut, ft0aCut, ft0cCut, zdcCut); + // Check if the event is in UPC mode + if (ifCheckUPCmode && (collision.flags() != 1)) { + return; + } + histosData.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 0); - histosData.fill(HIST("GapSide"), gapSide); - histosData.fill(HIST("TrueGapSide"), truegapSide); + // FTOA + if (!(collision.totalFT0AmplitudeA() <= ft0aCut)) { + return; + } histosData.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 1); + + // FT0C + if (!(collision.totalFT0AmplitudeC() <= ft0cCut)) { + return; + } + histosData.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 2); + + // FV0 + if (!(collision.totalFV0AmplitudeA() <= fv0Cut)) { + return; + } + histosData.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 3); + + // noSamebunchPileup + if (collision.sbp() != sbpCut) { + return; + } + histosData.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 4); + + // kIsVertexITSTPC + if (collision.vtxITSTPC() != vtxITSTPCcut) { + return; + } + histosData.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 5); + + // kNoITSROFrameBorder + if (collision.itsROFb() != itsROFbCut) { + return; + } + histosData.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 6); + + // kNoTimeFrameBorder + if (collision.tfb() != tfbCut) { + return; + } + histosData.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 7); + + // ZDC + if (!(collision.energyCommonZNA() <= zdcCut || collision.energyCommonZNC() <= zdcCut)) { + return; + } + histosData.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 8); + + // Vertex Z cut + if (!(std::abs(collision.posZ()) <= vZCut)) { + return; + } + histosData.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 9); + + // true Gap Side + if (sgSelector.trueGap(collision, fv0Cut, ft0aCut, ft0cCut, zdcCut) != gapSideCut) { + return; + } + histosData.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 10); + + // number of PV contributors + if (!(collision.numContrib() == numPVContrib)) { + return; + } + histosData.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 11); + + histosData.fill(HIST("GapSide"), collision.gapSide()); + histosData.fill(HIST("TrueGapSide"), sgSelector.trueGap(collision, fv0Cut, ft0aCut, ft0cCut, zdcCut)); histosData.fill(HIST("vertexX"), collision.posX()); histosData.fill(HIST("vertexY"), collision.posY()); histosData.fill(HIST("vertexZ"), collision.posZ()); @@ -567,41 +643,163 @@ struct ExclusiveRhoTo4Pi { std::vector selectedPionPlusTracks; std::vector selectedPionMinusTracks; - double avgpT = 0.0; - double avgEta = 0.0; - double avgPhi = 0.0; - double avgdcaxy = 0.0; - double avgdcaz = 0.0; - for (const auto& t0 : tracks) { ROOT::Math::PxPyPzMVector trackVector(t0.px(), t0.py(), t0.pz(), o2::constants::physics::MassPionCharged); - avgpT += trackVector.Pt(); - avgEta += trackVector.Eta(); - avgPhi += trackVector.Phi(); - avgdcaxy += t0.dcaXY(); - avgdcaz += t0.dcaZ(); - - if (trackselector(t0, parameters)) { - selectedTracks.push_back(t0); - if (selectionPIDPion(t0, true, nSigmaTPCcut, nSigmaTOFcut)) { - selectedPionTracks.push_back(t0); - if (t0.sign() == 1) { - selectedPionPlusTracks.push_back(t0); - } - if (t0.sign() == -1) { - selectedPionMinusTracks.push_back(t0); - } - } // End of Selection PID Pion - } // End of track selections + // no Cuts + histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 0); - } // End of loop over tracks + if (trackSelectionMode == 0) { + + // is PV Contributor + if (!(t0.isPVContributor() == useOnlyPVtracks)) { + continue; + } + histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 1); - histosData.fill(HIST("avg_pT_pi_vs_runNo"), collision.runNumber(), avgpT / tracks.size()); - histosData.fill(HIST("avg_eta_pi_vs_runNo"), collision.runNumber(), avgEta / tracks.size()); - histosData.fill(HIST("avg_phi_pi_vs_runNo"), collision.runNumber(), avgPhi / tracks.size()); - histosData.fill(HIST("avg_dcaxy_vs_runNo"), collision.runNumber(), avgdcaxy / tracks.size()); - histosData.fill(HIST("avg_dcaz_vs_runNo"), collision.runNumber(), avgdcaz / tracks.size()); + // has ITS hit + if ((useITS == true) && (t0.hasITS() != true)) { + continue; + } + histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 2); + + // min no of itsNCls + if (t0.itsNCls() < itsNClsCut) { + continue; + } + histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 3); + + // min ITS chi2NCl + if (t0.itsChi2NCl() > itsChi2NClCut) { + continue; + } + histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 4); + + // has TPC hit + if ((useTPC == true) && (t0.hasTPC() != true)) { + continue; + } + histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 5); + + // min no of found TPC clusters + if (t0.tpcNClsFindable() - t0.tpcNClsFindableMinusFound() < minFoundTPCclusters) { + continue; + } + histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 6); + + // range of tpcChi2NCl + if (!((tpcChi2NClsMin < t0.tpcChi2NCl()) && (t0.tpcChi2NCl() < tpcChi2NClsMax))) { + continue; + } + histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 7); + + // tpcNClsCrossedRows + if (t0.tpcNClsCrossedRows() < tpcNClsCrossedRowsCut) { + continue; + } + histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 8); + + // ratio of crossed TPC rows over findable clusters + if ((t0.tpcNClsCrossedRows() / t0.tpcNClsFindable()) < tpcCrossedRowsOverFindableCut) { + continue; + } + histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 9); + + // pT cut + if (trackVector.Pt() < pTcut) { + continue; + } + histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 10); + + // dcaZ cut + if ((std::abs(t0.dcaZ()) > dcaZcut) || (t0.dcaXY() > getMaxDCAxy(trackVector.Pt()))) { + continue; + } + histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 11); + + // eta cut + if (std::abs(trackVector.Eta()) > etaCut) { + continue; + } + histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 12); + } // end of trackSelectionMode == 0 + + if (trackSelectionMode == 1) { + // is PV Contributor + if (!(t0.isPVContributor() == useOnlyPVtracks)) { + continue; + } + histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 1); + + // pT cut + if (trackVector.Pt() < pTcut) { + continue; + } + histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 2); + + // eta cut + if (std::abs(trackVector.Eta()) > etaCut) { + continue; + } + histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 3); + + // dcaZ cut + if ((std::abs(t0.dcaZ()) > dcaZcut)) { + continue; + } + histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 4); + + // dcaXY cut + if (std::abs(t0.dcaXY()) > getMaxDCAxy(trackVector.Pt())) { + continue; + } + histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 5); + + // has ITS hit + if ((useITS == true) && (t0.hasITS() != true)) { + continue; + } + histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 6); + + // has TPC hit + if ((useTPC == true) && (t0.hasTPC() != true)) { + continue; + } + histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 7); + + // ITS Chi2 Cut + if (t0.itsChi2NCl() > itsChi2Cut) { + continue; + } + histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 8); + + // TPC Chi2 Cut + if (t0.tpcChi2NCl() > tpcChi2Cut) { + continue; + } + histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 9); + + // TPC Clusters findable cut + if (t0.tpcNClsFindable() < tpcNClsFindableCut) { + continue; + } + histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 10); + } // end of trackSelectionMode == 1 + + selectedTracks.push_back(t0); + if (selectionPIDPion(t0, useTOF, nSigmaTPCcut, nSigmaTOFcut)) { + selectedPionTracks.push_back(t0); + histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 13); + if (t0.sign() == 1) { + selectedPionPlusTracks.push_back(t0); + histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 14); + } + if (t0.sign() == -1) { + selectedPionMinusTracks.push_back(t0); + histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 15); + } + } // End of Selection PID Pion + } // End of loop over tracks int numSelectedTracks = static_cast(selectedTracks.size()); int numSelectedPionTracks = static_cast(selectedPionTracks.size()); @@ -623,6 +821,7 @@ struct ExclusiveRhoTo4Pi { histosData.fill(HIST("tpcNClsFindable"), selectedTracks[i].tpcNClsFindable()); histosData.fill(HIST("dcaXY"), selectedTracks[i].dcaXY()); histosData.fill(HIST("dcaZ"), selectedTracks[i].dcaZ()); + histosData.fill(HIST("itsClusterMap"), selectedTracks[i].itsClusterMap()); } // End of loop over tracks with selection only for (int i = 0; i < numSelectedPionTracks; i++) { @@ -647,13 +846,13 @@ struct ExclusiveRhoTo4Pi { histosData.fill(HIST("dcaZ_pions"), selectedPionTracks[i].dcaZ()); } // End of loop over tracks with selection and PID of pions + // event should have exactly 4 pions if (numSelectedPionTracks != numFourPionTracks) { return; } + histosData.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 12); - histosData.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 2); - - // Check if there is at least one track with TOF in the selected events, otherwise return + // Check if there is at least one track with TOF in the selected events (for derived Data) bool hasAtleastOneTOF = false; for (int i = 0; i < numPiPlusTracks; i++) { if (selectedPionPlusTracks[i].hasTOF() == true) { @@ -662,12 +861,10 @@ struct ExclusiveRhoTo4Pi { } } - histosData.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 3); - // Selecting Events with net charge = 0 if (numPionMinusTracks == numPiMinus && numPiPlusTracks == numPiPlus) { - histosData.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 4); + histosData.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 13); ROOT::Math::PtEtaPhiMVector k1, k2, k3, k4, k1234, k13, k14, k23, k24; @@ -696,12 +893,6 @@ struct ExclusiveRhoTo4Pi { histosData.fill(HIST("rapidity_track_pions_contributed"), p3.Rapidity()); histosData.fill(HIST("rapidity_track_pions_contributed"), p4.Rapidity()); - histosData.fill(HIST("avg_pT_pi_vs_runNo_selected4piEvents"), collision.runNumber(), (p1.Pt() + p2.Pt() + p3.Pt() + p4.Pt()) / 4.0); - histosData.fill(HIST("avg_eta_pi_vs_runNo_selected4piEvents"), collision.runNumber(), (p1.Eta() + p2.Eta() + p3.Eta() + p4.Eta()) / 4.0); - histosData.fill(HIST("avg_phi_pi_vs_runNo_selected4piEvents"), collision.runNumber(), (p1.Phi() + p2.Phi() + p3.Phi() + p4.Phi()) / 4.0); - histosData.fill(HIST("avg_dcaxy_vs_runNo_selected4piEvents"), collision.runNumber(), (selectedPionPlusTracks[0].dcaXY() + selectedPionPlusTracks[1].dcaXY() + selectedPionMinusTracks[0].dcaXY() + selectedPionMinusTracks[1].dcaXY()) / 4.0); - histosData.fill(HIST("avg_dcaz_vs_runNo_selected4piEvents"), collision.runNumber(), (selectedPionPlusTracks[0].dcaZ() + selectedPionPlusTracks[1].dcaZ() + selectedPionMinusTracks[0].dcaZ() + selectedPionMinusTracks[1].dcaZ()) / 4.0); - k1.SetCoordinates(p1.Pt(), p1.Eta(), p1.Phi(), o2::constants::physics::MassPionCharged); k2.SetCoordinates(p2.Pt(), p2.Eta(), p2.Phi(), o2::constants::physics::MassPionCharged); k3.SetCoordinates(p3.Pt(), p3.Eta(), p3.Phi(), o2::constants::physics::MassPionCharged); @@ -729,6 +920,8 @@ struct ExclusiveRhoTo4Pi { sigFromData( // run number collision.runNumber(), + // UPC mode + collision.flags(), // vertex collision.posX(), collision.posY(), collision.posZ(), // FIT Signals @@ -786,7 +979,10 @@ struct ExclusiveRhoTo4Pi { histosData.fill(HIST("fourpion_rap_0_charge_within_rap"), p1234.Rapidity()); histosData.fill(HIST("fourpion_mass_0_charge_within_rap"), p1234.M()); if (p1234.Pt() < rhoPtCut) { - histosData.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 5); + histosData.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 14); + if (rhoMassMin < p1234.M() && p1234.M() < rhoMassMax) { + histosData.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 15); + } // Fill the Invariant Mass Histogram histosData.fill(HIST("fourpion_mass_0_charge_domA"), p1234.M()); // Two Pion Masses @@ -831,7 +1027,7 @@ struct ExclusiveRhoTo4Pi { // Selecting Events with net charge != 0 for estimation of background if (numPionMinusTracks != numPiMinus && numPiPlusTracks != numPiPlus) { - histosData.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 6); + histosData.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 16); ROOT::Math::PxPyPzMVector p1(selectedPionTracks[0].px(), selectedPionTracks[0].py(), selectedPionTracks[0].pz(), o2::constants::physics::MassPionCharged); ROOT::Math::PxPyPzMVector p2(selectedPionTracks[1].px(), selectedPionTracks[1].py(), selectedPionTracks[1].pz(), o2::constants::physics::MassPionCharged); @@ -848,6 +1044,8 @@ struct ExclusiveRhoTo4Pi { bkgFromData( // Run Number collision.runNumber(), + // UPC mode + collision.flags(), // vertex collision.posX(), collision.posY(), collision.posZ(), // FIT Signals @@ -903,7 +1101,6 @@ struct ExclusiveRhoTo4Pi { histosData.fill(HIST("fourpion_rap_non_0_charge_within_rap"), p1234.Rapidity()); histosData.fill(HIST("fourpion_mass_non_0_charge_within_rap"), p1234.M()); if (p1234.Pt() < rhoPtCut) { - histosData.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 7); histosData.fill(HIST("fourpion_mass_non_0_charge_domA"), p1234.M()); } if (p1234.Pt() > rhoPtCut && p1234.Pt() < zeroPointEight) { @@ -966,6 +1163,11 @@ struct ExclusiveRhoTo4Pi { return phi; } + double getMaxDCAxy(double pT) + { + return 0.0105 + 0.035 / std::pow(pT, 1.1); + } + }; // End of Struct exclusiveRhoTo4Pi WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 2c7719843551a662934380dd1d1c1261059a2ade Mon Sep 17 00:00:00 2001 From: rolavick Date: Fri, 25 Jul 2025 11:36:26 +0200 Subject: [PATCH 061/345] [Infrastructure] Update CODEOWNERS (#12236) --- CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CODEOWNERS b/CODEOWNERS index a635934da22..57766839579 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -58,7 +58,7 @@ /PWGMM/Lumi @alibuild @aalkin @jgcn /PWGMM/UE @alibuild @aalkin @aortizve @jgcn -/PWGUD @alibuild @pbuehler @abylinkin @rolavick +/PWGUD @alibuild @pbuehler @nystrand @rolavick /PWGJE @alibuild @lhavener @maoyx @nzardosh @fjonasALICE @mfasDa @mhemmer-cern /Tools/PIDML @alibuild @saganatt /Tools/ML @alibuild @fcatalan92 @fmazzasc From 914de472ce525f9bd179f9f181c80d0101c24e30 Mon Sep 17 00:00:00 2001 From: spolitan <59452587+stefanopolitano@users.noreply.github.com> Date: Fri, 25 Jul 2025 12:31:22 +0200 Subject: [PATCH 062/345] [PWGCF] Adding selection on V0 rapidity in cf correlation (#12210) Co-authored-by: ALICE Action Bot --- PWGCF/Tasks/correlations.cxx | 53 +++++++++++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 4 deletions(-) diff --git a/PWGCF/Tasks/correlations.cxx b/PWGCF/Tasks/correlations.cxx index 48e70976c97..941f9541612 100644 --- a/PWGCF/Tasks/correlations.cxx +++ b/PWGCF/Tasks/correlations.cxx @@ -96,6 +96,7 @@ struct CorrelationTask { O2_DEFINE_CONFIGURABLE(cfgVerbosity, int, 1, "Verbosity level (0 = major, 1 = per collision)") O2_DEFINE_CONFIGURABLE(cfgDecayParticleMask, int, 0, "Selection bitmask for the decay particles: 0 = no selection") + O2_DEFINE_CONFIGURABLE(cfgV0RapidityMax, float, 0.8, "Maximum rapidity for the decay particles (0 = no selection)") O2_DEFINE_CONFIGURABLE(cfgMassAxis, int, 0, "Use invariant mass axis (0 = OFF, 1 = ON)") O2_DEFINE_CONFIGURABLE(cfgMcTriggerPDGs, std::vector, {}, "MC PDG codes to use exclusively as trigger particles and exclude from associated particles. Empty = no selection.") @@ -175,6 +176,7 @@ struct CorrelationTask { } } registry.add("multiplicity", "event multiplicity", {HistType::kTH1F, {{1000, 0, 100, "/multiplicity/centrality"}}}); + registry.add("yvspt", "y vs pT", {HistType::kTH2F, {{100, -1, 1, "y"}, {100, 0, 20, "p_{T}"}}}); // y vs pT for all tracks (control histogram) const int maxMixBin = AxisSpec(axisMultiplicity).getNbins() * AxisSpec(axisVertex).getNbins(); // The bin numbers for the control histograms (eventcount_*) come from getBin(...) and are the following: #mult_bin * #number_of_z_bins + #zbin @@ -398,6 +400,40 @@ struct CorrelationTask { template using HasPartDaugh1Id = decltype(std::declval().cfParticleDaugh1Id()); + template + float getV0Rapidity(const T& track) + { + const float pt = track.pt(); + const float eta = track.eta(); + const float phi = track.phi(); + + const float px = pt * std::cos(phi); + const float py = pt * std::sin(phi); + const float pz = pt * std::sinh(eta); + + const float p2 = px * px + py * py + pz * pz; + + if constexpr (std::experimental::is_detected::value) { + const auto decayType = track.decay(); + float mass = 0.f; + + if (decayType == aod::cf2prongtrack::K0stoPiPi) { + mass = o2::constants::physics::MassK0Short; + } else if (decayType == aod::cf2prongtrack::LambdatoPPi || decayType == aod::cf2prongtrack::AntiLambdatoPiP) { + mass = o2::constants::physics::MassLambda; + } else if (decayType == aod::cf2prongtrack::PhiToKK) { + mass = o2::constants::physics::MassPhi; + } else { + return -999.f; // unsupported decay type, return dummy rapidity + } + + const float E = std::sqrt(p2 + mass * mass); + return 0.5f * std::log((E + pz) / (E - pz)); + } + + return -999.f; // no decay type, return dummy rapidity + } + template void fillCorrelations(TTarget target, TTracks1& tracks1, TTracks2& tracks2, float multiplicity, float posZ, int magField, float eventWeight) { @@ -445,8 +481,13 @@ struct CorrelationTask { if (((track1.mcDecay() != aod::cf2prongtrack::D0ToPiK) && (track1.mcDecay() != aod::cf2prongtrack::D0barToKPi)) || (track1.decay() & aod::cf2prongmcpart::Prompt) == 0) continue; } else if constexpr (std::experimental::is_detected::value) { - if (cfgDecayParticleMask != 0 && (cfgDecayParticleMask & (1u << static_cast(track1.decay()))) == 0u) - continue; + if (cfgDecayParticleMask != 0 && (cfgDecayParticleMask & (1u << static_cast(track1.decay()))) == 0u) { + continue; // skip particles that do not match the decay mask + } + if (cfgV0RapidityMax > 0 && std::abs(getV0Rapidity(track1)) > cfgV0RapidityMax) { + continue; // V0s are not allowed to be outside the rapidity range + } + registry.fill(HIST("yvspt"), getV0Rapidity(track1), track1.pt()); } if constexpr (std::experimental::is_detected::value) { @@ -521,8 +562,12 @@ struct CorrelationTask { if ((((track2.mcDecay()) != aod::cf2prongtrack::D0ToPiK) && ((track2.mcDecay()) != aod::cf2prongtrack::D0barToKPi)) || (track2.decay() & aod::cf2prongmcpart::Prompt) == 0) continue; } else if constexpr (std::experimental::is_detected::value) { - if (cfgDecayParticleMask != 0 && (cfgDecayParticleMask & (1u << static_cast(track2.decay()))) == 0u) - continue; + if (cfgDecayParticleMask != 0 && (cfgDecayParticleMask & (1u << static_cast(track2.decay()))) == 0u) { + continue; // skip particles that do not match the decay mask + } + if (cfgV0RapidityMax > 0 && std::abs(getV0Rapidity(track1)) > cfgV0RapidityMax) { + continue; // V0s are not allowed to be outside the rapidity range + } } if constexpr (std::experimental::is_detected::value && std::experimental::is_detected::value) { From 241a8204a1ca29d1728e18f28e81994c2521594f Mon Sep 17 00:00:00 2001 From: "Paul Veen (paveen)" <80593165+ppoava@users.noreply.github.com> Date: Fri, 25 Jul 2025 12:43:31 +0200 Subject: [PATCH 063/345] [Common] Fixed memory issues with 3D histograms (#12226) --- Common/Tasks/qaMuon.cxx | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/Common/Tasks/qaMuon.cxx b/Common/Tasks/qaMuon.cxx index 86bc40b2aef..8ef5a42f824 100644 --- a/Common/Tasks/qaMuon.cxx +++ b/Common/Tasks/qaMuon.cxx @@ -568,11 +568,11 @@ struct muonQa { if (configQAs.fEnableQADimuon) { // single muons - AxisSpec transverseMomentumAxis = {1000, 0, 100, "p_{T} (GeV/c)"}; - AxisSpec etaAxis = {80, -5, -1, "#eta"}; - AxisSpec rAbsAxis = {100, 0., 100.0, "R_{abs} (cm)"}; - AxisSpec dcaAxis = {400, 0.0, 20.0, "DCA"}; - AxisSpec phiAxis = {360, -180.0, 180.0, "#phi (degrees)"}; + AxisSpec transverseMomentumAxis = {100, 0, 30, "p_{T} (GeV/c)"}; + AxisSpec etaAxis = {40, -5, -1, "#eta"}; + AxisSpec rAbsAxis = {10, 0., 100.0, "R_{abs} (cm)"}; + AxisSpec dcaAxis = {40, 0.0, 20.0, "DCA"}; + AxisSpec phiAxis = {36, -180.0, 180.0, "#phi (degrees)"}; // dimuons AxisSpec invMassAxis = {400, 1, 5, "M_{#mu^{+}#mu^{-}} (GeV/c^{2})"}; AxisSpec invMassCorrelationAxis = {80, 0, 8, "M_{#mu^{+}#mu^{-}} (GeV/c^{2})"}; @@ -581,20 +581,20 @@ struct muonQa { AxisSpec invMassAxis2D = {750, 0, 15, "M_{#mu^{+}#mu^{-}} (GeV/c^{2})"}; AxisSpec pTAxis2D = {120, 0, 30, "p_{T} (GeV/c)"}; // Single muons - dimuons correlations - registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuPosPt_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{+}", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, transverseMomentumAxis}}); - registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuNegPt_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{-}", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, transverseMomentumAxis}}); + registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuPosPt_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{+} p_{T}", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, pTAxis2D}}); + registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuNegPt_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{-} p_{T}", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, pTAxis2D}}); // - registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuPosEta_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{+}", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, etaAxis}}); - registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuNegEta_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{-}", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, etaAxis}}); + registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuPosEta_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{+} #eta", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, etaAxis}}); + registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuNegEta_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{-} #eta", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, etaAxis}}); // - registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuPosRabs_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{+}", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, rAbsAxis}}); - registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuNegRabs_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{-}", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, rAbsAxis}}); + registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuPosRabs_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{+} R_{abs}", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, rAbsAxis}}); + registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuNegRabs_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{-} R_{abs}", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, rAbsAxis}}); // - registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuPosDca_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{+}", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, dcaAxis}}); - registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuNegDca_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{-}", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuPosDca_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{+} DCA", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, dcaAxis}}); + registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuNegDca_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{-} DCA", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, dcaAxis}}); // - registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuPosPhi_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{+}", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, phiAxis}}); - registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuNegPhi_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{-}", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, phiAxis}}); + registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuPosPhi_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{+} #phi", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, phiAxis}}); + registryDimuon.add("dimuon/same-event/single-muon-dimuon-correlations/invariantMass_pT_MuNegPhi_MuonKine_MuonCuts", "#mu^{+}#mu^{-} and #mu^{-} #phi", {HistType::kTH3F, {invMassAxis2D, pTAxis2D, phiAxis}}); // MCH-MID tracks with MCH acceptance cuts registryDimuon.add("dimuon/same-event/invariantMass_MuonKine_MuonCuts", "#mu^{+}#mu^{-} invariant mass", {HistType::kTH1F, {invMassAxis}}); registryDimuon.add("dimuon/same-event/invariantMassFull_MuonKine_MuonCuts", "#mu^{+}#mu^{-} invariant mass", {HistType::kTH1F, {invMassAxisFull}}); From 42c86a5f965aea7361cfaf2711b62904fef5ee1b Mon Sep 17 00:00:00 2001 From: Gyula Bencedi Date: Fri, 25 Jul 2025 13:03:14 +0200 Subject: [PATCH 064/345] [PWGLF] Change to track chi2 per MFT clusters (#12237) --- PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx b/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx index d61047e6a76..f8e01e36a7e 100644 --- a/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx +++ b/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx @@ -100,7 +100,7 @@ struct DndetaMFTPbPb { Configurable minNclusterMft{"minNclusterMft", 5, "minimum number of MFT clusters"}; Configurable useChi2Cut{"useChi2Cut", false, "use track chi2 cut"}; - Configurable maxChi2{"maxChi2", 10.f, ""}; + Configurable maxChi2NCl{"maxChi2NCl", 1000.f, "maximum chi2 per MFT clusters"}; Configurable minPt{"minPt", 0., "minimum pT of the MFT tracks"}; Configurable requireCA{ "requireCA", false, "Use Cellular Automaton track-finding algorithm"}; @@ -747,7 +747,9 @@ struct DndetaMFTPbPb { if (track.eta() < trackCuts.minEta || track.eta() > trackCuts.maxEta) return false; if (trackCuts.useChi2Cut) { - if (track.chi2() > trackCuts.maxChi2) + float nclMft = std::max(2.0f * track.nClusters() - 5.0f, 1.0f); + float mftChi2NCl = track.chi2() / nclMft; + if (mftChi2NCl > trackCuts.maxChi2NCl) return false; } if (trackCuts.requireCA && !track.isCA()) From 023b44095eca5a4dd0e8f95a50b29f04340af10d Mon Sep 17 00:00:00 2001 From: prottayCMT <61418725+prottayCMT@users.noreply.github.com> Date: Fri, 25 Jul 2025 14:35:54 +0200 Subject: [PATCH 065/345] [PWGLF] updated mixing process function (#12240) Co-authored-by: Prottay Das --- PWGLF/Tasks/Strangeness/lambdapolsp.cxx | 156 ++++++++++++++++++++++++ 1 file changed, 156 insertions(+) diff --git a/PWGLF/Tasks/Strangeness/lambdapolsp.cxx b/PWGLF/Tasks/Strangeness/lambdapolsp.cxx index 0c35acf5fa6..7377271460e 100644 --- a/PWGLF/Tasks/Strangeness/lambdapolsp.cxx +++ b/PWGLF/Tasks/Strangeness/lambdapolsp.cxx @@ -99,6 +99,9 @@ struct lambdapolsp { Configurable doRandomPsi{"doRandomPsi", true, "randomize psi"}; Configurable doRandomPsiAC{"doRandomPsiAC", true, "randomize psiAC"}; Configurable doRandomPhi{"doRandomPhi", true, "randomize phi"}; + Configurable etaMix{"etaMix", 0.1, "eta difference in mixing"}; + Configurable ptMix{"ptMix", 0.1, "pt difference in mixing"}; + Configurable phiMix{"phiMix", 0.1, "phi difference in mixing"}; } randGrp; // events Configurable cfgCutVertex{"cfgCutVertex", 10.0f, "Accepted z-vertex range"}; @@ -1487,6 +1490,159 @@ struct lambdapolsp { } PROCESS_SWITCH(lambdapolsp, processDerivedDataMixed, "Process mixed event using derived data", false); + void processDerivedDataMixed2(soa::Join const& collisions, v0Candidates const& V0s, dauTracks const&) + { + TRandom3 randGen(0); + + for (auto& [collision1, collision2] : selfCombinations(colBinning, meGrp.nMix, -1, collisions, collisions)) { + + if (collision1.index() == collision2.index()) { + continue; + } + + if (!collision1.sel8()) { + continue; + } + if (!collision2.sel8()) { + continue; + } + + if (!collision1.triggereventsp()) { // provided by StraZDCSP + continue; + } + if (!collision2.triggereventsp()) { // provided by StraZDCSP + continue; + } + + if (rctCut.requireRCTFlagChecker && !rctChecker(collision1)) { + continue; + } + if (rctCut.requireRCTFlagChecker && !rctChecker(collision2)) { + continue; + } + + if (additionalEvSel && (!collision1.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision1.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { + continue; + } + if (additionalEvSel && (!collision2.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision2.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { + continue; + } + if (additionalEvSel2 && (collision1.trackOccupancyInTimeRange() > cfgMaxOccupancy || collision1.trackOccupancyInTimeRange() < cfgMinOccupancy)) { + continue; + } + if (additionalEvSel2 && (collision2.trackOccupancyInTimeRange() > cfgMaxOccupancy || collision2.trackOccupancyInTimeRange() < cfgMinOccupancy)) { + continue; + } + if (additionalEvSel3 && (!collision1.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision1.selection_bit(aod::evsel::kNoITSROFrameBorder))) { + continue; + } + if (additionalEvSel3 && (!collision2.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision2.selection_bit(aod::evsel::kNoITSROFrameBorder))) { + continue; + } + if (additionalEvSel4 && !collision1.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + continue; + } + if (additionalEvSel4 && !collision2.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + continue; + } + + auto centrality = collision1.centFT0C(); + auto qxZDCA = collision1.qxZDCA(); + auto qxZDCC = collision1.qxZDCC(); + auto qyZDCA = collision1.qyZDCA(); + auto qyZDCC = collision1.qyZDCC(); + auto psiZDCC = collision1.psiZDCC(); + auto psiZDCA = collision1.psiZDCA(); + double modqxZDCA; + double modqyZDCA; + double modqxZDCC; + double modqyZDCC; + + modqxZDCA = TMath::Sqrt((qxZDCA * qxZDCA) + (qyZDCA * qyZDCA)) * TMath::Cos(psiZDCA); + modqyZDCA = TMath::Sqrt((qxZDCA * qxZDCA) + (qyZDCA * qyZDCA)) * TMath::Sin(psiZDCA); + modqxZDCC = TMath::Sqrt((qxZDCC * qxZDCC) + (qyZDCC * qyZDCC)) * TMath::Cos(psiZDCC); + modqyZDCC = TMath::Sqrt((qxZDCC * qxZDCC) + (qyZDCC * qyZDCC)) * TMath::Sin(psiZDCC); + + auto psiZDC = TMath::ATan2((modqyZDCC - modqyZDCA), (modqxZDCC - modqxZDCA)); // full event plane from collision 2 + + histos.fill(HIST("hCentrality"), centrality); + histos.fill(HIST("hpRes"), centrality, (TMath::Cos(GetPhiInRange(psiZDCA - psiZDCC)))); + histos.fill(HIST("hpResSin"), centrality, (TMath::Sin(GetPhiInRange(psiZDCA - psiZDCC)))); + + // V0s from collision1 to match kinematics + auto v0sCol1 = V0s.sliceBy(tracksPerCollisionV0Mixed, collision1.index()); + // V0s from collision2 to test + auto v0sCol2 = V0s.sliceBy(tracksPerCollisionV0Mixed, collision2.index()); + + for (const auto& v0_2 : v0sCol2) { + + bool LambdaTag = isCompatible(v0_2, 0); + bool aLambdaTag = isCompatible(v0_2, 1); + if (!LambdaTag && !aLambdaTag) + continue; + if (!SelectionV0(collision2, v0_2)) + continue; + if (LambdaTag) { + Proton = ROOT::Math::PxPyPzMVector(v0_2.pxpos(), v0_2.pypos(), v0_2.pzpos(), massPr); + AntiPion = ROOT::Math::PxPyPzMVector(v0_2.pxneg(), v0_2.pyneg(), v0_2.pzneg(), massPi); + Lambdadummy = Proton + AntiPion; + } + if (aLambdaTag) { + AntiProton = ROOT::Math::PxPyPzMVector(v0_2.pxneg(), v0_2.pyneg(), v0_2.pzneg(), massPr); + Pion = ROOT::Math::PxPyPzMVector(v0_2.pxpos(), v0_2.pypos(), v0_2.pzpos(), massPi); + AntiLambdadummy = AntiProton + Pion; + } + if (shouldReject(LambdaTag, aLambdaTag, Lambdadummy, AntiLambdadummy)) { + continue; + } + if (TMath::Abs(v0_2.eta()) > 0.8) + continue; + + // Check if lambda kinematics from collision2 matches with collision1 + bool matched = false; + for (const auto& v0_1 : v0sCol1) { + bool LambdaTag1 = isCompatible(v0_1, 0); + bool aLambdaTag1 = isCompatible(v0_1, 1); + if (!LambdaTag1 && !aLambdaTag1) + continue; + if (!SelectionV0(collision1, v0_1)) + continue; + if (TMath::Abs(v0_1.eta()) > 0.8) + continue; + + double deta = std::abs(v0_1.eta() - v0_2.eta()); + double dpt = std::abs(v0_1.pt() - v0_2.pt()); + double dphi = RecoDecay::constrainAngle(v0_1.phi() - v0_2.phi(), 0.0); + if (deta < randGrp.etaMix && dpt < randGrp.ptMix && dphi < randGrp.phiMix && ((v0_1.eta() * v0_2.eta()) > 0.0)) { + matched = true; + break; + } + } + if (!matched) + continue; + + int taga = LambdaTag; + int tagb = aLambdaTag; + + if (LambdaTag) { + Lambda = Proton + AntiPion; + tagb = 0; + double acvalue = 1.0; + fillHistograms(taga, tagb, Lambda, Proton, psiZDCC, psiZDCA, psiZDC, centrality, v0_2.mLambda(), v0_2.pt(), v0_2.eta(), acvalue); + } + + tagb = aLambdaTag; + if (aLambdaTag) { + AntiLambda = AntiProton + Pion; + taga = 0; + double acvalue = 1.0; + fillHistograms(taga, tagb, AntiLambda, AntiProton, psiZDCC, psiZDCA, psiZDC, centrality, v0_2.mAntiLambda(), v0_2.pt(), v0_2.eta(), acvalue); + } + } + } + } + PROCESS_SWITCH(lambdapolsp, processDerivedDataMixed2, "Process mixed event2 using derived data", false); + void processDerivedDataMixedFIFO(soa::Join const& collisions, v0Candidates const& V0s, dauTracks const&) { From 89fdc6f8323808380476176f1a04f5a67ae942f9 Mon Sep 17 00:00:00 2001 From: Sandeep Dudi <69388148+sdudi123@users.noreply.github.com> Date: Fri, 25 Jul 2025 15:11:01 +0200 Subject: [PATCH 066/345] [PWGLF] kink selection criteria added (#12223) Co-authored-by: sandeep dudi --- PWGLF/Tasks/Nuspex/spectraKinkPiKa.cxx | 386 ++++++++++++++++++++++++- 1 file changed, 377 insertions(+), 9 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/spectraKinkPiKa.cxx b/PWGLF/Tasks/Nuspex/spectraKinkPiKa.cxx index 9e61c53de3e..1b3c900fc35 100644 --- a/PWGLF/Tasks/Nuspex/spectraKinkPiKa.cxx +++ b/PWGLF/Tasks/Nuspex/spectraKinkPiKa.cxx @@ -14,13 +14,29 @@ /// \author sandeep dudi sandeep.dudi@cern.ch #include "PWGLF/DataModel/LFKinkDecayTables.h" +#include "PWGLF/DataModel/LFParticleIdentification.h" +#include "PWGLF/Utils/svPoolCreator.h" +#include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" + +#include "CCDB/BasicCCDBManager.h" +#include "DCAFitter/DCAFitterN.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "DataFormatsParameters/GRPObject.h" +#include "DetectorsBase/GeometryManager.h" +#include "DetectorsBase/Propagator.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/Track.h" + +////////////// #include "Common/DataModel/PIDResponse.h" -#include "Framework/AnalysisTask.h" #include "Framework/O2DatabasePDGPlugin.h" -#include "Framework/runDataProcessing.h" #include "ReconstructionDataFormats/PID.h" #include "Math/GenVector/Boost.h" @@ -31,7 +47,11 @@ #include #include +#include +#include #include +#include +#include #include using namespace std; @@ -40,10 +60,297 @@ using namespace o2::aod; using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::constants::physics; +using VBracket = o2::math_utils::Bracket; -using TracksFull = soa::Join; +using TracksFull = soa::Join; using CollisionsFull = soa::Join; using CollisionsFullMC = soa::Join; +namespace +{ +constexpr std::array LayerRadii{2.33959f, 3.14076f, 3.91924f, 19.6213f, 24.5597f, 34.388f, 39.3329f}; +constexpr double betheBlochDefault[1][6]{{-1.e32, -1.e32, -1.e32, -1.e32, -1.e32, -1.e32}}; +static const std::vector betheBlochParNames{"p0", "p1", "p2", "p3", "p4", "resolution"}; +static const std::vector particleNames{"Daughter"}; + +} // namespace + +struct kinkCandidate { + int mothTrackID; + int daugTrackID; + int collisionID; + + int mothSign; + std::array momMoth = {-999, -999, -999}; + std::array momDaug = {-999, -999, -999}; + std::array primVtx = {-999, -999, -999}; + std::array decVtx = {-999, -999, -999}; + + float dcaKinkTopo = -999; + float dcaXYdaug = -999; + float dcaXYmoth = -999; + float kinkAngle = -999; +}; +struct kinkBuilder { + // kink analysis + Produces outputDataTable; + Service ccdb; + // Selection criteria + Configurable maxDCAMothToPV{"maxDCAMothToPV", 0.1, "Max DCA of the mother to the PV"}; + Configurable minDCADaugToPV{"minDCADaugToPV", 0., "Min DCA of the daughter to the PV"}; + Configurable minPtMoth{"minPtMoth", 0.5, "Minimum pT of the hypercandidate"}; + Configurable maxZDiff{"maxZDiff", 20., "Max z difference between the kink daughter and the mother"}; + Configurable maxPhiDiff{"maxPhiDiff", 100, "Max phi difference between the kink daughter and the mother"}; + Configurable timeMarginNS{"timeMarginNS", 600, "Additional time res tolerance in ns"}; + Configurable etaMax{"etaMax", 1., "eta daughter"}; + Configurable nTPCClusMinDaug{"nTPCClusMinDaug", 30, "mother NTPC clusters cut"}; + Configurable itsChi2cut{"itsChi2cut", 30, "mother itsChi2 cut"}; + Configurable askTOFforDaug{"askTOFforDaug", false, "If true, ask for TOF signal"}; + Configurable kaontopologhy{"kaontopologhy", true, "If true, selected mother have both ITS+TPC "}; + + o2::vertexing::DCAFitterN<2> fitter; + o2::base::MatLayerCylSet* lut = nullptr; + + // constants + float radToDeg = o2::constants::math::Rad2Deg; + svPoolCreator svCreator; + + // bethe bloch parameters + Configurable> cfgBetheBlochParams{"cfgBetheBlochParams", {betheBlochDefault[0], 1, 6, particleNames, betheBlochParNames}, "TPC Bethe-Bloch parameterisation for charged daughter"}; + Configurable cfgMaterialCorrection{"cfgMaterialCorrection", static_cast(o2::base::Propagator::MatCorrType::USEMatCorrNONE), "Type of material correction"}; + Configurable customVertexerTimeMargin{"customVertexerTimeMargin", 800, "Time margin for custom vertexer (ns)"}; + Configurable skipAmbiTracks{"skipAmbiTracks", false, "Skip ambiguous tracks"}; + Configurable unlikeSignBkg{"unlikeSignBkg", false, "Use unlike sign background"}; + + // CCDB options + Configurable ccdbPath{"ccdbPath", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; + Configurable lutPath{"lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"}; + + // std vector of candidates + std::vector kinkCandidates; + int mRunNumber; + float mBz; + std::array mBBparamsDaug; + + // mother and daughter tracks' properties (absolute charge and mass) + int charge = 1; + void init(InitContext const&) + { + // dummy values, 1 for mother, 0 for daughter + svCreator.setPDGs(1, 0); + + mRunNumber = 0; + mBz = 0; + + ccdb->setURL(ccdbPath); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + fitter.setPropagateToPCA(true); + fitter.setMaxR(200.); + fitter.setMinParamChange(1e-3); + fitter.setMinRelChi2Change(0.9); + fitter.setMaxDZIni(1e9); + fitter.setMaxChi2(1e9); + fitter.setUseAbsDCA(true); + + svCreator.setTimeMargin(customVertexerTimeMargin); + if (skipAmbiTracks) { + svCreator.setSkipAmbiTracks(); + } + for (int i = 0; i < 5; i++) { + mBBparamsDaug[i] = cfgBetheBlochParams->get("Daughter", Form("p%i", i)); + } + mBBparamsDaug[5] = cfgBetheBlochParams->get("Daughter", "resolution"); + } + + template + bool selectMothTrack(const T& candidate) + { + // ITS-standalone (no TPC, no TOF) + if (!kaontopologhy) { + if (candidate.has_collision() && candidate.hasITS() && !candidate.hasTPC() && !candidate.hasTOF() && + candidate.itsNCls() < 6 && + candidate.itsNClsInnerBarrel() == 3 && + candidate.itsChi2NCl() < 36 && + candidate.pt() > minPtMoth) { + return true; + } + return false; + } + // Kaon topology: ITS+TPC, no TOF + if (kaontopologhy) { + if (candidate.has_collision() && candidate.hasITS() && candidate.hasTPC() && !candidate.hasTOF() && + candidate.pt() > minPtMoth && + candidate.tpcNClsCrossedRows() >= nTPCClusMinDaug && + candidate.itsChi2NCl() <= itsChi2cut) { + return true; + } + return false; + } + + return false; // fallback + } + + template + bool selectDaugTrack(const T& candidate) + { + if (!kaontopologhy && (!candidate.hasTPC() || !candidate.hasITS())) { + return false; + } + + if (kaontopologhy && (!candidate.hasTPC() || candidate.hasITS())) { + return false; + } + + if (askTOFforDaug && !candidate.hasTOF()) { + return false; + } + return true; + } + + template + void fillCandidateData(const Tcolls& collisions, const Ttracks& tracks, aod::AmbiguousTracks const& ambiguousTracks, aod::BCs const& bcs) + { + svCreator.clearPools(); + svCreator.fillBC2Coll(collisions, bcs); + + for (const auto& track : tracks) { + if (std::abs(track.eta()) > etaMax) + continue; + + bool isDaug = selectDaugTrack(track); + bool isMoth = selectMothTrack(track); + + if (!isDaug && !isMoth) + continue; + + int pdgHypo = isMoth ? 1 : 0; + svCreator.appendTrackCand(track, collisions, pdgHypo, ambiguousTracks, bcs); + } + auto& kinkPool = svCreator.getSVCandPool(collisions, !unlikeSignBkg); + + for (const auto& svCand : kinkPool) { + kinkCandidate kinkCand; + + auto trackMoth = tracks.rawIteratorAt(svCand.tr0Idx); + auto trackDaug = tracks.rawIteratorAt(svCand.tr1Idx); + + auto const& collision = trackMoth.template collision_as(); + auto const& bc = collision.template bc_as(); + initCCDB(bc); + + o2::dataformats::VertexBase primaryVertex; + primaryVertex.setPos({collision.posX(), collision.posY(), collision.posZ()}); + primaryVertex.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); + kinkCand.primVtx = {primaryVertex.getX(), primaryVertex.getY(), primaryVertex.getZ()}; + + o2::track::TrackParCov trackParCovMoth = getTrackParCov(trackMoth); + o2::track::TrackParCov trackParCovMothPV{trackParCovMoth}; + o2::base::Propagator::Instance()->PropagateToXBxByBz(trackParCovMoth, LayerRadii[trackMoth.itsNCls() - 1]); + std::array dcaInfoMoth; + o2::base::Propagator::Instance()->propagateToDCABxByBz({primaryVertex.getX(), primaryVertex.getY(), primaryVertex.getZ()}, trackParCovMothPV, 2.f, static_cast(cfgMaterialCorrection.value), &dcaInfoMoth); + + o2::track::TrackParCov trackParCovDaug = getTrackParCov(trackDaug); + + // check if the kink daughter is close to the mother + if (std::abs(trackParCovMoth.getZ() - trackParCovDaug.getZ()) > maxZDiff) { + continue; + } + if ((std::abs(trackParCovMoth.getPhi() - trackParCovDaug.getPhi()) * radToDeg) > maxPhiDiff) { + continue; + } + + // propagate to PV + std::array dcaInfoDaug; + o2::base::Propagator::Instance()->propagateToDCABxByBz({primaryVertex.getX(), primaryVertex.getY(), primaryVertex.getZ()}, trackParCovDaug, 2.f, static_cast(cfgMaterialCorrection.value), &dcaInfoDaug); + if (std::abs(dcaInfoDaug[0]) < minDCADaugToPV) { + continue; + } + + int nCand = 0; + try { + nCand = fitter.process(trackParCovMoth, trackParCovDaug); + } catch (...) { + LOG(error) << "Exception caught in DCA fitter process call!"; + continue; + } + if (nCand == 0) { + continue; + } + + if (!fitter.propagateTracksToVertex()) { + continue; + } + + auto propMothTrack = fitter.getTrack(0); + auto propDaugTrack = fitter.getTrack(1); + kinkCand.decVtx = fitter.getPCACandidatePos(); + + for (int i = 0; i < 3; i++) { + kinkCand.decVtx[i] -= kinkCand.primVtx[i]; + } + propMothTrack.getPxPyPzGlo(kinkCand.momMoth); + propDaugTrack.getPxPyPzGlo(kinkCand.momDaug); + for (int i = 0; i < 3; i++) { + kinkCand.momMoth[i] *= charge; + kinkCand.momDaug[i] *= charge; + } + float pMoth = propMothTrack.getP() * charge; + float pDaug = propDaugTrack.getP() * charge; + float spKink = kinkCand.momMoth[0] * kinkCand.momDaug[0] + kinkCand.momMoth[1] * kinkCand.momDaug[1] + kinkCand.momMoth[2] * kinkCand.momDaug[2]; + kinkCand.kinkAngle = std::acos(spKink / (pMoth * pDaug)); + + kinkCand.collisionID = collision.globalIndex(); + kinkCand.mothTrackID = trackMoth.globalIndex(); + kinkCand.daugTrackID = trackDaug.globalIndex(); + + kinkCand.dcaXYmoth = dcaInfoMoth[0]; + kinkCand.mothSign = trackMoth.sign(); + kinkCand.dcaXYdaug = dcaInfoDaug[0]; + kinkCand.dcaKinkTopo = std::sqrt(fitter.getChi2AtPCACandidate()); + kinkCandidates.push_back(kinkCand); + } + } + + void initCCDB(aod::BCs::iterator const& bc) + { + if (mRunNumber == bc.runNumber()) { + return; + } + mRunNumber = bc.runNumber(); + LOG(info) << "Initializing CCDB for run " << mRunNumber; + o2::parameters::GRPMagField* grpmag = ccdb->getForRun(grpmagPath, mRunNumber); + o2::base::Propagator::initFieldFromGRP(grpmag); + mBz = grpmag->getNominalL3Field(); + fitter.setBz(mBz); + + if (!lut) { + lut = o2::base::MatLayerCylSet::rectifyPtrFromFile(ccdb->get(lutPath)); + int mat{static_cast(cfgMaterialCorrection)}; + fitter.setMatCorrType(static_cast(mat)); + } + o2::base::Propagator::Instance()->setMatLUT(lut); + LOG(info) << "Task initialized for run " << mRunNumber << " with magnetic field " << mBz << " kZG"; + } + + void process(aod::Collisions const& collisions, TracksFull const& tracks, aod::AmbiguousTracks const& ambiTracks, aod::BCs const& bcs) + { + kinkCandidates.clear(); + fillCandidateData(collisions, tracks, ambiTracks, bcs); + // sort kinkCandidates by collisionID to allow joining with collision table + std::sort(kinkCandidates.begin(), kinkCandidates.end(), [](const kinkCandidate& a, const kinkCandidate& b) { return a.collisionID < b.collisionID; }); + + for (const auto& kinkCand : kinkCandidates) { + outputDataTable(kinkCand.collisionID, kinkCand.mothTrackID, kinkCand.daugTrackID, + kinkCand.decVtx[0], kinkCand.decVtx[1], kinkCand.decVtx[2], + kinkCand.mothSign, kinkCand.momMoth[0], kinkCand.momMoth[1], kinkCand.momMoth[2], + kinkCand.momDaug[0], kinkCand.momDaug[1], kinkCand.momDaug[2], + kinkCand.dcaXYmoth, kinkCand.dcaXYdaug, kinkCand.dcaKinkTopo); + } + } + PROCESS_SWITCH(kinkBuilder, process, "Produce kink tables", false); +}; + struct spectraKinkPiKa { Service pdg; // Histograms are defined with HistogramRegistry @@ -54,16 +361,21 @@ struct spectraKinkPiKa { Configurable cutzvertex{"cutzvertex", 10.0f, "Accepted z-vertex range (cm)"}; Configurable cutNSigmaPi{"cutNSigmaPi", 4, "NSigmaTPCPion"}; Configurable cutNSigmaKa{"cutNSigmaKa", 4, "NSigmaTPCKaon"}; + Configurable cutNSigmaMu{"cutNSigmaMu", 4, "cutNSigmaMu"}; Configurable rapCut{"rapCut", 0.8, "rapCut"}; Configurable kinkanglecut{"kinkanglecut", 2.0, "kinkanglecut"}; - Configurable minradius{"minradius", 1.0, "minradiuscut"}; + Configurable minradius{"minradius", 130.0, "minradiuscut"}; Configurable maxradius{"maxradius", 200.0, "maxradiuscut"}; + Configurable dcaXYcut{"dcaXYcut", 0.2, "dcaXYcut"}; + Configurable dcaZcut{"dcaZcut", 0.2, "dcaZcut"}; + Configurable tpcChi2Cut{"tpcChi2Cut", 4.0, "tpcChi2Cut"}; Configurable pid{"pidMother", 321, ""}; Configurable dpid{"pidDaughter", 13, ""}; Configurable d0pid{"dopid", 0, ""}; Preslice mPerCol = aod::track::collisionId; + Preslice mtPerCol = aod::track::collisionId; void init(InitContext const&) { @@ -74,6 +386,7 @@ struct spectraKinkPiKa { const AxisSpec etaAxis{200, -5.0, 5.0, "#eta"}; const AxisSpec vertexAxis{1200, -300., 300., "vrtx [cm]"}; const AxisSpec radiusAxis{600, 0., 300., "vrtx [cm]"}; + const AxisSpec massAxis{600, 0.1, 0.7, "Inv mass (GeV/#it{c}^{2})"}; // Event selection rEventSelection.add("hVertexZRec", "hVertexZRec", {HistType::kTH1F, {vertexAxis}}); @@ -92,6 +405,10 @@ struct spectraKinkPiKa { rpiKkink.add("h2_moth_pt_vs_eta_rec_pion", "pt_vs_eta_moth", {HistType::kTH2F, {ptAxis, etaAxis}}); rpiKkink.add("h2_pt_moth_vs_dau_rec_pion", "pt_moth_vs_dau", {HistType::kTH2F, {ptAxis, ptAxis}}); + // inv mass + rpiKkink.add("h2_invmass_kaon", "Inv mass vs Pt", {HistType::kTH3F, {massAxis, ptAxis, ptAxis}}); + rpiKkink.add("h2_invmass_pion", "Inv mass vs Pt", {HistType::kTH3F, {massAxis, ptAxis, ptAxis}}); + rpiKkink.add("h2_qt_pion", "qt", {HistType::kTH1F, {qtAxis}}); rpiKkink.add("h2_qt_vs_ptpion", "qt_pt", {HistType::kTH2F, {qtAxis, ptAxis}}); rpiKkink.add("h2_kink_angle_pion", "kink angle", {HistType::kTH1F, {kinkAxis}}); @@ -112,6 +429,26 @@ struct spectraKinkPiKa { } } + double computeMotherMass(ROOT::Math::PxPyPzMVector p_moth, ROOT::Math::PxPyPzMVector p_daug) + { + // Infer neutrino momentum from conservation + ROOT::Math::XYZVector p_nu_vec = p_moth.Vect() - p_daug.Vect(); + + // Neutrino energy (massless): E_nu = |p_nu| + double E_nu = p_nu_vec.R(); + + // Total energy of the system + double E_total = p_daug.E() + E_nu; + + // Total momentum = p_nu + p_daug + ROOT::Math::XYZVector p_total_vec = p_nu_vec + p_daug.Vect(); + double p_total_sq = p_total_vec.Mag2(); + + // Invariant mass from E² - |p|² + double m2 = E_total * E_total - p_total_sq; + return (m2 > 0) ? std::sqrt(m2) : -1.0; + } + void processData(CollisionsFull::iterator const& collision, aod::KinkCands const& KinkCands, TracksFull const&) { ROOT::Math::PxPyPzMVector v0; @@ -127,8 +464,25 @@ struct spectraKinkPiKa { for (const auto& kinkCand : KinkCands) { auto dauTrack = kinkCand.trackDaug_as(); auto mothTrack = kinkCand.trackMoth_as(); + if (mothTrack.collisionId() != collision.globalIndex()) { + continue; // not from this event + } + if (!mothTrack.has_collision() || !dauTrack.has_collision()) { + continue; + } + if (mothTrack.collisionId() != dauTrack.collisionId()) { + continue; // skip mismatched collision tracks + } bool kaon = false; bool pion = false; + /* + if (mothTrack.dcaXY() > dcaXYcut) + continue; + if (mothTrack.dcaZ() > dcaZcut) + continue; + */ + if (mothTrack.tpcChi2NCl() > tpcChi2Cut) + continue; if (std::abs(mothTrack.tpcNSigmaKa()) < cutNSigmaKa) { kaon = true; } @@ -138,6 +492,9 @@ struct spectraKinkPiKa { if (!kaon && !pion) { continue; } + if (cutNSigmaMu != -1 && std::abs(dauTrack.tpcNSigmaMu()) > cutNSigmaMu) { + continue; + } double radiusxy = std::sqrt(kinkCand.xDecVtx() * kinkCand.xDecVtx() + kinkCand.yDecVtx() * kinkCand.yDecVtx()); if (radiusxy < minradius || radiusxy > maxradius) continue; @@ -154,6 +511,7 @@ struct spectraKinkPiKa { float radToDeg = o2::constants::math::Rad2Deg; if (kinkangle * radToDeg < kinkanglecut) continue; + if (kaon) { rpiKkink.fill(HIST("h2_moth_pt_vs_eta_rec"), v0.Pt(), v0.Eta()); rpiKkink.fill(HIST("h2_dau_pt_vs_eta_rec"), v1.Pt(), v1.Eta()); @@ -172,12 +530,18 @@ struct spectraKinkPiKa { double ptd = pdlab.Perp(motherDir); // or p_d_lab.Mag() * sin(theta) if (kaon) { + v0.SetCoordinates(mothTrack.px(), mothTrack.py(), mothTrack.pz(), o2::constants::physics::MassKaonCharged); + double mass = computeMotherMass(v0, v1); rpiKkink.fill(HIST("h2_qt"), ptd); rpiKkink.fill(HIST("h2_qt_vs_pt"), ptd, v1.Pt()); + rpiKkink.fill(HIST("h2_invmass_kaon"), mass, v0.Pt(), ptd); } if (pion) { + v0.SetCoordinates(mothTrack.px(), mothTrack.py(), mothTrack.pz(), o2::constants::physics::MassPionCharged); + double mass = computeMotherMass(v0, v1); rpiKkink.fill(HIST("h2_qt_pion"), ptd); rpiKkink.fill(HIST("h2_qt_vs_ptpion"), ptd, v1.Pt()); + rpiKkink.fill(HIST("h2_invmass_pion"), mass, v0.Pt(), ptd); } } } @@ -194,6 +558,7 @@ struct spectraKinkPiKa { if (!collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { continue; } + rEventSelection.fill(HIST("hVertexZRec"), collision.posZ()); auto kinkCandPerColl = KinkCands.sliceBy(mPerCol, collision.globalIndex()); for (const auto& kinkCand : kinkCandPerColl) { @@ -218,7 +583,6 @@ struct spectraKinkPiKa { continue; rpiKkink.fill(HIST("h2_kinkradius_vs_vz"), kinkCand.zDecVtx(), radiusxy); rpiKkink.fill(HIST("h2_kink_vx_vs_vy"), kinkCand.xDecVtx(), kinkCand.yDecVtx()); - v0.SetCoordinates(mothTrack.px(), mothTrack.py(), mothTrack.pz(), o2::constants::physics::MassPionCharged); v1.SetCoordinates(dauTrack.px(), dauTrack.py(), dauTrack.pz(), o2::constants::physics::MassMuon); @@ -245,7 +609,9 @@ struct spectraKinkPiKa { // do MC association auto mcLabMoth = trackLabelsMC.rawIteratorAt(mothTrack.globalIndex()); auto mcLabDau = trackLabelsMC.rawIteratorAt(dauTrack.globalIndex()); + if (mcLabMoth.has_mcParticle() && mcLabDau.has_mcParticle()) { + auto mcTrackMoth = mcLabMoth.mcParticle_as(); auto mcTrackDau = mcLabDau.mcParticle_as(); if (!mcTrackDau.has_mothers()) { @@ -266,11 +632,11 @@ struct spectraKinkPiKa { for (const auto& mcPart : particlesMC) { ROOT::Math::PxPyPzMVector v0; ROOT::Math::PxPyPzMVector v1; - if (!d0pid && (std::abs(mcPart.pdgCode()) != pid || std::abs(mcPart.y()) > rapCut)) { + if (!d0pid && (std::abs(mcPart.pdgCode()) != pid || std::abs(mcPart.eta()) > rapCut)) { continue; } bool isDmeson = std::abs(mcPart.pdgCode()) == kD0 || std::abs(mcPart.pdgCode()) == kDPlus || std::abs(mcPart.pdgCode()) == kDStar; - if (d0pid && (!isDmeson || std::abs(mcPart.y()) > rapCut)) { + if (d0pid && (!isDmeson || std::abs(mcPart.eta()) > rapCut)) { continue; } if (!mcPart.has_daughters()) { @@ -320,6 +686,8 @@ struct spectraKinkPiKa { WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { - return WorkflowSpec{ - adaptAnalysisTask(cfgc)}; + auto builderTask = adaptAnalysisTask(cfgc); + auto spectraTask = adaptAnalysisTask(cfgc); + + return {builderTask, spectraTask}; // Just return both tasks } From 26709c1cabc7dd62c40b714698e1caa2ca7fc8b1 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Fri, 25 Jul 2025 16:32:16 +0200 Subject: [PATCH 067/345] [PWGEM/Dilepton] update treeCreatorElectronMLDDA.cxx (#12231) --- PWGEM/Dilepton/DataModel/lmeeMLTables.h | 2 +- .../treeCreatorElectronMLDDA.cxx | 68 +++++++++++-------- 2 files changed, 40 insertions(+), 30 deletions(-) diff --git a/PWGEM/Dilepton/DataModel/lmeeMLTables.h b/PWGEM/Dilepton/DataModel/lmeeMLTables.h index 4d82d011bcc..f2000b0f4a4 100644 --- a/PWGEM/Dilepton/DataModel/lmeeMLTables.h +++ b/PWGEM/Dilepton/DataModel/lmeeMLTables.h @@ -93,7 +93,7 @@ DECLARE_SOA_TABLE(EMTracksForMLPID, "AOD", "EMTRACKMLPID", //! track::TPCChi2NCl, track::TPCInnerParam, track::TPCSignal, pidtpc::TPCNSigmaEl, pidtpc::TPCNSigmaPi, pidtpc::TPCNSigmaKa, pidtpc::TPCNSigmaPr, pidtofbeta::Beta, pidtof::TOFNSigmaEl, pidtof::TOFNSigmaPi, pidtof::TOFNSigmaKa, pidtof::TOFNSigmaPr, - track::ITSClusterSizes, track::ITSChi2NCl, track::TOFChi2, track::DetectorMap, emmltrack::PIDLabel, emmltrack::IsForValidation, + track::ITSClusterSizes, track::ITSChi2NCl, track::TOFChi2, track::DetectorMap, emmltrack::PIDLabel, // dynamic column emmltrack::MeanClusterSizeITS, diff --git a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx index 0a0dda6a69f..e7edb401ddf 100644 --- a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx +++ b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx @@ -182,6 +182,12 @@ struct TreeCreatorElectronMLDDA { Configurable cfg_max_mass_k0s{"cfg_max_mass_k0s", 0.505, "max mass for K0S"}; Configurable cfg_min_mass_lambda{"cfg_min_mass_lambda", 1.113, "min mass for Lambda"}; Configurable cfg_max_mass_lambda{"cfg_max_mass_lambda", 1.118, "max mass for Lambda"}; + + Configurable cfg_min_mass_k0s_veto{"cfg_min_mass_k0s_veto", 0.47, "min mass for K0S veto"}; + Configurable cfg_max_mass_k0s_veto{"cfg_max_mass_k0s_veto", 0.52, "max mass for K0S veto"}; + Configurable cfg_min_mass_lambda_veto{"cfg_min_mass_lambda_veto", 1.105, "min mass for Lambda veto"}; + Configurable cfg_max_mass_lambda_veto{"cfg_max_mass_lambda_veto", 1.125, "max mass for Lambda veto"}; + Configurable cfg_min_cospa{"cfg_min_cospa", 0.9998, "min cospa for v0"}; Configurable cfg_max_dcadau{"cfg_max_dcadau", 0.2, "max distance between 2 legs for v0"}; Configurable cfg_min_cr2findable_ratio_tpc{"cfg_min_cr2findable_ratio_tpc", 0.8, "min. TPC Ncr/Nf ratio"}; @@ -573,7 +579,7 @@ struct TreeCreatorElectronMLDDA { } template - void fillTrackTable(TCollision const& collision, TTrack const& track, const uint8_t pidlabel, const bool isForValidation) + void fillTrackTable(TCollision const& collision, TTrack const& track, const uint8_t pidlabel) { if (store_ele_band_only && !isElectron(track)) { return; @@ -613,7 +619,7 @@ struct TreeCreatorElectronMLDDA { track.tpcChi2NCl(), track.tpcInnerParam(), track.tpcSignal(), track.tpcNSigmaEl(), /*track.tpcNSigmaMu(),*/ track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr(), track.beta(), track.tofNSigmaEl(), /*track.tofNSigmaMu(),*/ track.tofNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPr(), - track.itsClusterSizes(), track.itsChi2NCl(), track.tofChi2(), track.detectorMap(), pidlabel, isForValidation); + track.itsClusterSizes(), track.itsChi2NCl(), track.tofChi2(), track.detectorMap(), pidlabel); stored_trackIds.emplace_back(track.globalIndex()); } } @@ -763,37 +769,41 @@ struct TreeCreatorElectronMLDDA { registry.fill(HIST("V0/hCosPA"), v0.v0cosPA()); registry.fill(HIST("V0/hAP"), v0.alpha(), v0.qtarm()); - if (isPionTight(pos) && isPion(neg)) { - registry.fill(HIST("V0/hMassK0Short"), v0.mK0Short()); - if (v0cuts.cfg_min_mass_k0s < v0.mK0Short() && v0.mK0Short() < v0cuts.cfg_max_mass_k0s) { - registry.fill(HIST("V0/hTPCdEdx_P_Pi"), neg.tpcInnerParam(), neg.tpcSignal()); - registry.fill(HIST("V0/hTOFbeta_P_Pi"), neg.tpcInnerParam(), neg.beta()); - fillTrackTable(collision, neg, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kPion), false); - } - if (isPion(pos) && isPionTight(neg)) { + if (!(v0cuts.cfg_min_mass_lambda_veto < v0.mLambda() && v0.mLambda() < v0cuts.cfg_max_mass_lambda_veto) && !(v0cuts.cfg_min_mass_lambda_veto < v0.mAntiLambda() && v0.mAntiLambda() < v0cuts.cfg_max_mass_lambda_veto)) { + if (isPionTight(pos) && isPion(neg)) { registry.fill(HIST("V0/hMassK0Short"), v0.mK0Short()); if (v0cuts.cfg_min_mass_k0s < v0.mK0Short() && v0.mK0Short() < v0cuts.cfg_max_mass_k0s) { - registry.fill(HIST("V0/hTPCdEdx_P_Pi"), pos.tpcInnerParam(), pos.tpcSignal()); - registry.fill(HIST("V0/hTOFbeta_P_Pi"), pos.tpcInnerParam(), pos.beta()); - fillTrackTable(collision, pos, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kPion), false); + registry.fill(HIST("V0/hTPCdEdx_P_Pi"), neg.tpcInnerParam(), neg.tpcSignal()); + registry.fill(HIST("V0/hTOFbeta_P_Pi"), neg.tpcInnerParam(), neg.beta()); + fillTrackTable(collision, neg, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kPion)); + } + if (isPion(pos) && isPionTight(neg)) { + registry.fill(HIST("V0/hMassK0Short"), v0.mK0Short()); + if (v0cuts.cfg_min_mass_k0s < v0.mK0Short() && v0.mK0Short() < v0cuts.cfg_max_mass_k0s) { + registry.fill(HIST("V0/hTPCdEdx_P_Pi"), pos.tpcInnerParam(), pos.tpcSignal()); + registry.fill(HIST("V0/hTOFbeta_P_Pi"), pos.tpcInnerParam(), pos.beta()); + fillTrackTable(collision, pos, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kPion)); + } } } } - if (isProton(pos) && isPionTight(neg)) { - registry.fill(HIST("V0/hMassLambda"), v0.mLambda()); - if (v0cuts.cfg_min_mass_lambda < v0.mLambda() && v0.mLambda() < v0cuts.cfg_max_mass_lambda) { - fillTrackTable(collision, pos, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kProton), false); - registry.fill(HIST("V0/hTPCdEdx_P_Pr"), pos.tpcInnerParam(), pos.tpcSignal()); - registry.fill(HIST("V0/hTOFbeta_P_Pr"), pos.tpcInnerParam(), pos.beta()); + if (!(v0cuts.cfg_min_mass_k0s_veto < v0.mK0Short() && v0.mK0Short() < v0cuts.cfg_max_mass_k0s_veto)) { + if (isProton(pos) && isPionTight(neg)) { + registry.fill(HIST("V0/hMassLambda"), v0.mLambda()); + if (v0cuts.cfg_min_mass_lambda < v0.mLambda() && v0.mLambda() < v0cuts.cfg_max_mass_lambda) { + fillTrackTable(collision, pos, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kProton)); + registry.fill(HIST("V0/hTPCdEdx_P_Pr"), pos.tpcInnerParam(), pos.tpcSignal()); + registry.fill(HIST("V0/hTOFbeta_P_Pr"), pos.tpcInnerParam(), pos.beta()); + } } - } - if (isPionTight(pos) && isProton(neg)) { - registry.fill(HIST("V0/hMassAntiLambda"), v0.mAntiLambda()); - if (v0cuts.cfg_min_mass_lambda < v0.mAntiLambda() && v0.mAntiLambda() < v0cuts.cfg_max_mass_lambda) { - fillTrackTable(collision, neg, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kProton), false); - registry.fill(HIST("V0/hTPCdEdx_P_Pr"), neg.tpcInnerParam(), neg.tpcSignal()); - registry.fill(HIST("V0/hTOFbeta_P_Pr"), neg.tpcInnerParam(), neg.beta()); + if (isPionTight(pos) && isProton(neg)) { + registry.fill(HIST("V0/hMassAntiLambda"), v0.mAntiLambda()); + if (v0cuts.cfg_min_mass_lambda < v0.mAntiLambda() && v0.mAntiLambda() < v0cuts.cfg_max_mass_lambda) { + fillTrackTable(collision, neg, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kProton)); + registry.fill(HIST("V0/hTPCdEdx_P_Pr"), neg.tpcInnerParam(), neg.tpcSignal()); + registry.fill(HIST("V0/hTOFbeta_P_Pr"), neg.tpcInnerParam(), neg.beta()); + } } } @@ -802,7 +812,7 @@ struct TreeCreatorElectronMLDDA { registry.fill(HIST("V0/hMassGamma_Rxy"), v0.v0radius(), v0.mGamma()); if (v0cuts.cfg_min_mass_photon < v0.mGamma() && v0.mGamma() < v0cuts.cfg_max_mass_photon) { registry.fill(HIST("V0/hXY_Gamma"), v0.x(), v0.y()); - fillTrackTable(collision, neg, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kElectron), false); + fillTrackTable(collision, neg, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kElectron)); registry.fill(HIST("V0/hTPCdEdx_P_El"), neg.tpcInnerParam(), neg.tpcSignal()); registry.fill(HIST("V0/hTOFbeta_P_El"), neg.tpcInnerParam(), neg.beta()); } @@ -813,7 +823,7 @@ struct TreeCreatorElectronMLDDA { registry.fill(HIST("V0/hMassGamma_Rxy"), v0.v0radius(), v0.mGamma()); if (v0cuts.cfg_min_mass_photon < v0.mGamma() && v0.mGamma() < v0cuts.cfg_max_mass_photon) { registry.fill(HIST("V0/hXY_Gamma"), v0.x(), v0.y()); - fillTrackTable(collision, pos, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kElectron), false); + fillTrackTable(collision, pos, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kElectron)); registry.fill(HIST("V0/hTPCdEdx_P_El"), pos.tpcInnerParam(), pos.tpcSignal()); registry.fill(HIST("V0/hTOFbeta_P_El"), pos.tpcInnerParam(), pos.beta()); } @@ -899,7 +909,7 @@ struct TreeCreatorElectronMLDDA { if (cascadecuts.cfg_min_mass_Omega < cascade.mOmega() && cascade.mOmega() < cascadecuts.cfg_max_mass_Omega) { // select Omega candidates registry.fill(HIST("V0/hTPCdEdx_P_Ka"), bachelor.tpcInnerParam(), bachelor.tpcSignal()); registry.fill(HIST("V0/hTOFbeta_P_Ka"), bachelor.tpcInnerParam(), bachelor.beta()); - fillTrackTable(collision, bachelor, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kKaon), false); + fillTrackTable(collision, bachelor, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kKaon)); } } } // end of cascade loop From c0f1db666e51eb11e7e22f831bf12e34ceba15eb Mon Sep 17 00:00:00 2001 From: EmilGorm <50658075+EmilGorm@users.noreply.github.com> Date: Fri, 25 Jul 2025 16:37:34 +0200 Subject: [PATCH 068/345] [PWGCF] add dcaxy pt-dep (#12222) --- PWGCF/Flow/Tasks/flowPtEfficiency.cxx | 45 ++++++++++++------- .../Tasks/flowGfwLightIons.cxx | 18 ++++++-- 2 files changed, 43 insertions(+), 20 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowPtEfficiency.cxx b/PWGCF/Flow/Tasks/flowPtEfficiency.cxx index 217b6f7fb36..27657e0f435 100644 --- a/PWGCF/Flow/Tasks/flowPtEfficiency.cxx +++ b/PWGCF/Flow/Tasks/flowPtEfficiency.cxx @@ -14,29 +14,32 @@ /// \since Jun/08/2023 /// \brief a task to calculate the pt efficiency -#include -#include -#include -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/RunningWorkflowInfo.h" -#include "Framework/HistogramRegistry.h" +#include "FlowContainer.h" +#include "GFW.h" +#include "GFWCumulant.h" +#include "GFWPowerArray.h" +#include "GFWWeights.h" #include "Common/Core/RecoDecay.h" -#include "Common/DataModel/EventSelection.h" #include "Common/Core/TrackSelection.h" #include "Common/Core/TrackSelectionDefaults.h" +#include "Common/DataModel/EventSelection.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "GFWPowerArray.h" -#include "GFW.h" -#include "GFWCumulant.h" -#include "GFWWeights.h" -#include "FlowContainer.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/runDataProcessing.h" +#include + +#include +#include #include #include -#include + +#include +#include using namespace o2; using namespace o2::framework; @@ -57,6 +60,8 @@ struct FlowPtEfficiency { O2_DEFINE_CONFIGURABLE(cfgCutITSclu, float, 5.0f, "minimum ITS clusters") O2_DEFINE_CONFIGURABLE(cfgCutTPCcrossedrows, float, 70.0f, "minimum TPC crossed rows") O2_DEFINE_CONFIGURABLE(cfgCutDCAxy, float, 0.2f, "DCAxy cut for tracks") + O2_DEFINE_CONFIGURABLE(cfgDCAxyNSigma, float, 7, "Cut on number of sigma deviations from expected DCA in the transverse direction"); + O2_DEFINE_CONFIGURABLE(cfgDCAxyFunction, std::string, "(0.0015+0.005/(x^1.1))", "Functional form of pt-dependent DCAxy cut"); O2_DEFINE_CONFIGURABLE(cfgCutDCAz, float, 2.0f, "DCAz cut for tracks") O2_DEFINE_CONFIGURABLE(cfgCutDCAxyppPass3Enabled, bool, false, "switch of ppPass3 DCAxy pt dependent cut") O2_DEFINE_CONFIGURABLE(cfgCutDCAzPtDepEnabled, bool, false, "switch of DCAz pt dependent cut") @@ -128,6 +133,7 @@ struct FlowPtEfficiency { std::vector corrconfigsTruth; std::vector corrconfigsReco; TRandom3* fRndm = new TRandom3(0); + TF1* fPtDepDCAxy = nullptr; bool isStable(int pdg) { @@ -230,7 +236,14 @@ struct FlowPtEfficiency { if (cfgCutDCAxyppPass3Enabled) { myTrackSel.SetMaxDcaXYPtDep([](float pt) { return 0.004f + 0.013f / pt; }); } else { - myTrackSel.SetMaxDcaXY(cfgCutDCAxy); + if (cfgCutDCAxy != 0.0) { + myTrackSel.SetMaxDcaXY(cfgCutDCAxy); + } else { + fPtDepDCAxy = new TF1("ptDepDCAxy", Form("[0]*%s", cfgDCAxyFunction->c_str()), 0.001, 100); + fPtDepDCAxy->SetParameter(0, cfgDCAxyNSigma); + LOGF(info, "DCAxy pt-dependence function: %s", Form("[0]*%s", cfgDCAxyFunction->c_str())); + myTrackSel.SetMaxDcaXYPtDep([fPtDepDCAxy = this->fPtDepDCAxy](float pt) { return fPtDepDCAxy->Eval(pt); }); + } } myTrackSel.SetMinNClustersTPC(cfgCutTPCclu); myTrackSel.SetMinNCrossedRowsTPC(cfgCutTPCcrossedrows); diff --git a/PWGCF/GenericFramework/Tasks/flowGfwLightIons.cxx b/PWGCF/GenericFramework/Tasks/flowGfwLightIons.cxx index 91f9194ef32..fb654b6014a 100644 --- a/PWGCF/GenericFramework/Tasks/flowGfwLightIons.cxx +++ b/PWGCF/GenericFramework/Tasks/flowGfwLightIons.cxx @@ -78,6 +78,7 @@ GFWRegions regions; GFWCorrConfigs configs; std::vector multGlobalCorrCutPars; std::vector multPVCorrCutPars; +std::vector multGlobalPVCorrCutPars; std::vector firstRunsOfFill; } // namespace o2::analysis::gfw @@ -127,10 +128,12 @@ struct FlowGfwLightIons { O2_DEFINE_CONFIGURABLE(cfgUseDensityDependentCorrection, bool, false, "Use density dependent efficiency correction based on Run 2 measurements"); Configurable> cfgTrackDensityP0{"cfgTrackDensityP0", std::vector{0.7217476707, 0.7384792571, 0.7542625668, 0.7640680200, 0.7701951667, 0.7755299053, 0.7805901710, 0.7849446786, 0.7957356586, 0.8113039262, 0.8211968966, 0.8280558878, 0.8329342135}, "parameter 0 for track density efficiency correction"}; Configurable> cfgTrackDensityP1{"cfgTrackDensityP1", std::vector{-2.169488e-05, -2.191913e-05, -2.295484e-05, -2.556538e-05, -2.754463e-05, -2.816832e-05, -2.846502e-05, -2.843857e-05, -2.705974e-05, -2.477018e-05, -2.321730e-05, -2.203315e-05, -2.109474e-05}, "parameter 1 for track density efficiency correction"}; - Configurable> cfgMultGlobalCutPars{"cfgMultGlobalCutPars", std::vector{2272.16, -76.6932, 1.01204, -0.00631545, 1.59868e-05, 136.336, -4.97006, 0.121199, -0.0015921, 7.66197e-06}, "Global multiplicity cut parameter values"}; - Configurable> cfgMultPVCutPars{"cfgMultPVCutPars", std::vector{3074.43, -106.192, 1.46176, -0.00968364, 2.61923e-05, 182.128, -7.43492, 0.193901, -0.00256715, 1.22594e-05}, "PV multiplicity cut parameter values"}; + Configurable> cfgMultGlobalCutPars{"cfgMultGlobalCutPars", std::vector{2272.16, -76.6932, 1.01204, -0.00631545, 1.59868e-05, 136.336, -4.97006, 0.121199, -0.0015921, 7.66197e-06}, "Global vs FT0C multiplicity cut parameter values"}; + Configurable> cfgMultPVCutPars{"cfgMultPVCutPars", std::vector{3074.43, -106.192, 1.46176, -0.00968364, 2.61923e-05, 182.128, -7.43492, 0.193901, -0.00256715, 1.22594e-05}, "PV vs FT0C multiplicity cut parameter values"}; + Configurable> cfgMultGlobalPVCutPars{"cfgMultGlobalPVCutPars", std::vector{-0.223013, 0.715849, 0.664242, 0.0829653, -0.000503733, 1.21185e-06}, "Global vs PV multiplicity cut parameter values"}; O2_DEFINE_CONFIGURABLE(cfgMultCorrHighCutFunction, std::string, "[0] + [1]*x + [2]*x*x + [3]*x*x*x + [4]*x*x*x*x + 3.*([5] + [6]*x + [7]*x*x + [8]*x*x*x + [9]*x*x*x*x)", "Functional for multiplicity correlation cut"); O2_DEFINE_CONFIGURABLE(cfgMultCorrLowCutFunction, std::string, "[0] + [1]*x + [2]*x*x + [3]*x*x*x + [4]*x*x*x*x - 3.*([5] + [6]*x + [7]*x*x + [8]*x*x*x + [9]*x*x*x*x)", "Functional for multiplicity correlation cut"); + O2_DEFINE_CONFIGURABLE(cfgMultGlobalPVCorrCutFunction, std::string, "[0] + [1]*x + 3*([2] + [3]*x + [4]*x*x + [5]*x*x*x)", "Functional for global vs pv multiplicity correlation cut"); Configurable cfgGFWBinning{"cfgGFWBinning", {40, 16, 72, 300, 0, 3000, 0.2, 10.0, 0.2, 3.0, {0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.25, 1.5, 1.75, 2, 2.25, 2.5, 2.75, 3, 3.25, 3.5, 3.75, 4, 4.5, 5, 5.5, 6, 7, 8, 9, 10}, {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90}}, "Configuration for binning"}; Configurable cfgRegions{"cfgRegions", {{"refN", "refP", "refFull"}, {-0.8, 0.4, -0.8}, {-0.4, 0.8, 0.8}, {0, 0, 0}, {1, 1, 1}}, "Configurations for GFW regions"}; @@ -237,6 +240,7 @@ struct FlowGfwLightIons { TF1* fMultPVCutHigh = nullptr; TF1* fMultCutLow = nullptr; TF1* fMultCutHigh = nullptr; + TF1* fMultPVGlobalCutHigh = nullptr; TF1* fPtDepDCAxy = nullptr; @@ -282,6 +286,7 @@ struct FlowGfwLightIons { cfgGFWBinning->Print(); o2::analysis::gfw::multGlobalCorrCutPars = cfgMultGlobalCutPars; o2::analysis::gfw::multPVCorrCutPars = cfgMultPVCutPars; + o2::analysis::gfw::multGlobalPVCorrCutPars = cfgMultGlobalPVCutPars; o2::analysis::gfw::firstRunsOfFill = cfgFirstRunsOfFill; if (cfgTimeDependent && !std::is_sorted(o2::analysis::gfw::firstRunsOfFill.begin(), o2::analysis::gfw::firstRunsOfFill.end())) { std::sort(o2::analysis::gfw::firstRunsOfFill.begin(), o2::analysis::gfw::firstRunsOfFill.end()); @@ -334,8 +339,8 @@ struct FlowGfwLightIons { }); AxisSpec bAxis = {bbinning, "#it{b}"}; AxisSpec t0cAxis = {1000, 0, 10000, "N_{ch} (T0C)"}; - AxisSpec t0aAxis = {500, 0, 500, "N_{ch} (T0A)"}; - AxisSpec v0aAxis = {500, 0, 500, "N_{ch} (V0A)"}; + AxisSpec t0aAxis = {300, 0, 30000, "N_{ch} (T0A)"}; + AxisSpec v0aAxis = {800, 0, 80000, "N_{ch} (V0A)"}; AxisSpec multpvAxis = {600, 0, 600, "N_{ch} (PV)"}; AxisSpec dcaZAXis = {200, -2, 2, "DCA_{z} (cm)"}; AxisSpec dcaXYAXis = {200, -0.5, 0.5, "DCA_{xy} (cm)"}; @@ -472,6 +477,8 @@ struct FlowGfwLightIons { fMultCutLow->SetParameters(&(o2::analysis::gfw::multGlobalCorrCutPars[0])); fMultCutHigh = new TF1("fMultCutHigh", cfgMultCorrHighCutFunction->c_str(), 0, 100); fMultCutHigh->SetParameters(&(o2::analysis::gfw::multGlobalCorrCutPars[0])); + fMultPVGlobalCutHigh = new TF1("fMultPVGlobalCutHigh", cfgMultGlobalPVCorrCutFunction->c_str(), 0, nchbinning.back()); + fMultPVGlobalCutHigh->SetParameters(&(o2::analysis::gfw::multGlobalPVCorrCutPars[0])); } if (cfgUseDensityDependentCorrection) { std::vector pTEffBins = {0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.4, 1.8, 2.2, 2.6, 3.0}; @@ -681,6 +688,8 @@ struct FlowGfwLightIons { return 0; if (multTrk > fMultCutHigh->Eval(centrality)) return 0; + if (multTrk > fMultPVGlobalCutHigh->Eval(collision.multNTracksPV())) + return 0; registry.fill(HIST("eventQA/eventSel"), kMultCuts); if (cfgRunByRun) th1sList[run][hEventSel]->Fill(kMultCuts); @@ -1199,6 +1208,7 @@ struct FlowGfwLightIons { for (const auto& collision : collisions) { centrality = getCentrality(collision); } + std::vector numberOfTracks; for (auto const& collision : collisions) { auto groupedTracks = tracks.sliceBy(perCollision, collision.globalIndex()); From 05c8c7a721e461c2852e7b7089b4c1ce454fe06c Mon Sep 17 00:00:00 2001 From: Roberta Ferioli <142217183+Roberta-Ferioli@users.noreply.github.com> Date: Fri, 25 Jul 2025 17:41:13 +0200 Subject: [PATCH 069/345] [PWGLF] Add possibility to process MC as Data, saving info (#12243) --- PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx | 55 ++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx b/PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx index ac68cf2c9a0..f1c60d198e1 100644 --- a/PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx +++ b/PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx @@ -1052,6 +1052,61 @@ struct nucleiSpectra { } PROCESS_SWITCH(nucleiSpectra, processMatching, "Matching analysis", false); + + void processMCasData(soa::Join const& collisions, aod::McCollisions const& mcCollisions, soa::Join const& tracks, aod::McParticles const& particlesMC, aod::BCsWithTimestamps const&) + { + nuclei::candidates.clear(); + std::vector goodCollisions(mcCollisions.size(), false); + for (auto& collision : collisions) { + if (!eventSelection(collision)) { + continue; + } + goodCollisions[collision.mcCollisionId()] = true; + const auto& slicedTracks = tracks.sliceBy(tracksPerCollisions, collision.globalIndex()); + fillDataInfo(collision, slicedTracks); + } + std::vector isReconstructed(particlesMC.size(), false); + for (size_t i{0}; i < nuclei::candidates.size(); ++i) { + auto& c = nuclei::candidates[i]; + if (c.fillTree) { + auto label = tracks.iteratorAt(c.globalIndex); + if (label.mcParticleId() < -1 || label.mcParticleId() >= particlesMC.size()) { + continue; + } + auto particle = particlesMC.iteratorAt(label.mcParticleId()); + int motherPdgCode = 0; + float motherDecRadius = -1; + isReconstructed[particle.globalIndex()] = true; + if (particle.isPhysicalPrimary()) { + c.flags |= kIsPhysicalPrimary; + if (particle.has_mothers()) { + for (auto& motherparticle : particle.mothers_as()) { + if (std::find(nuclei::hfMothCodes.begin(), nuclei::hfMothCodes.end(), std::abs(motherparticle.pdgCode())) != nuclei::hfMothCodes.end()) { + c.flags |= kIsSecondaryFromWeakDecay; + motherPdgCode = motherparticle.pdgCode(); + motherDecRadius = std::hypot(particle.vx() - motherparticle.vx(), particle.vy() - motherparticle.vy()); + break; + } + } + } + } else if (particle.has_mothers()) { + c.flags |= kIsSecondaryFromWeakDecay; + for (auto& motherparticle : particle.mothers_as()) { + motherPdgCode = motherparticle.pdgCode(); + motherDecRadius = std::hypot(particle.vx() - motherparticle.vx(), particle.vy() - motherparticle.vy()); + } + } else { + c.flags |= kIsSecondaryFromMaterial; + } + + isReconstructed[particle.globalIndex()] = true; + float absoDecL = computeAbsoDecL(particle); + + nucleiTableMC(c.pt, c.eta, c.phi, c.tpcInnerParam, c.beta, c.zVertex, c.nContrib, c.DCAxy, c.DCAz, c.TPCsignal, c.ITSchi2, c.TPCchi2, c.TOFchi2, c.flags, c.TPCfindableCls, c.TPCcrossedRows, c.ITSclsMap, c.TPCnCls, c.TPCnClsShared, c.clusterSizesITS, goodCollisions[particle.mcCollisionId()], particle.pt(), particle.eta(), particle.phi(), particle.pdgCode(), motherPdgCode, motherDecRadius, absoDecL); + } + } + } + PROCESS_SWITCH(nucleiSpectra, processMCasData, "MC as data analysis", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From e3cf868b5bd37d530a80b7c8addf393a96632476 Mon Sep 17 00:00:00 2001 From: sawan <124118453+sawankumawat@users.noreply.github.com> Date: Fri, 25 Jul 2025 21:48:25 +0530 Subject: [PATCH 070/345] [PWGLF] Added occupancy cuts and solved O2 linter errors (#12234) Co-authored-by: Sawan Sawan --- PWGLF/Tasks/Resonances/kstarqa.cxx | 288 ++++++++++++++++------------- 1 file changed, 163 insertions(+), 125 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarqa.cxx b/PWGLF/Tasks/Resonances/kstarqa.cxx index 08c1b4173d9..078fc6916bf 100644 --- a/PWGLF/Tasks/Resonances/kstarqa.cxx +++ b/PWGLF/Tasks/Resonances/kstarqa.cxx @@ -72,6 +72,38 @@ struct Kstarqa { } rctCut; RCTFlagsChecker rctChecker; + struct : ConfigurableGroup { + // Configurables for event selections + Configurable isINELgt0{"isINELgt0", true, "INEL>0 selection"}; + Configurable isTriggerTVX{"isTriggerTVX", false, "TriggerTVX"}; + Configurable isGoodZvtxFT0vsPV{"isGoodZvtxFT0vsPV", false, "IsGoodZvtxFT0vsPV"}; + Configurable isApplyOccCut{"isApplyOccCut", true, "Apply occupancy cut"}; + Configurable isNoSameBunchPileup{"isNoSameBunchPileup", true, "kNoSameBunchPileup"}; + Configurable isAllLayersGoodITS{"isAllLayersGoodITS", true, "Require all ITS layers to be good"}; + Configurable isNoTimeFrameBorder{"isNoTimeFrameBorder", true, "kNoTimeFrameBorder"}; + Configurable isNoITSROFrameBorder{"isNoITSROFrameBorder", true, "kNoITSROFrameBorder"}; + + Configurable cutzvertex{"cutzvertex", 10.0f, "Accepted z-vertex range (cm)"}; + Configurable configOccCut{"configOccCut", 1000., "Occupancy cut"}; + + // Configurables for track selections + Configurable cfgPVContributor{"cfgPVContributor", false, "PV contributor track selection"}; // PV Contriuibutor + Configurable cfgPrimaryTrack{"cfgPrimaryTrack", false, "Primary track selection"}; // kGoldenChi2 | kDCAxy | kDCAz + Configurable isGlobalTracks{"isGlobalTracks", true, "isGlobalTracks"}; + + Configurable rotationalCut{"rotationalCut", 10, "Cut value (Rotation angle pi - pi/cut and pi + pi/cut)"}; + Configurable cfgCutPT{"cfgCutPT", 0.2f, "PT cut on daughter track"}; + Configurable cfgCutEta{"cfgCutEta", 0.8f, "Eta cut on daughter track"}; + Configurable cfgCutDCAxy{"cfgCutDCAxy", 2.0f, "DCAxy range for tracks"}; + Configurable cfgCutDCAz{"cfgCutDCAz", 2.0f, "DCAz range for tracks"}; + Configurable cfgNoMixedEvents{"cfgNoMixedEvents", 5, "Number of mixed events per event"}; + Configurable cfgITScluster{"cfgITScluster", 0, "Number of ITS cluster"}; + Configurable cfgTPCcluster{"cfgTPCcluster", 70, "Number of TPC cluster"}; + Configurable cfgRCRFC{"cfgRCRFC", 0.8f, "Crossed Rows to Findable Clusters"}; + Configurable cfgITSChi2NCl{"cfgITSChi2NCl", 36.0, "ITS Chi2/NCl"}; + Configurable cfgTPCChi2NCl{"cfgTPCChi2NCl", 4.0, "TPC Chi2/NCl"}; + } selectionConfig; + // Histograms are defined with HistogramRegistry HistogramRegistry rEventSelection{"eventSelection", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry hInvMass{"hInvMass", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; @@ -79,7 +111,6 @@ struct Kstarqa { HistogramRegistry hOthers{"hOthers", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; // Confugrable for QA histograms - Configurable isINELgt0{"isINELgt0", true, "INEL>0 selection"}; Configurable calcLikeSign{"calcLikeSign", true, "Calculate Like Sign"}; Configurable calcRotational{"calcRotational", false, "Calculate Rotational"}; Configurable cQAplots{"cQAplots", true, "cQAplots"}; @@ -91,24 +122,7 @@ struct Kstarqa { Configurable cSelectMultEstimator{"cSelectMultEstimator", 0, "Select multiplicity estimator: 0 - FT0M, 1 - FT0A, 2 - FT0C"}; Configurable applyRecMotherRapidity{"applyRecMotherRapidity", true, "Apply rapidity cut on reconstructed mother track"}; Configurable applypTdepPID{"applypTdepPID", false, "Apply pT dependent PID"}; - Configurable ispileupGoodvtxCut{"ispileupGoodvtxCut", true, "kNoSameBunchPileup, kIsGoodZvtxFT0vsPV cuts"}; - Configurable allLayersGoodITS{"allLayersGoodITS", true, "Require all ITS layers to be good"}; - - // Configurables for track selections - Configurable rotationalCut{"rotationalCut", 10, "Cut value (Rotation angle pi - pi/cut and pi + pi/cut)"}; - Configurable cfgCutPT{"cfgCutPT", 0.2f, "PT cut on daughter track"}; - Configurable cfgCutEta{"cfgCutEta", 0.8f, "Eta cut on daughter track"}; - Configurable cfgCutDCAxy{"cfgCutDCAxy", 2.0f, "DCAxy range for tracks"}; - Configurable cfgCutDCAz{"cfgCutDCAz", 2.0f, "DCAz range for tracks"}; - Configurable cfgNoMixedEvents{"cfgNoMixedEvents", 5, "Number of mixed events per event"}; - Configurable isGlobalTracks{"isGlobalTracks", true, "isGlobalTracks"}; - Configurable cfgITScluster{"cfgITScluster", 0, "Number of ITS cluster"}; - Configurable cfgTPCcluster{"cfgTPCcluster", 70, "Number of TPC cluster"}; - Configurable cfgRCRFC{"cfgRCRFC", 0.8f, "Crossed Rows to Findable Clusters"}; - Configurable cfgITSChi2NCl{"cfgITSChi2NCl", 36.0, "ITS Chi2/NCl"}; - Configurable cfgTPCChi2NCl{"cfgTPCChi2NCl", 4.0, "TPC Chi2/NCl"}; - Configurable cfgPVContributor{"cfgPVContributor", false, "PV contributor track selection"}; // PV Contriuibutor - Configurable cfgPrimaryTrack{"cfgPrimaryTrack", false, "Primary track selection"}; // kGoldenChi2 | kDCAxy | kDCAz + // Configurable cfgGlobalWoDCATrack{"cfgGlobalWoDCATrack", false, "Global track selection without DCA"}; // kQualityTracks (kTrackType | kTPCNCls | kTPCCrossedRows | kTPCCrossedRowsOverNCls | kTPCChi2NDF | kTPCRefit | kITSNCls | kITSChi2NDF | kITSRefit | kITSHits) | kInAcceptanceTracks (kPtRange | kEtaRange) Configurable cBetaCutTOF{"cBetaCutTOF", 0.0, "cut TOF beta"}; Configurable cFakeTrack{"cFakeTrack", true, "Fake track selection"}; @@ -123,14 +137,6 @@ struct Kstarqa { Configurable nsigmaCutCombinedKa{"nsigmaCutCombinedKa", 3.0, "Combined Nsigma cut for kaon"}; Configurable nsigmaCutCombinedPi{"nsigmaCutCombinedPi", 3.0, "Combined Nsigma cut for pion"}; - // Event selection configurables - // Configurable timFrameEvsel{"timFrameEvsel", true, "TPC Time frame boundary cut"}; - // Configurable cTVXEvsel{"cTVXEvsel", true, "Triggger selection"}; - Configurable isTriggerTVX{"isTriggerTVX", false, "TriggerTVX"}; - Configurable isGoodZvtxFT0vsPV{"isGoodZvtxFT0vsPV", false, "IsGoodZvtxFT0vsPV"}; - Configurable cutzvertex{"cutzvertex", 10.0f, "Accepted z-vertex range (cm)"}; - // Configurable cMID{"cMID", false, "Misidentification of tracks"}; - // Configurable for histograms Configurable avoidsplitrackMC{"avoidsplitrackMC", true, "avoid split track in MC"}; Configurable cAllGenCollisions{"cAllGenCollisions", false, "To fill all generated collisions for the signal loss calculations"}; @@ -166,7 +172,8 @@ struct Kstarqa { // Event selection rEventSelection.add("hVertexZRec", "hVertexZRec", {HistType::kTH1F, {vertexZAxis}}); rEventSelection.add("hMultiplicity", "Multiplicity percentile", kTH1F, {{110, 0, 110}}); - rEventSelection.add("hEventCutFlow", "No. of event after cuts", kTH1I, {{10, 0, 10}}); + + rEventSelection.add("hEventCutFlow", "No. of event after cuts", kTH1I, {{20, 0, 20}}); std::shared_ptr hCutFlow = rEventSelection.get(HIST("hEventCutFlow")); hCutFlow->GetXaxis()->SetBinLabel(1, "All Events"); hCutFlow->GetXaxis()->SetBinLabel(2, "|Vz| < cut"); @@ -175,9 +182,10 @@ struct Kstarqa { hCutFlow->GetXaxis()->SetBinLabel(5, "kNoITSROFrameBorder"); hCutFlow->GetXaxis()->SetBinLabel(6, "kNoSameBunchPileup"); hCutFlow->GetXaxis()->SetBinLabel(7, "kIsGoodITSLayersAll"); - hCutFlow->GetXaxis()->SetBinLabel(8, "rctChecker"); - hCutFlow->GetXaxis()->SetBinLabel(9, "kIsTriggerTVX"); - hCutFlow->GetXaxis()->SetBinLabel(10, "kIsGoodZvtxFT0vsPV"); + hCutFlow->GetXaxis()->SetBinLabel(8, "Occupancy Cut"); + hCutFlow->GetXaxis()->SetBinLabel(9, "rctChecker"); + hCutFlow->GetXaxis()->SetBinLabel(10, "kIsTriggerTVX"); + hCutFlow->GetXaxis()->SetBinLabel(11, "kIsGoodZvtxFT0vsPV"); // for primary tracksbinsMultPlot if (cQAplots) { @@ -187,6 +195,9 @@ struct Kstarqa { hOthers.add("hCRFC_after", "CRFC after distribution", kTH1F, {{100, 0.0f, 10.0f}}); hOthers.add("hCRFC_before", "CRFC before distribution", kTH1F, {{100, 0.0f, 10.0f}}); + hOthers.add("hKstar_Rap", "Pair rapidity distribution; y; Counts", kTH1F, {{1000, -5.0f, 5.0f}}); + hOthers.add("hKstar_Eta", "Pair eta distribution; #eta; Counts", kTH1F, {{1000, -5.0f, 5.0f}}); + hPID.add("Before/hNsigmaTPC_Ka_before", "N #sigma Kaon TPC before", kTH2F, {{50, 0.0f, 10.0f}, {100, -10.0f, 10.0f}}); hPID.add("Before/hNsigmaTOF_Ka_before", "N #sigma Kaon TOF before", kTH2F, {{50, 0.0f, 10.0f}, {100, -10.0f, 10.0f}}); hPID.add("Before/hNsigmaTPC_Pi_before", "N #sigma Pion TPC before", kTH2F, {{50, 0.0f, 10.0f}, {100, -10.0f, 10.0f}}); @@ -214,6 +225,7 @@ struct Kstarqa { hPID.add("After/hNsigmaKaonTOF_after", "N #sigma Kaon TOF after", kTH2F, {{50, 0.0f, 10.0f}, {100, -10.0f, 10.0f}}); hPID.add("After/hNsigma_TPC_TOF_Ka_after", "N #sigma Kaon TOF after", kTH2F, {{50, -5.0f, 5.0f}, {50, -5.0f, 5.0f}}); hPID.add("After/hNsigma_TPC_TOF_Pi_after", "N #sigma Pion TOF after", kTH2F, {{50, -5.0f, 5.0f}, {50, -5.0f, 5.0f}}); + hPID.add("After/hDcaxyPi", "Dcaxy distribution of selected Pions", kTH1F, {{200, -1.0f, 1.0f}}); hPID.add("After/hDcaxyKa", "Dcaxy distribution of selected Kaons", kTH1F, {{200, -1.0f, 1.0f}}); hPID.add("After/hDcazPi", "Dcaz distribution of selected Pions", kTH1F, {{200, -1.0f, 1.0f}}); @@ -272,7 +284,7 @@ struct Kstarqa { if (fillHist) rEventSelection.fill(HIST("hEventCutFlow"), 0); - if (std::abs(collision.posZ()) > cutzvertex) + if (std::abs(collision.posZ()) > selectionConfig.cutzvertex) return false; if (fillHist) rEventSelection.fill(HIST("hEventCutFlow"), 1); @@ -282,71 +294,85 @@ struct Kstarqa { if (fillHist) rEventSelection.fill(HIST("hEventCutFlow"), 2); - if (!collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) + if (selectionConfig.isNoTimeFrameBorder && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) return false; if (fillHist) rEventSelection.fill(HIST("hEventCutFlow"), 3); - if (!collision.selection_bit(aod::evsel::kNoITSROFrameBorder)) + if (selectionConfig.isNoITSROFrameBorder && !collision.selection_bit(aod::evsel::kNoITSROFrameBorder)) return false; if (fillHist) rEventSelection.fill(HIST("hEventCutFlow"), 4); - if (ispileupGoodvtxCut && (!collision.selection_bit(aod::evsel::kNoSameBunchPileup))) + if (selectionConfig.isNoSameBunchPileup && (!collision.selection_bit(aod::evsel::kNoSameBunchPileup))) return false; if (fillHist) rEventSelection.fill(HIST("hEventCutFlow"), 5); - if (allLayersGoodITS && !collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) + if (selectionConfig.isAllLayersGoodITS && !collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) return false; if (fillHist) rEventSelection.fill(HIST("hEventCutFlow"), 6); - if (rctCut.requireRCTFlagChecker && !rctChecker(collision)) + if (selectionConfig.isApplyOccCut && (!collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard))) + return false; + + if (selectionConfig.isApplyOccCut && (std::abs(collision.trackOccupancyInTimeRange()) > selectionConfig.configOccCut)) return false; if (fillHist) rEventSelection.fill(HIST("hEventCutFlow"), 7); - if (isTriggerTVX && !collision.selection_bit(aod::evsel::kIsTriggerTVX)) + if (rctCut.requireRCTFlagChecker && !rctChecker(collision)) return false; if (fillHist) rEventSelection.fill(HIST("hEventCutFlow"), 8); - if (isGoodZvtxFT0vsPV && !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) + if (selectionConfig.isTriggerTVX && !collision.selection_bit(aod::evsel::kIsTriggerTVX)) return false; if (fillHist) rEventSelection.fill(HIST("hEventCutFlow"), 9); + if (selectionConfig.isGoodZvtxFT0vsPV && !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) + return false; + if (fillHist) + rEventSelection.fill(HIST("hEventCutFlow"), 10); + + if (selectionConfig.isINELgt0 && !collision.isInelGt0()) { + return false; + } + if (fillHist) + rEventSelection.fill(HIST("hEventCutFlow"), 11); + return true; } template bool selectionTrack(const T& candidate) { - if (isGlobalTracks && !(candidate.isGlobalTrackWoDCA() && candidate.isPVContributor() && std::abs(candidate.dcaXY()) < cfgCutDCAxy && std::abs(candidate.dcaZ()) < cfgCutDCAz && candidate.itsNCls() > cfgITScluster && candidate.tpcNClsFound() > cfgTPCcluster && std::abs(candidate.eta()) < cfgCutEta && std::abs(candidate.pt()) > cfgCutPT)) { + if (selectionConfig.isGlobalTracks && !(candidate.isGlobalTrackWoDCA() && candidate.isPVContributor() && std::abs(candidate.dcaXY()) < selectionConfig.cfgCutDCAxy && std::abs(candidate.dcaZ()) < selectionConfig.cfgCutDCAz && candidate.itsNCls() > selectionConfig.cfgITScluster && candidate.tpcNClsFound() > selectionConfig.cfgTPCcluster && std::abs(candidate.eta()) < selectionConfig.cfgCutEta && std::abs(candidate.pt()) > selectionConfig.cfgCutPT)) { return false; - } else if (!isGlobalTracks) { - if (std::abs(candidate.pt()) < cfgCutPT) + } else if (!selectionConfig.isGlobalTracks) { + if (std::abs(candidate.pt()) < selectionConfig.cfgCutPT) return false; - if (std::abs(candidate.eta()) > cfgCutEta) + if (std::abs(candidate.eta()) > selectionConfig.cfgCutEta) return false; - if (std::abs(candidate.dcaXY()) > cfgCutDCAxy) + if (std::abs(candidate.dcaXY()) > selectionConfig.cfgCutDCAxy) return false; - if (std::abs(candidate.dcaZ()) > cfgCutDCAz) + if (std::abs(candidate.dcaZ()) > selectionConfig.cfgCutDCAz) return false; - if (candidate.tpcCrossedRowsOverFindableCls() < cfgRCRFC) + if (candidate.tpcCrossedRowsOverFindableCls() < selectionConfig.cfgRCRFC) return false; - if (candidate.itsNCls() < cfgITScluster) + if (candidate.itsNCls() < selectionConfig.cfgITScluster) return false; - if (candidate.tpcNClsFound() < cfgTPCcluster) + if (candidate.tpcNClsFound() < selectionConfig.cfgTPCcluster) return false; - if (candidate.itsChi2NCl() >= cfgITSChi2NCl) + if (candidate.itsChi2NCl() >= selectionConfig.cfgITSChi2NCl) return false; - if (candidate.tpcChi2NCl() >= cfgTPCChi2NCl) + if (candidate.tpcChi2NCl() >= selectionConfig.cfgTPCChi2NCl) return false; - if (cfgPVContributor && !candidate.isPVContributor()) + if (selectionConfig.cfgPVContributor && !candidate.isPVContributor()) return false; - if (cfgPrimaryTrack && !candidate.isPrimaryTrack()) + if (selectionConfig.cfgPrimaryTrack && !candidate.isPrimaryTrack()) return false; } @@ -537,10 +563,10 @@ struct Kstarqa { // Processed events will be already fulfilling the event selection // requirements // Filter eventFilter = (o2::aod::evsel::sel8 == true); - Filter posZFilter = (nabs(o2::aod::collision::posZ) < cutzvertex); + Filter posZFilter = (nabs(o2::aod::collision::posZ) < selectionConfig.cutzvertex); - Filter acceptanceFilter = (nabs(aod::track::eta) < cfgCutEta && nabs(aod::track::pt) > cfgCutPT); - Filter fDCAcutFilter = (nabs(aod::track::dcaXY) < cfgCutDCAxy) && (nabs(aod::track::dcaZ) < cfgCutDCAz); + Filter acceptanceFilter = (nabs(aod::track::eta) < selectionConfig.cfgCutEta && nabs(aod::track::pt) > selectionConfig.cfgCutPT); + Filter fDCAcutFilter = (nabs(aod::track::dcaXY) < selectionConfig.cfgCutDCAxy) && (nabs(aod::track::dcaZ) < selectionConfig.cfgCutDCAz); using EventCandidates = soa::Join; // aod::CentNGlobals, aod::CentNTPVs, aod::CentMFTs using EventCandidatesMix = soa::Filtered>; // aod::CentNGlobals, aod::CentNTPVs, aod::CentMFTs @@ -573,7 +599,7 @@ struct Kstarqa { } for (int i = 0; i < cRotations; i++) { - theta2 = rn->Uniform(o2::constants::math::PI - o2::constants::math::PI / rotationalCut, o2::constants::math::PI + o2::constants::math::PI / rotationalCut); + theta2 = rn->Uniform(o2::constants::math::PI - o2::constants::math::PI / selectionConfig.rotationalCut, o2::constants::math::PI + o2::constants::math::PI / selectionConfig.rotationalCut); daughterRot = ROOT::Math::PxPyPzMVector(daughter1.Px() * std::cos(theta2) - daughter1.Py() * std::sin(theta2), daughter1.Px() * std::sin(theta2) + daughter1.Py() * std::cos(theta2), daughter1.Pz(), daughter1.M()); @@ -721,7 +747,7 @@ struct Kstarqa { // } // rEventSelection.fill(HIST("events_check_data"), 2.5); - if (!selectionEvent(collision)) { + if (!selectionEvent(collision, true)) { return; } @@ -776,6 +802,7 @@ struct Kstarqa { hPID.fill(HIST("Before/hNsigmaTOF_Pi_before"), track2.pt(), track2.tofNSigmaPi()); hPID.fill(HIST("Before/hNsigma_TPC_TOF_Ka_before"), track1.tpcNSigmaKa(), track1.tofNSigmaKa()); hPID.fill(HIST("Before/hNsigma_TPC_TOF_Pi_before"), track2.tpcNSigmaPi(), track2.tofNSigmaPi()); + hPID.fill(HIST("Before/hTPCnsigKa_mult_pt"), track1.tpcNSigmaKa(), multiplicity, track1.pt()); hPID.fill(HIST("Before/hTPCnsigPi_mult_pt"), track2.tpcNSigmaPi(), multiplicity, track2.pt()); hPID.fill(HIST("Before/hTOFnsigKa_mult_pt"), track1.tofNSigmaKa(), multiplicity, track1.pt()); @@ -865,6 +892,10 @@ struct Kstarqa { daughter1 = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa); daughter2 = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massPi); mother = daughter1 + daughter2; // Kstar meson + + hOthers.fill(HIST("hKstar_Rap"), mother.Rapidity()); + hOthers.fill(HIST("hKstar_Eta"), mother.Eta()); + isMix = false; fillInvMass(daughter1, daughter2, mother, multiplicity, isMix, track1, track2); } @@ -887,10 +918,10 @@ struct Kstarqa { BinningTypeFT0A binningOnFT0A{{axisVertex, axisMultiplicity}, true}; BinningTypeFV0A binningOnFV0A{{axisVertex, axisMultiplicity}, true}; - SameKindPair pair1{binningOnPositions, cfgNoMixedEvents, -1, &cache}; - SameKindPair pair2{binningOnCentrality, cfgNoMixedEvents, -1, &cache}; - SameKindPair pair3{binningOnFT0A, cfgNoMixedEvents, -1, &cache}; - SameKindPair pair4{binningOnFV0A, cfgNoMixedEvents, -1, &cache}; + SameKindPair pair1{binningOnPositions, selectionConfig.cfgNoMixedEvents, -1, &cache}; + SameKindPair pair2{binningOnCentrality, selectionConfig.cfgNoMixedEvents, -1, &cache}; + SameKindPair pair3{binningOnFT0A, selectionConfig.cfgNoMixedEvents, -1, &cache}; + SameKindPair pair4{binningOnFV0A, selectionConfig.cfgNoMixedEvents, -1, &cache}; void processME(EventCandidatesMix const&, TrackCandidates const&) { @@ -900,7 +931,7 @@ struct Kstarqa { // if (!c1.sel8() || !c2.sel8()) // continue; - if (!selectionEvent(c1) || !selectionEvent(c2)) { + if (!selectionEvent(c1, false) || !selectionEvent(c2, false)) { continue; } @@ -943,44 +974,46 @@ struct Kstarqa { void processGen(aod::McCollision const& mcCollision, aod::McParticles const& mcParticles, const soa::SmallGroups& collisions) { rEventSelection.fill(HIST("events_check"), 0.5); - if (std::abs(mcCollision.posZ()) < cutzvertex) { + if (std::abs(mcCollision.posZ()) < selectionConfig.cutzvertex) { rEventSelection.fill(HIST("events_check"), 1.5); } int nChInel = 0; for (const auto& mcParticle : mcParticles) { auto pdgcode = std::abs(mcParticle.pdgCode()); - if (mcParticle.isPhysicalPrimary() && (pdgcode == 211 || pdgcode == 321 || pdgcode == 2212 || pdgcode == 11 || pdgcode == 13)) { + if (mcParticle.isPhysicalPrimary() && (pdgcode == PDG_t::kPiPlus || pdgcode == PDG_t::kKPlus || pdgcode == PDG_t::kProton || pdgcode == std::abs(PDG_t::kElectron) || pdgcode == std::abs(PDG_t::kMuonMinus))) { if (std::abs(mcParticle.eta()) < 1.0) { nChInel = nChInel + 1; } } } - if (nChInel > 0 && std::abs(mcCollision.posZ()) < cutzvertex) + if (nChInel > 0 && std::abs(mcCollision.posZ()) < selectionConfig.cutzvertex) rEventSelection.fill(HIST("events_check"), 2.5); std::vector selectedEvents(collisions.size()); int nevts = 0; multiplicity = -1.0; for (const auto& collision : collisions) { - // if (!collision.sel8() || std::abs(collision.mcCollision().posZ()) > cutzvertex) { - if (std::abs(collision.mcCollision().posZ()) > cutzvertex) { + // if (!collision.sel8() || std::abs(collision.mcCollision().posZ()) > selectionConfig.cutzvertex) { + if (std::abs(collision.mcCollision().posZ()) > selectionConfig.cutzvertex) { continue; } - - if (!collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { + if (!collision.sel8()) { continue; } - if (!collision.selection_bit(aod::evsel::kIsTriggerTVX)) { + if (selectionConfig.isNoTimeFrameBorder && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { continue; } - if (!collision.sel8()) { + if (selectionConfig.isTriggerTVX && !collision.selection_bit(aod::evsel::kIsTriggerTVX)) { + continue; + } + if (selectionConfig.isINELgt0 && !collision.isInelGt0()) { continue; } - if (isINELgt0 && !collision.isInelGt0()) { + if (selectionConfig.isNoSameBunchPileup && !collision.selection_bit(aod::evsel::kNoSameBunchPileup)) { continue; } - if (ispileupGoodvtxCut && (!collision.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { + if (selectionConfig.isGoodZvtxFT0vsPV && !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { continue; } multiplicity = collision.centFT0M(); @@ -1003,7 +1036,7 @@ struct Kstarqa { } rEventSelection.fill(HIST("events_check"), 5.5); - if (std::abs(mcParticle.pdgCode()) != 313) { + if (std::abs(mcParticle.pdgCode()) != o2::constants::physics::kK0Star892) { continue; } rEventSelection.fill(HIST("events_check"), 6.5); @@ -1022,11 +1055,11 @@ struct Kstarqa { } rEventSelection.fill(HIST("events_check"), 8.5); - if (std::abs(kCurrentDaughter.pdgCode()) == 321) { + if (std::abs(kCurrentDaughter.pdgCode()) == PDG_t::kKPlus) { passkaon = true; daughter1 = ROOT::Math::PxPyPzMVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), massKa); - } else if (std::abs(kCurrentDaughter.pdgCode()) == 211) { + } else if (std::abs(kCurrentDaughter.pdgCode()) == PDG_t::kPiPlus) { passpion = true; daughter2 = ROOT::Math::PxPyPzMVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), massPi); } @@ -1040,43 +1073,43 @@ struct Kstarqa { } } PROCESS_SWITCH(Kstarqa, processGen, "Process Generated", false); + /* + void processEvtLossSigLossMC(aod::McCollisions::iterator const&, aod::McParticles const& mcParticles, const soa::SmallGroups& recCollisions) + { + + bool isSel = false; + // auto multiplicity1 = -999.; + for (const auto& RecCollision : recCollisions) { + if (!selectionEvent(RecCollision, false)) + continue; - // void processEvtLossSigLossMC(aod::McCollisions::iterator const&, aod::McParticles const& mcParticles, const soa::SmallGroups& recCollisions) - // { - - // bool isSel = false; - // // auto multiplicity1 = -999.; - // for (const auto& RecCollision : recCollisions) { - // if (!selectionEvent(RecCollision)) - // continue; - - // // if (cSelectMultEstimator == 0) { - // // multiplicity1 = RecCollision.centFT0M(); - // // } else if (cSelectMultEstimator == 1) { - // // multiplicity1 = RecCollision.centFT0A(); - // // } else if (cSelectMultEstimator == 2) { - // // multiplicity1 = RecCollision.centFT0C(); - // // } else { - // // multiplicity1 = RecCollision.centFT0M(); - // // } - - // isSel = true; - // } + // if (cSelectMultEstimator == 0) { + // multiplicity1 = RecCollision.centFT0M(); + // } else if (cSelectMultEstimator == 1) { + // multiplicity1 = RecCollision.centFT0A(); + // } else if (cSelectMultEstimator == 2) { + // multiplicity1 = RecCollision.centFT0C(); + // } else { + // multiplicity1 = RecCollision.centFT0M(); + // } - // // Generated MC - // for (const auto& mcPart : mcParticles) { - // if (std::abs(mcPart.y()) >= 0.5 || std::abs(mcPart.pdgCode()) != 313) - // continue; + isSel = true; + } - // // signal loss estimation - // hInvMass.fill(HIST("kstargenBeforeEvtSel"), mcPart.pt()); - // if (isSel) { - // hInvMass.fill(HIST("kstargenAfterEvtSel"), mcPart.pt()); - // } - // } // end loop on gen particles - // } - // PROCESS_SWITCH(Kstarqa, processEvtLossSigLossMC, "Process Signal Loss, Event Loss", false); + // Generated MC + for (const auto& mcPart : mcParticles) { + if (std::abs(mcPart.y()) >= 0.5 || std::abs(mcPart.pdgCode()) != o2::constants::physics::kK0Star892) + continue; + // signal loss estimation + hInvMass.fill(HIST("kstargenBeforeEvtSel"), mcPart.pt()); + if (isSel) { + hInvMass.fill(HIST("kstargenAfterEvtSel"), mcPart.pt()); + } + } // end loop on gen particles + } + PROCESS_SWITCH(Kstarqa, processEvtLossSigLossMC, "Process Signal Loss, Event Loss", false); + */ void processRec(EventCandidatesMC::iterator const& collision, TrackCandidatesMC const& tracks, aod::McParticles const&, aod::McCollisions const& /*mcCollisions*/) { @@ -1087,22 +1120,22 @@ struct Kstarqa { } rEventSelection.fill(HIST("events_checkrec"), 1.5); - if (isINELgt0 && !collision.isInelGt0()) { + if (selectionConfig.isINELgt0 && !collision.isInelGt0()) { return; } - // if (std::abs(collision.mcCollision().posZ()) > cutzvertex || !collision.sel8()) { - if (std::abs(collision.mcCollision().posZ()) > cutzvertex) { + // if (std::abs(collision.mcCollision().posZ()) > selectionConfig.cutzvertex || !collision.sel8()) { + if (std::abs(collision.mcCollision().posZ()) > selectionConfig.cutzvertex) { return; } rEventSelection.fill(HIST("events_checkrec"), 2.5); - if (!collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { + if (selectionConfig.isNoTimeFrameBorder && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { return; } rEventSelection.fill(HIST("events_checkrec"), 3.5); - if (!collision.selection_bit(aod::evsel::kIsTriggerTVX)) { + if (selectionConfig.isTriggerTVX && !collision.selection_bit(aod::evsel::kIsTriggerTVX)) { return; } rEventSelection.fill(HIST("events_checkrec"), 4.5); @@ -1110,9 +1143,14 @@ struct Kstarqa { if (!collision.sel8()) { return; } - if (ispileupGoodvtxCut && (!collision.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { + + if (selectionConfig.isNoSameBunchPileup && !collision.selection_bit(aod::evsel::kNoSameBunchPileup)) { return; } + if (selectionConfig.isGoodZvtxFT0vsPV && !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { + return; + } + multiplicity = collision.centFT0M(); hInvMass.fill(HIST("h1RecMult"), multiplicity); @@ -1156,31 +1194,31 @@ struct Kstarqa { int track1PDG = std::abs(mctrack1.pdgCode()); int track2PDG = std::abs(mctrack2.pdgCode()); - if (cQAplots && (mctrack2.pdgCode() == 211)) { // pion + if (cQAplots && (mctrack2.pdgCode() == PDG_t::kPiPlus)) { // pion hPID.fill(HIST("Before/h1PID_TPC_pos_pion"), track2.tpcNSigmaPi()); hPID.fill(HIST("Before/h1PID_TOF_pos_pion"), track2.tofNSigmaPi()); hPID.fill(HIST("Before/hNsigmaTPC_Pi_before"), track2.pt(), track2.tpcNSigmaPi()); hPID.fill(HIST("Before/hNsigmaTOF_Pi_before"), track2.pt(), track2.tofNSigmaPi()); } - if (cQAplots && (mctrack2.pdgCode() == 321)) { // kaon + if (cQAplots && (mctrack2.pdgCode() == PDG_t::kKPlus)) { // kaon hPID.fill(HIST("Before/h1PID_TPC_pos_kaon"), track2.tpcNSigmaKa()); hPID.fill(HIST("Before/h1PID_TOF_pos_kaon"), track2.tofNSigmaKa()); hPID.fill(HIST("Before/hNsigmaTPC_Ka_before"), track2.pt(), track2.tpcNSigmaKa()); hPID.fill(HIST("Before/hNsigmaTOF_Ka_before"), track2.pt(), track2.tofNSigmaKa()); } - if (cQAplots && (mctrack2.pdgCode() == -211)) { // negative track pion + if (cQAplots && (mctrack2.pdgCode() == -PDG_t::kPiMinus)) { // negative track pion hPID.fill(HIST("Before/h1PID_TPC_neg_pion"), track2.tpcNSigmaPi()); hPID.fill(HIST("Before/h1PID_TOF_neg_pion"), track2.tofNSigmaPi()); hPID.fill(HIST("Before/hNsigmaTPC_Pi_before"), track2.pt(), track2.tpcNSigmaPi()); hPID.fill(HIST("Before/hNsigmaTOF_Pi_before"), track2.pt(), track2.tofNSigmaPi()); } - if (cQAplots && (mctrack2.pdgCode() == -321)) { // negative track kaon + if (cQAplots && (mctrack2.pdgCode() == -PDG_t::kKMinus)) { // negative track kaon hPID.fill(HIST("Before/h1PID_TPC_neg_kaon"), track2.tpcNSigmaKa()); hPID.fill(HIST("Before/h1PID_TOF_neg_kaon"), track2.tofNSigmaKa()); hPID.fill(HIST("Before/hNsigmaTPC_Ka_before"), track2.pt(), track2.tpcNSigmaKa()); hPID.fill(HIST("Before/hNsigmaTOF_Ka_before"), track2.pt(), track2.tofNSigmaKa()); } - if (cQAplots && (std::abs(mctrack1.pdgCode()) == 321 && std::abs(mctrack2.pdgCode()) == 211)) { + if (cQAplots && (std::abs(mctrack1.pdgCode()) == PDG_t::kKPlus && std::abs(mctrack2.pdgCode()) == PDG_t::kPiPlus)) { hPID.fill(HIST("Before/hNsigma_TPC_TOF_Ka_before"), track1.tpcNSigmaKa(), track1.tofNSigmaKa()); hPID.fill(HIST("Before/hNsigma_TPC_TOF_Pi_before"), track2.tpcNSigmaPi(), track2.tofNSigmaPi()); } @@ -1195,13 +1233,13 @@ struct Kstarqa { } rEventSelection.fill(HIST("events_checkrec"), 12.5); - // if (!(track1PDG == 321 && track2PDG == 211)) { + // if (!(track1PDG == PDG_t::kKPlus && track2PDG == PDG_t::kPiPlus)) { // continue; // } - if ((track1PDG != 211) && (track1PDG != 321)) { + if ((track1PDG != PDG_t::kPiPlus) && (track1PDG != PDG_t::kKPlus)) { continue; } - if ((track2PDG != 211) && (track2PDG != 321)) { + if ((track2PDG != PDG_t::kPiPlus) && (track2PDG != PDG_t::kKPlus)) { continue; } rEventSelection.fill(HIST("events_checkrec"), 13.5); @@ -1229,11 +1267,11 @@ struct Kstarqa { } rEventSelection.fill(HIST("events_checkrec"), 18.5); - if (std::abs(mothertrack1.pdgCode()) != 313) { + if (std::abs(mothertrack1.pdgCode()) != o2::constants::physics::kK0Star892) { continue; } - if (track1PDG == 211) { + if (track1PDG == PDG_t::kPiPlus) { if (!applypTdepPID && !(selectionPID(track1, 0) && selectionPID(track2, 1))) { // pion and kaon continue; } else if (applypTdepPID && !(selectionPIDNew(track1, 0) && selectionPIDNew(track2, 1))) { // pion and kaon From 6b891f19be9773cedbff65d5576adc51d2edcc97 Mon Sep 17 00:00:00 2001 From: Marvin Hemmer <53471402+mhemmer-cern@users.noreply.github.com> Date: Fri, 25 Jul 2025 18:40:41 +0200 Subject: [PATCH 071/345] =?UTF-8?q?[PWGJE,EMCAL-689]=20Add=20DeltaEta=20an?= =?UTF-8?q?d=20DeltaPhi=20values=20to=20`EMCALMatchedTr=E2=80=A6=20(#12244?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PWGJE/Core/CMakeLists.txt | 1 + PWGJE/Core/JetUtilities.h | 5 - PWGJE/Core/utilsTrackMatchingEMC.h | 119 ++++++ PWGJE/DataModel/EMCALClusters.h | 9 +- PWGJE/TableProducer/emcalCorrectionTask.cxx | 77 ++-- PWGJE/Tasks/emcTmMonitor.cxx | 452 ++++++++++---------- 6 files changed, 387 insertions(+), 276 deletions(-) create mode 100644 PWGJE/Core/utilsTrackMatchingEMC.h diff --git a/PWGJE/Core/CMakeLists.txt b/PWGJE/Core/CMakeLists.txt index 7eb4bc8ea97..b6ccafb2be2 100644 --- a/PWGJE/Core/CMakeLists.txt +++ b/PWGJE/Core/CMakeLists.txt @@ -25,5 +25,6 @@ o2physics_target_root_dictionary(PWGJECore JetBkgSubUtils.h JetDerivedDataUtilities.h emcalCrossTalkEmulation.h + utilsTrackMatchingEMC.h LINKDEF PWGJECoreLinkDef.h) endif() diff --git a/PWGJE/Core/JetUtilities.h b/PWGJE/Core/JetUtilities.h index 358e1d1dd46..0efaf1fd8f9 100644 --- a/PWGJE/Core/JetUtilities.h +++ b/PWGJE/Core/JetUtilities.h @@ -76,11 +76,6 @@ std::tuple>, std::vector>> MatchCl throw std::invalid_argument("track collection eta and phi sizes don't match. Check the inputs."); } - // for (std::size_t iTrack = 0; iTrack < nTracks; iTrack++) { - // if (trackEta[iTrack] == 0) - // LOG(warning) << "Track eta is 0!"; - // } - // Build the KD-trees using vectors // We build two trees: // treeBase, which contains the base collection. diff --git a/PWGJE/Core/utilsTrackMatchingEMC.h b/PWGJE/Core/utilsTrackMatchingEMC.h new file mode 100644 index 00000000000..6256c712ff3 --- /dev/null +++ b/PWGJE/Core/utilsTrackMatchingEMC.h @@ -0,0 +1,119 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file utilsTrackMatchingEMC.h +/// \brief EMCal track matching related utils +/// \author Marvin Hemmer + +#ifndef PWGJE_CORE_UTILSTRACKMATCHINGEMC_H_ +#define PWGJE_CORE_UTILSTRACKMATCHINGEMC_H_ + +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace tmemcutilities +{ + +struct MatchResult { + std::vector> matchIndexTrack; + std::vector> matchDeltaPhi; + std::vector> matchDeltaEta; +}; + +/** + * Match clusters and tracks. + * + * Match cluster with tracks, where maxNumberMatches are considered in dR=maxMatchingDistance. + * If no unique match was found for a jet, an index of -1 is stored. + * The same map is created for clusters matched to tracks e.g. for electron analyses. + * + * @param clusterPhi cluster collection phi. + * @param clusterEta cluster collection eta. + * @param trackPhi track collection phi. + * @param trackEta track collection eta. + * @param maxMatchingDistance Maximum matching distance. + * @param maxNumberMatches Maximum number of matches (e.g. 5 closest). + * + * @returns (cluster to track index map, track to cluster index map) + */ +MatchResult matchTracksToCluster( + std::span clusterPhi, + std::span clusterEta, + std::span trackPhi, + std::span trackEta, + double maxMatchingDistance, + int maxNumberMatches) +{ + const std::size_t nClusters = clusterEta.size(); + const std::size_t nTracks = trackEta.size(); + MatchResult result; + + result.matchIndexTrack.resize(nClusters); + result.matchDeltaPhi.resize(nClusters); + result.matchDeltaEta.resize(nClusters); + + if (nClusters == 0 || nTracks == 0) { + // There are no jets, so nothing to be done. + return result; + } + // Input sizes must match + if (clusterPhi.size() != clusterEta.size()) { + throw std::invalid_argument("cluster collection eta and phi sizes don't match. Check the inputs."); + } + if (trackPhi.size() != trackEta.size()) { + throw std::invalid_argument("track collection eta and phi sizes don't match. Check the inputs."); + } + + // Build the KD-trees using vectors + // We build two trees: + // treeBase, which contains the base collection. + // treeTag, which contains the tag collection. + // The trees are built to match in two dimensions (eta, phi) + TKDTree treeTrack(trackEta.size(), 2, 1); + treeTrack.SetData(0, trackEta.data()); + treeTrack.SetData(1, trackPhi.data()); + treeTrack.Build(); + + // Find the track closest to each cluster. + for (std::size_t iCluster = 0; iCluster < nClusters; iCluster++) { + float point[2] = {clusterEta[iCluster], clusterPhi[iCluster]}; + int index[50]; // size 50 for safety + float distance[50]; // size 50 for safery + std::fill_n(index, 50, -1); + std::fill_n(distance, 50, std::numeric_limits::max()); + treeTrack.FindNearestNeighbors(point, maxNumberMatches, index, distance); + + // allocate enough memory + result.matchIndexTrack[iCluster].reserve(maxNumberMatches); + result.matchDeltaPhi[iCluster].reserve(maxNumberMatches); + result.matchDeltaEta[iCluster].reserve(maxNumberMatches); + + // test whether indices are matching: + for (int m = 0; m < maxNumberMatches; m++) { + if (index[m] >= 0 && distance[m] < maxMatchingDistance) { + result.matchIndexTrack[iCluster].push_back(index[m]); + result.matchDeltaPhi[iCluster].push_back(trackPhi[index[m]] - clusterPhi[iCluster]); + result.matchDeltaEta[iCluster].push_back(trackEta[index[m]] - clusterEta[iCluster]); + } + } + } + return result; +} +}; // namespace tmemcutilities + +#endif // PWGJE_CORE_UTILSTRACKMATCHINGEMC_H_ diff --git a/PWGJE/DataModel/EMCALClusters.h b/PWGJE/DataModel/EMCALClusters.h index ca42b0ae68e..56edf634628 100644 --- a/PWGJE/DataModel/EMCALClusters.h +++ b/PWGJE/DataModel/EMCALClusters.h @@ -162,10 +162,13 @@ using EMCALClusterCell = EMCALClusterCells::iterator; using EMCALAmbiguousClusterCell = EMCALAmbiguousClusterCells::iterator; namespace emcalmatchedtrack { -DECLARE_SOA_INDEX_COLUMN(Track, track); //! linked to Track table only for tracks that were matched +DECLARE_SOA_INDEX_COLUMN(Track, track); //! linked to Track table only for tracks that were matched +DECLARE_SOA_COLUMN(DeltaPhi, deltaPhi, float); //! difference between matched track and cluster azimuthal angle +DECLARE_SOA_COLUMN(DeltaEta, deltaEta, float); //! difference between matched track and cluster pseudorapidity } // namespace emcalmatchedtrack -DECLARE_SOA_TABLE(EMCALMatchedTracks, "AOD", "EMCMATCHTRACKS", //! - o2::soa::Index<>, emcalclustercell::EMCALClusterId, emcalmatchedtrack::TrackId); //! +DECLARE_SOA_TABLE(EMCALMatchedTracks, "AOD", "EMCMATCHTRACKS", //! + o2::soa::Index<>, emcalclustercell::EMCALClusterId, emcalmatchedtrack::TrackId, + emcalmatchedtrack::DeltaPhi, emcalmatchedtrack::DeltaEta); //! using EMCALMatchedTrack = EMCALMatchedTracks::iterator; } // namespace o2::aod #endif // PWGJE_DATAMODEL_EMCALCLUSTERS_H_ diff --git a/PWGJE/TableProducer/emcalCorrectionTask.cxx b/PWGJE/TableProducer/emcalCorrectionTask.cxx index 33efa53dad7..72f7941fa9e 100644 --- a/PWGJE/TableProducer/emcalCorrectionTask.cxx +++ b/PWGJE/TableProducer/emcalCorrectionTask.cxx @@ -18,12 +18,13 @@ /// \author Raymond Ehlers (raymond.ehlers@cern.ch) ORNL, Florian Jonas (florian.jonas@cern.ch) /// -#include "PWGJE/Core/JetUtilities.h" #include "PWGJE/Core/emcalCrossTalkEmulation.h" +#include "PWGJE/Core/utilsTrackMatchingEMC.h" #include "PWGJE/DataModel/EMCALClusterDefinition.h" #include "PWGJE/DataModel/EMCALClusters.h" #include "PWGJE/DataModel/EMCALMatchedCollisions.h" +#include "Common/Core/RecoDecay.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/TrackSelectionTables.h" @@ -65,6 +66,7 @@ #include #include #include +#include #include #include #include @@ -76,6 +78,7 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::emccrosstalk; +using namespace tmemcutilities; using MyGlobTracks = o2::soa::Join; using BcEvSels = o2::soa::Join; using CollEventSels = o2::soa::Join; @@ -83,6 +86,13 @@ using FilteredCells = o2::soa::Filtered; using McCells = o2::soa::Join; using FilteredMcCells = o2::soa::Filtered; +enum CellScaleMode { + ModeNone = 0, + ModeSMWise = 1, + ModeColumnWise = 2, + NumberModes = 3 +}; + struct EmcalCorrectionTask { Produces clusters; Produces mcclusters; @@ -442,9 +452,9 @@ struct EmcalCorrectionTask { std::vector> clusterToTrackIndexMap; std::vector> trackToClusterIndexMap; - std::tuple>, std::vector>> indexMapPair{clusterToTrackIndexMap, trackToClusterIndexMap}; + MatchResult indexMapPair; std::vector trackGlobalIndex; - doTrackMatching(col, tracks, indexMapPair, vertexPos, trackGlobalIndex); + doTrackMatching(col, tracks, indexMapPair, trackGlobalIndex); // Store the clusters in the table where a matching collision could // be identified. @@ -612,9 +622,9 @@ struct EmcalCorrectionTask { std::vector> clusterToTrackIndexMap; std::vector> trackToClusterIndexMap; - std::tuple>, std::vector>> indexMapPair{clusterToTrackIndexMap, trackToClusterIndexMap}; + MatchResult indexMapPair; std::vector trackGlobalIndex; - doTrackMatching(col, tracks, indexMapPair, vertexPos, trackGlobalIndex); + doTrackMatching(col, tracks, indexMapPair, trackGlobalIndex); // Store the clusters in the table where a matching collision could // be identified. @@ -798,16 +808,16 @@ struct EmcalCorrectionTask { } template - void fillClusterTable(Collision const& col, math_utils::Point3D const& vertexPos, size_t iClusterizer, const gsl::span cellIndicesBC, const std::tuple>, std::vector>>* indexMapPair = nullptr, const std::vector* trackGlobalIndex = nullptr) + void fillClusterTable(Collision const& col, math_utils::Point3D const& vertexPos, size_t iClusterizer, const gsl::span cellIndicesBC, MatchResult* indexMapPair = nullptr, const std::vector* trackGlobalIndex = nullptr) { // average number of cells per cluster, only used the reseve a reasonable amount for the clustercells table - const size_t NAvgNcells = 3; + const size_t nAvgNcells = 3; // we found a collision, put the clusters into the none ambiguous table clusters.reserve(mAnalysisClusters.size()); if (!mClusterLabels.empty()) { mcclusters.reserve(mClusterLabels.size()); } - clustercells.reserve(mAnalysisClusters.size() * NAvgNcells); + clustercells.reserve(mAnalysisClusters.size() * nAvgNcells); // get the clusterType once const auto clusterType = static_cast(mClusterDefinitions[iClusterizer]); @@ -867,10 +877,10 @@ struct EmcalCorrectionTask { mHistManager.fill(HIST("hClusterFCrossSigmaShortE"), cluster.E(), cluster.getFCross(), cluster.getM20()); } if (indexMapPair && trackGlobalIndex) { - for (unsigned int iTrack = 0; iTrack < std::get<0>(*indexMapPair)[iCluster].size(); iTrack++) { - if (std::get<0>(*indexMapPair)[iCluster][iTrack] >= 0) { - LOG(debug) << "Found track " << (*trackGlobalIndex)[std::get<0>(*indexMapPair)[iCluster][iTrack]] << " in cluster " << cluster.getID(); - matchedTracks(clusters.lastIndex(), (*trackGlobalIndex)[std::get<0>(*indexMapPair)[iCluster][iTrack]]); + for (unsigned int iTrack = 0; iTrack < indexMapPair->matchIndexTrack[iCluster].size(); iTrack++) { + if (indexMapPair->matchIndexTrack[iCluster][iTrack] >= 0) { + LOG(debug) << "Found track " << (*trackGlobalIndex)[indexMapPair->matchIndexTrack[iCluster][iTrack]] << " in cluster " << cluster.getID(); + matchedTracks(clusters.lastIndex(), (*trackGlobalIndex)[indexMapPair->matchIndexTrack[iCluster][iTrack]], indexMapPair->matchDeltaPhi[iCluster][iTrack], indexMapPair->matchDeltaEta[iCluster][iTrack]); } } } @@ -882,13 +892,13 @@ struct EmcalCorrectionTask { void fillAmbigousClusterTable(BC const& bc, size_t iClusterizer, const gsl::span cellIndicesBC, bool hasCollision) { // average number of cells per cluster, only used the reseve a reasonable amount for the clustercells table - const size_t NAvgNcells = 3; + const size_t nAvgNcells = 3; int cellindex = -1; clustersAmbiguous.reserve(mAnalysisClusters.size()); if (mClusterLabels.size() > 0) { mcclustersAmbiguous.reserve(mClusterLabels.size()); } - clustercellsambiguous.reserve(mAnalysisClusters.size() * NAvgNcells); + clustercellsambiguous.reserve(mAnalysisClusters.size() * nAvgNcells); unsigned int iCluster = 0; float energy = 0.f; for (const auto& cluster : mAnalysisClusters) { @@ -933,12 +943,12 @@ struct EmcalCorrectionTask { } template - void doTrackMatching(Collision const& col, MyGlobTracks const& tracks, std::tuple>, std::vector>>& indexMapPair, math_utils::Point3D& vertexPos, std::vector& trackGlobalIndex) + void doTrackMatching(Collision const& col, MyGlobTracks const& tracks, MatchResult& indexMapPair, std::vector& trackGlobalIndex) { auto groupedTracks = tracks.sliceBy(perCollision, col.globalIndex()); int nTracksInCol = groupedTracks.size(); - std::vector trackPhi; - std::vector trackEta; + std::vector trackPhi; + std::vector trackEta; // reserve memory to reduce on the fly memory allocation trackPhi.reserve(nTracksInCol); trackEta.reserve(nTracksInCol); @@ -946,8 +956,8 @@ struct EmcalCorrectionTask { fillTrackInfo(groupedTracks, trackPhi, trackEta, trackGlobalIndex); int nClusterInCol = mAnalysisClusters.size(); - std::vector clusterPhi; - std::vector clusterEta; + std::vector clusterPhi; + std::vector clusterEta; clusterPhi.reserve(nClusterInCol); clusterEta.reserve(nClusterInCol); @@ -957,20 +967,14 @@ struct EmcalCorrectionTask { // Determine the cluster eta, phi, correcting for the vertex // position. auto pos = cluster.getGlobalPosition(); - pos = pos - vertexPos; - // Normalize the vector and rescale by energy. - pos *= (cluster.E() / std::sqrt(pos.Mag2())); clusterPhi.emplace_back(TVector2::Phi_0_2pi(pos.Phi())); clusterEta.emplace_back(pos.Eta()); } - indexMapPair = - jetutilities::MatchClustersAndTracks(clusterPhi, clusterEta, - trackPhi, trackEta, - maxMatchingDistance, 20); + indexMapPair = matchTracksToCluster(clusterPhi, clusterEta, trackPhi, trackEta, maxMatchingDistance, 20); } template - void fillTrackInfo(Tracks const& tracks, std::vector& trackPhi, std::vector& trackEta, std::vector& trackGlobalIndex) + void fillTrackInfo(Tracks const& tracks, std::vector& trackPhi, std::vector& trackEta, std::vector& trackGlobalIndex) { int nTrack = 0; for (const auto& track : tracks) { @@ -986,10 +990,10 @@ struct EmcalCorrectionTask { continue; } nTrack++; - trackPhi.emplace_back(TVector2::Phi_0_2pi(track.trackPhiEmcal())); + trackPhi.emplace_back(RecoDecay::constrainAngle(track.trackPhiEmcal())); trackEta.emplace_back(track.trackEtaEmcal()); mHistManager.fill(HIST("hGlobalTrackEtaPhi"), track.trackEtaEmcal(), - TVector2::Phi_0_2pi(track.trackPhiEmcal())); + RecoDecay::constrainAngle(track.trackPhiEmcal())); trackGlobalIndex.emplace_back(track.globalIndex()); } mHistManager.fill(HIST("hGlobalTrackMult"), nTrack); @@ -1040,12 +1044,12 @@ struct EmcalCorrectionTask { { // Apply cell scale based on SM types (Full, Half (not used), EMC 1/3, DCal, DCal 1/3) // Same as in Run2 data - if (applyCellAbsScale == 1) { + if (applyCellAbsScale == CellScaleMode::ModeSMWise) { int iSM = mClusterizers.at(0)->getGeometry()->GetSuperModuleNumber(cellID); return cellAbsScaleFactors.value[mClusterizers.at(0)->getGeometry()->GetSMType(iSM)]; // Apply cell scale based on columns to accoutn for material of TRD structures - } else if (applyCellAbsScale == 2) { + } else if (applyCellAbsScale == CellScaleMode::ModeColumnWise) { auto res = mClusterizers.at(0)->getGeometry()->GlobalRowColFromIndex(cellID); return cellAbsScaleFactors.value[std::get<1>(res)]; } else { @@ -1063,6 +1067,9 @@ struct EmcalCorrectionTask { } float timeshift = 0.f; float timesmear = 0.f; + const float minLeaderEnergy = 0.3f; + const float lowEnergyRegime = 4.f; + const float highEnergyRegime = 30.f; if (isMC) { // ---> MC // Shift the time to 0, as the TOF was simulated -> eta dependent shift (as larger eta values are further away from collision point) // Use distance between vertex and EMCal (at eta = 0) and distance on EMCal surface (cell size times column) to calculate distance to cell @@ -1071,7 +1078,7 @@ struct EmcalCorrectionTask { timeshift = -std::sqrt(215.f + timeCol * timeCol); // 215 is 14.67ns^2 (time it takes to get the cell at eta = 0) // Also smear the time to account for the broader time resolution in data than in MC - if (cellEnergy < 0.3) // Cells with tless than 300 MeV cannot be the leading cell in the cluster, so their time does not require precise calibration + if (cellEnergy < minLeaderEnergy) // Cells with tless than 300 MeV cannot be the leading cell in the cluster, so their time does not require precise calibration timesmear = 0.; // They will therefore not be smeared and only get their shift else if (cellType == emcal::ChannelType_t::HIGH_GAIN) // High gain cells -> Low energies timesmear = normalgaus(rdgen) * (1.6 + 9.5 * std::exp(-3. * cellEnergy)); // Parameters extracted from LHC24f3b & LHC22o (pp), but also usable for other periods @@ -1079,15 +1086,15 @@ struct EmcalCorrectionTask { timesmear = normalgaus(rdgen) * (5.0); // Parameters extracted from LHC24g4 & LHC24aj (pp), but also usable for other periods } else { // ---> Data - if (cellEnergy < 0.3) { // Cells with tless than 300 MeV cannot be the leading cell in the cluster, so their time does not require precise calibration + if (cellEnergy < minLeaderEnergy) { // Cells with tless than 300 MeV cannot be the leading cell in the cluster, so their time does not require precise calibration timeshift = 0.; // In data they will not be shifted (they are close to 0 anyways) } else if (cellType == emcal::ChannelType_t::HIGH_GAIN) { // High gain cells -> Low energies - if (cellEnergy < 4.) // Low energy regime + if (cellEnergy < lowEnergyRegime) // Low energy regime timeshift = 0.8 * std::log(2.7 * cellEnergy); // Parameters extracted from LHC22o (pp), but also usable for other periods else // Medium energy regime timeshift = 1.5 * std::log(0.9 * cellEnergy); // Parameters extracted from LHC22o (pp), but also usable for other periods } else if (cellType == emcal::ChannelType_t::LOW_GAIN) { // Low gain cells -> High energies - if (cellEnergy < 30.) // High energy regime + if (cellEnergy < highEnergyRegime) // High energy regime timeshift = 1.9 * std::log(0.09 * cellEnergy); // Parameters extracted from LHC24aj (pp), but also usable for other periods else // Very high energy regime timeshift = 1.9; // Parameters extracted from LHC24aj (pp), but also usable for other periods diff --git a/PWGJE/Tasks/emcTmMonitor.cxx b/PWGJE/Tasks/emcTmMonitor.cxx index 9fa8df59dec..3d6baefda3b 100644 --- a/PWGJE/Tasks/emcTmMonitor.cxx +++ b/PWGJE/Tasks/emcTmMonitor.cxx @@ -9,6 +9,20 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +/// \file emcTmMonitor.cxx +/// \brief Simple monitoring task for EMCal clusters +/// \author Marvin Hemmer +/// \since 24.02.2023 +/// +/// This task is meant to be used for monitoring the matching between global tracks and EMCal clusters +/// properties, such as: +/// - cluster energy over track momentum +/// - difference in eta +/// - difference in phi +/// Simple event selection using the flag doEventSel is provided, which selects INT7 events if set to 1 +/// For pilot beam data, instead of relying on the event selection, one can veto specific BC IDS using the flag +/// fDoVetoBCID. + #include "PWGJE/DataModel/EMCALClusters.h" #include "Common/CCDB/TriggerAliases.h" @@ -16,23 +30,19 @@ #include "Common/DataModel/PIDResponseTPC.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "EMCALBase/Geometry.h" -#include "Framework/ASoA.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" +#include #include +#include +#include +#include #include +#include #include #include #include #include #include -#include - -#include - #include #include #include @@ -40,27 +50,13 @@ #include #include -// \struct TrackMatchingMonitor -/// \brief Simple monitoring task for EMCal clusters -/// \author Marvin Hemmer -/// \since 24.02.2023 -/// -/// This task is meant to be used for monitoring the matching between global tracks and EMCal clusters -/// properties, such as: -/// - cluster energy over track momentum -/// - difference in eta -/// - difference in phi -/// Simple event selection using the flag doEventSel is provided, which selects INT7 events if set to 1 -/// For pilot beam data, instead of relying on the event selection, one can veto specific BC IDS using the flag -/// fDoVetoBCID. using namespace o2::framework; using namespace o2::framework::expressions; -using collisionEvSelIt = o2::soa::Join::iterator; -using bcEvSelIt = o2::soa::Join::iterator; -using selectedClusters = o2::soa::Filtered; -using selectedAmbiguousClusters = o2::soa::Filtered; -using tracksPID = o2::soa::Join; -struct TrackMatchingMonitor { +using CollisionEvSelIt = o2::soa::Join::iterator; +using BcEvSelIt = o2::soa::Join::iterator; +using SelectedClusters = o2::soa::Filtered; +using TracksPID = o2::soa::Join; +struct EmcTmMonitor { HistogramRegistry mHistManager{"TrackMatchingMonitorHistograms", {}, OutputObjHandlingPolicy::AnalysisObject}; o2::emcal::Geometry* mGeometry = nullptr; @@ -68,14 +64,13 @@ struct TrackMatchingMonitor { Preslice perClusterAmb = o2::aod::emcalclustercell::emcalambiguousclusterId; Preslice perClusterMatchedTracks = o2::aod::emcalclustercell::emcalclusterId; // configurable parameters - // TODO adapt mDoEventSel switch to also allow selection of other triggers (e.g. EMC7) - Configurable mDoEventSel{"doEventSel", 0, "demand kINT7"}; - Configurable mVetoBCID{"vetoBCID", "", "BC ID(s) to be excluded, this should be used as an alternative to the event selection"}; - Configurable mSelectBCID{"selectBCID", "all", "BC ID(s) to be included, this should be used as an alternative to the event selection"}; - Configurable mVertexCut{"vertexCut", -1, "apply z-vertex cut with value in cm"}; - Configurable mClusterDefinition{"clusterDefinition", 10, "cluster definition to be selected, e.g. 10=kV3Default"}; - ConfigurableAxis mClusterTimeBinning{"clustertime-binning", {1500, -600, 900}, ""}; - Configurable hasPropagatedTracks{"hasPropagatedTracks", false, "temporary flag, only set to true when running over data which has the tracks propagated to EMCal/PHOS!"}; + // TODO adapt doEventSel switch to also allow selection of other triggers (e.g. EMC7) + Configurable doEventSel{"doEventSel", 0, "demand kINT7"}; + Configurable vetoBCID{"vetoBCID", "", "BC ID(s) to be excluded, this should be used as an alternative to the event selection"}; + Configurable selectBCID{"selectBCID", "all", "BC ID(s) to be included, this should be used as an alternative to the event selection"}; + Configurable vertexCut{"vertexCut", -1, "apply z-vertex cut with value in cm"}; + Configurable clusterDefinition{"clusterDefinition", 10, "cluster definition to be selected, e.g. 10=kV3Default"}; + ConfigurableAxis clusterTimeBinning{"clusterTimeBinning", {1500, -600, 900}, ""}; Configurable usePionRejection{"usePionRejection", false, "demand pion rection for electron signal with TPC PID"}; Configurable> tpcNsigmaElectron{"tpcNsigmaElectron", {-1., +3.}, "TPC PID NSigma range for electron signal (first <= NSigma <= second)"}; Configurable> tpcNsigmaBack{"tpcNsigmaBack", {-10., -4.}, "TPC PID NSigma range for electron background (first <= NSigma <= second)"}; @@ -85,7 +80,7 @@ struct TrackMatchingMonitor { Configurable minM02{"minM02", 0.1, "Minimum M02 for M02 cut"}; Configurable maxM02{"maxM02", 0.9, "Maximum M02 for M02 cut"}; Configurable maxM02HighPt{"maxM02HighPt", 0.6, "Maximum M02 for M02 cut for high pT"}; - Configurable M02highPt{"M02highPt", 15., "pT threshold for maxM02HighPt cut. Set to negative value to disable it!"}; + Configurable m02highPt{"m02highPt", 15., "pT threshold for maxM02HighPt cut. Set to negative value to disable it!"}; Configurable minDEta{"minDEta", 0.01, "Minimum dEta between track and cluster"}; Configurable minDPhi{"minDPhi", 0.01, "Minimum dPhi between track and cluster"}; Configurable> eOverPRange{"eOverPRange", {0.9, 1.2}, "E/p range where one would search for electrons (first <= E/p <= second)"}; @@ -97,101 +92,98 @@ struct TrackMatchingMonitor { /// \brief Create output histograms and initialize geometry void init(InitContext const&) { - // create histograms - using o2HistType = HistType; - using o2Axis = AxisSpec; - // load geometry just in case we need it mGeometry = o2::emcal::Geometry::GetInstanceFromRunNumber(300000); // create common axes LOG(info) << "Creating histograms"; - const o2Axis bcAxis{3501, -0.5, 3500.5}; - const o2Axis energyAxis{makeEnergyBinningAliPhysics(), "E_{clus} (GeV)"}; - const o2Axis amplitudeAxisLarge{1000, 0., 100., "amplitudeLarge", "Amplitude (GeV)"}; - const o2Axis dEtaAxis{100, -1.f * minDEta, minDEta, "d#it{#eta}"}; - const o2Axis dPhiAxis{100, -1.f * minDPhi, minDPhi, "d#it{#varphi} (rad)"}; - const o2Axis dRAxis{150, 0.0, 0.015, "d#it{R}"}; - const o2Axis eoverpAxis{500, 0, 10, "#it{E}_{cluster}/#it{p}_{track}"}; - const o2Axis nSigmaAxis{400, -10., +30., "N#sigma"}; - const o2Axis trackptAxis{makePtBinning(), "#it{p}_{T,track}"}; - const o2Axis trackpAxis{200, 0, 100, "#it{p}_{track}"}; - const o2Axis clusterptAxis{makePtBinning(), "#it{p}_{T}"}; - const o2Axis etaAxis{160, -0.8, 0.8, "#eta"}; - const o2Axis phiAxis{72, 0, 2 * 3.14159, "#varphi (rad)"}; - const o2Axis smAxis{20, -0.5, 19.5, "SM"}; - o2Axis timeAxis{mClusterTimeBinning, "t_{cl} (ns)"}; + const AxisSpec bcAxis{3501, -0.5, 3500.5}; + const AxisSpec energyAxis{makeEnergyBinningAliPhysics(), "E_{clus} (GeV)"}; + const AxisSpec amplitudeAxisLarge{1000, 0., 100., "amplitudeLarge", "Amplitude (GeV)"}; + const AxisSpec dEtaAxis{100, -1.f * minDEta, minDEta, "d#it{#eta}"}; + const AxisSpec dPhiAxis{100, -1.f * minDPhi, minDPhi, "d#it{#varphi} (rad)"}; + const AxisSpec dRAxis{150, 0.0, 0.015, "d#it{R}"}; + const AxisSpec eoverpAxis{500, 0, 10, "#it{E}_{cluster}/#it{p}_{track}"}; + const AxisSpec nSigmaAxis{400, -10., +30., "N#sigma"}; + const AxisSpec trackptAxis{makePtBinning(), "#it{p}_{T,track}"}; + const AxisSpec trackpAxis{200, 0, 100, "#it{p}_{track}"}; + const AxisSpec clusterptAxis{makePtBinning(), "#it{p}_{T}"}; + const AxisSpec etaAxis{160, -0.8, 0.8, "#eta"}; + const AxisSpec phiAxis{72, 0, 2 * 3.14159, "#varphi (rad)"}; + const AxisSpec smAxis{20, -0.5, 19.5, "SM"}; + AxisSpec timeAxis{clusterTimeBinning, "t_{cl} (ns)"}; - int MaxMatched = 20; // maximum number of matched tracks, hardcoded in emcalCorrectionTask.cxx! - const o2Axis nmatchedtrack{MaxMatched, -0.5, MaxMatched + 0.5}; + const int maxMatched = 20; // maximum number of matched tracks, hardcoded in emcalCorrectionTask.cxx! + const AxisSpec nmatchedtrack{maxMatched, -0.5, maxMatched + 0.5}; + // create histograms // event properties - mHistManager.add("eventsAll", "Number of events", o2HistType::kTH1F, {{1, 0.5, 1.5}}); - mHistManager.add("eventsSelected", "Number of events", o2HistType::kTH1F, {{1, 0.5, 1.5}}); - mHistManager.add("eventVertexZAll", "z-vertex of event (all events)", o2HistType::kTH1F, {{200, -20, 20}}); - mHistManager.add("eventVertexZSelected", "z-vertex of event (selected events)", o2HistType::kTH1F, {{200, -20, 20}}); + mHistManager.add("eventsAll", "Number of events", HistType::kTH1F, {{1, 0.5, 1.5}}); + mHistManager.add("eventsSelected", "Number of events", HistType::kTH1F, {{1, 0.5, 1.5}}); + mHistManager.add("eventVertexZAll", "z-vertex of event (all events)", HistType::kTH1F, {{200, -20, 20}}); + mHistManager.add("eventVertexZSelected", "z-vertex of event (selected events)", HistType::kTH1F, {{200, -20, 20}}); // cluster properties (matched clusters) - mHistManager.add("TrackEtaPhi", "#eta vs #varphi of all selected tracks", o2HistType::kTH2F, {etaAxis, phiAxis}); // eta vs phi of all selected tracks - mHistManager.add("TrackEtaPhi_Neg", "#eta vs #varphi of all selected negative tracks", o2HistType::kTH2F, {etaAxis, phiAxis}); // eta vs phi of all selected negative tracks - mHistManager.add("TrackEtaPhi_Pos", "#eta vs #varphi of all selected positive tracks", o2HistType::kTH2F, {etaAxis, phiAxis}); // eta vs phi of all selected positive tracks - mHistManager.add("clusterEMatched", "Energy of cluster (with match)", o2HistType::kTH1F, {energyAxis}); // energy of matched clusters - mHistManager.add("MatchedTrackEtaPhi_BeforeCut", "#eta vs #varphi of all selected matched tracks before d#eta and #dvarphi cut", o2HistType::kTH2F, {etaAxis, phiAxis}); // eta vs phi of all selected matched tracks before dEta and dPhi cut - mHistManager.add("MatchedTrackEtaPhi_Neg_BeforeCut", "#eta vs #varphi of all selected negative matched tracks before d#eta and #dvarphi cut", o2HistType::kTH2F, {etaAxis, phiAxis}); // eta vs phi of all selected negative matched tracks before dEta and dPhi cut - mHistManager.add("MatchedTrackEtaPhi_Pos_BeforeCut", "#eta vs #varphi of all selected positive matched tracks before d#eta and #dvarphi cut", o2HistType::kTH2F, {etaAxis, phiAxis}); // eta vs phi of all selected positive matched tracks before dEta and dPhi cut - mHistManager.add("MatchedTrackEtaPhi", "#eta vs #varphi of all selected matched tracks", o2HistType::kTH2F, {etaAxis, phiAxis}); // eta vs phi of all selected matched tracks - mHistManager.add("MatchedTrackEtaPhi_Neg", "#eta vs #varphi of all selected negative matched tracks", o2HistType::kTH2F, {etaAxis, phiAxis}); // eta vs phi of all selected negative matched tracks - mHistManager.add("MatchedTrackEtaPhi_Pos", "#eta vs #varphi of all selected positive matched tracks", o2HistType::kTH2F, {etaAxis, phiAxis}); // eta vs phi of all selected positive matched tracks - mHistManager.add("clusterTM_dEtadPhi", "cluster trackmatching dEta/dPhi", o2HistType::kTH3F, {dEtaAxis, dPhiAxis, smAxis}); // dEta dPhi per SM - mHistManager.add("clusterTM_dEtadPhi_ASide", "cluster trackmatching in A-Side dEta/dPhi", o2HistType::kTH3F, {dEtaAxis, dPhiAxis, smAxis}); // dEta dPhi per SM in A-Aside - mHistManager.add("clusterTM_dEtadPhi_CSide", "cluster trackmatching in C-Side tracks dEta/dPhi", o2HistType::kTH3F, {dEtaAxis, dPhiAxis, smAxis}); // dEta dPhi per SM in C-Side - mHistManager.add("clusterTM_PosdEtadPhi", "cluster trackmatching positive tracks dEta/dPhi", o2HistType::kTH3F, {dEtaAxis, dPhiAxis, smAxis}); // dEta dPhi per SM positive track - mHistManager.add("clusterTM_NegdEtadPhi", "cluster trackmatching negative tracks dEta/dPhi", o2HistType::kTH3F, {dEtaAxis, dPhiAxis, smAxis}); // dEta dPhi per SM negative track - mHistManager.add("clusterTM_PosdEtadPhi_Pl0_75", "cluster trackmatching positive tracks, p < 0.75 dEta/dPhi", o2HistType::kTH3F, {dEtaAxis, dPhiAxis, smAxis}); // dEta dPhi per SM positive track with p < 0.75 GeV/c - mHistManager.add("clusterTM_NegdEtadPhi_Pl0_75", "cluster trackmatching negative tracks, p < 0.75 dEta/dPhi", o2HistType::kTH3F, {dEtaAxis, dPhiAxis, smAxis}); // dEta dPhi per SM negative track with p < 0.75 GeV/c - mHistManager.add("clusterTM_PosdEtadPhi_0_75leqPl1_25", "cluster trackmatching positive tracks, 0.75 <= p < 1.25 dEta/dPhi", o2HistType::kTH3F, {dEtaAxis, dPhiAxis, smAxis}); // dEta dPhi per SM positive track with 0.75 <= p < 1.25 GeV/c - mHistManager.add("clusterTM_NegdEtadPhi_0_75leqPl1_25", "cluster trackmatching negative tracks, 0.75 <= p < 1.25 dEta/dPhi", o2HistType::kTH3F, {dEtaAxis, dPhiAxis, smAxis}); // dEta dPhi per SM negative track with 0.75 <= p < 1.25 GeV/c - mHistManager.add("clusterTM_PosdEtadPhi_Pgeq1_25", "cluster trackmatching positive tracks, p >= 1.25 dEta/dPhi", o2HistType::kTH3F, {dEtaAxis, dPhiAxis, smAxis}); // dEta dPhi per SM positive track with p >= 1.25 GeV/c - mHistManager.add("clusterTM_NegdEtadPhi_Pgeq1_25", "cluster trackmatching negative tracks, p >= 1.25 dEta/dPhi", o2HistType::kTH3F, {dEtaAxis, dPhiAxis, smAxis}); // dEta dPhi per SM negative track with p >= 1.25 GeV/c - mHistManager.add("clusterTM_dEtaPt", "cluster trackmatching dEta/#it{p}_{T};d#it{#eta};#it{p}_{T} (GeV/#it{c})", o2HistType::kTH3F, {dEtaAxis, clusterptAxis, smAxis}); // dEta vs pT per SM - mHistManager.add("clusterTM_PosdPhiPt", "cluster trackmatching positive tracks dPhi/#it{p}_{T}", o2HistType::kTH3F, {dPhiAxis, clusterptAxis, smAxis}); // dPhi vs pT per SM positive track - mHistManager.add("clusterTM_NegdPhiPt", "cluster trackmatching negative tracks dPh/#it{p}_{T}", o2HistType::kTH3F, {dPhiAxis, clusterptAxis, smAxis}); // dPhi vs pT per SM negative track - mHistManager.add("clusterTM_dEtaTN", "cluster trackmatching dEta/TN;d#it{#eta};#it{N}_{matched tracks}", o2HistType::kTH2F, {dEtaAxis, nmatchedtrack}); // dEta compared to the Nth closest track - mHistManager.add("clusterTM_dPhiTN", "cluster trackmatching dPhi/TN;d#it{#varphi} (rad);#it{N}_{matched tracks}", o2HistType::kTH2F, {dPhiAxis, nmatchedtrack}); // dPhi compared to the Nth closest track - mHistManager.add("clusterTM_dRTN", "cluster trackmatching dR/TN;d#it{R};#it{N}_{matched tracks}", o2HistType::kTH2F, {dRAxis, nmatchedtrack}); // dR compared to the Nth closest track - mHistManager.add("clusterTM_NTrack", "cluster trackmatching NMatchedTracks", o2HistType::kTH1I, {nmatchedtrack}); // how many tracks are matched - mHistManager.add("clusterTM_EoverP_E", "E/p ", o2HistType::kTH3F, {eoverpAxis, energyAxis, nmatchedtrack}); // E/p vs p for the Nth closest track - mHistManager.add("clusterTM_EoverP_Pt", "E/p vs track pT", o2HistType::kTH3F, {eoverpAxis, trackptAxis, nmatchedtrack}); // E/p vs track pT for the Nth closest track - mHistManager.add("clusterTM_EvsP", "cluster E/track p", o2HistType::kTH3F, {energyAxis, trackpAxis, nmatchedtrack}); // E vs p for the Nth closest track - mHistManager.add("clusterTM_EoverP_ep", "cluster E/electron p", o2HistType::kTH3F, {eoverpAxis, trackptAxis, nmatchedtrack}); // E over p vs track pT for the Nth closest electron/positron track - mHistManager.add("clusterTM_EoverP_e", "cluster E/electron p", o2HistType::kTH3F, {eoverpAxis, trackptAxis, nmatchedtrack}); // E over p vs track pT for the Nth closest electron track - mHistManager.add("clusterTM_EoverP_p", "cluster E/electron p", o2HistType::kTH3F, {eoverpAxis, trackptAxis, nmatchedtrack}); // E over p vs track pT for the Nth closest positron track - mHistManager.add("clusterTM_EoverP_electron_ASide", "cluster E/electron p in A-Side", o2HistType::kTH3F, {eoverpAxis, trackptAxis, nmatchedtrack}); // E over p vs track pT for the Nth closest electron/positron track in A-Side - mHistManager.add("clusterTM_EoverP_electron_CSide", "cluster E/electron p in C-Side", o2HistType::kTH3F, {eoverpAxis, trackptAxis, nmatchedtrack}); // E over p vs track pT for the Nth closest electron/positron track in C-Side - mHistManager.add("clusterTM_NSigma_BeforeCut", "electron NSigma for matched tracks before d#eta and #dvarphi cut", o2HistType::kTH3F, {nSigmaAxis, trackptAxis, nmatchedtrack}); // NSigma_electron vs track pT for the Nth closest track before dEta and dPhi cut - mHistManager.add("clusterTM_NSigma_neg_BeforeCut", "electron NSigma for matched negative tracks before d#eta and #dvarphi cut", o2HistType::kTH3F, {nSigmaAxis, trackptAxis, nmatchedtrack}); // NSigma_electron vs track pT for the Nth closest negative tracks before dEta and dPhi cut - mHistManager.add("clusterTM_NSigma_pos_BeforeCut", "electron NSigma for matched positive tracks before d#eta and #dvarphi cut", o2HistType::kTH3F, {nSigmaAxis, trackptAxis, nmatchedtrack}); // NSigma_electron vs track pT for the Nth closest positive tracks before dEta and dPhi cut - mHistManager.add("clusterTM_NSigma", "electron NSigma for matched track", o2HistType::kTH3F, {nSigmaAxis, trackptAxis, nmatchedtrack}); // NSigma_electron vs track pT for the Nth closest track - mHistManager.add("clusterTM_NSigma_neg", "electron NSigma for matched negative track", o2HistType::kTH3F, {nSigmaAxis, trackptAxis, nmatchedtrack}); // NSigma_electron vs track pT for the Nth closest negative tracks - mHistManager.add("clusterTM_NSigma_pos", "electron NSigma for matched positive track", o2HistType::kTH3F, {nSigmaAxis, trackptAxis, nmatchedtrack}); // NSigma_electron vs track pT for the Nth closest positive tracks - mHistManager.add("clusterTM_NSigma_cut", "electron NSigma for matched track with cuts", o2HistType::kTH3F, {nSigmaAxis, trackptAxis, nmatchedtrack}); // NSigma_electron vs track pT for the Nth closest track with cuts on E/p and cluster cuts - mHistManager.add("clusterTM_NSigma_e", "NSigma electron", o2HistType::kTH3F, {nSigmaAxis, trackptAxis, nmatchedtrack}); // NSigma vs track pT for the Nth closest electron track - mHistManager.add("clusterTM_NSigma_p", "NSigma positron", o2HistType::kTH3F, {nSigmaAxis, trackptAxis, nmatchedtrack}); // NSigma vs track pT for the Nth closest positron track - mHistManager.add("clusterTM_NSigma_e_cut", "NSigma electron with E over p cut", o2HistType::kTH3F, {nSigmaAxis, trackptAxis, nmatchedtrack}); // NSigma vs track pT for the Nth closest electron track with E/p cut - mHistManager.add("clusterTM_NSigma_p_cut", "NSigma positron with E over p cut", o2HistType::kTH3F, {nSigmaAxis, trackptAxis, nmatchedtrack}); // NSigma vs track pT for the Nth closest positron track with E/p cut - mHistManager.add("TrackTM_NSigma", "electron NSigma for global tracks", o2HistType::kTH2F, {nSigmaAxis, trackptAxis}); // NSigma_electron vs track pT for global track - mHistManager.add("TrackTM_NSigma_e", "NSigma e for global negative tracks", o2HistType::kTH2F, {nSigmaAxis, trackptAxis}); // NSigma vs track pT for negative global track - mHistManager.add("TrackTM_NSigma_p", "NSigma e for global positive tracks", o2HistType::kTH2F, {nSigmaAxis, trackptAxis}); // NSigma vs track pT for positive global track - mHistManager.add("clusterTM_NSigma_electron_ASide", "NSigma electron in A-Side", o2HistType::kTH3F, {nSigmaAxis, trackptAxis, nmatchedtrack}); // NSigma vs track pT for the Nth closest electron/positron track in A-Side - mHistManager.add("clusterTM_NSigma_electron_CSide", "NSigma positron in C-Side", o2HistType::kTH3F, {nSigmaAxis, trackptAxis, nmatchedtrack}); // NSigma vs track pT for the Nth closest electron/positron track in C-Side - mHistManager.add("clusterTM_EoverP_hadron", "cluster E/hadron p", o2HistType::kTH3F, {eoverpAxis, trackpAxis, nmatchedtrack}); // E over p vs track pT for the Nth closest hadron track - mHistManager.add("clusterTM_EoverP_hn", "cluster E/hadron p", o2HistType::kTH3F, {eoverpAxis, trackpAxis, nmatchedtrack}); // E over p vs track pT for the Nth closest negative hadron track - mHistManager.add("clusterTM_EoverP_hp", "cluster E/hadron p", o2HistType::kTH3F, {eoverpAxis, trackpAxis, nmatchedtrack}); // E over p vs track pT for the Nth closest positive hadron track - mHistManager.add("clusterTM_EoverP_hadron_ASide", "cluster E/hadron p in A-Side", o2HistType::kTH3F, {eoverpAxis, trackpAxis, nmatchedtrack}); // E over p vs track pT for the Nth closest hadron track in A-Side - mHistManager.add("clusterTM_EoverP_hadron_CSide", "cluster E/hadron p in C-Side", o2HistType::kTH3F, {eoverpAxis, trackpAxis, nmatchedtrack}); // E over p vs track pT for the Nth closest hadron track in C-Side + mHistManager.add("TrackEtaPhi", "#eta vs #varphi of all selected tracks", HistType::kTH2F, {etaAxis, phiAxis}); // eta vs phi of all selected tracks + mHistManager.add("TrackEtaPhi_Neg", "#eta vs #varphi of all selected negative tracks", HistType::kTH2F, {etaAxis, phiAxis}); // eta vs phi of all selected negative tracks + mHistManager.add("TrackEtaPhi_Pos", "#eta vs #varphi of all selected positive tracks", HistType::kTH2F, {etaAxis, phiAxis}); // eta vs phi of all selected positive tracks + mHistManager.add("clusterEMatched", "Energy of cluster (with match)", HistType::kTH1F, {energyAxis}); // energy of matched clusters + mHistManager.add("MatchedTrackEtaPhi_BeforeCut", "#eta vs #varphi of all selected matched tracks before d#eta and #dvarphi cut", HistType::kTH2F, {etaAxis, phiAxis}); // eta vs phi of all selected matched tracks before dEta and dPhi cut + mHistManager.add("MatchedTrackEtaPhi_Neg_BeforeCut", "#eta vs #varphi of all selected negative matched tracks before d#eta and #dvarphi cut", HistType::kTH2F, {etaAxis, phiAxis}); // eta vs phi of all selected negative matched tracks before dEta and dPhi cut + mHistManager.add("MatchedTrackEtaPhi_Pos_BeforeCut", "#eta vs #varphi of all selected positive matched tracks before d#eta and #dvarphi cut", HistType::kTH2F, {etaAxis, phiAxis}); // eta vs phi of all selected positive matched tracks before dEta and dPhi cut + mHistManager.add("MatchedTrackEtaPhi", "#eta vs #varphi of all selected matched tracks", HistType::kTH2F, {etaAxis, phiAxis}); // eta vs phi of all selected matched tracks + mHistManager.add("MatchedTrackEtaPhi_Neg", "#eta vs #varphi of all selected negative matched tracks", HistType::kTH2F, {etaAxis, phiAxis}); // eta vs phi of all selected negative matched tracks + mHistManager.add("MatchedTrackEtaPhi_Pos", "#eta vs #varphi of all selected positive matched tracks", HistType::kTH2F, {etaAxis, phiAxis}); // eta vs phi of all selected positive matched tracks + mHistManager.add("clusterTM_dEtadPhi", "cluster trackmatching dEta/dPhi", HistType::kTH3F, {dEtaAxis, dPhiAxis, smAxis}); // dEta dPhi per SM + mHistManager.add("clusterTM_dEtadPhi_ASide", "cluster trackmatching in A-Side dEta/dPhi", HistType::kTH3F, {dEtaAxis, dPhiAxis, smAxis}); // dEta dPhi per SM in A-Aside + mHistManager.add("clusterTM_dEtadPhi_CSide", "cluster trackmatching in C-Side tracks dEta/dPhi", HistType::kTH3F, {dEtaAxis, dPhiAxis, smAxis}); // dEta dPhi per SM in C-Side + mHistManager.add("clusterTM_PosdEtadPhi", "cluster trackmatching positive tracks dEta/dPhi", HistType::kTH3F, {dEtaAxis, dPhiAxis, smAxis}); // dEta dPhi per SM positive track + mHistManager.add("clusterTM_NegdEtadPhi", "cluster trackmatching negative tracks dEta/dPhi", HistType::kTH3F, {dEtaAxis, dPhiAxis, smAxis}); // dEta dPhi per SM negative track + mHistManager.add("clusterTM_PosdEtadPhi_Pl0_75", "cluster trackmatching positive tracks, p < 0.75 dEta/dPhi", HistType::kTH3F, {dEtaAxis, dPhiAxis, smAxis}); // dEta dPhi per SM positive track with p < 0.75 GeV/c + mHistManager.add("clusterTM_NegdEtadPhi_Pl0_75", "cluster trackmatching negative tracks, p < 0.75 dEta/dPhi", HistType::kTH3F, {dEtaAxis, dPhiAxis, smAxis}); // dEta dPhi per SM negative track with p < 0.75 GeV/c + mHistManager.add("clusterTM_PosdEtadPhi_0_75leqPl1_25", "cluster trackmatching positive tracks, 0.75 <= p < 1.25 dEta/dPhi", HistType::kTH3F, {dEtaAxis, dPhiAxis, smAxis}); // dEta dPhi per SM positive track with 0.75 <= p < 1.25 GeV/c + mHistManager.add("clusterTM_NegdEtadPhi_0_75leqPl1_25", "cluster trackmatching negative tracks, 0.75 <= p < 1.25 dEta/dPhi", HistType::kTH3F, {dEtaAxis, dPhiAxis, smAxis}); // dEta dPhi per SM negative track with 0.75 <= p < 1.25 GeV/c + mHistManager.add("clusterTM_PosdEtadPhi_Pgeq1_25", "cluster trackmatching positive tracks, p >= 1.25 dEta/dPhi", HistType::kTH3F, {dEtaAxis, dPhiAxis, smAxis}); // dEta dPhi per SM positive track with p >= 1.25 GeV/c + mHistManager.add("clusterTM_NegdEtadPhi_Pgeq1_25", "cluster trackmatching negative tracks, p >= 1.25 dEta/dPhi", HistType::kTH3F, {dEtaAxis, dPhiAxis, smAxis}); // dEta dPhi per SM negative track with p >= 1.25 GeV/c + mHistManager.add("clusterTM_dEtaPt", "cluster trackmatching dEta/#it{p}_{T};d#it{#eta};#it{p}_{T} (GeV/#it{c})", HistType::kTH3F, {dEtaAxis, clusterptAxis, smAxis}); // dEta vs pT per SM + mHistManager.add("clusterTM_PosdPhiPt", "cluster trackmatching positive tracks dPhi/#it{p}_{T}", HistType::kTH3F, {dPhiAxis, clusterptAxis, smAxis}); // dPhi vs pT per SM positive track + mHistManager.add("clusterTM_NegdPhiPt", "cluster trackmatching negative tracks dPh/#it{p}_{T}", HistType::kTH3F, {dPhiAxis, clusterptAxis, smAxis}); // dPhi vs pT per SM negative track + mHistManager.add("clusterTM_dEtaTN", "cluster trackmatching dEta/TN;d#it{#eta};#it{N}_{matched tracks}", HistType::kTH2F, {dEtaAxis, nmatchedtrack}); // dEta compared to the Nth closest track + mHistManager.add("clusterTM_dPhiTN", "cluster trackmatching dPhi/TN;d#it{#varphi} (rad);#it{N}_{matched tracks}", HistType::kTH2F, {dPhiAxis, nmatchedtrack}); // dPhi compared to the Nth closest track + mHistManager.add("clusterTM_dRTN", "cluster trackmatching dR/TN;d#it{R};#it{N}_{matched tracks}", HistType::kTH2F, {dRAxis, nmatchedtrack}); // dR compared to the Nth closest track + mHistManager.add("clusterTM_NTrack", "cluster trackmatching NMatchedTracks", HistType::kTH1I, {nmatchedtrack}); // how many tracks are matched + mHistManager.add("clusterTM_EoverP_E", "E/p ", HistType::kTH3F, {eoverpAxis, energyAxis, nmatchedtrack}); // E/p vs p for the Nth closest track + mHistManager.add("clusterTM_EoverP_Pt", "E/p vs track pT", HistType::kTH3F, {eoverpAxis, trackptAxis, nmatchedtrack}); // E/p vs track pT for the Nth closest track + mHistManager.add("clusterTM_EvsP", "cluster E/track p", HistType::kTH3F, {energyAxis, trackpAxis, nmatchedtrack}); // E vs p for the Nth closest track + mHistManager.add("clusterTM_EoverP_ep", "cluster E/electron p", HistType::kTH3F, {eoverpAxis, trackptAxis, nmatchedtrack}); // E over p vs track pT for the Nth closest electron/positron track + mHistManager.add("clusterTM_EoverP_e", "cluster E/electron p", HistType::kTH3F, {eoverpAxis, trackptAxis, nmatchedtrack}); // E over p vs track pT for the Nth closest electron track + mHistManager.add("clusterTM_EoverP_p", "cluster E/electron p", HistType::kTH3F, {eoverpAxis, trackptAxis, nmatchedtrack}); // E over p vs track pT for the Nth closest positron track + mHistManager.add("clusterTM_EoverP_electron_ASide", "cluster E/electron p in A-Side", HistType::kTH3F, {eoverpAxis, trackptAxis, nmatchedtrack}); // E over p vs track pT for the Nth closest electron/positron track in A-Side + mHistManager.add("clusterTM_EoverP_electron_CSide", "cluster E/electron p in C-Side", HistType::kTH3F, {eoverpAxis, trackptAxis, nmatchedtrack}); // E over p vs track pT for the Nth closest electron/positron track in C-Side + mHistManager.add("clusterTM_NSigma_BeforeCut", "electron NSigma for matched tracks before d#eta and #dvarphi cut", HistType::kTH3F, {nSigmaAxis, trackptAxis, nmatchedtrack}); // NSigma_electron vs track pT for the Nth closest track before dEta and dPhi cut + mHistManager.add("clusterTM_NSigma_neg_BeforeCut", "electron NSigma for matched negative tracks before d#eta and #dvarphi cut", HistType::kTH3F, {nSigmaAxis, trackptAxis, nmatchedtrack}); // NSigma_electron vs track pT for the Nth closest negative tracks before dEta and dPhi cut + mHistManager.add("clusterTM_NSigma_pos_BeforeCut", "electron NSigma for matched positive tracks before d#eta and #dvarphi cut", HistType::kTH3F, {nSigmaAxis, trackptAxis, nmatchedtrack}); // NSigma_electron vs track pT for the Nth closest positive tracks before dEta and dPhi cut + mHistManager.add("clusterTM_NSigma", "electron NSigma for matched track", HistType::kTH3F, {nSigmaAxis, trackptAxis, nmatchedtrack}); // NSigma_electron vs track pT for the Nth closest track + mHistManager.add("clusterTM_NSigma_neg", "electron NSigma for matched negative track", HistType::kTH3F, {nSigmaAxis, trackptAxis, nmatchedtrack}); // NSigma_electron vs track pT for the Nth closest negative tracks + mHistManager.add("clusterTM_NSigma_pos", "electron NSigma for matched positive track", HistType::kTH3F, {nSigmaAxis, trackptAxis, nmatchedtrack}); // NSigma_electron vs track pT for the Nth closest positive tracks + mHistManager.add("clusterTM_NSigma_cut", "electron NSigma for matched track with cuts", HistType::kTH3F, {nSigmaAxis, trackptAxis, nmatchedtrack}); // NSigma_electron vs track pT for the Nth closest track with cuts on E/p and cluster cuts + mHistManager.add("clusterTM_NSigma_e", "NSigma electron", HistType::kTH3F, {nSigmaAxis, trackptAxis, nmatchedtrack}); // NSigma vs track pT for the Nth closest electron track + mHistManager.add("clusterTM_NSigma_p", "NSigma positron", HistType::kTH3F, {nSigmaAxis, trackptAxis, nmatchedtrack}); // NSigma vs track pT for the Nth closest positron track + mHistManager.add("clusterTM_NSigma_e_cut", "NSigma electron with E over p cut", HistType::kTH3F, {nSigmaAxis, trackptAxis, nmatchedtrack}); // NSigma vs track pT for the Nth closest electron track with E/p cut + mHistManager.add("clusterTM_NSigma_p_cut", "NSigma positron with E over p cut", HistType::kTH3F, {nSigmaAxis, trackptAxis, nmatchedtrack}); // NSigma vs track pT for the Nth closest positron track with E/p cut + mHistManager.add("TrackTM_NSigma", "electron NSigma for global tracks", HistType::kTH2F, {nSigmaAxis, trackptAxis}); // NSigma_electron vs track pT for global track + mHistManager.add("TrackTM_NSigma_e", "NSigma e for global negative tracks", HistType::kTH2F, {nSigmaAxis, trackptAxis}); // NSigma vs track pT for negative global track + mHistManager.add("TrackTM_NSigma_p", "NSigma e for global positive tracks", HistType::kTH2F, {nSigmaAxis, trackptAxis}); // NSigma vs track pT for positive global track + mHistManager.add("clusterTM_NSigma_electron_ASide", "NSigma electron in A-Side", HistType::kTH3F, {nSigmaAxis, trackptAxis, nmatchedtrack}); // NSigma vs track pT for the Nth closest electron/positron track in A-Side + mHistManager.add("clusterTM_NSigma_electron_CSide", "NSigma positron in C-Side", HistType::kTH3F, {nSigmaAxis, trackptAxis, nmatchedtrack}); // NSigma vs track pT for the Nth closest electron/positron track in C-Side + mHistManager.add("clusterTM_EoverP_hadron", "cluster E/hadron p", HistType::kTH3F, {eoverpAxis, trackpAxis, nmatchedtrack}); // E over p vs track pT for the Nth closest hadron track + mHistManager.add("clusterTM_EoverP_hn", "cluster E/hadron p", HistType::kTH3F, {eoverpAxis, trackpAxis, nmatchedtrack}); // E over p vs track pT for the Nth closest negative hadron track + mHistManager.add("clusterTM_EoverP_hp", "cluster E/hadron p", HistType::kTH3F, {eoverpAxis, trackpAxis, nmatchedtrack}); // E over p vs track pT for the Nth closest positive hadron track + mHistManager.add("clusterTM_EoverP_hadron_ASide", "cluster E/hadron p in A-Side", HistType::kTH3F, {eoverpAxis, trackpAxis, nmatchedtrack}); // E over p vs track pT for the Nth closest hadron track in A-Side + mHistManager.add("clusterTM_EoverP_hadron_CSide", "cluster E/hadron p in C-Side", HistType::kTH3F, {eoverpAxis, trackpAxis, nmatchedtrack}); // E over p vs track pT for the Nth closest hadron track in C-Side - if (mVetoBCID->length()) { - std::stringstream parser(mVetoBCID.value); + if (vetoBCID->length()) { + std::stringstream parser(vetoBCID.value); std::string token; int bcid; while (std::getline(parser, token, ',')) { @@ -200,8 +192,8 @@ struct TrackMatchingMonitor { mVetoBCIDs.push_back(bcid); } } - if (mSelectBCID.value != "all") { - std::stringstream parser(mSelectBCID.value); + if (selectBCID.value != "all") { + std::stringstream parser(selectBCID.value); std::string token; int bcid; while (std::getline(parser, token, ',')) { @@ -215,19 +207,22 @@ struct TrackMatchingMonitor { // define cluster filter. It selects only those clusters which are of the type // sadly passing of the string at runtime is not possible for technical region so cluster definition is // an integer instead - Filter clusterDefinitionSelection = (o2::aod::emcalcluster::definition == mClusterDefinition) && (o2::aod::emcalcluster::time >= minTime) && (o2::aod::emcalcluster::time <= maxTime) && (o2::aod::emcalcluster::m02 > minM02) && (o2::aod::emcalcluster::m02 < maxM02); + Filter clusterDefinitionSelection = (o2::aod::emcalcluster::definition == clusterDefinition) && (o2::aod::emcalcluster::time >= minTime) && (o2::aod::emcalcluster::time <= maxTime) && (o2::aod::emcalcluster::m02 > minM02) && (o2::aod::emcalcluster::m02 < maxM02); /// \brief Process EMCAL clusters that are matched to a collisions - void processCollisions(collisionEvSelIt const& theCollision, selectedClusters const& clusters, o2::aod::EMCALClusterCells const&, o2::aod::Calos const&, o2::aod::EMCALMatchedTracks const& matchedtracks, tracksPID const& alltracks) + void processCollisions(CollisionEvSelIt const& theCollision, SelectedClusters const& clusters, o2::aod::EMCALClusterCells const&, o2::aod::Calos const&, o2::aod::EMCALMatchedTracks const& matchedtracks, TracksPID const& alltracks) { mHistManager.fill(HIST("eventsAll"), 1); - // do event selection if mDoEventSel is specified + // do event selection if doEventSel is specified // currently the event selection is hard coded to kINT7 // but other selections are possible that are defined in TriggerAliases.h bool isSelected = true; - if (mDoEventSel) { - if (theCollision.bc().runNumber() < 300000) { + const int beginningRun3 = 300000; + float lowP = 0.75f; + float midP = 1.25f; + if (doEventSel) { + if (theCollision.bc().runNumber() < beginningRun3) { if (!theCollision.alias_bit(kINT7)) { isSelected = false; } @@ -242,8 +237,8 @@ struct TrackMatchingMonitor { return; } mHistManager.fill(HIST("eventVertexZAll"), theCollision.posZ()); - if (mVertexCut > 0 && TMath::Abs(theCollision.posZ()) > mVertexCut) { - LOG(debug) << "Event not selected because of z-vertex cut z= " << theCollision.posZ() << " > " << mVertexCut << " cm, skipping"; + if (vertexCut > 0 && std::abs(theCollision.posZ()) > vertexCut) { + LOG(debug) << "Event not selected because of z-vertex cut z= " << theCollision.posZ() << " > " << vertexCut << " cm, skipping"; return; } mHistManager.fill(HIST("eventsSelected"), 1); @@ -251,13 +246,8 @@ struct TrackMatchingMonitor { for (const auto& alltrack : alltracks) { double trackEta, trackPhi; - if (hasPropagatedTracks) { // only temporarily while not every data has the tracks propagated to EMCal/PHOS - trackEta = alltrack.trackEtaEmcal(); - trackPhi = alltrack.trackPhiEmcal(); - } else { - trackEta = alltrack.eta(); - trackPhi = alltrack.phi(); - } + trackEta = alltrack.trackEtaEmcal(); + trackPhi = alltrack.trackPhiEmcal(); if (alltrack.isGlobalTrack()) { // NSigma of all global tracks without matching mHistManager.fill(HIST("TrackTM_NSigma"), alltrack.tpcNSigmaEl(), alltrack.pt()); mHistManager.fill(HIST("TrackEtaPhi"), trackEta, trackPhi); @@ -294,7 +284,7 @@ struct TrackMatchingMonitor { // match.track_as() with // using globTracks = o2::soa::Join; // In this example the counter t is just used to only look at the closest match - double dEta, dPhi, pT, abs_p, trackEta, trackPhi, NSigmaEl; + float dEta, dPhi, pT, abs_p, trackEta, trackPhi, nSigmaEl; int supermoduleID; try { supermoduleID = mGeometry->SuperModuleNumberFromEtaPhi(cluster.eta(), cluster.phi()); @@ -304,40 +294,35 @@ struct TrackMatchingMonitor { continue; } - pT = cluster.energy() / cosh(cluster.eta()); - if (M02highPt > 0. && cluster.m02() >= maxM02HighPt && pT >= M02highPt) { // high pT M02 cut + pT = cluster.energy() / std::cosh(cluster.eta()); + if (m02highPt > 0. && cluster.m02() >= maxM02HighPt && pT >= m02highPt) { // high pT M02 cut continue; } auto tracksofcluster = matchedtracks.sliceBy(perClusterMatchedTracks, cluster.globalIndex()); int t = 0; for (const auto& match : tracksofcluster) { - NSigmaEl = match.track_as().tpcNSigmaEl(); + nSigmaEl = match.track_as().tpcNSigmaEl(); // exmple of how to access any property of the matched tracks (tracks are sorted by how close they are to cluster) - LOG(debug) << "Pt of match" << match.track_as().pt(); - abs_p = abs(match.track_as().p()); + LOG(debug) << "Pt of match" << match.track_as().pt(); + abs_p = std::abs(match.track_as().p()); // only consider closest match - if (hasPropagatedTracks) { // only temporarily while not every data has the tracks propagated to EMCal/PHOS - trackEta = match.track_as().trackEtaEmcal(); - trackPhi = match.track_as().trackPhiEmcal(); - } else { - trackEta = match.track_as().eta(); - trackPhi = match.track_as().phi(); - } - dPhi = trackPhi - cluster.phi(); - dEta = trackEta - cluster.eta(); + trackEta = match.track_as().trackEtaEmcal(); + trackPhi = match.track_as().trackPhiEmcal(); + dPhi = match.deltaPhi(); + dEta = match.deltaEta(); mHistManager.fill(HIST("MatchedTrackEtaPhi_BeforeCut"), trackEta, trackPhi); - mHistManager.fill(HIST("clusterTM_NSigma_BeforeCut"), NSigmaEl, match.track_as().pt(), t); - if (match.track_as().sign() == -1) { + mHistManager.fill(HIST("clusterTM_NSigma_BeforeCut"), nSigmaEl, match.track_as().pt(), t); + if (match.track_as().sign() == -1) { mHistManager.fill(HIST("MatchedTrackEtaPhi_Neg_BeforeCut"), trackEta, trackPhi); - mHistManager.fill(HIST("clusterTM_NSigma_neg_BeforeCut"), NSigmaEl, match.track_as().pt(), t); - } else if (match.track_as().sign() == 1) { + mHistManager.fill(HIST("clusterTM_NSigma_neg_BeforeCut"), nSigmaEl, match.track_as().pt(), t); + } else if (match.track_as().sign() == 1) { mHistManager.fill(HIST("MatchedTrackEtaPhi_Pos_BeforeCut"), trackEta, trackPhi); - mHistManager.fill(HIST("clusterTM_NSigma_pos_BeforeCut"), NSigmaEl, match.track_as().pt(), t); + mHistManager.fill(HIST("clusterTM_NSigma_pos_BeforeCut"), nSigmaEl, match.track_as().pt(), t); } - if (fabs(dEta) >= minDEta || fabs(dPhi) >= minDPhi) { // dEta and dPhi cut + if (std::abs(dEta) >= minDEta || std::abs(dPhi) >= minDPhi) { // dEta and dPhi cut continue; } - if (hasTRD && !(match.track_as().hasTRD())) { // request TRD hit cut + if (hasTRD && !(match.track_as().hasTRD())) { // request TRD hit cut continue; } // only fill these for the first matched track: @@ -353,105 +338,105 @@ struct TrackMatchingMonitor { mHistManager.fill(HIST("clusterTM_dEtadPhi"), dEta, dPhi, t); mHistManager.fill(HIST("clusterEMatched"), cluster.energy(), t); mHistManager.fill(HIST("clusterTM_EvsP"), cluster.energy(), abs_p, t); - mHistManager.fill(HIST("clusterTM_EoverP_Pt"), eOverP, match.track_as().pt(), t); - mHistManager.fill(HIST("clusterTM_NSigma"), NSigmaEl, match.track_as().pt(), t); + mHistManager.fill(HIST("clusterTM_EoverP_Pt"), eOverP, match.track_as().pt(), t); + mHistManager.fill(HIST("clusterTM_NSigma"), nSigmaEl, match.track_as().pt(), t); mHistManager.fill(HIST("MatchedTrackEtaPhi"), trackEta, trackPhi); if (eOverPRange->at(0) <= eOverP && eOverP <= eOverPRange->at(1)) { - mHistManager.fill(HIST("clusterTM_NSigma_cut"), NSigmaEl, match.track_as().pt(), t); + mHistManager.fill(HIST("clusterTM_NSigma_cut"), nSigmaEl, match.track_as().pt(), t); } // A- and C-side - if (match.track_as().eta() > 0.0 && t == 0) { + if (match.track_as().eta() > 0.0 && t == 0) { mHistManager.fill(HIST("clusterTM_dEtadPhi_ASide"), dEta, dPhi, supermoduleID); - } else if (match.track_as().eta() < 0.0 && t == 0) { + } else if (match.track_as().eta() < 0.0 && t == 0) { mHistManager.fill(HIST("clusterTM_dEtadPhi_CSide"), dEta, dPhi, supermoduleID); } // positive and negative tracks seperate, with three different track momentum ranges - if (match.track_as().sign() == 1) { - mHistManager.fill(HIST("clusterTM_NSigma_pos"), NSigmaEl, match.track_as().pt(), t); + if (match.track_as().sign() == 1) { + mHistManager.fill(HIST("clusterTM_NSigma_pos"), nSigmaEl, match.track_as().pt(), t); mHistManager.fill(HIST("MatchedTrackEtaPhi_Pos"), trackEta, trackPhi); if (t == 0) { mHistManager.fill(HIST("clusterTM_PosdPhiPt"), dPhi, pT, supermoduleID); mHistManager.fill(HIST("clusterTM_PosdEtadPhi"), dEta, dPhi, supermoduleID); - if (abs_p < 0.75) { + if (abs_p < lowP) { mHistManager.fill(HIST("clusterTM_PosdEtadPhi_Pl0_75"), dEta, dPhi, supermoduleID); - } else if (abs_p >= 1.25) { + } else if (abs_p >= midP) { mHistManager.fill(HIST("clusterTM_PosdEtadPhi_Pgeq1_25"), dEta, dPhi, supermoduleID); } else { mHistManager.fill(HIST("clusterTM_PosdEtadPhi_0_75leqPl1_25"), dEta, dPhi, supermoduleID); } } - } else if (match.track_as().sign() == -1) { - mHistManager.fill(HIST("clusterTM_NSigma_neg"), NSigmaEl, match.track_as().pt(), t); + } else if (match.track_as().sign() == -1) { + mHistManager.fill(HIST("clusterTM_NSigma_neg"), nSigmaEl, match.track_as().pt(), t); mHistManager.fill(HIST("MatchedTrackEtaPhi_Neg"), trackEta, trackPhi); if (t == 0) { mHistManager.fill(HIST("clusterTM_NegdPhiPt"), dPhi, pT, supermoduleID); mHistManager.fill(HIST("clusterTM_NegdEtadPhi"), dEta, dPhi, supermoduleID); - if (abs_p < 0.75) { + if (abs_p < lowP) { mHistManager.fill(HIST("clusterTM_NegdEtadPhi_Pl0_75"), dEta, dPhi, supermoduleID); - } else if (abs_p >= 1.25) { + } else if (abs_p >= midP) { mHistManager.fill(HIST("clusterTM_NegdEtadPhi_Pgeq1_25"), dEta, dPhi, supermoduleID); } else { mHistManager.fill(HIST("clusterTM_NegdEtadPhi_0_75leqPl1_25"), dEta, dPhi, supermoduleID); } } } - if (tpcNsigmaElectron->at(0) <= NSigmaEl && NSigmaEl <= tpcNsigmaElectron->at(1)) { // E/p for e+/e- - if (usePionRejection && (tpcNsigmaPion->at(0) <= match.track_as().tpcNSigmaPi() || match.track_as().tpcNSigmaPi() <= tpcNsigmaPion->at(1))) { // with pion rejection - mHistManager.fill(HIST("clusterTM_EoverP_ep"), eOverP, match.track_as().pt(), t); - if (match.track_as().eta() >= 0.) { - mHistManager.fill(HIST("clusterTM_EoverP_electron_ASide"), eOverP, match.track_as().pt(), t); - mHistManager.fill(HIST("clusterTM_NSigma_electron_ASide"), NSigmaEl, match.track_as().pt(), t); + if (tpcNsigmaElectron->at(0) <= nSigmaEl && nSigmaEl <= tpcNsigmaElectron->at(1)) { // E/p for e+/e- + if (usePionRejection && (tpcNsigmaPion->at(0) <= match.track_as().tpcNSigmaPi() || match.track_as().tpcNSigmaPi() <= tpcNsigmaPion->at(1))) { // with pion rejection + mHistManager.fill(HIST("clusterTM_EoverP_ep"), eOverP, match.track_as().pt(), t); + if (match.track_as().eta() >= 0.) { + mHistManager.fill(HIST("clusterTM_EoverP_electron_ASide"), eOverP, match.track_as().pt(), t); + mHistManager.fill(HIST("clusterTM_NSigma_electron_ASide"), nSigmaEl, match.track_as().pt(), t); } else { - mHistManager.fill(HIST("clusterTM_EoverP_electron_CSide"), eOverP, match.track_as().pt(), t); - mHistManager.fill(HIST("clusterTM_NSigma_electron_CSide"), NSigmaEl, match.track_as().pt(), t); + mHistManager.fill(HIST("clusterTM_EoverP_electron_CSide"), eOverP, match.track_as().pt(), t); + mHistManager.fill(HIST("clusterTM_NSigma_electron_CSide"), nSigmaEl, match.track_as().pt(), t); } - if (match.track_as().sign() == -1) { - mHistManager.fill(HIST("clusterTM_EoverP_e"), eOverP, match.track_as().pt(), t); - mHistManager.fill(HIST("clusterTM_NSigma_e"), NSigmaEl, match.track_as().pt(), t); + if (match.track_as().sign() == -1) { + mHistManager.fill(HIST("clusterTM_EoverP_e"), eOverP, match.track_as().pt(), t); + mHistManager.fill(HIST("clusterTM_NSigma_e"), nSigmaEl, match.track_as().pt(), t); if (eOverPRange->at(0) <= eOverP && eOverP <= eOverPRange->at(1)) { - mHistManager.fill(HIST("clusterTM_NSigma_e_cut"), NSigmaEl, match.track_as().pt(), t); + mHistManager.fill(HIST("clusterTM_NSigma_e_cut"), nSigmaEl, match.track_as().pt(), t); } - } else if (match.track_as().sign() == +1) { - mHistManager.fill(HIST("clusterTM_EoverP_p"), eOverP, match.track_as().pt(), t); - mHistManager.fill(HIST("clusterTM_NSigma_p"), NSigmaEl, match.track_as().pt(), t); + } else if (match.track_as().sign() == +1) { + mHistManager.fill(HIST("clusterTM_EoverP_p"), eOverP, match.track_as().pt(), t); + mHistManager.fill(HIST("clusterTM_NSigma_p"), nSigmaEl, match.track_as().pt(), t); if (eOverPRange->at(0) <= eOverP && eOverP <= eOverPRange->at(1)) { - mHistManager.fill(HIST("clusterTM_NSigma_p_cut"), NSigmaEl, match.track_as().pt(), t); + mHistManager.fill(HIST("clusterTM_NSigma_p_cut"), nSigmaEl, match.track_as().pt(), t); } } } else { // without pion rejection - mHistManager.fill(HIST("clusterTM_EoverP_ep"), eOverP, match.track_as().pt(), t); - if (match.track_as().eta() >= 0.) { - mHistManager.fill(HIST("clusterTM_EoverP_electron_ASide"), eOverP, match.track_as().pt(), t); - mHistManager.fill(HIST("clusterTM_NSigma_electron_ASide"), NSigmaEl, match.track_as().pt(), t); + mHistManager.fill(HIST("clusterTM_EoverP_ep"), eOverP, match.track_as().pt(), t); + if (match.track_as().eta() >= 0.) { + mHistManager.fill(HIST("clusterTM_EoverP_electron_ASide"), eOverP, match.track_as().pt(), t); + mHistManager.fill(HIST("clusterTM_NSigma_electron_ASide"), nSigmaEl, match.track_as().pt(), t); } else { - mHistManager.fill(HIST("clusterTM_EoverP_electron_CSide"), eOverP, match.track_as().pt(), t); - mHistManager.fill(HIST("clusterTM_NSigma_electron_CSide"), NSigmaEl, match.track_as().pt(), t); + mHistManager.fill(HIST("clusterTM_EoverP_electron_CSide"), eOverP, match.track_as().pt(), t); + mHistManager.fill(HIST("clusterTM_NSigma_electron_CSide"), nSigmaEl, match.track_as().pt(), t); } - if (match.track_as().sign() == -1) { - mHistManager.fill(HIST("clusterTM_EoverP_e"), eOverP, match.track_as().pt(), t); - mHistManager.fill(HIST("clusterTM_NSigma_e"), NSigmaEl, match.track_as().pt(), t); + if (match.track_as().sign() == -1) { + mHistManager.fill(HIST("clusterTM_EoverP_e"), eOverP, match.track_as().pt(), t); + mHistManager.fill(HIST("clusterTM_NSigma_e"), nSigmaEl, match.track_as().pt(), t); if (eOverPRange->at(0) <= eOverP && eOverP <= eOverPRange->at(1)) { - mHistManager.fill(HIST("clusterTM_NSigma_e_cut"), NSigmaEl, match.track_as().pt(), t); + mHistManager.fill(HIST("clusterTM_NSigma_e_cut"), nSigmaEl, match.track_as().pt(), t); } - } else if (match.track_as().sign() == +1) { - mHistManager.fill(HIST("clusterTM_EoverP_p"), eOverP, match.track_as().pt(), t); - mHistManager.fill(HIST("clusterTM_NSigma_p"), NSigmaEl, match.track_as().pt(), t); + } else if (match.track_as().sign() == +1) { + mHistManager.fill(HIST("clusterTM_EoverP_p"), eOverP, match.track_as().pt(), t); + mHistManager.fill(HIST("clusterTM_NSigma_p"), nSigmaEl, match.track_as().pt(), t); if (eOverPRange->at(0) <= eOverP && eOverP <= eOverPRange->at(1)) { - mHistManager.fill(HIST("clusterTM_NSigma_p_cut"), NSigmaEl, match.track_as().pt(), t); + mHistManager.fill(HIST("clusterTM_NSigma_p_cut"), nSigmaEl, match.track_as().pt(), t); } } } - } else if (tpcNsigmaBack->at(0) <= NSigmaEl && NSigmaEl <= tpcNsigmaBack->at(1)) { // E/p for hadrons / background - mHistManager.fill(HIST("clusterTM_EoverP_hadron"), eOverP, match.track_as().pt(), t); - if (match.track_as().eta() >= 0.) { - mHistManager.fill(HIST("clusterTM_EoverP_hadron_ASide"), eOverP, match.track_as().pt(), t); + } else if (tpcNsigmaBack->at(0) <= nSigmaEl && nSigmaEl <= tpcNsigmaBack->at(1)) { // E/p for hadrons / background + mHistManager.fill(HIST("clusterTM_EoverP_hadron"), eOverP, match.track_as().pt(), t); + if (match.track_as().eta() >= 0.) { + mHistManager.fill(HIST("clusterTM_EoverP_hadron_ASide"), eOverP, match.track_as().pt(), t); } else { - mHistManager.fill(HIST("clusterTM_EoverP_hadron_CSide"), eOverP, match.track_as().pt(), t); + mHistManager.fill(HIST("clusterTM_EoverP_hadron_CSide"), eOverP, match.track_as().pt(), t); } - if (match.track_as().sign() == -1) { - mHistManager.fill(HIST("clusterTM_EoverP_hn"), eOverP, match.track_as().pt(), t); - } else if (match.track_as().sign() == +1) { - mHistManager.fill(HIST("clusterTM_EoverP_hp"), eOverP, match.track_as().pt(), t); + if (match.track_as().sign() == -1) { + mHistManager.fill(HIST("clusterTM_EoverP_hn"), eOverP, match.track_as().pt(), t); + } else if (match.track_as().sign() == +1) { + mHistManager.fill(HIST("clusterTM_EoverP_hp"), eOverP, match.track_as().pt(), t); } } t++; @@ -459,12 +444,11 @@ struct TrackMatchingMonitor { mHistManager.fill(HIST("clusterTM_NTrack"), t); } } - PROCESS_SWITCH(TrackMatchingMonitor, processCollisions, "Process clusters from collision", true); + PROCESS_SWITCH(EmcTmMonitor, processCollisions, "Process clusters from collision", true); /// \brief Create binning for cluster energy axis (variable bin size) /// \return vector with bin limits - std::vector - makeEnergyBinning() const + std::vector makeEnergyBinning() const { auto fillBinLimits = [](std::vector& binlimits, double max, double binwidth) { auto current = *binlimits.rbegin(); @@ -491,26 +475,27 @@ struct TrackMatchingMonitor { { std::vector result; - Int_t nBinsClusterE = 235; - for (Int_t i = 0; i < nBinsClusterE + 1; i++) { - if (i < 1) + int nBinsClusterE = 235; + for (int i = 0; i < nBinsClusterE + 1; i++) { + if (i < 1) { // o2-linter: disable=magic-number (just numbers for binning) result.emplace_back(0.3 * i); - else if (i < 55) + } else if (i < 55) { // o2-linter: disable=magic-number (just numbers for binning) result.emplace_back(0.3 + 0.05 * (i - 1)); - else if (i < 105) + } else if (i < 105) { // o2-linter: disable=magic-number (just numbers for binning) result.emplace_back(3. + 0.1 * (i - 55)); - else if (i < 140) + } else if (i < 140) { // o2-linter: disable=magic-number (just numbers for binning) result.emplace_back(8. + 0.2 * (i - 105)); - else if (i < 170) + } else if (i < 170) { // o2-linter: disable=magic-number (just numbers for binning) result.emplace_back(15. + 0.5 * (i - 140)); - else if (i < 190) + } else if (i < 190) { // o2-linter: disable=magic-number (just numbers for binning) result.emplace_back(30. + 1.0 * (i - 170)); - else if (i < 215) + } else if (i < 215) { // o2-linter: disable=magic-number (just numbers for binning) result.emplace_back(50. + 2.0 * (i - 190)); - else if (i < 235) + } else if (i < 235) { // o2-linter: disable=magic-number (just numbers for binning) result.emplace_back(100. + 5.0 * (i - 215)); - else if (i < 245) + } else if (i < 245) { // o2-linter: disable=magic-number (just numbers for binning) result.emplace_back(200. + 10.0 * (i - 235)); + } } return result; } @@ -524,20 +509,21 @@ struct TrackMatchingMonitor { result.reserve(1000); double epsilon = 1e-6; double valGammaPt = 0; - for (int i = 0; i < 1000; ++i) { + for (int i = 0; i < 1000; ++i) { // o2-linter: disable=magic-number (just numbers for binning) result.push_back(valGammaPt); - if (valGammaPt < 1.0 - epsilon) + if (valGammaPt < 1.0 - epsilon) { // o2-linter: disable=magic-number (just numbers for binning) valGammaPt += 0.1; - else if (valGammaPt < 5 - epsilon) + } else if (valGammaPt < 5 - epsilon) { // o2-linter: disable=magic-number (just numbers for binning) valGammaPt += 0.2; - else if (valGammaPt < 10 - epsilon) + } else if (valGammaPt < 10 - epsilon) { // o2-linter: disable=magic-number (just numbers for binning) valGammaPt += 0.5; - else if (valGammaPt < 50 - epsilon) + } else if (valGammaPt < 50 - epsilon) { // o2-linter: disable=magic-number (just numbers for binning) valGammaPt += 1; - else if (valGammaPt < 100 - epsilon) + } else if (valGammaPt < 100 - epsilon) { // o2-linter: disable=magic-number (just numbers for binning) valGammaPt += 5; - else + } else { break; + } } return result; } @@ -546,6 +532,6 @@ struct TrackMatchingMonitor { WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { WorkflowSpec workflow{ - adaptAnalysisTask(cfgc, TaskName{"emc-tmmonitor"})}; + adaptAnalysisTask(cfgc)}; return workflow; } From d2be8617c1ea42c0ff67c5a69fc5c95b3b1e8ccc Mon Sep 17 00:00:00 2001 From: Junlee Kim Date: Sat, 26 Jul 2025 02:39:18 +0900 Subject: [PATCH 072/345] [PWGLF] initial commit on polarization correlations (#12247) Co-authored-by: ALICE Action Bot --- PWGLF/Tasks/Strangeness/CMakeLists.txt | 7 +- .../Strangeness/lambdaTwoPartPolarization.cxx | 399 ++++++++++++++++++ 2 files changed, 405 insertions(+), 1 deletion(-) create mode 100644 PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx diff --git a/PWGLF/Tasks/Strangeness/CMakeLists.txt b/PWGLF/Tasks/Strangeness/CMakeLists.txt index 2b261cecd1a..99908fd6661 100644 --- a/PWGLF/Tasks/Strangeness/CMakeLists.txt +++ b/PWGLF/Tasks/Strangeness/CMakeLists.txt @@ -154,4 +154,9 @@ o2physics_add_dpl_workflow(lambdaspincorrderived o2physics_add_dpl_workflow(strangenessderivedbinnedinfo SOURCES strangenessderivedbinnedinfo.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::AnalysisCCDB O2Physics::EventFilteringUtils - COMPONENT_NAME Analysis) \ No newline at end of file + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(lambdatwopartpolarization + SOURCES lambdaTwoPartPolarization.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) diff --git a/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx b/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx new file mode 100644 index 00000000000..29635eb8b45 --- /dev/null +++ b/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx @@ -0,0 +1,399 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \author Junlee Kim (jikim1290@gmail.com) + +#include "PWGLF/DataModel/LFStrangenessTables.h" + +#include "Common/Core/TrackSelection.h" +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "CCDB/BasicCCDBManager.h" +#include "CCDB/CcdbApi.h" +#include "CommonConstants/PhysicsConstants.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "DataFormatsParameters/GRPObject.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/O2DatabasePDGPlugin.h" +#include "Framework/StaticFor.h" +#include "Framework/StepTHn.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/Track.h" + +#include "Math/GenVector/Boost.h" +#include "Math/Vector3D.h" +#include "Math/Vector4D.h" +#include "TF1.h" +#include "TLorentzVector.h" +#include "TRandom3.h" +#include "TVector3.h" +#include + +#include +#include +#include +#include +#include +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::soa; +using namespace o2::constants::physics; + +struct lambdaTwoPartPolarization { + using EventCandidates = soa::Join; + using TrackCandidates = soa::Join; + using V0TrackCandidate = aod::V0Datas; + + HistogramRegistry histos{ + "histos", + {}, + OutputObjHandlingPolicy::AnalysisObject}; + + struct : ConfigurableGroup { + Configurable cfgURL{"cfgURL", + "http://alice-ccdb.cern.ch", "Address of the CCDB to browse"}; + Configurable nolaterthan{"ccdb-no-later-than", + std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), + "Latest acceptable timestamp of creation for the object"}; + } cfgCcdbParam; + Service ccdb; + o2::ccdb::CcdbApi ccdbApi; + + Configurable cfgCentSel{"cfgCentSel", 100., "Centrality selection"}; + Configurable cfgCentEst{"cfgCentEst", 2, "Centrality estimator, 1: FT0C, 2: FT0M"}; + + Configurable cfgEvtSel{"cfgEvtSel", true, "event selection flag"}; + Configurable cfgPVSel{"cfgPVSel", true, "Additional PV selection flag for syst"}; + Configurable cfgPV{"cfgPV", 10.0, "Additional PV selection range for syst"}; + Configurable cfgAddEvtSelPileup{"cfgAddEvtSelPileup", true, "flag for additional pileup selection"}; + Configurable cfgMaxOccupancy{"cfgMaxOccupancy", 999999, "maximum occupancy of tracks in neighbouring collisions in a given time range"}; + Configurable cfgMinOccupancy{"cfgMinOccupancy", 0, "maximum occupancy of tracks in neighbouring collisions in a given time range"}; + + Configurable cfgv0radiusMin{"cfgv0radiusMin", 1.2, "minimum decay radius"}; + Configurable cfgDCAPrToPVMin{"cfgDCAPrToPVMin", 0.05, "minimum DCA to PV for proton track"}; + Configurable cfgDCAPiToPVMin{"cfgDCAPiToPVMin", 0.1, "minimum DCA to PV for pion track"}; + Configurable cfgv0CosPA{"cfgv0CosPA", 0.99, "minimum v0 cosine"}; + Configurable cfgDCAV0Dau{"cfgDCAV0Dau", 1.0, "maximum DCA between daughters"}; + + Configurable cfgV0PtMin{"cfgV0PtMin", 0, "minimum pT for lambda"}; + Configurable cfgV0EtaMin{"cfgV0EtaMin", -0.5, "maximum rapidity"}; + Configurable cfgV0EtaMax{"cfgV0EtaMax", 0.5, "maximum rapidity"}; + Configurable cfgV0LifeTime{"cfgV0LifeTime", 30., "maximum lambda lifetime"}; + + Configurable cfgQAv0{"cfgQAv0", false, "QA plot"}; + + Configurable cfgDaughTPCnclsMin{"cfgDaughTPCnclsMin", 50, "minimum fired crossed rows"}; + Configurable cfgDaughPIDCutsTPCPr{"cfgDaughPIDCutsTPCPr", 5, "proton nsigma for TPC"}; + Configurable cfgDaughPIDCutsTPCPi{"cfgDaughPIDCutsTPCPi", 5, "pion nsigma for TPC"}; + Configurable cfgDaughEtaMin{"cfgDaughEtaMin", -0.8, "minimum daughter eta"}; + Configurable cfgDaughEtaMax{"cfgDaughEtaMax", 0.8, "maximum daughter eta"}; + Configurable cfgDaughPrPt{"cfgDaughPrPt", 0.5, "minimum daughter proton pt"}; + Configurable cfgDaughPiPt{"cfgDaughPiPt", 0.2, "minimum daughter pion pt"}; + + Configurable cfgHypMassWindow{"cfgHypMassWindow", 0.005, "single lambda mass selection"}; + + Configurable cfgEffCor{"cfgEffCor", false, "flag to apply efficiency correction"}; + Configurable cfgEffCorPath{"cfgEffCorPath", "", "path for pseudo efficiency correction"}; + + Configurable cfgAccCor{"cfgAccCor", false, "flag to apply acceptance correction"}; + Configurable cfgAccCorPath{"cfgAccCorPath", "", "path for pseudo acceptance correction"}; + + Configurable cfgRotBkg{"cfgRotBkg", true, "flag to construct rotational backgrounds"}; + Configurable cfgNRotBkg{"cfgNRotBkg", 10, "the number of rotational backgrounds"}; + Configurable cfgNoMixedEvents{"cfgNoMixedEvents", 10, "Number of mixed events per event"}; + + ConfigurableAxis ptAxis{"ptAxis", {VARIABLE_WIDTH, 0.2, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 4.0, 5.0, 6.5, 8.0, 10.0, 100.0}, "Transverse momentum bins"}; + ConfigurableAxis centAxis{"centAxis", {VARIABLE_WIDTH, 0, 10, 20, 30, 40, 50, 60, 70, 100}, "Centrality interval"}; + ConfigurableAxis RapAxis{"RapAxis", {10, -0.5, 0.5}, "Rapidity axis"}; + ConfigurableAxis detaAxis{"dyAxis", {20, -1, 1}, "relative rapidity axis"}; + ConfigurableAxis dphiAxis{"dphiAxis", {20, -constants::math::PI * 0.5, constants::math::PI * 1.5}, "relative azimuth axis"}; + + TF1* fMultPVCutLow = nullptr; + TF1* fMultPVCutHigh = nullptr; + + float centrality; + float dphi; + float weight; + + TProfile2D* EffMap = nullptr; + TProfile2D* AccMap = nullptr; + + void init(o2::framework::InitContext&) + { + AxisSpec centQaAxis = {100, 0.0, 100.0}; + AxisSpec PVzQaAxis = {300, -15.0, 15.0}; + AxisSpec epAxis = {6, 0.0, 2.0 * constants::math::PI}; + + AxisSpec pidAxis = {100, -10, 10}; + + AxisSpec shiftAxis = {10, 0, 10, "shift"}; + AxisSpec basisAxis = {20, 0, 20, "basis"}; + + if (cfgQAv0) { + histos.add("QA/CentDist", "", {HistType::kTH1F, {centQaAxis}}); + histos.add("QA/PVzDist", "", {HistType::kTH1F, {PVzQaAxis}}); + + histos.add("QA/nsigma_tpc_pt_ppr", "", {HistType::kTH2F, {ptAxis, pidAxis}}); + histos.add("QA/nsigma_tpc_pt_ppi", "", {HistType::kTH2F, {ptAxis, pidAxis}}); + histos.add("QA/nsigma_tpc_pt_mpr", "", {HistType::kTH2F, {ptAxis, pidAxis}}); + histos.add("QA/nsigma_tpc_pt_mpi", "", {HistType::kTH2F, {ptAxis, pidAxis}}); + } + + histos.add("Ana/Signal", "", {HistType::kTHnSparseF, {ptAxis, ptAxis, detaAxis, dphiAxis, centAxis}}); + histos.add("Ana/Acceptance", "", {HistType::kTHnSparseF, {ptAxis, centAxis, RapAxis}}); + + fMultPVCutLow = new TF1("fMultPVCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x - 2.5*([4]+[5]*x+[6]*x*x+[7]*x*x*x+[8]*x*x*x*x)", 0, 100); + fMultPVCutLow->SetParameters(2834.66, -87.0127, 0.915126, -0.00330136, 332.513, -12.3476, 0.251663, -0.00272819, 1.12242e-05); + fMultPVCutHigh = new TF1("fMultPVCutHigh", "[0]+[1]*x+[2]*x*x+[3]*x*x*x + 2.5*([4]+[5]*x+[6]*x*x+[7]*x*x*x+[8]*x*x*x*x)", 0, 100); + fMultPVCutHigh->SetParameters(2834.66, -87.0127, 0.915126, -0.00330136, 332.513, -12.3476, 0.251663, -0.00272819, 1.12242e-05); + + ccdb->setURL(cfgCcdbParam.cfgURL); + ccdbApi.init("http://alice-ccdb.cern.ch"); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); + } + + double massLambda = o2::constants::physics::MassLambda; + double massPr = o2::constants::physics::MassProton; + double massPi = o2::constants::physics::MassPionCharged; + + ROOT::Math::PxPyPzMVector ProtonVec1, PionVec1, LambdaVec1, ProtonBoostedVec1, PionBoostedVec1; + ROOT::Math::PxPyPzMVector ProtonVec2, PionVec2, LambdaVec2, ProtonBoostedVec2, PionBoostedVec2; + double costhetastar1; + double costhetastar2; + + template + bool eventSelected(TCollision collision) + { + if (!collision.sel8()) { + return 0; + } + if (cfgCentSel < centrality) { + return 0; + } + if (!collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { + return 0; + } + if (!collision.selection_bit(aod::evsel::kNoSameBunchPileup)) { + return 0; + } + if (cfgPVSel && std::abs(collision.posZ()) > cfgPV) { + return 0; + } + if (cfgAddEvtSelPileup && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + return 0; + } + if (collision.trackOccupancyInTimeRange() > cfgMaxOccupancy || collision.trackOccupancyInTimeRange() < cfgMinOccupancy) { + return 0; + } + + return 1; + } // event selection + + template + bool SelectionV0(TCollision const& collision, V0 const& candidate, int LambdaTag) + { + if (candidate.v0radius() < cfgv0radiusMin) + return false; + if (LambdaTag) { + if (std::abs(candidate.dcapostopv()) < cfgDCAPrToPVMin) + return false; + if (std::abs(candidate.dcanegtopv()) < cfgDCAPiToPVMin) + return false; + } else if (!LambdaTag) { + if (std::abs(candidate.dcapostopv()) < cfgDCAPiToPVMin) + return false; + if (std::abs(candidate.dcanegtopv()) < cfgDCAPrToPVMin) + return false; + } + if (candidate.v0cosPA() < cfgv0CosPA) + return false; + if (std::abs(candidate.dcaV0daughters()) > cfgDCAV0Dau) + return false; + if (candidate.pt() < cfgV0PtMin) + return false; + if (candidate.yLambda() < cfgV0EtaMin) + return false; + if (candidate.yLambda() > cfgV0EtaMax) + return false; + if (candidate.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * massLambda > cfgV0LifeTime) + return false; + + return true; + } + + template + bool isSelectedV0Daughter(T const& track, int pid) // pid 0: proton, pid 1: pion + { + if (track.tpcNClsFound() < cfgDaughTPCnclsMin) + return false; + if (pid == 0 && std::abs(track.tpcNSigmaPr()) > cfgDaughPIDCutsTPCPr) + return false; + if (pid == 1 && std::abs(track.tpcNSigmaPi()) > cfgDaughPIDCutsTPCPi) + return false; + if (track.eta() > cfgDaughEtaMax) + return false; + if (track.eta() < cfgDaughEtaMin) + return false; + if (pid == 0 && track.pt() < cfgDaughPrPt) + return false; + if (pid == 1 && track.pt() < cfgDaughPiPt) + return false; + + return true; + } + + template + void FillHistograms(C1 const& c1, C2 const& c2, V01 const& V01s, V02 const& V02s) + { + for (auto& v01 : V01s) { + auto postrack_v01 = v01.template posTrack_as(); + auto negtrack_v01 = v01.template negTrack_as(); + + int LambdaTag = 0; + int aLambdaTag = 0; + + if (isSelectedV0Daughter(postrack_v01, 0) && isSelectedV0Daughter(negtrack_v01, 1)) { + LambdaTag = 1; + } + if (isSelectedV0Daughter(negtrack_v01, 0) && isSelectedV0Daughter(postrack_v01, 1)) { + aLambdaTag = 1; + } + + if (LambdaTag == aLambdaTag) + continue; + + if (!SelectionV0(c1, v01, LambdaTag)) + continue; + + if (LambdaTag) { + ProtonVec1 = ROOT::Math::PxPyPzMVector(v01.pxpos(), v01.pypos(), v01.pzpos(), massPr); + PionVec1 = ROOT::Math::PxPyPzMVector(v01.pxneg(), v01.pyneg(), v01.pzneg(), massPi); + } + if (aLambdaTag) { + ProtonVec1 = ROOT::Math::PxPyPzMVector(v01.pxneg(), v01.pyneg(), v01.pzneg(), massPr); + PionVec1 = ROOT::Math::PxPyPzMVector(v01.pxpos(), v01.pypos(), v01.pzpos(), massPi); + } + LambdaVec1 = ProtonVec1 + PionVec1; + LambdaVec1.SetM(massLambda); + + ROOT::Math::Boost boost1{LambdaVec1.BoostToCM()}; + ProtonBoostedVec1 = boost1(ProtonVec1); + + costhetastar1 = ProtonBoostedVec1.Pz() / ProtonBoostedVec1.P(); + + histos.fill(HIST("Ana/Acceptance"), v01.pt(), centrality, v01.yLambda(), costhetastar1 * costhetastar1); + + for (auto& v02 : V02s) { + if (v01.v0Id() <= v02.v0Id() && doprocessDataSame) + continue; + auto postrack_v02 = v02.template posTrack_as(); + auto negtrack_v02 = v02.template negTrack_as(); + + LambdaTag = 0; + aLambdaTag = 0; + + if (isSelectedV0Daughter(postrack_v02, 0) && isSelectedV0Daughter(negtrack_v02, 1)) { + LambdaTag = 1; + } + if (isSelectedV0Daughter(negtrack_v02, 0) && isSelectedV0Daughter(postrack_v02, 1)) { + aLambdaTag = 1; + } + + if (LambdaTag == aLambdaTag) + continue; + + if (!SelectionV0(c2, v02, LambdaTag)) + continue; + + if (doprocessDataSame) { + if (postrack_v01.globalIndex() == postrack_v02.globalIndex() || postrack_v01.globalIndex() == negtrack_v02.globalIndex() || negtrack_v01.globalIndex() == postrack_v02.globalIndex() || negtrack_v01.globalIndex() == negtrack_v02.globalIndex()) + continue; // no shared decay products + } + + if (LambdaTag) { + ProtonVec2 = ROOT::Math::PxPyPzMVector(v02.pxpos(), v02.pypos(), v02.pzpos(), massPr); + PionVec2 = ROOT::Math::PxPyPzMVector(v02.pxneg(), v02.pyneg(), v02.pzneg(), massPi); + } + if (aLambdaTag) { + ProtonVec2 = ROOT::Math::PxPyPzMVector(v02.pxneg(), v02.pyneg(), v02.pzneg(), massPr); + PionVec2 = ROOT::Math::PxPyPzMVector(v02.pxpos(), v02.pypos(), v02.pzpos(), massPi); + } + LambdaVec2 = ProtonVec2 + PionVec2; + LambdaVec2.SetM(massLambda); + + ROOT::Math::Boost boost2{LambdaVec2.BoostToCM()}; + ProtonBoostedVec2 = boost2(ProtonVec2); + + costhetastar2 = ProtonBoostedVec2.Pz() / ProtonBoostedVec2.P(); + + weight = 1.0; + weight *= cfgEffCor ? 1.0 / EffMap->GetBinContent(EffMap->GetXaxis()->FindBin(v01.pt()), EffMap->GetYaxis()->FindBin(centrality)) : 1.; + weight *= cfgAccCor ? 1.0 / AccMap->GetBinContent(AccMap->GetXaxis()->FindBin(v01.pt()), AccMap->GetYaxis()->FindBin(v01.yLambda())) : 1.; + weight *= cfgEffCor ? 1.0 / EffMap->GetBinContent(EffMap->GetXaxis()->FindBin(v02.pt()), EffMap->GetYaxis()->FindBin(centrality)) : 1.; + weight *= cfgAccCor ? 1.0 / AccMap->GetBinContent(AccMap->GetXaxis()->FindBin(v02.pt()), AccMap->GetYaxis()->FindBin(v02.yLambda())) : 1.; + + dphi = TVector2::Phi_0_2pi(v01.phi() - v02.phi()); + if (dphi > constants::math::PI * 1.5) { + dphi -= constants::math::PI * 2.0; + } + + histos.fill(HIST("Ana/Signal"), v01.pt(), v02.pt(), v01.yLambda() - v02.yLambda(), dphi, centrality, costhetastar1 * costhetastar2 * weight); + } + } + } + + void processDataSame(EventCandidates::iterator const& collision, + TrackCandidates const& /*tracks*/, aod::V0Datas const& V0s, + aod::BCsWithTimestamps const&) + { + if (cfgCentEst == 1) { + centrality = collision.centFT0C(); + } else if (cfgCentEst == 2) { + centrality = collision.centFT0M(); + } + if (!eventSelected(collision) && cfgEvtSel) { + return; + } + + histos.fill(HIST("QA/CentDist"), centrality, 1.0); + histos.fill(HIST("QA/PVzDist"), collision.posZ(), 1.0); + + auto bc = collision.bc_as(); + if (cfgEffCor) { + EffMap = ccdb->getForTimeStamp(cfgEffCorPath.value, bc.timestamp()); + } + if (cfgAccCor) { + AccMap = ccdb->getForTimeStamp(cfgAccCorPath.value, bc.timestamp()); + } + + FillHistograms(collision, collision, V0s, V0s); + } + PROCESS_SWITCH(lambdaTwoPartPolarization, processDataSame, "Process Event for same data", true); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc, TaskName{"lf-lambdaTwoPartPolarization"})}; +} From 84fc5f5d761a68c3ac5603aca70580a511f53c05 Mon Sep 17 00:00:00 2001 From: Jesper Karlsson Gumprecht <113693781+jesgum@users.noreply.github.com> Date: Fri, 25 Jul 2025 22:00:24 +0200 Subject: [PATCH 073/345] [ALICE3] Add use of BDT to otf multi-charm (#12253) --- ALICE3/DataModel/OTFMulticharm.h | 11 +- .../TableProducer/alice3-multicharmTable.cxx | 13 +- ALICE3/Tasks/CMakeLists.txt | 2 +- ALICE3/Tasks/alice3-multicharm.cxx | 290 +++++++++++++++--- 4 files changed, 258 insertions(+), 58 deletions(-) diff --git a/ALICE3/DataModel/OTFMulticharm.h b/ALICE3/DataModel/OTFMulticharm.h index 1fca25575d9..2c3a715f16c 100644 --- a/ALICE3/DataModel/OTFMulticharm.h +++ b/ALICE3/DataModel/OTFMulticharm.h @@ -40,6 +40,8 @@ DECLARE_SOA_COLUMN(XiccMass, xiccMass, float); // kine vars DECLARE_SOA_COLUMN(XiccPt, xiccPt, float); DECLARE_SOA_COLUMN(XiccEta, xiccEta, float); +DECLARE_SOA_COLUMN(XicPt, xicPt, float); +DECLARE_SOA_COLUMN(XicEta, xicEta, float); // topo vars DECLARE_SOA_COLUMN(XiDCAz, xiDCAz, float); @@ -122,12 +124,15 @@ DECLARE_SOA_TABLE(MCharmIndices, "AOD", "MCharmIndices", otfmulticharm::XiCCPionId); DECLARE_SOA_TABLE(MCharmCores, "AOD", "MCharmCores", - otfmulticharm::XicDauDCA, - otfmulticharm::XiccDauDCA, - otfmulticharm::XicMass, otfmulticharm::XiccMass, otfmulticharm::XiccPt, otfmulticharm::XiccEta, + otfmulticharm::XiccDauDCA, + + otfmulticharm::XicMass, + otfmulticharm::XicPt, + otfmulticharm::XicEta, + otfmulticharm::XicDauDCA, otfmulticharm::XiDCAxy, otfmulticharm::XiDCAz, diff --git a/ALICE3/TableProducer/alice3-multicharmTable.cxx b/ALICE3/TableProducer/alice3-multicharmTable.cxx index 433b6d065a9..f667b5dcd0a 100644 --- a/ALICE3/TableProducer/alice3-multicharmTable.cxx +++ b/ALICE3/TableProducer/alice3-multicharmTable.cxx @@ -734,9 +734,10 @@ struct alice3multicharmTable { picc.globalIndex()); multiCharmCore( - thisXiCcandidate.dca, thisXiCCcandidate.dca, - thisXiCcandidate.mass, thisXiCCcandidate.mass, - thisXiCCcandidate.pt, thisXiCCcandidate.eta, + thisXiCCcandidate.mass, thisXiCCcandidate.pt, + thisXiCCcandidate.eta, thisXiCCcandidate.dca, + thisXiCcandidate.mass, thisXiCcandidate.pt, + thisXiCcandidate.eta, thisXiCcandidate.dca, xi.dcaXY(), xi.dcaZ(), xicdcaXY, xicdcaZ, xiccdcaXY, xiccdcaZ, @@ -756,12 +757,10 @@ struct alice3multicharmTable { pi1cTOFDiffOuter, pi1c.nSigmaPionOuterTOF(), pi1c.hasSigPi(), pi1c.nSigmaPionRich(), getPdgCodeForTrack(pi1c), - pi2cTOFDiffInner, pi2c.nSigmaPionInnerTOF(), pi2cTOFDiffOuter, pi2c.nSigmaPionOuterTOF(), pi2c.hasSigPi(), pi2c.nSigmaPionRich(), getPdgCodeForTrack(pi2c), - piccTOFDiffInner, picc.nSigmaPionInnerTOF(), piccTOFDiffOuter, picc.nSigmaPionOuterTOF(), picc.hasSigPi(), picc.nSigmaPionRich(), @@ -774,9 +773,7 @@ struct alice3multicharmTable { prFromLa.dcaXY(), prFromLa.dcaZ(), piFromLa.pt(), piFromLa.eta(), piFromLa.dcaXY(), piFromLa.dcaZ(), - pi1c.eta(), - pi2c.eta(), - picc.eta()); + pi1c.eta(), pi2c.eta(), picc.eta()); } } histos.fill(HIST("hCombinationsXiCC"), nCombinationsCC); diff --git a/ALICE3/Tasks/CMakeLists.txt b/ALICE3/Tasks/CMakeLists.txt index 5da0bd2f7ea..06864096cf5 100644 --- a/ALICE3/Tasks/CMakeLists.txt +++ b/ALICE3/Tasks/CMakeLists.txt @@ -61,7 +61,7 @@ o2physics_add_dpl_workflow(alice3-taskcorrelationddbar o2physics_add_dpl_workflow(alice3-multicharm SOURCES alice3-multicharm.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::MLCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(alice3-efficiency diff --git a/ALICE3/Tasks/alice3-multicharm.cxx b/ALICE3/Tasks/alice3-multicharm.cxx index 59c1fda5f83..083a8e206bd 100644 --- a/ALICE3/Tasks/alice3-multicharm.cxx +++ b/ALICE3/Tasks/alice3-multicharm.cxx @@ -30,6 +30,8 @@ #include "Common/Core/TrackSelection.h" #include "Common/Core/trackUtilities.h" #include "Common/DataModel/TrackSelectionTables.h" +#include "Tools/ML/MlResponse.h" +#include "Tools/ML/model.h" #include "CCDB/BasicCCDBManager.h" #include "CommonConstants/PhysicsConstants.h" @@ -53,20 +55,45 @@ #include #include #include +#include #include +#include using namespace o2; +using namespace o2::ml; using namespace o2::framework; using namespace o2::framework::expressions; using multiCharmTracksPID = soa::Join; using multiCharmTracksFull = soa::Join; +#define getHist(type, name) std::get>(histPointers[name]) struct alice3multicharm { HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + std::map histPointers; + std::string histPath; + std::map pdgToBin; + o2::ml::OnnxModel bdtMCharm; + + std::map metadata; + o2::ccdb::CcdbApi ccdbApi; + Service ccdb; + + struct : ConfigurableGroup { + std::string prefix = "bdt"; // JSON group name + Configurable ccdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable localPath{"localPath", "MCharm_BDTModel.onnx", "(std::string) Path to the local .onnx file."}; + Configurable pathCCDB{"btdPathCCDB", "Users/j/jekarlss/MLModels2", "Path on CCDB"}; + Configurable timestampCCDB{"timestampCCDB", -1, "timestamp of the ONNX file for ML model used to query in CCDB. Exceptions: > 0 for the specific timestamp, 0 gets the run dependent timestamp"}; + Configurable loadModelsFromCCDB{"loadModelsFromCCDB", false, "Flag to enable or disable the loading of models from CCDB"}; + Configurable enableOptimizations{"enableOptimizations", false, "Enables the ONNX extended model-optimization: sessionOptions.SetGraphOptimizationLevel(GraphOptimizationLevel::ORT_ENABLE_EXTENDED)"}; + Configurable enableML{"enableML", false, "Enables bdt model"}; + Configurable> requiredScores{"requiredScores", {0.5, 0.75, 0.85, 0.9, 0.95, 0.99}, "Vector of different scores to try"}; + } bdt; ConfigurableAxis axisEta{"axisEta", {80, -4.0f, +4.0f}, "#eta"}; + ConfigurableAxis axisXicMass{"axisXicMass", {200, 2.368f, 2.568f}, "XiC Inv Mass (GeV/c^{2})"}; ConfigurableAxis axisXiccMass{"axisXiccMass", {200, 3.521f, 3.721f}, "Xicc Inv Mass (GeV/c^{2})"}; ConfigurableAxis axisDCA{"axisDCA", {400, 0, 400}, "DCA (#mum)"}; ConfigurableAxis axisRadiusLarge{"axisRadiusLarge", {1000, 0, 20}, "Decay radius (cm)"}; @@ -106,6 +133,21 @@ struct alice3multicharm { void init(InitContext&) { + ccdb->setURL(bdt.ccdbUrl.value); + if (bdt.loadModelsFromCCDB) { + ccdbApi.init(bdt.ccdbUrl); + LOG(info) << "Fetching model for timestamp: " << bdt.timestampCCDB.value; + bool retrieveSuccessMCharm = ccdbApi.retrieveBlob(bdt.pathCCDB.value, ".", metadata, bdt.timestampCCDB.value, false, bdt.localPath.value); + + if (retrieveSuccessMCharm) { + bdtMCharm.initModel(bdt.localPath.value, bdt.enableOptimizations.value); + } else { + LOG(fatal) << "Error encountered while fetching/loading the MCharm model from CCDB! Maybe the model doesn't exist yet for this runnumber/timestamp?"; + } + } else { + bdtMCharm.initModel(bdt.localPath.value, bdt.enableOptimizations.value); + } + histos.add("SelectionQA/hDCAXicDaughters", "hDCAXicDaughters; DCA between Xic daughters (#mum)", kTH1D, {axisDcaDaughters}); histos.add("SelectionQA/hDCAXiccDaughters", "hDCAXiccDaughters; DCA between Xicc daughters (#mum)", kTH1D, {axisDcaDaughters}); histos.add("SelectionQA/hDCAxyXi", "hDCAxyXi; Xi DCAxy to PV (#mum)", kTH1D, {axisDCA}); @@ -119,6 +161,12 @@ struct alice3multicharm { histos.add("SelectionQA/hDecayDistanceFromPVXic", "hDecayDistanceFromPVXic; Distance (#mum)", kTH1D, {axisDecayLength}); histos.add("SelectionQA/hProperLengthXic", "hProperLengthXic; Distance (#mum)", kTH1D, {axisDecayLength}); histos.add("SelectionQA/hProperLengthXicc", "hProperLengthXicc; Distance (#mum)", kTH1D, {axisDecayLength}); + histos.add("SelectionQA/hPi1cDCAxy", "hPi1cDCAxy; Pi1c DCAxy (#mum)", kTH1D, {axisDCA}); + histos.add("SelectionQA/hPi1cDCAz", "hPi1cDCAz; Pi1c DCAz (#mum)", kTH1D, {axisDCA}); + histos.add("SelectionQA/hPi2cDCAxy", "hPi2cDCAxy; Pi2c DCAxy (#mum)", kTH1D, {axisDCA}); + histos.add("SelectionQA/hPi2cDCAz", "hPi2cDCAz; Pi2c DCAz (#mum)", kTH1D, {axisDCA}); + histos.add("SelectionQA/hPiccDCAxy", "hPiccDCAxy; Picc DCAxy (#mum)", kTH1D, {axisDCA}); + histos.add("SelectionQA/hPiccDCAz", "hPiccDCAz; Picc DCAz (#mum)", kTH1D, {axisDCA}); histos.add("SelectionQA/hPi1cPt", "hPi1cPt; Pi1c pT (Gev/#it(c))", kTH1D, {axisPt}); histos.add("SelectionQA/hPi2cPt", "hPi2cPt; Pi2c pT (Gev/#it(c))", kTH1D, {axisPt}); histos.add("SelectionQA/hPiccPt", "hPiccPt; Picc pT (Gev/#it(c))", kTH1D, {axisPt}); @@ -129,10 +177,10 @@ struct alice3multicharm { hMCharmBuilding->GetXaxis()->SetBinLabel(3, "xiccMaxDauDCA"); hMCharmBuilding->GetXaxis()->SetBinLabel(4, "xiMinDCAxy"); hMCharmBuilding->GetXaxis()->SetBinLabel(5, "xiMinDCAz"); - hMCharmBuilding->GetXaxis()->SetBinLabel(6, "picMinDCAxy"); - hMCharmBuilding->GetXaxis()->SetBinLabel(7, "picMinDCAz"); - hMCharmBuilding->GetXaxis()->SetBinLabel(8, "picMinDCAxy"); - hMCharmBuilding->GetXaxis()->SetBinLabel(9, "picMinDCAz"); + hMCharmBuilding->GetXaxis()->SetBinLabel(6, "pi1cMinDCAxy"); + hMCharmBuilding->GetXaxis()->SetBinLabel(7, "pi1cMinDCAz"); + hMCharmBuilding->GetXaxis()->SetBinLabel(8, "pi2cMinDCAxy"); + hMCharmBuilding->GetXaxis()->SetBinLabel(9, "pi2cMinDCAz"); hMCharmBuilding->GetXaxis()->SetBinLabel(10, "piccMinDCAxy"); hMCharmBuilding->GetXaxis()->SetBinLabel(11, "piccMinDCAz"); hMCharmBuilding->GetXaxis()->SetBinLabel(12, "xicMinDCAxy"); @@ -179,6 +227,7 @@ struct alice3multicharm { histos.add("PIDQA/hOuterTofNSigmaPi2c", "hOuterTofNSigmaPi2c; TOF NSigma pion", kTH2D, {axisPt, axisNSigma}); histos.add("PIDQA/hInnerTofNSigmaPicc", "hInnerTofNSigmaPicc; TOF NSigma pion", kTH2D, {axisPt, axisNSigma}); histos.add("PIDQA/hOuterTofNSigmaPicc", "hOuterTofNSigmaPicc; TOF NSigma pion", kTH2D, {axisPt, axisNSigma}); + histos.add("PIDQA/hRichNSigmaPi1c", "hRichNSigmaPi1c; RICH NSigma pion", kTH2D, {axisPt, axisNSigma}); histos.add("PIDQA/hRichNSigmaPi2c", "hRichNSigmaPi2c; RICH NSigma pion", kTH2D, {axisPt, axisNSigma}); histos.add("PIDQA/hRichNSigmaPicc", "hRichNSigmaPicc; RICH NSigma pion", kTH2D, {axisPt, axisNSigma}); @@ -192,7 +241,45 @@ struct alice3multicharm { histos.add("XiccProngs/h3dPi2c", "h3dPi2c; Xicc pT (GeV/#it(c)); Pi2c pT (GeV/#it(c)); Pi2c #eta", kTH3D, {axisPt, axisPt, axisEta}); histos.add("XiccProngs/h3dPicc", "h3dPicc; Xicc pT (GeV/#it(c)); Picc pT (GeV/#it(c)); Picc #eta", kTH3D, {axisPt, axisPt, axisEta}); } + + histos.add("hXiccMass", "hXiccMass", kTH1D, {axisXiccMass}); + histos.add("hXicMass", "hXicMass", kTH1D, {axisXicMass}); + histos.add("hXiccPt", "hXiccPt", kTH1D, {axisPt}); + histos.add("hXicPt", "hXicPt", kTH1D, {axisPt}); histos.add("h3dXicc", "h3dXicc; Xicc pT (GeV/#it(c)); Xicc #eta; Xicc mass (GeV/#it(c)^{2})", kTH3D, {axisPt, axisEta, axisXiccMass}); + + if (bdt.enableML) { + for (const auto& score : bdt.requiredScores.value) { + histPath = std::format("MLQA/RequiredBDTScore_{}/", static_cast(score * 100)); + histPointers.insert({histPath + "hDCAXicDaughters", histos.add((histPath + "hDCAXicDaughters").c_str(), "hDCAXicDaughters", {kTH1D, {{axisDcaDaughters}}})}); + histPointers.insert({histPath + "hDCAXiccDaughters", histos.add((histPath + "hDCAXiccDaughters").c_str(), "hDCAXiccDaughters", {kTH1D, {{axisDcaDaughters}}})}); + histPointers.insert({histPath + "hDCAxyXi", histos.add((histPath + "hDCAxyXi").c_str(), "hDCAxyXi", {kTH1D, {{axisDCA}}})}); + histPointers.insert({histPath + "hDCAzXi", histos.add((histPath + "hDCAzXi").c_str(), "hDCAzXi", {kTH1D, {{axisDCA}}})}); + histPointers.insert({histPath + "hDCAxyXic", histos.add((histPath + "hDCAxyXic").c_str(), "hDCAxyXic", {kTH1D, {{axisDCA}}})}); + histPointers.insert({histPath + "hDCAzXic", histos.add((histPath + "hDCAzXic").c_str(), "hDCAzXic", {kTH1D, {{axisDCA}}})}); + histPointers.insert({histPath + "hDCAxyXicc", histos.add((histPath + "hDCAxyXicc").c_str(), "hDCAxyXicc", {kTH1D, {{axisDCA}}})}); + histPointers.insert({histPath + "hDCAzXicc", histos.add((histPath + "hDCAzXicc").c_str(), "hDCAzXicc", {kTH1D, {{axisDCA}}})}); + histPointers.insert({histPath + "hDecayRadiusXic", histos.add((histPath + "hDecayRadiusXic").c_str(), "hDecayRadiusXic", {kTH1D, {{axisRadius}}})}); + histPointers.insert({histPath + "hDecayRadiusXicc", histos.add((histPath + "hDecayRadiusXicc").c_str(), "hDecayRadiusXicc", {kTH1D, {{axisRadius}}})}); + histPointers.insert({histPath + "hDecayDistanceFromPVXic", histos.add((histPath + "hDecayDistanceFromPVXic").c_str(), "hDecayDistanceFromPVXic", {kTH1D, {{axisDecayLength}}})}); + histPointers.insert({histPath + "hProperLengthXic", histos.add((histPath + "hProperLengthXic").c_str(), "hProperLengthXic", {kTH1D, {{axisDecayLength}}})}); + histPointers.insert({histPath + "hProperLengthXicc", histos.add((histPath + "hProperLengthXicc").c_str(), "hProperLengthXicc", {kTH1D, {{axisDecayLength}}})}); + histPointers.insert({histPath + "hPi1cDCAxy", histos.add((histPath + "hPi1cDCAxy").c_str(), "hPi1cDCAxy", {kTH1D, {{axisDCA}}})}); + histPointers.insert({histPath + "hPi1cDCAz", histos.add((histPath + "hPi1cDCAz").c_str(), "hPi1cDCAxy", {kTH1D, {{axisDCA}}})}); + histPointers.insert({histPath + "hPi2cDCAxy", histos.add((histPath + "hPi2cDCAxy").c_str(), "hPi2cDCAxy", {kTH1D, {{axisDCA}}})}); + histPointers.insert({histPath + "hPi2cDCAz", histos.add((histPath + "hPi2cDCAz").c_str(), "hPi2cDCAz", {kTH1D, {{axisDCA}}})}); + histPointers.insert({histPath + "hPiccDCAxy", histos.add((histPath + "hPiccDCAxy").c_str(), "hPiccDCAxy", {kTH1D, {{axisDCA}}})}); + histPointers.insert({histPath + "hPiccDCAz", histos.add((histPath + "hPiccDCAz").c_str(), "hPiccDCAz", {kTH1D, {{axisDCA}}})}); + histPointers.insert({histPath + "hPi1cPt", histos.add((histPath + "hPi1cPt").c_str(), "hPi1cPt", {kTH1D, {{axisPt}}})}); + histPointers.insert({histPath + "hPi2cPt", histos.add((histPath + "hPi2cPt").c_str(), "hPi2cPt", {kTH1D, {{axisPt}}})}); + histPointers.insert({histPath + "hPiccPt", histos.add((histPath + "hPiccPt").c_str(), "hPiccPt", {kTH1D, {{axisPt}}})}); + histPointers.insert({histPath + "h3dXicc", histos.add((histPath + "h3dXicc").c_str(), "h3dXicc", {kTH3D, {{axisPt, axisEta, axisXiccMass}}})}); + histPointers.insert({histPath + "hXiccMass", histos.add((histPath + "hXiccMass").c_str(), "hXiccMass", {kTH1D, {{axisXiccMass}}})}); + histPointers.insert({histPath + "hXicMass", histos.add((histPath + "hXicMass").c_str(), "hXicMass", {kTH1D, {{axisXicMass}}})}); + histPointers.insert({histPath + "hXiccPt", histos.add((histPath + "hXiccPt").c_str(), "hXiccPt", {kTH1D, {{axisPt}}})}); + histPointers.insert({histPath + "hXicPt", histos.add((histPath + "hXicPt").c_str(), "hXicPt", {kTH1D, {{axisPt}}})}); + } + } } int getBin(const std::map& pdgToBin, int pdg) @@ -206,91 +293,192 @@ struct alice3multicharm { { for (const auto& xiccCand : xiccCands) { + if (bdt.enableML) { + std::vector inputFeatures{ + xiccCand.xicDauDCA(), + xiccCand.xiccDauDCA(), + xiccCand.xiDCAxy(), + xiccCand.xicDCAxy(), + xiccCand.xiccDCAxy(), + xiccCand.xiDCAz(), + xiccCand.xicDCAz(), + xiccCand.xiccDCAz(), + xiccCand.pi1cDCAxy(), + xiccCand.pi2cDCAxy(), + xiccCand.piccDCAxy(), + xiccCand.pi1cDCAz(), + xiccCand.pi2cDCAz(), + xiccCand.piccDCAz(), + xiccCand.xicDecayRadius2D(), + xiccCand.xiccDecayRadius2D(), + xiccCand.xicProperLength(), + xiccCand.xicDistanceFromPV(), + xiccCand.xiccProperLength()}; + + float* probabilityMCharm = bdtMCharm.evalModel(inputFeatures); + float bdtScore = probabilityMCharm[1]; + + for (const auto& requiredScore : bdt.requiredScores.value) { + if (bdtScore > requiredScore) { + histPath = std::format("MLQA/RequiredBDTScore_{}/", static_cast(requiredScore * 100)); + getHist(TH1, histPath + "hDCAXicDaughters")->Fill(xiccCand.xicDauDCA() * 1e+4); + getHist(TH1, histPath + "hDCAXiccDaughters")->Fill(xiccCand.xiccDauDCA() * 1e+4); + getHist(TH1, histPath + "hDCAxyXi")->Fill(std::fabs(xiccCand.xiDCAxy() * 1e+4)); + getHist(TH1, histPath + "hDCAzXi")->Fill(std::fabs(xiccCand.xiDCAz() * 1e+4)); + getHist(TH1, histPath + "hDCAxyXic")->Fill(std::fabs(xiccCand.xicDCAxy() * 1e+4)); + getHist(TH1, histPath + "hDCAzXic")->Fill(std::fabs(xiccCand.xicDCAz() * 1e+4)); + getHist(TH1, histPath + "hDCAxyXicc")->Fill(std::fabs(xiccCand.xiccDCAxy() * 1e+4)); + getHist(TH1, histPath + "hDCAzXicc")->Fill(std::fabs(xiccCand.xiccDCAz() * 1e+4)); + getHist(TH1, histPath + "hDecayRadiusXic")->Fill(xiccCand.xicDecayRadius2D() * 1e+4); + getHist(TH1, histPath + "hDecayRadiusXicc")->Fill(xiccCand.xiccDecayRadius2D() * 1e+4); + getHist(TH1, histPath + "hDecayDistanceFromPVXic")->Fill(xiccCand.xicDistanceFromPV() * 1e+4); + getHist(TH1, histPath + "hProperLengthXic")->Fill(xiccCand.xicProperLength() * 1e+4); + getHist(TH1, histPath + "hProperLengthXicc")->Fill(xiccCand.xiccProperLength() * 1e+4); + getHist(TH1, histPath + "hPi1cDCAxy")->Fill(xiccCand.pi1cDCAxy() * 1e+4); + getHist(TH1, histPath + "hPi1cDCAz")->Fill(xiccCand.pi1cDCAz() * 1e+4); + getHist(TH1, histPath + "hPi2cDCAxy")->Fill(xiccCand.pi2cDCAxy() * 1e+4); + getHist(TH1, histPath + "hPi2cDCAz")->Fill(xiccCand.pi2cDCAz() * 1e+4); + getHist(TH1, histPath + "hPiccDCAxy")->Fill(xiccCand.piccDCAxy() * 1e+4); + getHist(TH1, histPath + "hPiccDCAz")->Fill(xiccCand.piccDCAz() * 1e+4); + getHist(TH1, histPath + "hPi1cDCAz")->Fill(xiccCand.pi1cPt()); + getHist(TH1, histPath + "hPi2cDCAz")->Fill(xiccCand.pi2cPt()); + getHist(TH1, histPath + "hPiccDCAz")->Fill(xiccCand.piccPt()); + getHist(TH1, histPath + "hXiccMass")->Fill(xiccCand.xiccMass()); + getHist(TH1, histPath + "hXicMass")->Fill(xiccCand.xicMass()); + getHist(TH1, histPath + "hXiccPt")->Fill(xiccCand.xiccPt()); + getHist(TH1, histPath + "hXicPt")->Fill(xiccCand.xicPt()); + getHist(TH3, histPath + "h3dXicc")->Fill(xiccCand.xiccPt(), xiccCand.xiccEta(), xiccCand.xiccMass()); + } + } + } + histos.fill(HIST("hMCharmBuilding"), 0); - if (xiccCand.xicDauDCA() > xicMaxDauDCA) + if (xiccCand.xicDauDCA() > xicMaxDauDCA) { continue; + } else { + histos.fill(HIST("hMCharmBuilding"), 1); + } - histos.fill(HIST("hMCharmBuilding"), 1); - if (xiccCand.xiccDauDCA() > xiccMaxDauDCA) + if (xiccCand.xiccDauDCA() > xiccMaxDauDCA) { continue; + } else { + histos.fill(HIST("hMCharmBuilding"), 2); + } - histos.fill(HIST("hMCharmBuilding"), 2); - if (std::fabs(xiccCand.xiDCAxy()) < xiMinDCAxy) + if (std::fabs(xiccCand.xiDCAxy()) < xiMinDCAxy) { continue; + } else { + histos.fill(HIST("hMCharmBuilding"), 3); + } - histos.fill(HIST("hMCharmBuilding"), 3); - if (std::fabs(xiccCand.xiDCAz()) < xiMinDCAz) + if (std::fabs(xiccCand.xiDCAz()) < xiMinDCAz) { continue; + } else { + histos.fill(HIST("hMCharmBuilding"), 4); + } - histos.fill(HIST("hMCharmBuilding"), 4); - if (std::fabs(xiccCand.pi1cDCAxy()) < picMinDCAxy) + if (std::fabs(xiccCand.pi1cDCAxy()) < picMinDCAxy) { continue; + } else { + histos.fill(HIST("hMCharmBuilding"), 5); + } - histos.fill(HIST("hMCharmBuilding"), 5); - if (std::fabs(xiccCand.pi1cDCAz()) < picMinDCAz) + if (std::fabs(xiccCand.pi1cDCAz()) < picMinDCAz) { continue; + } else { + histos.fill(HIST("hMCharmBuilding"), 6); + } - histos.fill(HIST("hMCharmBuilding"), 6); - if (std::fabs(xiccCand.pi2cDCAxy()) < picMinDCAxy) + if (std::fabs(xiccCand.pi2cDCAxy()) < picMinDCAxy) { continue; + } else { + histos.fill(HIST("hMCharmBuilding"), 7); + } - histos.fill(HIST("hMCharmBuilding"), 7); - if (std::fabs(xiccCand.pi2cDCAz()) < picMinDCAz) + if (std::fabs(xiccCand.pi2cDCAz()) < picMinDCAz) { continue; + } else { + histos.fill(HIST("hMCharmBuilding"), 8); + } - histos.fill(HIST("hMCharmBuilding"), 8); - if (std::fabs(xiccCand.piccDCAxy()) < piccMinDCAxy) + if (std::fabs(xiccCand.piccDCAxy()) < piccMinDCAxy) { continue; + } else { + histos.fill(HIST("hMCharmBuilding"), 9); + } - histos.fill(HIST("hMCharmBuilding"), 9); - if (std::fabs(xiccCand.piccDCAz()) < piccMinDCAz) + if (std::fabs(xiccCand.piccDCAz()) < piccMinDCAz) { continue; + } else { + histos.fill(HIST("hMCharmBuilding"), 10); + } - histos.fill(HIST("hMCharmBuilding"), 10); - if (std::fabs(xiccCand.xicDCAxy()) < xicMinDCAxy) + if (std::fabs(xiccCand.xicDCAxy()) < xicMinDCAxy) { continue; + } else { + histos.fill(HIST("hMCharmBuilding"), 11); + } - histos.fill(HIST("hMCharmBuilding"), 11); - if (std::fabs(xiccCand.xicDCAz()) < xicMinDCAz) + if (std::fabs(xiccCand.xicDCAz()) < xicMinDCAz) { continue; + } else { + histos.fill(HIST("hMCharmBuilding"), 12); + } - histos.fill(HIST("hMCharmBuilding"), 12); - if (std::fabs(xiccCand.xiccDCAxy()) > xiccMaxDCAxy) + if (std::fabs(xiccCand.xiccDCAxy()) > xiccMaxDCAxy) { continue; + } else { + histos.fill(HIST("hMCharmBuilding"), 13); + } - histos.fill(HIST("hMCharmBuilding"), 13); - if (std::fabs(xiccCand.xiccDCAz()) > xiccMaxDCAz) + if (std::fabs(xiccCand.xiccDCAz()) > xiccMaxDCAz) { continue; + } else { + histos.fill(HIST("hMCharmBuilding"), 14); + } - histos.fill(HIST("hMCharmBuilding"), 14); - if (xiccCand.xicDecayRadius2D() < xicMinRadius) + if (xiccCand.xicDecayRadius2D() < xicMinRadius) { continue; + } else { + histos.fill(HIST("hMCharmBuilding"), 15); + } - histos.fill(HIST("hMCharmBuilding"), 15); - if (xiccCand.xiccDecayRadius2D() < xiccMinRadius) + if (xiccCand.xiccDecayRadius2D() < xiccMinRadius) { continue; + } else { + histos.fill(HIST("hMCharmBuilding"), 16); + } - histos.fill(HIST("hMCharmBuilding"), 16); - if (xiccCand.xicProperLength() < xicMinProperLength) + if (xiccCand.xicProperLength() < xicMinProperLength) { continue; + } else { + histos.fill(HIST("hMCharmBuilding"), 17); + } - histos.fill(HIST("hMCharmBuilding"), 17); - if (xiccCand.xicProperLength() > xicMaxProperLength) + if (xiccCand.xicProperLength() > xicMaxProperLength) { continue; + } else { + histos.fill(HIST("hMCharmBuilding"), 18); + } - histos.fill(HIST("hMCharmBuilding"), 18); - if (xiccCand.xiccProperLength() < xiccMinProperLength) + if (xiccCand.xiccProperLength() < xiccMinProperLength) { continue; + } else { + histos.fill(HIST("hMCharmBuilding"), 19); + } - histos.fill(HIST("hMCharmBuilding"), 19); - if (xiccCand.xiccProperLength() > xiccMaxProperLength) + if (xiccCand.xiccProperLength() > xiccMaxProperLength) { continue; + } else { + histos.fill(HIST("hMCharmBuilding"), 20); + } - histos.fill(HIST("hMCharmBuilding"), 20); - if (xiccCand.xicDistanceFromPV() < xicMinDecayDistanceFromPV) + if (xiccCand.xicDistanceFromPV() < xicMinDecayDistanceFromPV) { continue; + } else { + histos.fill(HIST("hMCharmBuilding"), 21); + } - histos.fill(HIST("hMCharmBuilding"), 21); histos.fill(HIST("SelectionQA/hDCAXicDaughters"), xiccCand.xicDauDCA() * 1e+4); histos.fill(HIST("SelectionQA/hDCAXiccDaughters"), xiccCand.xiccDauDCA() * 1e+4); histos.fill(HIST("SelectionQA/hDCAxyXi"), std::fabs(xiccCand.xiDCAxy() * 1e+4)); @@ -304,6 +492,12 @@ struct alice3multicharm { histos.fill(HIST("SelectionQA/hDecayDistanceFromPVXic"), xiccCand.xicDistanceFromPV() * 1e+4); histos.fill(HIST("SelectionQA/hProperLengthXic"), xiccCand.xicProperLength() * 1e+4); histos.fill(HIST("SelectionQA/hProperLengthXicc"), xiccCand.xiccProperLength() * 1e+4); + histos.fill(HIST("SelectionQA/hPi1cDCAxy"), xiccCand.pi1cDCAxy() * 1e+4); + histos.fill(HIST("SelectionQA/hPi1cDCAz"), xiccCand.pi1cDCAz() * 1e+4); + histos.fill(HIST("SelectionQA/hPi2cDCAxy"), xiccCand.pi2cDCAxy() * 1e+4); + histos.fill(HIST("SelectionQA/hPi2cDCAz"), xiccCand.pi2cDCAz() * 1e+4); + histos.fill(HIST("SelectionQA/hPiccDCAxy"), xiccCand.piccDCAxy() * 1e+4); + histos.fill(HIST("SelectionQA/hPiccDCAz"), xiccCand.piccDCAz() * 1e+4); histos.fill(HIST("SelectionQA/hPi1cPt"), xiccCand.pi1cPt()); histos.fill(HIST("SelectionQA/hPi2cPt"), xiccCand.pi2cPt()); histos.fill(HIST("SelectionQA/hPiccPt"), xiccCand.piccPt()); @@ -345,6 +539,10 @@ struct alice3multicharm { histos.fill(HIST("XiccProngs/h3dPicc"), xiccCand.xiccPt(), xiccCand.piccPt(), xiccCand.piccEta()); } + histos.fill(HIST("hXiccMass"), xiccCand.xiccMass()); + histos.fill(HIST("hXicMass"), xiccCand.xicMass()); + histos.fill(HIST("hXiccPt"), xiccCand.xiccPt()); + histos.fill(HIST("hXicPt"), xiccCand.xicPt()); histos.fill(HIST("h3dXicc"), xiccCand.xiccPt(), xiccCand.xiccEta(), xiccCand.xiccMass()); } } From 3a7fc003f06fc941d71e1995e7db5829001ea6a2 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Fri, 25 Jul 2025 22:59:35 +0200 Subject: [PATCH 074/345] [PWGEM/Dilepton] update 2PC (#12254) --- PWGEM/Dilepton/Core/DileptonHadronMPC.h | 385 +++++++----------- PWGEM/Dilepton/Core/EMTrackCut.cxx | 6 + PWGEM/Dilepton/Core/EMTrackCut.h | 137 ++++--- PWGEM/Dilepton/DataModel/dileptonTables.h | 25 +- .../TableProducer/skimmerPrimaryTrack.cxx | 125 +++--- PWGEM/Dilepton/Utils/EMTrack.h | 32 +- PWGEM/Dilepton/Utils/EMTrackUtilities.h | 14 + PWGEM/Dilepton/Utils/EventHistograms.h | 6 +- PWGEM/Dilepton/Utils/PairUtilities.h | 4 +- PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h | 304 +++++++++----- .../TableProducer/createEMEventPhoton.cxx | 16 +- 11 files changed, 582 insertions(+), 472 deletions(-) diff --git a/PWGEM/Dilepton/Core/DileptonHadronMPC.h b/PWGEM/Dilepton/Core/DileptonHadronMPC.h index 176cfcdb740..fe1c3f7c036 100644 --- a/PWGEM/Dilepton/Core/DileptonHadronMPC.h +++ b/PWGEM/Dilepton/Core/DileptonHadronMPC.h @@ -90,10 +90,8 @@ using FilteredMyMuon = FilteredMyMuons::iterator; using MyTracks = soa::Join; using MyTrack = MyTracks::iterator; -using MyEMH_electron = o2::aod::pwgem::dilepton::utils::EventMixingHandler, std::pair, EMTrackWithCov>; +using MyEMH_electron = o2::aod::pwgem::dilepton::utils::EventMixingHandler, std::pair, EMTrack>; using MyEMH_muon = o2::aod::pwgem::dilepton::utils::EventMixingHandler, std::pair, EMFwdTrack>; -using MyEMH_dielectron = o2::aod::pwgem::dilepton::utils::EventMixingHandler, std::pair, EMTrack>; -using MyEMH_dimuon = o2::aod::pwgem::dilepton::utils::EventMixingHandler, std::pair, EMFwdTrack>; using MyEMH_track = o2::aod::pwgem::dilepton::utils::EventMixingHandler, std::pair, EMTrack>; // for charged track template @@ -106,16 +104,17 @@ struct DileptonHadronMPC { Configurable skipGRPOquery{"skipGRPOquery", true, "skip grpo query"}; Configurable d_bz_input{"d_bz_input", -999, "bz field in kG, -999 is automatic"}; - Configurable cfgAnalysisType{"cfgAnalysisType", static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonHadronAnalysisType::kCumulant), "kCumulant:0, kCorrelationFunction:1"}; + Configurable cfgAnalysisType{"cfgAnalysisType", static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonHadronAnalysisType::kAzimuthalCorrelation), "kAzimuthalCorrelation:0, kCumulant:1"}; Configurable cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2"}; Configurable cfgOccupancyEstimator{"cfgOccupancyEstimator", 0, "FT0C:0, Track:1"}; Configurable cfgCentMin{"cfgCentMin", -1, "min. centrality"}; Configurable cfgCentMax{"cfgCentMax", 999.f, "max. centrality"}; Configurable cfgDoMix{"cfgDoMix", true, "flag for event mixing"}; - Configurable ndepth{"ndepth", 100, "depth for event mixing"}; + Configurable ndepth_lepton{"ndepth_lepton", 100, "depth for event mixing between lepton-lepton"}; + Configurable ndepth_hadron{"ndepth_hadron", 2, "depth for event mixing between hadron-hadron"}; Configurable ndiff_bc_mix{"ndiff_bc_mix", 594, "difference in global BC required in mixed events"}; ConfigurableAxis ConfVtxBins{"ConfVtxBins", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"}; - ConfigurableAxis ConfCentBins{"ConfCentBins", {VARIABLE_WIDTH, 0.0f, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f, 100.f, 999.f}, "Mixing bins - centrality"}; + ConfigurableAxis ConfCentBins{"ConfCentBins", {VARIABLE_WIDTH, 0.0f, 0.1, 1, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f, 100.f, 999.f}, "Mixing bins - centrality"}; ConfigurableAxis ConfOccupancyBins{"ConfOccupancyBins", {VARIABLE_WIDTH, -1, 1e+10}, "Mixing bins - occupancy"}; Configurable cfg_swt_name{"cfg_swt_name", "fHighTrackMult", "desired software trigger name"}; // 1 trigger name per 1 task. fHighTrackMult, fHighFt0Mult // Configurable cfgNtracksPV08Min{"cfgNtracksPV08Min", -1, "min. multNTracksPV"}; @@ -280,7 +279,7 @@ struct DileptonHadronMPC { EMTrackCut fEMTrackCut; struct : ConfigurableGroup { std::string prefix = "trackcut_group"; - Configurable cfg_min_pt_track{"cfg_min_pt_track", 0.15, "min pT for ref. track"}; + Configurable cfg_min_pt_track{"cfg_min_pt_track", 0.2, "min pT for ref. track"}; Configurable cfg_max_pt_track{"cfg_max_pt_track", 3.0, "max pT for ref. track"}; Configurable cfg_min_eta_track{"cfg_min_eta_track", -1.2, "min eta for ref. track"}; Configurable cfg_max_eta_track{"cfg_max_eta_track", +1.2, "max eta for ref. track"}; @@ -292,8 +291,8 @@ struct DileptonHadronMPC { Configurable cfg_max_frac_shared_clusters_tpc{"cfg_max_frac_shared_clusters_tpc", 0.7, "max fraction of shared clusters in TPC"}; Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; Configurable cfg_max_chi2its{"cfg_max_chi2its", 36.0, "max chi2/NclsITS"}; - Configurable cfg_max_dcaxy{"cfg_max_dcaxy", 1.0, "max dca XY for single track in cm"}; - Configurable cfg_max_dcaz{"cfg_max_dcaz", 1.0, "max dca Z for single track in cm"}; + Configurable cfg_max_dcaxy{"cfg_max_dcaxy", 0.5, "max dca XY for single track in cm"}; + Configurable cfg_max_dcaz{"cfg_max_dcaz", 0.5, "max dca Z for single track in cm"}; Configurable cfg_require_itsib_any{"cfg_require_itsib_any", true, "flag to require ITS ib any hits"}; Configurable cfg_require_itsib_1st{"cfg_require_itsib_1st", false, "flag to require ITS ib 1st hit"}; } trackcuts; @@ -381,8 +380,9 @@ struct DileptonHadronMPC { } } - emh_pos = new TEMH(ndepth); - emh_neg = new TEMH(ndepth); + emh_pos = new TEMH(ndepth_lepton); + emh_neg = new TEMH(ndepth_lepton); + emh_ref = new MyEMH_track(ndepth_hadron); // for reference flow DefineEMEventCut(); DefineEMTrackCut(); @@ -397,7 +397,7 @@ struct DileptonHadronMPC { leptonM2 = o2::constants::physics::MassMuon; } - if (doprocess2PCwithTrigger) { + if (doprocessTriggerAnalysis) { fRegistry.add("Event/hNInspectedTVX", "N inspected TVX;run number;N_{TVX}", kTProfile, {{80000, 520000.5, 600000.5}}, true); } } @@ -456,9 +456,13 @@ struct DileptonHadronMPC { emh_pos = 0x0; delete emh_neg; emh_neg = 0x0; + delete emh_ref; + emh_ref = 0x0; used_trackIds.clear(); used_trackIds.shrink_to_fit(); + used_refTrackIds.clear(); + used_refTrackIds.shrink_to_fit(); } void addhistograms() @@ -506,51 +510,45 @@ struct DileptonHadronMPC { // dilepton-hadron info const AxisSpec axis_pt_ref{ConfPtHadronBins, "p_{T,h}^{ref} (GeV/c)"}; const AxisSpec axis_deta{ConfDEtaBins, deta_axis_title}; - // const AxisSpec axis_dphi{cfgNbinsDPhi, -M_PI/2, 3 * M_PI/2, dphi_axis_title}; - const AxisSpec axis_cos_ndphi{cfgNbinsCosNDPhi, -1, +1, cosndphi_axis_title}; + + // hadron-hadron info + const AxisSpec axis_deta_hh{ConfDEtaBins, "#Delta#eta = #eta_{h}^{trg} - #eta_{h}^{ref}"}; const AxisSpec axis_pt_trg{ConfPtHadronBins, "p_{T,h} (GeV/c)"}; const AxisSpec axis_eta_trg{40, -2, +2, "#eta_{h}"}; const AxisSpec axis_phi_trg{36, 0, 2 * M_PI, "#varphi_{h} (rad.)"}; - - if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonHadronAnalysisType::kCumulant)) { - fRegistry.add("Hadron/hs", "hadron", kTHnSparseD, {axis_pt_trg, axis_eta_trg, axis_phi_trg}, true); - - fRegistry.add("DileptonHadron/same/uls/hs", "dilepton-hadron 2PC", kTHnSparseD, {axis_mass, axis_pt, axis_dca, axis_y, axis_pt_ref, axis_deta, axis_cos_ndphi}, true); + fRegistry.add("Hadron/hs", "hadron", kTHnSparseD, {axis_pt_trg, axis_eta_trg, axis_phi_trg}, true); + fRegistry.add("Dilepton/same/uls/hs", "dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_dca, axis_y}, true); + fRegistry.addClone("Dilepton/same/uls/", "Dilepton/same/lspp/"); + fRegistry.addClone("Dilepton/same/uls/", "Dilepton/same/lsmm/"); + fRegistry.addClone("Dilepton/same/", "Dilepton/mix/"); + + if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonHadronAnalysisType::kAzimuthalCorrelation)) { + const AxisSpec axis_dphi{cfgNbinsDPhi, -M_PI / 2, 3 * M_PI / 2, dphi_axis_title}; + const AxisSpec axis_dphi_hh{cfgNbinsDPhi, -M_PI / 2, 3 * M_PI / 2, "#Delta#varphi = #varphi_{h}^{trg} - #varphi_{h}^{ref} (rad.)"}; + // dilepton-hadron + fRegistry.add("DileptonHadron/same/uls/hs", "dilepton-hadron 2PC", kTHnSparseD, {axis_mass, axis_pt, axis_dca, axis_y, axis_pt_ref, axis_deta, axis_dphi}, true); fRegistry.addClone("DileptonHadron/same/uls/", "DileptonHadron/same/lspp/"); fRegistry.addClone("DileptonHadron/same/uls/", "DileptonHadron/same/lsmm/"); - fRegistry.addClone("DileptonHadron/same/", "DileptonHadron/mix/"); - - fRegistry.add("Dilepton/same/uls/hs", "dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_dca, axis_y}, true); - fRegistry.addClone("Dilepton/same/uls/", "Dilepton/same/lspp/"); - fRegistry.addClone("Dilepton/same/uls/", "Dilepton/same/lsmm/"); - fRegistry.addClone("Dilepton/same/", "Dilepton/mix/"); + // fRegistry.addClone("DileptonHadron/same/", "DileptonHadron/mix/"); // hadron-hadron - const AxisSpec axis_deta_hh{ConfDEtaBins, "#Delta#eta = #eta_{h}^{trg} - #eta_{h}^{ref}"}; - // const AxisSpec axis_dphi_hh{cfgNbinsDPhi, -M_PI/2, 3 * M_PI/2, "#Delta#varphi = #varphi_{h}^{trg} - #varphi_{h}^{ref} (rad.)"}; const AxisSpec axis_cosndphi_hh{cfgNbinsCosNDPhi, -1, +1, std::format("cos({0:d}(#varphi_{{h}}^{{trg}} - #varphi_{{h}}^{{ref}}))", cfgNmod.value)}; - fRegistry.add("HadronHadron/same/hs", "hadron-hadron 2PC", kTHnSparseD, {axis_pt_trg, axis_pt_ref, axis_deta_hh, axis_cosndphi_hh}, true); - // fRegistry.addClone("HadronHadron/same/", "HadronHadron/mix/"); - } else { // same as kCumulant to avoid seg. fault - fRegistry.add("Hadron/hs", "hadron", kTHnSparseD, {axis_pt_trg, axis_eta_trg, axis_phi_trg}, true); + fRegistry.add("HadronHadron/same/hs", "hadron-hadron 2PC", kTHnSparseD, {axis_pt_trg, axis_pt_ref, axis_deta_hh, axis_dphi_hh}, true); + fRegistry.addClone("HadronHadron/same/", "HadronHadron/mix/"); + fRegistry.add("HadronHadron/mix/hDiffBC", "diff. global BC in mixed event;|BC_{current} - BC_{mixed}|", kTH1D, {{10001, -0.5, 10000.5}}, true); + } else if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonHadronAnalysisType::kCumulant)) { + const AxisSpec axis_cos_ndphi{cfgNbinsCosNDPhi, -1, +1, cosndphi_axis_title}; + // dilepton-hadron fRegistry.add("DileptonHadron/same/uls/hs", "dilepton-hadron 2PC", kTHnSparseD, {axis_mass, axis_pt, axis_dca, axis_y, axis_pt_ref, axis_deta, axis_cos_ndphi}, true); fRegistry.addClone("DileptonHadron/same/uls/", "DileptonHadron/same/lspp/"); fRegistry.addClone("DileptonHadron/same/uls/", "DileptonHadron/same/lsmm/"); fRegistry.addClone("DileptonHadron/same/", "DileptonHadron/mix/"); - fRegistry.add("Dilepton/same/uls/hs", "dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_dca, axis_y}, true); - fRegistry.addClone("Dilepton/same/uls/", "Dilepton/same/lspp/"); - fRegistry.addClone("Dilepton/same/uls/", "Dilepton/same/lsmm/"); - fRegistry.addClone("Dilepton/same/", "Dilepton/mix/"); - // hadron-hadron - const AxisSpec axis_deta_hh{ConfDEtaBins, "#Delta#eta = #eta_{h}^{trg} - #eta_{h}^{ref}"}; - // const AxisSpec axis_dphi_hh{cfgNbinsDPhi, -M_PI/2, 3 * M_PI/2, "#Delta#varphi = #varphi_{h}^{trg} - #varphi_{h}^{ref} (rad.)"}; const AxisSpec axis_cosndphi_hh{cfgNbinsCosNDPhi, -1, +1, std::format("cos({0:d}(#varphi_{{h}}^{{trg}} - #varphi_{{h}}^{{ref}}))", cfgNmod.value)}; fRegistry.add("HadronHadron/same/hs", "hadron-hadron 2PC", kTHnSparseD, {axis_pt_trg, axis_pt_ref, axis_deta_hh, axis_cosndphi_hh}, true); - // fRegistry.addClone("HadronHadron/same/", "HadronHadron/mix/"); } fRegistry.add("Dilepton/mix/hDiffBC", "diff. global BC in mixed event;|BC_{current} - BC_{mixed}|", kTH1D, {{10001, -0.5, 10000.5}}, true); } @@ -777,22 +775,12 @@ struct DileptonHadronMPC { pair_dca = pairDCAQuadSum(fwdDcaXYinSigma(t1), fwdDcaXYinSigma(t2)); } - if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonHadronAnalysisType::kCumulant)) { - if (t1.sign() * t2.sign() < 0) { // ULS - fRegistry.fill(HIST("Dilepton/") + HIST(event_pair_types[ev_id]) + HIST("uls/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), weight); - } else if (t1.sign() > 0 && t2.sign() > 0) { // LS++ - fRegistry.fill(HIST("Dilepton/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), weight); - } else if (t1.sign() < 0 && t2.sign() < 0) { // LS-- - fRegistry.fill(HIST("Dilepton/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), weight); - } - } else { // same as kCumulant to avoid seg. fault - if (t1.sign() * t2.sign() < 0) { // ULS - fRegistry.fill(HIST("Dilepton/") + HIST(event_pair_types[ev_id]) + HIST("uls/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), weight); - } else if (t1.sign() > 0 && t2.sign() > 0) { // LS++ - fRegistry.fill(HIST("Dilepton/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), weight); - } else if (t1.sign() < 0 && t2.sign() < 0) { // LS-- - fRegistry.fill(HIST("Dilepton/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), weight); - } + if (t1.sign() * t2.sign() < 0) { // ULS + fRegistry.fill(HIST("Dilepton/") + HIST(event_pair_types[ev_id]) + HIST("uls/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), weight); + } else if (t1.sign() > 0 && t2.sign() > 0) { // LS++ + fRegistry.fill(HIST("Dilepton/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), weight); + } else if (t1.sign() < 0 && t2.sign() < 0) { // LS-- + fRegistry.fill(HIST("Dilepton/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), weight); } // store tracks for event mixing without double counting @@ -812,13 +800,9 @@ struct DileptonHadronMPC { used_trackIds.emplace_back(pair_tmp_id1); if (cfgDoMix) { if (t1.sign() > 0) { - emh_pos->AddTrackToEventPool(key_df_collision, EMTrackWithCov(ndf, t1.globalIndex(), collision.globalIndex(), t1.trackId(), t1.pt(), t1.eta(), t1.phi(), leptonM1, t1.sign(), t1.dcaXY(), t1.dcaZ(), possibleIds1, - t1.x(), t1.y(), t1.z(), t1.alpha(), t1.snp(), t1.tgl(), t1.cYY(), t1.cZY(), t1.cZZ(), - t1.cSnpY(), t1.cSnpZ(), t1.cSnpSnp(), t1.cTglY(), t1.cTglZ(), t1.cTglSnp(), t1.cTglTgl(), t1.c1PtY(), t1.c1PtZ(), t1.c1PtSnp(), t1.c1PtTgl(), t1.c1Pt21Pt2())); + emh_pos->AddTrackToEventPool(key_df_collision, EMTrack(ndf, t1.globalIndex(), collision.globalIndex(), t1.trackId(), t1.pt(), t1.eta(), t1.phi(), leptonM1, t1.sign(), t1.dcaXY(), t1.dcaZ(), possibleIds1, t1.cYY(), t1.cZY(), t1.cZZ())); } else { - emh_neg->AddTrackToEventPool(key_df_collision, EMTrackWithCov(ndf, t1.globalIndex(), collision.globalIndex(), t1.trackId(), t1.pt(), t1.eta(), t1.phi(), leptonM1, t1.sign(), t1.dcaXY(), t1.dcaZ(), possibleIds1, - t1.x(), t1.y(), t1.z(), t1.alpha(), t1.snp(), t1.tgl(), t1.cYY(), t1.cZY(), t1.cZZ(), - t1.cSnpY(), t1.cSnpZ(), t1.cSnpSnp(), t1.cTglY(), t1.cTglZ(), t1.cTglSnp(), t1.cTglTgl(), t1.c1PtY(), t1.c1PtZ(), t1.c1PtSnp(), t1.c1PtTgl(), t1.c1Pt21Pt2())); + emh_neg->AddTrackToEventPool(key_df_collision, EMTrack(ndf, t1.globalIndex(), collision.globalIndex(), t1.trackId(), t1.pt(), t1.eta(), t1.phi(), leptonM1, t1.sign(), t1.dcaXY(), t1.dcaZ(), possibleIds1, t1.cYY(), t1.cZY(), t1.cZZ())); } } } @@ -826,13 +810,9 @@ struct DileptonHadronMPC { used_trackIds.emplace_back(pair_tmp_id2); if (cfgDoMix) { if (t2.sign() > 0) { - emh_pos->AddTrackToEventPool(key_df_collision, EMTrackWithCov(ndf, t2.globalIndex(), collision.globalIndex(), t2.trackId(), t2.pt(), t2.eta(), t2.phi(), leptonM2, t2.sign(), t2.dcaXY(), t2.dcaZ(), possibleIds2, - t2.x(), t2.y(), t2.z(), t2.alpha(), t2.snp(), t2.tgl(), t2.cYY(), t2.cZY(), t2.cZZ(), - t2.cSnpY(), t2.cSnpZ(), t2.cSnpSnp(), t2.cTglY(), t2.cTglZ(), t2.cTglSnp(), t2.cTglTgl(), t2.c1PtY(), t2.c1PtZ(), t2.c1PtSnp(), t2.c1PtTgl(), t2.c1Pt21Pt2())); + emh_pos->AddTrackToEventPool(key_df_collision, EMTrack(ndf, t2.globalIndex(), collision.globalIndex(), t2.trackId(), t2.pt(), t2.eta(), t2.phi(), leptonM2, t2.sign(), t2.dcaXY(), t2.dcaZ(), possibleIds2, t2.cYY(), t2.cZY(), t2.cZZ())); } else { - emh_neg->AddTrackToEventPool(key_df_collision, EMTrackWithCov(ndf, t2.globalIndex(), collision.globalIndex(), t2.trackId(), t2.pt(), t2.eta(), t2.phi(), leptonM2, t2.sign(), t2.dcaXY(), t2.dcaZ(), possibleIds2, - t2.x(), t2.y(), t2.z(), t2.alpha(), t2.snp(), t2.tgl(), t2.cYY(), t2.cZY(), t2.cZZ(), - t2.cSnpY(), t2.cSnpZ(), t2.cSnpSnp(), t2.cTglY(), t2.cTglZ(), t2.cTglSnp(), t2.cTglTgl(), t2.c1PtY(), t2.c1PtZ(), t2.c1PtSnp(), t2.c1PtTgl(), t2.c1Pt21Pt2())); + emh_neg->AddTrackToEventPool(key_df_collision, EMTrack(ndf, t2.globalIndex(), collision.globalIndex(), t2.trackId(), t2.pt(), t2.eta(), t2.phi(), leptonM2, t2.sign(), t2.dcaXY(), t2.dcaZ(), possibleIds2, t2.cYY(), t2.cZY(), t2.cZZ())); } } } @@ -865,6 +845,11 @@ struct DileptonHadronMPC { } } } + + // possibleIds1.clear(); + // possibleIds1.shrink_to_fit(); + // possibleIds2.clear(); + // possibleIds2.shrink_to_fit(); } return true; } @@ -872,6 +857,7 @@ struct DileptonHadronMPC { template bool fillDileptonHadron(TCollision const& collision, TTrack1 const& t1, TTrack2 const& t2, TCut const& cut, TAllTracks const& tracks, TRefTrack const& t3) { + // this function must be called, if dilepton passes the cut. if constexpr (ev_id == 1) { if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { // bool is_found1 = std::find(t2.ambiguousElectronsIds.begin(), t2.ambiguousElectronsIds.end(), t1.globalIndex()) != t2.ambiguousElectronsIds.end(); // this does not work. @@ -951,9 +937,6 @@ struct DileptonHadronMPC { ROOT::Math::PtEtaPhiMVector v3(t3.pt(), t3.eta(), t3.phi(), 0.139); // mass of hadron does not matter. float deta = v12.Eta() - v3.Eta(); float dphi = v12.Phi() - v3.Phi(); - // dphi = RecoDecay::constrainAngle(dphi, - M_PI/2, 1U); - o2::math_utils::bringTo02Pi(dphi); - float cosndphi = std::cos(cfgNmod * dphi); float pair_dca = 999.f; if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { @@ -967,7 +950,18 @@ struct DileptonHadronMPC { pair_dca = pairDCAQuadSum(fwdDcaXYinSigma(t1), fwdDcaXYinSigma(t2)); } - if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonHadronAnalysisType::kCumulant)) { + if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonHadronAnalysisType::kAzimuthalCorrelation)) { + dphi = RecoDecay::constrainAngle(dphi, -M_PI / 2, 1U); + if (t1.sign() * t2.sign() < 0) { // ULS + fRegistry.fill(HIST("DileptonHadron/") + HIST(event_pair_types[ev_id]) + HIST("uls/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), v3.Pt(), deta, dphi, weight); + } else if (t1.sign() > 0 && t2.sign() > 0) { // LS++ + fRegistry.fill(HIST("DileptonHadron/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), v3.Pt(), deta, dphi, weight); + } else if (t1.sign() < 0 && t2.sign() < 0) { // LS-- + fRegistry.fill(HIST("DileptonHadron/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), v3.Pt(), deta, dphi, weight); + } + } else if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonHadronAnalysisType::kCumulant)) { + o2::math_utils::bringTo02Pi(dphi); + float cosndphi = std::cos(cfgNmod * dphi); if (t1.sign() * t2.sign() < 0) { // ULS fRegistry.fill(HIST("DileptonHadron/") + HIST(event_pair_types[ev_id]) + HIST("uls/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), v3.Pt(), deta, cosndphi, weight); } else if (t1.sign() > 0 && t2.sign() > 0) { // LS++ @@ -977,175 +971,67 @@ struct DileptonHadronMPC { } } - // // store tracks for event mixing without double counting - // if constexpr (ev_id == 0) { - // std::pair key_df_collision = std::make_pair(ndf, collision.globalIndex()); - // std::pair pair_tmp_id1 = std::make_pair(ndf, t1.globalIndex()); - // std::pair pair_tmp_id2 = std::make_pair(ndf, t2.globalIndex()); - - // std::vector possibleIds1; - // std::vector possibleIds2; - - // if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - // std::copy(t1.ambiguousElectronsIds().begin(), t1.ambiguousElectronsIds().end(), std::back_inserter(possibleIds1)); - // std::copy(t2.ambiguousElectronsIds().begin(), t2.ambiguousElectronsIds().end(), std::back_inserter(possibleIds2)); - - // if (std::find(used_trackIds.begin(), used_trackIds.end(), pair_tmp_id1) == used_trackIds.end()) { - // used_trackIds.emplace_back(pair_tmp_id1); - // if (cfgDoMix) { - // if (t1.sign() > 0) { - // emh_pos->AddTrackToEventPool(key_df_collision, EMTrackWithCov(ndf, t1.globalIndex(), collision.globalIndex(), t1.trackId(), t1.pt(), t1.eta(), t1.phi(), leptonM1, t1.sign(), t1.dcaXY(), t1.dcaZ(), possibleIds1, - // t1.x(), t1.y(), t1.z(), t1.alpha(), t1.snp(), t1.tgl(), t1.cYY(), t1.cZY(), t1.cZZ(), - // t1.cSnpY(), t1.cSnpZ(), t1.cSnpSnp(), t1.cTglY(), t1.cTglZ(), t1.cTglSnp(), t1.cTglTgl(), t1.c1PtY(), t1.c1PtZ(), t1.c1PtSnp(), t1.c1PtTgl(), t1.c1Pt21Pt2())); - // } else { - // emh_neg->AddTrackToEventPool(key_df_collision, EMTrackWithCov(ndf, t1.globalIndex(), collision.globalIndex(), t1.trackId(), t1.pt(), t1.eta(), t1.phi(), leptonM1, t1.sign(), t1.dcaXY(), t1.dcaZ(), possibleIds1, - // t1.x(), t1.y(), t1.z(), t1.alpha(), t1.snp(), t1.tgl(), t1.cYY(), t1.cZY(), t1.cZZ(), - // t1.cSnpY(), t1.cSnpZ(), t1.cSnpSnp(), t1.cTglY(), t1.cTglZ(), t1.cTglSnp(), t1.cTglTgl(), t1.c1PtY(), t1.c1PtZ(), t1.c1PtSnp(), t1.c1PtTgl(), t1.c1Pt21Pt2())); - // } - // } - // } - // if (std::find(used_trackIds.begin(), used_trackIds.end(), pair_tmp_id2) == used_trackIds.end()) { - // used_trackIds.emplace_back(pair_tmp_id2); - // if (cfgDoMix) { - // if (t2.sign() > 0) { - // emh_pos->AddTrackToEventPool(key_df_collision, EMTrackWithCov(ndf, t2.globalIndex(), collision.globalIndex(), t2.trackId(), t2.pt(), t2.eta(), t2.phi(), leptonM2, t2.sign(), t2.dcaXY(), t2.dcaZ(), possibleIds2, - // t2.x(), t2.y(), t2.z(), t2.alpha(), t2.snp(), t2.tgl(), t2.cYY(), t2.cZY(), t2.cZZ(), - // t2.cSnpY(), t2.cSnpZ(), t2.cSnpSnp(), t2.cTglY(), t2.cTglZ(), t2.cTglSnp(), t2.cTglTgl(), t2.c1PtY(), t2.c1PtZ(), t2.c1PtSnp(), t2.c1PtTgl(), t2.c1Pt21Pt2())); - // } else { - // emh_neg->AddTrackToEventPool(key_df_collision, EMTrackWithCov(ndf, t2.globalIndex(), collision.globalIndex(), t2.trackId(), t2.pt(), t2.eta(), t2.phi(), leptonM2, t2.sign(), t2.dcaXY(), t2.dcaZ(), possibleIds2, - // t2.x(), t2.y(), t2.z(), t2.alpha(), t2.snp(), t2.tgl(), t2.cYY(), t2.cZY(), t2.cZZ(), - // t2.cSnpY(), t2.cSnpZ(), t2.cSnpSnp(), t2.cTglY(), t2.cTglZ(), t2.cTglSnp(), t2.cTglTgl(), t2.c1PtY(), t2.c1PtZ(), t2.c1PtSnp(), t2.c1PtTgl(), t2.c1Pt21Pt2())); - // } - // } - // } - // } else if (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { - // std::copy(t1.ambiguousMuonsIds().begin(), t1.ambiguousMuonsIds().end(), std::back_inserter(possibleIds1)); - // std::copy(t2.ambiguousMuonsIds().begin(), t2.ambiguousMuonsIds().end(), std::back_inserter(possibleIds2)); - - // if (std::find(used_trackIds.begin(), used_trackIds.end(), pair_tmp_id1) == used_trackIds.end()) { - // used_trackIds.emplace_back(pair_tmp_id1); - // if (cfgDoMix) { - // if (t1.sign() > 0) { - // emh_pos->AddTrackToEventPool(key_df_collision, EMFwdTrack(ndf, t1.globalIndex(), collision.globalIndex(), t1.fwdtrackId(), t1.pt(), t1.eta(), t1.phi(), o2::constants::physics::MassMuon, t1.sign(), t1.fwdDcaX(), t1.fwdDcaY(), possibleIds1, - // t1.cXXatDCA(), t1.cXYatDCA(), t1.cYYatDCA())); - // } else { - // emh_neg->AddTrackToEventPool(key_df_collision, EMFwdTrack(ndf, t1.globalIndex(), collision.globalIndex(), t1.fwdtrackId(), t1.pt(), t1.eta(), t1.phi(), o2::constants::physics::MassMuon, t1.sign(), t1.fwdDcaX(), t1.fwdDcaY(), possibleIds1, - // t1.cXXatDCA(), t1.cXYatDCA(), t1.cYYatDCA())); - // } - // } - // } - // if (std::find(used_trackIds.begin(), used_trackIds.end(), pair_tmp_id2) == used_trackIds.end()) { - // used_trackIds.emplace_back(pair_tmp_id2); - // if (cfgDoMix) { - // if (t2.sign() > 0) { - // emh_pos->AddTrackToEventPool(key_df_collision, EMFwdTrack(ndf, t2.globalIndex(), collision.globalIndex(), t2.fwdtrackId(), t2.pt(), t2.eta(), t2.phi(), o2::constants::physics::MassMuon, t2.sign(), t2.fwdDcaX(), t2.fwdDcaY(), possibleIds2, - // t2.cXXatDCA(), t2.cXYatDCA(), t2.cYYatDCA())); - // } else { - // emh_neg->AddTrackToEventPool(key_df_collision, EMFwdTrack(ndf, t2.globalIndex(), collision.globalIndex(), t2.fwdtrackId(), t2.pt(), t2.eta(), t2.phi(), o2::constants::physics::MassMuon, t2.sign(), t2.fwdDcaX(), t2.fwdDcaY(), possibleIds2, - // t2.cXXatDCA(), t2.cXYatDCA(), t2.cYYatDCA())); - // } - // } - // } - // } - // } return true; } - template - bool fillHadronHadron(TRefTrack const& t1, TRefTrack const& t2) + template + bool fillHadronHadron(TCollision const& collision, TRefTrack const& t1, TRefTrack const& t2, TLeptons const& posLeptons, TLeptons const& negLeptons) { if constexpr (ev_id == 0) { if (!fEMTrackCut.IsSelected(t1) || !fEMTrackCut.IsSelected(t2)) { // for charged track return false; } - } else { - return false; // mixed event is not necessary for cumulant method. + + // Leptons should not be in reference track sample. + if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { + for (const auto& pos : posLeptons) { // leptons per collision + if (t1.trackId() == pos.trackId() || t2.trackId() == pos.trackId()) { + return false; + } + } + for (const auto& neg : negLeptons) { // leptons per collision + if (t1.trackId() == neg.trackId() || t2.trackId() == neg.trackId()) { + return false; + } + } + } + } + + if constexpr (ev_id == 1) { + if (t1.dfId() == t2.dfId() && t1.globalIndex() == t2.globalIndex()) { + return false; // this never happens. only for protection. + } } float weight = 1.f; float deta = t1.eta() - t2.eta(); // t1 is trigger, t2 is associated float dphi = t1.phi() - t2.phi(); // t1 is trigger, t2 is associated - // dphi = RecoDecay::constrainAngle(dphi, - M_PI/2, 1U); - o2::math_utils::bringTo02Pi(dphi); - float cosndphi = std::cos(cfgNmod * dphi); - if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonHadronAnalysisType::kCumulant)) { - fRegistry.fill(HIST("HadronHadron/") + HIST(event_pair_types[ev_id]) + HIST("hs"), t1.pt(), t2.pt(), deta, cosndphi, weight); - } else { // same as kCumulant to avoid seg. fault + if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonHadronAnalysisType::kAzimuthalCorrelation)) { + dphi = RecoDecay::constrainAngle(dphi, -M_PI / 2, 1U); + fRegistry.fill(HIST("HadronHadron/") + HIST(event_pair_types[ev_id]) + HIST("hs"), t1.pt(), t2.pt(), deta, dphi, weight); + } else if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonHadronAnalysisType::kCumulant)) { + o2::math_utils::bringTo02Pi(dphi); + float cosndphi = std::cos(cfgNmod * dphi); fRegistry.fill(HIST("HadronHadron/") + HIST(event_pair_types[ev_id]) + HIST("hs"), t1.pt(), t2.pt(), deta, cosndphi, weight); } - // // store tracks for event mixing without double counting - // if constexpr (ev_id == 0) { - // std::pair key_df_collision = std::make_pair(ndf, collision.globalIndex()); - // std::pair pair_tmp_id1 = std::make_pair(ndf, t1.globalIndex()); - // std::pair pair_tmp_id2 = std::make_pair(ndf, t2.globalIndex()); - // - // std::vector possibleIds1; - // std::vector possibleIds2; - // - // if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - // std::copy(t1.ambiguousElectronsIds().begin(), t1.ambiguousElectronsIds().end(), std::back_inserter(possibleIds1)); - // std::copy(t2.ambiguousElectronsIds().begin(), t2.ambiguousElectronsIds().end(), std::back_inserter(possibleIds2)); - // - // if (std::find(used_trackIds.begin(), used_trackIds.end(), pair_tmp_id1) == used_trackIds.end()) { - // used_trackIds.emplace_back(pair_tmp_id1); - // if (cfgDoMix) { - // if (t1.sign() > 0) { - // emh_pos->AddTrackToEventPool(key_df_collision, EMTrackWithCov(ndf, t1.globalIndex(), collision.globalIndex(), t1.trackId(), t1.pt(), t1.eta(), t1.phi(), leptonM1, t1.sign(), t1.dcaXY(), t1.dcaZ(), possibleIds1, - // t1.x(), t1.y(), t1.z(), t1.alpha(), t1.snp(), t1.tgl(), t1.cYY(), t1.cZY(), t1.cZZ(), - // t1.cSnpY(), t1.cSnpZ(), t1.cSnpSnp(), t1.cTglY(), t1.cTglZ(), t1.cTglSnp(), t1.cTglTgl(), t1.c1PtY(), t1.c1PtZ(), t1.c1PtSnp(), t1.c1PtTgl(), t1.c1Pt21Pt2())); - // } else { - // emh_neg->AddTrackToEventPool(key_df_collision, EMTrackWithCov(ndf, t1.globalIndex(), collision.globalIndex(), t1.trackId(), t1.pt(), t1.eta(), t1.phi(), leptonM1, t1.sign(), t1.dcaXY(), t1.dcaZ(), possibleIds1, - // t1.x(), t1.y(), t1.z(), t1.alpha(), t1.snp(), t1.tgl(), t1.cYY(), t1.cZY(), t1.cZZ(), - // t1.cSnpY(), t1.cSnpZ(), t1.cSnpSnp(), t1.cTglY(), t1.cTglZ(), t1.cTglSnp(), t1.cTglTgl(), t1.c1PtY(), t1.c1PtZ(), t1.c1PtSnp(), t1.c1PtTgl(), t1.c1Pt21Pt2())); - // } - // } - // } - // if (std::find(used_trackIds.begin(), used_trackIds.end(), pair_tmp_id2) == used_trackIds.end()) { - // used_trackIds.emplace_back(pair_tmp_id2); - // if (cfgDoMix) { - // if (t2.sign() > 0) { - // emh_pos->AddTrackToEventPool(key_df_collision, EMTrackWithCov(ndf, t2.globalIndex(), collision.globalIndex(), t2.trackId(), t2.pt(), t2.eta(), t2.phi(), leptonM2, t2.sign(), t2.dcaXY(), t2.dcaZ(), possibleIds2, - // t2.x(), t2.y(), t2.z(), t2.alpha(), t2.snp(), t2.tgl(), t2.cYY(), t2.cZY(), t2.cZZ(), - // t2.cSnpY(), t2.cSnpZ(), t2.cSnpSnp(), t2.cTglY(), t2.cTglZ(), t2.cTglSnp(), t2.cTglTgl(), t2.c1PtY(), t2.c1PtZ(), t2.c1PtSnp(), t2.c1PtTgl(), t2.c1Pt21Pt2())); - // } else { - // emh_neg->AddTrackToEventPool(key_df_collision, EMTrackWithCov(ndf, t2.globalIndex(), collision.globalIndex(), t2.trackId(), t2.pt(), t2.eta(), t2.phi(), leptonM2, t2.sign(), t2.dcaXY(), t2.dcaZ(), possibleIds2, - // t2.x(), t2.y(), t2.z(), t2.alpha(), t2.snp(), t2.tgl(), t2.cYY(), t2.cZY(), t2.cZZ(), - // t2.cSnpY(), t2.cSnpZ(), t2.cSnpSnp(), t2.cTglY(), t2.cTglZ(), t2.cTglSnp(), t2.cTglTgl(), t2.c1PtY(), t2.c1PtZ(), t2.c1PtSnp(), t2.c1PtTgl(), t2.c1Pt21Pt2())); - // } - // } - // } - // } else if (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { - // std::copy(t1.ambiguousMuonsIds().begin(), t1.ambiguousMuonsIds().end(), std::back_inserter(possibleIds1)); - // std::copy(t2.ambiguousMuonsIds().begin(), t2.ambiguousMuonsIds().end(), std::back_inserter(possibleIds2)); - // - // if (std::find(used_trackIds.begin(), used_trackIds.end(), pair_tmp_id1) == used_trackIds.end()) { - // used_trackIds.emplace_back(pair_tmp_id1); - // if (cfgDoMix) { - // if (t1.sign() > 0) { - // emh_pos->AddTrackToEventPool(key_df_collision, EMFwdTrack(ndf, t1.globalIndex(), collision.globalIndex(), t1.fwdtrackId(), t1.pt(), t1.eta(), t1.phi(), o2::constants::physics::MassMuon, t1.sign(), t1.fwdDcaX(), t1.fwdDcaY(), possibleIds1, - // t1.cXXatDCA(), t1.cXYatDCA(), t1.cYYatDCA())); - // } else { - // emh_neg->AddTrackToEventPool(key_df_collision, EMFwdTrack(ndf, t1.globalIndex(), collision.globalIndex(), t1.fwdtrackId(), t1.pt(), t1.eta(), t1.phi(), o2::constants::physics::MassMuon, t1.sign(), t1.fwdDcaX(), t1.fwdDcaY(), possibleIds1, - // t1.cXXatDCA(), t1.cXYatDCA(), t1.cYYatDCA())); - // } - // } - // } - // if (std::find(used_trackIds.begin(), used_trackIds.end(), pair_tmp_id2) == used_trackIds.end()) { - // used_trackIds.emplace_back(pair_tmp_id2); - // if (cfgDoMix) { - // if (t2.sign() > 0) { - // emh_pos->AddTrackToEventPool(key_df_collision, EMFwdTrack(ndf, t2.globalIndex(), collision.globalIndex(), t2.fwdtrackId(), t2.pt(), t2.eta(), t2.phi(), o2::constants::physics::MassMuon, t2.sign(), t2.fwdDcaX(), t2.fwdDcaY(), possibleIds2, - // t2.cXXatDCA(), t2.cXYatDCA(), t2.cYYatDCA())); - // } else { - // emh_neg->AddTrackToEventPool(key_df_collision, EMFwdTrack(ndf, t2.globalIndex(), collision.globalIndex(), t2.fwdtrackId(), t2.pt(), t2.eta(), t2.phi(), o2::constants::physics::MassMuon, t2.sign(), t2.fwdDcaX(), t2.fwdDcaY(), possibleIds2, - // t2.cXXatDCA(), t2.cXYatDCA(), t2.cYYatDCA())); - // } - // } - // } - // } - // } + // store ref tracks for mixed event in case of kAzimuthalCorrelation + if constexpr (ev_id == 0) { + if (cfgDoMix && cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonHadronAnalysisType::kAzimuthalCorrelation)) { + std::pair key_df_collision = std::make_pair(ndf, collision.globalIndex()); + std::pair pair_tmp_id1 = std::make_pair(ndf, t1.globalIndex()); + std::pair pair_tmp_id2 = std::make_pair(ndf, t2.globalIndex()); + if (std::find(used_refTrackIds.begin(), used_refTrackIds.end(), pair_tmp_id1) == used_refTrackIds.end()) { + used_refTrackIds.emplace_back(pair_tmp_id1); + emh_ref->AddTrackToEventPool(key_df_collision, EMTrack(ndf, t1.globalIndex(), collision.globalIndex(), t1.trackId(), t1.pt(), t1.eta(), t1.phi(), 0.139)); + } // store t1 + if (std::find(used_refTrackIds.begin(), used_refTrackIds.end(), pair_tmp_id2) == used_refTrackIds.end()) { + used_refTrackIds.emplace_back(pair_tmp_id2); + emh_ref->AddTrackToEventPool(key_df_collision, EMTrack(ndf, t2.globalIndex(), collision.globalIndex(), t2.trackId(), t2.pt(), t2.eta(), t2.phi(), 0.139)); + } // store t2 + } + } return true; } @@ -1188,9 +1074,11 @@ struct DileptonHadronMPC { TEMH* emh_pos = nullptr; TEMH* emh_neg = nullptr; + MyEMH_track* emh_ref = nullptr; // for reference flow std::map, uint64_t> map_mixed_eventId_to_globalBC; std::vector> used_trackIds; + std::vector> used_refTrackIds; int ndf = 0; template @@ -1239,8 +1127,8 @@ struct DileptonHadronMPC { bool is_pair_ok = fillDilepton<0>(collision, pos, neg, cut, tracks); if (is_pair_ok) { nuls++; - for (const auto& reftrack : refTracks_per_coll) { - fillDileptonHadron<0>(collision, pos, neg, cut, tracks, reftrack); + for (const auto& refTrack : refTracks_per_coll) { + fillDileptonHadron<0>(collision, pos, neg, cut, tracks, refTrack); } } } @@ -1248,8 +1136,8 @@ struct DileptonHadronMPC { bool is_pair_ok = fillDilepton<0>(collision, pos1, pos2, cut, tracks); if (is_pair_ok) { nlspp++; - for (const auto& reftrack : refTracks_per_coll) { - fillDileptonHadron<0>(collision, pos1, pos2, cut, tracks, reftrack); + for (const auto& refTrack : refTracks_per_coll) { + fillDileptonHadron<0>(collision, pos1, pos2, cut, tracks, refTrack); } } } @@ -1257,15 +1145,15 @@ struct DileptonHadronMPC { bool is_pair_ok = fillDilepton<0>(collision, neg1, neg2, cut, tracks); if (is_pair_ok) { nlsmm++; - for (const auto& reftrack : refTracks_per_coll) { - fillDileptonHadron<0>(collision, neg1, neg2, cut, tracks, reftrack); + for (const auto& refTrack : refTracks_per_coll) { + fillDileptonHadron<0>(collision, neg1, neg2, cut, tracks, refTrack); } } } if (nuls > 0 || nlspp > 0 || nlsmm > 0) { // at least 1 pair exists. for (const auto& [trg, ref] : combinations(CombinationsStrictlyUpperIndexPolicy(refTracks_per_coll, refTracks_per_coll))) { - fillHadronHadron<0>(trg, ref); + fillHadronHadron<0>(collision, trg, ref, posTracks_per_coll, negTracks_per_coll); } } @@ -1356,12 +1244,39 @@ struct DileptonHadronMPC { fillDilepton<1>(collision, neg1, neg2, cut, tracks); } } - } // end of loop over mixed event pool + } // end of loop over mixed event pool for lepton-lepton + + if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonHadronAnalysisType::kAzimuthalCorrelation)) { + auto selected_refTracks_in_this_event = emh_ref->GetTracksPerCollision(key_df_collision); + auto collisionIds_in_mixing_pool_hadron = emh_ref->GetCollisionIdsFromEventPool(key_bin); + for (const auto& mix_dfId_collisionId : collisionIds_in_mixing_pool_hadron) { + int mix_dfId = mix_dfId_collisionId.first; + int mix_collisionId = mix_dfId_collisionId.second; + if (collision.globalIndex() == mix_collisionId && ndf == mix_dfId) { // this never happens. only protection. + continue; + } + + auto globalBC_mix = map_mixed_eventId_to_globalBC[mix_dfId_collisionId]; + uint64_t diffBC = std::max(collision.globalBC(), globalBC_mix) - std::min(collision.globalBC(), globalBC_mix); + fRegistry.fill(HIST("HadronHadron/mix/hDiffBC"), diffBC); + if (diffBC < ndiff_bc_mix) { + continue; + } + + auto refTracks_from_event_pool = emh_ref->GetTracksPerCollision(mix_dfId_collisionId); + for (const auto& ref1 : selected_refTracks_in_this_event) { // ref-ref mix + for (const auto& ref2 : refTracks_from_event_pool) { + fillHadronHadron<1>(collision, ref1, ref2, nullptr, nullptr); + } + } + } // end of loop over mixed event pool for lepton-lepton + } if (nuls > 0 || nlspp > 0 || nlsmm > 0) { map_mixed_eventId_to_globalBC[key_df_collision] = collision.globalBC(); emh_pos->AddCollisionIdAtLast(key_bin, key_df_collision); emh_neg->AddCollisionIdAtLast(key_bin, key_df_collision); + emh_ref->AddCollisionIdAtLast(key_bin, key_df_collision); } } // end of collision loop @@ -1488,7 +1403,7 @@ struct DileptonHadronMPC { passed_pairIds.shrink_to_fit(); } - void process2PC(FilteredMyCollisions const& collisions, MyTracks const& refTracks, Types const&... args) + void processAnalysis(FilteredMyCollisions const& collisions, MyTracks const& refTracks, Types const&... args) { if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { auto electrons = std::get<0>(std::tie(args...)); @@ -1506,10 +1421,10 @@ struct DileptonHadronMPC { map_weight.clear(); ndf++; } - PROCESS_SWITCH(DileptonHadronMPC, process2PC, "run dilepton analysis", true); + PROCESS_SWITCH(DileptonHadronMPC, processAnalysis, "run dilepton analysis", true); using FilteredMyCollisionsWithSWT = soa::Filtered; - void process2PCwithTrigger(FilteredMyCollisionsWithSWT const& collisions, MyTracks const& refTracks, Types const&... args) + void processTriggerAnalysis(FilteredMyCollisionsWithSWT const& collisions, MyTracks const& refTracks, Types const&... args) { if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { auto electrons = std::get<0>(std::tie(args...)); @@ -1527,7 +1442,7 @@ struct DileptonHadronMPC { map_weight.clear(); ndf++; } - PROCESS_SWITCH(DileptonHadronMPC, process2PCwithTrigger, "run dilepton analysis on triggered data", false); + PROCESS_SWITCH(DileptonHadronMPC, processTriggerAnalysis, "run dilepton analysis on triggered data", false); void processDummy(MyCollisions const&) {} PROCESS_SWITCH(DileptonHadronMPC, processDummy, "Dummy function", false); diff --git a/PWGEM/Dilepton/Core/EMTrackCut.cxx b/PWGEM/Dilepton/Core/EMTrackCut.cxx index 9d33efc1fc8..a875a644ce8 100644 --- a/PWGEM/Dilepton/Core/EMTrackCut.cxx +++ b/PWGEM/Dilepton/Core/EMTrackCut.cxx @@ -111,3 +111,9 @@ void EMTrackCut::RequireITSib1st(bool flag) mRequireITSib1st = flag; LOG(info) << "EMTrack Cut, require ITS ib 1st: " << mRequireITSib1st; } + +void EMTrackCut::SetTrackBits(uint16_t bits) +{ + mTrackBits = bits; + LOG(info) << "EMTrack Cut, require track bits: " << mTrackBits; +} diff --git a/PWGEM/Dilepton/Core/EMTrackCut.h b/PWGEM/Dilepton/Core/EMTrackCut.h index 7b15d8871f3..0df094c8ff1 100644 --- a/PWGEM/Dilepton/Core/EMTrackCut.h +++ b/PWGEM/Dilepton/Core/EMTrackCut.h @@ -16,7 +16,7 @@ #ifndef PWGEM_DILEPTON_CORE_EMTRACKCUT_H_ #define PWGEM_DILEPTON_CORE_EMTRACKCUT_H_ -// #include "PWGEM/Dilepton/Utils/EMTrackUtilities.h" +#include "PWGEM/Dilepton/Utils/EMTrackUtilities.h" #include "CommonConstants/PhysicsConstants.h" #include "Framework/DataTypes.h" @@ -31,7 +31,7 @@ #include #include -// using namespace o2::aod::pwgem::dilepton::utils::emtrackutil; +using namespace o2::aod::pwgem::dilepton::utils::emtrackutil; class EMTrackCut : public TNamed { @@ -45,24 +45,25 @@ class EMTrackCut : public TNamed kTrackPtRange, kTrackEtaRange, kTrackPhiRange, + kDCAxy, + kDCAz, kTPCNCls, kTPCCrossedRows, kTPCCrossedRowsOverNCls, kTPCFracSharedClusters, kTPCChi2NDF, - kDCAxy, - kDCAz, kITSNCls, kITSChi2NDF, + kTrackBits, kNCuts }; template bool IsSelected(TTrack const& track) const { - if (!track.hasITS() || !track.hasTPC()) { - return false; - } + // if (!track.hasITS() || !track.hasTPC()) { + // return false; + // } if (!IsSelectedTrack(track, EMTrackCuts::kTrackPtRange)) { return false; @@ -70,55 +71,58 @@ class EMTrackCut : public TNamed if (!IsSelectedTrack(track, EMTrackCuts::kTrackEtaRange)) { return false; } - if (!IsSelectedTrack(track, EMTrackCuts::kTrackPhiRange)) { return false; } + if (!IsSelectedTrack(track, EMTrackCuts::kDCAxy)) { return false; } if (!IsSelectedTrack(track, EMTrackCuts::kDCAz)) { return false; } - - // ITS cuts - if (!IsSelectedTrack(track, EMTrackCuts::kITSNCls)) { + if (!IsSelectedTrack(track, EMTrackCuts::kTrackBits)) { return false; } - if (!IsSelectedTrack(track, EMTrackCuts::kITSChi2NDF)) { - return false; - } - - if (mRequireITSibAny) { - auto hits_ib = std::count_if(its_ib_any_Requirement.second.begin(), its_ib_any_Requirement.second.end(), [&](auto&& requiredLayer) { return track.itsClusterMap() & (1 << requiredLayer); }); - if (hits_ib < its_ib_any_Requirement.first) { - return false; - } - } - if (mRequireITSib1st) { - auto hits_ib = std::count_if(its_ib_1st_Requirement.second.begin(), its_ib_1st_Requirement.second.end(), [&](auto&& requiredLayer) { return track.itsClusterMap() & (1 << requiredLayer); }); - if (hits_ib < its_ib_1st_Requirement.first) { - return false; - } - } - - // TPC cuts - if (!IsSelectedTrack(track, EMTrackCuts::kTPCNCls)) { - return false; - } - if (!IsSelectedTrack(track, EMTrackCuts::kTPCCrossedRows)) { - return false; - } - if (!IsSelectedTrack(track, EMTrackCuts::kTPCCrossedRowsOverNCls)) { - return false; - } - if (!IsSelectedTrack(track, EMTrackCuts::kTPCFracSharedClusters)) { - return false; - } - if (!IsSelectedTrack(track, EMTrackCuts::kTPCChi2NDF)) { - return false; - } + // // ITS cuts + // if (!IsSelectedTrack(track, EMTrackCuts::kITSNCls)) { + // return false; + // } + // if (!IsSelectedTrack(track, EMTrackCuts::kITSChi2NDF)) { + // return false; + // } + // + // if (mRequireITSibAny) { + // auto hits_ib = std::count_if(its_ib_any_Requirement.second.begin(), its_ib_any_Requirement.second.end(), [&](auto&& requiredLayer) { return track.itsClusterMap() & (1 << requiredLayer); }); + // if (hits_ib < its_ib_any_Requirement.first) { + // return false; + // } + // } + // + // if (mRequireITSib1st) { + // auto hits_ib = std::count_if(its_ib_1st_Requirement.second.begin(), its_ib_1st_Requirement.second.end(), [&](auto&& requiredLayer) { return track.itsClusterMap() & (1 << requiredLayer); }); + // if (hits_ib < its_ib_1st_Requirement.first) { + // return false; + // } + // } + // + // // TPC cuts + // if (!IsSelectedTrack(track, EMTrackCuts::kTPCNCls)) { + // return false; + // } + // if (!IsSelectedTrack(track, EMTrackCuts::kTPCCrossedRows)) { + // return false; + // } + // if (!IsSelectedTrack(track, EMTrackCuts::kTPCCrossedRowsOverNCls)) { + // return false; + // } + // if (!IsSelectedTrack(track, EMTrackCuts::kTPCFracSharedClusters)) { + // return false; + // } + // if (!IsSelectedTrack(track, EMTrackCuts::kTPCChi2NDF)) { + // return false; + // } return true; } @@ -136,32 +140,35 @@ class EMTrackCut : public TNamed case EMTrackCuts::kTrackPhiRange: return track.phi() > mMinTrackPhi && track.phi() < mMaxTrackPhi; - case EMTrackCuts::kTPCNCls: - return track.tpcNClsFound() >= mMinNClustersTPC; - - case EMTrackCuts::kTPCCrossedRows: - return track.tpcNClsCrossedRows() >= mMinNCrossedRowsTPC; - - case EMTrackCuts::kTPCCrossedRowsOverNCls: - return track.tpcCrossedRowsOverFindableCls() > mMinNCrossedRowsOverFindableClustersTPC; - - case EMTrackCuts::kTPCFracSharedClusters: - return track.tpcFractionSharedCls() < mMaxFracSharedClustersTPC; - - case EMTrackCuts::kTPCChi2NDF: - return mMinChi2PerClusterTPC < track.tpcChi2NCl() && track.tpcChi2NCl() < mMaxChi2PerClusterTPC; - case EMTrackCuts::kDCAxy: return std::fabs(track.dcaXY()) < ((mMaxDcaXYPtDep) ? mMaxDcaXYPtDep(track.pt()) : mMaxDcaXY); case EMTrackCuts::kDCAz: return std::fabs(track.dcaZ()) < mMaxDcaZ; - case EMTrackCuts::kITSNCls: - return mMinNClustersITS <= track.itsNCls() && track.itsNCls() <= mMaxNClustersITS; - - case EMTrackCuts::kITSChi2NDF: - return mMinChi2PerClusterITS < track.itsChi2NCl() && track.itsChi2NCl() < mMaxChi2PerClusterITS; + case EMTrackCuts::kTrackBits: + return true; + + // case EMTrackCuts::kTPCNCls: + // return track.tpcNClsFound() >= mMinNClustersTPC; + // + // case EMTrackCuts::kTPCCrossedRows: + // return track.tpcNClsCrossedRows() >= mMinNCrossedRowsTPC; + // + // case EMTrackCuts::kTPCCrossedRowsOverNCls: + // return track.tpcCrossedRowsOverFindableCls() > mMinNCrossedRowsOverFindableClustersTPC; + // + // case EMTrackCuts::kTPCFracSharedClusters: + // return track.tpcFractionSharedCls() < mMaxFracSharedClustersTPC; + // + // case EMTrackCuts::kTPCChi2NDF: + // return mMinChi2PerClusterTPC < track.tpcChi2NCl() && track.tpcChi2NCl() < mMaxChi2PerClusterTPC; + // + // case EMTrackCuts::kITSNCls: + // return mMinNClustersITS <= track.itsNCls() && track.itsNCls() <= mMaxNClustersITS; + // + // case EMTrackCuts::kITSChi2NDF: + // return mMinChi2PerClusterITS < track.itsChi2NCl() && track.itsChi2NCl() < mMaxChi2PerClusterITS; default: return false; @@ -186,6 +193,7 @@ class EMTrackCut : public TNamed void SetTrackMaxDcaXYPtDep(std::function ptDepCut); void RequireITSibAny(bool flag); void RequireITSib1st(bool flag); + void SetTrackBits(uint16_t bits); private: static const std::pair> its_ib_any_Requirement; @@ -206,6 +214,7 @@ class EMTrackCut : public TNamed float mMinChi2PerClusterITS{0.f}, mMaxChi2PerClusterITS{1e10f}; // max its fit chi2 per ITS cluster bool mRequireITSibAny{true}; bool mRequireITSib1st{false}; + uint16_t mTrackBits{0}; float mMaxDcaXY{1.0f}; // max dca in xy plane float mMaxDcaZ{1.0f}; // max dca in z direction diff --git a/PWGEM/Dilepton/DataModel/dileptonTables.h b/PWGEM/Dilepton/DataModel/dileptonTables.h index ad003750ca3..88321541855 100644 --- a/PWGEM/Dilepton/DataModel/dileptonTables.h +++ b/PWGEM/Dilepton/DataModel/dileptonTables.h @@ -694,6 +694,7 @@ DECLARE_SOA_INDEX_COLUMN(EMEvent, emevent); //! DECLARE_SOA_COLUMN(CollisionId, collisionId, int); //! DECLARE_SOA_COLUMN(TrackId, trackId, int); //! DECLARE_SOA_COLUMN(Sign, sign, int8_t); //! +DECLARE_SOA_COLUMN(TrackBit, trackBit, uint16_t); //! DECLARE_SOA_DYNAMIC_COLUMN(Signed1Pt, signed1Pt, [](float pt, int8_t sign) -> float { return sign * 1. / pt; }); DECLARE_SOA_DYNAMIC_COLUMN(P, p, [](float pt, float eta) -> float { return pt * std::cosh(eta); }); DECLARE_SOA_DYNAMIC_COLUMN(Px, px, [](float pt, float phi) -> float { return pt * std::cos(phi); }); @@ -704,18 +705,20 @@ DECLARE_SOA_DYNAMIC_COLUMN(Pz, pz, [](float pt, float eta) -> float { return pt DECLARE_SOA_TABLE_VERSIONED(EMPrimaryTracks_000, "AOD", "EMPRIMARYTRACK", 0, //! o2::soa::Index<>, emprimarytrack::CollisionId, emprimarytrack::TrackId, emprimarytrack::Sign, - track::Pt, track::Eta, track::Phi, track::DcaXY, track::DcaZ, - track::TPCNClsFindable, track::TPCNClsFindableMinusFound, track::TPCNClsFindableMinusCrossedRows, track::TPCNClsShared, track::TPCChi2NCl, - track::ITSClusterSizes, track::ITSChi2NCl, track::DetectorMap, + track::Pt, track::Eta, track::Phi, track::DcaXY, track::DcaZ, emprimarytrack::TrackBit, - // dynamic column - track::TPCNClsFound, - track::TPCNClsCrossedRows, - track::TPCCrossedRowsOverFindableCls, - track::TPCFoundOverFindableCls, - track::TPCFractionSharedCls, - track::v001::ITSClusterMap, track::v001::ITSNCls, track::v001::ITSNClsInnerBarrel, - track::HasITS, track::HasTPC, track::HasTRD, track::HasTOF, + // track::TPCNClsFindable, track::TPCNClsFindableMinusFound, track::TPCNClsFindableMinusCrossedRows, track::TPCNClsShared, track::TPCChi2NCl, + // track::ITSClusterSizes, track::ITSChi2NCl, track::DetectorMap, + + // // dynamic column + // track::TPCNClsFound, + // track::TPCNClsCrossedRows, + // track::TPCCrossedRowsOverFindableCls, + // track::TPCFoundOverFindableCls, + // track::TPCFractionSharedCls, + // track::v001::ITSClusterMap, track::v001::ITSNCls, track::v001::ITSNClsInnerBarrel, + + // track::HasITS, track::HasTPC, track::HasTRD, track::HasTOF, emprimarytrack::Signed1Pt, emprimarytrack::P, emprimarytrack::Px, diff --git a/PWGEM/Dilepton/TableProducer/skimmerPrimaryTrack.cxx b/PWGEM/Dilepton/TableProducer/skimmerPrimaryTrack.cxx index 93cbd031f88..37bde849360 100644 --- a/PWGEM/Dilepton/TableProducer/skimmerPrimaryTrack.cxx +++ b/PWGEM/Dilepton/TableProducer/skimmerPrimaryTrack.cxx @@ -13,7 +13,8 @@ /// \author daiki.sekihata@cern.ch #include "PWGEM/Dilepton/DataModel/dileptonTables.h" -#include "PWGEM/Dilepton/Utils/PairUtilities.h" +// #include "PWGEM/Dilepton/Utils/PairUtilities.h" +#include "PWGEM/Dilepton/Utils/EMTrackUtilities.h" #include "Common/Core/TableHelper.h" #include "Common/Core/trackUtilities.h" @@ -44,6 +45,7 @@ using namespace o2::soa; using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::constants::physics; +using namespace o2::aod::pwgem::dilepton::utils::emtrackutil; using MyCollisions = soa::Join; using MyCollisionsWithSWT = soa::Join; @@ -69,19 +71,21 @@ struct skimmerPrimaryTrack { // Operation and minimisation criteria Configurable fillQAHistogram{"fillQAHistogram", false, "flag to fill QA histograms"}; Configurable d_bz_input{"d_bz_input", -999, "bz field in kG, -999 is automatic"}; - Configurable min_ncluster_tpc{"min_ncluster_tpc", 0, "min ncluster tpc"}; - Configurable mincrossedrows{"mincrossedrows", 70, "min. crossed rows"}; - Configurable min_tpc_cr_findable_ratio{"min_tpc_cr_findable_ratio", 0.8, "min. TPC Ncr/Nf ratio"}; - Configurable min_ncluster_its{"min_ncluster_its", 4, "min ncluster its"}; - Configurable min_ncluster_itsib{"min_ncluster_itsib", 1, "min ncluster itsib"}; - Configurable maxchi2tpc{"maxchi2tpc", 5.0, "max. chi2/NclsTPC"}; - Configurable maxchi2its{"maxchi2its", 36.0, "max. chi2/NclsITS"}; + Configurable minpt{"minpt", 0.15, "min pt for ITS-TPC track"}; + Configurable maxpt{"maxpt", 5.0, "max pt for ITS-TPC track"}; Configurable maxeta{"maxeta", 2.0, "eta acceptance"}; Configurable dca_xy_max{"dca_xy_max", 1.0, "max DCAxy in cm"}; Configurable dca_z_max{"dca_z_max", 1.0, "max DCAz in cm"}; - Configurable dca_3d_sigma_max{"dca_3d_sigma_max", 1e+10, "max DCA 3D in sigma"}; - Configurable max_frac_shared_clusters_tpc{"max_frac_shared_clusters_tpc", 999.f, "max fraction of shared clusters in TPC"}; + + // Configurable min_ncluster_tpc{"min_ncluster_tpc", 0, "min ncluster tpc"}; + // Configurable mincrossedrows{"mincrossedrows", 70, "min. crossed rows"}; + // Configurable min_tpc_cr_findable_ratio{"min_tpc_cr_findable_ratio", 0.8, "min. TPC Ncr/Nf ratio"}; + // Configurable max_frac_shared_clusters_tpc{"max_frac_shared_clusters_tpc", 999.f, "max fraction of shared clusters in TPC"}; + // Configurable min_ncluster_its{"min_ncluster_its", 4, "min ncluster its"}; + // Configurable min_ncluster_itsib{"min_ncluster_itsib", 1, "min ncluster itsib"}; + // Configurable maxchi2tpc{"maxchi2tpc", 5.0, "max. chi2/NclsTPC"}; + // Configurable maxchi2its{"maxchi2its", 36.0, "max. chi2/NclsITS"}; HistogramRegistry fRegistry{"output", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; @@ -195,35 +199,35 @@ struct skimmerPrimaryTrack { return false; } - if (track.itsChi2NCl() > maxchi2its) { + if (track.itsChi2NCl() > 36.f) { return false; } - if (track.itsNCls() < min_ncluster_its) { + if (track.itsNCls() < 4) { return false; } - if (track.itsNClsInnerBarrel() < min_ncluster_itsib) { + if (track.itsNClsInnerBarrel() < 1) { return false; } - if (track.tpcChi2NCl() > maxchi2tpc) { + if (track.tpcChi2NCl() > 5.f) { return false; } - if (track.tpcNClsFound() < min_ncluster_tpc) { + if (track.tpcNClsFound() < 0) { return false; } - if (track.tpcNClsCrossedRows() < mincrossedrows) { + if (track.tpcNClsCrossedRows() < 50) { return false; } - if (track.tpcCrossedRowsOverFindableCls() < min_tpc_cr_findable_ratio) { + if (track.tpcCrossedRowsOverFindableCls() < 0.8) { return false; } - if (track.tpcFractionSharedCls() > max_frac_shared_clusters_tpc) { - return false; - } + // if (track.tpcFractionSharedCls() > max_frac_shared_clusters_tpc) { + // return false; + // } o2::dataformats::DCA mDcaInfoCov; mDcaInfoCov.set(999, 999, 999, 999, 999); @@ -239,19 +243,7 @@ struct skimmerPrimaryTrack { return false; } - float dca_3d = 999.f; - float det = trackParCov.getSigmaY2() * trackParCov.getSigmaZ2() - trackParCov.getSigmaZY() * trackParCov.getSigmaZY(); - if (det < 0) { - dca_3d = 999.f; - } else { - float chi2 = (dcaXY * dcaXY * trackParCov.getSigmaZ2() + dcaZ * dcaZ * trackParCov.getSigmaY2() - 2. * dcaXY * dcaZ * trackParCov.getSigmaZY()) / det; - dca_3d = std::sqrt(std::fabs(chi2) / 2.); - } - if (dca_3d > dca_3d_sigma_max) { - return false; - } - - if (std::fabs(trackParCov.getEta()) > maxeta || trackParCov.getPt() < minpt) { + if (std::fabs(trackParCov.getEta()) > maxeta || trackParCov.getPt() < minpt || maxpt < trackParCov.getPt()) { return false; } @@ -272,26 +264,65 @@ struct skimmerPrimaryTrack { float dcaXY = mDcaInfoCov.getY(); float dcaZ = mDcaInfoCov.getZ(); - float pt_recalc = trackParCov.getPt(); - float eta_recalc = trackParCov.getEta(); - float phi_recalc = trackParCov.getPhi(); - o2::math_utils::bringTo02Pi(phi_recalc); + float pt = trackParCov.getPt(); + float eta = trackParCov.getEta(); + float phi = trackParCov.getPhi(); + o2::math_utils::bringTo02Pi(phi); + uint16_t trackBit = 0; + + // As minimal cuts, following cuts are applied. The cut values are hardcoded on the purpose for consistent bit operation. + // has info on ITS and TPC + // a hit on ITSib any + // Ncls ITS >= 4 + // chi2/Ncls ITS < 36 + // Ncr TPC >= 50 + // chi2/Ncls TPC < 5 + // Ncr/Nf ratio in TPC > 0.8 + + if (track.itsNCls() >= 5) { + trackBit |= static_cast(RefTrackBit::kNclsITS5); + } + if (track.itsNCls() >= 6) { + trackBit |= static_cast(RefTrackBit::kNclsITS6); + } + + if (track.tpcNClsCrossedRows() >= 70) { + trackBit |= static_cast(RefTrackBit::kNcrTPC70); + } + if (track.tpcNClsCrossedRows() >= 90) { + trackBit |= static_cast(RefTrackBit::kNcrTPC90); + } + if (track.tpcNClsFound() >= 50) { + trackBit |= static_cast(RefTrackBit::kNclsTPC50); + } + if (track.tpcNClsFound() >= 70) { + trackBit |= static_cast(RefTrackBit::kNclsTPC70); + } + if (track.tpcNClsFound() >= 90) { + trackBit |= static_cast(RefTrackBit::kNclsTPC90); + } + if (track.tpcChi2NCl() < 4) { + trackBit |= static_cast(RefTrackBit::kChi2TPC4); + } + if (track.tpcChi2NCl() < 3) { + trackBit |= static_cast(RefTrackBit::kChi2TPC3); + } + if (track.tpcFractionSharedCls() < 0.7) { + trackBit |= static_cast(RefTrackBit::kFracSharedTPC07); + } - emprimarytracks(collision.globalIndex(), track.globalIndex(), track.sign(), - pt_recalc, eta_recalc, phi_recalc, dcaXY, dcaZ, - track.tpcNClsFindable(), track.tpcNClsFindableMinusFound(), track.tpcNClsFindableMinusCrossedRows(), track.tpcNClsShared(), track.tpcChi2NCl(), - track.itsClusterSizes(), track.itsChi2NCl(), track.detectorMap()); + emprimarytracks(collision.globalIndex(), track.globalIndex(), track.sign(), pt, eta, phi, dcaXY, dcaZ, trackBit); stored_trackIds.emplace_back(std::pair{collision.globalIndex(), track.globalIndex()}); if (fillQAHistogram) { - fRegistry.fill(HIST("Track/hPt"), pt_recalc); - fRegistry.fill(HIST("Track/hQoverPt"), track.sign() / pt_recalc); - fRegistry.fill(HIST("Track/hEtaPhi"), phi_recalc, eta_recalc); + fRegistry.fill(HIST("Track/hPt"), pt); + fRegistry.fill(HIST("Track/hQoverPt"), track.sign() / pt); + fRegistry.fill(HIST("Track/hEtaPhi"), phi, eta); fRegistry.fill(HIST("Track/hDCAxyz"), dcaXY, dcaZ); fRegistry.fill(HIST("Track/hDCAxyzSigma"), dcaXY / std::sqrt(trackParCov.getSigmaY2()), dcaZ / std::sqrt(trackParCov.getSigmaZ2())); - fRegistry.fill(HIST("Track/hDCAxyRes_Pt"), pt_recalc, std::sqrt(trackParCov.getSigmaY2()) * 1e+4); // convert cm to um - fRegistry.fill(HIST("Track/hDCAzRes_Pt"), pt_recalc, std::sqrt(trackParCov.getSigmaZ2()) * 1e+4); // convert cm to um + fRegistry.fill(HIST("Track/hDCAxyRes_Pt"), pt, std::sqrt(trackParCov.getSigmaY2()) * 1e+4); // convert cm to um + fRegistry.fill(HIST("Track/hDCAzRes_Pt"), pt, std::sqrt(trackParCov.getSigmaZ2()) * 1e+4); // convert cm to um fRegistry.fill(HIST("Track/hNclsITS"), track.itsNCls()); fRegistry.fill(HIST("Track/hNclsTPC"), track.tpcNClsFound()); fRegistry.fill(HIST("Track/hNcrTPC"), track.tpcNClsCrossedRows()); @@ -308,7 +339,7 @@ struct skimmerPrimaryTrack { Preslice trackIndicesPerCollision = aod::track_association::collisionId; std::vector> stored_trackIds; - Filter trackFilter = o2::aod::track::itsChi2NCl < maxchi2its && o2::aod::track::tpcChi2NCl < maxchi2tpc && ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::ITS) == true && ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::TPC) == true; + Filter trackFilter = o2::aod::track::itsChi2NCl < 36.f && o2::aod::track::tpcChi2NCl < 5.f && ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::ITS) == true && ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::TPC) == true; using MyFilteredTracks = soa::Filtered; // ---------- for data ---------- diff --git a/PWGEM/Dilepton/Utils/EMTrack.h b/PWGEM/Dilepton/Utils/EMTrack.h index 0f894d5b4dc..d7ddae81476 100644 --- a/PWGEM/Dilepton/Utils/EMTrack.h +++ b/PWGEM/Dilepton/Utils/EMTrack.h @@ -15,15 +15,16 @@ #ifndef PWGEM_DILEPTON_UTILS_EMTRACK_H_ #define PWGEM_DILEPTON_UTILS_EMTRACK_H_ -#include #include "Math/Vector4D.h" +#include + namespace o2::aod::pwgem::dilepton::utils { class EMTrack { public: - EMTrack(int dfId, int globalId, int collisionId, int trackId, float pt, float eta, float phi, float mass, int8_t charge = 0, float dcaXY = 0.f, float dcaZ = 0.f, std::vector amb_ele_self_ids = {}) + EMTrack(int dfId, int globalId, int collisionId, int trackId, float pt, float eta, float phi, float mass, int8_t charge = 0, float dcaXY = 0.f, float dcaZ = 0.f, std::vector amb_ele_self_ids = {}, float CYY = 0, float CZY = 0, float CZZ = 0) { fDFId = dfId; fGlobalId = globalId; @@ -36,6 +37,9 @@ class EMTrack fCharge = charge; fDCAxy = dcaXY; fDCAz = dcaZ; + fCYY = CYY; + fCZY = CZY; + fCZZ = CZZ; fPairDCA3DinSigmaOTF = 0; fAmbEleSelfIds = amb_ele_self_ids; @@ -78,6 +82,11 @@ class EMTrack int8_t sign() const { return fCharge; } float dcaXY() const { return fDCAxy; } float dcaZ() const { return fDCAz; } + + float cYY() const { return fCYY; } + float cZY() const { return fCZY; } + float cZZ() const { return fCZZ; } + float p() const { return fPt * std::cosh(fEta); } float px() const { return fPt * std::cos(fPhi); } float py() const { return fPt * std::sin(fPhi); } @@ -130,6 +139,10 @@ class EMTrack std::vector ambiguousPosLegIds() const { return fAmbPosLegSelfIds; } std::vector ambiguousNegLegIds() const { return fAmbNegLegSelfIds; } + void setCYY(float cYY) { fCYY = cYY; } + void setCZY(float cZY) { fCZY = cZY; } + void setCZZ(float cZZ) { fCZZ = cZZ; } + protected: int fDFId; int fGlobalId; @@ -142,6 +155,11 @@ class EMTrack int8_t fCharge; float fDCAxy; float fDCAz; + + float fCYY; + float fCZY; + float fCZZ; + float fPairDCA3DinSigmaOTF; bool fIsAmbiguous; std::vector fAmbEleSelfIds; @@ -199,9 +217,6 @@ class EMTrackWithCov : public EMTrack float snp() const { return fSnp; } float tgl() const { return fTgl; } - float cYY() const { return fCYY; } - float cZY() const { return fCZY; } - float cZZ() const { return fCZZ; } float cSnpY() const { return fCSnpY; } float cSnpZ() const { return fCSnpZ; } float cSnpSnp() const { return fCSnpSnp; } @@ -215,10 +230,6 @@ class EMTrackWithCov : public EMTrack float c1PtTgl() const { return fC1PtTgl; } float c1Pt21Pt2() const { return fC1Pt21Pt2; } - void setCYY(float cYY) { fCYY = cYY; } - void setCZY(float cZY) { fCZY = cZY; } - void setCZZ(float cZZ) { fCZZ = cZZ; } - protected: float fX; float fY; @@ -226,9 +237,6 @@ class EMTrackWithCov : public EMTrack float fAlpha; float fSnp; float fTgl; - float fCYY; - float fCZY; - float fCZZ; float fCSnpY; float fCSnpZ; float fCSnpSnp; diff --git a/PWGEM/Dilepton/Utils/EMTrackUtilities.h b/PWGEM/Dilepton/Utils/EMTrackUtilities.h index d698bdbf68c..087ee38d60b 100644 --- a/PWGEM/Dilepton/Utils/EMTrackUtilities.h +++ b/PWGEM/Dilepton/Utils/EMTrackUtilities.h @@ -26,6 +26,20 @@ //_______________________________________________________________________ namespace o2::aod::pwgem::dilepton::utils::emtrackutil { + +enum class RefTrackBit : uint16_t { // This is not for leptons, but charged particles for ref. flow. + kNclsITS5 = 1, + kNclsITS6 = 2, + kNcrTPC70 = 4, + kNcrTPC90 = 8, + kNclsTPC50 = 16, // (not necessary, if ncr is used.) + kNclsTPC70 = 32, // (not necessary, if ncr is used.) + kNclsTPC90 = 64, // (not necessary, if ncr is used.) + kChi2TPC4 = 128, + kChi2TPC3 = 256, + kFracSharedTPC07 = 512, +}; + //_______________________________________________________________________ template float dca3DinSigma(T const& track) diff --git a/PWGEM/Dilepton/Utils/EventHistograms.h b/PWGEM/Dilepton/Utils/EventHistograms.h index afebfff955b..ab448b1dcc6 100644 --- a/PWGEM/Dilepton/Utils/EventHistograms.h +++ b/PWGEM/Dilepton/Utils/EventHistograms.h @@ -74,9 +74,9 @@ void addEventHistograms(HistogramRegistry* fRegistry) fRegistry->add("Event/before/hMultNTracksPV", "hMultNTracksPV; N_{track} to PV", kTH1F, {{6001, -0.5, 6000.5}}, false); fRegistry->add("Event/before/hMultNTracksPVeta1", "hMultNTracksPVeta1; N_{track} to PV", kTH1F, {{6001, -0.5, 6000.5}}, false); fRegistry->add("Event/before/hMultFT0", "hMultFT0;mult. FT0A;mult. FT0C", kTH2F, {{200, 0, 200000}, {60, 0, 60000}}, false); - fRegistry->add("Event/before/hCentFT0A", "hCentFT0A;centrality FT0A (%)", kTH1F, {{axis_cent_ft0m}}, false); - fRegistry->add("Event/before/hCentFT0C", "hCentFT0C;centrality FT0C (%)", kTH1F, {{axis_cent_ft0a}}, false); - fRegistry->add("Event/before/hCentFT0M", "hCentFT0M;centrality FT0M (%)", kTH1F, {{axis_cent_ft0c}}, false); + fRegistry->add("Event/before/hCentFT0A", "hCentFT0A;centrality FT0A (%)", kTH1F, {{axis_cent_ft0a}}, false); + fRegistry->add("Event/before/hCentFT0C", "hCentFT0C;centrality FT0C (%)", kTH1F, {{axis_cent_ft0c}}, false); + fRegistry->add("Event/before/hCentFT0M", "hCentFT0M;centrality FT0M (%)", kTH1F, {{axis_cent_ft0m}}, false); fRegistry->add("Event/before/hCentFT0CvsMultNTracksPV", "hCentFT0CvsMultNTracksPV;centrality FT0C (%);N_{track} to PV", kTH2F, {{110, 0, 110}, {600, 0, 6000}}, false); fRegistry->add("Event/before/hMultFT0CvsMultNTracksPV", "hMultFT0CvsMultNTracksPV;mult. FT0C;N_{track} to PV", kTH2F, {{60, 0, 60000}, {600, 0, 6000}}, false); fRegistry->add("Event/before/hMultFT0CvsOccupancy", "hMultFT0CvsOccupancy;mult. FT0C;N_{track} in time range", kTH2F, {{60, 0, 60000}, {200, 0, 20000}}, false); diff --git a/PWGEM/Dilepton/Utils/PairUtilities.h b/PWGEM/Dilepton/Utils/PairUtilities.h index 73e66a53142..1fcede0e14d 100644 --- a/PWGEM/Dilepton/Utils/PairUtilities.h +++ b/PWGEM/Dilepton/Utils/PairUtilities.h @@ -47,8 +47,8 @@ enum class DileptonAnalysisType : int { }; enum class DileptonHadronAnalysisType : int { - kCumulant = 0, - kCorrelationFunction = 1, + kAzimuthalCorrelation = 0, + kCumulant = 1, }; enum class DileptonPrefilterBit : int { diff --git a/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h b/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h index 499b3fe1184..7ceb009cbd8 100644 --- a/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h +++ b/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h @@ -97,10 +97,11 @@ struct DiphotonHadronMPC { Configurable cfgCentMax{"cfgCentMax", 999, "max. centrality"}; Configurable maxY{"maxY", 0.8, "maximum rapidity for diphoton"}; Configurable cfgDoMix{"cfgDoMix", true, "flag for event mixing"}; - Configurable ndepth{"ndepth", 100, "depth for event mixing"}; + Configurable ndepth_photon{"ndepth_photon", 100, "depth for event mixing between photon-photon"}; + Configurable ndepth_hadron{"ndepth_hadron", 2, "depth for event mixing between hadron-hadron"}; Configurable ndiff_bc_mix{"ndiff_bc_mix", 594, "difference in global BC required in mixed events"}; ConfigurableAxis ConfVtxBins{"ConfVtxBins", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"}; - ConfigurableAxis ConfCentBins{"ConfCentBins", {VARIABLE_WIDTH, 0.0f, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f, 100.f, 999.f}, "Mixing bins - centrality"}; + ConfigurableAxis ConfCentBins{"ConfCentBins", {VARIABLE_WIDTH, 0.0f, 0.1, 1, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f, 100.f, 999.f}, "Mixing bins - centrality"}; ConfigurableAxis ConfOccupancyBins{"ConfOccupancyBins", {VARIABLE_WIDTH, -1, 1e+10}, "Mixing bins - occupancy"}; ConfigurableAxis ConfMggBins{"ConfMggBins", {200, 0.0, 0.8}, "mgg bins for output histograms"}; @@ -109,8 +110,8 @@ struct DiphotonHadronMPC { ConfigurableAxis ConfPtHadronBins{"ConfPtHadronBins", {VARIABLE_WIDTH, 0.00, 0.15, 0.2, 0.3, 0.4, 0.50, 1.00, 2.00, 3.00, 4.00, 5.00}, "pT,h bins for output histograms"}; ConfigurableAxis ConfDEtaBins{"ConfDEtaBins", {60, -3, 3}, "deta bins for output histograms"}; Configurable cfgNbinsDPhi{"cfgNbinsDPhi", 36, "nbins in dphi for output histograms"}; - Configurable cfgNbinsCosNDPhi{"cfgNbinsCosNDPhi", 200, "nbins in cos(n(dphi)) for output histograms"}; - Configurable cfgNmod{"cfgNmod", 2, "n-th harmonics"}; + // Configurable cfgNbinsCosNDPhi{"cfgNbinsCosNDPhi", 100, "nbins in cos(n(dphi)) for output histograms"}; + // Configurable cfgNmod{"cfgNmod", 2, "n-th harmonics"}; EMPhotonEventCut fEMEventCut; struct : ConfigurableGroup { @@ -202,11 +203,11 @@ struct DiphotonHadronMPC { EMTrackCut fEMTrackCut; struct : ConfigurableGroup { std::string prefix = "trackcut_group"; - Configurable cfg_min_pt_track{"cfg_min_pt_track", 0.15, "min pT for ref. track"}; + Configurable cfg_min_pt_track{"cfg_min_pt_track", 0.2, "min pT for ref. track"}; Configurable cfg_max_pt_track{"cfg_max_pt_track", 3.0, "max pT for ref. track"}; - Configurable cfg_min_eta_track{"cfg_min_eta_track", -1.2, "min eta for ref. track"}; - Configurable cfg_max_eta_track{"cfg_max_eta_track", +1.2, "max eta for ref. track"}; - Configurable cfg_min_phi_track{"cfg_min_phi_track", 0., "min phi for ref. track"}; + Configurable cfg_min_eta_track{"cfg_min_eta_track", -0.8, "min eta for ref. track"}; + Configurable cfg_max_eta_track{"cfg_max_eta_track", +0.8, "max eta for ref. track"}; + Configurable cfg_min_phi_track{"cfg_min_phi_track", 0.0, "min phi for ref. track"}; Configurable cfg_max_phi_track{"cfg_max_phi_track", 6.3, "max phi for ref. track"}; Configurable cfg_min_ncluster_its{"cfg_min_ncluster_its", 5, "min ncluster its"}; Configurable cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 0, "min ncluster tpc"}; @@ -246,8 +247,10 @@ struct DiphotonHadronMPC { occ_bin_edges = std::vector(ConfOccupancyBins.value.begin(), ConfOccupancyBins.value.end()); occ_bin_edges.erase(occ_bin_edges.begin()); - emh1 = new MyEMH(ndepth); - emh2 = new MyEMH(ndepth); + emh1 = new MyEMH(ndepth_photon); + emh2 = new MyEMH(ndepth_photon); + emh_diphoton = new MyEMH_track(ndepth_photon); + emh_ref = new MyEMH_track(ndepth_hadron); o2::aod::pwgem::photonmeson::utils::eventhistogram::addEventHistograms(&fRegistry); addHistograms(); @@ -258,7 +261,7 @@ struct DiphotonHadronMPC { DefineDileptonCut(); fRegistry.add("Diphoton/mix/hDiffBC", "diff. global BC in mixed event;|BC_{current} - BC_{mixed}|", kTH1D, {{10001, -0.5, 10000.5}}, true); - if (doprocess2PCwithTrigger) { + if (doprocessTriggerAnalysis) { fRegistry.add("Event/hNInspectedTVX", "N inspected TVX;run number;N_{TVX}", kTProfile, {{80000, 520000.5, 600000.5}}, true); } @@ -293,8 +296,9 @@ struct DiphotonHadronMPC { auto run3grp_timestamp = collision.timestamp(); o2::parameters::GRPObject* grpo = 0x0; o2::parameters::GRPMagField* grpmag = 0x0; - if (!skipGRPOquery) + if (!skipGRPOquery) { grpo = ccdb->getForTimeStamp(grpPath, run3grp_timestamp); + } if (grpo) { // Fetch magnetic field from ccdb for current collision d_bz = grpo->getNominalL3Field(); @@ -323,11 +327,18 @@ struct DiphotonHadronMPC { emh1 = 0x0; delete emh2; emh2 = 0x0; + delete emh_diphoton; + emh_diphoton = 0x0; + delete emh_ref; + emh_ref = 0x0; used_photonIds.clear(); used_photonIds.shrink_to_fit(); used_dileptonIds.clear(); used_dileptonIds.shrink_to_fit(); + used_refTrackIds.clear(); + used_refTrackIds.shrink_to_fit(); + map_mixed_eventId_to_globalBC.clear(); } @@ -337,22 +348,23 @@ struct DiphotonHadronMPC { std::string pair_pt_axis_title = "p_{T,#gamma#gamma} (GeV/c)"; std::string deta_axis_title = "#Delta#eta = #eta_{#gamma#gamma} - #eta_{h}"; std::string dphi_axis_title = "#Delta#varphi = #varphi_{#gamma#gamma} - #varphi_{h} (rad.)"; - std::string cosndphi_axis_title = std::format("cos({0:d}(#varphi_{{#gamma#gamma}} - #varphi_{{h}}))", cfgNmod.value); + // std::string cosndphi_axis_title = std::format("cos({0:d}(#varphi_{{#gamma#gamma}} - #varphi_{{h}}))", cfgNmod.value); if constexpr (pairtype == PairType::kPCMDalitzEE) { mass_axis_title = "m_{ee#gamma} (GeV/c^{2})"; pair_pt_axis_title = "p_{T,ee#gamma} (GeV/c)"; deta_axis_title = "#Delta#eta = #eta_{ee#gamma} - #eta_{h}"; dphi_axis_title = "#Delta#varphi = #varphi_{ee#gamma} - #varphi_{h} (rad.)"; - cosndphi_axis_title = std::format("cos({0:d}(#varphi_{{ee#gamma}} - #varphi_{{h}}))", cfgNmod.value); + // cosndphi_axis_title = std::format("cos({0:d}(#varphi_{{ee#gamma}} - #varphi_{{h}}))", cfgNmod.value); } // photon info const AxisSpec axis_pt_single{ConfPtggBins, "p_{T,#gamma} (GeV/c)"}; - const AxisSpec axis_eta_single{40, -2, +2, "#eta_{#gamma}"}; + const AxisSpec axis_eta_single{20, -1, +1, "#eta_{#gamma}"}; const AxisSpec axis_phi_single{36, 0, 2 * M_PI, "#varphi_{#gamma} (rad.)"}; const AxisSpec axis_deta_single{ConfDEtaBins, "#Delta#eta = #eta_{#gamma} - #eta_{h}"}; - const AxisSpec axis_cos_ndphi_single{cfgNbinsCosNDPhi, -1, +1, std::format("cos({0:d}(#varphi_{{#gamma}} - #varphi_{{h}}))", cfgNmod.value)}; + const AxisSpec axis_dphi_single{cfgNbinsDPhi, -M_PI / 2, +3 * M_PI / 2, "#Delta#varphi = #varphi_{#gamma} - #varphi_{h} (rad.)"}; + // const AxisSpec axis_cos_ndphi_single{cfgNbinsCosNDPhi, -1, +1, std::format("cos({0:d}(#varphi_{{#gamma}} - #varphi_{{h}}))", cfgNmod.value)}; // diphoton info const AxisSpec axis_mass{ConfMggBins, mass_axis_title}; @@ -361,26 +373,26 @@ struct DiphotonHadronMPC { // diphoton-hadron info const AxisSpec axis_pt_ref{ConfPtHadronBins, "p_{T,h}^{ref} (GeV/c)"}; const AxisSpec axis_deta{ConfDEtaBins, deta_axis_title}; - const AxisSpec axis_cos_ndphi{cfgNbinsCosNDPhi, -1, +1, cosndphi_axis_title}; + const AxisSpec axis_dphi{cfgNbinsDPhi, -M_PI / 2, +3 * M_PI / 2, dphi_axis_title}; - const AxisSpec axis_pt_trg{ConfPtHadronBins, "p_{T,h} (GeV/c)"}; - const AxisSpec axis_eta_trg{40, -2, +2, "#eta_{h}"}; - const AxisSpec axis_phi_trg{36, 0, 2 * M_PI, "#varphi_{h} (rad.)"}; + const AxisSpec axis_pt_hadron{ConfPtHadronBins, "p_{T,h} (GeV/c)"}; + const AxisSpec axis_eta_hadron{40, -2, +2, "#eta_{h}"}; + const AxisSpec axis_phi_hadron{36, 0, 2 * M_PI, "#varphi_{h} (rad.)"}; - fRegistry.add("Hadron/hs", "hadron", kTHnSparseD, {axis_pt_trg, axis_eta_trg, axis_phi_trg}, true); - fRegistry.add("Photon/hs", "photon", kTHnSparseD, {axis_pt_single, axis_eta_single, axis_phi_single}, true); + fRegistry.add("Hadron/hs", "hadron", kTHnSparseD, {axis_pt_hadron, axis_eta_hadron, axis_phi_hadron}, true); fRegistry.add("Diphoton/same/hs", "diphoton", kTHnSparseD, {axis_mass, axis_pt}, true); fRegistry.addClone("Diphoton/same/", "Diphoton/mix/"); - fRegistry.add("DiphotonHadron/same/hs", "diphoton-hadron 2PC", kTHnSparseD, {axis_mass, axis_pt, axis_pt_ref, axis_deta, axis_cos_ndphi}, true); - fRegistry.add("PhotonHadron/same/hs", "photon-hadron 2PC", kTHnSparseD, {axis_pt_single, axis_pt_ref, axis_deta_single, axis_cos_ndphi_single}, true); + fRegistry.add("DiphotonHadron/same/hs", "diphoton-hadron 2PC", kTHnSparseD, {axis_mass, axis_pt, axis_pt_ref, axis_deta, axis_dphi}, true); + fRegistry.addClone("DiphotonHadron/same/", "DiphotonHadron/mix/"); // hadron-hadron - const AxisSpec axis_deta_hh{ConfDEtaBins, "#Delta#eta = #eta_{h}^{trg} - #eta_{h}^{ref}"}; - const AxisSpec axis_cosndphi_hh{cfgNbinsCosNDPhi, -1, +1, std::format("cos({0:d}(#varphi_{{h}}^{{trg}} - #varphi_{{h}}^{{ref}}))", cfgNmod.value)}; - fRegistry.add("HadronHadron_for_Diphoton/same/hs", "hadron-hadron 2PC", kTHnSparseD, {axis_pt_trg, axis_pt_ref, axis_deta_hh, axis_cosndphi_hh}, true); - fRegistry.addClone("HadronHadron_for_Diphoton/same/hs", "HadronHadron_for_Photon/same/hs"); + const AxisSpec axis_deta_hh{ConfDEtaBins, "#Delta#eta = #eta_{h}^{ref1} - #eta_{h}^{ref2}"}; + const AxisSpec axis_dphi_hh{cfgNbinsDPhi, -M_PI / 2, +3 * M_PI / 2, "#Delta#varphi = #varphi_{h}^{ref1} - #varphi_{h}^{ref2} (rad.)"}; + // const AxisSpec axis_cosndphi_hh{cfgNbinsCosNDPhi, -1, +1, std::format("cos({0:d}(#varphi_{{h}}^{{ref1}} - #varphi_{{h}}^{{ref2}}))", cfgNmod.value)}; + fRegistry.add("HadronHadron/same/hs", "hadron-hadron 2PC", kTHnSparseD, {axis_pt_hadron, axis_pt_ref, axis_deta_hh, axis_dphi_hh}, true); + fRegistry.addClone("HadronHadron/same/", "HadronHadron/mix/"); } void DefineEMEventCut() @@ -490,8 +502,14 @@ struct DiphotonHadronMPC { using MyEMH = o2::aod::pwgem::dilepton::utils::EventMixingHandler, std::pair, EMTrack>; MyEMH* emh1 = nullptr; MyEMH* emh2 = nullptr; + using MyEMH_track = o2::aod::pwgem::dilepton::utils::EventMixingHandler, std::pair, EMTrack>; // for charged track + MyEMH_track* emh_diphoton = nullptr; + MyEMH_track* emh_ref = nullptr; + std::vector> used_photonIds; // std::vector> used_dileptonIds; // + std::vector> used_refTrackIds; // + std::vector> used_diphotonIds; // std::map, uint64_t> map_mixed_eventId_to_globalBC; template @@ -502,7 +520,6 @@ struct DiphotonHadronMPC { for (const auto& collision : collisions) { initCCDB(collision); int ndiphoton = 0; - int nphoton = 0; const float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { @@ -574,22 +591,6 @@ struct DiphotonHadronMPC { auto photons1_per_collision = photons1.sliceBy(perCollision1, collision.globalIndex()); auto photons2_per_collision = photons2.sliceBy(perCollision2, collision.globalIndex()); - for (const auto& photon : photons1_per_collision) { // single photon - if (cut1.template IsSelected(photon)) { - fRegistry.fill(HIST("Photon/hs"), photon.pt(), photon.eta(), photon.phi()); - nphoton++; - for (const auto& track : refTracks_per_collision) { - if (fEMTrackCut.IsSelected(track)) { - float deta = photon.eta() - track.eta(); - float dphi = photon.phi() - track.phi(); - o2::math_utils::bringTo02Pi(dphi); - - fRegistry.fill(HIST("PhotonHadron/same/hs"), photon.pt(), track.pt(), deta, std::cos(cfgNmod * dphi)); - } - } // end of ref track loop - } - } // end of photon loop - for (const auto& [g1, g2] : combinations(CombinationsStrictlyUpperIndexPolicy(photons1_per_collision, photons2_per_collision))) { if (!cut1.template IsSelected(g1) || !cut2.template IsSelected(g2)) { continue; @@ -601,27 +602,53 @@ struct DiphotonHadronMPC { if (std::fabs(v12.Rapidity()) > maxY) { continue; } - fRegistry.fill(HIST("Diphoton/same/hs"), v12.M(), v12.Pt()); + auto pos1 = g1.template posTrack_as(); + auto ele1 = g1.template negTrack_as(); + auto pos2 = g2.template posTrack_as(); + auto ele2 = g2.template negTrack_as(); + + int npair = 0; for (const auto& track : refTracks_per_collision) { + if (pos1.trackId() == track.trackId() || ele1.trackId() == track.trackId()) { + continue; + } + if (pos2.trackId() == track.trackId() || ele2.trackId() == track.trackId()) { + continue; + } + if (fEMTrackCut.IsSelected(track)) { ROOT::Math::PtEtaPhiMVector v3(track.pt(), track.eta(), track.phi(), 0.139); float deta = v12.Eta() - v3.Eta(); float dphi = v12.Phi() - v3.Phi(); - o2::math_utils::bringTo02Pi(dphi); - fRegistry.fill(HIST("DiphotonHadron/same/hs"), v12.M(), v12.Pt(), v3.Pt(), deta, std::cos(cfgNmod * dphi)); + // o2::math_utils::bringTo02Pi(dphi); + dphi = RecoDecay::constrainAngle(dphi, -M_PI / 2, 1U); + fRegistry.fill(HIST("DiphotonHadron/same/hs"), v12.M(), v12.Pt(), v3.Pt(), deta, dphi); + npair++; + std::pair pair_tmp_ref = std::make_pair(ndf, track.globalIndex()); + if (std::find(used_refTrackIds.begin(), used_refTrackIds.end(), pair_tmp_ref) == used_refTrackIds.end()) { // add a ref track in mixing pool + emh_ref->AddTrackToEventPool(key_df_collision, EMTrack(ndf, track.globalIndex(), collision.globalIndex(), track.globalIndex(), track.pt(), track.eta(), track.phi(), 0.139)); + used_refTrackIds.emplace_back(pair_tmp_ref); + } } } // end of ref track loop + if (npair > 0) { + std::tuple tuple_tmp_diphoton = std::make_tuple(ndf, g1.globalIndex(), g2.globalIndex(), -1); + if (std::find(used_diphotonIds.begin(), used_diphotonIds.end(), tuple_tmp_diphoton) == used_diphotonIds.end()) { + emh_diphoton->AddTrackToEventPool(key_df_collision, EMTrack(ndf, -1, collision.globalIndex(), -1, v12.Pt(), v12.Eta(), v12.Phi(), v12.M())); + used_diphotonIds.emplace_back(tuple_tmp_diphoton); + } + } + std::pair pair_tmp_id1 = std::make_pair(ndf, g1.globalIndex()); std::pair pair_tmp_id2 = std::make_pair(ndf, g2.globalIndex()); - if (std::find(used_photonIds.begin(), used_photonIds.end(), pair_tmp_id1) == used_photonIds.end()) { - emh1->AddTrackToEventPool(key_df_collision, EMTrack(-1, g1.globalIndex(), collision.globalIndex(), g1.globalIndex(), g1.pt(), g1.eta(), g1.phi(), 0)); + emh1->AddTrackToEventPool(key_df_collision, EMTrack(ndf, g1.globalIndex(), collision.globalIndex(), g1.globalIndex(), g1.pt(), g1.eta(), g1.phi(), 0)); used_photonIds.emplace_back(pair_tmp_id1); } if (std::find(used_photonIds.begin(), used_photonIds.end(), pair_tmp_id2) == used_photonIds.end()) { - emh1->AddTrackToEventPool(key_df_collision, EMTrack(-1, g2.globalIndex(), collision.globalIndex(), g2.globalIndex(), g2.pt(), g2.eta(), g2.phi(), 0)); + emh1->AddTrackToEventPool(key_df_collision, EMTrack(ndf, g2.globalIndex(), collision.globalIndex(), g2.globalIndex(), g2.pt(), g2.eta(), g2.phi(), 0)); used_photonIds.emplace_back(pair_tmp_id2); } ndiphoton++; @@ -631,22 +658,6 @@ struct DiphotonHadronMPC { auto positrons_per_collision = positrons->sliceByCached(o2::aod::emprimaryelectron::emeventId, collision.globalIndex(), cache); auto electrons_per_collision = electrons->sliceByCached(o2::aod::emprimaryelectron::emeventId, collision.globalIndex(), cache); - for (const auto& photon : photons1_per_collision) { // single photon - if (cut1.template IsSelected(photon)) { - fRegistry.fill(HIST("Photon/hs"), photon.pt(), photon.eta(), photon.phi()); - nphoton++; - for (const auto& track : refTracks_per_collision) { - if (fEMTrackCut.IsSelected(track)) { - float deta = photon.eta() - track.eta(); - float dphi = photon.phi() - track.phi(); - o2::math_utils::bringTo02Pi(dphi); - - fRegistry.fill(HIST("PhotonHadron/same/hs"), photon.pt(), track.pt(), deta, std::cos(cfgNmod * dphi)); - } - } // end of ref track loop - } - } // end of photon loop - for (const auto& g1 : photons1_per_collision) { if (!cut1.template IsSelected(g1)) { continue; @@ -679,24 +690,48 @@ struct DiphotonHadronMPC { if (std::fabs(veeg.Rapidity()) > maxY) { continue; } - fRegistry.fill(HIST("Diphoton/same/hs"), veeg.M(), veeg.Pt()); + + int npair = 0; for (const auto& track : refTracks_per_collision) { + if (pos1.trackId() == track.trackId() || ele1.trackId() == track.trackId()) { + continue; + } + if (pos2.trackId() == track.trackId() || ele2.trackId() == track.trackId()) { + continue; + } + ROOT::Math::PtEtaPhiMVector v3(track.pt(), track.eta(), track.phi(), 0.139); float deta = veeg.Eta() - v3.Eta(); float dphi = veeg.Phi() - v3.Phi(); - o2::math_utils::bringTo02Pi(dphi); - fRegistry.fill(HIST("DiphotonHadron/same/hs"), veeg.M(), veeg.Pt(), v3.Pt(), deta, std::cos(cfgNmod * dphi)); + // o2::math_utils::bringTo02Pi(dphi); + dphi = RecoDecay::constrainAngle(dphi, -M_PI / 2, 1U); + fRegistry.fill(HIST("DiphotonHadron/same/hs"), veeg.M(), veeg.Pt(), v3.Pt(), deta, dphi); + npair++; + + std::pair pair_tmp_ref = std::make_pair(ndf, track.globalIndex()); + if (std::find(used_refTrackIds.begin(), used_refTrackIds.end(), pair_tmp_ref) == used_refTrackIds.end()) { // add a ref track in mixing pool + emh_ref->AddTrackToEventPool(key_df_collision, EMTrack(ndf, track.globalIndex(), collision.globalIndex(), track.globalIndex(), track.pt(), track.eta(), track.phi(), 0.139)); + used_refTrackIds.emplace_back(pair_tmp_ref); + } } // end of ref track loop + if (npair > 0) { + std::tuple tuple_tmp_diphoton = std::make_tuple(ndf, g1.globalIndex(), pos2.trackId(), ele2.trackId()); + if (std::find(used_diphotonIds.begin(), used_diphotonIds.end(), tuple_tmp_diphoton) == used_diphotonIds.end()) { + emh_diphoton->AddTrackToEventPool(key_df_collision, EMTrack(ndf, -1, collision.globalIndex(), -1, veeg.Pt(), veeg.Eta(), veeg.Phi(), veeg.M())); + used_diphotonIds.emplace_back(tuple_tmp_diphoton); + } + } + std::pair pair_tmp_id1 = std::make_pair(ndf, g1.globalIndex()); std::tuple tuple_tmp_id2 = std::make_tuple(ndf, collision.globalIndex(), pos2.trackId(), ele2.trackId()); if (std::find(used_photonIds.begin(), used_photonIds.end(), pair_tmp_id1) == used_photonIds.end()) { - emh1->AddTrackToEventPool(key_df_collision, EMTrack(-1, g1.globalIndex(), collision.globalIndex(), -1, g1.pt(), g1.eta(), g1.phi(), 0)); + emh1->AddTrackToEventPool(key_df_collision, EMTrack(ndf, g1.globalIndex(), collision.globalIndex(), -1, g1.pt(), g1.eta(), g1.phi(), 0)); used_photonIds.emplace_back(pair_tmp_id1); } if (std::find(used_dileptonIds.begin(), used_dileptonIds.end(), tuple_tmp_id2) == used_dileptonIds.end()) { - emh2->AddTrackToEventPool(key_df_collision, EMTrack(-1, -1, collision.globalIndex(), -1, v_ee.Pt(), v_ee.Eta(), v_ee.Phi(), v_ee.M())); + emh2->AddTrackToEventPool(key_df_collision, EMTrack(ndf, -1, collision.globalIndex(), -1, v_ee.Pt(), v_ee.Eta(), v_ee.Phi(), v_ee.M())); used_dileptonIds.emplace_back(tuple_tmp_id2); } ndiphoton++; @@ -704,24 +739,14 @@ struct DiphotonHadronMPC { } // end of g1 loop } // end of pairing in same event - if (nphoton > 0) { - for (const auto& [trg, ref] : combinations(CombinationsStrictlyUpperIndexPolicy(refTracks_per_collision, refTracks_per_collision))) { - if (fEMTrackCut.IsSelected(trg) && fEMTrackCut.IsSelected(ref)) { - float deta = trg.eta() - ref.eta(); - float dphi = trg.phi() - ref.phi(); - o2::math_utils::bringTo02Pi(dphi); - fRegistry.fill(HIST("HadronHadron_for_Photon/same/hs"), trg.pt(), ref.pt(), deta, std::cos(cfgNmod * dphi)); - } - } - } - if (ndiphoton > 0) { - for (const auto& [trg, ref] : combinations(CombinationsStrictlyUpperIndexPolicy(refTracks_per_collision, refTracks_per_collision))) { - if (fEMTrackCut.IsSelected(trg) && fEMTrackCut.IsSelected(ref)) { - float deta = trg.eta() - ref.eta(); - float dphi = trg.phi() - ref.phi(); - o2::math_utils::bringTo02Pi(dphi); - fRegistry.fill(HIST("HadronHadron_for_Diphoton/same/hs"), trg.pt(), ref.pt(), deta, std::cos(cfgNmod * dphi)); + for (const auto& [ref1, ref2] : combinations(CombinationsStrictlyUpperIndexPolicy(refTracks_per_collision, refTracks_per_collision))) { + if (fEMTrackCut.IsSelected(ref1) && fEMTrackCut.IsSelected(ref2)) { + float deta = ref1.eta() - ref2.eta(); + float dphi = ref1.phi() - ref2.phi(); + // o2::math_utils::bringTo02Pi(dphi); + dphi = RecoDecay::constrainAngle(dphi, -M_PI / 2, 1U); + fRegistry.fill(HIST("HadronHadron/same/hs"), ref1.pt(), ref2.pt(), deta, dphi); } } } @@ -734,9 +759,13 @@ struct DiphotonHadronMPC { // make a vector of selected photons in this collision. auto selected_photons1_in_this_event = emh1->GetTracksPerCollision(key_df_collision); auto selected_photons2_in_this_event = emh2->GetTracksPerCollision(key_df_collision); + auto selected_refTracks_in_this_event = emh_ref->GetTracksPerCollision(key_df_collision); + auto selected_diphotons_in_this_event = emh_diphoton->GetTracksPerCollision(key_df_collision); auto collisionIds1_in_mixing_pool = emh1->GetCollisionIdsFromEventPool(key_bin); auto collisionIds2_in_mixing_pool = emh2->GetCollisionIdsFromEventPool(key_bin); + auto collisionIdsRef_in_mixing_pool = emh_ref->GetCollisionIdsFromEventPool(key_bin); + auto collisionIdsDiphoton_in_mixing_pool = emh_diphoton->GetCollisionIdsFromEventPool(key_bin); if constexpr (pairtype == PairType::kPCMPCM) { // same kinds pairing for (const auto& mix_dfId_collisionId : collisionIds1_in_mixing_pool) { @@ -765,11 +794,36 @@ struct DiphotonHadronMPC { if (std::fabs(v12.Rapidity()) > maxY) { continue; } - fRegistry.fill(HIST("Diphoton/mix/hs"), v12.M(), v12.Pt(), 1.f); } } - } // end of loop over mixed event pool + } // end of loop over mixed event pool between photon-photon + + for (const auto& mix_dfId_collisionId : collisionIdsRef_in_mixing_pool) { + int mix_dfId = mix_dfId_collisionId.first; + int64_t mix_collisionId = mix_dfId_collisionId.second; + + if (collision.globalIndex() == mix_collisionId && ndf == mix_dfId) { // this never happens. only protection. + continue; + } + + auto globalBC_mix = map_mixed_eventId_to_globalBC[mix_dfId_collisionId]; + uint64_t diffBC = std::max(collision.globalBC(), globalBC_mix) - std::min(collision.globalBC(), globalBC_mix); + if (diffBC < ndiff_bc_mix) { + continue; + } + + auto refTracks_from_event_pool = emh_ref->GetTracksPerCollision(mix_dfId_collisionId); + for (const auto& trg : selected_diphotons_in_this_event) { + for (const auto& ref : refTracks_from_event_pool) { + float deta = trg.eta() - ref.eta(); + float dphi = trg.phi() - ref.phi(); + // o2::math_utils::bringTo02Pi(dphi); + dphi = RecoDecay::constrainAngle(dphi, -M_PI / 2, 1U); + fRegistry.fill(HIST("DiphotonHadron/mix/hs"), trg.mass(), trg.pt(), ref.pt(), deta, dphi); + } + } + } // end of loop over mixed event pool between diphoton-hadron } else { // [photon1 from event1, photon2 from event2] and [photon1 from event2, photon2 from event1] for (const auto& mix_dfId_collisionId : collisionIds2_in_mixing_pool) { @@ -804,7 +858,8 @@ struct DiphotonHadronMPC { fRegistry.fill(HIST("Diphoton/mix/hs"), v12.M(), v12.Pt(), 1.f); } } - } // end of loop over mixed event pool + } // end of loop over mixed event pool between photon-photon + for (const auto& mix_dfId_collisionId : collisionIds1_in_mixing_pool) { int mix_dfId = mix_dfId_collisionId.first; int64_t mix_collisionId = mix_dfId_collisionId.second; @@ -837,12 +892,67 @@ struct DiphotonHadronMPC { fRegistry.fill(HIST("Diphoton/mix/hs"), v12.M(), v12.Pt(), 1.f); } } - } // end of loop over mixed event pool + } // end of loop over mixed event pool between photon-photon + + for (const auto& mix_dfId_collisionId : collisionIdsRef_in_mixing_pool) { + int mix_dfId = mix_dfId_collisionId.first; + int64_t mix_collisionId = mix_dfId_collisionId.second; + + if (collision.globalIndex() == mix_collisionId && ndf == mix_dfId) { // this never happens. only protection. + continue; + } + + auto globalBC_mix = map_mixed_eventId_to_globalBC[mix_dfId_collisionId]; + uint64_t diffBC = std::max(collision.globalBC(), globalBC_mix) - std::min(collision.globalBC(), globalBC_mix); + if (diffBC < ndiff_bc_mix) { + continue; + } + + auto refTracks_from_event_pool = emh_ref->GetTracksPerCollision(mix_dfId_collisionId); + for (const auto& trg : selected_diphotons_in_this_event) { + for (const auto& ref : refTracks_from_event_pool) { + float deta = trg.eta() - ref.eta(); + float dphi = trg.phi() - ref.phi(); + // o2::math_utils::bringTo02Pi(dphi); + dphi = RecoDecay::constrainAngle(dphi, -M_PI / 2, 1U); + fRegistry.fill(HIST("DiphotonHadron/mix/hs"), trg.mass(), trg.pt(), ref.pt(), deta, dphi); + } + } + } // end of loop over mixed event pool between diphoton-hadron } + // hadron-hadron mixed event + for (const auto& mix_dfId_collisionId : collisionIdsRef_in_mixing_pool) { + int mix_dfId = mix_dfId_collisionId.first; + int64_t mix_collisionId = mix_dfId_collisionId.second; + + if (collision.globalIndex() == mix_collisionId && ndf == mix_dfId) { // this never happens. only protection. + continue; + } + + auto globalBC_mix = map_mixed_eventId_to_globalBC[mix_dfId_collisionId]; + uint64_t diffBC = std::max(collision.globalBC(), globalBC_mix) - std::min(collision.globalBC(), globalBC_mix); + if (diffBC < ndiff_bc_mix) { + continue; + } + + auto refTracks_from_event_pool = emh_ref->GetTracksPerCollision(mix_dfId_collisionId); + for (const auto& ref1 : selected_refTracks_in_this_event) { + for (const auto& ref2 : refTracks_from_event_pool) { + float deta = ref1.eta() - ref2.eta(); + float dphi = ref1.phi() - ref2.phi(); + // o2::math_utils::bringTo02Pi(dphi); + dphi = RecoDecay::constrainAngle(dphi, -M_PI / 2, 1U); + fRegistry.fill(HIST("HadronHadron/mix/hs"), ref1.pt(), ref2.pt(), deta, dphi); + } + } + } // end of loop over mixed event pool between hadron-hadron + if (ndiphoton > 0) { emh1->AddCollisionIdAtLast(key_bin, key_df_collision); emh2->AddCollisionIdAtLast(key_bin, key_df_collision); + emh_diphoton->AddCollisionIdAtLast(key_bin, key_df_collision); + emh_ref->AddCollisionIdAtLast(key_bin, key_df_collision); map_mixed_eventId_to_globalBC[key_df_collision] = collision.globalBC(); } @@ -858,7 +968,7 @@ struct DiphotonHadronMPC { Filter prefilter_primaryelectron = ifnode(dileptoncuts.cfg_apply_cuts_from_prefilter_derived.node(), o2::aod::emprimaryelectron::pfbderived == static_cast(0), true); int ndf = 0; - void process2PC(FilteredMyCollisions const& collisions, MyTracks const& refTracks, Types const&... args) + void processAnalysis(FilteredMyCollisions const& collisions, MyTracks const& refTracks, Types const&... args) { // LOGF(info, "ndf = %d", ndf); if constexpr (pairtype == PairType::kPCMPCM) { @@ -874,10 +984,10 @@ struct DiphotonHadronMPC { } ndf++; } - PROCESS_SWITCH(DiphotonHadronMPC, process2PC, "process pair analysis", true); + PROCESS_SWITCH(DiphotonHadronMPC, processAnalysis, "process pair analysis", true); using FilteredMyCollisionsWithSWT = soa::Filtered; - void process2PCwithTrigger(FilteredMyCollisionsWithSWT const& collisions, MyTracks const& refTracks, Types const&... args) + void processTriggerAnalysis(FilteredMyCollisionsWithSWT const& collisions, MyTracks const& refTracks, Types const&... args) { // LOGF(info, "ndf = %d", ndf); if constexpr (pairtype == PairType::kPCMPCM) { @@ -893,7 +1003,7 @@ struct DiphotonHadronMPC { } ndf++; } - PROCESS_SWITCH(DiphotonHadronMPC, process2PCwithTrigger, "process pair analysis", false); + PROCESS_SWITCH(DiphotonHadronMPC, processTriggerAnalysis, "process pair analysis with software trigger", false); void processDummy(MyCollisions const&) {} PROCESS_SWITCH(DiphotonHadronMPC, processDummy, "Dummy function", false); diff --git a/PWGEM/PhotonMeson/TableProducer/createEMEventPhoton.cxx b/PWGEM/PhotonMeson/TableProducer/createEMEventPhoton.cxx index e1438f423ad..9a6d3be2734 100644 --- a/PWGEM/PhotonMeson/TableProducer/createEMEventPhoton.cxx +++ b/PWGEM/PhotonMeson/TableProducer/createEMEventPhoton.cxx @@ -52,6 +52,7 @@ using MyCollisionsMCCent = soa::Join; struct CreateEMEventPhoton { + Produces embc; Produces event; // Produces eventCov; Produces eventMult; @@ -135,8 +136,14 @@ struct CreateEMEventPhoton { } template - void skimEvent(TCollisions const& collisions, TBCs const&) + void skimEvent(TCollisions const& collisions, TBCs const& bcs) { + for (const auto& bc : bcs) { + if (bc.selection_bit(o2::aod::evsel::kIsTriggerTVX)) { + embc(bc.alias_raw(), bc.selection_raw(), bc.rct_raw()); // TVX is fired. + } + } // end of bc loop + for (const auto& collision : collisions) { if constexpr (isMC) { if (!collision.has_mcCollision()) { @@ -328,11 +335,13 @@ struct AssociatePhotonToEMEvent { Produces prmeleventid; Produces phoseventid; Produces emceventid; + Produces prmtrackeventid; Preslice perCollisionPCM = aod::v0photonkf::collisionId; PresliceUnsorted perCollisionEl = aod::emprimaryelectron::collisionId; Preslice perCollisionPHOS = aod::skimmedcluster::collisionId; Preslice perCollisionEMC = aod::skimmedcluster::collisionId; + PresliceUnsorted perCollisionTrack = aod::emprimarytrack::collisionId; void init(o2::framework::InitContext&) {} @@ -361,6 +370,11 @@ struct AssociatePhotonToEMEvent { fillEventId(collisions, tracks, prmeleventid, perCollisionEl); } + void processChargedTrack(aod::EMEvents const& collisions, aod::EMPrimaryTracks const& tracks) + { + fillEventId(collisions, tracks, prmtrackeventid, perCollisionTrack); + } + void processPHOS(aod::EMEvents const& collisions, aod::PHOSClusters const& photons) { fillEventId(collisions, photons, phoseventid, perCollisionPHOS); From 0041100d7b0879db5ccef48f7325806201498d19 Mon Sep 17 00:00:00 2001 From: Gianni Shigeru Setoue Liveraro <81832939+gianniliveraro@users.noreply.github.com> Date: Fri, 25 Jul 2025 19:34:08 -0300 Subject: [PATCH 075/345] [PWGLF] Improvements in photon deduplication (#12242) Co-authored-by: ALICE Action Bot --- .../TableProducer/Strangeness/CMakeLists.txt | 2 +- .../Strangeness/strangenessbuilder.cxx | 385 ++++++++++++++---- PWGLF/Utils/strangenessBuilderHelper.h | 12 + 3 files changed, 324 insertions(+), 75 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/CMakeLists.txt b/PWGLF/TableProducer/Strangeness/CMakeLists.txt index bc8ba1da673..1224f01df0f 100644 --- a/PWGLF/TableProducer/Strangeness/CMakeLists.txt +++ b/PWGLF/TableProducer/Strangeness/CMakeLists.txt @@ -108,7 +108,7 @@ o2physics_add_dpl_workflow(strangederivedbuilder o2physics_add_dpl_workflow(strangenessbuilder SOURCES strangenessbuilder.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter KFParticle::KFParticle O2Physics::TPCDriftManager + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter KFParticle::KFParticle O2Physics::TPCDriftManager O2Physics::MLCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(v0-selector diff --git a/PWGLF/TableProducer/Strangeness/strangenessbuilder.cxx b/PWGLF/TableProducer/Strangeness/strangenessbuilder.cxx index 0cf07e8de4d..c3f065876a6 100644 --- a/PWGLF/TableProducer/Strangeness/strangenessbuilder.cxx +++ b/PWGLF/TableProducer/Strangeness/strangenessbuilder.cxx @@ -32,25 +32,31 @@ // -- v0builderopts ......: V0-specific building options (topological, deduplication, etc) // -- cascadebuilderopts .: cascade-specific building options (topological, etc) -#include -#include - -#include "Framework/DataSpecUtils.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Common/DataModel/PIDResponse.h" #include "TableHelper.h" -#include "PWGLF/DataModel/LFStrangenessTables.h" + #include "PWGLF/DataModel/LFStrangenessPIDTables.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" #include "PWGLF/Utils/strangenessBuilderHelper.h" + +#include "Common/Core/TPCVDriftManager.h" +#include "Common/DataModel/PIDResponse.h" +#include "Tools/ML/MlResponse.h" +#include "Tools/ML/model.h" + #include "CCDB/BasicCCDBManager.h" -#include "DataFormatsParameters/GRPObject.h" #include "DataFormatsParameters/GRPMagField.h" -#include "Common/Core/TPCVDriftManager.h" +#include "DataFormatsParameters/GRPObject.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/DataSpecUtils.h" +#include "Framework/runDataProcessing.h" + +#include +#include using namespace o2; using namespace o2::framework; +using namespace o2::ml; static constexpr int nParameters = 1; static const std::vector tableNames{ @@ -156,6 +162,9 @@ struct StrangenessBuilder { // helper object o2::pwglf::strangenessBuilderHelper straHelper; + // ML model + o2::ml::OnnxModel deduplication_bdt; + // table index : match order above enum tableIndex { kV0Indices = 0, kV0CoresBase, @@ -291,9 +300,33 @@ struct StrangenessBuilder { Configurable geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; } ccdbConfigurations; - // first order deduplication implementation - // more algorithms to be added as necessary - Configurable deduplicationAlgorithm{"deduplicationAlgorithm", 1, "0: disabled; 1: best pointing angle wins; 2: best DCA daughters wins; 3: best pointing and best DCA wins"}; + // ML options + std::map metadata; + + struct : ConfigurableGroup { + std::string prefix = "DeduplicationOpts"; + + Configurable deduplicationAlgorithm{"deduplicationAlgorithm", 1, + "0: disabled;" + "1: best pointing angle wins;" + "2: best DCA daughters wins;" + "3: best pointing and best DCA wins;" + "4: best BDT score wins;" + "5: selects on PA (not a winner takes it all approach!);" + "6: selects on BDT score (not a winner takes it all approach!)"}; + + // BDT settings + Configurable BDTLocalPath{"BDTLocalPath", "Deduplication_BDTModel.onnx", "(std::string) Path to the local .onnx file."}; + Configurable BDTPathCCDB{"BDTPathCCDB", "Users/g/gsetouel/MLModels2", "Path on CCDB"}; + Configurable timestampCCDB{"timestampCCDB", -1, "timestamp of the ONNX file for ML model used to query in CCDB. Exceptions: > 0 for the specific timestamp, 0 gets the run dependent timestamp"}; + Configurable loadModelsFromCCDB{"loadModelsFromCCDB", false, "Flag to enable or disable the loading of models from CCDB"}; + Configurable enableOptimizations{"enableOptimizations", false, "Enables the ONNX extended model-optimization: sessionOptions.SetGraphOptimizationLevel(GraphOptimizationLevel::ORT_ENABLE_EXTENDED)"}; + + // Selection based duplicates removal + Configurable PAthreshold{"PAthreshold", 0.02, "PA cut to remove duplicates."}; + Configurable BDTthreshold{"BDTthreshold", 0.7, "BDT score cut to remove duplicates."}; + + } DeduplicationOpts; // V0 buffer for V0s used in cascades: master switch // exchanges CPU (generate V0s again) with memory (save pre-generated V0s) @@ -516,6 +549,17 @@ struct StrangenessBuilder { }; mcCascinfo thisCascInfo; //*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+* + // Helper structure to save v0 duplicates auxiliary info + struct V0DuplicateExtra { + bool isBestPA; + bool isBestDCADau; + bool isBestMLScore; + bool isBuildOk; + float PA; + float V0DCAToPVz; + float V0zVtx; + float MLScore; + }; HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -594,6 +638,14 @@ struct StrangenessBuilder { hFindable->GetXaxis()->SetBinLabel(6, "Cascades with collId -1"); } + if (DeduplicationOpts.deduplicationAlgorithm.value > 0) { + histos.add("DeduplicationQA/hMLScore", "hMLScore", kTH1F, {{200, 0.0f, 1.0f}}); + histos.add("DeduplicationQA/hPA", "hPA", kTH1F, {{200, 0.0f, 0.4f}}); + histos.add("DeduplicationQA/hBestPA", "hBestPA", kTH1F, {{200, 0.0f, 0.4f}}); + histos.add("DeduplicationQA/hBestDCADau", "hBestDCADau", kTH1F, {{200, -10.0f, 10.0f}}); + histos.add("DeduplicationQA/hBestMLScore", "hBestMLScore", kTH1F, {{200, 0.0f, 1.0f}}); + } + auto hPrimaryV0s = histos.add("hPrimaryV0s", "hPrimaryV0s", kTH1D, {{2, -0.5f, 1.5f}}); hPrimaryV0s->GetXaxis()->SetBinLabel(1, "All V0s"); hPrimaryV0s->GetXaxis()->SetBinLabel(2, "Primary V0s"); @@ -714,6 +766,24 @@ struct StrangenessBuilder { straHelper.cascadeselections.dcacascdau = cascadeBuilderOpts.dcacascdau; straHelper.cascadeselections.lambdaMassWindow = cascadeBuilderOpts.lambdaMassWindow; straHelper.cascadeselections.maxDaughterEta = cascadeBuilderOpts.maxDaughterEta; + + // Loading BDT model + if (DeduplicationOpts.deduplicationAlgorithm.value == 4 || DeduplicationOpts.deduplicationAlgorithm.value == 6) { + if (DeduplicationOpts.loadModelsFromCCDB) { + + /// Fetching model for specific timestamp + LOG(info) << "Fetching model for timestamp: " << DeduplicationOpts.timestampCCDB.value; + + bool retrieveSuccess = ccdbApi.retrieveBlob(DeduplicationOpts.BDTPathCCDB.value, ".", metadata, DeduplicationOpts.timestampCCDB.value, false, DeduplicationOpts.BDTLocalPath.value); + if (retrieveSuccess) { + deduplication_bdt.initModel(DeduplicationOpts.BDTLocalPath.value, DeduplicationOpts.enableOptimizations.value); + } else { + LOG(fatal) << "Error encountered while fetching/loading the Gamma model from CCDB! Maybe the model doesn't exist yet for this runnumber/timestamp?"; + } + } else { + deduplication_bdt.initModel(DeduplicationOpts.BDTLocalPath.value, DeduplicationOpts.enableOptimizations.value); + } + } } // for sorting @@ -730,6 +800,211 @@ struct StrangenessBuilder { return idx; } + // Simple function to rank vectors based on values + std::vector rankSort(const std::vector& v_temp, bool descending = false) + { + std::vector> v_sort(v_temp.size()); + + // Pair each value with its original index + for (size_t i = 0U; i < v_temp.size(); ++i) { + v_sort[i] = std::make_pair(v_temp[i], i); + } + + // Sort by value - ascending: lowest gets rank 1, descending: highest gets rank 1 + + if (descending) { + std::sort(v_sort.begin(), v_sort.end(), [](const auto& a, const auto& b) { + return a.first > b.first; + }); + } else { + std::sort(v_sort.begin(), v_sort.end(), [](const auto& a, const auto& b) { + return a.first < b.first; + }); + } + + std::pair rank_tracker = std::make_pair(std::numeric_limits::quiet_NaN(), 0); + std::vector result(v_temp.size()); + + for (size_t i = 0U; i < v_sort.size(); ++i) { + // Only update rank if value is different from previous + if (v_sort[i].first != rank_tracker.first) { + rank_tracker = std::make_pair(v_sort[i].first, i + 1); // +1 for 1-based rank + } + result[v_sort[i].second] = rank_tracker.second; // assign rank to original index + } + + return result; + } + + //_______________________________________________________________________ + // Process duplicated photons + template + std::vector processDuplicates(TCollisions const& collisions, TTracks const& tracks, std::vector V0Grouped, size_t iV0) + { + auto pTrack = tracks.rawIteratorAt(V0Grouped[iV0].posTrackId); + auto nTrack = tracks.rawIteratorAt(V0Grouped[iV0].negTrackId); + + bool isPosTPCOnly = (pTrack.hasTPC() && !pTrack.hasITS() && !pTrack.hasTRD() && !pTrack.hasTOF()); + bool isNegTPCOnly = (nTrack.hasTPC() && !nTrack.hasITS() && !nTrack.hasTRD() && !nTrack.hasTOF()); + + // don't try to de-duplicate if no track is TPC only + if (!isPosTPCOnly && !isNegTPCOnly) { + return {}; + } + + // fitness criteria defined here + float bestPointingAngle = 10; // a nonsense angle, anything's better + size_t bestPointingAngleIndex = -1; + + float bestDCADaughters = 1e+3; // an excessively large DCA + size_t bestDCADaughtersIndex = -1; + + float bestMLScore = -1; // a nonsense ML score + size_t bestMLScoreIndex = -1; + + // Defining context variables + int NDuplicates = 0; + float AvgPA = 0.0f; + + // Containers for ranking + std::vector paVec(V0Grouped[iV0].collisionIds.size(), 999.f); + std::vector v0zVec(V0Grouped[iV0].collisionIds.size(), 999.f); + + // Auxiliary vector to store V0 duplicate info + std::vector V0DuplicateExtras; + + // Loop over duplicates + for (size_t ic = 0; ic < V0Grouped[iV0].collisionIds.size(); ic++) { + + // Helper structure to save duplicates info - initializing with dummy values + V0DuplicateExtra v0DuplicateInfo; + v0DuplicateInfo.isBestPA = false; + v0DuplicateInfo.isBestDCADau = false; + v0DuplicateInfo.isBestMLScore = false; + v0DuplicateInfo.isBuildOk = false; + v0DuplicateInfo.PA = 10; + v0DuplicateInfo.V0DCAToPVz = 999.f; + v0DuplicateInfo.V0zVtx = 999.f; + v0DuplicateInfo.MLScore = -1; + + // We include V0DuplicateExtra info in the vector at this point to avoid indexing issues later + V0DuplicateExtras.push_back(v0DuplicateInfo); + + // get track parametrizations, collisions + auto posTrackPar = getTrackParCov(pTrack); + auto negTrackPar = getTrackParCov(nTrack); + auto const& collision = collisions.rawIteratorAt(V0Grouped[iV0].collisionIds[ic]); + + // handle TPC-only tracks properly (photon conversions) + if (v0BuilderOpts.moveTPCOnlyTracks) { + if (isPosTPCOnly) { + // Nota bene: positive is TPC-only -> this entire V0 merits treatment as photon candidate + posTrackPar.setPID(o2::track::PID::Electron); + negTrackPar.setPID(o2::track::PID::Electron); + if (!mVDriftMgr.moveTPCTrack(collision, pTrack, posTrackPar)) { + continue; + } + } + if (isNegTPCOnly) { + // Nota bene: negative is TPC-only -> this entire V0 merits treatment as photon candidate + posTrackPar.setPID(o2::track::PID::Electron); + negTrackPar.setPID(o2::track::PID::Electron); + if (!mVDriftMgr.moveTPCTrack(collision, nTrack, negTrackPar)) { + continue; + } + } + } // end TPC drift treatment + + // process candidate with helper, generate properties for consulting + // : do not apply selections: do as much as possible to preserve + // candidate at this level and do not select with topo selections + if (straHelper.buildV0Candidate(V0Grouped[iV0].collisionIds[ic], collision.posX(), collision.posY(), collision.posZ(), pTrack, nTrack, posTrackPar, negTrackPar, true, false, true)) { + + // candidate built, check pointing angle + if (straHelper.v0.pointingAngle < bestPointingAngle) { + bestPointingAngle = straHelper.v0.pointingAngle; + bestPointingAngleIndex = ic; + } + if (straHelper.v0.daughterDCA < bestDCADaughters) { + bestDCADaughters = straHelper.v0.daughterDCA; + bestDCADaughtersIndex = ic; + } + + // Calculating features for ML Analysis + if (DeduplicationOpts.deduplicationAlgorithm.value == 4 || DeduplicationOpts.deduplicationAlgorithm.value == 6) { + AvgPA += straHelper.v0.pointingAngle; + paVec[ic] = straHelper.v0.pointingAngle; + v0zVec[ic] = std::abs(straHelper.v0.position[2]); + NDuplicates++; + } + + // Updating values in the struct + V0DuplicateExtras[ic].isBuildOk = true; + V0DuplicateExtras[ic].PA = straHelper.v0.pointingAngle; + V0DuplicateExtras[ic].V0DCAToPVz = std::abs(straHelper.v0.v0DCAToPVz); + V0DuplicateExtras[ic].V0zVtx = std::abs(straHelper.v0.position[2]); + } // end build V0 + } // end candidate loop + + // Additional loop to perform ML Analysis if requested + if (DeduplicationOpts.deduplicationAlgorithm.value == 4 || DeduplicationOpts.deduplicationAlgorithm.value == 6) { + + // Preparing features + if (NDuplicates > 0) + AvgPA /= NDuplicates; + + // Get vector of ranks + std::vector paRanks = rankSort(paVec, false); + std::vector v0zRanks = rankSort(v0zVec, false); + + // Fill the ML score for all candidates + for (size_t ic = 0; ic < V0Grouped[iV0].collisionIds.size(); ic++) { + + // Skip if v0 was not built + if (!V0DuplicateExtras[ic].isBuildOk) + continue; + + // Input vector for BDT + std::vector inputFeatures{V0DuplicateExtras[ic].V0DCAToPVz, // 1. V0DCAToPVz + V0DuplicateExtras[ic].PA, // 2. Pointing Angle + V0DuplicateExtras[ic].V0zVtx, // 3. V0 Vtx z-position + static_cast(paRanks[ic]), // 4. Pointing Angle Rank + static_cast(NDuplicates), // 5. N. of Duplicates + AvgPA, // 6. Avg Pointing Angle + static_cast(v0zRanks[ic])}; // 7. V0 Vtx z Rank + + float* BDTProbability = deduplication_bdt.evalModel(inputFeatures); + + if (BDTProbability[1] > bestMLScore) { + bestMLScore = BDTProbability[1]; + bestMLScoreIndex = ic; + } + + // QA histo + histos.fill(HIST("DeduplicationQA/hMLScore"), BDTProbability[1]); + histos.fill(HIST("DeduplicationQA/hPA"), V0DuplicateExtras[ic].PA); + + // Updating BDT score info in the struct + V0DuplicateExtras[ic].MLScore = BDTProbability[1]; + } + } + + histos.fill(HIST("DeduplicationQA/hBestPA"), bestPointingAngle); + histos.fill(HIST("DeduplicationQA/hBestDCADau"), bestDCADaughters); + histos.fill(HIST("DeduplicationQA/hBestMLScore"), bestMLScore); + + // Final step: Defining the winners: + if (bestPointingAngleIndex != static_cast(-1)) + V0DuplicateExtras[bestPointingAngleIndex].isBestPA = true; + if (bestDCADaughtersIndex != static_cast(-1)) + V0DuplicateExtras[bestDCADaughtersIndex].isBestDCADau = true; + if (bestMLScoreIndex != static_cast(-1)) + V0DuplicateExtras[bestMLScoreIndex].isBestMLScore = true; + + // return vector with duplicates info + return V0DuplicateExtras; + } + template bool initCCDB(aod::BCsWithTimestamps const& bcs, TCollisions const& collisions) { @@ -885,7 +1160,7 @@ struct StrangenessBuilder { // keep all unless de-duplication active ao2dV0toV0List.resize(v0s.size(), -1); // -1 means keep, -2 means do not keep - if (deduplicationAlgorithm > 0 && v0BuilderOpts.generatePhotonCandidates) { + if (DeduplicationOpts.deduplicationAlgorithm.value > 0 && v0BuilderOpts.generatePhotonCandidates) { // handle duplicates explicitly: group V0s according to (p,n) indices // will provide a list of collisionIds (in V0group), allowing for // easy de-duplication when passing to the v0List @@ -895,82 +1170,44 @@ struct StrangenessBuilder { // process grouped duplicates, remove 'bad' ones for (size_t iV0 = 0; iV0 < v0tableGrouped.size(); iV0++) { - auto pTrack = tracks.rawIteratorAt(v0tableGrouped[iV0].posTrackId); - auto nTrack = tracks.rawIteratorAt(v0tableGrouped[iV0].negTrackId); - - bool isPosTPCOnly = (pTrack.hasTPC() && !pTrack.hasITS() && !pTrack.hasTRD() && !pTrack.hasTOF()); - bool isNegTPCOnly = (nTrack.hasTPC() && !nTrack.hasITS() && !nTrack.hasTRD() && !nTrack.hasTOF()); // skip single copy V0s if (v0tableGrouped[iV0].collisionIds.size() == 1) { continue; } - // don't try to de-duplicate if no track is TPC only - if (!isPosTPCOnly && !isNegTPCOnly) { + // process duplicates + std::vector deduplicationOutput = processDuplicates(collisions, tracks, v0tableGrouped, iV0); + + // skip if empty + if (deduplicationOutput.empty()) { continue; } - // fitness criteria defined here - float bestPointingAngle = 10; // a nonsense angle, anything's better - size_t bestPointingAngleIndex = -1; - - float bestDCADaughters = 1e+3; // an excessively large DCA - size_t bestDCADaughtersIndex = -1; - - for (size_t ic = 0; ic < v0tableGrouped[iV0].collisionIds.size(); ic++) { - // get track parametrizations, collisions - auto posTrackPar = getTrackParCov(pTrack); - auto negTrackPar = getTrackParCov(nTrack); - auto const& collision = collisions.rawIteratorAt(v0tableGrouped[iV0].collisionIds[ic]); - - // handle TPC-only tracks properly (photon conversions) - if (v0BuilderOpts.moveTPCOnlyTracks) { - if (isPosTPCOnly) { - // Nota bene: positive is TPC-only -> this entire V0 merits treatment as photon candidate - posTrackPar.setPID(o2::track::PID::Electron); - negTrackPar.setPID(o2::track::PID::Electron); - if (!mVDriftMgr.moveTPCTrack(collision, pTrack, posTrackPar)) { - return; - } - } - if (isNegTPCOnly) { - // Nota bene: negative is TPC-only -> this entire V0 merits treatment as photon candidate - posTrackPar.setPID(o2::track::PID::Electron); - negTrackPar.setPID(o2::track::PID::Electron); - if (!mVDriftMgr.moveTPCTrack(collision, nTrack, negTrackPar)) { - return; - } - } - } // end TPC drift treatment - - // process candidate with helper, generate properties for consulting - // : do not apply selections: do as much as possible to preserve - // candidate at this level and do not select with topo selections - if (straHelper.buildV0Candidate(v0tableGrouped[iV0].collisionIds[ic], collision.posX(), collision.posY(), collision.posZ(), pTrack, nTrack, posTrackPar, negTrackPar, true, false, true)) { - // candidate built, check pointing angle - if (straHelper.v0.pointingAngle < bestPointingAngle) { - bestPointingAngle = straHelper.v0.pointingAngle; - bestPointingAngleIndex = ic; - } - if (straHelper.v0.daughterDCA < bestDCADaughters) { - bestDCADaughters = straHelper.v0.daughterDCA; - bestDCADaughtersIndex = ic; - } - } // end build V0 - } // end candidate loop - // mark de-duplicated candidates for (size_t ic = 0; ic < v0tableGrouped[iV0].collisionIds.size(); ic++) { ao2dV0toV0List[v0tableGrouped[iV0].V0Ids[ic]] = -2; // algorithm 1: best pointing angle - if (bestPointingAngleIndex == ic && deduplicationAlgorithm.value == 1) { + if (DeduplicationOpts.deduplicationAlgorithm.value == 1 && deduplicationOutput[ic].isBestPA) { + ao2dV0toV0List[v0tableGrouped[iV0].V0Ids[ic]] = -1; // keep best only + } + // algorithm 2: best DCA between daughters + if (DeduplicationOpts.deduplicationAlgorithm.value == 2 && deduplicationOutput[ic].isBestDCADau) { + ao2dV0toV0List[v0tableGrouped[iV0].V0Ids[ic]] = -1; // keep best only + } + // algorithm 3: best PA AND DCA between daughters + if (DeduplicationOpts.deduplicationAlgorithm.value == 3 && deduplicationOutput[ic].isBestDCADau && deduplicationOutput[ic].isBestPA) { + ao2dV0toV0List[v0tableGrouped[iV0].V0Ids[ic]] = -1; // keep best only + } + // algorithm 4: best ML Score + if (DeduplicationOpts.deduplicationAlgorithm.value == 4 && deduplicationOutput[ic].isBestMLScore) { ao2dV0toV0List[v0tableGrouped[iV0].V0Ids[ic]] = -1; // keep best only } - if (bestDCADaughtersIndex == ic && deduplicationAlgorithm.value == 2) { + // Selection-based duplicate removal + if (DeduplicationOpts.deduplicationAlgorithm.value == 5 && deduplicationOutput[ic].PA <= DeduplicationOpts.PAthreshold) { ao2dV0toV0List[v0tableGrouped[iV0].V0Ids[ic]] = -1; // keep best only } - if (bestDCADaughtersIndex == ic && bestPointingAngleIndex == ic && deduplicationAlgorithm.value == 3) { + if (DeduplicationOpts.deduplicationAlgorithm.value == 6 && deduplicationOutput[ic].MLScore >= DeduplicationOpts.BDTthreshold) { ao2dV0toV0List[v0tableGrouped[iV0].V0Ids[ic]] = -1; // keep best only } } diff --git a/PWGLF/Utils/strangenessBuilderHelper.h b/PWGLF/Utils/strangenessBuilderHelper.h index 85257418e0a..6eda3c07848 100644 --- a/PWGLF/Utils/strangenessBuilderHelper.h +++ b/PWGLF/Utils/strangenessBuilderHelper.h @@ -160,6 +160,8 @@ struct v0candidate { float daughterDCA = 1000.0f; float pointingAngle = 1.0f; float dcaToPV = 0.0f; + float v0DCAToPVxy = 0.0f; + float v0DCAToPVz = 0.0f; // calculated masses for convenience float massGamma; @@ -346,6 +348,16 @@ class strangenessBuilderHelper } fitter.setCollinear(false); // proper cleaning: when exiting this loop, always reset to not collinear + // Calculate DCAToPV of the V0 + o2::track::TrackPar V0Temp = fitter.createParentTrackPar(); + V0Temp.setAbsCharge(0); // charge zero + std::array dcaV0Info; + + // propagate to collision vertex + o2::base::Propagator::Instance()->propagateToDCABxByBz({pvX, pvY, pvZ}, V0Temp, 2.f, fitter.getMatCorrType(), &dcaV0Info); + v0.v0DCAToPVxy = dcaV0Info[0]; + v0.v0DCAToPVz = dcaV0Info[1]; + v0.positiveTrackX = fitter.getTrack(0).getX(); v0.negativeTrackX = fitter.getTrack(1).getX(); positiveTrackParam = fitter.getTrack(0); From fb37352ad898b8e56fdd30f3d88193b7ea9a1eed Mon Sep 17 00:00:00 2001 From: altsybee Date: Sat, 26 Jul 2025 02:35:24 +0200 Subject: [PATCH 076/345] [DPG] more granular binning for kine vs occupancy histos (#12229) --- DPG/Tasks/AOTEvent/detectorOccupancyQa.cxx | 5 +++-- DPG/Tasks/AOTEvent/eventSelectionQa.cxx | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/DPG/Tasks/AOTEvent/detectorOccupancyQa.cxx b/DPG/Tasks/AOTEvent/detectorOccupancyQa.cxx index 123cbd0e442..a47d4dc870f 100644 --- a/DPG/Tasks/AOTEvent/detectorOccupancyQa.cxx +++ b/DPG/Tasks/AOTEvent/detectorOccupancyQa.cxx @@ -260,7 +260,7 @@ struct DetectorOccupancyQaTask { histos.add("track_distr_nITStrThisEv_above_2000/hEta_highOccupInDistantFuture", ";#eta;n tracks", kTH1D, {axisEta}); histos.add("track_distr_nITStrThisEv_above_2000/hEta_highOccupInNeighbourEvents", ";#eta;n tracks", kTH1D, {axisEta}); - const int nPhiBins = 800; + const int nPhiBins = 810; // 18*45 AxisSpec axisPhi{nPhiBins, 0, TMath::TwoPi(), "#varphi"}; // o2-linter: disable=external-pi (temporary fix) histos.add("track_distr_nITStrThisEv_10_200/hPhi_lowOccupInTPC", ";#varphi;n tracks", kTH1D, {axisPhi}); histos.add("track_distr_nITStrThisEv_10_200/hPhi_highOccupInRecentPast", ";#varphi;n tracks", kTH1D, {axisPhi}); @@ -290,7 +290,8 @@ struct DetectorOccupancyQaTask { histos.add("track_distr_nITStrThisEv_above_2000/hPt_highOccupInNeighbourEvents", ";p_{T};n tracks", kTH1D, {axisLogPt}); // July 2025: to compare data and MC (pt, eta, phi) - AxisSpec axisOccupForKine{{0, 500, 1000, 2000, 4000, 6000, 20000}, "weighted occupancy"}; + // AxisSpec axisOccupForKine{{0, 500, 1000, 2000, 4000, 6000, 20000}, "weighted occupancy"}; + AxisSpec axisOccupForKine{{0, 500, 1000, 2000, 4000, 6000, 8000, 10000, 20000}, "weighted occupancy"}; AxisSpec axisPtForKine{{0.2, 0.6, 1.0, 2.0, 10}, "centrality percentile"}; histos.add("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/hPt_pos", ";p_{T};weighted occupancy", kTH2D, {axisLogPt, axisOccupForKine}); histos.add("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/hPt_neg", ";p_{T};weighted occupancy", kTH2D, {axisLogPt, axisOccupForKine}); diff --git a/DPG/Tasks/AOTEvent/eventSelectionQa.cxx b/DPG/Tasks/AOTEvent/eventSelectionQa.cxx index 9626e628b1f..c02ac2deda5 100644 --- a/DPG/Tasks/AOTEvent/eventSelectionQa.cxx +++ b/DPG/Tasks/AOTEvent/eventSelectionQa.cxx @@ -1185,7 +1185,7 @@ struct EventSelectionQaTask { histos.fill(HIST("occupancyQA/tpcNCrossedRows_vs_V0A_vs_occupancy"), multV0A, track.tpcNClsFindable() - tpcNClsFindableMinusCrossedRowsCorrected, occupancyByTracks); } } // end of hasTPC - if (track.tpcNClsFound() > 70 && track.tpcNClsCrossedRows() > 80 && track.itsChi2NCl() < 36 && track.tpcChi2NCl() < 4) { + if (track.tpcNClsFound() > 50 && track.tpcNClsCrossedRows() > 80 && track.itsChi2NCl() < 36 && track.tpcChi2NCl() < 4) { nContributorsAfterEtaTPCCuts++; // ROF border QA histos.fill(HIST("ITSROFborderQA/hFoundBC_kTVX_nITSlayers_for_ITSTPCtracks"), localBC, track.itsNCls()); @@ -1232,7 +1232,7 @@ struct EventSelectionQaTask { continue; if (std::fabs(track.eta()) < 0.8 && track.pt() > 0.2 && track.itsNCls() >= 5) { float signedP = track.sign() * track.tpcInnerParam(); - if (std::fabs(signedP) > 0.38 && std::fabs(signedP) < 0.4 && track.tpcNClsFound() > 70 && track.tpcNClsCrossedRows() > 80 && track.itsChi2NCl() < 36 && track.tpcChi2NCl() < 4) { + if (std::fabs(signedP) > 0.38 && std::fabs(signedP) < 0.4 && track.tpcNClsFound() > 50 && track.tpcNClsCrossedRows() > 80 && track.itsChi2NCl() < 36 && track.tpcChi2NCl() < 4) { float dEdx = track.tpcSignal(); histos.fill(HIST("occupancyQA/dEdx_vs_centr_vs_occup_narrow_p_win"), nPV, occupancyByTracks, dEdx); } From dd9b960ce16058842915ec44919b78631c73fea1 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Sat, 26 Jul 2025 04:35:51 +0200 Subject: [PATCH 077/345] [Common] Improve user-friendliness of autodetect printout (#12239) Co-authored-by: ALICE Builder --- Common/Tools/TrackPropagationModule.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Common/Tools/TrackPropagationModule.h b/Common/Tools/TrackPropagationModule.h index 61ee995b367..d8cc3fd4f28 100644 --- a/Common/Tools/TrackPropagationModule.h +++ b/Common/Tools/TrackPropagationModule.h @@ -103,6 +103,27 @@ class TrackPropagationModule LOGF(info, "Track propagation to PV not required. Suppressing all further processing and logs."); } + LOGF(info, " Track propagation table detection results:"); + LOGF(info, " ---> Will generate Tracks table."); + if (fillTracksCov) { + LOGF(info, "---> Will generate TracksCov table."); + } + if (fillTracksDCA) { + LOGF(info, "---> Will generate TracksDCA table."); + } + if (fillTracksDCACov) { + LOGF(info, "---> Will generate TracksDCACov table."); + } + if (fillTracksCov) { + LOGF(info, "**************************************************************"); + LOGF(info, " Warning: TracksCov has been requested due to a subscription!"); + LOGF(info, " Please be mindful that generating track covariances requires"); + LOGF(info, " a significant extra amount of CPU and memory. If not strictly"); + LOGF(info, " necessary, requesting TracksCov should be avoided to save"); + LOGF(info, " these additional resouces."); + LOGF(info, "**************************************************************"); + } + /// TrackTuner initialization if (cGroup.useTrackTuner.value) { std::string outputStringParams = ""; From c0df1ca1c0621f04c4537469cf47bd1b07a4eee1 Mon Sep 17 00:00:00 2001 From: Zhiyong <71517277+Luzhiyongg@users.noreply.github.com> Date: Sat, 26 Jul 2025 09:14:01 +0200 Subject: [PATCH 078/345] [PWGCF] flowMc: add Ev/Tr sel; flowTask/Dihadron: add multCorr config, roll back to wo PID (#12245) --- PWGCF/Flow/Tasks/flowMc.cxx | 100 ++++++++- PWGCF/Flow/Tasks/flowTask.cxx | 87 +++++--- .../Tasks/diHadronCor.cxx | 195 ++++++++---------- 3 files changed, 241 insertions(+), 141 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowMc.cxx b/PWGCF/Flow/Tasks/flowMc.cxx index b310096ef40..682eeece738 100644 --- a/PWGCF/Flow/Tasks/flowMc.cxx +++ b/PWGCF/Flow/Tasks/flowMc.cxx @@ -54,13 +54,19 @@ struct FlowMc { Configurable minB{"minB", 0.0f, "min impact parameter"}; Configurable maxB{"maxB", 20.0f, "max impact parameter"}; + O2_DEFINE_CONFIGURABLE(cfgCutVertex, float, 10.0f, "Accepted z-vertex range") + O2_DEFINE_CONFIGURABLE(cfgCutPtMin, float, 0.2f, "Minimal pT for tracks") + O2_DEFINE_CONFIGURABLE(cfgCutPtMax, float, 1000.0f, "Maximal pT for tracks") + O2_DEFINE_CONFIGURABLE(cfgCutEta, float, 0.8f, "Eta range for tracks") O2_DEFINE_CONFIGURABLE(cfgOutputNUAWeights, bool, false, "Fill and output NUA weights") O2_DEFINE_CONFIGURABLE(cfgCutPtRefMin, float, 0.2f, "Minimal pT for ref tracks") O2_DEFINE_CONFIGURABLE(cfgCutPtRefMax, float, 3.0f, "Maximal pT for ref tracks") O2_DEFINE_CONFIGURABLE(cfgCutPtPOIMin, float, 0.2f, "Minimal pT for poi tracks") O2_DEFINE_CONFIGURABLE(cfgCutPtPOIMax, float, 10.0f, "Maximal pT for poi tracks") - O2_DEFINE_CONFIGURABLE(cfgCutTPCclu, float, 70.0f, "minimum TPC clusters") - O2_DEFINE_CONFIGURABLE(cfgCutITSclu, float, 6.0f, "minimum ITS clusters") + O2_DEFINE_CONFIGURABLE(cfgCutTPCclu, float, 50.0f, "minimum TPC clusters") + O2_DEFINE_CONFIGURABLE(cfgCutITSclu, float, 5.0f, "minimum ITS clusters") + O2_DEFINE_CONFIGURABLE(cfgCutChi2prTPCcls, float, 2.5f, "max chi2 per TPC clusters") + O2_DEFINE_CONFIGURABLE(cfgCutTPCcrossedrows, float, 70.0f, "minimum TPC crossed rows") O2_DEFINE_CONFIGURABLE(cfgFlowAcceptance, std::string, "", "CCDB path to acceptance object") O2_DEFINE_CONFIGURABLE(cfgFlowEfficiency, std::string, "", "CCDB path to efficiency object") O2_DEFINE_CONFIGURABLE(cfgCentVsIPTruth, std::string, "", "CCDB path to centrality vs IP truth") @@ -70,6 +76,10 @@ struct FlowMc { O2_DEFINE_CONFIGURABLE(cfgFlowCumulantNbootstrap, int, 30, "Number of subsamples") O2_DEFINE_CONFIGURABLE(cfgTrackDensityCorrUse, bool, false, "Use track density efficiency correction") O2_DEFINE_CONFIGURABLE(cfgTrackDensityCorrSlopeFactor, float, 1.0f, "A factor to scale the track density efficiency slope") + O2_DEFINE_CONFIGURABLE(cfgRecoEvRejectMC, bool, false, "reject both MC and Reco events when reco do not pass") + O2_DEFINE_CONFIGURABLE(cfgRecoEvSel8, bool, false, "require sel8 for reconstruction events") + O2_DEFINE_CONFIGURABLE(cfgRecoEvkIsGoodITSLayersAll, bool, false, "require kIsGoodITSLayersAll for reconstruction events") + O2_DEFINE_CONFIGURABLE(cfgRecoEvkNoSameBunchPileup, bool, false, "require kNoSameBunchPileup for reconstruction events") Configurable> cfgTrackDensityP0{"cfgTrackDensityP0", std::vector{0.6003720411, 0.6152630970, 0.6288860646, 0.6360694031, 0.6409494798, 0.6450540203, 0.6482117301, 0.6512592056, 0.6640008690, 0.6862631416, 0.7005738691, 0.7106567432, 0.7170728333}, "parameter 0 for track density efficiency correction"}; Configurable> cfgTrackDensityP1{"cfgTrackDensityP1", std::vector{-1.007592e-05, -8.932635e-06, -9.114538e-06, -1.054818e-05, -1.220212e-05, -1.312304e-05, -1.376433e-05, -1.412813e-05, -1.289562e-05, -1.050065e-05, -8.635725e-06, -7.380821e-06, -6.201250e-06}, "parameter 1 for track density efficiency correction"}; float maxEta = 0.8; @@ -81,6 +91,18 @@ struct FlowMc { ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f}, "pt axis"}; + // Filter for MCcollisions + Filter mccollisionFilter = nabs(aod::mccollision::posZ) < cfgCutVertex; + using FilteredMcCollisions = soa::Filtered; + // Filter for MCParticle + Filter particleFilter = (nabs(aod::mcparticle::eta) < cfgCutEta) && (aod::mcparticle::pt > cfgCutPtMin) && (aod::mcparticle::pt < cfgCutPtMax); + using FilteredMcParticles = soa::Filtered>; + // Filter for reco tracks + Filter trackFilter = (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtMin) && (aod::track::pt < cfgCutPtMax) && (aod::track::tpcChi2NCl < cfgCutChi2prTPCcls); + using FilteredTracks = soa::Filtered>; + + // using FilteredTracks = soa::Join; + // Cent vs IP TH1D* mCentVsIPTruth = nullptr; bool centVsIPTruthLoaded = false; @@ -98,7 +120,6 @@ struct FlowMc { // Connect to ccdb Service ccdb; - Configurable ccdbNoLaterThan{"ccdbNoLaterThan", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; OutputObj fWeights{GFWWeights("weights")}; @@ -110,10 +131,22 @@ struct FlowMc { std::vector corrconfigsTruth; std::vector corrconfigsReco; TRandom3* fRndm = new TRandom3(0); + double epsilon = 1e-6; void init(InitContext&) { + ccdb->setURL(ccdbUrl.value); + ccdb->setCaching(true); + auto now = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); + ccdb->setCreatedNotAfter(now); + + const AxisSpec axisVertex{20, -10, 10, "Vtxz (cm)"}; + const AxisSpec axisEta{20, -1., 1., "#eta"}; + const AxisSpec axisCounter{1, 0, +1, ""}; // QA histograms + histos.add("mcEventCounter", "Monte Carlo Truth EventCounter", HistType::kTH1F, {axisCounter}); + histos.add("numberOfRecoCollisions", "numberOfRecoCollisions", HistType::kTH1F, {{10, -0.5f, 9.5f}}); + histos.add("RecoEventCounter", "Reconstruction EventCounter", HistType::kTH1F, {axisCounter}); histos.add("hnTPCClu", "Number of found TPC clusters", HistType::kTH1D, {{100, 40, 180}}); histos.add("hnITSClu", "Number of found ITS clusters", HistType::kTH1D, {{100, 0, 20}}); // pT histograms @@ -156,7 +189,9 @@ struct FlowMc { histos.add("hPtNchGeneratedLambda", "Reco production; pT (GeV/c); multiplicity", HistType::kTH2D, {axisPt, axisNch}); histos.add("hPtNchGlobalLambda", "Global production; pT (GeV/c); multiplicity", HistType::kTH2D, {axisPt, axisNch}); histos.add("hPtMCGen", "Monte Carlo Truth; pT (GeV/c);", {HistType::kTH1D, {axisPt}}); + histos.add("hEtaPtVtxzMCGen", "Monte Carlo Truth; #eta; p_{T} (GeV/c); V_{z} (cm);", {HistType::kTH3D, {axisEta, axisPt, axisVertex}}); histos.add("hPtMCGlobal", "Monte Carlo Global; pT (GeV/c);", {HistType::kTH1D, {axisPt}}); + histos.add("hEtaPtVtxzMCGlobal", "Monte Carlo Global; #eta; p_{T} (GeV/c); V_{z} (cm);", {HistType::kTH3D, {axisEta, axisPt, axisVertex}}); histos.add("hPhiWeightedTrDen", "corrected #phi distribution, considering track density", {HistType::kTH1D, {axisPhi}}); o2::framework::AxisSpec axis = axisPt; @@ -318,9 +353,35 @@ struct FlowMc { } } - using RecoTracks = soa::Join; + template + bool eventSelected(TCollision collision) + { + if (std::fabs(collision.posZ()) > cfgCutVertex) { + return 0; + } + if (cfgRecoEvSel8 && !collision.sel8()) { + return 0; + } + if (cfgRecoEvkNoSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + // rejects collisions which are associated with the same "found-by-T0" bunch crossing + // https://indico.cern.ch/event/1396220/#1-event-selection-with-its-rof + return 0; + } + if (cfgRecoEvkIsGoodITSLayersAll && !collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + // from Jan 9 2025 AOT meeting + // cut time intervals with dead ITS staves + return 0; + } + return 1; + } + + template + bool trackSelected(TTrack track) + { + return ((track.tpcNClsFound() >= cfgCutTPCclu) && (track.tpcNClsCrossedRows() >= cfgCutTPCcrossedrows) && (track.itsNCls() >= cfgCutITSclu)); + } - void process(aod::McCollision const& mcCollision, aod::BCsWithTimestamps const&, soa::Join const& mcParticles, RecoTracks const&) + void process(FilteredMcCollisions::iterator const& mcCollision, aod::BCsWithTimestamps const&, soa::SmallGroups> const& collisions, FilteredMcParticles const& mcParticles, FilteredTracks const&) { float imp = mcCollision.impactParameter(); @@ -337,6 +398,21 @@ struct FlowMc { auto bc = mcCollision.bc_as(); loadCorrections(bc.timestamp()); + if (collisions.size() > -1) { + histos.fill(HIST("mcEventCounter"), 0.5); + histos.fill(HIST("numberOfRecoCollisions"), collisions.size()); // number of times coll was reco-ed + if (cfgRecoEvRejectMC) { + if (collisions.size() != 1) { // only pass those have one reconstruction event + return; + } + for (auto const& collision : collisions) { + if (!eventSelected(collision)) + return; + } + } + histos.fill(HIST("RecoEventCounter"), 0.5); + } + if (imp > minB && imp < maxB) { // event within range histos.fill(HIST("hImpactParameter"), imp); @@ -363,9 +439,9 @@ struct FlowMc { if (std::fabs(mcParticle.eta()) > maxEta) // main acceptance continue; if (mcParticle.has_tracks()) { - auto const& tracks = mcParticle.tracks_as(); + auto const& tracks = mcParticle.tracks_as(); for (auto const& track : tracks) { - if (!((track.tpcNClsFound() >= cfgCutTPCclu) && (track.itsNCls() >= cfgCutITSclu))) { + if (!trackSelected(track)) { continue; } if (cfgIsGlobalTrack && track.isGlobalTrack()) { @@ -418,6 +494,7 @@ struct FlowMc { histos.fill(HIST("hBVsPtVsPhiGenerated"), imp, deltaPhi, mcParticle.pt()); histos.fill(HIST("hPtNchGenerated"), mcParticle.pt(), nChGlobal); histos.fill(HIST("hPtMCGen"), mcParticle.pt()); + histos.fill(HIST("hEtaPtVtxzMCGen"), mcParticle.eta(), mcParticle.pt(), vtxz); if (pdgCode == PDG_t::kPiPlus) histos.fill(HIST("hPtNchGeneratedPion"), mcParticle.pt(), nChGlobal); if (pdgCode == PDG_t::kKPlus) @@ -437,9 +514,9 @@ struct FlowMc { bool validITSTrack = false; bool validITSABTrack = false; if (mcParticle.has_tracks()) { - auto const& tracks = mcParticle.tracks_as(); + auto const& tracks = mcParticle.tracks_as(); for (auto const& track : tracks) { - if (!((track.tpcNClsFound() >= cfgCutTPCclu) && (track.itsNCls() >= cfgCutITSclu))) { + if (!trackSelected(track)) { continue; } histos.fill(HIST("hnTPCClu"), track.tpcNClsFound()); @@ -456,10 +533,10 @@ struct FlowMc { if (track.hasTPC()) { validTPCTrack = true; } - if (track.hasITS() && track.itsChi2NCl() > -1e-6) { + if (track.hasITS() && track.itsChi2NCl() > -1. * epsilon) { validITSTrack = true; } - if (track.hasITS() && track.itsChi2NCl() < -1e-6) { + if (track.hasITS() && track.itsChi2NCl() < -1. * epsilon) { validITSABTrack = true; } } @@ -519,6 +596,7 @@ struct FlowMc { histos.fill(HIST("hBVsPtVsPhiGlobal"), imp, deltaPhi, mcParticle.pt(), wacc * weff); histos.fill(HIST("hPtNchGlobal"), mcParticle.pt(), nChGlobal); histos.fill(HIST("hPtMCGlobal"), mcParticle.pt()); + histos.fill(HIST("hEtaPtVtxzMCGlobal"), mcParticle.eta(), mcParticle.pt(), vtxz); if (pdgCode == PDG_t::kPiPlus) histos.fill(HIST("hPtNchGlobalPion"), mcParticle.pt(), nChGlobal); if (pdgCode == PDG_t::kKPlus) diff --git a/PWGCF/Flow/Tasks/flowTask.cxx b/PWGCF/Flow/Tasks/flowTask.cxx index b552add5223..158cb8820d9 100644 --- a/PWGCF/Flow/Tasks/flowTask.cxx +++ b/PWGCF/Flow/Tasks/flowTask.cxx @@ -110,8 +110,23 @@ struct FlowTask { Configurable> cfgUserDefineGFWName{"cfgUserDefineGFWName", std::vector{"Ch02Gap22", "Ch12Gap22"}, "User defined GFW Name"}; Configurable cfgUserPtVnCorrConfig{"cfgUserPtVnCorrConfig", {{"refP {2} refN {-2}", "refP {3} refN {-3}"}, {"ChGap22", "ChGap32"}, {0, 0}, {3, 3}}, "Configurations for vn-pt correlations"}; Configurable> cfgRunRemoveList{"cfgRunRemoveList", std::vector{-1}, "excluded run numbers"}; - Configurable> cfgTrackDensityP0{"cfgTrackDensityP0", std::vector{0.7217476707, 0.7384792571, 0.7542625668, 0.7640680200, 0.7701951667, 0.7755299053, 0.7805901710, 0.7849446786, 0.7957356586, 0.8113039262, 0.8211968966, 0.8280558878, 0.8329342135}, "parameter 0 for track density efficiency correction"}; - Configurable> cfgTrackDensityP1{"cfgTrackDensityP1", std::vector{-2.169488e-05, -2.191913e-05, -2.295484e-05, -2.556538e-05, -2.754463e-05, -2.816832e-05, -2.846502e-05, -2.843857e-05, -2.705974e-05, -2.477018e-05, -2.321730e-05, -2.203315e-05, -2.109474e-05}, "parameter 1 for track density efficiency correction"}; + struct : ConfigurableGroup { + Configurable> cfgTrackDensityP0{"cfgTrackDensityP0", std::vector{0.7217476707, 0.7384792571, 0.7542625668, 0.7640680200, 0.7701951667, 0.7755299053, 0.7805901710, 0.7849446786, 0.7957356586, 0.8113039262, 0.8211968966, 0.8280558878, 0.8329342135}, "parameter 0 for track density efficiency correction"}; + Configurable> cfgTrackDensityP1{"cfgTrackDensityP1", std::vector{-2.169488e-05, -2.191913e-05, -2.295484e-05, -2.556538e-05, -2.754463e-05, -2.816832e-05, -2.846502e-05, -2.843857e-05, -2.705974e-05, -2.477018e-05, -2.321730e-05, -2.203315e-05, -2.109474e-05}, "parameter 1 for track density efficiency correction"}; + O2_DEFINE_CONFIGURABLE(cfgMultCentHighCutFunction, std::string, "[0] + [1]*x + [2]*x*x + [3]*x*x*x + [4]*x*x*x*x + 10.*([5] + [6]*x + [7]*x*x + [8]*x*x*x + [9]*x*x*x*x)", "Functional for multiplicity correlation cut"); + O2_DEFINE_CONFIGURABLE(cfgMultCentLowCutFunction, std::string, "[0] + [1]*x + [2]*x*x + [3]*x*x*x + [4]*x*x*x*x - 3.*([5] + [6]*x + [7]*x*x + [8]*x*x*x + [9]*x*x*x*x)", "Functional for multiplicity correlation cut"); + O2_DEFINE_CONFIGURABLE(cfgMultT0CCutEnabled, bool, false, "Enable Global multiplicity vs T0C centrality cut") + Configurable> cfgMultT0CCutPars{"cfgMultT0CCutPars", std::vector{143.04, -4.58368, 0.0766055, -0.000727796, 2.86153e-06, 23.3108, -0.36304, 0.00437706, -4.717e-05, 1.98332e-07}, "Global multiplicity vs T0C centrality cut parameter values"}; + O2_DEFINE_CONFIGURABLE(cfgMultPVT0CCutEnabled, bool, false, "Enable PV multiplicity vs T0C centrality cut") + Configurable> cfgMultPVT0CCutPars{"cfgMultPVT0CCutPars", std::vector{195.357, -6.15194, 0.101313, -0.000955828, 3.74793e-06, 30.0326, -0.43322, 0.00476265, -5.11206e-05, 2.13613e-07}, "PV multiplicity vs T0C centrality cut parameter values"}; + O2_DEFINE_CONFIGURABLE(cfgMultMultHighCutFunction, std::string, "[0]+[1]*x + 5.*([2]+[3]*x)", "Functional for multiplicity correlation cut"); + O2_DEFINE_CONFIGURABLE(cfgMultMultLowCutFunction, std::string, "[0]+[1]*x - 5.*([2]+[3]*x)", "Functional for multiplicity correlation cut"); + O2_DEFINE_CONFIGURABLE(cfgMultGlobalPVCutEnabled, bool, false, "Enable global multiplicity vs PV multiplicity cut") + Configurable> cfgMultGlobalPVCutPars{"cfgMultGlobalPVCutPars", std::vector{-0.140809, 0.734344, 2.77495, 0.0165935}, "PV multiplicity vs T0C centrality cut parameter values"}; + std::vector multT0CCutPars; + std::vector multPVT0CCutPars; + std::vector multGlobalPVCutPars; + } cfgFuncParas; ConfigurableAxis axisPtHist{"axisPtHist", {100, 0., 10.}, "pt axis for histograms"}; ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.2, 2.4, 2.6, 2.8, 3, 3.5, 4, 5, 6, 8, 10}, "pt axis for histograms"}; @@ -184,10 +199,12 @@ struct FlowTask { TF1* funcV4; // Additional Event selection cuts - Copy from flowGenericFramework.cxx - TF1* fMultPVCutLow = nullptr; - TF1* fMultPVCutHigh = nullptr; - TF1* fMultCutLow = nullptr; - TF1* fMultCutHigh = nullptr; + TF1* fMultPVT0CCutLow = nullptr; + TF1* fMultPVT0CCutHigh = nullptr; + TF1* fMultT0CCutLow = nullptr; + TF1* fMultT0CCutHigh = nullptr; + TF1* fMultGlobalPVCutLow = nullptr; + TF1* fMultGlobalPVCutHigh = nullptr; TF1* fT0AV0AMean = nullptr; TF1* fT0AV0ASigma = nullptr; @@ -448,16 +465,24 @@ struct FlowTask { } fGFW->CreateRegions(); - if (cfgUseAdditionalEventCut) { - fMultPVCutLow = new TF1("fMultPVCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x - 3.5*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", 0, 100); - fMultPVCutLow->SetParameters(3257.29, -121.848, 1.98492, -0.0172128, 6.47528e-05, 154.756, -1.86072, -0.0274713, 0.000633499, -3.37757e-06); - fMultPVCutHigh = new TF1("fMultPVCutHigh", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x + 3.5*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", 0, 100); - fMultPVCutHigh->SetParameters(3257.29, -121.848, 1.98492, -0.0172128, 6.47528e-05, 154.756, -1.86072, -0.0274713, 0.000633499, -3.37757e-06); - - fMultCutLow = new TF1("fMultCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x - 2.*([4]+[5]*x+[6]*x*x+[7]*x*x*x+[8]*x*x*x*x)", 0, 100); - fMultCutLow->SetParameters(1654.46, -47.2379, 0.449833, -0.0014125, 150.773, -3.67334, 0.0530503, -0.000614061, 3.15956e-06); - fMultCutHigh = new TF1("fMultCutHigh", "[0]+[1]*x+[2]*x*x+[3]*x*x*x + 3.*([4]+[5]*x+[6]*x*x+[7]*x*x*x+[8]*x*x*x*x)", 0, 100); - fMultCutHigh->SetParameters(1654.46, -47.2379, 0.449833, -0.0014125, 150.773, -3.67334, 0.0530503, -0.000614061, 3.15956e-06); + if (cfgEvSelMultCorrelation) { + cfgFuncParas.multT0CCutPars = cfgFuncParas.cfgMultT0CCutPars; + cfgFuncParas.multPVT0CCutPars = cfgFuncParas.cfgMultPVT0CCutPars; + cfgFuncParas.multGlobalPVCutPars = cfgFuncParas.cfgMultGlobalPVCutPars; + fMultPVT0CCutLow = new TF1("fMultPVT0CCutLow", cfgFuncParas.cfgMultCentLowCutFunction->c_str(), 0, 100); + fMultPVT0CCutLow->SetParameters(&(cfgFuncParas.multPVT0CCutPars[0])); + fMultPVT0CCutHigh = new TF1("fMultPVT0CCutHigh", cfgFuncParas.cfgMultCentHighCutFunction->c_str(), 0, 100); + fMultPVT0CCutHigh->SetParameters(&(cfgFuncParas.multPVT0CCutPars[0])); + + fMultT0CCutLow = new TF1("fMultT0CCutLow", cfgFuncParas.cfgMultCentLowCutFunction->c_str(), 0, 100); + fMultT0CCutLow->SetParameters(&(cfgFuncParas.multT0CCutPars[0])); + fMultT0CCutHigh = new TF1("fMultT0CCutHigh", cfgFuncParas.cfgMultCentHighCutFunction->c_str(), 0, 100); + fMultT0CCutHigh->SetParameters(&(cfgFuncParas.multT0CCutPars[0])); + + fMultGlobalPVCutLow = new TF1("fMultGlobalPVCutLow", cfgFuncParas.cfgMultMultLowCutFunction->c_str(), 0, 4000); + fMultGlobalPVCutLow->SetParameters(&(cfgFuncParas.multGlobalPVCutPars[0])); + fMultGlobalPVCutHigh = new TF1("fMultGlobalPVCutHigh", cfgFuncParas.cfgMultMultHighCutFunction->c_str(), 0, 4000); + fMultGlobalPVCutHigh->SetParameters(&(cfgFuncParas.multGlobalPVCutPars[0])); fT0AV0AMean = new TF1("fT0AV0AMean", "[0]+[1]*x", 0, 200000); fT0AV0AMean->SetParameters(-1601.0581, 9.417652e-01); @@ -470,8 +495,8 @@ struct FlowTask { hFindPtBin = new TH1D("hFindPtBin", "hFindPtBin", pTEffBins.size() - 1, &pTEffBins[0]); funcEff.resize(pTEffBins.size() - 1); // LHC24g3 Eff - std::vector f1p0 = cfgTrackDensityP0; - std::vector f1p1 = cfgTrackDensityP1; + std::vector f1p0 = cfgFuncParas.cfgTrackDensityP0; + std::vector f1p1 = cfgFuncParas.cfgTrackDensityP1; for (uint ifunc = 0; ifunc < pTEffBins.size() - 1; ifunc++) { funcEff[ifunc] = new TF1(Form("funcEff%i", ifunc), "[0]+[1]*x", 0, 3000); funcEff[ifunc]->SetParameters(f1p0[ifunc], f1p1[ifunc]); @@ -656,14 +681,24 @@ struct FlowTask { registry.fill(HIST("hEventCountSpecific"), 9.5); if (cfgEvSelMultCorrelation) { - if (multNTracksPV < fMultPVCutLow->Eval(centrality)) - return 0; - if (multNTracksPV > fMultPVCutHigh->Eval(centrality)) - return 0; - if (multTrk < fMultCutLow->Eval(centrality)) - return 0; - if (multTrk > fMultCutHigh->Eval(centrality)) - return 0; + if (cfgFuncParas.cfgMultPVT0CCutEnabled) { + if (multNTracksPV < fMultPVT0CCutLow->Eval(centrality)) + return 0; + if (multNTracksPV > fMultPVT0CCutHigh->Eval(centrality)) + return 0; + } + if (cfgFuncParas.cfgMultT0CCutEnabled) { + if (multTrk < fMultT0CCutLow->Eval(centrality)) + return 0; + if (multTrk > fMultT0CCutHigh->Eval(centrality)) + return 0; + } + if (cfgFuncParas.cfgMultGlobalPVCutEnabled) { + if (multTrk < fMultGlobalPVCutLow->Eval(multNTracksPV)) + return 0; + if (multTrk > fMultGlobalPVCutHigh->Eval(multNTracksPV)) + return 0; + } } if (cfgEvSelMultCorrelation) registry.fill(HIST("hEventCountSpecific"), 10.5); diff --git a/PWGCF/TwoParticleCorrelations/Tasks/diHadronCor.cxx b/PWGCF/TwoParticleCorrelations/Tasks/diHadronCor.cxx index 6a1b61718f2..d47aff3c749 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/diHadronCor.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/diHadronCor.cxx @@ -28,7 +28,6 @@ #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/PIDResponse.h" -#include "Common/DataModel/PIDResponseITS.h" #include "Common/DataModel/TrackSelectionTables.h" #include "CommonConstants/MathConstants.h" @@ -41,8 +40,6 @@ #include "Framework/RunningWorkflowInfo.h" #include "Framework/StepTHn.h" #include "Framework/runDataProcessing.h" -#include "ReconstructionDataFormats/PID.h" -#include "ReconstructionDataFormats/Track.h" #include #include "TF1.h" @@ -98,14 +95,27 @@ struct DiHadronCor { O2_DEFINE_CONFIGURABLE(cfgCutOccupancyHigh, int, 2000, "High cut on TPC occupancy") O2_DEFINE_CONFIGURABLE(cfgCutOccupancyLow, int, 0, "Low cut on TPC occupancy") O2_DEFINE_CONFIGURABLE(cfgEfficiency, std::string, "", "CCDB path to efficiency object") + O2_DEFINE_CONFIGURABLE(cfgCentralityWeight, std::string, "", "CCDB path to centrality weight object") O2_DEFINE_CONFIGURABLE(cfgLocalEfficiency, bool, false, "Use local efficiency object") O2_DEFINE_CONFIGURABLE(cfgVerbosity, bool, false, "Verbose output") O2_DEFINE_CONFIGURABLE(cfgUseEventWeights, bool, false, "Use event weights for mixed event") O2_DEFINE_CONFIGURABLE(cfgUsePtOrder, bool, true, "enable trigger pT < associated pT cut") O2_DEFINE_CONFIGURABLE(cfgUsePtOrderInMixEvent, bool, true, "enable trigger pT < associated pT cut in mixed event") - O2_DEFINE_CONFIGURABLE(cfgPIDUseITSPID, bool, true, "Use ITS PID for particle identification") - O2_DEFINE_CONFIGURABLE(cfgPIDTofPtCut, float, 0.5f, "Minimum pt to use TOF N-sigma") - O2_DEFINE_CONFIGURABLE(cfgPIDParticle, int, 0, "1 = pion, 2 = kaon, 3 = proton, 0 for no PID") + struct : ConfigurableGroup { + O2_DEFINE_CONFIGURABLE(cfgMultCentHighCutFunction, std::string, "[0] + [1]*x + [2]*x*x + [3]*x*x*x + [4]*x*x*x*x + 10.*([5] + [6]*x + [7]*x*x + [8]*x*x*x + [9]*x*x*x*x)", "Functional for multiplicity correlation cut"); + O2_DEFINE_CONFIGURABLE(cfgMultCentLowCutFunction, std::string, "[0] + [1]*x + [2]*x*x + [3]*x*x*x + [4]*x*x*x*x - 3.*([5] + [6]*x + [7]*x*x + [8]*x*x*x + [9]*x*x*x*x)", "Functional for multiplicity correlation cut"); + O2_DEFINE_CONFIGURABLE(cfgMultT0CCutEnabled, bool, false, "Enable Global multiplicity vs T0C centrality cut") + Configurable> cfgMultT0CCutPars{"cfgMultT0CCutPars", std::vector{143.04, -4.58368, 0.0766055, -0.000727796, 2.86153e-06, 23.3108, -0.36304, 0.00437706, -4.717e-05, 1.98332e-07}, "Global multiplicity vs T0C centrality cut parameter values"}; + O2_DEFINE_CONFIGURABLE(cfgMultPVT0CCutEnabled, bool, false, "Enable PV multiplicity vs T0C centrality cut") + Configurable> cfgMultPVT0CCutPars{"cfgMultPVT0CCutPars", std::vector{195.357, -6.15194, 0.101313, -0.000955828, 3.74793e-06, 30.0326, -0.43322, 0.00476265, -5.11206e-05, 2.13613e-07}, "PV multiplicity vs T0C centrality cut parameter values"}; + O2_DEFINE_CONFIGURABLE(cfgMultMultHighCutFunction, std::string, "[0]+[1]*x + 5.*([2]+[3]*x)", "Functional for multiplicity correlation cut"); + O2_DEFINE_CONFIGURABLE(cfgMultMultLowCutFunction, std::string, "[0]+[1]*x - 5.*([2]+[3]*x)", "Functional for multiplicity correlation cut"); + O2_DEFINE_CONFIGURABLE(cfgMultGlobalPVCutEnabled, bool, false, "Enable global multiplicity vs PV multiplicity cut") + Configurable> cfgMultGlobalPVCutPars{"cfgMultGlobalPVCutPars", std::vector{-0.140809, 0.734344, 2.77495, 0.0165935}, "PV multiplicity vs T0C centrality cut parameter values"}; + std::vector multT0CCutPars; + std::vector multPVT0CCutPars; + std::vector multGlobalPVCutPars; + } cfgFuncParas; SliceCache cache; @@ -120,9 +130,6 @@ struct DiHadronCor { ConfigurableAxis axisVtxMix{"axisVtxMix", {VARIABLE_WIDTH, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, "vertex axis for mixed event histograms"}; ConfigurableAxis axisMultMix{"axisMultMix", {VARIABLE_WIDTH, 0, 10, 20, 40, 60, 80, 100, 120, 140, 160, 180, 200, 220, 240, 260}, "multiplicity / centrality axis for mixed event histograms"}; ConfigurableAxis axisSample{"axisSample", {cfgSampleSize, 0, cfgSampleSize}, "sample axis for histograms"}; - Configurable> pidTofNsigmaCut{"pidTofNsigmaCut", std::vector{1.5, 1.5, 1.5, -1.5, -1.5, -1.5}, "TOF n-sigma cut for pions_posNsigma, kaons_posNsigma, protons_posNsigma, pions_negNsigma, kaons_negNsigma, protons_negNsigma"}; - Configurable> pidItsNsigmaCut{"pidItsNsigmaCut", std::vector{3, 3, 3, -3, -3, -3}, "ITS n-sigma cut for pions_posNsigma, kaons_posNsigma, protons_posNsigma, pions_negNsigma, kaons_negNsigma, protons_negNsigma"}; - Configurable> pidTpcNsigmaCut{"pidTpcNsigmaCut", std::vector{10, 10, 10, -10, -10, -10}, "TOF n-sigma cut for pions_posNsigma, kaons_posNsigma, protons_posNsigma, pions_negNsigma, kaons_negNsigma, protons_negNsigma"}; ConfigurableAxis axisVertexEfficiency{"axisVertexEfficiency", {10, -10, 10}, "vertex axis for efficiency histograms"}; ConfigurableAxis axisEtaEfficiency{"axisEtaEfficiency", {20, -1.0, 1.0}, "eta axis for efficiency histograms"}; @@ -132,7 +139,7 @@ struct DiHadronCor { Filter collisionFilter = (nabs(aod::collision::posZ) < cfgCutVtxZ); Filter trackFilter = (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtMin) && (aod::track::pt < cfgCutPtMax) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t) true)) && (aod::track::tpcChi2NCl < cfgCutChi2prTPCcls) && (nabs(aod::track::dcaZ) < cfgCutDCAz); using FilteredCollisions = soa::Filtered>; - using FilteredTracks = soa::Filtered>; + using FilteredTracks = soa::Filtered>; using FilteredTracksWithMCLabels = soa::Filtered>; // Filter for MCParticle @@ -150,6 +157,7 @@ struct DiHadronCor { // Corrections TH3D* mEfficiency = nullptr; + TH1D* mCentralityWeight = nullptr; bool correctionsLoaded = false; // Define the outputs @@ -171,25 +179,17 @@ struct DiHadronCor { SameEvent = 1, MixedEvent = 3 }; - std::vector tofNsigmaCut; - std::vector itsNsigmaCut; - std::vector tpcNsigmaCut; - o2::aod::ITSResponse itsResponse; - enum Particles { - PIONS, - KAONS, - PROTONS - }; // persistent caches std::vector efficiencyAssociatedCache; // Additional Event selection cuts - Copy from flowGenericFramework.cxx - TF1* fMultPVCutLow = nullptr; - TF1* fMultPVCutHigh = nullptr; - TF1* fMultCutLow = nullptr; - TF1* fMultCutHigh = nullptr; - TF1* fMultMultPVCut = nullptr; + TF1* fMultPVT0CCutLow = nullptr; + TF1* fMultPVT0CCutHigh = nullptr; + TF1* fMultT0CCutLow = nullptr; + TF1* fMultT0CCutHigh = nullptr; + TF1* fMultGlobalPVCutLow = nullptr; + TF1* fMultGlobalPVCutHigh = nullptr; TF1* fT0AV0AMean = nullptr; TF1* fT0AV0ASigma = nullptr; @@ -225,16 +225,24 @@ struct DiHadronCor { registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(12, "cfgEvSelV0AT0ACut"); } - if (cfgUseAdditionalEventCut) { - fMultPVCutLow = new TF1("fMultPVCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x - 3.5*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", 0, 100); - fMultPVCutLow->SetParameters(3257.29, -121.848, 1.98492, -0.0172128, 6.47528e-05, 154.756, -1.86072, -0.0274713, 0.000633499, -3.37757e-06); - fMultPVCutHigh = new TF1("fMultPVCutHigh", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x + 3.5*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", 0, 100); - fMultPVCutHigh->SetParameters(3257.29, -121.848, 1.98492, -0.0172128, 6.47528e-05, 154.756, -1.86072, -0.0274713, 0.000633499, -3.37757e-06); - - fMultCutLow = new TF1("fMultCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x - 2.*([4]+[5]*x+[6]*x*x+[7]*x*x*x+[8]*x*x*x*x)", 0, 100); - fMultCutLow->SetParameters(1654.46, -47.2379, 0.449833, -0.0014125, 150.773, -3.67334, 0.0530503, -0.000614061, 3.15956e-06); - fMultCutHigh = new TF1("fMultCutHigh", "[0]+[1]*x+[2]*x*x+[3]*x*x*x + 3.*([4]+[5]*x+[6]*x*x+[7]*x*x*x+[8]*x*x*x*x)", 0, 100); - fMultCutHigh->SetParameters(1654.46, -47.2379, 0.449833, -0.0014125, 150.773, -3.67334, 0.0530503, -0.000614061, 3.15956e-06); + if (cfgEvSelMultCorrelation) { + cfgFuncParas.multT0CCutPars = cfgFuncParas.cfgMultT0CCutPars; + cfgFuncParas.multPVT0CCutPars = cfgFuncParas.cfgMultPVT0CCutPars; + cfgFuncParas.multGlobalPVCutPars = cfgFuncParas.cfgMultGlobalPVCutPars; + fMultPVT0CCutLow = new TF1("fMultPVT0CCutLow", cfgFuncParas.cfgMultCentLowCutFunction->c_str(), 0, 100); + fMultPVT0CCutLow->SetParameters(&(cfgFuncParas.multPVT0CCutPars[0])); + fMultPVT0CCutHigh = new TF1("fMultPVT0CCutHigh", cfgFuncParas.cfgMultCentHighCutFunction->c_str(), 0, 100); + fMultPVT0CCutHigh->SetParameters(&(cfgFuncParas.multPVT0CCutPars[0])); + + fMultT0CCutLow = new TF1("fMultT0CCutLow", cfgFuncParas.cfgMultCentLowCutFunction->c_str(), 0, 100); + fMultT0CCutLow->SetParameters(&(cfgFuncParas.multT0CCutPars[0])); + fMultT0CCutHigh = new TF1("fMultT0CCutHigh", cfgFuncParas.cfgMultCentHighCutFunction->c_str(), 0, 100); + fMultT0CCutHigh->SetParameters(&(cfgFuncParas.multT0CCutPars[0])); + + fMultGlobalPVCutLow = new TF1("fMultGlobalPVCutLow", cfgFuncParas.cfgMultMultLowCutFunction->c_str(), 0, 4000); + fMultGlobalPVCutLow->SetParameters(&(cfgFuncParas.multGlobalPVCutPars[0])); + fMultGlobalPVCutHigh = new TF1("fMultGlobalPVCutHigh", cfgFuncParas.cfgMultMultHighCutFunction->c_str(), 0, 4000); + fMultGlobalPVCutHigh->SetParameters(&(cfgFuncParas.multGlobalPVCutPars[0])); fT0AV0AMean = new TF1("fT0AV0AMean", "[0]+[1]*x", 0, 200000); fT0AV0AMean->SetParameters(-1601.0581, 9.417652e-01); @@ -310,10 +318,6 @@ struct DiHadronCor { same.setObject(new CorrelationContainer("sameEvent", "sameEvent", corrAxis, effAxis, userAxis)); mixed.setObject(new CorrelationContainer("mixedEvent", "mixedEvent", corrAxis, effAxis, userAxis)); - tofNsigmaCut = pidTofNsigmaCut; - itsNsigmaCut = pidItsNsigmaCut; - tpcNsigmaCut = pidTpcNsigmaCut; - LOGF(info, "End of init"); } @@ -358,9 +362,6 @@ struct DiHadronCor { template bool trackSelected(TTrack track) { - if (cfgPIDParticle && getNsigmaPID(track) != cfgPIDParticle) { - return false; - } return ((track.tpcNClsFound() >= cfgCutTPCclu) && (track.tpcNClsCrossedRows() >= cfgCutTPCCrossedRows) && (track.itsNCls() >= cfgCutITSclu)); } @@ -382,7 +383,7 @@ struct DiHadronCor { return true; } - void loadEfficiency(uint64_t timestamp) + void loadCorrection(uint64_t timestamp) { if (correctionsLoaded) { return; @@ -399,6 +400,13 @@ struct DiHadronCor { } LOGF(info, "Loaded efficiency histogram from %s (%p)", cfgEfficiency.value.c_str(), (void*)mEfficiency); } + if (cfgCentralityWeight.value.empty() == false) { + mCentralityWeight = ccdb->getForTimeStamp(cfgCentralityWeight, timestamp); + if (mCentralityWeight == nullptr) { + LOGF(fatal, "Could not load efficiency histogram for trigger particles from %s", cfgCentralityWeight.value.c_str()); + } + LOGF(info, "Loaded efficiency histogram from %s (%p)", cfgCentralityWeight.value.c_str(), (void*)mCentralityWeight); + } correctionsLoaded = true; } @@ -419,6 +427,19 @@ struct DiHadronCor { return true; } + bool getCentralityWeight(float& weightCent, const float centrality) + { + float weight = 1.; + if (mCentralityWeight) + weight = mCentralityWeight->GetBinContent(mCentralityWeight->FindBin(centrality)); + else + weight = 1.0; + if (weight == 0) + return false; + weightCent = weight; + return true; + } + // fill multiple histograms template void fillYield(TCollision collision, TTracks tracks) // function to fill the yield and etaphi histograms. @@ -659,14 +680,24 @@ struct DiHadronCor { auto multNTracksPV = collision.multNTracksPV(); if (cfgEvSelMultCorrelation) { - if (multNTracksPV < fMultPVCutLow->Eval(centrality)) - return 0; - if (multNTracksPV > fMultPVCutHigh->Eval(centrality)) - return 0; - if (multTrk < fMultCutLow->Eval(centrality)) - return 0; - if (multTrk > fMultCutHigh->Eval(centrality)) - return 0; + if (cfgFuncParas.cfgMultPVT0CCutEnabled) { + if (multNTracksPV < fMultPVT0CCutLow->Eval(centrality)) + return 0; + if (multNTracksPV > fMultPVT0CCutHigh->Eval(centrality)) + return 0; + } + if (cfgFuncParas.cfgMultT0CCutEnabled) { + if (multTrk < fMultT0CCutLow->Eval(centrality)) + return 0; + if (multTrk > fMultT0CCutHigh->Eval(centrality)) + return 0; + } + if (cfgFuncParas.cfgMultGlobalPVCutEnabled) { + if (multTrk < fMultGlobalPVCutLow->Eval(multNTracksPV)) + return 0; + if (multTrk > fMultGlobalPVCutHigh->Eval(multNTracksPV)) + return 0; + } } if (fillCounter && cfgEvSelMultCorrelation) registry.fill(HIST("hEventCountSpecific"), 10.5); @@ -704,12 +735,15 @@ struct DiHadronCor { return; } - loadEfficiency(bc.timestamp()); + loadCorrection(bc.timestamp()); registry.fill(HIST("eventcount"), SameEvent); // because its same event i put it in the 1 bin fillYield(collision, tracks); + float weightCent = 1.0f; + if (!cfgCentTableUnavailable) + getCentralityWeight(weightCent, cent); same->fillEvent(tracks.size(), CorrelationContainer::kCFStepReconstructed); - fillCorrelations(tracks, tracks, collision.posZ(), SameEvent, getMagneticField(bc.timestamp()), cent, 1.0f); + fillCorrelations(tracks, tracks, collision.posZ(), SameEvent, getMagneticField(bc.timestamp()), cent, weightCent); } PROCESS_SWITCH(DiHadronCor, processSame, "Process same event", true); @@ -759,13 +793,16 @@ struct DiHadronCor { registry.fill(HIST("eventcount"), MixedEvent); // fill the mixed event in the 3 bin auto bc = collision1.bc_as(); - loadEfficiency(bc.timestamp()); + loadCorrection(bc.timestamp()); float eventWeight = 1.0f; if (cfgUseEventWeights) { eventWeight = 1.0f / it.currentWindowNeighbours(); } + float weightCent = 1.0f; + if (!cfgCentTableUnavailable) + getCentralityWeight(weightCent, cent1); - fillCorrelations(tracks1, tracks2, collision1.posZ(), MixedEvent, getMagneticField(bc.timestamp()), cent1, eventWeight); + fillCorrelations(tracks1, tracks2, collision1.posZ(), MixedEvent, getMagneticField(bc.timestamp()), cent1, eventWeight * weightCent); } } @@ -989,56 +1026,6 @@ struct DiHadronCor { } } PROCESS_SWITCH(DiHadronCor, processOntheflyMixed, "Process on-the-fly mixed events", false); - - template - int getNsigmaPID(TTrack track) - { - // Computing Nsigma arrays for pion, kaon, and protons - std::array nSigmaTPC = {track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr()}; - std::array nSigmaTOF = {track.tofNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPr()}; - std::array nSigmaITS = {itsResponse.nSigmaITS(track), itsResponse.nSigmaITS(track), itsResponse.nSigmaITS(track)}; - int pid = -1; - - std::array nSigmaToUse = cfgPIDUseITSPID ? nSigmaITS : nSigmaTPC; // Choose which nSigma to use: TPC or ITS - std::vector detectorNsigmaCut = cfgPIDUseITSPID ? itsNsigmaCut : tpcNsigmaCut; // Choose which nSigma to use: TPC or ITS - - bool isPion, isKaon, isProton; - bool isDetectedPion = nSigmaToUse[0] < detectorNsigmaCut[0] && nSigmaToUse[0] > detectorNsigmaCut[0 + 3]; - bool isDetectedKaon = nSigmaToUse[1] < detectorNsigmaCut[1] && nSigmaToUse[1] > detectorNsigmaCut[1 + 3]; - bool isDetectedProton = nSigmaToUse[2] < detectorNsigmaCut[2] && nSigmaToUse[2] > detectorNsigmaCut[2 + 3]; - - bool isTofPion = nSigmaTOF[0] < tofNsigmaCut[0] && nSigmaTOF[0] > tofNsigmaCut[0 + 3]; - bool isTofKaon = nSigmaTOF[1] < tofNsigmaCut[1] && nSigmaTOF[1] > tofNsigmaCut[1 + 3]; - bool isTofProton = nSigmaTOF[2] < tofNsigmaCut[2] && nSigmaTOF[2] > tofNsigmaCut[2 + 3]; - - if (track.pt() > cfgPIDTofPtCut && !track.hasTOF()) { - return 0; - } else if (track.pt() > cfgPIDTofPtCut && track.hasTOF()) { - isPion = isTofPion && isDetectedPion; - isKaon = isTofKaon && isDetectedKaon; - isProton = isTofProton && isDetectedProton; - } else { - isPion = isDetectedPion; - isKaon = isDetectedKaon; - isProton = isDetectedProton; - } - - if ((isPion && isKaon) || (isPion && isProton) || (isKaon && isProton)) { - return 0; // more than one particle satisfy the criteria - } - - if (isPion) { - pid = PIONS; - } else if (isKaon) { - pid = KAONS; - } else if (isProton) { - pid = PROTONS; - } else { - return 0; // no particle satisfies the criteria - } - - return pid + 1; // shift the pid by 1, 1 = pion, 2 = kaon, 3 = proton - } }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From bdd5ff1eb916b9a6acdc84c72c32ba3317cb9fff Mon Sep 17 00:00:00 2001 From: Maximiliano Puccio Date: Sat, 26 Jul 2025 13:14:57 +0200 Subject: [PATCH 079/345] [PWGLF] He3-L derived data analysis (#12250) --- PWGLF/DataModel/LFSlimHeLambda.h | 82 ++++++++++ .../Nuspex/he3LambdaAnalysis.cxx | 67 +-------- PWGLF/Tasks/Nuspex/CMakeLists.txt | 5 + .../Tasks/Nuspex/he3LambdaDerivedAnalysis.cxx | 140 ++++++++++++++++++ 4 files changed, 234 insertions(+), 60 deletions(-) create mode 100644 PWGLF/DataModel/LFSlimHeLambda.h create mode 100644 PWGLF/Tasks/Nuspex/he3LambdaDerivedAnalysis.cxx diff --git a/PWGLF/DataModel/LFSlimHeLambda.h b/PWGLF/DataModel/LFSlimHeLambda.h new file mode 100644 index 00000000000..fc0178907df --- /dev/null +++ b/PWGLF/DataModel/LFSlimHeLambda.h @@ -0,0 +1,82 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// +/// \file LFSlimNucleiTables.h +/// \brief Slim nuclei tables +/// + +#ifndef PWGLF_DATAMODEL_LFSLIMNUCLEITABLES_H_ +#define PWGLF_DATAMODEL_LFSLIMNUCLEITABLES_H_ + +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" + +#include + +namespace o2::aod +{ +namespace lfv0he3 +{ +DECLARE_SOA_COLUMN(Z, z, float); +DECLARE_SOA_COLUMN(CentT0C, centT0C, float); +} // namespace lfv0he3 +DECLARE_SOA_TABLE(LFEvents, "AOD", "LFEVENT", o2::soa::Index<>, lfv0he3::Z, lfv0he3::CentT0C); + +namespace lfv0he3 +{ +DECLARE_SOA_INDEX_COLUMN(LFEvent, lfEvent); // Collision ID for the event +DECLARE_SOA_COLUMN(Pt, pt, float); +DECLARE_SOA_COLUMN(Eta, eta, float); +DECLARE_SOA_COLUMN(Phi, phi, float); +DECLARE_SOA_COLUMN(Mass, mass, float); +DECLARE_SOA_COLUMN(CosPA, cosPA, float); +DECLARE_SOA_COLUMN(DCAxy, dcaXY, float); +DECLARE_SOA_COLUMN(DCAz, dcaZ, float); +DECLARE_SOA_COLUMN(TPCnCls, tpcNCls, int); +DECLARE_SOA_COLUMN(ITSClusterSizes, itsClusterSizes, uint32_t); +DECLARE_SOA_COLUMN(NsigmaTPC, nSigmaTPC, float); +// DECLARE_SOA_COLUMN(NsigmaTPCproton, nSigmaTPCproton, float); +DECLARE_SOA_COLUMN(DCAdaughters, dcaDaughters, float); +DECLARE_SOA_COLUMN(DCAPVProton, dcaPVProton, float); +DECLARE_SOA_COLUMN(DCAPVPion, dcaPVPion, float); +DECLARE_SOA_COLUMN(V0Radius, v0Radius, float); +DECLARE_SOA_COLUMN(Sign, sign, int8_t); +} // namespace lfv0he3 +DECLARE_SOA_TABLE(LFHe3, "AOD", "LFHE3V0", lfv0he3::LFEventId, lfv0he3::Pt, lfv0he3::Eta, lfv0he3::Phi, lfv0he3::DCAxy, lfv0he3::DCAz, lfv0he3::TPCnCls, lfv0he3::ITSClusterSizes, lfv0he3::NsigmaTPC, lfv0he3::Sign); +DECLARE_SOA_TABLE(LFLambda, "AOD", "LFLAMBDA", lfv0he3::LFEventId, lfv0he3::Pt, lfv0he3::Eta, lfv0he3::Phi, lfv0he3::Mass, lfv0he3::CosPA, lfv0he3::DCAdaughters, lfv0he3::DCAPVProton, lfv0he3::DCAPVPion, lfv0he3::V0Radius, lfv0he3::Sign); +} // namespace o2::aod + +struct he3Candidate { + ROOT::Math::LorentzVector> momentum; // 4-momentum of the He3 candidate + float nSigmaTPC = -999.f; // TPC nSigma for He3 + float dcaXY = -999.f; + float dcaZ = -999.f; + int tpcNClsFound = 0; // Number of TPC clusters found + int itsNCls = 0; // Number of ITS clusters + uint32_t itsClusterSizes = 0; // ITS cluster sizes + int8_t sign = 0; // Charge sign of the He3 candidate +}; + +struct lambdaCandidate { + ROOT::Math::LorentzVector> momentum; + float mass = -1.f; // Lambda mass + float cosPA = -2.f; // Cosine of pointing angle + float dcaV0Daughters = -999.f; // DCA between V0 daughters + float dcaProtonToPV = -999.f; // DCA of the proton to primary vertex + float dcaPionToPV = -999.f; // DCA of the pion to primary vertex + float v0Radius = -1.f; // V0 radius + float protonNSigmaTPC = -999.f; // Proton TPC nSigma + float pionNSigmaTPC = -999.f; + int8_t sign = 0; // Charge sign of the Lambda candidate +}; + +#endif // PWGLF_DATAMODEL_LFSLIMNUCLEITABLES_H_ diff --git a/PWGLF/TableProducer/Nuspex/he3LambdaAnalysis.cxx b/PWGLF/TableProducer/Nuspex/he3LambdaAnalysis.cxx index 8c5b296cbe7..d10a1338e55 100644 --- a/PWGLF/TableProducer/Nuspex/he3LambdaAnalysis.cxx +++ b/PWGLF/TableProducer/Nuspex/he3LambdaAnalysis.cxx @@ -9,6 +9,8 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +#include "PWGLF/DataModel/LFSlimHeLambda.h" + #include "Common/Core/trackUtilities.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" @@ -45,39 +47,6 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::constants::physics; - -namespace o2::aod -{ -namespace lfv0he3 -{ -DECLARE_SOA_COLUMN(Z, z, float); -DECLARE_SOA_COLUMN(CentT0C, centT0C, float); -} // namespace lfv0he3 -DECLARE_SOA_TABLE(LFEvents, "AOD", "LFEVENT", o2::soa::Index<>, lfv0he3::Z, lfv0he3::CentT0C); - -namespace lfv0he3 -{ -DECLARE_SOA_INDEX_COLUMN(LFEvent, lfEvent); // Collision ID for the event -DECLARE_SOA_COLUMN(Pt, pt, float); -DECLARE_SOA_COLUMN(Eta, eta, float); -DECLARE_SOA_COLUMN(Phi, phi, float); -DECLARE_SOA_COLUMN(Mass, mass, float); -DECLARE_SOA_COLUMN(CosPA, cosPA, float); -DECLARE_SOA_COLUMN(DCAxy, dcaXY, float); -DECLARE_SOA_COLUMN(DCAz, dcaZ, float); -DECLARE_SOA_COLUMN(TPCnCls, tpcNCls, int); -DECLARE_SOA_COLUMN(ITSClusterSizes, itsClusterSizes, uint32_t); -DECLARE_SOA_COLUMN(NsigmaTPC, nSigmaTPC, float); -DECLARE_SOA_COLUMN(DCAdaughters, dcaDaughters, float); -DECLARE_SOA_COLUMN(DCAPVProton, dcaPVProton, float); -DECLARE_SOA_COLUMN(DCAPVPion, dcaPVPion, float); -DECLARE_SOA_COLUMN(V0Radius, v0Radius, float); -DECLARE_SOA_COLUMN(Sign, sign, int8_t); -} // namespace lfv0he3 -DECLARE_SOA_TABLE(LFHe3, "AOD", "LFHE3V0", lfv0he3::LFEventId, lfv0he3::Pt, lfv0he3::Eta, lfv0he3::Phi, lfv0he3::DCAxy, lfv0he3::DCAz, lfv0he3::TPCnCls, lfv0he3::ITSClusterSizes, lfv0he3::NsigmaTPC, lfv0he3::Sign); -DECLARE_SOA_TABLE(LFLambda, "AOD", "LFLAMBDA", lfv0he3::LFEventId, lfv0he3::Pt, lfv0he3::Eta, lfv0he3::Phi, lfv0he3::Mass, lfv0he3::CosPA, lfv0he3::DCAdaughters, lfv0he3::DCAPVProton, lfv0he3::DCAPVPion, lfv0he3::V0Radius, lfv0he3::Sign); -} // namespace o2::aod - namespace { constexpr double betheBlochDefault[1][6]{{-1.e32, -1.e32, -1.e32, -1.e32, -1.e32, -1.e32}}; @@ -106,37 +75,14 @@ std::shared_ptr hTPCnSigmaAll; std::shared_ptr hTPCnSigmaHe3; std::shared_ptr hArmenterosPodolanskiAll; std::shared_ptr hArmenterosPodolanskiSelected; -std::shared_ptr hInvariantMass; +std::shared_ptr hInvariantMassUS; +std::shared_ptr hInvariantMassLS; }; // namespace using TracksFull = soa::Join; using CollisionsFull = soa::Join; -struct he3Candidate { - ROOT::Math::LorentzVector> momentum; // 4-momentum of the He3 candidate - float nSigmaTPC; // TPC nSigma for He3 - float dcaXY; - float dcaZ; - int tpcNClsFound; // Number of TPC clusters found - int itsNCls; // Number of ITS clusters - uint32_t itsClusterSizes; // ITS cluster sizes - int8_t sign; // Charge sign of the He3 candidate -}; - -struct lambdaCandidate { - ROOT::Math::LorentzVector> momentum; - float mass; // Lambda mass - float cosPA; // Cosine of pointing angle - float dcaV0Daughters; // DCA between V0 daughters - float dcaProtonToPV; // DCA of the proton to primary vertex - float dcaPionToPV; // DCA of the pion to primary vertex - float v0Radius; - float protonNSigmaTPC; // Proton TPC nSigma - float pionNSigmaTPC; - int8_t sign; // Charge sign of the Lambda candidate -}; - struct he3LambdaAnalysis { // Services @@ -251,7 +197,8 @@ struct he3LambdaAnalysis { hArmenterosPodolanskiSelected = mRegistry.add("hArmenterosPodolanskiSelected", "Armenteros-Podolanski Selected", {HistType::kTH2D, {{100, -1., 1.}, {100, 0., 0.5}}}); constexpr double ConstituentsMass = o2::constants::physics::MassProton + o2::constants::physics::MassNeutron * 2 + o2::constants::physics::MassSigmaPlus; - hInvariantMass = mRegistry.add("hInvariantMass", "Invariant Mass", {HistType::kTH2D, {{45, 1., 10}, {100, ConstituentsMass - 0.05, ConstituentsMass + 0.05}}}); + hInvariantMassUS = mRegistry.add("hInvariantMassUS", "Invariant Mass", {HistType::kTH2D, {{45, 1., 10}, {100, ConstituentsMass - 0.05, ConstituentsMass + 0.05}}}); + hInvariantMassLS = mRegistry.add("hInvariantMassLS", "Invariant Mass", {HistType::kTH2D, {{45, 1., 10}, {100, ConstituentsMass - 0.05, ConstituentsMass + 0.05}}}); LOGF(info, "He3-Lambda analysis initialized"); } @@ -439,7 +386,7 @@ struct he3LambdaAnalysis { for (const auto& he3 : he3Candidates) { for (const auto& lambda : lambdaCandidates) { auto pairMomentum = lambda.momentum + he3.momentum; // Calculate invariant mass - hInvariantMass->Fill(pairMomentum.Pt(), pairMomentum.M()); + (he3.sign * lambda.sign > 0 ? hInvariantMassLS : hInvariantMassUS)->Fill(pairMomentum.Pt(), pairMomentum.M()); } } } diff --git a/PWGLF/Tasks/Nuspex/CMakeLists.txt b/PWGLF/Tasks/Nuspex/CMakeLists.txt index a464257d67a..05b1bc2ca8e 100644 --- a/PWGLF/Tasks/Nuspex/CMakeLists.txt +++ b/PWGLF/Tasks/Nuspex/CMakeLists.txt @@ -145,4 +145,9 @@ o2physics_add_dpl_workflow(kink-pika PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(he3-lambda-derived-analysis + SOURCES he3LambdaDerivedAnalysis.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + endif() diff --git a/PWGLF/Tasks/Nuspex/he3LambdaDerivedAnalysis.cxx b/PWGLF/Tasks/Nuspex/he3LambdaDerivedAnalysis.cxx new file mode 100644 index 00000000000..6d8f95d4ba2 --- /dev/null +++ b/PWGLF/Tasks/Nuspex/he3LambdaDerivedAnalysis.cxx @@ -0,0 +1,140 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#include "PWGLF/DataModel/LFSlimHeLambda.h" + +#include +#include +#include +#include + +#include + +#include + +namespace +{ +std::shared_ptr hInvariantMassUS[2]; +std::shared_ptr hInvariantMassLS[2]; +std::shared_ptr hRotationInvariantMassUS[2]; +std::shared_ptr hRotationInvariantMassLS[2]; +std::shared_ptr hRotationInvariantMassAntiLSeta[2]; +std::shared_ptr hInvariantMassLambda[2]; +std::shared_ptr hCosPALambda; +std::shared_ptr hNsigmaHe3; +std::shared_ptr hNsigmaProton; +}; // namespace + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::constants::physics; + +struct he3LambdaDerivedAnalysis { + HistogramRegistry mRegistry{"He3LambdaDerivedAnalysis"}; + + Configurable cfgNrotations{"cfgNrotations", 7, "Number of rotations for He3 candidates"}; + Configurable cfgMirrorEta{"cfgMirrorEta", true, "Mirror eta for He3 candidates"}; + Configurable cfgMinCosPA{"cfgMinCosPA", 0.99, "Minimum cosPA for Lambda candidates"}; + Configurable cfgMaxNSigmaTPCHe3{"cfgMaxNSigmaTPCHe3", 2.0, "Maximum nSigmaTPC for He3 candidates"}; + Configurable cfgMinLambdaPt{"cfgMinLambdaPt", 0.4, "Minimum pT for Lambda candidates"}; + Configurable cfgMaxLambdaDeltaM{"cfgMaxLambdaDeltaM", 10.0e-3, "Maximum deltaM for Lambda candidates"}; + + void init(InitContext const&) + { + constexpr double ConstituentsMass = o2::constants::physics::MassProton + o2::constants::physics::MassNeutron * 2 + o2::constants::physics::MassSigmaPlus; + for (int i = 0; i < 2; ++i) { + hInvariantMassUS[i] = mRegistry.add(Form("hInvariantMassUS%i", i), "Invariant Mass", {HistType::kTH2D, {{45, 1., 10}, {100, ConstituentsMass - 0.05, ConstituentsMass + 0.05}}}); + hInvariantMassLS[i] = mRegistry.add(Form("hInvariantMassLS%i", i), "Invariant Mass", {HistType::kTH2D, {{45, 1., 10}, {100, ConstituentsMass - 0.05, ConstituentsMass + 0.05}}}); + hRotationInvariantMassUS[i] = mRegistry.add(Form("hRotationInvariantMassUS%i", i), "Rotation Invariant Mass", {HistType::kTH2D, {{45, 1., 10}, {100, ConstituentsMass - 0.05, ConstituentsMass + 0.05}}}); + hRotationInvariantMassLS[i] = mRegistry.add(Form("hRotationInvariantMassLS%i", i), "Rotation Invariant Mass", {HistType::kTH2D, {{45, 1., 10}, {100, ConstituentsMass - 0.05, ConstituentsMass + 0.05}}}); + hInvariantMassLambda[i] = mRegistry.add(Form("hInvariantMassLambda%i", i), "Invariant Mass Lambda", {HistType::kTH2D, {{50, 0., 10.}, {30, o2::constants::physics::MassLambda0 - 0.015, o2::constants::physics::MassLambda0 + 0.015}}}); + hRotationInvariantMassAntiLSeta[i] = mRegistry.add(Form("hRotationInvariantMassAntiLSeta%i", i), "Rotation Invariant Mass Anti-Lambda", {HistType::kTH2D, {{45, 1., 10}, {100, ConstituentsMass - 0.05, ConstituentsMass + 0.05}}}); + } + hCosPALambda = mRegistry.add("hCosPALambda", "Cosine of Pointing Angle for Lambda", {HistType::kTH2D, {{50, 0., 10.}, {500, 0.9, 1.}}}); + hNsigmaHe3 = mRegistry.add("hNsigmaHe3", "nSigma TPC for He3", {HistType::kTH2D, {{100, -10., 10.}, {200, -5, 5.}}}); + hNsigmaProton = mRegistry.add("hNsigmaProton", "nSigma TPC for Proton", {HistType::kTH2D, {{100, -10., 10.}, {200, -5, 5.}}}); + } + + void processSameEvent(o2::aod::LFEvents::iterator const& collision, o2::aod::LFHe3 const& he3s, o2::aod::LFLambda const& lambdas) + { + std::vector he3Candidates; + he3Candidates.reserve(he3s.size()); + std::vector lambdaCandidates; + lambdaCandidates.reserve(lambdas.size()); + for (const auto& he3 : he3s) { + if (he3.lfEventId() != collision.globalIndex()) { + std::cout << "He3 candidate does not match event index, skipping." << std::endl; + return; + } + he3Candidate candidate; + candidate.momentum = ROOT::Math::LorentzVector>(he3.pt(), he3.eta(), he3.phi(), o2::constants::physics::MassHelium3); + candidate.nSigmaTPC = he3.nSigmaTPC(); + candidate.dcaXY = he3.dcaXY(); + candidate.dcaZ = he3.dcaZ(); + candidate.tpcNClsFound = he3.tpcNCls(); + candidate.itsNCls = he3.itsClusterSizes(); + candidate.itsClusterSizes = he3.itsClusterSizes(); + candidate.sign = he3.sign(); + hNsigmaHe3->Fill(he3.pt() * he3.sign(), he3.nSigmaTPC()); + if (std::abs(he3.nSigmaTPC()) > cfgMaxNSigmaTPCHe3) { + continue; // Skip candidates with nSigmaTPC outside range + } + he3Candidates.push_back(candidate); + } + for (const auto& lambda : lambdas) { + if (lambda.lfEventId() != collision.globalIndex()) { + std::cout << "Lambda candidate does not match event index, skipping." << std::endl; + return; + } + lambdaCandidate candidate; + candidate.momentum.SetCoordinates(lambda.pt(), lambda.eta(), lambda.phi(), o2::constants::physics::MassLambda0); + candidate.mass = lambda.mass(); + candidate.cosPA = lambda.cosPA(); + candidate.dcaV0Daughters = lambda.dcaDaughters(); + hCosPALambda->Fill(lambda.pt(), candidate.cosPA); + // hNsigmaProton->Fill(lambda.pt() * lambda.sign(), lambda.protonNSigmaTPC()); + hInvariantMassLambda[0]->Fill(lambda.pt(), lambda.mass()); + if (candidate.cosPA < cfgMinCosPA || lambda.pt() < cfgMinLambdaPt || + std::abs(lambda.mass() - o2::constants::physics::MassLambda0) > cfgMaxLambdaDeltaM) { + continue; // Skip candidates with low cosPA + } + hInvariantMassLambda[1]->Fill(lambda.pt(), lambda.mass()); + lambdaCandidates.push_back(candidate); + } + + for (const auto& he3 : he3Candidates) { + for (const auto& lambda : lambdaCandidates) { + auto pairMomentum = lambda.momentum + he3.momentum; // Calculate invariant mass + (he3.sign * lambda.sign > 0 ? hInvariantMassLS : hInvariantMassUS)[he3.sign > 0]->Fill(pairMomentum.Pt(), pairMomentum.M()); + } + for (int iEta{0}; iEta <= cfgMirrorEta; ++iEta) { + for (int iR{0}; iR <= cfgNrotations; ++iR) { + auto he3Momentum = ROOT::Math::LorentzVector>(he3.momentum.Pt(), (1. - iEta * 2.) * he3.momentum.Eta(), he3.momentum.Phi() + TMath::Pi() * (0.75 + 0.5 * iR / cfgNrotations), he3.momentum.M()); + for (const auto& lambda : lambdaCandidates) { + auto pairMomentum = lambda.momentum + he3Momentum; // Calculate invariant mass + (he3.sign * lambda.sign > 0 ? hRotationInvariantMassLS : hRotationInvariantMassUS)[he3.sign > 0]->Fill(pairMomentum.Pt(), pairMomentum.M()); + if (he3.sign < 0 && lambda.sign < 0) { + hRotationInvariantMassAntiLSeta[iEta]->Fill(pairMomentum.Pt(), pairMomentum.M()); + } + } + } + } + } + } + PROCESS_SWITCH(he3LambdaDerivedAnalysis, processSameEvent, "Process same event", true); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} From f0b71c64aada51a7497f38d7919bf74c79573ca1 Mon Sep 17 00:00:00 2001 From: sawan <124118453+sawankumawat@users.noreply.github.com> Date: Sat, 26 Jul 2025 17:50:30 +0530 Subject: [PATCH 080/345] [PWGLF] Added derived data process function (#12255) Co-authored-by: Sawan Sawan --- .../Tasks/Resonances/higherMassResonances.cxx | 391 +++++++++++++++--- 1 file changed, 343 insertions(+), 48 deletions(-) diff --git a/PWGLF/Tasks/Resonances/higherMassResonances.cxx b/PWGLF/Tasks/Resonances/higherMassResonances.cxx index 197f25de0b8..61ef930a7c2 100644 --- a/PWGLF/Tasks/Resonances/higherMassResonances.cxx +++ b/PWGLF/Tasks/Resonances/higherMassResonances.cxx @@ -14,6 +14,7 @@ /// \author Sawan // #include +#include "PWGLF/DataModel/LFStrangenessPIDTables.h" #include "PWGLF/DataModel/LFStrangenessTables.h" // #include "Common/Core/TrackSelection.h" @@ -183,8 +184,8 @@ struct HigherMassResonances { ROOT::Math::XYZVector randomVec, beamVec, normalVec; ROOT::Math::XYZVectorF v1_CM, zaxis_HE, yaxis_HE, xaxis_HE; // ROOT::Math::XYZVector threeVecDauCM, helicityVec, randomVec, beamVec, normalVec; - ROOT::Math::XYZVector zBeam; // ẑ: beam direction in lab frame - double BeamMomentum = TMath::Sqrt(13600 * 13600 / 4 - 0.938 * 0.938); // GeV + ROOT::Math::XYZVector zBeam; // ẑ: beam direction in lab frame + double BeamMomentum = std::sqrt(13600 * 13600 / 4 - 0.938 * 0.938); // GeV ROOT::Math::PxPyPzEVector Beam1{0., 0., -BeamMomentum, 13600. / 2.}; ROOT::Math::PxPyPzEVector Beam2{0., 0., BeamMomentum, 13600. / 2.}; ROOT::Math::XYZVectorF Beam1_CM, Beam2_CM; @@ -651,75 +652,97 @@ struct HigherMassResonances { angle_phi += 2 * TMath::Pi(); // ensure phi is in [0, 2pi] } - if (std::abs(mother.Rapidity()) < 0.5) { - if (config.activateTHnSparseCosThStarHelicity) { - // helicityVec = mother.Vect(); // 3 vector of mother in COM frame - // auto cosThetaStarHelicity = helicityVec.Dot(threeVecDauCM) / (std::sqrt(threeVecDauCM.Mag2()) * std::sqrt(helicityVec.Mag2())); - auto cosThetaStarHelicity = mother.Vect().Dot(fourVecDauCM.Vect()) / (std::sqrt(fourVecDauCM.Vect().Mag2()) * std::sqrt(mother.Vect().Mag2())); - if (!isMix) { + // if (std::abs(mother.Rapidity()) < 0.5) { + if (config.activateTHnSparseCosThStarHelicity) { + // helicityVec = mother.Vect(); // 3 vector of mother in COM frame + // auto cosThetaStarHelicity = helicityVec.Dot(threeVecDauCM) / (std::sqrt(threeVecDauCM.Mag2()) * std::sqrt(helicityVec.Mag2())); + auto cosThetaStarHelicity = mother.Vect().Dot(fourVecDauCM.Vect()) / (std::sqrt(fourVecDauCM.Vect().Mag2()) * std::sqrt(mother.Vect().Mag2())); + if (!isMix) { + if (std::abs(mother.Rapidity()) < 0.5) { hglue.fill(HIST("h3glueInvMassDS"), multiplicity, mother.Pt(), mother.M(), cosThetaStarHelicity, angle_phi); + } - for (int i = 0; i < config.cRotations; i++) { - theta2 = rn->Uniform(o2::constants::math::PI - o2::constants::math::PI / config.rotationalCut, o2::constants::math::PI + o2::constants::math::PI / config.rotationalCut); - - daughterRot = ROOT::Math::PxPyPzMVector(daughter1.Px() * std::cos(theta2) - daughter1.Py() * std::sin(theta2), daughter1.Px() * std::sin(theta2) + daughter1.Py() * std::cos(theta2), daughter1.Pz(), daughter1.M()); + for (int i = 0; i < config.cRotations; i++) { + theta2 = rn->Uniform(o2::constants::math::PI - o2::constants::math::PI / config.rotationalCut, o2::constants::math::PI + o2::constants::math::PI / config.rotationalCut); - motherRot = daughterRot + daughter2; + daughterRot = ROOT::Math::PxPyPzMVector(daughter1.Px() * std::cos(theta2) - daughter1.Py() * std::sin(theta2), daughter1.Px() * std::sin(theta2) + daughter1.Py() * std::cos(theta2), daughter1.Pz(), daughter1.M()); - ROOT::Math::Boost boost2{motherRot.BoostToCM()}; - daughterRotCM = boost2(daughterRot); + motherRot = daughterRot + daughter2; - auto cosThetaStarHelicityRot = motherRot.Vect().Dot(daughterRotCM.Vect()) / (std::sqrt(daughterRotCM.Vect().Mag2()) * std::sqrt(motherRot.Vect().Mag2())); + ROOT::Math::Boost boost2{motherRot.BoostToCM()}; + daughterRotCM = boost2(daughterRot); + auto cosThetaStarHelicityRot = motherRot.Vect().Dot(daughterRotCM.Vect()) / (std::sqrt(daughterRotCM.Vect().Mag2()) * std::sqrt(motherRot.Vect().Mag2())); + if (motherRot.Rapidity() < 0.5) hglue.fill(HIST("h3glueInvMassRot"), multiplicity, motherRot.Pt(), motherRot.M(), cosThetaStarHelicityRot, angle_phi); - } - } else { + } + } else { + if (std::abs(mother.Rapidity()) < 0.5) { hglue.fill(HIST("h3glueInvMassME"), multiplicity, mother.Pt(), mother.M(), cosThetaStarHelicity, angle_phi); } - } else if (config.activateTHnSparseCosThStarProduction) { - normalVec = ROOT::Math::XYZVector(mother.Py(), -mother.Px(), 0.f); - auto cosThetaStarProduction = normalVec.Dot(fourVecDauCM.Vect()) / (std::sqrt(fourVecDauCM.Vect().Mag2()) * std::sqrt(normalVec.Mag2())); - if (!isMix) { + } + } else if (config.activateTHnSparseCosThStarProduction) { + normalVec = ROOT::Math::XYZVector(mother.Py(), -mother.Px(), 0.f); + auto cosThetaStarProduction = normalVec.Dot(fourVecDauCM.Vect()) / (std::sqrt(fourVecDauCM.Vect().Mag2()) * std::sqrt(normalVec.Mag2())); + if (!isMix) { + if (std::abs(mother.Rapidity()) < 0.5) { hglue.fill(HIST("h3glueInvMassDS"), multiplicity, mother.Pt(), mother.M(), cosThetaStarProduction, angle_phi); - for (int i = 0; i < config.cRotations; i++) { - theta2 = rn->Uniform(o2::constants::math::PI - o2::constants::math::PI / config.rotationalCut, o2::constants::math::PI + o2::constants::math::PI / config.rotationalCut); - motherRot = ROOT::Math::PxPyPzMVector(mother.Px() * std::cos(theta2) - mother.Py() * std::sin(theta2), mother.Px() * std::sin(theta2) + mother.Py() * std::cos(theta2), mother.Pz(), mother.M()); + } + for (int i = 0; i < config.cRotations; i++) { + theta2 = rn->Uniform(o2::constants::math::PI - o2::constants::math::PI / config.rotationalCut, o2::constants::math::PI + o2::constants::math::PI / config.rotationalCut); + motherRot = ROOT::Math::PxPyPzMVector(mother.Px() * std::cos(theta2) - mother.Py() * std::sin(theta2), mother.Px() * std::sin(theta2) + mother.Py() * std::cos(theta2), mother.Pz(), mother.M()); + if (std::abs(motherRot.Rapidity()) < 0.5) { hglue.fill(HIST("h3glueInvMassRot"), multiplicity, motherRot.Pt(), motherRot.M(), cosThetaStarProduction, angle_phi); } - } else { + } + } else { + if (std::abs(mother.Rapidity()) < 0.5) { hglue.fill(HIST("h3glueInvMassME"), multiplicity, mother.Pt(), mother.M(), cosThetaStarProduction, angle_phi); } - } else if (config.activateTHnSparseCosThStarBeam) { - beamVec = ROOT::Math::XYZVector(0.f, 0.f, 1.f); - auto cosThetaStarBeam = beamVec.Dot(fourVecDauCM.Vect()) / std::sqrt(fourVecDauCM.Vect().Mag2()); - if (!isMix) { + } + } else if (config.activateTHnSparseCosThStarBeam) { + beamVec = ROOT::Math::XYZVector(0.f, 0.f, 1.f); + auto cosThetaStarBeam = beamVec.Dot(fourVecDauCM.Vect()) / std::sqrt(fourVecDauCM.Vect().Mag2()); + if (!isMix) { + if (std::abs(mother.Rapidity()) < 0.5) { hglue.fill(HIST("h3glueInvMassDS"), multiplicity, mother.Pt(), mother.M(), cosThetaStarBeam, angle_phi); - for (int i = 0; i < config.cRotations; i++) { - theta2 = rn->Uniform(o2::constants::math::PI - o2::constants::math::PI / config.rotationalCut, o2::constants::math::PI + o2::constants::math::PI / config.rotationalCut); - motherRot = ROOT::Math::PxPyPzMVector(mother.Px() * std::cos(theta2) - mother.Py() * std::sin(theta2), mother.Px() * std::sin(theta2) + mother.Py() * std::cos(theta2), mother.Pz(), mother.M()); + } + for (int i = 0; i < config.cRotations; i++) { + theta2 = rn->Uniform(o2::constants::math::PI - o2::constants::math::PI / config.rotationalCut, o2::constants::math::PI + o2::constants::math::PI / config.rotationalCut); + motherRot = ROOT::Math::PxPyPzMVector(mother.Px() * std::cos(theta2) - mother.Py() * std::sin(theta2), mother.Px() * std::sin(theta2) + mother.Py() * std::cos(theta2), mother.Pz(), mother.M()); + if (std::abs(motherRot.Rapidity()) < 0.5) { hglue.fill(HIST("h3glueInvMassRot"), multiplicity, motherRot.Pt(), motherRot.M(), cosThetaStarBeam, angle_phi); } - } else { + } + } else { + if (std::abs(mother.Rapidity()) < 0.5) { hglue.fill(HIST("h3glueInvMassME"), multiplicity, mother.Pt(), mother.M(), cosThetaStarBeam, angle_phi); } - } else if (config.activateTHnSparseCosThStarRandom) { - auto phiRandom = gRandom->Uniform(0.f, constants::math::TwoPI); - auto thetaRandom = gRandom->Uniform(0.f, constants::math::PI); - - randomVec = ROOT::Math::XYZVector(std::sin(thetaRandom) * std::cos(phiRandom), std::sin(thetaRandom) * std::sin(phiRandom), std::cos(thetaRandom)); - auto cosThetaStarRandom = randomVec.Dot(fourVecDauCM.Vect()) / std::sqrt(fourVecDauCM.Vect().Mag2()); - if (!isMix) { + } + } else if (config.activateTHnSparseCosThStarRandom) { + auto phiRandom = gRandom->Uniform(0.f, constants::math::TwoPI); + auto thetaRandom = gRandom->Uniform(0.f, constants::math::PI); + + randomVec = ROOT::Math::XYZVector(std::sin(thetaRandom) * std::cos(phiRandom), std::sin(thetaRandom) * std::sin(phiRandom), std::cos(thetaRandom)); + auto cosThetaStarRandom = randomVec.Dot(fourVecDauCM.Vect()) / std::sqrt(fourVecDauCM.Vect().Mag2()); + if (!isMix) { + if (std::abs(mother.Rapidity()) < 0.5) { hglue.fill(HIST("h3glueInvMassDS"), multiplicity, mother.Pt(), mother.M(), cosThetaStarRandom, angle_phi); - for (int i = 0; i < config.cRotations; i++) { - theta2 = rn->Uniform(o2::constants::math::PI - o2::constants::math::PI / config.rotationalCut, o2::constants::math::PI + o2::constants::math::PI / config.rotationalCut); - motherRot = ROOT::Math::PxPyPzMVector(mother.Px() * std::cos(theta2) - mother.Py() * std::sin(theta2), mother.Px() * std::sin(theta2) + mother.Py() * std::cos(theta2), mother.Pz(), mother.M()); + } + for (int i = 0; i < config.cRotations; i++) { + theta2 = rn->Uniform(o2::constants::math::PI - o2::constants::math::PI / config.rotationalCut, o2::constants::math::PI + o2::constants::math::PI / config.rotationalCut); + motherRot = ROOT::Math::PxPyPzMVector(mother.Px() * std::cos(theta2) - mother.Py() * std::sin(theta2), mother.Px() * std::sin(theta2) + mother.Py() * std::cos(theta2), mother.Pz(), mother.M()); + if (std::abs(motherRot.Rapidity()) < 0.5) { hglue.fill(HIST("h3glueInvMassRot"), multiplicity, motherRot.Pt(), motherRot.M(), cosThetaStarRandom, angle_phi); } - } else { + } + } else { + if (std::abs(mother.Rapidity()) < 0.5) { hglue.fill(HIST("h3glueInvMassME"), multiplicity, mother.Pt(), mother.M(), cosThetaStarRandom, angle_phi); } } } + // } } void processSE(EventCandidates::iterator const& collision, TrackCandidates const& /*tracks*/, aod::V0Datas const& V0s) @@ -837,17 +860,289 @@ struct HigherMassResonances { } v0indexes.clear(); } - PROCESS_SWITCH(HigherMassResonances, processSE, "same event process", true); + using EventCandidatesDerivedData = soa::Join; + using V0CandidatesDerivedData = soa::Join; + using dauTracks = soa::Join; + + void processSEderived(EventCandidatesDerivedData::iterator const& collision, TrackCandidates const& /*tracks*/, aod::V0Datas const& V0s) + { + hglue.fill(HIST("heventscheck"), 0.5); + multiplicity = 0.0; + if (config.cfgMultFOTM) { + multiplicity = collision.centFT0M(); + } else { + multiplicity = collision.centFT0C(); + } + if (!eventselection(collision)) { + return; + } + + if (rctCut.requireRCTFlagChecker && !rctCut.rctChecker(collision)) { + return; + } + + // auto occupancyNumber = collision.trackOccupancyInTimeRange(); + // if (applyOccupancyCut && occupancyNumber < occupancyCut) { + // return; + // } + + if (config.qAevents) { + rEventSelection.fill(HIST("hVertexZRec"), collision.posZ()); + rEventSelection.fill(HIST("hmultiplicity"), multiplicity); + // rEventSelection.fill(HIST("multdist_FT0M"), collision.multFT0M()); + // rEventSelection.fill(HIST("multdist_FT0A"), collision.multFT0A()); + // rEventSelection.fill(HIST("multdist_FT0C"), collision.multFT0C()); + // rEventSelection.fill(HIST("hNcontributor"), collision.numContrib()); + } + + std::vector v0indexes; + bool allConditionsMet = 0; + + for (const auto& [v1, v2] : combinations(CombinationsFullIndexPolicy(V0s, V0s))) { + + if (v1.size() == 0 || v2.size() == 0) { + continue; + } + + if (!selectionV0(collision, v1, multiplicity)) { + continue; + } + if (!selectionV0(collision, v2, multiplicity)) { + continue; + } + + auto postrack1 = v1.template posTrack_as(); + auto negtrack1 = v1.template negTrack_as(); + auto postrack2 = v2.template posTrack_as(); + auto negtrack2 = v2.template negTrack_as(); + + double nTPCSigmaPos1{postrack1.tpcNSigmaPi()}; + double nTPCSigmaNeg1{negtrack1.tpcNSigmaPi()}; + double nTPCSigmaPos2{postrack2.tpcNSigmaPi()}; + double nTPCSigmaNeg2{negtrack2.tpcNSigmaPi()}; + + if (!(isSelectedV0Daughter(negtrack1, -1, nTPCSigmaNeg1, v1) && isSelectedV0Daughter(postrack1, 1, nTPCSigmaPos1, v1))) { + continue; + } + if (!(isSelectedV0Daughter(postrack2, 1, nTPCSigmaPos2, v2) && isSelectedV0Daughter(negtrack2, -1, nTPCSigmaNeg2, v2))) { + continue; + } + + if (std::find(v0indexes.begin(), v0indexes.end(), v1.globalIndex()) == v0indexes.end()) { + v0indexes.push_back(v1.globalIndex()); + } + // if (!(std::find(v0indexes.begin(), v0indexes.end(), v2.globalIndex()) != v0indexes.end())) { + // v0indexes.push_back(v2.globalIndex()); + // } + + if (v2.globalIndex() <= v1.globalIndex()) { + continue; + } + + // if (config.qAv0Daughters) { + // rKzeroShort.fill(HIST("negative_pt"), negtrack1.pt()); + // rKzeroShort.fill(HIST("positive_pt"), postrack1.pt()); + // rKzeroShort.fill(HIST("negative_eta"), negtrack1.eta()); + // rKzeroShort.fill(HIST("positive_eta"), postrack1.eta()); + // rKzeroShort.fill(HIST("negative_phi"), negtrack1.phi()); + // rKzeroShort.fill(HIST("positive_phi"), postrack1.phi()); + // } + + if (postrack1.globalIndex() == postrack2.globalIndex()) { + continue; + } + if (negtrack1.globalIndex() == negtrack2.globalIndex()) { + continue; + } + + if (!applyAngSep(v1, v2)) { + continue; + } + + if (config.qAv0) { + rKzeroShort.fill(HIST("hMasscorrelationbefore"), v1.mK0Short(), v2.mK0Short()); + } + allConditionsMet = 1; + daughter1 = ROOT::Math::PxPyPzMVector(v1.px(), v1.py(), v1.pz(), o2::constants::physics::MassK0Short); // Kshort + daughter2 = ROOT::Math::PxPyPzMVector(v2.px(), v2.py(), v2.pz(), o2::constants::physics::MassK0Short); // Kshort + + mother = daughter1 + daughter2; // invariant mass of Kshort pair + isMix = false; + + if (!config.selectTWOKsOnly) + fillInvMass(mother, multiplicity, daughter1, daughter2, isMix); + } + int sizeofv0indexes = v0indexes.size(); + rKzeroShort.fill(HIST("NksProduced"), sizeofv0indexes); + if (config.selectTWOKsOnly && sizeofv0indexes == 2 && allConditionsMet) { + fillInvMass(mother, multiplicity, daughter1, daughter2, false); + } + v0indexes.clear(); + } + PROCESS_SWITCH(HigherMassResonances, processSEderived, "same event process in strangeness derived data", true); + + ConfigurableAxis mevz = {"mevz", {10, -10., 10.}, "mixed event vertex z binning"}; + ConfigurableAxis memult = {"memult", {20, 0, 100}, "mixed event multiplicity binning"}; + + // Processing Event Mixing + using BinningType = ColumnBinningPolicy; + BinningType colBinning{{mevz, memult}, true}; + Preslice tracksPerCollisionV0Mixed = o2::aod::v0data::straCollisionId; // for derived data only + + void processMEderived(EventCandidatesDerivedData const& collisions, TrackCandidates const& /*tracks*/, V0CandidatesDerivedData const& v0s) + { + // auto tracksTuple = std::make_tuple(v0s); + // BinningTypeVertexContributor binningOnPositions1{{mevz, memult}, true}; + // BinningTypeCentralityM binningOnPositions2{{mevz, memult}, true}; + + // SameKindPair pair1{binningOnPositions1, config.cfgNmixedEvents, -1, collisions, tracksTuple, &cache}; // for PbPb + // SameKindPair pair2{binningOnPositions2, config.cfgNmixedEvents, -1, collisions, tracksTuple, &cache}; // for pp + + // if (config.cfgMultFOTM) { + for (const auto& [c1, c2] : selfCombinations(colBinning, config.cfgNmixedEvents, -1, collisions, collisions)) // two different centrality c1 and c2 and tracks corresponding to them + { + + multiplicity = 0.0; + multiplicity = c1.centFT0M(); + + if (!eventselection(c1) || !eventselection(c2)) { + continue; + } + // auto occupancyNumber = c1.trackOccupancyInTimeRange(); + // auto occupancyNumber2 = c2.trackOccupancyInTimeRange(); + // if (applyOccupancyCut && (occupancyNumber < occupancyCut || occupancyNumber2 < occupancyCut)) { + // return; + // } + + if (rctCut.requireRCTFlagChecker && !rctCut.rctChecker(c1)) { + return; + } + if (rctCut.requireRCTFlagChecker && !rctCut.rctChecker(c2)) { + return; + } + auto groupV01 = v0s.sliceBy(tracksPerCollisionV0Mixed, c1.index()); + auto groupV02 = v0s.sliceBy(tracksPerCollisionV0Mixed, c2.index()); + for (const auto& [t1, t2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(groupV01, groupV02))) { + + if (t1.size() == 0 || t2.size() == 0) { + continue; + } + + if (!selectionV0(c1, t1, multiplicity)) + continue; + if (!selectionV0(c2, t2, multiplicity)) + continue; + + auto postrack1 = t1.template posTrackExtra_as(); + auto negtrack1 = t1.template negTrackExtra_as(); + auto postrack2 = t2.template posTrackExtra_as(); + auto negtrack2 = t2.template negTrackExtra_as(); + + if (postrack1.globalIndex() == postrack2.globalIndex()) { + continue; + } + if (negtrack1.globalIndex() == negtrack2.globalIndex()) { + continue; + } + double nTPCSigmaPos1{postrack1.tpcNSigmaPi()}; + double nTPCSigmaNeg1{negtrack1.tpcNSigmaPi()}; + double nTPCSigmaPos2{postrack2.tpcNSigmaPi()}; + double nTPCSigmaNeg2{negtrack2.tpcNSigmaPi()}; + + if (!isSelectedV0Daughter(postrack1, 1, nTPCSigmaPos1, t1)) { + continue; + } + if (!isSelectedV0Daughter(postrack2, 1, nTPCSigmaPos2, t2)) { + continue; + } + if (!isSelectedV0Daughter(negtrack1, -1, nTPCSigmaNeg1, t1)) { + continue; + } + if (!isSelectedV0Daughter(negtrack2, -1, nTPCSigmaNeg2, t2)) { + continue; + } + + daughter1 = ROOT::Math::PxPyPzMVector(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassK0Short); // Kshort + daughter2 = ROOT::Math::PxPyPzMVector(t2.px(), t2.py(), t2.pz(), o2::constants::physics::MassK0Short); // Kshort + + mother = daughter1 + daughter2; // invariant mass of Kshort pair + isMix = true; + fillInvMass(mother, multiplicity, daughter1, daughter2, isMix); + } + } + // } + // else { + // for (const auto& [c1, tracks1, c2, tracks2] : pair1) // two different centrality c1 and c2 and tracks corresponding to them + // { + // multiplicity = 0.0f; + // multiplicity = c1.centFT0C(); + + // if (!eventselection(c1) || !eventselection(c2)) { + // continue; + // } + // // auto occupancyNumber = c1.trackOccupancyInTimeRange(); + // // auto occupancyNumber2 = c2.trackOccupancyInTimeRange(); + // // if (applyOccupancyCut && (occupancyNumber < occupancyCut || occupancyNumber2 < occupancyCut)) { + // // return; + // // } + + // for (const auto& [t1, t2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { + // if (t1.size() == 0 || t2.size() == 0) { + // continue; + // } + + // if (!selectionV0(c1, t1, multiplicity)) + // continue; + // if (!selectionV0(c2, t2, multiplicity)) + // continue; + + // auto postrack1 = t1.template posTrack_as(); + // auto negtrack1 = t1.template negTrack_as(); + // auto postrack2 = t2.template posTrack_as(); + // auto negtrack2 = t2.template negTrack_as(); + // if (postrack1.globalIndex() == postrack2.globalIndex()) { + // continue; + // } + // if (negtrack1.globalIndex() == negtrack2.globalIndex()) { + // continue; + // } + // double nTPCSigmaPos1{postrack1.tpcNSigmaPi()}; + // double nTPCSigmaNeg1{negtrack1.tpcNSigmaPi()}; + // double nTPCSigmaPos2{postrack2.tpcNSigmaPi()}; + // double nTPCSigmaNeg2{negtrack2.tpcNSigmaPi()}; + + // if (!isSelectedV0Daughter(postrack1, 1, nTPCSigmaPos1, t1)) { + // continue; + // } + // if (!isSelectedV0Daughter(postrack2, 1, nTPCSigmaPos2, t2)) { + // continue; + // } + // if (!isSelectedV0Daughter(negtrack1, -1, nTPCSigmaNeg1, t1)) { + // continue; + // } + // if (!isSelectedV0Daughter(negtrack2, -1, nTPCSigmaNeg2, t2)) { + // continue; + // } + // daughter1 = ROOT::Math::PxPyPzMVector(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassK0Short); // Kshort + // daughter2 = ROOT::Math::PxPyPzMVector(t2.px(), t2.py(), t2.pz(), o2::constants::physics::MassK0Short); // Kshort + + // mother = daughter1 + daughter2; // invariant mass of Kshort pair + // isMix = true; + // fillInvMass(mother, multiplicity, daughter1, daughter2, isMix); + // } + // } + // } + } + PROCESS_SWITCH(HigherMassResonances, processMEderived, "mixed event process in derived data", true); + array pvec0; array pvec1; // use any one of 3 alias depending on the dataset. If pp then FT0M and if pbpb then FTOC using BinningTypeTPCMultiplicity = ColumnBinningPolicy; using BinningTypeCentralityM = ColumnBinningPolicy; using BinningTypeVertexContributor = ColumnBinningPolicy; - ConfigurableAxis mevz = {"mevz", {10, -10., 10.}, "mixed event vertex z binning"}; - ConfigurableAxis memult = {"memult", {2000, 0, 10000}, "mixed event multiplicity binning"}; void processME(EventCandidates const& collisions, TrackCandidates const& /*tracks*/, V0TrackCandidate const& v0s) { From 97904701919c9165c56a4312666567c10497b790 Mon Sep 17 00:00:00 2001 From: Noor Koster <82090643+cnkoster@users.noreply.github.com> Date: Sat, 26 Jul 2025 15:15:23 +0200 Subject: [PATCH 081/345] [PWGCF] Add options for 2D QA track histos for centrality dependence (#12249) Co-authored-by: ALICE Action Bot --- PWGCF/Flow/Tasks/flowSP.cxx | 156 ++++++++++++++++++++++++++---------- 1 file changed, 114 insertions(+), 42 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowSP.cxx b/PWGCF/Flow/Tasks/flowSP.cxx index f37c15eac01..1442509bba0 100644 --- a/PWGCF/Flow/Tasks/flowSP.cxx +++ b/PWGCF/Flow/Tasks/flowSP.cxx @@ -14,35 +14,39 @@ /// \since 01/12/2024 /// \brief task to evaluate flow with respect to spectator plane. -#include -#include -#include -#include -#include -#include -#include -#include +#include "GFWWeights.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/RunningWorkflowInfo.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/O2DatabasePDGPlugin.h" +#include "PWGCF/DataModel/SPTableZDC.h" -#include "Common/DataModel/EventSelection.h" +#include "Common/Core/RecoDecay.h" #include "Common/Core/TrackSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/Centrality.h" -#include "Common/Core/RecoDecay.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "CCDB/BasicCCDBManager.h" +#include "DataFormatsParameters/GRPLHCIFData.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "DataFormatsParameters/GRPObject.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/O2DatabasePDGPlugin.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/runDataProcessing.h" -#include "PWGCF/DataModel/SPTableZDC.h" -#include "GFWWeights.h" #include "TF1.h" #include "TPDGCode.h" +#include +#include +#include +#include +#include +#include + using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; @@ -93,6 +97,7 @@ struct FlowSP { O2_DEFINE_CONFIGURABLE(cfgTrackSelsDCApt1, float, 0.1, "DcaZ < a * b / pt^1.1 -> this sets a"); O2_DEFINE_CONFIGURABLE(cfgTrackSelsDCApt2, float, 0.035, "DcaZ < a * b / pt^1.1 -> this sets b"); O2_DEFINE_CONFIGURABLE(cfgTrackSelsPIDNsigma, float, 2.0, "nSigma cut for PID"); + O2_DEFINE_CONFIGURABLE(cfgTrackSelDoTrackQAvsCent, bool, true, "Do track selection QA plots as function of centrality"); // Additional event selections O2_DEFINE_CONFIGURABLE(cfgEvSelsUseAdditionalEventCut, bool, true, "Bool to enable Additional Event Cut"); O2_DEFINE_CONFIGURABLE(cfgEvSelsMaxOccupancy, int, 10000, "Maximum occupancy of selected events"); @@ -366,15 +371,6 @@ struct FlowSP { if (cfgFillTrackQA) { registry.add("QA/after/pt_phi", "", {HistType::kTH2D, {axisPt, axisPhiMod}}); - registry.add("incl/QA/after/hPt", "", kTH1D, {axisPt}); - registry.add("incl/QA/after/hPt_forward", "", kTH1D, {axisPt}); - registry.add("incl/QA/after/hPt_forward_uncorrected", "", kTH1D, {axisPt}); - registry.add("incl/QA/after/hPt_backward", "", kTH1D, {axisPt}); - registry.add("incl/QA/after/hPt_backward_uncorrected", "", kTH1D, {axisPt}); - registry.add("incl/QA/after/hPhi", "", kTH1D, {axisPhi}); - registry.add("incl/QA/after/hPhi_uncorrected", "", kTH1D, {axisPhi}); - registry.add("incl/QA/after/hEta", "", kTH1D, {axisEta}); - registry.add("incl/QA/after/hEta_uncorrected", "", kTH1D, {axisEta}); registry.add("incl/QA/after/hPhi_Eta_vz", "", kTH3D, {axisPhi, axisEta, axisVz}); registry.add("incl/QA/after/hPhi_Eta_vz_corrected", "", kTH3D, {axisPhi, axisEta, axisVz}); registry.add("incl/QA/after/hDCAxy_pt", "", kTH2D, {axisPt, axisDCAxy}); @@ -383,6 +379,28 @@ struct FlowSP { registry.add("incl/QA/after/hCrossedRows_pt", "", {HistType::kTH2D, {axisPt, axisCl}}); registry.add("incl/QA/after/hCrossedRows_vs_SharedClusters", "", {HistType::kTH2D, {axisCl, axisShCl}}); + if (cfgTrackSelDoTrackQAvsCent) { + registry.add("incl/QA/after/hPt", "", kTH2D, {axisPt, axisCent}); + registry.add("incl/QA/after/hPt_forward", "", kTH2D, {axisPt, axisCent}); + registry.add("incl/QA/after/hPt_forward_uncorrected", "", kTH2D, {axisPt, axisCent}); + registry.add("incl/QA/after/hPt_backward", "", kTH2D, {axisPt, axisCent}); + registry.add("incl/QA/after/hPt_backward_uncorrected", "", kTH2D, {axisPt, axisCent}); + registry.add("incl/QA/after/hPhi", "", kTH2D, {axisPhi, axisCent}); + registry.add("incl/QA/after/hPhi_uncorrected", "", kTH2D, {axisPhi, axisCent}); + registry.add("incl/QA/after/hEta", "", kTH2D, {axisEta, axisCent}); + registry.add("incl/QA/after/hEta_uncorrected", "", kTH2D, {axisEta, axisCent}); + } else { + registry.add("incl/QA/after/hPt", "", kTH1D, {axisPt}); + registry.add("incl/QA/after/hPt_forward", "", kTH1D, {axisPt}); + registry.add("incl/QA/after/hPt_forward_uncorrected", "", kTH1D, {axisPt}); + registry.add("incl/QA/after/hPt_backward", "", kTH1D, {axisPt}); + registry.add("incl/QA/after/hPt_backward_uncorrected", "", kTH1D, {axisPt}); + registry.add("incl/QA/after/hPhi", "", kTH1D, {axisPhi}); + registry.add("incl/QA/after/hPhi_uncorrected", "", kTH1D, {axisPhi}); + registry.add("incl/QA/after/hEta", "", kTH1D, {axisEta}); + registry.add("incl/QA/after/hEta_uncorrected", "", kTH1D, {axisEta}); + } + if (cfgFillQABefore) registry.addClone("incl/QA/after/", "incl/QA/before/"); } @@ -656,6 +674,19 @@ struct FlowSP { return grpo->getNominalL3Field(); } + std::pair getCrossingAngleCCDB(uint64_t timestamp) + { + // TODO done only once (and not per run). Will be replaced by CCDBConfigurable + auto grpo = ccdb->getForTimeStamp("GLO/Config/GRPLHCIF", timestamp); + if (grpo == nullptr) { + LOGF(fatal, "GRP object for Crossing Angle not found for timestamp %llu", timestamp); + return {0, 0}; + } + float crossingAngle = grpo->getCrossingAngle(); + uint16_t crossingAngleTime = grpo->getCrossingAngleTime(); + return {crossingAngle, crossingAngleTime}; + } + // From Generic Framework void loadCorrections(uint64_t timestamp) { @@ -916,7 +947,7 @@ struct FlowSP { registry.fill(HIST("QA/") + HIST(Time[ft]) + HIST("/CentFT0C_vs_CentNGlobal"), collision.centFT0C(), collision.centNGlobal(), centWeight); if (cfgFillEventPlaneQA) { - if constexpr (framework::has_type_v) { + if constexpr (o2::framework::has_type_v) { double psiA = 1.0 * std::atan2(collision.qyA(), collision.qxA()); double psiC = 1.0 * std::atan2(collision.qyC(), collision.qxC()); double psiFull = 1.0 * std::atan2(collision.qyA() + collision.qyC(), collision.qxA() + collision.qxC()); @@ -1074,6 +1105,35 @@ struct FlowSP { registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hCrossedRows_vs_SharedClusters"), track.tpcNClsFound(), track.tpcFractionSharedCls(), wacc * weff); } + template + inline void fillTrackQA(TrackObject track, double vz, double centrality, float wacc = 1, float weff = 1) + { + if (!cfgFillTrackQA) + return; + + static constexpr std::string_view Time[] = {"before/", "after/"}; + // NOTE: species[kUnidentified] = "" (when no PID) + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPt"), track.pt(), centrality, wacc * weff); + if (track.eta() > 0) { + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPt_forward"), track.pt(), centrality, wacc * weff); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPt_forward_uncorrected"), track.pt(), centrality); + } else { + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPt_backward"), track.pt(), centrality, wacc * weff); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPt_backward_uncorrected"), track.pt(), centrality); + } + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi"), track.phi(), centrality, wacc); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi_uncorrected"), track.phi(), centrality); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hEta"), track.eta(), centrality, wacc); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hEta_uncorrected"), track.eta(), centrality); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi_Eta_vz"), track.phi(), track.eta(), vz); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hPhi_Eta_vz_corrected"), track.phi(), track.eta(), vz, wacc); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hDCAxy_pt"), track.pt(), track.dcaXY(), wacc * weff); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hDCAz_pt"), track.pt(), track.dcaZ(), wacc * weff); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hSharedClusters_pt"), track.pt(), track.tpcFractionSharedCls(), wacc * weff); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hCrossedRows_pt"), track.pt(), track.tpcNClsFound(), wacc * weff); + registry.fill(HIST(Charge[ct]) + HIST(Species[pt]) + HIST("QA/") + HIST(Time[ft]) + HIST("hCrossedRows_vs_SharedClusters"), track.tpcNClsFound(), track.tpcFractionSharedCls(), wacc * weff); + } + template inline void fillPIDQA(TrackObject track) { @@ -1141,15 +1201,27 @@ struct FlowSP { } template - void fillAllQA(TrackObject track, double vtxz, bool pos, float wacc = 1, float weff = 1, float waccP = 1, float weffP = 1, float waccN = 1, float weffN = 1) + void fillAllQA(TrackObject track, double vtxz, double centrality, bool pos, float wacc = 1, float weff = 1, float waccP = 1, float weffP = 1, float waccN = 1, float weffN = 1) { - fillTrackQA(track, vtxz, wacc, weff); + if (!cfgTrackSelDoTrackQAvsCent) { + fillTrackQA(track, vtxz, wacc, weff); + } else { + fillTrackQA(track, vtxz, centrality, wacc, weff); + } fillPIDQA(track); if (pos) { - fillTrackQA(track, vtxz, waccP, weffP); + if (!cfgTrackSelDoTrackQAvsCent) { + fillTrackQA(track, vtxz, waccP, weffP); + } else { + fillTrackQA(track, vtxz, centrality, waccP, weffP); + } fillPIDQA(track); } else { - fillTrackQA(track, vtxz, waccN, weffN); + if (!cfgTrackSelDoTrackQAvsCent) { + fillTrackQA(track, vtxz, waccN, weffN); + } else { + fillTrackQA(track, vtxz, centrality, waccN, weffN); + } fillPIDQA(track); } } @@ -1291,16 +1363,16 @@ struct FlowSP { if (cfgFillQABefore) { switch (trackPID) { case kUnidentified: - fillAllQA(track, vtxz, pos); + fillAllQA(track, vtxz, centrality, pos); break; case kPion: - fillAllQA(track, vtxz, pos); + fillAllQA(track, vtxz, centrality, pos); break; case kKaon: - fillAllQA(track, vtxz, pos); + fillAllQA(track, vtxz, centrality, pos); break; case kProton: - fillAllQA(track, vtxz, pos); + fillAllQA(track, vtxz, centrality, pos); break; } } @@ -1345,16 +1417,16 @@ struct FlowSP { switch (trackPID) { case kUnidentified: - fillAllQA(track, vtxz, pos, wacc, weff, waccP, weffP, waccN, weffN); + fillAllQA(track, vtxz, centrality, pos, wacc, weff, waccP, weffP, waccN, weffN); break; case kPion: - fillAllQA(track, vtxz, pos, wacc, weff, waccP, weffP, waccN, weffN); + fillAllQA(track, vtxz, centrality, pos, wacc, weff, waccP, weffP, waccN, weffN); break; case kKaon: - fillAllQA(track, vtxz, pos, wacc, weff, waccP, weffP, waccN, weffN); + fillAllQA(track, vtxz, centrality, pos, wacc, weff, waccP, weffP, waccN, weffN); break; case kProton: - fillAllQA(track, vtxz, pos, wacc, weff, waccP, weffP, waccN, weffN); + fillAllQA(track, vtxz, centrality, pos, wacc, weff, waccP, weffP, waccN, weffN); break; } From d922ee8e9a2d1e3e328129d19eb93cc11d995ebc Mon Sep 17 00:00:00 2001 From: omvazque Date: Sat, 26 Jul 2025 08:46:03 -0500 Subject: [PATCH 082/345] [PWGLF] Added more histos for MC closure (#12258) --- PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx | 916 ++++++++++--------- 1 file changed, 501 insertions(+), 415 deletions(-) diff --git a/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx b/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx index 584c3ecfc1b..ea894e460c3 100644 --- a/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx @@ -69,8 +69,8 @@ using SimTracks = soa::Join, kSizeBootStrapEnsemble> hPoisson{}; std::array, kSizeBootStrapEnsemble> hNch{}; +std::array, kSizeBootStrapEnsemble> hPoisson{}; std::array, kSizeBootStrapEnsemble> pNchVsOneParCorrVsZN{}; std::array, kSizeBootStrapEnsemble> pNchVsTwoParCorrVsZN{}; std::array, kSizeBootStrapEnsemble> pNchVsThreeParCorrVsZN{}; @@ -83,18 +83,24 @@ std::array, kSizeBootStrapEnsemble> pOneParCorrVsV0A{} std::array, kSizeBootStrapEnsemble> pTwoParCorrVsV0A{}; std::array, kSizeBootStrapEnsemble> pThreeParCorrVsV0A{}; +std::array, kSizeBootStrapEnsemble> pOneParCorrVsNch{}; +std::array, kSizeBootStrapEnsemble> pTwoParCorrVsNch{}; +std::array, kSizeBootStrapEnsemble> pThreeParCorrVsNch{}; + std::array, kSizeBootStrapEnsemble> hPoissonMC{}; std::array, kSizeBootStrapEnsemble> hNchGen{}; -std::array, kSizeBootStrapEnsemble> pNchvsOneParCorrGen{}; -std::array, kSizeBootStrapEnsemble> pNchvsTwoParCorrGen{}; -std::array, kSizeBootStrapEnsemble> pNchvsThreeParCorrGen{}; -std::array, kSizeBootStrapEnsemble> pNchvsFourParCorrGen{}; -std::array, kSizeBootStrapEnsemble> hNchRec{}; -std::array, kSizeBootStrapEnsemble> pNchvsOneParCorrRec{}; -std::array, kSizeBootStrapEnsemble> pNchvsTwoParCorrRec{}; -std::array, kSizeBootStrapEnsemble> pNchvsThreeParCorrRec{}; -std::array, kSizeBootStrapEnsemble> pNchvsFourParCorrRec{}; +// std::array, kSizeBootStrapEnsemble> pOneParCorrVsT0MGen{}; +// std::array, kSizeBootStrapEnsemble> pTwoParCorrVsT0MGen{}; +// std::array, kSizeBootStrapEnsemble> pThreeParCorrVsT0MGen{}; +// +// std::array, kSizeBootStrapEnsemble> pOneParCorrVsV0AGen{}; +// std::array, kSizeBootStrapEnsemble> pTwoParCorrVsV0AGen{}; +// std::array, kSizeBootStrapEnsemble> pThreeParCorrVsV0AGen{}; + +std::array, kSizeBootStrapEnsemble> pOneParCorrVsNchGen{}; +std::array, kSizeBootStrapEnsemble> pTwoParCorrVsNchGen{}; +std::array, kSizeBootStrapEnsemble> pThreeParCorrVsNchGen{}; struct UccZdc { @@ -317,34 +323,32 @@ struct UccZdc { xEvtsDiv->SetBinLabel(1, "MC closure"); xEvtsDiv->SetBinLabel(2, "Corrections"); // MC closure - registry.add("NchGen", "MC closure;#it{N}_{ch} (|#eta| < 0.8);Entries;", kTH1F, {{nBinsNch, minNch, maxNch}}); - registry.add("NchvsOneParCorrGen", "MC closure;#it{N}_{ch} (|#eta| < 0.8);#LT[#it{p}_{T}^{(1)}]#GT (GeV/#it{c})", kTProfile, {{nBinsNch, minNch, maxNch}}); - registry.add("NchvsTwoParCorrGen", "MC closure;#it{N}_{ch} (|#eta| < 0.8);#LT[#it{p}_{T}^{(2)}]#GT", kTProfile, {{nBinsNch, minNch, maxNch}}); - registry.add("NchvsThreeParCorrGen", "MC closure;#it{N}_{ch} (|#eta| < 0.8);#LT[#it{p}_{T}^{(3)}]#GT", kTProfile, {{nBinsNch, minNch, maxNch}}); - registry.add("NchvsFourParCorrGen", "MC closure;#it{N}_{ch} (|#eta| < 0.8);#LT[#it{p}_{T}^{(4)}]#GT", kTProfile, {{nBinsNch, minNch, maxNch}}); - registry.add("NchVsTwoParCorr", "MC closure;#it{N}_{ch} (|#eta| < 0.8, Corrected);#LT[#it{p}_{T}^{(2)}]#GT", kTProfile, {{nBinsNch, minNch, maxNch}}); - registry.add("NchVsThreeParCorr", "MC closure;#it{N}_{ch} (|#eta| < 0.8, Corrected);#LT[#it{p}_{T}^{(3)}]#GT", kTProfile, {{nBinsNch, minNch, maxNch}}); - registry.add("NchVsFourParCorr", "MC closure;#it{N}_{ch} (|#eta| < 0.8, Corrected);#LT[#it{p}_{T}^{(4)}]#GT", kTProfile, {{nBinsNch, minNch, maxNch}}); + registry.add("NchGen", Form("MC Closure;%s;Entries", tiNch), kTH1F, {{nBinsNch, minNch, maxNch}}); + registry.add("NchvsOneParCorrGen", Form("MC Closure;%s;%s", tiNch, tiOneParCorr), kTProfile, {{nBinsNch, minNch, maxNch}}); + registry.add("NchvsTwoParCorrGen", Form("MC Closure;%s;%s", tiNch, tiTwoParCorr), kTProfile, {{nBinsNch, minNch, maxNch}}); + registry.add("NchvsThreeParCorrGen", Form("MC Closure;%s;%s", tiNch, tiThreeParCorr), kTProfile, {{nBinsNch, minNch, maxNch}}); + registry.add("NchVsTwoParCorr", Form("MC Closure;%s;%s", tiNch, tiTwoParCorr), kTProfile, {{nBinsNch, minNch, maxNch}}); + registry.add("NchVsThreeParCorr", Form("MC Closure;%s;%s", tiNch, tiThreeParCorr), kTProfile, {{nBinsNch, minNch, maxNch}}); // Corrections registry.add("zPosMC", "Filled at MC closure + Corrections;;Entries;", kTH1F, {axisZpos}); registry.add("hEventCounterMC", "Event counter", kTH1F, {axisEvent}); registry.add("nRecColvsCent", "", kTH2F, {{6, -0.5, 5.5}, {{axisCent}}}); - registry.add("Pt_all_ch", "Corrections;#it{N}_{ch} (|#eta|<0.8);;", kTH2F, {{nBinsNch, minNch, maxNch}, {axisPt}}); - registry.add("Pt_ch", "Corrections;#it{N}_{ch} (|#eta|<0.8);;", kTH2F, {{nBinsNch, minNch, maxNch}, {axisPt}}); - registry.add("Pt_pi", "Corrections;#it{N}_{ch} (|#eta|<0.8);;", kTH2F, {{nBinsNch, minNch, maxNch}, {axisPt}}); - registry.add("Pt_ka", "Corrections;#it{N}_{ch} (|#eta|<0.8);;", kTH2F, {{nBinsNch, minNch, maxNch}, {axisPt}}); - registry.add("Pt_pr", "Corrections;#it{N}_{ch} (|#eta|<0.8);;", kTH2F, {{nBinsNch, minNch, maxNch}, {axisPt}}); - registry.add("Pt_sigpos", "Corrections;;;", kTH2F, {{nBinsNch, minNch, maxNch}, {axisPt}}); - registry.add("Pt_signeg", "Corrections;;;", kTH2F, {{nBinsNch, minNch, maxNch}, {axisPt}}); - registry.add("Pt_re", "Corrections;;;", kTH2F, {{nBinsNch, minNch, maxNch}, {axisPt}}); - registry.add("PtMC_ch", "Corrections;;;", kTH2F, {{nBinsNch, minNch, maxNch}, {axisPt}}); - registry.add("PtMC_pi", "Corrections;;;", kTH2F, {{nBinsNch, minNch, maxNch}, {axisPt}}); - registry.add("PtMC_ka", "Corrections;;;", kTH2F, {{nBinsNch, minNch, maxNch}, {axisPt}}); - registry.add("PtMC_pr", "Corrections;;;", kTH2F, {{nBinsNch, minNch, maxNch}, {axisPt}}); - registry.add("PtMC_sigpos", "Corrections;;;", kTH2F, {{nBinsNch, minNch, maxNch}, {axisPt}}); - registry.add("PtMC_signeg", "Corrections;;;", kTH2F, {{nBinsNch, minNch, maxNch}, {axisPt}}); - registry.add("PtMC_re", "Corrections;;;", kTH2F, {{nBinsNch, minNch, maxNch}, {axisPt}}); - registry.add("McNchVsFT0M", ";T0A+T0C (#times 1/100, -3.3 < #eta < -2.1 and 3.5 < #eta < 4.9);#it{N}_{ch} (|#eta|<0.8);", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsNch, minNch, maxNch}}}); + registry.add("Pt_all_ch", Form("Corrections;%s;%s", tiNch, tiPt), kTH2F, {{nBinsNch, minNch, maxNch}, {axisPt}}); + registry.add("Pt_ch", Form("Corrections;%s;%s", tiNch, tiPt), kTH2F, {{nBinsNch, minNch, maxNch}, {axisPt}}); + registry.add("Pt_pi", Form("Corrections;%s;%s", tiNch, tiPt), kTH2F, {{nBinsNch, minNch, maxNch}, {axisPt}}); + registry.add("Pt_ka", Form("Corrections;%s;%s", tiNch, tiPt), kTH2F, {{nBinsNch, minNch, maxNch}, {axisPt}}); + registry.add("Pt_pr", Form("Corrections;%s;%s", tiNch, tiPt), kTH2F, {{nBinsNch, minNch, maxNch}, {axisPt}}); + registry.add("Pt_sigpos", Form("Corrections;%s;%s", tiNch, tiPt), kTH2F, {{nBinsNch, minNch, maxNch}, {axisPt}}); + registry.add("Pt_signeg", Form("Corrections;%s;%s", tiNch, tiPt), kTH2F, {{nBinsNch, minNch, maxNch}, {axisPt}}); + registry.add("Pt_re", Form("Corrections;%s;%s", tiNch, tiPt), kTH2F, {{nBinsNch, minNch, maxNch}, {axisPt}}); + registry.add("PtMC_ch", Form("Corrections;%s;%s", tiNch, tiPt), kTH2F, {{nBinsNch, minNch, maxNch}, {axisPt}}); + registry.add("PtMC_pi", Form("Corrections;%s;%s", tiNch, tiPt), kTH2F, {{nBinsNch, minNch, maxNch}, {axisPt}}); + registry.add("PtMC_ka", Form("Corrections;%s;%s", tiNch, tiPt), kTH2F, {{nBinsNch, minNch, maxNch}, {axisPt}}); + registry.add("PtMC_pr", Form("Corrections;%s;%s", tiNch, tiPt), kTH2F, {{nBinsNch, minNch, maxNch}, {axisPt}}); + registry.add("PtMC_sigpos", Form("Corrections;%s;%s", tiNch, tiPt), kTH2F, {{nBinsNch, minNch, maxNch}, {axisPt}}); + registry.add("PtMC_signeg", Form("Corrections;%s;%s", tiNch, tiPt), kTH2F, {{nBinsNch, minNch, maxNch}, {axisPt}}); + registry.add("PtMC_re", Form("Corrections;%s;%s", tiNch, tiPt), kTH2F, {{nBinsNch, minNch, maxNch}, {axisPt}}); + registry.add("McNchVsFT0M", Form("Corrections;%s;%s", tiT0M, tiNch), kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsNch, minNch, maxNch}}}); auto hECMC = registry.get(HIST("hEventCounterMC")); auto* x = hECMC->GetXaxis(); @@ -352,18 +356,36 @@ struct UccZdc { x->SetBinLabel(13, "VtxZ cut"); for (int i = 0; i < kSizeBootStrapEnsemble; i++) { - hPoissonMC[i] = registry.add(Form("PoissonMC_Replica%d", i), ";#it{k};Entries", kTH1F, {{21, -0.5, 20.5}}); - hNchGen[i] = registry.add(Form("NchGen_Replica%d", i), ";#it{N}_{ch} (|#eta| < 0.8);Entries", kTH1F, {{nBinsNch, minNch, maxNch}}); - pNchvsOneParCorrGen[i] = registry.add(Form("NchvsOneParCorrGen_Replica%d", i), ";#it{N}_{ch}, |#eta| < 0.8; One-particle #it{p}_{T} correlator", kTProfile, {{nBinsNch, minNch, maxNch}}); - pNchvsTwoParCorrGen[i] = registry.add(Form("NchvsTwoParCorrGen_Replica%d", i), ";#it{N}_{ch}, |#eta| < 0.8; Two-particle #it{p}_{T} correlator", kTProfile, {{nBinsNch, minNch, maxNch}}); - pNchvsThreeParCorrGen[i] = registry.add(Form("NchvsThreeParCorrGen_Replica%d", i), ";#it{N}_{ch}, |#eta| < 0.8; Three-particle #it{p}_{T} correlator", kTProfile, {{nBinsNch, minNch, maxNch}}); - pNchvsFourParCorrGen[i] = registry.add(Form("NchvsFourParCorrGen_Replica%d", i), ";#it{N}_{ch}, |#eta| < 0.8; Four-particle #it{p}_{T} correlator", kTProfile, {{nBinsNch, minNch, maxNch}}); - - hNchRec[i] = registry.add(Form("NchRec_Replica%d", i), ";#it{N}_{ch} (|#eta| < 0.8);Entries", kTH1F, {{nBinsNch, minNch, maxNch}}); - pNchvsOneParCorrRec[i] = registry.add(Form("NchvsOneParCorrRec_Replica%d", i), ";#it{N}_{ch}, |#eta| < 0.8; One-particle #it{p}_{T} correlator", kTProfile, {{nBinsNch, minNch, maxNch}}); - pNchvsTwoParCorrRec[i] = registry.add(Form("NchvsTwoParCorrRec_Replica%d", i), ";#it{N}_{ch}, |#eta| < 0.8; Two-particle #it{p}_{T} correlator", kTProfile, {{nBinsNch, minNch, maxNch}}); - pNchvsThreeParCorrRec[i] = registry.add(Form("NchvsThreeParCorrRec_Replica%d", i), ";#it{N}_{ch}, |#eta| < 0.8; Three-particle #it{p}_{T} correlator", kTProfile, {{nBinsNch, minNch, maxNch}}); - pNchvsFourParCorrRec[i] = registry.add(Form("NchvsFourParCorrRec_Replica%d", i), ";#it{N}_{ch}, |#eta| < 0.8; Four-particle #it{p}_{T} correlator", kTProfile, {{nBinsNch, minNch, maxNch}}); + + hPoissonMC[i] = registry.add(Form("PoissonMC_Replica%d", i), ";#it{k};Entries", kTH1F, {{11, -0.5, 10.5}}); + hNchGen[i] = registry.add(Form("NchGen_Replica%d", i), Form(";%s;Entries", tiNch), kTH1F, {{nBinsNch, minNch, maxNch}}); + + pOneParCorrVsNchGen[i] = registry.add(Form("OneParCorrVsNchGen_Replica%d", i), Form(";%s;%s;", tiNch, tiOneParCorr), kTProfile, {{nBinsNch, minNch, maxNch}}); + pTwoParCorrVsNchGen[i] = registry.add(Form("TwoParCorrVsNchGen_Replica%d", i), Form(";%s;%s;", tiNch, tiTwoParCorr), kTProfile, {{nBinsNch, minNch, maxNch}}); + pThreeParCorrVsNchGen[i] = registry.add(Form("ThreeParCorrVsNchGen_Replica%d", i), Form(";%s;%s;", tiNch, tiThreeParCorr), kTProfile, {{nBinsNch, minNch, maxNch}}); + + // pOneParCorrVsT0MGen[i] = registry.add(Form("OneParCorrVsT0MGen_Replica%d",i),Form(";%s;%s;",tiT0M,tiOneParCorr), kTProfile,{{nBinsAmpFT0,0.,maxAmpFT0}}); + // pTwoParCorrVsT0MGen[i] = registry.add(Form("TwoParCorrVsT0MGen_Replica%d",i),Form(";%s;%s;",tiT0M,tiTwoParCorr), kTProfile,{{nBinsAmpFT0,0.,maxAmpFT0}}); + // pThreeParCorrVsT0MGen[i] = registry.add(Form("ThreeParCorrVsT0MGen_Replica%d",i),Form(";%s;%s;",tiT0M,tiThreeParCorr), kTProfile,{{nBinsAmpFT0,0.,maxAmpFT0}}); + + // pOneParCorrVsV0AGen[i] = registry.add(Form("OneParCorrVsV0AGen_Replica%d",i),Form(";%s;%s;",tiT0M,tiOneParCorr), kTProfile,{{nBinsAmpFT0,0.,maxAmpFT0}}); + // pTwoParCorrVsV0AGen[i] = registry.add(Form("TwoParCorrVsV0AGen_Replica%d",i),Form(";%s;%s;",tiT0M,tiTwoParCorr), kTProfile,{{nBinsAmpFT0,0.,maxAmpFT0}}); + // pThreeParCorrVsV0AGen[i] = registry.add(Form("ThreeParCorrVsV0AGen_Replica%d",i),Form(";%s;%s;",tiT0M,tiThreeParCorr), kTProfile,{{nBinsAmpFT0,0.,maxAmpFT0}}); + + hNch[i] = registry.add(Form("Nch_Replica%d", i), Form(";%s;Entries", tiNch), kTH1F, {{nBinsNch, minNch, maxNch}}); + hPoisson[i] = registry.add(Form("Poisson_Replica%d", i), ";#it{k};Entries", kTH1F, {{11, -0.5, 10.5}}); + + pOneParCorrVsNch[i] = registry.add(Form("OneParCorrVsNch_Replica%d", i), Form(";%s;%s;", tiNch, tiOneParCorr), kTProfile, {{nBinsNch, minNch, maxNch}}); + pTwoParCorrVsNch[i] = registry.add(Form("TwoParCorrVsNch_Replica%d", i), Form(";%s;%s;", tiNch, tiTwoParCorr), kTProfile, {{nBinsNch, minNch, maxNch}}); + pThreeParCorrVsNch[i] = registry.add(Form("ThreeParCorrVsNch_Replica%d", i), Form(";%s;%s;", tiNch, tiTwoParCorr), kTProfile, {{nBinsNch, minNch, maxNch}}); + + // pOneParCorrVsT0M[i] = registry.add(Form("OneParCorrVsT0M_Replica%d",i),Form(";%s;%s;",tiT0M,tiOneParCorr),kTProfile,{{nBinsAmpFT0,0.,maxAmpFT0}}); + // pTwoParCorrVsT0M[i] = registry.add(Form("TwoParCorrVsT0M_Replica%d",i),Form(";%s;%s;",tiT0M,tiTwoParCorr),kTProfile,{{nBinsAmpFT0,0.,maxAmpFT0}}); + // pThreeParCorrVsT0M[i] = registry.add(Form("ThreeParCorrVsT0M_Replica%d",i),Form(";%s;%s;",tiT0M,tiThreeParCorr),kTProfile,{{nBinsAmpFT0,0.,maxAmpFT0}}); + // + // pOneParCorrVsV0A[i] = registry.add(Form("OneParCorrVsV0A_Replica%d",i),Form(";%s;%s;",tiV0A,tiOneParCorr),kTProfile,{{nBinsAmpV0A,0.,maxAmpV0A}}); + // pTwoParCorrVsV0A[i] = registry.add(Form("TwoParCorrVsV0A_Replica%d",i),Form(";%s;%s;",tiV0A,tiTwoParCorr),kTProfile,{{nBinsAmpV0A,0.,maxAmpV0A}}); + // pThreeParCorrVsV0A[i] = registry.add(Form("ThreeParCorrVsV0A_Replica%d",i),Form(";%s;%s;",tiV0A,tiThreeParCorr),kTProfile,{{nBinsAmpV0A,0.,maxAmpV0A}}); } } @@ -756,7 +778,7 @@ struct UccZdc { } // Nch-based selection - int glbTracks = 0; + int glbTracks{0}; for (const auto& track : tracks) { // Track Selection if (!track.isGlobalTrack()) { @@ -809,7 +831,7 @@ struct UccZdc { return; } - double nchMult{0.}; + double nchMult{static_cast(glbTracks)}; std::vector pTs; std::vector vecFD; std::vector vecEff; @@ -953,165 +975,9 @@ struct UccZdc { } PROCESS_SWITCH(UccZdc, processZdcCollAss, "Process ZDC W/Coll Ass.", true); - template - void eventSampling(const T& tracks, const U& normV0A, const U& normT0M, const U& sumZNs, const V& timeStamp) - { - TRandom3 rndGen(timeStamp); - std::vector vPoisson; - for (int replica = 0; replica < kSizeBootStrapEnsemble; ++replica) - vPoisson.emplace_back(rndGen.Poisson(1.)); - - for (int replica = 0; replica < kSizeBootStrapEnsemble; ++replica) { - - hPoisson[replica]->Fill(vPoisson.at(replica)); - - for (uint64_t evtRep = 0; evtRep < vPoisson.at(replica); ++evtRep) { - - double nchMult{0.}; - int glbTracks{0}; - std::vector pTs; - std::vector vecFD; - std::vector vecEff; - - // Calculates the uncorrected Nch multiplicity - for (const auto& track : tracks) { - // Track Selection - if (!track.isGlobalTrack()) { - continue; - } - if ((track.pt() < minPt) || (track.pt() > maxPt)) { - continue; - } - if ((track.eta() < minEta) || (track.eta() > maxEta)) { - continue; - } - glbTracks++; - } - - if (glbTracks < minNchSel) { - continue; - } - - // Calculates the Nch multiplicity if corrections are loaded - if (cfg.correctionsLoaded) { - const int foundNchBin{cfg.hEfficiency->GetXaxis()->FindBin(glbTracks)}; - for (const auto& track : tracks) { - // Track Selection - if (!track.isGlobalTrack()) { - continue; - } - if ((track.pt() < minPt) || (track.pt() > maxPt)) { - continue; - } - if ((track.eta() < minEta) || (track.eta() > maxEta)) { - continue; - } - - float pt{track.pt()}; - double fdValue{1.}; - int foundPtBin{cfg.hEfficiency->GetYaxis()->FindBin(pt)}; - double effValue{cfg.hEfficiency->GetBinContent(foundNchBin, foundPtBin)}; - - if (applyFD) - fdValue = cfg.hFeedDown->GetBinContent(foundNchBin, foundPtBin); - if ((effValue > 0.) && (fdValue > 0.)) { - nchMult += (std::pow(effValue, -1.) * fdValue); - } - } - } - - if (!applyEff) - nchMult = static_cast(glbTracks); - if (applyEff && !correctNch) - nchMult = static_cast(glbTracks); - - // Fill vectors for [pT] measurement - if (cfg.correctionsLoaded) { - const int foundNchBin{cfg.hEfficiency->GetXaxis()->FindBin(glbTracks)}; - // Fill vectors for [pT] measurement - for (const auto& track : tracks) { - // Track Selection - if (!track.isGlobalTrack()) { - continue; - } - if ((track.pt() < minPt) || (track.pt() > maxPtSpectra)) { - continue; - } - if ((track.eta() < minEta) || (track.eta() > maxEta)) { - continue; - } - - float pt{track.pt()}; - double fdValue{1.}; - int foundPtBin{cfg.hEfficiency->GetYaxis()->FindBin(pt)}; - double effValue{cfg.hEfficiency->GetBinContent(foundNchBin, foundPtBin)}; - - if (applyFD) - fdValue = cfg.hFeedDown->GetBinContent(foundNchBin, foundPtBin); - - if ((effValue > 0.) && (fdValue > 0.)) { - pTs.emplace_back(pt); - vecEff.emplace_back(effValue); - vecFD.emplace_back(fdValue); - // To calculate event-averaged - registry.fill(HIST("NchVsZNVsPt"), nchMult, sumZNs, pt * (fdValue / effValue)); - } - } - } else { - for (const auto& track : tracks) { - // Track Selection - if (!track.isGlobalTrack()) { - continue; - } - if ((track.pt() < minPt) || (track.pt() > maxPtSpectra)) { - continue; - } - - pTs.emplace_back(track.pt()); - vecEff.emplace_back(1.); - vecFD.emplace_back(1.); - - // To calculate event-averaged - registry.fill(HIST("NchVsZNVsPt"), nchMult, sumZNs, track.pt()); - } - } - - double p1, p2, p3, p4, w1, w2, w3, w4; - p1 = p2 = p3 = p4 = w1 = w2 = w3 = w4 = 0.0; - getPTpowers(pTs, vecEff, vecFD, p1, w1, p2, w2, p3, w3, p4, w4); - - // EbE one-particle pT correlation - const double oneParCorr{p1 / w1}; - - // EbE two-particle pT correlation - const double denTwoParCorr{std::pow(w1, 2.) - w2}; - const double numTwoParCorr{std::pow(p1, 2.) - p2}; - const double twoParCorr{numTwoParCorr / denTwoParCorr}; - - // EbE three-particle pT correlation - const double denThreeParCorr{std::pow(w1, 3.) - 3. * w2 * w1 + 2. * w3}; - const double numThreeParCorr{std::pow(p1, 3.) - 3. * p2 * p1 + 2. * p3}; - const double threeParCorr{numThreeParCorr / denThreeParCorr}; - - hNch[replica]->Fill(nchMult); - pNchVsOneParCorrVsZN[replica]->Fill(nchMult, sumZNs, oneParCorr, w1); - pNchVsTwoParCorrVsZN[replica]->Fill(nchMult, sumZNs, twoParCorr, denTwoParCorr); - pNchVsThreeParCorrVsZN[replica]->Fill(nchMult, sumZNs, threeParCorr, denThreeParCorr); - - pOneParCorrVsV0A[replica]->Fill(normV0A, oneParCorr, w1); - pTwoParCorrVsV0A[replica]->Fill(normV0A, twoParCorr, denTwoParCorr); - pThreeParCorrVsV0A[replica]->Fill(normV0A, threeParCorr, denThreeParCorr); - - pOneParCorrVsT0M[replica]->Fill(normT0M, oneParCorr, w1); - pTwoParCorrVsT0M[replica]->Fill(normT0M, twoParCorr, denTwoParCorr); - pThreeParCorrVsT0M[replica]->Fill(normT0M, threeParCorr, denThreeParCorr); - } // event per replica - } // replica's loop - } - Preslice perCollision = aod::track::collisionId; Service pdg; - void processMCclosure(aod::McCollisions::iterator const& mccollision, soa::SmallGroups const& collisions, o2::aod::BCsRun3 const& /*bcs*/, aod::FT0s const& /*ft0s*/, aod::McParticles const& mcParticles, TheFilteredSimTracks const& simTracks) + void processMCclosure(aod::McCollisions::iterator const& mccollision, soa::SmallGroups const& collisions, o2::aod::BCsRun3 const& /*bcs*/, aod::FT0s const& /*ft0s*/, aod::FV0As const& /*fv0as*/, aod::McParticles const& mcParticles, TheFilteredSimTracks const& simTracks) { for (const auto& collision : collisions) { // Event selection @@ -1136,7 +1002,7 @@ struct UccZdc { const double rndNum{rndGen.Uniform(0.0, 1.0)}; registry.fill(HIST("RandomNumber"), rndNum); - float aT0A = 0., aT0C = 0.; + double aT0A = 0., aT0C = 0.; if (foundBC.has_ft0()) { for (const auto& amplitude : foundBC.ft0().amplitudeA()) { aT0A += amplitude; @@ -1148,11 +1014,17 @@ struct UccZdc { return; } + // double aV0A{-999.}; + // if (foundBC.has_fv0a()) { + // for (const auto& amplitude : foundBC.fv0a().amplitude()) { aV0A += amplitude; } + // } + + const double normT0M{(aT0A + aT0C) / 100.}; + // const double normV0A{aV0A/100.}; + double nchRaw{0.}; double nchMult{0.}; double nchMC{0.}; - double normT0M{0.}; - normT0M = (aT0A + aT0C) / 100.; registry.fill(HIST("zPos"), collision.posZ()); registry.fill(HIST("zPosMC"), mccollision.posZ()); @@ -1174,15 +1046,10 @@ struct UccZdc { registry.fill(HIST("EvtsDivided"), 0); - // To use run-by-run efficiency - auto efficiency = ccdb->getForTimeStamp(paTHEff.value, foundBC.timestamp()); - if (!efficiency) { - return; - } - - auto feedDown = ccdb->getForTimeStamp(paTHFD.value, foundBC.timestamp()); - if (!feedDown) { - return; + // Run-by-run efficiency + loadCorrections(foundBC.timestamp()); + if (!(cfg.hEfficiency && cfg.hFeedDown)) { + continue; } std::vector pTs; @@ -1204,8 +1071,13 @@ struct UccZdc { nchRaw++; } + // Reject event if nchRaw less than a lower cutoff + if (nchRaw < minNchSel) { + return; + } + // Calculates the event weight, W_k - const int foundNchBin{efficiency->GetXaxis()->FindBin(nchRaw)}; + const int foundNchBin{cfg.hEfficiency->GetXaxis()->FindBin(nchRaw)}; for (const auto& track : groupedTracks) { // Track Selection @@ -1240,14 +1112,12 @@ struct UccZdc { // if (!particle.isPhysicalPrimary()) { continue; } const double pt{static_cast(track.pt())}; - const int foundPtBin{efficiency->GetYaxis()->FindBin(pt)}; - double effValue{1.}; + const int foundPtBin{cfg.hEfficiency->GetYaxis()->FindBin(pt)}; + const double effValue{cfg.hEfficiency->GetBinContent(foundNchBin, foundPtBin)}; double fdValue{1.}; - if (applyEff) { - effValue = efficiency->GetBinContent(foundNchBin, foundPtBin); - fdValue = feedDown->GetBinContent(foundNchBin, foundPtBin); - } + if (applyFD) + fdValue = cfg.hFeedDown->GetBinContent(foundNchBin, foundPtBin); if ((effValue > 0.) && (fdValue > 0.)) { pTs.emplace_back(pt); vecEff.emplace_back(effValue); @@ -1256,10 +1126,6 @@ struct UccZdc { } } - if (nchMult < minNchSel) { - return; - } - double p1, p2, p3, p4, w1, w2, w3, w4; p1 = p2 = p3 = p4 = w1 = w2 = w3 = w4 = 0.0; getPTpowers(pTs, vecEff, vecFD, p1, w1, p2, w2, p3, w3, p4, w4); @@ -1268,20 +1134,18 @@ struct UccZdc { const double numTwoParCorr{std::pow(p1, 2.) - p2}; const double denThreeParCorr{std::pow(w1, 3.) - 3. * w2 * w1 + 2. * w3}; const double numThreeParCorr{std::pow(p1, 3.) - 3. * p2 * p1 + 2. * p3}; - const double denFourParCorr{std::pow(w1, 4.) - 6. * w2 * std::pow(w1, 2.) + 3. * std::pow(w2, 2.) + 8 * w3 * w1 - 6. * w4}; - const double numFourParCorr{std::pow(p1, 4.) - 6. * p2 * std::pow(p1, 2.) + 3. * std::pow(p2, 2.) + 8 * p3 * p1 - 6. * p4}; + // const double denFourParCorr{std::pow(w1, 4.) - 6. * w2 * std::pow(w1, 2.) + 3. * std::pow(w2, 2.) + 8 * w3 * w1 - 6. * w4}; + // const double numFourParCorr{std::pow(p1, 4.) - 6. * p2 * std::pow(p1, 2.) + 3. * std::pow(p2, 2.) + 8 * p3 * p1 - 6. * p4}; const double oneParCorr{p1 / w1}; const double twoParCorr{numTwoParCorr / denTwoParCorr}; const double threeParCorr{numThreeParCorr / denThreeParCorr}; - const double fourParCorr{numFourParCorr / denFourParCorr}; registry.fill(HIST("Nch"), nchMult); registry.fill(HIST("NchUncorrected"), nchRaw); registry.fill(HIST("NchVsOneParCorr"), nchMult, oneParCorr, w1); registry.fill(HIST("NchVsTwoParCorr"), nchMult, twoParCorr, denTwoParCorr); registry.fill(HIST("NchVsThreeParCorr"), nchMult, threeParCorr, denThreeParCorr); - registry.fill(HIST("NchVsFourParCorr"), nchMult, fourParCorr, denFourParCorr); //--------------------------- Generated MC --------------------------- std::vector pTsMC; @@ -1335,200 +1199,22 @@ struct UccZdc { const double numTwoParCorrMC{std::pow(p1MC, 2.) - p2MC}; const double denThreeParCorrMC{std::pow(w1MC, 3.) - 3. * w2MC * w1MC + 2. * w3MC}; const double numThreeParCorrMC{std::pow(p1MC, 3.) - 3. * p2MC * p1MC + 2. * p3MC}; - const double denFourParCorrMC{std::pow(w1MC, 4.) - 6. * w2MC * std::pow(w1MC, 2.) + 3. * std::pow(w2MC, 2.) + 8 * w3MC * w1MC - 6. * w4MC}; - const double numFourParCorrMC{std::pow(p1MC, 4.) - 6. * p2MC * std::pow(p1MC, 2.) + 3. * std::pow(p2MC, 2.) + 8 * p3MC * p1MC - 6. * p4MC}; + // const double denFourParCorrMC{std::pow(w1MC, 4.) - 6. * w2MC * std::pow(w1MC, 2.) + 3. * std::pow(w2MC, 2.) + 8 * w3MC * w1MC - 6. * w4MC}; + // const double numFourParCorrMC{std::pow(p1MC, 4.) - 6. * p2MC * std::pow(p1MC, 2.) + 3. * std::pow(p2MC, 2.) + 8 * p3MC * p1MC - 6. * p4MC}; const double oneParCorrMC{p1MC / w1MC}; const double twoParCorrMC{numTwoParCorrMC / denTwoParCorrMC}; const double threeParCorrMC{numThreeParCorrMC / denThreeParCorrMC}; - const double fourParCorrMC{numFourParCorrMC / denFourParCorrMC}; + // const double fourParCorrMC{numFourParCorrMC / denFourParCorrMC}; registry.fill(HIST("NchGen"), nchMC); registry.fill(HIST("NchvsOneParCorrGen"), nchMC, oneParCorrMC, w1MC); registry.fill(HIST("NchvsTwoParCorrGen"), nchMC, twoParCorrMC, denTwoParCorrMC); registry.fill(HIST("NchvsThreeParCorrGen"), nchMC, threeParCorrMC, denThreeParCorrMC); - registry.fill(HIST("NchvsFourParCorrGen"), nchMC, fourParCorrMC, denFourParCorrMC); //------------------ Poisson sampling - std::vector vPoisson; - for (int replica = 0; replica < kSizeBootStrapEnsemble; ++replica) { - vPoisson.emplace_back(rndGen.Poisson(1.)); - } - - for (int replica = 0; replica < kSizeBootStrapEnsemble; ++replica) { - hPoissonMC[replica]->Fill(vPoisson.at(replica)); - - for (uint64_t evtRep = 0; evtRep < vPoisson.at(replica); ++evtRep) { - - double nchRaw{0.0}; - double nchMult{0.0}; - std::vector pTs; - std::vector vecFD; - std::vector vecEff; - - // const auto& groupedTracks{simTracks.sliceBy(perCollision, collision.globalIndex())}; - - // Calculates the event's Nch to evaluate the efficiency - for (const auto& track : groupedTracks) { - // Track Selection - if (track.eta() < minEta || track.eta() > maxEta) { - continue; - } - if (track.pt() < minPt || track.pt() > maxPt) { - continue; - } - if (!track.isGlobalTrack()) { - continue; - } - nchRaw++; - } - - // Calculates the event weight, W_k - const int foundNchBin{efficiency->GetXaxis()->FindBin(nchRaw)}; - - for (const auto& track : groupedTracks) { - // Track Selection - if (track.eta() < minEta || track.eta() > maxEta) { - continue; - } - if (track.pt() < minPt || track.pt() > maxPt) { - continue; - } - if (!track.isGlobalTrack()) { - continue; - } - if (!track.has_mcParticle()) { - continue; - } - const auto& particle{track.mcParticle()}; - - auto charge{0.}; - // Get the MC particle - auto* pdgParticle = pdg->GetParticle(particle.pdgCode()); - if (pdgParticle != nullptr) { - charge = pdgParticle->Charge(); - } else { - continue; - } - - // Is it a charged particle? - if (std::abs(charge) < kMinCharge) { - continue; - } - // Is it a primary particle? - // if (!particle.isPhysicalPrimary()) { continue; } - - const double pt{static_cast(track.pt())}; - const int foundPtBin{efficiency->GetYaxis()->FindBin(pt)}; - double effValue{1.}; - double fdValue{1.}; - - if (applyEff) { - effValue = efficiency->GetBinContent(foundNchBin, foundPtBin); - fdValue = feedDown->GetBinContent(foundNchBin, foundPtBin); - } - if ((effValue > 0.) && (fdValue > 0.)) { - pTs.emplace_back(pt); - vecEff.emplace_back(effValue); - vecFD.emplace_back(fdValue); - nchMult += (std::pow(effValue, -1.0) * fdValue); - } - } - - if (nchMult < minNchSel) { - return; - } - - double p1, p2, p3, p4, w1, w2, w3, w4; - p1 = p2 = p3 = p4 = w1 = w2 = w3 = w4 = 0.0; - getPTpowers(pTs, vecEff, vecFD, p1, w1, p2, w2, p3, w3, p4, w4); - - const double denTwoParCorr{std::pow(w1, 2.) - w2}; - const double numTwoParCorr{std::pow(p1, 2.) - p2}; - const double denThreeParCorr{std::pow(w1, 3.) - 3. * w2 * w1 + 2. * w3}; - const double numThreeParCorr{std::pow(p1, 3.) - 3. * p2 * p1 + 2. * p3}; - const double denFourParCorr{std::pow(w1, 4.) - 6. * w2 * std::pow(w1, 2.) + 3. * std::pow(w2, 2.) + 8 * w3 * w1 - 6. * w4}; - const double numFourParCorr{std::pow(p1, 4.) - 6. * p2 * std::pow(p1, 2.) + 3. * std::pow(p2, 2.) + 8 * p3 * p1 - 6. * p4}; - - const double oneParCorr{p1 / w1}; - const double twoParCorr{numTwoParCorr / denTwoParCorr}; - const double threeParCorr{numThreeParCorr / denThreeParCorr}; - const double fourParCorr{numFourParCorr / denFourParCorr}; - - hNchRec[replica]->Fill(nchMult); - pNchvsOneParCorrRec[replica]->Fill(nchMult, oneParCorr, w1); - pNchvsTwoParCorrRec[replica]->Fill(nchMult, twoParCorr, denTwoParCorr); - pNchvsThreeParCorrRec[replica]->Fill(nchMult, threeParCorr, denThreeParCorr); - pNchvsFourParCorrRec[replica]->Fill(nchMult, fourParCorr, denFourParCorr); - - //--------------------------- Generated MC --------------------------- - double nchMC{0.0}; - std::vector pTsMC; - std::vector vecFullEff; - std::vector vecFDEqualOne; - - // Calculates the event weight, W_k - for (const auto& particle : mcParticles) { - if (particle.eta() < minEta || particle.eta() > maxEta) { - continue; - } - if (particle.pt() < minPt || particle.pt() > maxPt) { - continue; - } - - auto charge{0.}; - // Get the MC particle - auto* pdgParticle = pdg->GetParticle(particle.pdgCode()); - if (pdgParticle != nullptr) { - charge = pdgParticle->Charge(); - } else { - continue; - } - - // Is it a charged particle? - if (std::abs(charge) < kMinCharge) { - continue; - } - // Is it a primary particle? - if (!particle.isPhysicalPrimary()) { - continue; - } - - float pt{particle.pt()}; - pTsMC.emplace_back(pt); - vecFullEff.emplace_back(1.); - vecFDEqualOne.emplace_back(1.); - nchMC++; - } - - if (nchMC < minNchSel) { - continue; - } - // printf("nchMult = %f | nchMC = %f | nchMult/nchMc = %f\n",nchMult,nchMC,nchMult/nchMC); - - double p1MC, p2MC, p3MC, p4MC, w1MC, w2MC, w3MC, w4MC; - p1MC = p2MC = p3MC = p4MC = w1MC = w2MC = w3MC = w4MC = 0.0; - getPTpowers(pTsMC, vecFullEff, vecFDEqualOne, p1MC, w1MC, p2MC, w2MC, p3MC, w3MC, p4MC, w4MC); - - const double denTwoParCorrMC{std::pow(w1MC, 2.) - w2MC}; - const double numTwoParCorrMC{std::pow(p1MC, 2.) - p2MC}; - const double denThreeParCorrMC{std::pow(w1MC, 3.) - 3. * w2MC * w1MC + 2. * w3MC}; - const double numThreeParCorrMC{std::pow(p1MC, 3.) - 3. * p2MC * p1MC + 2. * p3MC}; - const double denFourParCorrMC{std::pow(w1MC, 4.) - 6. * w2MC * std::pow(w1MC, 2.) + 3. * std::pow(w2MC, 2.) + 8 * w3MC * w1MC - 6. * w4MC}; - const double numFourParCorrMC{std::pow(p1MC, 4.) - 6. * p2MC * std::pow(p1MC, 2.) + 3. * std::pow(p2MC, 2.) + 8 * p3MC * p1MC - 6. * p4MC}; - - const double oneParCorrMC{p1MC / w1MC}; - const double twoParCorrMC{numTwoParCorrMC / denTwoParCorrMC}; - const double threeParCorrMC{numThreeParCorrMC / denThreeParCorrMC}; - const double fourParCorrMC{numFourParCorrMC / denFourParCorrMC}; - - hNchGen[replica]->Fill(nchMC); - pNchvsOneParCorrGen[replica]->Fill(nchMC, oneParCorrMC, w1MC); - pNchvsTwoParCorrGen[replica]->Fill(nchMC, twoParCorrMC, w1MC); - pNchvsThreeParCorrGen[replica]->Fill(nchMC, threeParCorrMC, w1MC); - pNchvsFourParCorrGen[replica]->Fill(nchMC, fourParCorrMC, w1MC); - } // events per replica - } // replica's loop + eventSamplingMC(mcParticles, timeStamp); + eventSamplingMCRec(groupedTracks, timeStamp); } else { // Correction with the remaining half of the sample registry.fill(HIST("EvtsDivided"), 1); //----- MC reconstructed -----// @@ -1670,6 +1356,406 @@ struct UccZdc { } } + template + void eventSamplingMC(const T& mcParticles, const V& timeStamp) + { + TRandom3 rndGen(timeStamp); + std::vector vPoisson; + for (int replica = 0; replica < kSizeBootStrapEnsemble; ++replica) + vPoisson.emplace_back(rndGen.Poisson(1.)); + + for (int replica = 0; replica < kSizeBootStrapEnsemble; ++replica) { + + hPoissonMC[replica]->Fill(vPoisson.at(replica)); + + for (uint64_t evtRep = 0; evtRep < vPoisson.at(replica); ++evtRep) { + + double nchMult{0.}; + std::vector pTs; + std::vector vecFD; + std::vector vecEff; + + // Calculates the event weight, W_k + for (const auto& particle : mcParticles) { + if (particle.eta() < minEta || particle.eta() > maxEta) { + continue; + } + if (particle.pt() < minPt || particle.pt() > maxPt) { + continue; + } + + auto charge{0.}; + // Get the MC particle + auto* pdgParticle = pdg->GetParticle(particle.pdgCode()); + if (pdgParticle != nullptr) { + charge = pdgParticle->Charge(); + } else { + continue; + } + + // Is it a charged particle? + if (std::abs(charge) < kMinCharge) { + continue; + } + // Is it a primary particle? + if (!particle.isPhysicalPrimary()) { + continue; + } + + float pt{particle.pt()}; + pTs.emplace_back(pt); + vecEff.emplace_back(1.); + vecFD.emplace_back(1.); + nchMult++; + } + + if (nchMult < minNchSel) { + continue; + } + // printf("nchMult = %f | nchMC = %f | nchMult/nchMc = %f\n",nchMult,nchMC,nchMult/nchMC); + + double p1, p2, p3, p4, w1, w2, w3, w4; + p1 = p2 = p3 = p4 = w1 = w2 = w3 = w4 = 0.0; + getPTpowers(pTs, vecEff, vecFD, p1, w1, p2, w2, p3, w3, p4, w4); + + // EbE one-particle pT correlation + const double oneParCorr{p1 / w1}; + + // EbE two-particle pT correlation + const double denTwoParCorr{std::pow(w1, 2.) - w2}; + const double numTwoParCorr{std::pow(p1, 2.) - p2}; + const double twoParCorr{numTwoParCorr / denTwoParCorr}; + + // EbE three-particle pT correlation + const double denThreeParCorr{std::pow(w1, 3.) - 3. * w2 * w1 + 2. * w3}; + const double numThreeParCorr{std::pow(p1, 3.) - 3. * p2 * p1 + 2. * p3}; + const double threeParCorr{numThreeParCorr / denThreeParCorr}; + + hNchGen[replica]->Fill(nchMult); + + pOneParCorrVsNchGen[replica]->Fill(nchMult, oneParCorr, w1); + pTwoParCorrVsNchGen[replica]->Fill(nchMult, twoParCorr, denTwoParCorr); + pThreeParCorrVsNchGen[replica]->Fill(nchMult, threeParCorr, denThreeParCorr); + + // pOneParCorrVsV0AGen[replica]->Fill(normV0A, oneParCorr, w1); + // pTwoParCorrVsV0AGen[replica]->Fill(normV0A, twoParCorr, denTwoParCorr); + // pThreeParCorrVsV0AGen[replica]->Fill(normV0A, threeParCorr, denThreeParCorr); + + // pOneParCorrVsT0MGen[replica]->Fill(normT0M, oneParCorr, w1); + // pTwoParCorrVsT0MGen[replica]->Fill(normT0M, twoParCorr, denTwoParCorr); + // pThreeParCorrVsT0MGen[replica]->Fill(normT0M, threeParCorr, denThreeParCorr); + } // event per replica + } // replica's loop + } + + template + void eventSamplingMCRec(const T& tracks, const V& timeStamp) + { + TRandom3 rndGen(timeStamp); + std::vector vPoisson; + for (int replica = 0; replica < kSizeBootStrapEnsemble; ++replica) + vPoisson.emplace_back(rndGen.Poisson(1.)); + + for (int replica = 0; replica < kSizeBootStrapEnsemble; ++replica) { + + hPoisson[replica]->Fill(vPoisson.at(replica)); + + for (uint64_t evtRep = 0; evtRep < vPoisson.at(replica); ++evtRep) { + + double nchMult{0.}; + int glbTracks{0}; + std::vector pTs; + std::vector vecFD; + std::vector vecEff; + + // Calculates the uncorrected Nch multiplicity + for (const auto& track : tracks) { + // Track Selection + if (!track.isGlobalTrack()) { + continue; + } + if ((track.pt() < minPt) || (track.pt() > maxPt)) { + continue; + } + if ((track.eta() < minEta) || (track.eta() > maxEta)) { + continue; + } + glbTracks++; + } + + if (glbTracks < minNchSel) { + continue; + } + + // Calculates the Nch multiplicity if corrections are loaded + if (cfg.correctionsLoaded) { + const int foundNchBin{cfg.hEfficiency->GetXaxis()->FindBin(glbTracks)}; + for (const auto& track : tracks) { + // Track Selection + if (!track.isGlobalTrack()) { + continue; + } + if ((track.pt() < minPt) || (track.pt() > maxPt)) { + continue; + } + if ((track.eta() < minEta) || (track.eta() > maxEta)) { + continue; + } + + float pt{track.pt()}; + double fdValue{1.}; + int foundPtBin{cfg.hEfficiency->GetYaxis()->FindBin(pt)}; + double effValue{cfg.hEfficiency->GetBinContent(foundNchBin, foundPtBin)}; + + if (applyFD) + fdValue = cfg.hFeedDown->GetBinContent(foundNchBin, foundPtBin); + if ((effValue > 0.) && (fdValue > 0.)) { + nchMult += (std::pow(effValue, -1.) * fdValue); + } + } + } + + if (!applyEff) + nchMult = static_cast(glbTracks); + if (applyEff && !correctNch) + nchMult = static_cast(glbTracks); + + // Fill vectors for [pT] measurement + if (cfg.correctionsLoaded) { + const int foundNchBin{cfg.hEfficiency->GetXaxis()->FindBin(glbTracks)}; + // Fill vectors for [pT] measurement + for (const auto& track : tracks) { + // Track Selection + if (!track.isGlobalTrack()) { + continue; + } + if ((track.pt() < minPt) || (track.pt() > maxPtSpectra)) { + continue; + } + if ((track.eta() < minEta) || (track.eta() > maxEta)) { + continue; + } + + float pt{track.pt()}; + double fdValue{1.}; + int foundPtBin{cfg.hEfficiency->GetYaxis()->FindBin(pt)}; + double effValue{cfg.hEfficiency->GetBinContent(foundNchBin, foundPtBin)}; + + if (applyFD) + fdValue = cfg.hFeedDown->GetBinContent(foundNchBin, foundPtBin); + + if ((effValue > 0.) && (fdValue > 0.)) { + pTs.emplace_back(pt); + vecEff.emplace_back(effValue); + vecFD.emplace_back(fdValue); + } + } + } else { + for (const auto& track : tracks) { + // Track Selection + if (!track.isGlobalTrack()) { + continue; + } + if ((track.pt() < minPt) || (track.pt() > maxPtSpectra)) { + continue; + } + + pTs.emplace_back(track.pt()); + vecEff.emplace_back(1.); + vecFD.emplace_back(1.); + } + } + + double p1, p2, p3, p4, w1, w2, w3, w4; + p1 = p2 = p3 = p4 = w1 = w2 = w3 = w4 = 0.0; + getPTpowers(pTs, vecEff, vecFD, p1, w1, p2, w2, p3, w3, p4, w4); + + // EbE one-particle pT correlation + const double oneParCorr{p1 / w1}; + + // EbE two-particle pT correlation + const double denTwoParCorr{std::pow(w1, 2.) - w2}; + const double numTwoParCorr{std::pow(p1, 2.) - p2}; + const double twoParCorr{numTwoParCorr / denTwoParCorr}; + + // EbE three-particle pT correlation + const double denThreeParCorr{std::pow(w1, 3.) - 3. * w2 * w1 + 2. * w3}; + const double numThreeParCorr{std::pow(p1, 3.) - 3. * p2 * p1 + 2. * p3}; + const double threeParCorr{numThreeParCorr / denThreeParCorr}; + + hNch[replica]->Fill(nchMult); + + pOneParCorrVsNch[replica]->Fill(nchMult, oneParCorr, w1); + pTwoParCorrVsNch[replica]->Fill(nchMult, twoParCorr, denTwoParCorr); + pThreeParCorrVsNch[replica]->Fill(nchMult, threeParCorr, denThreeParCorr); + + // pOneParCorrVsV0A[replica]->Fill(normV0A, oneParCorr, w1); + // pTwoParCorrVsV0A[replica]->Fill(normV0A, twoParCorr, denTwoParCorr); + // pThreeParCorrVsV0A[replica]->Fill(normV0A, threeParCorr, denThreeParCorr); + // + // pOneParCorrVsT0M[replica]->Fill(normT0M, oneParCorr, w1); + // pTwoParCorrVsT0M[replica]->Fill(normT0M, twoParCorr, denTwoParCorr); + // pThreeParCorrVsT0M[replica]->Fill(normT0M, threeParCorr, denThreeParCorr); + } // event per replica + } // replica's loop + } + + template + void eventSampling(const T& tracks, const U& normV0A, const U& normT0M, const U& sumZNs, const V& timeStamp) + { + TRandom3 rndGen(timeStamp); + std::vector vPoisson; + for (int replica = 0; replica < kSizeBootStrapEnsemble; ++replica) + vPoisson.emplace_back(rndGen.Poisson(1.)); + + for (int replica = 0; replica < kSizeBootStrapEnsemble; ++replica) { + + hPoisson[replica]->Fill(vPoisson.at(replica)); + + for (uint64_t evtRep = 0; evtRep < vPoisson.at(replica); ++evtRep) { + + double nchMult{0.}; + int glbTracks{0}; + std::vector pTs; + std::vector vecFD; + std::vector vecEff; + + // Calculates the uncorrected Nch multiplicity + for (const auto& track : tracks) { + // Track Selection + if (!track.isGlobalTrack()) { + continue; + } + if ((track.pt() < minPt) || (track.pt() > maxPt)) { + continue; + } + if ((track.eta() < minEta) || (track.eta() > maxEta)) { + continue; + } + glbTracks++; + } + + if (glbTracks < minNchSel) { + continue; + } + + // Calculates the Nch multiplicity if corrections are loaded + if (cfg.correctionsLoaded) { + const int foundNchBin{cfg.hEfficiency->GetXaxis()->FindBin(glbTracks)}; + for (const auto& track : tracks) { + // Track Selection + if (!track.isGlobalTrack()) { + continue; + } + if ((track.pt() < minPt) || (track.pt() > maxPt)) { + continue; + } + if ((track.eta() < minEta) || (track.eta() > maxEta)) { + continue; + } + + float pt{track.pt()}; + double fdValue{1.}; + int foundPtBin{cfg.hEfficiency->GetYaxis()->FindBin(pt)}; + double effValue{cfg.hEfficiency->GetBinContent(foundNchBin, foundPtBin)}; + + if (applyFD) + fdValue = cfg.hFeedDown->GetBinContent(foundNchBin, foundPtBin); + if ((effValue > 0.) && (fdValue > 0.)) { + nchMult += (std::pow(effValue, -1.) * fdValue); + } + } + } + + if (!applyEff) + nchMult = static_cast(glbTracks); + if (applyEff && !correctNch) + nchMult = static_cast(glbTracks); + + // Fill vectors for [pT] measurement + if (cfg.correctionsLoaded) { + const int foundNchBin{cfg.hEfficiency->GetXaxis()->FindBin(glbTracks)}; + // Fill vectors for [pT] measurement + for (const auto& track : tracks) { + // Track Selection + if (!track.isGlobalTrack()) { + continue; + } + if ((track.pt() < minPt) || (track.pt() > maxPtSpectra)) { + continue; + } + if ((track.eta() < minEta) || (track.eta() > maxEta)) { + continue; + } + + float pt{track.pt()}; + double fdValue{1.}; + int foundPtBin{cfg.hEfficiency->GetYaxis()->FindBin(pt)}; + double effValue{cfg.hEfficiency->GetBinContent(foundNchBin, foundPtBin)}; + + if (applyFD) + fdValue = cfg.hFeedDown->GetBinContent(foundNchBin, foundPtBin); + + if ((effValue > 0.) && (fdValue > 0.)) { + pTs.emplace_back(pt); + vecEff.emplace_back(effValue); + vecFD.emplace_back(fdValue); + // To calculate event-averaged + registry.fill(HIST("NchVsZNVsPt"), nchMult, sumZNs, pt * (fdValue / effValue)); + } + } + } else { + for (const auto& track : tracks) { + // Track Selection + if (!track.isGlobalTrack()) { + continue; + } + if ((track.pt() < minPt) || (track.pt() > maxPtSpectra)) { + continue; + } + + pTs.emplace_back(track.pt()); + vecEff.emplace_back(1.); + vecFD.emplace_back(1.); + + // To calculate event-averaged + registry.fill(HIST("NchVsZNVsPt"), nchMult, sumZNs, track.pt()); + } + } + + double p1, p2, p3, p4, w1, w2, w3, w4; + p1 = p2 = p3 = p4 = w1 = w2 = w3 = w4 = 0.0; + getPTpowers(pTs, vecEff, vecFD, p1, w1, p2, w2, p3, w3, p4, w4); + + // EbE one-particle pT correlation + const double oneParCorr{p1 / w1}; + + // EbE two-particle pT correlation + const double denTwoParCorr{std::pow(w1, 2.) - w2}; + const double numTwoParCorr{std::pow(p1, 2.) - p2}; + const double twoParCorr{numTwoParCorr / denTwoParCorr}; + + // EbE three-particle pT correlation + const double denThreeParCorr{std::pow(w1, 3.) - 3. * w2 * w1 + 2. * w3}; + const double numThreeParCorr{std::pow(p1, 3.) - 3. * p2 * p1 + 2. * p3}; + const double threeParCorr{numThreeParCorr / denThreeParCorr}; + + hNch[replica]->Fill(nchMult); + pNchVsOneParCorrVsZN[replica]->Fill(nchMult, sumZNs, oneParCorr, w1); + pNchVsTwoParCorrVsZN[replica]->Fill(nchMult, sumZNs, twoParCorr, denTwoParCorr); + pNchVsThreeParCorrVsZN[replica]->Fill(nchMult, sumZNs, threeParCorr, denThreeParCorr); + + pOneParCorrVsV0A[replica]->Fill(normV0A, oneParCorr, w1); + pTwoParCorrVsV0A[replica]->Fill(normV0A, twoParCorr, denTwoParCorr); + pThreeParCorrVsV0A[replica]->Fill(normV0A, threeParCorr, denThreeParCorr); + + pOneParCorrVsT0M[replica]->Fill(normT0M, oneParCorr, w1); + pTwoParCorrVsT0M[replica]->Fill(normT0M, twoParCorr, denTwoParCorr); + pThreeParCorrVsT0M[replica]->Fill(normT0M, threeParCorr, denThreeParCorr); + } // event per replica + } // replica's loop + } + void loadCorrections(uint64_t timeStamp) { // if (cfg.correctionsLoaded) return; From 2cb482114f0a3e23aab41dd6735ef695f2eb231f Mon Sep 17 00:00:00 2001 From: Stefano Cannito <143754257+scannito@users.noreply.github.com> Date: Sat, 26 Jul 2025 16:55:51 +0200 Subject: [PATCH 083/345] [PWGLF] Systematics in dN/deta with phi trigger (#12260) --- .../Tasks/Strangeness/phik0shortanalysis.cxx | 500 ++++++++++-------- 1 file changed, 286 insertions(+), 214 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx b/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx index 598d8f56df4..ca6ba09680d 100644 --- a/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx +++ b/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx @@ -62,6 +62,22 @@ using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::aod::track; +enum { + kGlobalplusITSonly = 0, + kGlobalonly, + kITSonly +}; + +enum { + kSpAll = 0, + kSpPion, + kSpKaon, + kSpProton, + kSpOther, + kSpStrangeDecay, + kSpNotPrimary +}; + struct Phik0shortanalysis { // Histograms are defined with HistogramRegistry HistogramRegistry dataEventHist{"dataEventHist", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; @@ -172,13 +188,14 @@ struct Phik0shortanalysis { Configurable> binspTPi{"binspTPi", {0.2, 0.3, 0.4, 0.5, 0.6, 0.8, 1.0, 1.2, 1.5, 2.0, 3.0}, "pT bin limits for pions"}; // Configurables for delta y selection - Configurable nBinsY{"nBinsY", 20, "Number of bins in y axis"}; - Configurable nBinsDeltaY{"nBinsDeltaY", 20, "Number of bins in deltay axis"}; - Configurable cfgYAcceptance{"cfgYAcceptance", 0.5f, "Rapidity acceptance"}; - Configurable cfgYAcceptanceSmear{"cfgYAcceptanceSmear", 0.8f, "Rapidity acceptance for smearing matrix study"}; - Configurable cfgFCutOnDeltaY{"cfgFCutOnDeltaY", 0.5f, "First upper bound on Deltay selection"}; - Configurable cfgSCutOnDeltaY{"cfgSCutOnDeltaY", 0.1f, "Second upper bound on Deltay selection"}; - Configurable> cfgDeltaYAcceptanceBins{"cfgDeltaYAcceptanceBins", {0.5f}, "Rapidity acceptance bins"}; + struct : ConfigurableGroup { + Configurable nBinsY{"nBinsY", 20, "Number of bins in y axis"}; + Configurable nBinsDeltaY{"nBinsDeltaY", 20, "Number of bins in deltay axis"}; + Configurable cfgYAcceptance{"cfgYAcceptance", 0.5f, "Rapidity acceptance"}; + Configurable cfgFCutOnDeltaY{"cfgFCutOnDeltaY", 0.5f, "First upper bound on Deltay selection"}; + Configurable cfgSCutOnDeltaY{"cfgSCutOnDeltaY", 0.1f, "Second upper bound on Deltay selection"}; + Configurable> cfgDeltaYAcceptanceBins{"cfgDeltaYAcceptanceBins", {0.5f}, "Rapidity acceptance bins"}; + } deltaYConfigs; // Configurable for RecMC Configurable cfgiskNoITSROFrameBorder{"cfgiskNoITSROFrameBorder", false, "kNoITSROFrameBorder request on RecMC collisions"}; @@ -193,7 +210,8 @@ struct Phik0shortanalysis { Configurable fillMethodSingleWeight{"fillMethodSingleWeight", false, "Fill method Single Weight"}; Configurable applyEfficiency{"applyEfficiency", false, "Use efficiency for filling histograms"}; - // Configurable for MCPhi filter + // Configurables for dN/deta with phi computation + Configurable furtherCheckonMcCollision{"furtherCheckonMcCollision", true, "Further check on MC collisions"}; Configurable filterOnMcPhi{"filterOnMcPhi", true, "Filter on MC Phi"}; // Configurable for event mixing @@ -299,8 +317,8 @@ struct Phik0shortanalysis { AxisSpec nSigmaPiAxis = {100, -10.0f, 10.0f, "N#sigma #pi"}; AxisSpec vertexZAxis = {100, -15.f, 15.f, "vrtx_{Z} [cm]"}; AxisSpec etaAxis = {16, -trackConfigs.etaMax, trackConfigs.etaMax, "#eta"}; - AxisSpec yAxis = {nBinsY, -cfgYAcceptance, cfgYAcceptance, "#it{y}"}; - AxisSpec deltayAxis = {nBinsDeltaY, -1.0f, 1.0f, "#Delta#it{y}"}; + AxisSpec yAxis = {deltaYConfigs.nBinsY, -deltaYConfigs.cfgYAcceptance, deltaYConfigs.cfgYAcceptance, "#it{y}"}; + AxisSpec deltayAxis = {deltaYConfigs.nBinsDeltaY, -1.0f, 1.0f, "#Delta#it{y}"}; AxisSpec multAxis = {120, 0.0f, 120.0f, "centFT0M"}; AxisSpec binnedmultAxis{(std::vector)binsMult, "centFT0M"}; AxisSpec pTPhiAxis = {120, 0.0f, 12.0f, "#it{p}_{T} (GeV/#it{c})"}; @@ -324,9 +342,10 @@ struct Phik0shortanalysis { dataEventHist.add("hVertexZ", "hVertexZ", kTH1F, {vertexZAxis}); dataEventHist.add("hMultiplicityPercent", "Multiplicity Percentile", kTH1F, {multAxis}); dataEventHist.add("hMultiplicityPercentWithPhi", "Multiplicity Percentile in Events with a Phi Candidate", kTH1F, {multAxis}); + dataEventHist.add("h2VertexZvsMult", "Vertex Z vs Multiplicity Percentile", kTH2F, {vertexZAxis, binnedmultAxis}); // Eta distribution for dN/deta values estimation in Data - dataEventHist.add("h2EtaDistribution", "Eta vs multiplicity in Data", kTH2F, {binnedmultAxis, etaAxis}); + dataEventHist.add("h4EtaDistribution", "Eta vs multiplicity in Data", kTHnSparseF, {vertexZAxis, binnedmultAxis, etaAxis, {3, -0.5f, 2.5f}}); // Number of MC events per selection for Rec and Gen mcEventHist.add("hRecMCEventSelection", "hRecMCEventSelection", kTH1F, {{9, -0.5f, 8.5f}}); @@ -348,23 +367,26 @@ struct Phik0shortanalysis { mcEventHist.get(HIST("hGenMCEventSelection"))->GetXaxis()->SetBinLabel(5, "With at least a reco coll"); // MC Event information for Rec and Gen - mcEventHist.add("hRecMCVertexZ", "hRecMCVertexZ", kTH1F, {vertexZAxis}); - mcEventHist.add("hRecMCMultiplicityPercent", "RecMC Multiplicity Percentile", kTH1F, {multAxis}); - mcEventHist.add("hRecMCGenMultiplicityPercent", "RecMC Gen Multiplicity Percentile", kTH1F, {binnedmultAxis}); - mcEventHist.add("hRecMCGenMultiplicityPercentWithPhi", "RecMC Gen Multiplicity Percentile in Events with a Phi Candidate", kTH1F, {binnedmultAxis}); + mcEventHist.add("hRecoMCVertexZ", "hRecoMCVertexZ", kTH1F, {vertexZAxis}); + mcEventHist.add("hUnbinnedRecoMCMultiplicityPercent", "RecoMC Multiplicity Percentile", kTH1F, {multAxis}); + mcEventHist.add("hRecoMCMultiplicityPercent", "RecoMC Multiplicity Percentile", kTH1F, {binnedmultAxis}); + mcEventHist.add("hRecoMCMultiplicityPercentWithPhi", "RecoMC Multiplicity Percentile in Events with a Phi Candidate", kTH1F, {binnedmultAxis}); + mcEventHist.add("h2RecoMCVertexZvsMult", "RecoMC Vertex Z vs Multiplicity Percentile", kTH2F, {vertexZAxis, binnedmultAxis}); mcEventHist.add("hGenMCVertexZ", "hGenMCVertexZ", kTH1F, {vertexZAxis}); mcEventHist.add("hGenMCMultiplicityPercent", "GenMC Multiplicity Percentile", kTH1F, {binnedmultAxis}); mcEventHist.add("hGenMCAssocRecoMultiplicityPercent", "GenMC AssocReco Multiplicity Percentile", kTH1F, {binnedmultAxis}); mcEventHist.add("hGenMCRecoMultiplicityPercent", "GenMCReco Multiplicity Percentile", kTH1F, {binnedmultAxis}); + mcEventHist.add("h2GenMCRecoVertexZvsMult", "GenMCReco Vertex Z vs Multiplicity Percentile", kTH2F, {vertexZAxis, binnedmultAxis}); // Eta distribution for dN/deta values estimation in MC - mcEventHist.add("h2RecoMCEtaDistribution", "Eta vs multiplicity in MCReco", kTH2F, {binnedmultAxis, etaAxis}); - mcEventHist.add("h2RecoCheckMCEtaDistribution", "Eta vs multiplicity in MCReco Check", kTH2F, {binnedmultAxis, etaAxis}); + mcEventHist.add("h5RecoMCEtaDistribution", "Eta vs multiplicity in MCReco", kTHnSparseF, {vertexZAxis, binnedmultAxis, etaAxis, {3, -0.5f, 2.5f}, {6, -0.5f, 5.5f}}); + mcEventHist.add("h5RecoCheckMCEtaDistribution", "Eta vs multiplicity in MCReco Check", kTHnSparseF, {vertexZAxis, binnedmultAxis, etaAxis, {3, -0.5f, 2.5f}, {6, -0.5f, 5.5f}}); + mcEventHist.add("h2GenMCEtaDistribution", "Eta vs multiplicity in MCGen", kTH2F, {binnedmultAxis, etaAxis}); mcEventHist.add("h2GenMCEtaDistributionAssocReco", "Eta vs multiplicity in MCGen Assoc Reco", kTH2F, {binnedmultAxis, etaAxis}); - mcEventHist.add("h2GenMCEtaDistributionReco", "Eta vs multiplicity in MCGen Reco", kTH2F, {binnedmultAxis, etaAxis}); - mcEventHist.add("h2GenMCEtaDistributionRecoCheck", "Eta vs multiplicity in MCGen Reco Check", kTH2F, {binnedmultAxis, etaAxis}); + mcEventHist.add("h4GenMCEtaDistributionReco", "Eta vs multiplicity in MCGen Reco", kTHnSparseF, {vertexZAxis, binnedmultAxis, etaAxis, {6, -0.5f, 5.5f}}); + mcEventHist.add("h4GenMCEtaDistributionRecoCheck", "Eta vs multiplicity in MCGen Reco Check", kTHnSparseF, {vertexZAxis, binnedmultAxis, etaAxis, {6, -0.5f, 5.5f}}); // Phi topological/PID cuts dataPhiHist.add("h2DauTracksPhiDCAxyPreCutData", "Dcaxy distribution vs pt before DCAxy cut", kTH2F, {{100, 0.0, 5.0, "#it{p}_{T} (GeV/#it{c})"}, {2000, -0.05, 0.05, "DCA_{xy} (cm)"}}); @@ -380,16 +402,16 @@ struct Phik0shortanalysis { // Phi invariant mass for computing purities and normalisation dataPhiHist.add("h3PhipurData", "Invariant mass of Phi for Purity (no K0S/Pi) in Data", kTH3F, {binnedmultAxis, binnedpTPhiAxis, massPhiAxis}); - dataPhiHist.add("h4PhipurK0SData", "Invariant mass of Phi for Purity (K0S) in Data", kTHnSparseF, {{static_cast(cfgDeltaYAcceptanceBins->size() + 1), -0.5f, static_cast(cfgDeltaYAcceptanceBins->size() + 1.0f - 0.5f)}, binnedmultAxis, binnedpTPhiAxis, massPhiAxis}); + dataPhiHist.add("h4PhipurK0SData", "Invariant mass of Phi for Purity (K0S) in Data", kTHnSparseF, {{static_cast(deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1), -0.5f, static_cast(deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1.0f - 0.5f)}, binnedmultAxis, binnedpTPhiAxis, massPhiAxis}); dataPhiHist.get(HIST("h4PhipurK0SData"))->GetAxis(0)->SetBinLabel(1, "Inclusive"); - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size(); i++) { - dataPhiHist.get(HIST("h4PhipurK0SData"))->GetAxis(0)->SetBinLabel(i + 2, Form("|Delta#it{y}| < %.1f", cfgDeltaYAcceptanceBins->at(i))); + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size(); i++) { + dataPhiHist.get(HIST("h4PhipurK0SData"))->GetAxis(0)->SetBinLabel(i + 2, Form("|Delta#it{y}| < %.1f", deltaYConfigs.cfgDeltaYAcceptanceBins->at(i))); } - dataPhiHist.add("h4PhipurPiData", "Invariant mass of Phi for Purity (Pi) in Data", kTHnSparseF, {{static_cast(cfgDeltaYAcceptanceBins->size() + 1), -0.5f, static_cast(cfgDeltaYAcceptanceBins->size() + 1.0f - 0.5f)}, binnedmultAxis, binnedpTPhiAxis, massPhiAxis}); + dataPhiHist.add("h4PhipurPiData", "Invariant mass of Phi for Purity (Pi) in Data", kTHnSparseF, {{static_cast(deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1), -0.5f, static_cast(deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1.0f - 0.5f)}, binnedmultAxis, binnedpTPhiAxis, massPhiAxis}); dataPhiHist.get(HIST("h4PhipurPiData"))->GetAxis(0)->SetBinLabel(1, "Inclusive"); - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size(); i++) { - dataPhiHist.get(HIST("h4PhipurPiData"))->GetAxis(0)->SetBinLabel(i + 2, Form("|Delta#it{y}| < %.1f", cfgDeltaYAcceptanceBins->at(i))); + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size(); i++) { + dataPhiHist.get(HIST("h4PhipurPiData"))->GetAxis(0)->SetBinLabel(i + 2, Form("|Delta#it{y}| < %.1f", deltaYConfigs.cfgDeltaYAcceptanceBins->at(i))); } } @@ -403,16 +425,16 @@ struct Phik0shortanalysis { // MCPhi invariant mass for computing purities closureMCPhiHist.add("h3PhipurMCClosure", "Invariant mass of Phi for Purity (no K0S/Pi)", kTH3F, {binnedmultAxis, binnedpTPhiAxis, massPhiAxis}); - closureMCPhiHist.add("h4PhipurK0SMCClosure", "Invariant mass of Phi for Purity (K0S) in MCClosure", kTHnSparseF, {{static_cast(cfgDeltaYAcceptanceBins->size() + 1), -0.5f, static_cast(cfgDeltaYAcceptanceBins->size() + 1.0f - 0.5f)}, binnedmultAxis, binnedpTPhiAxis, massPhiAxis}); + closureMCPhiHist.add("h4PhipurK0SMCClosure", "Invariant mass of Phi for Purity (K0S) in MCClosure", kTHnSparseF, {{static_cast(deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1), -0.5f, static_cast(deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1.0f - 0.5f)}, binnedmultAxis, binnedpTPhiAxis, massPhiAxis}); closureMCPhiHist.get(HIST("h4PhipurK0SMCClosure"))->GetAxis(0)->SetBinLabel(1, "Inclusive"); - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size(); i++) { - closureMCPhiHist.get(HIST("h4PhipurK0SMCClosure"))->GetAxis(0)->SetBinLabel(i + 2, Form("|Delta#it{y}| < %.1f", cfgDeltaYAcceptanceBins->at(i))); + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size(); i++) { + closureMCPhiHist.get(HIST("h4PhipurK0SMCClosure"))->GetAxis(0)->SetBinLabel(i + 2, Form("|Delta#it{y}| < %.1f", deltaYConfigs.cfgDeltaYAcceptanceBins->at(i))); } - closureMCPhiHist.add("h4PhipurPiMCClosure", "Invariant mass of Phi for Purity (Pi) in MCClosure", kTHnSparseF, {{static_cast(cfgDeltaYAcceptanceBins->size() + 1), -0.5f, static_cast(cfgDeltaYAcceptanceBins->size() + 1.0f - 0.5f)}, binnedmultAxis, binnedpTPhiAxis, massPhiAxis}); + closureMCPhiHist.add("h4PhipurPiMCClosure", "Invariant mass of Phi for Purity (Pi) in MCClosure", kTHnSparseF, {{static_cast(deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1), -0.5f, static_cast(deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1.0f - 0.5f)}, binnedmultAxis, binnedpTPhiAxis, massPhiAxis}); closureMCPhiHist.get(HIST("h4PhipurPiMCClosure"))->GetAxis(0)->SetBinLabel(1, "Inclusive"); - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size(); i++) { - closureMCPhiHist.get(HIST("h4PhipurPiMCClosure"))->GetAxis(0)->SetBinLabel(i + 2, Form("|Delta#it{y}| < %.1f", cfgDeltaYAcceptanceBins->at(i))); + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size(); i++) { + closureMCPhiHist.get(HIST("h4PhipurPiMCClosure"))->GetAxis(0)->SetBinLabel(i + 2, Form("|Delta#it{y}| < %.1f", deltaYConfigs.cfgDeltaYAcceptanceBins->at(i))); } } @@ -424,10 +446,10 @@ struct Phik0shortanalysis { if (analysisModeConfigs.isData) { // 2D mass of Phi and K0S for Data - dataPhiK0SHist.add("h5PhiK0SData", "2D Invariant mass of Phi and K0Short for Data", kTHnSparseF, {{static_cast(cfgDeltaYAcceptanceBins->size() + 1), -0.5f, static_cast(cfgDeltaYAcceptanceBins->size() + 1.0f - 0.5f)}, binnedmultAxis, binnedpTK0SAxis, massK0SAxis, sigmassPhiAxis}); + dataPhiK0SHist.add("h5PhiK0SData", "2D Invariant mass of Phi and K0Short for Data", kTHnSparseF, {{static_cast(deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1), -0.5f, static_cast(deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1.0f - 0.5f)}, binnedmultAxis, binnedpTK0SAxis, massK0SAxis, sigmassPhiAxis}); dataPhiK0SHist.get(HIST("h5PhiK0SData"))->GetAxis(0)->SetBinLabel(1, "Inclusive"); - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size(); i++) { - dataPhiK0SHist.get(HIST("h5PhiK0SData"))->GetAxis(0)->SetBinLabel(i + 2, Form("|Delta#it{y}| < %.1f", cfgDeltaYAcceptanceBins->at(i))); + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size(); i++) { + dataPhiK0SHist.get(HIST("h5PhiK0SData"))->GetAxis(0)->SetBinLabel(i + 2, Form("|Delta#it{y}| < %.1f", deltaYConfigs.cfgDeltaYAcceptanceBins->at(i))); } // 1D mass of K0S for Data @@ -441,32 +463,32 @@ struct Phik0shortanalysis { if (analysisModeConfigs.isMC) { // RecMC K0S coupled to Phi - mcPhiK0SHist.add("h4PhiK0SMCReco", "K0S coupled to Phi in MCReco", kTHnSparseF, {{static_cast(cfgDeltaYAcceptanceBins->size() + 1), -0.5f, static_cast(cfgDeltaYAcceptanceBins->size() + 1.0f - 0.5f)}, binnedmultAxis, binnedpTK0SAxis, massK0SAxis}); + mcPhiK0SHist.add("h4PhiK0SMCReco", "K0S coupled to Phi in MCReco", kTHnSparseF, {{static_cast(deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1), -0.5f, static_cast(deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1.0f - 0.5f)}, binnedmultAxis, binnedpTK0SAxis, massK0SAxis}); mcPhiK0SHist.get(HIST("h4PhiK0SMCReco"))->GetAxis(0)->SetBinLabel(1, "Inclusive"); - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size(); i++) { - mcPhiK0SHist.get(HIST("h4PhiK0SMCReco"))->GetAxis(0)->SetBinLabel(i + 2, Form("|Delta#it{y}| < %.1f", cfgDeltaYAcceptanceBins->at(i))); + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size(); i++) { + mcPhiK0SHist.get(HIST("h4PhiK0SMCReco"))->GetAxis(0)->SetBinLabel(i + 2, Form("|Delta#it{y}| < %.1f", deltaYConfigs.cfgDeltaYAcceptanceBins->at(i))); } // GenMC K0S coupled to Phi - mcPhiK0SHist.add("h3PhiK0SMCGen", "K0S coupled toPhi in MCGen", kTH3F, {{static_cast(cfgDeltaYAcceptanceBins->size() + 1), -0.5f, static_cast(cfgDeltaYAcceptanceBins->size() + 1.0f - 0.5f)}, binnedmultAxis, binnedpTK0SAxis}); + mcPhiK0SHist.add("h3PhiK0SMCGen", "K0S coupled toPhi in MCGen", kTH3F, {{static_cast(deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1), -0.5f, static_cast(deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1.0f - 0.5f)}, binnedmultAxis, binnedpTK0SAxis}); mcPhiK0SHist.get(HIST("h3PhiK0SMCGen"))->GetXaxis()->SetBinLabel(1, "Inclusive"); - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size(); i++) { - mcPhiK0SHist.get(HIST("h3PhiK0SMCGen"))->GetXaxis()->SetBinLabel(i + 2, Form("|Delta#it{y}| < %.1f", cfgDeltaYAcceptanceBins->at(i))); + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size(); i++) { + mcPhiK0SHist.get(HIST("h3PhiK0SMCGen"))->GetXaxis()->SetBinLabel(i + 2, Form("|Delta#it{y}| < %.1f", deltaYConfigs.cfgDeltaYAcceptanceBins->at(i))); } - mcPhiK0SHist.add("h3PhiK0SMCGenAssocReco", "K0S coupled toPhi in MCGen Associated MCReco Collision", kTH3F, {{static_cast(cfgDeltaYAcceptanceBins->size() + 1), -0.5f, static_cast(cfgDeltaYAcceptanceBins->size() + 1.0f - 0.5f)}, binnedmultAxis, binnedpTK0SAxis}); + mcPhiK0SHist.add("h3PhiK0SMCGenAssocReco", "K0S coupled toPhi in MCGen Associated MCReco Collision", kTH3F, {{static_cast(deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1), -0.5f, static_cast(deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1.0f - 0.5f)}, binnedmultAxis, binnedpTK0SAxis}); mcPhiK0SHist.get(HIST("h3PhiK0SMCGenAssocReco"))->GetXaxis()->SetBinLabel(1, "Inclusive"); - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size(); i++) { - mcPhiK0SHist.get(HIST("h3PhiK0SMCGenAssocReco"))->GetXaxis()->SetBinLabel(i + 2, Form("|Delta#it{y}| < %.1f", cfgDeltaYAcceptanceBins->at(i))); + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size(); i++) { + mcPhiK0SHist.get(HIST("h3PhiK0SMCGenAssocReco"))->GetXaxis()->SetBinLabel(i + 2, Form("|Delta#it{y}| < %.1f", deltaYConfigs.cfgDeltaYAcceptanceBins->at(i))); } } if (analysisModeConfigs.isClosure) { // 2D mass of Phi and K0S for Closure Test - closureMCPhiK0SHist.add("h5PhiK0SMCClosure", "2D Invariant mass of Phi and K0Short for MC Closure Test", kTHnSparseF, {{static_cast(cfgDeltaYAcceptanceBins->size() + 1), -0.5f, static_cast(cfgDeltaYAcceptanceBins->size() + 1.0f - 0.5f)}, binnedmultAxis, binnedpTK0SAxis, massK0SAxis, sigmassPhiAxis}); + closureMCPhiK0SHist.add("h5PhiK0SMCClosure", "2D Invariant mass of Phi and K0Short for MC Closure Test", kTHnSparseF, {{static_cast(deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1), -0.5f, static_cast(deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1.0f - 0.5f)}, binnedmultAxis, binnedpTK0SAxis, massK0SAxis, sigmassPhiAxis}); closureMCPhiK0SHist.get(HIST("h5PhiK0SMCClosure"))->GetAxis(0)->SetBinLabel(1, "Inclusive"); - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size(); i++) { - closureMCPhiK0SHist.get(HIST("h5PhiK0SMCClosure"))->GetAxis(0)->SetBinLabel(i + 2, Form("|Delta#it{y}| < %.1f", cfgDeltaYAcceptanceBins->at(i))); + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size(); i++) { + closureMCPhiK0SHist.get(HIST("h5PhiK0SMCClosure"))->GetAxis(0)->SetBinLabel(i + 2, Form("|Delta#it{y}| < %.1f", deltaYConfigs.cfgDeltaYAcceptanceBins->at(i))); } // 1D mass of K0S for Closure Test @@ -477,10 +499,10 @@ struct Phik0shortanalysis { if (analysisModeConfigs.isData) { // Phi mass vs Pion NSigma dE/dx for Data - dataPhiPionHist.add("h6PhiPiData", "Phi Invariant mass vs Pion nSigma TPC/TOF for Data", kTHnSparseF, {{static_cast(cfgDeltaYAcceptanceBins->size() + 1), -0.5f, static_cast(cfgDeltaYAcceptanceBins->size() + 1.0f - 0.5f)}, binnedmultAxis, binnedpTPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}, sigmassPhiAxis}); + dataPhiPionHist.add("h6PhiPiData", "Phi Invariant mass vs Pion nSigma TPC/TOF for Data", kTHnSparseF, {{static_cast(deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1), -0.5f, static_cast(deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1.0f - 0.5f)}, binnedmultAxis, binnedpTPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}, sigmassPhiAxis}); dataPhiPionHist.get(HIST("h6PhiPiData"))->GetAxis(0)->SetBinLabel(1, "Inclusive"); - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size(); i++) { - dataPhiPionHist.get(HIST("h6PhiPiData"))->GetAxis(0)->SetBinLabel(i + 2, Form("|Delta#it{y}| < %.1f", cfgDeltaYAcceptanceBins->at(i))); + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size(); i++) { + dataPhiPionHist.get(HIST("h6PhiPiData"))->GetAxis(0)->SetBinLabel(i + 2, Form("|Delta#it{y}| < %.1f", deltaYConfigs.cfgDeltaYAcceptanceBins->at(i))); } // Pion NSigma dE/dx for Data @@ -511,38 +533,38 @@ struct Phik0shortanalysis { if (analysisModeConfigs.isMC) { // RecMC Pion coupled to Phi with TPC - mcPhiPionHist.add("h4PhiPiTPCMCReco", "Pion coupled to Phi in MCReco (TPC)", kTHnSparseF, {{static_cast(cfgDeltaYAcceptanceBins->size() + 1), -0.5f, static_cast(cfgDeltaYAcceptanceBins->size() + 1.0f - 0.5f)}, binnedmultAxis, binnedpTPiAxis, {100, -10.0f, 10.0f}}); + mcPhiPionHist.add("h4PhiPiTPCMCReco", "Pion coupled to Phi in MCReco (TPC)", kTHnSparseF, {{static_cast(deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1), -0.5f, static_cast(deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1.0f - 0.5f)}, binnedmultAxis, binnedpTPiAxis, {100, -10.0f, 10.0f}}); mcPhiPionHist.get(HIST("h4PhiPiTPCMCReco"))->GetAxis(0)->SetBinLabel(1, "Inclusive"); - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size(); i++) { - mcPhiPionHist.get(HIST("h4PhiPiTPCMCReco"))->GetAxis(0)->SetBinLabel(i + 2, Form("|Delta#it{y}| < %.1f", cfgDeltaYAcceptanceBins->at(i))); + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size(); i++) { + mcPhiPionHist.get(HIST("h4PhiPiTPCMCReco"))->GetAxis(0)->SetBinLabel(i + 2, Form("|Delta#it{y}| < %.1f", deltaYConfigs.cfgDeltaYAcceptanceBins->at(i))); } // RecMC Pion coupled to Phi with TPC and TOF - mcPhiPionHist.add("h5PhiPiTPCTOFMCReco", "Pion coupled to Phi in MCReco (TPC and TOF)", kTHnSparseF, {{static_cast(cfgDeltaYAcceptanceBins->size() + 1), -0.5f, static_cast(cfgDeltaYAcceptanceBins->size() + 1.0f - 0.5f)}, binnedmultAxis, binnedpTPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}}); + mcPhiPionHist.add("h5PhiPiTPCTOFMCReco", "Pion coupled to Phi in MCReco (TPC and TOF)", kTHnSparseF, {{static_cast(deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1), -0.5f, static_cast(deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1.0f - 0.5f)}, binnedmultAxis, binnedpTPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}}); mcPhiPionHist.get(HIST("h5PhiPiTPCTOFMCReco"))->GetAxis(0)->SetBinLabel(1, "Inclusive"); - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size(); i++) { - mcPhiPionHist.get(HIST("h5PhiPiTPCTOFMCReco"))->GetAxis(0)->SetBinLabel(i + 2, Form("|Delta#it{y}| < %.1f", cfgDeltaYAcceptanceBins->at(i))); + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size(); i++) { + mcPhiPionHist.get(HIST("h5PhiPiTPCTOFMCReco"))->GetAxis(0)->SetBinLabel(i + 2, Form("|Delta#it{y}| < %.1f", deltaYConfigs.cfgDeltaYAcceptanceBins->at(i))); } - mcPhiPionHist.add("h3PhiPiMCGen", "Pion coupled to Phi in MCGen", kTH3F, {{static_cast(cfgDeltaYAcceptanceBins->size() + 1), -0.5f, static_cast(cfgDeltaYAcceptanceBins->size() + 1.0f - 0.5f)}, binnedmultAxis, binnedpTPiAxis}); + mcPhiPionHist.add("h3PhiPiMCGen", "Pion coupled to Phi in MCGen", kTH3F, {{static_cast(deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1), -0.5f, static_cast(deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1.0f - 0.5f)}, binnedmultAxis, binnedpTPiAxis}); mcPhiPionHist.get(HIST("h3PhiPiMCGen"))->GetXaxis()->SetBinLabel(1, "Inclusive"); - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size(); i++) { - mcPhiPionHist.get(HIST("h3PhiPiMCGen"))->GetXaxis()->SetBinLabel(i + 2, Form("|Delta#it{y}| < %.1f", cfgDeltaYAcceptanceBins->at(i))); + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size(); i++) { + mcPhiPionHist.get(HIST("h3PhiPiMCGen"))->GetXaxis()->SetBinLabel(i + 2, Form("|Delta#it{y}| < %.1f", deltaYConfigs.cfgDeltaYAcceptanceBins->at(i))); } - mcPhiPionHist.add("h3PhiPiMCGenAssocReco", "Pion coupled to Phi in MCGen Associated Reco Collision", kTH3F, {{static_cast(cfgDeltaYAcceptanceBins->size() + 1), -0.5f, static_cast(cfgDeltaYAcceptanceBins->size() + 1.0f - 0.5f)}, binnedmultAxis, binnedpTPiAxis}); + mcPhiPionHist.add("h3PhiPiMCGenAssocReco", "Pion coupled to Phi in MCGen Associated Reco Collision", kTH3F, {{static_cast(deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1), -0.5f, static_cast(deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1.0f - 0.5f)}, binnedmultAxis, binnedpTPiAxis}); mcPhiPionHist.get(HIST("h3PhiPiMCGenAssocReco"))->GetXaxis()->SetBinLabel(1, "Inclusive"); - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size(); i++) { - mcPhiPionHist.get(HIST("h3PhiPiMCGenAssocReco"))->GetXaxis()->SetBinLabel(i + 2, Form("|Delta#it{y}| < %.1f", cfgDeltaYAcceptanceBins->at(i))); + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size(); i++) { + mcPhiPionHist.get(HIST("h3PhiPiMCGenAssocReco"))->GetXaxis()->SetBinLabel(i + 2, Form("|Delta#it{y}| < %.1f", deltaYConfigs.cfgDeltaYAcceptanceBins->at(i))); } } if (analysisModeConfigs.isClosure) { // Phi mass vs Pion NSigma dE/dx for Closure Test - closureMCPhiPionHist.add("h6PhiPiMCClosure", "Phi Invariant mass vs Pion nSigma TPC/TOF for MC Closure Test", kTHnSparseF, {{static_cast(cfgDeltaYAcceptanceBins->size() + 1), -0.5f, static_cast(cfgDeltaYAcceptanceBins->size() + 1.0f - 0.5f)}, binnedmultAxis, binnedpTPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}, sigmassPhiAxis}); + closureMCPhiPionHist.add("h6PhiPiMCClosure", "Phi Invariant mass vs Pion nSigma TPC/TOF for MC Closure Test", kTHnSparseF, {{static_cast(deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1), -0.5f, static_cast(deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1.0f - 0.5f)}, binnedmultAxis, binnedpTPiAxis, {100, -10.0f, 10.0f}, {100, -10.0f, 10.0f}, sigmassPhiAxis}); closureMCPhiPionHist.get(HIST("h6PhiPiMCClosure"))->GetAxis(0)->SetBinLabel(1, "Inclusive"); - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size(); i++) { - closureMCPhiPionHist.get(HIST("h6PhiPiMCClosure"))->GetAxis(0)->SetBinLabel(i + 2, Form("|Delta#it{y}| < %.1f", cfgDeltaYAcceptanceBins->at(i))); + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size(); i++) { + closureMCPhiPionHist.get(HIST("h6PhiPiMCClosure"))->GetAxis(0)->SetBinLabel(i + 2, Form("|Delta#it{y}| < %.1f", deltaYConfigs.cfgDeltaYAcceptanceBins->at(i))); } // Phi mass vs Pion NSigma dE/dx for Closure Test @@ -664,9 +686,9 @@ struct Phik0shortanalysis { if (fillMethodSingleWeight) getPhiPurityFunctionsFromCCDB(); - if (applyEfficiency) + if (applyEfficiency) { getEfficiencyMapsFromCCDB(); - else { + } else { effMapPhi = nullptr; effMapK0S = nullptr; effMapPionTPC = nullptr; @@ -716,7 +738,7 @@ struct Phik0shortanalysis { return false; if (QA) { mcEventHist.fill(HIST("hRecMCEventSelection"), 4); // vertex-Z selected - mcEventHist.fill(HIST("hRecMCVertexZ"), collision.posZ()); + mcEventHist.fill(HIST("hRecoMCVertexZ"), collision.posZ()); } if (!collision.isInelGt0()) return false; @@ -928,7 +950,7 @@ struct Phik0shortanalysis { continue; if (recPhi.M() < lowMPhi || recPhi.M() > upMPhi) continue; - if (std::abs(recPhi.Rapidity()) > cfgYAcceptance) + if (std::abs(recPhi.Rapidity()) > deltaYConfigs.cfgYAcceptance) continue; nPhi++; @@ -950,7 +972,7 @@ struct Phik0shortanalysis { continue; if (mcParticle.pt() < minPhiPt || mcParticle.pt() > maxPhiPt) continue; - if (std::abs(mcParticle.y()) > cfgYAcceptance) + if (std::abs(mcParticle.y()) > deltaYConfigs.cfgYAcceptance) continue; nPhi++; @@ -976,6 +998,27 @@ struct Phik0shortanalysis { return true; } + int fromPDGToEnum(int pdgCode) + { + int pid = kSpAll; + switch (std::abs(pdgCode)) { + case PDG_t::kPiPlus: + pid = kSpPion; + break; + case PDG_t::kKPlus: + pid = kSpKaon; + break; + case PDG_t::kProton: + pid = kSpProton; + break; + default: + pid = kSpOther; + break; + } + + return pid; + } + // Get phi-meson purity functions from CCDB void getPhiPurityFunctionsFromCCDB() { @@ -1053,15 +1096,15 @@ struct Phik0shortanalysis { for (const auto& Phi : listPhi) { if constexpr (!isMC) { // same event dataPhiK0SHist.fill(HIST("h5PhiK0SData"), 0, multiplicity, V0.pt(), V0.mK0Short(), Phi.M(), weights.at(0)); - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size(); i++) { - if (std::abs(V0.yK0Short() - Phi.Rapidity()) > cfgDeltaYAcceptanceBins->at(i)) + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size(); i++) { + if (std::abs(V0.yK0Short() - Phi.Rapidity()) > deltaYConfigs.cfgDeltaYAcceptanceBins->at(i)) continue; dataPhiK0SHist.fill(HIST("h5PhiK0SData"), i + 1, multiplicity, V0.pt(), V0.mK0Short(), Phi.M(), weights.at(i + 1)); } } else { // MC event closureMCPhiK0SHist.fill(HIST("h5PhiK0SMCClosure"), 0, multiplicity, V0.pt(), V0.mK0Short(), Phi.M(), weights.at(0)); - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size(); i++) { - if (std::abs(V0.yK0Short() - Phi.Rapidity()) > cfgDeltaYAcceptanceBins->at(i)) + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size(); i++) { + if (std::abs(V0.yK0Short() - Phi.Rapidity()) > deltaYConfigs.cfgDeltaYAcceptanceBins->at(i)) continue; closureMCPhiK0SHist.fill(HIST("h5PhiK0SMCClosure"), i + 1, multiplicity, V0.pt(), V0.mK0Short(), Phi.M(), weights.at(i + 1)); } @@ -1078,15 +1121,15 @@ struct Phik0shortanalysis { for (const auto& Phi : listPhi) { if constexpr (!isMC) { // same event dataPhiPionHist.fill(HIST("h6PhiPiData"), 0, multiplicity, Pi.pt(), Pi.tpcNSigmaPi(), nSigmaTOFPi, Phi.M(), weights.at(0)); - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size(); i++) { - if (std::abs(Pi.rapidity(massPi) - Phi.Rapidity()) > cfgDeltaYAcceptanceBins->at(i)) + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size(); i++) { + if (std::abs(Pi.rapidity(massPi) - Phi.Rapidity()) > deltaYConfigs.cfgDeltaYAcceptanceBins->at(i)) continue; dataPhiPionHist.fill(HIST("h6PhiPiData"), i + 1, multiplicity, Pi.pt(), Pi.tpcNSigmaPi(), nSigmaTOFPi, Phi.M(), weights.at(i + 1)); } } else { // MC event closureMCPhiPionHist.fill(HIST("h6PhiPiMCClosure"), 0, multiplicity, Pi.pt(), Pi.tpcNSigmaPi(), nSigmaTOFPi, Phi.M(), weights.at(0)); - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size(); i++) { - if (std::abs(Pi.rapidity(massPi) - Phi.Rapidity()) > cfgDeltaYAcceptanceBins->at(i)) + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size(); i++) { + if (std::abs(Pi.rapidity(massPi) - Phi.Rapidity()) > deltaYConfigs.cfgDeltaYAcceptanceBins->at(i)) continue; closureMCPhiPionHist.fill(HIST("h6PhiPiMCClosure"), i + 1, multiplicity, Pi.pt(), Pi.tpcNSigmaPi(), nSigmaTOFPi, Phi.M(), weights.at(i + 1)); } @@ -1167,7 +1210,7 @@ struct Phik0shortanalysis { ROOT::Math::PxPyPzMVector recPhi = recMother(track1, track2, massKa, massKa); if (recPhi.Pt() < minPhiPt || recPhi.Pt() > maxPhiPt) continue; - if (std::abs(recPhi.Rapidity()) > cfgYAcceptance) + if (std::abs(recPhi.Rapidity()) > deltaYConfigs.cfgYAcceptance) continue; if (!isCountedPhi) { @@ -1181,7 +1224,7 @@ struct Phik0shortanalysis { dataPhiHist.fill(HIST("h3PhipurData"), multiplicity, recPhi.Pt(), recPhi.M()); - std::vector countsK0S(cfgDeltaYAcceptanceBins->size() + 1, 0); + std::vector countsK0S(deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1, 0); // V0 already reconstructed by the builder for (const auto& v0 : V0s) { @@ -1205,43 +1248,43 @@ struct Phik0shortanalysis { } } - if (std::abs(v0.yK0Short()) > cfgYAcceptance) + if (std::abs(v0.yK0Short()) > deltaYConfigs.cfgYAcceptance) continue; countsK0S.at(0)++; - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size(); i++) { - if (std::abs(v0.yK0Short() - recPhi.Rapidity()) > cfgDeltaYAcceptanceBins->at(i)) + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size(); i++) { + if (std::abs(v0.yK0Short() - recPhi.Rapidity()) > deltaYConfigs.cfgDeltaYAcceptanceBins->at(i)) continue; countsK0S.at(i + 1)++; } } - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size() + 1; i++) { + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1; i++) { if (countsK0S.at(i) > 0) dataPhiHist.fill(HIST("h4PhipurK0SData"), i, multiplicity, recPhi.Pt(), recPhi.M()); } isFilledhV0 = true; - std::vector countsPi(cfgDeltaYAcceptanceBins->size(), 0); + std::vector countsPi(deltaYConfigs.cfgDeltaYAcceptanceBins->size(), 0); // Loop over all primary pion candidates for (const auto& track : fullTracks) { if (!selectionPion(track, false)) continue; - if (std::abs(track.rapidity(massPi)) > cfgYAcceptance) + if (std::abs(track.rapidity(massPi)) > deltaYConfigs.cfgYAcceptance) continue; countsPi.at(0)++; - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size(); i++) { - if (std::abs(track.rapidity(massPi) - recPhi.Rapidity()) > cfgDeltaYAcceptanceBins->at(i)) + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size(); i++) { + if (std::abs(track.rapidity(massPi) - recPhi.Rapidity()) > deltaYConfigs.cfgDeltaYAcceptanceBins->at(i)) continue; countsPi.at(i + 1)++; } } - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size() + 1; i++) { + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1; i++) { if (countsPi.at(i) > 0) dataPhiHist.fill(HIST("h4PhipurPiData"), i, multiplicity, recPhi.Pt(), recPhi.M()); } @@ -1279,12 +1322,12 @@ struct Phik0shortanalysis { dataK0SHist.fill(HIST("h3K0SRapidityData"), multiplicity, v0.pt(), v0.yK0Short()); - if (std::abs(v0.yK0Short()) > cfgYAcceptance) + if (std::abs(v0.yK0Short()) > deltaYConfigs.cfgYAcceptance) continue; std::vector listrecPhi; - std::vector counts(cfgDeltaYAcceptanceBins->size() + 1, 0); - std::vector weights(cfgDeltaYAcceptanceBins->size() + 1, 1); + std::vector counts(deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1, 0); + std::vector weights(deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1, 1); // Phi reconstruction // Loop over positive tracks @@ -1308,7 +1351,7 @@ struct Phik0shortanalysis { continue; if (recPhi.M() < lowMPhi || recPhi.M() > upMPhi) continue; - if (std::abs(recPhi.Rapidity()) > cfgYAcceptance) + if (std::abs(recPhi.Rapidity()) > deltaYConfigs.cfgYAcceptance) continue; double phiPurity{}; @@ -1320,8 +1363,8 @@ struct Phik0shortanalysis { counts.at(0)++; weights.at(0) *= (1 - phiPurity); - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size(); i++) { - if (std::abs(v0.yK0Short() - recPhi.Rapidity()) > cfgDeltaYAcceptanceBins->at(i)) + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size(); i++) { + if (std::abs(v0.yK0Short() - recPhi.Rapidity()) > deltaYConfigs.cfgDeltaYAcceptanceBins->at(i)) continue; counts.at(i + 1)++; weights.at(i + 1) *= (1 - phiPurity); @@ -1330,12 +1373,12 @@ struct Phik0shortanalysis { } if (fillMethodMultipleWeights) { - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size() + 1; i++) { + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1; i++) { weights.at(i) = (counts.at(i) > 0 ? 1. / static_cast(counts.at(i)) : 0); } fillInvMass2D(v0, listrecPhi, multiplicity, weights); } else if (fillMethodSingleWeight) { - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size() + 1; i++) { + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1; i++) { weights.at(i) = (counts.at(i) > 0 ? 1 - weights.at(i) : 0); } fillInvMass(v0, multiplicity, weights); @@ -1366,12 +1409,12 @@ struct Phik0shortanalysis { dataPionHist.fill(HIST("h3PiRapidityData"), multiplicity, track.pt(), track.rapidity(massPi)); - if (std::abs(track.rapidity(massPi)) > cfgYAcceptance) + if (std::abs(track.rapidity(massPi)) > deltaYConfigs.cfgYAcceptance) continue; std::vector listrecPhi; - std::vector counts(cfgDeltaYAcceptanceBins->size() + 1, 0); - std::vector weights(cfgDeltaYAcceptanceBins->size() + 1, 1); + std::vector counts(deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1, 0); + std::vector weights(deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1, 1); // Phi reconstruction // Loop over positive tracks @@ -1395,7 +1438,7 @@ struct Phik0shortanalysis { continue; if (recPhi.M() < lowMPhi || recPhi.M() > upMPhi) continue; - if (std::abs(recPhi.Rapidity()) > cfgYAcceptance) + if (std::abs(recPhi.Rapidity()) > deltaYConfigs.cfgYAcceptance) continue; double phiPurity{}; @@ -1407,8 +1450,8 @@ struct Phik0shortanalysis { counts.at(0)++; weights.at(0) *= (1 - phiPurity); - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size(); i++) { - if (std::abs(track.rapidity(massPi) - recPhi.Rapidity()) > cfgDeltaYAcceptanceBins->at(i)) + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size(); i++) { + if (std::abs(track.rapidity(massPi) - recPhi.Rapidity()) > deltaYConfigs.cfgDeltaYAcceptanceBins->at(i)) continue; counts.at(i + 1)++; weights.at(i + 1) *= (1 - phiPurity); @@ -1417,12 +1460,12 @@ struct Phik0shortanalysis { } if (fillMethodMultipleWeights) { - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size() + 1; i++) { + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1; i++) { weights.at(i) = (counts.at(i) > 0 ? 1. / static_cast(counts.at(i)) : 0); } fillInvMassNSigma(track, listrecPhi, multiplicity, weights); } else if (fillMethodSingleWeight) { - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size() + 1; i++) { + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1; i++) { weights.at(i) = (counts.at(i) > 0 ? 1 - weights.at(i) : 0); } fillNSigma(track, multiplicity, weights); @@ -1438,7 +1481,7 @@ struct Phik0shortanalysis { return; float multiplicity = collision.centFT0M(); - mcEventHist.fill(HIST("hRecMCMultiplicityPercent"), multiplicity); + mcEventHist.fill(HIST("hUnbinnedRecoMCMultiplicityPercent"), multiplicity); if (!collision.has_mcCollision()) return; @@ -1446,7 +1489,7 @@ struct Phik0shortanalysis { const auto& mcCollision = collision.mcCollision_as(); float genmultiplicity = mcCollision.centFT0M(); - mcEventHist.fill(HIST("hRecMCGenMultiplicityPercent"), genmultiplicity); + mcEventHist.fill(HIST("hRecoMCMultiplicityPercent"), genmultiplicity); // Defining positive and negative tracks for phi reconstruction auto posThisColl = posMCTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); @@ -1502,7 +1545,7 @@ struct Phik0shortanalysis { mcPhiHist.fill(HIST("h3PhiRapiditySmearing"), genmultiplicity, recPhi.Rapidity(), mcMotherPhi.y()); - if (std::abs(recPhi.Rapidity()) > cfgYAcceptance) + if (std::abs(recPhi.Rapidity()) > deltaYConfigs.cfgYAcceptance) continue; if (!isCountedPhi) { @@ -1533,19 +1576,19 @@ struct Phik0shortanalysis { if (v0Configs.cfgFurtherV0Selection && !furtherSelectionV0(v0, collision)) continue; - if (std::abs(v0.yK0Short()) > cfgYAcceptance) + if (std::abs(v0.yK0Short()) > deltaYConfigs.cfgYAcceptance) continue; if (!isCountedK0S.at(0)) { mcPhiHist.fill(HIST("h3PhieffK0SInvMassInc"), genmultiplicity, v0.pt(), recPhi.M()); isCountedK0S.at(0) = true; } - if (std::abs(v0.yK0Short() - recPhi.Rapidity()) > cfgFCutOnDeltaY) + if (std::abs(v0.yK0Short() - recPhi.Rapidity()) > deltaYConfigs.cfgFCutOnDeltaY) continue; if (!isCountedK0S.at(1)) { mcPhiHist.fill(HIST("h3PhieffK0SInvMassFCut"), genmultiplicity, v0.pt(), recPhi.M()); isCountedK0S.at(1) = true; } - if (std::abs(v0.yK0Short() - recPhi.Rapidity()) > cfgSCutOnDeltaY) + if (std::abs(v0.yK0Short() - recPhi.Rapidity()) > deltaYConfigs.cfgSCutOnDeltaY) continue; if (!isCountedK0S.at(2)) { mcPhiHist.fill(HIST("h3PhieffK0SInvMassSCut"), genmultiplicity, v0.pt(), recPhi.M()); @@ -1567,19 +1610,19 @@ struct Phik0shortanalysis { if (!selectionPion(track, false)) continue; - if (std::abs(track.rapidity(massPi)) > cfgYAcceptance) + if (std::abs(track.rapidity(massPi)) > deltaYConfigs.cfgYAcceptance) continue; if (!isCountedPi.at(0)) { mcPhiHist.fill(HIST("h3PhieffPiInvMassInc"), genmultiplicity, track.pt(), recPhi.M()); isCountedPi.at(0) = true; } - if (std::abs(track.rapidity(massPi) - recPhi.Rapidity()) > cfgFCutOnDeltaY) + if (std::abs(track.rapidity(massPi) - recPhi.Rapidity()) > deltaYConfigs.cfgFCutOnDeltaY) continue; if (!isCountedPi.at(1)) { mcPhiHist.fill(HIST("h3PhieffPiInvMassFCut"), genmultiplicity, track.pt(), recPhi.M()); isCountedPi.at(1) = true; } - if (std::abs(track.rapidity(massPi) - recPhi.Rapidity()) > cfgSCutOnDeltaY) + if (std::abs(track.rapidity(massPi) - recPhi.Rapidity()) > deltaYConfigs.cfgSCutOnDeltaY) continue; if (!isCountedPi.at(2)) { mcPhiHist.fill(HIST("h3PhieffPiInvMassSCut"), genmultiplicity, track.pt(), recPhi.M()); @@ -1629,30 +1672,30 @@ struct Phik0shortanalysis { mcK0SHist.fill(HIST("h4K0SRapiditySmearing"), genmultiplicity, v0.pt(), v0.yK0Short(), v0mcparticle.y()); - if (std::abs(v0mcparticle.y()) > cfgYAcceptance) + if (std::abs(v0mcparticle.y()) > deltaYConfigs.cfgYAcceptance) continue; mcK0SHist.fill(HIST("h3K0SMCReco"), genmultiplicity, v0mcparticle.pt(), v0.mK0Short()); - std::vector counts(cfgDeltaYAcceptanceBins->size() + 1, 0); + std::vector counts(deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1, 0); for (const auto& mcParticle : mcParticlesThisColl) { if (mcParticle.pdgCode() != o2::constants::physics::Pdg::kPhi) continue; if (mcParticle.pt() < minPhiPt || mcParticle.pt() > maxPhiPt) continue; - if (std::abs(mcParticle.y()) > cfgYAcceptance) + if (std::abs(mcParticle.y()) > deltaYConfigs.cfgYAcceptance) continue; counts.at(0)++; - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size(); i++) { - if (std::abs(v0mcparticle.y() - mcParticle.y()) > cfgDeltaYAcceptanceBins->at(i)) + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size(); i++) { + if (std::abs(v0mcparticle.y() - mcParticle.y()) > deltaYConfigs.cfgDeltaYAcceptanceBins->at(i)) continue; counts.at(i + 1)++; } } - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size() + 1; i++) { + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1; i++) { if (counts.at(i) > 0) mcPhiK0SHist.fill(HIST("h4PhiK0SMCReco"), i, genmultiplicity, v0mcparticle.pt(), v0.mK0Short()); } @@ -1693,7 +1736,7 @@ struct Phik0shortanalysis { if (std::abs(mcTrack.pdgCode()) != PDG_t::kPiPlus) continue; - if (std::abs(mcTrack.y()) > cfgYAcceptance) + if (std::abs(mcTrack.y()) > deltaYConfigs.cfgYAcceptance) continue; // Primary pion selection @@ -1712,25 +1755,25 @@ struct Phik0shortanalysis { mcPionHist.fill(HIST("h3PiTPCMCReco"), genmultiplicity, mcTrack.pt(), track.tpcNSigmaPi()); - std::vector countsTPC(cfgDeltaYAcceptanceBins->size() + 1, 0); + std::vector countsTPC(deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1, 0); for (const auto& mcParticle : mcParticlesThisColl) { if (mcParticle.pdgCode() != o2::constants::physics::Pdg::kPhi) continue; if (mcParticle.pt() < minPhiPt || mcParticle.pt() > maxPhiPt) continue; - if (std::abs(mcParticle.y()) > cfgYAcceptance) + if (std::abs(mcParticle.y()) > deltaYConfigs.cfgYAcceptance) continue; countsTPC.at(0)++; - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size(); i++) { - if (std::abs(mcTrack.y() - mcParticle.y()) > cfgDeltaYAcceptanceBins->at(i)) + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size(); i++) { + if (std::abs(mcTrack.y() - mcParticle.y()) > deltaYConfigs.cfgDeltaYAcceptanceBins->at(i)) continue; countsTPC.at(i + 1)++; } } - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size() + 1; i++) { + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1; i++) { if (countsTPC.at(i) > 0) mcPhiPionHist.fill(HIST("h4PhiPiTPCMCReco"), i, genmultiplicity, mcTrack.pt(), track.tpcNSigmaPi()); } @@ -1740,25 +1783,25 @@ struct Phik0shortanalysis { mcPionHist.fill(HIST("h4PiTPCTOFMCReco"), genmultiplicity, mcTrack.pt(), track.tpcNSigmaPi(), track.tofNSigmaPi()); - std::vector countsTPCTOF(cfgDeltaYAcceptanceBins->size() + 1, 0); + std::vector countsTPCTOF(deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1, 0); for (const auto& mcParticle : mcParticlesThisColl) { if (mcParticle.pdgCode() != o2::constants::physics::Pdg::kPhi) continue; if (mcParticle.pt() < minPhiPt || mcParticle.pt() > maxPhiPt) continue; - if (std::abs(mcParticle.y()) > cfgYAcceptance) + if (std::abs(mcParticle.y()) > deltaYConfigs.cfgYAcceptance) continue; countsTPCTOF.at(0)++; - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size(); i++) { - if (std::abs(mcTrack.y() - mcParticle.y()) > cfgDeltaYAcceptanceBins->at(i)) + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size(); i++) { + if (std::abs(mcTrack.y() - mcParticle.y()) > deltaYConfigs.cfgDeltaYAcceptanceBins->at(i)) continue; countsTPCTOF.at(i + 1)++; } } - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size() + 1; i++) { + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1; i++) { if (countsTPCTOF.at(i) > 0) mcPhiPionHist.fill(HIST("h5PhiPiTPCTOFMCReco"), i, genmultiplicity, mcTrack.pt(), track.tpcNSigmaPi(), track.tofNSigmaPi()); } @@ -1779,7 +1822,7 @@ struct Phik0shortanalysis { const auto& mcCollision = collision.mcCollision_as(); float genmultiplicity = mcCollision.centFT0M(); - mcEventHist.fill(HIST("hRecMCGenMultiplicityPercent"), genmultiplicity); + mcEventHist.fill(HIST("hRecoMCMultiplicityPercent"), genmultiplicity); // Defining positive and negative tracks for phi reconstruction auto posThisColl = posMCTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); @@ -1808,12 +1851,12 @@ struct Phik0shortanalysis { ROOT::Math::PxPyPzMVector recPhi = recMother(track1, track2, massKa, massKa); if (recPhi.Pt() < minPhiPt || recPhi.Pt() > maxPhiPt) continue; - if (std::abs(recPhi.Rapidity()) > cfgYAcceptance) + if (std::abs(recPhi.Rapidity()) > deltaYConfigs.cfgYAcceptance) continue; if (!isCountedPhi) { mcEventHist.fill(HIST("hRecMCEventSelection"), 7); // at least a Phi candidate in the event - mcEventHist.fill(HIST("hRecMCGenMultiplicityPercentWithPhi"), genmultiplicity); + mcEventHist.fill(HIST("hRecoMCMultiplicityPercentWithPhi"), genmultiplicity); isCountedPhi = true; } @@ -1822,7 +1865,7 @@ struct Phik0shortanalysis { closureMCPhiHist.fill(HIST("h3PhipurMCClosure"), genmultiplicity, recPhi.Pt(), recPhi.M()); - std::vector countsK0S(cfgDeltaYAcceptanceBins->size() + 1, 0); + std::vector countsK0S(deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1, 0); // V0 already reconstructed by the builder for (const auto& v0 : V0s) { @@ -1842,23 +1885,23 @@ struct Phik0shortanalysis { if (v0Configs.cfgFurtherV0Selection && !furtherSelectionV0(v0, collision)) continue; - if (std::abs(v0.yK0Short()) > cfgYAcceptance) + if (std::abs(v0.yK0Short()) > deltaYConfigs.cfgYAcceptance) continue; countsK0S.at(0)++; - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size(); i++) { - if (std::abs(v0.yK0Short() - recPhi.Rapidity()) > cfgDeltaYAcceptanceBins->at(i)) + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size(); i++) { + if (std::abs(v0.yK0Short() - recPhi.Rapidity()) > deltaYConfigs.cfgDeltaYAcceptanceBins->at(i)) continue; countsK0S.at(i + 1)++; } } - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size() + 1; i++) { + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1; i++) { if (countsK0S.at(i) > 0) closureMCPhiHist.fill(HIST("h4PhipurK0SInvMass"), i, genmultiplicity, recPhi.Pt(), recPhi.M()); } - std::vector countsPi(cfgDeltaYAcceptanceBins->size() + 1, 0); + std::vector countsPi(deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1, 0); // Loop over all primary pion candidates for (const auto& track : fullMCTracks) { @@ -1873,18 +1916,18 @@ struct Phik0shortanalysis { if (!selectionPion(track, false)) continue; - if (std::abs(track.rapidity(massPi)) > cfgYAcceptance) + if (std::abs(track.rapidity(massPi)) > deltaYConfigs.cfgYAcceptance) continue; countsPi.at(0)++; - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size(); i++) { - if (std::abs(track.rapidity(massPi) - recPhi.Rapidity()) > cfgDeltaYAcceptanceBins->at(i)) + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size(); i++) { + if (std::abs(track.rapidity(massPi) - recPhi.Rapidity()) > deltaYConfigs.cfgDeltaYAcceptanceBins->at(i)) continue; countsPi.at(i + 1)++; } } - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size() + 1; i++) { + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1; i++) { if (countsPi.at(i) > 0) closureMCPhiHist.fill(HIST("h4PhipurPiInvMass"), i, genmultiplicity, recPhi.Pt(), recPhi.M()); } @@ -1930,12 +1973,12 @@ struct Phik0shortanalysis { if (v0Configs.cfgFurtherV0Selection && !furtherSelectionV0(v0, collision)) continue; - if (std::abs(v0.yK0Short()) > cfgYAcceptance) + if (std::abs(v0.yK0Short()) > deltaYConfigs.cfgYAcceptance) continue; std::vector listrecPhi; - std::vector counts(cfgDeltaYAcceptanceBins->size() + 1, 0); - std::vector weights(cfgDeltaYAcceptanceBins->size() + 1, 1); + std::vector counts(deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1, 0); + std::vector weights(deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1, 1); // Phi reconstruction for (const auto& track1 : posThisColl) { // loop over all selected tracks @@ -1986,7 +2029,7 @@ struct Phik0shortanalysis { continue; if (recPhi.M() < lowMPhi || recPhi.M() > upMPhi) continue; - if (std::abs(recPhi.Rapidity()) > cfgYAcceptance) + if (std::abs(recPhi.Rapidity()) > deltaYConfigs.cfgYAcceptance) continue; double phiPurity{}; @@ -1998,8 +2041,8 @@ struct Phik0shortanalysis { counts.at(0)++; weights.at(0) *= (1 - phiPurity); - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size(); i++) { - if (std::abs(v0.yK0Short() - recPhi.Rapidity()) > cfgDeltaYAcceptanceBins->at(i)) + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size(); i++) { + if (std::abs(v0.yK0Short() - recPhi.Rapidity()) > deltaYConfigs.cfgDeltaYAcceptanceBins->at(i)) continue; counts.at(i + 1)++; weights.at(i + 1) *= (1 - phiPurity); @@ -2008,12 +2051,12 @@ struct Phik0shortanalysis { } if (fillMethodMultipleWeights) { - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size() + 1; i++) { + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1; i++) { weights.at(i) = (counts.at(i) > 0 ? 1. / static_cast(counts.at(i)) : 0); } fillInvMass2D(v0, listrecPhi, genmultiplicity, weights); } else if (fillMethodSingleWeight) { - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size() + 1; i++) { + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1; i++) { weights.at(i) = (counts.at(i) > 0 ? 1 - weights.at(i) : 0); } fillInvMass(v0, genmultiplicity, weights); @@ -2052,12 +2095,12 @@ struct Phik0shortanalysis { if (!selectionPion(track, true)) continue; - if (std::abs(track.rapidity(massPi)) > cfgYAcceptance) + if (std::abs(track.rapidity(massPi)) > deltaYConfigs.cfgYAcceptance) continue; std::vector listrecPhi; - std::vector counts(cfgDeltaYAcceptanceBins->size() + 1, 0); - std::vector weights(cfgDeltaYAcceptanceBins->size() + 1, 1); + std::vector counts(deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1, 0); + std::vector weights(deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1, 1); // Phi reconstruction for (const auto& track1 : posThisColl) { // loop over all selected tracks @@ -2108,7 +2151,7 @@ struct Phik0shortanalysis { continue; if (recPhi.M() < lowMPhi || recPhi.M() > upMPhi) continue; - if (std::abs(recPhi.Rapidity()) > cfgYAcceptance) + if (std::abs(recPhi.Rapidity()) > deltaYConfigs.cfgYAcceptance) continue; double phiPurity{}; @@ -2120,8 +2163,8 @@ struct Phik0shortanalysis { counts.at(0)++; weights.at(0) *= (1 - phiPurity); - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size(); i++) { - if (std::abs(track.rapidity(massPi) - recPhi.Rapidity()) > cfgDeltaYAcceptanceBins->at(i)) + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size(); i++) { + if (std::abs(track.rapidity(massPi) - recPhi.Rapidity()) > deltaYConfigs.cfgDeltaYAcceptanceBins->at(i)) continue; counts.at(i + 1)++; weights.at(i + 1) *= (1 - phiPurity); @@ -2130,12 +2173,12 @@ struct Phik0shortanalysis { } if (fillMethodMultipleWeights) { - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size() + 1; i++) { + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1; i++) { weights.at(i) = (counts.at(i) > 0 ? 1. / static_cast(counts.at(i)) : 0); } fillInvMassNSigma(track, listrecPhi, genmultiplicity, weights); } else if (fillMethodSingleWeight) { - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size() + 1; i++) { + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1; i++) { weights.at(i) = (counts.at(i) > 0 ? 1 - weights.at(i) : 0); } fillNSigma(track, genmultiplicity, weights); @@ -2184,7 +2227,7 @@ struct Phik0shortanalysis { } if (!isPosKaon || !isNegKaon) continue; - if (std::abs(mcParticle1.y()) > cfgYAcceptance) + if (std::abs(mcParticle1.y()) > deltaYConfigs.cfgYAcceptance) continue; if (!isCountedPhi) { @@ -2206,7 +2249,7 @@ struct Phik0shortanalysis { if (!mcParticle2.isPhysicalPrimary()) continue; - if (std::abs(mcParticle2.y()) > cfgYAcceptance) + if (std::abs(mcParticle2.y()) > deltaYConfigs.cfgYAcceptance) continue; if (!isCountedK0S.at(0)) { mcPhiHist.fill(HIST("h2PhieffK0SGenMCInc"), genmultiplicity, mcParticle2.pt()); @@ -2214,7 +2257,7 @@ struct Phik0shortanalysis { mcPhiHist.fill(HIST("h2PhieffK0SGenMCFCutAssocReco"), genmultiplicity, mcParticle2.pt()); isCountedK0S.at(0) = true; } - if (std::abs(mcParticle1.y() - mcParticle2.y()) > cfgFCutOnDeltaY) + if (std::abs(mcParticle1.y() - mcParticle2.y()) > deltaYConfigs.cfgFCutOnDeltaY) continue; if (!isCountedK0S.at(1)) { mcPhiHist.fill(HIST("h2PhieffK0SGenMCFCut"), genmultiplicity, mcParticle2.pt()); @@ -2222,7 +2265,7 @@ struct Phik0shortanalysis { mcPhiHist.fill(HIST("h2PhieffK0SGenMCFCutAssocReco"), genmultiplicity, mcParticle2.pt()); isCountedK0S.at(1) = true; } - if (std::abs(mcParticle1.y() - mcParticle2.y()) > cfgSCutOnDeltaY) + if (std::abs(mcParticle1.y() - mcParticle2.y()) > deltaYConfigs.cfgSCutOnDeltaY) continue; if (!isCountedK0S.at(2)) { mcPhiHist.fill(HIST("h2PhieffK0SGenMCSCut"), genmultiplicity, mcParticle2.pt()); @@ -2240,7 +2283,7 @@ struct Phik0shortanalysis { if (!mcParticle2.isPhysicalPrimary()) continue; - if (std::abs(mcParticle2.y()) > cfgYAcceptance) + if (std::abs(mcParticle2.y()) > deltaYConfigs.cfgYAcceptance) continue; if (!isCountedPi.at(0)) { mcPhiHist.fill(HIST("h2PhieffPiGenMCInc"), genmultiplicity, mcParticle2.pt()); @@ -2248,7 +2291,7 @@ struct Phik0shortanalysis { mcPhiHist.fill(HIST("h2PhieffPiGenMCIncAssocReco"), genmultiplicity, mcParticle2.pt()); isCountedPi.at(0) = true; } - if (std::abs(mcParticle1.y() - mcParticle2.y()) > cfgFCutOnDeltaY) + if (std::abs(mcParticle1.y() - mcParticle2.y()) > deltaYConfigs.cfgFCutOnDeltaY) continue; if (!isCountedPi.at(1)) { mcPhiHist.fill(HIST("h2PhieffPiGenMCFCut"), genmultiplicity, mcParticle2.pt()); @@ -2256,7 +2299,7 @@ struct Phik0shortanalysis { mcPhiHist.fill(HIST("h2PhieffPiGenMCFCutAssocReco"), genmultiplicity, mcParticle2.pt()); isCountedPi.at(1) = true; } - if (std::abs(mcParticle1.y() - mcParticle2.y()) > cfgSCutOnDeltaY) + if (std::abs(mcParticle1.y() - mcParticle2.y()) > deltaYConfigs.cfgSCutOnDeltaY) continue; if (!isCountedPi.at(2)) { mcPhiHist.fill(HIST("h2PhieffPiGenMCSCut"), genmultiplicity, mcParticle2.pt()); @@ -2296,14 +2339,14 @@ struct Phik0shortanalysis { mcK0SHist.fill(HIST("h3K0SRapidityGenMC"), genmultiplicity, mcParticle1.pt(), mcParticle1.y()); - if (std::abs(mcParticle1.y()) > cfgYAcceptance) + if (std::abs(mcParticle1.y()) > deltaYConfigs.cfgYAcceptance) continue; mcK0SHist.fill(HIST("h2K0SMCGen"), genmultiplicity, mcParticle1.pt()); if (isAssocColl) mcK0SHist.fill(HIST("h2K0SMCGenAssocReco"), genmultiplicity, mcParticle1.pt()); - std::vector counts(cfgDeltaYAcceptanceBins->size() + 1, 0); + std::vector counts(deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1, 0); for (const auto& mcParticle2 : mcParticles) { if (mcParticle2.pdgCode() != o2::constants::physics::Pdg::kPhi) @@ -2324,18 +2367,18 @@ struct Phik0shortanalysis { } if (mcParticle2.pt() < minPhiPt || mcParticle2.pt() > maxPhiPt) continue; - if (std::abs(mcParticle2.y()) > cfgYAcceptance) + if (std::abs(mcParticle2.y()) > deltaYConfigs.cfgYAcceptance) continue; counts.at(0)++; - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size(); i++) { - if (std::abs(mcParticle1.y() - mcParticle2.y()) > cfgDeltaYAcceptanceBins->at(i)) + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size(); i++) { + if (std::abs(mcParticle1.y() - mcParticle2.y()) > deltaYConfigs.cfgDeltaYAcceptanceBins->at(i)) continue; counts.at(i + 1)++; } } - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size() + 1; i++) { + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1; i++) { if (counts.at(i) > 0) { mcPhiK0SHist.fill(HIST("h3PhiK0SMCGen"), i, genmultiplicity, mcParticle1.pt()); if (isAssocColl) @@ -2373,14 +2416,14 @@ struct Phik0shortanalysis { mcPionHist.fill(HIST("h3PiRapidityGenMC"), genmultiplicity, mcParticle1.pt(), mcParticle1.y()); - if (std::abs(mcParticle1.y()) > cfgYAcceptance) + if (std::abs(mcParticle1.y()) > deltaYConfigs.cfgYAcceptance) continue; mcPionHist.fill(HIST("h2PiMCGen"), genmultiplicity, mcParticle1.pt()); if (isAssocColl) mcPionHist.fill(HIST("h2PiMCGenAssocReco"), genmultiplicity, mcParticle1.pt()); - std::vector counts(cfgDeltaYAcceptanceBins->size() + 1, 0); + std::vector counts(deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1, 0); for (const auto& mcParticle2 : mcParticles) { if (mcParticle2.pdgCode() != o2::constants::physics::Pdg::kPhi) @@ -2401,18 +2444,18 @@ struct Phik0shortanalysis { } if (mcParticle2.pt() < minPhiPt || mcParticle2.pt() > maxPhiPt) continue; - if (std::abs(mcParticle2.y()) > cfgYAcceptance) + if (std::abs(mcParticle2.y()) > deltaYConfigs.cfgYAcceptance) continue; counts.at(0)++; - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size(); i++) { - if (std::abs(mcParticle1.y() - mcParticle2.y()) > cfgDeltaYAcceptanceBins->at(i)) + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size(); i++) { + if (std::abs(mcParticle1.y() - mcParticle2.y()) > deltaYConfigs.cfgDeltaYAcceptanceBins->at(i)) continue; counts.at(i + 1)++; } } - for (size_t i = 0; i < cfgDeltaYAcceptanceBins->size() + 1; i++) { + for (size_t i = 0; i < deltaYConfigs.cfgDeltaYAcceptanceBins->size() + 1; i++) { if (counts.at(i) > 0) { mcPhiPionHist.fill(HIST("h3PhiPiMCGen"), i, genmultiplicity, mcParticle1.pt()); if (isAssocColl) @@ -2438,11 +2481,17 @@ struct Phik0shortanalysis { if (!eventHasPhi(posThisColl, negThisColl)) return; - float multiplicity = collision.centFT0M(); - dataEventHist.fill(HIST("hMultiplicityPercent"), multiplicity); + dataEventHist.fill(HIST("hMultiplicityPercent"), collision.centFT0M()); + dataEventHist.fill(HIST("h2VertexZvsMult"), collision.posZ(), collision.centFT0M()); - for (const auto& track : filteredTracks) - dataEventHist.fill(HIST("h2EtaDistribution"), multiplicity, track.eta()); + for (const auto& track : filteredTracks) { + dataEventHist.fill(HIST("h4EtaDistribution"), collision.posZ(), collision.centFT0M(), track.eta(), kGlobalplusITSonly); + if (track.hasTPC()) { + dataEventHist.fill(HIST("h4EtaDistribution"), collision.posZ(), collision.centFT0M(), track.eta(), kGlobalonly); + } else { + dataEventHist.fill(HIST("h4EtaDistribution"), collision.posZ(), collision.centFT0M(), track.eta(), kITSonly); + } + } } PROCESS_SWITCH(Phik0shortanalysis, processdNdetaWPhiData, "Process function for dN/deta values in Data", false); @@ -2453,15 +2502,17 @@ struct Phik0shortanalysis { return; if (!collision.has_mcCollision()) return; - const auto& mcCollision = collision.mcCollision_as(); + const auto& mcCollision = collision.mcCollision_as(); auto mcParticlesThisColl = mcParticles.sliceBy(preslices.perMCColl, mcCollision.globalIndex()); + if (furtherCheckonMcCollision && (std::abs(mcCollision.posZ()) > cutZVertex || !pwglf::isINELgtNmc(mcParticlesThisColl, 0, pdgDB))) + return; if (filterOnMcPhi && !eventHasMCPhi(mcParticlesThisColl)) return; - float genmultiplicity = mcCollision.centFT0M(); - mcEventHist.fill(HIST("hRecMCGenMultiplicityPercent"), genmultiplicity); + mcEventHist.fill(HIST("hRecoMCMultiplicityPercent"), mcCollision.centFT0M()); + mcEventHist.fill(HIST("h2RecoMCVertexZvsMult"), collision.posZ(), mcCollision.centFT0M()); for (const auto& track : filteredMCTracks) { if (!track.has_mcParticle()) @@ -2471,14 +2522,25 @@ struct Phik0shortanalysis { if (!mcTrack.isPhysicalPrimary() || std::abs(mcTrack.eta()) > trackConfigs.etaMax) continue; - mcEventHist.fill(HIST("h2RecoMCEtaDistribution"), genmultiplicity, mcTrack.eta()); + mcEventHist.fill(HIST("h5RecoMCEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcTrack.eta(), kGlobalplusITSonly, kSpAll); + if (track.hasTPC()) { + mcEventHist.fill(HIST("h5RecoMCEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcTrack.eta(), kGlobalonly, kSpAll); + } else { + mcEventHist.fill(HIST("h5RecoMCEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcTrack.eta(), kITSonly, kSpAll); + } + + int pid = fromPDGToEnum(mcTrack.pdgCode()); + mcEventHist.fill(HIST("h5RecoMCEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcTrack.eta(), kGlobalplusITSonly, pid); } for (const auto& mcParticle : mcParticlesThisColl) { if (!isGenParticleCharged(mcParticle)) continue; - mcEventHist.fill(HIST("h2GenMCEtaDistributionReco"), genmultiplicity, mcParticle.eta()); + mcEventHist.fill(HIST("h4GenMCEtaDistributionReco"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), kSpAll); + + int pid = fromPDGToEnum(mcParticle.pdgCode()); + mcEventHist.fill(HIST("h4GenMCEtaDistributionReco"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), pid); } } @@ -2493,12 +2555,11 @@ struct Phik0shortanalysis { if (filterOnMcPhi && !eventHasMCPhi(mcParticles)) return; - float genmultiplicity = mcCollision.centFT0M(); - uint64_t numberAssocColl = 0; for (const auto& collision : collisions) { if (acceptEventQA(collision, false)) { - mcEventHist.fill(HIST("hGenMCRecoMultiplicityPercent"), genmultiplicity); + mcEventHist.fill(HIST("hGenMCRecoMultiplicityPercent"), mcCollision.centFT0M()); + mcEventHist.fill(HIST("h2GenMCRecoVertexZvsMult"), collision.posZ(), mcCollision.centFT0M()); auto filteredMCTracksThisColl = filteredMCTracks.sliceBy(preslices.perColl, collision.globalIndex()); for (const auto& track : filteredMCTracksThisColl) { @@ -2509,31 +2570,42 @@ struct Phik0shortanalysis { if (!mcTrack.isPhysicalPrimary() || std::abs(mcTrack.eta()) > trackConfigs.etaMax) continue; - mcEventHist.fill(HIST("h2RecoCheckMCEtaDistribution"), genmultiplicity, mcTrack.eta()); + mcEventHist.fill(HIST("h5RecoCheckMCEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcTrack.eta(), kGlobalplusITSonly, kSpAll); + if (track.hasTPC()) { + mcEventHist.fill(HIST("h5RecoCheckMCEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcTrack.eta(), kGlobalonly, kSpAll); + } else { + mcEventHist.fill(HIST("h5RecoCheckMCEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcTrack.eta(), kITSonly, kSpAll); + } + + int pid = fromPDGToEnum(mcTrack.pdgCode()); + mcEventHist.fill(HIST("h5RecoCheckMCEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcTrack.eta(), kGlobalplusITSonly, pid); } for (const auto& mcParticle : mcParticles) { if (!isGenParticleCharged(mcParticle)) continue; - mcEventHist.fill(HIST("h2GenMCEtaDistributionRecoCheck"), genmultiplicity, mcParticle.eta()); + mcEventHist.fill(HIST("h4GenMCEtaDistributionRecoCheck"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), kSpAll); + + int pid = fromPDGToEnum(mcParticle.pdgCode()); + mcEventHist.fill(HIST("h4GenMCEtaDistributionRecoCheck"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), pid); } numberAssocColl++; } } - mcEventHist.fill(HIST("hGenMCMultiplicityPercent"), genmultiplicity); + mcEventHist.fill(HIST("hGenMCMultiplicityPercent"), mcCollision.centFT0M()); if (numberAssocColl > 0) - mcEventHist.fill(HIST("hGenMCAssocRecoMultiplicityPercent"), genmultiplicity); + mcEventHist.fill(HIST("hGenMCAssocRecoMultiplicityPercent"), mcCollision.centFT0M()); for (const auto& mcParticle : mcParticles) { if (!isGenParticleCharged(mcParticle)) continue; - mcEventHist.fill(HIST("h2GenMCEtaDistribution"), genmultiplicity, mcParticle.eta()); + mcEventHist.fill(HIST("h2GenMCEtaDistribution"), mcCollision.centFT0M(), mcParticle.eta()); if (numberAssocColl > 0) - mcEventHist.fill(HIST("h2GenMCEtaDistributionAssocReco"), genmultiplicity, mcParticle.eta()); + mcEventHist.fill(HIST("h2GenMCEtaDistributionAssocReco"), mcCollision.centFT0M(), mcParticle.eta()); } } @@ -2579,7 +2651,7 @@ struct Phik0shortanalysis { ROOT::Math::PxPyPzMVector recPhi = recMother(track1, track2, massKa, massKa); if (recPhi.Pt() < minPhiPt || recPhi.Pt() > maxPhiPt) continue; - if (std::abs(recPhi.Rapidity()) > cfgYAcceptance) + if (std::abs(recPhi.Rapidity()) > deltaYConfigs.cfgYAcceptance) continue; if (!isCountedPhi) { @@ -2619,7 +2691,7 @@ struct Phik0shortanalysis { } } - if (std::abs(v0.yK0Short()) > cfgYAcceptance) + if (std::abs(v0.yK0Short()) > deltaYConfigs.cfgYAcceptance) continue; float efficiencyPhiK0S = 1.0f; @@ -2639,7 +2711,7 @@ struct Phik0shortanalysis { if (!selectionPion(track, false)) continue; - if (std::abs(track.rapidity(massPi)) > cfgYAcceptance) + if (std::abs(track.rapidity(massPi)) > deltaYConfigs.cfgYAcceptance) continue; float efficiencyPhiPion = 1.0f; @@ -2670,7 +2742,7 @@ struct Phik0shortanalysis { const auto& mcCollision = collision.mcCollision_as(); float genmultiplicity = mcCollision.centFT0M(); - mcEventHist.fill(HIST("hRecMCGenMultiplicityPercent"), genmultiplicity); + mcEventHist.fill(HIST("hRecoMCMultiplicityPercent"), genmultiplicity); // Defining positive and negative tracks for phi reconstruction auto posThisColl = posMCTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); @@ -2697,12 +2769,12 @@ struct Phik0shortanalysis { ROOT::Math::PxPyPzMVector recPhi = recMother(track1, track2, massKa, massKa); if (recPhi.Pt() < minPhiPt || recPhi.Pt() > maxPhiPt) continue; - if (std::abs(recPhi.Rapidity()) > cfgYAcceptance) + if (std::abs(recPhi.Rapidity()) > deltaYConfigs.cfgYAcceptance) continue; if (!isCountedPhi) { mcEventHist.fill(HIST("hRecMCEventSelection"), 7); // at least a Phi candidate in the event - mcEventHist.fill(HIST("hRecMCGenMultiplicityPercentWithPhi"), genmultiplicity); + mcEventHist.fill(HIST("hRecoMCMultiplicityPercentWithPhi"), genmultiplicity); isCountedPhi = true; } @@ -2733,7 +2805,7 @@ struct Phik0shortanalysis { if (v0Configs.cfgFurtherV0Selection && !furtherSelectionV0(v0, collision)) continue; - if (std::abs(v0.yK0Short()) > cfgYAcceptance) + if (std::abs(v0.yK0Short()) > deltaYConfigs.cfgYAcceptance) continue; float efficiencyPhiK0S = 1.0f; @@ -2759,7 +2831,7 @@ struct Phik0shortanalysis { if (!selectionPion(track, false)) continue; - if (std::abs(track.rapidity(massPi)) > cfgYAcceptance) + if (std::abs(track.rapidity(massPi)) > deltaYConfigs.cfgYAcceptance) continue; float efficiencyPhiPion = 1.0f; @@ -2840,7 +2912,7 @@ struct Phik0shortanalysis { if (!isMCMotherPhi) continue; - if (pTMother < minPhiPt || std::abs(yMother) > cfgYAcceptance) + if (pTMother < minPhiPt || std::abs(yMother) > deltaYConfigs.cfgYAcceptance) continue; mcPhiHist.fill(HIST("h3PhiMCRecoNewProc"), genmultiplicity, pTMother, yMother); @@ -2862,7 +2934,7 @@ struct Phik0shortanalysis { continue; if (v0Configs.cfgFurtherV0Selection && !furtherSelectionV0(v0, collision)) continue; - if (std::abs(v0mcparticle.y()) > cfgYAcceptance) + if (std::abs(v0mcparticle.y()) > deltaYConfigs.cfgYAcceptance) continue; mcK0SHist.fill(HIST("h3K0SMCRecoNewProc"), genmultiplicity, v0mcparticle.pt(), v0mcparticle.y()); @@ -2880,7 +2952,7 @@ struct Phik0shortanalysis { if (std::abs(mcTrack.pdgCode()) != PDG_t::kPiPlus) continue; - if (std::abs(mcTrack.y()) > cfgYAcceptance) + if (std::abs(mcTrack.y()) > deltaYConfigs.cfgYAcceptance) continue; // Primary pion selection @@ -2907,7 +2979,7 @@ struct Phik0shortanalysis { auto mcParticlesThisColl = mcParticles.sliceByCached(aod::mcparticle::mcCollisionId, mcCollision.globalIndex(), cache); for (const auto& mcParticle : mcParticlesThisColl) { - if (std::abs(mcParticle.y()) > cfgYAcceptance) + if (std::abs(mcParticle.y()) > deltaYConfigs.cfgYAcceptance) continue; // Phi selection @@ -2943,7 +3015,7 @@ struct Phik0shortanalysis { for (const auto& mcParticle : mcParticles) { // The inclusive number of particles is the signal loss denominator, // while the number of associated particles is the signal loss numerator - if (std::abs(mcParticle.y()) > cfgYAcceptance) + if (std::abs(mcParticle.y()) > deltaYConfigs.cfgYAcceptance) continue; // Phi selection @@ -2972,7 +3044,7 @@ struct Phik0shortanalysis { for (const auto& mcParticle : mcParticles) { // The inclusive number of particles is the signal loss denominator, // while the number of associated particles is the signal loss numerator - if (std::abs(mcParticle.y()) > cfgYAcceptance) + if (std::abs(mcParticle.y()) > deltaYConfigs.cfgYAcceptance) continue; // Phi selection @@ -3024,7 +3096,7 @@ struct Phik0shortanalysis { ROOT::Math::PxPyPzMVector recPhi = recMother(posTrack1, negTrack1, massKa, massKa); if (recPhi.Pt() < minPhiPt) continue; - if (std::abs(recPhi.Rapidity()) > cfgYAcceptance) + if (std::abs(recPhi.Rapidity()) > deltaYConfigs.cfgYAcceptance) continue; const auto& posDaughterTrack = v0.posTrack_as(); @@ -3034,7 +3106,7 @@ struct Phik0shortanalysis { continue; if (v0Configs.cfgFurtherV0Selection && !furtherSelectionV0(v0, collision2)) continue; - if (std::abs(v0.yK0Short()) > cfgYAcceptance) + if (std::abs(v0.yK0Short()) > deltaYConfigs.cfgYAcceptance) continue; float efficiencyPhiK0S = 1.0f; @@ -3075,12 +3147,12 @@ struct Phik0shortanalysis { ROOT::Math::PxPyPzMVector recPhi = recMother(posTrack1, negTrack1, massKa, massKa); if (recPhi.Pt() < minPhiPt) continue; - if (std::abs(recPhi.Rapidity()) > cfgYAcceptance) + if (std::abs(recPhi.Rapidity()) > deltaYConfigs.cfgYAcceptance) continue; if (!selectionPion(track, false)) continue; - if (std::abs(track.rapidity(massPi)) > cfgYAcceptance) + if (std::abs(track.rapidity(massPi)) > deltaYConfigs.cfgYAcceptance) continue; float efficiencyPhiPion = 1.0f; From e81126f98edb0e234d43d224e9dc2bee37aed574 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Sat, 26 Jul 2025 20:30:05 +0200 Subject: [PATCH 084/345] [Common] Improve CCDB access pattern (#12263) --- Common/Tasks/centralityStudy.cxx | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Common/Tasks/centralityStudy.cxx b/Common/Tasks/centralityStudy.cxx index a24b4410c12..7a0d4c35ab1 100644 --- a/Common/Tasks/centralityStudy.cxx +++ b/Common/Tasks/centralityStudy.cxx @@ -47,6 +47,7 @@ struct centralityStudy { Service ccdb; ctpRateFetcher mRateFetcher; int mRunNumber; + uint64_t startOfRunTimestamp; // Configurables Configurable do2DPlots{"do2DPlots", true, "0 - no, 1 - yes"}; @@ -256,8 +257,8 @@ struct centralityStudy { if (doTimeStudies) { ccdb->setURL(ccdbURL); - ccdb->setCaching(true); - ccdb->setLocalObjectValidityChecking(); + // ccdb->setCaching(true); + // ccdb->setLocalObjectValidityChecking(); ccdb->setFatalWhenNull(false); if (doTimeStudyFV0AOuterVsFT0A3d) { histos.add((histPath + "h3dFV0AVsTime").c_str(), "", {kTH3F, {{axisDeltaTimestamp, axisMultCoarseFV0A, axisMultCoarseFV0A}}}); @@ -273,6 +274,13 @@ struct centralityStudy { } mRunNumber = collision.multRunNumber(); + + LOGF(info, "Setting up for run: %i", mRunNumber); + + // only get object when switching runs + o2::parameters::GRPECSObject* grpo = ccdb->getForRun(pathGRPECSObject, mRunNumber); + startOfRunTimestamp = grpo->getTimeStart(); + histPath = std::format("Run_{}/", mRunNumber); if (doprocessCollisions || doprocessCollisionsWithCentrality) { @@ -351,6 +359,7 @@ struct centralityStudy { // process this collisions { initRun(collision); + histos.fill(HIST("hCollisionSelection"), 0); // all collisions getHist(TH1, histPath + "hCollisionSelection")->Fill(0); @@ -567,11 +576,9 @@ struct centralityStudy { } if (doTimeStudies && collision.has_multBC()) { - initRun(collision); auto multbc = collision.template multBC_as(); uint64_t bcTimestamp = multbc.timestamp(); - o2::parameters::GRPECSObject* grpo = ccdb->getForTimeStamp(pathGRPECSObject, bcTimestamp); - uint64_t startOfRunTimestamp = grpo->getTimeStart(); + float hoursAfterStartOfRun = static_cast(bcTimestamp - startOfRunTimestamp) / 3600000.0; getHist(TH2, histPath + "hFT0AVsTime")->Fill(hoursAfterStartOfRun, collision.multFT0A()); From f2aad8bc2012a810bd61787f9ce51a23288f1ce7 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Sun, 27 Jul 2025 01:32:30 +0200 Subject: [PATCH 085/345] [PWGEM/Dilepton] update on eventQC.cxx (#12264) Co-authored-by: ALICE Action Bot --- .../treeCreatorElectronMLDDA.cxx | 44 ++- PWGEM/Dilepton/Tasks/CMakeLists.txt | 2 +- PWGEM/Dilepton/Tasks/eventQC.cxx | 277 ++++++------------ PWGEM/PhotonMeson/Utils/EventHistograms.h | 6 +- 4 files changed, 110 insertions(+), 219 deletions(-) diff --git a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx index e7edb401ddf..31207b2acbd 100644 --- a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx +++ b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx @@ -76,7 +76,7 @@ struct TreeCreatorElectronMLDDA { {"V0/hXY_Gamma", "photon conversion point in XY;X (cm);Y (cm)", {HistType::kTH2F, {{400, -100, +100}, {400, -100, +100}}}}, {"V0/hMassGamma_Rxy", "V0 mass gamma", {HistType::kTH2F, {{200, 0, 100}, {100, 0, 0.1}}}}, {"V0/hCosPA", "V0 cosine of pointing angle", {HistType::kTH1F, {{100, 0.99, 1.f}}}}, - {"V0/hPCA", "V0 distance between 2 legs", {HistType::kTH1F, {{200, 0.f, 2.f}}}}, + {"V0/hPCA", "V0 distance between 2 legs", {HistType::kTH1F, {{50, 0.f, 0.5f}}}}, {"V0/hMassGamma", "V0 mass gamma", {HistType::kTH1F, {{100, 0, 0.1}}}}, {"V0/hMassK0Short", "V0 mass K0S", {HistType::kTH1F, {{200, 0.4, 0.6}}}}, {"V0/hMassLambda", "V0 mass Lambda", {HistType::kTH1F, {{100, 1.08, 1.18}}}}, @@ -95,10 +95,10 @@ struct TreeCreatorElectronMLDDA { {"Cascade/hRxy_Omega", "R_{xy} of cascade vs. mass;m_{#LambdaK};R_{xy} (cm)", {HistType::kTH2F, {{200, 1.6, 1.8}, {200, 0, 20.f}}}}, {"Cascade/hCTau_Xi", "c#tau vs. mass;m_{#Lambda#pi};c#tau (cm)", {HistType::kTH2F, {{200, 1.2, 1.4}, {200, 0, 20.f}}}}, {"Cascade/hCTau_Omega", "c#tau vs. mass;m_{#LambdaK};c#tau (cm)", {HistType::kTH2F, {{200, 1.6, 1.8}, {200, 0, 20.f}}}}, - {"Cascade/hV0CosPA", "V0 cosine of pointing angle", {HistType::kTH1F, {{50, 0.95, 1.f}}}}, - {"Cascade/hV0PCA", "V0 distance between 2 legs", {HistType::kTH1F, {{200, 0.f, 2.f}}}}, + {"Cascade/hV0CosPA", "V0 cosine of pointing angle", {HistType::kTH1F, {{100, 0.99, 1.f}}}}, + {"Cascade/hV0PCA", "V0 distance between 2 legs", {HistType::kTH1F, {{50, 0.f, 0.5}}}}, {"Cascade/hCosPA", "cascade cosine of pointing angle", {HistType::kTH1F, {{100, 0.99, 1.f}}}}, - {"Cascade/hPCA", "cascade distance between 2 legs", {HistType::kTH1F, {{200, 0.f, 2.f}}}}, + {"Cascade/hPCA", "cascade distance between 2 legs", {HistType::kTH1F, {{50, 0.f, 0.5}}}}, {"Cascade/hMassLambda", "V0 mass Lambda in cascade", {HistType::kTH1F, {{100, 1.08, 1.18}}}}, {"Cascade/hMassXi", "cascade mass #Xi", {HistType::kTH1F, {{200, 1.2, 1.4}}}}, {"Cascade/hMassOmega", "cascade mass #Omega", {HistType::kTH1F, {{200, 1.6, 1.8}}}}, @@ -119,10 +119,10 @@ struct TreeCreatorElectronMLDDA { Configurable d_bz_input{"d_bz_input", -999, "bz field, -999 is automatic"}; Configurable useMatCorrType{"useMatCorrType", 2, "0: none, 1: TGeo, 2: LUT"}; - Configurable downscaling_electron{"downscaling_electron", 0.005, "down scaling factor to store electron"}; - Configurable downscaling_pion{"downscaling_pion", 0.001, "down scaling factor to store pion"}; + Configurable downscaling_electron{"downscaling_electron", 0.01, "down scaling factor to store electron"}; + Configurable downscaling_pion{"downscaling_pion", 0.01, "down scaling factor to store pion"}; Configurable downscaling_kaon{"downscaling_kaon", 1.1, "down scaling factor to store kaon"}; - Configurable downscaling_proton{"downscaling_proton", 0.005, "down scaling factor to store proton"}; + Configurable downscaling_proton{"downscaling_proton", 0.01, "down scaling factor to store proton"}; Configurable max_p_for_downscaling_electron{"max_p_for_downscaling_electron", 2.0, "max p to apply down scaling factor to store electron"}; Configurable max_p_for_downscaling_pion{"max_p_for_downscaling_pion", 2.0, "max p to apply down scaling factor to store pion"}; @@ -189,7 +189,7 @@ struct TreeCreatorElectronMLDDA { Configurable cfg_max_mass_lambda_veto{"cfg_max_mass_lambda_veto", 1.125, "max mass for Lambda veto"}; Configurable cfg_min_cospa{"cfg_min_cospa", 0.9998, "min cospa for v0"}; - Configurable cfg_max_dcadau{"cfg_max_dcadau", 0.2, "max distance between 2 legs for v0"}; + Configurable cfg_max_dcadau{"cfg_max_dcadau", 0.1, "max distance between 2 legs for v0"}; Configurable cfg_min_cr2findable_ratio_tpc{"cfg_min_cr2findable_ratio_tpc", 0.8, "min. TPC Ncr/Nf ratio"}; Configurable cfg_max_frac_shared_clusters_tpc{"cfg_max_frac_shared_clusters_tpc", 0.7, "max fraction of shared clusters in TPC"}; Configurable cfg_min_ncrossedrows_tpc{"cfg_min_ncrossedrows_tpc", 70, "min ncrossed rows"}; @@ -244,24 +244,16 @@ struct TreeCreatorElectronMLDDA { Configurable cfg_max_mass_Xi_veto{"cfg_max_mass_Xi_veto", 1.33, "max mass for Xi veto"}; Configurable cfg_min_mass_Omega{"cfg_min_mass_Omega", 1.669, "min mass for Omega"}; Configurable cfg_max_mass_Omega{"cfg_max_mass_Omega", 1.675, "max mass for Omega"}; - Configurable cfg_min_cospa_v0{"cfg_min_cospa_v0", 0.97, "minimum V0 CosPA in cascade"}; - Configurable cfg_max_dcadau_v0{"cfg_max_dcadau_v0", 0.2, "max distance between V0 Daughters in cascade"}; + Configurable cfg_min_cospa_v0{"cfg_min_cospa_v0", 0.995, "minimum V0 CosPA in cascade"}; + Configurable cfg_max_dcadau_v0{"cfg_max_dcadau_v0", 0.1, "max distance between V0 Daughters in cascade"}; Configurable cfg_min_cospa{"cfg_min_cospa", 0.9998, "minimum cascade CosPA"}; - Configurable cfg_max_dcadau{"cfg_max_dcadau", 0.2, "max distance between bachelor and V0"}; + Configurable cfg_max_dcadau{"cfg_max_dcadau", 0.1, "max distance between bachelor and V0"}; Configurable cfg_min_rxy_v0{"cfg_min_rxy_v0", 1.2, "minimum V0 rxy in cascade"}; Configurable cfg_min_rxy{"cfg_min_rxy", 0.5, "minimum V0 rxy in cascade"}; Configurable cfg_min_dcaxy_v0leg{"cfg_min_dcaxy_v0leg", 0.1, "min dca XY for v0 legs in cm"}; Configurable cfg_min_dcaxy_bachelor{"cfg_min_dcaxy_bachelor", 0.1, "min dca XY for bachelor in cm"}; } cascadecuts; - struct : ConfigurableGroup { - std::string prefix = "dalitzcut_group"; - Configurable cfg_min_mass_ee{"cfg_min_mass_ee", 0.000, "min mass for ee from pi0 dalitz decay in GeV/c2"}; - Configurable cfg_max_mass_ee{"cfg_max_mass_ee", 0.005, "max mass for ee from pi0 dalitz decay in GeV/c2"}; - Configurable cfg_min_phiv_ee{"cfg_min_phiv_ee", 0.0, "min phiv for ee from pi0 dalitz decay in rad."}; - Configurable cfg_max_phiv_ee{"cfg_max_phiv_ee", M_PI / 2, "max phiv for ee from pi0 dalitz decay in rad."}; - } dalitzcuts; - // for RCT Configurable cfgRequireGoodRCT{"cfgRequireGoodRCT", false, "require good detector flag in run condtion table"}; Configurable cfgRCTLabel{"cfgRCTLabel", "CBT_hadronPID", "select 1 [CBT, CBT_hadronPID, CBT_muon_glo] see O2Physics/Common/CCDB/RCTSelectionFlags.h"}; @@ -777,13 +769,13 @@ struct TreeCreatorElectronMLDDA { registry.fill(HIST("V0/hTOFbeta_P_Pi"), neg.tpcInnerParam(), neg.beta()); fillTrackTable(collision, neg, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kPion)); } - if (isPion(pos) && isPionTight(neg)) { - registry.fill(HIST("V0/hMassK0Short"), v0.mK0Short()); - if (v0cuts.cfg_min_mass_k0s < v0.mK0Short() && v0.mK0Short() < v0cuts.cfg_max_mass_k0s) { - registry.fill(HIST("V0/hTPCdEdx_P_Pi"), pos.tpcInnerParam(), pos.tpcSignal()); - registry.fill(HIST("V0/hTOFbeta_P_Pi"), pos.tpcInnerParam(), pos.beta()); - fillTrackTable(collision, pos, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kPion)); - } + } + if (isPion(pos) && isPionTight(neg)) { + registry.fill(HIST("V0/hMassK0Short"), v0.mK0Short()); + if (v0cuts.cfg_min_mass_k0s < v0.mK0Short() && v0.mK0Short() < v0cuts.cfg_max_mass_k0s) { + registry.fill(HIST("V0/hTPCdEdx_P_Pi"), pos.tpcInnerParam(), pos.tpcSignal()); + registry.fill(HIST("V0/hTOFbeta_P_Pi"), pos.tpcInnerParam(), pos.beta()); + fillTrackTable(collision, pos, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kPion)); } } } diff --git a/PWGEM/Dilepton/Tasks/CMakeLists.txt b/PWGEM/Dilepton/Tasks/CMakeLists.txt index fd976b5e79f..94ccb5f2ea4 100644 --- a/PWGEM/Dilepton/Tasks/CMakeLists.txt +++ b/PWGEM/Dilepton/Tasks/CMakeLists.txt @@ -53,7 +53,7 @@ o2physics_add_dpl_workflow(bc-counter o2physics_add_dpl_workflow(event-qc SOURCES eventQC.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(single-electron-qc diff --git a/PWGEM/Dilepton/Tasks/eventQC.cxx b/PWGEM/Dilepton/Tasks/eventQC.cxx index 8297a5f04e0..2fc38618c2a 100644 --- a/PWGEM/Dilepton/Tasks/eventQC.cxx +++ b/PWGEM/Dilepton/Tasks/eventQC.cxx @@ -15,7 +15,7 @@ // Please write to: daiki.sekihata@cern.ch #include "PWGEM/PhotonMeson/DataModel/gammaTables.h" -#include "PWGLF/DataModel/LFStrangenessTables.h" +// #include "PWGLF/DataModel/LFStrangenessTables.h" #include "Common/Core/RecoDecay.h" #include "Common/DataModel/Centrality.h" @@ -25,6 +25,7 @@ #include "Common/DataModel/PIDResponseITS.h" #include "Common/DataModel/Qvectors.h" #include "Common/DataModel/TrackSelectionTables.h" +#include "EventFiltering/Zorro.h" #include "CCDB/BasicCCDBManager.h" #include "Framework/ASoAHelpers.h" @@ -47,25 +48,25 @@ using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::soa; -using MyBCs = soa::Join; -using MyQvectors = soa::Join; +struct eventQC { + using MyBCs = soa::Join; + using MyQvectors = soa::Join; -using MyCollisions = soa::Join; -using MyCollisions_Qvec = soa::Join; + using MyCollisions = soa::Join; + using MyCollisions_Qvec = soa::Join; -using MyTracks = soa::Join; -using MyTrack = MyTracks::iterator; + using MyTracks = soa::Join; + using MyTrack = MyTracks::iterator; -struct eventQC { // Configurables Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable cfg_swt_name{"cfg_swt_name", "fHighTrackMult", "desired software trigger name"}; Configurable cfgFillEvent{"cfgFillEvent", false, "fill event histograms"}; Configurable cfgFillTrack{"cfgFillTrack", false, "fill track histograms"}; Configurable cfgFillPID{"cfgFillPID", false, "fill PID histograms"}; - Configurable cfgFillPIDITS{"cfgFillPIDITS", false, "fill PID ITS histograms"}; Configurable> cfgnMods{"cfgnMods", {2, 3}, "Modulation of interest. Please keep increasing order"}; Configurable cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2"}; Configurable cfgQvecEstimator{"cfgQvecEstimator", 0, "FT0M:0, FT0A:1, FT0C:2, BTot:3, BPos:4, BNeg:5"}; @@ -164,6 +165,12 @@ struct eventQC { Configurable cfgTreatLimitedAcceptanceAsBad{"cfgTreatLimitedAcceptanceAsBad", false, "reject all events where the detectors relevant for the specified Runlist are flagged as LimitedAcceptance"}; o2::aod::rctsel::RCTFlagsChecker rctChecker; + Zorro zorro; + std::vector mTOIidx; + uint64_t mNinspectedTVX{0}; + std::vector swt_names; + + int mRunNumber; Service ccdb; HistogramRegistry fRegistry{"output", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; @@ -171,6 +178,7 @@ struct eventQC { void init(InitContext&) { + mRunNumber = 0; ccdb->setURL(ccdburl); ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); @@ -178,13 +186,28 @@ struct eventQC { rctChecker.init(cfgRCTLabel.value, cfgCheckZDC.value, cfgTreatLimitedAcceptanceAsBad.value); addhistograms(); - if (doprocessEventQC_V0_PID) { - addV0histograms(); - } } ~eventQC() {} + template + void initCCDB(TBC const& bc) + { + if (mRunNumber == bc.runNumber()) { + return; + } + + mTOIidx = zorro.initCCDB(ccdb.service, bc.runNumber(), bc.timestamp(), cfg_swt_name.value); + for (auto& idx : mTOIidx) { + LOGF(info, "Trigger of Interest : index = %d", idx); + } + mNinspectedTVX = zorro.getInspectedTVX()->GetBinContent(1); + LOGF(info, "total inspected TVX events = %d in run number %d", mNinspectedTVX, bc.runNumber()); + fRegistry.fill(HIST("hNInspectedTVX"), bc.runNumber(), mNinspectedTVX); + + mRunNumber = bc.runNumber(); + } + void addhistograms() { // event info @@ -212,14 +235,37 @@ struct eventQC { hCollisionCounter->GetXaxis()->SetBinLabel(19, "GoodITSLayersAll"); hCollisionCounter->GetXaxis()->SetBinLabel(nbin_ev, "accepted"); + fRegistry.add("hNInspectedTVX", "N inspected TVX;run number;N_{TVX}", kTProfile, {{80000, 520000.5, 600000.5}}, true); + + const AxisSpec axis_cent_ft0m{{0, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110}, + "centrality FT0M (%)"}; + + const AxisSpec axis_cent_ft0a{{0, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110}, + "centrality FT0A (%)"}; + + const AxisSpec axis_cent_ft0c{{0, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110}, + "centrality FT0C (%)"}; + if (cfgFillEvent) { fRegistry.add("Event/before/hZvtx", "vertex z; Z_{vtx} (cm)", kTH1F, {{100, -50, +50}}, false); fRegistry.add("Event/before/hMultNTracksPV", "hMultNTracksPV; N_{track} to PV", kTH1F, {{6001, -0.5, 6000.5}}, false); fRegistry.add("Event/before/hMultNTracksPVeta1", "hMultNTracksPVeta1; N_{track} to PV", kTH1F, {{6001, -0.5, 6000.5}}, false); fRegistry.add("Event/before/hMultFT0", "hMultFT0;mult. FT0A;mult. FT0C", kTH2F, {{200, 0, 200000}, {60, 0, 60000}}, false); - fRegistry.add("Event/before/hCentFT0A", "hCentFT0A;centrality FT0A (%)", kTH1F, {{110, 0, 110}}, false); - fRegistry.add("Event/before/hCentFT0C", "hCentFT0C;centrality FT0C (%)", kTH1F, {{110, 0, 110}}, false); - fRegistry.add("Event/before/hCentFT0M", "hCentFT0M;centrality FT0M (%)", kTH1F, {{110, 0, 110}}, false); + fRegistry.add("Event/before/hCentFT0A", "hCentFT0A;centrality FT0A (%)", kTH1F, {{axis_cent_ft0a}}, false); + fRegistry.add("Event/before/hCentFT0C", "hCentFT0C;centrality FT0C (%)", kTH1F, {{axis_cent_ft0c}}, false); + fRegistry.add("Event/before/hCentFT0M", "hCentFT0M;centrality FT0M (%)", kTH1F, {{axis_cent_ft0m}}, false); fRegistry.add("Event/before/hCentFT0CvsMultNTracksPV", "hCentFT0CvsMultNTracksPV;centrality FT0C (%);N_{track} to PV", kTH2F, {{100, 0, 100}, {600, 0, 6000}}, false); fRegistry.add("Event/before/hMultFT0CvsMultNTracksPV", "hMultFT0CvsMultNTracksPV;mult. FT0C;N_{track} to PV", kTH2F, {{60, 0, 60000}, {600, 0, 6000}}, false); fRegistry.add("Event/before/hMultFT0CvsOccupancy", "hMultFT0CvsOccupancy;mult. FT0C;N_{track} in time range", kTH2F, {{60, 0, 60000}, {200, 0, 20000}}, false); @@ -336,9 +382,6 @@ struct eventQC { fRegistry.add("Track/hTPCNsigmaPi", "TPC n sigma pi;p_{in} (GeV/c);n #sigma_{#pi}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5.f, +5.f}}, false); fRegistry.add("Track/hTPCNsigmaKa", "TPC n sigma ka;p_{in} (GeV/c);n #sigma_{K}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5.f, +5.f}}, false); fRegistry.add("Track/hTPCNsigmaPr", "TPC n sigma pr;p_{in} (GeV/c);n #sigma_{p}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5.f, +5.f}}, false); - if (doprocessEventQC_V0_PID) { - fRegistry.add("Track/hsEID", "TPC n sigma el;p_{in} (GeV/c);#eta;n #sigma_{e}^{TPC};", kTHnSparseF, {{200, 0, 10}, {20, -1, +1}, {100, -5, +5}}, false); - } fRegistry.add("Track/hTOFbeta", "TOF #beta;p_{pv} (GeV/c);#beta", kTH2F, {{1000, 0, 10}, {240, 0, 1.2}}, false); fRegistry.add("Track/hTOFNsigmaEl", "TOF n sigma el;p_{pv} (GeV/c);n #sigma_{e}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); fRegistry.add("Track/hTOFNsigmaMu", "TOF n sigma mu;p_{pv} (GeV/c);n #sigma_{#mu}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); @@ -346,38 +389,10 @@ struct eventQC { fRegistry.add("Track/hTOFNsigmaKa", "TOF n sigma ka;p_{pv} (GeV/c);n #sigma_{K}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); fRegistry.add("Track/hTOFNsigmaPr", "TOF n sigma pr;p_{pv} (GeV/c);n #sigma_{p}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - if (cfgFillPIDITS) { - fRegistry.add("Track/hMeanClusterSizeITS", "mean cluster size ITS;p_{pv} (GeV/c); on ITS #times cos(#lambda);", kTH2F, {{1000, 0.f, 10.f}, {150, 0, 15}}, false); - fRegistry.add("Track/hITSNsigmaEl", "ITS n sigma el;p_{pv} (GeV/c);n #sigma_{e}^{ITS}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/hITSNsigmaMu", "ITS n sigma mu;p_{pv} (GeV/c);n #sigma_{#mu}^{ITS}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/hITSNsigmaPi", "ITS n sigma pi;p_{pv} (GeV/c);n #sigma_{#pi}^{ITS}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/hITSNsigmaKa", "ITS n sigma ka;p_{pv} (GeV/c);n #sigma_{K}^{ITS}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/hITSNsigmaPr", "ITS n sigma pr;p_{pv} (GeV/c);n #sigma_{p}^{ITS}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - } + fRegistry.add("Track/hMeanClusterSizeITS", "mean cluster size ITS;p_{pv} (GeV/c); on ITS #times cos(#lambda);", kTH2F, {{1000, 0.f, 10.f}, {150, 0, 15}}, false); } } - void addV0histograms() - { - fRegistry.add("V0/hAP", "AP plot", kTH2F, {{200, -1, +1}, {250, 0, 0.25}}, false); - fRegistry.add("V0/hPCA", "distance between 2 legs", kTH1F, {{200, 0, 2}}, false); - fRegistry.add("V0/hCosPA", "cos pointing angle", kTH1F, {{100, 0.99, 1}}, false); - fRegistry.add("V0/hRadius", "radius", kTH1F, {{200, 0, 20}}, false); - fRegistry.add("V0/K0S/pion/hTPCdEdx", "TPC dE/dx;p_{in} (GeV/c);TPC dE/dx (a.u.)", kTH2F, {{1000, 0, 10}, {200, 0, 200}}, false); - fRegistry.add("V0/K0S/pion/hsEID", "TPC n sigma el;p_{in} (GeV/c);#eta;n #sigma_{e}^{TPC};", kTHnSparseF, {{200, 0, 10}, {20, -1, +1}, {100, -5, +5}}, false); - - fRegistry.add("V0/K0S/hMass", "mass vs. p_{T} of K^{0}_{S}", kTH2F, {{200, 0.4, 0.6}, {100, 0, 10}}, false); - fRegistry.add("V0/Lambda/hMass", "mass vs. p_{T} of #Lambda", kTH2F, {{100, 1.08, 1.18}, {100, 0, 10}}, false); - fRegistry.add("V0/AntiLambda/hMass", "mass vs. p_{T} of #bar{#Lambda}", kTH2F, {{100, 1.08, 1.18}, {100, 0, 10}}, false); - fRegistry.add("V0/GammaTMP/hMass", "mass vs. p_{T} of #gamma", kTH2F, {{100, 0.0, 0.1}, {100, 0, 10}}, false); - - fRegistry.add("V0/Photon/hMass", "mass vs. p_{T}", kTH2F, {{100, 0, 0.1}, {100, 0, 10}}, false); - fRegistry.add("V0/Photon/hChi2", "radius vs. KF chi2", kTH2F, {{100, 0, 100}, {100, 0, 100}}, false); - fRegistry.add("V0/Photon/hXY", "photon conversion point;X (cm);Y(cm)", kTH2F, {{400, -100, +100}, {400, -100, 100}}, false); - fRegistry.add("V0/Photon/electron/hTPCdEdx", "TPC dE/dx;p_{in} (GeV/c);TPC dE/dx (a.u.)", kTH2F, {{1000, 0, 10}, {200, 0, 200}}, false); - fRegistry.add("V0/Photon/electron/hsEID", "TPC n sigma el;p_{in} (GeV/c);#eta;n #sigma_{e}^{TPC};", kTHnSparseF, {{200, 0, 10}, {20, -1, +1}, {100, -5, +5}}, false); - } - template void fillTrackInfo(TTrack const& track) { @@ -416,21 +431,11 @@ struct eventQC { fRegistry.fill(HIST("Track/hTOFNsigmaKa"), track.p(), track.tofNSigmaKa()); fRegistry.fill(HIST("Track/hTOFNsigmaPr"), track.p(), track.tofNSigmaPr()); - if (cfgFillPIDITS) { - int nsize = 0; - for (int il = 0; il < 7; il++) { - nsize += track.itsClsSizeInLayer(il); - } - fRegistry.fill(HIST("Track/hMeanClusterSizeITS"), track.p(), static_cast(nsize) / static_cast(track.itsNCls()) * std::cos(std::atan(track.tgl()))); - fRegistry.fill(HIST("Track/hITSNsigmaEl"), track.p(), track.itsNSigmaEl()); - fRegistry.fill(HIST("Track/hITSNsigmaMu"), track.p(), track.itsNSigmaMu()); - fRegistry.fill(HIST("Track/hITSNsigmaPi"), track.p(), track.itsNSigmaPi()); - fRegistry.fill(HIST("Track/hITSNsigmaKa"), track.p(), track.itsNSigmaKa()); - fRegistry.fill(HIST("Track/hITSNsigmaPr"), track.p(), track.itsNSigmaPr()); + int nsize = 0; + for (int il = 0; il < 7; il++) { + nsize += track.itsClsSizeInLayer(il); } - } - if (doprocessEventQC_V0_PID) { - fRegistry.fill(HIST("Track/hsEID"), track.tpcInnerParam(), track.eta(), track.tpcNSigmaEl()); + fRegistry.fill(HIST("Track/hMeanClusterSizeITS"), track.p(), static_cast(nsize) / static_cast(track.itsNCls()) * std::cos(std::atan(track.tgl()))); } } @@ -883,21 +888,28 @@ struct eventQC { SliceCache cache; Preslice perCol = o2::aod::track::collisionId; - Preslice perCol_pcm = o2::aod::v0photonkf::collisionId; - Preslice perCol_v0 = o2::aod::v0data::collisionId; - Preslice perCol_casc = o2::aod::cascdata::collisionId; - template - void runQC(TCollisions const& collisions, TTracks const& tracks, TV0Photons const& v0photons, TV0Legs const&, TV0StrHadrons const& v0strhadrons) + template + void runQC(TBCs const&, TCollisions const& collisions, TTracks const& tracks) { for (auto& collision : collisions) { + if constexpr (isTriggerAnalysis) { + const auto& bc = collision.template bc_as(); // don't use foundBC for CEFP. + initCCDB(bc); + if (!zorro.isSelected(bc.globalBC())) { // triggered event + continue; + } + } + const float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { continue; } + if (cfgRequireGoodRCT && !rctChecker.checkTable(collision)) { continue; } + if (cfgFillEvent) { fillEventInfo<0>(collision); } @@ -949,139 +961,26 @@ struct eventQC { fRegistry.fill(HIST("Event/after/hCentFT0CvsMultNGlobalTracksPV"), collision.centFT0C(), nGlobalTracksPV); } - // for V0 PID - if constexpr (doV0s) { - auto v0hadrons_per_coll = v0strhadrons.sliceBy(perCol_v0, collision.globalIndex()); - for (auto& v0hadron : v0hadrons_per_coll) { - if (v0hadron.dcaV0daughters() > v0cuts.cfg_max_pca_v0hadron || v0hadron.v0cosPA() < v0cuts.cfg_min_cospa_v0hadron || v0hadron.v0radius() < v0cuts.cfg_min_radius_v0hadron) { - continue; - } - - fRegistry.fill(HIST("V0/hAP"), v0hadron.alpha(), v0hadron.qtarm()); - fRegistry.fill(HIST("V0/hPCA"), v0hadron.dcaV0daughters()); - fRegistry.fill(HIST("V0/hCosPA"), v0hadron.v0cosPA()); - fRegistry.fill(HIST("V0/hRadius"), v0hadron.v0radius()); - - fRegistry.fill(HIST("V0/K0S/hMass"), v0hadron.mK0Short(), v0hadron.pt()); - if (v0cuts.cfg_min_mass_k0s < v0hadron.mK0Short() && v0hadron.mK0Short() < v0cuts.cfg_max_mass_k0s) { // K0S - fRegistry.fill(HIST("V0/GammaTMP/hMass"), v0hadron.mGamma(), v0hadron.pt()); - fRegistry.fill(HIST("V0/Lambda/hMass"), v0hadron.mLambda(), v0hadron.pt()); - fRegistry.fill(HIST("V0/AntiLambda/hMass"), v0hadron.mAntiLambda(), v0hadron.pt()); - if (v0cuts.cfg_min_mass_lambda < v0hadron.mLambda() && v0hadron.mLambda() < v0cuts.cfg_max_mass_lambda) { // Lambda rejection - continue; - } - if (v0cuts.cfg_min_mass_lambda < v0hadron.mAntiLambda() && v0hadron.mAntiLambda() < v0cuts.cfg_max_mass_lambda) { // AntiLambda rejection - continue; - } - if (v0cuts.cfg_min_mass_photon < v0hadron.mGamma() && v0hadron.mGamma() < v0cuts.cfg_max_mass_photon) { // photon conversion rejection - continue; - } - - auto pos = tracks.rawIteratorAt(v0hadron.posTrackId()); - auto neg = tracks.rawIteratorAt(v0hadron.negTrackId()); - if (!isSelectedV0Leg(pos) || !isSelectedV0Leg(neg)) { - continue; - } - if (!pos.hasITS() || !neg.hasITS()) { - continue; - } - if (std::fabs(pos.dcaXY()) < v0cuts.cfg_min_dcaxy_v0leg || std::fabs(neg.dcaXY()) < v0cuts.cfg_min_dcaxy_v0leg) { - continue; - } - - // if (pos.tpcNSigmaPi() < v0cuts.cfg_min_TPCNsigmaPi || v0cuts.cfg_max_TPCNsigmaPi < pos.tpcNSigmaPi()) { - // continue; - // } - // if (neg.tpcNSigmaPi() < v0cuts.cfg_min_TPCNsigmaPi || v0cuts.cfg_max_TPCNsigmaPi < neg.tpcNSigmaPi()) { - // continue; - // } - - bool isTPCOK_pos = pos.hasTPC() && v0cuts.cfg_min_TPCNsigmaPi < pos.tpcNSigmaPi() && pos.tpcNSigmaPi() < v0cuts.cfg_max_TPCNsigmaPi; - bool isTPCOK_neg = neg.hasTPC() && v0cuts.cfg_min_TPCNsigmaPi < neg.tpcNSigmaPi() && neg.tpcNSigmaPi() < v0cuts.cfg_max_TPCNsigmaPi; - bool isTOFOK_pos = pos.hasTOF() && pos.tofChi2() < v0cuts.cfg_max_chi2tof && v0cuts.cfg_min_TOFNsigmaPi < pos.tofNSigmaPi() && pos.tofNSigmaPi() < v0cuts.cfg_max_TOFNsigmaPi; - bool isTOFOK_neg = neg.hasTOF() && neg.tofChi2() < v0cuts.cfg_max_chi2tof && v0cuts.cfg_min_TOFNsigmaPi < neg.tofNSigmaPi() && neg.tofNSigmaPi() < v0cuts.cfg_max_TOFNsigmaPi; - - if (isTPCOK_neg && isTOFOK_neg) { // K0S is tagged by neg and pos is probe. - fRegistry.fill(HIST("V0/K0S/pion/hTPCdEdx"), pos.tpcInnerParam(), pos.tpcSignal()); - fRegistry.fill(HIST("V0/K0S/pion/hsEID"), pos.tpcInnerParam(), pos.eta(), pos.tpcNSigmaEl()); - } - if (isTPCOK_pos && isTOFOK_pos) { // K0S is tagged by pos and neg is probe. - fRegistry.fill(HIST("V0/K0S/pion/hTPCdEdx"), neg.tpcInnerParam(), neg.tpcSignal()); - fRegistry.fill(HIST("V0/K0S/pion/hsEID"), neg.tpcInnerParam(), neg.eta(), neg.tpcNSigmaEl()); - } - } // end of K0S - } // end of v0hadron loop - - auto v0photons_per_coll = v0photons.sliceBy(perCol_pcm, collision.globalIndex()); - for (auto& v0photon : v0photons_per_coll) { - if (v0photon.chiSquareNDF() > v0cuts.cfg_max_kfchi2) { - continue; - } - - fRegistry.fill(HIST("V0/Photon/hMass"), v0photon.mGamma(), v0photon.pt()); - fRegistry.fill(HIST("V0/Photon/hXY"), v0photon.vx(), v0photon.vy()); - fRegistry.fill(HIST("V0/Photon/hChi2"), v0photon.v0radius(), v0photon.chiSquareNDF()); - auto pos_v0leg = v0photon.template posTrack_as(); - auto neg_v0leg = v0photon.template negTrack_as(); - auto pos = tracks.rawIteratorAt(pos_v0leg.trackId()); - auto neg = tracks.rawIteratorAt(neg_v0leg.trackId()); - - if (!isSelectedV0Leg(pos) || !isSelectedV0Leg(neg)) { - continue; - } - if (std::fabs(pos.dcaXY()) < v0cuts.cfg_min_dcaxy_v0leg || std::fabs(neg.dcaXY()) < v0cuts.cfg_min_dcaxy_v0leg) { - continue; - } - - // if (pos.tpcNSigmaEl() < v0cuts.cfg_min_TPCNsigmaEl || v0cuts.cfg_max_TPCNsigmaEl < pos.tpcNSigmaEl()) { - // continue; - // } - // if (neg.tpcNSigmaEl() < v0cuts.cfg_min_TPCNsigmaEl || v0cuts.cfg_max_TPCNsigmaEl < neg.tpcNSigmaEl()) { - // continue; - // } - - bool isTPCOK_pos = pos.hasTPC() && v0cuts.cfg_min_TPCNsigmaEl < pos.tpcNSigmaEl() && pos.tpcNSigmaEl() < v0cuts.cfg_max_TPCNsigmaEl; - bool isTPCOK_neg = neg.hasTPC() && v0cuts.cfg_min_TPCNsigmaEl < neg.tpcNSigmaEl() && neg.tpcNSigmaEl() < v0cuts.cfg_max_TPCNsigmaEl; - bool isTOFOK_pos = pos.hasTOF() && pos.tofChi2() < v0cuts.cfg_max_chi2tof && v0cuts.cfg_min_TOFNsigmaEl < pos.tofNSigmaEl() && pos.tofNSigmaEl() < v0cuts.cfg_max_TOFNsigmaEl; - bool isTOFOK_neg = neg.hasTOF() && neg.tofChi2() < v0cuts.cfg_max_chi2tof && v0cuts.cfg_min_TOFNsigmaEl < neg.tofNSigmaEl() && neg.tofNSigmaEl() < v0cuts.cfg_max_TOFNsigmaEl; - - if (isTPCOK_neg && isTOFOK_neg) { // photon conversion is tagged by neg and pos is probe. - fRegistry.fill(HIST("V0/Photon/electron/hTPCdEdx"), pos.tpcInnerParam(), pos.tpcSignal()); - fRegistry.fill(HIST("V0/Photon/electron/hsEID"), pos.tpcInnerParam(), pos.eta(), pos.tpcNSigmaEl()); - } - if (isTPCOK_pos && isTOFOK_pos) { // photon conversion is tagged by pos and neg is probe. - fRegistry.fill(HIST("V0/Photon/electron/hTPCdEdx"), neg.tpcInnerParam(), neg.tpcSignal()); - fRegistry.fill(HIST("V0/Photon/electron/hsEID"), neg.tpcInnerParam(), neg.eta(), neg.tpcNSigmaEl()); - } - } // end of v0photon loop - } // end of V0 PID } // end of collision loop } // end of process - void processEventQC(FilteredMyCollisions const& collisions, FilteredMyTracks const& tracks) + void processEventQC(MyBCs const& bcs, FilteredMyCollisions const& collisions, FilteredMyTracks const& tracks) { - auto tracksWithITSPid = soa::Attach(tracks); - runQC(collisions, tracksWithITSPid, nullptr, nullptr, nullptr); + runQC(bcs, collisions, tracks); } PROCESS_SWITCH(eventQC, processEventQC, "event QC", true); - void processEventQC_Cent_Qvec(FilteredMyCollisions_Qvec const& collisions, FilteredMyTracks const& tracks) + void processEventQC_SWT(MyBCs const& bcs, FilteredMyCollisions const& collisions, FilteredMyTracks const& tracks) { - auto tracksWithITSPid = soa::Attach(tracks); - runQC(collisions, tracksWithITSPid, nullptr, nullptr, nullptr); + runQC(bcs, collisions, tracks); } - PROCESS_SWITCH(eventQC, processEventQC_Cent_Qvec, "event QC + q vector", false); - - //! type of V0. 0: built solely for cascades (does not pass standard V0 cuts), 1: standard 2, 3: photon-like with TPC-only use. Regular analysis should always use type 1. - Filter v0Filter = o2::aod::v0data::v0Type == uint8_t(1) && o2::aod::v0data::v0cosPA > v0cuts.cfg_min_cospa_v0hadron&& o2::aod::v0data::dcaV0daughters < v0cuts.cfg_max_pca_v0hadron; - using filteredV0s = soa::Filtered; + PROCESS_SWITCH(eventQC, processEventQC_SWT, "event QC", false); - void processEventQC_V0_PID(FilteredMyCollisions const& collisions, FilteredMyTracks const& tracks, aod::V0PhotonsKF const& v0photons, aod::V0Legs const& v0legs, filteredV0s const& v0strhadrons) + void processEventQC_Cent_Qvec(MyBCs const& bcs, FilteredMyCollisions_Qvec const& collisions, FilteredMyTracks const& tracks) { - auto tracksWithITSPid = soa::Attach(tracks); - runQC(collisions, tracksWithITSPid, v0photons, v0legs, v0strhadrons); + runQC(bcs, collisions, tracks); } - PROCESS_SWITCH(eventQC, processEventQC_V0_PID, "event QC + V0 PID", false); + PROCESS_SWITCH(eventQC, processEventQC_Cent_Qvec, "event QC + q vector", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGEM/PhotonMeson/Utils/EventHistograms.h b/PWGEM/PhotonMeson/Utils/EventHistograms.h index 33ea324fc31..ef5f115e216 100644 --- a/PWGEM/PhotonMeson/Utils/EventHistograms.h +++ b/PWGEM/PhotonMeson/Utils/EventHistograms.h @@ -63,9 +63,9 @@ void addEventHistograms(HistogramRegistry* fRegistry) fRegistry->add("Event/before/hMultNTracksPV", "hMultNTracksPV; N_{track} to PV", kTH1F, {{6001, -0.5, 6000.5}}, false); fRegistry->add("Event/before/hMultNTracksPVeta1", "hMultNTracksPVeta1; N_{track} to PV", kTH1F, {{6001, -0.5, 6000.5}}, false); fRegistry->add("Event/before/hMultFT0", "hMultFT0;mult. FT0A;mult. FT0C", kTH2F, {{200, 0, 200000}, {60, 0, 60000}}, false); - fRegistry->add("Event/before/hCentFT0A", "hCentFT0A;centrality FT0A (%)", kTH1F, {{axis_cent_ft0m}}, false); - fRegistry->add("Event/before/hCentFT0C", "hCentFT0C;centrality FT0C (%)", kTH1F, {{axis_cent_ft0a}}, false); - fRegistry->add("Event/before/hCentFT0M", "hCentFT0M;centrality FT0M (%)", kTH1F, {{axis_cent_ft0c}}, false); + fRegistry->add("Event/before/hCentFT0A", "hCentFT0A;centrality FT0A (%)", kTH1F, {{axis_cent_ft0a}}, false); + fRegistry->add("Event/before/hCentFT0C", "hCentFT0C;centrality FT0C (%)", kTH1F, {{axis_cent_ft0c}}, false); + fRegistry->add("Event/before/hCentFT0M", "hCentFT0M;centrality FT0M (%)", kTH1F, {{axis_cent_ft0m}}, false); fRegistry->add("Event/before/hCentFT0CvsMultNTracksPV", "hCentFT0CvsMultNTracksPV;centrality FT0C (%);N_{track} to PV", kTH2F, {{110, 0, 110}, {500, 0, 5000}}, false); fRegistry->add("Event/before/hMultFT0CvsMultNTracksPV", "hMultFT0CvsMultNTracksPV;mult. FT0C;N_{track} to PV", kTH2F, {{60, 0, 60000}, {500, 0, 5000}}, false); fRegistry->add("Event/before/hMultFT0CvsOccupancy", "hMultFT0CvsOccupancy;mult. FT0C;N_{track} in time range", kTH2F, {{60, 0, 60000}, {2000, 0, 20000}}, false); From 61949bf5bb344fb3ddaddf10e27d3650a9fcf24e Mon Sep 17 00:00:00 2001 From: Gianni Shigeru Setoue Liveraro <81832939+gianniliveraro@users.noreply.github.com> Date: Sat, 26 Jul 2025 21:12:39 -0300 Subject: [PATCH 086/345] [PWGLF] Fix initialization of ccdbApi in strangenessbuilder (#12266) Co-authored-by: ALICE Action Bot --- PWGLF/TableProducer/Strangeness/strangenessbuilder.cxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/PWGLF/TableProducer/Strangeness/strangenessbuilder.cxx b/PWGLF/TableProducer/Strangeness/strangenessbuilder.cxx index c3f065876a6..bca1b08b07f 100644 --- a/PWGLF/TableProducer/Strangeness/strangenessbuilder.cxx +++ b/PWGLF/TableProducer/Strangeness/strangenessbuilder.cxx @@ -771,6 +771,9 @@ struct StrangenessBuilder { if (DeduplicationOpts.deduplicationAlgorithm.value == 4 || DeduplicationOpts.deduplicationAlgorithm.value == 6) { if (DeduplicationOpts.loadModelsFromCCDB) { + // Retrieve the model from CCDB + ccdbApi.init(ccdbConfigurations.ccdburl); + /// Fetching model for specific timestamp LOG(info) << "Fetching model for timestamp: " << DeduplicationOpts.timestampCCDB.value; From f0b17b971076ff9a97ec37dffc63a055e0baab46 Mon Sep 17 00:00:00 2001 From: Anantha Padmanabhan M Nair <82643666+ananthapadmanabhan18@users.noreply.github.com> Date: Sun, 27 Jul 2025 07:03:32 +0530 Subject: [PATCH 087/345] [PWGUD] Added back the filters for fast analysis and new process for event and track counters (#12265) --- PWGUD/Tasks/exclusiveRhoTo4Pi.cxx | 597 +++++++++++++++--------------- 1 file changed, 308 insertions(+), 289 deletions(-) diff --git a/PWGUD/Tasks/exclusiveRhoTo4Pi.cxx b/PWGUD/Tasks/exclusiveRhoTo4Pi.cxx index b12b4d2a228..97068a4c9a9 100644 --- a/PWGUD/Tasks/exclusiveRhoTo4Pi.cxx +++ b/PWGUD/Tasks/exclusiveRhoTo4Pi.cxx @@ -376,48 +376,38 @@ struct ExclusiveRhoTo4Pi { int numPiPlus = 2; int numPiMinus = 2; float zeroPointEight = 0.8; + std::vector trackSelectionParams; // Derived Data Produces sigFromData; Produces bkgFromData; // Histogram Registry - HistogramRegistry histosData{"histosData", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry histosData{"Data", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry histosCounter{"counters", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; // Configurable Event parameters Configurable ifCheckUPCmode{"ifCheckUPCmode", false, "Enable UPC reconstruction only"}; Configurable vZCut{"vZCut", 10., "Vertex Cut"}; Configurable fv0Cut{"fv0Cut", 50., "FV0A threshold"}; - Configurable ft0aCut{"ft0aCut", 150., "FT0A threshold"}; + Configurable ft0aCut{"ft0aCut", 50., "FT0A threshold"}; Configurable ft0cCut{"ft0cCut", 50., "FT0C threshold"}; Configurable zdcCut{"zdcCut", 0., "ZDC threshold"}; Configurable numPVContrib{"numPVContrib", 4, "Number of PV Contributors"}; - Configurable gapSideCut{"gapSideCut", 2, "Gap Side"}; Configurable sbpCut{"sbpCut", 1, "Sbp"}; Configurable itsROFbCut{"itsROFbCut", 1, "itsROFbCut"}; Configurable vtxITSTPCcut{"vtxITSTPCcut", 1, "vtxITSTPCcut"}; Configurable tfbCut{"tfbCut", 1, "tfbCut"}; - // track Selection mode - Configurable trackSelectionMode{"trackSelectionMode", 0, "Different modes of track selection"}; - // Configurable Track parameters common to mode 0 and 1 + // Configurable Track parameters Configurable useOnlyPVtracks{"useOnlyPVtracks", true, "Use Only PV tracks"}; - Configurable useITS{"useITS", true, "only use tracks with hit in ITS"}; - Configurable useTPC{"useTPC", true, "has TPC hit"}; - Configurable tpcNClsFindableCut{"tpcNClsFindableCut", 70, "Min TPC Findable Clusters"}; - Configurable pTcut{"pTcut", 0.1, "Track Pt"}; - Configurable dcaZcut{"dcaZcut", 1, "dcaZ cut"}; + Configurable pTcut{"pTcut", 0.15, "Track Pt"}; Configurable etaCut{"etaCut", 0.9, "Track Pseudorapidity"}; - // Configurable Track parameters for mode 0 only - Configurable itsNClsCut{"itsNClsCut", 4, "Min No of itsNCls"}; - Configurable itsClusterMapCut{"itsClusterMapCut", 1, "min no of ITS clusters in cluster map"}; - Configurable itsChi2NClCut{"itsChi2NClCut", 3.0, "Max ITS Chi2/NCl"}; - Configurable minFoundTPCclusters{"minFoundTPCclusters", 120, "Min TPC Findable Clusters"}; - Configurable tpcChi2NClsMin{"tpcChi2NClsMin", 1.0, "Min TPC Chi2/NCls"}; - Configurable tpcChi2NClsMax{"tpcChi2NClsMax", 3.0, "Max TPC Chi2/NCls"}; - Configurable tpcNClsCrossedRowsCut{"tpcNClsCrossedRowsCut", 130, "Min TPC Crossed Rows"}; - Configurable tpcCrossedRowsOverFindableCut{"tpcCrossedRowsOverFindableCut", 1.0, "Min TPC Crossed Rows over Findable Clusters"}; - // Configurable Track parameters for mode: 1 only - Configurable itsChi2Cut{"itsChi2Cut", 36, "ITS Chi2"}; - Configurable tpcChi2Cut{"tpcChi2Cut", 4.0, "TPC Chi2"}; + Configurable dcaXYcut{"dcaXYcut", 0, "dcaXY cut"}; + Configurable dcaZcut{"dcaZcut", 2, "dcaZ cut"}; + Configurable useITStracksOnly{"useITStracksOnly", true, "only use tracks with hit in ITS"}; + Configurable useTPCtracksOnly{"useTPCtracksOnly", true, "only use tracks with hit in TPC"}; + Configurable itsChi2NClsCut{"itsChi2NClsCut", 36, "ITS Chi2NCls"}; + Configurable tpcChi2NClsCut{"tpcChi2NClsCut", 4.0, "TPC Chi2NCls"}; + Configurable tpcNClsFindableCut{"tpcNClsFindableCut", 70, "Min TPC Findable Clusters"}; // Configurable PID parameters - Configurable useTOF{"useTOF", true, "has TOF for PID"}; + Configurable useTOF{"useTOF", true, "if track has TOF use TOF"}; Configurable nSigmaTPCcut{"nSigmaTPCcut", 3, "TPC cut"}; Configurable nSigmaTOFcut{"nSigmaTOFcut", 3, "TOF cut"}; // Configurable Rho parameters @@ -435,32 +425,35 @@ struct ExclusiveRhoTo4Pi { void init(InitContext const&) { - // QA plots: Event Counter - histosData.add("EventsCounts_vs_runNo", "Number of Selected 4-Pion Events per Run; Run Number; Number of Events", kTH2F, {{1355, 544013, 545367}, {21, -1, 20}}); - histosData.add("TracksCounts_vs_runNo", "Number of Selected Tracks per Run; Run Number; Number of Tracks", kTH2F, {{1355, 544013, 545367}, {20, 0, 20}}); + // QA plots: Event and Track Counter + histosCounter.add("EventsCounts_vs_runNo", "Number of Selected 4-Pion Events per Run; Run Number; Number of Events", kTH2F, {{1355, 544013, 545367}, {20, 0, 20}}); + histosCounter.add("TracksCounts_vs_runNo", "Number of Selected Tracks per Run; Run Number; Number of Tracks", kTH2F, {{1355, 544013, 545367}, {20, 0, 20}}); // QA plots: event selection - histosData.add("FT0A", "T0A amplitude", kTH1F, {{2000, 0.0, 500.0}}); - histosData.add("FT0C", "T0C amplitude", kTH1F, {{2000, 0.0, 500.0}}); + histosData.add("UPCmode", "UPC mode; Events", kTH1F, {{5, 0, 5}}); + histosData.add("FT0A", "T0A amplitude", kTH1F, {{500, 0.0, 500.0}}); + histosData.add("FT0C", "T0C amplitude", kTH1F, {{500, 0.0, 500.0}}); + histosData.add("FV0A", "V0A amplitude", kTH1F, {{100, 0.0, 100}}); histosData.add("ZDC_A", "ZDC amplitude", kTH1F, {{1000, 0.0, 15}}); histosData.add("ZDC_C", "ZDC amplitude", kTH1F, {{1000, 0.0, 15}}); - histosData.add("V0A", "V0A amplitude", kTH1F, {{1000, 0.0, 100}}); + histosData.add("FDDA", "FDD A signal; FDD A signal; Counts", kTH1F, {{500, 0.0, 500}}); + histosData.add("FDDC", "FDD C signal; FDD C signal; Counts", kTH1F, {{500, 0.0, 500}}); histosData.add("vertexX", "Vertex X; Vertex X [cm]; Counts", kTH1F, {{2000, -0.05, 0.05}}); histosData.add("vertexY", "Vertex Y; Vertex Y [cm]; Counts", kTH1F, {{2000, -0.05, 0.05}}); histosData.add("vertexZ", "Vertex Z; Vertex Z [cm]; Counts", kTH1F, {{2000, -15, 15}}); + histosData.add("GapSide", "Gap Side;Gap Side; Events", kTH1F, {{4, -1.5, 2.5}}); + histosData.add("TrueGapSide", "True Gap Side; True Gap Side; Events", kTH1F, {{4, -1.5, 2.5}}); histosData.add("occupancy", "Occupancy; Occupancy; Counts", kTH1F, {{20000, 0, 20000}}); - histosData.add("GapSide", "Gap Side; Events", kTH1F, {{4, -1.5, 2.5}}); - histosData.add("TrueGapSide", "Gap Side; Events", kTH1F, {{4, -1.5, 2.5}}); // QA plots: tracks - histosData.add("dcaXY", "dcaXY; dcaXY [cm]; Counts", kTH1F, {{5000, -1, 1}}); + histosData.add("dcaXY_all", "dcaXY; dcaXY [cm]; Counts", kTH1F, {{5000, -1, 1}}); histosData.add("dcaXY_pions", "dcaXY_pions; dcaXY of Pions [cm]; Counts", kTH1F, {{5000, -1, 1}}); - histosData.add("dcaZ", "dcaZ; dcaZ [cm]; Counts", kTH1F, {{5000, -1, 1}}); + histosData.add("dcaZ_all", "dcaZ; dcaZ [cm]; Counts", kTH1F, {{5000, -1, 1}}); histosData.add("dcaZ_pions", "dcaZ_pions; dcaZ of Pions [cm]; Counts", kTH1F, {{5000, -1, 1}}); - histosData.add("tpcChi2NCl", "TPC Chi2/NCl; Chi2/NCl; Counts", kTH1F, {{250, 0, 50}}); - histosData.add("itsChi2NCl", "ITS Chi2/NCl; Chi2/NCl; Counts", kTH1F, {{250, 0, 50}}); - histosData.add("tpcNClsFindable", "TPC N Cls Findable; N Cls Findable; Counts", kTH1F, {{200, 0, 200}}); - histosData.add("itsClusterMap", "ITS Cluster Map; itsClusterMap; Counts", kTH1F, {{200, 0, 200}}); + histosData.add("itsChi2NCl_all", "ITS Chi2/NCl; Chi2/NCl; Counts", kTH1F, {{250, 0, 50}}); + histosData.add("itsChi2_all", "ITS Chi2; ITS Chi2; Counts", kTH1F, {{500, 0, 50}}); + histosData.add("tpcChi2NCl_all", "TPC Chi2/NCl; Chi2/NCl; Counts", kTH1F, {{250, 0, 50}}); + histosData.add("tpcNClsFindable_all", "TPC N Cls Findable; N Cls Findable; Counts", kTH1F, {{200, 0, 200}}); // QA plots: PID - histosData.add("tpcSignal", "TPC dEdx vs p; p [GeV/c]; dEdx [a.u.]", kTH2F, {{500, 0, 10}, {5000, 0.0, 5000.0}}); + histosData.add("tpcSignal_all", "TPC dEdx vs p; p [GeV/c]; dEdx [a.u.]", kTH2F, {{500, 0, 10}, {5000, 0.0, 5000.0}}); histosData.add("tpcSignal_pions", "TPC dEdx vs p for pions; p [GeV/c]; dEdx [a.u.]", kTH2F, {{500, 0, 10}, {5000, 0.0, 5000.0}}); histosData.add("tpcNSigmaPi_all", "TPC nSigma Pion with track selection; Events", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); histosData.add("tpcNSigmaPi_pions", "TPC nSigma Pion with track selection and PID Selection of Pi; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); @@ -468,7 +461,7 @@ struct ExclusiveRhoTo4Pi { histosData.add("tpcNSigmaPr_pions", "TPC nSigma Proton with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); histosData.add("tpcNSigmaEl_pions", "TPC nSigma Electron with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); histosData.add("tpcNSigmaMu_pions", "TPC nSigma Muon with track selection and PID Selection of Pion; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); - histosData.add("tofBeta", "TOF beta vs p; p [GeV/c]; #beta", kTH2F, {{500, 0, 10}, {500, 0.0, 1.0}}); + histosData.add("tofBeta_all", "TOF beta vs p; p [GeV/c]; #beta", kTH2F, {{500, 0, 10}, {500, 0.0, 1.0}}); histosData.add("tofBeta_pions", "TOF beta vs p for pions; p [GeV/c]; #beta", kTH2F, {{500, 0, 10}, {500, 0.0, 1.0}}); histosData.add("tofNSigmaPi_all", "TOF nSigma Pion with track selection; Events", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); histosData.add("tofNSigmaPi_pions", "TOF nSigma Pion with track selection and PID Selection of Pi; Entries", kTH2F, {{1000, -15, 15}, {1000, 0, 10}}); @@ -545,86 +538,26 @@ struct ExclusiveRhoTo4Pi { histosData.add("phi_vs_costheta_large_mass", "Phi vs cosTheta for large mass; #phi; cos(#theta)", kTH2F, {phiAxis, cosThetaAxis}); } // End of init function + //--------------------------------------------------------------------------------------------------------------------------------------------- + // Event Cuts + Filter vertexZcut = (nabs(o2::aod::collision::posZ) <= vZCut); + Filter numPVcontributorsCut = (o2::aod::collision::numContrib == numPVContrib); + Filter fitcuts = (o2::aod::udcollision::totalFV0AmplitudeA <= fv0Cut) && (o2::aod::udcollision::totalFT0AmplitudeA <= ft0aCut) && (o2::aod::udcollision::totalFT0AmplitudeC <= ft0cCut); + Filter zdcCuts = (o2::aod::udzdc::energyCommonZNA <= zdcCut) && (o2::aod::udzdc::energyCommonZNC <= zdcCut); + Filter bcSelectionCuts = (o2::aod::udcollision::sbp == sbpCut) && (o2::aod::udcollision::itsROFb == itsROFbCut) && (o2::aod::udcollision::vtxITSTPC == vtxITSTPCcut) && (o2::aod::udcollision::tfb == tfbCut); + // Track Cuts + Filter onlyPVtracks = o2::aod::udtrack::isPVContributor == useOnlyPVtracks; + //--------------------------------------------------------------------------------------------------------------------------------------------- + using UDtracks = soa::Join; using UDCollisions = soa::Join; - void processData(UDCollisions::iterator const& collision, UDtracks const& tracks) + void processData(soa::Filtered::iterator const& collision, soa::Filtered const& tracks) { - - // no cuts - histosData.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), -1); - - // Check if the event is in UPC mode + // Check if the Event is reconstructed in UPC mode if (ifCheckUPCmode && (collision.flags() != 1)) { return; } - histosData.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 0); - - // FTOA - if (!(collision.totalFT0AmplitudeA() <= ft0aCut)) { - return; - } - histosData.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 1); - - // FT0C - if (!(collision.totalFT0AmplitudeC() <= ft0cCut)) { - return; - } - histosData.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 2); - - // FV0 - if (!(collision.totalFV0AmplitudeA() <= fv0Cut)) { - return; - } - histosData.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 3); - - // noSamebunchPileup - if (collision.sbp() != sbpCut) { - return; - } - histosData.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 4); - - // kIsVertexITSTPC - if (collision.vtxITSTPC() != vtxITSTPCcut) { - return; - } - histosData.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 5); - - // kNoITSROFrameBorder - if (collision.itsROFb() != itsROFbCut) { - return; - } - histosData.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 6); - - // kNoTimeFrameBorder - if (collision.tfb() != tfbCut) { - return; - } - histosData.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 7); - - // ZDC - if (!(collision.energyCommonZNA() <= zdcCut || collision.energyCommonZNC() <= zdcCut)) { - return; - } - histosData.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 8); - - // Vertex Z cut - if (!(std::abs(collision.posZ()) <= vZCut)) { - return; - } - histosData.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 9); - - // true Gap Side - if (sgSelector.trueGap(collision, fv0Cut, ft0aCut, ft0cCut, zdcCut) != gapSideCut) { - return; - } - histosData.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 10); - - // number of PV contributors - if (!(collision.numContrib() == numPVContrib)) { - return; - } - histosData.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 11); histosData.fill(HIST("GapSide"), collision.gapSide()); histosData.fill(HIST("TrueGapSide"), sgSelector.trueGap(collision, fv0Cut, ft0aCut, ft0cCut, zdcCut)); @@ -632,11 +565,14 @@ struct ExclusiveRhoTo4Pi { histosData.fill(HIST("vertexY"), collision.posY()); histosData.fill(HIST("vertexZ"), collision.posZ()); histosData.fill(HIST("occupancy"), collision.occupancyInTime()); - histosData.fill(HIST("V0A"), collision.totalFV0AmplitudeA()); + histosData.fill(HIST("FV0A"), collision.totalFV0AmplitudeA()); histosData.fill(HIST("FT0A"), collision.totalFT0AmplitudeA()); histosData.fill(HIST("FT0C"), collision.totalFT0AmplitudeC()); histosData.fill(HIST("ZDC_A"), collision.energyCommonZNA()); histosData.fill(HIST("ZDC_C"), collision.energyCommonZNC()); + histosData.fill(HIST("FDDA"), collision.totalFDDAmplitudeA()); + histosData.fill(HIST("FDDC"), collision.totalFDDAmplitudeC()); + histosData.fill(HIST("UPCmode"), collision.flags()); std::vector selectedTracks; std::vector selectedPionTracks; @@ -644,159 +580,17 @@ struct ExclusiveRhoTo4Pi { std::vector selectedPionMinusTracks; for (const auto& t0 : tracks) { - - ROOT::Math::PxPyPzMVector trackVector(t0.px(), t0.py(), t0.pz(), o2::constants::physics::MassPionCharged); - // no Cuts - histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 0); - - if (trackSelectionMode == 0) { - - // is PV Contributor - if (!(t0.isPVContributor() == useOnlyPVtracks)) { - continue; - } - histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 1); - - // has ITS hit - if ((useITS == true) && (t0.hasITS() != true)) { - continue; - } - histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 2); - - // min no of itsNCls - if (t0.itsNCls() < itsNClsCut) { - continue; - } - histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 3); - - // min ITS chi2NCl - if (t0.itsChi2NCl() > itsChi2NClCut) { - continue; - } - histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 4); - - // has TPC hit - if ((useTPC == true) && (t0.hasTPC() != true)) { - continue; - } - histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 5); - - // min no of found TPC clusters - if (t0.tpcNClsFindable() - t0.tpcNClsFindableMinusFound() < minFoundTPCclusters) { - continue; - } - histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 6); - - // range of tpcChi2NCl - if (!((tpcChi2NClsMin < t0.tpcChi2NCl()) && (t0.tpcChi2NCl() < tpcChi2NClsMax))) { - continue; - } - histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 7); - - // tpcNClsCrossedRows - if (t0.tpcNClsCrossedRows() < tpcNClsCrossedRowsCut) { - continue; - } - histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 8); - - // ratio of crossed TPC rows over findable clusters - if ((t0.tpcNClsCrossedRows() / t0.tpcNClsFindable()) < tpcCrossedRowsOverFindableCut) { - continue; - } - histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 9); - - // pT cut - if (trackVector.Pt() < pTcut) { - continue; - } - histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 10); - - // dcaZ cut - if ((std::abs(t0.dcaZ()) > dcaZcut) || (t0.dcaXY() > getMaxDCAxy(trackVector.Pt()))) { - continue; - } - histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 11); - - // eta cut - if (std::abs(trackVector.Eta()) > etaCut) { - continue; - } - histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 12); - } // end of trackSelectionMode == 0 - - if (trackSelectionMode == 1) { - // is PV Contributor - if (!(t0.isPVContributor() == useOnlyPVtracks)) { - continue; - } - histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 1); - - // pT cut - if (trackVector.Pt() < pTcut) { - continue; - } - histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 2); - - // eta cut - if (std::abs(trackVector.Eta()) > etaCut) { - continue; - } - histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 3); - - // dcaZ cut - if ((std::abs(t0.dcaZ()) > dcaZcut)) { - continue; - } - histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 4); - - // dcaXY cut - if (std::abs(t0.dcaXY()) > getMaxDCAxy(trackVector.Pt())) { - continue; - } - histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 5); - - // has ITS hit - if ((useITS == true) && (t0.hasITS() != true)) { - continue; - } - histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 6); - - // has TPC hit - if ((useTPC == true) && (t0.hasTPC() != true)) { - continue; - } - histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 7); - - // ITS Chi2 Cut - if (t0.itsChi2NCl() > itsChi2Cut) { - continue; - } - histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 8); - - // TPC Chi2 Cut - if (t0.tpcChi2NCl() > tpcChi2Cut) { - continue; - } - histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 9); - - // TPC Clusters findable cut - if (t0.tpcNClsFindable() < tpcNClsFindableCut) { - continue; - } - histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 10); - } // end of trackSelectionMode == 1 - + if (!isSelectedTrack(t0, pTcut, etaCut, dcaXYcut, dcaZcut, useITStracksOnly, useTPCtracksOnly, itsChi2NClsCut, tpcChi2NClsCut, tpcNClsFindableCut)) { + continue; + } selectedTracks.push_back(t0); if (selectionPIDPion(t0, useTOF, nSigmaTPCcut, nSigmaTOFcut)) { selectedPionTracks.push_back(t0); - histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 13); if (t0.sign() == 1) { selectedPionPlusTracks.push_back(t0); - histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 14); } if (t0.sign() == -1) { selectedPionMinusTracks.push_back(t0); - histosData.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 15); } } // End of Selection PID Pion } // End of loop over tracks @@ -808,49 +602,55 @@ struct ExclusiveRhoTo4Pi { for (int i = 0; i < numSelectedTracks; i++) { ROOT::Math::PxPyPzMVector selectedTrackVector(selectedTracks[i].px(), selectedTracks[i].py(), selectedTracks[i].pz(), o2::constants::physics::MassPionCharged); - histosData.fill(HIST("tpcSignal"), selectedTrackVector.P(), selectedTracks[i].tpcSignal()); - histosData.fill(HIST("tofBeta"), selectedTrackVector.P(), selectedTracks[i].beta()); - histosData.fill(HIST("tpcNSigmaPi_all"), selectedTracks[i].tpcNSigmaPi(), selectedTrackVector.Pt()); - histosData.fill(HIST("tofNSigmaPi_all"), selectedTracks[i].tofNSigmaPi(), selectedTrackVector.Pt()); histosData.fill(HIST("pT_track_all"), selectedTrackVector.Pt()); histosData.fill(HIST("eta_track_all"), selectedTrackVector.Eta()); histosData.fill(HIST("phi_track_all"), selectedTrackVector.Phi()); histosData.fill(HIST("rapidity_track_all"), selectedTrackVector.Rapidity()); - histosData.fill(HIST("itsChi2NCl"), selectedTracks[i].itsChi2NCl()); - histosData.fill(HIST("tpcChi2NCl"), selectedTracks[i].tpcChi2NCl()); - histosData.fill(HIST("tpcNClsFindable"), selectedTracks[i].tpcNClsFindable()); - histosData.fill(HIST("dcaXY"), selectedTracks[i].dcaXY()); - histosData.fill(HIST("dcaZ"), selectedTracks[i].dcaZ()); - histosData.fill(HIST("itsClusterMap"), selectedTracks[i].itsClusterMap()); + + histosData.fill(HIST("dcaXY_all"), selectedTracks[i].dcaXY()); + histosData.fill(HIST("dcaZ_all"), selectedTracks[i].dcaZ()); + + histosData.fill(HIST("itsChi2NCl_all"), selectedTracks[i].itsChi2NCl()); + histosData.fill(HIST("itsChi2_all"), selectedTracks[i].itsChi2NCl() * selectedTracks[i].itsNCls()); + histosData.fill(HIST("tpcChi2NCl_all"), selectedTracks[i].tpcChi2NCl()); + histosData.fill(HIST("tpcNClsFindable_all"), selectedTracks[i].tpcNClsFindable()); + + histosData.fill(HIST("tpcSignal_all"), selectedTrackVector.P(), selectedTracks[i].tpcSignal()); + histosData.fill(HIST("tpcNSigmaPi_all"), selectedTracks[i].tpcNSigmaPi(), selectedTrackVector.Pt()); + histosData.fill(HIST("tofBeta_all"), selectedTrackVector.P(), selectedTracks[i].beta()); + histosData.fill(HIST("tofNSigmaPi_all"), selectedTracks[i].tofNSigmaPi(), selectedTrackVector.Pt()); } // End of loop over tracks with selection only for (int i = 0; i < numSelectedPionTracks; i++) { ROOT::Math::PxPyPzMVector selectedPionTrackVector(selectedPionTracks[i].px(), selectedPionTracks[i].py(), selectedPionTracks[i].pz(), o2::constants::physics::MassPionCharged); + + histosData.fill(HIST("pT_track_pions"), selectedPionTrackVector.Pt()); + histosData.fill(HIST("eta_track_pions"), selectedPionTrackVector.Eta()); + histosData.fill(HIST("phi_track_pions"), selectedPionTrackVector.Phi()); + histosData.fill(HIST("rapidity_track_pions"), selectedPionTrackVector.Rapidity()); + + histosData.fill(HIST("dcaXY_pions"), selectedPionTracks[i].dcaXY()); + histosData.fill(HIST("dcaZ_pions"), selectedPionTracks[i].dcaZ()); + histosData.fill(HIST("tpcSignal_pions"), selectedPionTrackVector.P(), selectedPionTracks[i].tpcSignal()); - histosData.fill(HIST("tofBeta_pions"), selectedPionTrackVector.P(), selectedPionTracks[i].beta()); histosData.fill(HIST("tpcNSigmaPi_pions"), selectedPionTracks[i].tpcNSigmaPi(), selectedPionTrackVector.Pt()); histosData.fill(HIST("tpcNSigmaKa_pions"), selectedPionTracks[i].tpcNSigmaKa(), selectedPionTrackVector.Pt()); histosData.fill(HIST("tpcNSigmaPr_pions"), selectedPionTracks[i].tpcNSigmaPr(), selectedPionTrackVector.Pt()); histosData.fill(HIST("tpcNSigmaEl_pions"), selectedPionTracks[i].tpcNSigmaEl(), selectedPionTrackVector.Pt()); histosData.fill(HIST("tpcNSigmaMu_pions"), selectedPionTracks[i].tpcNSigmaMu(), selectedPionTrackVector.Pt()); + + histosData.fill(HIST("tofBeta_pions"), selectedPionTrackVector.P(), selectedPionTracks[i].beta()); histosData.fill(HIST("tofNSigmaPi_pions"), selectedPionTracks[i].tofNSigmaPi(), selectedPionTrackVector.Pt()); histosData.fill(HIST("tofNSigmaKa_pions"), selectedPionTracks[i].tofNSigmaKa(), selectedPionTrackVector.Pt()); histosData.fill(HIST("tofNSigmaPr_pions"), selectedPionTracks[i].tofNSigmaPr(), selectedPionTrackVector.Pt()); histosData.fill(HIST("tofNSigmaEl_pions"), selectedPionTracks[i].tofNSigmaEl(), selectedPionTrackVector.Pt()); histosData.fill(HIST("tofNSigmaMu_pions"), selectedPionTracks[i].tofNSigmaMu(), selectedPionTrackVector.Pt()); - histosData.fill(HIST("pT_track_pions"), selectedPionTrackVector.Pt()); - histosData.fill(HIST("eta_track_pions"), selectedPionTrackVector.Eta()); - histosData.fill(HIST("phi_track_pions"), selectedPionTrackVector.Phi()); - histosData.fill(HIST("rapidity_track_pions"), selectedPionTrackVector.Rapidity()); - histosData.fill(HIST("dcaXY_pions"), selectedPionTracks[i].dcaXY()); - histosData.fill(HIST("dcaZ_pions"), selectedPionTracks[i].dcaZ()); } // End of loop over tracks with selection and PID of pions // event should have exactly 4 pions if (numSelectedPionTracks != numFourPionTracks) { return; } - histosData.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 12); // Check if there is at least one track with TOF in the selected events (for derived Data) bool hasAtleastOneTOF = false; @@ -864,8 +664,6 @@ struct ExclusiveRhoTo4Pi { // Selecting Events with net charge = 0 if (numPionMinusTracks == numPiMinus && numPiPlusTracks == numPiPlus) { - histosData.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 13); - ROOT::Math::PtEtaPhiMVector k1, k2, k3, k4, k1234, k13, k14, k23, k24; ROOT::Math::PxPyPzMVector p1(selectedPionPlusTracks[0].px(), selectedPionPlusTracks[0].py(), selectedPionPlusTracks[0].pz(), o2::constants::physics::MassPionCharged); @@ -979,10 +777,6 @@ struct ExclusiveRhoTo4Pi { histosData.fill(HIST("fourpion_rap_0_charge_within_rap"), p1234.Rapidity()); histosData.fill(HIST("fourpion_mass_0_charge_within_rap"), p1234.M()); if (p1234.Pt() < rhoPtCut) { - histosData.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 14); - if (rhoMassMin < p1234.M() && p1234.M() < rhoMassMax) { - histosData.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 15); - } // Fill the Invariant Mass Histogram histosData.fill(HIST("fourpion_mass_0_charge_domA"), p1234.M()); // Two Pion Masses @@ -997,7 +791,6 @@ struct ExclusiveRhoTo4Pi { histosData.fill(HIST("collin_soper_costheta_2"), fourPiCosThetaPair2); histosData.fill(HIST("phi_vs_costheta_1"), fourPiPhiPair1, fourPiCosThetaPair1); histosData.fill(HIST("phi_vs_costheta_2"), fourPiPhiPair2, fourPiCosThetaPair2); - // Small Mass CosTheta and Phi if ((k13.M() + k24.M()) > (k14.M() + k23.M())) { histosData.fill(HIST("collin_soper_phi_large_mass"), fourPiPhiPair1); @@ -1027,8 +820,6 @@ struct ExclusiveRhoTo4Pi { // Selecting Events with net charge != 0 for estimation of background if (numPionMinusTracks != numPiMinus && numPiPlusTracks != numPiPlus) { - histosData.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 16); - ROOT::Math::PxPyPzMVector p1(selectedPionTracks[0].px(), selectedPionTracks[0].py(), selectedPionTracks[0].pz(), o2::constants::physics::MassPionCharged); ROOT::Math::PxPyPzMVector p2(selectedPionTracks[1].px(), selectedPionTracks[1].py(), selectedPionTracks[1].pz(), o2::constants::physics::MassPionCharged); ROOT::Math::PxPyPzMVector p3(selectedPionTracks[2].px(), selectedPionTracks[2].py(), selectedPionTracks[2].pz(), o2::constants::physics::MassPionCharged); @@ -1113,7 +904,184 @@ struct ExclusiveRhoTo4Pi { } // End of Analysis for non 0 charge events } // End of 4 Pion Analysis Process function for Pass5 Data + void processCounter(UDCollisions::iterator const& collision, UDtracks const& tracks) + { + + histosCounter.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 0); + + // UPC mode + if (ifCheckUPCmode && collision.flags() != 1) { + return; + } + histosCounter.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 1); + + // vtxITSTPC + if (collision.vtxITSTPC() != vtxITSTPCcut) { + return; + } + histosCounter.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 2); + + // sbp + if (collision.sbp() != sbpCut) { + return; + } + histosCounter.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 3); + + // itsROFb + if (collision.itsROFb() != itsROFbCut) { + return; + } + histosCounter.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 4); + + // tfb + if (collision.tfb() != tfbCut) { + return; + } + histosCounter.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 5); + + // FT0A + if (collision.totalFT0AmplitudeA() > ft0aCut) { + return; + } + histosCounter.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 6); + // FT0C + if (collision.totalFT0AmplitudeC() > ft0cCut) { + return; + } + histosCounter.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 7); + // FV0A + if (collision.totalFV0AmplitudeA() > fv0Cut) { + return; + } + histosCounter.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 8); + + // ZDC + if (collision.energyCommonZNA() > zdcCut || collision.energyCommonZNC() > zdcCut) { + return; + } + histosCounter.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 9); + + // numContributors + if (collision.numContrib() != numPVContrib) { + return; + } + histosCounter.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 10); + + // vertexZ + if (std::abs(collision.posZ()) > vZCut) { + return; + } + histosCounter.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 11); + + std::vector selectedPionTracks; + std::vector selectedPionPlusTracks; + std::vector selectedPionMinusTracks; + + for (const auto& track : tracks) { + histosCounter.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 0); + ROOT::Math::PxPyPzMVector trackVector(track.px(), track.py(), track.pz(), o2::constants::physics::MassPionCharged); + // is PV contributor + if (track.isPVContributor() != useOnlyPVtracks) { + continue; + } + histosCounter.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 1); + // pt cut + if (trackVector.Pt() < pTcut) { + continue; + } + histosCounter.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 2); + // eta cut + if (std::abs(trackVector.Eta()) > etaCut) { + continue; + } + histosCounter.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 3); + // DCA Z cut + if (std::abs(track.dcaZ()) > dcaZcut) { + continue; + } + histosCounter.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 4); + // DCA XY cut + float maxDCAxy = 0.0105 + 0.035 / std::pow(trackVector.Pt(), 1.1); + if (dcaXYcut == 0 && (std::fabs(track.dcaXY()) > maxDCAxy)) { + continue; + } else if (dcaXYcut != 0 && (std::fabs(track.dcaXY()) > dcaXYcut)) { + continue; + } + histosCounter.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 5); + // ITS Track only + if (useITStracksOnly && !track.hasITS()) { + continue; + } + histosCounter.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 6); + // TPC Track only + if (useTPCtracksOnly && !track.hasTPC()) { + continue; + } + histosCounter.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 7); + // ITS Chi2 N Clusters cut + if (track.hasITS() && track.itsChi2NCl() > itsChi2NClsCut) { + continue; + } + histosCounter.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 8); + // TPC Chi2 N Clusters cut + if (track.hasTPC() && track.tpcChi2NCl() > tpcChi2NClsCut) { + continue; + } + histosCounter.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 9); + // TPC N Clusters Findable cut + if (track.hasTPC() && track.tpcNClsFindable() < tpcNClsFindableCut) { + continue; + } + histosCounter.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 10); + // Selection PID Pion + if (selectionPIDPion(track, useTOF, nSigmaTPCcut, nSigmaTOFcut)) { + histosCounter.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 11); + selectedPionTracks.push_back(track); + if (track.sign() == 1) { + histosCounter.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 12); + selectedPionPlusTracks.push_back(track); + } + if (track.sign() == -1) { + histosCounter.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 13); + selectedPionMinusTracks.push_back(track); + } + } // End of Selection PID Pion + } // End of loop over tracks + + int numSelectedPionTracks = static_cast(selectedPionTracks.size()); + int numPiPlusTracks = static_cast(selectedPionPlusTracks.size()); + int numPionMinusTracks = static_cast(selectedPionMinusTracks.size()); + // Events with 4 pions + if (numSelectedPionTracks != numFourPionTracks) { + return; + } + histosCounter.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 12); + + // Selecting Events with net charge = 0 + if (numPionMinusTracks == numPiMinus && numPiPlusTracks == numPiPlus) { + histosCounter.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 13); + ROOT::Math::PxPyPzMVector p1(selectedPionPlusTracks[0].px(), selectedPionPlusTracks[0].py(), selectedPionPlusTracks[0].pz(), o2::constants::physics::MassPionCharged); + ROOT::Math::PxPyPzMVector p2(selectedPionPlusTracks[1].px(), selectedPionPlusTracks[1].py(), selectedPionPlusTracks[1].pz(), o2::constants::physics::MassPionCharged); + ROOT::Math::PxPyPzMVector p3(selectedPionMinusTracks[0].px(), selectedPionMinusTracks[0].py(), selectedPionMinusTracks[0].pz(), o2::constants::physics::MassPionCharged); + ROOT::Math::PxPyPzMVector p4(selectedPionMinusTracks[1].px(), selectedPionMinusTracks[1].py(), selectedPionMinusTracks[1].pz(), o2::constants::physics::MassPionCharged); + ROOT::Math::PxPyPzMVector p1234 = p1 + p2 + p3 + p4; + + if ((p1234.Pt() < rhoPtCut) && (std::abs(p1234.Rapidity()) < rhoRapCut)) { + histosCounter.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 14); + if ((rhoMassMin < p1234.M()) && (p1234.M() < rhoMassMax)) { + histosCounter.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 15); + } + } + } // End of Zero Charge Events + + if (numPionMinusTracks != numPiMinus && numPiPlusTracks != numPiPlus) { + histosCounter.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 16); + } // End of Non Zero Charge Events + + } // End of processCounter function + PROCESS_SWITCH(ExclusiveRhoTo4Pi, processData, "The Process for 4 Pion Analysis from data", true); + PROCESS_SWITCH(ExclusiveRhoTo4Pi, processCounter, "The Process for 4 Pion Analysis from data", true); double cosThetaCollinsSoperFrame(ROOT::Math::PtEtaPhiMVector pair1, ROOT::Math::PtEtaPhiMVector pair2, ROOT::Math::PtEtaPhiMVector fourpion) { @@ -1163,11 +1131,62 @@ struct ExclusiveRhoTo4Pi { return phi; } - double getMaxDCAxy(double pT) + template + bool isSelectedTrack(T const& track, + float ptcut, + float etaCut, + float dcaxycut, + float dcazcut, + bool ifITS, + bool ifTPC, + float itschi2nclscut, + float tpcchi2nclscut, + float tpcnclsfindablecut) { - return 0.0105 + 0.035 / std::pow(pT, 1.1); - } + ROOT::Math::PxPyPzMVector trackVector(track.px(), track.py(), track.pz(), o2::constants::physics::MassPionCharged); + // pt cut + if (trackVector.Pt() < ptcut) { + return false; + } + // eta cut + if (std::fabs(trackVector.Eta()) > etaCut) { + return false; + } + // DCA Z cut + if (std::fabs(track.dcaZ()) > dcazcut) { + return false; + } + // DCA XY cut + float maxDCAxy = 0.0105 + 0.035 / std::pow(trackVector.Pt(), 1.1); + if (dcaxycut == 0 && (std::fabs(track.dcaXY()) > maxDCAxy)) { + return false; + } else if (dcaxycut != 0 && (std::fabs(track.dcaXY()) > dcaxycut)) { + return false; + } + // ITS Track only + if (ifITS && !track.hasITS()) { + return false; + } + // TPC Track only + if (ifTPC && !track.hasTPC()) { + return false; + } + // ITS Chi2 N Clusters cut + if (track.hasITS() && track.itsChi2NCl() > itschi2nclscut) { + return false; + } + // TPC Chi2 N Clusters cut + if (track.hasTPC() && track.tpcChi2NCl() > tpcchi2nclscut) { + return false; + } + // TPC N Clusters Findable cut + if (track.hasTPC() && track.tpcNClsFindable() < tpcnclsfindablecut) { + return false; + } + // All cuts passed + return true; + } // End of Track Selection function }; // End of Struct exclusiveRhoTo4Pi WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 2a3478d27f7b94821e2558f9a63f0dffad898184 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Sun, 27 Jul 2025 05:34:12 +0200 Subject: [PATCH 088/345] [PWGEM/Dilepton] update charged track for 2PC (#12261) Co-authored-by: ALICE Action Bot --- PWGEM/Dilepton/DataModel/dileptonTables.h | 38 +++++++++++-------- .../TableProducer/createEMEventDilepton.cxx | 2 +- .../TableProducer/skimmerPrimaryTrack.cxx | 18 +++++---- .../TableProducer/createEMEventPhoton.cxx | 13 ++++--- 4 files changed, 41 insertions(+), 30 deletions(-) diff --git a/PWGEM/Dilepton/DataModel/dileptonTables.h b/PWGEM/Dilepton/DataModel/dileptonTables.h index 88321541855..a96debb1457 100644 --- a/PWGEM/Dilepton/DataModel/dileptonTables.h +++ b/PWGEM/Dilepton/DataModel/dileptonTables.h @@ -693,19 +693,20 @@ namespace emprimarytrack DECLARE_SOA_INDEX_COLUMN(EMEvent, emevent); //! DECLARE_SOA_COLUMN(CollisionId, collisionId, int); //! DECLARE_SOA_COLUMN(TrackId, trackId, int); //! -DECLARE_SOA_COLUMN(Sign, sign, int8_t); //! -DECLARE_SOA_COLUMN(TrackBit, trackBit, uint16_t); //! -DECLARE_SOA_DYNAMIC_COLUMN(Signed1Pt, signed1Pt, [](float pt, int8_t sign) -> float { return sign * 1. / pt; }); -DECLARE_SOA_DYNAMIC_COLUMN(P, p, [](float pt, float eta) -> float { return pt * std::cosh(eta); }); -DECLARE_SOA_DYNAMIC_COLUMN(Px, px, [](float pt, float phi) -> float { return pt * std::cos(phi); }); -DECLARE_SOA_DYNAMIC_COLUMN(Py, py, [](float pt, float phi) -> float { return pt * std::sin(phi); }); -DECLARE_SOA_DYNAMIC_COLUMN(Pz, pz, [](float pt, float eta) -> float { return pt * std::sinh(eta); }); +// DECLARE_SOA_COLUMN(Sign, sign, int8_t); //! +DECLARE_SOA_COLUMN(TrackBit, trackBit, uint16_t); //! +DECLARE_SOA_COLUMN(PtUINT16, ptuint16, uint16_t); //! +DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt, [](uint16_t ptuint16) -> float { return static_cast(ptuint16) * 1e-4; }); +// DECLARE_SOA_DYNAMIC_COLUMN(Signed1Pt, signed1Pt, [](float pt, int8_t sign) -> float { return sign * 1. / pt; }); +// DECLARE_SOA_DYNAMIC_COLUMN(P, p, [](float pt, float eta) -> float { return pt * std::cosh(eta); }); +// DECLARE_SOA_DYNAMIC_COLUMN(Px, px, [](float pt, float phi) -> float { return pt * std::cos(phi); }); +// DECLARE_SOA_DYNAMIC_COLUMN(Py, py, [](float pt, float phi) -> float { return pt * std::sin(phi); }); +// DECLARE_SOA_DYNAMIC_COLUMN(Pz, pz, [](float pt, float eta) -> float { return pt * std::sinh(eta); }); } // namespace emprimarytrack -DECLARE_SOA_TABLE_VERSIONED(EMPrimaryTracks_000, "AOD", "EMPRIMARYTRACK", 0, //! - o2::soa::Index<>, emprimarytrack::CollisionId, - emprimarytrack::TrackId, emprimarytrack::Sign, - track::Pt, track::Eta, track::Phi, track::DcaXY, track::DcaZ, emprimarytrack::TrackBit, +DECLARE_SOA_TABLE_VERSIONED(EMPrimaryTracks_000, "AOD", "EMPRIMARYTRACK", 0, //! + o2::soa::Index<>, emprimarytrack::CollisionId, emprimarytrack::TrackId, /* emprimarytrack::Sign,*/ + emprimarytrack::PtUINT16, track::Eta, track::Phi, track::DcaXY, track::DcaZ, emprimarytrack::TrackBit, // track::TPCNClsFindable, track::TPCNClsFindableMinusFound, track::TPCNClsFindableMinusCrossedRows, track::TPCNClsShared, track::TPCChi2NCl, // track::ITSClusterSizes, track::ITSChi2NCl, track::DetectorMap, @@ -719,11 +720,12 @@ DECLARE_SOA_TABLE_VERSIONED(EMPrimaryTracks_000, "AOD", "EMPRIMARYTRACK", 0, //! // track::v001::ITSClusterMap, track::v001::ITSNCls, track::v001::ITSNClsInnerBarrel, // track::HasITS, track::HasTPC, track::HasTRD, track::HasTOF, - emprimarytrack::Signed1Pt, - emprimarytrack::P, - emprimarytrack::Px, - emprimarytrack::Py, - emprimarytrack::Pz); + // emprimarytrack::Signed1Pt, + // emprimarytrack::P, + // emprimarytrack::Px, + // emprimarytrack::Py, + // emprimarytrack::Pz + emprimarytrack::Pt); using EMPrimaryTracks = EMPrimaryTracks_000; // iterators @@ -733,6 +735,10 @@ DECLARE_SOA_TABLE(EMPrimaryTrackEMEventIds, "AOD", "PRMTRKEMEVENTID", emprimaryt // iterators using EMPrimaryTrackEMEventId = EMPrimaryTrackEMEventIds::iterator; +// DECLARE_SOA_TABLE(EMPrimaryTrackEMEventIdsTMP, "AOD", "PRMTRKEVIDTMP", track::CollisionId); // To be joined with EMPrimaryTracks in associateDileptonToEMEvent +// // iterators +// using EMPrimaryTrackEMEventIdTMP = EMPrimaryTrackEMEventIdsTMP::iterator; + // Dummy data for MC namespace emdummydata { diff --git a/PWGEM/Dilepton/TableProducer/createEMEventDilepton.cxx b/PWGEM/Dilepton/TableProducer/createEMEventDilepton.cxx index d56a024de77..a6ab3c9c4c5 100644 --- a/PWGEM/Dilepton/TableProducer/createEMEventDilepton.cxx +++ b/PWGEM/Dilepton/TableProducer/createEMEventDilepton.cxx @@ -303,7 +303,7 @@ struct AssociateDileptonToEMEvent { Preslice perCollision_pcm = aod::v0photonkf::collisionId; PresliceUnsorted perCollision_el = aod::emprimaryelectron::collisionId; PresliceUnsorted perCollision_mu = aod::emprimarymuon::collisionId; - PresliceUnsorted perCollision_track = aod::emprimarytrack::collisionId; + Preslice perCollision_track = aod::emprimarytrack::collisionId; void init(o2::framework::InitContext&) {} diff --git a/PWGEM/Dilepton/TableProducer/skimmerPrimaryTrack.cxx b/PWGEM/Dilepton/TableProducer/skimmerPrimaryTrack.cxx index 37bde849360..7e05accb739 100644 --- a/PWGEM/Dilepton/TableProducer/skimmerPrimaryTrack.cxx +++ b/PWGEM/Dilepton/TableProducer/skimmerPrimaryTrack.cxx @@ -13,7 +13,6 @@ /// \author daiki.sekihata@cern.ch #include "PWGEM/Dilepton/DataModel/dileptonTables.h" -// #include "PWGEM/Dilepton/Utils/PairUtilities.h" #include "PWGEM/Dilepton/Utils/EMTrackUtilities.h" #include "Common/Core/TableHelper.h" @@ -59,6 +58,7 @@ struct skimmerPrimaryTrack { SliceCache cache; Preslice perCol = o2::aod::track::collisionId; Produces emprimarytracks; + // Produces prmtrackeventidtmp; // Configurables Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; @@ -72,11 +72,11 @@ struct skimmerPrimaryTrack { Configurable fillQAHistogram{"fillQAHistogram", false, "flag to fill QA histograms"}; Configurable d_bz_input{"d_bz_input", -999, "bz field in kG, -999 is automatic"}; - Configurable minpt{"minpt", 0.15, "min pt for ITS-TPC track"}; - Configurable maxpt{"maxpt", 5.0, "max pt for ITS-TPC track"}; - Configurable maxeta{"maxeta", 2.0, "eta acceptance"}; - Configurable dca_xy_max{"dca_xy_max", 1.0, "max DCAxy in cm"}; - Configurable dca_z_max{"dca_z_max", 1.0, "max DCAz in cm"}; + Configurable minpt{"minpt", 0.2, "min pt for ITS-TPC track"}; + Configurable maxpt{"maxpt", 3.0, "max pt for ITS-TPC track"}; + Configurable maxeta{"maxeta", 1.4, "eta acceptance"}; + Configurable dca_xy_max{"dca_xy_max", 0.5, "max DCAxy in cm"}; + Configurable dca_z_max{"dca_z_max", 0.5, "max DCAz in cm"}; // Configurable min_ncluster_tpc{"min_ncluster_tpc", 0, "min ncluster tpc"}; // Configurable mincrossedrows{"mincrossedrows", 70, "min. crossed rows"}; @@ -246,6 +246,9 @@ struct skimmerPrimaryTrack { if (std::fabs(trackParCov.getEta()) > maxeta || trackParCov.getPt() < minpt || maxpt < trackParCov.getPt()) { return false; } + if (trackParCov.getPt() > 5.f) { + return false; + } return true; } @@ -311,7 +314,8 @@ struct skimmerPrimaryTrack { trackBit |= static_cast(RefTrackBit::kFracSharedTPC07); } - emprimarytracks(collision.globalIndex(), track.globalIndex(), track.sign(), pt, eta, phi, dcaXY, dcaZ, trackBit); + emprimarytracks(collision.globalIndex(), track.globalIndex(), /*track.sign(),*/ static_cast(pt * 1e+4), eta, phi, dcaXY, dcaZ, trackBit); + // prmtrackeventidtmp(collision.globalIndex()); stored_trackIds.emplace_back(std::pair{collision.globalIndex(), track.globalIndex()}); diff --git a/PWGEM/PhotonMeson/TableProducer/createEMEventPhoton.cxx b/PWGEM/PhotonMeson/TableProducer/createEMEventPhoton.cxx index 9a6d3be2734..871bd62f35d 100644 --- a/PWGEM/PhotonMeson/TableProducer/createEMEventPhoton.cxx +++ b/PWGEM/PhotonMeson/TableProducer/createEMEventPhoton.cxx @@ -341,7 +341,7 @@ struct AssociatePhotonToEMEvent { PresliceUnsorted perCollisionEl = aod::emprimaryelectron::collisionId; Preslice perCollisionPHOS = aod::skimmedcluster::collisionId; Preslice perCollisionEMC = aod::skimmedcluster::collisionId; - PresliceUnsorted perCollisionTrack = aod::emprimarytrack::collisionId; + Preslice perCollision_track = aod::emprimarytrack::collisionId; void init(o2::framework::InitContext&) {} @@ -370,11 +370,6 @@ struct AssociatePhotonToEMEvent { fillEventId(collisions, tracks, prmeleventid, perCollisionEl); } - void processChargedTrack(aod::EMEvents const& collisions, aod::EMPrimaryTracks const& tracks) - { - fillEventId(collisions, tracks, prmtrackeventid, perCollisionTrack); - } - void processPHOS(aod::EMEvents const& collisions, aod::PHOSClusters const& photons) { fillEventId(collisions, photons, phoseventid, perCollisionPHOS); @@ -385,12 +380,18 @@ struct AssociatePhotonToEMEvent { fillEventId(collisions, photons, emceventid, perCollisionEMC); } + void processChargedTrack(aod::EMEvents const& collisions, aod::EMPrimaryTracks const& tracks) + { + fillEventId(collisions, tracks, prmtrackeventid, perCollision_track); + } + void processDummy(aod::EMEvents const&) {} PROCESS_SWITCH(AssociatePhotonToEMEvent, processPCM, "process pcm-event indexing", false); PROCESS_SWITCH(AssociatePhotonToEMEvent, processElectronFromDalitz, "process dalitzee-event indexing", false); PROCESS_SWITCH(AssociatePhotonToEMEvent, processPHOS, "process phos-event indexing", false); PROCESS_SWITCH(AssociatePhotonToEMEvent, processEMC, "process emc-event indexing", false); + PROCESS_SWITCH(AssociatePhotonToEMEvent, processChargedTrack, "process indexing for charged tracks", false); PROCESS_SWITCH(AssociatePhotonToEMEvent, processDummy, "process dummy", true); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 93c3a1eb244be75ee7a6900a960bdfc612a650ee Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Sun, 27 Jul 2025 13:56:47 +0200 Subject: [PATCH 089/345] [PWGEM/Dilepton] update treeCreatorElectronMLDDA.cxx (#12268) --- .../treeCreatorElectronMLDDA.cxx | 63 ++++++++++--------- 1 file changed, 33 insertions(+), 30 deletions(-) diff --git a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx index 31207b2acbd..0a5527d1428 100644 --- a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx +++ b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx @@ -201,6 +201,7 @@ struct TreeCreatorElectronMLDDA { Configurable cfg_min_dcaxy_v0leg{"cfg_min_dcaxy_v0leg", 0.1, "min dca XY to PV for v0 legs in cm"}; Configurable cfg_includeITSsa{"cfg_includeITSsa", false, "Flag to include ITSsa tracks"}; Configurable cfg_max_pt_itssa{"cfg_max_pt_itssa", 0.15, "mix pt for ITSsa track"}; + Configurable cfg_min_qt_strangeness{"cfg_min_qt_strangeness", 0.015, "min qt for Lambda and K0S"}; Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -5, "min n sigma e in TPC"}; Configurable cfg_max_TPCNsigmaEl{"cfg_max_TPCNsigmaEl", +5, "max n sigma e in TPC"}; @@ -761,43 +762,45 @@ struct TreeCreatorElectronMLDDA { registry.fill(HIST("V0/hCosPA"), v0.v0cosPA()); registry.fill(HIST("V0/hAP"), v0.alpha(), v0.qtarm()); - if (!(v0cuts.cfg_min_mass_lambda_veto < v0.mLambda() && v0.mLambda() < v0cuts.cfg_max_mass_lambda_veto) && !(v0cuts.cfg_min_mass_lambda_veto < v0.mAntiLambda() && v0.mAntiLambda() < v0cuts.cfg_max_mass_lambda_veto)) { - if (isPionTight(pos) && isPion(neg)) { - registry.fill(HIST("V0/hMassK0Short"), v0.mK0Short()); - if (v0cuts.cfg_min_mass_k0s < v0.mK0Short() && v0.mK0Short() < v0cuts.cfg_max_mass_k0s) { - registry.fill(HIST("V0/hTPCdEdx_P_Pi"), neg.tpcInnerParam(), neg.tpcSignal()); - registry.fill(HIST("V0/hTOFbeta_P_Pi"), neg.tpcInnerParam(), neg.beta()); - fillTrackTable(collision, neg, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kPion)); + if (v0cuts.cfg_min_qt_strangeness < v0.qtarm()) { + if (!(v0cuts.cfg_min_mass_lambda_veto < v0.mLambda() && v0.mLambda() < v0cuts.cfg_max_mass_lambda_veto) && !(v0cuts.cfg_min_mass_lambda_veto < v0.mAntiLambda() && v0.mAntiLambda() < v0cuts.cfg_max_mass_lambda_veto)) { + if (isPionTight(pos) && isPion(neg)) { + registry.fill(HIST("V0/hMassK0Short"), v0.mK0Short()); + if (v0cuts.cfg_min_mass_k0s < v0.mK0Short() && v0.mK0Short() < v0cuts.cfg_max_mass_k0s) { + registry.fill(HIST("V0/hTPCdEdx_P_Pi"), neg.tpcInnerParam(), neg.tpcSignal()); + registry.fill(HIST("V0/hTOFbeta_P_Pi"), neg.tpcInnerParam(), neg.beta()); + fillTrackTable(collision, neg, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kPion)); + } } - } - if (isPion(pos) && isPionTight(neg)) { - registry.fill(HIST("V0/hMassK0Short"), v0.mK0Short()); - if (v0cuts.cfg_min_mass_k0s < v0.mK0Short() && v0.mK0Short() < v0cuts.cfg_max_mass_k0s) { - registry.fill(HIST("V0/hTPCdEdx_P_Pi"), pos.tpcInnerParam(), pos.tpcSignal()); - registry.fill(HIST("V0/hTOFbeta_P_Pi"), pos.tpcInnerParam(), pos.beta()); - fillTrackTable(collision, pos, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kPion)); + if (isPion(pos) && isPionTight(neg)) { + registry.fill(HIST("V0/hMassK0Short"), v0.mK0Short()); + if (v0cuts.cfg_min_mass_k0s < v0.mK0Short() && v0.mK0Short() < v0cuts.cfg_max_mass_k0s) { + registry.fill(HIST("V0/hTPCdEdx_P_Pi"), pos.tpcInnerParam(), pos.tpcSignal()); + registry.fill(HIST("V0/hTOFbeta_P_Pi"), pos.tpcInnerParam(), pos.beta()); + fillTrackTable(collision, pos, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kPion)); + } } } - } - if (!(v0cuts.cfg_min_mass_k0s_veto < v0.mK0Short() && v0.mK0Short() < v0cuts.cfg_max_mass_k0s_veto)) { - if (isProton(pos) && isPionTight(neg)) { - registry.fill(HIST("V0/hMassLambda"), v0.mLambda()); - if (v0cuts.cfg_min_mass_lambda < v0.mLambda() && v0.mLambda() < v0cuts.cfg_max_mass_lambda) { - fillTrackTable(collision, pos, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kProton)); - registry.fill(HIST("V0/hTPCdEdx_P_Pr"), pos.tpcInnerParam(), pos.tpcSignal()); - registry.fill(HIST("V0/hTOFbeta_P_Pr"), pos.tpcInnerParam(), pos.beta()); + if (!(v0cuts.cfg_min_mass_k0s_veto < v0.mK0Short() && v0.mK0Short() < v0cuts.cfg_max_mass_k0s_veto)) { + if (isProton(pos) && isPionTight(neg)) { + registry.fill(HIST("V0/hMassLambda"), v0.mLambda()); + if (v0cuts.cfg_min_mass_lambda < v0.mLambda() && v0.mLambda() < v0cuts.cfg_max_mass_lambda) { + fillTrackTable(collision, pos, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kProton)); + registry.fill(HIST("V0/hTPCdEdx_P_Pr"), pos.tpcInnerParam(), pos.tpcSignal()); + registry.fill(HIST("V0/hTOFbeta_P_Pr"), pos.tpcInnerParam(), pos.beta()); + } } - } - if (isPionTight(pos) && isProton(neg)) { - registry.fill(HIST("V0/hMassAntiLambda"), v0.mAntiLambda()); - if (v0cuts.cfg_min_mass_lambda < v0.mAntiLambda() && v0.mAntiLambda() < v0cuts.cfg_max_mass_lambda) { - fillTrackTable(collision, neg, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kProton)); - registry.fill(HIST("V0/hTPCdEdx_P_Pr"), neg.tpcInnerParam(), neg.tpcSignal()); - registry.fill(HIST("V0/hTOFbeta_P_Pr"), neg.tpcInnerParam(), neg.beta()); + if (isPionTight(pos) && isProton(neg)) { + registry.fill(HIST("V0/hMassAntiLambda"), v0.mAntiLambda()); + if (v0cuts.cfg_min_mass_lambda < v0.mAntiLambda() && v0.mAntiLambda() < v0cuts.cfg_max_mass_lambda) { + fillTrackTable(collision, neg, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kProton)); + registry.fill(HIST("V0/hTPCdEdx_P_Pr"), neg.tpcInnerParam(), neg.tpcSignal()); + registry.fill(HIST("V0/hTOFbeta_P_Pr"), neg.tpcInnerParam(), neg.beta()); + } } } - } + } // end of stangeness if (isElectronTight(pos) && isElectron(neg)) { registry.fill(HIST("V0/hMassGamma"), v0.mGamma()); From 04d0bf24b2bf3fe318e4b36098e0d7fe0d1f811e Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Sun, 27 Jul 2025 16:57:06 +0200 Subject: [PATCH 090/345] [PWGEM/Dilepton] remove unused parameters (#12273) --- PWGEM/Dilepton/Tasks/eventQC.cxx | 68 ++------------------------------ 1 file changed, 3 insertions(+), 65 deletions(-) diff --git a/PWGEM/Dilepton/Tasks/eventQC.cxx b/PWGEM/Dilepton/Tasks/eventQC.cxx index 2fc38618c2a..60ff83b2da1 100644 --- a/PWGEM/Dilepton/Tasks/eventQC.cxx +++ b/PWGEM/Dilepton/Tasks/eventQC.cxx @@ -15,7 +15,6 @@ // Please write to: daiki.sekihata@cern.ch #include "PWGEM/PhotonMeson/DataModel/gammaTables.h" -// #include "PWGLF/DataModel/LFStrangenessTables.h" #include "Common/Core/RecoDecay.h" #include "Common/DataModel/Centrality.h" @@ -72,6 +71,8 @@ struct eventQC { Configurable cfgQvecEstimator{"cfgQvecEstimator", 0, "FT0M:0, FT0A:1, FT0C:2, BTot:3, BPos:4, BNeg:5"}; Configurable cfgCentMin{"cfgCentMin", 0, "min. centrality"}; Configurable cfgCentMax{"cfgCentMax", 999.f, "max. centrality"}; + Configurable cfgNtracksPV08Min{"cfgNtracksPV08Min", -1, "min. multNTracksPV"}; + Configurable cfgNtracksPV08Max{"cfgNtracksPV08Max", 1000000000, "max. multNTracksPV"}; ConfigurableAxis ConfPtBins{"ConfPtBins", {VARIABLE_WIDTH, 0.00, 0.05, 0.10, 0.15, 0.20, 0.25, 0.30, 0.35, 0.40, 0.45, 0.50, 0.55, 0.60, 0.65, 0.70, 0.75, 0.80, 0.85, 0.90, 0.95, 1.00, 1.10, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00, 2.50, 3.00, 3.50, 4.00, 4.50, 5.00, 6.00, 7.00, 8.00, 9.00, 10.00}, "pT bins for output histograms"}; Configurable cfgNbinsEta{"cfgNbinsEta", 20, "number of eta bins for output histograms"}; Configurable cfgNbinsPhi{"cfgNbinsPhi", 36, "number of phi bins for output histograms"}; @@ -128,36 +129,6 @@ struct eventQC { Configurable cfg_requireTOF{"cfg_requireTOF", false, "require TOF hit"}; } trackcuts; - struct : ConfigurableGroup { - std::string prefix = "v0cut_group"; - Configurable cfg_min_mass_photon{"cfg_min_mass_photon", 0.0, "min mass for photon rejection"}; - Configurable cfg_max_mass_photon{"cfg_max_mass_photon", 0.1, "max mass for photon rejection"}; - Configurable cfg_min_mass_k0s{"cfg_min_mass_k0s", 0.490, "min mass for K0S"}; - Configurable cfg_max_mass_k0s{"cfg_max_mass_k0s", 0.505, "max mass for K0S"}; - Configurable cfg_min_mass_lambda{"cfg_min_mass_lambda", 1.11, "min mass for Lambda rejection"}; - Configurable cfg_max_mass_lambda{"cfg_max_mass_lambda", 1.12, "max mass for Lambda rejection"}; - Configurable cfg_min_cospa_v0hadron{"cfg_min_cospa_v0hadron", 0.999, "min cospa for v0hadron"}; - Configurable cfg_max_pca_v0hadron{"cfg_max_pca_v0hadron", 0.5, "max distance between 2 legs for v0hadron"}; - Configurable cfg_min_radius_v0hadron{"cfg_min_radius_v0hadron", 1.0, "min rxy for v0hadron"}; - Configurable cfg_max_kfchi2{"cfg_max_kfchi2", 1e+10, "max kfchi2 for PCM"}; - Configurable cfg_min_cr2findable_ratio_tpc{"cfg_min_cr2findable_ratio_tpc", 0.8, "min. TPC Ncr/Nf ratio"}; - Configurable cfg_max_frac_shared_clusters_tpc{"cfg_max_frac_shared_clusters_tpc", 999.f, "max fraction of shared clusters in TPC"}; - Configurable cfg_min_ncrossedrows_tpc{"cfg_min_ncrossedrows_tpc", 40, "min ncrossed rows"}; - Configurable cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 0, "min ncluster tpc"}; - Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; - Configurable cfg_max_chi2its{"cfg_max_chi2its", 5.0, "max chi2/NclsITS"}; - Configurable cfg_max_chi2tof{"cfg_max_chi2tof", 1.0, "max chi2 for TOF"}; - Configurable cfg_min_dcaxy_v0leg{"cfg_min_dcaxy_v0leg", 0.1, "min dca XY for v0 legs in cm"}; - Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -4, "min n sigma e in TPC"}; - Configurable cfg_max_TPCNsigmaEl{"cfg_max_TPCNsigmaEl", +4, "max n sigma e in TPC"}; - Configurable cfg_min_TPCNsigmaPi{"cfg_min_TPCNsigmaPi", -4, "min n sigma pi in TPC"}; - Configurable cfg_max_TPCNsigmaPi{"cfg_max_TPCNsigmaPi", +4, "max n sigma pi in TPC"}; - Configurable cfg_min_TOFNsigmaEl{"cfg_min_TOFNsigmaEl", -2, "min n sigma el in TOF"}; - Configurable cfg_max_TOFNsigmaEl{"cfg_max_TOFNsigmaEl", +2, "max n sigma el in TOF"}; - Configurable cfg_min_TOFNsigmaPi{"cfg_min_TOFNsigmaPi", -2, "min n sigma pi in TOF"}; - Configurable cfg_max_TOFNsigmaPi{"cfg_max_TOFNsigmaPi", +2, "max n sigma pi in TOF"}; - } v0cuts; - // for RCT Configurable cfgRequireGoodRCT{"cfgRequireGoodRCT", false, "require good detector flag in run condtion table"}; Configurable cfgRCTLabel{"cfgRCTLabel", "CBT_hadronPID", "select 1 [CBT, CBT_hadronPID, CBT_muon_glo] see O2Physics/Common/CCDB/RCTSelectionFlags.h"}; @@ -757,40 +728,6 @@ struct eventQC { return true; } - template - bool isSelectedV0Leg(TTrack const& track) - { - if (!track.hasTPC()) { - return false; - } - - if (track.hasITS() && track.itsChi2NCl() > v0cuts.cfg_max_chi2its) { - return false; - } - - if (track.tpcChi2NCl() > v0cuts.cfg_max_chi2tpc) { - return false; - } - - if (track.tpcNClsFound() < v0cuts.cfg_min_ncluster_tpc) { - return false; - } - - if (track.tpcNClsCrossedRows() < v0cuts.cfg_min_ncrossedrows_tpc) { - return false; - } - - if (track.tpcCrossedRowsOverFindableCls() < v0cuts.cfg_min_cr2findable_ratio_tpc) { - return false; - } - - if (track.tpcFractionSharedCls() > v0cuts.cfg_max_frac_shared_clusters_tpc) { - return false; - } - - return true; - } - template bool isSelectedEvent(TCollision const& collision) { @@ -875,6 +812,7 @@ struct eventQC { Filter collisionFilter_evsel = o2::aod::evsel::sel8 == true && (eventcuts.cfgZvtxMin < o2::aod::collision::posZ && o2::aod::collision::posZ < eventcuts.cfgZvtxMax); Filter collisionFilter_centrality = (cfgCentMin < o2::aod::cent::centFT0M && o2::aod::cent::centFT0M < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0A && o2::aod::cent::centFT0A < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0C && o2::aod::cent::centFT0C < cfgCentMax); + Filter collisionFilter_multiplicity = cfgNtracksPV08Min <= o2::aod::mult::multNTracksPV && o2::aod::mult::multNTracksPV < cfgNtracksPV08Max; Filter collisionFilter_track_occupancy = eventcuts.cfgTrackOccupancyMin <= o2::aod::evsel::trackOccupancyInTimeRange && o2::aod::evsel::trackOccupancyInTimeRange < eventcuts.cfgTrackOccupancyMax; Filter collisionFilter_ft0c_occupancy = eventcuts.cfgFT0COccupancyMin <= o2::aod::evsel::ft0cOccupancyInTimeRange && o2::aod::evsel::ft0cOccupancyInTimeRange < eventcuts.cfgFT0COccupancyMax; using FilteredMyCollisions = soa::Filtered; From cacce5e7f0c08cc3bb492ee36ea26c3deb0c71c2 Mon Sep 17 00:00:00 2001 From: Roman Lietava Date: Sun, 27 Jul 2025 20:07:45 +0200 Subject: [PATCH 091/345] [PWGLF] Omega - more mulyiplicity histos (#12274) --- PWGLF/Tasks/Strangeness/nonPromptCascade.cxx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/nonPromptCascade.cxx b/PWGLF/Tasks/Strangeness/nonPromptCascade.cxx index 79e8ad6f4e0..488e5815ce0 100644 --- a/PWGLF/Tasks/Strangeness/nonPromptCascade.cxx +++ b/PWGLF/Tasks/Strangeness/nonPromptCascade.cxx @@ -247,15 +247,18 @@ struct NonPromptCascadeTask { std::vector ptBinning = {0.4, 0.8, 1.2, 1.6, 2.0, 2.4, 2.8, 3.2, 3.6, 4.0, 4.4, 4.8, 5.2, 5.6, 6.0}; // AxisSpec ptAxis = {ptBinning, "#it{p}_{T} (GeV/#it{c})"}; AxisSpec centAxis = {101, 0., 101., "Centrality"}; - AxisSpec centAxisZoom = {100, 0., 1., "Centrality"}; - AxisSpec multAxis = {10000, 0, 10000, "Multiplicity"}; - AxisSpec multAxisZoom = {1000, 0, 1000, "Multiplicity"}; + AxisSpec centAxisZoom = {100, 0., 10., "Centrality"}; + AxisSpec multAxis = {10000, 0, 10000, "Multiplicity FT0M"}; + AxisSpec multAxisZoom = {7000, 3000, 10000, "Multiplicity FT0M"}; + AxisSpec nTracksAxis = {100, 0., 100., "NTracksGlobal"}; std::array cutsNames{"# candidates", "hasTOF", "nClusTPC", "nSigmaTPCbach", "nSigmaTPCprotontrack", "nSigmaTPCpiontrack", "cosPA"}; auto cutsOmega{std::get>(mRegistry.add("h_PIDcutsOmega", ";;Invariant mass (GeV/#it{c}^{2})", HistType::kTH2D, {{cutsNames.size(), -0.5, -0.5 + cutsNames.size()}, {125, 1.650, 1.700}}))}; auto cutsXi{std::get>(mRegistry.add("h_PIDcutsXi", ";;Invariant mass (GeV/#it{c}^{2})", HistType::kTH2D, {{6, -0.5, 5.5}, {125, 1.296, 1.346}}))}; mRegistry.add("hMultVsCent", "hMultVsCent", HistType::kTH2F, {centAxis, multAxis}); mRegistry.add("hMultVsCentZoom", "hMultVsCentZoom", HistType::kTH2F, {centAxisZoom, multAxisZoom}); + mRegistry.add("hNTracksVsCent", "hNTracksVsCent", HistType::kTH2F, {centAxis, nTracksAxis}); + mRegistry.add("hNTracksVsCentZoom", "hNTracksVsCentZoom", HistType::kTH2F, {centAxisZoom, nTracksAxis}); for (size_t iBin{0}; iBin < cutsNames.size(); ++iBin) { cutsOmega->GetYaxis()->SetBinLabel(iBin + 1, cutsNames[iBin].c_str()); @@ -323,11 +326,13 @@ struct NonPromptCascadeTask { } void fillMultHistos(const auto& collisions) { - std::cout << "Filling mult histos" << std::endl; + // std::cout << "Filling mult histos" << std::endl; for (const auto& coll : collisions) { - // std::cout << coll.centFT0M() << " mult, cent " << coll.multFT0M() << std::endl; + // std::cout << coll.centFT0M() << " mult, cent " << coll.multNTracksGlobal() << std::endl; mRegistry.fill(HIST("hMultVsCent"), coll.centFT0M(), coll.multFT0M()); mRegistry.fill(HIST("hMultVsCentZoom"), coll.centFT0M(), coll.multFT0M()); + mRegistry.fill(HIST("hNTracksVsCent"), coll.centFT0M(), (float)coll.multNTracksGlobal()); + mRegistry.fill(HIST("hNTracksVsCentZoom"), coll.centFT0M(), coll.multNTracksGlobal()); } }; From 63eb8efe0d09dce049b3501b1a3ff433c038bb6b Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Sun, 27 Jul 2025 22:08:26 +0200 Subject: [PATCH 092/345] [PWGEM/Dilepton] add dphiPosition (#12275) --- PWGEM/Dilepton/Core/Dilepton.h | 18 ++++++- PWGEM/Dilepton/Core/DileptonMC.h | 13 ++++- PWGEM/Dilepton/Core/SingleTrackQCMC.h | 4 ++ PWGEM/Dilepton/Tasks/prefilterDielectron.cxx | 56 ++++++++++++++++++++ 4 files changed, 87 insertions(+), 4 deletions(-) diff --git a/PWGEM/Dilepton/Core/Dilepton.h b/PWGEM/Dilepton/Core/Dilepton.h index d35cb0cfdac..4cfb818e2ce 100644 --- a/PWGEM/Dilepton/Core/Dilepton.h +++ b/PWGEM/Dilepton/Core/Dilepton.h @@ -214,6 +214,7 @@ struct Dilepton { Configurable cfg_max_its_cluster_size{"cfg_max_its_cluster_size", 16.f, "max ITS cluster size"}; Configurable cfg_min_rel_diff_pin{"cfg_min_rel_diff_pin", -1e+10, "min rel. diff. between pin and ppv"}; Configurable cfg_max_rel_diff_pin{"cfg_max_rel_diff_pin", +1e+10, "max rel. diff. between pin and ppv"}; + Configurable cfgRefR{"cfgRefR", 1.2, "reference R (in m) for extrapolation"}; // https://cds.cern.ch/record/1419204 Configurable cfg_pid_scheme{"cfg_pid_scheme", static_cast(DielectronCut::PIDSchemes::kTPChadrejORTOFreq), "pid scheme [kTOFreq : 0, kTPChadrej : 1, kTPChadrejORTOFreq : 2, kTPConly : 3, kTOFif : 4, kPIDML : 5, kTPChadrejORTOFreq_woTOFif : 6]"}; Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -2.0, "min. TPC n sigma for electron inclusion"}; @@ -463,7 +464,7 @@ struct Dilepton { o2::base::Propagator::initFieldFromGRP(grpo); // Fetch magnetic field from ccdb for current collision d_bz = grpo->getNominalL3Field(); - LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; + LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kG"; } else { grpmag = ccdb->getForTimeStamp(grpmagPath, run3grp_timestamp); if (!grpmag) { @@ -472,7 +473,7 @@ struct Dilepton { o2::base::Propagator::initFieldFromGRP(grpmag); // Fetch magnetic field from ccdb for current collision d_bz = std::lround(5.f * grpmag->getL3Current() / 30000.f); - LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; + LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kG"; } mRunNumber = collision.runNumber(); @@ -548,6 +549,8 @@ struct Dilepton { if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonAnalysisType::kQC)) { fRegistry.add("Pair/same/uls/hs", "dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_dca}, true); fRegistry.add("Pair/same/uls/hDeltaEtaDeltaPhi", "#Delta#eta-#Delta#varphi between 2 tracks;#Delta#varphi (rad.);#Delta#eta;", kTH2D, {{180, -M_PI, M_PI}, {400, -2, +2}}, true); + fRegistry.add("Pair/same/uls/hDeltaEtaDeltaPhiPosition", "#Delta#eta-#Delta#varphi^{*} between 2 tracks;#Delta#varphi^{*} (rad.);#Delta#eta;", kTH2D, {{180, -M_PI, M_PI}, {400, -2, +2}}, true); + if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { fRegistry.add("Pair/same/uls/hMvsPhiV", "m_{ee} vs. #varphi_{V};#varphi_{V} (rad.);m_{ee} (GeV/c^{2})", kTH2D, {{90, 0, M_PI}, {100, 0.0f, 1.0f}}, true); // phiv is only for dielectron fRegistry.add("Pair/same/uls/hMvsOpAng", "m_{ee} vs. angle between 2 tracks;#omega (rad.);m_{ee} (GeV/c^{2})", kTH2D, {{90, 0, M_PI}, {100, 0.0f, 1.0f}}, true); @@ -907,12 +910,21 @@ struct Dilepton { float dphi = t1.sign() * v1.Pt() > t2.sign() * v2.Pt() ? v1.Phi() - v2.Phi() : v2.Phi() - v1.Phi(); o2::math_utils::bringToPMPi(dphi); + float phiPosition1 = t1.phi() + std::asin(t1.sign() * 0.30282 * (d_bz * 0.1) * dielectroncuts.cfgRefR / (2.f * t1.pt())); + float phiPosition2 = t2.phi() + std::asin(t2.sign() * 0.30282 * (d_bz * 0.1) * dielectroncuts.cfgRefR / (2.f * t2.pt())); + + phiPosition1 = RecoDecay::constrainAngle(phiPosition1, 0, 1); // 0-2pi + phiPosition2 = RecoDecay::constrainAngle(phiPosition2, 0, 1); // 0-2pi + float dphiPosition = t1.sign() * v1.Pt() > t2.sign() * v2.Pt() ? phiPosition1 - phiPosition2 : phiPosition2 - phiPosition1; + o2::math_utils::bringToPMPi(dphiPosition); + float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(t1.px(), t1.py(), t1.pz(), t2.px(), t2.py(), t2.pz(), t1.sign(), t2.sign(), d_bz); float opAng = o2::aod::pwgem::dilepton::utils::pairutil::getOpeningAngle(t1.px(), t1.py(), t1.pz(), t2.px(), t2.py(), t2.pz()); if (t1.sign() * t2.sign() < 0) { // ULS fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hs"), v12.M(), v12.Pt(), pair_dca, weight); fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hDeltaEtaDeltaPhi"), dphi, deta, weight); + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hDeltaEtaDeltaPhiPosition"), dphiPosition, deta, weight); if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hMvsPhiV"), phiv, v12.M(), weight); fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hMvsOpAng"), opAng, v12.M(), weight); @@ -925,6 +937,7 @@ struct Dilepton { } else if (t1.sign() > 0 && t2.sign() > 0) { // LS++ fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hs"), v12.M(), v12.Pt(), pair_dca, weight); fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hDeltaEtaDeltaPhi"), dphi, deta, weight); + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hDeltaEtaDeltaPhiPosition"), dphiPosition, deta, weight); if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hMvsPhiV"), phiv, v12.M(), weight); fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hMvsOpAng"), opAng, v12.M(), weight); @@ -937,6 +950,7 @@ struct Dilepton { } else if (t1.sign() < 0 && t2.sign() < 0) { // LS-- fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hs"), v12.M(), v12.Pt(), pair_dca, weight); fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hDeltaEtaDeltaPhi"), dphi, deta, weight); + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hDeltaEtaDeltaPhiPosition"), dphiPosition, deta, weight); if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hMvsPhiV"), phiv, v12.M(), weight); fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hMvsOpAng"), opAng, v12.M(), weight); diff --git a/PWGEM/Dilepton/Core/DileptonMC.h b/PWGEM/Dilepton/Core/DileptonMC.h index 4d1ec46f2f5..e5add9f6e63 100644 --- a/PWGEM/Dilepton/Core/DileptonMC.h +++ b/PWGEM/Dilepton/Core/DileptonMC.h @@ -284,6 +284,7 @@ struct DileptonMC { Configurable cfg_max_DPhi_wrt_matchedMCHMID{"cfg_max_DPhi_wrt_matchedMCHMID", 1e+10f, "max. dphi between MFT-MCH-MID and MCH-MID"}; Configurable requireMFTHitMap{"requireMFTHitMap", false, "flag to apply MFT hit map"}; Configurable> requiredMFTDisks{"requiredMFTDisks", std::vector{0}, "hit map on MFT disks [0,1,2,3,4]. logical-OR of each double-sided disk"}; + Configurable rejectWrongMatch{"rejectWrongMatch", false, "flag to reject wrong match between MFT and MCH-MID"}; // this is only for MC study, as we don't know correct match in data. } dimuoncuts; o2::aod::rctsel::RCTFlagsChecker rctChecker; @@ -577,7 +578,7 @@ struct DileptonMC { o2::base::Propagator::initFieldFromGRP(grpo); // Fetch magnetic field from ccdb for current collision d_bz = grpo->getNominalL3Field(); - LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; + LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kG"; } else { grpmag = ccdb->getForTimeStamp(grpmagPath, run3grp_timestamp); if (!grpmag) { @@ -586,7 +587,7 @@ struct DileptonMC { o2::base::Propagator::initFieldFromGRP(grpmag); // Fetch magnetic field from ccdb for current collision d_bz = std::lround(5.f * grpmag->getL3Current() / 30000.f); - LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; + LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kG"; } mRunNumber = collision.runNumber(); @@ -836,6 +837,14 @@ struct DileptonMC { if (!o2::aod::pwgem::dilepton::utils::emtrackutil::isBestMatch(t2, cut, tracks)) { return false; } + if (dimuoncuts.rejectWrongMatch) { + if (t1.trackType() == static_cast(o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) && t1.emmcparticleId() != t1.emmftmcparticleId()) { + return false; + } + if (t2.trackType() == static_cast(o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) && t2.emmcparticleId() != t2.emmftmcparticleId()) { + return false; + } + } if (!cut.IsSelectedPair(t1, t2)) { return false; diff --git a/PWGEM/Dilepton/Core/SingleTrackQCMC.h b/PWGEM/Dilepton/Core/SingleTrackQCMC.h index 8a491159b76..ce5496388d6 100644 --- a/PWGEM/Dilepton/Core/SingleTrackQCMC.h +++ b/PWGEM/Dilepton/Core/SingleTrackQCMC.h @@ -217,6 +217,7 @@ struct SingleTrackQCMC { Configurable cfg_max_DPhi_wrt_matchedMCHMID{"cfg_max_DPhi_wrt_matchedMCHMID", 1e+10f, "max. dphi between MFT-MCH-MID and MCH-MID"}; Configurable requireMFTHitMap{"requireMFTHitMap", false, "flag to apply MFT hit map"}; Configurable> requiredMFTDisks{"requiredMFTDisks", std::vector{0}, "hit map on MFT disks [0,1,2,3,4]. logical-OR of each double-sided disk"}; + Configurable rejectWrongMatch{"rejectWrongMatch", false, "flag to reject wrong match between MFT and MCH-MID"}; // this is only for MC study, as we don't know correct match in data. } dimuoncuts; o2::aod::rctsel::RCTFlagsChecker rctChecker; @@ -820,6 +821,9 @@ struct SingleTrackQCMC { if (!o2::aod::pwgem::dilepton::utils::emtrackutil::isBestMatch(track, cut, tracks)) { continue; } + if (dimuoncuts.rejectWrongMatch && track.trackType() == static_cast(o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) && track.emmcparticleId() != track.emmftmcparticleId()) { + continue; + } } auto mcmother = mcparticles.iteratorAt(mctrack.mothersIds()[0]); diff --git a/PWGEM/Dilepton/Tasks/prefilterDielectron.cxx b/PWGEM/Dilepton/Tasks/prefilterDielectron.cxx index 75a92e03c9a..d1c15942c5e 100644 --- a/PWGEM/Dilepton/Tasks/prefilterDielectron.cxx +++ b/PWGEM/Dilepton/Tasks/prefilterDielectron.cxx @@ -129,6 +129,7 @@ struct prefilterDielectron { Configurable cfg_max_its_cluster_size{"cfg_max_its_cluster_size", 16.f, "max ITS cluster size"}; Configurable cfg_min_rel_diff_pin{"cfg_min_rel_diff_pin", -1e+10, "min rel. diff. between pin and ppv"}; Configurable cfg_max_rel_diff_pin{"cfg_max_rel_diff_pin", +1e+10, "max rel. diff. between pin and ppv"}; + Configurable cfgRefR{"cfgRefR", 1.2, "reference R (in m) for extrapolation"}; // https://cds.cern.ch/record/1419204 Configurable cfg_pid_scheme{"cfg_pid_scheme", static_cast(DielectronCut::PIDSchemes::kTPChadrejORTOFreq), "pid scheme [kTOFreq : 0, kTPChadrej : 1, kTPChadrejORTOFreq : 2, kTPConly : 3, kTOFif : 4, kPIDML : 5, kTPChadrejORTOFreq_woTOFif : 6]"}; Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -2.0, "min. TPC n sigma for electron inclusion"}; @@ -236,6 +237,7 @@ struct prefilterDielectron { fRegistry.add("Pair/before/uls/hMvsPt", "m_{ee} vs. p_{T,ee}", kTH2D, {axis_mass, axis_pair_pt}, true); fRegistry.add("Pair/before/uls/hMvsPhiV", "m_{ee} vs. #varphi_{V};#varphi_{V} (rad.);m_{ee} (GeV/c^{2})", kTH2D, {axis_phiv, {200, 0, 1}}, true); fRegistry.add("Pair/before/uls/hDeltaEtaDeltaPhi", "#Delta#eta-#Delta#varphi between 2 tracks;#Delta#varphi (rad.);#Delta#eta;", kTH2D, {{180, -M_PI, M_PI}, {200, -1, +1}}, true); + fRegistry.add("Pair/before/uls/hDeltaEtaDeltaPhiPosition", "#Delta#eta-#Delta#varphi^{*} between 2 tracks;#Delta#varphi^{*} (rad.);#Delta#eta;", kTH2D, {{180, -M_PI, M_PI}, {200, -1, +1}}, true); fRegistry.addClone("Pair/before/uls/", "Pair/before/lspp/"); fRegistry.addClone("Pair/before/uls/", "Pair/before/lsmm/"); fRegistry.addClone("Pair/before/", "Pair/after/"); @@ -382,9 +384,18 @@ struct prefilterDielectron { float dphi = pos.sign() * v1.Pt() > ele.sign() * v2.Pt() ? v1.Phi() - v2.Phi() : v2.Phi() - v1.Phi(); o2::math_utils::bringToPMPi(dphi); + float phiPosition1 = pos.phi() + std::asin(pos.sign() * 0.30282 * (d_bz * 0.1) * dielectroncuts.cfgRefR / (2.f * pos.pt())); + float phiPosition2 = ele.phi() + std::asin(ele.sign() * 0.30282 * (d_bz * 0.1) * dielectroncuts.cfgRefR / (2.f * ele.pt())); + + phiPosition1 = RecoDecay::constrainAngle(phiPosition1, 0, 1); // 0-2pi + phiPosition2 = RecoDecay::constrainAngle(phiPosition2, 0, 1); // 0-2pi + float dphiPosition = pos.sign() * v1.Pt() > ele.sign() * v2.Pt() ? phiPosition1 - phiPosition2 : phiPosition2 - phiPosition1; + o2::math_utils::bringToPMPi(dphiPosition); + fRegistry.fill(HIST("Pair/before/uls/hMvsPhiV"), phiv, v12.M()); fRegistry.fill(HIST("Pair/before/uls/hMvsPt"), v12.M(), v12.Pt()); fRegistry.fill(HIST("Pair/before/uls/hDeltaEtaDeltaPhi"), dphi, deta); + fRegistry.fill(HIST("Pair/before/uls/hDeltaEtaDeltaPhiPosition"), dphiPosition, deta); if (dielectroncuts.cfg_min_mass < v12.M() && v12.M() < dielectroncuts.cfg_max_mass) { map_pfb[pos.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kMee); @@ -416,9 +427,18 @@ struct prefilterDielectron { float dphi = pos1.sign() * v1.Pt() > pos2.sign() * v2.Pt() ? v1.Phi() - v2.Phi() : v2.Phi() - v1.Phi(); o2::math_utils::bringToPMPi(dphi); + float phiPosition1 = pos1.phi() + std::asin(pos1.sign() * 0.30282 * (d_bz * 0.1) * dielectroncuts.cfgRefR / (2.f * pos1.pt())); + float phiPosition2 = pos2.phi() + std::asin(pos2.sign() * 0.30282 * (d_bz * 0.1) * dielectroncuts.cfgRefR / (2.f * pos2.pt())); + + phiPosition1 = RecoDecay::constrainAngle(phiPosition1, 0, 1); // 0-2pi + phiPosition2 = RecoDecay::constrainAngle(phiPosition2, 0, 1); // 0-2pi + float dphiPosition = pos1.sign() * v1.Pt() > pos2.sign() * v2.Pt() ? phiPosition1 - phiPosition2 : phiPosition2 - phiPosition1; + o2::math_utils::bringToPMPi(dphiPosition); + fRegistry.fill(HIST("Pair/before/lspp/hMvsPt"), v12.M(), v12.Pt()); fRegistry.fill(HIST("Pair/before/lspp/hMvsPhiV"), phiv, v12.M()); fRegistry.fill(HIST("Pair/before/lspp/hDeltaEtaDeltaPhi"), dphi, deta); + fRegistry.fill(HIST("Pair/before/lspp/hDeltaEtaDeltaPhiPosition"), dphiPosition, deta); if (dielectroncuts.cfg_apply_detadphi_ls && std::pow(deta / dielectroncuts.cfg_min_deta_ls, 2) + std::pow(dphi / dielectroncuts.cfg_min_dphi_ls, 2) < 1.f) { map_pfb[pos1.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kSplitOrMergedTrackLS); @@ -440,9 +460,18 @@ struct prefilterDielectron { float dphi = ele1.sign() * v1.Pt() > ele2.sign() * v2.Pt() ? v1.Phi() - v2.Phi() : v2.Phi() - v1.Phi(); o2::math_utils::bringToPMPi(dphi); + float phiPosition1 = ele1.phi() + std::asin(ele1.sign() * 0.30282 * (d_bz * 0.1) * dielectroncuts.cfgRefR / (2.f * ele1.pt())); + float phiPosition2 = ele2.phi() + std::asin(ele2.sign() * 0.30282 * (d_bz * 0.1) * dielectroncuts.cfgRefR / (2.f * ele2.pt())); + + phiPosition1 = RecoDecay::constrainAngle(phiPosition1, 0, 1); // 0-2pi + phiPosition2 = RecoDecay::constrainAngle(phiPosition2, 0, 1); // 0-2pi + float dphiPosition = ele1.sign() * v1.Pt() > ele2.sign() * v2.Pt() ? phiPosition1 - phiPosition2 : phiPosition2 - phiPosition1; + o2::math_utils::bringToPMPi(dphiPosition); + fRegistry.fill(HIST("Pair/before/lsmm/hMvsPt"), v12.M(), v12.Pt()); fRegistry.fill(HIST("Pair/before/lsmm/hMvsPhiV"), phiv, v12.M()); fRegistry.fill(HIST("Pair/before/lsmm/hDeltaEtaDeltaPhi"), dphi, deta); + fRegistry.fill(HIST("Pair/before/lsmm/hDeltaEtaDeltaPhiPosition"), dphiPosition, deta); if (dielectroncuts.cfg_apply_detadphi_ls && std::pow(deta / dielectroncuts.cfg_min_deta_ls, 2) + std::pow(dphi / dielectroncuts.cfg_min_dphi_ls, 2) < 1.f) { map_pfb[ele1.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kSplitOrMergedTrackLS); @@ -487,9 +516,18 @@ struct prefilterDielectron { float dphi = pos.sign() * v1.Pt() > ele.sign() * v2.Pt() ? v1.Phi() - v2.Phi() : v2.Phi() - v1.Phi(); o2::math_utils::bringToPMPi(dphi); + float phiPosition1 = pos.phi() + std::asin(pos.sign() * 0.30282 * (d_bz * 0.1) * dielectroncuts.cfgRefR / (2.f * pos.pt())); + float phiPosition2 = ele.phi() + std::asin(ele.sign() * 0.30282 * (d_bz * 0.1) * dielectroncuts.cfgRefR / (2.f * ele.pt())); + + phiPosition1 = RecoDecay::constrainAngle(phiPosition1, 0, 1); // 0-2pi + phiPosition2 = RecoDecay::constrainAngle(phiPosition2, 0, 1); // 0-2pi + float dphiPosition = pos.sign() * v1.Pt() > ele.sign() * v2.Pt() ? phiPosition1 - phiPosition2 : phiPosition2 - phiPosition1; + o2::math_utils::bringToPMPi(dphiPosition); + fRegistry.fill(HIST("Pair/after/uls/hMvsPhiV"), phiv, v12.M()); fRegistry.fill(HIST("Pair/after/uls/hMvsPt"), v12.M(), v12.Pt()); fRegistry.fill(HIST("Pair/after/uls/hDeltaEtaDeltaPhi"), dphi, deta); + fRegistry.fill(HIST("Pair/after/uls/hDeltaEtaDeltaPhiPosition"), dphiPosition, deta); } for (auto& [pos1, pos2] : combinations(CombinationsStrictlyUpperIndexPolicy(posTracks_per_coll, posTracks_per_coll))) { // LS++ @@ -508,9 +546,18 @@ struct prefilterDielectron { float dphi = pos1.sign() * v1.Pt() > pos2.sign() * v2.Pt() ? v1.Phi() - v2.Phi() : v2.Phi() - v1.Phi(); o2::math_utils::bringToPMPi(dphi); + float phiPosition1 = pos1.phi() + std::asin(pos1.sign() * 0.30282 * (d_bz * 0.1) * dielectroncuts.cfgRefR / (2.f * pos1.pt())); + float phiPosition2 = pos2.phi() + std::asin(pos2.sign() * 0.30282 * (d_bz * 0.1) * dielectroncuts.cfgRefR / (2.f * pos2.pt())); + + phiPosition1 = RecoDecay::constrainAngle(phiPosition1, 0, 1); // 0-2pi + phiPosition2 = RecoDecay::constrainAngle(phiPosition2, 0, 1); // 0-2pi + float dphiPosition = pos1.sign() * v1.Pt() > pos2.sign() * v2.Pt() ? phiPosition1 - phiPosition2 : phiPosition2 - phiPosition1; + o2::math_utils::bringToPMPi(dphiPosition); + fRegistry.fill(HIST("Pair/after/lspp/hMvsPt"), v12.M(), v12.Pt()); fRegistry.fill(HIST("Pair/after/lspp/hMvsPhiV"), phiv, v12.M()); fRegistry.fill(HIST("Pair/after/lspp/hDeltaEtaDeltaPhi"), dphi, deta); + fRegistry.fill(HIST("Pair/after/lspp/hDeltaEtaDeltaPhiPosition"), dphiPosition, deta); } for (auto& [ele1, ele2] : combinations(CombinationsStrictlyUpperIndexPolicy(negTracks_per_coll, negTracks_per_coll))) { // LS-- @@ -529,9 +576,18 @@ struct prefilterDielectron { float dphi = ele1.sign() * v1.Pt() > ele2.sign() * v2.Pt() ? v1.Phi() - v2.Phi() : v2.Phi() - v1.Phi(); o2::math_utils::bringToPMPi(dphi); + float phiPosition1 = ele1.phi() + std::asin(ele1.sign() * 0.30282 * (d_bz * 0.1) * dielectroncuts.cfgRefR / (2.f * ele1.pt())); + float phiPosition2 = ele2.phi() + std::asin(ele2.sign() * 0.30282 * (d_bz * 0.1) * dielectroncuts.cfgRefR / (2.f * ele2.pt())); + + phiPosition1 = RecoDecay::constrainAngle(phiPosition1, 0, 1); // 0-2pi + phiPosition2 = RecoDecay::constrainAngle(phiPosition2, 0, 1); // 0-2pi + float dphiPosition = ele1.sign() * v1.Pt() > ele2.sign() * v2.Pt() ? phiPosition1 - phiPosition2 : phiPosition2 - phiPosition1; + o2::math_utils::bringToPMPi(dphiPosition); + fRegistry.fill(HIST("Pair/after/lsmm/hMvsPt"), v12.M(), v12.Pt()); fRegistry.fill(HIST("Pair/after/lsmm/hMvsPhiV"), phiv, v12.M()); fRegistry.fill(HIST("Pair/after/lsmm/hDeltaEtaDeltaPhi"), dphi, deta); + fRegistry.fill(HIST("Pair/after/lsmm/hDeltaEtaDeltaPhiPosition"), dphiPosition, deta); } } // end of collision loop From e558342b4eff3234207531ab93de4511bab4ca0e Mon Sep 17 00:00:00 2001 From: JimunLee Date: Mon, 28 Jul 2025 06:24:04 +0900 Subject: [PATCH 093/345] [PWGLF] Added the condition in event selection of KstarInOO.cxx (#12270) Co-authored-by: jimun_lee --- PWGLF/Tasks/Resonances/kstarInOO.cxx | 33 ++++++++++++++-------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index 83f233d5112..dc70ae02010 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -34,7 +34,6 @@ #include #include -#include "TRandom.h" #include #include #include @@ -102,9 +101,9 @@ struct kstarInOO { Configurable cDebugLevel{"cDebugLevel", 0, "Resolution of Debug"}; // Mixing - ConfigurableAxis cfg_bins_MixVtx{"cfg_bins_MixVtx", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"}; - ConfigurableAxis cfg_bins_MixMult{"cfg_bins_MixMult", {VARIABLE_WIDTH, 0.0f, 1.0f, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f}, "Mixing bins - z-vertex"}; - Configurable cfg_Mix_NMixedEvents{"cfg_Mix_NMixedEvents", 5, "Number of mixed events per event"}; + ConfigurableAxis cfg_bins_MixMult{"cfg_bins_Cent", {VARIABLE_WIDTH, 0.0, 1.0, 5.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 110.0}, "Binning of the centrality axis"}; + ConfigurableAxis cfg_bins_MixVtx{"cfg_bins_MixVtx", {VARIABLE_WIDTH, -10.0f, -5.f, 0.f, 5.f, 10.f}, "Mixing bins - z-vertex"}; + Configurable cfg_Mix_NMixedEvents{"cfg_Mix_NMixedEvents", 10, "Number of mixed events per event"}; // Pair Configurable cfg_MinvNBins{"cfg_MinvNBins", 300, "Number of bins for Minv axis"}; @@ -112,6 +111,7 @@ struct kstarInOO { Configurable cfg_MinvMax{"cfg_MinvMax", 1.20, "Maximum Minv value"}; // Histogram + Configurable cfg_Event_CutQA{"cfg_Event_CutsQA", false, "Enable Event QA Hists"}; Configurable cfg_Track_CutQA{"cfg_Track_CutQA", false, "Enable Track QA Hists"}; // std::vector eventSelectionBits; @@ -125,6 +125,11 @@ struct kstarInOO { const AxisSpec PIDAxis = {120, -6, 6}; const AxisSpec MinvAxis = {cfg_MinvNBins, cfg_MinvMin, cfg_MinvMax}; + if (cfg_Event_CutQA) { + OOhistos.add("hPosZ_BC", "PosZ_Bc", kTH1F, {{100, 0.0, 15.0}}); + OOhistos.add("hPosZ_AC", "PosZ_AC", kTH1F, {{100, 0.0, 15.0}}); + } + if (cfg_Track_CutQA) { OOhistos.add("h_rawpT", "h_rawpT", kTH1F, {{1000, 0.0, 10.0}}); OOhistos.add("h_rawpT_Kaon", "h_rawpT_Kaon", kTH1F, {{1000, 0.0, 10.0}}); @@ -165,8 +170,8 @@ struct kstarInOO { // For Mixed Event using BinningType = ColumnBinningPolicy; - Partition Kaon_MC = (!cfg_Track_TPCPID || (nabs(aod::pidtpc::tpcNSigmaKa) <= cfg_Track_TPCPID_nSig)); - Partition Pion_MC = (!cfg_Track_TPCPID || (nabs(aod::pidtpc::tpcNSigmaPi) <= cfg_Track_TPCPID_nSig)); + Partition Kaon_MC = nabs(aod::pidtpc::tpcNSigmaKa) <= cfg_Track_TPCPID_nSig; + Partition Pion_MC = nabs(aod::pidtpc::tpcNSigmaPi) <= cfg_Track_TPCPID_nSig; double massKa = o2::constants::physics::MassKPlus; double massPi = o2::constants::physics::MassPiMinus; @@ -181,17 +186,16 @@ struct kstarInOO { { if (!event.sel8()) return false; - + if (std::abs(event.posZ()) > cfg_Event_VtxCut) + return false; if (!event.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) return false; if (!event.selection_bit(aod::evsel::kNoSameBunchPileup)) return false; - if (!event.selection_bit(aod::evsel::kNoTimeFrameBorder)) return false; if (!event.selection_bit(aod::evsel::kNoITSROFrameBorder)) return false; - if (!event.selection_bit(aod::evsel::kNoCollInTimeRangeStandard)) return false; @@ -335,9 +339,11 @@ struct kstarInOO { if (!trackPIDKaon(trk1) || !trackPIDPion(trk2)) return {-1.0, -1.0}; - if (trk1.globalIndex() == trk2.globalIndex()) - return {-1.0, -1.0}; // For Kstar, we need to run (0,1), (1,0) pairs as well. but same id pairs are not neede. + if (trk1.globalIndex() == trk2.globalIndex()) { + // std::cout<<"This happens"< cfg_Event_VtxCut) - return; - bool INELgt0 = false; for (const auto& track : tracks) { if (std::fabs(track.eta()) < cfg_Track_MaxEta) { @@ -385,7 +388,6 @@ struct kstarInOO { return; OOhistos.fill(HIST("nEvents_MC"), 1.5); - TrackSlicing_MC(collision, tracks, collision, tracks, false); } // processSameEvents_MC @@ -410,7 +412,6 @@ struct kstarInOO { std::cout << "Processed Mixed Events: " << nEvents_MC_Mix << std::endl; } } - auto goodEv1 = eventSelection(collision1); auto goodEv2 = eventSelection(collision2); OOhistos.fill(HIST("nEvents_MC_Mix"), 0.5); From bb6213a63c964bbffb2b21789f7b6e0c6e613e91 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Mon, 28 Jul 2025 04:10:16 +0200 Subject: [PATCH 094/345] [PWGEM/Dilepton] update EMTrackCut (#12279) --- PWGEM/Dilepton/Core/DileptonHadronMPC.h | 42 ++++++----- PWGEM/Dilepton/Core/EMTrackCut.cxx | 6 +- PWGEM/Dilepton/Core/EMTrackCut.h | 75 ++++++++++--------- PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h | 40 +++++----- .../skimmerPrimaryElectronFromDalitzEE.cxx | 23 +++--- 5 files changed, 99 insertions(+), 87 deletions(-) diff --git a/PWGEM/Dilepton/Core/DileptonHadronMPC.h b/PWGEM/Dilepton/Core/DileptonHadronMPC.h index fe1c3f7c036..9a0a2a551d3 100644 --- a/PWGEM/Dilepton/Core/DileptonHadronMPC.h +++ b/PWGEM/Dilepton/Core/DileptonHadronMPC.h @@ -281,20 +281,21 @@ struct DileptonHadronMPC { std::string prefix = "trackcut_group"; Configurable cfg_min_pt_track{"cfg_min_pt_track", 0.2, "min pT for ref. track"}; Configurable cfg_max_pt_track{"cfg_max_pt_track", 3.0, "max pT for ref. track"}; - Configurable cfg_min_eta_track{"cfg_min_eta_track", -1.2, "min eta for ref. track"}; - Configurable cfg_max_eta_track{"cfg_max_eta_track", +1.2, "max eta for ref. track"}; - Configurable cfg_min_phi_track{"cfg_min_phi_track", 0., "min phi for ref. track"}; + Configurable cfg_min_eta_track{"cfg_min_eta_track", -0.8, "min eta for ref. track"}; + Configurable cfg_max_eta_track{"cfg_max_eta_track", +0.8, "max eta for ref. track"}; + Configurable cfg_min_phi_track{"cfg_min_phi_track", 0.0, "min phi for ref. track"}; Configurable cfg_max_phi_track{"cfg_max_phi_track", 6.3, "max phi for ref. track"}; - Configurable cfg_min_ncluster_its{"cfg_min_ncluster_its", 5, "min ncluster its"}; - Configurable cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 0, "min ncluster tpc"}; - Configurable cfg_min_ncrossedrows{"cfg_min_ncrossedrows", 70, "min ncrossed rows"}; - Configurable cfg_max_frac_shared_clusters_tpc{"cfg_max_frac_shared_clusters_tpc", 0.7, "max fraction of shared clusters in TPC"}; - Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; - Configurable cfg_max_chi2its{"cfg_max_chi2its", 36.0, "max chi2/NclsITS"}; Configurable cfg_max_dcaxy{"cfg_max_dcaxy", 0.5, "max dca XY for single track in cm"}; Configurable cfg_max_dcaz{"cfg_max_dcaz", 0.5, "max dca Z for single track in cm"}; - Configurable cfg_require_itsib_any{"cfg_require_itsib_any", true, "flag to require ITS ib any hits"}; - Configurable cfg_require_itsib_1st{"cfg_require_itsib_1st", false, "flag to require ITS ib 1st hit"}; + Configurable cfg_track_bits{"cfg_track_bits", 645, "required track bits"}; // default:645, loose:0, tight:778 + // Configurable cfg_min_ncluster_its{"cfg_min_ncluster_its", 5, "min ncluster its"}; + // Configurable cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 0, "min ncluster tpc"}; + // Configurable cfg_min_ncrossedrows{"cfg_min_ncrossedrows", 70, "min ncrossed rows"}; + // Configurable cfg_max_frac_shared_clusters_tpc{"cfg_max_frac_shared_clusters_tpc", 0.7, "max fraction of shared clusters in TPC"}; + // Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; + // Configurable cfg_max_chi2its{"cfg_max_chi2its", 36.0, "max chi2/NclsITS"}; + // Configurable cfg_require_itsib_any{"cfg_require_itsib_any", true, "flag to require ITS ib any hits"}; + // Configurable cfg_require_itsib_1st{"cfg_require_itsib_1st", false, "flag to require ITS ib 1st hit"}; } trackcuts; o2::aod::rctsel::RCTFlagsChecker rctChecker; @@ -682,17 +683,18 @@ struct DileptonHadronMPC { fEMTrackCut.SetTrackPtRange(trackcuts.cfg_min_pt_track, trackcuts.cfg_max_pt_track); fEMTrackCut.SetTrackEtaRange(trackcuts.cfg_min_eta_track, trackcuts.cfg_max_eta_track); fEMTrackCut.SetTrackPhiRange(trackcuts.cfg_min_phi_track, trackcuts.cfg_max_phi_track); - fEMTrackCut.SetMinNClustersTPC(trackcuts.cfg_min_ncluster_tpc); - fEMTrackCut.SetMinNCrossedRowsTPC(trackcuts.cfg_min_ncrossedrows); - fEMTrackCut.SetMinNCrossedRowsOverFindableClustersTPC(0.8); - fEMTrackCut.SetMaxFracSharedClustersTPC(trackcuts.cfg_max_frac_shared_clusters_tpc); - fEMTrackCut.SetChi2PerClusterTPC(0.0, trackcuts.cfg_max_chi2tpc); - fEMTrackCut.SetChi2PerClusterITS(0.0, trackcuts.cfg_max_chi2its); - fEMTrackCut.SetNClustersITS(trackcuts.cfg_min_ncluster_its, 7); fEMTrackCut.SetTrackMaxDcaXY(trackcuts.cfg_max_dcaxy); fEMTrackCut.SetTrackMaxDcaZ(trackcuts.cfg_max_dcaz); - fEMTrackCut.RequireITSibAny(trackcuts.cfg_require_itsib_any); - fEMTrackCut.RequireITSib1st(trackcuts.cfg_require_itsib_1st); + fEMTrackCut.SetTrackBit(trackcuts.cfg_track_bits); + // fEMTrackCut.SetMinNClustersTPC(trackcuts.cfg_min_ncluster_tpc); + // fEMTrackCut.SetMinNCrossedRowsTPC(trackcuts.cfg_min_ncrossedrows); + // fEMTrackCut.SetMinNCrossedRowsOverFindableClustersTPC(0.8); + // fEMTrackCut.SetMaxFracSharedClustersTPC(trackcuts.cfg_max_frac_shared_clusters_tpc); + // fEMTrackCut.SetChi2PerClusterTPC(0.0, trackcuts.cfg_max_chi2tpc); + // fEMTrackCut.SetChi2PerClusterITS(0.0, trackcuts.cfg_max_chi2its); + // fEMTrackCut.SetNClustersITS(trackcuts.cfg_min_ncluster_its, 7); + // fEMTrackCut.RequireITSibAny(trackcuts.cfg_require_itsib_any); + // fEMTrackCut.RequireITSib1st(trackcuts.cfg_require_itsib_1st); } template diff --git a/PWGEM/Dilepton/Core/EMTrackCut.cxx b/PWGEM/Dilepton/Core/EMTrackCut.cxx index a875a644ce8..2ea7934a30b 100644 --- a/PWGEM/Dilepton/Core/EMTrackCut.cxx +++ b/PWGEM/Dilepton/Core/EMTrackCut.cxx @@ -112,8 +112,8 @@ void EMTrackCut::RequireITSib1st(bool flag) LOG(info) << "EMTrack Cut, require ITS ib 1st: " << mRequireITSib1st; } -void EMTrackCut::SetTrackBits(uint16_t bits) +void EMTrackCut::SetTrackBit(uint16_t bit) { - mTrackBits = bits; - LOG(info) << "EMTrack Cut, require track bits: " << mTrackBits; + mTrackBit = bit; + LOG(info) << "EMTrack Cut, require track bits: " << mTrackBit; } diff --git a/PWGEM/Dilepton/Core/EMTrackCut.h b/PWGEM/Dilepton/Core/EMTrackCut.h index 0df094c8ff1..a5d62b45ac0 100644 --- a/PWGEM/Dilepton/Core/EMTrackCut.h +++ b/PWGEM/Dilepton/Core/EMTrackCut.h @@ -47,14 +47,14 @@ class EMTrackCut : public TNamed kTrackPhiRange, kDCAxy, kDCAz, - kTPCNCls, - kTPCCrossedRows, - kTPCCrossedRowsOverNCls, - kTPCFracSharedClusters, - kTPCChi2NDF, - kITSNCls, - kITSChi2NDF, - kTrackBits, + // kTPCNCls, + // kTPCCrossedRows, + // kTPCCrossedRowsOverNCls, + // kTPCFracSharedClusters, + // kTPCChi2NDF, + // kITSNCls, + // kITSChi2NDF, + kTrackBit, kNCuts }; @@ -81,7 +81,7 @@ class EMTrackCut : public TNamed if (!IsSelectedTrack(track, EMTrackCuts::kDCAz)) { return false; } - if (!IsSelectedTrack(track, EMTrackCuts::kTrackBits)) { + if (!IsSelectedTrack(track, EMTrackCuts::kTrackBit)) { return false; } @@ -146,29 +146,36 @@ class EMTrackCut : public TNamed case EMTrackCuts::kDCAz: return std::fabs(track.dcaZ()) < mMaxDcaZ; - case EMTrackCuts::kTrackBits: - return true; - - // case EMTrackCuts::kTPCNCls: - // return track.tpcNClsFound() >= mMinNClustersTPC; - // - // case EMTrackCuts::kTPCCrossedRows: - // return track.tpcNClsCrossedRows() >= mMinNCrossedRowsTPC; - // - // case EMTrackCuts::kTPCCrossedRowsOverNCls: - // return track.tpcCrossedRowsOverFindableCls() > mMinNCrossedRowsOverFindableClustersTPC; - // - // case EMTrackCuts::kTPCFracSharedClusters: - // return track.tpcFractionSharedCls() < mMaxFracSharedClustersTPC; - // - // case EMTrackCuts::kTPCChi2NDF: - // return mMinChi2PerClusterTPC < track.tpcChi2NCl() && track.tpcChi2NCl() < mMaxChi2PerClusterTPC; - // - // case EMTrackCuts::kITSNCls: - // return mMinNClustersITS <= track.itsNCls() && track.itsNCls() <= mMaxNClustersITS; - // - // case EMTrackCuts::kITSChi2NDF: - // return mMinChi2PerClusterITS < track.itsChi2NCl() && track.itsChi2NCl() < mMaxChi2PerClusterITS; + case EMTrackCuts::kTrackBit: { + // for (int i = 0; i < 10; i++) { + // if ((mTrackBit & (1 << i)) > 0 && !((track.trackBit() & (1 << i)) > 0)) { + // return false; + // } + // } + // return true; + return (track.trackBit() & mTrackBit) >= mTrackBit; + } + + // case EMTrackCuts::kTPCNCls: + // return track.tpcNClsFound() >= mMinNClustersTPC; + + // case EMTrackCuts::kTPCCrossedRows: + // return track.tpcNClsCrossedRows() >= mMinNCrossedRowsTPC; + + // case EMTrackCuts::kTPCCrossedRowsOverNCls: + // return track.tpcCrossedRowsOverFindableCls() > mMinNCrossedRowsOverFindableClustersTPC; + + // case EMTrackCuts::kTPCFracSharedClusters: + // return track.tpcFractionSharedCls() < mMaxFracSharedClustersTPC; + + // case EMTrackCuts::kTPCChi2NDF: + // return mMinChi2PerClusterTPC < track.tpcChi2NCl() && track.tpcChi2NCl() < mMaxChi2PerClusterTPC; + + // case EMTrackCuts::kITSNCls: + // return mMinNClustersITS <= track.itsNCls() && track.itsNCls() <= mMaxNClustersITS; + + // case EMTrackCuts::kITSChi2NDF: + // return mMinChi2PerClusterITS < track.itsChi2NCl() && track.itsChi2NCl() < mMaxChi2PerClusterITS; default: return false; @@ -193,7 +200,7 @@ class EMTrackCut : public TNamed void SetTrackMaxDcaXYPtDep(std::function ptDepCut); void RequireITSibAny(bool flag); void RequireITSib1st(bool flag); - void SetTrackBits(uint16_t bits); + void SetTrackBit(uint16_t bits); private: static const std::pair> its_ib_any_Requirement; @@ -214,7 +221,7 @@ class EMTrackCut : public TNamed float mMinChi2PerClusterITS{0.f}, mMaxChi2PerClusterITS{1e10f}; // max its fit chi2 per ITS cluster bool mRequireITSibAny{true}; bool mRequireITSib1st{false}; - uint16_t mTrackBits{0}; + uint16_t mTrackBit{0}; float mMaxDcaXY{1.0f}; // max dca in xy plane float mMaxDcaZ{1.0f}; // max dca in z direction diff --git a/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h b/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h index 7ceb009cbd8..a0811629c32 100644 --- a/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h +++ b/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h @@ -209,16 +209,17 @@ struct DiphotonHadronMPC { Configurable cfg_max_eta_track{"cfg_max_eta_track", +0.8, "max eta for ref. track"}; Configurable cfg_min_phi_track{"cfg_min_phi_track", 0.0, "min phi for ref. track"}; Configurable cfg_max_phi_track{"cfg_max_phi_track", 6.3, "max phi for ref. track"}; - Configurable cfg_min_ncluster_its{"cfg_min_ncluster_its", 5, "min ncluster its"}; - Configurable cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 0, "min ncluster tpc"}; - Configurable cfg_min_ncrossedrows{"cfg_min_ncrossedrows", 70, "min ncrossed rows"}; - Configurable cfg_max_frac_shared_clusters_tpc{"cfg_max_frac_shared_clusters_tpc", 0.7, "max fraction of shared clusters in TPC"}; - Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; - Configurable cfg_max_chi2its{"cfg_max_chi2its", 36.0, "max chi2/NclsITS"}; - Configurable cfg_max_dcaxy{"cfg_max_dcaxy", 1.0, "max dca XY for single track in cm"}; - Configurable cfg_max_dcaz{"cfg_max_dcaz", 1.0, "max dca Z for single track in cm"}; - Configurable cfg_require_itsib_any{"cfg_require_itsib_any", true, "flag to require ITS ib any hits"}; - Configurable cfg_require_itsib_1st{"cfg_require_itsib_1st", false, "flag to require ITS ib 1st hit"}; + Configurable cfg_max_dcaxy{"cfg_max_dcaxy", 0.5, "max dca XY for single track in cm"}; + Configurable cfg_max_dcaz{"cfg_max_dcaz", 0.5, "max dca Z for single track in cm"}; + Configurable cfg_track_bits{"cfg_track_bits", 645, "required track bits"}; // default:645, loose:0, tight:778 + // Configurable cfg_min_ncluster_its{"cfg_min_ncluster_its", 5, "min ncluster its"}; + // Configurable cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 0, "min ncluster tpc"}; + // Configurable cfg_min_ncrossedrows{"cfg_min_ncrossedrows", 70, "min ncrossed rows"}; + // Configurable cfg_max_frac_shared_clusters_tpc{"cfg_max_frac_shared_clusters_tpc", 0.7, "max fraction of shared clusters in TPC"}; + // Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; + // Configurable cfg_max_chi2its{"cfg_max_chi2its", 36.0, "max chi2/NclsITS"}; + // Configurable cfg_require_itsib_any{"cfg_require_itsib_any", true, "flag to require ITS ib any hits"}; + // Configurable cfg_require_itsib_1st{"cfg_require_itsib_1st", false, "flag to require ITS ib 1st hit"}; } trackcuts; o2::aod::rctsel::RCTFlagsChecker rctChecker; @@ -478,17 +479,18 @@ struct DiphotonHadronMPC { fEMTrackCut.SetTrackPtRange(trackcuts.cfg_min_pt_track, trackcuts.cfg_max_pt_track); fEMTrackCut.SetTrackEtaRange(trackcuts.cfg_min_eta_track, trackcuts.cfg_max_eta_track); fEMTrackCut.SetTrackPhiRange(trackcuts.cfg_min_phi_track, trackcuts.cfg_max_phi_track); - fEMTrackCut.SetMinNClustersTPC(trackcuts.cfg_min_ncluster_tpc); - fEMTrackCut.SetMinNCrossedRowsTPC(trackcuts.cfg_min_ncrossedrows); - fEMTrackCut.SetMinNCrossedRowsOverFindableClustersTPC(0.8); - fEMTrackCut.SetMaxFracSharedClustersTPC(trackcuts.cfg_max_frac_shared_clusters_tpc); - fEMTrackCut.SetChi2PerClusterTPC(0.0, trackcuts.cfg_max_chi2tpc); - fEMTrackCut.SetChi2PerClusterITS(0.0, trackcuts.cfg_max_chi2its); - fEMTrackCut.SetNClustersITS(trackcuts.cfg_min_ncluster_its, 7); fEMTrackCut.SetTrackMaxDcaXY(trackcuts.cfg_max_dcaxy); fEMTrackCut.SetTrackMaxDcaZ(trackcuts.cfg_max_dcaz); - fEMTrackCut.RequireITSibAny(trackcuts.cfg_require_itsib_any); - fEMTrackCut.RequireITSib1st(trackcuts.cfg_require_itsib_1st); + fEMTrackCut.SetTrackBit(trackcuts.cfg_track_bits); + // fEMTrackCut.SetMinNClustersTPC(trackcuts.cfg_min_ncluster_tpc); + // fEMTrackCut.SetMinNCrossedRowsTPC(trackcuts.cfg_min_ncrossedrows); + // fEMTrackCut.SetMinNCrossedRowsOverFindableClustersTPC(0.8); + // fEMTrackCut.SetMaxFracSharedClustersTPC(trackcuts.cfg_max_frac_shared_clusters_tpc); + // fEMTrackCut.SetChi2PerClusterTPC(0.0, trackcuts.cfg_max_chi2tpc); + // fEMTrackCut.SetChi2PerClusterITS(0.0, trackcuts.cfg_max_chi2its); + // fEMTrackCut.SetNClustersITS(trackcuts.cfg_min_ncluster_its, 7); + // fEMTrackCut.RequireITSibAny(trackcuts.cfg_require_itsib_any); + // fEMTrackCut.RequireITSib1st(trackcuts.cfg_require_itsib_1st); } SliceCache cache; diff --git a/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryElectronFromDalitzEE.cxx b/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryElectronFromDalitzEE.cxx index bdd24cbfd90..b773c43cea6 100644 --- a/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryElectronFromDalitzEE.cxx +++ b/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryElectronFromDalitzEE.cxx @@ -42,7 +42,8 @@ using namespace o2::framework::expressions; using namespace o2::constants::physics; using namespace o2::pwgem::photonmeson; -using MyCollisions = soa::Join; +// using MyCollisions = soa::Join; +using MyCollisions = soa::Join; using MyCollisionsWithSWT = soa::Join; using MyCollisionsMC = soa::Join; @@ -71,7 +72,7 @@ struct skimmerPrimaryElectronFromDalitzEE { Configurable min_ncluster_its{"min_ncluster_its", 4, "min ncluster its"}; Configurable min_ncluster_itsib{"min_ncluster_itsib", 1, "min ncluster itsib"}; Configurable maxchi2tpc{"maxchi2tpc", 5.0, "max. chi2/NclsTPC"}; - Configurable maxchi2its{"maxchi2its", 6.0, "max. chi2/NclsITS"}; + Configurable maxchi2its{"maxchi2its", 36.0, "max. chi2/NclsITS"}; Configurable minpt{"minpt", 0.05, "min pt for ITS-TPC track"}; Configurable maxeta{"maxeta", 2.0, "max eta acceptance"}; Configurable dca_xy_max{"dca_xy_max", 1, "max DCAxy in cm"}; @@ -444,9 +445,9 @@ struct skimmerPrimaryElectronFromDalitzEE { continue; } - if (collision.ngpcm() < 1) { - continue; - } + // if (collision.ngpcm() < 1) { + // continue; + // } auto posTracks_per_coll = posTracks->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache); auto negTracks_per_coll = negTracks->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache); @@ -474,9 +475,9 @@ struct skimmerPrimaryElectronFromDalitzEE { continue; } - if (collision.ngpcm() < 1) { - continue; - } + // if (collision.ngpcm() < 1) { + // continue; + // } if (collision.swtaliastmp_raw() == 0) { continue; @@ -515,9 +516,9 @@ struct skimmerPrimaryElectronFromDalitzEE { auto bc = collision.template foundBC_as(); initCCDB(bc); - if (collision.ngpcm() < 1) { - continue; - } + // if (collision.ngpcm() < 1) { + // continue; + // } auto posTracks_per_coll = posTracksMC->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache); auto negTracks_per_coll = negTracksMC->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache); From 30ca7e26ae0ada0296f6a9bcac99ea5c12285e1a Mon Sep 17 00:00:00 2001 From: sangwoo <141385263+sangwoo184@users.noreply.github.com> Date: Mon, 28 Jul 2025 16:05:00 +0900 Subject: [PATCH 095/345] [PWGLF] Added eventmixing histogram (#12280) --- PWGLF/Tasks/Resonances/f0980pbpbanalysis.cxx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/PWGLF/Tasks/Resonances/f0980pbpbanalysis.cxx b/PWGLF/Tasks/Resonances/f0980pbpbanalysis.cxx index a28228fc6e8..96abd0ca43a 100644 --- a/PWGLF/Tasks/Resonances/f0980pbpbanalysis.cxx +++ b/PWGLF/Tasks/Resonances/f0980pbpbanalysis.cxx @@ -548,11 +548,11 @@ struct F0980pbpbanalysis { if (trk1.sign() * trk2.sign() < 0) { histos.fill(HIST("hInvMass_f0980_MixedUS_EPA"), recoPtl.M(), recoPtl.Pt(), centrality, relPhiMix); - } else if (trk1.sign() > 0 && trk2.sign() > 0) { - histos.fill(HIST("hInvMass_f0980_MixedLSpp_EPA"), recoPtl.M(), recoPtl.Pt(), centrality, relPhiMix); - } else if (trk1.sign() < 0 && trk2.sign() < 0) { - histos.fill(HIST("hInvMass_f0980_MixedLSmm_EPA"), recoPtl.M(), recoPtl.Pt(), centrality, relPhiMix); - } + } // else if (trk1.sign() > 0 && trk2.sign() > 0) { + // histos.fill(HIST("hInvMass_f0980_MixedLSpp_EPA"), recoPtl.M(), recoPtl.Pt(), centrality, relPhiMix); + // } else if (trk1.sign() < 0 && trk2.sign() < 0) { + // histos.fill(HIST("hInvMass_f0980_MixedLSmm_EPA"), recoPtl.M(), recoPtl.Pt(), centrality, relPhiMix); + // } } } // for (auto& [trk1, trk2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(t1, t2))) { @@ -623,6 +623,8 @@ struct F0980pbpbanalysis { {HistType::kTHnSparseF, {massAxis, ptAxis, centAxis, epAxis}}); histos.add("hInvMass_f0980_USRot_EPA", "unlike invariant mass Rotation", {HistType::kTHnSparseF, {massAxis, ptAxis, centAxis, epAxis}}); + histos.add("hInvMass_f0980_MixedUS_EPA", "unlike invariant mass EventMixing", + {HistType::kTHnSparseF, {massAxis, ptAxis, centAxis, epAxis}}); // if (doprocessMCLight) { // histos.add("MCL/hpT_f0980_GEN", "generated f0 signals", HistType::kTH1F, {qaPtAxis}); // histos.add("MCL/hpT_f0980_REC", "reconstructed f0 signals", HistType::kTH3F, {massAxis, qaPtAxis, centAxis}); From 60407bdcaad76ef8c8438f6ac84c48710fa0ae83 Mon Sep 17 00:00:00 2001 From: samrangy Date: Mon, 28 Jul 2025 09:37:24 +0200 Subject: [PATCH 096/345] [PWGHF] taskCorrelationD0Hadrons: D0 selection correction in efficiency (#12278) --- PWGHF/HFC/Tasks/taskCorrelationD0Hadrons.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGHF/HFC/Tasks/taskCorrelationD0Hadrons.cxx b/PWGHF/HFC/Tasks/taskCorrelationD0Hadrons.cxx index a7eead5aeb3..bea1510a24b 100644 --- a/PWGHF/HFC/Tasks/taskCorrelationD0Hadrons.cxx +++ b/PWGHF/HFC/Tasks/taskCorrelationD0Hadrons.cxx @@ -801,7 +801,7 @@ struct HfTaskCorrelationD0Hadrons { float multiplicity = -1.; for (const auto& mcParticle : mcParticles) { // generated candidates - if (std::abs(mcParticle.pdgCode()) != Pdg::kD0) { + if (std::abs(mcParticle.pdgCode()) == Pdg::kD0) { auto mcCollision = mcParticle.template mcCollision_as>(); multiplicity = mcCollision.multMCFT0A() + mcCollision.multMCFT0C(); // multFT0M = multFt0A + multFT0C hCandidates->Fill(kCandidateStepMcGenAll, mcParticle.pt(), multiplicity, mcParticle.originMcGen()); From 0da913b150467f5ab0414e83262fc153fd5b649f Mon Sep 17 00:00:00 2001 From: fuchuncui <162277233+fuchuncui@users.noreply.github.com> Date: Mon, 28 Jul 2025 17:14:15 +0800 Subject: [PATCH 097/345] [PWGCF] remove auto-correlation of cascades v24 (#12272) --- PWGCF/Flow/Tasks/flowGfwOmegaXi.cxx | 184 ++++++++++++++++++++++------ 1 file changed, 149 insertions(+), 35 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowGfwOmegaXi.cxx b/PWGCF/Flow/Tasks/flowGfwOmegaXi.cxx index 741f4b5b33a..fd0a6e5b27a 100644 --- a/PWGCF/Flow/Tasks/flowGfwOmegaXi.cxx +++ b/PWGCF/Flow/Tasks/flowGfwOmegaXi.cxx @@ -384,8 +384,6 @@ struct FlowGfwOmegaXi { registry.add("Xic24_gapdpt", ";pt ; C_{2}{4} ", {HistType::kTProfile3D, {cfgaxisPtXi, cfgaxisXiMassforflow, axisMultiplicity}}); registry.add("Omegac24_gapdpt", ";pt ; C_{2}{4} ", {HistType::kTProfile3D, {cfgaxisPtOmega, cfgaxisOmegaMassforflow, axisMultiplicity}}); - registry.add("Xic22Full_oldpt", ";pt ; C_{2}{2} ", {HistType::kTProfile3D, {cfgaxisPtXi, cfgaxisXiMassforflow, axisMultiplicity}}); - registry.add("Omegac22Full_oldpt", ";pt ; C_{2}{2} ", {HistType::kTProfile3D, {cfgaxisPtOmega, cfgaxisOmegaMassforflow, axisMultiplicity}}); // v3 registry.add("Xic32dpt", ";pt ; C_{2}{2} ", {HistType::kTProfile3D, {cfgaxisPtXi, cfgaxisXiMassforflow, axisMultiplicity}}); registry.add("Omegac32dpt", ";pt ; C_{2}{2} ", {HistType::kTProfile3D, {cfgaxisPtOmega, cfgaxisOmegaMassforflow, axisMultiplicity}}); @@ -450,6 +448,8 @@ struct FlowGfwOmegaXi { fGFW->AddRegion("reffull", -0.8, 0.8, 1, 1); // ("name", etamin, etamax, ptbinnum, bitmask)eta region -0.8 to 0.8 fGFW->AddRegion("refN10", -0.8, -0.4, 1, 1); fGFW->AddRegion("refP10", 0.4, 0.8, 1, 1); + fGFW->AddRegion("olxidaudpt", -0.8, 0.8, 1, 2048); + fGFW->AddRegion("olomegadaudpt", -0.8, 0.8, 1, 4096); // POI fGFW->AddRegion("poiN10dpt", -0.8, -0.4, nPtBins, 32); fGFW->AddRegion("poiP10dpt", 0.4, 0.8, nPtBins, 32); @@ -462,26 +462,20 @@ struct FlowGfwOmegaXi { fGFW->AddRegion("poiXifulldpt", -0.8, 0.8, nXiptMassBins, 2); fGFW->AddRegion("poiXiP", 0.4, 0.8, 1, 2); fGFW->AddRegion("poiXiN", -0.8, -0.4, 1, 2); - fGFW->AddRegion("Xioldpt", -0.8, 0.8, nXiptMassBins, 2048); int nOmegaptMassBins = nXiPtBins * cfgmassbins[3]; fGFW->AddRegion("poiOmegaPdpt", 0.4, 0.8, nOmegaptMassBins, 4); fGFW->AddRegion("poiOmegaNdpt", -0.8, -0.4, nOmegaptMassBins, 4); fGFW->AddRegion("poiOmegafulldpt", -0.8, 0.8, nOmegaptMassBins, 4); fGFW->AddRegion("poiOmegaP", 0.4, 0.8, 1, 4); fGFW->AddRegion("poiOmegaN", -0.8, -0.4, 1, 4); - fGFW->AddRegion("Omegaoldpt", -0.8, 0.8, nOmegaptMassBins, 4096); int nK0sptMassBins = nK0sPtBins * cfgmassbins[0]; fGFW->AddRegion("poiK0sPdpt", 0.4, 0.8, nK0sptMassBins, 8); fGFW->AddRegion("poiK0sNdpt", -0.8, -0.4, nK0sptMassBins, 8); fGFW->AddRegion("poiK0sfulldpt", -0.8, 0.8, nK0sptMassBins, 8); - fGFW->AddRegion("poiK0sP", 0.4, 0.8, 1, 8); - fGFW->AddRegion("poiK0sN", -0.8, 0.4, 1, 8); int nLambdaptMassBins = nLambdaPtBins * cfgmassbins[1]; fGFW->AddRegion("poiLambdaPdpt", 0.4, 0.8, nLambdaptMassBins, 16); fGFW->AddRegion("poiLambdaNdpt", -0.8, -0.4, nLambdaptMassBins, 16); fGFW->AddRegion("poiLambdafulldpt", -0.8, 0.8, nLambdaptMassBins, 16); - fGFW->AddRegion("poiLambdaP", 0.4, 0.8, 1, 16); - fGFW->AddRegion("poiLambdaN", -0.8, -0.4, 1, 16); // MC fGFW->AddRegion("refN10MC", -0.8, -0.4, 1, 64); fGFW->AddRegion("refP10MC", 0.4, 0.8, 1, 64); @@ -506,15 +500,15 @@ struct FlowGfwOmegaXi { corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiXifulldpt {2} reffull {-2}", "XiFull22", kTRUE)); corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiOmegaPdpt {2} refN10 {-2}", "Omega10Gap22a", kTRUE)); corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiOmegaNdpt {2} refP10 {-2}", "Omega10Gap22b", kTRUE)); - corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiOmegafulldpt reffull {2 2 -2 -2}", "Xi10Gap24", kTRUE)); // 10 + corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiOmegafulldpt reffull {2 2 -2 -2}", "Omega10Gap24", kTRUE)); // 10 corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiOmegafulldpt {2} reffull {-2}", "OmegaFull22", kTRUE)); corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiK0sPdpt {2} refN10 {-2}", "K0short10Gap22a", kTRUE)); corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiK0sNdpt {2} refP10 {-2}", "K0short10Gap22b", kTRUE)); - corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiK0sfulldpt reffull {2 2 -2 -2}", "Xi10Gap24", kTRUE)); - corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiK0sfulldpt {2} reffull {-2}", "K0sFull22", kTRUE)); // 15 + corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiK0sfulldpt reffull {2 2 -2 -2}", "K0short10Gap24", kTRUE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiK0sfulldpt {2} reffull {-2}", "K0shortFull22", kTRUE)); // 15 corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiLambdaPdpt {2} refN10 {-2}", "Lambda10Gap22a", kTRUE)); corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiLambdaNdpt {2} refP10 {-2}", "Lambda10Gap22b", kTRUE)); - corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiLambdafulldpt reffull {2 2 -2 -2}", "Xi10Gap24a", kTRUE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiLambdafulldpt reffull {2 2 -2 -2}", "LambdaFull24", kTRUE)); corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiLambdafulldpt {2} reffull {-2}", "LambdaFull22", kTRUE)); corrconfigs.push_back(fGFW->GetCorrelatorConfig("refP10 {2} refN10 {-2}", "Ref10Gap22a", kFALSE)); // 20 corrconfigs.push_back(fGFW->GetCorrelatorConfig("reffull reffull {2 2 -2 -2}", "Ref10Gap24", kFALSE)); @@ -542,10 +536,12 @@ struct FlowGfwOmegaXi { corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiXiPdpt refN10 {2 2 -2 -2}", "Xi10Gap24a", kTRUE)); corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiXiNdpt refP10 {2 2 -2 -2}", "Xi10Gap24b", kTRUE)); - corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiXifulldpt reffull | Xioldpt {2 -2}", "XiFullol22", kTRUE)); - corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiOmegaPdpt refN10 {2 2 -2 -2}", "Xi10Gap24a", kTRUE)); - corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiOmegaNdpt refP10 {2 2 -2 -2}", "Xi10Gap24b", kTRUE)); // 45 - corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiOmegafulldpt reffull | Omegaoldpt {2 -2}", "OmegaFullol22", kTRUE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiXifulldpt {2} olxidaudpt {-2}", "XiFullol22", kTRUE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiXifulldpt olxidaudpt {2 2 -2 -2}", "XiFullol24", kTRUE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiOmegaPdpt refN10 {2 2 -2 -2}", "Omega10Gap24a", kTRUE)); // 45 + corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiOmegaNdpt refP10 {2 2 -2 -2}", "Omega10Gap24b", kTRUE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiOmegafulldpt {2} olomegadaudpt {-2}", "OmegaFullol22", kTRUE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiOmegafulldpt olomegadaudpt {2 2 -2 -2}", "OmegaFullol24", kTRUE)); fGFW->CreateRegions(); // finalize the initialization // used for event selection @@ -706,6 +702,56 @@ struct FlowGfwOmegaXi { return; } + // remove auto-corr + template + void fillProfilepTMass(const GFW::CorrConfig& corrconf, const GFW::CorrConfig& corrconfol, const ConstStr& tarName, const int& ptbin, const int& PDGCode, const float& cent) + { + int nMassBins = 0; + int nptbins = 0; + TAxis* fMass = nullptr; + TAxis* fpt = nullptr; + if (PDGCode == kXiMinus) { + nMassBins = cfgmassbins[2]; + nptbins = nXiPtBins; + fpt = fXiPtAxis; + fMass = fXiMass; + } else if (PDGCode == kOmegaMinus) { + nMassBins = cfgmassbins[3]; + nptbins = nOmegaPtBins; + fpt = fOmegaPtAxis; + fMass = fOmegaMass; + } else if (PDGCode == kK0Short) { + nMassBins = cfgmassbins[0]; + nptbins = nK0sPtBins; + fpt = fK0sPtAxis; + fMass = fK0sMass; + } else if (PDGCode == kLambda0) { + nMassBins = cfgmassbins[1]; + nptbins = nLambdaPtBins; + fpt = fLambdaPtAxis; + fMass = fLambdaMass; + } else { + LOGF(error, "Error, please put in correct PDGCode of K0s, Lambda, Xi or Omega"); + return; + } + for (int massbin = 1; massbin <= nMassBins; massbin++) { + float dnx = 0; + float val = 0; + float dnxol = 0; + dnx = fGFW->Calculate(corrconf, (ptbin - 1) + ((massbin - 1) * nptbins), kTRUE).real(); + dnxol = fGFW->Calculate(corrconfol, (ptbin - 1) + ((massbin - 1) * nptbins), kTRUE).real(); + dnx = dnx - dnxol; + if (dnx == 0) + continue; + val = (fGFW->Calculate(corrconf, (ptbin - 1) + ((massbin - 1) * nptbins), kFALSE).real() - fGFW->Calculate(corrconfol, (ptbin - 1) + ((massbin - 1) * nptbins), kFALSE).real()) / dnx; + + if (std::fabs(val) < 1) { + registry.fill(tarName, fpt->GetBinCenter(ptbin), fMass->GetBinCenter(massbin), cent, val, dnx); + } + } + return; + } + // input shared_ptr void fillProfilepTMass(const GFW::CorrConfig& corrconf, std::shared_ptr TProfile3D, const int& ptbin, const int& PDGCode, const float& cent) { @@ -751,6 +797,54 @@ struct FlowGfwOmegaXi { return; } + // remove auto-corr + void fillProfilepTMass(const GFW::CorrConfig& corrconf, const GFW::CorrConfig& corrconfol, std::shared_ptr TProfile3D, const int& ptbin, const int& PDGCode, const float& cent) + { + int nMassBins = 0; + int nptbins = 0; + TAxis* fMass = nullptr; + TAxis* fpt = nullptr; + if (PDGCode == kXiMinus) { + nMassBins = cfgmassbins[2]; + nptbins = nXiPtBins; + fpt = fXiPtAxis; + fMass = fXiMass; + } else if (PDGCode == kOmegaMinus) { + nMassBins = cfgmassbins[3]; + nptbins = nOmegaPtBins; + fpt = fOmegaPtAxis; + fMass = fOmegaMass; + } else if (PDGCode == kK0Short) { + nMassBins = cfgmassbins[0]; + nptbins = nK0sPtBins; + fpt = fK0sPtAxis; + fMass = fK0sMass; + } else if (PDGCode == kLambda0) { + nMassBins = cfgmassbins[1]; + nptbins = nLambdaPtBins; + fpt = fLambdaPtAxis; + fMass = fLambdaMass; + } else { + LOGF(error, "Error, please put in correct PDGCode of K0s, Lambda, Xi or Omega"); + return; + } + for (int massbin = 1; massbin <= nMassBins; massbin++) { + float dnx = 0; + float val = 0; + float dnxol = 0; + dnx = fGFW->Calculate(corrconf, (ptbin - 1) + ((massbin - 1) * nptbins), kTRUE).real(); + dnxol = fGFW->Calculate(corrconfol, (ptbin - 1) + ((massbin - 1) * nptbins), kTRUE).real(); + dnx = dnx - dnxol; + if (dnx == 0) + continue; + val = (fGFW->Calculate(corrconf, (ptbin - 1) + ((massbin - 1) * nptbins), kFALSE).real() - fGFW->Calculate(corrconfol, (ptbin - 1) + ((massbin - 1) * nptbins), kFALSE).real()) / dnx; + if (std::fabs(val) < 1) { + TProfile3D->Fill(fpt->GetBinCenter(ptbin), fMass->GetBinCenter(massbin), cent, val, dnx); + } + } + return; + } + void loadCorrections(uint64_t timestamp) { if (correctionsLoaded) @@ -1111,12 +1205,27 @@ struct FlowGfwOmegaXi { ((std::fabs(itsResponse.nSigmaITS(bachelor)) < cfgNSigma[8]) || bachelor.pt() < lowpt) && ((std::fabs(itsResponse.nSigmaITS(posdau)) < cfgNSigma[7]) || posdau.pt() < lowpt) && ((std::fabs(itsResponse.nSigmaITS(negdau)) < cfgNSigma[6]) || negdau.pt() < lowpt)) { registry.fill(HIST("InvMassOmega_all"), casc.pt(), casc.mOmega(), casc.eta(), cent); isOmega = true; + + setCurrentParticleWeights(weff, wacc, bachelor, vtxz, 0); + fGFW->Fill(bachelor.eta(), 1, bachelor.phi(), wacc * weff * wloc, 4096); + setCurrentParticleWeights(weff, wacc, posdau, vtxz, 0); + fGFW->Fill(posdau.eta(), 1, posdau.phi(), wacc * weff * wloc, 4096); + setCurrentParticleWeights(weff, wacc, negdau, vtxz, 0); + fGFW->Fill(negdau.eta(), 1, negdau.phi(), wacc * weff * wloc, 4096); + } else if (casc.sign() > 0 && std::fabs(casc.yOmega()) < cfgCasc_rapidity && (std::fabs(bachelor.tpcNSigmaKa()) < cfgNSigma[2] && std::fabs(negdau.tpcNSigmaPr()) < cfgNSigma[1] && std::fabs(posdau.tpcNSigmaPi()) < cfgNSigma[0]) && ((std::fabs(bachelor.tofNSigmaKa()) < cfgNSigma[5] || bachelor.pt() < lowpt) && (std::fabs(negdau.tofNSigmaPr()) < cfgNSigma[4] || negdau.pt() < lowpt) && (std::fabs(posdau.tofNSigmaPi()) < cfgNSigma[3] || posdau.pt() < lowpt)) && ((std::fabs(itsResponse.nSigmaITS(bachelor)) < cfgNSigma[8]) || bachelor.pt() < lowpt) && ((std::fabs(itsResponse.nSigmaITS(posdau)) < cfgNSigma[7]) || posdau.pt() < lowpt) && ((std::fabs(itsResponse.nSigmaITS(negdau)) < cfgNSigma[6]) || negdau.pt() < lowpt)) { registry.fill(HIST("InvMassOmega_all"), casc.pt(), casc.mOmega(), casc.eta(), cent); isOmega = true; + + setCurrentParticleWeights(weff, wacc, bachelor, vtxz, 0); + fGFW->Fill(bachelor.eta(), 1, bachelor.phi(), wacc * weff * wloc, 4096); + setCurrentParticleWeights(weff, wacc, posdau, vtxz, 0); + fGFW->Fill(posdau.eta(), 1, posdau.phi(), wacc * weff * wloc, 4096); + setCurrentParticleWeights(weff, wacc, negdau, vtxz, 0); + fGFW->Fill(negdau.eta(), 1, negdau.phi(), wacc * weff * wloc, 4096); } } // Xi and antiXi @@ -1127,12 +1236,27 @@ struct FlowGfwOmegaXi { ((std::fabs(itsResponse.nSigmaITS(bachelor)) < cfgNSigma[6]) || bachelor.pt() < lowpt) && ((std::fabs(itsResponse.nSigmaITS(posdau)) < cfgNSigma[7]) || posdau.pt() < lowpt) && ((std::fabs(itsResponse.nSigmaITS(negdau)) < cfgNSigma[6]) || negdau.pt() < lowpt)) { registry.fill(HIST("InvMassXi_all"), casc.pt(), casc.mXi(), casc.eta(), cent); isXi = true; + + setCurrentParticleWeights(weff, wacc, bachelor, vtxz, 0); + fGFW->Fill(bachelor.eta(), 1, bachelor.phi(), wacc * weff * wloc, 2048); + setCurrentParticleWeights(weff, wacc, posdau, vtxz, 0); + fGFW->Fill(posdau.eta(), 1, posdau.phi(), wacc * weff * wloc, 2048); + setCurrentParticleWeights(weff, wacc, negdau, vtxz, 0); + fGFW->Fill(negdau.eta(), 1, negdau.phi(), wacc * weff * wloc, 2048); + } else if (casc.sign() > 0 && std::fabs(casc.yXi()) < cfgCasc_rapidity && (std::fabs(bachelor.tpcNSigmaPi()) < cfgNSigma[0] && std::fabs(negdau.tpcNSigmaPr()) < cfgNSigma[1] && std::fabs(posdau.tpcNSigmaPi()) < cfgNSigma[0]) && ((std::fabs(bachelor.tofNSigmaPi()) < cfgNSigma[3] || bachelor.pt() < lowpt) && (std::fabs(negdau.tofNSigmaPr()) < cfgNSigma[4] || negdau.pt() < lowpt) && (std::fabs(posdau.tofNSigmaPi()) < cfgNSigma[3] || posdau.pt() < lowpt)) && ((std::fabs(itsResponse.nSigmaITS(bachelor)) < cfgNSigma[6]) || bachelor.pt() < lowpt) && ((std::fabs(itsResponse.nSigmaITS(posdau)) < cfgNSigma[7]) || posdau.pt() < lowpt) && ((std::fabs(itsResponse.nSigmaITS(negdau)) < cfgNSigma[6]) || negdau.pt() < lowpt)) { registry.fill(HIST("InvMassXi_all"), casc.pt(), casc.mXi(), casc.eta(), cent); isXi = true; + + setCurrentParticleWeights(weff, wacc, bachelor, vtxz, 0); + fGFW->Fill(bachelor.eta(), 1, bachelor.phi(), wacc * weff * wloc, 2048); + setCurrentParticleWeights(weff, wacc, posdau, vtxz, 0); + fGFW->Fill(posdau.eta(), 1, posdau.phi(), wacc * weff * wloc, 2048); + setCurrentParticleWeights(weff, wacc, negdau, vtxz, 0); + fGFW->Fill(negdau.eta(), 1, negdau.phi(), wacc * weff * wloc, 2048); } } // fill QA @@ -1222,10 +1346,6 @@ struct FlowGfwOmegaXi { registry.fill(HIST("InvMassOmega"), casc.pt(), casc.mOmega(), casc.eta(), cent); fGFW->Fill(casc.eta(), fOmegaPtAxis->FindBin(casc.pt()) - 1 + ((fOmegaMass->FindBin(casc.mOmega()) - 1) * nOmegaPtBins), casc.phi(), wacc * weff * wloc, 4); - fGFW->Fill(casc.eta(), fOmegaPtAxis->FindBin(casc.pt()) - 1 + ((fOmegaMass->FindBin(casc.mOmega()) - 1) * nOmegaPtBins), bachelor.phi(), wacc * weff * wloc, 4096); - fGFW->Fill(casc.eta(), fOmegaPtAxis->FindBin(casc.pt()) - 1 + ((fOmegaMass->FindBin(casc.mOmega()) - 1) * nOmegaPtBins), posdau.phi(), wacc * weff * wloc, 4096); - fGFW->Fill(casc.eta(), fOmegaPtAxis->FindBin(casc.pt()) - 1 + ((fOmegaMass->FindBin(casc.mOmega()) - 1) * nOmegaPtBins), negdau.phi(), wacc * weff * wloc, 4096); - if (cfgOutputNUAWeights) fWeightsOmega->fill(casc.phi(), casc.eta(), vtxz, casc.pt(), cent, 0); } @@ -1244,10 +1364,6 @@ struct FlowGfwOmegaXi { registry.fill(HIST("InvMassXi"), casc.pt(), casc.mXi(), casc.eta(), cent); fGFW->Fill(casc.eta(), fXiPtAxis->FindBin(casc.pt()) - 1 + ((fXiMass->FindBin(casc.mXi()) - 1) * nXiPtBins), casc.phi(), wacc * weff * wloc, 2); - fGFW->Fill(casc.eta(), fXiPtAxis->FindBin(casc.pt()) - 1 + ((fXiMass->FindBin(casc.mXi()) - 1) * nXiPtBins), bachelor.phi(), wacc * weff * wloc, 2048); - fGFW->Fill(casc.eta(), fXiPtAxis->FindBin(casc.pt()) - 1 + ((fXiMass->FindBin(casc.mXi()) - 1) * nXiPtBins), posdau.phi(), wacc * weff * wloc, 2048); - fGFW->Fill(casc.eta(), fXiPtAxis->FindBin(casc.pt()) - 1 + ((fXiMass->FindBin(casc.mXi()) - 1) * nXiPtBins), negdau.phi(), wacc * weff * wloc, 2048); - if (cfgOutputNUAWeights) fWeightsXi->fill(casc.phi(), casc.eta(), vtxz, casc.pt(), cent, 0); } @@ -1288,26 +1404,24 @@ struct FlowGfwOmegaXi { for (int i = 1; i <= nXiPtBins; i++) { fillProfilepTMass(corrconfigs.at(4), HIST("Xic22dpt"), i, kXiMinus, cent); fillProfilepTMass(corrconfigs.at(5), HIST("Xic22dpt"), i, kXiMinus, cent); - fillProfilepTMass(corrconfigs.at(6), HIST("Xic24dpt"), i, kXiMinus, cent); - fillProfilepTMass(corrconfigs.at(7), HIST("Xic22Fulldpt"), i, kXiMinus, cent); + fillProfilepTMass(corrconfigs.at(6), corrconfigs.at(44), HIST("Xic24dpt"), i, kXiMinus, cent); + fillProfilepTMass(corrconfigs.at(7), corrconfigs.at(43), HIST("Xic22Fulldpt"), i, kXiMinus, cent); fillProfilepTMass(corrconfigs.at(23), HIST("Xic32dpt"), i, kXiMinus, cent); fillProfilepTMass(corrconfigs.at(24), HIST("Xic32dpt"), i, kXiMinus, cent); fillProfilepTMass(corrconfigs.at(41), HIST("Xic24_gapdpt"), i, kXiMinus, cent); fillProfilepTMass(corrconfigs.at(42), HIST("Xic24_gapdpt"), i, kXiMinus, cent); - fillProfilepTMass(corrconfigs.at(43), HIST("Xic22Full_oldpt"), i, kXiMinus, cent); } for (int i = 1; i <= nOmegaPtBins; i++) { fillProfilepTMass(corrconfigs.at(8), HIST("Omegac22dpt"), i, kOmegaMinus, cent); fillProfilepTMass(corrconfigs.at(9), HIST("Omegac22dpt"), i, kOmegaMinus, cent); - fillProfilepTMass(corrconfigs.at(10), HIST("Omegac24dpt"), i, kOmegaMinus, cent); - fillProfilepTMass(corrconfigs.at(11), HIST("Omegac22Fulldpt"), i, kOmegaMinus, cent); + fillProfilepTMass(corrconfigs.at(10), corrconfigs.at(48), HIST("Omegac24dpt"), i, kOmegaMinus, cent); + fillProfilepTMass(corrconfigs.at(11), corrconfigs.at(47), HIST("Omegac22Fulldpt"), i, kOmegaMinus, cent); fillProfilepTMass(corrconfigs.at(25), HIST("Omegac32dpt"), i, kOmegaMinus, cent); fillProfilepTMass(corrconfigs.at(26), HIST("Omegac32dpt"), i, kOmegaMinus, cent); - fillProfilepTMass(corrconfigs.at(44), HIST("Omegac24_gapdpt"), i, kOmegaMinus, cent); fillProfilepTMass(corrconfigs.at(45), HIST("Omegac24_gapdpt"), i, kOmegaMinus, cent); - fillProfilepTMass(corrconfigs.at(46), HIST("Omegac22Full_oldpt"), i, kOmegaMinus, cent); + fillProfilepTMass(corrconfigs.at(46), HIST("Omegac24_gapdpt"), i, kOmegaMinus, cent); } } // Fill subevents flow @@ -1344,16 +1458,16 @@ struct FlowGfwOmegaXi { for (int i = 1; i <= nXiPtBins; i++) { fillProfilepTMass(corrconfigs.at(4), xic22[j - 1], i, kXiMinus, cent); fillProfilepTMass(corrconfigs.at(5), xic22[j - 1], i, kXiMinus, cent); - fillProfilepTMass(corrconfigs.at(6), xic24[j - 1], i, kXiMinus, cent); - fillProfilepTMass(corrconfigs.at(7), xic22Full[j - 1], i, kXiMinus, cent); + fillProfilepTMass(corrconfigs.at(6), corrconfigs.at(44), xic24[j - 1], i, kXiMinus, cent); + fillProfilepTMass(corrconfigs.at(7), corrconfigs.at(43), xic22Full[j - 1], i, kXiMinus, cent); fillProfilepTMass(corrconfigs.at(23), xic32[j - 1], i, kXiMinus, cent); fillProfilepTMass(corrconfigs.at(24), xic32[j - 1], i, kXiMinus, cent); } for (int i = 1; i <= nOmegaPtBins; i++) { fillProfilepTMass(corrconfigs.at(8), omegac22[j - 1], i, kOmegaMinus, cent); fillProfilepTMass(corrconfigs.at(9), omegac22[j - 1], i, kOmegaMinus, cent); - fillProfilepTMass(corrconfigs.at(10), omegac24[j - 1], i, kOmegaMinus, cent); - fillProfilepTMass(corrconfigs.at(11), omegac22Full[j - 1], i, kOmegaMinus, cent); + fillProfilepTMass(corrconfigs.at(10), corrconfigs.at(48), omegac24[j - 1], i, kOmegaMinus, cent); + fillProfilepTMass(corrconfigs.at(11), corrconfigs.at(47), omegac22Full[j - 1], i, kOmegaMinus, cent); fillProfilepTMass(corrconfigs.at(25), omegac32[j - 1], i, kOmegaMinus, cent); fillProfilepTMass(corrconfigs.at(26), omegac32[j - 1], i, kOmegaMinus, cent); } From 45325ef140de3ae1f3e365ddd4df893682c10f8a Mon Sep 17 00:00:00 2001 From: Swati <69241911+SwatiSaha-1997@users.noreply.github.com> Date: Mon, 28 Jul 2025 15:10:55 +0530 Subject: [PATCH 098/345] [PWGCF] added more event selection cuts and choice for centrality estimation (#12276) --- .../Tasks/MeanptFluctuations.cxx | 26 ++++++++++++++++--- .../Tasks/v0ptHadPiKaProt.cxx | 24 +++++++++++------ 2 files changed, 39 insertions(+), 11 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/MeanptFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/MeanptFluctuations.cxx index 1229cb4dfc6..e184f65c5a1 100644 --- a/PWGCF/EbyEFluctuations/Tasks/MeanptFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/MeanptFluctuations.cxx @@ -78,6 +78,9 @@ struct MeanptFluctuations_QA_QnTable { ConfigurableAxis nchAxis{"nchAxis", {5000, 0.5, 5000.5}, ""}; Configurable cfgEvSelkNoSameBunchPileup{"cfgEvSelkNoSameBunchPileup", true, "Pileup removal"}; Configurable cfgUseGoodITSLayerAllCut{"cfgUseGoodITSLayerAllCut", true, "Remove time interval with dead ITS zone"}; + Configurable cfgEvSelkNoITSROFrameBorder{"cfgEvSelkNoITSROFrameBorder", true, "ITSROFrame border event selection cut"}; + Configurable cfgEvSelkNoTimeFrameBorder{"cfgEvSelkNoTimeFrameBorder", true, "TimeFrame border event selection cut"}; + Configurable cfgCentralityEstimator{"cfgCentralityEstimator", 1, "Centrlaity estimatore choice: 1-->FT0C, 2-->FT0A; 3-->FT0M, 4-->FV0A"}; O2_DEFINE_CONFIGURABLE(cfgUse22sEventCut, bool, true, "Use 22s event cut on mult correlations") @@ -93,7 +96,7 @@ struct MeanptFluctuations_QA_QnTable { HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; // filtering collisions and tracks*********** - using aodCollisions = soa::Filtered>; + using aodCollisions = soa::Filtered>; // using aodCollisions = soa::Filtered>; using aodTracks = soa::Filtered>; @@ -192,18 +195,35 @@ struct MeanptFluctuations_QA_QnTable { if (cfgEvSelkNoSameBunchPileup && !(coll.selection_bit(o2::aod::evsel::kNoSameBunchPileup))) { return; } + if (cfgEvSelkNoITSROFrameBorder && !(coll.selection_bit(o2::aod::evsel::kNoITSROFrameBorder))) { + return; + } + if (cfgEvSelkNoTimeFrameBorder && !(coll.selection_bit(o2::aod::evsel::kNoTimeFrameBorder))) { + return; + } const auto CentralityFT0C = coll.centFT0C(); if (cfgUse22sEventCut && !eventSelected(coll, inputTracks.size(), CentralityFT0C)) return; histos.fill(HIST("hZvtx_after_sel"), coll.posZ()); - histos.fill(HIST("hCentrality"), coll.centFT0C()); + + double cent = 0.0; + if (cfgCentralityEstimator == 1) + cent = coll.centFT0C(); + else if (cfgCentralityEstimator == 2) + cent = coll.centFT0A(); + else if (cfgCentralityEstimator == 3) + cent = coll.centFT0M(); + else if (cfgCentralityEstimator == 4) + cent = coll.centFV0A(); + + histos.fill(HIST("hCentrality"), cent); + histos.fill(HIST("Hist2D_globalTracks_PVTracks"), coll.multNTracksPV(), inputTracks.size()); histos.fill(HIST("Hist2D_cent_nch"), inputTracks.size(), CentralityFT0C); // variables - double cent = coll.centFT0C(); double pT_sum = 0.0; double N = 0.0; diff --git a/PWGCF/EbyEFluctuations/Tasks/v0ptHadPiKaProt.cxx b/PWGCF/EbyEFluctuations/Tasks/v0ptHadPiKaProt.cxx index 855ea4d58b9..f0ec5f81685 100644 --- a/PWGCF/EbyEFluctuations/Tasks/v0ptHadPiKaProt.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/v0ptHadPiKaProt.cxx @@ -87,9 +87,11 @@ struct V0ptHadPiKaProt { Configurable cfgCutEtaLeft{"cfgCutEtaLeft", 0.8f, "Left end of eta gap"}; Configurable cfgCutEtaRight{"cfgCutEtaRight", 0.8f, "Right end of eta gap"}; Configurable cfgNSubsample{"cfgNSubsample", 10, "Number of subsamples"}; - Configurable cfgCentralityChoice{"cfgCentralityChoice", 1, "Which centrality estimator? 0-->FT0M, 1-->FT0C"}; + Configurable cfgCentralityChoice{"cfgCentralityChoice", 1, "Which centrality estimator? 1-->FT0C, 2-->FT0A, 3-->FT0M, 4-->FV0A"}; Configurable cfgEvSelkNoSameBunchPileup{"cfgEvSelkNoSameBunchPileup", true, "Pileup removal"}; Configurable cfgUseGoodITSLayerAllCut{"cfgUseGoodITSLayerAllCut", true, "Remove time interval with dead ITS zone"}; + Configurable cfgEvSelkNoITSROFrameBorder{"cfgEvSelkNoITSROFrameBorder", true, "ITSROFrame border event selection cut"}; + Configurable cfgEvSelkNoTimeFrameBorder{"cfgEvSelkNoTimeFrameBorder", true, "TimeFrame border event selection cut"}; // Connect to ccdb Service ccdb; @@ -342,13 +344,23 @@ struct V0ptHadPiKaProt { if (cfgEvSelkNoSameBunchPileup && !(coll.selection_bit(o2::aod::evsel::kNoSameBunchPileup))) { return; } + if (cfgEvSelkNoITSROFrameBorder && !(coll.selection_bit(o2::aod::evsel::kNoITSROFrameBorder))) { + return; + } + if (cfgEvSelkNoTimeFrameBorder && !(coll.selection_bit(o2::aod::evsel::kNoTimeFrameBorder))) { + return; + } // Centrality double cent = 0.0; - if (cfgCentralityChoice == 0) - cent = coll.centFT0M(); - else if (cfgCentralityChoice == 1) + if (cfgCentralityChoice == 1) + cent = coll.centFT0C(); + else if (cfgCentralityChoice == 2) + cent = coll.centFT0A(); + else if (cfgCentralityChoice == 3) cent = coll.centFT0M(); + else if (cfgCentralityChoice == 4) + cent = coll.centFV0A(); histos.fill(HIST("hZvtx_after_sel"), coll.posZ()); histos.fill(HIST("hCentrality"), cent); @@ -483,7 +495,6 @@ struct V0ptHadPiKaProt { subSample[sampleIndex][0]->Fill(cent, fPtProfileHad->GetBinCenter(i + 1), (fPtProfileHad->GetBinContent(i + 1) / nSumEtaLeftHad)); subSample[sampleIndex][1]->Fill(cent, fPtProfileHad->GetBinCenter(i + 1), ((fPtProfileHad->GetBinContent(i + 1) / nSumEtaLeftHad) * (pTsumEtaRightHad / nSumEtaRightHad))); subSample[sampleIndex][2]->Fill(cent, 0.5, ((pTsumEtaLeftHad / nSumEtaLeftHad) * (pTsumEtaRightHad / nSumEtaRightHad))); - ; subSample[sampleIndex][3]->Fill(cent, 0.5, (pTsumEtaLeftHad / nSumEtaLeftHad)); subSample[sampleIndex][4]->Fill(cent, 0.5, (pTsumEtaRightHad / nSumEtaRightHad)); } @@ -500,7 +511,6 @@ struct V0ptHadPiKaProt { subSample[sampleIndex][5]->Fill(cent, fPtProfilePi->GetBinCenter(i + 1), (fPtProfilePi->GetBinContent(i + 1) / nSumEtaLeftPi)); subSample[sampleIndex][6]->Fill(cent, fPtProfilePi->GetBinCenter(i + 1), ((fPtProfilePi->GetBinContent(i + 1) / nSumEtaLeftPi) * (pTsumEtaRightHad / nSumEtaRightHad))); subSample[sampleIndex][7]->Fill(cent, 0.5, ((pTsumEtaLeftHad / nSumEtaLeftHad) * (pTsumEtaRightHad / nSumEtaRightHad))); - ; subSample[sampleIndex][8]->Fill(cent, 0.5, (pTsumEtaLeftHad / nSumEtaLeftHad)); subSample[sampleIndex][9]->Fill(cent, 0.5, (pTsumEtaRightHad / nSumEtaRightHad)); } @@ -517,7 +527,6 @@ struct V0ptHadPiKaProt { subSample[sampleIndex][10]->Fill(cent, fPtProfileKa->GetBinCenter(i + 1), (fPtProfileKa->GetBinContent(i + 1) / nSumEtaLeftKa)); subSample[sampleIndex][11]->Fill(cent, fPtProfileKa->GetBinCenter(i + 1), ((fPtProfileKa->GetBinContent(i + 1) / nSumEtaLeftKa) * (pTsumEtaRightHad / nSumEtaRightHad))); subSample[sampleIndex][12]->Fill(cent, 0.5, ((pTsumEtaLeftHad / nSumEtaLeftHad) * (pTsumEtaRightHad / nSumEtaRightHad))); - ; subSample[sampleIndex][13]->Fill(cent, 0.5, (pTsumEtaLeftHad / nSumEtaLeftHad)); subSample[sampleIndex][14]->Fill(cent, 0.5, (pTsumEtaRightHad / nSumEtaRightHad)); } @@ -533,7 +542,6 @@ struct V0ptHadPiKaProt { subSample[sampleIndex][15]->Fill(cent, fPtProfileProt->GetBinCenter(i + 1), (fPtProfileProt->GetBinContent(i + 1) / nSumEtaLeftProt)); subSample[sampleIndex][16]->Fill(cent, fPtProfileProt->GetBinCenter(i + 1), ((fPtProfileProt->GetBinContent(i + 1) / nSumEtaLeftProt) * (pTsumEtaRightHad / nSumEtaRightHad))); subSample[sampleIndex][17]->Fill(cent, 0.5, ((pTsumEtaLeftHad / nSumEtaLeftHad) * (pTsumEtaRightHad / nSumEtaRightHad))); - ; subSample[sampleIndex][18]->Fill(cent, 0.5, (pTsumEtaLeftHad / nSumEtaLeftHad)); subSample[sampleIndex][19]->Fill(cent, 0.5, (pTsumEtaRightHad / nSumEtaRightHad)); } From 2dec14a248b9229d717064ff8a837f47e9615e99 Mon Sep 17 00:00:00 2001 From: Shirajum Monira <38348689+Eloviyo@users.noreply.github.com> Date: Mon, 28 Jul 2025 13:28:19 +0200 Subject: [PATCH 099/345] [PWGCF] FemtoUniverse v0cascade task -- PID bitmask for v0 and cascade analysis (#12163) Co-authored-by: Shirajum Monira --- .../Core/FemtoUniverseDetaDphiStar.h | 19 +++-- .../femtoUniverseProducerTask.cxx | 83 +++++++++++++++---- 2 files changed, 79 insertions(+), 23 deletions(-) diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h b/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h index e8941e7cbd9..a8a9b2daf57 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h @@ -19,16 +19,19 @@ #ifndef PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSEDETADPHISTAR_H_ #define PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSEDETADPHISTAR_H_ -#include -#include -#include -#include "TMath.h" -#include "PWGCF/FemtoUniverse/DataModel/FemtoDerived.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniverseFemtoContainer.h" #include "PWGCF/FemtoUniverse/Core/FemtoUniverseAngularContainer.h" #include "PWGCF/FemtoUniverse/Core/FemtoUniverseContainer.h" -#include "Framework/HistogramRegistry.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseFemtoContainer.h" #include "PWGCF/FemtoUniverse/Core/FemtoUniverseTrackSelection.h" +#include "PWGCF/FemtoUniverse/DataModel/FemtoDerived.h" + +#include "Framework/HistogramRegistry.h" + +#include "TMath.h" + +#include +#include +#include namespace o2::analysis { @@ -279,7 +282,7 @@ class FemtoUniverseDetaDphiStar auto indexOfDaughterpart2 = (ChosenEventType == femto_universe_container::EventType::mixed ? part2.globalIndex() : part2.index()) + CascChildTable[i][1]; auto daughterpart1 = particles.begin() + indexOfDaughterpart1; auto daughterpart2 = particles.begin() + indexOfDaughterpart2; - if (isSameSignCPR && (daughterpart1.sign() != daughterpart2.sign())) + if (isSameSignCPR && (daughterpart1.mAntiLambda() != daughterpart2.mAntiLambda())) // mAntiLambda() is used here as sign getter continue; auto deta = daughterpart1.eta() - daughterpart2.eta(); auto dphiAvg = averagePhiStar(*daughterpart1, *daughterpart2, i); diff --git a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx index e337ecf7f7e..0fc168d03ef 100644 --- a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx +++ b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx @@ -125,6 +125,7 @@ struct FemtoUniverseProducerTask { Produces outputCascParts; Configurable confIsDebug{"confIsDebug", true, "Enable Debug tables"}; + Configurable confIsUseCutculator{"confIsUseCutculator", true, "Enable cutculator for track cuts"}; // Choose if filtering or skimming version is run // Configurable confIsTrigger{"confIsTrigger", false, "Store all collisions"}; //Commented: not used configurable // Choose if running on converted data or Run3 / Pilot @@ -325,6 +326,15 @@ struct FemtoUniverseProducerTask { Configurable> classMlD0D0bar{"classMlD0D0bar", {0, 1, 2}, "Indexes of ML scores to be stored. Three indexes max."}; } ConfD0Selection; + // PID bitmask configurables + struct : o2::framework::ConfigurableGroup { + Configurable confMinMomTOF{"confMinMomTOF", 0.75, "momentum threshold for particle identification using TOF"}; + Configurable confNsigmaTPCParticleChild{"confNsigmaTPCParticleChild", 3.0, "TPC Sigma for particle (daugh & bach) momentum < Confmom"}; + Configurable confNsigmaTOFParticleChild{"confNsigmaTOFParticleChild", 3.0, "TOF Sigma for particle (daugh & bach) momentum > Confmom"}; + Configurable confNsigmaTPCParticle{"confNsigmaTPCParticle", 3.0, "TPC Sigma for particle (track) momentum < Confmom"}; + Configurable confNsigmaCombinedParticle{"confNsigmaCombinedParticle", 3.0, "TPC and TOF Sigma (combined) for particle (track) momentum > Confmom"}; + } ConfPIDBitmask; + HfHelper hfHelper; bool isKaonNSigma(float mom, float nsigmaTPCK, float nsigmaTOFK) { @@ -411,6 +421,48 @@ struct FemtoUniverseProducerTask { } } + bool isNSigmaTPC(float nsigmaTPCParticle) + { + return (std::abs(nsigmaTPCParticle) < ConfPIDBitmask.confNsigmaTPCParticleChild); + } + + bool isNSigmaTOF(float mom, float nsigmaTOFParticle, bool hasTOF) + { + // Cut only on daughter and bachelor tracks, that have TOF signal + if (mom > ConfPIDBitmask.confMinMomTOF && hasTOF) { + return (std::abs(nsigmaTOFParticle) < ConfPIDBitmask.confNsigmaTOFParticleChild); + } else { + return true; + } + } + + bool isNSigmaCombined(float mom, float nsigmaTPCParticle, float nsigmaTOFParticle) + { + if (mom <= ConfPIDBitmask.confMinMomTOF) { + return (std::abs(nsigmaTPCParticle) < ConfPIDBitmask.confNsigmaTPCParticle); + } else { + return (TMath::Hypot(nsigmaTOFParticle, nsigmaTPCParticle) < ConfPIDBitmask.confNsigmaCombinedParticle); + } + } + + template + aod::femtouniverseparticle::CutContainerType PIDBitmask(const TrackType& track) + { + static const o2::track::PID pids[] = {o2::track::PID::Proton, o2::track::PID::Pion, o2::track::PID::Kaon}; + aod::femtouniverseparticle::CutContainerType mask = 0u; + for (UInt_t i = 0; i < 3; ++i) { + if (isNSigmaTPC(trackCuts.getNsigmaTPC(track, pids[i]))) + mask |= (1u << i); + if (isNSigmaTOF(track.p(), trackCuts.getNsigmaTOF(track, pids[i]), track.hasTOF())) + mask |= (8u << i); + if (isNSigmaCombined(track.p(), trackCuts.getNsigmaTPC(track, pids[i]), trackCuts.getNsigmaTOF(track, pids[i]))) + mask |= (64u << i); + } + if (track.hasTOF()) + mask |= (512u); + return mask; + } + /// \todo should we add filter on min value pT/eta of V0 and daughters? /*Filter v0Filter = (nabs(aod::v0data::x) < V0DecVtxMax.value) && (nabs(aod::v0data::y) < V0DecVtxMax.value) && @@ -1023,8 +1075,9 @@ struct FemtoUniverseProducerTask { track.phi(), aod::femtouniverseparticle::ParticleType::kTrack, cutContainer.at( femto_universe_track_selection::TrackContainerPosition::kCuts), - cutContainer.at( - femto_universe_track_selection::TrackContainerPosition::kPID), + confIsUseCutculator ? cutContainer.at( + femto_universe_track_selection::TrackContainerPosition::kPID) + : PIDBitmask(track), track.dcaXY(), childIDs, 0, track.sign()); // sign getter is mAntiLambda() @@ -1078,11 +1131,11 @@ struct FemtoUniverseProducerTask { v0.positiveeta(), v0.positivephi(), aod::femtouniverseparticle::ParticleType::kV0Child, cutContainerV0.at(femto_universe_v0_selection::V0ContainerPosition::kPosCuts), - cutContainerV0.at(femto_universe_v0_selection::V0ContainerPosition::kPosPID), + confIsUseCutculator ? cutContainerV0.at(femto_universe_v0_selection::V0ContainerPosition::kPosPID) : PIDBitmask(postrack), 0., childIDs, 0, - 0); + postrack.sign()); const int rowOfPosTrack = outputParts.lastIndex(); if constexpr (isMC) { fillMCParticle(postrack, o2::aod::femtouniverseparticle::ParticleType::kV0Child); @@ -1098,11 +1151,11 @@ struct FemtoUniverseProducerTask { v0.negativephi(), aod::femtouniverseparticle::ParticleType::kV0Child, cutContainerV0.at(femto_universe_v0_selection::V0ContainerPosition::kNegCuts), - cutContainerV0.at(femto_universe_v0_selection::V0ContainerPosition::kNegPID), + confIsUseCutculator ? cutContainerV0.at(femto_universe_v0_selection::V0ContainerPosition::kNegPID) : PIDBitmask(negtrack), 0., childIDs, 0, - 0); + negtrack.sign()); const int rowOfNegTrack = outputParts.lastIndex(); if constexpr (isMC) { fillMCParticle(negtrack, o2::aod::femtouniverseparticle::ParticleType::kV0Child); @@ -1160,12 +1213,12 @@ struct FemtoUniverseProducerTask { casc.positiveeta(), casc.positivephi(), aod::femtouniverseparticle::ParticleType::kV0Child, - 0, // cutContainerV0.at(femto_universe_v0_selection::V0ContainerPosition::kPosCuts), - 0, // cutContainerV0.at(femto_universe_v0_selection::V0ContainerPosition::kPosPID), + 0, // cutContainerV0.at(femto_universe_v0_selection::V0ContainerPosition::kPosCuts), + PIDBitmask(posTrackCasc), // cutContainerV0.at(femto_universe_v0_selection::V0ContainerPosition::kPosPID), hasTOF, childIDs, 0, - 0); + posTrackCasc.sign()); const int rowOfPosTrack = outputParts.lastIndex(); if constexpr (isMC) { fillMCParticle(posTrackCasc, o2::aod::femtouniverseparticle::ParticleType::kV0Child); @@ -1182,12 +1235,12 @@ struct FemtoUniverseProducerTask { casc.negativeeta(), casc.negativephi(), aod::femtouniverseparticle::ParticleType::kV0Child, - 0, // cutContainerV0.at(femto_universe_v0_selection::V0ContainerPosition::kNegCuts), - 0, // cutContainerV0.at(femto_universe_v0_selection::V0ContainerPosition::kNegPID), + 0, // cutContainerV0.at(femto_universe_v0_selection::V0ContainerPosition::kNegCuts), + PIDBitmask(negTrackCasc), // cutContainerV0.at(femto_universe_v0_selection::V0ContainerPosition::kNegPID), hasTOF, childIDs, 0, - 0); + negTrackCasc.sign()); const int rowOfNegTrack = outputParts.lastIndex(); if constexpr (isMC) { fillMCParticle(negTrackCasc, o2::aod::femtouniverseparticle::ParticleType::kV0Child); @@ -1205,12 +1258,12 @@ struct FemtoUniverseProducerTask { casc.bacheloreta(), casc.bachelorphi(), aod::femtouniverseparticle::ParticleType::kCascadeBachelor, - 0, // cutContainerV0.at(femto_universe_v0_selection::V0ContainerPosition::kNegCuts), - 0, // cutContainerV0.at(femto_universe_v0_selection::V0ContainerPosition::kNegPID), + 0, // cutContainerV0.at(femto_universe_v0_selection::V0ContainerPosition::kNegCuts), + PIDBitmask(bachTrackCasc), // cutContainerV0.at(femto_universe_v0_selection::V0ContainerPosition::kNegPID), hasTOF, childIDs, 0, - 0); + bachTrackCasc.sign()); const int rowOfBachTrack = outputParts.lastIndex(); if constexpr (isMC) { fillMCParticle(bachTrackCasc, o2::aod::femtouniverseparticle::ParticleType::kCascadeBachelor); From 87d3bbc692bf619395d0aeac1ac7530d96aebd58 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Mon, 28 Jul 2025 13:56:51 +0200 Subject: [PATCH 100/345] [PWGEM/Dilepton] update filterEoI.cxx (#12282) --- PWGEM/Dilepton/TableProducer/filterEoI.cxx | 55 +++++++++++++++------- 1 file changed, 37 insertions(+), 18 deletions(-) diff --git a/PWGEM/Dilepton/TableProducer/filterEoI.cxx b/PWGEM/Dilepton/TableProducer/filterEoI.cxx index 11a3078d501..dcbb33f9ec2 100644 --- a/PWGEM/Dilepton/TableProducer/filterEoI.cxx +++ b/PWGEM/Dilepton/TableProducer/filterEoI.cxx @@ -32,38 +32,43 @@ struct filterEoI { kElectron = 0x1, kFwdMuon = 0x2, kPCM = 0x4, + kElectronFromDalitz = 0x8, }; Produces emeoi; Configurable minNElectrons{"minNElectrons", 1, "min number of e+ or e- at midrapidity"}; Configurable minNMuons{"minNMuons", 1, "min number of mu+ or mu- at forward rapidity"}; Configurable minNV0s{"minNV0s", 1, "min number of v0 photons at midrapidity"}; + Configurable minNElectronsFromDalitz{"minNElectronsFromDalitz", 1, "min number of e+ or e- from dalitz decay at midrapidity"}; HistogramRegistry fRegistry{"output"}; void init(o2::framework::InitContext&) { - auto hEventCounter = fRegistry.add("hEventCounter", "hEventCounter", kTH1D, {{8, 0.5f, 8.5f}}); + auto hEventCounter = fRegistry.add("hEventCounter", "hEventCounter", kTH1D, {{9, 0.5f, 9.5f}}); hEventCounter->GetXaxis()->SetBinLabel(1, "all"); hEventCounter->GetXaxis()->SetBinLabel(2, "event with electron"); hEventCounter->GetXaxis()->SetBinLabel(3, "event with forward muon"); hEventCounter->GetXaxis()->SetBinLabel(4, "event with v0"); - hEventCounter->GetXaxis()->SetBinLabel(5, "event with electron or forward muon"); - hEventCounter->GetXaxis()->SetBinLabel(6, "event with electron and forward muon"); - hEventCounter->GetXaxis()->SetBinLabel(7, "event with electron or forward muon or v0"); - hEventCounter->GetXaxis()->SetBinLabel(8, "event with electron and forward muon and v0"); + hEventCounter->GetXaxis()->SetBinLabel(5, "event with electron from dalitz"); + hEventCounter->GetXaxis()->SetBinLabel(6, "event with electron or forward muon"); + hEventCounter->GetXaxis()->SetBinLabel(7, "event with electron and forward muon"); + hEventCounter->GetXaxis()->SetBinLabel(8, "event with electron or forward muon or v0"); + hEventCounter->GetXaxis()->SetBinLabel(9, "event with v0 or electron from dalitz"); } SliceCache cache; Preslice perCollision_el = aod::emprimaryelectron::collisionId; Preslice perCollision_mu = aod::emprimarymuon::collisionId; Preslice perCollision_v0 = aod::v0photonkf::collisionId; + Preslice perCollision_elda = aod::emprimaryelectron::collisionId; - template - void selectEoI(TCollisions const& collisions, TElectrons const& electrons, TMuons const& muons, TV0s const& v0s) + template + void selectEoI(TCollisions const& collisions, TElectrons const& electrons, TMuons const& muons, TV0s const& v0s, TElectronsFromDalitz const& electronsda) { for (const auto& collision : collisions) { bool does_electron_exist = false; bool does_fwdmuon_exist = false; bool does_pcm_exist = false; + bool does_electronda_exist = false; fRegistry.fill(HIST("hEventCounter"), 1); if constexpr (static_cast(system & kElectron)) { @@ -87,21 +92,28 @@ struct filterEoI { fRegistry.fill(HIST("hEventCounter"), 4); } } + if constexpr (static_cast(system & kElectronFromDalitz)) { + auto electronsda_coll = electronsda.sliceBy(perCollision_elda, collision.globalIndex()); + if (electronsda_coll.size() >= minNElectronsFromDalitz) { + does_electronda_exist = true; + fRegistry.fill(HIST("hEventCounter"), 5); + } + } if (does_electron_exist || does_fwdmuon_exist) { - fRegistry.fill(HIST("hEventCounter"), 5); - } - if (does_electron_exist && does_fwdmuon_exist) { fRegistry.fill(HIST("hEventCounter"), 6); } - if (does_electron_exist || does_fwdmuon_exist || does_pcm_exist) { + if (does_electron_exist && does_fwdmuon_exist) { fRegistry.fill(HIST("hEventCounter"), 7); } - if (does_electron_exist && does_fwdmuon_exist && does_pcm_exist) { + if (does_electron_exist || does_fwdmuon_exist || does_pcm_exist) { fRegistry.fill(HIST("hEventCounter"), 8); } + if (does_electronda_exist || does_pcm_exist) { + fRegistry.fill(HIST("hEventCounter"), 9); + } - emeoi(does_electron_exist || does_fwdmuon_exist || does_pcm_exist); + emeoi(does_electron_exist || does_fwdmuon_exist || does_pcm_exist || does_electronda_exist); } // end of collision loop @@ -110,31 +122,37 @@ struct filterEoI { void process_Electron(aod::Collisions const& collisions, aod::EMPrimaryElectrons const& electrons) { const uint8_t sysflag = kElectron; - selectEoI(collisions, electrons, nullptr, nullptr); + selectEoI(collisions, electrons, nullptr, nullptr, nullptr); } void process_FwdMuon(aod::Collisions const& collisions, aod::EMPrimaryMuons const& muons) { const uint8_t sysflag = kFwdMuon; - selectEoI(collisions, nullptr, muons, nullptr); + selectEoI(collisions, nullptr, muons, nullptr, nullptr); } void process_Electron_FwdMuon(aod::Collisions const& collisions, aod::EMPrimaryElectrons const& electrons, aod::EMPrimaryMuons const& muons) { const uint8_t sysflag = kElectron | kFwdMuon; - selectEoI(collisions, electrons, muons, nullptr); + selectEoI(collisions, electrons, muons, nullptr, nullptr); } void process_PCM(aod::Collisions const& collisions, aod::V0PhotonsKF const& v0s) { const uint8_t sysflag = kPCM; - selectEoI(collisions, nullptr, nullptr, v0s); + selectEoI(collisions, nullptr, nullptr, v0s, nullptr); } void process_Electron_FwdMuon_PCM(aod::Collisions const& collisions, aod::EMPrimaryElectrons const& electrons, aod::EMPrimaryMuons const& muons, aod::V0PhotonsKF const& v0s) { const uint8_t sysflag = kElectron | kFwdMuon | kPCM; - selectEoI(collisions, electrons, muons, v0s); + selectEoI(collisions, electrons, muons, v0s, nullptr); + } + + void process_PCM_ElectronFromDalitz(aod::Collisions const& collisions, aod::V0PhotonsKF const& v0s, aod::EMPrimaryElectronsFromDalitz const& electronsda) + { + const uint8_t sysflag = kPCM | kElectronFromDalitz; + selectEoI(collisions, nullptr, nullptr, v0s, electronsda); } void processDummy(aod::Collisions const& collisions) @@ -149,6 +167,7 @@ struct filterEoI { PROCESS_SWITCH(filterEoI, process_PCM, "create filter bit for PCM", false); PROCESS_SWITCH(filterEoI, process_Electron_FwdMuon, "create filter bit for Electron, FwdMuon", false); PROCESS_SWITCH(filterEoI, process_Electron_FwdMuon_PCM, "create filter bit for Electron, FwdMuon, PCM", false); + PROCESS_SWITCH(filterEoI, process_PCM_ElectronFromDalitz, "create filter bit for PCM, electron from dalitz", false); PROCESS_SWITCH(filterEoI, processDummy, "processDummy", true); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 215e5caaf0963fedefced869c06e6369481e54a0 Mon Sep 17 00:00:00 2001 From: Chiara De Martin <39315597+ChiaraDeMartin95@users.noreply.github.com> Date: Mon, 28 Jul 2025 15:17:14 +0200 Subject: [PATCH 101/345] [PWGLF] Adapt the task to measure lambda longitudinal polarization in OO (#12205) Co-authored-by: Chiara De Martin Co-authored-by: ALICE Action Bot --- .../TableProducer/Strangeness/cascadeflow.cxx | 464 ++++++++++++++---- 1 file changed, 378 insertions(+), 86 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/cascadeflow.cxx b/PWGLF/TableProducer/Strangeness/cascadeflow.cxx index 5179a89846b..ae997e2d1fc 100644 --- a/PWGLF/TableProducer/Strangeness/cascadeflow.cxx +++ b/PWGLF/TableProducer/Strangeness/cascadeflow.cxx @@ -47,10 +47,12 @@ using CollEventPlaneCentralFW = soa::Join::iterator; using CollEventAndSpecPlaneCentralFW = soa::Join::iterator; using MCCollisionsStra = soa::Join; +using V0Candidates = soa::Join; using CascCandidates = soa::Join; using CascMCCandidates = soa::Join; -const int nParticles = 2; +const int nParticles = 2; // Xi, Omega +const int nCharges = 2; // Lambda, AntiLambda const int nParameters = 4; namespace cascadev2 @@ -77,6 +79,17 @@ std::shared_ptr hBkgScoreAfterSel[nParticles]; std::shared_ptr hSparseV2C[nParticles]; } // namespace cascadev2 +namespace lambdav2 +{ +enum species { Lambda = 0, + AntiLambda = 1 }; +static const std::vector speciesNames{"Lambda", "AntiLambda"}; +const double AlphaLambda[2] = {0.747, -0.757}; // decay parameter of Lambda and AntiLambda + +std::shared_ptr hMassBeforeSelVsPt[nCharges]; +std::shared_ptr hMassAfterSelVsPt[nCharges]; +} // namespace lambdav2 + namespace cascade_flow_cuts_ml { // direction of the cut @@ -143,6 +156,8 @@ struct cascadeFlow { Configurable isFillTHNXi_PzVsPsi{"isFillTHNXi_PzVsPsi", 1, ""}; Configurable isFillTHNOmega{"isFillTHNOmega", 1, ""}; Configurable isFillTHNOmega_PzVsPsi{"isFillTHNOmega_PzVsPsi", 1, ""}; + Configurable isFillTHNLambda{"isFillTHNLambda", 1, ""}; + Configurable isFillTHNLambda_PzVsPsi{"isFillTHNLambda_PzVsPsi", 1, ""}; Configurable isFillTHN_V2{"isFillTHN_V2", 1, ""}; Configurable isFillTHN_Pz{"isFillTHN_Pz", 1, ""}; Configurable isFillTHN_PzFromLambda{"isFillTHN_PzFromLambda", 1, ""}; @@ -208,6 +223,22 @@ struct cascadeFlow { Configurable MaxOmegaMass{"MaxOmegaMass", 1.690, ""}; } CandidateConfigs; + struct : ConfigurableGroup { + Configurable MinPtV0{"MinPtV0", 0.2, "Min pt of v0"}; + Configurable MaxPtV0{"MaxPtV0", 10, "Max pt of v0"}; + Configurable MinMassLambda{"MinMassLambda", 1.105, ""}; + Configurable MaxMassLambda{"MaxMassLambda", 1.125, ""}; + Configurable etaV0{"etaV0", 0.8, "etaV0"}; + Configurable v0cospa{"v0cospa", 0.97, "min V0 CosPA"}; + Configurable dcav0dau{"dcav0dau", 1.0, "max DCA V0 Daughters (cm)"}; + Configurable dcanegtopv{"dcanegtopv", .05, "min DCA Neg To PV (cm)"}; + Configurable dcapostopv{"dcapostopv", .05, "min DCA Pos To PV (cm)"}; + Configurable v0radius{"v0radius", 1.2, "minimum V0 radius (cm)"}; + Configurable v0radiusMax{"v0radiusMax", 1E5, "maximum V0 radius (cm)"}; + Configurable rapidityLambda{"rapidityLambda", 0.5, "rapidityLambda"}; + Configurable etaLambda{"etaLambda", 0.8, "etaLambda"}; + } V0Configs; + Configurable sideBandStart{"sideBandStart", 5, "Start of the sideband region in number of sigmas"}; Configurable sideBandEnd{"sideBandEnd", 7, "End of the sideband region in number of sigmas"}; Configurable downsample{"downsample", 1., "Downsample training output tree"}; @@ -230,8 +261,10 @@ struct cascadeFlow { Configurable acceptancePathsCCDBXi{"acceptancePathsCCDBXi", "Users/c/chdemart/AcceptanceXi", "Paths of Xi acceptance on CCDB"}; Configurable acceptancePathsCCDBOmega{"acceptancePathsCCDBOmega", "Users/c/chdemart/AcceptanceOmega", "Paths of Omega acceptance on CCDB"}; Configurable acceptancePathsCCDBLambda{"acceptancePathsCCDBLambda", "Users/c/chdemart/AcceptanceLambda", "Paths of Lambda acceptance on CCDB"}; + Configurable acceptancePathsCCDBPrimaryLambda{"acceptancePathsCCDBPrimaryLambda", "Users/c/chdemart/AcceptanceLambda", "Paths of PrimaryLambda acceptance on CCDB"}; Configurable acceptanceHistoNameCasc{"acceptanceHistoNameCasc", "histoCos2ThetaNoFit2D", "Histo name of acceptance on CCDB"}; Configurable acceptanceHistoNameLambda{"acceptanceHistoNameLambda", "histoCos2ThetaLambdaFromCNoFit2D", "Histo name of acceptance on CCDB"}; + Configurable acceptanceHistoNamePrimaryLambda{"acceptanceHistoNamePrimaryLambda", "histoCos2ThetaLambdaFromCNoFit2D", "Histo name of acceptance on CCDB"}; // ML inference Configurable isApplyML{"isApplyML", 1, "Flag to apply ML selections"}; @@ -360,6 +393,64 @@ struct cascadeFlow { return true; } + template + bool isLambdaAccepted(TDaughter negExtra, TDaughter posExtra, int& counter) // loose cuts on topological selections of v0s + { + // TPC cuts as those implemented for the training of the signal + if (doNTPCSigmaCut) { + if (std::abs(posExtra.tpcNSigmaPr()) > nsigmatpcPr || std::abs(negExtra.tpcNSigmaPi()) > nsigmatpcPi) + return false; + } + counter++; + + if (posExtra.tpcCrossedRows() < mintpccrrows || negExtra.tpcCrossedRows() < mintpccrrows) + return false; + + counter++; + return true; + } + template + bool isAntiLambdaAccepted(TDaughter negExtra, TDaughter posExtra, int& counter) // loose cuts on topological selections of v0s + { + // TPC cuts as those implemented for the training of the signal + if (doNTPCSigmaCut) { + if (std::abs(negExtra.tpcNSigmaPr()) > nsigmatpcPr || std::abs(posExtra.tpcNSigmaPi()) > nsigmatpcPi) + return false; + } + counter++; + + if (posExtra.tpcCrossedRows() < mintpccrrows || negExtra.tpcCrossedRows() < mintpccrrows) + return false; + + counter++; + return true; + } + + template + bool isV0TopoAccepted(TV0 v0) + { + // topological selections + if (v0.v0radius() < V0Configs.v0radius) + return false; + if (v0.v0radius() > V0Configs.v0radiusMax) + return false; + if (std::abs(v0.dcapostopv()) < V0Configs.dcapostopv) + return false; + if (std::abs(v0.dcanegtopv()) < V0Configs.dcanegtopv) + return false; + if (v0.v0cosPA() < V0Configs.v0cospa) + return false; + if (v0.dcaV0daughters() > V0Configs.dcav0dau) + return false; + // rapidity selection + if (std::abs(v0.yLambda()) > V0Configs.rapidityLambda) + return false; + if (std::abs(v0.eta()) > V0Configs.etaLambda) + return false; + + return true; + } + double GetPhiInRange(double phi) { while (phi < 0) { @@ -375,6 +466,7 @@ struct cascadeFlow { TH2F* hAcceptanceXi; TH2F* hAcceptanceOmega; TH2F* hAcceptanceLambda; + TH2F* hAcceptancePrimaryLambda; HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject, false, true}; HistogramRegistry histosMCGen{"histosMCGen", {}, OutputObjHandlingPolicy::AnalysisObject, false, true}; @@ -492,6 +584,10 @@ struct cascadeFlow { TList* listAcceptanceLambda = ccdb->get(acceptancePathsCCDBLambda); if (!listAcceptanceLambda) LOG(fatal) << "Problem getting TList object with acceptance for Lambda!"; + TList* listAcceptancePrimaryLambda = ccdb->get(acceptancePathsCCDBPrimaryLambda); + if (!listAcceptancePrimaryLambda) + LOG(fatal) << "Problem getting TList object with acceptance for Primary Lambda!"; + hAcceptanceXi = static_cast(listAcceptanceXi->FindObject(Form("%s", acceptanceHistoNameCasc->data()))); if (!hAcceptanceXi) { LOG(fatal) << "The histogram for Xi is not there!"; @@ -507,6 +603,11 @@ struct cascadeFlow { LOG(fatal) << "The histogram for Lambda is not there!"; } hAcceptanceLambda->SetName("hAcceptanceLambda"); + hAcceptancePrimaryLambda = static_cast(listAcceptancePrimaryLambda->FindObject(Form("%s", acceptanceHistoNamePrimaryLambda->data()))); + if (!hAcceptancePrimaryLambda) { + LOG(fatal) << "The histogram for Primary Lambda is not there!"; + } + hAcceptancePrimaryLambda->SetName("hAcceptancePrimaryLambda"); LOG(info) << "Acceptance now loaded"; } @@ -515,9 +616,14 @@ struct cascadeFlow { float minMass[2]{1.28, 1.6}; float maxMass[2]{1.36, 1.73}; + float minMassLambda[2]{1.09, 1.09}; + float maxMassLambda[2]{1.14, 1.14}; const AxisSpec massCascAxis[2]{{static_cast((maxMass[0] - minMass[0]) / 0.001f), minMass[0], maxMass[0], "#Xi candidate mass (GeV/c^{2})"}, {static_cast((maxMass[1] - minMass[1]) / 0.001f), minMass[1], maxMass[1], "#Omega candidate mass (GeV/c^{2})"}}; - const AxisSpec ptAxis{static_cast((CandidateConfigs.MaxPt - CandidateConfigs.MinPt) / 0.2), CandidateConfigs.MinPt, CandidateConfigs.MaxPt, "#it{p}_{T} (GeV/#it{c})"}; + const AxisSpec massLambdaAxis[2]{{static_cast((maxMassLambda[0] - minMassLambda[0]) / 0.001f), minMassLambda[0], maxMassLambda[0], "#Lambda candidate mass (GeV/c^{2})"}, + {static_cast((maxMassLambda[1] - minMassLambda[1]) / 0.001f), minMassLambda[1], maxMassLambda[1], "#bar{#Lambda} candidate mass (GeV/c^{2})"}}; + const AxisSpec ptAxisCasc{static_cast((CandidateConfigs.MaxPt - CandidateConfigs.MinPt) / 0.2), CandidateConfigs.MinPt, CandidateConfigs.MaxPt, "#it{p}_{T} (GeV/#it{c})"}; + const AxisSpec ptAxisLambda{static_cast((V0Configs.MaxPtV0 - V0Configs.MinPtV0) / 0.2), V0Configs.MinPtV0, V0Configs.MaxPtV0, "#it{p}_{T} (GeV/#it{c})"}; const AxisSpec v2Axis{200, -1., 1., "#it{v}_{2}"}; const AxisSpec CentAxis{18, 0., 90., "FT0C centrality percentile"}; TString hNEventsLabels[10] = {"All", "sel8", "z vrtx", "kNoSameBunchPileup", "kIsGoodZvtxFT0vsPV", "trackOccupancyInTimeRange", "kNoCollInTimeRange", "kNoCollInROF", "kTVXinTRD", "kIsGoodEventEP"}; @@ -553,8 +659,11 @@ struct cascadeFlow { histos.add("hMultNTracksITSTPCVsCentrality", "hMultNTracksITSTPCVsCentrality", kTH2F, {{100, 0, 100}, {1000, 0, 5000}}); histos.add("hCandidate", "hCandidate", HistType::kTH1F, {{22, -0.5, 21.5}}); + histos.add("hLambdaCandidate", "hLambdaCandidate", HistType::kTH1F, {{5, -0.5, 4.5}}); histos.add("hCascadeSignal", "hCascadeSignal", HistType::kTH1F, {{6, -0.5, 5.5}}); histos.add("hCascade", "hCascade", HistType::kTH1F, {{6, -0.5, 5.5}}); + histos.add("hLambdaDauSel", "hLambdaDauSel", HistType::kTH1F, {{3, -0.5, 2.5}}); + histos.add("hALambdaDauSel", "hALambdaDauSel", HistType::kTH1F, {{3, -0.5, 2.5}}); histos.add("hXiPtvsCent", "hXiPtvsCent", HistType::kTH2F, {{100, 0, 100}, {400, 0, 20}}); histos.add("hXiPtvsCentEta08", "hXiPtvsCentEta08", HistType::kTH2F, {{100, 0, 100}, {400, 0, 20}}); histos.add("hXiPtvsCentY05", "hXiPtvsCentY05", HistType::kTH2F, {{100, 0, 100}, {400, 0, 20}}); @@ -563,6 +672,8 @@ struct cascadeFlow { histos.add("hOmegaPtvsCentY05", "hOmegaPtvsCentY05", HistType::kTH2F, {{100, 0, 100}, {400, 0, 20}}); histos.add("hCascadePhi", "hCascadePhi", HistType::kTH1F, {{100, 0, o2::constants::math::TwoPI}}); histos.add("hcascminuspsiT0C", "hcascminuspsiT0C", HistType::kTH1F, {{100, 0, o2::constants::math::PI}}); + histos.add("hLambdaPhi", "hLambdaPhi", HistType::kTH1F, {{100, 0, o2::constants::math::TwoPI}}); + histos.add("hlambdaminuspsiT0C", "hlambdaminuspsiT0C", HistType::kTH1F, {{100, 0, o2::constants::math::PI}}); histos.add("hv2CEPvsFT0C", "hv2CEPvsFT0C", HistType::kTH2F, {CentAxis, {100, -1, 1}}); histos.add("hv2CEPvsv2CSP", "hv2CEPvsV2CSP", HistType::kTH2F, {{100, -1, 1}, {100, -1, 1}}); histos.add("hv1EPvsv1SP", "hV1EPvsV1SP", HistType::kTH2F, {{100, -1, 1}, {100, -1, 1}}); @@ -643,6 +754,20 @@ struct cascadeFlow { if (fillingConfigs.isFillTHN_AccFromLambdaVsLambda) histos.add("hOmegaCos2ThetaVsPsiFromLambdaL", "THn for cos2Theta of Lambda vs Lambda mass and pt", HistType::kTHnF, {thnAxisFT0C, thnAxisCharge, thnAxisEta, thnAxisPtLambda, thnAxisMassLambda, thnAxisBDTScore, thnAxisCos2ThetaL, thnAxisPsiDiff}); } + if (fillingConfigs.isFillTHNLambda) { + if (fillingConfigs.isFillTHN_V2) + histos.add("hLambdaV2", "THn for v2 of Lambda", HistType::kTHnF, {thnAxisFT0C, thnAxisCharge, thnAxisPtLambda, thnAxisMassLambda, thnAxisV2}); + if (fillingConfigs.isFillTHN_Pz) + histos.add("hLambdaPzs2", "THn for Pzs2 of Lambda", HistType::kTHnF, {thnAxisFT0C, thnAxisCharge, thnAxisPtLambda, thnAxisMassLambda, thnAxisPzs2Lambda}); + if (fillingConfigs.isFillTHN_Acc) + histos.add("hLambdaCos2Theta", "THn for Cos2Theta of Lambda", HistType::kTHnF, {thnAxisFT0C, thnAxisCharge, thnAxisEta, thnAxisPtLambda, thnAxisMassLambda, thnAxisCos2Theta}); + } + if (fillingConfigs.isFillTHNLambda_PzVsPsi) { + if (fillingConfigs.isFillTHN_Pz) + histos.add("hLambdaPzVsPsi", "THn for cosTheta of Lambda", HistType::kTHnF, {thnAxisFT0C, thnAxisCharge, thnAxisPtLambda, thnAxisMassLambda, thnAxisCosThetaProtonAlpha, thnAxisPsiDiff}); + if (fillingConfigs.isFillTHN_Acc) + histos.add("hLambdaCos2ThetaVsPsi", "THn for cos2Theta of Lambda", HistType::kTHnF, {thnAxisFT0C, thnAxisCharge, thnAxisEta, thnAxisPtLambda, thnAxisMassLambda, thnAxisCos2Theta, thnAxisPsiDiff}); + } histosMCGen.add("h2DGenXiEta08", "h2DGenXiEta08", HistType::kTH2F, {{100, 0, 100}, {400, 0, 20}}); histosMCGen.add("h2DGenOmegaEta08", "h2DGenOmegaEta08", HistType::kTH2F, {{100, 0, 100}, {400, 0, 20}}); @@ -661,14 +786,19 @@ struct cascadeFlow { } for (int iS{0}; iS < nParticles; ++iS) { - cascadev2::hMassBeforeSelVsPt[iS] = histos.add(Form("hMassBeforeSelVsPt%s", cascadev2::speciesNames[iS].data()), "hMassBeforeSelVsPt", HistType::kTH2F, {massCascAxis[iS], ptAxis}); - cascadev2::hMassAfterSelVsPt[iS] = histos.add(Form("hMassAfterSelVsPt%s", cascadev2::speciesNames[iS].data()), "hMassAfterSelVsPt", HistType::kTH2F, {massCascAxis[iS], ptAxis}); + cascadev2::hMassBeforeSelVsPt[iS] = histos.add(Form("hMassBeforeSelVsPt%s", cascadev2::speciesNames[iS].data()), "hMassBeforeSelVsPt", HistType::kTH2F, {massCascAxis[iS], ptAxisCasc}); + cascadev2::hMassAfterSelVsPt[iS] = histos.add(Form("hMassAfterSelVsPt%s", cascadev2::speciesNames[iS].data()), "hMassAfterSelVsPt", HistType::kTH2F, {massCascAxis[iS], ptAxisCasc}); cascadev2::hSignalScoreBeforeSel[iS] = histos.add(Form("hSignalScoreBeforeSel%s", cascadev2::speciesNames[iS].data()), "Signal score before selection;BDT first score;entries", HistType::kTH1F, {{100, 0., 1.}}); cascadev2::hBkgScoreBeforeSel[iS] = histos.add(Form("hBkgScoreBeforeSel%s", cascadev2::speciesNames[iS].data()), "Bkg score before selection;BDT first score;entries", HistType::kTH1F, {{100, 0., 1.}}); cascadev2::hSignalScoreAfterSel[iS] = histos.add(Form("hSignalScoreAfterSel%s", cascadev2::speciesNames[iS].data()), "Signal score after selection;BDT first score;entries", HistType::kTH1F, {{100, 0., 1.}}); cascadev2::hBkgScoreAfterSel[iS] = histos.add(Form("hBkgScoreAfterSel%s", cascadev2::speciesNames[iS].data()), "Bkg score after selection;BDT first score;entries", HistType::kTH1F, {{100, 0., 1.}}); - cascadev2::hSparseV2C[iS] = histos.add(Form("hSparseV2C%s", cascadev2::speciesNames[iS].data()), "hSparseV2C", HistType::kTHnF, {massCascAxis[iS], ptAxis, v2Axis, CentAxis}); + cascadev2::hSparseV2C[iS] = histos.add(Form("hSparseV2C%s", cascadev2::speciesNames[iS].data()), "hSparseV2C", HistType::kTHnF, {massCascAxis[iS], ptAxisCasc, v2Axis, CentAxis}); } + for (int iS{0}; iS < nCharges; ++iS) { + lambdav2::hMassBeforeSelVsPt[iS] = histos.add(Form("hMassBeforeSelVsPt%s", lambdav2::speciesNames[iS].data()), "hMassBeforeSelVsPt", HistType::kTH2F, {massLambdaAxis[iS], ptAxisLambda}); + lambdav2::hMassAfterSelVsPt[iS] = histos.add(Form("hMassAfterSelVsPt%s", lambdav2::speciesNames[iS].data()), "hMassAfterSelVsPt", HistType::kTH2F, {massLambdaAxis[iS], ptAxisLambda}); + } + if (isApplyML) { // Configure and initialise the ML class mlResponseXi.configure(binsPtMl, cutsMl, cutDirMl, nClassesMl); @@ -924,9 +1054,9 @@ struct cascadeFlow { auto etaLambda = RecoDecay::eta(std::array{casc.pxlambda(), casc.pylambda(), casc.pzlambda()}); // acceptance values if requested - double MeanCos2ThetaLambdaFromXi = 1; - double MeanCos2ThetaLambdaFromOmega = 1; - double MeanCos2ThetaProtonFromLambda = 1; + double meanCos2ThetaLambdaFromXi = 1; + double meanCos2ThetaLambdaFromOmega = 1; + double meanCos2ThetaProtonFromLambda = 1; if (applyAcceptanceCorrection) { if (ptLambda < CandidateConfigs.MinPtLambda || ptLambda > CandidateConfigs.MaxPtLambda) { continue; @@ -938,24 +1068,24 @@ struct cascadeFlow { int bin2DXi = hAcceptanceXi->FindBin(casc.pt(), casc.eta()); int bin2DOmega = hAcceptanceOmega->FindBin(casc.pt(), casc.eta()); int bin2DLambda = hAcceptanceLambda->FindBin(ptLambda, etaLambda); - MeanCos2ThetaLambdaFromXi = hAcceptanceXi->GetBinContent(bin2DXi); - MeanCos2ThetaLambdaFromOmega = hAcceptanceOmega->GetBinContent(bin2DOmega); - MeanCos2ThetaProtonFromLambda = hAcceptanceLambda->GetBinContent(bin2DLambda); + meanCos2ThetaLambdaFromXi = hAcceptanceXi->GetBinContent(bin2DXi); + meanCos2ThetaLambdaFromOmega = hAcceptanceOmega->GetBinContent(bin2DOmega); + meanCos2ThetaProtonFromLambda = hAcceptanceLambda->GetBinContent(bin2DLambda); } - int ChargeIndex = 0; + int chargeIndex = 0; if (casc.sign() > 0) - ChargeIndex = 1; - double Pzs2Xi = cosThetaStarLambda[0] * std::sin(2 * (casc.phi() - PsiT0C)) / cascadev2::AlphaXi[ChargeIndex] / MeanCos2ThetaLambdaFromXi; - double Pzs2Omega = cosThetaStarLambda[1] * std::sin(2 * (casc.phi() - PsiT0C)) / cascadev2::AlphaOmega[ChargeIndex] / MeanCos2ThetaLambdaFromOmega; - double Cos2ThetaXi = cosThetaStarLambda[0] * cosThetaStarLambda[0]; - double Cos2ThetaOmega = cosThetaStarLambda[1] * cosThetaStarLambda[1]; - double Pzs2LambdaFromCasc = cosThetaStarProton * std::sin(2 * (casc.phi() - PsiT0C)) / cascadev2::AlphaLambda[ChargeIndex] / MeanCos2ThetaProtonFromLambda; - double Cos2ThetaLambda = cosThetaStarProton * cosThetaStarProton; - - double CosThetaXiWithAlpha = cosThetaStarLambda[0] / cascadev2::AlphaXi[ChargeIndex]; - double CosThetaOmegaWithAlpha = cosThetaStarLambda[1] / cascadev2::AlphaOmega[ChargeIndex]; - double CosThetaProtonWithAlpha = cosThetaStarProton / cascadev2::AlphaLambda[ChargeIndex]; + chargeIndex = 1; + double pzs2Xi = cosThetaStarLambda[0] * std::sin(2 * (casc.phi() - PsiT0C)) / cascadev2::AlphaXi[chargeIndex] / meanCos2ThetaLambdaFromXi; + double pzs2Omega = cosThetaStarLambda[1] * std::sin(2 * (casc.phi() - PsiT0C)) / cascadev2::AlphaOmega[chargeIndex] / meanCos2ThetaLambdaFromOmega; + double cos2ThetaXi = cosThetaStarLambda[0] * cosThetaStarLambda[0]; + double cos2ThetaOmega = cosThetaStarLambda[1] * cosThetaStarLambda[1]; + double pzs2LambdaFromCasc = cosThetaStarProton * std::sin(2 * (casc.phi() - PsiT0C)) / cascadev2::AlphaLambda[chargeIndex] / meanCos2ThetaProtonFromLambda; + double cos2ThetaLambda = cosThetaStarProton * cosThetaStarProton; + + double cosThetaXiWithAlpha = cosThetaStarLambda[0] / cascadev2::AlphaXi[chargeIndex]; + double cosThetaOmegaWithAlpha = cosThetaStarLambda[1] / cascadev2::AlphaOmega[chargeIndex]; + double cosThetaProtonWithAlpha = cosThetaStarProton / cascadev2::AlphaLambda[chargeIndex]; histos.fill(HIST("hv2CEPvsFT0C"), coll.centFT0C(), v2CEP); histos.fill(HIST("hv2CEPvsv2CSP"), v2CSP, v2CEP); @@ -982,73 +1112,73 @@ struct cascadeFlow { if (std::abs(casc.eta()) < CandidateConfigs.etaCasc) { if (fillingConfigs.isFillTHNXi) { if (fillingConfigs.isFillTHN_V2) - histos.get(HIST("hXiV2"))->Fill(coll.centFT0C(), ChargeIndex, casc.pt(), casc.mXi(), BDTresponse[0], v2CEP); + histos.get(HIST("hXiV2"))->Fill(coll.centFT0C(), chargeIndex, casc.pt(), casc.mXi(), BDTresponse[0], v2CEP); if (fillingConfigs.isFillTHN_Pz) - histos.get(HIST("hXiPzs2"))->Fill(coll.centFT0C(), ChargeIndex, casc.pt(), casc.mXi(), BDTresponse[0], Pzs2Xi); + histos.get(HIST("hXiPzs2"))->Fill(coll.centFT0C(), chargeIndex, casc.pt(), casc.mXi(), BDTresponse[0], pzs2Xi); if (casc.mLambda() > CandidateConfigs.MinLambdaMass && casc.mLambda() < CandidateConfigs.MaxLambdaMass) { if (fillingConfigs.isFillTHN_PzFromLambda) - histos.get(HIST("hXiPzs2FromLambda"))->Fill(coll.centFT0C(), ChargeIndex, casc.pt(), casc.mXi(), BDTresponse[0], Pzs2LambdaFromCasc); + histos.get(HIST("hXiPzs2FromLambda"))->Fill(coll.centFT0C(), chargeIndex, casc.pt(), casc.mXi(), BDTresponse[0], pzs2LambdaFromCasc); } if (fillingConfigs.isFillTHN_Acc) - histos.get(HIST("hXiCos2Theta"))->Fill(coll.centFT0C(), ChargeIndex, casc.eta(), casc.pt(), casc.mXi(), BDTresponse[0], Cos2ThetaXi); + histos.get(HIST("hXiCos2Theta"))->Fill(coll.centFT0C(), chargeIndex, casc.eta(), casc.pt(), casc.mXi(), BDTresponse[0], cos2ThetaXi); if (fillingConfigs.isFillTHN_AccFromLambdaVsCasc) - histos.get(HIST("hXiCos2ThetaFromLambda"))->Fill(coll.centFT0C(), ChargeIndex, casc.eta(), casc.pt(), casc.mXi(), BDTresponse[0], Cos2ThetaLambda); + histos.get(HIST("hXiCos2ThetaFromLambda"))->Fill(coll.centFT0C(), chargeIndex, casc.eta(), casc.pt(), casc.mXi(), BDTresponse[0], cos2ThetaLambda); if (casc.mXi() > CandidateConfigs.MinXiMass && casc.mXi() < CandidateConfigs.MaxXiMass) { if (fillingConfigs.isFillTHN_AccFromLambdaVsLambda) - histos.get(HIST("hXiCos2ThetaFromLambdaL"))->Fill(coll.centFT0C(), ChargeIndex, etaLambda, ptLambda, casc.mLambda(), BDTresponse[0], Cos2ThetaLambda); + histos.get(HIST("hXiCos2ThetaFromLambdaL"))->Fill(coll.centFT0C(), chargeIndex, etaLambda, ptLambda, casc.mLambda(), BDTresponse[0], cos2ThetaLambda); histos.get(HIST("massXi_ProtonAcc"))->Fill(casc.mXi()); } } if (fillingConfigs.isFillTHNXi_PzVsPsi) { if (fillingConfigs.isFillTHN_Pz) - histos.get(HIST("hXiPzVsPsi"))->Fill(coll.centFT0C(), ChargeIndex, casc.pt(), casc.mXi(), BDTresponse[0], CosThetaXiWithAlpha, 2 * cascminuspsiT0C); + histos.get(HIST("hXiPzVsPsi"))->Fill(coll.centFT0C(), chargeIndex, casc.pt(), casc.mXi(), BDTresponse[0], cosThetaXiWithAlpha, 2 * cascminuspsiT0C); if (fillingConfigs.isFillTHN_PzFromLambda) - histos.get(HIST("hXiPzVsPsiFromLambda"))->Fill(coll.centFT0C(), ChargeIndex, casc.pt(), casc.mXi(), BDTresponse[0], CosThetaProtonWithAlpha, 2 * cascminuspsiT0C); + histos.get(HIST("hXiPzVsPsiFromLambda"))->Fill(coll.centFT0C(), chargeIndex, casc.pt(), casc.mXi(), BDTresponse[0], cosThetaProtonWithAlpha, 2 * cascminuspsiT0C); if (casc.mLambda() > CandidateConfigs.MinLambdaMass && casc.mLambda() < CandidateConfigs.MaxLambdaMass) { if (fillingConfigs.isFillTHN_Acc) - histos.get(HIST("hXiCos2ThetaVsPsi"))->Fill(coll.centFT0C(), ChargeIndex, casc.eta(), casc.pt(), casc.mXi(), BDTresponse[0], Cos2ThetaXi, 2 * cascminuspsiT0C); + histos.get(HIST("hXiCos2ThetaVsPsi"))->Fill(coll.centFT0C(), chargeIndex, casc.eta(), casc.pt(), casc.mXi(), BDTresponse[0], cos2ThetaXi, 2 * cascminuspsiT0C); } if (fillingConfigs.isFillTHN_AccFromLambdaVsCasc) - histos.get(HIST("hXiCos2ThetaVsPsiFromLambda"))->Fill(coll.centFT0C(), ChargeIndex, casc.eta(), casc.pt(), casc.mXi(), BDTresponse[0], Cos2ThetaLambda, 2 * cascminuspsiT0C); + histos.get(HIST("hXiCos2ThetaVsPsiFromLambda"))->Fill(coll.centFT0C(), chargeIndex, casc.eta(), casc.pt(), casc.mXi(), BDTresponse[0], cos2ThetaLambda, 2 * cascminuspsiT0C); if (casc.mXi() > CandidateConfigs.MinXiMass && casc.mXi() < CandidateConfigs.MaxXiMass) { if (fillingConfigs.isFillTHN_AccFromLambdaVsLambda) - histos.get(HIST("hXiCos2ThetaVsPsiFromLambdaL"))->Fill(coll.centFT0C(), ChargeIndex, etaLambda, ptLambda, casc.mLambda(), BDTresponse[0], Cos2ThetaLambda, 2 * cascminuspsiT0C); + histos.get(HIST("hXiCos2ThetaVsPsiFromLambdaL"))->Fill(coll.centFT0C(), chargeIndex, etaLambda, ptLambda, casc.mLambda(), BDTresponse[0], cos2ThetaLambda, 2 * cascminuspsiT0C); histos.get(HIST("massXi_ProtonAcc"))->Fill(casc.mXi()); } } if (fillingConfigs.isFillTHNOmega) { if (fillingConfigs.isFillTHN_V2) - histos.get(HIST("hOmegaV2"))->Fill(coll.centFT0C(), ChargeIndex, casc.pt(), casc.mOmega(), BDTresponse[1], v2CEP); + histos.get(HIST("hOmegaV2"))->Fill(coll.centFT0C(), chargeIndex, casc.pt(), casc.mOmega(), BDTresponse[1], v2CEP); if (fillingConfigs.isFillTHN_Pz) - histos.get(HIST("hOmegaPzs2"))->Fill(coll.centFT0C(), ChargeIndex, casc.pt(), casc.mOmega(), BDTresponse[1], Pzs2Omega); + histos.get(HIST("hOmegaPzs2"))->Fill(coll.centFT0C(), chargeIndex, casc.pt(), casc.mOmega(), BDTresponse[1], pzs2Omega); if (casc.mLambda() > CandidateConfigs.MinLambdaMass && casc.mLambda() < CandidateConfigs.MaxLambdaMass) { if (fillingConfigs.isFillTHN_PzFromLambda) - histos.get(HIST("hOmegaPzs2FromLambda"))->Fill(coll.centFT0C(), ChargeIndex, casc.pt(), casc.mOmega(), BDTresponse[1], Pzs2LambdaFromCasc); + histos.get(HIST("hOmegaPzs2FromLambda"))->Fill(coll.centFT0C(), chargeIndex, casc.pt(), casc.mOmega(), BDTresponse[1], pzs2LambdaFromCasc); } if (fillingConfigs.isFillTHN_Acc) - histos.get(HIST("hOmegaCos2Theta"))->Fill(coll.centFT0C(), ChargeIndex, casc.eta(), casc.pt(), casc.mOmega(), BDTresponse[1], Cos2ThetaOmega); + histos.get(HIST("hOmegaCos2Theta"))->Fill(coll.centFT0C(), chargeIndex, casc.eta(), casc.pt(), casc.mOmega(), BDTresponse[1], cos2ThetaOmega); if (fillingConfigs.isFillTHN_AccFromLambdaVsCasc) - histos.get(HIST("hOmegaCos2ThetaFromLambda"))->Fill(coll.centFT0C(), ChargeIndex, casc.eta(), casc.pt(), casc.mOmega(), BDTresponse[1], Cos2ThetaLambda); + histos.get(HIST("hOmegaCos2ThetaFromLambda"))->Fill(coll.centFT0C(), chargeIndex, casc.eta(), casc.pt(), casc.mOmega(), BDTresponse[1], cos2ThetaLambda); if (casc.mOmega() > CandidateConfigs.MinOmegaMass && casc.mOmega() < CandidateConfigs.MaxOmegaMass) { if (fillingConfigs.isFillTHN_AccFromLambdaVsLambda) - histos.get(HIST("hOmegaCos2ThetaFromLambdaL"))->Fill(coll.centFT0C(), ChargeIndex, etaLambda, ptLambda, casc.mLambda(), BDTresponse[1], Cos2ThetaLambda); + histos.get(HIST("hOmegaCos2ThetaFromLambdaL"))->Fill(coll.centFT0C(), chargeIndex, etaLambda, ptLambda, casc.mLambda(), BDTresponse[1], cos2ThetaLambda); histos.get(HIST("massOmega_ProtonAcc"))->Fill(casc.mOmega()); } } if (fillingConfigs.isFillTHNOmega_PzVsPsi) { if (fillingConfigs.isFillTHN_Pz) - histos.get(HIST("hOmegaPzVsPsi"))->Fill(coll.centFT0C(), ChargeIndex, casc.pt(), casc.mOmega(), BDTresponse[1], CosThetaOmegaWithAlpha, 2 * cascminuspsiT0C); + histos.get(HIST("hOmegaPzVsPsi"))->Fill(coll.centFT0C(), chargeIndex, casc.pt(), casc.mOmega(), BDTresponse[1], cosThetaOmegaWithAlpha, 2 * cascminuspsiT0C); if (fillingConfigs.isFillTHN_PzFromLambda) - histos.get(HIST("hOmegaPzVsPsiFromLambda"))->Fill(coll.centFT0C(), ChargeIndex, casc.pt(), casc.mOmega(), BDTresponse[1], CosThetaProtonWithAlpha, 2 * cascminuspsiT0C); + histos.get(HIST("hOmegaPzVsPsiFromLambda"))->Fill(coll.centFT0C(), chargeIndex, casc.pt(), casc.mOmega(), BDTresponse[1], cosThetaProtonWithAlpha, 2 * cascminuspsiT0C); if (casc.mLambda() > CandidateConfigs.MinLambdaMass && casc.mLambda() < CandidateConfigs.MaxLambdaMass) { if (fillingConfigs.isFillTHN_Acc) - histos.get(HIST("hOmegaCos2ThetaVsPsi"))->Fill(coll.centFT0C(), ChargeIndex, casc.eta(), casc.pt(), casc.mOmega(), BDTresponse[1], Cos2ThetaOmega, 2 * cascminuspsiT0C); + histos.get(HIST("hOmegaCos2ThetaVsPsi"))->Fill(coll.centFT0C(), chargeIndex, casc.eta(), casc.pt(), casc.mOmega(), BDTresponse[1], cos2ThetaOmega, 2 * cascminuspsiT0C); } if (fillingConfigs.isFillTHN_AccFromLambdaVsCasc) - histos.get(HIST("hOmegaCos2ThetaVsPsiFromLambda"))->Fill(coll.centFT0C(), ChargeIndex, casc.eta(), casc.pt(), casc.mOmega(), BDTresponse[1], Cos2ThetaLambda, 2 * cascminuspsiT0C); + histos.get(HIST("hOmegaCos2ThetaVsPsiFromLambda"))->Fill(coll.centFT0C(), chargeIndex, casc.eta(), casc.pt(), casc.mOmega(), BDTresponse[1], cos2ThetaLambda, 2 * cascminuspsiT0C); if (casc.mOmega() > CandidateConfigs.MinOmegaMass && casc.mOmega() < CandidateConfigs.MaxOmegaMass) { if (fillingConfigs.isFillTHN_AccFromLambdaVsLambda) - histos.get(HIST("hOmegaCos2ThetaVsPsiFromLambdaL"))->Fill(coll.centFT0C(), ChargeIndex, etaLambda, ptLambda, casc.mLambda(), BDTresponse[1], Cos2ThetaLambda, 2 * cascminuspsiT0C); + histos.get(HIST("hOmegaCos2ThetaVsPsiFromLambdaL"))->Fill(coll.centFT0C(), chargeIndex, etaLambda, ptLambda, casc.mLambda(), BDTresponse[1], cos2ThetaLambda, 2 * cascminuspsiT0C); histos.get(HIST("massOmega_ProtonAcc"))->Fill(casc.mOmega()); } } @@ -1193,9 +1323,9 @@ struct cascadeFlow { auto etaLambda = RecoDecay::eta(std::array{casc.pxlambda(), casc.pylambda(), casc.pzlambda()}); // acceptance values if requested - double MeanCos2ThetaLambdaFromXi = 1; - double MeanCos2ThetaLambdaFromOmega = 1; - double MeanCos2ThetaProtonFromLambda = 1; + double meanCos2ThetaLambdaFromXi = 1; + double meanCos2ThetaLambdaFromOmega = 1; + double meanCos2ThetaProtonFromLambda = 1; if (applyAcceptanceCorrection) { if (ptLambda < CandidateConfigs.MinPtLambda || ptLambda > CandidateConfigs.MaxPtLambda) { continue; @@ -1207,24 +1337,24 @@ struct cascadeFlow { int bin2DXi = hAcceptanceXi->FindBin(casc.pt(), casc.eta()); int bin2DOmega = hAcceptanceOmega->FindBin(casc.pt(), casc.eta()); int bin2DLambda = hAcceptanceLambda->FindBin(ptLambda, etaLambda); - MeanCos2ThetaLambdaFromXi = hAcceptanceXi->GetBinContent(bin2DXi); - MeanCos2ThetaLambdaFromOmega = hAcceptanceOmega->GetBinContent(bin2DOmega); - MeanCos2ThetaProtonFromLambda = hAcceptanceLambda->GetBinContent(bin2DLambda); + meanCos2ThetaLambdaFromXi = hAcceptanceXi->GetBinContent(bin2DXi); + meanCos2ThetaLambdaFromOmega = hAcceptanceOmega->GetBinContent(bin2DOmega); + meanCos2ThetaProtonFromLambda = hAcceptanceLambda->GetBinContent(bin2DLambda); } - int ChargeIndex = 0; + int chargeIndex = 0; if (casc.sign() > 0) - ChargeIndex = 1; - double Pzs2Xi = cosThetaStarLambda[0] * std::sin(2 * (casc.phi() - PsiT0C)) / cascadev2::AlphaXi[ChargeIndex] / MeanCos2ThetaLambdaFromXi; - double Pzs2Omega = cosThetaStarLambda[1] * std::sin(2 * (casc.phi() - PsiT0C)) / cascadev2::AlphaOmega[ChargeIndex] / MeanCos2ThetaLambdaFromOmega; - double Cos2ThetaXi = cosThetaStarLambda[0] * cosThetaStarLambda[0]; - double Cos2ThetaOmega = cosThetaStarLambda[1] * cosThetaStarLambda[1]; - double Pzs2LambdaFromCasc = cosThetaStarProton * std::sin(2 * (casc.phi() - PsiT0C)) / cascadev2::AlphaLambda[ChargeIndex] / MeanCos2ThetaProtonFromLambda; - double Cos2ThetaLambda = cosThetaStarProton * cosThetaStarProton; - - double CosThetaXiWithAlpha = cosThetaStarLambda[0] / cascadev2::AlphaXi[ChargeIndex]; - double CosThetaOmegaWithAlpha = cosThetaStarLambda[1] / cascadev2::AlphaOmega[ChargeIndex]; - double CosThetaProtonWithAlpha = cosThetaStarProton / cascadev2::AlphaLambda[ChargeIndex]; + chargeIndex = 1; + double pzs2Xi = cosThetaStarLambda[0] * std::sin(2 * (casc.phi() - PsiT0C)) / cascadev2::AlphaXi[chargeIndex] / meanCos2ThetaLambdaFromXi; + double pzs2Omega = cosThetaStarLambda[1] * std::sin(2 * (casc.phi() - PsiT0C)) / cascadev2::AlphaOmega[chargeIndex] / meanCos2ThetaLambdaFromOmega; + double cos2ThetaXi = cosThetaStarLambda[0] * cosThetaStarLambda[0]; + double cos2ThetaOmega = cosThetaStarLambda[1] * cosThetaStarLambda[1]; + double pzs2LambdaFromCasc = cosThetaStarProton * std::sin(2 * (casc.phi() - PsiT0C)) / cascadev2::AlphaLambda[chargeIndex] / meanCos2ThetaProtonFromLambda; + double cos2ThetaLambda = cosThetaStarProton * cosThetaStarProton; + + double cosThetaXiWithAlpha = cosThetaStarLambda[0] / cascadev2::AlphaXi[chargeIndex]; + double cosThetaOmegaWithAlpha = cosThetaStarLambda[1] / cascadev2::AlphaOmega[chargeIndex]; + double cosThetaProtonWithAlpha = cosThetaStarProton / cascadev2::AlphaLambda[chargeIndex]; histos.fill(HIST("hv2CEPvsFT0C"), coll.centFT0C(), v2CEP); histos.fill(HIST("hv2CEPvsv2CSP"), v2CSP, v2CEP); @@ -1249,73 +1379,73 @@ struct cascadeFlow { if (std::abs(casc.eta()) < CandidateConfigs.etaCasc) { if (fillingConfigs.isFillTHNXi) { if (fillingConfigs.isFillTHN_V2) - histos.get(HIST("hXiV2"))->Fill(coll.centFT0C(), ChargeIndex, casc.pt(), casc.mXi(), BDTresponse[0], v2CEP); + histos.get(HIST("hXiV2"))->Fill(coll.centFT0C(), chargeIndex, casc.pt(), casc.mXi(), BDTresponse[0], v2CEP); if (fillingConfigs.isFillTHN_Pz) - histos.get(HIST("hXiPzs2"))->Fill(coll.centFT0C(), ChargeIndex, casc.pt(), casc.mXi(), BDTresponse[0], Pzs2Xi); + histos.get(HIST("hXiPzs2"))->Fill(coll.centFT0C(), chargeIndex, casc.pt(), casc.mXi(), BDTresponse[0], pzs2Xi); if (casc.mLambda() > CandidateConfigs.MinLambdaMass && casc.mLambda() < CandidateConfigs.MaxLambdaMass) { if (fillingConfigs.isFillTHN_PzFromLambda) - histos.get(HIST("hXiPzs2FromLambda"))->Fill(coll.centFT0C(), ChargeIndex, casc.pt(), casc.mXi(), BDTresponse[0], Pzs2LambdaFromCasc); + histos.get(HIST("hXiPzs2FromLambda"))->Fill(coll.centFT0C(), chargeIndex, casc.pt(), casc.mXi(), BDTresponse[0], pzs2LambdaFromCasc); } if (fillingConfigs.isFillTHN_Acc) - histos.get(HIST("hXiCos2Theta"))->Fill(coll.centFT0C(), ChargeIndex, casc.eta(), casc.pt(), casc.mXi(), BDTresponse[0], Cos2ThetaXi); + histos.get(HIST("hXiCos2Theta"))->Fill(coll.centFT0C(), chargeIndex, casc.eta(), casc.pt(), casc.mXi(), BDTresponse[0], cos2ThetaXi); if (fillingConfigs.isFillTHN_AccFromLambdaVsCasc) - histos.get(HIST("hXiCos2ThetaFromLambda"))->Fill(coll.centFT0C(), ChargeIndex, casc.eta(), casc.pt(), casc.mXi(), BDTresponse[0], Cos2ThetaLambda); + histos.get(HIST("hXiCos2ThetaFromLambda"))->Fill(coll.centFT0C(), chargeIndex, casc.eta(), casc.pt(), casc.mXi(), BDTresponse[0], cos2ThetaLambda); if (casc.mXi() > CandidateConfigs.MinXiMass && casc.mXi() < CandidateConfigs.MaxXiMass) { if (fillingConfigs.isFillTHN_AccFromLambdaVsLambda) - histos.get(HIST("hXiCos2ThetaFromLambdaL"))->Fill(coll.centFT0C(), ChargeIndex, etaLambda, ptLambda, casc.mLambda(), BDTresponse[0], Cos2ThetaLambda); + histos.get(HIST("hXiCos2ThetaFromLambdaL"))->Fill(coll.centFT0C(), chargeIndex, etaLambda, ptLambda, casc.mLambda(), BDTresponse[0], cos2ThetaLambda); histos.get(HIST("massXi_ProtonAcc"))->Fill(casc.mXi()); } } if (fillingConfigs.isFillTHNXi_PzVsPsi) { if (fillingConfigs.isFillTHN_Pz) - histos.get(HIST("hXiPzVsPsi"))->Fill(coll.centFT0C(), ChargeIndex, casc.pt(), casc.mXi(), BDTresponse[0], CosThetaXiWithAlpha, 2 * cascminuspsiT0C); + histos.get(HIST("hXiPzVsPsi"))->Fill(coll.centFT0C(), chargeIndex, casc.pt(), casc.mXi(), BDTresponse[0], cosThetaXiWithAlpha, 2 * cascminuspsiT0C); if (fillingConfigs.isFillTHN_PzFromLambda) - histos.get(HIST("hXiPzVsPsiFromLambda"))->Fill(coll.centFT0C(), ChargeIndex, casc.pt(), casc.mXi(), BDTresponse[0], CosThetaProtonWithAlpha, 2 * cascminuspsiT0C); + histos.get(HIST("hXiPzVsPsiFromLambda"))->Fill(coll.centFT0C(), chargeIndex, casc.pt(), casc.mXi(), BDTresponse[0], cosThetaProtonWithAlpha, 2 * cascminuspsiT0C); if (casc.mLambda() > CandidateConfigs.MinLambdaMass && casc.mLambda() < CandidateConfigs.MaxLambdaMass) { if (fillingConfigs.isFillTHN_Acc) - histos.get(HIST("hXiCos2ThetaVsPsi"))->Fill(coll.centFT0C(), ChargeIndex, casc.eta(), casc.pt(), casc.mXi(), BDTresponse[0], Cos2ThetaXi, 2 * cascminuspsiT0C); + histos.get(HIST("hXiCos2ThetaVsPsi"))->Fill(coll.centFT0C(), chargeIndex, casc.eta(), casc.pt(), casc.mXi(), BDTresponse[0], cos2ThetaXi, 2 * cascminuspsiT0C); } if (fillingConfigs.isFillTHN_AccFromLambdaVsCasc) - histos.get(HIST("hXiCos2ThetaVsPsiFromLambda"))->Fill(coll.centFT0C(), ChargeIndex, casc.eta(), casc.pt(), casc.mXi(), BDTresponse[0], Cos2ThetaLambda, 2 * cascminuspsiT0C); + histos.get(HIST("hXiCos2ThetaVsPsiFromLambda"))->Fill(coll.centFT0C(), chargeIndex, casc.eta(), casc.pt(), casc.mXi(), BDTresponse[0], cos2ThetaLambda, 2 * cascminuspsiT0C); if (casc.mXi() > CandidateConfigs.MinXiMass && casc.mXi() < CandidateConfigs.MaxXiMass) { if (fillingConfigs.isFillTHN_AccFromLambdaVsLambda) - histos.get(HIST("hXiCos2ThetaVsPsiFromLambdaL"))->Fill(coll.centFT0C(), ChargeIndex, etaLambda, ptLambda, casc.mLambda(), BDTresponse[0], Cos2ThetaLambda, 2 * cascminuspsiT0C); + histos.get(HIST("hXiCos2ThetaVsPsiFromLambdaL"))->Fill(coll.centFT0C(), chargeIndex, etaLambda, ptLambda, casc.mLambda(), BDTresponse[0], cos2ThetaLambda, 2 * cascminuspsiT0C); histos.get(HIST("massXi_ProtonAcc"))->Fill(casc.mXi()); } } if (fillingConfigs.isFillTHNOmega) { if (fillingConfigs.isFillTHN_V2) - histos.get(HIST("hOmegaV2"))->Fill(coll.centFT0C(), ChargeIndex, casc.pt(), casc.mOmega(), BDTresponse[1], v2CEP); + histos.get(HIST("hOmegaV2"))->Fill(coll.centFT0C(), chargeIndex, casc.pt(), casc.mOmega(), BDTresponse[1], v2CEP); if (fillingConfigs.isFillTHN_Pz) - histos.get(HIST("hOmegaPzs2"))->Fill(coll.centFT0C(), ChargeIndex, casc.pt(), casc.mOmega(), BDTresponse[1], Pzs2Omega); + histos.get(HIST("hOmegaPzs2"))->Fill(coll.centFT0C(), chargeIndex, casc.pt(), casc.mOmega(), BDTresponse[1], pzs2Omega); if (casc.mLambda() > CandidateConfigs.MinLambdaMass && casc.mLambda() < CandidateConfigs.MaxLambdaMass) { if (fillingConfigs.isFillTHN_PzFromLambda) - histos.get(HIST("hOmegaPzs2FromLambda"))->Fill(coll.centFT0C(), ChargeIndex, casc.pt(), casc.mOmega(), BDTresponse[1], Pzs2LambdaFromCasc); + histos.get(HIST("hOmegaPzs2FromLambda"))->Fill(coll.centFT0C(), chargeIndex, casc.pt(), casc.mOmega(), BDTresponse[1], pzs2LambdaFromCasc); } if (fillingConfigs.isFillTHN_Acc) - histos.get(HIST("hOmegaCos2Theta"))->Fill(coll.centFT0C(), ChargeIndex, casc.eta(), casc.pt(), casc.mOmega(), BDTresponse[1], Cos2ThetaOmega); + histos.get(HIST("hOmegaCos2Theta"))->Fill(coll.centFT0C(), chargeIndex, casc.eta(), casc.pt(), casc.mOmega(), BDTresponse[1], cos2ThetaOmega); if (fillingConfigs.isFillTHN_AccFromLambdaVsCasc) - histos.get(HIST("hOmegaCos2ThetaFromLambda"))->Fill(coll.centFT0C(), ChargeIndex, casc.eta(), casc.pt(), casc.mOmega(), BDTresponse[1], Cos2ThetaLambda); + histos.get(HIST("hOmegaCos2ThetaFromLambda"))->Fill(coll.centFT0C(), chargeIndex, casc.eta(), casc.pt(), casc.mOmega(), BDTresponse[1], cos2ThetaLambda); if (casc.mOmega() > CandidateConfigs.MinOmegaMass && casc.mOmega() < CandidateConfigs.MaxOmegaMass) { if (fillingConfigs.isFillTHN_AccFromLambdaVsLambda) - histos.get(HIST("hOmegaCos2ThetaFromLambdaL"))->Fill(coll.centFT0C(), ChargeIndex, etaLambda, ptLambda, casc.mLambda(), BDTresponse[1], Cos2ThetaLambda); + histos.get(HIST("hOmegaCos2ThetaFromLambdaL"))->Fill(coll.centFT0C(), chargeIndex, etaLambda, ptLambda, casc.mLambda(), BDTresponse[1], cos2ThetaLambda); histos.get(HIST("massOmega_ProtonAcc"))->Fill(casc.mOmega()); } } if (fillingConfigs.isFillTHNOmega_PzVsPsi) { if (fillingConfigs.isFillTHN_Pz) - histos.get(HIST("hOmegaPzVsPsi"))->Fill(coll.centFT0C(), ChargeIndex, casc.pt(), casc.mOmega(), BDTresponse[1], CosThetaOmegaWithAlpha, 2 * cascminuspsiT0C); + histos.get(HIST("hOmegaPzVsPsi"))->Fill(coll.centFT0C(), chargeIndex, casc.pt(), casc.mOmega(), BDTresponse[1], cosThetaOmegaWithAlpha, 2 * cascminuspsiT0C); if (fillingConfigs.isFillTHN_PzFromLambda) - histos.get(HIST("hOmegaPzVsPsiFromLambda"))->Fill(coll.centFT0C(), ChargeIndex, casc.pt(), casc.mOmega(), BDTresponse[1], CosThetaProtonWithAlpha, 2 * cascminuspsiT0C); + histos.get(HIST("hOmegaPzVsPsiFromLambda"))->Fill(coll.centFT0C(), chargeIndex, casc.pt(), casc.mOmega(), BDTresponse[1], cosThetaProtonWithAlpha, 2 * cascminuspsiT0C); if (casc.mLambda() > CandidateConfigs.MinLambdaMass && casc.mLambda() < CandidateConfigs.MaxLambdaMass) { if (fillingConfigs.isFillTHN_Acc) - histos.get(HIST("hOmegaCos2ThetaVsPsi"))->Fill(coll.centFT0C(), ChargeIndex, casc.eta(), casc.pt(), casc.mOmega(), BDTresponse[1], Cos2ThetaOmega, 2 * cascminuspsiT0C); + histos.get(HIST("hOmegaCos2ThetaVsPsi"))->Fill(coll.centFT0C(), chargeIndex, casc.eta(), casc.pt(), casc.mOmega(), BDTresponse[1], cos2ThetaOmega, 2 * cascminuspsiT0C); } if (fillingConfigs.isFillTHN_AccFromLambdaVsCasc) - histos.get(HIST("hOmegaCos2ThetaVsPsiFromLambda"))->Fill(coll.centFT0C(), ChargeIndex, casc.eta(), casc.pt(), casc.mOmega(), BDTresponse[1], Cos2ThetaLambda, 2 * cascminuspsiT0C); + histos.get(HIST("hOmegaCos2ThetaVsPsiFromLambda"))->Fill(coll.centFT0C(), chargeIndex, casc.eta(), casc.pt(), casc.mOmega(), BDTresponse[1], cos2ThetaLambda, 2 * cascminuspsiT0C); if (casc.mOmega() > CandidateConfigs.MinOmegaMass && casc.mOmega() < CandidateConfigs.MaxOmegaMass) { if (fillingConfigs.isFillTHN_AccFromLambdaVsLambda) - histos.get(HIST("hOmegaCos2ThetaVsPsiFromLambdaL"))->Fill(coll.centFT0C(), ChargeIndex, etaLambda, ptLambda, casc.mLambda(), BDTresponse[1], Cos2ThetaLambda, 2 * cascminuspsiT0C); + histos.get(HIST("hOmegaCos2ThetaVsPsiFromLambdaL"))->Fill(coll.centFT0C(), chargeIndex, etaLambda, ptLambda, casc.mLambda(), BDTresponse[1], cos2ThetaLambda, 2 * cascminuspsiT0C); histos.get(HIST("massOmega_ProtonAcc"))->Fill(casc.mOmega()); } } @@ -1328,6 +1458,167 @@ struct cascadeFlow { } } + void processAnalyseLambdaEP2CentralFW(CollEventPlaneCentralFW const& coll, V0Candidates const& V0s, DauTracks const&) + { + + if (!AcceptEvent(coll, 1)) { + return; + } + + // select only events used for the calibration of the event plane + if (isGoodEventEP) { + if (std::abs(coll.qvecFT0CRe()) > 990 || std::abs(coll.qvecFT0CIm()) > 990 || std::abs(coll.qvecBNegRe()) > 990 || std::abs(coll.qvecBNegIm()) > 990 || std::abs(coll.qvecBPosRe()) > 990 || std::abs(coll.qvecBPosIm()) > 990) { + return; + } + } + + histos.fill(HIST("hNEvents"), 9.5); + histos.fill(HIST("hEventNchCorrelationAfterEP"), coll.multNTracksPVeta1(), coll.multNTracksGlobal()); + histos.fill(HIST("hEventPVcontributorsVsCentralityAfterEP"), coll.centFT0C(), coll.multNTracksPVeta1()); + histos.fill(HIST("hEventGlobalTracksVsCentralityAfterEP"), coll.centFT0C(), coll.multNTracksGlobal()); + + histos.fill(HIST("hEventCentrality"), coll.centFT0C()); + histos.fill(HIST("hEventVertexZ"), coll.posZ()); + + ROOT::Math::XYZVector eventplaneVecT0C{coll.qvecFT0CRe(), coll.qvecFT0CIm(), 0}; + ROOT::Math::XYZVector eventplaneVecTPCA{coll.qvecBPosRe(), coll.qvecBPosIm(), 0}; + ROOT::Math::XYZVector eventplaneVecTPCC{coll.qvecBNegRe(), coll.qvecBNegIm(), 0}; + + const float psiT0C = std::atan2(coll.qvecFT0CIm(), coll.qvecFT0CRe()) * 0.5f; + histos.fill(HIST("hPsiT0C"), psiT0C); + histos.fill(HIST("hPsiT0CvsCentFT0C"), coll.centFT0C(), psiT0C); + + resolution.fill(HIST("QVectorsT0CTPCA"), eventplaneVecT0C.Dot(eventplaneVecTPCA), coll.centFT0C()); + resolution.fill(HIST("QVectorsT0CTPCC"), eventplaneVecT0C.Dot(eventplaneVecTPCC), coll.centFT0C()); + resolution.fill(HIST("QVectorsTPCAC"), eventplaneVecTPCA.Dot(eventplaneVecTPCC), coll.centFT0C()); + resolution.fill(HIST("QVectorsNormT0CTPCA"), eventplaneVecT0C.Dot(eventplaneVecTPCA) / (coll.qTPCR() * coll.sumAmplFT0C()), coll.centFT0C()); + resolution.fill(HIST("QVectorsNormT0CTPCC"), eventplaneVecT0C.Dot(eventplaneVecTPCC) / (coll.qTPCL() * coll.sumAmplFT0C()), coll.centFT0C()); + resolution.fill(HIST("QVectorsNormTPCAC"), eventplaneVecTPCA.Dot(eventplaneVecTPCC) / (coll.qTPCR() * coll.qTPCL()), coll.centFT0C()); + + std::vector bdtScore[nParticles]; + for (auto const& v0 : V0s) { + + /// Add some minimal cuts for single track variables (min number of TPC clusters) + auto negExtra = v0.negTrackExtra_as(); + auto posExtra = v0.posTrackExtra_as(); + + int counterLambda = 0; + int counterALambda = 0; + bool isLambdaCandidate = 0; + bool isALambdaCandidate = 0; + if (isLambdaAccepted(negExtra, posExtra, counterLambda)) + isLambdaCandidate = 1; + if (isAntiLambdaAccepted(negExtra, posExtra, counterALambda)) + isALambdaCandidate = 1; + histos.fill(HIST("hLambdaDauSel"), counterLambda); + histos.fill(HIST("hALambdaDauSel"), counterALambda); + + // pt cut + if (v0.pt() < V0Configs.MinPtV0 || v0.pt() > V0Configs.MaxPtV0) { + continue; + } + + float massV0[nCharges]{v0.mLambda(), v0.mAntiLambda()}; + lambdav2::hMassBeforeSelVsPt[0]->Fill(massV0[0], v0.pt()); + lambdav2::hMassBeforeSelVsPt[1]->Fill(massV0[1], v0.pt()); + + bool isSelectedV0[2]{false, false}; + if (isV0TopoAccepted(v0) && isLambdaCandidate) + isSelectedV0[0] = true; + if (isV0TopoAccepted(v0) && isALambdaCandidate) + isSelectedV0[1] = true; + + int chargeIndex = -1; + if (isSelectedV0[0] && !isSelectedV0[1]) { // Lambdas + histos.fill(HIST("hLambdaCandidate"), 0); + chargeIndex = 0; + } + if (isSelectedV0[1] && !isSelectedV0[0]) { // AntiLambdas + histos.fill(HIST("hLambdaCandidate"), 1); + chargeIndex = 1; + } + if (isSelectedV0[0] && isSelectedV0[1]) { + histos.fill(HIST("hLambdaCandidate"), 2); + if (v0.mLambda() > V0Configs.MinMassLambda && v0.mLambda() < V0Configs.MaxMassLambda && v0.mAntiLambda() > V0Configs.MinMassLambda && v0.mAntiLambda() < V0Configs.MaxMassLambda) { + histos.fill(HIST("hLambdaCandidate"), 3); + continue; // in case of ambiguity between Lambda and AntiLambda, I skip the particle + } + if (v0.mLambda() > V0Configs.MinMassLambda && v0.mLambda() < V0Configs.MaxMassLambda) + chargeIndex = 0; + else if (v0.mAntiLambda() > V0Configs.MinMassLambda && v0.mAntiLambda() < V0Configs.MaxMassLambda) + chargeIndex = 1; + else { + histos.fill(HIST("hLambdaCandidate"), 4); + continue; // in case of ambiguity between Lambda and AntiLambda, I skip the particle + } + } + if (!isSelectedV0[0] && !isSelectedV0[1]) + continue; + + ROOT::Math::XYZVector lambdaQvec{std::cos(2 * v0.phi()), std::sin(2 * v0.phi()), 0}; + auto v2CSP = lambdaQvec.Dot(eventplaneVecT0C); // not normalised by amplitude + auto lambdaminuspsiT0C = GetPhiInRange(v0.phi() - psiT0C); + auto v2CEP = std::cos(2.0 * lambdaminuspsiT0C); + ROOT::Math::XYZVector lambdaUvec{std::cos(v0.phi()), std::sin(v0.phi()), 0}; + + // polarization variables + double massLambda = o2::constants::physics::MassLambda; + float cosThetaStarProton[nCharges]; + ROOT::Math::PxPyPzMVector lambdaVector, protonVector[nCharges]; + lambdaVector.SetCoordinates(v0.px(), v0.py(), v0.pz(), massLambda); + ROOT::Math::Boost lambdaBoost{lambdaVector.BoostToCM()}; + for (int i{0}; i < nCharges; ++i) { + if (i == 0) + protonVector[i].SetCoordinates(v0.pxpos(), v0.pypos(), v0.pzpos(), o2::constants::physics::MassProton); + else + protonVector[i].SetCoordinates(v0.pxneg(), v0.pyneg(), v0.pzneg(), o2::constants::physics::MassProton); + auto boostedProton{lambdaBoost(protonVector[i])}; + cosThetaStarProton[i] = boostedProton.Pz() / boostedProton.P(); + } + + // acceptance values if requested + double meanCos2ThetaProtonFromLambda = 1; + if (applyAcceptanceCorrection) { + int bin2DLambda = hAcceptanceLambda->FindBin(v0.pt(), v0.eta()); + meanCos2ThetaProtonFromLambda = hAcceptancePrimaryLambda->GetBinContent(bin2DLambda); + } + + double pzs2Lambda = 0; + double cos2ThetaLambda = 0; + double cosThetaLambda = 0; + if (chargeIndex == 0) { + pzs2Lambda = cosThetaStarProton[0] * std::sin(2 * (v0.phi() - psiT0C)) / lambdav2::AlphaLambda[0] / meanCos2ThetaProtonFromLambda; + cos2ThetaLambda = cosThetaStarProton[0] * cosThetaStarProton[0]; + cosThetaLambda = cosThetaStarProton[0] / cascadev2::AlphaLambda[0] / meanCos2ThetaProtonFromLambda; + } else { + pzs2Lambda = cosThetaStarProton[1] * std::sin(2 * (v0.phi() - psiT0C)) / lambdav2::AlphaLambda[1] / meanCos2ThetaProtonFromLambda; + cos2ThetaLambda = cosThetaStarProton[1] * cosThetaStarProton[1]; + cosThetaLambda = cosThetaStarProton[1] / cascadev2::AlphaLambda[1] / meanCos2ThetaProtonFromLambda; + } + + histos.fill(HIST("hv2CEPvsFT0C"), coll.centFT0C(), v2CEP); + histos.fill(HIST("hv2CEPvsv2CSP"), v2CSP, v2CEP); + histos.fill(HIST("hLambdaPhi"), v0.phi()); + histos.fill(HIST("hlambdaminuspsiT0C"), lambdaminuspsiT0C); + + if (fillingConfigs.isFillTHNLambda) { + if (fillingConfigs.isFillTHN_V2) + histos.get(HIST("hLambdaV2"))->Fill(coll.centFT0C(), chargeIndex, v0.pt(), v0.mLambda(), v2CEP); + if (fillingConfigs.isFillTHN_Pz) { + histos.get(HIST("hLambdaPzs2"))->Fill(coll.centFT0C(), chargeIndex, v0.pt(), v0.mLambda(), pzs2Lambda); + } + if (fillingConfigs.isFillTHN_Acc) + histos.get(HIST("hLambdaCos2Theta"))->Fill(coll.centFT0C(), chargeIndex, v0.eta(), v0.pt(), v0.mLambda(), cos2ThetaLambda); + } + if (fillingConfigs.isFillTHNLambda_PzVsPsi) { + if (fillingConfigs.isFillTHN_Pz) + histos.get(HIST("hLambdaPzVsPsi"))->Fill(coll.centFT0C(), chargeIndex, v0.pt(), v0.mLambda(), cosThetaLambda, 2 * lambdaminuspsiT0C); + if (fillingConfigs.isFillTHN_Acc) + histos.get(HIST("hLambdaCos2ThetaVsPsi"))->Fill(coll.centFT0C(), chargeIndex, v0.eta(), v0.pt(), v0.mLambda(), cos2ThetaLambda, 2 * lambdaminuspsiT0C); + } + } + } + void processAnalyseDataEPCentralFW(CollEventAndSpecPlaneCentralFW const& coll, CascCandidates const& Cascades, DauTracks const&) { @@ -1488,7 +1779,7 @@ struct cascadeFlow { } bool hasEventPlane = 0; // no info at the moment - bool hasSpectatorPlane = 0; // no infor at the moment + bool hasSpectatorPlane = 0; // no info at the moment histos.fill(HIST("hNEvents"), 9.5); histos.fill(HIST("hEventNchCorrelationAfterEP"), coll.multNTracksPVeta1(), coll.multNTracksGlobal()); @@ -1707,6 +1998,7 @@ struct cascadeFlow { PROCESS_SWITCH(cascadeFlow, processAnalyseData, "Process to apply ML model to the data", false); PROCESS_SWITCH(cascadeFlow, processAnalyseDataEP2CentralFW, "Process to apply ML model to the data - second order event plane calibration from central framework", false); PROCESS_SWITCH(cascadeFlow, processAnalyseDataEPCentralFW, "Process to apply ML model to the data - event plane calibration from central framework", false); + PROCESS_SWITCH(cascadeFlow, processAnalyseLambdaEP2CentralFW, "Process to measure flow and polarization of Lambda - event plane calibration from central framework", false); PROCESS_SWITCH(cascadeFlow, processAnalyseMC, "Process to apply ML model to the MC", false); PROCESS_SWITCH(cascadeFlow, processMCGen, "Process to store MC generated particles", false); }; From 5727a012f245ca575f61981425570060dac125ce Mon Sep 17 00:00:00 2001 From: Junlee Kim Date: Mon, 28 Jul 2025 22:33:28 +0900 Subject: [PATCH 102/345] [PWGLF] adding cosine axis (#12281) --- PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx b/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx index 29635eb8b45..70f39e55dea 100644 --- a/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx +++ b/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx @@ -127,6 +127,9 @@ struct lambdaTwoPartPolarization { ConfigurableAxis detaAxis{"dyAxis", {20, -1, 1}, "relative rapidity axis"}; ConfigurableAxis dphiAxis{"dphiAxis", {20, -constants::math::PI * 0.5, constants::math::PI * 1.5}, "relative azimuth axis"}; + ConfigurableAxis cosSigAxis{"cosSigAxis", {110, -1.05, 1.05}, "Signal cosine axis"}; + ConfigurableAxis cosAccAxis{"cosAccAxis", {110, -7.05, 7.05}, "Accepatance cosine axis"}; + TF1* fMultPVCutLow = nullptr; TF1* fMultPVCutHigh = nullptr; @@ -158,8 +161,8 @@ struct lambdaTwoPartPolarization { histos.add("QA/nsigma_tpc_pt_mpi", "", {HistType::kTH2F, {ptAxis, pidAxis}}); } - histos.add("Ana/Signal", "", {HistType::kTHnSparseF, {ptAxis, ptAxis, detaAxis, dphiAxis, centAxis}}); - histos.add("Ana/Acceptance", "", {HistType::kTHnSparseF, {ptAxis, centAxis, RapAxis}}); + histos.add("Ana/Signal", "", {HistType::kTHnSparseF, {ptAxis, ptAxis, detaAxis, dphiAxis, centAxis, cosSigAxis}}); + histos.add("Ana/Acceptance", "", {HistType::kTHnSparseF, {ptAxis, centAxis, RapAxis, cosAccAxis}}); fMultPVCutLow = new TF1("fMultPVCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x - 2.5*([4]+[5]*x+[6]*x*x+[7]*x*x*x+[8]*x*x*x*x)", 0, 100); fMultPVCutLow->SetParameters(2834.66, -87.0127, 0.915126, -0.00330136, 332.513, -12.3476, 0.251663, -0.00272819, 1.12242e-05); From 82e04b6dfc14120ae77108a750c01be938fae8a5 Mon Sep 17 00:00:00 2001 From: Maximiliano Puccio Date: Mon, 28 Jul 2025 15:55:01 +0200 Subject: [PATCH 103/345] [PWGLF] Add TPC PID clusters and PID info to He3 and Lambda (#12283) --- PWGLF/DataModel/LFSlimHeLambda.h | 14 ++++++++++---- PWGLF/TableProducer/Nuspex/he3LambdaAnalysis.cxx | 15 +++++---------- PWGLF/Tasks/Nuspex/he3LambdaDerivedAnalysis.cxx | 2 +- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/PWGLF/DataModel/LFSlimHeLambda.h b/PWGLF/DataModel/LFSlimHeLambda.h index fc0178907df..8745ac1838a 100644 --- a/PWGLF/DataModel/LFSlimHeLambda.h +++ b/PWGLF/DataModel/LFSlimHeLambda.h @@ -42,17 +42,22 @@ DECLARE_SOA_COLUMN(CosPA, cosPA, float); DECLARE_SOA_COLUMN(DCAxy, dcaXY, float); DECLARE_SOA_COLUMN(DCAz, dcaZ, float); DECLARE_SOA_COLUMN(TPCnCls, tpcNCls, int); +DECLARE_SOA_COLUMN(TPCnClsPID, tpcNClsPID, int); DECLARE_SOA_COLUMN(ITSClusterSizes, itsClusterSizes, uint32_t); +DECLARE_SOA_COLUMN(NsigmaTPCPion, nSigmaTPCPion, float); +DECLARE_SOA_COLUMN(NsigmaTPCProton, nSigmaTPCProton, float); DECLARE_SOA_COLUMN(NsigmaTPC, nSigmaTPC, float); -// DECLARE_SOA_COLUMN(NsigmaTPCproton, nSigmaTPCproton, float); DECLARE_SOA_COLUMN(DCAdaughters, dcaDaughters, float); DECLARE_SOA_COLUMN(DCAPVProton, dcaPVProton, float); DECLARE_SOA_COLUMN(DCAPVPion, dcaPVPion, float); DECLARE_SOA_COLUMN(V0Radius, v0Radius, float); DECLARE_SOA_COLUMN(Sign, sign, int8_t); } // namespace lfv0he3 -DECLARE_SOA_TABLE(LFHe3, "AOD", "LFHE3V0", lfv0he3::LFEventId, lfv0he3::Pt, lfv0he3::Eta, lfv0he3::Phi, lfv0he3::DCAxy, lfv0he3::DCAz, lfv0he3::TPCnCls, lfv0he3::ITSClusterSizes, lfv0he3::NsigmaTPC, lfv0he3::Sign); -DECLARE_SOA_TABLE(LFLambda, "AOD", "LFLAMBDA", lfv0he3::LFEventId, lfv0he3::Pt, lfv0he3::Eta, lfv0he3::Phi, lfv0he3::Mass, lfv0he3::CosPA, lfv0he3::DCAdaughters, lfv0he3::DCAPVProton, lfv0he3::DCAPVPion, lfv0he3::V0Radius, lfv0he3::Sign); +DECLARE_SOA_TABLE_VERSIONED(LFHe3_000, "AOD", "LFHE3V0", 0, lfv0he3::LFEventId, lfv0he3::Pt, lfv0he3::Eta, lfv0he3::Phi, lfv0he3::DCAxy, lfv0he3::DCAz, lfv0he3::TPCnCls, lfv0he3::ITSClusterSizes, lfv0he3::NsigmaTPC, lfv0he3::Sign); +DECLARE_SOA_TABLE_VERSIONED(LFLambda_000, "AOD", "LFLAMBDA", 0, lfv0he3::LFEventId, lfv0he3::Pt, lfv0he3::Eta, lfv0he3::Phi, lfv0he3::Mass, lfv0he3::CosPA, lfv0he3::DCAdaughters, lfv0he3::DCAPVProton, lfv0he3::DCAPVPion, lfv0he3::V0Radius, lfv0he3::Sign); + +DECLARE_SOA_TABLE_VERSIONED(LFHe3_001, "AOD", "LFHE3V0", 1, lfv0he3::LFEventId, lfv0he3::Pt, lfv0he3::Eta, lfv0he3::Phi, lfv0he3::DCAxy, lfv0he3::DCAz, lfv0he3::TPCnCls, lfv0he3::TPCnClsPID, lfv0he3::ITSClusterSizes, lfv0he3::NsigmaTPC, lfv0he3::Sign); +DECLARE_SOA_TABLE_VERSIONED(LFLambda_001, "AOD", "LFLAMBDA", 1, lfv0he3::LFEventId, lfv0he3::Pt, lfv0he3::Eta, lfv0he3::Phi, lfv0he3::Mass, lfv0he3::CosPA, lfv0he3::DCAdaughters, lfv0he3::DCAPVProton, lfv0he3::DCAPVPion, lfv0he3::V0Radius, lfv0he3::NsigmaTPCProton, lfv0he3::NsigmaTPCPion, lfv0he3::Sign); } // namespace o2::aod struct he3Candidate { @@ -61,6 +66,7 @@ struct he3Candidate { float dcaXY = -999.f; float dcaZ = -999.f; int tpcNClsFound = 0; // Number of TPC clusters found + int tpcNClsPID = 0; // Number of TPC clusters used for PID int itsNCls = 0; // Number of ITS clusters uint32_t itsClusterSizes = 0; // ITS cluster sizes int8_t sign = 0; // Charge sign of the He3 candidate @@ -75,7 +81,7 @@ struct lambdaCandidate { float dcaPionToPV = -999.f; // DCA of the pion to primary vertex float v0Radius = -1.f; // V0 radius float protonNSigmaTPC = -999.f; // Proton TPC nSigma - float pionNSigmaTPC = -999.f; + float pionNSigmaTPC = -999.f; // Pion TPC nSigma int8_t sign = 0; // Charge sign of the Lambda candidate }; diff --git a/PWGLF/TableProducer/Nuspex/he3LambdaAnalysis.cxx b/PWGLF/TableProducer/Nuspex/he3LambdaAnalysis.cxx index d10a1338e55..9482de6d51e 100644 --- a/PWGLF/TableProducer/Nuspex/he3LambdaAnalysis.cxx +++ b/PWGLF/TableProducer/Nuspex/he3LambdaAnalysis.cxx @@ -92,8 +92,8 @@ struct he3LambdaAnalysis { o2::vertexing::DCAFitterN<2> fitter; Produces lfHe3V0Collision; - Produces lfHe3; - Produces lfLambda; + Produces lfHe3; + Produces lfLambda; // Configurables for event selection struct : ConfigurableGroup { @@ -280,6 +280,7 @@ struct he3LambdaAnalysis { candidate.dcaXY = dcaInfo[0]; candidate.dcaZ = dcaInfo[1]; candidate.tpcNClsFound = track.tpcNClsFound(); + candidate.tpcNClsPID = track.tpcNClsPID(); candidate.itsNCls = track.itsNCls(); candidate.itsClusterSizes = track.itsClusterSizes(); candidate.sign = track.sign() > 0 ? 1 : -1; @@ -376,11 +377,11 @@ struct he3LambdaAnalysis { lfHe3V0Collision(collision.posZ(), collision.centFT0C()); for (const auto& he3 : he3Candidates) { lfHe3(lfHe3V0Collision.lastIndex(), he3.momentum.Pt(), he3.momentum.Eta(), he3.momentum.Phi(), - he3.dcaXY, he3.dcaZ, he3.tpcNClsFound, he3.itsClusterSizes, he3.nSigmaTPC, he3.sign); + he3.dcaXY, he3.dcaZ, he3.tpcNClsFound, he3.tpcNClsPID, he3.itsClusterSizes, he3.nSigmaTPC, he3.sign); } for (const auto& lambda : lambdaCandidates) { lfLambda(lfHe3V0Collision.lastIndex(), lambda.momentum.Pt(), lambda.momentum.Eta(), lambda.momentum.Phi(), - lambda.mass, lambda.cosPA, lambda.dcaV0Daughters, lambda.dcaProtonToPV, lambda.dcaPionToPV, lambda.v0Radius, lambda.sign); + lambda.mass, lambda.cosPA, lambda.dcaV0Daughters, lambda.dcaProtonToPV, lambda.dcaPionToPV, lambda.v0Radius, lambda.protonNSigmaTPC, lambda.pionNSigmaTPC, lambda.sign); } for (const auto& he3 : he3Candidates) { @@ -391,12 +392,6 @@ struct he3LambdaAnalysis { } } PROCESS_SWITCH(he3LambdaAnalysis, processData, "Process data", true); - - // void processDerived(o2::aod::LFEvents::iterator const& collision, o2::aod::LFHe3 const& he3s, o2::aod::LFLambda const& lambdas) - // { - // - // } - // PROCESS_SWITCH(he3LambdaAnalysis, processDerived, "Process derived", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGLF/Tasks/Nuspex/he3LambdaDerivedAnalysis.cxx b/PWGLF/Tasks/Nuspex/he3LambdaDerivedAnalysis.cxx index 6d8f95d4ba2..7929f4eaa9c 100644 --- a/PWGLF/Tasks/Nuspex/he3LambdaDerivedAnalysis.cxx +++ b/PWGLF/Tasks/Nuspex/he3LambdaDerivedAnalysis.cxx @@ -64,7 +64,7 @@ struct he3LambdaDerivedAnalysis { hNsigmaProton = mRegistry.add("hNsigmaProton", "nSigma TPC for Proton", {HistType::kTH2D, {{100, -10., 10.}, {200, -5, 5.}}}); } - void processSameEvent(o2::aod::LFEvents::iterator const& collision, o2::aod::LFHe3 const& he3s, o2::aod::LFLambda const& lambdas) + void processSameEvent(o2::aod::LFEvents::iterator const& collision, o2::aod::LFHe3_000 const& he3s, o2::aod::LFLambda_000 const& lambdas) { std::vector he3Candidates; he3Candidates.reserve(he3s.size()); From 9ebd8f7cbb879d9573f2d4417e7bd7a1f7c342f4 Mon Sep 17 00:00:00 2001 From: jaelpark Date: Mon, 28 Jul 2025 16:58:26 +0200 Subject: [PATCH 104/345] [PWGCF] Add MC reco flags check, fix prompt check (#12284) --- PWGCF/TableProducer/filter2Prong.cxx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/PWGCF/TableProducer/filter2Prong.cxx b/PWGCF/TableProducer/filter2Prong.cxx index 80f9bb8e038..deb190dd778 100644 --- a/PWGCF/TableProducer/filter2Prong.cxx +++ b/PWGCF/TableProducer/filter2Prong.cxx @@ -115,9 +115,12 @@ struct Filter2Prong { using HFCandidates = soa::Join; using HFCandidatesML = soa::Join; + using HFCandidatesMCRecoML = soa::Join; template using HasMLProb = decltype(std::declval().mlProbD0()); + template + using HasFlagMcMatchRec = decltype(std::declval().flagMcMatchRec()); using PIDTrack = soa::Join; using ResoV0s = aod::V0Datas; @@ -170,6 +173,10 @@ struct Filter2Prong { continue; if (cfgYMax >= 0.0f && std::abs(hfHelper.yD0(c)) > cfgYMax) continue; + if constexpr (std::experimental::is_detected::value) { + if (std::abs(c.flagMcMatchRec()) != o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) + continue; + } if (c.isSelD0() > 0) { output2ProngTracks(cfcollisions.begin().globalIndex(), @@ -213,6 +220,12 @@ struct Filter2Prong { } PROCESS_SWITCH(Filter2Prong, processData, "Process data D0 candidates", true); + void processMCRecoML(aod::Collisions::iterator const& col, aod::BCsWithTimestamps const& bcs, aod::CFCollRefs const& cfcollisions, aod::CFTrackRefs const& cftracks, HFCandidatesMCRecoML const& candidates) + { + processDataT(col, bcs, cfcollisions, cftracks, candidates); + } + PROCESS_SWITCH(Filter2Prong, processMCRecoML, "Process data D0 candidates together with reco information and ML", false); + using HFMCTrack = soa::Join; void processMC(aod::McCollisions::iterator const&, aod::CFMcParticleRefs const& cfmcparticles, [[maybe_unused]] HFMCTrack const& mcparticles) { @@ -233,7 +246,7 @@ struct Filter2Prong { } } output2ProngMcParts(prongCFId[0], prongCFId[1], - (mcParticle.pdgCode() >= 0 ? aod::cf2prongtrack::D0ToPiK : aod::cf2prongtrack::D0barToKPi) | ((mcParticle.originMcGen() & RecoDecay::OriginType::Prompt) ? aod::cf2prongmcpart::Prompt : 0)); + (mcParticle.pdgCode() >= 0 ? aod::cf2prongtrack::D0ToPiK : aod::cf2prongtrack::D0barToKPi) | ((mcParticle.originMcGen() == RecoDecay::OriginType::Prompt) ? aod::cf2prongmcpart::Prompt : 0)); } } PROCESS_SWITCH(Filter2Prong, processMC, "Process MC 2-prong daughters", false); From 3dcbb1c30a0a9e62501be07f95835100805de261 Mon Sep 17 00:00:00 2001 From: yuanzhe <90246048+wang-yuanzhe@users.noreply.github.com> Date: Mon, 28 Jul 2025 17:31:06 +0200 Subject: [PATCH 105/345] [PWGLF] Add an option to update ST TrackPar using PV in kink builder (#12233) --- PWGLF/TableProducer/Common/kinkBuilder.cxx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/PWGLF/TableProducer/Common/kinkBuilder.cxx b/PWGLF/TableProducer/Common/kinkBuilder.cxx index 64605ec9897..fe1cdc61a87 100644 --- a/PWGLF/TableProducer/Common/kinkBuilder.cxx +++ b/PWGLF/TableProducer/Common/kinkBuilder.cxx @@ -111,6 +111,7 @@ struct kinkBuilder { Configurable nTPCClusMinDaug{"nTPCClusMinDaug", 80, "daug NTPC clusters cut"}; Configurable askTOFforDaug{"askTOFforDaug", false, "If true, ask for TOF signal"}; Configurable doSVRadiusCut{"doSVRadiusCut", true, "If true, apply the cut on the radius of the secondary vertex and tracksIU"}; + Configurable updateMothTrackUsePV{"updateMothTrackUsePV", false, "If true, update the mother track parameters using the primary vertex"}; o2::vertexing::DCAFitterN<2> fitter; o2::base::MatLayerCylSet* lut = nullptr; @@ -313,6 +314,14 @@ struct kinkBuilder { continue; } + if (updateMothTrackUsePV) { + // update the mother track parameters using the primary vertex + trackParCovMoth = trackParCovMothPV; + if (!trackParCovMoth.update(primaryVertex)) { + continue; + } + } + int nCand = 0; try { nCand = fitter.process(trackParCovMoth, trackParCovDaug); From 6c64d8b6377d703c46e3a7dbae1d8816f4f779c9 Mon Sep 17 00:00:00 2001 From: Marvin Hemmer <53471402+mhemmer-cern@users.noreply.github.com> Date: Mon, 28 Jul 2025 17:57:44 +0200 Subject: [PATCH 106/345] [PWGEM,PWGEM-36] taskPi0FlowEMC.cxx: Clear up includes and O2linter (#12286) --- PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx | 177 ++++++++++++--------- 1 file changed, 101 insertions(+), 76 deletions(-) diff --git a/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx b/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx index 2e64bd6ebe2..3f019289988 100644 --- a/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx +++ b/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx @@ -14,69 +14,89 @@ /// /// \author M. Hemmer, marvin.hemmer@cern.ch -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "Math/Vector4D.h" -#include "Math/Vector3D.h" -#include "Math/LorentzRotation.h" -#include "Math/Rotation3D.h" -#include "Math/AxisAngle.h" - -#include "CCDB/BasicCCDBManager.h" -#include "Framework/AnalysisTask.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/runDataProcessing.h" - -#include "Common/Core/EventPlaneHelper.h" -#include "Common/Core/RecoDecay.h" -#include "Common/DataModel/Qvectors.h" -#include "CommonConstants/MathConstants.h" - -#include "DetectorsBase/GeometryManager.h" -#include "DataFormatsEMCAL/Constants.h" -#include "EMCALBase/Geometry.h" -#include "EMCALCalib/BadChannelMap.h" - -#include "PWGEM/Dilepton/Utils/EMTrackUtilities.h" #include "PWGEM/PhotonMeson/Core/EMCPhotonCut.h" #include "PWGEM/PhotonMeson/Core/EMPhotonEventCut.h" #include "PWGEM/PhotonMeson/DataModel/gammaTables.h" -#include "PWGEM/PhotonMeson/Utils/emcalHistoDefinitions.h" -#include "PWGEM/PhotonMeson/Utils/PairUtilities.h" #include "PWGEM/PhotonMeson/Utils/EventHistograms.h" -#include "PWGEM/PhotonMeson/Utils/NMHistograms.h" +#include "PWGEM/PhotonMeson/Utils/emcalHistoDefinitions.h" + +#include "Common/CCDB/TriggerAliases.h" +#include "Common/Core/EventPlaneHelper.h" +#include "Common/Core/RecoDecay.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include // IWYU pragma: keep +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include using namespace o2; using namespace o2::aod; using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::soa; -using namespace o2::aod::pwgem::photonmeson::photonpair; using namespace o2::aod::pwgem::photon; -using namespace o2::aod::pwgem::dilepton::utils; - -enum QvecEstimator { FT0M = 0, - FT0A = 1, - FT0C, - TPCPos, - TPCNeg, - TPCTot }; - -enum CentralityEstimator { None = 0, - CFT0A = 1, - CFT0C, - CFT0M, - NCentralityEstimators + +enum QvecEstimator { + FT0M = 0, + FT0A = 1, + FT0C, + TPCPos, + TPCNeg, + TPCTot +}; + +enum CentralityEstimator { + None = 0, + CFT0A = 1, + CFT0C, + CFT0M, + NCentralityEstimators +}; + +enum Harmonics { + kNone = 0, + kDirect = 1, + kElliptic = 2, + kTriangluar = 3, + kQuadrangular = 4, + kPentagonal = 5, + kHexagonal = 6, + kHeptagonal = 7, + kOctagonal = 8 }; struct TaskPi0FlowEMC { @@ -98,6 +118,8 @@ struct TaskPi0FlowEMC { Configurable cfgDoM02{"cfgDoM02", false, "Flag to enable flow vs M02 for single photons"}; Configurable cfgDoReverseScaling{"cfgDoReverseScaling", false, "Flag to reverse the scaling that is possibly applied during NonLin"}; Configurable cfgDoPlaneQA{"cfgDoPlaneQA", false, "Flag to enable QA plots comparing in and out of plane"}; + Configurable cfgMaxQVector{"cfgMaxQVector", 20.f, "Maximum allowed absolute QVector value."}; + Configurable cfgMaxAsymmetry{"cfgMaxAsymmetry", 0.1f, "Maximum allowed asymmetry for photon pairs used in calibration."}; // configurable axis ConfigurableAxis thnConfigAxisInvMass{"thnConfigAxisInvMass", {400, 0.0, 0.8}, ""}; @@ -205,6 +227,9 @@ struct TaskPi0FlowEMC { std::vector lookupTable1D; float epsilon = 1.e-8; + // static constexpr + static constexpr int64_t NMinPhotonRotBkg = 3; + // To access the 1D array inline int getIndex(int iEta, int iPhi) { @@ -265,7 +290,7 @@ struct TaskPi0FlowEMC { void init(InitContext&) { - if (harmonic != 2 && harmonic != 3) { + if (harmonic != kElliptic && harmonic != kTriangluar) { LOG(info) << "Harmonic was set to " << harmonic << " but can only be 2 or 3!"; } @@ -492,65 +517,65 @@ struct TaskPi0FlowEMC { switch (detector) { case QvecEstimator::FT0M: - if (harmonic == 2) { + if (harmonic == kElliptic) { xQVec = collision.q2xft0m(); yQVec = collision.q2yft0m(); - } else if (harmonic == 3) { + } else if (harmonic == kTriangluar) { xQVec = collision.q3xft0m(); yQVec = collision.q3yft0m(); } break; case QvecEstimator::FT0A: - if (harmonic == 2) { + if (harmonic == kElliptic) { xQVec = collision.q2xft0a(); yQVec = collision.q2yft0a(); - } else if (harmonic == 3) { + } else if (harmonic == kTriangluar) { xQVec = collision.q3xft0a(); yQVec = collision.q3yft0a(); } break; case QvecEstimator::FT0C: - if (harmonic == 2) { + if (harmonic == kElliptic) { xQVec = collision.q2xft0c(); yQVec = collision.q2yft0c(); - } else if (harmonic == 3) { + } else if (harmonic == kTriangluar) { xQVec = collision.q3xft0c(); yQVec = collision.q3yft0c(); } break; case QvecEstimator::TPCPos: - if (harmonic == 2) { + if (harmonic == kElliptic) { xQVec = collision.q2xbpos(); yQVec = collision.q2ybpos(); - } else if (harmonic == 3) { + } else if (harmonic == kTriangluar) { xQVec = collision.q3xbpos(); yQVec = collision.q3ybpos(); } break; case QvecEstimator::TPCNeg: - if (harmonic == 2) { + if (harmonic == kElliptic) { xQVec = collision.q2xbneg(); yQVec = collision.q2ybneg(); - } else if (harmonic == 3) { + } else if (harmonic == kTriangluar) { xQVec = collision.q3xbneg(); yQVec = collision.q3ybneg(); } break; case QvecEstimator::TPCTot: - if (harmonic == 2) { + if (harmonic == kElliptic) { xQVec = collision.q2xbtot(); yQVec = collision.q2ybtot(); - } else if (harmonic == 3) { + } else if (harmonic == kTriangluar) { xQVec = collision.q3xbtot(); yQVec = collision.q3ybtot(); } break; default: LOG(warning) << "Q vector estimator not valid. Falling back to FT0M"; - if (harmonic == 2) { + if (harmonic == kElliptic) { xQVec = collision.q2xft0m(); yQVec = collision.q2yft0m(); - } else if (harmonic == 3) { + } else if (harmonic == kTriangluar) { xQVec = collision.q3xft0m(); yQVec = collision.q3yft0m(); } @@ -565,7 +590,7 @@ struct TaskPi0FlowEMC { { bool isgood = true; for (const auto& QVec : QVecs) { - if (std::fabs(QVec) > 20.f) { + if (std::fabs(QVec) > cfgMaxQVector) { isgood = false; break; } @@ -660,7 +685,7 @@ struct TaskPi0FlowEMC { void rotationBackground(const ROOT::Math::PtEtaPhiMVector& meson, ROOT::Math::PtEtaPhiMVector photon1, ROOT::Math::PtEtaPhiMVector photon2, TPhotons const& photons_coll, unsigned int ig1, unsigned int ig2, CollsWithQvecs::iterator const& collision) { // if less than 3 clusters are present skip event since we need at least 3 clusters - if (photons_coll.size() < 3) { + if (photons_coll.size() < NMinPhotonRotBkg) { return; } @@ -759,7 +784,7 @@ struct TaskPi0FlowEMC { void rotationBackgroundCalib(const ROOT::Math::PtEtaPhiMVector& meson, ROOT::Math::PtEtaPhiMVector photon1, ROOT::Math::PtEtaPhiMVector photon2, TPhotons const& photons_coll, unsigned int ig1, unsigned int ig2, CollsWithQvecs::iterator const& collision) { // if less than 3 clusters are present skip event since we need at least 3 clusters - if (photons_coll.size() < 3) { + if (photons_coll.size() < NMinPhotonRotBkg) { return; } float cent = getCentrality(collision); @@ -794,7 +819,7 @@ struct TaskPi0FlowEMC { } ROOT::Math::PtEtaPhiMVector photon3(photon.pt(), photon.eta(), photon.phi(), 0.); if (iCellIDPhoton1 >= 0) { - if (std::fabs((photon1.E() - photon3.E()) / (photon1.E() + photon3.E()) < 0.1)) { // only use symmetric decays + if (std::fabs((photon1.E() - photon3.E()) / (photon1.E() + photon3.E()) < cfgMaxAsymmetry)) { // only use symmetric decays ROOT::Math::PtEtaPhiMVector mother1 = photon1 + photon3; float openingAngle1 = std::acos(photon1.Vect().Dot(photon3.Vect()) / (photon1.P() * photon3.P())); @@ -812,7 +837,7 @@ struct TaskPi0FlowEMC { } } if (iCellIDPhoton2 >= 0) { - if (std::fabs((photon2.E() - photon3.E()) / (photon2.E() + photon3.E()) < 0.1)) { // only use symmetric decays + if (std::fabs((photon2.E() - photon3.E()) / (photon2.E() + photon3.E()) < cfgMaxAsymmetry)) { // only use symmetric decays ROOT::Math::PtEtaPhiMVector mother2 = photon2 + photon3; float openingAngle2 = std::acos(photon2.Vect().Dot(photon3.Vect()) / (photon2.P() * photon3.P())); @@ -1138,7 +1163,7 @@ struct TaskPi0FlowEMC { float yQVecBNeg = -999.f; float xQVecBTot = -999.f; float yQVecBTot = -999.f; - if (harmonic == 2) { + if (harmonic == kElliptic) { xQVecFT0a = collision.q2xft0a(); yQVecFT0a = collision.q2yft0a(); xQVecFT0c = collision.q2xft0c(); @@ -1151,7 +1176,7 @@ struct TaskPi0FlowEMC { yQVecBNeg = collision.q2ybneg(); xQVecBTot = collision.q2xbtot(); yQVecBTot = collision.q2ybtot(); - } else if (harmonic == 3) { + } else if (harmonic == kTriangluar) { xQVecFT0a = collision.q3xft0a(); yQVecFT0a = collision.q3yft0a(); xQVecFT0c = collision.q3xft0c(); @@ -1203,7 +1228,7 @@ struct TaskPi0FlowEMC { registry.fill(HIST("epReso/hEpResoFT0mTPCneg"), centrality, std::cos(harmonic * getDeltaPsiInRange(epFT0m, epBNegs))); registry.fill(HIST("epReso/hEpResoFT0mTPCtot"), centrality, std::cos(harmonic * getDeltaPsiInRange(epFT0m, epBTots))); registry.fill(HIST("epReso/hEpResoTPCposTPCneg"), centrality, std::cos(harmonic * getDeltaPsiInRange(epBPoss, epBNegs))); - for (int n = 1; n <= 8; n++) { + for (int n = 1; n <= kOctagonal; n++) { registry.fill(HIST("epReso/hEpCosCoefficientsFT0c"), centrality, n, std::cos(n * epFT0c)); registry.fill(HIST("epReso/hEpSinCoefficientsFT0c"), centrality, n, std::sin(n * epFT0c)); registry.fill(HIST("epReso/hEpCosCoefficientsFT0a"), centrality, n, std::cos(n * epFT0a)); @@ -1323,7 +1348,7 @@ struct TaskPi0FlowEMC { registry.fill(HIST("hClusterCuts"), 5); continue; } - if (std::fabs((v1.E() - v2.E()) / (v1.E() + v2.E()) < 0.1)) { // only use symmetric decays + if (std::fabs((v1.E() - v2.E()) / (v1.E() + v2.E()) < cfgMaxAsymmetry)) { // only use symmetric decays registry.fill(HIST("hClusterCuts"), 6); registry.fill(HIST("hSparseCalibSE"), vMeson.M(), vMeson.E() / 2., getCentrality(collision)); } From 1ba3ac5ea5f8c7b13df5f4ae4e711e786c4f20e7 Mon Sep 17 00:00:00 2001 From: blacwovie Date: Tue, 29 Jul 2025 00:31:08 +0800 Subject: [PATCH 107/345] [PWGCF] fix track selection bug (#12238) Co-authored-by: ALICE Action Bot --- PWGCF/Femto/TableProducer/PiDeuteronFemto.cxx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/PWGCF/Femto/TableProducer/PiDeuteronFemto.cxx b/PWGCF/Femto/TableProducer/PiDeuteronFemto.cxx index 4988e4d1068..dbfd962f801 100644 --- a/PWGCF/Femto/TableProducer/PiDeuteronFemto.cxx +++ b/PWGCF/Femto/TableProducer/PiDeuteronFemto.cxx @@ -230,6 +230,7 @@ struct PiDeuteronFemto { {"hEmptyPool", "svPoolCreator did not find track pairs false/true", {HistType::kTH1F, {{2, -0.5, 1.5}}}}, {"hdcaxyDe", ";DCA_{xy} (cm)", {HistType::kTH1F, {{200, -1.0f, 1.0f}}}}, {"hdcazDe", ";DCA_{z} (cm)", {HistType::kTH1F, {{200, -1.0f, 1.0f}}}}, + {"hdcazDe_min", ";DCA_{z}-min (cm)", {HistType::kTH1F, {{20, -1.0f, 1.0f}}}}, {"hNClsDeITS", ";N_{ITS} Cluster", {HistType::kTH1F, {{20, -10.0f, 10.0f}}}}, {"hNClsPiITS", ";N_{ITS} Cluster", {HistType::kTH1F, {{20, -10.0f, 10.0f}}}}, {"hDePitInvMass", "; M(De + p) (GeV/#it{c}^{2})", {HistType::kTH1F, {{300, 3.74f, 4.34f}}}}, @@ -464,8 +465,10 @@ struct PiDeuteronFemto { mQaRegistry.fill(HIST("h2NsigmaDeTPC"), candidate.sign() * candidate.pt(), tpcNSigmaDe); mQaRegistry.fill(HIST("h2NsigmaDeTOF"), candidate.sign() * candidate.pt(), tofNSigmaDe); return true; - } else if (std::abs(tpcNSigmaDe) < settingCutNsigmaTPCDe) { - + } else if (candidate.tpcInnerParam() <= settingCutPinMinTOFITSDe) { + if (std::abs(tpcNSigmaDe) > settingCutNsigmaTPCDe) { + return false; + } o2::aod::ITSResponse mResponseITS; auto itsnSigmaDe = mResponseITS.nSigmaITS(candidate.itsClusterSizes(), candidate.p(), candidate.eta()); mQaRegistry.fill(HIST("h2NSigmaDeITS_preselection"), candidate.sign() * candidate.pt(), itsnSigmaDe); @@ -719,6 +722,7 @@ struct PiDeuteronFemto { mQaRegistry.fill(HIST("hDePitInvMass"), piDecand.invMass); mQaRegistry.fill(HIST("hdcaxyDe"), piDecand.dcaxyDe); mQaRegistry.fill(HIST("hdcazDe"), piDecand.dcazDe); + mQaRegistry.fill(HIST("hdcazDe_min"), (abs(piDecand.dcazDe) - settingCutDeDCAzMin)); mQaRegistry.fill(HIST("hNClsDeITS"), piDecand.nClsItsDe); mQaRegistry.fill(HIST("hNClsPiITS"), piDecand.nClsItsPi); mQaRegistry.fill(HIST("hisBkgEM"), piDecand.isBkgEM); @@ -781,7 +785,6 @@ struct PiDeuteronFemto { float DeDCAxyMin = 0.015 + 0.0305 / TMath::Power(piDecand.recoPtDe(), 1.1); if (abs(piDecand.dcaxyDe) > DeDCAxyMin || abs(piDecand.dcazDe) > settingCutDeDCAzMin || abs(piDecand.dcaxyPi) > settingCutPiDCAxyMin || abs(piDecand.dcazPi) > settingCutPiDCAzMin) return; - fillHistograms(piDecand); double kstar = computeKstar(piDecand); From 8d75a8851891ba32a963153aba6ef8611b643261 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Mon, 28 Jul 2025 18:57:32 +0200 Subject: [PATCH 108/345] [PWGEM/Dilepton] reduce data size for 2PC (#12290) --- PWGEM/Dilepton/DataModel/dileptonTables.h | 9 ++++++--- PWGEM/Dilepton/TableProducer/skimmerPrimaryTrack.cxx | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/PWGEM/Dilepton/DataModel/dileptonTables.h b/PWGEM/Dilepton/DataModel/dileptonTables.h index a96debb1457..d8639eaab5b 100644 --- a/PWGEM/Dilepton/DataModel/dileptonTables.h +++ b/PWGEM/Dilepton/DataModel/dileptonTables.h @@ -695,8 +695,10 @@ DECLARE_SOA_COLUMN(CollisionId, collisionId, int); //! DECLARE_SOA_COLUMN(TrackId, trackId, int); //! // DECLARE_SOA_COLUMN(Sign, sign, int8_t); //! DECLARE_SOA_COLUMN(TrackBit, trackBit, uint16_t); //! -DECLARE_SOA_COLUMN(PtUINT16, ptuint16, uint16_t); //! +DECLARE_SOA_COLUMN(PtUINT16, ptuint16, uint16_t); //! 0 - 65536 +DECLARE_SOA_COLUMN(DcaZINT16, dcaZint16, int16_t); //! -32768 - +32768 DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt, [](uint16_t ptuint16) -> float { return static_cast(ptuint16) * 1e-4; }); +DECLARE_SOA_DYNAMIC_COLUMN(DcaZ, dcaZ, [](int16_t dcaZint16) -> float { return static_cast(dcaZint16) * 1e-4; }); // DECLARE_SOA_DYNAMIC_COLUMN(Signed1Pt, signed1Pt, [](float pt, int8_t sign) -> float { return sign * 1. / pt; }); // DECLARE_SOA_DYNAMIC_COLUMN(P, p, [](float pt, float eta) -> float { return pt * std::cosh(eta); }); // DECLARE_SOA_DYNAMIC_COLUMN(Px, px, [](float pt, float phi) -> float { return pt * std::cos(phi); }); @@ -706,7 +708,7 @@ DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt, [](uint16_t ptuint16) -> float { return stati DECLARE_SOA_TABLE_VERSIONED(EMPrimaryTracks_000, "AOD", "EMPRIMARYTRACK", 0, //! o2::soa::Index<>, emprimarytrack::CollisionId, emprimarytrack::TrackId, /* emprimarytrack::Sign,*/ - emprimarytrack::PtUINT16, track::Eta, track::Phi, track::DcaXY, track::DcaZ, emprimarytrack::TrackBit, + emprimarytrack::PtUINT16, track::Eta, track::Phi, track::DcaXY, emprimarytrack::DcaZINT16, emprimarytrack::TrackBit, // track::TPCNClsFindable, track::TPCNClsFindableMinusFound, track::TPCNClsFindableMinusCrossedRows, track::TPCNClsShared, track::TPCChi2NCl, // track::ITSClusterSizes, track::ITSChi2NCl, track::DetectorMap, @@ -725,7 +727,8 @@ DECLARE_SOA_TABLE_VERSIONED(EMPrimaryTracks_000, "AOD", "EMPRIMARYTRACK", 0, // emprimarytrack::Px, // emprimarytrack::Py, // emprimarytrack::Pz - emprimarytrack::Pt); + emprimarytrack::Pt, + emprimarytrack::DcaZ); using EMPrimaryTracks = EMPrimaryTracks_000; // iterators diff --git a/PWGEM/Dilepton/TableProducer/skimmerPrimaryTrack.cxx b/PWGEM/Dilepton/TableProducer/skimmerPrimaryTrack.cxx index 7e05accb739..65b5252bf34 100644 --- a/PWGEM/Dilepton/TableProducer/skimmerPrimaryTrack.cxx +++ b/PWGEM/Dilepton/TableProducer/skimmerPrimaryTrack.cxx @@ -242,6 +242,9 @@ struct skimmerPrimaryTrack { if (std::fabs(dcaXY) > dca_xy_max || std::fabs(dcaZ) > dca_z_max) { return false; } + if (std::fabs(dcaZ) > 3.f) { + return false; + } if (std::fabs(trackParCov.getEta()) > maxeta || trackParCov.getPt() < minpt || maxpt < trackParCov.getPt()) { return false; @@ -304,17 +307,17 @@ struct skimmerPrimaryTrack { if (track.tpcNClsFound() >= 90) { trackBit |= static_cast(RefTrackBit::kNclsTPC90); } - if (track.tpcChi2NCl() < 4) { + if (track.tpcChi2NCl() < 4.f) { trackBit |= static_cast(RefTrackBit::kChi2TPC4); } - if (track.tpcChi2NCl() < 3) { + if (track.tpcChi2NCl() < 3.f) { trackBit |= static_cast(RefTrackBit::kChi2TPC3); } if (track.tpcFractionSharedCls() < 0.7) { trackBit |= static_cast(RefTrackBit::kFracSharedTPC07); } - emprimarytracks(collision.globalIndex(), track.globalIndex(), /*track.sign(),*/ static_cast(pt * 1e+4), eta, phi, dcaXY, dcaZ, trackBit); + emprimarytracks(collision.globalIndex(), track.globalIndex(), static_cast(pt * 1e+4), eta, phi, dcaXY, static_cast(dcaZ * 1e+4), trackBit); // prmtrackeventidtmp(collision.globalIndex()); stored_trackIds.emplace_back(std::pair{collision.globalIndex(), track.globalIndex()}); From f652b1ffeb108ef21ee801e59e1f77bb91027889 Mon Sep 17 00:00:00 2001 From: abmodak <67369858+abmodak@users.noreply.github.com> Date: Mon, 28 Jul 2025 19:41:36 +0200 Subject: [PATCH 109/345] [PWGCF] Rework on the task longrangeCorrelation.cxx (#12285) --- .../Tasks/longrangeCorrelation.cxx | 903 +++++++++++++++--- 1 file changed, 774 insertions(+), 129 deletions(-) diff --git a/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx b/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx index 5fb1bc8e1c8..b71695872c4 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx @@ -12,50 +12,54 @@ /// \file longrangeCorrelation.cxx /// /// \brief task for long range correlation analysis -/// \author Abhi Modak (abhi.modak@cern.ch) and Debojit sarkar (debojit.sarkar@cern.ch) +/// \author Abhi Modak (abhi.modak@cern.ch) and Debojit Sarkar (debojit.sarkar@cern.ch) /// \since April 22, 2025 -#include -#include -#include -#include -#include -#include -#include +#include "PWGCF/Core/CorrelationContainer.h" +#include "PWGCF/Core/PairCuts.h" +#include "PWGCF/DataModel/CorrelationsDerived.h" +#include "PWGMM/Mult/DataModel/bestCollisionTable.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/StepTHn.h" -#include "ReconstructionDataFormats/Track.h" -#include "Common/DataModel/PIDResponse.h" -#include "Common/DataModel/Multiplicity.h" +#include "Common/Core/RecoDecay.h" +#include "Common/Core/TrackSelection.h" +#include "Common/Core/trackUtilities.h" #include "Common/DataModel/Centrality.h" -#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/DataModel/CollisionAssociationTables.h" #include "Common/DataModel/EventSelection.h" -#include "Common/Core/trackUtilities.h" -#include "CommonConstants/PhysicsConstants.h" -#include "Common/Core/TrackSelection.h" -#include "Framework/ASoAHelpers.h" #include "Common/DataModel/FT0Corrected.h" -#include "Common/Core/RecoDecay.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "CCDB/BasicCCDBManager.h" +#include "CCDB/CcdbApi.h" #include "CommonConstants/MathConstants.h" +#include "CommonConstants/PhysicsConstants.h" +#include "DetectorsCommonDataFormats/AlignParam.h" #include "FT0Base/Geometry.h" #include "FV0Base/Geometry.h" -#include "PWGCF/DataModel/CorrelationsDerived.h" -#include "Common/DataModel/CollisionAssociationTables.h" -#include "PWGCF/Core/CorrelationContainer.h" -#include "PWGCF/Core/PairCuts.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/StepTHn.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/Track.h" -#include "CCDB/CcdbApi.h" -#include "CCDB/BasicCCDBManager.h" -#include "DetectorsCommonDataFormats/AlignParam.h" +#include +#include +#include + +#include +#include +#include +#include using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::aod::track; +using namespace o2::aod::fwdtrack; using namespace o2::aod::evsel; using namespace o2::constants::math; @@ -72,8 +76,6 @@ static constexpr TrackSelectionFlags::flagtype TrackSelectionDcaxyOnly = TrackSelectionFlags::kDCAxy; AxisSpec axisEvent{10, 0.5, 9.5, "#Event", "EventAxis"}; -AxisSpec amplitudeFT0{5000, 0, 10000, "FT0 amplitude"}; -AxisSpec channelFT0Axis{96, 0.0, 96.0, "FT0 channel"}; struct LongrangeCorrelation { @@ -86,6 +88,7 @@ struct LongrangeCorrelation { Service ccdb; o2::ccdb::CcdbApi ccdbApi; std::vector* offsetFT0; + std::vector* offsetFV0; HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; Configurable cfgVtxCut{"cfgVtxCut", 10.0f, "Vertex Z range to consider"}; Configurable cfgEtaCut{"cfgEtaCut", 1.0f, "Eta range to consider"}; @@ -95,7 +98,12 @@ struct LongrangeCorrelation { Configurable mixingParameter{"mixingParameter", 5, "how many events are mixed"}; Configurable cfgMinMult{"cfgMinMult", 0, "Minimum multiplicity for collision"}; Configurable cfgMaxMult{"cfgMaxMult", 10, "Maximum multiplicity for collision"}; + Configurable cfigMftEtaMax{"cfigMftEtaMax", -2.5f, "Maximum MFT eta cut"}; + Configurable cfigMftEtaMin{"cfigMftEtaMin", -3.6f, "Minimum MFT eta cut"}; + Configurable cfigMftDcaxy{"cfigMftDcaxy", 2.0f, "cut on DCA xy for MFT tracks"}; + Configurable cfigMftCluster{"cfigMftCluster", 5, "cut on MFT Cluster"}; Configurable cfgSampleSize{"cfgSampleSize", 10, "Sample size for mixed event"}; + Configurable isApplySameBunchPileup{"isApplySameBunchPileup", false, "Enable SameBunchPileup cut"}; ConfigurableAxis axisDeltaPhi{"axisDeltaPhi", {72, -PIHalf, PIHalf * 3}, "delta phi axis for histograms"}; ConfigurableAxis axisDeltaEta{"axisDeltaEta", {40, -6, -2}, "delta eta axis for histograms"}; ConfigurableAxis axisPtTrigger{"axisPtTrigger", {VARIABLE_WIDTH, 0.5, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0, 10.0}, "pt trigger axis for histograms"}; @@ -111,13 +119,25 @@ struct LongrangeCorrelation { ConfigurableAxis axisEtaAssoc{"axisEtaAssoc", {96, 3.5, 4.9}, "#eta assoc axis"}; ConfigurableAxis axisSample{"axisSample", {cfgSampleSize, 0, cfgSampleSize}, "sample axis for histograms"}; ConfigurableAxis axisMultiplicity{"axisMultiplicity", {VARIABLE_WIDTH, 0, 5, 10, 15, 20, 25, 30, 35, 40, 50, 60, 80, 100}, "multiplicity / centrality axis for histograms"}; + ConfigurableAxis amplitudeFt0a{"amplitudeFt0a", {5000, 0, 10000}, "FT0A amplitude"}; + ConfigurableAxis channelFt0aAxis{"channelFt0aAxis", {96, 0.0, 96.0}, "FT0A channel"}; using CollTable = soa::Join; using TrksTable = soa::Filtered>; - Preslice perCollision = aod::track::collisionId; - - OutputObj same{Form("sameEvent_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; - OutputObj mixed{Form("mixedEvent_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; + using MftTrkTable = soa::Filtered; + Preslice perColGlobal = aod::track::collisionId; + Preslice perColMft = aod::fwdtrack::collisionId; + + OutputObj sameFt0aGlobal{Form("sameEventFt0aGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; + OutputObj mixedFt0aGlobal{Form("mixedEventFt0aGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; + OutputObj sameFt0cGlobal{Form("sameEventFt0cGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; + OutputObj mixedFt0cGlobal{Form("mixedEventFt0cGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; + OutputObj sameMftGlobal{Form("sameEventMftGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; + OutputObj mixedMftGlobal{Form("mixedEventMftGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; + OutputObj sameFv0Global{Form("sameEventFv0Global_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; + OutputObj mixedFv0Global{Form("mixedEventFv0Global_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; + OutputObj sameFv0Mft{Form("sameEventFv0Mft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; + OutputObj mixedFv0Mft{Form("mixedEventFv0Mft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; void init(InitContext const&) { @@ -128,45 +148,18 @@ struct LongrangeCorrelation { ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); LOGF(info, "Getting alignment offsets from the CCDB..."); offsetFT0 = ccdb->getForTimeStamp>("FT0/Calib/Align", cfgCcdbParam.noLaterThan.value); + offsetFV0 = ccdb->getForTimeStamp>("FV0/Calib/Align", cfgCcdbParam.noLaterThan.value); LOGF(info, "Offset for FT0A: x = %.3f y = %.3f z = %.3f\n", (*offsetFT0)[0].getX(), (*offsetFT0)[0].getY(), (*offsetFT0)[0].getZ()); LOGF(info, "Offset for FT0C: x = %.3f y = %.3f z = %.3f\n", (*offsetFT0)[1].getX(), (*offsetFT0)[1].getY(), (*offsetFT0)[1].getZ()); - - // QA histos - histos.add("QA/EventHist", "events", kTH1F, {axisEvent}, false); - histos.add("QA/VtxZHist", "v_{z} (cm)", kTH1F, {axisVtxZ}, false); - histos.add("QA/hMEpvz1", ";pvz;Entries", kTH1F, {{30, -15, 15}}); - histos.add("QA/hMEpvz2", ";pvz;Entries", kTH1F, {{30, -15, 15}}); - histos.add("QA/hMixingQA", "events", kTH1F, {axisEvent}, false); + LOGF(info, "Offset for FV0-left: x = %.3f y = %.3f\n", (*offsetFV0)[0].getX(), (*offsetFV0)[0].getY()); + LOGF(info, "Offset for FV0-right: x = %.3f y = %.3f\n", (*offsetFV0)[1].getX(), (*offsetFV0)[1].getY()); auto hstat = histos.get(HIST("QA/EventHist")); auto* x = hstat->GetXaxis(); x->SetBinLabel(1, "All events"); x->SetBinLabel(2, "sel8"); - x->SetBinLabel(3, "|vz|<10"); - - histos.add("SE/hMult", "event multiplicity", kTH1D, {axisMultiplicity}); - histos.add("SE/Trig_etavsphi", ";#eta;#phi", kTH2D, {axisPhi, axisEtaTrig}); - histos.add("SE/Trig_eta", "#eta", kTH1D, {axisEtaTrig}); - histos.add("SE/Trig_phi", "#eta", kTH1D, {axisPhi}); - histos.add("SE/Trig_pt", "p_{T}", kTH1D, {axisPtTrigger}); - histos.add("SE/hMult_used", "event multiplicity", kTH1F, {axisMultiplicity}); - histos.add("SE/Trig_hist", "trig hist", kTHnSparseF, {axisSample, axisVtxZ, axisPtTrigger}); - histos.add("SE/FT0Amp", "ftoamult", kTH2D, {channelFT0Axis, amplitudeFT0}); - histos.add("SE/FT0Aeta", "ft0a;#eta", kTH1D, {axisEtaAssoc}); - histos.add("SE/FT0Aphi", "ft0a;#phi", kTH1D, {axisPhi}); - histos.add("SE/FT0Aetavsphi", ";ft0a;#eta;#phi", kTH2D, {axisPhi, axisEtaAssoc}); - histos.add("SE/deltaEta_deltaPhi", ";#delta#eta;#delta#phi", kTH2D, {axisDeltaPhi, axisDeltaEta}); - - histos.add("ME/hMult", "event multiplicity", kTH1D, {axisMultiplicity}); - histos.add("ME/Trig_etavsphi", ";#eta;#phi", kTH2D, {axisPhi, axisEtaTrig}); - histos.add("ME/Trig_eta", "#eta", kTH1D, {axisEtaTrig}); - histos.add("ME/Trig_phi", "#eta", kTH1D, {axisPhi}); - histos.add("ME/Trig_pt", "p_{T}", kTH1D, {axisPtTrigger}); - histos.add("ME/FT0Amp", "ftoamult", kTH2D, {channelFT0Axis, amplitudeFT0}); - histos.add("ME/FT0Aeta", "ft0a;#eta", kTH1D, {axisEtaAssoc}); - histos.add("ME/FT0Aphi", "ft0a;#phi", kTH1D, {axisPhi}); - histos.add("ME/FT0Aetavsphi", ";ft0a;#eta;#phi", kTH2D, {axisPhi, axisEtaAssoc}); - histos.add("ME/deltaEta_deltaPhi", ";#delta#eta;#delta#phi", kTH2D, {axisDeltaPhi, axisDeltaEta}); + x->SetBinLabel(3, "kNoSameBunchPileup"); // reject collisions in case of pileup with another collision in the same foundBC + x->SetBinLabel(4, "|vz|<10"); std::vector corrAxis = {{axisSample, "Sample"}, {axisVtxZ, "z-vtx (cm)"}, @@ -180,10 +173,168 @@ struct LongrangeCorrelation { std::vector userAxis; - same.setObject(new CorrelationContainer(Form("sameEvent_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("sameEvent_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); - mixed.setObject(new CorrelationContainer(Form("mixedEvent_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("mixedEvent_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); + if (doprocessEventStat) { + histos.add("QA/EventHist", "events", kTH1F, {axisEvent}, false); + histos.add("QA/VtxZHist", "v_{z} (cm)", kTH1F, {axisVtxZ}, false); + } + + if (doprocessFt0aGlobalSE || doprocessFt0aGlobalME) { + histos.add("Ft0aGlobal/SE/hMult", "event multiplicity", kTH1D, {axisMultiplicity}); + histos.add("Ft0aGlobal/SE/Trig_etavsphi", ";#eta;#phi", kTH2D, {axisPhi, axisEtaTrig}); + histos.add("Ft0aGlobal/SE/Trig_eta", "#eta", kTH1D, {axisEtaTrig}); + histos.add("Ft0aGlobal/SE/Trig_phi", "#eta", kTH1D, {axisPhi}); + histos.add("Ft0aGlobal/SE/Trig_pt", "p_{T}", kTH1D, {axisPtTrigger}); + histos.add("Ft0aGlobal/SE/hMult_used", "event multiplicity", kTH1F, {axisMultiplicity}); + histos.add("Ft0aGlobal/SE/Trig_hist", "trig hist", kTHnSparseF, {axisSample, axisVtxZ, axisPtTrigger}); + histos.add("Ft0aGlobal/SE/FT0Amp", "ft0amult", kTH2D, {channelFt0aAxis, amplitudeFt0a}); + histos.add("Ft0aGlobal/SE/FT0eta", "ft0a;#eta", kTH1D, {axisEtaAssoc}); + histos.add("Ft0aGlobal/SE/FT0phi", "ft0a;#phi", kTH1D, {axisPhi}); + histos.add("Ft0aGlobal/SE/FT0etavsphi", ";ft0a;#eta;#phi", kTH2D, {axisPhi, axisEtaAssoc}); + histos.add("Ft0aGlobal/SE/deltaEta_deltaPhi", ";#delta#eta;#delta#phi", kTH2D, {axisDeltaPhi, axisDeltaEta}); + + histos.add("Ft0aGlobal/ME/hMult", "event multiplicity", kTH1D, {axisMultiplicity}); + histos.add("Ft0aGlobal/ME/Trig_etavsphi", ";#eta;#phi", kTH2D, {axisPhi, axisEtaTrig}); + histos.add("Ft0aGlobal/ME/Trig_eta", "#eta", kTH1D, {axisEtaTrig}); + histos.add("Ft0aGlobal/ME/Trig_phi", "#eta", kTH1D, {axisPhi}); + histos.add("Ft0aGlobal/ME/Trig_pt", "p_{T}", kTH1D, {axisPtTrigger}); + histos.add("Ft0aGlobal/ME/FT0Amp", "ft0amult", kTH2D, {channelFt0aAxis, amplitudeFt0a}); + histos.add("Ft0aGlobal/ME/FT0eta", "ft0a;#eta", kTH1D, {axisEtaAssoc}); + histos.add("Ft0aGlobal/ME/FT0phi", "ft0a;#phi", kTH1D, {axisPhi}); + histos.add("Ft0aGlobal/ME/FT0etavsphi", ";ft0a;#eta;#phi", kTH2D, {axisPhi, axisEtaAssoc}); + histos.add("Ft0aGlobal/ME/deltaEta_deltaPhi", ";#delta#eta;#delta#phi", kTH2D, {axisDeltaPhi, axisDeltaEta}); + + sameFt0aGlobal.setObject(new CorrelationContainer(Form("sameEventFt0aGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("sameEventFt0aGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); + mixedFt0aGlobal.setObject(new CorrelationContainer(Form("mixedEventFt0aGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("mixedEventFt0aGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); + } + + if (doprocessFt0cGlobalSE || doprocessFt0cGlobalME) { + histos.add("Ft0cGlobal/SE/hMult", "event multiplicity", kTH1D, {axisMultiplicity}); + histos.add("Ft0cGlobal/SE/Trig_etavsphi", ";#eta;#phi", kTH2D, {axisPhi, axisEtaTrig}); + histos.add("Ft0cGlobal/SE/Trig_eta", "#eta", kTH1D, {axisEtaTrig}); + histos.add("Ft0cGlobal/SE/Trig_phi", "#eta", kTH1D, {axisPhi}); + histos.add("Ft0cGlobal/SE/Trig_pt", "p_{T}", kTH1D, {axisPtTrigger}); + histos.add("Ft0cGlobal/SE/hMult_used", "event multiplicity", kTH1F, {axisMultiplicity}); + histos.add("Ft0cGlobal/SE/Trig_hist", "trig hist", kTHnSparseF, {axisSample, axisVtxZ, axisPtTrigger}); + histos.add("Ft0cGlobal/SE/FT0Amp", "ft0amult", kTH2D, {channelFt0aAxis, amplitudeFt0a}); + histos.add("Ft0cGlobal/SE/FT0eta", "ft0a;#eta", kTH1D, {axisEtaAssoc}); + histos.add("Ft0cGlobal/SE/FT0phi", "ft0a;#phi", kTH1D, {axisPhi}); + histos.add("Ft0cGlobal/SE/FT0etavsphi", ";ft0a;#eta;#phi", kTH2D, {axisPhi, axisEtaAssoc}); + histos.add("Ft0cGlobal/SE/deltaEta_deltaPhi", ";#delta#eta;#delta#phi", kTH2D, {axisDeltaPhi, axisDeltaEta}); + + histos.add("Ft0cGlobal/ME/hMult", "event multiplicity", kTH1D, {axisMultiplicity}); + histos.add("Ft0cGlobal/ME/Trig_etavsphi", ";#eta;#phi", kTH2D, {axisPhi, axisEtaTrig}); + histos.add("Ft0cGlobal/ME/Trig_eta", "#eta", kTH1D, {axisEtaTrig}); + histos.add("Ft0cGlobal/ME/Trig_phi", "#eta", kTH1D, {axisPhi}); + histos.add("Ft0cGlobal/ME/Trig_pt", "p_{T}", kTH1D, {axisPtTrigger}); + histos.add("Ft0cGlobal/ME/FT0Amp", "ft0cmult", kTH2D, {channelFt0aAxis, amplitudeFt0a}); + histos.add("Ft0cGlobal/ME/FT0eta", "ft0c;#eta", kTH1D, {axisEtaAssoc}); + histos.add("Ft0cGlobal/ME/FT0phi", "ft0c;#phi", kTH1D, {axisPhi}); + histos.add("Ft0cGlobal/ME/FT0etavsphi", ";ft0c;#eta;#phi", kTH2D, {axisPhi, axisEtaAssoc}); + histos.add("Ft0cGlobal/ME/deltaEta_deltaPhi", ";#delta#eta;#delta#phi", kTH2D, {axisDeltaPhi, axisDeltaEta}); + + sameFt0cGlobal.setObject(new CorrelationContainer(Form("sameEventFt0cGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("sameEventFt0cGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); + mixedFt0cGlobal.setObject(new CorrelationContainer(Form("mixedEventFt0cGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("mixedEventFt0cGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); + } + + if (doprocessMftGlobalSE || doprocessMftGlobalME) { + histos.add("MftGlobal/SE/hMult", "event multiplicity", kTH1D, {axisMultiplicity}); + histos.add("MftGlobal/SE/Trig_etavsphi", ";#eta;#phi", kTH2D, {axisPhi, axisEtaTrig}); + histos.add("MftGlobal/SE/Trig_eta", "#eta", kTH1D, {axisEtaTrig}); + histos.add("MftGlobal/SE/Trig_phi", "#eta", kTH1D, {axisPhi}); + histos.add("MftGlobal/SE/Trig_pt", "p_{T}", kTH1D, {axisPtTrigger}); + histos.add("MftGlobal/SE/hMult_used", "event multiplicity", kTH1F, {axisMultiplicity}); + histos.add("MftGlobal/SE/Trig_hist", "trig hist", kTHnSparseF, {axisSample, axisVtxZ, axisPtTrigger}); + histos.add("MftGlobal/SE/MFTeta", "mft;#eta", kTH1D, {axisEtaAssoc}); + histos.add("MftGlobal/SE/MFTphi", "mft;#phi", kTH1D, {axisPhi}); + histos.add("MftGlobal/SE/MFTetavsphi", ";mft0;#eta;#phi", kTH2D, {axisPhi, axisEtaAssoc}); + histos.add("MftGlobal/SE/deltaEta_deltaPhi", ";#delta#eta;#delta#phi", kTH2D, {axisDeltaPhi, axisDeltaEta}); + + histos.add("MftGlobal/ME/hMult", "event multiplicity", kTH1D, {axisMultiplicity}); + histos.add("MftGlobal/ME/Trig_etavsphi", ";#eta;#phi", kTH2D, {axisPhi, axisEtaTrig}); + histos.add("MftGlobal/ME/Trig_eta", "#eta", kTH1D, {axisEtaTrig}); + histos.add("MftGlobal/ME/Trig_phi", "#eta", kTH1D, {axisPhi}); + histos.add("MftGlobal/ME/Trig_pt", "p_{T}", kTH1D, {axisPtTrigger}); + histos.add("MftGlobal/ME/MFTeta", "mft;#eta", kTH1D, {axisEtaAssoc}); + histos.add("MftGlobal/ME/MFTphi", "mft;#phi", kTH1D, {axisPhi}); + histos.add("MftGlobal/ME/MFTetavsphi", ";mft;#eta;#phi", kTH2D, {axisPhi, axisEtaAssoc}); + histos.add("MftGlobal/ME/deltaEta_deltaPhi", ";#delta#eta;#delta#phi", kTH2D, {axisDeltaPhi, axisDeltaEta}); + + sameMftGlobal.setObject(new CorrelationContainer(Form("sameEventMftGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("sameEventMftGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); + mixedMftGlobal.setObject(new CorrelationContainer(Form("mixedEventMftGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("mixedEventMftGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); + } + + if (doprocessFv0GlobalSE || doprocessFv0GlobalME) { + histos.add("Fv0Global/SE/hMult", "event multiplicity", kTH1D, {axisMultiplicity}); + histos.add("Fv0Global/SE/Trig_etavsphi", ";#eta;#phi", kTH2D, {axisPhi, axisEtaTrig}); + histos.add("Fv0Global/SE/Trig_eta", "#eta", kTH1D, {axisEtaTrig}); + histos.add("Fv0Global/SE/Trig_phi", "#eta", kTH1D, {axisPhi}); + histos.add("Fv0Global/SE/Trig_pt", "p_{T}", kTH1D, {axisPtTrigger}); + histos.add("Fv0Global/SE/hMult_used", "event multiplicity", kTH1F, {axisMultiplicity}); + histos.add("Fv0Global/SE/Trig_hist", "trig hist", kTHnSparseF, {axisSample, axisVtxZ, axisPtTrigger}); + histos.add("Fv0Global/SE/FV0Amp", "fv0mult", kTH2D, {channelFt0aAxis, amplitudeFt0a}); + histos.add("Fv0Global/SE/FV0eta", "fv0;#eta", kTH1D, {axisEtaAssoc}); + histos.add("Fv0Global/SE/FV0phi", "fv0;#phi", kTH1D, {axisPhi}); + histos.add("Fv0Global/SE/FV0etavsphi", ";fv0;#eta;#phi", kTH2D, {axisPhi, axisEtaAssoc}); + histos.add("Fv0Global/SE/deltaEta_deltaPhi", ";#delta#eta;#delta#phi", kTH2D, {axisDeltaPhi, axisDeltaEta}); + + histos.add("Fv0Global/ME/hMult", "event multiplicity", kTH1D, {axisMultiplicity}); + histos.add("Fv0Global/ME/Trig_etavsphi", ";#eta;#phi", kTH2D, {axisPhi, axisEtaTrig}); + histos.add("Fv0Global/ME/Trig_eta", "#eta", kTH1D, {axisEtaTrig}); + histos.add("Fv0Global/ME/Trig_phi", "#eta", kTH1D, {axisPhi}); + histos.add("Fv0Global/ME/Trig_pt", "p_{T}", kTH1D, {axisPtTrigger}); + histos.add("Fv0Global/ME/FV0Amp", "fv0mult", kTH2D, {channelFt0aAxis, amplitudeFt0a}); + histos.add("Fv0Global/ME/FV0eta", "fv0;#eta", kTH1D, {axisEtaAssoc}); + histos.add("Fv0Global/ME/FV0phi", "fv0;#phi", kTH1D, {axisPhi}); + histos.add("Fv0Global/ME/FV0etavsphi", ";fv0;#eta;#phi", kTH2D, {axisPhi, axisEtaAssoc}); + histos.add("Fv0Global/ME/deltaEta_deltaPhi", ";#delta#eta;#delta#phi", kTH2D, {axisDeltaPhi, axisDeltaEta}); + + sameFv0Global.setObject(new CorrelationContainer(Form("sameEventFv0Global_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("sameEventFv0Global_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); + mixedFv0Global.setObject(new CorrelationContainer(Form("mixedEventFv0Global_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("mixedEventFv0Global_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); + } + + if (doprocessFv0MftSE || doprocessFv0MftME) { + histos.add("Fv0Mft/SE/hMult", "event multiplicity", kTH1D, {axisMultiplicity}); + histos.add("Fv0Mft/SE/Trig_etavsphi", ";#eta;#phi", kTH2D, {axisPhi, axisEtaTrig}); + histos.add("Fv0Mft/SE/Trig_eta", "#eta", kTH1D, {axisEtaTrig}); + histos.add("Fv0Mft/SE/Trig_phi", "#eta", kTH1D, {axisPhi}); + histos.add("Fv0Mft/SE/Trig_pt", "p_{T}", kTH1D, {axisPtTrigger}); + histos.add("Fv0Mft/SE/hMult_used", "event multiplicity", kTH1F, {axisMultiplicity}); + histos.add("Fv0Mft/SE/Trig_hist", "trig hist", kTHnSparseF, {axisSample, axisVtxZ, axisPtTrigger}); + histos.add("Fv0Mft/SE/FV0Amp", "fv0mult", kTH2D, {channelFt0aAxis, amplitudeFt0a}); + histos.add("Fv0Mft/SE/FV0eta", "fv0;#eta", kTH1D, {axisEtaAssoc}); + histos.add("Fv0Mft/SE/FV0phi", "fv0;#phi", kTH1D, {axisPhi}); + histos.add("Fv0Mft/SE/FV0etavsphi", ";fv0;#eta;#phi", kTH2D, {axisPhi, axisEtaAssoc}); + histos.add("Fv0Mft/SE/deltaEta_deltaPhi", ";#delta#eta;#delta#phi", kTH2D, {axisDeltaPhi, axisDeltaEta}); + + histos.add("Fv0Mft/ME/hMult", "event multiplicity", kTH1D, {axisMultiplicity}); + histos.add("Fv0Mft/ME/Trig_etavsphi", ";#eta;#phi", kTH2D, {axisPhi, axisEtaTrig}); + histos.add("Fv0Mft/ME/Trig_eta", "#eta", kTH1D, {axisEtaTrig}); + histos.add("Fv0Mft/ME/Trig_phi", "#eta", kTH1D, {axisPhi}); + histos.add("Fv0Mft/ME/Trig_pt", "p_{T}", kTH1D, {axisPtTrigger}); + histos.add("Fv0Mft/ME/FV0Amp", "fv0mult", kTH2D, {channelFt0aAxis, amplitudeFt0a}); + histos.add("Fv0Mft/ME/FV0eta", "fv0;#eta", kTH1D, {axisEtaAssoc}); + histos.add("Fv0Mft/ME/FV0phi", "fv0;#phi", kTH1D, {axisPhi}); + histos.add("Fv0Mft/ME/FV0etavsphi", ";fv0;#eta;#phi", kTH2D, {axisPhi, axisEtaAssoc}); + histos.add("Fv0Mft/ME/deltaEta_deltaPhi", ";#delta#eta;#delta#phi", kTH2D, {axisDeltaPhi, axisDeltaEta}); + + sameFv0Mft.setObject(new CorrelationContainer(Form("sameEventFv0Mft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("sameEventFv0Mft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); + mixedFv0Mft.setObject(new CorrelationContainer(Form("mixedEventFv0Mft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("mixedEventFv0Mft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); + } } + Filter fTrackSelectionITS = ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::ITS) && + ncheckbit(aod::track::trackCutFlag, TrackSelectionIts); + Filter fTrackSelectionTPC = ifnode(ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::TPC), + ncheckbit(aod::track::trackCutFlag, TrackSelectionTpc), true); + Filter fTrackSelectionDCA = ifnode(dcaZ.node() > 0.f, nabs(aod::track::dcaZ) <= dcaZ && ncheckbit(aod::track::trackCutFlag, TrackSelectionDcaxyOnly), + ncheckbit(aod::track::trackCutFlag, TrackSelectionDca)); + Filter fTracksEta = nabs(aod::track::eta) < cfgEtaCut; + Filter fTracksPt = (aod::track::pt > cfgPtCutMin) && (aod::track::pt < cfgPtCutMax); + + Filter fMftTrackEta = (aod::fwdtrack::eta < cfigMftEtaMax) && (aod::fwdtrack::eta > cfigMftEtaMin); + Filter fMftTrackColID = (aod::fwdtrack::bestCollisionId >= 0); + Filter fMftTrackDca = (nabs(aod::fwdtrack::bestDCAXY) < cfigMftDcaxy); + double getPhiFT0(int chno, double offsetX, double offsetY) { o2::ft0::Geometry ft0Det; @@ -192,6 +343,24 @@ struct LongrangeCorrelation { return RecoDecay::phi(chPos.X() + offsetX, chPos.Y() + offsetY); } + double getPhiFV0(int chno) + { + o2::fv0::Geometry fv0Det; + int cellsInLeft[] = {0, 1, 2, 3, 8, 9, 10, 11, 16, 17, 18, 19, 24, 25, 26, 27, 32, 40, 33, 41, 34, 42, 35, 43}; + bool isChnoInLeft = std::find(std::begin(cellsInLeft), std::end(cellsInLeft), chno) != std::end(cellsInLeft); + float offsetX, offsetY; + if (isChnoInLeft) { + offsetX = (*offsetFV0)[0].getX(); + offsetY = (*offsetFV0)[0].getY(); + } else { + offsetX = (*offsetFV0)[1].getX(); + offsetY = (*offsetFV0)[1].getY(); + } + + auto chPos = fv0Det.getReadoutCenter(chno); + return RecoDecay::phi(chPos.x + offsetX, chPos.y + offsetY); + } + double getEtaFT0(int chno, double offsetX, double offsetY, double offsetZ) { o2::ft0::Geometry ft0Det; @@ -205,120 +374,483 @@ struct LongrangeCorrelation { return -std::log(std::tan(0.5 * theta)); } - Filter fTrackSelectionITS = ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::ITS) && - ncheckbit(aod::track::trackCutFlag, TrackSelectionIts); - Filter fTrackSelectionTPC = ifnode(ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::TPC), - ncheckbit(aod::track::trackCutFlag, TrackSelectionTpc), true); - Filter fTrackSelectionDCA = ifnode(dcaZ.node() > 0.f, nabs(aod::track::dcaZ) <= dcaZ && ncheckbit(aod::track::trackCutFlag, TrackSelectionDcaxyOnly), - ncheckbit(aod::track::trackCutFlag, TrackSelectionDca)); - Filter fTracksEta = nabs(aod::track::eta) < cfgEtaCut; - Filter fTracksPt = (aod::track::pt > cfgPtCutMin) && (aod::track::pt < cfgPtCutMax); + double getEtaFV0(int chno) + { + o2::fv0::Geometry fv0Det; + int cellsInLeft[] = {0, 1, 2, 3, 8, 9, 10, 11, 16, 17, 18, 19, 24, 25, 26, 27, 32, 40, 33, 41, 34, 42, 35, 43}; + bool isChnoInLeft = std::find(std::begin(cellsInLeft), std::end(cellsInLeft), chno) != std::end(cellsInLeft); + float offsetX, offsetY, offsetZ; + if (isChnoInLeft) { + offsetX = (*offsetFV0)[0].getX(); + offsetY = (*offsetFV0)[0].getY(); + offsetZ = (*offsetFV0)[0].getZ(); + } else { + offsetX = (*offsetFV0)[1].getX(); + offsetY = (*offsetFV0)[1].getY(); + offsetZ = (*offsetFV0)[1].getZ(); + } + + auto chPos = fv0Det.getReadoutCenter(chno); + auto x = chPos.x + offsetX; + auto y = chPos.y + offsetY; + auto z = chPos.z + offsetZ; + auto r = std::sqrt(x * x + y * y); + auto theta = std::atan2(r, z); + return -std::log(std::tan(0.5 * theta)); + } template bool isEventSelected(CheckCol const& col) { - histos.fill(HIST("QA/EventHist"), 1); if (!col.sel8()) { return false; } - histos.fill(HIST("QA/EventHist"), 2); + if (isApplySameBunchPileup && !col.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + return false; + } if (std::abs(col.posZ()) >= cfgVtxCut) { return false; } - histos.fill(HIST("QA/EventHist"), 3); - histos.fill(HIST("QA/VtxZHist"), col.posZ()); return true; } + template + bool isMftTrackSelected(CheckMftTrack const& track) + { + if (track.nClusters() < cfigMftCluster) { + return false; + } + return true; + } + + template + void fillYieldFt0aGlobal(TTracks tracks, bool mixing) + { + if (mixing) { + histos.fill(HIST("Ft0aGlobal/ME/hMult"), tracks.size()); + for (auto const& triggerTrack : tracks) { + histos.fill(HIST("Ft0aGlobal/ME/Trig_etavsphi"), triggerTrack.phi(), triggerTrack.eta()); + histos.fill(HIST("Ft0aGlobal/ME/Trig_eta"), triggerTrack.eta()); + histos.fill(HIST("Ft0aGlobal/ME/Trig_phi"), triggerTrack.phi()); + histos.fill(HIST("Ft0aGlobal/ME/Trig_pt"), triggerTrack.pt()); + } + } else { + histos.fill(HIST("Ft0aGlobal/SE/hMult"), tracks.size()); + for (auto const& triggerTrack : tracks) { + histos.fill(HIST("Ft0aGlobal/SE/Trig_etavsphi"), triggerTrack.phi(), triggerTrack.eta()); + histos.fill(HIST("Ft0aGlobal/SE/Trig_eta"), triggerTrack.eta()); + histos.fill(HIST("Ft0aGlobal/SE/Trig_phi"), triggerTrack.phi()); + histos.fill(HIST("Ft0aGlobal/SE/Trig_pt"), triggerTrack.pt()); + } + } + } + + template + void fillYieldFt0cGlobal(TTracks tracks, bool mixing) + { + if (mixing) { + histos.fill(HIST("Ft0cGlobal/ME/hMult"), tracks.size()); + for (auto const& triggerTrack : tracks) { + histos.fill(HIST("Ft0cGlobal/ME/Trig_etavsphi"), triggerTrack.phi(), triggerTrack.eta()); + histos.fill(HIST("Ft0cGlobal/ME/Trig_eta"), triggerTrack.eta()); + histos.fill(HIST("Ft0cGlobal/ME/Trig_phi"), triggerTrack.phi()); + histos.fill(HIST("Ft0cGlobal/ME/Trig_pt"), triggerTrack.pt()); + } + } else { + histos.fill(HIST("Ft0cGlobal/SE/hMult"), tracks.size()); + for (auto const& triggerTrack : tracks) { + histos.fill(HIST("Ft0cGlobal/SE/Trig_etavsphi"), triggerTrack.phi(), triggerTrack.eta()); + histos.fill(HIST("Ft0cGlobal/SE/Trig_eta"), triggerTrack.eta()); + histos.fill(HIST("Ft0cGlobal/SE/Trig_phi"), triggerTrack.phi()); + histos.fill(HIST("Ft0cGlobal/SE/Trig_pt"), triggerTrack.pt()); + } + } + } + + template + void fillYieldMftGlobal(TTracks tracks, bool mixing) + { + if (mixing) { + histos.fill(HIST("MftGlobal/ME/hMult"), tracks.size()); + for (auto const& triggerTrack : tracks) { + histos.fill(HIST("MftGlobal/ME/Trig_etavsphi"), triggerTrack.phi(), triggerTrack.eta()); + histos.fill(HIST("MftGlobal/ME/Trig_eta"), triggerTrack.eta()); + histos.fill(HIST("MftGlobal/ME/Trig_phi"), triggerTrack.phi()); + histos.fill(HIST("MftGlobal/ME/Trig_pt"), triggerTrack.pt()); + } + } else { + histos.fill(HIST("MftGlobal/SE/hMult"), tracks.size()); + for (auto const& triggerTrack : tracks) { + histos.fill(HIST("MftGlobal/SE/Trig_etavsphi"), triggerTrack.phi(), triggerTrack.eta()); + histos.fill(HIST("MftGlobal/SE/Trig_eta"), triggerTrack.eta()); + histos.fill(HIST("MftGlobal/SE/Trig_phi"), triggerTrack.phi()); + histos.fill(HIST("MftGlobal/SE/Trig_pt"), triggerTrack.pt()); + } + } + } + + template + void fillYieldFv0Global(TTracks tracks, bool mixing) + { + if (mixing) { + histos.fill(HIST("Fv0Global/ME/hMult"), tracks.size()); + for (auto const& triggerTrack : tracks) { + histos.fill(HIST("Fv0Global/ME/Trig_etavsphi"), triggerTrack.phi(), triggerTrack.eta()); + histos.fill(HIST("Fv0Global/ME/Trig_eta"), triggerTrack.eta()); + histos.fill(HIST("Fv0Global/ME/Trig_phi"), triggerTrack.phi()); + histos.fill(HIST("Fv0Global/ME/Trig_pt"), triggerTrack.pt()); + } + } else { + histos.fill(HIST("Fv0Global/SE/hMult"), tracks.size()); + for (auto const& triggerTrack : tracks) { + histos.fill(HIST("Fv0Global/SE/Trig_etavsphi"), triggerTrack.phi(), triggerTrack.eta()); + histos.fill(HIST("Fv0Global/SE/Trig_eta"), triggerTrack.eta()); + histos.fill(HIST("Fv0Global/SE/Trig_phi"), triggerTrack.phi()); + histos.fill(HIST("Fv0Global/SE/Trig_pt"), triggerTrack.pt()); + } + } + } + template - void fillYield(TTracks tracks, bool mixing) + void fillYieldFv0Mft(TTracks tracks, bool mixing) { if (mixing) { - histos.fill(HIST("ME/hMult"), tracks.size()); + histos.fill(HIST("Fv0Mft/ME/hMult"), tracks.size()); for (auto const& triggerTrack : tracks) { - histos.fill(HIST("ME/Trig_etavsphi"), triggerTrack.phi(), triggerTrack.eta()); - histos.fill(HIST("ME/Trig_eta"), triggerTrack.eta()); - histos.fill(HIST("ME/Trig_phi"), triggerTrack.phi()); - histos.fill(HIST("ME/Trig_pt"), triggerTrack.pt()); + histos.fill(HIST("Fv0Mft/ME/Trig_etavsphi"), triggerTrack.phi(), triggerTrack.eta()); + histos.fill(HIST("Fv0Mft/ME/Trig_eta"), triggerTrack.eta()); + histos.fill(HIST("Fv0Mft/ME/Trig_phi"), triggerTrack.phi()); + histos.fill(HIST("Fv0Mft/ME/Trig_pt"), triggerTrack.pt()); } } else { - histos.fill(HIST("SE/hMult"), tracks.size()); + histos.fill(HIST("Fv0Mft/SE/hMult"), tracks.size()); for (auto const& triggerTrack : tracks) { - histos.fill(HIST("SE/Trig_etavsphi"), triggerTrack.phi(), triggerTrack.eta()); - histos.fill(HIST("SE/Trig_eta"), triggerTrack.eta()); - histos.fill(HIST("SE/Trig_phi"), triggerTrack.phi()); - histos.fill(HIST("SE/Trig_pt"), triggerTrack.pt()); + histos.fill(HIST("Fv0Mft/SE/Trig_etavsphi"), triggerTrack.phi(), triggerTrack.eta()); + histos.fill(HIST("Fv0Mft/SE/Trig_eta"), triggerTrack.eta()); + histos.fill(HIST("Fv0Mft/SE/Trig_phi"), triggerTrack.phi()); + histos.fill(HIST("Fv0Mft/SE/Trig_pt"), triggerTrack.pt()); } } } template - void fillCorrelation(TTarget target, TTriggers const& triggers, TFT0s const& ft0, bool mixing, float vz) + void fillCorrFt0aGlobal(TTarget target, TTriggers const& triggers, TFT0s const& ft0, bool mixing, float vz) { int fSampleIndex = gRandom->Uniform(0, cfgSampleSize); if (!mixing) - histos.fill(HIST("SE/hMult_used"), triggers.size()); + histos.fill(HIST("Ft0aGlobal/SE/hMult_used"), triggers.size()); for (auto const& triggerTrack : triggers) { if (!mixing) - histos.fill(HIST("SE/Trig_hist"), fSampleIndex, vz, triggerTrack.pt()); - - auto offsetFT0Ax = (*offsetFT0)[0].getX(); - auto offsetFT0Ay = (*offsetFT0)[0].getY(); - auto offsetFT0Az = (*offsetFT0)[0].getZ(); - for (std::size_t iChA = 0; iChA < ft0.channelA().size(); iChA++) { - auto chanelid = ft0.channelA()[iChA]; - float ampl = ft0.amplitudeA()[iChA]; + histos.fill(HIST("Ft0aGlobal/SE/Trig_hist"), fSampleIndex, vz, triggerTrack.pt()); + + auto offsetX = (*offsetFT0)[0].getX(); + auto offsetY = (*offsetFT0)[0].getY(); + auto offsetZ = (*offsetFT0)[0].getZ(); + for (std::size_t iCh = 0; iCh < ft0.channelA().size(); iCh++) { + auto chanelid = ft0.channelA()[iCh]; + float ampl = ft0.amplitudeA()[iCh]; if (ampl <= 0) continue; if (mixing) - histos.fill(HIST("ME/FT0Amp"), chanelid, ampl); + histos.fill(HIST("Ft0aGlobal/ME/FT0Amp"), chanelid, ampl); else - histos.fill(HIST("SE/FT0Amp"), chanelid, ampl); + histos.fill(HIST("Ft0aGlobal/SE/FT0Amp"), chanelid, ampl); - auto phiA = getPhiFT0(chanelid, offsetFT0Ax, offsetFT0Ay); - auto etaA = getEtaFT0(chanelid, offsetFT0Ax, offsetFT0Ay, offsetFT0Az); + auto phi = getPhiFT0(chanelid, offsetX, offsetY); + auto eta = getEtaFT0(chanelid, offsetX, offsetY, offsetZ); if (mixing) { - histos.fill(HIST("ME/FT0Aeta"), etaA); - histos.fill(HIST("ME/FT0Aphi"), phiA); - histos.fill(HIST("ME/FT0Aetavsphi"), phiA, etaA); + histos.fill(HIST("Ft0aGlobal/ME/FT0eta"), eta); + histos.fill(HIST("Ft0aGlobal/ME/FT0phi"), phi); + histos.fill(HIST("Ft0aGlobal/ME/FT0etavsphi"), phi, eta); } else { - histos.fill(HIST("SE/FT0Aeta"), etaA); - histos.fill(HIST("SE/FT0Aphi"), phiA); - histos.fill(HIST("SE/FT0Aetavsphi"), phiA, etaA); + histos.fill(HIST("Ft0aGlobal/SE/FT0eta"), eta); + histos.fill(HIST("Ft0aGlobal/SE/FT0phi"), phi); + histos.fill(HIST("Ft0aGlobal/SE/FT0etavsphi"), phi, eta); } - float deltaPhi = RecoDecay::constrainAngle(triggerTrack.phi() - phiA, -PIHalf); - float deltaEta = triggerTrack.eta() - etaA; + float deltaPhi = RecoDecay::constrainAngle(triggerTrack.phi() - phi, -PIHalf); + float deltaEta = triggerTrack.eta() - eta; if (mixing) - histos.fill(HIST("ME/deltaEta_deltaPhi"), deltaPhi, deltaEta); + histos.fill(HIST("Ft0aGlobal/ME/deltaEta_deltaPhi"), deltaPhi, deltaEta); else - histos.fill(HIST("SE/deltaEta_deltaPhi"), deltaPhi, deltaEta); + histos.fill(HIST("Ft0aGlobal/SE/deltaEta_deltaPhi"), deltaPhi, deltaEta); target->getPairHist()->Fill(step, fSampleIndex, vz, triggerTrack.pt(), triggerTrack.pt(), deltaPhi, deltaEta); } // associated ft0 tracks } // trigger tracks - } // fillCorrelation + } // fillCorrFt0aGlobal + + template + void fillCorrFt0cGlobal(TTarget target, TTriggers const& triggers, TFT0s const& ft0, bool mixing, float vz) + { + int fSampleIndex = gRandom->Uniform(0, cfgSampleSize); + if (!mixing) + histos.fill(HIST("Ft0cGlobal/SE/hMult_used"), triggers.size()); + for (auto const& triggerTrack : triggers) { + if (!mixing) + histos.fill(HIST("Ft0cGlobal/SE/Trig_hist"), fSampleIndex, vz, triggerTrack.pt()); + + auto offsetX = (*offsetFT0)[1].getX(); + auto offsetY = (*offsetFT0)[1].getY(); + auto offsetZ = (*offsetFT0)[1].getZ(); + for (std::size_t iCh = 0; iCh < ft0.channelC().size(); iCh++) { + auto chanelid = ft0.channelC()[iCh]; + float ampl = ft0.amplitudeC()[iCh]; + if (ampl <= 0) + continue; + if (mixing) + histos.fill(HIST("Ft0cGlobal/ME/FT0Amp"), chanelid, ampl); + else + histos.fill(HIST("Ft0cGlobal/SE/FT0Amp"), chanelid, ampl); + + auto phi = getPhiFT0(chanelid, offsetX, offsetY); + auto eta = getEtaFT0(chanelid, offsetX, offsetY, offsetZ); + + if (mixing) { + histos.fill(HIST("Ft0cGlobal/ME/FT0eta"), eta); + histos.fill(HIST("Ft0cGlobal/ME/FT0phi"), phi); + histos.fill(HIST("Ft0cGlobal/ME/FT0etavsphi"), phi, eta); + } else { + histos.fill(HIST("Ft0cGlobal/SE/FT0eta"), eta); + histos.fill(HIST("Ft0cGlobal/SE/FT0phi"), phi); + histos.fill(HIST("Ft0cGlobal/SE/FT0etavsphi"), phi, eta); + } + float deltaPhi = RecoDecay::constrainAngle(triggerTrack.phi() - phi, -PIHalf); + float deltaEta = triggerTrack.eta() - eta; + if (mixing) + histos.fill(HIST("Ft0cGlobal/ME/deltaEta_deltaPhi"), deltaPhi, deltaEta); + else + histos.fill(HIST("Ft0cGlobal/SE/deltaEta_deltaPhi"), deltaPhi, deltaEta); + target->getPairHist()->Fill(step, fSampleIndex, vz, triggerTrack.pt(), triggerTrack.pt(), deltaPhi, deltaEta); + } // associated ft0 tracks + } // trigger tracks + } // fillCorrFt0cGlobal + + template + void fillCorrMftGlobal(TTarget target, TTriggers const& triggers, TMFTs const& mft, bool mixing, float vz) + { + int fSampleIndex = gRandom->Uniform(0, cfgSampleSize); + if (!mixing) + histos.fill(HIST("MftGlobal/SE/hMult_used"), triggers.size()); + for (auto const& triggerTrack : triggers) { + if (!mixing) + histos.fill(HIST("MftGlobal/SE/Trig_hist"), fSampleIndex, vz, triggerTrack.pt()); + + for (auto const& assoTrack : mft) { + if (!isMftTrackSelected(assoTrack)) { + continue; + } + auto phi = assoTrack.phi(); + o2::math_utils::bringTo02Pi(phi); + if (mixing) { + histos.fill(HIST("MftGlobal/ME/MFTeta"), assoTrack.eta()); + histos.fill(HIST("MftGlobal/ME/MFTphi"), phi); + histos.fill(HIST("MftGlobal/ME/MFTetavsphi"), phi, assoTrack.eta()); + } else { + histos.fill(HIST("MftGlobal/SE/FT0eta"), assoTrack.eta()); + histos.fill(HIST("MftGlobal/SE/FT0phi"), phi); + histos.fill(HIST("MftGlobal/SE/FT0etavsphi"), phi, assoTrack.eta()); + } + float deltaPhi = RecoDecay::constrainAngle(triggerTrack.phi() - phi, -PIHalf); + float deltaEta = triggerTrack.eta() - assoTrack.eta(); + if (mixing) + histos.fill(HIST("MftGlobal/ME/deltaEta_deltaPhi"), deltaPhi, deltaEta); + else + histos.fill(HIST("MftGlobal/SE/deltaEta_deltaPhi"), deltaPhi, deltaEta); + target->getPairHist()->Fill(step, fSampleIndex, vz, triggerTrack.pt(), assoTrack.pt(), deltaPhi, deltaEta); + } // associated mft tracks + } // trigger tracks + } // fillCorrMftGlobal + + template + void fillCorrFv0Global(TTarget target, TTriggers const& triggers, TFV0s const& fv0, bool mixing, float vz) + { + int fSampleIndex = gRandom->Uniform(0, cfgSampleSize); + if (!mixing) + histos.fill(HIST("Fv0Global/SE/hMult_used"), triggers.size()); + for (auto const& triggerTrack : triggers) { + if (!mixing) + histos.fill(HIST("Fv0Global/SE/Trig_hist"), fSampleIndex, vz, triggerTrack.pt()); + + for (std::size_t iCh = 0; iCh < fv0.channel().size(); iCh++) { + auto chanelid = fv0.channel()[iCh]; + float ampl = fv0.amplitude()[iCh]; + if (ampl <= 0) + continue; + if (mixing) + histos.fill(HIST("Fv0Global/ME/FV0Amp"), chanelid, ampl); + else + histos.fill(HIST("Fv0Global/SE/FV0Amp"), chanelid, ampl); + + auto phi = getPhiFV0(chanelid); + auto eta = getEtaFV0(chanelid); + + if (mixing) { + histos.fill(HIST("Fv0Global/ME/FV0eta"), eta); + histos.fill(HIST("Fv0Global/ME/FV0phi"), phi); + histos.fill(HIST("Fv0Global/ME/FV0etavsphi"), phi, eta); + } else { + histos.fill(HIST("Fv0Global/SE/FV0eta"), eta); + histos.fill(HIST("Fv0Global/SE/FV0phi"), phi); + histos.fill(HIST("Fv0Global/SE/FV0etavsphi"), phi, eta); + } + float deltaPhi = RecoDecay::constrainAngle(triggerTrack.phi() - phi, -PIHalf); + float deltaEta = triggerTrack.eta() - eta; + if (mixing) + histos.fill(HIST("Fv0Global/ME/deltaEta_deltaPhi"), deltaPhi, deltaEta); + else + histos.fill(HIST("Fv0Global/SE/deltaEta_deltaPhi"), deltaPhi, deltaEta); + target->getPairHist()->Fill(step, fSampleIndex, vz, triggerTrack.pt(), triggerTrack.pt(), deltaPhi, deltaEta); + } // associated fv0 tracks + } // trigger tracks + } // fillCorrFv0Global - void processSE(CollTable::iterator const& col, aod::FT0s const&, TrksTable const& tracks) + template + void fillCorrFv0Mft(TTarget target, TTracks const& tracks, TTriggers const& triggers, TFV0s const& fv0, bool mixing, float vz) + { + int fSampleIndex = gRandom->Uniform(0, cfgSampleSize); + if (!mixing) + histos.fill(HIST("Fv0Mft/SE/hMult_used"), tracks.size()); + for (auto const& triggerTrack : triggers) { + if (!isMftTrackSelected(triggerTrack)) { + continue; + } + if (!mixing) + histos.fill(HIST("Fv0Mft/SE/Trig_hist"), fSampleIndex, vz, triggerTrack.pt()); + + auto trigphi = triggerTrack.phi(); + o2::math_utils::bringTo02Pi(trigphi); + + for (std::size_t iCh = 0; iCh < fv0.channel().size(); iCh++) { + auto chanelid = fv0.channel()[iCh]; + float ampl = fv0.amplitude()[iCh]; + if (ampl <= 0) + continue; + if (mixing) + histos.fill(HIST("Fv0Mft/ME/FV0Amp"), chanelid, ampl); + else + histos.fill(HIST("Fv0Mft/SE/FV0Amp"), chanelid, ampl); + + auto phi = getPhiFV0(chanelid); + auto eta = getEtaFV0(chanelid); + + if (mixing) { + histos.fill(HIST("Fv0Mft/ME/FV0eta"), eta); + histos.fill(HIST("Fv0Mft/ME/FV0phi"), phi); + histos.fill(HIST("Fv0Mft/ME/FV0etavsphi"), phi, eta); + } else { + histos.fill(HIST("Fv0Mft/SE/FV0eta"), eta); + histos.fill(HIST("Fv0Mft/SE/FV0phi"), phi); + histos.fill(HIST("Fv0Mft/SE/FV0etavsphi"), phi, eta); + } + + float deltaPhi = RecoDecay::constrainAngle(trigphi - phi, -PIHalf); + float deltaEta = triggerTrack.eta() - eta; + if (mixing) + histos.fill(HIST("Fv0Mft/ME/deltaEta_deltaPhi"), deltaPhi, deltaEta); + else + histos.fill(HIST("Fv0Mft/SE/deltaEta_deltaPhi"), deltaPhi, deltaEta); + target->getPairHist()->Fill(step, fSampleIndex, vz, triggerTrack.pt(), triggerTrack.pt(), deltaPhi, deltaEta); + } // associated fv0 tracks + } // trigger tracks + } // fillCorrFv0Mft + + void processEventStat(CollTable::iterator const& col) + { + histos.fill(HIST("QA/EventHist"), 1); + if (!col.sel8()) { + return; + } + histos.fill(HIST("QA/EventHist"), 2); + if (isApplySameBunchPileup && !col.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + return; + } + histos.fill(HIST("QA/EventHist"), 3); + if (std::abs(col.posZ()) >= cfgVtxCut) { + return; + } + histos.fill(HIST("QA/EventHist"), 4); + histos.fill(HIST("QA/VtxZHist"), col.posZ()); + } + + void processFt0aGlobalSE(CollTable::iterator const& col, aod::FT0s const&, TrksTable const& tracks) { if (!isEventSelected(col)) { return; } if (col.has_foundFT0()) { - fillYield(tracks, false); + fillYieldFt0aGlobal(tracks, false); const auto& ft0 = col.foundFT0(); if (tracks.size() < cfgMinMult || tracks.size() >= cfgMaxMult) { return; } - fillCorrelation(same, tracks, ft0, false, col.posZ()); + fillCorrFt0aGlobal(sameFt0aGlobal, tracks, ft0, false, col.posZ()); + } + } // same event + + void processFt0cGlobalSE(CollTable::iterator const& col, aod::FT0s const&, TrksTable const& tracks) + { + if (!isEventSelected(col)) { + return; + } + if (col.has_foundFT0()) { + fillYieldFt0cGlobal(tracks, false); + const auto& ft0 = col.foundFT0(); + if (tracks.size() < cfgMinMult || tracks.size() >= cfgMaxMult) { + return; + } + fillCorrFt0cGlobal(sameFt0cGlobal, tracks, ft0, false, col.posZ()); + } + } // same event + + void processMftGlobalSE(CollTable::iterator const& col, MftTrkTable const& mfttracks, TrksTable const& tracks) + { + if (!isEventSelected(col)) { + return; + } + fillYieldMftGlobal(tracks, false); + if (tracks.size() < cfgMinMult || tracks.size() >= cfgMaxMult) { + return; + } + fillCorrMftGlobal(sameMftGlobal, tracks, mfttracks, false, col.posZ()); + } // same event + + void processFv0GlobalSE(CollTable::iterator const& col, aod::FV0As const&, TrksTable const& tracks) + { + if (!isEventSelected(col)) { + return; + } + if (col.has_foundFV0()) { + fillYieldFv0Global(tracks, false); + const auto& fv0 = col.foundFV0(); + if (tracks.size() < cfgMinMult || tracks.size() >= cfgMaxMult) { + return; + } + fillCorrFv0Global(sameFv0Global, tracks, fv0, false, col.posZ()); } } // same event - void processME(CollTable const& col, aod::FT0s const&, TrksTable const& tracks) + void processFv0MftSE(CollTable::iterator const& col, aod::FV0As const&, TrksTable const& tracks, MftTrkTable const& mfttracks) + { + if (!isEventSelected(col)) { + return; + } + if (col.has_foundFV0()) { + fillYieldFv0Mft(mfttracks, false); + const auto& fv0 = col.foundFV0(); + if (tracks.size() < cfgMinMult || tracks.size() >= cfgMaxMult) { + return; + } + fillCorrFv0Mft(sameFv0Mft, tracks, mfttracks, fv0, false, col.posZ()); + } + } // same event + + void processFt0aGlobalME(CollTable const& col, aod::FT0s const&, TrksTable const& tracks) { auto getTracksSize = [&tracks, this](CollTable::iterator const& collision) { auto associatedTracks = tracks.sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), this->cache); return associatedTracks.size(); }; + using MixedBinning = FlexibleBinningPolicy, aod::collision::PosZ, decltype(getTracksSize)>; MixedBinning binningOnVtxAndMult{{getTracksSize}, {axisVtxZME, axisMultME}, true}; for (auto const& [col1, col2] : soa::selfCombinations(binningOnVtxAndMult, mixingParameter, -1, col, col)) { @@ -326,25 +858,138 @@ struct LongrangeCorrelation { continue; } if (col1.globalIndex() == col2.globalIndex()) { - histos.fill(HIST("QA/hMixingQA"), 1.0); // same-collision pair counting continue; } if (col1.has_foundFT0() && col2.has_foundFT0()) { - histos.fill(HIST("QA/hMEpvz1"), col1.posZ()); - histos.fill(HIST("QA/hMEpvz2"), col2.posZ()); - auto slicedTriggerTracks = tracks.sliceBy(perCollision, col1.globalIndex()); - fillYield(slicedTriggerTracks, true); + auto slicedTriggerTracks = tracks.sliceBy(perColGlobal, col1.globalIndex()); + fillYieldFt0aGlobal(slicedTriggerTracks, true); const auto& ft0 = col2.foundFT0(); if (slicedTriggerTracks.size() < cfgMinMult || slicedTriggerTracks.size() >= cfgMaxMult) { continue; } - fillCorrelation(mixed, slicedTriggerTracks, ft0, true, col1.posZ()); + fillCorrFt0aGlobal(mixedFt0aGlobal, slicedTriggerTracks, ft0, true, col1.posZ()); + } + } + } // mixed event + + void processFt0cGlobalME(CollTable const& col, aod::FT0s const&, TrksTable const& tracks) + { + auto getTracksSize = [&tracks, this](CollTable::iterator const& collision) { + auto associatedTracks = tracks.sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), this->cache); + return associatedTracks.size(); + }; + + using MixedBinning = FlexibleBinningPolicy, aod::collision::PosZ, decltype(getTracksSize)>; + MixedBinning binningOnVtxAndMult{{getTracksSize}, {axisVtxZME, axisMultME}, true}; + for (auto const& [col1, col2] : soa::selfCombinations(binningOnVtxAndMult, mixingParameter, -1, col, col)) { + if (!isEventSelected(col1) || !isEventSelected(col2)) { + continue; + } + if (col1.globalIndex() == col2.globalIndex()) { + continue; + } + if (col1.has_foundFT0() && col2.has_foundFT0()) { + auto slicedTriggerTracks = tracks.sliceBy(perColGlobal, col1.globalIndex()); + fillYieldFt0cGlobal(slicedTriggerTracks, true); + const auto& ft0 = col2.foundFT0(); + if (slicedTriggerTracks.size() < cfgMinMult || slicedTriggerTracks.size() >= cfgMaxMult) { + continue; + } + fillCorrFt0cGlobal(mixedFt0cGlobal, slicedTriggerTracks, ft0, true, col1.posZ()); + } + } + } // mixed event + + void processMftGlobalME(CollTable const& col, MftTrkTable const& mfttracks, TrksTable const& tracks) + { + auto getTracksSize = [&tracks, this](CollTable::iterator const& collision) { + auto associatedTracks = tracks.sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), this->cache); + return associatedTracks.size(); + }; + + using MixedBinning = FlexibleBinningPolicy, aod::collision::PosZ, decltype(getTracksSize)>; + MixedBinning binningOnVtxAndMult{{getTracksSize}, {axisVtxZME, axisMultME}, true}; + auto tracksTuple = std::make_tuple(tracks, mfttracks); + Pair pairs{binningOnVtxAndMult, mixingParameter, -1, col, tracksTuple, &cache}; + for (auto const& [col1, tracks1, col2, tracks2] : pairs) { + if (!isEventSelected(col1) || !isEventSelected(col2)) { + continue; + } + if ((tracks1.size() < cfgMinMult || tracks1.size() >= cfgMaxMult)) { + continue; + } + fillCorrMftGlobal(mixedMftGlobal, tracks1, tracks2, true, col1.posZ()); + } + } // mixed event + + void processFv0GlobalME(CollTable const& col, aod::FV0As const&, TrksTable const& tracks) + { + auto getTracksSize = [&tracks, this](CollTable::iterator const& collision) { + auto associatedTracks = tracks.sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), this->cache); + return associatedTracks.size(); + }; + + using MixedBinning = FlexibleBinningPolicy, aod::collision::PosZ, decltype(getTracksSize)>; + MixedBinning binningOnVtxAndMult{{getTracksSize}, {axisVtxZME, axisMultME}, true}; + for (auto const& [col1, col2] : soa::selfCombinations(binningOnVtxAndMult, mixingParameter, -1, col, col)) { + if (!isEventSelected(col1) || !isEventSelected(col2)) { + continue; + } + if (col1.globalIndex() == col2.globalIndex()) { + continue; + } + if (col1.has_foundFV0() && col2.has_foundFV0()) { + auto slicedTriggerTracks = tracks.sliceBy(perColGlobal, col1.globalIndex()); + fillYieldFv0Global(slicedTriggerTracks, true); + const auto& fv0 = col2.foundFV0(); + if (slicedTriggerTracks.size() < cfgMinMult || slicedTriggerTracks.size() >= cfgMaxMult) { + continue; + } + fillCorrFv0Global(mixedFv0Global, slicedTriggerTracks, fv0, true, col1.posZ()); + } + } + } // mixed event + + void processFv0MftME(CollTable const& col, aod::FV0As const&, TrksTable const& tracks, MftTrkTable const& mfttracks) + { + auto getTracksSize = [&tracks, this](CollTable::iterator const& collision) { + auto associatedTracks = tracks.sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), this->cache); + return associatedTracks.size(); + }; + + using MixedBinning = FlexibleBinningPolicy, aod::collision::PosZ, decltype(getTracksSize)>; + MixedBinning binningOnVtxAndMult{{getTracksSize}, {axisVtxZME, axisMultME}, true}; + for (auto const& [col1, col2] : soa::selfCombinations(binningOnVtxAndMult, mixingParameter, -1, col, col)) { + if (!isEventSelected(col1) || !isEventSelected(col2)) { + continue; + } + if (col1.globalIndex() == col2.globalIndex()) { + continue; + } + if (col1.has_foundFV0() && col2.has_foundFV0()) { + auto slicedGlobalTracks = tracks.sliceBy(perColGlobal, col1.globalIndex()); + auto slicedTriggerMftTracks = mfttracks.sliceBy(perColMft, col1.globalIndex()); + fillYieldFv0Mft(slicedTriggerMftTracks, true); + const auto& fv0 = col2.foundFV0(); + if (slicedGlobalTracks.size() < cfgMinMult || slicedGlobalTracks.size() >= cfgMaxMult) { + continue; + } + fillCorrFv0Mft(mixedFv0Mft, slicedGlobalTracks, slicedTriggerMftTracks, fv0, true, col1.posZ()); } } } // mixed event - PROCESS_SWITCH(LongrangeCorrelation, processSE, "process same event", false); - PROCESS_SWITCH(LongrangeCorrelation, processME, "process mixed event", false); + PROCESS_SWITCH(LongrangeCorrelation, processEventStat, "event stat", false); + PROCESS_SWITCH(LongrangeCorrelation, processFt0aGlobalSE, "same event FT0a vs global", false); + PROCESS_SWITCH(LongrangeCorrelation, processFt0aGlobalME, "mixed event FT0a vs global", false); + PROCESS_SWITCH(LongrangeCorrelation, processFt0cGlobalSE, "same event FT0c vs global", false); + PROCESS_SWITCH(LongrangeCorrelation, processFt0cGlobalME, "mixed event FT0c vs global", false); + PROCESS_SWITCH(LongrangeCorrelation, processMftGlobalSE, "same event MFT vs global", false); + PROCESS_SWITCH(LongrangeCorrelation, processMftGlobalME, "mixed event MFT vs global", false); + PROCESS_SWITCH(LongrangeCorrelation, processFv0GlobalSE, "same event FV0 vs global", false); + PROCESS_SWITCH(LongrangeCorrelation, processFv0GlobalME, "mixed event FV0 vs global", false); + PROCESS_SWITCH(LongrangeCorrelation, processFv0MftSE, "same event FV0 vs MFT", false); + PROCESS_SWITCH(LongrangeCorrelation, processFv0MftME, "mixed event FV0 vs MFT", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From c1265b3aaef7ecec6696134fe84dfd84aa3a704e Mon Sep 17 00:00:00 2001 From: Preet-Bhanjan Date: Mon, 28 Jul 2025 19:46:44 +0200 Subject: [PATCH 110/345] [PWGCF] Addition of likesign method (#12288) Co-authored-by: Preet Pati Co-authored-by: ALICE Action Bot --- PWGCF/Flow/Tasks/resonancesGfwFlow.cxx | 128 ++++++++++++++++++------- 1 file changed, 93 insertions(+), 35 deletions(-) diff --git a/PWGCF/Flow/Tasks/resonancesGfwFlow.cxx b/PWGCF/Flow/Tasks/resonancesGfwFlow.cxx index 8a2c634e31f..de9c43aeb88 100644 --- a/PWGCF/Flow/Tasks/resonancesGfwFlow.cxx +++ b/PWGCF/Flow/Tasks/resonancesGfwFlow.cxx @@ -66,11 +66,13 @@ namespace { std::vector> refV2; std::vector> phiV2; +std::vector> lsPhiV2; std::vector> k0V2; std::vector> lambdaV2; std::vector>> refBoot; std::vector>> phiBoot; +std::vector>> lsPhiBoot; std::vector>> k0Boot; std::vector>> lambdaBoot; } // namespace @@ -203,7 +205,7 @@ struct ResonancesGfwFlow { O2_DEFINE_CONFIGURABLE(cfgUseBootStrap, bool, true, "Use bootstrap for error estimation") O2_DEFINE_CONFIGURABLE(cfgTrackDensityCorrUse, bool, true, "Use track density efficiency correction") O2_DEFINE_CONFIGURABLE(cfgV0AT0Acut, int, 5, "V0AT0A cut") - + O2_DEFINE_CONFIGURABLE(cfgUseLsPhi, bool, true, "Use LikeSign for Phi v2") O2_DEFINE_CONFIGURABLE(cfgUseOnlyTPC, bool, true, "Use only TPC PID for daughter selection") O2_DEFINE_CONFIGURABLE(cfgUseStrictPID, bool, true, "Use strict PID cuts for TPC") O2_DEFINE_CONFIGURABLE(cfgUseAsymmetricPID, bool, false, "Use asymmetric PID cuts") @@ -314,6 +316,7 @@ struct ResonancesGfwFlow { refBoot.resize(cfgNbootstrap); phiBoot.resize(cfgNbootstrap); + lsPhiBoot.resize(cfgNbootstrap); k0Boot.resize(cfgNbootstrap); lambdaBoot.resize(cfgNbootstrap); @@ -328,6 +331,14 @@ struct ResonancesGfwFlow { } // end of bootstrap condition } // end of phi loop + if (cfgUseLsPhi && configs.GetHeads()[i].starts_with("LsPhi")) { + lsPhiV2.push_back(histos.add(Form("h%spt", configs.GetHeads()[i].c_str()), "", {HistType::kTProfile3D, {axisPt, axisPhiMass, axisMultiplicity}})); + if (cfgUseBootStrap) { + for (int j = 0; j < cfgNbootstrap; ++j) { + phiBoot[j].push_back(histos.add(Form("BootStrap/h%spt_boot_%d", configs.GetHeads()[i].c_str(), j), "", {HistType::kTProfile3D, {axisPt, axisPhiMass, axisMultiplicity}})); + } + } // end of bootstrap condition + } if (resoSwitchVals[K0][kUseParticle] && configs.GetHeads()[i].starts_with("K0")) { k0V2.push_back(histos.add(Form("h%spt", configs.GetHeads()[i].c_str()), "", {HistType::kTProfile3D, {axisPt, axisK0Mass, axisMultiplicity}})); if (cfgUseBootStrap) { @@ -357,6 +368,10 @@ struct ResonancesGfwFlow { } // end of configs loop + if (cfgUseLsPhi) { + histos.add("hLsPhiMass_sparse", "", {HistType::kTHnSparseD, {{axisPhiMass, axisPt, axisMultiplicity}}}); + } + if (resoSwitchVals[PHI][kUseParticle]) { histos.add("KaPlusTPC", "", {HistType::kTH2D, {{axisPt, axisNsigmaTPC}}}); histos.add("KaMinusTPC", "", {HistType::kTH2D, {{axisPt, axisNsigmaTPC}}}); @@ -365,7 +380,6 @@ struct ResonancesGfwFlow { histos.add("hPhiPhi", "", {HistType::kTH1D, {axisPhi}}); histos.add("hPhiEta", "", {HistType::kTH1D, {axisEta}}); histos.add("hPhiMass_sparse", "", {HistType::kTHnSparseD, {{axisPhiMass, axisPt, axisMultiplicity}}}); - histos.add("hPhimassSparse_RD", "", {HistType::kTHnSparseD, {{axisPhiMass, axisPt, axisMultiplicity}}}); histos.add("hPhiCount", "Number of Phi;; Count", {HistType::kTH1D, {{5, 0, 5}}}); histos.get(HIST("hPhiCount"))->GetXaxis()->SetBinLabel(1, "Phi candidates"); @@ -878,6 +892,35 @@ struct ResonancesGfwFlow { } } + template + bool selectionV0Daughter(TTrack const& track, int pid) + { + if (!(track.itsNCls() > cfgITScluster)) + return 0; + if (!track.hasTPC()) + return false; + if (track.tpcNClsFound() < cfgTpcCluster) + return false; + if (!(track.tpcNClsCrossedRows() > cfgTpcCrossRows)) + return 0; + + if (cfgUseOnlyTPC) { + if (pid == PIONS && std::abs(track.tpcNSigmaPi()) > cfgTpcCut) + return false; + if (pid == KAONS && std::abs(track.tpcNSigmaKa()) > cfgTpcCut) + return false; + if (pid == PROTONS && std::abs(track.tpcNSigmaPr()) > cfgTpcCut) + return false; + } else { + int partIndex = cfgUseAsymmetricPID ? getNsigmaPIDAssymmetric(track) : getNsigmaPIDTpcTof(track); + int pidIndex = partIndex - 1; // 0 = pion, 1 = kaon, 2 = proton + if (pidIndex != pid) + return false; + } + + return true; + } + template void resurrectPhi(TTrack trackplus, TTrack trackminus, const TCollision collision, vector plusdaug, vector minusdaug, vector mom, double plusmass, const ConstStr& hist) { @@ -900,13 +943,6 @@ struct ResonancesGfwFlow { histos.fill(HIST("KaMinusTPC"), partminus.pt(), partminus.tpcNSigmaKa()); histos.fill(HIST("KaMinusTOF"), partminus.pt(), partminus.tofNSigmaKa()); - std::array, 2> ptarr = {{{partplus.px(), partplus.py(), partplus.pz()}, {partminus.px(), partminus.py(), partminus.pz()}}}; - std::array massarr = {plusmass, plusmass}; - - // Calculation using RecoDecay - double invMassRD = RecoDecay::m2(ptarr, massarr); - double ptRD = std::sqrt(RecoDecay::sumOfSquares(partplus.pt(), partminus.pt())); - // Calculation using ROOT vectors plusdaug = ROOT::Math::PxPyPzMVector(partplus.px(), partplus.py(), partplus.pz(), plusmass); minusdaug = ROOT::Math::PxPyPzMVector(partminus.px(), partminus.py(), partminus.pz(), plusmass); @@ -926,7 +962,6 @@ struct ResonancesGfwFlow { histos.fill(hist, invMass, pt, collision.centFT0C()); histos.fill(HIST("hPhiPhi"), phi); histos.fill(HIST("hPhiEta"), mom.Eta()); - histos.fill(HIST("hPhimassSparse_RD"), invMassRD, ptRD, collision.centFT0C()); // fill RecoDecay mass and pt // Fill Phi weights if (cfgOutputNUAWeights && withinPtPOI) { @@ -942,37 +977,46 @@ struct ResonancesGfwFlow { if (withinPtPOI && withinPtRef) fGFW->Fill(mom.Eta(), ((fPtAxis->FindBin(pt) - 1) * fPhiMassAxis->GetNbins()) + (fPhiMassAxis->FindBin(invMass) - 1), phi, weff * waccPOI, 32); } - } + } // end of combinations loop return; } - template - bool selectionV0Daughter(TTrack const& track, int pid) + template + void likeSignPhi(TTrack track, const TCollision collision, double plusmass, const ConstStr& hist) { - if (!(track.itsNCls() > cfgITScluster)) - return 0; - if (!track.hasTPC()) - return false; - if (track.tpcNClsFound() < cfgTpcCluster) - return false; - if (!(track.tpcNClsCrossedRows() > cfgTpcCrossRows)) - return 0; + ROOT::Math::PxPyPzMVector daug1, daug2, mom; + for (auto const& [part1, part2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(track, track))) { - if (cfgUseOnlyTPC) { - if (pid == PIONS && std::abs(track.tpcNSigmaPi()) > cfgTpcCut) - return false; - if (pid == KAONS && std::abs(track.tpcNSigmaKa()) > cfgTpcCut) - return false; - if (pid == PROTONS && std::abs(track.tpcNSigmaPr()) > cfgTpcCut) - return false; - } else { - int partIndex = cfgUseAsymmetricPID ? getNsigmaPIDAssymmetric(track) : getNsigmaPIDTpcTof(track); - int pidIndex = partIndex - 1; // 0 = pion, 1 = kaon, 2 = proton - if (pidIndex != pid) - return false; - } + if (!selectionV0Daughter(part1, KAONS) || !selectionV0Daughter(part2, KAONS)) // 0 = pion, 1 = kaon, 2 = proton + continue; + if (isFakeKaon(part1) || isFakeKaon(part2)) + continue; - return true; + // Calculation using ROOT vectors + daug1 = ROOT::Math::PxPyPzMVector(part1.px(), part1.py(), part1.pz(), plusmass); + daug2 = ROOT::Math::PxPyPzMVector(part2.px(), part2.py(), part2.pz(), plusmass); + mom = daug1 + daug2; + + double pt = mom.Pt(); + double invMass = mom.M(); + double phi = mom.Phi(); + bool withinPtPOI = (cfgCutPtPOIMin < pt) && (pt < cfgCutPtPOIMax); // within POI pT range + bool withinPtRef = (cfgCutPtMin < pt) && (pt < cfgCutPtMax); + + phi = RecoDecay::constrainAngle(phi, 0.0, 1); // constrain azimuthal angle to [0,2pi] + + if (std::abs(mom.Rapidity()) < resoCutVals[PHI][kRapidity]) { + histos.fill(hist, invMass, pt, collision.centFT0C()); + double weff = 1; + double waccPOI = 1; + + if (withinPtPOI) + fGFW->Fill(mom.Eta(), ((fPtAxis->FindBin(pt) - 1) * fPhiMassAxis->GetNbins()) + (fPhiMassAxis->FindBin(invMass) - 1), phi, weff * waccPOI, 512); + if (withinPtPOI && withinPtRef) + fGFW->Fill(mom.Eta(), ((fPtAxis->FindBin(pt) - 1) * fPhiMassAxis->GetNbins()) + (fPhiMassAxis->FindBin(invMass) - 1), phi, weff * waccPOI, 1024); + } + } // end of positive combinations loop + return; } template @@ -1348,6 +1392,11 @@ struct ResonancesGfwFlow { resurrectPhi(posSlicedTracks, negSlicedTracks, collision, kaonPlus, kaonMinus, phiMom, massKaPlus, HIST("hPhiMass_sparse")); } + if (cfgUseLsPhi) { + likeSignPhi(posSlicedTracks, collision, massKaPlus, HIST("hLsPhiMass_sparse")); + likeSignPhi(negSlicedTracks, collision, massKaPlus, HIST("hLsPhiMass_sparse")); + } + // ---------------------- Analyzing the V0s for (auto const& v0s : V0s) { if (resoSwitchVals[K0][kUseParticle]) { @@ -1374,6 +1423,15 @@ struct ResonancesGfwFlow { } } // end of phi condition + if (cfgUseLsPhi && corrconfigs.at(i).Head.starts_with("LsPhi")) { + int pIndex = findComponent(lsPhiV2, Form("h%spt", corrconfigs.at(i).Head.c_str())); + fillProfileBoot3D(corrconfigs.at(i), lsPhiV2[pIndex], cent, fPhiMassAxis); + + if (cfgUseBootStrap) { + fillProfileBoot3D(corrconfigs.at(i), phiBoot[bootId][pIndex], cent, fPhiMassAxis); + } + } // end of LikeSign phi condition + if (resoSwitchVals[K0][kUseParticle] && corrconfigs.at(i).Head.starts_with("K0")) { int pIndex = findComponent(k0V2, Form("h%spt", corrconfigs.at(i).Head.c_str())); fillProfileBoot3D(corrconfigs.at(i), k0V2[pIndex], cent, fK0MassAxis); From 46dcd4d86edb948286eb9c4b94ab2585209bfcfa Mon Sep 17 00:00:00 2001 From: Gyula Bencedi Date: Mon, 28 Jul 2025 20:37:52 +0200 Subject: [PATCH 111/345] [PWGLF] Fix unnecessary histo filling (#12295) --- .../GlobalEventProperties/flattenictyPikp.cxx | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/PWGLF/Tasks/GlobalEventProperties/flattenictyPikp.cxx b/PWGLF/Tasks/GlobalEventProperties/flattenictyPikp.cxx index 51511ece0cf..56a932dd705 100644 --- a/PWGLF/Tasks/GlobalEventProperties/flattenictyPikp.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/flattenictyPikp.cxx @@ -538,6 +538,17 @@ struct FlattenictyPikp { flatchrg.add("hPtVsDCAxyAll", "hPtVsDCAxyAll", HistType::kTH2D, {ptAxis, dcaXYAxis}); flatchrg.add({"ResponseGen", " ; N_{part}; F_{FV0};", {HistType::kTHnSparseD, {multAxis, flatAxis}}}); flatchrg.add("h1flatencityFV0MCGen", "", HistType::kTH1D, {{102, -0.01, 1.01, "1-flatencityFV0"}}); + + // Hash list for efficiency + listEfficiency.setObject(new THashList); + static_for<0, 1>([&](auto pidSgn) { + bookMcHist(); + bookMcHist(); + bookMcHist(); + initEfficiency(); + initEfficiency(); + initEfficiency(); + }); } if (doprocessMCclosure) { @@ -573,17 +584,6 @@ struct FlattenictyPikp { flatchrg.add({fmt::format(kPtGenRecCollPrimSgnINELF.data(), kSpecies[i]).c_str(), " ; p_{T} (GeV/c)", {HistType::kTH3D, {multAxis, flatAxis, ptAxis}}}); } } - - // Hash list for efficiency - listEfficiency.setObject(new THashList); - static_for<0, 1>([&](auto pidSgn) { - bookMcHist(); - bookMcHist(); - bookMcHist(); - initEfficiency(); - initEfficiency(); - initEfficiency(); - }); } void initCCDB(aod::BCsWithTimestamps::iterator const& bc) @@ -675,7 +675,7 @@ struct FlattenictyPikp { void fillNsigma(T const& tracks, const C& collision) { const float mult = getMult(collision); - const float flat = fillFlat(collision); + const float flat = fillFlat(collision); for (const auto& track : tracks) { checkNsigma(track, mult, flat); } @@ -1064,7 +1064,7 @@ struct FlattenictyPikp { inline void filldEdxQA(T const& track, C const& collision, const float dEdx) { const float mult = getMult(collision); - const float flat = fillFlat(collision); + const float flat = fillFlat(collision); // float dEdx = track.tpcSignal(); if constexpr (fillHist) { if (track.tpcInnerParam() >= trkSelOpt.cfgMomMIPMin && track.tpcInnerParam() <= trkSelOpt.cfgMomMIPMax) { From a2c85be900292f4ec57b211f570a217f98594e5b Mon Sep 17 00:00:00 2001 From: Christian Sonnabend Date: Mon, 28 Jul 2025 21:31:55 +0200 Subject: [PATCH 112/345] [Common] Batched evaluation for ONNX models to reduce memory consumption (#11839) Co-authored-by: ALICE Action Bot --- Common/TableProducer/PID/pidTPC.cxx | 58 +++++++++++++++++------------ 1 file changed, 35 insertions(+), 23 deletions(-) diff --git a/Common/TableProducer/PID/pidTPC.cxx b/Common/TableProducer/PID/pidTPC.cxx index 2ec03df592f..e423f5a7a7d 100644 --- a/Common/TableProducer/PID/pidTPC.cxx +++ b/Common/TableProducer/PID/pidTPC.cxx @@ -150,9 +150,11 @@ struct tpcPid { Configurable useNetworkHe{"useNetworkHe", 1, {"Switch for applying neural network on the helium3 mass hypothesis (if network enabled) (set to 0 to disable)"}}; Configurable useNetworkAl{"useNetworkAl", 1, {"Switch for applying neural network on the alpha mass hypothesis (if network enabled) (set to 0 to disable)"}}; Configurable networkBetaGammaCutoff{"networkBetaGammaCutoff", 0.45, {"Lower value of beta-gamma to override the NN application"}}; + Configurable networkInputBatchedMode{"networkInputBatchedMode", -1, {"-1: Takes all tracks, >0: Takes networkInputBatchedMode number of tracks at once"}}; // Parametrization configuration bool useCCDBParam = false; + std::vector track_properties; void init(o2::framework::InitContext& initContext) { @@ -298,8 +300,6 @@ struct tpcPid { std::vector createNetworkPrediction(C const& collisions, T const& tracks, B const& bcs, const size_t size) { - std::vector network_prediction; - auto start_network_total = std::chrono::high_resolution_clock::now(); if (autofetchNetworks) { const auto& bc = bcs.begin(); @@ -345,20 +345,24 @@ struct tpcPid { // Defining some network parameters int input_dimensions = network.getNumInputNodes(); int output_dimensions = network.getNumOutputNodes(); - const uint64_t track_prop_size = input_dimensions * size; const uint64_t prediction_size = output_dimensions * size; + const uint8_t numSpecies = 9; + const uint64_t total_eval_size = size * numSpecies; // 9 species - network_prediction = std::vector(prediction_size * 9); // For each mass hypotheses const float nNclNormalization = response->GetNClNormalization(); float duration_network = 0; - std::vector track_properties(track_prop_size); - uint64_t counter_track_props = 0; - int loop_counter = 0; + uint64_t counter_track_props = 0, exec_counter = 0, in_batch_counter = 0, total_input_count = 0; + uint64_t track_prop_size = networkInputBatchedMode.value; + if (networkInputBatchedMode.value <= 0) { + track_prop_size = size; // If the networkInputBatchedMode is not set, we use all tracks at once + } + track_properties.resize(track_prop_size * input_dimensions); // If the networkInputBatchedMode is set, we use the number of tracks specified in the config + std::vector network_prediction(prediction_size * numSpecies); // For each mass hypotheses // Filling a std::vector to be evaluated by the network // Evaluation on single tracks brings huge overhead: Thus evaluation is done on one large vector - for (int i = 0; i < 9; i++) { // Loop over particle number for which network correction is used + for (int species = 0; species < numSpecies; species++) { // Loop over particle number for which network correction is used for (auto const& trk : tracks) { if (!trk.hasTPC()) { continue; @@ -368,30 +372,38 @@ struct tpcPid { continue; } } - track_properties[counter_track_props] = trk.tpcInnerParam(); + + if ((in_batch_counter == track_prop_size) || (total_input_count == total_eval_size)) { // If the batch size is reached, reset the counter + int32_t fill_shift = (exec_counter * track_prop_size - ((total_input_count == total_eval_size) ? (total_input_count % track_prop_size) : 0)) * output_dimensions; + auto start_network_eval = std::chrono::high_resolution_clock::now(); + float* output_network = network.evalModel(track_properties); + auto stop_network_eval = std::chrono::high_resolution_clock::now(); + duration_network += std::chrono::duration>(stop_network_eval - start_network_eval).count(); + + for (uint64_t i = 0; i < (in_batch_counter * output_dimensions); i += output_dimensions) { + for (int j = 0; j < output_dimensions; j++) { + network_prediction[i + j + fill_shift] = output_network[i + j]; + } + } + counter_track_props = 0; + in_batch_counter = 0; + exec_counter++; + } + + // LOG(info) << "counter_tracks_props: " << counter_track_props << "; in_batch_counter: " << in_batch_counter << "; total_input_count: " << total_input_count << "; exec_counter: " << exec_counter << "; track_prop_size: " << track_prop_size << "; size: " << size << "; track_properties.size(): " << track_properties.size(); + track_properties[counter_track_props] = trk.tpcInnerParam(); // (tracks.asArrowTable()->GetColumn("tpcInnerParam")).GetData(); track_properties[counter_track_props + 1] = trk.tgl(); track_properties[counter_track_props + 2] = trk.signed1Pt(); - track_properties[counter_track_props + 3] = o2::track::pid_constants::sMasses[i]; + track_properties[counter_track_props + 3] = o2::track::pid_constants::sMasses[species]; track_properties[counter_track_props + 4] = trk.has_collision() ? collisions.iteratorAt(trk.collisionId()).multTPC() / 11000. : 1.; track_properties[counter_track_props + 5] = std::sqrt(nNclNormalization / trk.tpcNClsFound()); if (input_dimensions == 7 && networkVersion == "2") { track_properties[counter_track_props + 6] = trk.has_collision() ? collisions.iteratorAt(trk.collisionId()).ft0cOccupancyInTimeRange() / 60000. : 1.; } counter_track_props += input_dimensions; + in_batch_counter++; + total_input_count++; } - - auto start_network_eval = std::chrono::high_resolution_clock::now(); - float* output_network = network.evalModel(track_properties); - auto stop_network_eval = std::chrono::high_resolution_clock::now(); - duration_network += std::chrono::duration>(stop_network_eval - start_network_eval).count(); - for (uint64_t i = 0; i < prediction_size; i += output_dimensions) { - for (int j = 0; j < output_dimensions; j++) { - network_prediction[i + j + prediction_size * loop_counter] = output_network[i + j]; - } - } - - counter_track_props = 0; - loop_counter += 1; } track_properties.clear(); From 83e8039bc12c7abb8c5b4a72ede8d0d3b3e42a6b Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Mon, 28 Jul 2025 22:37:04 +0200 Subject: [PATCH 113/345] [PWGEM/Dilepton] support new data of global muons (#12297) --- .../TableProducer/skimmerPrimaryMuon.cxx | 83 ++++++++++++++++++- 1 file changed, 82 insertions(+), 1 deletion(-) diff --git a/PWGEM/Dilepton/TableProducer/skimmerPrimaryMuon.cxx b/PWGEM/Dilepton/TableProducer/skimmerPrimaryMuon.cxx index aaeddaadb27..457e2787771 100644 --- a/PWGEM/Dilepton/TableProducer/skimmerPrimaryMuon.cxx +++ b/PWGEM/Dilepton/TableProducer/skimmerPrimaryMuon.cxx @@ -38,6 +38,7 @@ #include #include +#include #include #include #include @@ -399,14 +400,46 @@ struct skimmerPrimaryMuon { } } - SliceCache cache; + // std::map, float> mCandidates; // std::pair -> chi2MatchMCHMFT; + std::vector> vec_min_chi2MatchMCHMFT; // std::pair -> chi2MatchMCHMFT; + template + void findBestMatchPerMCHMID(TMuons const& muons) + { + vec_min_chi2MatchMCHMFT.reserve(muons.size()); + for (const auto& muon : muons) { + if (muon.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::MuonStandaloneTrack) { + const auto& muons_per_MCHMID = muons.sliceBy(fwdtracksPerMCHTrack, muon.globalIndex()); + // LOGF(info, "stanadalone: muon.globalIndex() = %d, muon.chi2MatchMCHMFT() = %f", muon.globalIndex(), muon.chi2MatchMCHMFT()); + // LOGF(info, "muons_per_MCHMID.size() = %d", muons_per_MCHMID.size()); + + float min_chi2MatchMCHMFT = 1e+10; + std::tuple tupleIds_at_min; + for (const auto& muon_tmp : muons_per_MCHMID) { + if (muon_tmp.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) { + // LOGF(info, "muon_tmp.globalIndex() = %d, muon_tmp.matchMCHTrackId() = %d, muon_tmp.matchMFTTrackId() = %d, muon_tmp.chi2MatchMCHMFT() = %f", muon_tmp.globalIndex(), muon_tmp.matchMCHTrackId(), muon_tmp.matchMFTTrackId(), muon_tmp.chi2MatchMCHMFT()); + if (0.f < muon_tmp.chi2MatchMCHMFT() && muon_tmp.chi2MatchMCHMFT() < min_chi2MatchMCHMFT) { + min_chi2MatchMCHMFT = muon_tmp.chi2MatchMCHMFT(); + tupleIds_at_min = std::make_tuple(muon_tmp.globalIndex(), muon_tmp.matchMCHTrackId(), muon_tmp.matchMFTTrackId()); + } + } + } + vec_min_chi2MatchMCHMFT.emplace_back(tupleIds_at_min); + // mCandidates[tupleIds_at_min] = min_chi2MatchMCHMFT; + // LOGF(info, "min: muon_tmp.globalIndex() = %d, muon_tmp.matchMCHTrackId() = %d, muon_tmp.matchMFTTrackId() = %d, muon_tmp.chi2MatchMCHMFT() = %f", std::get<0>(tupleIds_at_min), std::get<1>(tupleIds_at_min), std::get<2>(tupleIds_at_min), min_chi2MatchMCHMFT); + } + } // end of muon loop + } + SliceCache cache; Preslice perCollision = o2::aod::fwdtrack::collisionId; Preslice fwdtrackIndicesPerCollision = aod::track_association::collisionId; PresliceUnsorted fwdtrackIndicesPerFwdTrack = aod::track_association::fwdtrackId; + PresliceUnsorted fwdtracksPerMCHTrack = aod::fwdtrack::matchMCHTrackId; void processRec_SA(MyCollisions const& collisions, MyFwdTracks const& fwdtracks, aod::MFTTracks const&, aod::BCsWithTimestamps const&) { + findBestMatchPerMCHMID(fwdtracks); + for (const auto& collision : collisions) { const auto& bc = collision.template bc_as(); initCCDB(bc); @@ -420,14 +453,24 @@ struct skimmerPrimaryMuon { if (fwdtrack.trackType() != o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack && fwdtrack.trackType() != o2::aod::fwdtrack::ForwardTrackTypeEnum::MuonStandaloneTrack) { continue; } + + if (fwdtrack.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack && std::find(vec_min_chi2MatchMCHMFT.begin(), vec_min_chi2MatchMCHMFT.end(), std::make_tuple(fwdtrack.globalIndex(), fwdtrack.matchMCHTrackId(), fwdtrack.matchMFTTrackId())) == vec_min_chi2MatchMCHMFT.end()) { + continue; + } + fillFwdTrackTable(collision, fwdtrack, false); } // end of fwdtrack loop } // end of collision loop + + vec_min_chi2MatchMCHMFT.clear(); + vec_min_chi2MatchMCHMFT.shrink_to_fit(); } PROCESS_SWITCH(skimmerPrimaryMuon, processRec_SA, "process reconstructed info", false); void processRec_TTCA(MyCollisions const& collisions, MyFwdTracks const& fwdtracks, aod::MFTTracks const&, aod::BCsWithTimestamps const&, aod::FwdTrackAssoc const& fwdtrackIndices) { + findBestMatchPerMCHMID(fwdtracks); + std::unordered_map mapAmb; // fwdtrack.globalIndex() -> bool isAmb; for (const auto& fwdtrack : fwdtracks) { const auto& fwdtrackIdsPerFwdTrack = fwdtrackIndices.sliceBy(fwdtrackIndicesPerFwdTrack, fwdtrack.globalIndex()); @@ -449,15 +492,23 @@ struct skimmerPrimaryMuon { if (fwdtrack.trackType() != o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack && fwdtrack.trackType() != o2::aod::fwdtrack::ForwardTrackTypeEnum::MuonStandaloneTrack) { continue; } + if (fwdtrack.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack && std::find(vec_min_chi2MatchMCHMFT.begin(), vec_min_chi2MatchMCHMFT.end(), std::make_tuple(fwdtrack.globalIndex(), fwdtrack.matchMCHTrackId(), fwdtrack.matchMFTTrackId())) == vec_min_chi2MatchMCHMFT.end()) { + continue; + } + fillFwdTrackTable(collision, fwdtrack, mapAmb[fwdtrack.globalIndex()]); } // end of fwdtrack loop } // end of collision loop mapAmb.clear(); + vec_min_chi2MatchMCHMFT.clear(); + vec_min_chi2MatchMCHMFT.shrink_to_fit(); } PROCESS_SWITCH(skimmerPrimaryMuon, processRec_TTCA, "process reconstructed info", false); void processRec_SA_SWT(MyCollisionsWithSWT const& collisions, MyFwdTracks const& fwdtracks, aod::MFTTracks const&, aod::BCsWithTimestamps const&) { + findBestMatchPerMCHMID(fwdtracks); + for (const auto& collision : collisions) { const auto& bc = collision.template bc_as(); initCCDB(bc); @@ -475,14 +526,22 @@ struct skimmerPrimaryMuon { if (fwdtrack.trackType() != o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack && fwdtrack.trackType() != o2::aod::fwdtrack::ForwardTrackTypeEnum::MuonStandaloneTrack) { continue; } + if (fwdtrack.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack && std::find(vec_min_chi2MatchMCHMFT.begin(), vec_min_chi2MatchMCHMFT.end(), std::make_tuple(fwdtrack.globalIndex(), fwdtrack.matchMCHTrackId(), fwdtrack.matchMFTTrackId())) == vec_min_chi2MatchMCHMFT.end()) { + continue; + } + fillFwdTrackTable(collision, fwdtrack, false); } // end of fwdtrack loop } // end of collision loop + vec_min_chi2MatchMCHMFT.clear(); + vec_min_chi2MatchMCHMFT.shrink_to_fit(); } PROCESS_SWITCH(skimmerPrimaryMuon, processRec_SA_SWT, "process reconstructed info only with standalone", false); void processRec_TTCA_SWT(MyCollisionsWithSWT const& collisions, MyFwdTracks const& fwdtracks, aod::MFTTracks const&, aod::BCsWithTimestamps const&, aod::FwdTrackAssoc const& fwdtrackIndices) { + findBestMatchPerMCHMID(fwdtracks); + std::unordered_map mapAmb; // fwdtrack.globalIndex() -> bool isAmb; for (const auto& fwdtrack : fwdtracks) { const auto& fwdtrackIdsPerFwdTrack = fwdtrackIndices.sliceBy(fwdtrackIndicesPerFwdTrack, fwdtrack.globalIndex()); @@ -506,15 +565,23 @@ struct skimmerPrimaryMuon { if (fwdtrack.trackType() != o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack && fwdtrack.trackType() != o2::aod::fwdtrack::ForwardTrackTypeEnum::MuonStandaloneTrack) { continue; } + if (fwdtrack.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack && std::find(vec_min_chi2MatchMCHMFT.begin(), vec_min_chi2MatchMCHMFT.end(), std::make_tuple(fwdtrack.globalIndex(), fwdtrack.matchMCHTrackId(), fwdtrack.matchMFTTrackId())) == vec_min_chi2MatchMCHMFT.end()) { + continue; + } + fillFwdTrackTable(collision, fwdtrack, mapAmb[fwdtrack.globalIndex()]); } // end of fwdtrack loop } // end of collision loop mapAmb.clear(); + vec_min_chi2MatchMCHMFT.clear(); + vec_min_chi2MatchMCHMFT.shrink_to_fit(); } PROCESS_SWITCH(skimmerPrimaryMuon, processRec_TTCA_SWT, "process reconstructed info", false); void processMC_SA(soa::Join const& collisions, MyFwdTracksMC const& fwdtracks, MFTTracksMC const&, aod::BCsWithTimestamps const&) { + findBestMatchPerMCHMID(fwdtracks); + for (const auto& collision : collisions) { const auto& bc = collision.template bc_as(); initCCDB(bc); @@ -533,14 +600,22 @@ struct skimmerPrimaryMuon { if (fwdtrack.trackType() != o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack && fwdtrack.trackType() != o2::aod::fwdtrack::ForwardTrackTypeEnum::MuonStandaloneTrack) { continue; } + if (fwdtrack.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack && std::find(vec_min_chi2MatchMCHMFT.begin(), vec_min_chi2MatchMCHMFT.end(), std::make_tuple(fwdtrack.globalIndex(), fwdtrack.matchMCHTrackId(), fwdtrack.matchMFTTrackId())) == vec_min_chi2MatchMCHMFT.end()) { + continue; + } + fillFwdTrackTable(collision, fwdtrack, false); } // end of fwdtrack loop } // end of collision loop + vec_min_chi2MatchMCHMFT.clear(); + vec_min_chi2MatchMCHMFT.shrink_to_fit(); } PROCESS_SWITCH(skimmerPrimaryMuon, processMC_SA, "process reconstructed and MC info", false); void processMC_TTCA(soa::Join const& collisions, MyFwdTracksMC const& fwdtracks, MFTTracksMC const&, aod::BCsWithTimestamps const&, aod::FwdTrackAssoc const& fwdtrackIndices) { + findBestMatchPerMCHMID(fwdtracks); + std::unordered_map mapAmb; // fwdtrack.globalIndex() -> bool isAmb; for (const auto& fwdtrack : fwdtracks) { const auto& fwdtrackIdsPerFwdTrack = fwdtrackIndices.sliceBy(fwdtrackIndicesPerFwdTrack, fwdtrack.globalIndex()); @@ -567,10 +642,16 @@ struct skimmerPrimaryMuon { if (fwdtrack.trackType() != o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack && fwdtrack.trackType() != o2::aod::fwdtrack::ForwardTrackTypeEnum::MuonStandaloneTrack) { continue; } + if (fwdtrack.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack && std::find(vec_min_chi2MatchMCHMFT.begin(), vec_min_chi2MatchMCHMFT.end(), std::make_tuple(fwdtrack.globalIndex(), fwdtrack.matchMCHTrackId(), fwdtrack.matchMFTTrackId())) == vec_min_chi2MatchMCHMFT.end()) { + continue; + } + fillFwdTrackTable(collision, fwdtrack, mapAmb[fwdtrack.globalIndex()]); } // end of fwdtrack loop } // end of collision loop mapAmb.clear(); + vec_min_chi2MatchMCHMFT.clear(); + vec_min_chi2MatchMCHMFT.shrink_to_fit(); } PROCESS_SWITCH(skimmerPrimaryMuon, processMC_TTCA, "process reconstructed and MC info", false); From 08e1b6e24d7c09e776dae9b5f86acadbd8615c2f Mon Sep 17 00:00:00 2001 From: omvazque Date: Mon, 28 Jul 2025 18:14:38 -0500 Subject: [PATCH 114/345] [PWGLF] Fixed the Nch mult != 0 bug. (#12301) --- PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx b/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx index ea894e460c3..cc56b8fe550 100644 --- a/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx @@ -838,7 +838,7 @@ struct UccZdc { // apply corrections if (applyEff || applyFD) { - + nchMult = 0.; loadCorrections(foundBC.timestamp()); if (!(cfg.hEfficiency && cfg.hFeedDown)) return; From cca16d3dc34468aa8b639675ae4926457f56e82d Mon Sep 17 00:00:00 2001 From: EmilGorm <50658075+EmilGorm@users.noreply.github.com> Date: Tue, 29 Jul 2025 01:20:58 +0200 Subject: [PATCH 115/345] [PWGCF] Add additional cut on global vs V0A/T0A correlation (#12291) --- .../Tasks/flowGfwLightIons.cxx | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/PWGCF/GenericFramework/Tasks/flowGfwLightIons.cxx b/PWGCF/GenericFramework/Tasks/flowGfwLightIons.cxx index fb654b6014a..7a74223e5ac 100644 --- a/PWGCF/GenericFramework/Tasks/flowGfwLightIons.cxx +++ b/PWGCF/GenericFramework/Tasks/flowGfwLightIons.cxx @@ -79,6 +79,8 @@ GFWCorrConfigs configs; std::vector multGlobalCorrCutPars; std::vector multPVCorrCutPars; std::vector multGlobalPVCorrCutPars; +std::vector multGlobalV0ACutPars; +std::vector multGlobalT0ACutPars; std::vector firstRunsOfFill; } // namespace o2::analysis::gfw @@ -134,6 +136,15 @@ struct FlowGfwLightIons { O2_DEFINE_CONFIGURABLE(cfgMultCorrHighCutFunction, std::string, "[0] + [1]*x + [2]*x*x + [3]*x*x*x + [4]*x*x*x*x + 3.*([5] + [6]*x + [7]*x*x + [8]*x*x*x + [9]*x*x*x*x)", "Functional for multiplicity correlation cut"); O2_DEFINE_CONFIGURABLE(cfgMultCorrLowCutFunction, std::string, "[0] + [1]*x + [2]*x*x + [3]*x*x*x + [4]*x*x*x*x - 3.*([5] + [6]*x + [7]*x*x + [8]*x*x*x + [9]*x*x*x*x)", "Functional for multiplicity correlation cut"); O2_DEFINE_CONFIGURABLE(cfgMultGlobalPVCorrCutFunction, std::string, "[0] + [1]*x + 3*([2] + [3]*x + [4]*x*x + [5]*x*x*x)", "Functional for global vs pv multiplicity correlation cut"); + struct : ConfigurableGroup { + O2_DEFINE_CONFIGURABLE(cfgMultGlobalASideCorrCutFunction, std::string, "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x + [10]*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", "Functional for global vs V0A multiplicity low correlation cut"); + Configurable> cfgMultGlobalV0ACutPars{"cfgMultGlobalV0ACutPars", std::vector{567.785, 172.715, 0.77888, -0.00693466, 1.40564e-05, 679.853, 66.8068, -0.444332, 0.00115002, -4.92064e-07}, "Global vs FV0A multiplicity cut parameter values"}; + Configurable> cfgMultGlobalT0ACutPars{"cfgMultGlobalT0ACutPars", std::vector{241.618, 61.8402, 0.348049, -0.00306078, 6.20357e-06, 315.235, 29.1491, -0.188639, 0.00044528, -9.08912e-08}, "Global vs FT0A multiplicity cut parameter values"}; + O2_DEFINE_CONFIGURABLE(cfgGlobalV0ALowSigma, float, -3, "Number of sigma deviations below expected value in global vs V0A correlation"); + O2_DEFINE_CONFIGURABLE(cfgGlobalV0AHighSigma, float, 4, "Number of sigma deviations above expected value in global vs V0A correlation"); + O2_DEFINE_CONFIGURABLE(cfgGlobalT0ALowSigma, float, -3., "Number of sigma deviations below expected value in global vs T0A correlation"); + O2_DEFINE_CONFIGURABLE(cfgGlobalT0AHighSigma, float, 4, "Number of sigma deviations above expected value in global vs T0A correlation"); + } cfgGlobalAsideCorrCuts; Configurable cfgGFWBinning{"cfgGFWBinning", {40, 16, 72, 300, 0, 3000, 0.2, 10.0, 0.2, 3.0, {0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.25, 1.5, 1.75, 2, 2.25, 2.5, 2.75, 3, 3.25, 3.5, 3.75, 4, 4.5, 5, 5.5, 6, 7, 8, 9, 10}, {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90}}, "Configuration for binning"}; Configurable cfgRegions{"cfgRegions", {{"refN", "refP", "refFull"}, {-0.8, 0.4, -0.8}, {-0.4, 0.8, 0.8}, {0, 0, 0}, {1, 1, 1}}, "Configurations for GFW regions"}; @@ -241,6 +252,10 @@ struct FlowGfwLightIons { TF1* fMultCutLow = nullptr; TF1* fMultCutHigh = nullptr; TF1* fMultPVGlobalCutHigh = nullptr; + TF1* fMultGlobalV0ACutLow = nullptr; + TF1* fMultGlobalV0ACutHigh = nullptr; + TF1* fMultGlobalT0ACutLow = nullptr; + TF1* fMultGlobalT0ACutHigh = nullptr; TF1* fPtDepDCAxy = nullptr; @@ -287,6 +302,8 @@ struct FlowGfwLightIons { o2::analysis::gfw::multGlobalCorrCutPars = cfgMultGlobalCutPars; o2::analysis::gfw::multPVCorrCutPars = cfgMultPVCutPars; o2::analysis::gfw::multGlobalPVCorrCutPars = cfgMultGlobalPVCutPars; + o2::analysis::gfw::multGlobalV0ACutPars = cfgGlobalAsideCorrCuts.cfgMultGlobalV0ACutPars; + o2::analysis::gfw::multGlobalT0ACutPars = cfgGlobalAsideCorrCuts.cfgMultGlobalT0ACutPars; o2::analysis::gfw::firstRunsOfFill = cfgFirstRunsOfFill; if (cfgTimeDependent && !std::is_sorted(o2::analysis::gfw::firstRunsOfFill.begin(), o2::analysis::gfw::firstRunsOfFill.end())) { std::sort(o2::analysis::gfw::firstRunsOfFill.begin(), o2::analysis::gfw::firstRunsOfFill.end()); @@ -479,6 +496,36 @@ struct FlowGfwLightIons { fMultCutHigh->SetParameters(&(o2::analysis::gfw::multGlobalCorrCutPars[0])); fMultPVGlobalCutHigh = new TF1("fMultPVGlobalCutHigh", cfgMultGlobalPVCorrCutFunction->c_str(), 0, nchbinning.back()); fMultPVGlobalCutHigh->SetParameters(&(o2::analysis::gfw::multGlobalPVCorrCutPars[0])); + + LOGF(info, "Global V0A function: %s in range 0-%g", cfgGlobalAsideCorrCuts.cfgMultGlobalASideCorrCutFunction->c_str(), v0aAxis.binEdges.back()); + fMultGlobalV0ACutLow = new TF1("fMultGlobalV0ACutLow", cfgGlobalAsideCorrCuts.cfgMultGlobalASideCorrCutFunction->c_str(), 0, v0aAxis.binEdges.back()); + for (std::size_t i = 0; i < o2::analysis::gfw::multGlobalV0ACutPars.size(); ++i) + fMultGlobalV0ACutLow->SetParameter(i, o2::analysis::gfw::multGlobalV0ACutPars[i]); + fMultGlobalV0ACutLow->SetParameter(o2::analysis::gfw::multGlobalV0ACutPars.size(), cfgGlobalAsideCorrCuts.cfgGlobalV0ALowSigma); + for (int i = 0; i < fMultGlobalV0ACutLow->GetNpar(); ++i) + LOGF(info, "fMultGlobalV0ACutLow par %d = %g", i, fMultGlobalV0ACutLow->GetParameter(i)); + + fMultGlobalV0ACutHigh = new TF1("fMultGlobalV0ACutHigh", cfgGlobalAsideCorrCuts.cfgMultGlobalASideCorrCutFunction->c_str(), 0, v0aAxis.binEdges.back()); + for (std::size_t i = 0; i < o2::analysis::gfw::multGlobalV0ACutPars.size(); ++i) + fMultGlobalV0ACutHigh->SetParameter(i, o2::analysis::gfw::multGlobalV0ACutPars[i]); + fMultGlobalV0ACutHigh->SetParameter(o2::analysis::gfw::multGlobalV0ACutPars.size(), cfgGlobalAsideCorrCuts.cfgGlobalV0AHighSigma); + for (int i = 0; i < fMultGlobalV0ACutHigh->GetNpar(); ++i) + LOGF(info, "fMultGlobalV0ACutHigh par %d = %g", i, fMultGlobalV0ACutHigh->GetParameter(i)); + + LOGF(info, "Global T0A function: %s", cfgGlobalAsideCorrCuts.cfgMultGlobalASideCorrCutFunction->c_str()); + fMultGlobalT0ACutLow = new TF1("fMultGlobalT0ACutLow", cfgGlobalAsideCorrCuts.cfgMultGlobalASideCorrCutFunction->c_str(), 0, t0aAxis.binEdges.back()); + for (std::size_t i = 0; i < o2::analysis::gfw::multGlobalT0ACutPars.size(); ++i) + fMultGlobalT0ACutLow->SetParameter(i, o2::analysis::gfw::multGlobalT0ACutPars[i]); + fMultGlobalT0ACutLow->SetParameter(o2::analysis::gfw::multGlobalT0ACutPars.size(), cfgGlobalAsideCorrCuts.cfgGlobalT0ALowSigma); + for (int i = 0; i < fMultGlobalT0ACutLow->GetNpar(); ++i) + LOGF(info, "fMultGlobalT0ACutLow par %d = %g", i, fMultGlobalT0ACutLow->GetParameter(i)); + + fMultGlobalT0ACutHigh = new TF1("fMultGlobalT0ACutHigh", cfgGlobalAsideCorrCuts.cfgMultGlobalASideCorrCutFunction->c_str(), 0, t0aAxis.binEdges.back()); + for (std::size_t i = 0; i < o2::analysis::gfw::multGlobalT0ACutPars.size(); ++i) + fMultGlobalT0ACutHigh->SetParameter(i, o2::analysis::gfw::multGlobalT0ACutPars[i]); + fMultGlobalT0ACutHigh->SetParameter(o2::analysis::gfw::multGlobalT0ACutPars.size(), cfgGlobalAsideCorrCuts.cfgGlobalT0AHighSigma); + for (int i = 0; i < fMultGlobalT0ACutHigh->GetNpar(); ++i) + LOGF(info, "fMultGlobalT0ACutHigh par %d = %g", i, fMultGlobalT0ACutHigh->GetParameter(i)); } if (cfgUseDensityDependentCorrection) { std::vector pTEffBins = {0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.4, 1.8, 2.2, 2.6, 3.0}; @@ -690,6 +737,15 @@ struct FlowGfwLightIons { return 0; if (multTrk > fMultPVGlobalCutHigh->Eval(collision.multNTracksPV())) return 0; + + if (!(cfgGlobalAsideCorrCuts.cfgMultGlobalASideCorrCutFunction->empty()) && static_cast(collision.multFV0A()) < fMultGlobalV0ACutLow->Eval(multTrk)) + return 0; + if (!(cfgGlobalAsideCorrCuts.cfgMultGlobalASideCorrCutFunction->empty()) && static_cast(collision.multFV0A()) > fMultGlobalV0ACutHigh->Eval(multTrk)) + return 0; + if (!(cfgGlobalAsideCorrCuts.cfgMultGlobalASideCorrCutFunction->empty()) && static_cast(collision.multFT0A()) < fMultGlobalT0ACutLow->Eval(multTrk)) + return 0; + if (!(cfgGlobalAsideCorrCuts.cfgMultGlobalASideCorrCutFunction->empty()) && static_cast(collision.multFT0A()) > fMultGlobalT0ACutHigh->Eval(multTrk)) + return 0; registry.fill(HIST("eventQA/eventSel"), kMultCuts); if (cfgRunByRun) th1sList[run][hEventSel]->Fill(kMultCuts); From 8b9e89458374bdead9b6c7729b500ef10e7f4590 Mon Sep 17 00:00:00 2001 From: Matteo Morgante Date: Tue, 29 Jul 2025 05:22:29 +0200 Subject: [PATCH 116/345] [PWGLF] Added output table to sigmaminustask (#12252) Co-authored-by: ALICE Action Bot --- PWGLF/DataModel/LFKinkDecayTables.h | 35 ++++++ .../TableProducer/Strangeness/CMakeLists.txt | 5 + .../Strangeness/sigmaminustask.cxx | 115 ++++++++++++++++-- PWGLF/Tasks/Strangeness/CMakeLists.txt | 5 - 4 files changed, 143 insertions(+), 17 deletions(-) rename PWGLF/{Tasks => TableProducer}/Strangeness/sigmaminustask.cxx (54%) diff --git a/PWGLF/DataModel/LFKinkDecayTables.h b/PWGLF/DataModel/LFKinkDecayTables.h index 9533bd66116..d8df2eb865f 100644 --- a/PWGLF/DataModel/LFKinkDecayTables.h +++ b/PWGLF/DataModel/LFKinkDecayTables.h @@ -47,6 +47,21 @@ DECLARE_SOA_COLUMN(DcaMothPv, dcaMothPv, float); //! DCA of the mother to th DECLARE_SOA_COLUMN(DcaDaugPv, dcaDaugPv, float); //! DCA of the daughter kink to the primary vertex DECLARE_SOA_COLUMN(DcaKinkTopo, dcaKinkTopo, float); //! DCA of the kink topology +DECLARE_SOA_COLUMN(NSigmaTPCPi, nSigmaTPCPi, float); //! Number of sigmas for the pion candidate from Sigma kink in TPC +DECLARE_SOA_COLUMN(NSigmaTPCPr, nSigmaTPCPr, float); //! Number of sigmas for the proton candidate from Sigma kink in TPC +DECLARE_SOA_COLUMN(NSigmaTPCKa, nSigmaTPCKa, float); //! Number of sigmas for the kaon candidate from Sigma kink in TPC +DECLARE_SOA_COLUMN(NSigmaTOFPi, nSigmaTOFPi, float); //! Number of sigmas for the pion candidate from Sigma kink in TOF +DECLARE_SOA_COLUMN(NSigmaTOFPr, nSigmaTOFPr, float); //! Number of sigmas for the proton candidate from Sigma kink in TOF +DECLARE_SOA_COLUMN(NSigmaTOFKa, nSigmaTOFKa, float); //! Number of sigmas for the kaon candidate from Sigma kink in TOF + +// MC Columns +DECLARE_SOA_COLUMN(MothPdgCode, mothPdgCode, int); //! PDG code of the Sigma daughter +DECLARE_SOA_COLUMN(DaugPdgCode, daugPdgCode, int); //! PDG code of the kink daughter +DECLARE_SOA_COLUMN(PtMC, ptMC, float); //! pT of the candidate in MC +DECLARE_SOA_COLUMN(MassMC, massMC, float); //! Invariant mass of the candidate in MC +DECLARE_SOA_COLUMN(DecayRadiusMC, decayRadiusMC, float); //! Decay radius of the candidate in MC +DECLARE_SOA_COLUMN(CollisionIdCheck, collisionIdCheck, bool); //! Check if mcDaughter collision ID matches the reconstructed collision ID + // DYNAMIC COLUMNS DECLARE_SOA_DYNAMIC_COLUMN(PxDaugNeut, pxDaugNeut, //! Px of the daughter neutral particle @@ -120,6 +135,26 @@ DECLARE_SOA_TABLE(KinkCandsUnbound, "AOD", "UBKINKCANDS", kinkcand::MSigmaPlus, kinkcand::MXiMinus); +DECLARE_SOA_TABLE(SlimKinkCands, "AOD", "SLIMKINKCANDS", + kinkcand::XDecVtx, kinkcand::YDecVtx, kinkcand::ZDecVtx, + kinkcand::PxMoth, kinkcand::PyMoth, kinkcand::PzMoth, + kinkcand::PxDaug, kinkcand::PyDaug, kinkcand::PzDaug, + kinkcand::DcaMothPv, kinkcand::DcaDaugPv, kinkcand::DcaKinkTopo, + kinkcand::MothSign, + kinkcand::NSigmaTPCPi, kinkcand::NSigmaTPCPr, kinkcand::NSigmaTPCKa, + kinkcand::NSigmaTOFPi, kinkcand::NSigmaTOFPr, kinkcand::NSigmaTOFKa); + +DECLARE_SOA_TABLE(SlimKinkCandsMC, "AOD", "SLIMKINKCANDSMC", + kinkcand::XDecVtx, kinkcand::YDecVtx, kinkcand::ZDecVtx, + kinkcand::PxMoth, kinkcand::PyMoth, kinkcand::PzMoth, + kinkcand::PxDaug, kinkcand::PyDaug, kinkcand::PzDaug, + kinkcand::DcaMothPv, kinkcand::DcaDaugPv, kinkcand::DcaKinkTopo, + kinkcand::MothSign, + kinkcand::NSigmaTPCPi, kinkcand::NSigmaTPCPr, kinkcand::NSigmaTPCKa, + kinkcand::NSigmaTOFPi, kinkcand::NSigmaTOFPr, kinkcand::NSigmaTOFKa, + kinkcand::MothPdgCode, kinkcand::DaugPdgCode, + kinkcand::PtMC, kinkcand::MassMC, kinkcand::DecayRadiusMC, kinkcand::CollisionIdCheck); + } // namespace o2::aod #endif // PWGLF_DATAMODEL_LFKINKDECAYTABLES_H_ diff --git a/PWGLF/TableProducer/Strangeness/CMakeLists.txt b/PWGLF/TableProducer/Strangeness/CMakeLists.txt index 1224f01df0f..9e4a3fa04f8 100644 --- a/PWGLF/TableProducer/Strangeness/CMakeLists.txt +++ b/PWGLF/TableProducer/Strangeness/CMakeLists.txt @@ -91,6 +91,11 @@ o2physics_add_dpl_workflow(lambdakzerospawner PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(sigmaminus-task + SOURCES sigmaminustask.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(strange-tree-creator SOURCES strangeTreeCreator.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore diff --git a/PWGLF/Tasks/Strangeness/sigmaminustask.cxx b/PWGLF/TableProducer/Strangeness/sigmaminustask.cxx similarity index 54% rename from PWGLF/Tasks/Strangeness/sigmaminustask.cxx rename to PWGLF/TableProducer/Strangeness/sigmaminustask.cxx index ac588fb8597..d60109009a5 100644 --- a/PWGLF/Tasks/Strangeness/sigmaminustask.cxx +++ b/PWGLF/TableProducer/Strangeness/sigmaminustask.cxx @@ -26,11 +26,18 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; -using TracksFull = soa::Join; +using TracksFull = soa::Join; using CollisionsFull = soa::Join; using CollisionsFullMC = soa::Join; struct sigmaminustask { + + // Output Tables + Produces outputDataTable; + Produces outputDataTableMC; + // Histograms are defined with HistogramRegistry HistogramRegistry rEventSelection{"eventSelection", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry rSigmaMinus{"sigmaminus", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; @@ -38,19 +45,25 @@ struct sigmaminustask { // Configurable for event selection Configurable cutzvertex{"cutzvertex", 10.0f, "Accepted z-vertex range (cm)"}; Configurable cutNSigmaPi{"cutNSigmaPi", 4, "NSigmaTPCPion"}; + Configurable cutEtaMotherMC{"cutEtaMotherMC", 1.0f, "Eta cut for mother Sigma in MC"}; + + Configurable fillOutputTree{"fillOutputTree", true, "If true, fill the output tree with Kink candidates"}; Preslice mPerCol = aod::track::collisionId; void init(InitContext const&) { // Axes - const AxisSpec ptAxis{50, -10, 10, "#it{p}_{T} (GeV/#it{c})"}; + const AxisSpec ptAxis{100, -10, 10, "#it{p}_{T} (GeV/#it{c})"}; const AxisSpec nSigmaPiAxis{100, -5, 5, "n#sigma_{#pi}"}; const AxisSpec sigmaMassAxis{100, 1.1, 1.4, "m (GeV/#it{c}^{2})"}; const AxisSpec xiMassAxis{100, 1.2, 1.6, "m_{#Xi} (GeV/#it{c}^{2})"}; const AxisSpec pdgAxis{10001, -5000, 5000, "PDG code"}; const AxisSpec vertexZAxis{100, -15., 15., "vrtx_{Z} [cm]"}; + const AxisSpec ptResolutionAxis{100, -0.5, 0.5, "#it{p}_{T}^{rec} - #it{p}_{T}^{gen} (GeV/#it{c})"}; + const AxisSpec massResolutionAxis{100, -0.1, 0.1, "m_{rec} - m_{gen} (GeV/#it{c}^{2})"}; + // Event selection rEventSelection.add("hVertexZRec", "hVertexZRec", {HistType::kTH1F, {vertexZAxis}}); // Sigma-minus reconstruction @@ -62,6 +75,11 @@ struct sigmaminustask { // Add MC histograms if needed rSigmaMinus.add("h2MassPtMCRec", "h2MassPtMCRec", {HistType::kTH2F, {ptAxis, sigmaMassAxis}}); rSigmaMinus.add("h2MassPtMCGen", "h2MassPtMCGen", {HistType::kTH2F, {ptAxis, sigmaMassAxis}}); + + rSigmaMinus.add("h2MassResolution_minus", "h2MassResolution_minus", {HistType::kTH2F, {sigmaMassAxis, massResolutionAxis}}); + rSigmaMinus.add("h2PtResolution_minus", "h2PtResolution_minus", {HistType::kTH2F, {ptAxis, ptResolutionAxis}}); + rSigmaMinus.add("h2MassResolution_plus", "h2MassResolution_plus", {HistType::kTH2F, {sigmaMassAxis, massResolutionAxis}}); + rSigmaMinus.add("h2PtResolution_plus", "h2PtResolution_plus", {HistType::kTH2F, {ptAxis, ptResolutionAxis}}); } } @@ -71,14 +89,27 @@ struct sigmaminustask { return; } rEventSelection.fill(HIST("hVertexZRec"), collision.posZ()); + for (const auto& kinkCand : KinkCands) { auto dauTrack = kinkCand.trackDaug_as(); - if (abs(dauTrack.tpcNSigmaPi()) > cutNSigmaPi) { + + if (std::abs(dauTrack.tpcNSigmaPi()) > cutNSigmaPi) { continue; } + rSigmaMinus.fill(HIST("h2MassSigmaMinusPt"), kinkCand.mothSign() * kinkCand.ptMoth(), kinkCand.mSigmaMinus()); rSigmaMinus.fill(HIST("h2SigmaMassVsXiMass"), kinkCand.mXiMinus(), kinkCand.mSigmaMinus()); rSigmaMinus.fill(HIST("h2NSigmaPiPt"), kinkCand.mothSign() * kinkCand.ptMoth(), dauTrack.tpcNSigmaPi()); + + if (fillOutputTree) { + outputDataTable(kinkCand.xDecVtx(), kinkCand.yDecVtx(), kinkCand.zDecVtx(), + kinkCand.pxMoth(), kinkCand.pyMoth(), kinkCand.pzMoth(), + kinkCand.pxDaug(), kinkCand.pyDaug(), kinkCand.pzDaug(), + kinkCand.dcaMothPv(), kinkCand.dcaDaugPv(), kinkCand.dcaKinkTopo(), + kinkCand.mothSign(), + dauTrack.tpcNSigmaPi(), dauTrack.tpcNSigmaPr(), dauTrack.tpcNSigmaKa(), + dauTrack.tofNSigmaPi(), dauTrack.tofNSigmaPr(), dauTrack.tofNSigmaKa()); + } } } PROCESS_SWITCH(sigmaminustask, processData, "Data processing", true); @@ -92,20 +123,23 @@ struct sigmaminustask { rEventSelection.fill(HIST("hVertexZRec"), collision.posZ()); auto kinkCandPerColl = KinkCands.sliceBy(mPerCol, collision.globalIndex()); + for (const auto& kinkCand : kinkCandPerColl) { + auto dauTrack = kinkCand.trackDaug_as(); auto mothTrack = kinkCand.trackMoth_as(); if (dauTrack.sign() != mothTrack.sign()) { LOG(info) << "Skipping kink candidate with opposite sign daughter and mother: " << kinkCand.globalIndex(); continue; // Skip if the daughter has the opposite sign as the mother } - if (abs(dauTrack.tpcNSigmaPi()) > cutNSigmaPi) { + if (std::abs(dauTrack.tpcNSigmaPi()) > cutNSigmaPi) { continue; } rSigmaMinus.fill(HIST("h2MassSigmaMinusPt"), kinkCand.mothSign() * kinkCand.ptMoth(), kinkCand.mSigmaMinus()); rSigmaMinus.fill(HIST("h2SigmaMassVsXiMass"), kinkCand.mXiMinus(), kinkCand.mSigmaMinus()); rSigmaMinus.fill(HIST("h2NSigmaPiPt"), kinkCand.mothSign() * kinkCand.ptMoth(), dauTrack.tpcNSigmaPi()); + // do MC association auto mcLabSigma = trackLabelsMC.rawIteratorAt(mothTrack.globalIndex()); auto mcLabPiDau = trackLabelsMC.rawIteratorAt(dauTrack.globalIndex()); @@ -119,36 +153,93 @@ struct sigmaminustask { if (piMother.globalIndex() != mcTrackSigma.globalIndex()) { continue; } - if (std::abs(mcTrackSigma.pdgCode()) != 3112 || std::abs(mcTrackPiDau.pdgCode()) != 211) { + if (std::abs(mcTrackSigma.pdgCode()) != 3112) { + continue; + } + if (std::abs(mcTrackPiDau.pdgCode()) != 211 && std::abs(mcTrackPiDau.pdgCode()) != 2212) { continue; } + + float MotherMassMC = std::sqrt(piMother.e() * piMother.e() - piMother.p() * piMother.p()); + float MotherpTMC = piMother.pt(); + float deltaXMother = mcTrackPiDau.vx() - piMother.vx(); + float deltaYMother = mcTrackPiDau.vy() - piMother.vy(); + float decayRadiusMC = std::sqrt(deltaXMother * deltaXMother + deltaYMother * deltaYMother); + + // Check coherence of MCcollision Id for daughter MCparticle and reconstructed collision + auto mcCollision = mcTrackPiDau.template mcCollision_as(); + bool mcCollisionIdCheck = collision.mcCollisionId() == mcCollision.globalIndex(); + rSigmaMinus.fill(HIST("h2MassPtMCRec"), kinkCand.mothSign() * kinkCand.ptMoth(), kinkCand.mSigmaMinus()); + if (mcTrackSigma.pdgCode() > 0) { + rSigmaMinus.fill(HIST("h2MassResolution_plus"), kinkCand.mSigmaMinus(), kinkCand.mSigmaMinus() - MotherMassMC); + rSigmaMinus.fill(HIST("h2PtResolution_plus"), kinkCand.ptMoth(), kinkCand.ptMoth() - MotherpTMC); + } else { + rSigmaMinus.fill(HIST("h2MassResolution_minus"), kinkCand.mSigmaMinus(), kinkCand.mSigmaMinus() - MotherMassMC); + rSigmaMinus.fill(HIST("h2PtResolution_minus"), kinkCand.ptMoth(), kinkCand.ptMoth() - MotherpTMC); + } + + // fill the output table with Mc information + if (fillOutputTree) { + outputDataTableMC(kinkCand.xDecVtx(), kinkCand.yDecVtx(), kinkCand.zDecVtx(), + kinkCand.pxMoth(), kinkCand.pyMoth(), kinkCand.pzMoth(), + kinkCand.pxDaug(), kinkCand.pyDaug(), kinkCand.pzDaug(), + kinkCand.dcaMothPv(), kinkCand.dcaDaugPv(), kinkCand.dcaKinkTopo(), + kinkCand.mothSign(), + dauTrack.tpcNSigmaPi(), dauTrack.tpcNSigmaPr(), dauTrack.tpcNSigmaKa(), + dauTrack.tofNSigmaPi(), dauTrack.tofNSigmaPr(), dauTrack.tofNSigmaKa(), + mcTrackSigma.pdgCode(), mcTrackPiDau.pdgCode(), + MotherpTMC, MotherMassMC, decayRadiusMC, mcCollisionIdCheck); + } } - } - } - } + } // MC association and selection + } // kink cand loop + } // collision loop + + // Loop over all generated particles to fill MC histograms for (const auto& mcPart : particlesMC) { - if (std::abs(mcPart.pdgCode()) != 3112 || std::abs(mcPart.y()) > 0.5) { + if (std::abs(mcPart.pdgCode()) != 3112 || std::abs(mcPart.y()) > cutEtaMotherMC) { // only sigma mothers and rapidity cut continue; } if (!mcPart.has_daughters()) { continue; // Skip if no daughters } bool hasSigmaDaughter = false; + int daug_pdg = 0; + std::array secVtx; + std::array momDaug; for (const auto& daughter : mcPart.daughters_as()) { - if (std::abs(daughter.pdgCode()) == 211) { // Sigma PDG code + if (std::abs(daughter.pdgCode()) == 211 || std::abs(daughter.pdgCode()) == 2212) { // Pi or proton daughter hasSigmaDaughter = true; - break; // Found a pi daughter, exit loop + secVtx = {daughter.vx(), daughter.vy(), daughter.vz()}; + momDaug = {daughter.px(), daughter.py(), daughter.pz()}; + daug_pdg = daughter.pdgCode(); + break; // Found a daughter, exit loop } } if (!hasSigmaDaughter) { - continue; // Skip if no pi daughter found + continue; // Skip if no pi/proton daughter found } float mcMass = std::sqrt(mcPart.e() * mcPart.e() - mcPart.p() * mcPart.p()); + float mcDecayRadius = std::sqrt((secVtx[0] - mcPart.vx()) * (secVtx[0] - mcPart.vx()) + (secVtx[1] - mcPart.vy()) * (secVtx[1] - mcPart.vy())); int sigmaSign = mcPart.pdgCode() > 0 ? 1 : -1; // Determine the sign of the Sigma rSigmaMinus.fill(HIST("h2MassPtMCGen"), sigmaSign * mcPart.pt(), mcMass); + + // Fill output table with non reconstructed MC candidates + if (fillOutputTree) { + outputDataTableMC(-999, -999, -999, + -999, -999, -999, + -999, -999, -999, + -999, -999, -999, + sigmaSign, + -999, -999, -999, + -999, -999, -999, + mcPart.pdgCode(), daug_pdg, + mcPart.pt(), mcMass, mcDecayRadius, false); + } } } + PROCESS_SWITCH(sigmaminustask, processMC, "MC processing", false); }; diff --git a/PWGLF/Tasks/Strangeness/CMakeLists.txt b/PWGLF/Tasks/Strangeness/CMakeLists.txt index 99908fd6661..5f88145c01d 100644 --- a/PWGLF/Tasks/Strangeness/CMakeLists.txt +++ b/PWGLF/Tasks/Strangeness/CMakeLists.txt @@ -29,11 +29,6 @@ o2physics_add_dpl_workflow(cascadeanalysis PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(sigmaminus-task - SOURCES sigmaminustask.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore - COMPONENT_NAME Analysis) - o2physics_add_dpl_workflow(cascadeanalysismc SOURCES cascadeanalysisMC.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore From bf4968286f3b0f2fdc022f1b101bfff1ecb9d00c Mon Sep 17 00:00:00 2001 From: Marvin Hemmer <53471402+mhemmer-cern@users.noreply.github.com> Date: Tue, 29 Jul 2025 08:00:25 +0200 Subject: [PATCH 117/345] [PWGEM,PWGEM-8] Clean up of PhotonMeson (#12296) --- PWGEM/PhotonMeson/Core/EMCPhotonCut.cxx | 10 +- PWGEM/PhotonMeson/Core/EMCPhotonCut.h | 31 ++- PWGEM/PhotonMeson/Core/HistogramsLibrary.cxx | 39 ++-- PWGEM/PhotonMeson/Core/HistogramsLibrary.h | 47 ++--- PWGEM/PhotonMeson/DataModel/gammaTables.h | 55 ++--- .../PhotonMeson/TableProducer/CMakeLists.txt | 10 - .../TableProducer/gammaSelection.cxx | 193 ------------------ .../TableProducer/produceMesonCalo.cxx | 151 -------------- .../TableProducer/skimmerGammaCalo.cxx | 11 +- PWGEM/PhotonMeson/Tasks/SinglePhoton.cxx | 62 +++--- PWGEM/PhotonMeson/Tasks/SinglePhotonMC.cxx | 67 +++--- PWGEM/PhotonMeson/Tasks/TagAndProbe.cxx | 111 +++++----- PWGEM/PhotonMeson/Tasks/emcalQC.cxx | 43 ++-- PWGEM/PhotonMeson/Utils/ClusterHistograms.h | 67 +++--- .../PhotonMeson/Utils/emcalHistoDefinitions.h | 4 +- PWGEM/PhotonMeson/Utils/gammaSelectionCuts.h | 165 --------------- 16 files changed, 278 insertions(+), 788 deletions(-) delete mode 100644 PWGEM/PhotonMeson/TableProducer/gammaSelection.cxx delete mode 100644 PWGEM/PhotonMeson/TableProducer/produceMesonCalo.cxx delete mode 100644 PWGEM/PhotonMeson/Utils/gammaSelectionCuts.h diff --git a/PWGEM/PhotonMeson/Core/EMCPhotonCut.cxx b/PWGEM/PhotonMeson/Core/EMCPhotonCut.cxx index 582b9754057..199da171c11 100644 --- a/PWGEM/PhotonMeson/Core/EMCPhotonCut.cxx +++ b/PWGEM/PhotonMeson/Core/EMCPhotonCut.cxx @@ -13,11 +13,17 @@ // Class for EMCal cluster selection // -#include -#include "Framework/Logger.h" #include "PWGEM/PhotonMeson/Core/EMCPhotonCut.h" + #include "PWGJE/DataModel/EMCALClusters.h" +#include "Framework/Logger.h" + +#include + +#include +#include + ClassImp(EMCPhotonCut); const char* EMCPhotonCut::mCutNames[static_cast(EMCPhotonCut::EMCPhotonCuts::kNCuts)] = {"Definition", "Energy", "NCell", "M02", "Timing", "TrackMatching", "Exotic"}; diff --git a/PWGEM/PhotonMeson/Core/EMCPhotonCut.h b/PWGEM/PhotonMeson/Core/EMCPhotonCut.h index 8bfd8ca630f..1e3ac74f6cd 100644 --- a/PWGEM/PhotonMeson/Core/EMCPhotonCut.h +++ b/PWGEM/PhotonMeson/Core/EMCPhotonCut.h @@ -9,22 +9,19 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -// -// Class for emcal photon selection -// +/// \file EMCPhotonCut.h +/// \brief Header of class for emcal photon selection. +/// \author M. Hemmer, marvin.hemmer@cern.ch; N. Strangmann, nicolas.strangmann@cern.ch #ifndef PWGEM_PHOTONMESON_CORE_EMCPHOTONCUT_H_ #define PWGEM_PHOTONMESON_CORE_EMCPHOTONCUT_H_ -#include -#include -#include +#include + +#include + +#include #include -#include -#include "Framework/Logger.h" -#include "Framework/DataTypes.h" -#include "Rtypes.h" -#include "TNamed.h" class EMCPhotonCut : public TNamed { @@ -95,14 +92,14 @@ class EMCPhotonCut : public TNamed return mMinTime <= cluster.time() && cluster.time() <= mMaxTime; case EMCPhotonCuts::kTM: { - auto trackseta = cluster.tracketa(); // std:vector - auto tracksphi = cluster.trackphi(); // std:vector - auto trackspt = cluster.trackpt(); // std:vector - auto tracksp = cluster.trackp(); // std:vector + auto dEtas = cluster.deltaEta(); // std:vector + auto dPhis = cluster.deltaPhi(); // std:vector + auto trackspt = cluster.trackpt(); // std:vector + auto tracksp = cluster.trackp(); // std:vector int ntrack = tracksp.size(); for (int itr = 0; itr < ntrack; itr++) { - float dEta = fabs(trackseta[itr] - cluster.eta()); - float dPhi = fabs(tracksphi[itr] - cluster.phi()); + float dEta = std::fabs(dEtas[itr]); + float dPhi = std::fabs(dPhis[itr]); bool result = (dEta > mTrackMatchingEta(trackspt[itr])) || (dPhi > mTrackMatchingPhi(trackspt[itr])) || (cluster.e() / tracksp[itr] >= mMinEoverP); if (!result) { return false; diff --git a/PWGEM/PhotonMeson/Core/HistogramsLibrary.cxx b/PWGEM/PhotonMeson/Core/HistogramsLibrary.cxx index 50174ab9e08..e54a462e9dc 100644 --- a/PWGEM/PhotonMeson/Core/HistogramsLibrary.cxx +++ b/PWGEM/PhotonMeson/Core/HistogramsLibrary.cxx @@ -9,28 +9,25 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. // -// Contact: daiki.sekihata@cern.ch -// -#include -#include -#include -using namespace std; +/// \file HistogramsLibrary.cxx +/// \brief Small histogram library for photon and meson analysis. +/// \author D. Sekihata, daiki.sekihata@cern.ch + +#include "PWGEM/PhotonMeson/Core/HistogramsLibrary.h" + +#include -#include -#include +#include +#include #include -#include -#include -#include -#include -#include -#include -#include #include -#include -#include -#include "Framework/Logger.h" -#include "PWGEM/PhotonMeson/Core/HistogramsLibrary.h" +#include + +#include + +#include + +using namespace std; void o2::aod::pwgem::photon::histogram::DefineHistograms(THashList* list, const char* histClass, const char* subGroup) { @@ -184,7 +181,7 @@ void o2::aod::pwgem::photon::histogram::DefineHistograms(THashList* list, const list->Add(new TH2F("hEtaRec_DeltaEta", "photon #eta resolution;#eta^{rec} of conversion point;#eta^{rec} - #eta^{gen}", 400, -2, +2, 400, -1.0f, 1.0f)); list->Add(new TH2F("hEtaRec_DeltaPhi", "photon #varphi resolution;#eta^{rec} of conversion point;#varphi^{rec} - #varphi^{gen} (rad.)", 400, -2, +2, 400, -1.0f, 1.0f)); } // end of mc - } // end of V0 + } // end of V0 if (TString(histClass).Contains("Dalitz")) { THnSparseF* hs_dilepton_uls_same = nullptr; @@ -576,7 +573,7 @@ void o2::aod::pwgem::photon::histogram::DefineHistograms(THashList* list, const hs_conv_point_mix->Sumw2(); list->Add(hs_conv_point_mix); } // end of pair - } // end of material budget study + } // end of material budget study if (TString(histClass) == "Generated") { list->Add(new TH1F("hCollisionCounter", "hCollisionCounter", 5, 0.5f, 5.5f)); diff --git a/PWGEM/PhotonMeson/Core/HistogramsLibrary.h b/PWGEM/PhotonMeson/Core/HistogramsLibrary.h index 324718a663e..368acef59ce 100644 --- a/PWGEM/PhotonMeson/Core/HistogramsLibrary.h +++ b/PWGEM/PhotonMeson/Core/HistogramsLibrary.h @@ -8,34 +8,25 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -// -// Contact: daiki.sekihata@cern.ch -// + +/// \file HistogramsLibrary.h +/// \brief Small histogram library for photon and meson analysis. +/// \author D. Sekihata, daiki.sekihata@cern.ch #ifndef PWGEM_PHOTONMESON_CORE_HISTOGRAMSLIBRARY_H_ #define PWGEM_PHOTONMESON_CORE_HISTOGRAMSLIBRARY_H_ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include "Common/CCDB/EventSelectionParams.h" #include "Common/Core/RecoDecay.h" +#include +#include +#include + +#include +#include +#include + enum EMHistType { kEvent = 0, kEvent_Cent = 1, @@ -48,6 +39,8 @@ enum EMHistType { kEMCCluster = 8, }; +const float maxZ = 10.f; + namespace o2::aod { namespace pwgem::photon::histogram @@ -81,7 +74,7 @@ void FillHistClass(THashList* list, const char* subGroup, T1 const& obj1 /*, con if (obj1.sel8()) { reinterpret_cast(list->FindObject("hCollisionCounter"))->Fill("sel8", 1.f); } - if (abs(obj1.posZ()) < 10.0) { + if (std::abs(obj1.posZ()) < maxZ) { reinterpret_cast(list->FindObject("hCollisionCounter"))->Fill("|Z_{vtx}| < 10 cm", 1.f); } @@ -176,9 +169,9 @@ void FillHistClass(THashList* list, const char* subGroup, T1 const& obj1 /*, con reinterpret_cast(list->FindObject("hQoverPt"))->Fill(obj1.sign() / obj1.pt()); reinterpret_cast(list->FindObject("hEtaPhi"))->Fill(obj1.phi(), obj1.eta()); reinterpret_cast(list->FindObject("hDCAxyz"))->Fill(obj1.dcaXY(), obj1.dcaZ()); - reinterpret_cast(list->FindObject("hDCAxyzSigma"))->Fill(obj1.dcaXY() / sqrt(obj1.cYY()), obj1.dcaZ() / sqrt(obj1.cZZ())); - reinterpret_cast(list->FindObject("hDCAxyRes_Pt"))->Fill(obj1.pt(), sqrt(obj1.cYY()) * 1e+4); // convert cm to um - reinterpret_cast(list->FindObject("hDCAzRes_Pt"))->Fill(obj1.pt(), sqrt(obj1.cZZ()) * 1e+4); // convert cm to um + reinterpret_cast(list->FindObject("hDCAxyzSigma"))->Fill(obj1.dcaXY() / std::sqrt(obj1.cYY()), obj1.dcaZ() / std::sqrt(obj1.cZZ())); + reinterpret_cast(list->FindObject("hDCAxyRes_Pt"))->Fill(obj1.pt(), std::sqrt(obj1.cYY()) * 1e+4); // convert cm to um + reinterpret_cast(list->FindObject("hDCAzRes_Pt"))->Fill(obj1.pt(), std::sqrt(obj1.cZZ()) * 1e+4); // convert cm to um reinterpret_cast(list->FindObject("hNclsITS"))->Fill(obj1.itsNCls()); reinterpret_cast(list->FindObject("hNclsTPC"))->Fill(obj1.tpcNClsFound()); reinterpret_cast(list->FindObject("hNcrTPC"))->Fill(obj1.tpcNClsCrossedRows()); @@ -225,8 +218,8 @@ void FillHistClass(THashList* list, const char* subGroup, T1 const& obj1 /*, con reinterpret_cast(list->FindObject("hPt"))->Fill(obj1.pt()); reinterpret_cast(list->FindObject("hE"))->Fill(obj1.e()); reinterpret_cast(list->FindObject("hEtaPhi"))->Fill(obj1.phi(), obj1.eta()); - for (size_t itrack = 0; itrack < obj1.tracketa().size(); itrack++) { // Fill TrackEtaPhi histogram with delta phi and delta eta of all tracks saved in the vectors in skimmerGammaCalo.cxx - reinterpret_cast(list->FindObject("hTrackEtaPhi"))->Fill(obj1.trackphi()[itrack] - obj1.phi(), obj1.tracketa()[itrack] - obj1.eta()); + for (size_t itrack = 0; itrack < obj1.deltaEta().size(); itrack++) { // Fill TrackEtaPhi histogram with delta phi and delta eta of all tracks saved in the vectors in skimmerGammaCalo.cxx + reinterpret_cast(list->FindObject("hTrackEtaPhi"))->Fill(obj1.deltaPhi()[itrack], obj1.deltaEta()[itrack]); } } } diff --git a/PWGEM/PhotonMeson/DataModel/gammaTables.h b/PWGEM/PhotonMeson/DataModel/gammaTables.h index 0abbc3bfe76..9418e3b9221 100644 --- a/PWGEM/PhotonMeson/DataModel/gammaTables.h +++ b/PWGEM/PhotonMeson/DataModel/gammaTables.h @@ -9,15 +9,21 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#include -#include +#include "PWGEM/Dilepton/DataModel/dileptonTables.h" #include "Common/Core/RecoDecay.h" #include "Common/DataModel/CaloClusters.h" +#include "Common/DataModel/PIDResponseTOF.h" +#include "Common/DataModel/PIDResponseTPC.h" +#include "Common/DataModel/TrackSelectionTables.h" -#include "PWGEM/Dilepton/DataModel/dileptonTables.h" +#include +#include -#include "PWGJE/DataModel/EMCALClusters.h" +#include +#include +#include +#include #ifndef PWGEM_PHOTONMESON_DATAMODEL_GAMMATABLES_H_ #define PWGEM_PHOTONMESON_DATAMODEL_GAMMATABLES_H_ @@ -462,16 +468,16 @@ DECLARE_SOA_COLUMN(Time, time, float); DECLARE_SOA_COLUMN(IsExotic, isExotic, bool); //! flag to mark cluster as exotic DECLARE_SOA_COLUMN(Definition, definition, int); //! cluster definition, see EMCALClusterDefinition.h DECLARE_SOA_ARRAY_INDEX_COLUMN(Track, track); //! TrackIds -DECLARE_SOA_COLUMN(TrackEta, tracketa, std::vector); //! eta values of the matched tracks -DECLARE_SOA_COLUMN(TrackPhi, trackphi, std::vector); //! phi values of the matched tracks +DECLARE_SOA_COLUMN(DeltaPhi, deltaPhi, std::vector); //! phi values of the matched tracks +DECLARE_SOA_COLUMN(DeltaEta, deltaEta, std::vector); //! eta values of the matched tracks DECLARE_SOA_COLUMN(TrackP, trackp, std::vector); //! momentum values of the matched tracks DECLARE_SOA_COLUMN(TrackPt, trackpt, std::vector); //! pt values of the matched tracks DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt, [](float e, float eta, float m = 0) -> float { return sqrt(e * e - m * m) / cosh(eta); }); //! cluster pt, mass to be given as argument when getter is called! } // namespace emccluster -DECLARE_SOA_TABLE(SkimEMCClusters, "AOD", "SKIMEMCCLUSTERS", //! table of skimmed EMCal clusters +DECLARE_SOA_TABLE(SkimEMCClusters, "AOD", "SKIMEMCCLUSTER", //! table of skimmed EMCal clusters o2::soa::Index<>, skimmedcluster::CollisionId, emccluster::Definition, skimmedcluster::E, skimmedcluster::Eta, skimmedcluster::Phi, - skimmedcluster::M02, skimmedcluster::NCells, skimmedcluster::Time, emccluster::IsExotic, emccluster::TrackEta, - emccluster::TrackPhi, emccluster::TrackP, emccluster::TrackPt, emccluster::Pt); + skimmedcluster::M02, skimmedcluster::NCells, skimmedcluster::Time, emccluster::IsExotic, emccluster::DeltaPhi, + emccluster::DeltaEta, emccluster::TrackP, emccluster::TrackPt, emccluster::Pt); using SkimEMCCluster = SkimEMCClusters::iterator; DECLARE_SOA_TABLE(EMCEMEventIds, "AOD", "EMCEMEVENTID", emccluster::EMEventId); // To be joined with SkimEMCClusters table at analysis level. @@ -523,42 +529,11 @@ namespace caloextra { DECLARE_SOA_INDEX_COLUMN_FULL(Cluster, cluster, int, SkimEMCClusters, ""); //! reference to the gamma in the skimmed EMCal table DECLARE_SOA_INDEX_COLUMN_FULL(Cell, cell, int, Calos, ""); //! reference to the gamma in the skimmed EMCal table -// DECLARE_SOA_INDEX_COLUMN(Track, track); //! TrackID -DECLARE_SOA_COLUMN(TrackEta, tracketa, float); //! eta of the matched track -DECLARE_SOA_COLUMN(TrackPhi, trackphi, float); //! phi of the matched track -DECLARE_SOA_COLUMN(TrackP, trackp, float); //! momentum of the matched track -DECLARE_SOA_COLUMN(TrackPt, trackpt, float); //! pt of the matched track } // namespace caloextra DECLARE_SOA_TABLE(SkimEMCCells, "AOD", "SKIMEMCCELLS", //! table of link between skimmed EMCal clusters and their cells o2::soa::Index<>, caloextra::ClusterId, caloextra::CellId); //! using SkimEMCCell = SkimEMCCells::iterator; - -DECLARE_SOA_TABLE(SkimEMCMTs, "AOD", "SKIMEMCMTS", //! table of link between skimmed EMCal clusters and their matched tracks - o2::soa::Index<>, caloextra::ClusterId, caloextra::TrackEta, - caloextra::TrackPhi, caloextra::TrackP, caloextra::TrackPt); -using SkimEMCMT = SkimEMCMTs::iterator; - -namespace gammareco -{ -DECLARE_SOA_COLUMN(Method, method, int); //! cut bit for PCM photon candidates -DECLARE_SOA_INDEX_COLUMN_FULL(SkimmedPCM, skimmedPCM, int, V0PhotonsKF, ""); //! reference to the gamma in the skimmed PCM table -DECLARE_SOA_INDEX_COLUMN_FULL(SkimmedPHOS, skimmedPHOS, int, PHOSClusters, ""); //! reference to the gamma in the skimmed PHOS table -DECLARE_SOA_INDEX_COLUMN_FULL(SkimmedEMC, skimmedEMC, int, SkimEMCClusters, ""); //! reference to the gamma in the skimmed EMCal table -DECLARE_SOA_COLUMN(PCMCutBit, pcmcutbit, uint64_t); //! cut bit for PCM photon candidates -DECLARE_SOA_COLUMN(PHOSCutBit, phoscutbit, uint64_t); //! cut bit for PHOS photon candidates -DECLARE_SOA_COLUMN(EMCCutBit, emccutbit, uint64_t); //! cut bit for EMCal photon candidates -} // namespace gammareco -DECLARE_SOA_TABLE(SkimGammas, "AOD", "SKIMGAMMAS", //! table of all gamma candidates (PCM, EMCal and PHOS) after cuts - o2::soa::Index<>, skimmedcluster::CollisionId, gammareco::Method, - skimmedcluster::E, skimmedcluster::Eta, skimmedcluster::Phi, - gammareco::SkimmedEMCId, gammareco::SkimmedPHOSId); -DECLARE_SOA_TABLE(SkimPCMCuts, "AOD", "SKIMPCMCUTS", //! table of link between skimmed PCM photon candidates and their cuts - o2::soa::Index<>, gammareco::SkimmedPCMId, gammareco::PCMCutBit); //! -DECLARE_SOA_TABLE(SkimPHOSCuts, "AOD", "SKIMPHOSCUTS", //! table of link between skimmed PHOS photon candidates and their cuts - o2::soa::Index<>, gammareco::SkimmedPHOSId, gammareco::PHOSCutBit); //! -DECLARE_SOA_TABLE(SkimEMCCuts, "AOD", "SKIMEMCCUTS", //! table of link between skimmed EMCal photon candidates and their cuts - o2::soa::Index<>, gammareco::SkimmedEMCId, gammareco::EMCCutBit); //! } // namespace o2::aod #endif // PWGEM_PHOTONMESON_DATAMODEL_GAMMATABLES_H_ diff --git a/PWGEM/PhotonMeson/TableProducer/CMakeLists.txt b/PWGEM/PhotonMeson/TableProducer/CMakeLists.txt index 511fb699611..a4cf2e6b566 100644 --- a/PWGEM/PhotonMeson/TableProducer/CMakeLists.txt +++ b/PWGEM/PhotonMeson/TableProducer/CMakeLists.txt @@ -63,13 +63,3 @@ o2physics_add_dpl_workflow(skimmer-dalitz-ee SOURCES skimmerDalitzEE.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) - -o2physics_add_dpl_workflow(gamma-table-producer - SOURCES gammaSelection.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore - COMPONENT_NAME Analysis) - -o2physics_add_dpl_workflow(produce-meson-calo - SOURCES produceMesonCalo.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore - COMPONENT_NAME Analysis) diff --git a/PWGEM/PhotonMeson/TableProducer/gammaSelection.cxx b/PWGEM/PhotonMeson/TableProducer/gammaSelection.cxx deleted file mode 100644 index 7a3708d480b..00000000000 --- a/PWGEM/PhotonMeson/TableProducer/gammaSelection.cxx +++ /dev/null @@ -1,193 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// \brief skim cluster information to write photon cluster table in AO2D.root -/// dependencies: skimmergammacalo, skimmergammaconversions, skimmer-phos -/// \author marvin.hemmer@cern.ch - -// TODO: add PCM table -#include - -#include "PWGEM/PhotonMeson/Utils/gammaSelectionCuts.h" - -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" - -// includes for the R recalculation -#include "DetectorsBase/GeometryManager.h" -#include "DataFormatsParameters/GRPObject.h" -#include "CCDB/BasicCCDBManager.h" - -#include "PWGEM/PhotonMeson/DataModel/gammaTables.h" -#include "PWGEM/PhotonMeson/Utils/emcalHistoDefinitions.h" - -using namespace o2; -using namespace o2::framework; -using namespace o2::framework::expressions; - -struct gammaSelection { - - uint64_t EMC_CutModeBit; - - Preslice perEMCClusterMT = o2::aod::caloextra::clusterId; - - Produces tableGammaReco; - Produces tableEMCCuts; - - // Configurable for filter/cuts - Configurable EMC_minTime{"EMC_minTime", -20., "Minimum cluster time for EMCal time cut"}; - Configurable EMC_maxTime{"EMC_maxTime", +25., "Maximum cluster time for EMCal time cut"}; - Configurable EMC_minM02{"EMC_minM02", 0.1, "Minimum M02 for EMCal M02 cut"}; - Configurable EMC_maxM02{"EMC_maxM02", 0.7, "Maximum M02 for EMCal M02 cut"}; - Configurable EMC_minE{"EMC_minE", 0.7, "Minimum cluster energy for EMCal energy cut"}; - Configurable EMC_minNCell{"EMC_minNCell", 1, "Minimum number of cells per cluster for EMCal NCell cut"}; - Configurable> EMC_TM_Eta{"EMC_TM_Eta", {0.01f, 4.07f, -2.5f}, "|eta| <= [0]+(pT+[1])^[2] for EMCal track matching"}; - Configurable> EMC_TM_Phi{"EMC_TM_Phi", {0.015f, 3.65f, -2.f}, "|phi| <= [0]+(pT+[1])^[2] for EMCal track matching"}; - Configurable EMC_Eoverp{"EMC_Eoverp", 1.75, "Minimum cluster energy over track momentum for EMCal track matching"}; - Configurable EMC_CutMode{"EMC_CutMode", "0", "Cut Mode that is run. Each bit is a different setting. The first bit will use the cuts from the configurables."}; - - Configurable PHOS_minTime{"PHOS_minTime", -30., "Minimum cluster time for PHOS time cut"}; - Configurable PHOS_maxTime{"PHOS_maxTime", +30., "Maximum cluster time for PHOS time cut"}; - Configurable PHOS_minM02{"PHOS_minM02", 0.1, "Minimum M02 for PHOS M02 cut"}; - Configurable PHOS_minE{"PHOS_minE", 0.3, "Minimum cluster energy for PHOS energy cut"}; - Configurable PHOS_minENCell{"PHOS_minENCell", 0.1, "Threshold cluster energy for switch for PHOS NCell and M02 cut"}; - Configurable PHOS_minNCell{"PHOS_minNCell", 1, "Minimum number of cells per cluster for PHOS NCell cut"}; - Configurable PHOS_TM_Eta{"PHOS_TM_Eta", 0.02f, "|eta| <= value for PHOS track matching"}; - Configurable PHOS_TM_Phi{"PHOS_TM_Phi", 0.08f, "|phi| <= value for PHOS track matching"}; - - Configurable PHOS_QA{"PHOS_QA", 0b0, "Flag to enable PHOS related QA plots. 1st bit for TM QA."}; - - HistogramRegistry EMCHistos{ - "EMCHistos", - {}, - OutputObjHandlingPolicy::QAObject, - true, - true}; - - HistogramRegistry PHOSHistos{ - "PHOSHistos", - {}, - OutputObjHandlingPolicy::QAObject, - true, - true}; - - void init(o2::framework::InitContext&) - { - EMC_CutModeBit = stoi(EMC_CutMode, 0, 2); - std::bitset<64> EMC_CutModeBitSet(EMC_CutModeBit); - // EMCal - EMCHistos.add("hClusterEIn", "hClusterEIn", gHistoSpec_clusterECuts); - EMCHistos.add("hClusterEOut", "hClusterEOut", gHistoSpec_clusterECuts); - auto hCaloCuts_EMC = EMCHistos.add("hCaloCuts_EMC", "hCaloCuts_EMC", kTH2I, {{7, -0.5, 6.5}, {64, -0.5, 63.5}}); - hCaloCuts_EMC->GetXaxis()->SetBinLabel(1, "in"); - hCaloCuts_EMC->GetXaxis()->SetBinLabel(2, "#it{t}_{cluster} cut"); - hCaloCuts_EMC->GetXaxis()->SetBinLabel(3, "#it{M}_{02} cut"); - hCaloCuts_EMC->GetXaxis()->SetBinLabel(4, "#it{E} cut"); - hCaloCuts_EMC->GetXaxis()->SetBinLabel(5, "#it{N}_{cell} cut"); - hCaloCuts_EMC->GetXaxis()->SetBinLabel(6, "TM"); - hCaloCuts_EMC->GetXaxis()->SetBinLabel(7, "out"); - - LOG(info) << "| ECMal cluster cut settings:"; - LOG(info) << "|\t Timing cut: " << EMC_minTime << " < t < " << EMC_maxTime; - LOG(info) << "|\t M02 cut: " << EMC_minM02 << " < M02 < " << EMC_maxM02; - LOG(info) << "|\t E_min cut: E_cluster > " << EMC_minE; - LOG(info) << "|\t N_cell cut: N_cell > " << EMC_minNCell; - LOG(info) << "|\t TM |eta|: |eta| <= " << EMC_TM_Eta->at(0) << " + (pT + " << EMC_TM_Eta->at(1) << ")^" << EMC_TM_Eta->at(2); - LOG(info) << "|\t TM |phi|: |phi| <= " << EMC_TM_Phi->at(0) << " + (pT + " << EMC_TM_Phi->at(1) << ")^" << EMC_TM_Phi->at(2); - LOG(info) << "|\t TM E/p: E/p < " << EMC_Eoverp; - LOG(info) << "|\t Cut bit is set to: " << EMC_CutModeBitSet << std::endl; - - gatherCutsEMC(EMC_minTime, EMC_maxTime, EMC_minM02, EMC_maxM02, EMC_minE, EMC_minNCell, EMC_TM_Eta, EMC_TM_Phi, EMC_Eoverp); - - // PHOS - PHOSHistos.add("hClusterEIn", "hClusterEIn", gHistoSpec_clusterECuts); - PHOSHistos.add("hClusterEOut", "hClusterEOut", gHistoSpec_clusterECuts); - auto hCaloCuts_PHOS = PHOSHistos.add("hCaloCuts_PHOS", "hCaloCuts_PHOS", kTH1I, {{7, -0.5, 6.5}}); - hCaloCuts_PHOS->GetXaxis()->SetBinLabel(1, "in"); - hCaloCuts_PHOS->GetXaxis()->SetBinLabel(2, "#it{t}_{cluster} cut"); - hCaloCuts_PHOS->GetXaxis()->SetBinLabel(3, "#it{M}_{02} cut"); - hCaloCuts_PHOS->GetXaxis()->SetBinLabel(4, "#it{E} cut"); - hCaloCuts_PHOS->GetXaxis()->SetBinLabel(5, "#it{N}_{cell} cut"); - hCaloCuts_PHOS->GetXaxis()->SetBinLabel(6, "TM"); - hCaloCuts_PHOS->GetXaxis()->SetBinLabel(7, "out"); - if (PHOS_QA & 0b1) { - PHOSHistos.add("clusterTM_dEtadPhi", "cluster trackmatching dEta/dPhi;d#it{#eta};d#it{#varphi} (rad)", kTH2F, {{100, -0.2, 0.2}, {100, -0.2, 0.2}}); // dEta dPhi map of matched tracks - } - - LOG(info) << "| PHOS cluster cut settings:"; - LOG(info) << "|\t Timing cut: " << PHOS_minTime << " < t < " << PHOS_maxTime; - LOG(info) << "|\t NCell cut: " << PHOS_minNCell << " <= NCell for E >= " << PHOS_minENCell; - LOG(info) << "|\t M02 cut: " << PHOS_minM02 << " < M02 for E >= " << PHOS_minENCell; - LOG(info) << "|\t E_min cut: E_cluster > " << PHOS_minE; - LOG(info) << "|\t TM |eta|: |eta| <= " << PHOS_TM_Eta; - LOG(info) << "|\t TM |phi|: |phi| <= " << PHOS_TM_Phi << std::endl; - } - - void processRec(aod::EMEvents const&, aod::SkimEMCClusters const& emcclusters, aod::SkimEMCMTs const& matchedtracks, aod::PHOSClusters const& phosclusters) - { - for (const auto& emccluster : emcclusters) { // loop of EMC clusters - uint64_t EMC_CutBit = doPhotonCutsEMC(EMC_CutModeBit, emccluster, matchedtracks, perEMCClusterMT, EMCHistos); - tableEMCCuts(emccluster.globalIndex(), EMC_CutBit); - } // end loop of EMC clusters - - for (const auto& phoscluster : phosclusters) { // loop over PHOS clusters - PHOSHistos.fill(HIST("hClusterEIn"), phoscluster.e(), 0); - PHOSHistos.fill(HIST("hCaloCuts_PHOS"), 0); - - if (phoscluster.time() > PHOS_maxTime || phoscluster.time() < PHOS_minTime) { - PHOSHistos.fill(HIST("hCaloCuts_PHOS"), 1); - continue; - } - if (!(phoscluster.e() >= PHOS_minENCell && phoscluster.m02() > PHOS_minM02)) { - PHOSHistos.fill(HIST("hCaloCuts_PHOS"), 2); - continue; - } - if (phoscluster.e() <= PHOS_minE) { - PHOSHistos.fill(HIST("hCaloCuts_PHOS"), 3); - continue; - } - if (!(phoscluster.e() >= PHOS_minENCell && phoscluster.nCells() > PHOS_minNCell)) { - PHOSHistos.fill(HIST("hCaloCuts_PHOS"), 4); - continue; - } - - // TODO: add track matching for PHOS when available! - // track matching - bool hasMatchedTrack_PHOS = false; - // double dEta_PHOS, dPhi_PHOS; - // // only consider closest match - // dEta_PHOS = phoscluster.tracketa() - phoscluster.eta(); - // dPhi_PHOS = phoscluster.trackphi() - phoscluster.phi(); - // if ((fabs(dEta_PHOS) < PHOS_TM_Eta) && (fabs(dPhi_PHOS) < PHOS_TM_Phi)) { - // hasMatchedTrack_PHOS = true; - // if (PHOS_QA & 0b1) { - // EMCHistos.fill(HIST("clusterTM_dEtadPhi"), dEta_PHOS, dPhi_PHOS); - // } - // } - if (hasMatchedTrack_PHOS) { - PHOSHistos.fill(HIST("hCaloCuts_PHOS"), 5); - } else { - PHOSHistos.fill(HIST("hClusterEOut"), phoscluster.e(), 0); - PHOSHistos.fill(HIST("hCaloCuts_PHOS"), 6); - tableGammaReco(phoscluster.collisionId(), 2, - phoscluster.e(), phoscluster.eta(), phoscluster.phi(), 0, phoscluster.globalIndex()); - } - } // end loop of PHOS clusters - } - PROCESS_SWITCH(gammaSelection, processRec, "process only reconstructed info", true); -}; - -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - WorkflowSpec workflow{adaptAnalysisTask(cfgc)}; - return workflow; -} diff --git a/PWGEM/PhotonMeson/TableProducer/produceMesonCalo.cxx b/PWGEM/PhotonMeson/TableProducer/produceMesonCalo.cxx deleted file mode 100644 index 7fd19416d3d..00000000000 --- a/PWGEM/PhotonMeson/TableProducer/produceMesonCalo.cxx +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// \brief perform calo photon analysis on calo photons from skimmergammacalo task -/// dependencies: skimmergammacalo -/// \author marvin.hemmer@cern.ch - -#include "PWGEM/PhotonMeson/DataModel/gammaTables.h" -#include "PWGEM/PhotonMeson/DataModel/mesonTables.h" - -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" - -// includes for the R recalculation -#include "DataFormatsParameters/GRPObject.h" -#include "DetectorsBase/GeometryManager.h" -#include "CCDB/BasicCCDBManager.h" - -using namespace o2; -using namespace o2::framework; -using namespace o2::framework::expressions; - -struct produceMesonCalo { - - Produces tableCaloMeson; - - HistogramRegistry spectra = { - "spectra", - {}, - OutputObjHandlingPolicy::AnalysisObject, - true, - true}; - - // Configurable for histograms - Configurable nBinsMinv{"nBinsMinv", 800, "N bins for minv axis"}; - Configurable minMinv{"minMinv", 0.0, "Minimum value for minv axis"}; - Configurable maxMinv{"maxMinv", 0.8, "Maximum value for minv axis"}; - Configurable nBinsPt{"nBinsPt", 180, "N bins for pT axis"}; - Configurable minPt{"minPt", 0., "Minimum value for pT axis"}; - Configurable maxPt{"maxPt", 60., "Maximum value for pT axis"}; - - void init(o2::framework::InitContext&) - { - std::vector ptBinning(nBinsPt, 0); - - for (int i = 0; i < nBinsPt; i++) { - if (i < 100) { - ptBinning.at(i) = 0.10 * i; - } else if (i < 140) { - ptBinning.at(i) = 10. + 0.25 * (i - 100); - } else if (i < 180) { - ptBinning.at(i) = 20. + 1.00 * (i - 140); - } else { - ptBinning.at(i) = maxPt; - } - } - - AxisSpec ptAxis = {ptBinning, "#it{p}_{T} (GeV/#it{c})"}; - AxisSpec minvAxis = {nBinsMinv, minMinv, maxMinv, - "#it{m}_{inv} (GeV/#it{c}^{2})"}; - AxisSpec etaAxis = {100, -0.8, 0.8, "#eta"}; - AxisSpec phiAxis = {360, 0, 2 * M_PI, "#varphi (rad)"}; - AxisSpec alphaAxis = {200, -1, +1, "#alpha"}; - AxisSpec oaAxis = {180, 0, M_PI, "#vartheta_{#gamma#gamma} (rad)"}; - - HistogramConfigSpec defaultPtMinvHist( - {HistType::kTH2F, {minvAxis, ptAxis}}); - - HistogramConfigSpec defaultEtaPhiHist( - {HistType::kTH2F, {etaAxis, phiAxis}}); - - HistogramConfigSpec defaultPtMotherPtGammaHist( - {HistType::kTH2F, {ptAxis, ptAxis}}); - - HistogramConfigSpec defaultPtAlpha( - {HistType::kTH2F, {ptAxis, alphaAxis}}); - - HistogramConfigSpec defaultPtOA( - {HistType::kTH2F, {ptAxis, oaAxis}}); - - spectra.add("SameEvent_Minv_Pt", "SameEvent_Minv_Pt", defaultPtMinvHist, true); - spectra.add("SameEvent_Eta_Phi", "SameEvent_Eta_Phi", defaultEtaPhiHist, true); - spectra.add("SameEvent_Pt_Alpha", "SameEvent_Pt_Alpha", defaultPtAlpha, true); - spectra.add("SameEvent_Pt_OA", "SameEvent_Pt_OA", defaultPtOA, true); - spectra.add("SameEvent_PtMother_PtGamma", "SameEvent_PtMother_PtGamma", defaultPtMotherPtGammaHist, true); - - spectra.add("Photon_Eta_Phi", "Photon_Eta_Phi", defaultEtaPhiHist, true); - } - - void - processRec(aod::Collision const&, - aod::SkimGammas const& skimgammas) - { - for (auto& [gamma0, gamma1] : // EMC-EMC - combinations(o2::soa::CombinationsStrictlyUpperIndexPolicy(skimgammas, - skimgammas))) { - float openingAngle = acos((cos(gamma0.phi() - gamma1.phi()) + - sinh(gamma0.eta()) * sinh(gamma1.eta())) / - (cosh(gamma0.eta()) * cosh(gamma1.eta()))); - float E = gamma0.e() + gamma1.e(); - float pt0 = gamma0.e() / cosh(gamma0.eta()); - float pt1 = gamma1.e() / cosh(gamma1.eta()); - float px = - pt0 * cos(gamma0.phi()) + pt1 * cos(gamma1.phi()); - float py = - pt0 * sin(gamma0.phi()) + pt1 * sin(gamma1.phi()); - float pz = - pt0 * sinh(gamma0.eta()) + pt1 * sinh(gamma1.eta()); - float alpha = (gamma0.e() - gamma1.e()) != 0. - ? (gamma0.e() - gamma1.e()) / (gamma0.e() + gamma1.e()) - : 0.; - float Pt = sqrt(pt0 * pt0 + pt1 * pt1 + - 2. * pt0 * pt1 * - cos(gamma0.phi() - gamma1.phi())); - float minv = - sqrt(2. * gamma0.e() * gamma1.e() * (1. - cos(openingAngle))); - float eta = asinh(pz / Pt); - float phi = atan2(py, px); - phi = (phi < 0) ? phi + 2. * M_PI : phi; - tableCaloMeson(gamma0.collisionId(), gamma0.globalIndex(), gamma1.globalIndex(), - openingAngle, px, py, pz, E, alpha, minv, eta, phi, - Pt); - spectra.get(HIST("SameEvent_Minv_Pt"))->Fill(minv, Pt); - spectra.get(HIST("SameEvent_Eta_Phi"))->Fill(eta, phi); - spectra.get(HIST("SameEvent_Pt_Alpha"))->Fill(Pt, alpha); - spectra.get(HIST("SameEvent_Pt_OA"))->Fill(Pt, openingAngle); - spectra.get(HIST("SameEvent_PtMother_PtGamma"))->Fill(Pt, pt0); - spectra.get(HIST("SameEvent_PtMother_PtGamma"))->Fill(Pt, pt1); - - spectra.get(HIST("Photon_Eta_Phi"))->Fill(gamma0.eta(), gamma0.phi()); - spectra.get(HIST("Photon_Eta_Phi"))->Fill(gamma1.eta(), gamma1.phi()); - } - } - PROCESS_SWITCH(produceMesonCalo, processRec, - "process only reconstructed info", true); -}; - -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - WorkflowSpec workflow{adaptAnalysisTask(cfgc)}; - return workflow; -} diff --git a/PWGEM/PhotonMeson/TableProducer/skimmerGammaCalo.cxx b/PWGEM/PhotonMeson/TableProducer/skimmerGammaCalo.cxx index f5dbdad1c28..0de9fee8f62 100644 --- a/PWGEM/PhotonMeson/TableProducer/skimmerGammaCalo.cxx +++ b/PWGEM/PhotonMeson/TableProducer/skimmerGammaCalo.cxx @@ -51,7 +51,6 @@ struct SkimmerGammaCalo { Produces tableGammaEMCReco; Produces tableEMCClusterMCLabels; Produces tableCellEMCReco; - Produces tableTrackEMCReco; // Configurable for filter/cuts Configurable minTime{"minTime", -200., "Minimum cluster time for time cut"}; @@ -155,21 +154,19 @@ struct SkimmerGammaCalo { vP.reserve(groupedMTs.size()); vPt.reserve(groupedMTs.size()); for (const auto& emcmatchedtrack : groupedMTs) { - if (std::abs(emccluster.eta() - emcmatchedtrack.track_as().trackEtaEmcal()) >= maxdEta || std::abs(emccluster.phi() - emcmatchedtrack.track_as().trackPhiEmcal()) >= maxdPhi) { + if (std::abs(emcmatchedtrack.deltaEta()) >= maxdEta || std::abs(emcmatchedtrack.deltaPhi()) >= maxdPhi) { continue; } historeg.fill(HIST("MTEtaPhi"), emccluster.eta() - emcmatchedtrack.track_as().trackEtaEmcal(), emccluster.phi() - emcmatchedtrack.track_as().trackPhiEmcal()); vTrackIds.emplace_back(emcmatchedtrack.trackId()); - vEta.emplace_back(emcmatchedtrack.track_as().trackEtaEmcal()); - vPhi.emplace_back(emcmatchedtrack.track_as().trackPhiEmcal()); + vEta.emplace_back(emcmatchedtrack.deltaEta()); + vPhi.emplace_back(emcmatchedtrack.deltaPhi()); vP.emplace_back(emcmatchedtrack.track_as().p()); vPt.emplace_back(emcmatchedtrack.track_as().pt()); - tableTrackEMCReco(emcmatchedtrack.emcalclusterId(), emcmatchedtrack.track_as().trackEtaEmcal(), emcmatchedtrack.track_as().trackPhiEmcal(), - emcmatchedtrack.track_as().p(), emcmatchedtrack.track_as().pt()); } tableGammaEMCReco(emccluster.collisionId(), emccluster.definition(), emccluster.energy(), emccluster.eta(), emccluster.phi(), emccluster.m02(), - emccluster.nCells(), emccluster.time(), emccluster.isExotic(), vEta, vPhi, vP, vPt); + emccluster.nCells(), emccluster.time(), emccluster.isExotic(), vPhi, vEta, vP, vPt); } } void processMC(soa::Join::iterator const& collision, soa::Join const& emcclusters, aod::McParticles const&) diff --git a/PWGEM/PhotonMeson/Tasks/SinglePhoton.cxx b/PWGEM/PhotonMeson/Tasks/SinglePhoton.cxx index 9c82fa7b09a..d00c2e9732f 100644 --- a/PWGEM/PhotonMeson/Tasks/SinglePhoton.cxx +++ b/PWGEM/PhotonMeson/Tasks/SinglePhoton.cxx @@ -14,29 +14,37 @@ // This code loops over photon candidate and fill histograms // Please write to: daiki.sekihata@cern.ch -#include -#include - -#include "TString.h" -#include "Math/Vector4D.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" -#include "ReconstructionDataFormats/Track.h" -#include "Common/Core/trackUtilities.h" -#include "Common/Core/TrackSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/Centrality.h" -#include "Common/DataModel/PIDResponse.h" -#include "Common/Core/RecoDecay.h" -#include "PWGEM/PhotonMeson/DataModel/gammaTables.h" -#include "PWGEM/PhotonMeson/Core/V0PhotonCut.h" -#include "PWGEM/PhotonMeson/Core/PHOSPhotonCut.h" -#include "PWGEM/PhotonMeson/Core/EMCPhotonCut.h" +#include "EMPhotonEventCut.h" + #include "PWGEM/PhotonMeson/Core/CutsLibrary.h" +#include "PWGEM/PhotonMeson/Core/EMCPhotonCut.h" #include "PWGEM/PhotonMeson/Core/HistogramsLibrary.h" +#include "PWGEM/PhotonMeson/Core/PHOSPhotonCut.h" +#include "PWGEM/PhotonMeson/Core/V0PhotonCut.h" +#include "PWGEM/PhotonMeson/DataModel/gammaTables.h" + +#include "Common/CCDB/TriggerAliases.h" +#include "Common/Core/RecoDecay.h" +#include "Common/DataModel/Centrality.h" + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include using namespace o2; using namespace o2::aod; @@ -266,8 +274,8 @@ struct SinglePhoton { return is_selected; } - template - void FillPhoton(TEvents const& collisions, TPhotons1 const& photons1, TPreslice1 const& perCollision1, TCuts1 const& cuts1, TV0Legs const&, TEMCMatchedTracks const&) + template + void FillPhoton(TEvents const& collisions, TPhotons1 const& photons1, TPreslice1 const& perCollision1, TCuts1 const& cuts1, TV0Legs const&) { THashList* list_ev_before = static_cast(fMainList->FindObject("Event")->FindObject(detnames[photontype].data())->FindObject(event_types[0].data())); THashList* list_ev_after = static_cast(fMainList->FindObject("Event")->FindObject(detnames[photontype].data())->FindObject(event_types[1].data())); @@ -339,17 +347,17 @@ struct SinglePhoton { void processPCM(MyCollisions const&, MyV0Photons const& v0photons, aod::V0Legs const& legs) { - FillPhoton(grouped_collisions, v0photons, perCollision, fPCMCuts, legs, nullptr); + FillPhoton(grouped_collisions, v0photons, perCollision, fPCMCuts, legs); } // void processPHOS(MyCollisions const& collisions, aod::PHOSClusters const& phosclusters) // { - // FillPhoton(grouped_collisions, phosclusters, perCollision_phos, fPHOSCuts, nullptr, nullptr); + // FillPhoton(grouped_collisions, phosclusters, perCollision_phos, fPHOSCuts, nullptr); // } - // void processEMC(MyCollisions const& collisions, aod::SkimEMCClusters const& emcclusters, aod::SkimEMCMTs const& emcmatchedtracks) + // void processEMC(MyCollisions const& collisions, aod::SkimEMCClusters const& emcclusters) // { - // FillPhoton(grouped_collisions, emcclusters, perCollision_emc, fEMCCuts, nullptr, emcmatchedtracks); + // FillPhoton(grouped_collisions, emcclusters, perCollision_emc, fEMCCuts, nullptr); // } void processDummy(MyCollisions::iterator const&) {} diff --git a/PWGEM/PhotonMeson/Tasks/SinglePhotonMC.cxx b/PWGEM/PhotonMeson/Tasks/SinglePhotonMC.cxx index ccb33db7f3a..dd09bc17c4a 100644 --- a/PWGEM/PhotonMeson/Tasks/SinglePhotonMC.cxx +++ b/PWGEM/PhotonMeson/Tasks/SinglePhotonMC.cxx @@ -14,32 +14,35 @@ // This code loops over photon candidate and fill histograms // Please write to: daiki.sekihata@cern.ch -#include -#include - -#include "TString.h" -#include "TMath.h" -#include "Math/Vector4D.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" -#include "ReconstructionDataFormats/Track.h" -#include "Common/Core/trackUtilities.h" -#include "Common/Core/TrackSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/Centrality.h" -#include "Common/DataModel/PIDResponse.h" -#include "Common/Core/RecoDecay.h" -#include "PWGEM/PhotonMeson/DataModel/gammaTables.h" -#include "PWGEM/PhotonMeson/Utils/MCUtilities.h" -#include "PWGEM/PhotonMeson/Core/V0PhotonCut.h" -#include "PWGEM/PhotonMeson/Core/PHOSPhotonCut.h" -#include "PWGEM/PhotonMeson/Core/EMCPhotonCut.h" +#include "EMPhotonEventCut.h" + +#include "PWGEM/Dilepton/Utils/MCUtilities.h" #include "PWGEM/PhotonMeson/Core/CutsLibrary.h" +#include "PWGEM/PhotonMeson/Core/EMCPhotonCut.h" #include "PWGEM/PhotonMeson/Core/HistogramsLibrary.h" -#include "PWGEM/Dilepton/Utils/MCUtilities.h" +#include "PWGEM/PhotonMeson/Core/PHOSPhotonCut.h" +#include "PWGEM/PhotonMeson/Core/V0PhotonCut.h" +#include "PWGEM/PhotonMeson/DataModel/gammaTables.h" +#include "PWGEM/PhotonMeson/Utils/MCUtilities.h" + +#include "Common/CCDB/TriggerAliases.h" +#include "Common/DataModel/Centrality.h" + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include using namespace o2; using namespace o2::aod; @@ -272,8 +275,8 @@ struct SinglePhotonMC { return is_selected; } - template - void FillTruePhoton(TEvents const& collisions, TPhotons1 const& photons1, TPreslice1 const& perCollision1, TCuts1 const& cuts1, TV0Legs const&, TEMCMatchedTracks const&, TMCParticles const& mcparticles, TMCEvents const&) + template + void FillTruePhoton(TEvents const& collisions, TPhotons1 const& photons1, TPreslice1 const& perCollision1, TCuts1 const& cuts1, TV0Legs const&, TMCParticles const& mcparticles, TMCEvents const&) { THashList* list_ev_before = static_cast(fMainList->FindObject("Event")->FindObject(detnames[photontype].data())->FindObject(event_types[0].data())); THashList* list_ev_after = static_cast(fMainList->FindObject("Event")->FindObject(detnames[photontype].data())->FindObject(event_types[1].data())); @@ -351,25 +354,25 @@ struct SinglePhotonMC { } } // end of photon loop - } // end of cut loop - } // end of collision loop + } // end of cut loop + } // end of collision loop } Partition grouped_collisions = (cfgCentMin < o2::aod::cent::centFT0M && o2::aod::cent::centFT0M < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0A && o2::aod::cent::centFT0A < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0C && o2::aod::cent::centFT0C < cfgCentMax); // this goes to same event. void processPCM(MyCollisions const&, MyV0Photons const& v0photons, MyMCV0Legs const& legs, aod::EMMCParticles const& mcparticles, aod::EMMCEvents const& mccollisions) { - FillTruePhoton(grouped_collisions, v0photons, perCollision, fPCMCuts, legs, nullptr, mcparticles, mccollisions); + FillTruePhoton(grouped_collisions, v0photons, perCollision, fPCMCuts, legs, mcparticles, mccollisions); } // void processPHOS(MyCollisions const& collisions, aod::PHOSClusters const& phosclusters, aod::EMMCParticles const& mcparticles, aod::EMMCEvents const& mccollisions) // { - // FillTruePhoton(grouped_collisions, phosclusters, perCollision_phos, fPHOSCuts, nullptr, nullptr, mcparticles, mccollisions); + // FillTruePhoton(grouped_collisions, phosclusters, perCollision_phos, fPHOSCuts, nullptr, mcparticles, mccollisions); // } - // void processEMC(MyCollisions const& collisions, aod::SkimEMCClusters const& emcclusters, aod::SkimEMCMTs const& emcmatchedtracks, aod::EMMCParticles const& mcparticles, aod::EMMCEvents const& mccollisions) + // void processEMC(MyCollisions const& collisions, aod::SkimEMCClusters const& emcclusters, aod::EMMCParticles const& mcparticles, aod::EMMCEvents const& mccollisions) // { - // FillTruePhoton(grouped_collisions, emcclusters, perCollision_emc, fEMCCuts, nullptr, emcmatchedtracks, mcparticles, mccollisions); + // FillTruePhoton(grouped_collisions, emcclusters, perCollision_emc, fEMCCuts, nullptr, mcparticles, mccollisions); // } PresliceUnsorted perMcCollision = aod::emmcparticle::emmceventId; diff --git a/PWGEM/PhotonMeson/Tasks/TagAndProbe.cxx b/PWGEM/PhotonMeson/Tasks/TagAndProbe.cxx index 2f91a62dc43..17989065391 100644 --- a/PWGEM/PhotonMeson/Tasks/TagAndProbe.cxx +++ b/PWGEM/PhotonMeson/Tasks/TagAndProbe.cxx @@ -14,28 +14,47 @@ // This code is for data-driven efficiency for photon analyses. tag and probe method // Please write to: daiki.sekihata@cern.ch -#include -#include - -#include "TString.h" -#include "Math/Vector4D.h" -#include "Math/Vector3D.h" -#include "Math/LorentzRotation.h" -#include "Math/Rotation3D.h" -#include "Math/AxisAngle.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" -#include "Common/Core/RecoDecay.h" -#include "PWGEM/PhotonMeson/DataModel/gammaTables.h" -#include "PWGEM/PhotonMeson/Utils/PairUtilities.h" -#include "PWGEM/PhotonMeson/Core/V0PhotonCut.h" -#include "PWGEM/PhotonMeson/Core/PHOSPhotonCut.h" -#include "PWGEM/PhotonMeson/Core/EMCPhotonCut.h" -#include "PWGEM/PhotonMeson/Core/PairCut.h" +#include "EMPhotonEventCut.h" + #include "PWGEM/PhotonMeson/Core/CutsLibrary.h" +#include "PWGEM/PhotonMeson/Core/EMCPhotonCut.h" #include "PWGEM/PhotonMeson/Core/HistogramsLibrary.h" +#include "PWGEM/PhotonMeson/Core/PHOSPhotonCut.h" +#include "PWGEM/PhotonMeson/Core/PairCut.h" +#include "PWGEM/PhotonMeson/Core/V0PhotonCut.h" +#include "PWGEM/PhotonMeson/DataModel/gammaTables.h" +#include "PWGEM/PhotonMeson/Utils/PairUtilities.h" + +#include "Common/CCDB/TriggerAliases.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include using namespace o2; using namespace o2::aod; @@ -126,7 +145,7 @@ struct TagAndProbe { THashList* list_pair_subsys_paircut = reinterpret_cast(list_pair_subsys_photoncut->FindObject(pair_cut_name.data())); o2::aod::pwgem::photon::histogram::DefineHistograms(list_pair_subsys_paircut, "tag_and_probe", pairname.data()); } // end of cut3 loop pair cut - } // end of cut2 loop + } // end of cut2 loop } static constexpr std::string_view pairnames[6] = {"PCMPCM", "PHOSPHOS", "EMCEMC", "PCMPHOS", "PCMEMC", "PHOSEMC"}; @@ -232,8 +251,8 @@ struct TagAndProbe { Preslice perCollision_phos = aod::skimmedcluster::collisionId; Preslice perCollision_emc = aod::skimmedcluster::collisionId; - template - void SameEventPairing(TEvents const& collisions, TPhotons1 const& photons1, TPhotons2 const& photons2, TPreslice1 const& perCollision1, TPreslice2 const& perCollision2, TTagCut const& tagcut, TProbeCuts const& probecuts, TPairCuts const& paircuts, TLegs const& /*legs*/, TEMCMTs const& emcmatchedtracks) + template + void SameEventPairing(TEvents const& collisions, TPhotons1 const& photons1, TPhotons2 const& photons2, TPreslice1 const& perCollision1, TPreslice2 const& perCollision2, TTagCut const& tagcut, TProbeCuts const& probecuts, TPairCuts const& paircuts, TLegs const& /*legs*/) { THashList* list_ev_pair_before = static_cast(fMainList->FindObject("Event")->FindObject(pairnames[pairtype].data())->FindObject(event_types[0].data())); THashList* list_ev_pair_after = static_cast(fMainList->FindObject("Event")->FindObject(pairnames[pairtype].data())->FindObject(event_types[1].data())); @@ -315,13 +334,13 @@ struct TagAndProbe { reinterpret_cast(list_pair_ss->FindObject(Form("%s_%s", tagcut.GetName(), probecut.GetName()))->FindObject(paircut.GetName())->FindObject("hMggPt_PassingProbe_Same"))->Fill(v12.M(), v2.Pt()); if constexpr (pairtype == PairType::kEMCEMC) { - RotationBackground(v12, v1, v2, photons2_coll, g1.globalIndex(), g2.globalIndex(), probecut, paircut, emcmatchedtracks); + RotationBackground(v12, v1, v2, photons2_coll, g1.globalIndex(), g2.globalIndex(), probecut, paircut); } } // end of probe cut loop - } // end of pair cut loop - } // end of g2 loop - } // end of g1 loop - } // end of collision loop + } // end of pair cut loop + } // end of g2 loop + } // end of g1 loop + } // end of collision loop } Configurable ndepth{"ndepth", 10, "depth for event mixing"}; @@ -334,8 +353,8 @@ struct TagAndProbe { BinningType_A colBinning_A{{ConfVtxBins, ConfCentBins}, true}; BinningType_C colBinning_C{{ConfVtxBins, ConfCentBins}, true}; - template - void MixedEventPairing(TEvents const& collisions, TPhotons1 const& photons1, TPhotons2 const& photons2, TPreslice1 const& perCollision1, TPreslice2 const& perCollision2, TTagCut const& tagcut, TProbeCuts const& probecuts, TPairCuts const& paircuts, TLegs const& /*legs*/, TEMCMTs const& /*emcmatchedtracks*/, TMixedBinning const& colBinning) + template + void MixedEventPairing(TEvents const& collisions, TPhotons1 const& photons1, TPhotons2 const& photons2, TPreslice1 const& perCollision1, TPreslice2 const& perCollision2, TTagCut const& tagcut, TProbeCuts const& probecuts, TPairCuts const& paircuts, TLegs const& /*legs*/, TMixedBinning const& colBinning) { THashList* list_pair_ss = static_cast(fMainList->FindObject("Pair")->FindObject(pairnames[pairtype].data())); @@ -406,15 +425,15 @@ struct TagAndProbe { reinterpret_cast(list_pair_ss->FindObject(Form("%s_%s", tagcut.GetName(), probecut.GetName()))->FindObject(paircut.GetName())->FindObject("hMggPt_PassingProbe_Mixed"))->Fill(v12.M(), v2.Pt()); } // end of probe cut loop - } // end of pair cut loop - } // end of g2 loop - } // end of g1 loop - } // end of different collision combinations + } // end of pair cut loop + } // end of g2 loop + } // end of g1 loop + } // end of different collision combinations } /// \brief Calculate background (using rotation background method only for EMCal!) template - void RotationBackground(const ROOT::Math::PtEtaPhiMVector& meson, ROOT::Math::PtEtaPhiMVector photon1, ROOT::Math::PtEtaPhiMVector photon2, TPhotons const& photons_coll, unsigned int ig1, unsigned int ig2, EMCPhotonCut const& cut, PairCut const& paircut, SkimEMCMTs const& /*emcmatchedtracks*/) + void RotationBackground(const ROOT::Math::PtEtaPhiMVector& meson, ROOT::Math::PtEtaPhiMVector photon1, ROOT::Math::PtEtaPhiMVector photon2, TPhotons const& photons_coll, unsigned int ig1, unsigned int ig2, EMCPhotonCut const& cut, PairCut const& paircut) { // if less than 3 clusters are present skip event since we need at least 3 clusters if (photons_coll.size() < 3) { @@ -442,7 +461,7 @@ struct TagAndProbe { // only combine rotated photons with other photons continue; } - if (!cut.template IsSelected(photon)) { + if (!cut.template IsSelected(photon)) { continue; } @@ -474,32 +493,32 @@ struct TagAndProbe { } Partition grouped_collisions = cfgCentMin < o2::aod::cent::centFT0M && o2::aod::cent::centFT0M < cfgCentMax; // this goes to same event. - Filter collisionFilter_common = nabs(o2::aod::collision::posZ) < 10.f && o2::aod::collision::numContrib > (uint16_t)0 && o2::aod::evsel::sel8 == true; + Filter collisionFilter_common = nabs(o2::aod::collision::posZ) < 10.f && o2::aod::collision::numContrib > static_cast(0) && o2::aod::evsel::sel8 == true; Filter collisionFilter_centrality = (cfgCentMin < o2::aod::cent::centFT0M && o2::aod::cent::centFT0M < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0A && o2::aod::cent::centFT0A < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0C && o2::aod::cent::centFT0C < cfgCentMax); using MyFilteredCollisions = soa::Filtered; // this goes to mixed event. void processPCMPCM(MyCollisions const&, MyFilteredCollisions const& filtered_collisions, MyV0Photons const& v0photons, aod::V0Legs const& legs) { - SameEventPairing(grouped_collisions, v0photons, v0photons, perCollision, perCollision, fTagPCMCut, fProbePCMCuts, fPairCuts, legs, nullptr); + SameEventPairing(grouped_collisions, v0photons, v0photons, perCollision, perCollision, fTagPCMCut, fProbePCMCuts, fPairCuts, legs); if (cfgCentEstimator == 0) { - MixedEventPairing(filtered_collisions, v0photons, v0photons, perCollision, perCollision, fTagPCMCut, fProbePCMCuts, fPairCuts, legs, nullptr, colBinning_M); + MixedEventPairing(filtered_collisions, v0photons, v0photons, perCollision, perCollision, fTagPCMCut, fProbePCMCuts, fPairCuts, legs, colBinning_M); } else if (cfgCentEstimator == 1) { - MixedEventPairing(filtered_collisions, v0photons, v0photons, perCollision, perCollision, fTagPCMCut, fProbePCMCuts, fPairCuts, legs, nullptr, colBinning_A); + MixedEventPairing(filtered_collisions, v0photons, v0photons, perCollision, perCollision, fTagPCMCut, fProbePCMCuts, fPairCuts, legs, colBinning_A); } else if (cfgCentEstimator == 2) { - MixedEventPairing(filtered_collisions, v0photons, v0photons, perCollision, perCollision, fTagPCMCut, fProbePCMCuts, fPairCuts, legs, nullptr, colBinning_C); + MixedEventPairing(filtered_collisions, v0photons, v0photons, perCollision, perCollision, fTagPCMCut, fProbePCMCuts, fPairCuts, legs, colBinning_C); } } void processPHOSPHOS(MyCollisions const&, MyFilteredCollisions const& filtered_collisions, aod::PHOSClusters const& phosclusters) { - SameEventPairing(grouped_collisions, phosclusters, phosclusters, perCollision_phos, perCollision_phos, fTagPHOSCut, fProbePHOSCuts, fPairCuts, nullptr, nullptr); - MixedEventPairing(filtered_collisions, phosclusters, phosclusters, perCollision_phos, perCollision_phos, fTagPHOSCut, fProbePHOSCuts, fPairCuts, nullptr, nullptr, colBinning_C); + SameEventPairing(grouped_collisions, phosclusters, phosclusters, perCollision_phos, perCollision_phos, fTagPHOSCut, fProbePHOSCuts, fPairCuts, nullptr); + MixedEventPairing(filtered_collisions, phosclusters, phosclusters, perCollision_phos, perCollision_phos, fTagPHOSCut, fProbePHOSCuts, fPairCuts, nullptr, colBinning_C); } - void processEMCEMC(MyCollisions const&, MyFilteredCollisions const& filtered_collisions, aod::SkimEMCClusters const& emcclusters, aod::SkimEMCMTs const& emcmatchedtracks) + void processEMCEMC(MyCollisions const&, MyFilteredCollisions const& filtered_collisions, aod::SkimEMCClusters const& emcclusters) { - SameEventPairing(grouped_collisions, emcclusters, emcclusters, perCollision_emc, perCollision_emc, fTagEMCCut, fProbeEMCCuts, fPairCuts, nullptr, emcmatchedtracks); - MixedEventPairing(filtered_collisions, emcclusters, emcclusters, perCollision_emc, perCollision_emc, fTagEMCCut, fProbeEMCCuts, fPairCuts, nullptr, emcmatchedtracks, colBinning_C); + SameEventPairing(grouped_collisions, emcclusters, emcclusters, perCollision_emc, perCollision_emc, fTagEMCCut, fProbeEMCCuts, fPairCuts, nullptr); + MixedEventPairing(filtered_collisions, emcclusters, emcclusters, perCollision_emc, perCollision_emc, fTagEMCCut, fProbeEMCCuts, fPairCuts, nullptr, colBinning_C); } void processDummy(MyCollisions const&) {} diff --git a/PWGEM/PhotonMeson/Tasks/emcalQC.cxx b/PWGEM/PhotonMeson/Tasks/emcalQC.cxx index 4173c26eccf..6f298546c30 100644 --- a/PWGEM/PhotonMeson/Tasks/emcalQC.cxx +++ b/PWGEM/PhotonMeson/Tasks/emcalQC.cxx @@ -18,28 +18,31 @@ /// \author Nicolas Strangmann (nicolas.strangmann@cern.ch) Goethe University Frankfurt /// -#include -#include -#include -#include "TString.h" -#include "THashList.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" -#include "ReconstructionDataFormats/Track.h" -#include "Common/Core/trackUtilities.h" -#include "Common/Core/TrackSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/Centrality.h" -#include "Common/DataModel/PIDResponse.h" -#include "Common/Core/RecoDecay.h" -#include "PWGEM/PhotonMeson/DataModel/gammaTables.h" +#include "EMPhotonEventCut.h" + #include "PWGEM/PhotonMeson/Core/EMCPhotonCut.h" -#include "PWGEM/PhotonMeson/Core/CutsLibrary.h" -#include "PWGEM/PhotonMeson/Utils/EventHistograms.h" +#include "PWGEM/PhotonMeson/DataModel/gammaTables.h" #include "PWGEM/PhotonMeson/Utils/ClusterHistograms.h" +#include "PWGEM/PhotonMeson/Utils/EventHistograms.h" + +#include "Common/CCDB/EventSelectionParams.h" +#include "Common/CCDB/TriggerAliases.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include using namespace o2; using namespace o2::aod; diff --git a/PWGEM/PhotonMeson/Utils/ClusterHistograms.h b/PWGEM/PhotonMeson/Utils/ClusterHistograms.h index bb1a641bbfe..b5f0eb6db85 100644 --- a/PWGEM/PhotonMeson/Utils/ClusterHistograms.h +++ b/PWGEM/PhotonMeson/Utils/ClusterHistograms.h @@ -9,40 +9,51 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// Header file for histograms used in EMC cluster QA -/// \author nicolas.strangmann@cern.ch +/// \file ClusterHistograms.h +/// \brief Header file for histograms used in EMC cluster QA +/// \author N. Strangmann, nicolas.strangmann@cern.ch #ifndef PWGEM_PHOTONMESON_UTILS_CLUSTERHISTOGRAMS_H_ #define PWGEM_PHOTONMESON_UTILS_CLUSTERHISTOGRAMS_H_ +#include +#include + +#include + +#include +#include + +#include + using namespace o2::framework; namespace o2::aod::pwgem::photonmeson::utils::clusterhistogram { -void addClusterHistograms(HistogramRegistry* fRegistry, bool do2DQA) +inline void addClusterHistograms(HistogramRegistry* fRegistry, bool do2DQA) { - fRegistry->add("Cluster/before/hE", "E_{cluster};#it{E}_{cluster} (GeV);#it{N}_{cluster}", kTH1F, {{500, 0.0f, 50}}, true); - fRegistry->add("Cluster/before/hPt", "Transverse momenta of clusters;#it{p}_{T} (GeV/c);#it{N}_{cluster}", kTH1F, {{500, 0.0f, 50}}, true); - fRegistry->add("Cluster/before/hNgamma", "Number of #gamma candidates per collision;#it{N}_{#gamma} per collision;#it{N}_{collisions}", kTH1F, {{51, -0.5f, 50.5f}}, true); - fRegistry->add("Cluster/before/hEtaPhi", "#eta vs #varphi;#eta;#varphi (rad.)", kTH2F, {{280, -0.7f, 0.7f}, {180, 0, 2 * M_PI}}, true); - fRegistry->add("Cluster/before/hNTracks", "Number of tracks considered for TM;#it{N}_{tracks};#it{N}_{cluster}", kTH1F, {{20, -0.5f, 19.5}}, true); - fRegistry->add("Cluster/before/hTrackdEtadPhi", "d#eta vs. d#varphi of matched tracks;d#eta;d#varphi (rad.)", kTH2F, {{200, -0.2f, 0.2f}, {200, -0.2f, 0.2f}}, true); + fRegistry->add("Cluster/before/hE", "E_{cluster};#it{E}_{cluster} (GeV);#it{N}_{cluster}", o2::framework::kTH1F, {{500, 0.0f, 50}}, true); + fRegistry->add("Cluster/before/hPt", "Transverse momenta of clusters;#it{p}_{T} (GeV/c);#it{N}_{cluster}", o2::framework::kTH1F, {{500, 0.0f, 50}}, true); + fRegistry->add("Cluster/before/hNgamma", "Number of #gamma candidates per collision;#it{N}_{#gamma} per collision;#it{N}_{collisions}", o2::framework::kTH1F, {{51, -0.5f, 50.5f}}, true); + fRegistry->add("Cluster/before/hEtaPhi", "#eta vs #varphi;#eta;#varphi (rad.)", o2::framework::kTH2F, {{280, -0.7f, 0.7f}, {180, 0, 2 * M_PI}}, true); + fRegistry->add("Cluster/before/hNTracks", "Number of tracks considered for TM;#it{N}_{tracks};#it{N}_{cluster}", o2::framework::kTH1F, {{20, -0.5f, 19.5}}, true); + fRegistry->add("Cluster/before/hTrackdEtadPhi", "d#eta vs. d#varphi of matched tracks;d#eta;d#varphi (rad.)", o2::framework::kTH2F, {{200, -0.2f, 0.2f}, {200, -0.2f, 0.2f}}, true); if (do2DQA) { // Check if 2D QA histograms were selected in em-qc task - fRegistry->add("Cluster/before/hNCell", "#it{N}_{cells};N_{cells} (GeV);#it{E}_{cluster} (GeV)", kTH2F, {{26, -0.5, 25.5}, {200, 0, 20}}, true); - fRegistry->add("Cluster/before/hM02", "Long ellipse axis;#it{M}_{02} (cm);#it{E}_{cluster} (GeV)", kTH2F, {{200, 0, 2}, {200, 0, 20}}, true); - fRegistry->add("Cluster/before/hTime", "Cluster time;#it{t}_{cls} (ns);#it{E}_{cluster} (GeV)", kTH2F, {{300, -150, 150}, {200, 0, 20}}, true); - fRegistry->add("Cluster/before/hTrackdEta", "d#eta vs. E of matched tracks;d#eta;#it{E}_{cluster} (GeV)", kTH2F, {{200, -0.2f, 0.2f}, {200, 0, 20}}, true); - fRegistry->add("Cluster/before/hTrackdPhi", "d#phi vs. E of matched tracks;d#varphi (rad.);#it{E}_{cluster} (GeV)", kTH2F, {{200, -0.2f, 0.2f}, {200, 0, 20}}, true); - fRegistry->add("Cluster/before/hTrackEOverP", "Energy of cluster divided by momentum of matched tracks;#it{E}_{cluster}/#it{p}_{track} (#it{c});#it{E}_{cluster} (GeV)", kTH2F, {{200, 0., 5.}, {200, 0, 20}}, true); + fRegistry->add("Cluster/before/hNCell", "#it{N}_{cells};N_{cells} (GeV);#it{E}_{cluster} (GeV)", o2::framework::kTH2F, {{26, -0.5, 25.5}, {200, 0, 20}}, true); + fRegistry->add("Cluster/before/hM02", "Long ellipse axis;#it{M}_{02} (cm);#it{E}_{cluster} (GeV)", o2::framework::kTH2F, {{200, 0, 2}, {200, 0, 20}}, true); + fRegistry->add("Cluster/before/hTime", "Cluster time;#it{t}_{cls} (ns);#it{E}_{cluster} (GeV)", o2::framework::kTH2F, {{300, -150, 150}, {200, 0, 20}}, true); + fRegistry->add("Cluster/before/hTrackdEta", "d#eta vs. E of matched tracks;d#eta;#it{E}_{cluster} (GeV)", o2::framework::kTH2F, {{200, -0.2f, 0.2f}, {200, 0, 20}}, true); + fRegistry->add("Cluster/before/hTrackdPhi", "d#phi vs. E of matched tracks;d#varphi (rad.);#it{E}_{cluster} (GeV)", o2::framework::kTH2F, {{200, -0.2f, 0.2f}, {200, 0, 20}}, true); + fRegistry->add("Cluster/before/hTrackEOverP", "Energy of cluster divided by momentum of matched tracks;#it{E}_{cluster}/#it{p}_{track} (#it{c});#it{E}_{cluster} (GeV)", o2::framework::kTH2F, {{200, 0., 5.}, {200, 0, 20}}, true); } else { - fRegistry->add("Cluster/before/hNCell", "#it{N}_{cells};N_{cells} (GeV);#it{N}_{cluster}", kTH1F, {{26, -0.5, 25.5}}, true); - fRegistry->add("Cluster/before/hM02", "Long ellipse axis;#it{M}_{02} (cm);#it{N}_{cluster}", kTH1F, {{400, 0, 2}}, true); - fRegistry->add("Cluster/before/hTime", "Cluster time;#it{t}_{cls} (ns);#it{N}_{cluster}", kTH1F, {{600, -150, 150}}, true); - fRegistry->add("Cluster/before/hTrackEOverP", "Energy of cluster divided by momentum of matched tracks;#it{E}_{cluster}/#it{p}_{track} (#it{c})", kTH1F, {{200, 0., 5.}}, true); + fRegistry->add("Cluster/before/hNCell", "#it{N}_{cells};N_{cells} (GeV);#it{N}_{cluster}", o2::framework::kTH1F, {{26, -0.5, 25.5}}, true); + fRegistry->add("Cluster/before/hM02", "Long ellipse axis;#it{M}_{02} (cm);#it{N}_{cluster}", o2::framework::kTH1F, {{400, 0, 2}}, true); + fRegistry->add("Cluster/before/hTime", "Cluster time;#it{t}_{cls} (ns);#it{N}_{cluster}", o2::framework::kTH1F, {{600, -150, 150}}, true); + fRegistry->add("Cluster/before/hTrackEOverP", "Energy of cluster divided by momentum of matched tracks;#it{E}_{cluster}/#it{p}_{track} (#it{c})", o2::framework::kTH1F, {{200, 0., 5.}}, true); } - auto hClusterQualityCuts = fRegistry->add("Cluster/hClusterQualityCuts", "Energy at which clusters are removed by a given cut;;#it{E} (GeV)", kTH2F, {{8, -0.5, 7.5}, {500, 0, 50}}, true); + auto hClusterQualityCuts = fRegistry->add("Cluster/hClusterQualityCuts", "Energy at which clusters are removed by a given cut;;#it{E} (GeV)", o2::framework::kTH2F, {{8, -0.5, 7.5}, {500, 0, 50}}, true); hClusterQualityCuts->GetXaxis()->SetBinLabel(1, "In"); hClusterQualityCuts->GetXaxis()->SetBinLabel(2, "Energy"); hClusterQualityCuts->GetXaxis()->SetBinLabel(3, "NCell"); @@ -56,30 +67,30 @@ void addClusterHistograms(HistogramRegistry* fRegistry, bool do2DQA) } template -void fillClusterHistograms(HistogramRegistry* fRegistry, TCluster cluster, bool do2DQA, float weight = 1.f) +inline void fillClusterHistograms(HistogramRegistry* fRegistry, TCluster cluster, bool do2DQA, float weight = 1.f) { static constexpr std::string_view cluster_types[2] = {"before/", "after/"}; fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hE"), cluster.e(), weight); fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hPt"), cluster.pt(), weight); fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hEtaPhi"), cluster.eta(), cluster.phi(), weight); - fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hNTracks"), cluster.tracketa().size(), weight); - for (size_t itrack = 0; itrack < cluster.tracketa().size(); itrack++) { // Fill TrackEtaPhi histogram with delta phi and delta eta of all tracks saved in the vectors in skimmerGammaCalo.cxx - fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hTrackdEtadPhi"), cluster.tracketa()[itrack] - cluster.eta(), cluster.trackphi()[itrack] - cluster.phi(), weight); + fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hNTracks"), cluster.deltaEta().size(), weight); + for (size_t itrack = 0; itrack < cluster.deltaEta().size(); itrack++) { // Fill TrackEtaPhi histogram with delta phi and delta eta of all tracks saved in the vectors in skimmerGammaCalo.cxx + fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hTrackdEtadPhi"), cluster.deltaEta()[itrack], cluster.deltaPhi()[itrack], weight); } if (do2DQA) { fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hNCell"), cluster.nCells(), cluster.e(), weight); fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hM02"), cluster.m02(), cluster.e(), weight); fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hTime"), cluster.time(), cluster.e(), weight); - for (size_t itrack = 0; itrack < cluster.tracketa().size(); itrack++) { + for (size_t itrack = 0; itrack < cluster.deltaEta().size(); itrack++) { fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hTrackEOverP"), cluster.e() / cluster.trackp()[itrack], cluster.e(), weight); - fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hTrackdEta"), cluster.tracketa()[itrack] - cluster.eta(), cluster.e(), weight); - fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hTrackdPhi"), cluster.trackphi()[itrack] - cluster.phi(), cluster.e(), weight); + fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hTrackdEta"), cluster.deltaEta()[itrack], cluster.e(), weight); + fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hTrackdPhi"), cluster.deltaPhi()[itrack], cluster.e(), weight); } } else { fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hNCell"), cluster.nCells(), weight); fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hM02"), cluster.m02(), weight); fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hTime"), cluster.time(), weight); - for (size_t itrack = 0; itrack < cluster.tracketa().size(); itrack++) { + for (size_t itrack = 0; itrack < cluster.deltaEta().size(); itrack++) { fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hTrackEOverP"), cluster.e() / cluster.trackp()[itrack], weight); } } diff --git a/PWGEM/PhotonMeson/Utils/emcalHistoDefinitions.h b/PWGEM/PhotonMeson/Utils/emcalHistoDefinitions.h index 6ce678e9c35..f3eac77ca04 100644 --- a/PWGEM/PhotonMeson/Utils/emcalHistoDefinitions.h +++ b/PWGEM/PhotonMeson/Utils/emcalHistoDefinitions.h @@ -12,9 +12,9 @@ /// \brief commonly used histogram (axis) definitions for emcal in PWGEM /// \author marvin.hemmer@cern.ch -#include +#include -#include "Framework/AnalysisTask.h" +#include #ifndef PWGEM_PHOTONMESON_UTILS_EMCALHISTODEFINITIONS_H_ #define PWGEM_PHOTONMESON_UTILS_EMCALHISTODEFINITIONS_H_ diff --git a/PWGEM/PhotonMeson/Utils/gammaSelectionCuts.h b/PWGEM/PhotonMeson/Utils/gammaSelectionCuts.h deleted file mode 100644 index 341a6c95e38..00000000000 --- a/PWGEM/PhotonMeson/Utils/gammaSelectionCuts.h +++ /dev/null @@ -1,165 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// \brief cut selection and cut functions for photon candidates -/// \author marvin.hemmer@cern.ch - -#include - -#include "Framework/AnalysisTask.h" -#include "PWGEM/PhotonMeson/DataModel/gammaTables.h" - -#ifndef PWGEM_PHOTONMESON_UTILS_GAMMASELECTIONCUTS_H_ -#define PWGEM_PHOTONMESON_UTILS_GAMMASELECTIONCUTS_H_ - -using namespace o2; -using namespace o2::framework; -using namespace o2::framework::expressions; -namespace emccuts -{ -// set the standard cuts -std::vector EMC_minTime = {-20.f}; -std::vector EMC_maxTime = {+25.f}; -std::vector EMC_minM02 = {0.1f}; -std::vector EMC_maxM02 = {0.7f}; -std::vector EMC_minE = {0.7f}; -std::vector EMC_minNCell = {1}; -std::vector> EMC_TM_Eta = {{0.01f, 4.07f, -2.5f}}; -std::vector> EMC_TM_Phi = {{0.015f, 3.65f, -2.f}}; -std::vector EMC_Eoverp = {1.75f}; -} // namespace emccuts -void gatherCutsEMC(float minTime, float maxTime, float minM02, float maxM02, float minE, int minNCell, std::vector TM_Eta, std::vector TM_Phi, float Eoverp) -{ - // insert the configurable values in first position - emccuts::EMC_minTime.insert(emccuts::EMC_minTime.begin(), minTime); - emccuts::EMC_maxTime.insert(emccuts::EMC_maxTime.begin(), maxTime); - emccuts::EMC_minM02.insert(emccuts::EMC_minM02.begin(), minM02); - emccuts::EMC_maxM02.insert(emccuts::EMC_maxM02.begin(), maxM02); - emccuts::EMC_minE.insert(emccuts::EMC_minE.begin(), minE); - emccuts::EMC_minNCell.insert(emccuts::EMC_minNCell.begin(), minNCell); - emccuts::EMC_TM_Eta.insert(emccuts::EMC_TM_Eta.begin(), TM_Eta); - emccuts::EMC_TM_Phi.insert(emccuts::EMC_TM_Phi.begin(), TM_Phi); - emccuts::EMC_Eoverp.insert(emccuts::EMC_Eoverp.begin(), Eoverp); - - // fill up the rest of the vectors to size 64 to ensure no crashes can happen - emccuts::EMC_minTime.resize(64, 0); - emccuts::EMC_maxTime.resize(64, 0); - emccuts::EMC_minM02.resize(64, 0); - emccuts::EMC_maxM02.resize(64, 0); - emccuts::EMC_minE.resize(64, 0); - emccuts::EMC_minNCell.resize(64, 0); - emccuts::EMC_TM_Eta.resize(64, {0, 0, 0}); - emccuts::EMC_TM_Phi.resize(64, {0, 0, 0}); - emccuts::EMC_Eoverp.resize(64, 0); -} - -uint64_t doTimeCutEMC(int iCut, uint64_t cutbit, aod::SkimEMCCluster const& cluster, HistogramRegistry& registry) -{ - uint64_t cut_return = 0; - if (cutbit & ((uint64_t)1 << (uint64_t)iCut)) { // check if current cut should be applied - if (cluster.time() <= emccuts::EMC_maxTime.at(iCut) && cluster.time() >= emccuts::EMC_minTime.at(iCut)) { // check cut itself - cut_return |= (1 << iCut); // set bit of current cut to 1 for passing the cut - } else { - registry.fill(HIST("hCaloCuts_EMC"), 1, iCut); - } - } - return cut_return; -} - -uint64_t doM02CutEMC(int iCut, uint64_t cutbit, aod::SkimEMCCluster const& cluster, HistogramRegistry& registry) -{ - uint64_t cut_return = 0; - if (cutbit & ((uint64_t)1 << (uint64_t)iCut)) { // check if current cut should be applied - if (cluster.m02() <= emccuts::EMC_maxM02.at(iCut) && cluster.m02() >= emccuts::EMC_minM02.at(iCut)) { // check cut itself - cut_return |= (1 << iCut); // set bit of current cut to 1 for passing the cut - } else { - registry.fill(HIST("hCaloCuts_EMC"), 2, iCut); - } - } - return cut_return; -} - -uint64_t doMinECutEMC(int iCut, uint64_t cutbit, aod::SkimEMCCluster const& cluster, HistogramRegistry& registry) -{ - uint64_t cut_return = 0; - if (cutbit & ((uint64_t)1 << (uint64_t)iCut)) { // check if current cut should be applied - if (cluster.e() > emccuts::EMC_minE.at(iCut)) { // check cut itself - cut_return |= (1 << iCut); // set bit of current cut to 1 for passing the cut - } else { - registry.fill(HIST("hCaloCuts_EMC"), 3, iCut); - } - } - return cut_return; -} - -uint64_t doNCellCutEMC(int iCut, uint64_t cutbit, aod::SkimEMCCluster const& cluster, HistogramRegistry& registry) -{ - uint64_t cut_return = 0; - if (cutbit & ((uint64_t)1 << (uint64_t)iCut)) { // check if current cut should be applied - if (cluster.nCells() >= emccuts::EMC_minNCell.at(iCut)) { // check cut itself - cut_return |= (1 << iCut); // set bit of current cut to 1 for passing the cut - } else { - registry.fill(HIST("hCaloCuts_EMC"), 4, iCut); - } - } - return cut_return; -} - -uint64_t doTrackMatchingEMC(int iCut, uint64_t cutbit, aod::SkimEMCCluster const& cluster, aod::SkimEMCMTs const& tracks, HistogramRegistry& registry) -{ - uint64_t cut_return = 0; - double dEta, dPhi; - if (cutbit & ((uint64_t)1 << (uint64_t)iCut)) { // check if current cut should be applied - bool hasMatchedTrack_EMC = false; - for (const auto& track : tracks) { - dEta = track.tracketa() - cluster.eta(); - dPhi = track.trackphi() - cluster.phi(); - if ((fabs(dEta) <= emccuts::EMC_TM_Eta.at(iCut).at(0) + pow(track.trackpt() + emccuts::EMC_TM_Eta.at(iCut).at(1), emccuts::EMC_TM_Eta.at(iCut).at(2))) && - (fabs(dPhi) <= emccuts::EMC_TM_Phi.at(iCut).at(0) + pow(track.trackpt() + emccuts::EMC_TM_Phi.at(iCut).at(1), emccuts::EMC_TM_Phi.at(iCut).at(2))) && - cluster.e() / track.trackp() < emccuts::EMC_Eoverp.at(iCut)) { // check cut itself - hasMatchedTrack_EMC = true; // set bit of current cut to 1 for passing the cut - } - } - if (hasMatchedTrack_EMC) { - registry.fill(HIST("hCaloCuts_EMC"), 5, iCut); - } else { - cut_return |= (1 << iCut); - } - } - return cut_return; -} - -uint64_t doPhotonCutsEMC(uint64_t cutbit, aod::SkimEMCCluster const& cluster, aod::SkimEMCMTs const& tracks, Preslice perEMCClusterMT, HistogramRegistry& registry) -{ - uint64_t cut_return = 0; - auto tracksMatchedEMC = tracks.sliceBy(perEMCClusterMT, cluster.globalIndex()); - for (int iCut = 0; iCut < 64; iCut++) { // loop over max number of cut settings - if (cutbit & ((uint64_t)1 << (uint64_t)iCut)) { // check each cut setting if it is selected - registry.fill(HIST("hClusterEIn"), cluster.e(), iCut); - cut_return = doTimeCutEMC(iCut, cutbit, cluster, registry); - // use cut_return instead of cutbit from here on to only check cut settings that we want to look at - // where the cluster did not fail in the previous cut(s) - cut_return = doM02CutEMC(iCut, cut_return, cluster, registry); - cut_return = doMinECutEMC(iCut, cut_return, cluster, registry); - cut_return = doNCellCutEMC(iCut, cut_return, cluster, registry); - cut_return = doTrackMatchingEMC(iCut, cut_return, cluster, tracksMatchedEMC, registry); - - registry.fill(HIST("hCaloCuts_EMC"), 0, iCut); - if (cut_return & ((uint64_t)1 << (uint64_t)iCut)) { - registry.fill(HIST("hClusterEOut"), cluster.e(), iCut); - registry.fill(HIST("hCaloCuts_EMC"), 6, iCut); - } - } - } - return cut_return; -} - -#endif // PWGEM_PHOTONMESON_UTILS_GAMMASELECTIONCUTS_H_ From 8c46b7cf152c6d5c4e6f74fa6c16cd9b7f5ef0d0 Mon Sep 17 00:00:00 2001 From: Zhiyong <71517277+Luzhiyongg@users.noreply.github.com> Date: Tue, 29 Jul 2025 10:52:25 +0200 Subject: [PATCH 118/345] [PWGCF] add cuts for MC and data (#12289) --- PWGCF/Flow/Tasks/flowMc.cxx | 38 ++++++++++++++- PWGCF/Flow/Tasks/flowTask.cxx | 87 +++++++++++++++++++++-------------- 2 files changed, 89 insertions(+), 36 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowMc.cxx b/PWGCF/Flow/Tasks/flowMc.cxx index 682eeece738..5884fa0e127 100644 --- a/PWGCF/Flow/Tasks/flowMc.cxx +++ b/PWGCF/Flow/Tasks/flowMc.cxx @@ -67,6 +67,13 @@ struct FlowMc { O2_DEFINE_CONFIGURABLE(cfgCutITSclu, float, 5.0f, "minimum ITS clusters") O2_DEFINE_CONFIGURABLE(cfgCutChi2prTPCcls, float, 2.5f, "max chi2 per TPC clusters") O2_DEFINE_CONFIGURABLE(cfgCutTPCcrossedrows, float, 70.0f, "minimum TPC crossed rows") + O2_DEFINE_CONFIGURABLE(cfgCutDCAxy, float, 0.2f, "DCAxy cut for tracks") + O2_DEFINE_CONFIGURABLE(cfgDCAxyNSigma, float, 7, "Cut on number of sigma deviations from expected DCA in the transverse direction"); + O2_DEFINE_CONFIGURABLE(cfgDCAxyFunction, std::string, "(0.0015+0.005/(x^1.1))", "Functional form of pt-dependent DCAxy cut"); + O2_DEFINE_CONFIGURABLE(cfgCutDCAz, float, 2.0f, "DCAz cut for tracks") + O2_DEFINE_CONFIGURABLE(cfgCutDCAzPtDepEnabled, bool, false, "switch of DCAz pt dependent cut") + O2_DEFINE_CONFIGURABLE(cfgEnableITSCuts, bool, true, "switch of enabling ITS based track selection cuts") + O2_DEFINE_CONFIGURABLE(cfgTrkSelRun3ITSMatch, bool, false, "GlobalTrackRun3ITSMatching::Run3ITSall7Layers selection") O2_DEFINE_CONFIGURABLE(cfgFlowAcceptance, std::string, "", "CCDB path to acceptance object") O2_DEFINE_CONFIGURABLE(cfgFlowEfficiency, std::string, "", "CCDB path to efficiency object") O2_DEFINE_CONFIGURABLE(cfgCentVsIPTruth, std::string, "", "CCDB path to centrality vs IP truth") @@ -103,6 +110,10 @@ struct FlowMc { // using FilteredTracks = soa::Join; + // Additional filters for tracks + TrackSelection myTrackSel; + TF1* fPtDepDCAxy = nullptr; + // Cent vs IP TH1D* mCentVsIPTruth = nullptr; bool centVsIPTruthLoaded = false; @@ -247,6 +258,28 @@ struct FlowMc { fGFWReco->CreateRegions(); } + if (cfgEnableITSCuts) { + if (cfgTrkSelRun3ITSMatch) { + myTrackSel = getGlobalTrackSelectionRun3ITSMatch(TrackSelection::GlobalTrackRun3ITSMatching::Run3ITSall7Layers, TrackSelection::GlobalTrackRun3DCAxyCut::Default); + } else { + myTrackSel = getGlobalTrackSelectionRun3ITSMatch(TrackSelection::GlobalTrackRun3ITSMatching::Run3ITSibAny, TrackSelection::GlobalTrackRun3DCAxyCut::Default); + } + } + if (cfgCutDCAxy != 0.0) { + myTrackSel.SetMaxDcaXY(cfgCutDCAxy); + } else { + fPtDepDCAxy = new TF1("ptDepDCAxy", Form("[0]*%s", cfgDCAxyFunction->c_str()), 0.001, 100); + fPtDepDCAxy->SetParameter(0, cfgDCAxyNSigma); + LOGF(info, "DCAxy pt-dependence function: %s", Form("[0]*%s", cfgDCAxyFunction->c_str())); + myTrackSel.SetMaxDcaXYPtDep([fPtDepDCAxy = this->fPtDepDCAxy](float pt) { return fPtDepDCAxy->Eval(pt); }); + } + myTrackSel.SetMinNClustersTPC(cfgCutTPCclu); + myTrackSel.SetMinNCrossedRowsTPC(cfgCutTPCcrossedrows); + if (cfgEnableITSCuts) + myTrackSel.SetMinNClustersITS(cfgCutITSclu); + if (!cfgCutDCAzPtDepEnabled) + myTrackSel.SetMaxDcaZ(cfgCutDCAz); + if (cfgTrackDensityCorrUse) { std::vector pTEffBins = {0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.4, 1.8, 2.2, 2.6, 3.0}; hFindPtBin = new TH1D("hFindPtBin", "hFindPtBin", pTEffBins.size() - 1, &pTEffBins[0]); @@ -378,7 +411,10 @@ struct FlowMc { template bool trackSelected(TTrack track) { - return ((track.tpcNClsFound() >= cfgCutTPCclu) && (track.tpcNClsCrossedRows() >= cfgCutTPCcrossedrows) && (track.itsNCls() >= cfgCutITSclu)); + if (cfgCutDCAzPtDepEnabled && (track.dcaZ() > (0.004f + 0.013f / track.pt()))) { + return false; + } + return myTrackSel.IsSelected(track); } void process(FilteredMcCollisions::iterator const& mcCollision, aod::BCsWithTimestamps const&, soa::SmallGroups> const& collisions, FilteredMcParticles const& mcParticles, FilteredTracks const&) diff --git a/PWGCF/Flow/Tasks/flowTask.cxx b/PWGCF/Flow/Tasks/flowTask.cxx index 158cb8820d9..ed94b5ce88a 100644 --- a/PWGCF/Flow/Tasks/flowTask.cxx +++ b/PWGCF/Flow/Tasks/flowTask.cxx @@ -119,13 +119,28 @@ struct FlowTask { Configurable> cfgMultT0CCutPars{"cfgMultT0CCutPars", std::vector{143.04, -4.58368, 0.0766055, -0.000727796, 2.86153e-06, 23.3108, -0.36304, 0.00437706, -4.717e-05, 1.98332e-07}, "Global multiplicity vs T0C centrality cut parameter values"}; O2_DEFINE_CONFIGURABLE(cfgMultPVT0CCutEnabled, bool, false, "Enable PV multiplicity vs T0C centrality cut") Configurable> cfgMultPVT0CCutPars{"cfgMultPVT0CCutPars", std::vector{195.357, -6.15194, 0.101313, -0.000955828, 3.74793e-06, 30.0326, -0.43322, 0.00476265, -5.11206e-05, 2.13613e-07}, "PV multiplicity vs T0C centrality cut parameter values"}; - O2_DEFINE_CONFIGURABLE(cfgMultMultHighCutFunction, std::string, "[0]+[1]*x + 5.*([2]+[3]*x)", "Functional for multiplicity correlation cut"); - O2_DEFINE_CONFIGURABLE(cfgMultMultLowCutFunction, std::string, "[0]+[1]*x - 5.*([2]+[3]*x)", "Functional for multiplicity correlation cut"); + O2_DEFINE_CONFIGURABLE(cfgMultMultPVHighCutFunction, std::string, "[0]+[1]*x + 5.*([2]+[3]*x)", "Functional for multiplicity correlation cut"); + O2_DEFINE_CONFIGURABLE(cfgMultMultPVLowCutFunction, std::string, "[0]+[1]*x - 5.*([2]+[3]*x)", "Functional for multiplicity correlation cut"); O2_DEFINE_CONFIGURABLE(cfgMultGlobalPVCutEnabled, bool, false, "Enable global multiplicity vs PV multiplicity cut") Configurable> cfgMultGlobalPVCutPars{"cfgMultGlobalPVCutPars", std::vector{-0.140809, 0.734344, 2.77495, 0.0165935}, "PV multiplicity vs T0C centrality cut parameter values"}; + O2_DEFINE_CONFIGURABLE(cfgMultMultV0AHighCutFunction, std::string, "[0] + [1]*x + [2]*x*x + [3]*x*x*x + [4]*x*x*x*x + 4.*([5] + [6]*x + [7]*x*x + [8]*x*x*x + [9]*x*x*x*x)", "Functional for multiplicity correlation cut"); + O2_DEFINE_CONFIGURABLE(cfgMultMultV0ALowCutFunction, std::string, "[0] + [1]*x + [2]*x*x + [3]*x*x*x + [4]*x*x*x*x - 3.*([5] + [6]*x + [7]*x*x + [8]*x*x*x + [9]*x*x*x*x)", "Functional for multiplicity correlation cut"); + O2_DEFINE_CONFIGURABLE(cfgMultMultV0ACutEnabled, bool, false, "Enable global multiplicity vs V0A multiplicity cut") + Configurable> cfgMultMultV0ACutPars{"cfgMultMultV0ACutPars", std::vector{534.893, 184.344, 0.423539, -0.00331436, 5.34622e-06, 871.239, 53.3735, -0.203528, 0.000122758, 5.41027e-07}, "Global multiplicity vs V0A multiplicity cut parameter values"}; std::vector multT0CCutPars; std::vector multPVT0CCutPars; std::vector multGlobalPVCutPars; + std::vector multMultV0ACutPars; + TF1* fMultPVT0CCutLow = nullptr; + TF1* fMultPVT0CCutHigh = nullptr; + TF1* fMultT0CCutLow = nullptr; + TF1* fMultT0CCutHigh = nullptr; + TF1* fMultGlobalPVCutLow = nullptr; + TF1* fMultGlobalPVCutHigh = nullptr; + TF1* fMultMultV0ACutLow = nullptr; + TF1* fMultMultV0ACutHigh = nullptr; + TF1* fT0AV0AMean = nullptr; + TF1* fT0AV0ASigma = nullptr; } cfgFuncParas; ConfigurableAxis axisPtHist{"axisPtHist", {100, 0., 10.}, "pt axis for histograms"}; @@ -198,16 +213,6 @@ struct FlowTask { TF1* funcV3; TF1* funcV4; - // Additional Event selection cuts - Copy from flowGenericFramework.cxx - TF1* fMultPVT0CCutLow = nullptr; - TF1* fMultPVT0CCutHigh = nullptr; - TF1* fMultT0CCutLow = nullptr; - TF1* fMultT0CCutHigh = nullptr; - TF1* fMultGlobalPVCutLow = nullptr; - TF1* fMultGlobalPVCutHigh = nullptr; - TF1* fT0AV0AMean = nullptr; - TF1* fT0AV0ASigma = nullptr; - void init(InitContext const&) { const AxisSpec axisVertex{40, -20, 20, "Vtxz (cm)"}; @@ -469,25 +474,31 @@ struct FlowTask { cfgFuncParas.multT0CCutPars = cfgFuncParas.cfgMultT0CCutPars; cfgFuncParas.multPVT0CCutPars = cfgFuncParas.cfgMultPVT0CCutPars; cfgFuncParas.multGlobalPVCutPars = cfgFuncParas.cfgMultGlobalPVCutPars; - fMultPVT0CCutLow = new TF1("fMultPVT0CCutLow", cfgFuncParas.cfgMultCentLowCutFunction->c_str(), 0, 100); - fMultPVT0CCutLow->SetParameters(&(cfgFuncParas.multPVT0CCutPars[0])); - fMultPVT0CCutHigh = new TF1("fMultPVT0CCutHigh", cfgFuncParas.cfgMultCentHighCutFunction->c_str(), 0, 100); - fMultPVT0CCutHigh->SetParameters(&(cfgFuncParas.multPVT0CCutPars[0])); + cfgFuncParas.multMultV0ACutPars = cfgFuncParas.cfgMultMultV0ACutPars; + cfgFuncParas.fMultPVT0CCutLow = new TF1("fMultPVT0CCutLow", cfgFuncParas.cfgMultCentLowCutFunction->c_str(), 0, 100); + cfgFuncParas.fMultPVT0CCutLow->SetParameters(&(cfgFuncParas.multPVT0CCutPars[0])); + cfgFuncParas.fMultPVT0CCutHigh = new TF1("fMultPVT0CCutHigh", cfgFuncParas.cfgMultCentHighCutFunction->c_str(), 0, 100); + cfgFuncParas.fMultPVT0CCutHigh->SetParameters(&(cfgFuncParas.multPVT0CCutPars[0])); + + cfgFuncParas.fMultT0CCutLow = new TF1("fMultT0CCutLow", cfgFuncParas.cfgMultCentLowCutFunction->c_str(), 0, 100); + cfgFuncParas.fMultT0CCutLow->SetParameters(&(cfgFuncParas.multT0CCutPars[0])); + cfgFuncParas.fMultT0CCutHigh = new TF1("fMultT0CCutHigh", cfgFuncParas.cfgMultCentHighCutFunction->c_str(), 0, 100); + cfgFuncParas.fMultT0CCutHigh->SetParameters(&(cfgFuncParas.multT0CCutPars[0])); - fMultT0CCutLow = new TF1("fMultT0CCutLow", cfgFuncParas.cfgMultCentLowCutFunction->c_str(), 0, 100); - fMultT0CCutLow->SetParameters(&(cfgFuncParas.multT0CCutPars[0])); - fMultT0CCutHigh = new TF1("fMultT0CCutHigh", cfgFuncParas.cfgMultCentHighCutFunction->c_str(), 0, 100); - fMultT0CCutHigh->SetParameters(&(cfgFuncParas.multT0CCutPars[0])); + cfgFuncParas.fMultGlobalPVCutLow = new TF1("fMultGlobalPVCutLow", cfgFuncParas.cfgMultMultPVLowCutFunction->c_str(), 0, 4000); + cfgFuncParas.fMultGlobalPVCutLow->SetParameters(&(cfgFuncParas.multGlobalPVCutPars[0])); + cfgFuncParas.fMultGlobalPVCutHigh = new TF1("fMultGlobalPVCutHigh", cfgFuncParas.cfgMultMultPVHighCutFunction->c_str(), 0, 4000); + cfgFuncParas.fMultGlobalPVCutHigh->SetParameters(&(cfgFuncParas.multGlobalPVCutPars[0])); - fMultGlobalPVCutLow = new TF1("fMultGlobalPVCutLow", cfgFuncParas.cfgMultMultLowCutFunction->c_str(), 0, 4000); - fMultGlobalPVCutLow->SetParameters(&(cfgFuncParas.multGlobalPVCutPars[0])); - fMultGlobalPVCutHigh = new TF1("fMultGlobalPVCutHigh", cfgFuncParas.cfgMultMultHighCutFunction->c_str(), 0, 4000); - fMultGlobalPVCutHigh->SetParameters(&(cfgFuncParas.multGlobalPVCutPars[0])); + cfgFuncParas.fMultMultV0ACutLow = new TF1("fMultMultV0ACutLow", cfgFuncParas.cfgMultMultV0ALowCutFunction->c_str(), 0, 4000); + cfgFuncParas.fMultMultV0ACutLow->SetParameters(&(cfgFuncParas.multMultV0ACutPars[0])); + cfgFuncParas.fMultMultV0ACutHigh = new TF1("fMultMultV0ACutHigh", cfgFuncParas.cfgMultMultV0AHighCutFunction->c_str(), 0, 4000); + cfgFuncParas.fMultMultV0ACutHigh->SetParameters(&(cfgFuncParas.multMultV0ACutPars[0])); - fT0AV0AMean = new TF1("fT0AV0AMean", "[0]+[1]*x", 0, 200000); - fT0AV0AMean->SetParameters(-1601.0581, 9.417652e-01); - fT0AV0ASigma = new TF1("fT0AV0ASigma", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x", 0, 200000); - fT0AV0ASigma->SetParameters(463.4144, 6.796509e-02, -9.097136e-07, 7.971088e-12, -2.600581e-17); + cfgFuncParas.fT0AV0AMean = new TF1("fT0AV0AMean", "[0]+[1]*x", 0, 200000); + cfgFuncParas.fT0AV0AMean->SetParameters(-1601.0581, 9.417652e-01); + cfgFuncParas.fT0AV0ASigma = new TF1("fT0AV0ASigma", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x", 0, 200000); + cfgFuncParas.fT0AV0ASigma->SetParameters(463.4144, 6.796509e-02, -9.097136e-07, 7.971088e-12, -2.600581e-17); } if (cfgTrackDensityCorrUse) { @@ -682,21 +693,27 @@ struct FlowTask { if (cfgEvSelMultCorrelation) { if (cfgFuncParas.cfgMultPVT0CCutEnabled) { - if (multNTracksPV < fMultPVT0CCutLow->Eval(centrality)) + if (multNTracksPV < cfgFuncParas.fMultPVT0CCutLow->Eval(centrality)) return 0; - if (multNTracksPV > fMultPVT0CCutHigh->Eval(centrality)) + if (multNTracksPV > cfgFuncParas.fMultPVT0CCutHigh->Eval(centrality)) return 0; } if (cfgFuncParas.cfgMultT0CCutEnabled) { - if (multTrk < fMultT0CCutLow->Eval(centrality)) + if (multTrk < cfgFuncParas.fMultT0CCutLow->Eval(centrality)) return 0; - if (multTrk > fMultT0CCutHigh->Eval(centrality)) + if (multTrk > cfgFuncParas.fMultT0CCutHigh->Eval(centrality)) return 0; } if (cfgFuncParas.cfgMultGlobalPVCutEnabled) { - if (multTrk < fMultGlobalPVCutLow->Eval(multNTracksPV)) + if (multTrk < cfgFuncParas.fMultGlobalPVCutLow->Eval(multNTracksPV)) + return 0; + if (multTrk > cfgFuncParas.fMultGlobalPVCutHigh->Eval(multNTracksPV)) + return 0; + } + if (cfgFuncParas.cfgMultMultV0ACutEnabled) { + if (collision.multFV0A() < cfgFuncParas.fMultMultV0ACutLow->Eval(multTrk)) return 0; - if (multTrk > fMultGlobalPVCutHigh->Eval(multNTracksPV)) + if (collision.multFV0A() > cfgFuncParas.fMultMultV0ACutHigh->Eval(multTrk)) return 0; } } @@ -705,7 +722,7 @@ struct FlowTask { // V0A T0A 5 sigma cut float sigma = 5.0; - if (cfgEvSelV0AT0ACut && (std::fabs(collision.multFV0A() - fT0AV0AMean->Eval(collision.multFT0A())) > sigma * fT0AV0ASigma->Eval(collision.multFT0A()))) + if (cfgEvSelV0AT0ACut && (std::fabs(collision.multFV0A() - cfgFuncParas.fT0AV0AMean->Eval(collision.multFT0A())) > sigma * cfgFuncParas.fT0AV0ASigma->Eval(collision.multFT0A()))) return 0; if (cfgEvSelV0AT0ACut) registry.fill(HIST("hEventCountSpecific"), 11.5); From fbe4b231c3208be1b9bb49526d4b06435921aed8 Mon Sep 17 00:00:00 2001 From: altsybee Date: Tue, 29 Jul 2025 14:56:46 +0200 Subject: [PATCH 119/345] [DPG] more options for phi-dependent study (#12300) --- DPG/Tasks/AOTEvent/detectorOccupancyQa.cxx | 138 ++++++++++++--------- 1 file changed, 80 insertions(+), 58 deletions(-) diff --git a/DPG/Tasks/AOTEvent/detectorOccupancyQa.cxx b/DPG/Tasks/AOTEvent/detectorOccupancyQa.cxx index a47d4dc870f..4575146c592 100644 --- a/DPG/Tasks/AOTEvent/detectorOccupancyQa.cxx +++ b/DPG/Tasks/AOTEvent/detectorOccupancyQa.cxx @@ -42,11 +42,8 @@ using namespace o2; using namespace o2::framework; using namespace o2::aod::evsel; -// using BCsRun2 = soa::Join; using BCsRun3 = soa::Join; -// using ColEvSels = soa::Join; using ColEvSels = soa::Join; -// using FullTracksIU = soa::Join; using FullTracksIU = soa::Join; struct DetectorOccupancyQaTask { @@ -78,7 +75,7 @@ struct DetectorOccupancyQaTask { Configurable confCutPtMaxThisEvent{"PtMaxThisEvent", 100., "pt cut for particles in a current event"}; // o2-linter: disable=name/configurable (temporary fix) Configurable confCutEtaMinTracksThisEvent{"EtaMinTracksThisEvent", -0.8, "eta cut for particles in a current event"}; // o2-linter: disable=name/configurable (temporary fix) Configurable confCutEtaMaxTracksThisEvent{"EtaMaxTracksThisEvent", 0.8, "eta cut for particles in a current event"}; // o2-linter: disable=name/configurable (temporary fix) - Configurable confCutMinTPCcls{"MinNumTPCcls", 70, "min number of TPC clusters for a current event"}; // o2-linter: disable=name/configurable (temporary fix) + Configurable confCutMinTPCcls{"MinNumTPCcls", 50, "min number of TPC clusters for a current event"}; // o2-linter: disable=name/configurable (temporary fix) // config for QA histograms Configurable confAddTracksVsFwdHistos{"AddTracksVsFwdHistos", true, "0 - add histograms, 1 - skip"}; // o2-linter: disable=name/configurable (temporary fix) @@ -93,6 +90,12 @@ struct DetectorOccupancyQaTask { Configurable nMaxBcInTFforAnalysis{"nMaxBcInTFforAnalysis", -1, "When to stop taking collisions in TF, if -1: take all collisions"}; // o2-linter: disable=name/configurable (temporary fix) + ConfigurableAxis confAxisPtBinsForPhiStudy{"PtBinsForPhiStudy", {VARIABLE_WIDTH, 0.2, 0.6, 1.0, 2.0, 10}, "pt axis"}; + ConfigurableAxis confAxisOccupForKine{"AxisOccupForKine", {VARIABLE_WIDTH, 0, 500, 1000, 2000, 4000, 6000, 8000, 10000, 20000}, "weighted occupancy"}; + + Configurable confUsePhiAtTPCinnerR{"UsePhiAtTPCinnerR", false, "0 - not use, 1 - use"}; // o2-linter: disable=name/configurable (temporary fix) + Configurable confUseAorCsideForPhiStudy{"UseAorCsideForPhiStudy", -1, "-1 - use full eta range, 0 - A, 1 - C sides"}; // o2-linter: disable=name/configurable (temporary fix) + uint64_t minGlobalBC = 0; Service ccdb; HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -290,46 +293,50 @@ struct DetectorOccupancyQaTask { histos.add("track_distr_nITStrThisEv_above_2000/hPt_highOccupInNeighbourEvents", ";p_{T};n tracks", kTH1D, {axisLogPt}); // July 2025: to compare data and MC (pt, eta, phi) - // AxisSpec axisOccupForKine{{0, 500, 1000, 2000, 4000, 6000, 20000}, "weighted occupancy"}; - AxisSpec axisOccupForKine{{0, 500, 1000, 2000, 4000, 6000, 8000, 10000, 20000}, "weighted occupancy"}; - AxisSpec axisPtForKine{{0.2, 0.6, 1.0, 2.0, 10}, "centrality percentile"}; - histos.add("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/hPt_pos", ";p_{T};weighted occupancy", kTH2D, {axisLogPt, axisOccupForKine}); - histos.add("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/hPt_neg", ";p_{T};weighted occupancy", kTH2D, {axisLogPt, axisOccupForKine}); - histos.add("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/hEta_pos", ";#eta;weighted occupancy", kTH2D, {axisEta, axisOccupForKine}); - histos.add("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/hEta_neg", ";#eta;weighted occupancy", kTH2D, {axisEta, axisOccupForKine}); - histos.add("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/hPhi_pos", ";#varphi;n tracks", kTH3D, {axisPhi, axisOccupForKine, axisPtForKine}); - histos.add("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/hPhi_neg", ";#varphi;n tracks", kTH3D, {axisPhi, axisOccupForKine, axisPtForKine}); - - histos.add("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/PV_hPt_pos", ";p_{T};weighted occupancy", kTH2D, {axisLogPt, axisOccupForKine}); - histos.add("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/PV_hPt_neg", ";p_{T};weighted occupancy", kTH2D, {axisLogPt, axisOccupForKine}); - histos.add("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/PV_hEta_pos", ";#eta;weighted occupancy", kTH2D, {axisEta, axisOccupForKine}); - histos.add("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/PV_hEta_neg", ";#eta;weighted occupancy", kTH2D, {axisEta, axisOccupForKine}); - histos.add("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/PV_hPhi_pos", ";#varphi;n tracks", kTH3D, {axisPhi, axisOccupForKine, axisPtForKine}); - histos.add("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/PV_hPhi_neg", ";#varphi;n tracks", kTH3D, {axisPhi, axisOccupForKine, axisPtForKine}); - - histos.add("track_distr_nITStrThisEv_above_2000/kine_vs_weighted_occup/hPt_pos", ";p_{T};weighted occupancy", kTH2D, {axisLogPt, axisOccupForKine}); - histos.add("track_distr_nITStrThisEv_above_2000/kine_vs_weighted_occup/hPt_neg", ";p_{T};weighted occupancy", kTH2D, {axisLogPt, axisOccupForKine}); - histos.add("track_distr_nITStrThisEv_above_2000/kine_vs_weighted_occup/hEta_pos", ";#eta;weighted occupancy", kTH2D, {axisEta, axisOccupForKine}); - histos.add("track_distr_nITStrThisEv_above_2000/kine_vs_weighted_occup/hEta_neg", ";#eta;weighted occupancy", kTH2D, {axisEta, axisOccupForKine}); - histos.add("track_distr_nITStrThisEv_above_2000/kine_vs_weighted_occup/hPhi_pos", ";#varphi;n tracks", kTH3D, {axisPhi, axisOccupForKine, axisPtForKine}); - histos.add("track_distr_nITStrThisEv_above_2000/kine_vs_weighted_occup/hPhi_neg", ";#varphi;n tracks", kTH3D, {axisPhi, axisOccupForKine, axisPtForKine}); - - histos.add("track_distr_nITStrThisEv_above_2000/kine_vs_weighted_occup/PV_hPt_pos", ";p_{T};weighted occupancy", kTH2D, {axisLogPt, axisOccupForKine}); - histos.add("track_distr_nITStrThisEv_above_2000/kine_vs_weighted_occup/PV_hPt_neg", ";p_{T};weighted occupancy", kTH2D, {axisLogPt, axisOccupForKine}); - histos.add("track_distr_nITStrThisEv_above_2000/kine_vs_weighted_occup/PV_hEta_pos", ";#eta;weighted occupancy", kTH2D, {axisEta, axisOccupForKine}); - histos.add("track_distr_nITStrThisEv_above_2000/kine_vs_weighted_occup/PV_hEta_neg", ";#eta;weighted occupancy", kTH2D, {axisEta, axisOccupForKine}); - histos.add("track_distr_nITStrThisEv_above_2000/kine_vs_weighted_occup/PV_hPhi_pos", ";#varphi;n tracks", kTH3D, {axisPhi, axisOccupForKine, axisPtForKine}); - histos.add("track_distr_nITStrThisEv_above_2000/kine_vs_weighted_occup/PV_hPhi_neg", ";#varphi;n tracks", kTH3D, {axisPhi, axisOccupForKine, axisPtForKine}); + // AxisSpec confAxisOccupForKine{{0, 500, 1000, 2000, 4000, 6000, 20000}, "weighted occupancy"}; + // AxisSpec confAxisOccupForKine{{0, 500, 1000, 2000, 4000, 6000, 8000, 10000, 20000}, "weighted occupancy"}; + // AxisSpec confAxisPtBinsForPhiStudy{{0.2, 0.6, 1.0, 2.0, 10}, "pt bins for phi study"}; + histos.add("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/hPt_pos", ";p_{T};weighted occupancy", kTH2D, {axisLogPt, confAxisOccupForKine}); + histos.add("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/hPt_neg", ";p_{T};weighted occupancy", kTH2D, {axisLogPt, confAxisOccupForKine}); + histos.add("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/hEta_pos", ";#eta;weighted occupancy", kTH2D, {axisEta, confAxisOccupForKine}); + histos.add("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/hEta_neg", ";#eta;weighted occupancy", kTH2D, {axisEta, confAxisOccupForKine}); + histos.add("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/hPhi_pos", ";#varphi;n tracks", kTH3D, {axisPhi, confAxisOccupForKine, confAxisPtBinsForPhiStudy}); + histos.add("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/hPhi_neg", ";#varphi;n tracks", kTH3D, {axisPhi, confAxisOccupForKine, confAxisPtBinsForPhiStudy}); + + histos.add("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/PV_hPt_pos", ";p_{T};weighted occupancy", kTH2D, {axisLogPt, confAxisOccupForKine}); + histos.add("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/PV_hPt_neg", ";p_{T};weighted occupancy", kTH2D, {axisLogPt, confAxisOccupForKine}); + histos.add("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/PV_hEta_pos", ";#eta;weighted occupancy", kTH2D, {axisEta, confAxisOccupForKine}); + histos.add("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/PV_hEta_neg", ";#eta;weighted occupancy", kTH2D, {axisEta, confAxisOccupForKine}); + histos.add("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/PV_hPhi_pos", ";#varphi;n tracks", kTH3D, {axisPhi, confAxisOccupForKine, confAxisPtBinsForPhiStudy}); + histos.add("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/PV_hPhi_neg", ";#varphi;n tracks", kTH3D, {axisPhi, confAxisOccupForKine, confAxisPtBinsForPhiStudy}); + + histos.add("track_distr_nITStrThisEv_above_2000/kine_vs_weighted_occup/hPt_pos", ";p_{T};weighted occupancy", kTH2D, {axisLogPt, confAxisOccupForKine}); + histos.add("track_distr_nITStrThisEv_above_2000/kine_vs_weighted_occup/hPt_neg", ";p_{T};weighted occupancy", kTH2D, {axisLogPt, confAxisOccupForKine}); + histos.add("track_distr_nITStrThisEv_above_2000/kine_vs_weighted_occup/hEta_pos", ";#eta;weighted occupancy", kTH2D, {axisEta, confAxisOccupForKine}); + histos.add("track_distr_nITStrThisEv_above_2000/kine_vs_weighted_occup/hEta_neg", ";#eta;weighted occupancy", kTH2D, {axisEta, confAxisOccupForKine}); + histos.add("track_distr_nITStrThisEv_above_2000/kine_vs_weighted_occup/hPhi_pos", ";#varphi;n tracks", kTH3D, {axisPhi, confAxisOccupForKine, confAxisPtBinsForPhiStudy}); + histos.add("track_distr_nITStrThisEv_above_2000/kine_vs_weighted_occup/hPhi_neg", ";#varphi;n tracks", kTH3D, {axisPhi, confAxisOccupForKine, confAxisPtBinsForPhiStudy}); + histos.add("track_distr_nITStrThisEv_above_2000/kine_vs_weighted_occup/hPhi_posInitialQA", ";#varphi;n tracks", kTH1D, {{3 * 810, -TMath::TwoPi(), 2 * TMath::TwoPi(), "#varphi"}}); + histos.add("track_distr_nITStrThisEv_above_2000/kine_vs_weighted_occup/hPhi_posModifiedQA", ";#varphi;n tracks", kTH1D, {{3 * 810, -TMath::TwoPi(), 2 * TMath::TwoPi(), "#varphi"}}); + histos.add("track_distr_nITStrThisEv_above_2000/kine_vs_weighted_occup/hPhi_negInitialQA", ";#varphi;n tracks", kTH1D, {{3 * 810, -TMath::TwoPi(), 2 * TMath::TwoPi(), "#varphi"}}); + histos.add("track_distr_nITStrThisEv_above_2000/kine_vs_weighted_occup/hPhi_negModifiedQA", ";#varphi;n tracks", kTH1D, {{3 * 810, -TMath::TwoPi(), 2 * TMath::TwoPi(), "#varphi"}}); + + histos.add("track_distr_nITStrThisEv_above_2000/kine_vs_weighted_occup/PV_hPt_pos", ";p_{T};weighted occupancy", kTH2D, {axisLogPt, confAxisOccupForKine}); + histos.add("track_distr_nITStrThisEv_above_2000/kine_vs_weighted_occup/PV_hPt_neg", ";p_{T};weighted occupancy", kTH2D, {axisLogPt, confAxisOccupForKine}); + histos.add("track_distr_nITStrThisEv_above_2000/kine_vs_weighted_occup/PV_hEta_pos", ";#eta;weighted occupancy", kTH2D, {axisEta, confAxisOccupForKine}); + histos.add("track_distr_nITStrThisEv_above_2000/kine_vs_weighted_occup/PV_hEta_neg", ";#eta;weighted occupancy", kTH2D, {axisEta, confAxisOccupForKine}); + histos.add("track_distr_nITStrThisEv_above_2000/kine_vs_weighted_occup/PV_hPhi_pos", ";#varphi;n tracks", kTH3D, {axisPhi, confAxisOccupForKine, confAxisPtBinsForPhiStudy}); + histos.add("track_distr_nITStrThisEv_above_2000/kine_vs_weighted_occup/PV_hPhi_neg", ";#varphi;n tracks", kTH3D, {axisPhi, confAxisOccupForKine, confAxisPtBinsForPhiStudy}); AxisSpec axisLogPtFor2D{50, 0.05, 10, "p_{T}"}; AxisSpec axisLogPtTpcFor2D{50, 0.05, 10, "p_{T} TPC inner"}; - histos.add("track_distr_nITStrThisEv_10_200/hPt_vs_tpcInnerPt_vs_occup", ";p_{T};p_{T} TPC inner;weighted occupancy", kTH3D, {axisLogPtFor2D, axisLogPtTpcFor2D, axisOccupForKine}); - histos.add("track_distr_nITStrThisEv_above_2000/hPt_vs_tpcInnerPt_vs_occup", ";p_{T};p_{T} TPC inner;weighted occupancy", kTH3D, {axisLogPtFor2D, axisLogPtTpcFor2D, axisOccupForKine}); + histos.add("track_distr_nITStrThisEv_10_200/hPt_vs_tpcInnerPt_vs_occup", ";p_{T};p_{T} TPC inner;weighted occupancy", kTH3D, {axisLogPtFor2D, axisLogPtTpcFor2D, confAxisOccupForKine}); + histos.add("track_distr_nITStrThisEv_above_2000/hPt_vs_tpcInnerPt_vs_occup", ";p_{T};p_{T} TPC inner;weighted occupancy", kTH3D, {axisLogPtFor2D, axisLogPtTpcFor2D, confAxisOccupForKine}); - histos.add("hNcolVsBcInTF/hNcolVsBcInTF_vs_occupancy", ";bc in TF;weighted occupancy", kTH2F, {axisBCinTF, axisOccupForKine}); - histos.add("hNcolVsBcInTF/hNcolVsBcInTF_vs_occupancy_vertexTOFmatched", ";bc in TF;weighted occupancy", kTH2F, {axisBCinTF, axisOccupForKine}); - histos.add("hNcolVsBcInTF/hNcolVsBcInTF_vs_occupancy_nPV_10_200", ";bc in TF;weighted occupancy", kTH2F, {axisBCinTF, axisOccupForKine}); - histos.add("hNcolVsBcInTF/hNcolVsBcInTF_vs_occupancy_nPV_above2000", ";bc in TF;weighted occupancy", kTH2F, {axisBCinTF, axisOccupForKine}); + histos.add("hNcolVsBcInTF/hNcolVsBcInTF_vs_occupancy", ";bc in TF;weighted occupancy", kTH2F, {axisBCinTF, confAxisOccupForKine}); + histos.add("hNcolVsBcInTF/hNcolVsBcInTF_vs_occupancy_vertexTOFmatched", ";bc in TF;weighted occupancy", kTH2F, {axisBCinTF, confAxisOccupForKine}); + histos.add("hNcolVsBcInTF/hNcolVsBcInTF_vs_occupancy_nPV_10_200", ";bc in TF;weighted occupancy", kTH2F, {axisBCinTF, confAxisOccupForKine}); + histos.add("hNcolVsBcInTF/hNcolVsBcInTF_vs_occupancy_nPV_above2000", ";bc in TF;weighted occupancy", kTH2F, {axisBCinTF, confAxisOccupForKine}); // end of July 2025: to compare data and MC (pt, eta, phi) // 3D: pt vs centr vs occup @@ -1218,23 +1225,30 @@ struct DetectorOccupancyQaTask { // continue; bool isGoodGlobal = (track.isGlobalTrack() && track.tpcNClsFound() >= confCutMinTPCcls); + bool hasTPCspecCuts = (track.hasTPC() && track.tpcNClsFound() >= confCutMinTPCcls && track.tpcNClsCrossedRows() > 80 && track.tpcChi2NCl() < 4); // ### kine distr vs centr vs occup float sign = track.sign(); float pt = track.pt(); float eta = track.eta(); float phi = track.phi(); + float phiInitial = phi; + + if (confUsePhiAtTPCinnerR) { + phi -= asin(0.8 /*inner TPC radius*/ / 2 * 0.3 * sign * 0.5 / pt); + if (phi < 0) + phi += TMath::TwoPi(); + else if (phi > TMath::TwoPi()) + phi -= TMath::TwoPi(); + } - if (occupancy >= 0 && fabs(eta) < 0.8 && pt > 0.15) { - // if (confFlagManyHeavyHistos) { - // histos.fill(HIST("ptGlobal_vs_centr_vs_occup"), nPV, occupancy, pt); - // histos.fill(HIST("ptPV_vs_centr_vs_occup"), nPV, occupancy, pt); - // if (col.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { - // histos.fill(HIST("ptGlobal_vs_centr_vs_occup_NoCollStd"), nPV, occupancy, pt); - // histos.fill(HIST("ptPV_vs_centr_vs_occup_NoCollStd"), nPV, occupancy, pt); - // } - // } + bool etaInRange = true; + if (confUseAorCsideForPhiStudy == 0 && eta < 0.1) // check if we are in A side + etaInRange = false; + if (confUseAorCsideForPhiStudy == 1 && eta > -0.1) // check if we are in C side + etaInRange = false; + if (occupancy >= 0 && fabs(eta) < 0.8 && pt > 0.15 && etaInRange) { if (nPV >= 10 && nPV < 200) { if (isGoodGlobal) { if (flagWhichDeltaTimeWin == 1 && flagNoCollNearby) { @@ -1266,22 +1280,22 @@ struct DetectorOccupancyQaTask { } // end of TPC good global // July 2025: for data vs MC kine distr comparison - if (sign > 0) // positive + if (sign > 0) // positive tracks { histos.fill(HIST("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/PV_hPt_pos"), pt, occupancy); histos.fill(HIST("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/PV_hEta_pos"), eta, occupancy); histos.fill(HIST("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/PV_hPhi_pos"), phi, occupancy, pt); - if (isGoodGlobal) { + if (hasTPCspecCuts) { histos.fill(HIST("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/hPt_pos"), pt, occupancy); histos.fill(HIST("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/hEta_pos"), eta, occupancy); histos.fill(HIST("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/hPhi_pos"), phi, occupancy, pt); } - } else // negative + } else // negative tracks { histos.fill(HIST("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/PV_hPt_neg"), pt, occupancy); histos.fill(HIST("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/PV_hEta_neg"), eta, occupancy); histos.fill(HIST("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/PV_hPhi_neg"), phi, occupancy, pt); - if (track.hasTPC()) { + if (hasTPCspecCuts) { histos.fill(HIST("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/hPt_neg"), pt, occupancy); histos.fill(HIST("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/hEta_neg"), eta, occupancy); histos.fill(HIST("track_distr_nITStrThisEv_10_200/kine_vs_weighted_occup/hPhi_neg"), phi, occupancy, pt); @@ -1320,30 +1334,38 @@ struct DetectorOccupancyQaTask { } // end of TPC good global // July 2025: for data vs MC kine distr comparison - if (sign > 0) // positive + if (sign > 0) // positive tracks { histos.fill(HIST("track_distr_nITStrThisEv_above_2000/kine_vs_weighted_occup/PV_hPt_pos"), pt, occupancy); histos.fill(HIST("track_distr_nITStrThisEv_above_2000/kine_vs_weighted_occup/PV_hEta_pos"), eta, occupancy); histos.fill(HIST("track_distr_nITStrThisEv_above_2000/kine_vs_weighted_occup/PV_hPhi_pos"), phi, occupancy, pt); - if (isGoodGlobal) { + if (hasTPCspecCuts) { histos.fill(HIST("track_distr_nITStrThisEv_above_2000/kine_vs_weighted_occup/hPt_pos"), pt, occupancy); histos.fill(HIST("track_distr_nITStrThisEv_above_2000/kine_vs_weighted_occup/hEta_pos"), eta, occupancy); histos.fill(HIST("track_distr_nITStrThisEv_above_2000/kine_vs_weighted_occup/hPhi_pos"), phi, occupancy, pt); + if (pt > 0.7 && pt < 1.0) { + histos.fill(HIST("track_distr_nITStrThisEv_above_2000/kine_vs_weighted_occup/hPhi_posInitialQA"), phiInitial); + histos.fill(HIST("track_distr_nITStrThisEv_above_2000/kine_vs_weighted_occup/hPhi_posModifiedQA"), phi); + } } - } else // negative + } else // negative tracks { histos.fill(HIST("track_distr_nITStrThisEv_above_2000/kine_vs_weighted_occup/PV_hPt_neg"), pt, occupancy); histos.fill(HIST("track_distr_nITStrThisEv_above_2000/kine_vs_weighted_occup/PV_hEta_neg"), eta, occupancy); histos.fill(HIST("track_distr_nITStrThisEv_above_2000/kine_vs_weighted_occup/PV_hPhi_neg"), phi, occupancy, pt); - if (track.hasTPC()) { + if (hasTPCspecCuts) { histos.fill(HIST("track_distr_nITStrThisEv_above_2000/kine_vs_weighted_occup/hPt_neg"), pt, occupancy); histos.fill(HIST("track_distr_nITStrThisEv_above_2000/kine_vs_weighted_occup/hEta_neg"), eta, occupancy); histos.fill(HIST("track_distr_nITStrThisEv_above_2000/kine_vs_weighted_occup/hPhi_neg"), phi, occupancy, pt); + if (pt > 0.7 && pt < 1.0) { + histos.fill(HIST("track_distr_nITStrThisEv_above_2000/kine_vs_weighted_occup/hPhi_negInitialQA"), phiInitial); + histos.fill(HIST("track_distr_nITStrThisEv_above_2000/kine_vs_weighted_occup/hPhi_negModifiedQA"), phi); + } } } // end of July 2025: for data vs MC kine distr comparison } // end of if (nPV >= 2000) - } // end of if (occupancy >= 0) + } // end of if (occupancy >= 0) && kine cuts } // end of spec track loop to fill track histograms } // end of if (confAddBasicQAhistos) From 935c8f24651d251b24ad7d70398c1b3b5ca75b3a Mon Sep 17 00:00:00 2001 From: Jesper Karlsson Gumprecht <113693781+jesgum@users.noreply.github.com> Date: Tue, 29 Jul 2025 15:12:06 +0200 Subject: [PATCH 120/345] [ALICE3] Add bdt score histograms to otf multi-charm (#12298) --- ALICE3/Tasks/alice3-multicharm.cxx | 45 +++++++++++++++++------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/ALICE3/Tasks/alice3-multicharm.cxx b/ALICE3/Tasks/alice3-multicharm.cxx index 083a8e206bd..088a3b5c1f6 100644 --- a/ALICE3/Tasks/alice3-multicharm.cxx +++ b/ALICE3/Tasks/alice3-multicharm.cxx @@ -84,8 +84,8 @@ struct alice3multicharm { std::string prefix = "bdt"; // JSON group name Configurable ccdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable localPath{"localPath", "MCharm_BDTModel.onnx", "(std::string) Path to the local .onnx file."}; - Configurable pathCCDB{"btdPathCCDB", "Users/j/jekarlss/MLModels2", "Path on CCDB"}; - Configurable timestampCCDB{"timestampCCDB", -1, "timestamp of the ONNX file for ML model used to query in CCDB. Exceptions: > 0 for the specific timestamp, 0 gets the run dependent timestamp"}; + Configurable pathCCDB{"btdPathCCDB", "Users/j/jekarlss/MLModels", "Path on CCDB"}; + Configurable timestampCCDB{"timestampCCDB", 1695750420200, "timestamp of the ONNX file for ML model used to query in CCDB. Please use 1695750420200"}; Configurable loadModelsFromCCDB{"loadModelsFromCCDB", false, "Flag to enable or disable the loading of models from CCDB"}; Configurable enableOptimizations{"enableOptimizations", false, "Enables the ONNX extended model-optimization: sessionOptions.SetGraphOptimizationLevel(GraphOptimizationLevel::ORT_ENABLE_EXTENDED)"}; Configurable enableML{"enableML", false, "Enables bdt model"}; @@ -93,7 +93,7 @@ struct alice3multicharm { } bdt; ConfigurableAxis axisEta{"axisEta", {80, -4.0f, +4.0f}, "#eta"}; - ConfigurableAxis axisXicMass{"axisXicMass", {200, 2.368f, 2.568f}, "XiC Inv Mass (GeV/c^{2})"}; + ConfigurableAxis axisXicMass{"axisXicMass", {200, 2.368f, 2.568f}, "Xic Inv Mass (GeV/c^{2})"}; ConfigurableAxis axisXiccMass{"axisXiccMass", {200, 3.521f, 3.721f}, "Xicc Inv Mass (GeV/c^{2})"}; ConfigurableAxis axisDCA{"axisDCA", {400, 0, 400}, "DCA (#mum)"}; ConfigurableAxis axisRadiusLarge{"axisRadiusLarge", {1000, 0, 20}, "Decay radius (cm)"}; @@ -102,6 +102,7 @@ struct alice3multicharm { ConfigurableAxis axisNSigma{"axisNSigma", {21, -10, 10}, "nsigma"}; ConfigurableAxis axisDecayLength{"axisDecayLength", {2000, 0, 2000}, "Decay lenght (#mum)"}; ConfigurableAxis axisDcaDaughters{"axisDcaDaughters", {200, 0, 100}, "DCA (mum)"}; + ConfigurableAxis axisBDTScore{"axisBDTScore", {100, 0, 1}, "BDT Score"}; ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "pt axis for QA histograms"}; Configurable xiMinDCAxy{"xiMinDCAxy", -1, "[0] in |DCAxy| > [0]+[1]/pT"}; @@ -133,21 +134,6 @@ struct alice3multicharm { void init(InitContext&) { - ccdb->setURL(bdt.ccdbUrl.value); - if (bdt.loadModelsFromCCDB) { - ccdbApi.init(bdt.ccdbUrl); - LOG(info) << "Fetching model for timestamp: " << bdt.timestampCCDB.value; - bool retrieveSuccessMCharm = ccdbApi.retrieveBlob(bdt.pathCCDB.value, ".", metadata, bdt.timestampCCDB.value, false, bdt.localPath.value); - - if (retrieveSuccessMCharm) { - bdtMCharm.initModel(bdt.localPath.value, bdt.enableOptimizations.value); - } else { - LOG(fatal) << "Error encountered while fetching/loading the MCharm model from CCDB! Maybe the model doesn't exist yet for this runnumber/timestamp?"; - } - } else { - bdtMCharm.initModel(bdt.localPath.value, bdt.enableOptimizations.value); - } - histos.add("SelectionQA/hDCAXicDaughters", "hDCAXicDaughters; DCA between Xic daughters (#mum)", kTH1D, {axisDcaDaughters}); histos.add("SelectionQA/hDCAXiccDaughters", "hDCAXiccDaughters; DCA between Xicc daughters (#mum)", kTH1D, {axisDcaDaughters}); histos.add("SelectionQA/hDCAxyXi", "hDCAxyXi; Xi DCAxy to PV (#mum)", kTH1D, {axisDCA}); @@ -249,6 +235,24 @@ struct alice3multicharm { histos.add("h3dXicc", "h3dXicc; Xicc pT (GeV/#it(c)); Xicc #eta; Xicc mass (GeV/#it(c)^{2})", kTH3D, {axisPt, axisEta, axisXiccMass}); if (bdt.enableML) { + ccdb->setURL(bdt.ccdbUrl.value); + if (bdt.loadModelsFromCCDB) { + ccdbApi.init(bdt.ccdbUrl); + LOG(info) << "Fetching model for timestamp: " << bdt.timestampCCDB.value; + bool retrieveSuccessMCharm = ccdbApi.retrieveBlob(bdt.pathCCDB.value, ".", metadata, bdt.timestampCCDB.value, false, bdt.localPath.value); + + if (retrieveSuccessMCharm) { + bdtMCharm.initModel(bdt.localPath.value, bdt.enableOptimizations.value); + } else { + LOG(fatal) << "Error encountered while fetching/loading the MCharm model from CCDB! Maybe the model doesn't exist yet for this runnumber/timestamp?"; + } + } else { + bdtMCharm.initModel(bdt.localPath.value, bdt.enableOptimizations.value); + } + + histos.add("hBDTScore", "hBDTScore", kTH1D, {axisBDTScore}); + histos.add("hBDTScoreVsXiccMass", "hBDTScoreVsXiccMass", kTH2D, {axisXiccMass, axisBDTScore}); + histos.add("hBDTScoreVsXiccPt", "hBDTScoreVsXiccPt", kTH2D, {axisXiccMass, axisPt}); for (const auto& score : bdt.requiredScores.value) { histPath = std::format("MLQA/RequiredBDTScore_{}/", static_cast(score * 100)); histPointers.insert({histPath + "hDCAXicDaughters", histos.add((histPath + "hDCAXicDaughters").c_str(), "hDCAXicDaughters", {kTH1D, {{axisDcaDaughters}}})}); @@ -292,7 +296,6 @@ struct alice3multicharm { void genericProcessXicc(TMCharmCands xiccCands) { for (const auto& xiccCand : xiccCands) { - if (bdt.enableML) { std::vector inputFeatures{ xiccCand.xicDauDCA(), @@ -318,6 +321,10 @@ struct alice3multicharm { float* probabilityMCharm = bdtMCharm.evalModel(inputFeatures); float bdtScore = probabilityMCharm[1]; + histos.fill(HIST("hBDTScore"), bdtScore); + histos.fill(HIST("hBDTScoreVsXiccMass"), xiccCand.xiccMass(), bdtScore); + histos.fill(HIST("hBDTScoreVsXiccPt"), xiccCand.xiccPt(), bdtScore); + for (const auto& requiredScore : bdt.requiredScores.value) { if (bdtScore > requiredScore) { histPath = std::format("MLQA/RequiredBDTScore_{}/", static_cast(requiredScore * 100)); From 20bf8ff0f42b09a031283b8ed4cdd1b84c1040b3 Mon Sep 17 00:00:00 2001 From: arvindkhuntia <31609955+arvindkhuntia@users.noreply.github.com> Date: Tue, 29 Jul 2025 20:21:35 +0530 Subject: [PATCH 121/345] [PWGJE] Add cent axis to histogram (#12248) Co-authored-by: Arvind Khuntia --- PWGJE/Tasks/nucleiInJets.cxx | 80 ++++++++++++++++++------------------ 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/PWGJE/Tasks/nucleiInJets.cxx b/PWGJE/Tasks/nucleiInJets.cxx index 298850f5bf5..f85ccded8e0 100644 --- a/PWGJE/Tasks/nucleiInJets.cxx +++ b/PWGJE/Tasks/nucleiInJets.cxx @@ -246,6 +246,8 @@ struct nucleiInJets { jetHist.get(HIST("hNEventsInc"))->GetXaxis()->SetBinLabel(2, "Sel8"); jetHist.get(HIST("hNEventsInc"))->GetXaxis()->SetBinLabel(3, "|Vz|<10"); + jetHist.add("hNEventsIncVsCent", "hNEventsIncVsCent", {HistType::kTH2D, {{4, 0.f, 4.f}, {CentAxis}}}); + // TPC nSigma vs pT (inclusive) jetHist.add("tracksInc/proton/h3PtVsProtonNSigmaTPCVsPt", "pT(p) vs NSigmaTPC (p) vs centrality; #it{p}_{T} (GeV/#it{c}); NSigmaTPC; centrality", HistType::kTH3F, {PtAxis, {200, -10, 10}, CentAxis}); jetHist.add("tracksInc/antiProton/h3PtVsantiProtonNSigmaTPCVsPt", "pT(#bar{p}) vs NSigmaTPC (#bar{p}) vs centrality; #it{p}_{T} (GeV/#it{c}); NSigmaTPC; centrality", HistType::kTH3F, {PtAxis, {200, -10, 10}, CentAxis}); @@ -415,18 +417,18 @@ struct nucleiInJets { if (cEnableProtonQA) { jetHist.add("tracks/proton/dca/after/hDCAxyVsPtProton", "DCAxy vs Pt (p)", HistType::kTH2F, {{dcaxyAxis}, {PtAxis}}); - jetHist.add("tracksInc/proton/dca/after/hDCAxyVsPtProton", "DCAxy vs Pt (p)", HistType::kTH2F, {{dcaxyAxis}, {PtAxis}}); + jetHist.add("tracksInc/proton/dca/after/hDCAxyVsPtProton", "DCAxy vs Pt (p)", HistType::kTH3F, {{dcaxyAxis}, {PtAxis}, {CentAxis}}); jetHist.add("tracks/antiProton/dca/after/hDCAxyVsPtantiProton", "DCAxy vs Pt (#bar{p})", HistType::kTH2F, {{dcaxyAxis}, {PtAxis}}); jetHist.add("tracks/proton/dca/after/hDCAzVsPtProton", "DCAz vs Pt (p)", HistType::kTH2F, {{dcazAxis}, {PtAxis}}); - jetHist.add("tracksInc/proton/dca/after/hDCAzVsPtProton", "DCAz vs Pt (p)", HistType::kTH2F, {{dcazAxis}, {PtAxis}}); + jetHist.add("tracksInc/proton/dca/after/hDCAzVsPtProton", "DCAz vs Pt (p)", HistType::kTH3F, {{dcazAxis}, {PtAxis}, {CentAxis}}); jetHist.add("tracks/antiProton/dca/after/hDCAzVsPtantiProton", "DCAz vs Pt (#bar{p})", HistType::kTH2F, {{dcazAxis}, {PtAxis}}); } if (cEnableDeuteronQA) { jetHist.add("tracks/deuteron/dca/after/hDCAxyVsPtDeuteron", "DCAxy vs Pt (d)", HistType::kTH2F, {{dcaxyAxis}, {PtAxis}}); - jetHist.add("tracksInc/deuteron/dca/after/hDCAxyVsPtDeuteron", "DCAxy vs Pt (d)", HistType::kTH2F, {{dcaxyAxis}, {PtAxis}}); + jetHist.add("tracksInc/deuteron/dca/after/hDCAxyVsPtDeuteron", "DCAxy vs Pt (d)", HistType::kTH3F, {{dcaxyAxis}, {PtAxis}, {CentAxis}}); jetHist.add("tracks/antiDeuteron/dca/after/hDCAxyVsPtantiDeuteron", "DCAxy vs Pt (#bar{d})", HistType::kTH2F, {{dcaxyAxis}, {PtAxis}}); jetHist.add("tracks/deuteron/dca/after/hDCAzVsPtDeuteron", "DCAz vs Pt (d)", HistType::kTH2F, {{dcazAxis}, {PtAxis}}); - jetHist.add("tracksInc/deuteron/dca/after/hDCAzVsPtDeuteron", "DCAz vs Pt (d)", HistType::kTH2F, {{dcazAxis}, {PtAxis}}); + jetHist.add("tracksInc/deuteron/dca/after/hDCAzVsPtDeuteron", "DCAz vs Pt (d)", HistType::kTH3F, {{dcazAxis}, {PtAxis}, {CentAxis}}); jetHist.add("tracks/antiDeuteron/dca/after/hDCAzVsPtantiDeuteron", "DCAz vs Pt (#bar{d})", HistType::kTH2F, {{dcazAxis}, {PtAxis}}); } if (cEnableTritonQA) { @@ -463,20 +465,20 @@ struct nucleiInJets { jetHist.add("tracks/helium/h2TOFmass2HeliumVsPt", "#Delta M^{2} (t) vs #it{p}_{T}t; TOFmass2; #it{p}_{T}/z (GeV)", HistType::kTH2F, {{massHeAxis}, {ptZHeAxis}}); jetHist.add("tracks/antiHelium/h2TOFmass2antiHeliumVsPt", "#Delta M^{2} (t) vs #it{p}_{T}; TOFmass2; #it{p}_{T}/z (GeV)", HistType::kTH2F, {{massHeAxis}, {ptZHeAxis}}); - jetHist.add("tracksInc/proton/h2TOFmassProtonVsPt", "h2TOFmassProtonVsPt; TOFmass; #it{p}_{T} (GeV)", HistType::kTH2F, {{80, 0.4, 4.}, {50, 0., 5.}}); - jetHist.add("tracksInc/antiProton/h2TOFmassantiProtonVsPt", "h2TOFmassantiProtonVsPt; TOFmass; #it{p}_{T} (GeV)", HistType::kTH2F, {{80, 0.4, 4.}, {50, 0., 5.}}); - jetHist.add("tracksInc/deuteron/h2TOFmassDeuteronVsPt", "h2TOFmassDeuteronVsPt; TOFmass; #it{p}_{T} (GeV)", HistType::kTH2F, {{80, 0.4, 4.}, {50, 0., 5.}}); - jetHist.add("tracksInc/antiDeuteron/h2TOFmassantiDeuteronVsPt", "h2TOFmassantiDeuteronVsPt; TOFmass; #it{p}_{T} (GeV)", HistType::kTH2F, {{80, 0.4, 4.}, {50, 0., 5.}}); + jetHist.add("tracksInc/proton/h2TOFmassProtonVsPt", "h2TOFmassProtonVsPt; TOFmass; #it{p}_{T} (GeV)", HistType::kTH3F, {{80, 0.4, 4.}, {50, 0., 5.}, {CentAxis}}); + jetHist.add("tracksInc/antiProton/h2TOFmassantiProtonVsPt", "h2TOFmassantiProtonVsPt; TOFmass; #it{p}_{T} (GeV)", HistType::kTH3F, {{80, 0.4, 4.}, {50, 0., 5.}, {CentAxis}}); + jetHist.add("tracksInc/deuteron/h2TOFmassDeuteronVsPt", "h2TOFmassDeuteronVsPt; TOFmass; #it{p}_{T} (GeV)", HistType::kTH3F, {{80, 0.4, 4.}, {50, 0., 5.}, {CentAxis}}); + jetHist.add("tracksInc/antiDeuteron/h2TOFmassantiDeuteronVsPt", "h2TOFmassantiDeuteronVsPt; TOFmass; #it{p}_{T} (GeV)", HistType::kTH3F, {{80, 0.4, 4.}, {50, 0., 5.}, {CentAxis}}); - jetHist.add("tracksInc/proton/h2TOFmass2ProtonVsPt", "#Delta M^{2} (t) vs #it{p}_{T}; TOFmass2; #it{p}_{T} (GeV)", HistType::kTH2F, {{massPrAxis}, {250, 0., 5.}}); - jetHist.add("tracksInc/antiProton/h2TOFmass2antiProtonVsPt", "#Delta M^{2} (t) vs #it{p}_{T}; TOFmass2; #it{p}_{T} (GeV)", HistType::kTH2F, {{massPrAxis}, {250, 0., 5.}}); - jetHist.add("tracksInc/deuteron/h2TOFmass2DeuteronVsPt", "#Delta M^{2} (t) vs #it{p}_{T}; TOFmass2; #it{p}_{T} (GeV)", HistType::kTH2F, {{massDeAxis}, {250, 0., 5.}}); - jetHist.add("tracksInc/antiDeuteron/h2TOFmass2antiDeuteronVsPt", "#Delta M^{2} (t) vs #it{p}_{T}; TOFmass2; #it{p}_{T} (GeV)", HistType::kTH2F, {{massDeAxis}, {250, 0., 5.}}); + jetHist.add("tracksInc/proton/h2TOFmass2ProtonVsPt", "#Delta M^{2} (t) vs #it{p}_{T}; TOFmass2; #it{p}_{T} (GeV)", HistType::kTH3F, {{massPrAxis}, {250, 0., 5.}, {CentAxis}}); + jetHist.add("tracksInc/antiProton/h2TOFmass2antiProtonVsPt", "#Delta M^{2} (t) vs #it{p}_{T}; TOFmass2; #it{p}_{T} (GeV)", HistType::kTH3F, {{massPrAxis}, {250, 0., 5.}, {CentAxis}}); + jetHist.add("tracksInc/deuteron/h2TOFmass2DeuteronVsPt", "#Delta M^{2} (t) vs #it{p}_{T}; TOFmass2; #it{p}_{T} (GeV)", HistType::kTH3F, {{massDeAxis}, {250, 0., 5.}, {CentAxis}}); + jetHist.add("tracksInc/antiDeuteron/h2TOFmass2antiDeuteronVsPt", "#Delta M^{2} (t) vs #it{p}_{T}; TOFmass2; #it{p}_{T} (GeV)", HistType::kTH3F, {{massDeAxis}, {250, 0., 5.}, {CentAxis}}); - jetHist.add("tracksInc/proton/h2TofNsigmaProtonVsPt", "h2TofNsigmaProtonVsPt; TofNsigma; #it{p}_{T} (GeV)", HistType::kTH2F, {{100, -5, 5}, {100, 0., 10.}}); - jetHist.add("tracksInc/antiProton/h2TofNsigmaantiProtonVsPt", "h2TofNsigmaantiProtonVsPt; TofNsigma; #it{p}_{T} (GeV)", HistType::kTH2F, {{100, -5, 5}, {100, 0., 10.}}); - jetHist.add("tracksInc/deuteron/h2TofNsigmaDeuteronVsPt", "h2TofNsigmaDeuteronVsPt; TofNsigma; #it{p}_{T} (GeV)", HistType::kTH2F, {{100, -5, 5}, {100, 0., 10.}}); - jetHist.add("tracksInc/antiDeuteron/h2TofNsigmaantiDeuteronVsPt", "h2TofNsigmaantiDeuteronVsPt; TofNsigma; #it{p}_{T} (GeV)", HistType::kTH2F, {{100, -5, 5}, {100, 0., 10.}}); + jetHist.add("tracksInc/proton/h2TofNsigmaProtonVsPt", "h2TofNsigmaProtonVsPt; TofNsigma; #it{p}_{T} (GeV)", HistType::kTH3F, {{100, -5, 5}, {100, 0., 10.}, {CentAxis}}); + jetHist.add("tracksInc/antiProton/h2TofNsigmaantiProtonVsPt", "h2TofNsigmaantiProtonVsPt; TofNsigma; #it{p}_{T} (GeV)", HistType::kTH3F, {{100, -5, 5}, {100, 0., 10.}, {CentAxis}}); + jetHist.add("tracksInc/deuteron/h2TofNsigmaDeuteronVsPt", "h2TofNsigmaDeuteronVsPt; TofNsigma; #it{p}_{T} (GeV)", HistType::kTH3F, {{100, -5, 5}, {100, 0., 10.}, {CentAxis}}); + jetHist.add("tracksInc/antiDeuteron/h2TofNsigmaantiDeuteronVsPt", "h2TofNsigmaantiDeuteronVsPt; TofNsigma; #it{p}_{T} (GeV)", HistType::kTH3F, {{100, -5, 5}, {100, 0., 10.}, {CentAxis}}); // TOF hist nSigma jetHist.add("tracks/proton/h2TofNsigmaProtonVsPt", "h2TofNsigmaProtonVsPt; TofNsigma; #it{p}_{T} (GeV)", HistType::kTH2F, {{100, -5, 5}, {50, 0., 5.}}); @@ -495,7 +497,7 @@ struct nucleiInJets { jetHist.get(HIST("recInc/eventStat"))->GetXaxis()->SetBinLabel(2, "Sel8"); jetHist.get(HIST("recInc/eventStat"))->GetXaxis()->SetBinLabel(3, "|Vz|<10"); - jetHist.add("recInc/vertexZ", "vertexZ (inclusive)", HistType::kTH1F, {{100, -15.0, 15.0}}); + jetHist.add("recInc/vertexZ", "vertexZ (inclusive)", HistType::kTH2F, {{100, -15.0, 15.0}, {CentAxis}}); jetHist.add("recInc/pt/PtParticleTypeTPC", "Pt vs ParticleType vs Centrality (TPC)", HistType::kTH3F, {{100, 0.f, 10.f}, {14, -7, 7}, {100, 0, 100}}); jetHist.add("recInc/pt/PtParticleTypeTPCTOF", "Pt vs ParticleType vs Centrality (TPC+TOF)", HistType::kTH3F, {{100, 0.f, 10.f}, {14, -7, 7}, {100, 0, 100}}); jetHist.add("recInc/pt/PtParticleTypeTPCTOFVeto", "Pt vs ParticleType vs Centrality (TPC+TOF Veto)", HistType::kTH3F, {{100, 0.f, 10.f}, {14, -7, 7}, {100, 0, 100}}); @@ -1369,7 +1371,7 @@ struct nucleiInJets { default: centrality = -999; } - + jetHist.fill(HIST("hNEventsIncVsCent"), coll.posZ(), centrality); for (const auto& track : tracks) { auto trk = track.track_as(); if (!isTrackSelected(trk)) { @@ -1429,12 +1431,12 @@ struct nucleiInJets { } if (cEnableProtonQA && std::abs(trk.tpcNSigmaPr()) < cfgnTPCPIDPr) { - jetHist.fill(HIST("tracksInc/proton/dca/after/hDCAxyVsPtProton"), trk.dcaXY(), trk.pt()); - jetHist.fill(HIST("tracksInc/proton/dca/after/hDCAzVsPtProton"), trk.dcaZ(), trk.pt()); + jetHist.fill(HIST("tracksInc/proton/dca/after/hDCAxyVsPtProton"), trk.dcaXY(), trk.pt(), centrality); + jetHist.fill(HIST("tracksInc/proton/dca/after/hDCAzVsPtProton"), trk.dcaZ(), trk.pt(), centrality); } if (cEnableDeuteronQA && std::abs(trk.tpcNSigmaDe()) < cfgnTPCPIDDe) { - jetHist.fill(HIST("tracksInc/deuteron/dca/after/hDCAxyVsPtDeuteron"), trk.dcaXY(), trk.pt()); - jetHist.fill(HIST("tracksInc/deuteron/dca/after/hDCAzVsPtDeuteron"), trk.dcaZ(), trk.pt()); + jetHist.fill(HIST("tracksInc/deuteron/dca/after/hDCAxyVsPtDeuteron"), trk.dcaXY(), trk.pt(), centrality); + jetHist.fill(HIST("tracksInc/deuteron/dca/after/hDCAzVsPtDeuteron"), trk.dcaZ(), trk.pt(), centrality); } } else { // anti-particle info @@ -1466,27 +1468,27 @@ struct nucleiInJets { if (addTOFplots && trk.hasTOF()) { massTOF = trk.p() * TMath::Sqrt(1.f / (trk.beta() * trk.beta()) - 1.f); if (!useTPCpreSel) { - jetHist.fill(HIST("tracksInc/antiProton/h2TOFmassantiProtonVsPt"), massTOF, trk.pt()); - jetHist.fill(HIST("tracksInc/antiProton/h2TOFmass2antiProtonVsPt"), massTOF * massTOF - gMassProton * gMassProton, trk.pt()); - jetHist.fill(HIST("tracksInc/antiProton/h2TofNsigmaantiProtonVsPt"), trk.tofNSigmaPr(), trk.pt()); + jetHist.fill(HIST("tracksInc/antiProton/h2TOFmassantiProtonVsPt"), massTOF, trk.pt(), centrality); + jetHist.fill(HIST("tracksInc/antiProton/h2TOFmass2antiProtonVsPt"), massTOF * massTOF - gMassProton * gMassProton, trk.pt(), centrality); + jetHist.fill(HIST("tracksInc/antiProton/h2TofNsigmaantiProtonVsPt"), trk.tofNSigmaPr(), trk.pt(), centrality); - jetHist.fill(HIST("tracksInc/antiDeuteron/h2TOFmassantiDeuteronVsPt"), massTOF, trk.pt()); - jetHist.fill(HIST("tracksInc/antiDeuteron/h2TOFmass2antiDeuteronVsPt"), massTOF * massTOF - gMassDeuteron * gMassDeuteron, trk.pt()); - jetHist.fill(HIST("tracksInc/antiDeuteron/h2TofNsigmaantiDeuteronVsPt"), trk.tofNSigmaDe(), trk.pt()); + jetHist.fill(HIST("tracksInc/antiDeuteron/h2TOFmassantiDeuteronVsPt"), massTOF, trk.pt(), centrality); + jetHist.fill(HIST("tracksInc/antiDeuteron/h2TOFmass2antiDeuteronVsPt"), massTOF * massTOF - gMassDeuteron * gMassDeuteron, trk.pt(), centrality); + jetHist.fill(HIST("tracksInc/antiDeuteron/h2TofNsigmaantiDeuteronVsPt"), trk.tofNSigmaDe(), trk.pt(), centrality); } else { if (std::abs(trk.tpcNSigmaPr()) < cfgnTPCPIDPr) { - jetHist.fill(HIST("tracksInc/antiProton/h2TOFmassantiProtonVsPt"), massTOF, trk.pt()); - jetHist.fill(HIST("tracksInc/antiProton/h2TOFmass2antiProtonVsPt"), massTOF * massTOF - gMassProton * gMassProton, trk.pt()); - jetHist.fill(HIST("tracksInc/antiProton/h2TofNsigmaantiProtonVsPt"), trk.tofNSigmaPr(), trk.pt()); + jetHist.fill(HIST("tracksInc/antiProton/h2TOFmassantiProtonVsPt"), massTOF, trk.pt(), centrality); + jetHist.fill(HIST("tracksInc/antiProton/h2TOFmass2antiProtonVsPt"), massTOF * massTOF - gMassProton * gMassProton, trk.pt(), centrality); + jetHist.fill(HIST("tracksInc/antiProton/h2TofNsigmaantiProtonVsPt"), trk.tofNSigmaPr(), trk.pt(), centrality); } if (std::abs(trk.tpcNSigmaDe()) < cfgnTPCPIDDe) { - jetHist.fill(HIST("tracksInc/antiDeuteron/h2TOFmassantiDeuteronVsPt"), massTOF, trk.pt()); - jetHist.fill(HIST("tracksInc/antiDeuteron/h2TOFmass2antiDeuteronVsPt"), massTOF * massTOF - gMassDeuteron * gMassDeuteron, trk.pt()); - jetHist.fill(HIST("tracksInc/antiDeuteron/h2TofNsigmaantiDeuteronVsPt"), trk.tofNSigmaDe(), trk.pt()); + jetHist.fill(HIST("tracksInc/antiDeuteron/h2TOFmassantiDeuteronVsPt"), massTOF, trk.pt(), centrality); + jetHist.fill(HIST("tracksInc/antiDeuteron/h2TOFmass2antiDeuteronVsPt"), massTOF * massTOF - gMassDeuteron * gMassDeuteron, trk.pt(), centrality); + jetHist.fill(HIST("tracksInc/antiDeuteron/h2TofNsigmaantiDeuteronVsPt"), trk.tofNSigmaDe(), trk.pt(), centrality); } else { - jetHist.fill(HIST("tracksInc/antiDeuteron/h2TOFmassantiDeuteronVsPt"), massTOF, trk.pt()); - jetHist.fill(HIST("tracksInc/antiDeuteron/h2TOFmass2antiDeuteronVsPt"), massTOF * massTOF - gMassDeuteron * gMassDeuteron, trk.pt()); - jetHist.fill(HIST("tracksInc/antiDeuteron/h2TofNsigmaantiDeuteronVsPt"), trk.tofNSigmaDe(), trk.pt()); + jetHist.fill(HIST("tracksInc/antiDeuteron/h2TOFmassantiDeuteronVsPt"), massTOF, trk.pt(), centrality); + jetHist.fill(HIST("tracksInc/antiDeuteron/h2TOFmass2antiDeuteronVsPt"), massTOF * massTOF - gMassDeuteron * gMassDeuteron, trk.pt(), centrality); + jetHist.fill(HIST("tracksInc/antiDeuteron/h2TofNsigmaantiDeuteronVsPt"), trk.tofNSigmaDe(), trk.pt(), centrality); } } } @@ -1971,8 +1973,6 @@ struct nucleiInJets { jetHist.fill(HIST("recInc/eventStat"), 1.5); if (std::abs(coll.posZ()) > 10) // bad vertex return; - - jetHist.fill(HIST("recInc/vertexZ"), coll.posZ()); jetHist.fill(HIST("recInc/eventStat"), 2.5); float centrality = -999; @@ -1989,7 +1989,7 @@ struct nucleiInJets { default: centrality = -999; } - + jetHist.fill(HIST("recInc/vertexZ"), coll.posZ(), centrality); for (const auto& track : tracks) { if (!isTrackSelected(track)) { continue; From 15809594d67dafc825b4cf8aceb5eaa7036e5afd Mon Sep 17 00:00:00 2001 From: abmodak <67369858+abmodak@users.noreply.github.com> Date: Tue, 29 Jul 2025 16:57:35 +0200 Subject: [PATCH 122/345] [PWGCF] Fix code replication (#12302) --- .../Tasks/longrangeCorrelation.cxx | 359 +++++------------- 1 file changed, 95 insertions(+), 264 deletions(-) diff --git a/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx b/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx index b71695872c4..126f0580ccd 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx @@ -178,145 +178,59 @@ struct LongrangeCorrelation { histos.add("QA/VtxZHist", "v_{z} (cm)", kTH1F, {axisVtxZ}, false); } - if (doprocessFt0aGlobalSE || doprocessFt0aGlobalME) { - histos.add("Ft0aGlobal/SE/hMult", "event multiplicity", kTH1D, {axisMultiplicity}); - histos.add("Ft0aGlobal/SE/Trig_etavsphi", ";#eta;#phi", kTH2D, {axisPhi, axisEtaTrig}); - histos.add("Ft0aGlobal/SE/Trig_eta", "#eta", kTH1D, {axisEtaTrig}); - histos.add("Ft0aGlobal/SE/Trig_phi", "#eta", kTH1D, {axisPhi}); - histos.add("Ft0aGlobal/SE/Trig_pt", "p_{T}", kTH1D, {axisPtTrigger}); - histos.add("Ft0aGlobal/SE/hMult_used", "event multiplicity", kTH1F, {axisMultiplicity}); - histos.add("Ft0aGlobal/SE/Trig_hist", "trig hist", kTHnSparseF, {axisSample, axisVtxZ, axisPtTrigger}); - histos.add("Ft0aGlobal/SE/FT0Amp", "ft0amult", kTH2D, {channelFt0aAxis, amplitudeFt0a}); - histos.add("Ft0aGlobal/SE/FT0eta", "ft0a;#eta", kTH1D, {axisEtaAssoc}); - histos.add("Ft0aGlobal/SE/FT0phi", "ft0a;#phi", kTH1D, {axisPhi}); - histos.add("Ft0aGlobal/SE/FT0etavsphi", ";ft0a;#eta;#phi", kTH2D, {axisPhi, axisEtaAssoc}); - histos.add("Ft0aGlobal/SE/deltaEta_deltaPhi", ";#delta#eta;#delta#phi", kTH2D, {axisDeltaPhi, axisDeltaEta}); - - histos.add("Ft0aGlobal/ME/hMult", "event multiplicity", kTH1D, {axisMultiplicity}); - histos.add("Ft0aGlobal/ME/Trig_etavsphi", ";#eta;#phi", kTH2D, {axisPhi, axisEtaTrig}); - histos.add("Ft0aGlobal/ME/Trig_eta", "#eta", kTH1D, {axisEtaTrig}); - histos.add("Ft0aGlobal/ME/Trig_phi", "#eta", kTH1D, {axisPhi}); - histos.add("Ft0aGlobal/ME/Trig_pt", "p_{T}", kTH1D, {axisPtTrigger}); - histos.add("Ft0aGlobal/ME/FT0Amp", "ft0amult", kTH2D, {channelFt0aAxis, amplitudeFt0a}); - histos.add("Ft0aGlobal/ME/FT0eta", "ft0a;#eta", kTH1D, {axisEtaAssoc}); - histos.add("Ft0aGlobal/ME/FT0phi", "ft0a;#phi", kTH1D, {axisPhi}); - histos.add("Ft0aGlobal/ME/FT0etavsphi", ";ft0a;#eta;#phi", kTH2D, {axisPhi, axisEtaAssoc}); - histos.add("Ft0aGlobal/ME/deltaEta_deltaPhi", ";#delta#eta;#delta#phi", kTH2D, {axisDeltaPhi, axisDeltaEta}); + histos.add("Ft0aGlobal/SE/hMult", "", kTH1D, {axisMultiplicity}); + histos.add("Ft0aGlobal/SE/Trig_etavsphi", "", kTH2D, {axisPhi, axisEtaTrig}); + histos.add("Ft0aGlobal/SE/Trig_eta", "", kTH1D, {axisEtaTrig}); + histos.add("Ft0aGlobal/SE/Trig_phi", "", kTH1D, {axisPhi}); + histos.add("Ft0aGlobal/SE/Trig_pt", "", kTH1D, {axisPtTrigger}); + histos.add("Ft0aGlobal/SE/hMult_used", "", kTH1F, {axisMultiplicity}); + histos.add("Ft0aGlobal/SE/Trig_hist", "", kTHnSparseF, {axisSample, axisVtxZ, axisPtTrigger}); + histos.add("Ft0aGlobal/SE/Assoc_amp", "", kTH2D, {channelFt0aAxis, amplitudeFt0a}); + histos.add("Ft0aGlobal/SE/Assoc_eta", "", kTH1D, {axisEtaAssoc}); + histos.add("Ft0aGlobal/SE/Assoc_phi", "", kTH1D, {axisPhi}); + histos.add("Ft0aGlobal/SE/Assoc_etavsphi", "", kTH2D, {axisPhi, axisEtaAssoc}); + histos.add("Ft0aGlobal/SE/deltaEta_deltaPhi", "", kTH2D, {axisDeltaPhi, axisDeltaEta}); + + histos.add("Ft0aGlobal/ME/hMult", "", kTH1D, {axisMultiplicity}); + histos.add("Ft0aGlobal/ME/Trig_etavsphi", "", kTH2D, {axisPhi, axisEtaTrig}); + histos.add("Ft0aGlobal/ME/Trig_eta", "", kTH1D, {axisEtaTrig}); + histos.add("Ft0aGlobal/ME/Trig_phi", "", kTH1D, {axisPhi}); + histos.add("Ft0aGlobal/ME/Trig_pt", "", kTH1D, {axisPtTrigger}); + histos.add("Ft0aGlobal/ME/Assoc_amp", "", kTH2D, {channelFt0aAxis, amplitudeFt0a}); + histos.add("Ft0aGlobal/ME/Assoc_eta", "", kTH1D, {axisEtaAssoc}); + histos.add("Ft0aGlobal/ME/Assoc_phi", "", kTH1D, {axisPhi}); + histos.add("Ft0aGlobal/ME/Assoc_etavsphi", "", kTH2D, {axisPhi, axisEtaAssoc}); + histos.add("Ft0aGlobal/ME/deltaEta_deltaPhi", "", kTH2D, {axisDeltaPhi, axisDeltaEta}); + if (doprocessFt0aGlobalSE || doprocessFt0aGlobalME) { sameFt0aGlobal.setObject(new CorrelationContainer(Form("sameEventFt0aGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("sameEventFt0aGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); mixedFt0aGlobal.setObject(new CorrelationContainer(Form("mixedEventFt0aGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("mixedEventFt0aGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); } if (doprocessFt0cGlobalSE || doprocessFt0cGlobalME) { - histos.add("Ft0cGlobal/SE/hMult", "event multiplicity", kTH1D, {axisMultiplicity}); - histos.add("Ft0cGlobal/SE/Trig_etavsphi", ";#eta;#phi", kTH2D, {axisPhi, axisEtaTrig}); - histos.add("Ft0cGlobal/SE/Trig_eta", "#eta", kTH1D, {axisEtaTrig}); - histos.add("Ft0cGlobal/SE/Trig_phi", "#eta", kTH1D, {axisPhi}); - histos.add("Ft0cGlobal/SE/Trig_pt", "p_{T}", kTH1D, {axisPtTrigger}); - histos.add("Ft0cGlobal/SE/hMult_used", "event multiplicity", kTH1F, {axisMultiplicity}); - histos.add("Ft0cGlobal/SE/Trig_hist", "trig hist", kTHnSparseF, {axisSample, axisVtxZ, axisPtTrigger}); - histos.add("Ft0cGlobal/SE/FT0Amp", "ft0amult", kTH2D, {channelFt0aAxis, amplitudeFt0a}); - histos.add("Ft0cGlobal/SE/FT0eta", "ft0a;#eta", kTH1D, {axisEtaAssoc}); - histos.add("Ft0cGlobal/SE/FT0phi", "ft0a;#phi", kTH1D, {axisPhi}); - histos.add("Ft0cGlobal/SE/FT0etavsphi", ";ft0a;#eta;#phi", kTH2D, {axisPhi, axisEtaAssoc}); - histos.add("Ft0cGlobal/SE/deltaEta_deltaPhi", ";#delta#eta;#delta#phi", kTH2D, {axisDeltaPhi, axisDeltaEta}); - - histos.add("Ft0cGlobal/ME/hMult", "event multiplicity", kTH1D, {axisMultiplicity}); - histos.add("Ft0cGlobal/ME/Trig_etavsphi", ";#eta;#phi", kTH2D, {axisPhi, axisEtaTrig}); - histos.add("Ft0cGlobal/ME/Trig_eta", "#eta", kTH1D, {axisEtaTrig}); - histos.add("Ft0cGlobal/ME/Trig_phi", "#eta", kTH1D, {axisPhi}); - histos.add("Ft0cGlobal/ME/Trig_pt", "p_{T}", kTH1D, {axisPtTrigger}); - histos.add("Ft0cGlobal/ME/FT0Amp", "ft0cmult", kTH2D, {channelFt0aAxis, amplitudeFt0a}); - histos.add("Ft0cGlobal/ME/FT0eta", "ft0c;#eta", kTH1D, {axisEtaAssoc}); - histos.add("Ft0cGlobal/ME/FT0phi", "ft0c;#phi", kTH1D, {axisPhi}); - histos.add("Ft0cGlobal/ME/FT0etavsphi", ";ft0c;#eta;#phi", kTH2D, {axisPhi, axisEtaAssoc}); - histos.add("Ft0cGlobal/ME/deltaEta_deltaPhi", ";#delta#eta;#delta#phi", kTH2D, {axisDeltaPhi, axisDeltaEta}); - + histos.addClone("Ft0aGlobal/SE/", "Ft0cGlobal/SE/"); + histos.addClone("Ft0aGlobal/ME/", "Ft0cGlobal/ME/"); sameFt0cGlobal.setObject(new CorrelationContainer(Form("sameEventFt0cGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("sameEventFt0cGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); mixedFt0cGlobal.setObject(new CorrelationContainer(Form("mixedEventFt0cGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("mixedEventFt0cGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); } if (doprocessMftGlobalSE || doprocessMftGlobalME) { - histos.add("MftGlobal/SE/hMult", "event multiplicity", kTH1D, {axisMultiplicity}); - histos.add("MftGlobal/SE/Trig_etavsphi", ";#eta;#phi", kTH2D, {axisPhi, axisEtaTrig}); - histos.add("MftGlobal/SE/Trig_eta", "#eta", kTH1D, {axisEtaTrig}); - histos.add("MftGlobal/SE/Trig_phi", "#eta", kTH1D, {axisPhi}); - histos.add("MftGlobal/SE/Trig_pt", "p_{T}", kTH1D, {axisPtTrigger}); - histos.add("MftGlobal/SE/hMult_used", "event multiplicity", kTH1F, {axisMultiplicity}); - histos.add("MftGlobal/SE/Trig_hist", "trig hist", kTHnSparseF, {axisSample, axisVtxZ, axisPtTrigger}); - histos.add("MftGlobal/SE/MFTeta", "mft;#eta", kTH1D, {axisEtaAssoc}); - histos.add("MftGlobal/SE/MFTphi", "mft;#phi", kTH1D, {axisPhi}); - histos.add("MftGlobal/SE/MFTetavsphi", ";mft0;#eta;#phi", kTH2D, {axisPhi, axisEtaAssoc}); - histos.add("MftGlobal/SE/deltaEta_deltaPhi", ";#delta#eta;#delta#phi", kTH2D, {axisDeltaPhi, axisDeltaEta}); - - histos.add("MftGlobal/ME/hMult", "event multiplicity", kTH1D, {axisMultiplicity}); - histos.add("MftGlobal/ME/Trig_etavsphi", ";#eta;#phi", kTH2D, {axisPhi, axisEtaTrig}); - histos.add("MftGlobal/ME/Trig_eta", "#eta", kTH1D, {axisEtaTrig}); - histos.add("MftGlobal/ME/Trig_phi", "#eta", kTH1D, {axisPhi}); - histos.add("MftGlobal/ME/Trig_pt", "p_{T}", kTH1D, {axisPtTrigger}); - histos.add("MftGlobal/ME/MFTeta", "mft;#eta", kTH1D, {axisEtaAssoc}); - histos.add("MftGlobal/ME/MFTphi", "mft;#phi", kTH1D, {axisPhi}); - histos.add("MftGlobal/ME/MFTetavsphi", ";mft;#eta;#phi", kTH2D, {axisPhi, axisEtaAssoc}); - histos.add("MftGlobal/ME/deltaEta_deltaPhi", ";#delta#eta;#delta#phi", kTH2D, {axisDeltaPhi, axisDeltaEta}); - + histos.addClone("Ft0aGlobal/SE/", "MftGlobal/SE/"); + histos.addClone("Ft0aGlobal/ME/", "MftGlobal/ME/"); sameMftGlobal.setObject(new CorrelationContainer(Form("sameEventMftGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("sameEventMftGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); mixedMftGlobal.setObject(new CorrelationContainer(Form("mixedEventMftGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("mixedEventMftGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); } if (doprocessFv0GlobalSE || doprocessFv0GlobalME) { - histos.add("Fv0Global/SE/hMult", "event multiplicity", kTH1D, {axisMultiplicity}); - histos.add("Fv0Global/SE/Trig_etavsphi", ";#eta;#phi", kTH2D, {axisPhi, axisEtaTrig}); - histos.add("Fv0Global/SE/Trig_eta", "#eta", kTH1D, {axisEtaTrig}); - histos.add("Fv0Global/SE/Trig_phi", "#eta", kTH1D, {axisPhi}); - histos.add("Fv0Global/SE/Trig_pt", "p_{T}", kTH1D, {axisPtTrigger}); - histos.add("Fv0Global/SE/hMult_used", "event multiplicity", kTH1F, {axisMultiplicity}); - histos.add("Fv0Global/SE/Trig_hist", "trig hist", kTHnSparseF, {axisSample, axisVtxZ, axisPtTrigger}); - histos.add("Fv0Global/SE/FV0Amp", "fv0mult", kTH2D, {channelFt0aAxis, amplitudeFt0a}); - histos.add("Fv0Global/SE/FV0eta", "fv0;#eta", kTH1D, {axisEtaAssoc}); - histos.add("Fv0Global/SE/FV0phi", "fv0;#phi", kTH1D, {axisPhi}); - histos.add("Fv0Global/SE/FV0etavsphi", ";fv0;#eta;#phi", kTH2D, {axisPhi, axisEtaAssoc}); - histos.add("Fv0Global/SE/deltaEta_deltaPhi", ";#delta#eta;#delta#phi", kTH2D, {axisDeltaPhi, axisDeltaEta}); - - histos.add("Fv0Global/ME/hMult", "event multiplicity", kTH1D, {axisMultiplicity}); - histos.add("Fv0Global/ME/Trig_etavsphi", ";#eta;#phi", kTH2D, {axisPhi, axisEtaTrig}); - histos.add("Fv0Global/ME/Trig_eta", "#eta", kTH1D, {axisEtaTrig}); - histos.add("Fv0Global/ME/Trig_phi", "#eta", kTH1D, {axisPhi}); - histos.add("Fv0Global/ME/Trig_pt", "p_{T}", kTH1D, {axisPtTrigger}); - histos.add("Fv0Global/ME/FV0Amp", "fv0mult", kTH2D, {channelFt0aAxis, amplitudeFt0a}); - histos.add("Fv0Global/ME/FV0eta", "fv0;#eta", kTH1D, {axisEtaAssoc}); - histos.add("Fv0Global/ME/FV0phi", "fv0;#phi", kTH1D, {axisPhi}); - histos.add("Fv0Global/ME/FV0etavsphi", ";fv0;#eta;#phi", kTH2D, {axisPhi, axisEtaAssoc}); - histos.add("Fv0Global/ME/deltaEta_deltaPhi", ";#delta#eta;#delta#phi", kTH2D, {axisDeltaPhi, axisDeltaEta}); - + histos.addClone("Ft0aGlobal/SE/", "Fv0Global/SE/"); + histos.addClone("Ft0aGlobal/ME/", "Fv0Global/ME/"); sameFv0Global.setObject(new CorrelationContainer(Form("sameEventFv0Global_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("sameEventFv0Global_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); mixedFv0Global.setObject(new CorrelationContainer(Form("mixedEventFv0Global_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("mixedEventFv0Global_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); } if (doprocessFv0MftSE || doprocessFv0MftME) { - histos.add("Fv0Mft/SE/hMult", "event multiplicity", kTH1D, {axisMultiplicity}); - histos.add("Fv0Mft/SE/Trig_etavsphi", ";#eta;#phi", kTH2D, {axisPhi, axisEtaTrig}); - histos.add("Fv0Mft/SE/Trig_eta", "#eta", kTH1D, {axisEtaTrig}); - histos.add("Fv0Mft/SE/Trig_phi", "#eta", kTH1D, {axisPhi}); - histos.add("Fv0Mft/SE/Trig_pt", "p_{T}", kTH1D, {axisPtTrigger}); - histos.add("Fv0Mft/SE/hMult_used", "event multiplicity", kTH1F, {axisMultiplicity}); - histos.add("Fv0Mft/SE/Trig_hist", "trig hist", kTHnSparseF, {axisSample, axisVtxZ, axisPtTrigger}); - histos.add("Fv0Mft/SE/FV0Amp", "fv0mult", kTH2D, {channelFt0aAxis, amplitudeFt0a}); - histos.add("Fv0Mft/SE/FV0eta", "fv0;#eta", kTH1D, {axisEtaAssoc}); - histos.add("Fv0Mft/SE/FV0phi", "fv0;#phi", kTH1D, {axisPhi}); - histos.add("Fv0Mft/SE/FV0etavsphi", ";fv0;#eta;#phi", kTH2D, {axisPhi, axisEtaAssoc}); - histos.add("Fv0Mft/SE/deltaEta_deltaPhi", ";#delta#eta;#delta#phi", kTH2D, {axisDeltaPhi, axisDeltaEta}); - - histos.add("Fv0Mft/ME/hMult", "event multiplicity", kTH1D, {axisMultiplicity}); - histos.add("Fv0Mft/ME/Trig_etavsphi", ";#eta;#phi", kTH2D, {axisPhi, axisEtaTrig}); - histos.add("Fv0Mft/ME/Trig_eta", "#eta", kTH1D, {axisEtaTrig}); - histos.add("Fv0Mft/ME/Trig_phi", "#eta", kTH1D, {axisPhi}); - histos.add("Fv0Mft/ME/Trig_pt", "p_{T}", kTH1D, {axisPtTrigger}); - histos.add("Fv0Mft/ME/FV0Amp", "fv0mult", kTH2D, {channelFt0aAxis, amplitudeFt0a}); - histos.add("Fv0Mft/ME/FV0eta", "fv0;#eta", kTH1D, {axisEtaAssoc}); - histos.add("Fv0Mft/ME/FV0phi", "fv0;#phi", kTH1D, {axisPhi}); - histos.add("Fv0Mft/ME/FV0etavsphi", ";fv0;#eta;#phi", kTH2D, {axisPhi, axisEtaAssoc}); - histos.add("Fv0Mft/ME/deltaEta_deltaPhi", ";#delta#eta;#delta#phi", kTH2D, {axisDeltaPhi, axisDeltaEta}); - + histos.addClone("Ft0aGlobal/SE/", "Fv0Mft/SE/"); + histos.addClone("Ft0aGlobal/ME/", "Fv0Mft/ME/"); sameFv0Mft.setObject(new CorrelationContainer(Form("sameEventFv0Mft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("sameEventFv0Mft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); mixedFv0Mft.setObject(new CorrelationContainer(Form("mixedEventFv0Mft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("mixedEventFv0Mft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); } @@ -423,112 +337,29 @@ struct LongrangeCorrelation { return true; } - template - void fillYieldFt0aGlobal(TTracks tracks, bool mixing) + template + void fillYield(TTracks tracks, bool mixing) { - if (mixing) { - histos.fill(HIST("Ft0aGlobal/ME/hMult"), tracks.size()); - for (auto const& triggerTrack : tracks) { - histos.fill(HIST("Ft0aGlobal/ME/Trig_etavsphi"), triggerTrack.phi(), triggerTrack.eta()); - histos.fill(HIST("Ft0aGlobal/ME/Trig_eta"), triggerTrack.eta()); - histos.fill(HIST("Ft0aGlobal/ME/Trig_phi"), triggerTrack.phi()); - histos.fill(HIST("Ft0aGlobal/ME/Trig_pt"), triggerTrack.pt()); - } - } else { - histos.fill(HIST("Ft0aGlobal/SE/hMult"), tracks.size()); - for (auto const& triggerTrack : tracks) { - histos.fill(HIST("Ft0aGlobal/SE/Trig_etavsphi"), triggerTrack.phi(), triggerTrack.eta()); - histos.fill(HIST("Ft0aGlobal/SE/Trig_eta"), triggerTrack.eta()); - histos.fill(HIST("Ft0aGlobal/SE/Trig_phi"), triggerTrack.phi()); - histos.fill(HIST("Ft0aGlobal/SE/Trig_pt"), triggerTrack.pt()); - } - } - } + static constexpr std::string_view SubDirSE[] = {"Ft0aGlobal/SE/", "Ft0cGlobal/SE/", "Fv0Global/SE/", + "MftGlobal/SE/", "Fv0Mft/SE/"}; + static constexpr std::string_view SubDirME[] = {"Ft0aGlobal/ME/", "Ft0cGlobal/ME/", "Fv0Global/ME/", + "MftGlobal/ME/", "Fv0Mft/ME/"}; - template - void fillYieldFt0cGlobal(TTracks tracks, bool mixing) - { - if (mixing) { - histos.fill(HIST("Ft0cGlobal/ME/hMult"), tracks.size()); - for (auto const& triggerTrack : tracks) { - histos.fill(HIST("Ft0cGlobal/ME/Trig_etavsphi"), triggerTrack.phi(), triggerTrack.eta()); - histos.fill(HIST("Ft0cGlobal/ME/Trig_eta"), triggerTrack.eta()); - histos.fill(HIST("Ft0cGlobal/ME/Trig_phi"), triggerTrack.phi()); - histos.fill(HIST("Ft0cGlobal/ME/Trig_pt"), triggerTrack.pt()); - } - } else { - histos.fill(HIST("Ft0cGlobal/SE/hMult"), tracks.size()); - for (auto const& triggerTrack : tracks) { - histos.fill(HIST("Ft0cGlobal/SE/Trig_etavsphi"), triggerTrack.phi(), triggerTrack.eta()); - histos.fill(HIST("Ft0cGlobal/SE/Trig_eta"), triggerTrack.eta()); - histos.fill(HIST("Ft0cGlobal/SE/Trig_phi"), triggerTrack.phi()); - histos.fill(HIST("Ft0cGlobal/SE/Trig_pt"), triggerTrack.pt()); - } - } - } - - template - void fillYieldMftGlobal(TTracks tracks, bool mixing) - { - if (mixing) { - histos.fill(HIST("MftGlobal/ME/hMult"), tracks.size()); - for (auto const& triggerTrack : tracks) { - histos.fill(HIST("MftGlobal/ME/Trig_etavsphi"), triggerTrack.phi(), triggerTrack.eta()); - histos.fill(HIST("MftGlobal/ME/Trig_eta"), triggerTrack.eta()); - histos.fill(HIST("MftGlobal/ME/Trig_phi"), triggerTrack.phi()); - histos.fill(HIST("MftGlobal/ME/Trig_pt"), triggerTrack.pt()); - } - } else { - histos.fill(HIST("MftGlobal/SE/hMult"), tracks.size()); - for (auto const& triggerTrack : tracks) { - histos.fill(HIST("MftGlobal/SE/Trig_etavsphi"), triggerTrack.phi(), triggerTrack.eta()); - histos.fill(HIST("MftGlobal/SE/Trig_eta"), triggerTrack.eta()); - histos.fill(HIST("MftGlobal/SE/Trig_phi"), triggerTrack.phi()); - histos.fill(HIST("MftGlobal/SE/Trig_pt"), triggerTrack.pt()); - } - } - } - - template - void fillYieldFv0Global(TTracks tracks, bool mixing) - { - if (mixing) { - histos.fill(HIST("Fv0Global/ME/hMult"), tracks.size()); - for (auto const& triggerTrack : tracks) { - histos.fill(HIST("Fv0Global/ME/Trig_etavsphi"), triggerTrack.phi(), triggerTrack.eta()); - histos.fill(HIST("Fv0Global/ME/Trig_eta"), triggerTrack.eta()); - histos.fill(HIST("Fv0Global/ME/Trig_phi"), triggerTrack.phi()); - histos.fill(HIST("Fv0Global/ME/Trig_pt"), triggerTrack.pt()); - } - } else { - histos.fill(HIST("Fv0Global/SE/hMult"), tracks.size()); - for (auto const& triggerTrack : tracks) { - histos.fill(HIST("Fv0Global/SE/Trig_etavsphi"), triggerTrack.phi(), triggerTrack.eta()); - histos.fill(HIST("Fv0Global/SE/Trig_eta"), triggerTrack.eta()); - histos.fill(HIST("Fv0Global/SE/Trig_phi"), triggerTrack.phi()); - histos.fill(HIST("Fv0Global/SE/Trig_pt"), triggerTrack.pt()); - } - } - } - - template - void fillYieldFv0Mft(TTracks tracks, bool mixing) - { if (mixing) { - histos.fill(HIST("Fv0Mft/ME/hMult"), tracks.size()); + histos.fill(HIST(SubDirME[mode]) + HIST("hMult"), tracks.size()); for (auto const& triggerTrack : tracks) { - histos.fill(HIST("Fv0Mft/ME/Trig_etavsphi"), triggerTrack.phi(), triggerTrack.eta()); - histos.fill(HIST("Fv0Mft/ME/Trig_eta"), triggerTrack.eta()); - histos.fill(HIST("Fv0Mft/ME/Trig_phi"), triggerTrack.phi()); - histos.fill(HIST("Fv0Mft/ME/Trig_pt"), triggerTrack.pt()); + histos.fill(HIST(SubDirME[mode]) + HIST("Trig_etavsphi"), triggerTrack.phi(), triggerTrack.eta()); + histos.fill(HIST(SubDirME[mode]) + HIST("Trig_eta"), triggerTrack.eta()); + histos.fill(HIST(SubDirME[mode]) + HIST("Trig_phi"), triggerTrack.phi()); + histos.fill(HIST(SubDirME[mode]) + HIST("Trig_pt"), triggerTrack.pt()); } } else { - histos.fill(HIST("Fv0Mft/SE/hMult"), tracks.size()); + histos.fill(HIST(SubDirSE[mode]) + HIST("hMult"), tracks.size()); for (auto const& triggerTrack : tracks) { - histos.fill(HIST("Fv0Mft/SE/Trig_etavsphi"), triggerTrack.phi(), triggerTrack.eta()); - histos.fill(HIST("Fv0Mft/SE/Trig_eta"), triggerTrack.eta()); - histos.fill(HIST("Fv0Mft/SE/Trig_phi"), triggerTrack.phi()); - histos.fill(HIST("Fv0Mft/SE/Trig_pt"), triggerTrack.pt()); + histos.fill(HIST(SubDirSE[mode]) + HIST("Trig_etavsphi"), triggerTrack.phi(), triggerTrack.eta()); + histos.fill(HIST(SubDirSE[mode]) + HIST("Trig_eta"), triggerTrack.eta()); + histos.fill(HIST(SubDirSE[mode]) + HIST("Trig_phi"), triggerTrack.phi()); + histos.fill(HIST(SubDirSE[mode]) + HIST("Trig_pt"), triggerTrack.pt()); } } } @@ -552,21 +383,21 @@ struct LongrangeCorrelation { if (ampl <= 0) continue; if (mixing) - histos.fill(HIST("Ft0aGlobal/ME/FT0Amp"), chanelid, ampl); + histos.fill(HIST("Ft0aGlobal/ME/Assoc_amp"), chanelid, ampl); else - histos.fill(HIST("Ft0aGlobal/SE/FT0Amp"), chanelid, ampl); + histos.fill(HIST("Ft0aGlobal/SE/Assoc_amp"), chanelid, ampl); auto phi = getPhiFT0(chanelid, offsetX, offsetY); auto eta = getEtaFT0(chanelid, offsetX, offsetY, offsetZ); if (mixing) { - histos.fill(HIST("Ft0aGlobal/ME/FT0eta"), eta); - histos.fill(HIST("Ft0aGlobal/ME/FT0phi"), phi); - histos.fill(HIST("Ft0aGlobal/ME/FT0etavsphi"), phi, eta); + histos.fill(HIST("Ft0aGlobal/ME/Assoc_eta"), eta); + histos.fill(HIST("Ft0aGlobal/ME/Assoc_phi"), phi); + histos.fill(HIST("Ft0aGlobal/ME/Assoc_etavsphi"), phi, eta); } else { - histos.fill(HIST("Ft0aGlobal/SE/FT0eta"), eta); - histos.fill(HIST("Ft0aGlobal/SE/FT0phi"), phi); - histos.fill(HIST("Ft0aGlobal/SE/FT0etavsphi"), phi, eta); + histos.fill(HIST("Ft0aGlobal/SE/Assoc_eta"), eta); + histos.fill(HIST("Ft0aGlobal/SE/Assoc_phi"), phi); + histos.fill(HIST("Ft0aGlobal/SE/Assoc_etavsphi"), phi, eta); } float deltaPhi = RecoDecay::constrainAngle(triggerTrack.phi() - phi, -PIHalf); float deltaEta = triggerTrack.eta() - eta; @@ -598,21 +429,21 @@ struct LongrangeCorrelation { if (ampl <= 0) continue; if (mixing) - histos.fill(HIST("Ft0cGlobal/ME/FT0Amp"), chanelid, ampl); + histos.fill(HIST("Ft0cGlobal/ME/Assoc_amp"), chanelid, ampl); else - histos.fill(HIST("Ft0cGlobal/SE/FT0Amp"), chanelid, ampl); + histos.fill(HIST("Ft0cGlobal/SE/Assoc_amp"), chanelid, ampl); auto phi = getPhiFT0(chanelid, offsetX, offsetY); auto eta = getEtaFT0(chanelid, offsetX, offsetY, offsetZ); if (mixing) { - histos.fill(HIST("Ft0cGlobal/ME/FT0eta"), eta); - histos.fill(HIST("Ft0cGlobal/ME/FT0phi"), phi); - histos.fill(HIST("Ft0cGlobal/ME/FT0etavsphi"), phi, eta); + histos.fill(HIST("Ft0cGlobal/ME/Assoc_eta"), eta); + histos.fill(HIST("Ft0cGlobal/ME/Assoc_phi"), phi); + histos.fill(HIST("Ft0cGlobal/ME/Assoc_etavsphi"), phi, eta); } else { - histos.fill(HIST("Ft0cGlobal/SE/FT0eta"), eta); - histos.fill(HIST("Ft0cGlobal/SE/FT0phi"), phi); - histos.fill(HIST("Ft0cGlobal/SE/FT0etavsphi"), phi, eta); + histos.fill(HIST("Ft0cGlobal/SE/Assoc_eta"), eta); + histos.fill(HIST("Ft0cGlobal/SE/Assoc_phi"), phi); + histos.fill(HIST("Ft0cGlobal/SE/Assoc_etavsphi"), phi, eta); } float deltaPhi = RecoDecay::constrainAngle(triggerTrack.phi() - phi, -PIHalf); float deltaEta = triggerTrack.eta() - eta; @@ -642,13 +473,13 @@ struct LongrangeCorrelation { auto phi = assoTrack.phi(); o2::math_utils::bringTo02Pi(phi); if (mixing) { - histos.fill(HIST("MftGlobal/ME/MFTeta"), assoTrack.eta()); - histos.fill(HIST("MftGlobal/ME/MFTphi"), phi); - histos.fill(HIST("MftGlobal/ME/MFTetavsphi"), phi, assoTrack.eta()); + histos.fill(HIST("MftGlobal/ME/Assoc_eta"), assoTrack.eta()); + histos.fill(HIST("MftGlobal/ME/Assoc_phi"), phi); + histos.fill(HIST("MftGlobal/ME/Assoc_etavsphi"), phi, assoTrack.eta()); } else { - histos.fill(HIST("MftGlobal/SE/FT0eta"), assoTrack.eta()); - histos.fill(HIST("MftGlobal/SE/FT0phi"), phi); - histos.fill(HIST("MftGlobal/SE/FT0etavsphi"), phi, assoTrack.eta()); + histos.fill(HIST("MftGlobal/SE/Assoc_eta"), assoTrack.eta()); + histos.fill(HIST("MftGlobal/SE/Assoc_phi"), phi); + histos.fill(HIST("MftGlobal/SE/Assoc_etavsphi"), phi, assoTrack.eta()); } float deltaPhi = RecoDecay::constrainAngle(triggerTrack.phi() - phi, -PIHalf); float deltaEta = triggerTrack.eta() - assoTrack.eta(); @@ -677,21 +508,21 @@ struct LongrangeCorrelation { if (ampl <= 0) continue; if (mixing) - histos.fill(HIST("Fv0Global/ME/FV0Amp"), chanelid, ampl); + histos.fill(HIST("Fv0Global/ME/Assoc_amp"), chanelid, ampl); else - histos.fill(HIST("Fv0Global/SE/FV0Amp"), chanelid, ampl); + histos.fill(HIST("Fv0Global/SE/Assoc_amp"), chanelid, ampl); auto phi = getPhiFV0(chanelid); auto eta = getEtaFV0(chanelid); if (mixing) { - histos.fill(HIST("Fv0Global/ME/FV0eta"), eta); - histos.fill(HIST("Fv0Global/ME/FV0phi"), phi); - histos.fill(HIST("Fv0Global/ME/FV0etavsphi"), phi, eta); + histos.fill(HIST("Fv0Global/ME/Assoc_eta"), eta); + histos.fill(HIST("Fv0Global/ME/Assoc_phi"), phi); + histos.fill(HIST("Fv0Global/ME/Assoc_etavsphi"), phi, eta); } else { - histos.fill(HIST("Fv0Global/SE/FV0eta"), eta); - histos.fill(HIST("Fv0Global/SE/FV0phi"), phi); - histos.fill(HIST("Fv0Global/SE/FV0etavsphi"), phi, eta); + histos.fill(HIST("Fv0Global/SE/Assoc_eta"), eta); + histos.fill(HIST("Fv0Global/SE/Assoc_phi"), phi); + histos.fill(HIST("Fv0Global/SE/Assoc_etavsphi"), phi, eta); } float deltaPhi = RecoDecay::constrainAngle(triggerTrack.phi() - phi, -PIHalf); float deltaEta = triggerTrack.eta() - eta; @@ -726,21 +557,21 @@ struct LongrangeCorrelation { if (ampl <= 0) continue; if (mixing) - histos.fill(HIST("Fv0Mft/ME/FV0Amp"), chanelid, ampl); + histos.fill(HIST("Fv0Mft/ME/Assoc_amp"), chanelid, ampl); else - histos.fill(HIST("Fv0Mft/SE/FV0Amp"), chanelid, ampl); + histos.fill(HIST("Fv0Mft/SE/Assoc_amp"), chanelid, ampl); auto phi = getPhiFV0(chanelid); auto eta = getEtaFV0(chanelid); if (mixing) { - histos.fill(HIST("Fv0Mft/ME/FV0eta"), eta); - histos.fill(HIST("Fv0Mft/ME/FV0phi"), phi); - histos.fill(HIST("Fv0Mft/ME/FV0etavsphi"), phi, eta); + histos.fill(HIST("Fv0Mft/ME/Assoc_eta"), eta); + histos.fill(HIST("Fv0Mft/ME/Assoc_phi"), phi); + histos.fill(HIST("Fv0Mft/ME/Assoc_etavsphi"), phi, eta); } else { - histos.fill(HIST("Fv0Mft/SE/FV0eta"), eta); - histos.fill(HIST("Fv0Mft/SE/FV0phi"), phi); - histos.fill(HIST("Fv0Mft/SE/FV0etavsphi"), phi, eta); + histos.fill(HIST("Fv0Mft/SE/Assoc_eta"), eta); + histos.fill(HIST("Fv0Mft/SE/Assoc_phi"), phi); + histos.fill(HIST("Fv0Mft/SE/Assoc_etavsphi"), phi, eta); } float deltaPhi = RecoDecay::constrainAngle(trigphi - phi, -PIHalf); @@ -778,7 +609,7 @@ struct LongrangeCorrelation { return; } if (col.has_foundFT0()) { - fillYieldFt0aGlobal(tracks, false); + fillYield<0>(tracks, false); const auto& ft0 = col.foundFT0(); if (tracks.size() < cfgMinMult || tracks.size() >= cfgMaxMult) { return; @@ -793,7 +624,7 @@ struct LongrangeCorrelation { return; } if (col.has_foundFT0()) { - fillYieldFt0cGlobal(tracks, false); + fillYield<1>(tracks, false); const auto& ft0 = col.foundFT0(); if (tracks.size() < cfgMinMult || tracks.size() >= cfgMaxMult) { return; @@ -807,7 +638,7 @@ struct LongrangeCorrelation { if (!isEventSelected(col)) { return; } - fillYieldMftGlobal(tracks, false); + fillYield<3>(tracks, false); if (tracks.size() < cfgMinMult || tracks.size() >= cfgMaxMult) { return; } @@ -820,7 +651,7 @@ struct LongrangeCorrelation { return; } if (col.has_foundFV0()) { - fillYieldFv0Global(tracks, false); + fillYield<2>(tracks, false); const auto& fv0 = col.foundFV0(); if (tracks.size() < cfgMinMult || tracks.size() >= cfgMaxMult) { return; @@ -835,7 +666,7 @@ struct LongrangeCorrelation { return; } if (col.has_foundFV0()) { - fillYieldFv0Mft(mfttracks, false); + fillYield<4>(mfttracks, false); const auto& fv0 = col.foundFV0(); if (tracks.size() < cfgMinMult || tracks.size() >= cfgMaxMult) { return; @@ -862,7 +693,7 @@ struct LongrangeCorrelation { } if (col1.has_foundFT0() && col2.has_foundFT0()) { auto slicedTriggerTracks = tracks.sliceBy(perColGlobal, col1.globalIndex()); - fillYieldFt0aGlobal(slicedTriggerTracks, true); + fillYield<0>(slicedTriggerTracks, true); const auto& ft0 = col2.foundFT0(); if (slicedTriggerTracks.size() < cfgMinMult || slicedTriggerTracks.size() >= cfgMaxMult) { continue; @@ -890,7 +721,7 @@ struct LongrangeCorrelation { } if (col1.has_foundFT0() && col2.has_foundFT0()) { auto slicedTriggerTracks = tracks.sliceBy(perColGlobal, col1.globalIndex()); - fillYieldFt0cGlobal(slicedTriggerTracks, true); + fillYield<1>(slicedTriggerTracks, true); const auto& ft0 = col2.foundFT0(); if (slicedTriggerTracks.size() < cfgMinMult || slicedTriggerTracks.size() >= cfgMaxMult) { continue; @@ -940,7 +771,7 @@ struct LongrangeCorrelation { } if (col1.has_foundFV0() && col2.has_foundFV0()) { auto slicedTriggerTracks = tracks.sliceBy(perColGlobal, col1.globalIndex()); - fillYieldFv0Global(slicedTriggerTracks, true); + fillYield<2>(slicedTriggerTracks, true); const auto& fv0 = col2.foundFV0(); if (slicedTriggerTracks.size() < cfgMinMult || slicedTriggerTracks.size() >= cfgMaxMult) { continue; @@ -969,7 +800,7 @@ struct LongrangeCorrelation { if (col1.has_foundFV0() && col2.has_foundFV0()) { auto slicedGlobalTracks = tracks.sliceBy(perColGlobal, col1.globalIndex()); auto slicedTriggerMftTracks = mfttracks.sliceBy(perColMft, col1.globalIndex()); - fillYieldFv0Mft(slicedTriggerMftTracks, true); + fillYield<4>(slicedTriggerMftTracks, true); const auto& fv0 = col2.foundFV0(); if (slicedGlobalTracks.size() < cfgMinMult || slicedGlobalTracks.size() >= cfgMaxMult) { continue; From ddf0bd15d0d393af308bdae389af427eaa6d9d67 Mon Sep 17 00:00:00 2001 From: jaimenorman Date: Tue, 29 Jul 2025 17:04:57 +0200 Subject: [PATCH 123/345] [PWGJE] take pT hard from event, add option to reject single track or jet outliers (#12262) --- PWGJE/Tasks/jetHadronRecoil.cxx | 146 +++++++++++++++++++++++--------- 1 file changed, 108 insertions(+), 38 deletions(-) diff --git a/PWGJE/Tasks/jetHadronRecoil.cxx b/PWGJE/Tasks/jetHadronRecoil.cxx index 211e7c1f7ed..c06ba1ebb1a 100644 --- a/PWGJE/Tasks/jetHadronRecoil.cxx +++ b/PWGJE/Tasks/jetHadronRecoil.cxx @@ -72,14 +72,15 @@ struct JetHadronRecoil { Configurable ptTTsigMax{"ptTTsigMax", 50, "signal maximum trigger track pt"}; Configurable fracSig{"fracSig", 0.9, "fraction of events to use for signal"}; Configurable jetR{"jetR", 0.4, "jet resolution parameter"}; - Configurable pTHatExponent{"pTHatExponent", 4.0, "exponent of the event weight for the calculation of pTHat"}; Configurable pTHatMaxMCD{"pTHatMaxMCD", 999.0, "maximum fraction of hard scattering for jet acceptance in detector MC"}; Configurable pTHatMaxMCP{"pTHatMaxMCP", 999.0, "maximum fraction of hard scattering for jet acceptance in particle MC"}; Configurable pTHatTrackMaxMCD{"pTHatTrackMaxMCD", 999.0, "maximum fraction of hard scattering for track acceptance in detector MC"}; Configurable pTHatTrackMaxMCP{"pTHatTrackMaxMCP", 999.0, "maximum fraction of hard scattering for track acceptance in particle MC"}; + Configurable pTHatMinEvent{"pTHatMinEvent", -1.0, "minimum absolute event pTHat"}; Configurable rhoReferenceShift{"rhoReferenceShift", 0.0, "shift in rho calculated in reference events for consistency with signal events"}; Configurable triggerMasks{"triggerMasks", "", "possible JE Trigger masks: fJetChLowPt,fJetChHighPt,fTrackLowPt,fTrackHighPt,fJetD0ChLowPt,fJetD0ChHighPt,fJetLcChLowPt,fJetLcChHighPt,fEMCALReadout,fJetFullHighPt,fJetFullLowPt,fJetNeutralHighPt,fJetNeutralLowPt,fGammaVeryHighPtEMCAL,fGammaVeryHighPtDCAL,fGammaHighPtEMCAL,fGammaHighPtDCAL,fGammaLowPtEMCAL,fGammaLowPtDCAL,fGammaVeryLowPtEMCAL,fGammaVeryLowPtDCAL"}; Configurable skipMBGapEvents{"skipMBGapEvents", false, "flag to choose to reject min. bias gap events; jet-level rejection applied at the jet finder level, here rejection is applied for collision and track process functions"}; + Configurable outlierRejectEvent{"outlierRejectEvent", true, "where outliers are found, reject event (true) or just reject the single track/jet (false)"}; Configurable wtaMethod{"wtaMethod", 1, "method for WTA axis definition: 0 = matching closest WTA jet (incorrect), 1 = recluster original jet"}; Preslice> partJetsPerCollision = aod::jet::mcCollisionId; @@ -204,7 +205,7 @@ struct JetHadronRecoil { } template - void fillHistograms(T const& jets, W const& jetsWTA, U const& tracks, float weight = 1.0, float rho = 0.0) + void fillHistograms(T const& jets, W const& jetsWTA, U const& tracks, float weight = 1.0, float rho = 0.0, float pTHat = 999.0) { bool isSigCol; std::vector phiTTAr; @@ -214,7 +215,6 @@ struct JetHadronRecoil { int trigNumber = 0; int nTT = 0; double leadingPT = 0; - float pTHat = 10. / (std::pow(weight, 1.0 / pTHatExponent)); float rhoReference = rho + rhoReferenceShift; float dice = rand->Rndm(); @@ -228,7 +228,11 @@ struct JetHadronRecoil { continue; } if (track.pt() > pTHatTrackMaxMCD * pTHat) { - return; + if (outlierRejectEvent) { + return; + } else { + continue; + } } if (isSigCol && track.pt() < ptTTsigMax && track.pt() > ptTTsigMin) { phiTTAr.push_back(track.phi()); @@ -269,10 +273,13 @@ struct JetHadronRecoil { registry.fill(HIST("hReferenceTriggersPtHard"), ptTT / pTHat, weight); } } - for (const auto& jet : jets) { if (jet.pt() > pTHatMaxMCD * pTHat) { - return; + if (outlierRejectEvent) { + return; + } else { + continue; + } } for (const auto& constituent : jet.template tracks_as()) { if (constituent.pt() > leadingPT) { @@ -331,7 +338,7 @@ struct JetHadronRecoil { } template - void fillMCPHistograms(T const& jets, W const& jetsWTA, U const& particles, float weight = 1.0) + void fillMCPHistograms(T const& jets, W const& jetsWTA, U const& particles, float weight = 1.0, float pTHat = 999.0) { bool isSigCol; std::vector phiTTAr; @@ -340,7 +347,6 @@ struct JetHadronRecoil { double ptTT = 0; int trigNumber = 0; int nTT = 0; - float pTHat = 10. / (std::pow(weight, 1.0 / pTHatExponent)); float dice = rand->Rndm(); if (dice < fracSig) @@ -350,7 +356,11 @@ struct JetHadronRecoil { for (const auto& particle : particles) { if (particle.pt() > pTHatTrackMaxMCD * pTHat) { - return; + if (outlierRejectEvent) { + return; + } else { + continue; + } } auto pdgParticle = pdg->GetParticle(particle.pdgCode()); if (!pdgParticle) { @@ -394,7 +404,11 @@ struct JetHadronRecoil { for (const auto& jet : jets) { if (jet.pt() > pTHatMaxMCP * pTHat) { - return; + if (outlierRejectEvent) { + return; + } else { + continue; + } } for (const auto& constituent : jet.template tracks_as()) { registry.fill(HIST("hConstituents3D"), constituent.pt(), constituent.eta(), constituent.phi()); @@ -439,15 +453,18 @@ struct JetHadronRecoil { } template - void fillMatchedHistograms(T const& jetsBase, V const& mcdjetsWTA, W const& mcpjetsWTA, U const&, X const& tracks, Y const& particles, float weight = 1.0, float rho = 0.0) + void fillMatchedHistograms(T const& jetsBase, V const& mcdjetsWTA, W const& mcpjetsWTA, U const&, X const& tracks, Y const& particles, float weight = 1.0, float rho = 0.0, float pTHat = 999.0) { for (const auto& jetBase : jetsBase) { double dR = 0; double dRp = 0; - float pTHat = 10. / (std::pow(weight, 1.0 / pTHatExponent)); if (jetBase.pt() > pTHatMaxMCD * pTHat) { - return; + if (outlierRejectEvent) { + return; + } else { + continue; + } } dR = getWTAaxisDifference(jetBase, mcdjetsWTA, tracks, true); @@ -455,7 +472,11 @@ struct JetHadronRecoil { if (jetBase.has_matchedJetGeo()) { for (const auto& jetTag : jetBase.template matchedJetGeo_as>()) { if (jetTag.pt() > pTHatMaxMCP * pTHat) { - return; + if (outlierRejectEvent) { + return; + } else { + continue; + } } dRp = getWTAaxisDifference(jetTag, mcpjetsWTA, particles, true); @@ -475,7 +496,7 @@ struct JetHadronRecoil { } template - void fillRecoilJetMatchedHistograms(T const& jetsBase, V const& mcdjetsWTA, W const& mcpjetsWTA, U const&, X const& tracks, Y const& particles, float weight = 1.0, float rho = 0.0) + void fillRecoilJetMatchedHistograms(T const& jetsBase, V const& mcdjetsWTA, W const& mcpjetsWTA, U const&, X const& tracks, Y const& particles, float weight = 1.0, float rho = 0.0, float pTHat = 999.0) { std::vector phiTTAr; std::vector phiTTArPart; @@ -483,7 +504,6 @@ struct JetHadronRecoil { double phiTTPart = 0; int trigNumber = 0; int nTT = 0; - float pTHat = 10. / (std::pow(weight, 1.0 / pTHatExponent)); for (const auto& track : tracks) { if (!track.has_mcParticle()) { @@ -493,7 +513,11 @@ struct JetHadronRecoil { continue; } if (track.pt() > pTHatTrackMaxMCD * pTHat) { - return; + if (outlierRejectEvent) { + return; + } else { + continue; + } } if (track.pt() < ptTTsigMax && track.pt() > ptTTsigMin) { phiTTAr.push_back(track.phi()); @@ -516,7 +540,11 @@ struct JetHadronRecoil { double dRp = 0; if (jetBase.pt() > pTHatMaxMCD * pTHat) { - return; + if (outlierRejectEvent) { + return; + } else { + continue; + } } float dphi = RecoDecay::constrainAngle(jetBase.phi() - phiTT); @@ -525,7 +553,11 @@ struct JetHadronRecoil { if (jetBase.has_matchedJetGeo()) { for (const auto& jetTag : jetBase.template matchedJetGeo_as>()) { if (jetTag.pt() > pTHatMaxMCP * pTHat) { - return; + if (outlierRejectEvent) { + return; + } else { + continue; + } } float dphip = RecoDecay::constrainAngle(jetTag.phi() - phiTTPart); @@ -578,7 +610,8 @@ struct JetHadronRecoil { } PROCESS_SWITCH(JetHadronRecoil, processDataWithRhoSubtraction, "process data with rho subtraction", false); - void processMCD(soa::Filtered::iterator const& collision, + void processMCD(soa::Filtered>::iterator const& collision, + aod::JMcCollisions const&, soa::Filtered> const& jets, soa::Filtered> const& jetsWTA, soa::Filtered const& tracks) @@ -592,12 +625,16 @@ struct JetHadronRecoil { if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { return; } + if (collision.mcCollision().ptHard() < pTHatMinEvent) { + return; + } registry.fill(HIST("hZvtxSelected"), collision.posZ()); - fillHistograms(jets, jetsWTA, tracks); + fillHistograms(jets, jetsWTA, tracks, 1.0, 0.0, collision.mcCollision().ptHard()); } PROCESS_SWITCH(JetHadronRecoil, processMCD, "process MC detector level", false); - void processMCDWithRhoSubtraction(soa::Filtered>::iterator const& collision, + void processMCDWithRhoSubtraction(soa::Filtered>::iterator const& collision, + aod::JMcCollisions const&, soa::Filtered> const& jets, soa::Filtered> const& jetsWTA, soa::Filtered const& tracks) @@ -611,8 +648,11 @@ struct JetHadronRecoil { if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { return; } + if (collision.mcCollision().ptHard() < pTHatMinEvent) { + return; + } registry.fill(HIST("hZvtxSelected"), collision.posZ()); - fillHistograms(jets, jetsWTA, tracks, 1.0, collision.rho()); + fillHistograms(jets, jetsWTA, tracks, 1.0, collision.rho(), collision.mcCollision().ptHard()); } PROCESS_SWITCH(JetHadronRecoil, processMCDWithRhoSubtraction, "process MC detector level with rho subtraction", false); @@ -631,8 +671,11 @@ struct JetHadronRecoil { if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { return; } + if (collision.mcCollision().ptHard() < pTHatMinEvent) { + return; + } registry.fill(HIST("hZvtxSelected"), collision.posZ(), collision.mcCollision().weight()); - fillHistograms(jets, jetsWTA, tracks, collision.mcCollision().weight()); + fillHistograms(jets, jetsWTA, tracks, collision.mcCollision().weight(), 0.0, collision.mcCollision().ptHard()); } PROCESS_SWITCH(JetHadronRecoil, processMCDWeighted, "process MC detector level with event weights", false); @@ -651,8 +694,11 @@ struct JetHadronRecoil { if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { return; } + if (collision.mcCollision().ptHard() < pTHatMinEvent) { + return; + } registry.fill(HIST("hZvtxSelected"), collision.posZ(), collision.mcCollision().weight()); - fillHistograms(jets, jetsWTA, tracks, collision.mcCollision().weight(), collision.rho()); + fillHistograms(jets, jetsWTA, tracks, collision.mcCollision().weight(), collision.rho(), collision.mcCollision().ptHard()); } PROCESS_SWITCH(JetHadronRecoil, processMCDWeightedWithRhoSubtraction, "process MC detector level with event weights and rho subtraction", false); @@ -667,8 +713,11 @@ struct JetHadronRecoil { if (skipMBGapEvents && collision.subGeneratorId() == jetderiveddatautilities::JCollisionSubGeneratorId::mbGap) { return; } + if (collision.ptHard() < pTHatMinEvent) { + return; + } registry.fill(HIST("hZvtxSelected"), collision.posZ()); - fillMCPHistograms(jets, jetsWTA, particles); + fillMCPHistograms(jets, jetsWTA, particles, 1.0, collision.ptHard()); } PROCESS_SWITCH(JetHadronRecoil, processMCP, "process MC particle level", false); @@ -683,12 +732,15 @@ struct JetHadronRecoil { if (skipMBGapEvents && collision.subGeneratorId() == jetderiveddatautilities::JCollisionSubGeneratorId::mbGap) { return; } + if (collision.ptHard() < pTHatMinEvent) { + return; + } registry.fill(HIST("hZvtxSelected"), collision.posZ(), collision.weight()); - fillMCPHistograms(jets, jetsWTA, particles, collision.weight()); + fillMCPHistograms(jets, jetsWTA, particles, collision.weight(), collision.ptHard()); } PROCESS_SWITCH(JetHadronRecoil, processMCPWeighted, "process MC particle level with event weights", false); - void processJetsMCPMCDMatched(soa::Filtered::iterator const& collision, + void processJetsMCPMCDMatched(soa::Filtered>::iterator const& collision, soa::Filtered> const& mcdjets, soa::Filtered> const& mcdjetsWTA, soa::Filtered> const& mcpjetsWTA, @@ -703,13 +755,16 @@ struct JetHadronRecoil { if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { return; } + if (collision.mcCollision().ptHard() < pTHatMinEvent) { + return; + } registry.fill(HIST("hZvtxSelected"), collision.posZ()); const auto& mcpjetsWTACut = mcpjetsWTA.sliceBy(partJetsPerCollision, collision.mcCollisionId()); fillMatchedHistograms(mcdjets, mcdjetsWTA, mcpjetsWTACut, mcpjets, tracks, particles); } PROCESS_SWITCH(JetHadronRecoil, processJetsMCPMCDMatched, "process MC matched (inc jets)", false); - void processJetsMCPMCDMatchedWithRhoSubtraction(soa::Filtered>::iterator const& collision, + void processJetsMCPMCDMatchedWithRhoSubtraction(soa::Filtered>::iterator const& collision, soa::Filtered> const& mcdjets, soa::Filtered> const& mcdjetsWTA, soa::Filtered> const& mcpjetsWTA, @@ -724,13 +779,16 @@ struct JetHadronRecoil { if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { return; } + if (collision.mcCollision().ptHard() < pTHatMinEvent) { + return; + } registry.fill(HIST("hZvtxSelected"), collision.posZ()); const auto& mcpjetsWTACut = mcpjetsWTA.sliceBy(partJetsPerCollision, collision.mcCollisionId()); - fillMatchedHistograms(mcdjets, mcdjetsWTA, mcpjetsWTACut, mcpjets, tracks, particles); + fillMatchedHistograms(mcdjets, mcdjetsWTA, mcpjetsWTACut, mcpjets, tracks, particles, 1.0, 0.0, collision.mcCollision().ptHard()); } PROCESS_SWITCH(JetHadronRecoil, processJetsMCPMCDMatchedWithRhoSubtraction, "process MC matched (inc jets) with rho subtraction", false); - void processJetsMCPMCDMatchedWeighted(soa::Filtered::iterator const& collision, + void processJetsMCPMCDMatchedWeighted(soa::Filtered>::iterator const& collision, soa::Filtered> const& mcdjets, soa::Filtered> const& mcdjetsWTA, soa::Filtered> const& mcpjetsWTA, @@ -745,13 +803,16 @@ struct JetHadronRecoil { if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { return; } + if (collision.mcCollision().ptHard() < pTHatMinEvent) { + return; + } registry.fill(HIST("hZvtxSelected"), collision.posZ()); const auto& mcpjetsWTACut = mcpjetsWTA.sliceBy(partJetsPerCollision, collision.mcCollisionId()); - fillMatchedHistograms(mcdjets, mcdjetsWTA, mcpjetsWTACut, mcpjets, tracks, particles, collision.mcCollision().weight()); + fillMatchedHistograms(mcdjets, mcdjetsWTA, mcpjetsWTACut, mcpjets, tracks, particles, collision.mcCollision().weight(), 0.0, collision.mcCollision().ptHard()); } PROCESS_SWITCH(JetHadronRecoil, processJetsMCPMCDMatchedWeighted, "process MC matched with event weights (inc jets)", false); - void processJetsMCPMCDMatchedWeightedWithRhoSubtraction(soa::Filtered>::iterator const& collision, + void processJetsMCPMCDMatchedWeightedWithRhoSubtraction(soa::Filtered>::iterator const& collision, soa::Filtered> const& mcdjets, soa::Filtered> const& mcdjetsWTA, soa::Filtered> const& mcpjetsWTA, @@ -766,13 +827,16 @@ struct JetHadronRecoil { if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { return; } + if (collision.mcCollision().ptHard() < pTHatMinEvent) { + return; + } registry.fill(HIST("hZvtxSelected"), collision.posZ()); const auto& mcpjetsWTACut = mcpjetsWTA.sliceBy(partJetsPerCollision, collision.mcCollisionId()); - fillMatchedHistograms(mcdjets, mcdjetsWTA, mcpjetsWTACut, mcpjets, tracks, particles, collision.mcCollision().weight(), collision.rho()); + fillMatchedHistograms(mcdjets, mcdjetsWTA, mcpjetsWTACut, mcpjets, tracks, particles, collision.mcCollision().weight(), collision.rho(), collision.mcCollision().ptHard()); } PROCESS_SWITCH(JetHadronRecoil, processJetsMCPMCDMatchedWeightedWithRhoSubtraction, "process MC matched with event weights (inc jets) and rho subtraction", false); - void processRecoilJetsMCPMCDMatched(soa::Filtered::iterator const& collision, + void processRecoilJetsMCPMCDMatched(soa::Filtered>::iterator const& collision, soa::Filtered> const& mcdjets, soa::Filtered> const& mcdjetsWTA, soa::Filtered> const& mcpjetsWTA, @@ -787,13 +851,16 @@ struct JetHadronRecoil { if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { return; } + if (collision.mcCollision().ptHard() < pTHatMinEvent) { + return; + } registry.fill(HIST("hZvtxSelected"), collision.posZ()); const auto& mcpjetsWTACut = mcpjetsWTA.sliceBy(partJetsPerCollision, collision.mcCollisionId()); - fillRecoilJetMatchedHistograms(mcdjets, mcdjetsWTA, mcpjetsWTACut, mcpjets, tracks, particles); + fillRecoilJetMatchedHistograms(mcdjets, mcdjetsWTA, mcpjetsWTACut, mcpjets, tracks, particles, 1.0, 0.0, collision.mcCollision().ptHard()); } PROCESS_SWITCH(JetHadronRecoil, processRecoilJetsMCPMCDMatched, "process MC matched (recoil jets)", false); - void processRecoilJetsMCPMCDMatchedWeighted(soa::Filtered::iterator const& collision, + void processRecoilJetsMCPMCDMatchedWeighted(soa::Filtered>::iterator const& collision, soa::Filtered> const& mcdjets, soa::Filtered> const& mcdjetsWTA, soa::Filtered> const& mcpjetsWTA, @@ -808,9 +875,12 @@ struct JetHadronRecoil { if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { return; } + if (collision.mcCollision().ptHard() < pTHatMinEvent) { + return; + } registry.fill(HIST("hZvtxSelected"), collision.posZ()); const auto& mcpjetsWTACut = mcpjetsWTA.sliceBy(partJetsPerCollision, collision.mcCollisionId()); - fillRecoilJetMatchedHistograms(mcdjets, mcdjetsWTA, mcpjetsWTACut, mcpjets, tracks, particles, collision.mcCollision().weight()); + fillRecoilJetMatchedHistograms(mcdjets, mcdjetsWTA, mcpjetsWTACut, mcpjets, tracks, particles, collision.mcCollision().weight(), 0.0, collision.mcCollision().ptHard()); } PROCESS_SWITCH(JetHadronRecoil, processRecoilJetsMCPMCDMatchedWeighted, "process MC matched with event weights (recoil jets)", false); From 933d0813b93cd01bbf9ad70207379e701cfb63c7 Mon Sep 17 00:00:00 2001 From: Maximiliano Puccio Date: Tue, 29 Jul 2025 18:47:35 +0200 Subject: [PATCH 124/345] [Trigger] Support for the new lumi-task output (#12312) --- EventFiltering/macros/uploadOTSobjects.C | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/EventFiltering/macros/uploadOTSobjects.C b/EventFiltering/macros/uploadOTSobjects.C index 2a9be2de17e..8e4c6c27136 100644 --- a/EventFiltering/macros/uploadOTSobjects.C +++ b/EventFiltering/macros/uploadOTSobjects.C @@ -67,6 +67,13 @@ void uploadOTSobjects(std::string inputList, std::string passName, bool useAlien api.storeAsTFile(scalers, baseCCDBpath + "FilterCounters", metadata, duration.first, duration.second + 1); api.storeAsTFile(filters, baseCCDBpath + "SelectionCounters", metadata, duration.first, duration.second + 1); TH1* hCounterTVX = static_cast(scalersFile->Get("bc-selection-task/hCounterTVX")); + if (!hCounterTVX) { + hCounterTVX = static_cast(scalersFile->Get("lumi-task/hCounterTVX")); + if (!hCounterTVX) { + std::cout << "No hCounterTVX histogram found in the file, skipping upload for run " << runString << std::endl; + continue; + } + } api.storeAsTFile(hCounterTVX, baseCCDBpath + "InspectedTVX", metadata, duration.first, duration.second + 1); std::vector zorroHelpers; From 7a1614006eae26f81c02044881394291f7b3c39d Mon Sep 17 00:00:00 2001 From: Stefano Cannito <143754257+scannito@users.noreply.github.com> Date: Tue, 29 Jul 2025 20:52:02 +0200 Subject: [PATCH 125/345] [PWGLF] More on systematics for dNdeta with phi trigger (#12318) --- .../Tasks/Strangeness/phik0shortanalysis.cxx | 77 ++++++++++++++----- 1 file changed, 56 insertions(+), 21 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx b/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx index ca6ba09680d..b38931be584 100644 --- a/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx +++ b/PWGLF/Tasks/Strangeness/phik0shortanalysis.cxx @@ -78,6 +78,12 @@ enum { kSpNotPrimary }; +enum { + kNoGenpTVar = 0, + kGenpTup, + kGenpTdown +}; + struct Phik0shortanalysis { // Histograms are defined with HistogramRegistry HistogramRegistry dataEventHist{"dataEventHist", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; @@ -121,6 +127,7 @@ struct Phik0shortanalysis { Configurable cfgMinAbsCharge{"cfgMinAbsCharge", 3.0f, "Cut on absolute charge"}; Configurable cfgGlobalWoDCATrack{"cfgGlobalWoDCATrack", true, "Global track selection without DCA"}; Configurable cfgPVContributor{"cfgPVContributor", true, "PV contributor track selection"}; + Configurable cMinChargedParticlePtcut{"cMinChargedParticlePtcut", 0.1f, "Track minimum pt cut"}; Configurable cMinKaonPtcut{"cMinKaonPtcut", 0.15f, "Track minimum pt cut"}; Configurable etaMax{"etaMax", 0.8f, "eta max"}; Configurable pTToUseTOF{"pTToUseTOF", 0.5f, "pT above which use TOF"}; @@ -148,6 +155,9 @@ struct Phik0shortanalysis { Configurable maxChi2TPC{"maxChi2TPC", 4.0f, "max chi2 per cluster TPC"}; Configurable minITSnCls{"minITSnCls", 4, "min number of ITS clusters"}; Configurable maxChi2ITS{"maxChi2ITS", 36.0f, "max chi2 per cluster ITS"}; + + Configurable applyExtraPhiCuts{"applyExtraPhiCuts", false, "Enable extra phi cut"}; + Configurable> extraPhiCuts{"extraPhiCuts", {3.07666f, 3.12661f, 0.03f, 6.253f}, "Extra phi cuts"}; } trackConfigs; // Configurables on phi pT bins @@ -315,10 +325,11 @@ struct Phik0shortanalysis { AxisSpec sigmassPhiAxis = {nBinsMPhi, lowMPhi, upMPhi, "#it{M}_{inv} [GeV/#it{c}^{2}]"}; AxisSpec massK0SAxis = {200, 0.45f, 0.55f, "#it{M}_{inv} [GeV/#it{c}^{2}]"}; AxisSpec nSigmaPiAxis = {100, -10.0f, 10.0f, "N#sigma #pi"}; - AxisSpec vertexZAxis = {100, -15.f, 15.f, "vrtx_{Z} [cm]"}; + AxisSpec vertexZAxis = {100, -cutZVertex, cutZVertex, "vrtx_{Z} [cm]"}; AxisSpec etaAxis = {16, -trackConfigs.etaMax, trackConfigs.etaMax, "#eta"}; AxisSpec yAxis = {deltaYConfigs.nBinsY, -deltaYConfigs.cfgYAcceptance, deltaYConfigs.cfgYAcceptance, "#it{y}"}; AxisSpec deltayAxis = {deltaYConfigs.nBinsDeltaY, -1.0f, 1.0f, "#Delta#it{y}"}; + AxisSpec phiAxis = {629, 0, o2::constants::math::TwoPI, "#phi"}; AxisSpec multAxis = {120, 0.0f, 120.0f, "centFT0M"}; AxisSpec binnedmultAxis{(std::vector)binsMult, "centFT0M"}; AxisSpec pTPhiAxis = {120, 0.0f, 12.0f, "#it{p}_{T} (GeV/#it{c})"}; @@ -345,7 +356,7 @@ struct Phik0shortanalysis { dataEventHist.add("h2VertexZvsMult", "Vertex Z vs Multiplicity Percentile", kTH2F, {vertexZAxis, binnedmultAxis}); // Eta distribution for dN/deta values estimation in Data - dataEventHist.add("h4EtaDistribution", "Eta vs multiplicity in Data", kTHnSparseF, {vertexZAxis, binnedmultAxis, etaAxis, {3, -0.5f, 2.5f}}); + dataEventHist.add("h5EtaDistribution", "Eta vs multiplicity in Data", kTHnSparseF, {vertexZAxis, binnedmultAxis, etaAxis, phiAxis, {3, -0.5f, 2.5f}}); // Number of MC events per selection for Rec and Gen mcEventHist.add("hRecMCEventSelection", "hRecMCEventSelection", kTH1F, {{9, -0.5f, 8.5f}}); @@ -380,13 +391,13 @@ struct Phik0shortanalysis { mcEventHist.add("h2GenMCRecoVertexZvsMult", "GenMCReco Vertex Z vs Multiplicity Percentile", kTH2F, {vertexZAxis, binnedmultAxis}); // Eta distribution for dN/deta values estimation in MC - mcEventHist.add("h5RecoMCEtaDistribution", "Eta vs multiplicity in MCReco", kTHnSparseF, {vertexZAxis, binnedmultAxis, etaAxis, {3, -0.5f, 2.5f}, {6, -0.5f, 5.5f}}); - mcEventHist.add("h5RecoCheckMCEtaDistribution", "Eta vs multiplicity in MCReco Check", kTHnSparseF, {vertexZAxis, binnedmultAxis, etaAxis, {3, -0.5f, 2.5f}, {6, -0.5f, 5.5f}}); + mcEventHist.add("h6RecoMCEtaDistribution", "Eta vs multiplicity in MCReco", kTHnSparseF, {vertexZAxis, binnedmultAxis, etaAxis, phiAxis, {6, -0.5f, 5.5f}, {3, -0.5f, 2.5f}}); + mcEventHist.add("h6RecoCheckMCEtaDistribution", "Eta vs multiplicity in MCReco Check", kTHnSparseF, {vertexZAxis, binnedmultAxis, etaAxis, phiAxis, {6, -0.5f, 5.5f}, {3, -0.5f, 2.5f}}); mcEventHist.add("h2GenMCEtaDistribution", "Eta vs multiplicity in MCGen", kTH2F, {binnedmultAxis, etaAxis}); mcEventHist.add("h2GenMCEtaDistributionAssocReco", "Eta vs multiplicity in MCGen Assoc Reco", kTH2F, {binnedmultAxis, etaAxis}); - mcEventHist.add("h4GenMCEtaDistributionReco", "Eta vs multiplicity in MCGen Reco", kTHnSparseF, {vertexZAxis, binnedmultAxis, etaAxis, {6, -0.5f, 5.5f}}); - mcEventHist.add("h4GenMCEtaDistributionRecoCheck", "Eta vs multiplicity in MCGen Reco Check", kTHnSparseF, {vertexZAxis, binnedmultAxis, etaAxis, {6, -0.5f, 5.5f}}); + mcEventHist.add("h6GenMCEtaDistributionReco", "Eta vs multiplicity in MCGen Reco", kTHnSparseF, {vertexZAxis, binnedmultAxis, etaAxis, phiAxis, {6, -0.5f, 5.5f}, {3, -0.5f, 2.5f}}); + mcEventHist.add("h6GenMCEtaDistributionRecoCheck", "Eta vs multiplicity in MCGen Reco Check", kTHnSparseF, {vertexZAxis, binnedmultAxis, etaAxis, phiAxis, {6, -0.5f, 5.5f}, {3, -0.5f, 2.5f}}); // Phi topological/PID cuts dataPhiHist.add("h2DauTracksPhiDCAxyPreCutData", "Dcaxy distribution vs pt before DCAxy cut", kTH2F, {{100, 0.0, 5.0, "#it{p}_{T} (GeV/#it{c})"}, {2000, -0.05, 0.05, "DCA_{xy} (cm)"}}); @@ -2485,11 +2496,15 @@ struct Phik0shortanalysis { dataEventHist.fill(HIST("h2VertexZvsMult"), collision.posZ(), collision.centFT0M()); for (const auto& track : filteredTracks) { - dataEventHist.fill(HIST("h4EtaDistribution"), collision.posZ(), collision.centFT0M(), track.eta(), kGlobalplusITSonly); + if (trackConfigs.applyExtraPhiCuts && ((track.phi() > trackConfigs.extraPhiCuts->at(0) && track.phi() < trackConfigs.extraPhiCuts->at(1)) || + track.phi() <= trackConfigs.extraPhiCuts->at(2) || track.phi() >= trackConfigs.extraPhiCuts->at(3))) + continue; + + dataEventHist.fill(HIST("h5EtaDistribution"), collision.posZ(), collision.centFT0M(), track.eta(), track.phi(), kGlobalplusITSonly); if (track.hasTPC()) { - dataEventHist.fill(HIST("h4EtaDistribution"), collision.posZ(), collision.centFT0M(), track.eta(), kGlobalonly); + dataEventHist.fill(HIST("h5EtaDistribution"), collision.posZ(), collision.centFT0M(), track.eta(), track.phi(), kGlobalonly); } else { - dataEventHist.fill(HIST("h4EtaDistribution"), collision.posZ(), collision.centFT0M(), track.eta(), kITSonly); + dataEventHist.fill(HIST("h5EtaDistribution"), collision.posZ(), collision.centFT0M(), track.eta(), track.phi(), kITSonly); } } } @@ -2515,6 +2530,9 @@ struct Phik0shortanalysis { mcEventHist.fill(HIST("h2RecoMCVertexZvsMult"), collision.posZ(), mcCollision.centFT0M()); for (const auto& track : filteredMCTracks) { + if (trackConfigs.applyExtraPhiCuts && ((track.phi() > trackConfigs.extraPhiCuts->at(0) && track.phi() < trackConfigs.extraPhiCuts->at(1)) || + track.phi() <= trackConfigs.extraPhiCuts->at(2) || track.phi() >= trackConfigs.extraPhiCuts->at(3))) + continue; if (!track.has_mcParticle()) continue; @@ -2522,25 +2540,32 @@ struct Phik0shortanalysis { if (!mcTrack.isPhysicalPrimary() || std::abs(mcTrack.eta()) > trackConfigs.etaMax) continue; - mcEventHist.fill(HIST("h5RecoMCEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcTrack.eta(), kGlobalplusITSonly, kSpAll); + mcEventHist.fill(HIST("h6RecoMCEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcTrack.eta(), mcTrack.phi(), kSpAll, kGlobalplusITSonly); if (track.hasTPC()) { - mcEventHist.fill(HIST("h5RecoMCEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcTrack.eta(), kGlobalonly, kSpAll); + mcEventHist.fill(HIST("h6RecoMCEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcTrack.eta(), mcTrack.phi(), kSpAll, kGlobalonly); } else { - mcEventHist.fill(HIST("h5RecoMCEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcTrack.eta(), kITSonly, kSpAll); + mcEventHist.fill(HIST("h6RecoMCEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcTrack.eta(), mcTrack.phi(), kSpAll, kITSonly); } int pid = fromPDGToEnum(mcTrack.pdgCode()); - mcEventHist.fill(HIST("h5RecoMCEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcTrack.eta(), kGlobalplusITSonly, pid); + mcEventHist.fill(HIST("h6RecoMCEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcTrack.eta(), mcTrack.phi(), pid, kGlobalplusITSonly); } for (const auto& mcParticle : mcParticlesThisColl) { if (!isGenParticleCharged(mcParticle)) continue; - mcEventHist.fill(HIST("h4GenMCEtaDistributionReco"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), kSpAll); + mcEventHist.fill(HIST("h6GenMCEtaDistributionReco"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kNoGenpTVar); + if (mcParticle.pt() < trackConfigs.cMinChargedParticlePtcut) { + mcEventHist.fill(HIST("h6GenMCEtaDistributionReco"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTup, -10.0f * mcParticle.pt() + 2.0f); + mcEventHist.fill(HIST("h6GenMCEtaDistributionReco"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTdown, 5.0f * mcParticle.pt() + 0.5f); + } else { + mcEventHist.fill(HIST("h6GenMCEtaDistributionReco"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTup); + mcEventHist.fill(HIST("h6GenMCEtaDistributionReco"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTdown); + } int pid = fromPDGToEnum(mcParticle.pdgCode()); - mcEventHist.fill(HIST("h4GenMCEtaDistributionReco"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), pid); + mcEventHist.fill(HIST("h6GenMCEtaDistributionReco"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), pid, kNoGenpTVar); } } @@ -2563,6 +2588,9 @@ struct Phik0shortanalysis { auto filteredMCTracksThisColl = filteredMCTracks.sliceBy(preslices.perColl, collision.globalIndex()); for (const auto& track : filteredMCTracksThisColl) { + if (trackConfigs.applyExtraPhiCuts && ((track.phi() > trackConfigs.extraPhiCuts->at(0) && track.phi() < trackConfigs.extraPhiCuts->at(1)) || + track.phi() <= trackConfigs.extraPhiCuts->at(2) || track.phi() >= trackConfigs.extraPhiCuts->at(3))) + continue; if (!track.has_mcParticle()) continue; @@ -2570,25 +2598,32 @@ struct Phik0shortanalysis { if (!mcTrack.isPhysicalPrimary() || std::abs(mcTrack.eta()) > trackConfigs.etaMax) continue; - mcEventHist.fill(HIST("h5RecoCheckMCEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcTrack.eta(), kGlobalplusITSonly, kSpAll); + mcEventHist.fill(HIST("h6RecoCheckMCEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcTrack.eta(), mcTrack.phi(), kSpAll, kGlobalplusITSonly); if (track.hasTPC()) { - mcEventHist.fill(HIST("h5RecoCheckMCEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcTrack.eta(), kGlobalonly, kSpAll); + mcEventHist.fill(HIST("h6RecoCheckMCEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcTrack.eta(), mcTrack.phi(), kSpAll, kGlobalonly); } else { - mcEventHist.fill(HIST("h5RecoCheckMCEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcTrack.eta(), kITSonly, kSpAll); + mcEventHist.fill(HIST("h6RecoCheckMCEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcTrack.eta(), mcTrack.phi(), kSpAll, kITSonly); } int pid = fromPDGToEnum(mcTrack.pdgCode()); - mcEventHist.fill(HIST("h5RecoCheckMCEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcTrack.eta(), kGlobalplusITSonly, pid); + mcEventHist.fill(HIST("h6RecoCheckMCEtaDistribution"), collision.posZ(), mcCollision.centFT0M(), mcTrack.eta(), mcTrack.phi(), pid, kGlobalplusITSonly); } for (const auto& mcParticle : mcParticles) { if (!isGenParticleCharged(mcParticle)) continue; - mcEventHist.fill(HIST("h4GenMCEtaDistributionRecoCheck"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), kSpAll); + mcEventHist.fill(HIST("h6GenMCEtaDistributionRecoCheck"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kNoGenpTVar); + if (mcParticle.pt() < trackConfigs.cMinChargedParticlePtcut) { + mcEventHist.fill(HIST("h6GenMCEtaDistributionRecoCheck"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTup, -10.0f * mcParticle.pt() + 2.0f); + mcEventHist.fill(HIST("h6GenMCEtaDistributionRecoCheck"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTdown, 5.0f * mcParticle.pt() + 0.5f); + } else { + mcEventHist.fill(HIST("h6GenMCEtaDistributionRecoCheck"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTup); + mcEventHist.fill(HIST("h6GenMCEtaDistributionRecoCheck"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), kSpAll, kGenpTdown); + } int pid = fromPDGToEnum(mcParticle.pdgCode()); - mcEventHist.fill(HIST("h4GenMCEtaDistributionRecoCheck"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), pid); + mcEventHist.fill(HIST("h6GenMCEtaDistributionRecoCheck"), collision.posZ(), mcCollision.centFT0M(), mcParticle.eta(), mcParticle.phi(), pid, kNoGenpTVar); } numberAssocColl++; From 196fc53d618d8a2a0bc026397cf11f7201b6ee72 Mon Sep 17 00:00:00 2001 From: a-m-andrushko <96832230+a-m-andrushko@users.noreply.github.com> Date: Tue, 29 Jul 2025 21:28:09 +0200 Subject: [PATCH 126/345] [PWGCF] FemtoUniverse -- Add MC analysis to debug-V0 task. (#12307) --- .../Tasks/femtoUniverseDebugV0.cxx | 164 +++++++++++++----- 1 file changed, 119 insertions(+), 45 deletions(-) diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniverseDebugV0.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniverseDebugV0.cxx index fe1bf2e7983..f82657be1d9 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniverseDebugV0.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniverseDebugV0.cxx @@ -13,25 +13,30 @@ /// \brief Tasks that reads the particle tables and fills QA histograms for V0s /// \author Luca Barioglio, TU München, luca.barioglio@cern.ch /// \author Zuzanna Chochulska, WUT Warsaw & CTU Prague, zchochul@cern.ch +/// \author Anna-Mariia Andrushko, WUT Warsaw, anna-mariia.andrushko@cern.ch -#include -#include -#include -#include +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseEventHisto.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseMath.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseParticleHisto.h" +#include "PWGCF/FemtoUniverse/Core/femtoUtils.h" +#include "PWGCF/FemtoUniverse/DataModel/FemtoDerived.h" + +#include "Common/DataModel/PIDResponse.h" + +#include "DataFormatsParameters/GRPObject.h" +#include "Framework/ASoAHelpers.h" #include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" #include "Framework/HistogramRegistry.h" -#include "Framework/ASoAHelpers.h" +#include "Framework/O2DatabasePDGPlugin.h" #include "Framework/RunningWorkflowInfo.h" #include "Framework/StepTHn.h" -#include "Framework/O2DatabasePDGPlugin.h" -#include "DataFormatsParameters/GRPObject.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/PID.h" -#include "PWGCF/FemtoUniverse/DataModel/FemtoDerived.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniverseParticleHisto.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniverseEventHisto.h" -#include "PWGCF/FemtoUniverse/Core/femtoUtils.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniverseMath.h" +#include + +#include +#include using namespace o2; using namespace o2::analysis::femto_universe; @@ -45,51 +50,70 @@ struct FemtoUniverseDebugV0 { SliceCache cache; - Configurable confPDGCodeV0{"confPDGCodeV0", 3122, "V0 -- PDG code"}; - Configurable confPDGCodePositiveChild{"confPDGCodePositiveChild", 2212, "Positive Child -- PDG code"}; - Configurable confPDGCodeNegativeChild{"confPDGCodeNegativeChild", 211, "Negative Child -- PDG code"}; - Configurable confCutV0{"confCutV0", 338, "V0 -- Selection bit from cutCulator"}; - ConfigurableAxis confV0TempFitVarBins{"confV0TempFitVarBins", {300, 0.95, 1.}, "V0: binning of the TempFitVar in the pT vs. TempFitVar plot"}; - ConfigurableAxis confV0TempFitVarpTBins{"confV0TempFitVarpTBins", {20, 0.5, 4.05}, "V0: pT binning of the pT vs. TempFitVar plot"}; - - Configurable confCutPositiveChild{"confCutPositiveChild", 150, "Positive Child of V0 -- Selection bit from cutCulator"}; - Configurable confCutNegativeChild{"confCutNegativeChild", 149, "Negative Child of V0 -- Selection bit from cutCulator"}; - Configurable confPositiveChildPIDnSigmaMax{"confPositiveChildPIDnSigmaMax", 3.f, "Positive Child of V0 -- Selection bit from cutCulator"}; - Configurable confNegativeChildPIDnSigmaMax{"confNegativeChildPIDnSigmaMax", 3.f, "Negative Child of V0 -- Selection bit from cutCulator"}; - Configurable confPositiveChildIndex{"confPositiveChildIndex", 1, "Positive Child of V0 -- Index from cutCulator"}; - Configurable confNegativeChildIndex{"confNegativeChildIndex", 0, "Negative Child of V0 -- Index from cutCulator"}; - Configurable> confChildPIDnSigmaMax{"confChildPIDnSigmaMax", std::vector{4.f, 3.f}, "V0 child selection: max. PID nSigma TPC"}; - Configurable confChildnSpecies{"confChildnSpecies", 2, "Number of particle spieces (for V0 children) with PID info"}; - ConfigurableAxis confChildTempFitVarBins{"confChildTempFitVarBins", {300, -0.15, 0.15}, "V0 child: binning of the TempFitVar in the pT vs. TempFitVar plot"}; - ConfigurableAxis confChildTempFitVarpTBins{"confChildTempFitVarpTBins", {20, 0.5, 4.05}, "V0 child: pT binning of the pT vs. TempFitVar plot"}; - + /// V0 configurables + struct : o2::framework::ConfigurableGroup { + Configurable confPDGCodeV0{"confPDGCodeV0", 3122, "V0 -- PDG code"}; + Configurable confPDGCodePositiveChild{"confPDGCodePositiveChild", 2212, "Positive Child -- PDG code"}; + Configurable confPDGCodeNegativeChild{"confPDGCodeNegativeChild", 211, "Negative Child -- PDG code"}; + Configurable confCutV0{"confCutV0", 338, "V0 -- Selection bit from cutCulator"}; + ConfigurableAxis confV0TempFitVarBins{"confV0TempFitVarBins", {300, 0.95, 1.}, "V0: binning of the TempFitVar in the pT vs. TempFitVar plot"}; + ConfigurableAxis confV0TempFitVarpTBins{"confV0TempFitVarpTBins", {20, 0.5, 4.05}, "V0: pT binning of the pT vs. TempFitVar plot"}; + } V0configs; // o2-linter: disable=name/function-variable + + /// Children configurables + struct : o2::framework::ConfigurableGroup { + Configurable confCutPositiveChild{"confCutPositiveChild", 150, "Positive Child of V0 -- Selection bit from cutCulator"}; + Configurable confCutNegativeChild{"confCutNegativeChild", 149, "Negative Child of V0 -- Selection bit from cutCulator"}; + Configurable confPositiveChildPIDnSigmaMax{"confPositiveChildPIDnSigmaMax", 3.f, "Positive Child of V0 -- Selection bit from cutCulator"}; + Configurable confNegativeChildPIDnSigmaMax{"confNegativeChildPIDnSigmaMax", 3.f, "Negative Child of V0 -- Selection bit from cutCulator"}; + Configurable confPositiveChildIndex{"confPositiveChildIndex", 1, "Positive Child of V0 -- Index from cutCulator"}; + Configurable confNegativeChildIndex{"confNegativeChildIndex", 0, "Negative Child of V0 -- Index from cutCulator"}; + Configurable> confChildPIDnSigmaMax{"confChildPIDnSigmaMax", std::vector{4.f, 3.f}, "V0 child selection: max. PID nSigma TPC"}; + Configurable confChildnSpecies{"confChildnSpecies", 2, "Number of particle spieces (for V0 children) with PID info"}; + ConfigurableAxis confChildTempFitVarBins{"confChildTempFitVarBins", {300, -0.15, 0.15}, "V0 child: binning of the TempFitVar in the pT vs. TempFitVar plot"}; + ConfigurableAxis confChildTempFitVarpTBins{"confChildTempFitVarpTBins", {20, 0.5, 4.05}, "V0 child: pT binning of the pT vs. TempFitVar plot"}; + } childconfigs; + + Configurable confIsMC{"confIsMC", false, "Enable additional histograms in the case of a Monte Carlo run"}; + + /// Partitioning using FemtoFullParticles = soa::Join; - Partition partsOne = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kV0)) && ((aod::femtouniverseparticle::cut & confCutV0) == confCutV0); + + Partition partsOne = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kV0)) && ((aod::femtouniverseparticle::cut & V0configs.confCutV0) == V0configs.confCutV0); + + Partition> partsOneMC = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kV0)) && ((aod::femtouniverseparticle::cut & V0configs.confCutV0) == V0configs.confCutV0); + Preslice perCol = aod::femtouniverseparticle::fdCollisionId; /// Histogramming FemtoUniverseEventHisto eventHisto; FemtoUniverseParticleHisto positiveChildHistos; FemtoUniverseParticleHisto negativeChildHistos; - FemtoUniverseParticleHisto V0Histos; + FemtoUniverseParticleHisto V0Histos; // o2-linter: disable=name/function-variable /// Histogram output - HistogramRegistry EventRegistry{"Event", {}, OutputObjHandlingPolicy::AnalysisObject}; - HistogramRegistry V0Registry{"FullV0QA", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry eventRegistry{"Event", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry V0Registry{"FullV0QA", {}, OutputObjHandlingPolicy::AnalysisObject}; // o2-linter: disable=name/function-variable HistogramRegistry thetaRegistry{"ThetaQA", {}, OutputObjHandlingPolicy::AnalysisObject}; void init(InitContext&) { - eventHisto.init(&EventRegistry); - positiveChildHistos.init(&V0Registry, confChildTempFitVarpTBins, confChildTempFitVarBins, false, confPDGCodePositiveChild.value, true); - negativeChildHistos.init(&V0Registry, confChildTempFitVarpTBins, confChildTempFitVarBins, false, confPDGCodeNegativeChild, true); - V0Histos.init(&V0Registry, confV0TempFitVarpTBins, confV0TempFitVarBins, false, confPDGCodeV0.value, true); + eventHisto.init(&eventRegistry); + positiveChildHistos.init(&V0Registry, childconfigs.confChildTempFitVarpTBins, childconfigs.confChildTempFitVarBins, confIsMC, V0configs.confPDGCodePositiveChild.value, true); + negativeChildHistos.init(&V0Registry, childconfigs.confChildTempFitVarpTBins, childconfigs.confChildTempFitVarBins, confIsMC, V0configs.confPDGCodeNegativeChild.value, true); + V0Histos.init(&V0Registry, V0configs.confV0TempFitVarpTBins, V0configs.confV0TempFitVarBins, confIsMC, V0configs.confPDGCodeV0.value, true); thetaRegistry.add("Theta/hTheta", " ; p (GeV/#it{c}); cos(#theta)", kTH2F, {{100, 0, 10}, {110, -1.1, 1.1}}); + thetaRegistry.add("Theta/PositiveChild/hThetaPt", " ; p_{T} (GeV/#it{c}); cos(#theta)", kTH2F, {{100, 0, 10}, {110, -1.1, 1.1}}); + thetaRegistry.add("Theta/PositiveChild/hThetaEta", " ; #eta; cos(#theta)", kTH2F, {{100, -1, 1}, {110, -1.1, 1.1}}); + thetaRegistry.add("Theta/PositiveChild/hThetaPhi", " ; #phi; cos(#theta)", kTH2F, {{100, -1, 7}, {110, -1.1, 1.1}}); + thetaRegistry.add("Theta/NegativeChild/hThetaPt", " ; p_{T} (GeV/#it{c}); cos(#theta)", kTH2F, {{100, 0, 10}, {110, -1.1, 1.1}}); + thetaRegistry.add("Theta/NegativeChild/hThetaEta", " ; #eta; cos(#theta)", kTH2F, {{100, -1, 1}, {110, -1.1, 1.1}}); + thetaRegistry.add("Theta/NegativeChild/hThetaPhi", " ; #phi; cos(#theta)", kTH2F, {{100, -1, 7}, {110, -1.1, 1.1}}); } - /// Produce QA plots for V0 selection in FemtoUniverse framework - void process(o2::aod::FdCollision const& col, FemtoFullParticles const& parts) + /// Produce QA plots for V0 and its children on real data + void processData(o2::aod::FdCollision const& col, FemtoFullParticles const& parts) { auto groupPartsOne = partsOne->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); eventHisto.fillQA(col); @@ -107,20 +131,70 @@ struct FemtoUniverseDebugV0 { // Check cuts on V0 children if (positiveChild.partType() == uint8_t(aod::femtouniverseparticle::ParticleType::kV0Child) && negativeChild.partType() == uint8_t(aod::femtouniverseparticle::ParticleType::kV0Child) && - isFullPIDSelected(positiveChild.pidCut(), positiveChild.p(), 999.f, confPositiveChildIndex.value, confChildnSpecies.value, confChildPIDnSigmaMax.value, confPositiveChildPIDnSigmaMax.value, 1.f) && - isFullPIDSelected(negativeChild.pidCut(), negativeChild.p(), 999.f, confNegativeChildIndex.value, confChildnSpecies.value, confChildPIDnSigmaMax.value, confNegativeChildPIDnSigmaMax.value, 1.f)) { - auto positiveChildMass = pdg->Mass(confPDGCodePositiveChild); - auto negativeChildMass = pdg->Mass(confPDGCodeNegativeChild); + isFullPIDSelected(positiveChild.pidCut(), positiveChild.p(), 999.f, childconfigs.confPositiveChildIndex.value, childconfigs.confChildnSpecies.value, childconfigs.confChildPIDnSigmaMax.value, childconfigs.confPositiveChildPIDnSigmaMax.value, 1.f) && + isFullPIDSelected(negativeChild.pidCut(), negativeChild.p(), 999.f, childconfigs.confNegativeChildIndex.value, childconfigs.confChildnSpecies.value, childconfigs.confChildPIDnSigmaMax.value, childconfigs.confNegativeChildPIDnSigmaMax.value, 1.f)) { + auto positiveChildMass = pdg->Mass(V0configs.confPDGCodePositiveChild); + auto negativeChildMass = pdg->Mass(V0configs.confPDGCodeNegativeChild); + auto positiveChildBoosted = FemtoUniverseMath::boostPRF(positiveChild, positiveChildMass, negativeChild, negativeChildMass); + auto cosineTheta = (positiveChildBoosted.Px() * part.px() + positiveChildBoosted.Py() * part.py() + positiveChildBoosted.Pz() * part.pz()) / (positiveChildBoosted.P() * part.p()); + + V0Histos.fillQA(part); + positiveChildHistos.fillQA(positiveChild); + negativeChildHistos.fillQA(negativeChild); + + thetaRegistry.fill(HIST("Theta/hTheta"), part.p(), cosineTheta); + thetaRegistry.fill(HIST("Theta/PositiveChild/hThetaPt"), positiveChild.pt(), cosineTheta); + thetaRegistry.fill(HIST("Theta/PositiveChild/hThetaEta"), positiveChild.eta(), cosineTheta); + thetaRegistry.fill(HIST("Theta/PositiveChild/hThetaPhi"), positiveChild.phi(), cosineTheta); + thetaRegistry.fill(HIST("Theta/NegativeChild/hThetaPt"), negativeChild.pt(), cosineTheta); + thetaRegistry.fill(HIST("Theta/NegativeChild/hThetaEta"), negativeChild.eta(), cosineTheta); + thetaRegistry.fill(HIST("Theta/NegativeChild/hThetaPhi"), negativeChild.phi(), cosineTheta); + } + } + } + PROCESS_SWITCH(FemtoUniverseDebugV0, processData, "Enable processing on real data", true); + + /// Produce QA plots for V0 and its children on Monte Carlo + void processMC(o2::aod::FdCollision const& col, soa::Join const& parts, o2::aod::FdMCParticles const&) + { + auto groupPartsOne = partsOneMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); + eventHisto.fillQA(col); + for (const auto& part : groupPartsOne) { + if (!part.has_children()) { + continue; + } + const auto& positiveChild = parts.iteratorAt(part.index() - 2); + const auto& negativeChild = parts.iteratorAt(part.index() - 1); + if (positiveChild.globalIndex() != part.childrenIds()[0] || negativeChild.globalIndex() != part.childrenIds()[1]) { + LOG(warn) << "Indices of V0 children do not match"; + continue; + } + + // Check cuts on V0 children + if (positiveChild.partType() == uint8_t(aod::femtouniverseparticle::ParticleType::kV0Child) && + negativeChild.partType() == uint8_t(aod::femtouniverseparticle::ParticleType::kV0Child) && + isFullPIDSelected(positiveChild.pidCut(), positiveChild.p(), 999.f, childconfigs.confPositiveChildIndex.value, childconfigs.confChildnSpecies.value, childconfigs.confChildPIDnSigmaMax.value, childconfigs.confPositiveChildPIDnSigmaMax.value, 1.f) && + isFullPIDSelected(negativeChild.pidCut(), negativeChild.p(), 999.f, childconfigs.confNegativeChildIndex.value, childconfigs.confChildnSpecies.value, childconfigs.confChildPIDnSigmaMax.value, childconfigs.confNegativeChildPIDnSigmaMax.value, 1.f)) { + auto positiveChildMass = pdg->Mass(V0configs.confPDGCodePositiveChild); + auto negativeChildMass = pdg->Mass(V0configs.confPDGCodeNegativeChild); auto positiveChildBoosted = FemtoUniverseMath::boostPRF(positiveChild, positiveChildMass, negativeChild, negativeChildMass); auto cosineTheta = (positiveChildBoosted.Px() * part.px() + positiveChildBoosted.Py() * part.py() + positiveChildBoosted.Pz() * part.pz()) / (positiveChildBoosted.P() * part.p()); V0Histos.fillQA(part); positiveChildHistos.fillQA(positiveChild); negativeChildHistos.fillQA(negativeChild); + thetaRegistry.fill(HIST("Theta/hTheta"), part.p(), cosineTheta); + thetaRegistry.fill(HIST("Theta/PositiveChild/hThetaPt"), positiveChild.pt(), cosineTheta); + thetaRegistry.fill(HIST("Theta/PositiveChild/hThetaEta"), positiveChild.eta(), cosineTheta); + thetaRegistry.fill(HIST("Theta/PositiveChild/hThetaPhi"), positiveChild.phi(), cosineTheta); + thetaRegistry.fill(HIST("Theta/NegativeChild/hThetaPt"), negativeChild.pt(), cosineTheta); + thetaRegistry.fill(HIST("Theta/NegativeChild/hThetaEta"), negativeChild.eta(), cosineTheta); + thetaRegistry.fill(HIST("Theta/NegativeChild/hThetaPhi"), negativeChild.phi(), cosineTheta); } } } + PROCESS_SWITCH(FemtoUniverseDebugV0, processMC, "Enable processing on Monte Carlo", false); }; WorkflowSpec From 54d3293da721bd09ea25b43544451396442ebf8d Mon Sep 17 00:00:00 2001 From: Paola Vargas Torres <88360333+PaolaVT@users.noreply.github.com> Date: Tue, 29 Jul 2025 14:55:23 -0600 Subject: [PATCH 127/345] [PWGLF] Phi parametrizations were updated (#12320) --- PWGMM/UE/Tasks/dedxAnalysis.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGMM/UE/Tasks/dedxAnalysis.cxx b/PWGMM/UE/Tasks/dedxAnalysis.cxx index b87e9c30478..11aea4031be 100644 --- a/PWGMM/UE/Tasks/dedxAnalysis.cxx +++ b/PWGMM/UE/Tasks/dedxAnalysis.cxx @@ -146,8 +146,8 @@ struct DedxAnalysis { AxisSpec ptAxis = {binP, "pT (GeV/c)"}; AxisSpec etaAxis{8, -0.8, 0.8, "#eta"}; AxisSpec pAxis = {binP, "#it{p}/Z (GeV/c)"}; - fphiCutLow = new TF1("StandardPhiCutLow", "0.1/x/x+pi/18.0-0.025", 0, 50); - fphiCutHigh = new TF1("StandardPhiCutHigh", "0.12/x+pi/18.0+0.035", 0, 50); + fphiCutLow = new TF1("StandardPhiCutLow", "0.119297/x/x+pi/18.0-0.000379693", 0, 50); + fphiCutHigh = new TF1("StandardPhiCutHigh", "0.16685/x+pi/18.0+0.00981942", 0, 50); if (calibrationMode) { // MIP for pions registryDeDx.add( From 20567d0eaa299901c6acfb8a94d9be6fd11d29a0 Mon Sep 17 00:00:00 2001 From: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Date: Tue, 29 Jul 2025 23:56:42 +0200 Subject: [PATCH 128/345] [PWGLF] Add 2 extra dimensions: PtArmV0 and AlphaV0 (#12321) --- .../Strangeness/strangenessderivedbinnedinfo.cxx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/strangenessderivedbinnedinfo.cxx b/PWGLF/Tasks/Strangeness/strangenessderivedbinnedinfo.cxx index 025341d279f..6e2be4e435c 100644 --- a/PWGLF/Tasks/Strangeness/strangenessderivedbinnedinfo.cxx +++ b/PWGLF/Tasks/Strangeness/strangenessderivedbinnedinfo.cxx @@ -240,6 +240,8 @@ struct strangenessderivedbinnedinfo { ConfigurableAxis axisEta{"axisEta", {10, -1.0f, 1.0f}, "Pseudo-rapidity #eta"}; ConfigurableAxis axisRadius{"axisRadius", {10, 0.0f, 250.0f}, "Decay radius (cm)"}; ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0.0f, 0.2f, 0.4f, 0.6f, 0.8f, 1.0f, 1.5f, 2.0f, 2.5f, 3.0f, 4.0f, 5.0f, 7.0f, 9.0f, 11.0f, 15.0f, 30.0f}, "#it{p}_{T} (GeV/#it{c})"}; + ConfigurableAxis axisAlphaV0{"axisAlphaV0", {1, -1.0f, 1.f}, "V0 #alpha Armenteros"}; + ConfigurableAxis axisPtArmV0{"axisPtArmV0", {1, 0.0f, 10.f}, "V0 #it{p}_{T} Armenteros"}; // PDG database Service pdgDB; @@ -285,7 +287,7 @@ struct strangenessderivedbinnedinfo { histos.add("hEventCentrality", "hEventCentrality", kTH1F, {{100, 0.0f, +100.0f}}); histos.add("hEventOccupancy", "hEventOccupancy", kTH1F, {axisOccupancy}); - histos.add("h7dCentOccQoverPtMassRadiusPhiEta", "h7dCentOccQoverPtMassRadiusPhiEta", kTHnSparseF, {axisCentrality, axisOccupancy, axisPt, axisMass, axisRadius, axisPhi, axisEta}); + histos.add("h9dCentOccQoverPtMassRadiusPhiEtaPtArmV0AlphaV0", "h9dCentOccQoverPtMassRadiusPhiEtaPtArmV0AlphaV0", kTHnSparseF, {axisCentrality, axisOccupancy, axisPt, axisMass, axisRadius, axisPhi, axisEta, axisPtArmV0, axisAlphaV0}); if (cfgSkimmedProcessing) { zorroSummary.setObject(zorro.getZorroSummary()); @@ -762,13 +764,13 @@ struct strangenessderivedbinnedinfo { continue; // skip V0s that are not standard if (analyseK0Short && isV0Selected(v0, collision, v0.yK0Short())) { - histos.fill(HIST("h7dCentOccQoverPtMassRadiusPhiEta"), centrality, occupancy, v0.pt(), v0.mK0Short(), v0.v0radius(), v0.phi(), v0.eta()); + histos.fill(HIST("h9dCentOccQoverPtMassRadiusPhiEtaPtArmV0AlphaV0"), centrality, occupancy, v0.pt(), v0.mK0Short(), v0.v0radius(), v0.phi(), v0.eta(), v0.qtarm(), v0.alpha()); } if (analyseLambda && isV0Selected(v0, collision, v0.yLambda())) { - histos.fill(HIST("h7dCentOccQoverPtMassRadiusPhiEta"), centrality, occupancy, v0.pt(), v0.mLambda(), v0.v0radius(), v0.phi(), v0.eta()); + histos.fill(HIST("h9dCentOccQoverPtMassRadiusPhiEtaPtArmV0AlphaV0"), centrality, occupancy, v0.pt(), v0.mLambda(), v0.v0radius(), v0.phi(), v0.eta(), v0.qtarm(), v0.alpha()); } if (analyseAntiLambda && isV0Selected(v0, collision, v0.yLambda())) { - histos.fill(HIST("h7dCentOccQoverPtMassRadiusPhiEta"), centrality, occupancy, v0.pt(), v0.mAntiLambda(), v0.v0radius(), v0.phi(), v0.eta()); + histos.fill(HIST("h9dCentOccQoverPtMassRadiusPhiEtaPtArmV0AlphaV0"), centrality, occupancy, v0.pt(), v0.mAntiLambda(), v0.v0radius(), v0.phi(), v0.eta(), v0.qtarm(), v0.alpha()); } } // end v0 loop } @@ -781,10 +783,10 @@ struct strangenessderivedbinnedinfo { continue; // remove acceptance that's badly reproduced by MC / superfluous in future if (analyseXi && isCascadeSelected(cascade, collision, cascade.yXi())) { - histos.fill(HIST("h7dCentOccQoverPtMassRadiusPhiEta"), centrality, occupancy, cascade.pt(), cascade.m(1), cascade.cascradius(), cascade.phi(), cascade.eta()); + histos.fill(HIST("h9dCentOccQoverPtMassRadiusPhiEtaPtArmV0AlphaV0"), centrality, occupancy, cascade.pt(), cascade.m(1), cascade.cascradius(), cascade.phi(), cascade.eta(), 0., 0.); } if (analyseOmega && isCascadeSelected(cascade, collision, cascade.yOmega())) { - histos.fill(HIST("h7dCentOccQoverPtMassRadiusPhiEta"), centrality, occupancy, cascade.pt(), cascade.m(2), cascade.cascradius(), cascade.phi(), cascade.eta()); + histos.fill(HIST("h9dCentOccQoverPtMassRadiusPhiEtaPtArmV0AlphaV0"), centrality, occupancy, cascade.pt(), cascade.m(2), cascade.cascradius(), cascade.phi(), cascade.eta(), 0., 0.); } } // end cascade loop } From 89d43bb091ed25de96d7fda79d27cf431e1b48dd Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Wed, 30 Jul 2025 00:59:21 +0200 Subject: [PATCH 129/345] [Common] Apply vertex-Z equalization in centrality studies (#12308) Co-authored-by: ALICE Builder --- Common/Tasks/centralityStudy.cxx | 185 +++++++++++++++++++++++++------ 1 file changed, 152 insertions(+), 33 deletions(-) diff --git a/Common/Tasks/centralityStudy.cxx b/Common/Tasks/centralityStudy.cxx index 7a0d4c35ab1..be975b9cecb 100644 --- a/Common/Tasks/centralityStudy.cxx +++ b/Common/Tasks/centralityStudy.cxx @@ -49,7 +49,20 @@ struct centralityStudy { int mRunNumber; uint64_t startOfRunTimestamp; + // vertex Z equalization + TList* hCalibObjects; + TProfile* hVtxZFV0A; + TProfile* hVtxZFT0A; + TProfile* hVtxZFT0C; + TProfile* hVtxZNTracks; + TProfile* hVtxZNGlobals; + TProfile* hVtxZMFT; + TProfile* hVtxZFDDA; + TProfile* hVtxZFDDC; + // Configurables + Configurable applyVertexZEqualization{"applyVertexZEqualization", false, "0 - no, 1 - yes"}; + Configurable do2DPlots{"do2DPlots", true, "0 - no, 1 - yes"}; Configurable doOccupancyStudyVsCentrality2d{"doOccupancyStudyVsCentrality2d", true, "0 - no, 1 - yes"}; Configurable doOccupancyStudyVsRawValues2d{"doOccupancyStudyVsRawValues2d", true, "0 - no, 1 - yes"}; @@ -64,10 +77,10 @@ struct centralityStudy { // Apply extra event selections Configurable rejectITSROFBorder{"rejectITSROFBorder", true, "reject events at ITS ROF border"}; Configurable rejectTFBorder{"rejectTFBorder", true, "reject events at TF border"}; - Configurable requireIsVertexITSTPC{"requireIsVertexITSTPC", true, "require events with at least one ITS-TPC track"}; - Configurable requireIsGoodZvtxFT0VsPV{"requireIsGoodZvtxFT0VsPV", true, "require events with PV position along z consistent (within 1 cm) between PV reconstructed using tracks and PV using FT0 A-C time difference"}; - Configurable requireIsVertexTOFmatched{"requireIsVertexTOFmatched", true, "require events with at least one of vertex contributors matched to TOF"}; - Configurable requireIsVertexTRDmatched{"requireIsVertexTRDmatched", true, "require events with at least one of vertex contributors matched to TRD"}; + Configurable requireIsVertexITSTPC{"requireIsVertexITSTPC", false, "require events with at least one ITS-TPC track"}; + Configurable requireIsGoodZvtxFT0VsPV{"requireIsGoodZvtxFT0VsPV", false, "require events with PV position along z consistent (within 1 cm) between PV reconstructed using tracks and PV using FT0 A-C time difference"}; + Configurable requireIsVertexTOFmatched{"requireIsVertexTOFmatched", false, "require events with at least one of vertex contributors matched to TOF"}; + Configurable requireIsVertexTRDmatched{"requireIsVertexTRDmatched", false, "require events with at least one of vertex contributors matched to TRD"}; Configurable rejectSameBunchPileup{"rejectSameBunchPileup", true, "reject collisions in case of pileup with another collision in the same foundBC"}; Configurable rejectITSinROFpileupStandard{"rejectITSinROFpileupStandard", false, "reject collisions in case of in-ROF ITS pileup (standard)"}; @@ -82,7 +95,7 @@ struct centralityStudy { Configurable vertexZwithT0{"vertexZwithT0", 1000.0f, "require a certain vertex-Z in BC analysis"}; Configurable minTimeDelta{"minTimeDelta", -1.0f, "reject collision if another collision is this close or less in time"}; - Configurable minFT0CforVertexZ{"minFT0CforVertexZ", 250, "minimum FT0C for vertex-Z profile calculation"}; + Configurable minFT0CforVertexZ{"minFT0CforVertexZ", -1.0f, "minimum FT0C for vertex-Z profile calculation"}; Configurable scaleSignalFT0C{"scaleSignalFT0C", 1.00f, "scale FT0C signal for convenience"}; Configurable scaleSignalFT0M{"scaleSignalFT0M", 1.00f, "scale FT0M signal for convenience"}; @@ -90,6 +103,7 @@ struct centralityStudy { Configurable ccdbURL{"ccdbURL", "http://alice-ccdb.cern.ch", "ccdb url"}; Configurable pathGRPECSObject{"pathGRPECSObject", "GLO/Config/GRPECS", "Path to GRPECS object"}; + Configurable pathVertexZ{"pathVertexZ", "Users/d/ddobrigk/Centrality/Calibration", "Path to vertexZ profiles"}; Configurable irSource{"irSource", "ZNC hadronic", "Source of the interaction rate: (Recommended: pp --> T0VTX, Pb-Pb --> ZNC hadronic)"}; Configurable irCrashOnNull{"irCrashOnNull", false, "Flag to avoid CTP RateFetcher crash."}; Configurable irDoRateVsTime{"irDoRateVsTime", true, "Do IR plots"}; @@ -148,6 +162,16 @@ struct centralityStudy { void init(InitContext&) { + hCalibObjects = nullptr; + hVtxZFV0A = nullptr; + hVtxZFT0A = nullptr; + hVtxZFT0C = nullptr; + hVtxZNTracks = nullptr; + hVtxZNGlobals = nullptr; + hVtxZMFT = nullptr; + hVtxZFDDA = nullptr; + hVtxZFDDC = nullptr; + if (doprocessCollisions || doprocessCollisionsWithCentrality) { const AxisSpec axisCollisions{100, -0.5f, 99.5f, "Number of collisions"}; histos.add("hCollisionSelection", "hCollisionSelection", kTH1D, {{20, -0.5f, +19.5f}}); @@ -274,13 +298,32 @@ struct centralityStudy { } mRunNumber = collision.multRunNumber(); - LOGF(info, "Setting up for run: %i", mRunNumber); // only get object when switching runs o2::parameters::GRPECSObject* grpo = ccdb->getForRun(pathGRPECSObject, mRunNumber); startOfRunTimestamp = grpo->getTimeStart(); + if (applyVertexZEqualization.value) { + // acquire vertex-Z equalization histograms if requested + LOGF(info, "Acquiring vertex-Z profiles for run %i", mRunNumber); + hCalibObjects = ccdb->getForRun(pathVertexZ, mRunNumber); + + hVtxZFV0A = static_cast(hCalibObjects->FindObject("hVtxZFV0A")); + hVtxZFT0A = static_cast(hCalibObjects->FindObject("hVtxZFT0A")); + hVtxZFT0C = static_cast(hCalibObjects->FindObject("hVtxZFT0C")); + // hVtxZFDDA = static_cast(hCalibObjects->FindObject("hVtxZFDDA")); + // hVtxZFDDC = static_cast(hCalibObjects->FindObject("hVtxZFDDC")); + hVtxZNTracks = static_cast(hCalibObjects->FindObject("hVtxZNTracksPV")); + hVtxZNGlobals = static_cast(hCalibObjects->FindObject("hVtxZNGlobals")); + hVtxZMFT = static_cast(hCalibObjects->FindObject("hVtxZMFT")); + + // Capture error + if (!hVtxZFV0A || !hVtxZFT0A || !hVtxZFT0C || !hVtxZNTracks || !hVtxZNGlobals || !hVtxZMFT) { + LOGF(error, "Problem loading CCDB objects! Please check"); + } + } + histPath = std::format("Run_{}/", mRunNumber); if (doprocessCollisions || doprocessCollisionsWithCentrality) { @@ -306,11 +349,22 @@ struct centralityStudy { histPointers.insert({histPath + "hNMFTTracks", histos.add((histPath + "hNMFTTracks").c_str(), "hNMFTTracks", {kTH1D, {{axisMultUltraFineMFTTracks}}})}); histPointers.insert({histPath + "hNPVContributors", histos.add((histPath + "hNPVContributors").c_str(), "hNPVContributors", {kTH1D, {{axisMultUltraFinePVContributors}}})}); + if (applyVertexZEqualization) { + histPointers.insert({histPath + "hFT0C_Collisions_Unequalized", histos.add((histPath + "hFT0C_Collisions_Unequalized").c_str(), "hFT0C_Collisions_Unequalized", {kTH1D, {{axisMultUltraFineFT0C}}})}); + histPointers.insert({histPath + "hFT0M_Collisions_Unequalized", histos.add((histPath + "hFT0M_Collisions_Unequalized").c_str(), "hFT0M_Collisions_Unequalized", {kTH1D, {{axisMultUltraFineFT0M}}})}); + histPointers.insert({histPath + "hFV0A_Collisions_Unequalized", histos.add((histPath + "hFV0A_Collisions_Unequalized").c_str(), "hFV0A_Collisions_Unequalized", {kTH1D, {{axisMultUltraFineFV0A}}})}); + histPointers.insert({histPath + "hNGlobalTracks_Unequalized", histos.add((histPath + "hNGlobalTracks_Unequalized").c_str(), "hNGlobalTracks_Unequalized", {kTH1D, {{axisMultUltraFineGlobalTracks}}})}); + histPointers.insert({histPath + "hNMFTTracks_Unequalized", histos.add((histPath + "hNMFTTracks_Unequalized").c_str(), "hNMFTTracks_Unequalized", {kTH1D, {{axisMultUltraFineMFTTracks}}})}); + histPointers.insert({histPath + "hNPVContributors_Unequalized", histos.add((histPath + "hNPVContributors_Unequalized").c_str(), "hNPVContributors_Unequalized", {kTH1D, {{axisMultUltraFinePVContributors}}})}); + } + histPointers.insert({histPath + "hFT0CvsPVz_Collisions_All", histos.add((histPath + "hFT0CvsPVz_Collisions_All").c_str(), "hFT0CvsPVz_Collisions_All", {kTProfile, {{axisPVz}}})}); + histPointers.insert({histPath + "hFT0AvsPVz_Collisions", histos.add((histPath + "hFT0AvsPVz_Collisions").c_str(), "hFT0AvsPVz_Collisions", {kTProfile, {{axisPVz}}})}); histPointers.insert({histPath + "hFT0CvsPVz_Collisions", histos.add((histPath + "hFT0CvsPVz_Collisions").c_str(), "hFT0CvsPVz_Collisions", {kTProfile, {{axisPVz}}})}); histPointers.insert({histPath + "hFV0AvsPVz_Collisions", histos.add((histPath + "hFV0AvsPVz_Collisions").c_str(), "hFV0AvsPVz_Collisions", {kTProfile, {{axisPVz}}})}); histPointers.insert({histPath + "hNGlobalTracksvsPVz_Collisions", histos.add((histPath + "hNGlobalTracksvsPVz_Collisions").c_str(), "hNGlobalTracksvsPVz_Collisions", {kTProfile, {{axisPVz}}})}); histPointers.insert({histPath + "hNMFTTracksvsPVz_Collisions", histos.add((histPath + "hNMFTTracksvsPVz_Collisions").c_str(), "hNMFTTracksvsPVz_Collisions", {kTProfile, {{axisPVz}}})}); + histPointers.insert({histPath + "hNTPVvsPVz_Collisions", histos.add((histPath + "hNTPVvsPVz_Collisions").c_str(), "hNTPVvsPVz_Collisions", {kTProfile, {{axisPVz}}})}); } if (do2DPlots) { @@ -359,7 +413,6 @@ struct centralityStudy { // process this collisions { initRun(collision); - histos.fill(HIST("hCollisionSelection"), 0); // all collisions getHist(TH1, histPath + "hCollisionSelection")->Fill(0); @@ -368,6 +421,69 @@ struct centralityStudy { histos.fill(HIST("hCollisionSelection"), 1); getHist(TH1, histPath + "hCollisionSelection")->Fill(1); + // calculate vertex-Z-equalized quantities if desired + float multFV0A = collision.multFV0A(); + float multFT0A = collision.multFT0A(); + float multFT0C = collision.multFT0C(); + float multNTracksGlobal = collision.multNTracksGlobal(); + float mftNtracks = collision.mftNtracks(); + float multNTracksPV = collision.multNTracksPV(); + if (applyVertexZEqualization) { + float epsilon = 1e-2; // average value after which this collision will be disregarded + multFV0A = -1.0f; + multFT0A = -1.0f; + multFT0C = -1.0f; + multNTracksGlobal = -1.0f; + mftNtracks = -1.0f; + multNTracksPV = -1.0f; + + if (hVtxZFV0A->Interpolate(collision.multPVz()) > epsilon) { + multFV0A = hVtxZFV0A->Interpolate(0.0) * collision.multFV0A() / hVtxZFV0A->Interpolate(collision.multPVz()); + } + if (hVtxZFT0A->Interpolate(collision.multPVz()) > epsilon) { + multFT0A = hVtxZFT0A->Interpolate(0.0) * collision.multFT0A() / hVtxZFT0A->Interpolate(collision.multPVz()); + } + if (hVtxZFT0C->Interpolate(collision.multPVz()) > epsilon) { + multFT0C = hVtxZFT0C->Interpolate(0.0) * collision.multFT0C() / hVtxZFT0C->Interpolate(collision.multPVz()); + } + if (hVtxZNGlobals->Interpolate(collision.multPVz()) > epsilon) { + multNTracksGlobal = hVtxZNGlobals->Interpolate(0.0) * collision.multNTracksGlobal() / hVtxZNGlobals->Interpolate(collision.multPVz()); + } + if (hVtxZMFT->Interpolate(collision.multPVz()) > epsilon) { + mftNtracks = hVtxZMFT->Interpolate(0.0) * collision.mftNtracks() / hVtxZMFT->Interpolate(collision.multPVz()); + } + if (hVtxZNTracks->Interpolate(collision.multPVz()) > epsilon) { + multNTracksPV = hVtxZNTracks->Interpolate(0.0) * collision.multNTracksPV() / hVtxZNTracks->Interpolate(collision.multPVz()); + } + } + + bool passRejectITSROFBorder = !(rejectITSROFBorder && !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)); + bool passRejectTFBorder = !(rejectTFBorder && !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)); + bool passRequireIsVertexITSTPC = !(requireIsVertexITSTPC && !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)); + bool passRequireIsGoodZvtxFT0VsPV = !(requireIsGoodZvtxFT0VsPV && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)); + bool passRequireIsVertexTOFmatched = !(requireIsVertexTOFmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTOFmatched)); + bool passRequireIsVertexTRDmatched = !(requireIsVertexTRDmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTRDmatched)); + bool passRejectSameBunchPileup = !(rejectSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)); + bool passRejectITSinROFpileupStandard = !(rejectITSinROFpileupStandard && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStandard)); + bool passRejectITSinROFpileupStrict = !(rejectITSinROFpileupStrict && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStrict)); + bool passSelectUPCcollisions = !(selectUPCcollisions && collision.flags() < 1); + bool passRejectCollInTimeRangeNarrow = !(rejectCollInTimeRangeNarrow && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeNarrow)); + // _______________________________________________________ + // sidestep vertex-Z rejection for vertex-Z profile histograms + if (passRejectITSROFBorder && passRejectTFBorder && passRequireIsVertexITSTPC && passRequireIsGoodZvtxFT0VsPV && + passRequireIsVertexTOFmatched && passRequireIsVertexTRDmatched && passRejectSameBunchPileup && passRejectITSinROFpileupStandard && passRejectITSinROFpileupStrict && + passSelectUPCcollisions && passRejectCollInTimeRangeNarrow) { + getHist(TProfile, histPath + "hFT0CvsPVz_Collisions_All")->Fill(collision.multPVz(), multFT0C * scaleSignalFT0C); + getHist(TProfile, histPath + "hFT0CvsPVz_Collisions")->Fill(collision.multPVz(), multFT0C * scaleSignalFT0C); + getHist(TProfile, histPath + "hFT0AvsPVz_Collisions")->Fill(collision.multPVz(), multFT0A * scaleSignalFT0C); + getHist(TProfile, histPath + "hFV0AvsPVz_Collisions")->Fill(collision.multPVz(), multFV0A * scaleSignalFV0A); + getHist(TProfile, histPath + "hNGlobalTracksvsPVz_Collisions")->Fill(collision.multPVz(), multNTracksGlobal); + getHist(TProfile, histPath + "hNMFTTracksvsPVz_Collisions")->Fill(collision.multPVz(), mftNtracks); + getHist(TProfile, histPath + "hNTPVvsPVz_Collisions")->Fill(collision.multPVz(), multNTracksPV); + } + + // _______________________________________________________ + if (applyVtxZ && TMath::Abs(collision.multPVz()) > 10) return; histos.fill(HIST("hCollisionSelection"), 2); @@ -375,43 +491,43 @@ struct centralityStudy { // _______________________________________________________ // Extra event selections start here - if (rejectITSROFBorder && !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { + if (!passRejectITSROFBorder) { return; } histos.fill(HIST("hCollisionSelection"), 3 /* Not at ITS ROF border */); getHist(TH1, histPath + "hCollisionSelection")->Fill(3); - if (rejectTFBorder && !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { + if (!passRejectTFBorder) { return; } histos.fill(HIST("hCollisionSelection"), 4 /* Not at TF border */); getHist(TH1, histPath + "hCollisionSelection")->Fill(4); - if (requireIsVertexITSTPC && !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { + if (!passRequireIsVertexITSTPC) { return; } histos.fill(HIST("hCollisionSelection"), 5 /* Contains at least one ITS-TPC track */); getHist(TH1, histPath + "hCollisionSelection")->Fill(5); - if (requireIsGoodZvtxFT0VsPV && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + if (!passRequireIsGoodZvtxFT0VsPV) { return; } histos.fill(HIST("hCollisionSelection"), 6 /* PV position consistency check */); getHist(TH1, histPath + "hCollisionSelection")->Fill(6); - if (requireIsVertexTOFmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTOFmatched)) { + if (!passRequireIsVertexTOFmatched) { return; } histos.fill(HIST("hCollisionSelection"), 7 /* PV with at least one contributor matched with TOF */); getHist(TH1, histPath + "hCollisionSelection")->Fill(7); - if (requireIsVertexTRDmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTRDmatched)) { + if (!passRequireIsVertexTRDmatched) { return; } histos.fill(HIST("hCollisionSelection"), 8 /* PV with at least one contributor matched with TRD */); getHist(TH1, histPath + "hCollisionSelection")->Fill(8); - if (rejectSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + if (!passRejectSameBunchPileup) { return; } histos.fill(HIST("hCollisionSelection"), 9 /* Not at same bunch pile-up */); @@ -430,25 +546,25 @@ struct centralityStudy { getHist(TH1, histPath + "hCollisionSelection")->Fill(10); } - if (rejectITSinROFpileupStandard && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStandard)) { + if (!passRejectITSinROFpileupStandard) { return; } histos.fill(HIST("hCollisionSelection"), 11 /* Not ITS ROF pileup (standard) */); getHist(TH1, histPath + "hCollisionSelection")->Fill(11); - if (rejectITSinROFpileupStrict && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStrict)) { + if (!passRejectITSinROFpileupStrict) { return; } histos.fill(HIST("hCollisionSelection"), 12 /* Not ITS ROF pileup (strict) */); getHist(TH1, histPath + "hCollisionSelection")->Fill(12); - if (selectUPCcollisions && collision.flags() < 1) { // if zero then NOT upc, otherwise UPC + if (!passSelectUPCcollisions) { // if zero then NOT upc, otherwise UPC return; } histos.fill(HIST("hCollisionSelection"), 13 /* is UPC event */); getHist(TH1, histPath + "hCollisionSelection")->Fill(13); - if (rejectCollInTimeRangeNarrow && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeNarrow)) { + if (!passRejectCollInTimeRangeNarrow) { return; } histos.fill(HIST("hCollisionSelection"), 14 /* Not ITS ROF pileup (strict) */); @@ -482,21 +598,24 @@ struct centralityStudy { histos.fill(HIST("hNGlobalTracksvsPVz_Collisions"), collision.multPVz(), collision.multNTracksGlobal()); histos.fill(HIST("hNMFTTracksvsPVz_Collisions"), collision.multPVz(), collision.mftNtracks()); - getHist(TH1, histPath + "hNPVContributors")->Fill(collision.multNTracksPV()); - getHist(TH1, histPath + "hFT0C_Collisions")->Fill(collision.multFT0C() * scaleSignalFT0C); - getHist(TH1, histPath + "hFT0M_Collisions")->Fill((collision.multFT0A() + collision.multFT0C()) * scaleSignalFT0M); - getHist(TH1, histPath + "hFV0A_Collisions")->Fill(collision.multFV0A() * scaleSignalFV0A); - getHist(TH1, histPath + "hNGlobalTracks")->Fill(collision.multNTracksGlobal()); - getHist(TH1, histPath + "hNMFTTracks")->Fill(collision.mftNtracks()); - getHist(TProfile, histPath + "hFT0CvsPVz_Collisions_All")->Fill(collision.multPVz(), collision.multFT0C() * scaleSignalFT0C); - getHist(TProfile, histPath + "hFV0AvsPVz_Collisions")->Fill(collision.multPVz(), collision.multFV0A() * scaleSignalFV0A); - getHist(TProfile, histPath + "hNGlobalTracksvsPVz_Collisions")->Fill(collision.multPVz(), collision.multNTracksGlobal()); - getHist(TProfile, histPath + "hNMFTTracksvsPVz_Collisions")->Fill(collision.multPVz(), collision.mftNtracks()); - - if (collision.multFT0C() > minFT0CforVertexZ) { - histos.fill(HIST("hFT0CvsPVz_Collisions"), collision.multPVz(), collision.multFT0C() * scaleSignalFT0C); - getHist(TProfile, histPath + "hFT0CvsPVz_Collisions")->Fill(collision.multPVz(), collision.multFT0C() * scaleSignalFT0C); + // save vertex-Z equalized + getHist(TH1, histPath + "hNPVContributors")->Fill(multNTracksPV); + getHist(TH1, histPath + "hFT0C_Collisions")->Fill(multFT0C * scaleSignalFT0C); + getHist(TH1, histPath + "hFT0M_Collisions")->Fill((multFT0A + multFT0C) * scaleSignalFT0M); + getHist(TH1, histPath + "hFV0A_Collisions")->Fill(multFV0A * scaleSignalFV0A); + getHist(TH1, histPath + "hNGlobalTracks")->Fill(multNTracksGlobal); + getHist(TH1, histPath + "hNMFTTracks")->Fill(mftNtracks); + + if (applyVertexZEqualization.value) { + // save unequalized for cross-checks + getHist(TH1, histPath + "hNPVContributors_Unequalized")->Fill(collision.multNTracksPV()); + getHist(TH1, histPath + "hFT0C_Collisions_Unequalized")->Fill(collision.multFT0C() * scaleSignalFT0C); + getHist(TH1, histPath + "hFT0M_Collisions_Unequalized")->Fill((collision.multFT0A() + collision.multFT0C()) * scaleSignalFT0M); + getHist(TH1, histPath + "hFV0A_Collisions_Unequalized")->Fill(collision.multFV0A() * scaleSignalFV0A); + getHist(TH1, histPath + "hNGlobalTracks_Unequalized")->Fill(collision.multNTracksGlobal()); + getHist(TH1, histPath + "hNMFTTracks_Unequalized")->Fill(collision.mftNtracks()); } + if (do2DPlots) { histos.fill(HIST("hNContribsVsFT0C"), collision.multFT0C() * scaleSignalFT0C, collision.multPVTotalContributors()); histos.fill(HIST("hNContribsVsFV0A"), collision.multFV0A() * scaleSignalFV0A, collision.multPVTotalContributors()); @@ -576,9 +695,9 @@ struct centralityStudy { } if (doTimeStudies && collision.has_multBC()) { + initRun(collision); auto multbc = collision.template multBC_as(); uint64_t bcTimestamp = multbc.timestamp(); - float hoursAfterStartOfRun = static_cast(bcTimestamp - startOfRunTimestamp) / 3600000.0; getHist(TH2, histPath + "hFT0AVsTime")->Fill(hoursAfterStartOfRun, collision.multFT0A()); From 6adda8ab223f41faf6003c1f1e25312f3f9f15c8 Mon Sep 17 00:00:00 2001 From: sawan <124118453+sawankumawat@users.noreply.github.com> Date: Wed, 30 Jul 2025 10:39:31 +0530 Subject: [PATCH 130/345] [PWGLF] Added signal/event loss corrections (#12293) Co-authored-by: Sawan Sawan --- .../Tasks/Resonances/higherMassResonances.cxx | 165 +++---- PWGLF/Tasks/Resonances/kstarqa.cxx | 410 ++++++++++-------- 2 files changed, 323 insertions(+), 252 deletions(-) diff --git a/PWGLF/Tasks/Resonances/higherMassResonances.cxx b/PWGLF/Tasks/Resonances/higherMassResonances.cxx index 61ef930a7c2..3a34c13fad2 100644 --- a/PWGLF/Tasks/Resonances/higherMassResonances.cxx +++ b/PWGLF/Tasks/Resonances/higherMassResonances.cxx @@ -43,7 +43,6 @@ #include #include #include -#include #include #include #include @@ -143,7 +142,7 @@ struct HigherMassResonances { Configurable cTVXEvsel{"cTVXEvsel", true, "Triggger selection"}; Configurable avoidsplitrackMC{"avoidsplitrackMC", false, "avoid split track in MC"}; Configurable selectMCparticles{"selectMCparticles", 1, "0: f0(1710), 1: f2(1525), 2: a2(1320), 3: f0(1370), 4: f0(1500)"}; - Configurable apply_rapidityMC{"apply_rapidityMC", true, "Apply rapidity cut on generated and reconstructed particles"}; + Configurable applyRapidityMC{"applyRapidityMC", true, "Apply rapidity cut on generated and reconstructed particles"}; std::vector pdgCodes = {10331, 335, 115, 10221, 9030221}; // output THnSparses @@ -171,6 +170,12 @@ struct HigherMassResonances { // ConfigurableAxis axisdEdx{"axisdEdx", {20000, 0.0f, 200.0f}, "dE/dx (a.u.)"}; // ConfigurableAxis axisPtfordEbydx{"axisPtfordEbydx", {2000, 0, 20}, "pT (GeV/c)"}; // ConfigurableAxis axisMultdist{"axisMultdist", {3500, 0, 70000}, "Multiplicity distribution"}; + + // fixed variables + float rapidityMotherData = 0.5; + float beamEnergy = 13600.0; + double beamMomentum = std::sqrt(beamEnergy * beamEnergy / 4 - o2::constants::physics::MassProton * o2::constants::physics::MassProton); // GeV + int noOfDaughters = 2; } config; // Service PDGdatabase; @@ -182,13 +187,12 @@ struct HigherMassResonances { ROOT::Math::PxPyPzMVector daughter1, daughter2, daughterRot, daughterRotCM, mother, motherRot, fourVecDauCM, fourVecDauCM1; ROOT::Math::PxPyPzEVector mother1; ROOT::Math::XYZVector randomVec, beamVec, normalVec; - ROOT::Math::XYZVectorF v1_CM, zaxis_HE, yaxis_HE, xaxis_HE; + ROOT::Math::XYZVectorF v1CM, zaxisHE, yaxisHE, xaxisHE; // ROOT::Math::XYZVector threeVecDauCM, helicityVec, randomVec, beamVec, normalVec; - ROOT::Math::XYZVector zBeam; // ẑ: beam direction in lab frame - double BeamMomentum = std::sqrt(13600 * 13600 / 4 - 0.938 * 0.938); // GeV - ROOT::Math::PxPyPzEVector Beam1{0., 0., -BeamMomentum, 13600. / 2.}; - ROOT::Math::PxPyPzEVector Beam2{0., 0., BeamMomentum, 13600. / 2.}; - ROOT::Math::XYZVectorF Beam1_CM, Beam2_CM; + ROOT::Math::XYZVector zBeam; // ẑ: beam direction in lab frame + ROOT::Math::PxPyPzEVector beam1{0., 0., -config.beamMomentum, 13600. / 2.}; + ROOT::Math::PxPyPzEVector beam2{0., 0., config.beamMomentum, 13600. / 2.}; + ROOT::Math::XYZVectorF beam1CM, beam2CM; // const double massK0s = o2::constants::physics::MassK0Short; bool isMix = false; @@ -389,8 +393,8 @@ struct HigherMassResonances { const float cpav0 = candidate.v0cosPA(); float ctauK0s = candidate.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short; - float lowmasscutks0 = 0.497 - config.cWidthKs0 * config.cSigmaMassKs0; - float highmasscutks0 = 0.497 + config.cWidthKs0 * config.cSigmaMassKs0; + float lowmasscutks0 = o2::constants::physics::MassKPlus - config.cWidthKs0 * config.cSigmaMassKs0; + float highmasscutks0 = o2::constants::physics::MassKPlus + config.cWidthKs0 * config.cSigmaMassKs0; // float decayLength = candidate.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * RecoDecay::sqrtSumOfSquares(candidate.px(), candidate.py(), candidate.pz()); if (config.qAv0) { @@ -615,8 +619,8 @@ struct HigherMassResonances { fourVecDauCM = boost(daughter1); // boost the frame of daughter to the center of mass frame // threeVecDauCM = fourVecDauCM.Vect(); // get the 3 vector of daughter in the frame of mother - Beam1_CM = ROOT::Math::XYZVectorF((boost(Beam1).Vect()).Unit()); - Beam2_CM = ROOT::Math::XYZVectorF((boost(Beam2).Vect()).Unit()); + beam1CM = ROOT::Math::XYZVectorF((boost(beam1).Vect()).Unit()); + beam2CM = ROOT::Math::XYZVectorF((boost(beam2).Vect()).Unit()); // define y = zBeam x z: Normal to the production plane // ẑ: mother direction in lab, boosted into mother's rest frame @@ -634,32 +638,33 @@ struct HigherMassResonances { // auto p_proj_y = threeVecDauCM.Dot(y_axis); // // Calculate φ in [-π, π] - // auto angle_phi = std::atan2(p_proj_y, p_proj_x); // φ in radians + // auto anglePhi = std::atan2(p_proj_y, p_proj_x); // φ in radians - v1_CM = ROOT::Math::XYZVectorF(boost(daughter1).Vect()).Unit(); + v1CM = ROOT::Math::XYZVectorF(boost(daughter1).Vect()).Unit(); // ROOT::Math::XYZVectorF v2_CM{(boost(daughter1).Vect()).Unit()}; // using positive sign convention for the first track - // ROOT::Math::XYZVectorF v_CM = (t1.sign() > 0 ? v1_CM : v2_CM); // here selected decay daughter momentum is intested. here you can choose one decay daughter no need to check both case as it is neutral particle for our case + // ROOT::Math::XYZVectorF v_CM = (t1.sign() > 0 ? v1CM : v2_CM); // here selected decay daughter momentum is intested. here you can choose one decay daughter no need to check both case as it is neutral particle for our case // Helicity frame - zaxis_HE = ROOT::Math::XYZVectorF(mother.Vect()).Unit(); - yaxis_HE = ROOT::Math::XYZVectorF(Beam1_CM.Cross(Beam2_CM)).Unit(); - xaxis_HE = ROOT::Math::XYZVectorF(yaxis_HE.Cross(zaxis_HE)).Unit(); + zaxisHE = ROOT::Math::XYZVectorF(mother.Vect()).Unit(); + yaxisHE = ROOT::Math::XYZVectorF(beam1CM.Cross(beam2CM)).Unit(); + xaxisHE = ROOT::Math::XYZVectorF(yaxisHE.Cross(zaxisHE)).Unit(); - // CosThetaHE = zaxis_HE.Dot(v_CM); + // CosThetaHE = zaxisHE.Dot(v_CM); - auto angle_phi = TMath::ATan2(yaxis_HE.Dot(v1_CM), xaxis_HE.Dot(v1_CM)); - if (angle_phi < 0) { - angle_phi += 2 * TMath::Pi(); // ensure phi is in [0, 2pi] - } + auto anglePhi = std::atan2(yaxisHE.Dot(v1CM), xaxisHE.Dot(v1CM)); + anglePhi = RecoDecay::constrainAngle(anglePhi, 0.0); + // if (anglePhi < 0) { + // anglePhi += o2::constants::math::TwoPI; // ensure phi is in [0, 2pi] + // } - // if (std::abs(mother.Rapidity()) < 0.5) { + // if (std::abs(mother.Rapidity()) < config.rapidityMotherData) { if (config.activateTHnSparseCosThStarHelicity) { // helicityVec = mother.Vect(); // 3 vector of mother in COM frame // auto cosThetaStarHelicity = helicityVec.Dot(threeVecDauCM) / (std::sqrt(threeVecDauCM.Mag2()) * std::sqrt(helicityVec.Mag2())); auto cosThetaStarHelicity = mother.Vect().Dot(fourVecDauCM.Vect()) / (std::sqrt(fourVecDauCM.Vect().Mag2()) * std::sqrt(mother.Vect().Mag2())); if (!isMix) { - if (std::abs(mother.Rapidity()) < 0.5) { - hglue.fill(HIST("h3glueInvMassDS"), multiplicity, mother.Pt(), mother.M(), cosThetaStarHelicity, angle_phi); + if (std::abs(mother.Rapidity()) < config.rapidityMotherData) { + hglue.fill(HIST("h3glueInvMassDS"), multiplicity, mother.Pt(), mother.M(), cosThetaStarHelicity, anglePhi); } for (int i = 0; i < config.cRotations; i++) { @@ -673,50 +678,50 @@ struct HigherMassResonances { daughterRotCM = boost2(daughterRot); auto cosThetaStarHelicityRot = motherRot.Vect().Dot(daughterRotCM.Vect()) / (std::sqrt(daughterRotCM.Vect().Mag2()) * std::sqrt(motherRot.Vect().Mag2())); - if (motherRot.Rapidity() < 0.5) - hglue.fill(HIST("h3glueInvMassRot"), multiplicity, motherRot.Pt(), motherRot.M(), cosThetaStarHelicityRot, angle_phi); + if (motherRot.Rapidity() < config.rapidityMotherData) + hglue.fill(HIST("h3glueInvMassRot"), multiplicity, motherRot.Pt(), motherRot.M(), cosThetaStarHelicityRot, anglePhi); } } else { - if (std::abs(mother.Rapidity()) < 0.5) { - hglue.fill(HIST("h3glueInvMassME"), multiplicity, mother.Pt(), mother.M(), cosThetaStarHelicity, angle_phi); + if (std::abs(mother.Rapidity()) < config.rapidityMotherData) { + hglue.fill(HIST("h3glueInvMassME"), multiplicity, mother.Pt(), mother.M(), cosThetaStarHelicity, anglePhi); } } } else if (config.activateTHnSparseCosThStarProduction) { normalVec = ROOT::Math::XYZVector(mother.Py(), -mother.Px(), 0.f); auto cosThetaStarProduction = normalVec.Dot(fourVecDauCM.Vect()) / (std::sqrt(fourVecDauCM.Vect().Mag2()) * std::sqrt(normalVec.Mag2())); if (!isMix) { - if (std::abs(mother.Rapidity()) < 0.5) { - hglue.fill(HIST("h3glueInvMassDS"), multiplicity, mother.Pt(), mother.M(), cosThetaStarProduction, angle_phi); + if (std::abs(mother.Rapidity()) < config.rapidityMotherData) { + hglue.fill(HIST("h3glueInvMassDS"), multiplicity, mother.Pt(), mother.M(), cosThetaStarProduction, anglePhi); } for (int i = 0; i < config.cRotations; i++) { theta2 = rn->Uniform(o2::constants::math::PI - o2::constants::math::PI / config.rotationalCut, o2::constants::math::PI + o2::constants::math::PI / config.rotationalCut); motherRot = ROOT::Math::PxPyPzMVector(mother.Px() * std::cos(theta2) - mother.Py() * std::sin(theta2), mother.Px() * std::sin(theta2) + mother.Py() * std::cos(theta2), mother.Pz(), mother.M()); - if (std::abs(motherRot.Rapidity()) < 0.5) { - hglue.fill(HIST("h3glueInvMassRot"), multiplicity, motherRot.Pt(), motherRot.M(), cosThetaStarProduction, angle_phi); + if (std::abs(motherRot.Rapidity()) < config.rapidityMotherData) { + hglue.fill(HIST("h3glueInvMassRot"), multiplicity, motherRot.Pt(), motherRot.M(), cosThetaStarProduction, anglePhi); } } } else { - if (std::abs(mother.Rapidity()) < 0.5) { - hglue.fill(HIST("h3glueInvMassME"), multiplicity, mother.Pt(), mother.M(), cosThetaStarProduction, angle_phi); + if (std::abs(mother.Rapidity()) < config.rapidityMotherData) { + hglue.fill(HIST("h3glueInvMassME"), multiplicity, mother.Pt(), mother.M(), cosThetaStarProduction, anglePhi); } } } else if (config.activateTHnSparseCosThStarBeam) { beamVec = ROOT::Math::XYZVector(0.f, 0.f, 1.f); auto cosThetaStarBeam = beamVec.Dot(fourVecDauCM.Vect()) / std::sqrt(fourVecDauCM.Vect().Mag2()); if (!isMix) { - if (std::abs(mother.Rapidity()) < 0.5) { - hglue.fill(HIST("h3glueInvMassDS"), multiplicity, mother.Pt(), mother.M(), cosThetaStarBeam, angle_phi); + if (std::abs(mother.Rapidity()) < config.rapidityMotherData) { + hglue.fill(HIST("h3glueInvMassDS"), multiplicity, mother.Pt(), mother.M(), cosThetaStarBeam, anglePhi); } for (int i = 0; i < config.cRotations; i++) { theta2 = rn->Uniform(o2::constants::math::PI - o2::constants::math::PI / config.rotationalCut, o2::constants::math::PI + o2::constants::math::PI / config.rotationalCut); motherRot = ROOT::Math::PxPyPzMVector(mother.Px() * std::cos(theta2) - mother.Py() * std::sin(theta2), mother.Px() * std::sin(theta2) + mother.Py() * std::cos(theta2), mother.Pz(), mother.M()); - if (std::abs(motherRot.Rapidity()) < 0.5) { - hglue.fill(HIST("h3glueInvMassRot"), multiplicity, motherRot.Pt(), motherRot.M(), cosThetaStarBeam, angle_phi); + if (std::abs(motherRot.Rapidity()) < config.rapidityMotherData) { + hglue.fill(HIST("h3glueInvMassRot"), multiplicity, motherRot.Pt(), motherRot.M(), cosThetaStarBeam, anglePhi); } } } else { - if (std::abs(mother.Rapidity()) < 0.5) { - hglue.fill(HIST("h3glueInvMassME"), multiplicity, mother.Pt(), mother.M(), cosThetaStarBeam, angle_phi); + if (std::abs(mother.Rapidity()) < config.rapidityMotherData) { + hglue.fill(HIST("h3glueInvMassME"), multiplicity, mother.Pt(), mother.M(), cosThetaStarBeam, anglePhi); } } } else if (config.activateTHnSparseCosThStarRandom) { @@ -726,19 +731,19 @@ struct HigherMassResonances { randomVec = ROOT::Math::XYZVector(std::sin(thetaRandom) * std::cos(phiRandom), std::sin(thetaRandom) * std::sin(phiRandom), std::cos(thetaRandom)); auto cosThetaStarRandom = randomVec.Dot(fourVecDauCM.Vect()) / std::sqrt(fourVecDauCM.Vect().Mag2()); if (!isMix) { - if (std::abs(mother.Rapidity()) < 0.5) { - hglue.fill(HIST("h3glueInvMassDS"), multiplicity, mother.Pt(), mother.M(), cosThetaStarRandom, angle_phi); + if (std::abs(mother.Rapidity()) < config.rapidityMotherData) { + hglue.fill(HIST("h3glueInvMassDS"), multiplicity, mother.Pt(), mother.M(), cosThetaStarRandom, anglePhi); } for (int i = 0; i < config.cRotations; i++) { theta2 = rn->Uniform(o2::constants::math::PI - o2::constants::math::PI / config.rotationalCut, o2::constants::math::PI + o2::constants::math::PI / config.rotationalCut); motherRot = ROOT::Math::PxPyPzMVector(mother.Px() * std::cos(theta2) - mother.Py() * std::sin(theta2), mother.Px() * std::sin(theta2) + mother.Py() * std::cos(theta2), mother.Pz(), mother.M()); - if (std::abs(motherRot.Rapidity()) < 0.5) { - hglue.fill(HIST("h3glueInvMassRot"), multiplicity, motherRot.Pt(), motherRot.M(), cosThetaStarRandom, angle_phi); + if (std::abs(motherRot.Rapidity()) < config.rapidityMotherData) { + hglue.fill(HIST("h3glueInvMassRot"), multiplicity, motherRot.Pt(), motherRot.M(), cosThetaStarRandom, anglePhi); } } } else { - if (std::abs(mother.Rapidity()) < 0.5) { - hglue.fill(HIST("h3glueInvMassME"), multiplicity, mother.Pt(), mother.M(), cosThetaStarRandom, angle_phi); + if (std::abs(mother.Rapidity()) < config.rapidityMotherData) { + hglue.fill(HIST("h3glueInvMassME"), multiplicity, mother.Pt(), mother.M(), cosThetaStarRandom, anglePhi); } } } @@ -855,7 +860,7 @@ struct HigherMassResonances { } int sizeofv0indexes = v0indexes.size(); rKzeroShort.fill(HIST("NksProduced"), sizeofv0indexes); - if (config.selectTWOKsOnly && sizeofv0indexes == 2 && allConditionsMet) { + if (config.selectTWOKsOnly && sizeofv0indexes == config.noOfDaughters && allConditionsMet) { fillInvMass(mother, multiplicity, daughter1, daughter2, false); } v0indexes.clear(); @@ -864,7 +869,7 @@ struct HigherMassResonances { using EventCandidatesDerivedData = soa::Join; using V0CandidatesDerivedData = soa::Join; - using dauTracks = soa::Join; + using DauTracks = soa::Join; void processSEderived(EventCandidatesDerivedData::iterator const& collision, TrackCandidates const& /*tracks*/, aod::V0Datas const& V0s) { @@ -976,7 +981,7 @@ struct HigherMassResonances { } int sizeofv0indexes = v0indexes.size(); rKzeroShort.fill(HIST("NksProduced"), sizeofv0indexes); - if (config.selectTWOKsOnly && sizeofv0indexes == 2 && allConditionsMet) { + if (config.selectTWOKsOnly && sizeofv0indexes == config.noOfDaughters && allConditionsMet) { fillInvMass(mother, multiplicity, daughter1, daughter2, false); } v0indexes.clear(); @@ -1290,8 +1295,8 @@ struct HigherMassResonances { int counter = 0; float multiplicityGen = 0.0; std::vector passKs; - ROOT::Math::PxPyPzMVector lResonance_gen1; - ROOT::Math::PxPyPzEVector lResonance_gen; + ROOT::Math::PxPyPzMVector lResonanceGen1; + ROOT::Math::PxPyPzEVector lResonanceGen; void processGen(aod::McCollision const& mcCollision, aod::McParticles const& mcParticles, const soa::SmallGroups& collisions) { @@ -1349,7 +1354,7 @@ struct HigherMassResonances { } hMChists.fill(HIST("events_check"), 5.5); - if (config.apply_rapidityMC && std::abs(mcParticle.y()) >= 0.5) { + if (config.applyRapidityMC && std::abs(mcParticle.y()) >= config.rapidityMotherData) { continue; } hMChists.fill(HIST("events_check"), 6.5); @@ -1359,7 +1364,7 @@ struct HigherMassResonances { // counter++; auto kDaughters = mcParticle.daughters_as(); - if (kDaughters.size() != 2) { + if (kDaughters.size() != config.noOfDaughters) { continue; } hMChists.fill(HIST("events_check"), 7.5); @@ -1371,44 +1376,44 @@ struct HigherMassResonances { continue; } hMChists.fill(HIST("events_check"), 8.5); - if (std::abs(kCurrentDaughter.pdgCode()) == 310) { + if (std::abs(kCurrentDaughter.pdgCode()) == PDG_t::kK0Short) { passKs.push_back(true); hMChists.fill(HIST("events_check"), 9.5); if (passKs.size() == 1) { daughter1 = ROOT::Math::PxPyPzMVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), o2::constants::physics::MassK0Short); - } else if (passKs.size() == 2) { + } else if (static_cast(passKs.size()) == config.noOfDaughters) { daughter2 = ROOT::Math::PxPyPzMVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), o2::constants::physics::MassK0Short); } } } - if (passKs.size() == 2) { - lResonance_gen = ROOT::Math::PxPyPzEVector(mcParticle.pt(), mcParticle.eta(), mcParticle.phi(), mcParticle.e()); - lResonance_gen1 = daughter1 + daughter2; + if (static_cast(passKs.size()) == config.noOfDaughters) { + lResonanceGen = ROOT::Math::PxPyPzEVector(mcParticle.pt(), mcParticle.eta(), mcParticle.phi(), mcParticle.e()); + lResonanceGen1 = daughter1 + daughter2; - ROOT::Math::Boost boost{lResonance_gen.BoostToCM()}; - ROOT::Math::Boost boost1{lResonance_gen1.BoostToCM()}; + ROOT::Math::Boost boost{lResonanceGen.BoostToCM()}; + ROOT::Math::Boost boost1{lResonanceGen1.BoostToCM()}; fourVecDauCM = boost(daughter1); fourVecDauCM1 = boost1(daughter1); - auto helicity_gen = lResonance_gen.Vect().Dot(fourVecDauCM.Vect()) / (std::sqrt(fourVecDauCM.Vect().Mag2()) * std::sqrt(lResonance_gen.Vect().Mag2())); - auto helicity_gen1 = lResonance_gen1.Vect().Dot(fourVecDauCM1.Vect()) / (std::sqrt(fourVecDauCM1.Vect().Mag2()) * std::sqrt(lResonance_gen1.Vect().Mag2())); + auto helicityGen = lResonanceGen.Vect().Dot(fourVecDauCM.Vect()) / (std::sqrt(fourVecDauCM.Vect().Mag2()) * std::sqrt(lResonanceGen.Vect().Mag2())); + auto helicityGen1 = lResonanceGen1.Vect().Dot(fourVecDauCM1.Vect()) / (std::sqrt(fourVecDauCM1.Vect().Mag2()) * std::sqrt(lResonanceGen1.Vect().Mag2())); - hMChists.fill(HIST("Genf1710"), multiplicityGen, lResonance_gen.pt(), helicity_gen); - hMChists.fill(HIST("Genf1710_mass"), lResonance_gen.M()); + hMChists.fill(HIST("Genf1710"), multiplicityGen, lResonanceGen.pt(), helicityGen); + hMChists.fill(HIST("Genf1710_mass"), lResonanceGen.M()); hMChists.fill(HIST("GenRapidity"), mcParticle.y()); hMChists.fill(HIST("GenEta"), mcParticle.eta()); hMChists.fill(HIST("GenPhi"), mcParticle.phi()); - if (config.applyPairRapidityGen && std::abs(lResonance_gen1.Y()) >= 0.5) { + if (config.applyPairRapidityGen && std::abs(lResonanceGen1.Rapidity()) >= config.rapidityMotherData) { continue; } - hMChists.fill(HIST("Genf17102"), multiplicityGen, lResonance_gen1.pt(), helicity_gen1); - hMChists.fill(HIST("Genf1710_mass2"), lResonance_gen1.M()); - hMChists.fill(HIST("GenRapidity2"), lResonance_gen1.Y()); - hMChists.fill(HIST("GenEta2"), lResonance_gen1.Eta()); - hMChists.fill(HIST("GenPhi2"), lResonance_gen1.Phi()); + hMChists.fill(HIST("Genf17102"), multiplicityGen, lResonanceGen1.pt(), helicityGen1); + hMChists.fill(HIST("Genf1710_mass2"), lResonanceGen1.M()); + hMChists.fill(HIST("GenRapidity2"), lResonanceGen1.Rapidity()); + hMChists.fill(HIST("GenEta2"), lResonanceGen1.Eta()); + hMChists.fill(HIST("GenPhi2"), lResonanceGen1.Phi()); } passKs.clear(); // clear the vector for the next iteration } @@ -1508,7 +1513,7 @@ struct HigherMassResonances { int trackv0PDG1 = std::abs(mctrackv01.pdgCode()); int trackv0PDG2 = std::abs(mctrackv02.pdgCode()); - if (std::abs(trackv0PDG1) != 310 || std::abs(trackv0PDG2) != 310) { + if (std::abs(trackv0PDG1) != PDG_t::kK0Short || std::abs(trackv0PDG2) != PDG_t::kK0Short) { continue; } hMChists.fill(HIST("events_checkrec"), 12.5); @@ -1555,7 +1560,7 @@ struct HigherMassResonances { } hMChists.fill(HIST("events_checkrec"), 18.5); - if (config.apply_rapidityMC && std::abs(mothertrack1.y()) >= 0.5) { + if (config.applyRapidityMC && std::abs(mothertrack1.y()) >= config.rapidityMotherData) { continue; } hMChists.fill(HIST("events_checkrec"), 19.5); @@ -1578,21 +1583,21 @@ struct HigherMassResonances { fourVecDauCM = boost(daughter1); fourVecDauCM1 = boost1(daughter1); - auto helicity_rec = mother.Vect().Dot(fourVecDauCM.Vect()) / (std::sqrt(fourVecDauCM.Vect().Mag2()) * std::sqrt(mother.Vect().Mag2())); + auto helicityRec = mother.Vect().Dot(fourVecDauCM.Vect()) / (std::sqrt(fourVecDauCM.Vect().Mag2()) * std::sqrt(mother.Vect().Mag2())); - auto helicity_rec2 = mother1.Vect().Dot(fourVecDauCM1.Vect()) / (std::sqrt(fourVecDauCM1.Vect().Mag2()) * std::sqrt(mother1.Vect().Mag2())); + auto helicityRec2 = mother1.Vect().Dot(fourVecDauCM1.Vect()) / (std::sqrt(fourVecDauCM1.Vect().Mag2()) * std::sqrt(mother1.Vect().Mag2())); - hMChists.fill(HIST("Recf1710_pt1"), multiplicity, mothertrack1.pt(), mother1.M(), helicity_rec2); + hMChists.fill(HIST("Recf1710_pt1"), multiplicity, mothertrack1.pt(), mother1.M(), helicityRec2); hMChists.fill(HIST("RecRapidity"), mothertrack1.y()); hMChists.fill(HIST("RecPhi"), mothertrack1.phi()); hMChists.fill(HIST("RecEta"), mothertrack1.eta()); - if (config.applyPairRapidityRec && std::abs(mother.Y()) >= 0.5) { + if (config.applyPairRapidityRec && std::abs(mother.Rapidity()) >= config.rapidityMotherData) { continue; } - hMChists.fill(HIST("Recf1710_pt2"), multiplicity, mother.Pt(), mother.M(), helicity_rec); - hMChists.fill(HIST("RecRapidity2"), mother.Y()); + hMChists.fill(HIST("Recf1710_pt2"), multiplicity, mother.Pt(), mother.M(), helicityRec); + hMChists.fill(HIST("RecRapidity2"), mother.Rapidity()); hMChists.fill(HIST("RecPhi2"), mother.Phi()); hMChists.fill(HIST("RecEta2"), mother.Eta()); } diff --git a/PWGLF/Tasks/Resonances/kstarqa.cxx b/PWGLF/Tasks/Resonances/kstarqa.cxx index 078fc6916bf..21f4db8e9c8 100644 --- a/PWGLF/Tasks/Resonances/kstarqa.cxx +++ b/PWGLF/Tasks/Resonances/kstarqa.cxx @@ -102,8 +102,24 @@ struct Kstarqa { Configurable cfgRCRFC{"cfgRCRFC", 0.8f, "Crossed Rows to Findable Clusters"}; Configurable cfgITSChi2NCl{"cfgITSChi2NCl", 36.0, "ITS Chi2/NCl"}; Configurable cfgTPCChi2NCl{"cfgTPCChi2NCl", 4.0, "TPC Chi2/NCl"}; + + // Other fixed variables + float lowPtCutPID = 0.5; + int noOfDaughters = 2; + float rapidityMotherData = 0.5; + } selectionConfig; + enum MultEstimator { + kFT0M, + kFT0A, + kFT0C, + kFV0A, + kFV0C, + kFV0M, + kNEstimators // useful if you want to iterate or size things + }; + // Histograms are defined with HistogramRegistry HistogramRegistry rEventSelection{"eventSelection", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry hInvMass{"hInvMass", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; @@ -147,6 +163,7 @@ struct Kstarqa { ConfigurableAxis configThnAxisPOL{"configThnAxisPOL", {20, -1.0, 1.0}, "Costheta axis"}; ConfigurableAxis invMassKstarAxis{"invMassKstarAxis", {300, 0.7f, 1.3f}, "Kstar invariant mass axis"}; ConfigurableAxis ptAxisKstar{"ptAxisKstar", {200, 0.0f, 20.0f}, "Kstar pT axis"}; + ConfigurableAxis binsImpactPar{"binsImpactPar", {100, 0, 25}, "Binning of the impact parameter axis"}; // Event plane configurables Configurable boostDaugter1{"boostDaugter1", false, "Boost daughter Kaon in the COM frame"}; @@ -167,14 +184,15 @@ struct Kstarqa { AxisSpec invmassAxis = {invMassKstarAxis, "Invariant mass (GeV/#it{c}^{2})"}; AxisSpec thnAxisPOL{configThnAxisPOL, "cos(#theta)"}; AxisSpec multiplicityAxis = {binsMultPlot, "Multiplicity Axis"}; + AxisSpec impactParAxis = {binsImpactPar, "Impact Parameter (cm)"}; // Histograms // Event selection rEventSelection.add("hVertexZRec", "hVertexZRec", {HistType::kTH1F, {vertexZAxis}}); rEventSelection.add("hMultiplicity", "Multiplicity percentile", kTH1F, {{110, 0, 110}}); - rEventSelection.add("hEventCutFlow", "No. of event after cuts", kTH1I, {{20, 0, 20}}); - std::shared_ptr hCutFlow = rEventSelection.get(HIST("hEventCutFlow")); + rEventSelection.add("hEventCut", "No. of event after cuts", kTH1I, {{20, 0, 20}}); + std::shared_ptr hCutFlow = rEventSelection.get(HIST("hEventCut")); hCutFlow->GetXaxis()->SetBinLabel(1, "All Events"); hCutFlow->GetXaxis()->SetBinLabel(2, "|Vz| < cut"); hCutFlow->GetXaxis()->SetBinLabel(3, "sel8"); @@ -186,6 +204,7 @@ struct Kstarqa { hCutFlow->GetXaxis()->SetBinLabel(9, "rctChecker"); hCutFlow->GetXaxis()->SetBinLabel(10, "kIsTriggerTVX"); hCutFlow->GetXaxis()->SetBinLabel(11, "kIsGoodZvtxFT0vsPV"); + hCutFlow->GetXaxis()->SetBinLabel(12, "IsINELgt0"); // for primary tracksbinsMultPlot if (cQAplots) { @@ -256,12 +275,49 @@ struct Kstarqa { hInvMass.add("h1genmass", "Invariant mass of generated kstar meson", kTH1F, {invmassAxis}); hInvMass.add("h1GenMult", "Multiplicity generated", kTH1F, {multiplicityAxis}); hInvMass.add("h1RecMult", "Multiplicity reconstructed", kTH1F, {multiplicityAxis}); - rEventSelection.add("events_check_data", "No. of events in the data", kTH1I, {{20, 0, 20}}); - rEventSelection.add("events_check", "No. of events in the generated MC", kTH1I, {{20, 0, 20}}); - rEventSelection.add("events_checkrec", "No. of events in the reconstructed MC", kTH1I, {{20, 0, 20}}); hInvMass.add("h1KSRecsplit", "KS meson Rec split", kTH1F, {{100, 0.0f, 10.0f}}); - hInvMass.add("kstargenBeforeEvtSel", "Kstar generated before event selection", kTH1F, {ptAxis}); - hInvMass.add("kstargenAfterEvtSel", "Kstar generated after event selection", kTH1F, {ptAxis}); + hInvMass.add("MCcorrections/hSignalLossDenominator", "Kstar generated before event selection", kTH2F, {{ptAxis}, {impactParAxis}}); + hInvMass.add("MCcorrections/hSignalLossNumerator", "Kstar generated after event selection", kTH2F, {{ptAxis}, {impactParAxis}}); + // hInvMass.add("hAllGenCollisionsImpact", "All generated collisions vs impact parameter", kTH1F, {multiplicityAxis}); + hInvMass.add("hAllGenCollisions", "All generated events", kTH1F, {multiplicityAxis}); + hInvMass.add("hAllGenCollisions1Rec", "All gen events with at least one rec event", kTH1F, {multiplicityAxis}); + hInvMass.add("hAllKstarGenCollisisons", "All generated Kstar in events with rapidity in 0.5", kTH2F, {{multiplicityAxis}, {ptAxis}}); + hInvMass.add("hAllKstarGenCollisisons1Rec", "All generated Kstar in events with at least one rec event in rapidity in 0.5", kTH2F, {{multiplicityAxis}, {ptAxis}}); + hInvMass.add("hAllRecCollisions", "All reconstructed events", kTH2F, {{multiplicityAxis}}); + hInvMass.add("MCcorrections/hImpactParameterRec", "Impact parameter in reconstructed MC", kTH1F, {{impactParAxis}}); + hInvMass.add("MCcorrections/hImpactParameterGen", "Impact parameter in generated MC", kTH1F, {{impactParAxis}}); + hInvMass.add("MCcorrections/hImpactParametervsMultiplicity", "Impact parameter vs multiplicity in reconstructed MC", kTH1F, {{impactParAxis}, {multiplicityAxis}}); + rEventSelection.add("tracksCheckData", "No. of events in the data", kTH1I, {{10, 0, 10}}); + rEventSelection.add("eventsCheckGen", "No. of events in the generated MC", kTH1I, {{10, 0, 10}}); + rEventSelection.add("recMCparticles", "No. of events in the reconstructed MC", kTH1I, {{20, 0, 20}}); + rEventSelection.add("hOccupancy", "Occupancy distribution", kTH1F, {{1000, 0, 15000}}); + + std::shared_ptr hrecLabel = rEventSelection.get(HIST("hEventCut")); + hrecLabel->GetXaxis()->SetBinLabel(1, "All tracks"); + hrecLabel->GetXaxis()->SetBinLabel(2, "Track selection"); + hrecLabel->GetXaxis()->SetBinLabel(3, "has_MC"); + hrecLabel->GetXaxis()->SetBinLabel(4, "StrictlyUpperIndex"); + hrecLabel->GetXaxis()->SetBinLabel(5, "Unlike Sign"); + hrecLabel->GetXaxis()->SetBinLabel(6, "Physical Primary"); + hrecLabel->GetXaxis()->SetBinLabel(7, "PID Cut"); + hrecLabel->GetXaxis()->SetBinLabel(8, "Same mother"); + hrecLabel->GetXaxis()->SetBinLabel(9, "Generator"); + hrecLabel->GetXaxis()->SetBinLabel(10, "Rapidity"); + hrecLabel->GetXaxis()->SetBinLabel(11, "MotherPID313"); + hrecLabel->GetXaxis()->SetBinLabel(12, "Split track"); + + std::shared_ptr hDataTracks = rEventSelection.get(HIST("tracksCheckData")); + hDataTracks->GetXaxis()->SetBinLabel(1, "All tracks"); + hDataTracks->GetXaxis()->SetBinLabel(2, "Track selection"); + hDataTracks->GetXaxis()->SetBinLabel(3, "PID Cut"); + hDataTracks->GetXaxis()->SetBinLabel(4, "RmFakeTracks"); + hDataTracks->GetXaxis()->SetBinLabel(5, "Global Index"); + + std::shared_ptr hGenTracks = rEventSelection.get(HIST("eventsCheckGen")); + hGenTracks->GetXaxis()->SetBinLabel(1, "All events"); + hGenTracks->GetXaxis()->SetBinLabel(2, "INELgt0+vtz"); + hGenTracks->GetXaxis()->SetBinLabel(3, "INELgt0"); + hGenTracks->GetXaxis()->SetBinLabel(4, "Event Reconstructed"); // Multplicity distribution if (cQAevents) { @@ -282,37 +338,37 @@ struct Kstarqa { bool selectionEvent(const Coll& collision, bool fillHist = true) { if (fillHist) - rEventSelection.fill(HIST("hEventCutFlow"), 0); + rEventSelection.fill(HIST("hEventCut"), 0); if (std::abs(collision.posZ()) > selectionConfig.cutzvertex) return false; if (fillHist) - rEventSelection.fill(HIST("hEventCutFlow"), 1); + rEventSelection.fill(HIST("hEventCut"), 1); if (!collision.sel8()) return false; if (fillHist) - rEventSelection.fill(HIST("hEventCutFlow"), 2); + rEventSelection.fill(HIST("hEventCut"), 2); if (selectionConfig.isNoTimeFrameBorder && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) return false; if (fillHist) - rEventSelection.fill(HIST("hEventCutFlow"), 3); + rEventSelection.fill(HIST("hEventCut"), 3); if (selectionConfig.isNoITSROFrameBorder && !collision.selection_bit(aod::evsel::kNoITSROFrameBorder)) return false; if (fillHist) - rEventSelection.fill(HIST("hEventCutFlow"), 4); + rEventSelection.fill(HIST("hEventCut"), 4); if (selectionConfig.isNoSameBunchPileup && (!collision.selection_bit(aod::evsel::kNoSameBunchPileup))) return false; if (fillHist) - rEventSelection.fill(HIST("hEventCutFlow"), 5); + rEventSelection.fill(HIST("hEventCut"), 5); if (selectionConfig.isAllLayersGoodITS && !collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) return false; if (fillHist) - rEventSelection.fill(HIST("hEventCutFlow"), 6); + rEventSelection.fill(HIST("hEventCut"), 6); if (selectionConfig.isApplyOccCut && (!collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard))) return false; @@ -320,28 +376,28 @@ struct Kstarqa { if (selectionConfig.isApplyOccCut && (std::abs(collision.trackOccupancyInTimeRange()) > selectionConfig.configOccCut)) return false; if (fillHist) - rEventSelection.fill(HIST("hEventCutFlow"), 7); + rEventSelection.fill(HIST("hEventCut"), 7); if (rctCut.requireRCTFlagChecker && !rctChecker(collision)) return false; if (fillHist) - rEventSelection.fill(HIST("hEventCutFlow"), 8); + rEventSelection.fill(HIST("hEventCut"), 8); if (selectionConfig.isTriggerTVX && !collision.selection_bit(aod::evsel::kIsTriggerTVX)) return false; if (fillHist) - rEventSelection.fill(HIST("hEventCutFlow"), 9); + rEventSelection.fill(HIST("hEventCut"), 9); if (selectionConfig.isGoodZvtxFT0vsPV && !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) return false; if (fillHist) - rEventSelection.fill(HIST("hEventCutFlow"), 10); + rEventSelection.fill(HIST("hEventCut"), 10); if (selectionConfig.isINELgt0 && !collision.isInelGt0()) { return false; } if (fillHist) - rEventSelection.fill(HIST("hEventCutFlow"), 11); + rEventSelection.fill(HIST("hEventCut"), 11); return true; } @@ -452,23 +508,23 @@ struct Kstarqa { bool selectionPIDNew(const T& candidate, int PID) { if (PID == 0) { - if (candidate.pt() < 0.5 && std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPCPi) { + if (candidate.pt() < selectionConfig.lowPtCutPID && std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPCPi) { return true; } - if (candidate.pt() >= 0.5 && std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPCPi && candidate.hasTOF() && std::abs(candidate.tofNSigmaPi()) < nsigmaCutTOFPi) { + if (candidate.pt() >= selectionConfig.lowPtCutPID && std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPCPi && candidate.hasTOF() && std::abs(candidate.tofNSigmaPi()) < nsigmaCutTOFPi) { return true; } - if (candidate.pt() >= 0.5 && std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPCPi && !candidate.hasTOF()) { + if (candidate.pt() >= selectionConfig.lowPtCutPID && std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPCPi && !candidate.hasTOF()) { return true; } } else if (PID == 1) { - if (candidate.pt() < 0.5 && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPCKa) { + if (candidate.pt() < selectionConfig.lowPtCutPID && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPCKa) { return true; } - if (candidate.pt() >= 0.5 && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPCKa && candidate.hasTOF() && std::abs(candidate.tofNSigmaKa()) < nsigmaCutTOFKa) { + if (candidate.pt() >= selectionConfig.lowPtCutPID && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPCKa && candidate.hasTOF() && std::abs(candidate.tofNSigmaKa()) < nsigmaCutTOFKa) { return true; } - if (candidate.pt() >= 0.5 && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPCKa && !candidate.hasTOF()) { + if (candidate.pt() >= selectionConfig.lowPtCutPID && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPCKa && !candidate.hasTOF()) { return true; } } @@ -574,6 +630,7 @@ struct Kstarqa { using EventCandidatesMC = soa::Join; using TrackCandidatesMC = soa::Filtered>; + using EventMCGenerated = soa::Join; // aod::CentNGlobals, aod::CentNTPVs, aod::CentMFTs //*********Varibles declaration*************** float multiplicity{-1.0}, theta2; @@ -588,13 +645,13 @@ struct Kstarqa { ROOT::Math::Boost boost{mother.BoostToCM()}; // boost mother to center of mass frame fourVecDauCM = boost(daughterSelected); // boost the frame of daughter same as mother - // if (std::abs(mother.Rapidity()) < 0.5) { + // if (std::abs(mother.Rapidity()) < selectionConfig.rapidityMotherData) { if (activateTHnSparseCosThStarHelicity) { auto cosThetaStarHelicity = mother.Vect().Dot(fourVecDauCM.Vect()) / (std::sqrt(fourVecDauCM.Vect().Mag2()) * std::sqrt(mother.Vect().Mag2())); if (track1.sign() * track2.sign() < 0) { if (!isMix) { - if (std::abs(mother.Rapidity()) < 0.5) { + if (std::abs(mother.Rapidity()) < selectionConfig.rapidityMotherData) { hInvMass.fill(HIST("h3KstarInvMassUnlikeSign"), multiplicity, mother.Pt(), mother.M(), cosThetaStarHelicity); } @@ -610,15 +667,15 @@ struct Kstarqa { auto cosThetaStarHelicityRot = motherRot.Vect().Dot(daughterRotCM.Vect()) / (std::sqrt(daughterRotCM.Vect().Mag2()) * std::sqrt(motherRot.Vect().Mag2())); - if (calcRotational && motherRot.Rapidity() < 0.5) + if (calcRotational && motherRot.Rapidity() < selectionConfig.rapidityMotherData) hInvMass.fill(HIST("h3KstarInvMassRotated"), multiplicity, motherRot.Pt(), motherRot.M(), cosThetaStarHelicityRot); } - } else if (isMix && std::abs(mother.Rapidity()) < 0.5) { + } else if (isMix && std::abs(mother.Rapidity()) < selectionConfig.rapidityMotherData) { hInvMass.fill(HIST("h3KstarInvMassMixed"), multiplicity, mother.Pt(), mother.M(), cosThetaStarHelicity); } } else { if (!isMix) { - if (calcLikeSign && std::abs(mother.Rapidity()) < 0.5) { + if (calcLikeSign && std::abs(mother.Rapidity()) < selectionConfig.rapidityMotherData) { if (track1.sign() > 0 && track2.sign() > 0) { hInvMass.fill(HIST("h3KstarInvMasslikeSignPP"), multiplicity, mother.Pt(), mother.M(), cosThetaStarHelicity); } else if (track1.sign() < 0 && track2.sign() < 0) { @@ -634,7 +691,7 @@ struct Kstarqa { if (track1.sign() * track2.sign() < 0) { if (!isMix) { - if (std::abs(mother.Rapidity()) < 0.5) { + if (std::abs(mother.Rapidity()) < selectionConfig.rapidityMotherData) { hInvMass.fill(HIST("h3KstarInvMassUnlikeSign"), multiplicity, mother.Pt(), mother.M(), cosThetaStarProduction); } for (int i = 0; i < cRotations; i++) { @@ -642,15 +699,15 @@ struct Kstarqa { daughterRot = ROOT::Math::PxPyPzMVector(daughter1.Px() * std::cos(theta2) - daughter1.Py() * std::sin(theta2), daughter1.Px() * std::sin(theta2) + daughter1.Py() * std::cos(theta2), daughter1.Pz(), daughter1.M()); motherRot = daughterRot + daughter2; - if (calcRotational && std::abs(motherRot.Rapidity()) < 0.5) + if (calcRotational && std::abs(motherRot.Rapidity()) < selectionConfig.rapidityMotherData) hInvMass.fill(HIST("h3KstarInvMassRotated"), multiplicity, motherRot.Pt(), motherRot.M(), cosThetaStarProduction); } - } else if (isMix && std::abs(mother.Rapidity()) < 0.5) { + } else if (isMix && std::abs(mother.Rapidity()) < selectionConfig.rapidityMotherData) { hInvMass.fill(HIST("h3KstarInvMassMixed"), multiplicity, mother.Pt(), mother.M(), cosThetaStarProduction); } } else { if (!isMix) { - if (calcLikeSign && std::abs(mother.Rapidity()) < 0.5) { + if (calcLikeSign && std::abs(mother.Rapidity()) < selectionConfig.rapidityMotherData) { if (track1.sign() > 0 && track2.sign() > 0) { hInvMass.fill(HIST("h3KstarInvMasslikeSignPP"), multiplicity, mother.Pt(), mother.M(), cosThetaStarProduction); } else if (track1.sign() < 0 && track2.sign() < 0) { @@ -665,7 +722,7 @@ struct Kstarqa { if (track1.sign() * track2.sign() < 0) { if (!isMix) { - if (std::abs(mother.Rapidity()) < 0.5) { + if (std::abs(mother.Rapidity()) < selectionConfig.rapidityMotherData) { hInvMass.fill(HIST("h3KstarInvMassUnlikeSign"), multiplicity, mother.Pt(), mother.M(), cosThetaStarBeam); } for (int i = 0; i < cRotations; i++) { @@ -673,14 +730,14 @@ struct Kstarqa { daughterRot = ROOT::Math::PxPyPzMVector(daughter1.Px() * std::cos(theta2) - daughter1.Py() * std::sin(theta2), daughter1.Px() * std::sin(theta2) + daughter1.Py() * std::cos(theta2), daughter1.Pz(), daughter1.M()); motherRot = daughterRot + daughter2; - if (calcRotational && std::abs(motherRot.Rapidity()) < 0.5) + if (calcRotational && std::abs(motherRot.Rapidity()) < selectionConfig.rapidityMotherData) hInvMass.fill(HIST("h3KstarInvMassRotated"), multiplicity, motherRot.Pt(), motherRot.M(), cosThetaStarBeam); } - } else if (isMix && std::abs(mother.Rapidity()) < 0.5) { + } else if (isMix && std::abs(mother.Rapidity()) < selectionConfig.rapidityMotherData) { hInvMass.fill(HIST("h3KstarInvMassMixed"), multiplicity, mother.Pt(), mother.M(), cosThetaStarBeam); } } else { - if (calcLikeSign && std::abs(mother.Rapidity()) < 0.5) { + if (calcLikeSign && std::abs(mother.Rapidity()) < selectionConfig.rapidityMotherData) { if (track1.sign() > 0 && track2.sign() > 0) { hInvMass.fill(HIST("h3KstarInvMasslikeSignPP"), multiplicity, mother.Pt(), mother.M(), cosThetaStarBeam); } else if (track1.sign() < 0 && track2.sign() < 0) { @@ -697,7 +754,7 @@ struct Kstarqa { if (track1.sign() * track2.sign() < 0) { if (!isMix) { - if (std::abs(mother.Rapidity()) < 0.5) { + if (std::abs(mother.Rapidity()) < selectionConfig.rapidityMotherData) { hInvMass.fill(HIST("h3KstarInvMassUnlikeSign"), multiplicity, mother.Pt(), mother.M(), cosThetaStarRandom); } for (int i = 0; i < cRotations; i++) { @@ -705,15 +762,15 @@ struct Kstarqa { daughterRot = ROOT::Math::PxPyPzMVector(daughter1.Px() * std::cos(theta2) - daughter1.Py() * std::sin(theta2), daughter1.Px() * std::sin(theta2) + daughter1.Py() * std::cos(theta2), daughter1.Pz(), daughter1.M()); motherRot = daughterRot + daughter2; - if (calcRotational && std::abs(motherRot.Rapidity()) < 0.5) + if (calcRotational && std::abs(motherRot.Rapidity()) < selectionConfig.rapidityMotherData) hInvMass.fill(HIST("h3KstarInvMassRotated"), multiplicity, motherRot.Pt(), motherRot.M(), cosThetaStarRandom); } - } else if (isMix && std::abs(mother.Rapidity()) < 0.5) { + } else if (isMix && std::abs(mother.Rapidity()) < selectionConfig.rapidityMotherData) { hInvMass.fill(HIST("h3KstarInvMassMixed"), multiplicity, mother.Pt(), mother.M(), cosThetaStarRandom); } } else { if (!isMix) { - if (calcLikeSign && std::abs(mother.Rapidity()) < 0.5) { + if (calcLikeSign && std::abs(mother.Rapidity()) < selectionConfig.rapidityMotherData) { if (track1.sign() > 0 && track2.sign() > 0) { hInvMass.fill(HIST("h3KstarInvMasslikeSignPP"), multiplicity, mother.Pt(), mother.M(), cosThetaStarRandom); } else if (track1.sign() < 0 && track2.sign() < 0) { @@ -727,16 +784,13 @@ struct Kstarqa { } // int counter = 0; - void processSE(EventCandidates::iterator const& collision, TrackCandidates const& tracks, aod::BCs const&) { - rEventSelection.fill(HIST("events_check_data"), 0.5); // if (cTVXEvsel && (!collision.selection_bit(aod::evsel::kIsTriggerTVX))) { // return; // } - // rEventSelection.fill(HIST("events_check_data"), 1.5); // if (timFrameEvsel && (!collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(aod::evsel::kNoITSROFrameBorder))) { // return; @@ -745,27 +799,28 @@ struct Kstarqa { // if (!collision.sel8()) { // return; // } - // rEventSelection.fill(HIST("events_check_data"), 2.5); if (!selectionEvent(collision, true)) { return; } - rEventSelection.fill(HIST("events_check_data"), 3.5); + int occupancy = collision.trackOccupancyInTimeRange(); + rEventSelection.fill(HIST("hOccupancy"), occupancy); multiplicity = -1; - if (cSelectMultEstimator == 0) { + if (cSelectMultEstimator == kFT0M) { multiplicity = collision.centFT0M(); - } else if (cSelectMultEstimator == 1) { + } else if (cSelectMultEstimator == kFT0A) { multiplicity = collision.centFT0A(); - } else if (cSelectMultEstimator == 2) { + } else if (cSelectMultEstimator == kFT0C) { multiplicity = collision.centFT0C(); - } else if (cSelectMultEstimator == 3) { + } else if (cSelectMultEstimator == kFV0A) { multiplicity = collision.centFV0A(); } else { - multiplicity = collision.centFT0M(); + multiplicity = collision.centFT0M(); // default } + /* else if (cSelectMultEstimator == 4) { multiplicity = collision.centMFT(); } */ @@ -787,13 +842,14 @@ struct Kstarqa { } for (const auto& [track1, track2] : combinations(CombinationsFullIndexPolicy(tracks, tracks))) { + rEventSelection.fill(HIST("tracksCheckData"), 0.5); if (!selectionTrack(track1)) { continue; } if (!selectionTrack(track2)) { continue; } - rEventSelection.fill(HIST("events_check_data"), 4.5); + rEventSelection.fill(HIST("tracksCheckData"), 1.5); if (cQAplots) { hPID.fill(HIST("Before/hNsigmaTPC_Ka_before"), track1.pt(), track1.tpcNSigmaKa()); @@ -825,11 +881,6 @@ struct Kstarqa { } } - rEventSelection.fill(HIST("events_check_data"), 5.5); - // if (counter < 1e4) - // std::cout << "TOF beta value is " << track1.beta() << std::endl; - // counter++; - if (cQAevents) { rEventSelection.fill(HIST("hDcaxy"), track1.dcaXY()); rEventSelection.fill(HIST("hDcaz"), track1.dcaZ()); @@ -846,7 +897,7 @@ struct Kstarqa { if (applypTdepPID && !selectionPIDNew(track2, 0)) // Track 2 is checked with Pion continue; - rEventSelection.fill(HIST("events_check_data"), 6.5); + rEventSelection.fill(HIST("tracksCheckData"), 2.5); if (cFakeTrack && isFakeTrack(track1, 1)) // Kaon continue; @@ -862,7 +913,7 @@ struct Kstarqa { // continue; // } - rEventSelection.fill(HIST("events_check_data"), 7.5); + rEventSelection.fill(HIST("tracksCheckData"), 3.5); if (cQAplots) { hPID.fill(HIST("After/hDcaxyPi"), track2.dcaXY()); @@ -887,7 +938,7 @@ struct Kstarqa { if (track1.globalIndex() == track2.globalIndex()) continue; - rEventSelection.fill(HIST("events_check_data"), 8.5); + rEventSelection.fill(HIST("tracksCheckData"), 4.5); daughter1 = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa); daughter2 = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massPi); @@ -950,7 +1001,7 @@ struct Kstarqa { isMix = true; - if (std::abs(mother.Rapidity()) < 0.5) { + if (std::abs(mother.Rapidity()) < selectionConfig.rapidityMotherData) { fillInvMass(daughter1, daughter2, mother, multiplicity, isMix, t1, t2); } } @@ -958,25 +1009,22 @@ struct Kstarqa { }; // Call mixing based on selected estimator - if (cSelectMultEstimator == 0) { + if (cSelectMultEstimator == kFT0M) { runMixing(pair1, [](const auto& c) { return c.centFT0M(); }); - } else if (cSelectMultEstimator == 1) { + } else if (cSelectMultEstimator == kFT0A) { runMixing(pair2, [](const auto& c) { return c.centFT0A(); }); - } else if (cSelectMultEstimator == 2) { + } else if (cSelectMultEstimator == kFT0C) { runMixing(pair3, [](const auto& c) { return c.centFT0C(); }); - } else if (cSelectMultEstimator == 3) { + } else if (cSelectMultEstimator == kFV0A) { runMixing(pair4, [](const auto& c) { return c.centFV0A(); }); } } PROCESS_SWITCH(Kstarqa, processME, "Process Mixed event", true); - void processGen(aod::McCollision const& mcCollision, aod::McParticles const& mcParticles, const soa::SmallGroups& collisions) + void processGen(EventMCGenerated::iterator const& mcCollision, aod::McParticles const& mcParticles, const soa::SmallGroups& collisions) { - rEventSelection.fill(HIST("events_check"), 0.5); - if (std::abs(mcCollision.posZ()) < selectionConfig.cutzvertex) { - rEventSelection.fill(HIST("events_check"), 1.5); - } + rEventSelection.fill(HIST("eventsCheckGen"), 0.5); int nChInel = 0; for (const auto& mcParticle : mcParticles) { @@ -988,64 +1036,83 @@ struct Kstarqa { } } if (nChInel > 0 && std::abs(mcCollision.posZ()) < selectionConfig.cutzvertex) - rEventSelection.fill(HIST("events_check"), 2.5); + rEventSelection.fill(HIST("eventsCheckGen"), 1.5); std::vector selectedEvents(collisions.size()); int nevts = 0; multiplicity = -1.0; + // float impactParameter = mcCollision.impactParameter(); + + if (selectionConfig.isINELgt0 && !mcCollision.isInelGt0()) { + return; + } + rEventSelection.fill(HIST("eventsCheckGen"), 2.5); + for (const auto& collision : collisions) { // if (!collision.sel8() || std::abs(collision.mcCollision().posZ()) > selectionConfig.cutzvertex) { - if (std::abs(collision.mcCollision().posZ()) > selectionConfig.cutzvertex) { - continue; - } - if (!collision.sel8()) { - continue; - } - if (selectionConfig.isNoTimeFrameBorder && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { - continue; - } - if (selectionConfig.isTriggerTVX && !collision.selection_bit(aod::evsel::kIsTriggerTVX)) { - continue; - } - if (selectionConfig.isINELgt0 && !collision.isInelGt0()) { - continue; - } - if (selectionConfig.isNoSameBunchPileup && !collision.selection_bit(aod::evsel::kNoSameBunchPileup)) { - continue; - } - if (selectionConfig.isGoodZvtxFT0vsPV && !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { + // if (std::abs(collision.mcCollision().posZ()) > selectionConfig.cutzvertex) { + // continue; + // } + // if (!collision.sel8()) { + // continue; + // } + // if (selectionConfig.isNoTimeFrameBorder && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { + // continue; + // } + // if (selectionConfig.isTriggerTVX && !collision.selection_bit(aod::evsel::kIsTriggerTVX)) { + // continue; + // } + // if (selectionConfig.isINELgt0 && !collision.isInelGt0()) { + // continue; + // } + // if (selectionConfig.isNoSameBunchPileup && !collision.selection_bit(aod::evsel::kNoSameBunchPileup)) { + // continue; + // } + // if (selectionConfig.isGoodZvtxFT0vsPV && !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { + // continue; + // } + if (!selectionEvent(collision, true)) { continue; } multiplicity = collision.centFT0M(); hInvMass.fill(HIST("h1GenMult"), multiplicity); + + int occupancy = collision.trackOccupancyInTimeRange(); + rEventSelection.fill(HIST("hOccupancy"), occupancy); + selectedEvents[nevts++] = collision.mcCollision_as().globalIndex(); } selectedEvents.resize(nevts); - rEventSelection.fill(HIST("events_check"), 3.5); - const auto evtReconstructedAndSelected = std::find(selectedEvents.begin(), selectedEvents.end(), mcCollision.globalIndex()) != selectedEvents.end(); + for (const auto& mcParticle : mcParticles) { + if (std::abs(mcParticle.y()) < selectionConfig.rapidityMotherData && std::abs(mcParticle.pdgCode()) == o2::constants::physics::kK0Star892) { + hInvMass.fill(HIST("hAllKstarGenCollisisons"), multiplicity, mcParticle.pt()); + } + } + const auto evtReconstructedAndSelected = std::find(selectedEvents.begin(), selectedEvents.end(), mcCollision.globalIndex()) != selectedEvents.end(); + hInvMass.fill(HIST("hAllGenCollisions"), multiplicity); if (!cAllGenCollisions && !evtReconstructedAndSelected) { // Check that the event is reconstructed and that the reconstructed events pass the selection return; } - rEventSelection.fill(HIST("events_check"), 4.5); + hInvMass.fill(HIST("hAllGenCollisions1Rec"), multiplicity); + rEventSelection.fill(HIST("eventsCheckGen"), 3.5); for (const auto& mcParticle : mcParticles) { - if (std::abs(mcParticle.y()) >= 0.5) { + + if (std::abs(mcParticle.y()) >= selectionConfig.rapidityMotherData) { continue; } - rEventSelection.fill(HIST("events_check"), 5.5); if (std::abs(mcParticle.pdgCode()) != o2::constants::physics::kK0Star892) { continue; } - rEventSelection.fill(HIST("events_check"), 6.5); + hInvMass.fill(HIST("hAllKstarGenCollisisons1Rec"), multiplicity, mcParticle.pt()); auto kDaughters = mcParticle.daughters_as(); - if (kDaughters.size() != 2) { + if (kDaughters.size() != selectionConfig.noOfDaughters) { continue; } - rEventSelection.fill(HIST("events_check"), 7.5); auto passkaon = false; auto passpion = false; @@ -1053,7 +1120,6 @@ struct Kstarqa { if (!kCurrentDaughter.isPhysicalPrimary()) { continue; } - rEventSelection.fill(HIST("events_check"), 8.5); if (std::abs(kCurrentDaughter.pdgCode()) == PDG_t::kKPlus) { passkaon = true; @@ -1073,83 +1139,84 @@ struct Kstarqa { } } PROCESS_SWITCH(Kstarqa, processGen, "Process Generated", false); - /* - void processEvtLossSigLossMC(aod::McCollisions::iterator const&, aod::McParticles const& mcParticles, const soa::SmallGroups& recCollisions) - { - - bool isSel = false; - // auto multiplicity1 = -999.; - for (const auto& RecCollision : recCollisions) { - if (!selectionEvent(RecCollision, false)) - continue; - - // if (cSelectMultEstimator == 0) { - // multiplicity1 = RecCollision.centFT0M(); - // } else if (cSelectMultEstimator == 1) { - // multiplicity1 = RecCollision.centFT0A(); - // } else if (cSelectMultEstimator == 2) { - // multiplicity1 = RecCollision.centFT0C(); - // } else { - // multiplicity1 = RecCollision.centFT0M(); - // } - isSel = true; - } + void processEvtLossSigLossMC(EventMCGenerated::iterator const& mcCollision, aod::McParticles const& mcParticles, const soa::SmallGroups& recCollisions) + { + if (selectionConfig.isINELgt0 && !mcCollision.isInelGt0()) { + return; + } + auto impactPar = mcCollision.impactParameter(); + hInvMass.fill(HIST("MCcorrections/hImpactParameterGen"), impactPar); - // Generated MC - for (const auto& mcPart : mcParticles) { - if (std::abs(mcPart.y()) >= 0.5 || std::abs(mcPart.pdgCode()) != o2::constants::physics::kK0Star892) - continue; + bool isSelectedEvent = false; + auto multiplicity1 = -999.; + for (const auto& RecCollision : recCollisions) { + if (!selectionEvent(RecCollision, false)) + continue; + multiplicity1 = RecCollision.centFT0M(); + isSelectedEvent = true; + } - // signal loss estimation - hInvMass.fill(HIST("kstargenBeforeEvtSel"), mcPart.pt()); - if (isSel) { - hInvMass.fill(HIST("kstargenAfterEvtSel"), mcPart.pt()); - } - } // end loop on gen particles + // Event loss + if (isSelectedEvent) { + hInvMass.fill(HIST("MCcorrections/hImpactParameterRec"), impactPar); + hInvMass.fill(HIST("MCcorrections/hImpactParametervsMultiplicity"), impactPar, multiplicity1); } - PROCESS_SWITCH(Kstarqa, processEvtLossSigLossMC, "Process Signal Loss, Event Loss", false); - */ + + // Generated MC + for (const auto& mcPart : mcParticles) { + if (std::abs(mcPart.y()) >= selectionConfig.rapidityMotherData || std::abs(mcPart.pdgCode()) != o2::constants::physics::kK0Star892) + continue; + + // signal loss estimation + hInvMass.fill(HIST("MCcorrections/hSignalLossDenominator"), mcPart.pt(), impactPar); + if (isSelectedEvent) { + hInvMass.fill(HIST("MCcorrections/hSignalLossNumerator"), mcPart.pt(), impactPar); + } + } // end loop on gen particles + } + PROCESS_SWITCH(Kstarqa, processEvtLossSigLossMC, "Process Signal Loss, Event Loss", false); + void processRec(EventCandidatesMC::iterator const& collision, TrackCandidatesMC const& tracks, aod::McParticles const&, aod::McCollisions const& /*mcCollisions*/) { - rEventSelection.fill(HIST("events_checkrec"), 0.5); - if (!collision.has_mcCollision()) { return; } - rEventSelection.fill(HIST("events_checkrec"), 1.5); if (selectionConfig.isINELgt0 && !collision.isInelGt0()) { return; } + multiplicity = collision.centFT0M(); + hInvMass.fill(HIST("hAllRecCollisions"), multiplicity); - // if (std::abs(collision.mcCollision().posZ()) > selectionConfig.cutzvertex || !collision.sel8()) { - if (std::abs(collision.mcCollision().posZ()) > selectionConfig.cutzvertex) { + if (!selectionEvent(collision, false)) { return; } - rEventSelection.fill(HIST("events_checkrec"), 2.5); - if (selectionConfig.isNoTimeFrameBorder && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { - return; - } - rEventSelection.fill(HIST("events_checkrec"), 3.5); + // // if (std::abs(collision.mcCollision().posZ()) > selectionConfig.cutzvertex || !collision.sel8()) { + // if (std::abs(collision.mcCollision().posZ()) > selectionConfig.cutzvertex) { + // return; + // } - if (selectionConfig.isTriggerTVX && !collision.selection_bit(aod::evsel::kIsTriggerTVX)) { - return; - } - rEventSelection.fill(HIST("events_checkrec"), 4.5); + // if (selectionConfig.isNoTimeFrameBorder && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { + // return; + // } - if (!collision.sel8()) { - return; - } + // if (selectionConfig.isTriggerTVX && !collision.selection_bit(aod::evsel::kIsTriggerTVX)) { + // return; + // } - if (selectionConfig.isNoSameBunchPileup && !collision.selection_bit(aod::evsel::kNoSameBunchPileup)) { - return; - } - if (selectionConfig.isGoodZvtxFT0vsPV && !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { - return; - } + // if (!collision.sel8()) { + // return; + // } + + // if (selectionConfig.isNoSameBunchPileup && !collision.selection_bit(aod::evsel::kNoSameBunchPileup)) { + // return; + // } + // if (selectionConfig.isGoodZvtxFT0vsPV && !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { + // return; + // } multiplicity = collision.centFT0M(); hInvMass.fill(HIST("h1RecMult"), multiplicity); @@ -1159,35 +1226,34 @@ struct Kstarqa { if (!selectionTrack(track1)) { continue; } - rEventSelection.fill(HIST("events_checkrec"), 5.5); if (!track1.has_mcParticle()) { continue; } - rEventSelection.fill(HIST("events_checkrec"), 6.5); auto track1ID = track1.index(); for (const auto& track2 : tracks) { + rEventSelection.fill(HIST("recMCparticles"), 0.5); if (!track2.has_mcParticle()) { continue; } - rEventSelection.fill(HIST("events_checkrec"), 7.5); + rEventSelection.fill(HIST("recMCparticles"), 1.5); if (!selectionTrack(track2)) { continue; } - rEventSelection.fill(HIST("events_checkrec"), 8.5); + rEventSelection.fill(HIST("recMCparticles"), 2.5); auto track2ID = track2.index(); if (track2ID <= track1ID) { continue; } - rEventSelection.fill(HIST("events_checkrec"), 9.5); + rEventSelection.fill(HIST("recMCparticles"), 3.5); if (track1.sign() * track2.sign() >= 0) { continue; } - rEventSelection.fill(HIST("events_checkrec"), 10.5); + rEventSelection.fill(HIST("recMCparticles"), 4.5); const auto mctrack1 = track1.mcParticle(); const auto mctrack2 = track2.mcParticle(); @@ -1226,12 +1292,11 @@ struct Kstarqa { if (!mctrack1.isPhysicalPrimary()) { continue; } - rEventSelection.fill(HIST("events_checkrec"), 11.5); if (!mctrack2.isPhysicalPrimary()) { continue; } - rEventSelection.fill(HIST("events_checkrec"), 12.5); + rEventSelection.fill(HIST("recMCparticles"), 5.5); // if (!(track1PDG == PDG_t::kKPlus && track2PDG == PDG_t::kPiPlus)) { // continue; @@ -1242,34 +1307,33 @@ struct Kstarqa { if ((track2PDG != PDG_t::kPiPlus) && (track2PDG != PDG_t::kKPlus)) { continue; } - rEventSelection.fill(HIST("events_checkrec"), 13.5); - rEventSelection.fill(HIST("events_checkrec"), 14.5); + rEventSelection.fill(HIST("recMCparticles"), 6.5); for (const auto& mothertrack1 : mctrack1.mothers_as()) { for (const auto& mothertrack2 : mctrack2.mothers_as()) { if (mothertrack1.pdgCode() != mothertrack2.pdgCode()) { continue; } - rEventSelection.fill(HIST("events_checkrec"), 15.5); if (mothertrack1.globalIndex() != mothertrack2.globalIndex()) { continue; } - rEventSelection.fill(HIST("events_checkrec"), 16.5); + rEventSelection.fill(HIST("recMCparticles"), 7.5); if (!mothertrack1.producedByGenerator()) { continue; } - rEventSelection.fill(HIST("events_checkrec"), 17.5); + rEventSelection.fill(HIST("recMCparticles"), 8.5); - if (std::abs(mothertrack1.y()) >= 0.5) { + if (std::abs(mothertrack1.y()) >= selectionConfig.rapidityMotherData) { continue; } - rEventSelection.fill(HIST("events_checkrec"), 18.5); + rEventSelection.fill(HIST("recMCparticles"), 9.5); if (std::abs(mothertrack1.pdgCode()) != o2::constants::physics::kK0Star892) { continue; } + rEventSelection.fill(HIST("recMCparticles"), 10.5); if (track1PDG == PDG_t::kPiPlus) { if (!applypTdepPID && !(selectionPID(track1, 0) && selectionPID(track2, 1))) { // pion and kaon @@ -1289,6 +1353,8 @@ struct Kstarqa { hInvMass.fill(HIST("h1KSRecsplit"), mothertrack1.pt()); continue; } + rEventSelection.fill(HIST("recMCparticles"), 11.5); + oldindex = mothertrack1.globalIndex(); if (track1.sign() * track2.sign() < 0) { daughter1 = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa); @@ -1297,7 +1363,7 @@ struct Kstarqa { hInvMass.fill(HIST("h2KstarRecpt2"), mothertrack1.pt(), multiplicity, std::sqrt(mothertrack1.e() * mothertrack1.e() - mothertrack1.p() * mothertrack1.p())); - if (applyRecMotherRapidity && mother.Rapidity() >= 0) { + if (applyRecMotherRapidity && mother.Rapidity() >= selectionConfig.rapidityMotherData) { continue; } From 3ce9b244d7e1ecea0c7b73d58015ed48213118bf Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Wed, 30 Jul 2025 07:39:07 +0200 Subject: [PATCH 131/345] [Common,PWGLF] Expose configurables inside TrackTuner in propagationService (#12306) Co-authored-by: David Dobrigkeit Chinellato Co-authored-by: ALICE Builder --- .../TableProducer/trackPropagationTester.cxx | 41 +++++++++++-------- Common/Tools/StandardCCDBLoader.h | 14 +++++-- Common/Tools/TrackPropagationModule.h | 25 ++++++----- .../Strangeness/propagationService.cxx | 12 ++++-- 4 files changed, 58 insertions(+), 34 deletions(-) diff --git a/Common/TableProducer/trackPropagationTester.cxx b/Common/TableProducer/trackPropagationTester.cxx index 694ff77d3c0..18543ee0994 100644 --- a/Common/TableProducer/trackPropagationTester.cxx +++ b/Common/TableProducer/trackPropagationTester.cxx @@ -23,24 +23,28 @@ // //=============================================================== -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" -#include "Framework/RunningWorkflowInfo.h" -#include "Common/DataModel/TrackSelectionTables.h" #include "Common/Core/trackUtilities.h" -#include "ReconstructionDataFormats/DCA.h" -#include "DetectorsBase/Propagator.h" -#include "DetectorsBase/GeometryManager.h" -#include "CommonUtils/NameConf.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/Tools/StandardCCDBLoader.h" +#include "Common/Tools/TrackPropagationModule.h" +#include "Common/Tools/TrackTuner.h" + +#include "CCDB/BasicCCDBManager.h" #include "CCDB/CcdbApi.h" +#include "CommonConstants/GeomConstants.h" +#include "CommonUtils/NameConf.h" +#include "DataFormatsCalibration/MeanVertexObject.h" #include "DataFormatsParameters/GRPMagField.h" -#include "CCDB/BasicCCDBManager.h" +#include "DetectorsBase/GeometryManager.h" +#include "DetectorsBase/Propagator.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" -#include "DataFormatsCalibration/MeanVertexObject.h" -#include "CommonConstants/GeomConstants.h" -#include "Common/Tools/TrackPropagationModule.h" -#include "Common/Tools/StandardCCDBLoader.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/DCA.h" + +#include // The Run 3 AO2D stores the tracks at the point of innermost update. For a track with ITS this is the innermost (or second innermost) // ITS layer. For a track without ITS, this is the TPC inner wall or for loopers in the TPC even a radius beyond that. @@ -59,6 +63,9 @@ struct TrackPropagationTester { o2::common::TrackPropagationProducts trackPropagationProducts; o2::common::TrackPropagationConfigurables trackPropagationConfigurables; + // the track tuner object -> needs to be here as it inherits from ConfigurableGroup (+ has its own copy of ccdbApi) + TrackTuner trackTunerObj; + // CCDB boilerplate declarations o2::framework::Configurable ccdburl{"ccdburl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Service ccdb; @@ -76,14 +83,14 @@ struct TrackPropagationTester { ccdb->setURL(ccdburl.value); // task-specific - trackPropagation.init(trackPropagationConfigurables, registry, initContext); + trackPropagation.init(trackPropagationConfigurables, trackTunerObj, registry, initContext); } void processReal(aod::Collisions const& collisions, soa::Join const& tracks, aod::Collisions const&, aod::BCs const& bcs) { // task-specific ccdbLoader.initCCDBfromBCs(standardCCDBLoaderConfigurables, ccdb, bcs); - trackPropagation.fillTrackTables(trackPropagationConfigurables, ccdbLoader, collisions, tracks, trackPropagationProducts, registry); + trackPropagation.fillTrackTables(trackPropagationConfigurables, trackTunerObj, ccdbLoader, collisions, tracks, trackPropagationProducts, registry); } PROCESS_SWITCH(TrackPropagationTester, processReal, "Process Real Data", true); @@ -91,7 +98,7 @@ struct TrackPropagationTester { void processMc(aod::Collisions const& collisions, soa::Join const& tracks, aod::McParticles const&, aod::Collisions const&, aod::BCs const& bcs) { ccdbLoader.initCCDBfromBCs(standardCCDBLoaderConfigurables, ccdb, bcs); - trackPropagation.fillTrackTables(trackPropagationConfigurables, ccdbLoader, collisions, tracks, trackPropagationProducts, registry); + trackPropagation.fillTrackTables(trackPropagationConfigurables, trackTunerObj, ccdbLoader, collisions, tracks, trackPropagationProducts, registry); } PROCESS_SWITCH(TrackPropagationTester, processMc, "Process Monte Carlo", false); }; diff --git a/Common/Tools/StandardCCDBLoader.h b/Common/Tools/StandardCCDBLoader.h index 6ba4c9be9a1..2134fec2666 100644 --- a/Common/Tools/StandardCCDBLoader.h +++ b/Common/Tools/StandardCCDBLoader.h @@ -16,12 +16,18 @@ #ifndef COMMON_TOOLS_STANDARDCCDBLOADER_H_ #define COMMON_TOOLS_STANDARDCCDBLOADER_H_ -#include -#include -#include -#include +#include "CCDB/BasicCCDBManager.h" +#include "DataFormatsCalibration/MeanVertexObject.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "DetectorsBase/GeometryManager.h" +#include "DetectorsBase/Propagator.h" #include "Framework/AnalysisDataModel.h" +#include +#include +#include +#include + //__________________________________________ // Standard class to load stuff // such as matLUT, B and mean Vertex diff --git a/Common/Tools/TrackPropagationModule.h b/Common/Tools/TrackPropagationModule.h index d8cc3fd4f28..305a7c774f2 100644 --- a/Common/Tools/TrackPropagationModule.h +++ b/Common/Tools/TrackPropagationModule.h @@ -16,16 +16,22 @@ #ifndef COMMON_TOOLS_TRACKPROPAGATIONMODULE_H_ #define COMMON_TOOLS_TRACKPROPAGATIONMODULE_H_ -#include -#include -#include -#include -#include +#include "TableHelper.h" + +#include "Common/Tools/TrackTuner.h" + +#include "DataFormatsCalibration/MeanVertexObject.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "DetectorsBase/Propagator.h" #include "Framework/AnalysisDataModel.h" #include "Framework/Configurable.h" #include "Framework/HistogramSpec.h" -#include "Common/Tools/TrackTuner.h" -#include "TableHelper.h" + +#include +#include +#include +#include +#include //__________________________________________ // track propagation module @@ -81,7 +87,6 @@ class TrackPropagationModule // pointers to objs needed for operation std::shared_ptr trackTunedTracks; - TrackTuner trackTunerObj; // Running variables std::array mDcaInfo; @@ -91,7 +96,7 @@ class TrackPropagationModule o2::track::TrackParametrizationWithError mTrackParCov; template - void init(TConfigurableGroup const& cGroup, THistoRegistry& registry, TInitContext& initContext) + void init(TConfigurableGroup const& cGroup, TrackTuner& trackTunerObj, THistoRegistry& registry, TInitContext& initContext) { // Checking if the tables are requested in the workflow and enabling them fillTracks = isTableRequiredInWorkflow(initContext, "Tracks"); @@ -154,7 +159,7 @@ class TrackPropagationModule } template - void fillTrackTables(TConfigurableGroup const& cGroup, TCCDBLoader const& ccdbLoader, TCollisions const& collisions, TTracks const& tracks, TOutputGroup& cursors, THistoRegistry& registry) + void fillTrackTables(TConfigurableGroup const& cGroup, TrackTuner& trackTunerObj, TCCDBLoader const& ccdbLoader, TCollisions const& collisions, TTracks const& tracks, TOutputGroup& cursors, THistoRegistry& registry) { if (!fillTracks) { return; // suppress everything diff --git a/PWGLF/TableProducer/Strangeness/propagationService.cxx b/PWGLF/TableProducer/Strangeness/propagationService.cxx index 6140dd2cc8b..191b920d9ef 100644 --- a/PWGLF/TableProducer/Strangeness/propagationService.cxx +++ b/PWGLF/TableProducer/Strangeness/propagationService.cxx @@ -31,6 +31,7 @@ #include "Common/DataModel/TrackSelectionTables.h" #include "Common/Tools/StandardCCDBLoader.h" #include "Common/Tools/TrackPropagationModule.h" +#include "Common/Tools/TrackTuner.h" #include "CCDB/BasicCCDBManager.h" #include "CCDB/CcdbApi.h" @@ -46,6 +47,8 @@ #include "Framework/runDataProcessing.h" #include "ReconstructionDataFormats/DCA.h" +#include + using namespace o2; using namespace o2::framework; // using namespace o2::framework::expressions; @@ -81,6 +84,9 @@ struct propagationService { o2::pwglf::strangenessbuilder::preSelectOpts preSelectOpts; o2::pwglf::strangenessbuilder::BuilderModule strangenessBuilderModule; + // the track tuner object -> needs to be here as it inherits from ConfigurableGroup (+ has its own copy of ccdbApi) + TrackTuner trackTunerObj; + // track propagation o2::common::TrackPropagationProducts trackPropagationProducts; o2::common::TrackPropagationConfigurables trackPropagationConfigurables; @@ -97,21 +103,21 @@ struct propagationService { ccdb->setURL(ccdburl.value); // task-specific - trackPropagation.init(trackPropagationConfigurables, histos, initContext); + trackPropagation.init(trackPropagationConfigurables, trackTunerObj, histos, initContext); strangenessBuilderModule.init(baseOpts, v0BuilderOpts, cascadeBuilderOpts, preSelectOpts, histos, initContext); } void processRealData(soa::Join const& collisions, aod::V0s const& v0s, aod::Cascades const& cascades, aod::TrackedCascades const& trackedCascades, FullTracksExtIU const& tracks, aod::BCsWithTimestamps const& bcs) { ccdbLoader.initCCDBfromBCs(standardCCDBLoaderConfigurables, ccdb, bcs); - trackPropagation.fillTrackTables(trackPropagationConfigurables, ccdbLoader, collisions, tracks, trackPropagationProducts, histos); + trackPropagation.fillTrackTables(trackPropagationConfigurables, trackTunerObj, ccdbLoader, collisions, tracks, trackPropagationProducts, histos); strangenessBuilderModule.dataProcess(ccdb, histos, collisions, static_cast(nullptr), v0s, cascades, trackedCascades, tracks, bcs, static_cast(nullptr), products); } void processMonteCarlo(soa::Join const& collisions, aod::McCollisions const& mccollisions, aod::V0s const& v0s, aod::Cascades const& cascades, aod::TrackedCascades const& trackedCascades, FullTracksExtLabeledIU const& tracks, aod::BCsWithTimestamps const& bcs, aod::McParticles const& mcParticles) { ccdbLoader.initCCDBfromBCs(standardCCDBLoaderConfigurables, ccdb, bcs); - trackPropagation.fillTrackTables(trackPropagationConfigurables, ccdbLoader, collisions, tracks, trackPropagationProducts, histos); + trackPropagation.fillTrackTables(trackPropagationConfigurables, trackTunerObj, ccdbLoader, collisions, tracks, trackPropagationProducts, histos); strangenessBuilderModule.dataProcess(ccdb, histos, collisions, mccollisions, v0s, cascades, trackedCascades, tracks, bcs, mcParticles, products); } From 715fb52e1378b763eaee921b8ff01db7da84e81d Mon Sep 17 00:00:00 2001 From: Pritam Chakraborty <47203359+prchakra@users.noreply.github.com> Date: Wed, 30 Jul 2025 10:10:13 +0200 Subject: [PATCH 132/345] [PWGCF] FemtoUniverse: Fixing the bug in phi calculation at R (#12315) --- PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h b/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h index a8a9b2daf57..65344e45bba 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h @@ -580,7 +580,7 @@ class FemtoUniverseDetaDphiStar for (size_t i = 0; i < 9; i++) { double arg = 0.3 * charge * magfield * TmpRadiiTPC[i] * 0.01 / (2. * pt); if (std::abs(arg) < 1.0) { - tmpVec.push_back(phi0 - std::asin(arg)); + tmpVec.push_back(phi0 + std::asin(arg)); } else { tmpVec.push_back(999.0); } From 33e39e1a73f1ae4d53eac3edd1136035e4a93e0b Mon Sep 17 00:00:00 2001 From: sawan <124118453+sawankumawat@users.noreply.github.com> Date: Wed, 30 Jul 2025 14:09:27 +0530 Subject: [PATCH 133/345] [PWGLF] Added cuts on particle mother (#12323) Co-authored-by: Sawan Sawan --- PWGLF/Tasks/Resonances/kstarqa.cxx | 54 ++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarqa.cxx b/PWGLF/Tasks/Resonances/kstarqa.cxx index 21f4db8e9c8..f356e53d4ab 100644 --- a/PWGLF/Tasks/Resonances/kstarqa.cxx +++ b/PWGLF/Tasks/Resonances/kstarqa.cxx @@ -102,6 +102,12 @@ struct Kstarqa { Configurable cfgRCRFC{"cfgRCRFC", 0.8f, "Crossed Rows to Findable Clusters"}; Configurable cfgITSChi2NCl{"cfgITSChi2NCl", 36.0, "ITS Chi2/NCl"}; Configurable cfgTPCChi2NCl{"cfgTPCChi2NCl", 4.0, "TPC Chi2/NCl"}; + Configurable cfgUseITSTPCRefit{"cfgUseITSTPCRefit", false, "Require ITS Refit"}; + + // cuts on mother + Configurable isApplyCutsOnMother{"isApplyCutsOnMother", false, "Enable additional cuts on Kstar mother"}; + Configurable cMaxPtMotherCut{"cMaxPtMotherCut", 15.0, "Maximum pt of mother cut"}; + Configurable cMaxMinvMotherCut{"cMaxMinvMotherCut", 1.5, "Maximum mass of mother cut"}; // Other fixed variables float lowPtCutPID = 0.5; @@ -405,8 +411,31 @@ struct Kstarqa { template bool selectionTrack(const T& candidate) { - if (selectionConfig.isGlobalTracks && !(candidate.isGlobalTrackWoDCA() && candidate.isPVContributor() && std::abs(candidate.dcaXY()) < selectionConfig.cfgCutDCAxy && std::abs(candidate.dcaZ()) < selectionConfig.cfgCutDCAz && candidate.itsNCls() > selectionConfig.cfgITScluster && candidate.tpcNClsFound() > selectionConfig.cfgTPCcluster && std::abs(candidate.eta()) < selectionConfig.cfgCutEta && std::abs(candidate.pt()) > selectionConfig.cfgCutPT)) { - return false; + if (selectionConfig.isGlobalTracks) { + if (!candidate.isGlobalTrackWoDCA()) + return false; + if (std::abs(candidate.pt()) < selectionConfig.cfgCutPT) + return false; + if (std::abs(candidate.eta()) > selectionConfig.cfgCutEta) + return false; + if (std::abs(candidate.dcaXY()) > selectionConfig.cfgCutDCAxy) + return false; + if (std::abs(candidate.dcaZ()) > selectionConfig.cfgCutDCAz) + return false; + if (candidate.tpcCrossedRowsOverFindableCls() < selectionConfig.cfgRCRFC) + return false; + if (candidate.itsNCls() < selectionConfig.cfgITScluster) + return false; + if (candidate.tpcNClsFound() < selectionConfig.cfgTPCcluster) + return false; + if (candidate.itsChi2NCl() >= selectionConfig.cfgITSChi2NCl) + return false; + if (candidate.tpcChi2NCl() >= selectionConfig.cfgTPCChi2NCl) + return false; + if (selectionConfig.cfgPVContributor && !candidate.isPVContributor()) + return false; + if (selectionConfig.cfgUseITSTPCRefit && (!(o2::aod::track::ITSrefit) || !(o2::aod::track::TPCrefit))) + return false; } else if (!selectionConfig.isGlobalTracks) { if (std::abs(candidate.pt()) < selectionConfig.cfgCutPT) return false; @@ -944,6 +973,13 @@ struct Kstarqa { daughter2 = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massPi); mother = daughter1 + daughter2; // Kstar meson + if (selectionConfig.isApplyCutsOnMother) { + if (mother.Pt() >= selectionConfig.cMaxPtMotherCut) // excluding candidates in overflow + continue; + if (mother.M() >= selectionConfig.cMaxMinvMotherCut) // excluding candidates in overflow + continue; + } + hOthers.fill(HIST("hKstar_Rap"), mother.Rapidity()); hOthers.fill(HIST("hKstar_Eta"), mother.Eta()); @@ -1104,6 +1140,13 @@ struct Kstarqa { continue; } + if (selectionConfig.isApplyCutsOnMother) { + if (mcParticle.pt() >= selectionConfig.cMaxPtMotherCut) // excluding candidates in overflow + continue; + if ((std::sqrt(mcParticle.e() * mcParticle.e() - mcParticle.p() * mcParticle.p())) >= selectionConfig.cMaxMinvMotherCut) // excluding candidates in overflow + continue; + } + if (std::abs(mcParticle.pdgCode()) != o2::constants::physics::kK0Star892) { continue; } @@ -1349,6 +1392,13 @@ struct Kstarqa { } } + if (selectionConfig.isApplyCutsOnMother) { + if (mothertrack1.pt() >= selectionConfig.cMaxPtMotherCut) // excluding candidates in overflow + continue; + if ((std::sqrt(mothertrack1.e() * mothertrack1.e() - mothertrack1.p() * mothertrack1.p())) >= selectionConfig.cMaxMinvMotherCut) // excluding candidates in overflow + continue; + } + if (avoidsplitrackMC && oldindex == mothertrack1.globalIndex()) { hInvMass.fill(HIST("h1KSRecsplit"), mothertrack1.pt()); continue; From a675a2e293a602fa06c575f4a93d2744ebf1739f Mon Sep 17 00:00:00 2001 From: Shirajum Monira <38348689+Eloviyo@users.noreply.github.com> Date: Wed, 30 Jul 2025 12:31:10 +0200 Subject: [PATCH 134/345] [PWGCF] FemtoUniverse cascade task -- Pid bitmask implementation on cascade task (#12310) Co-authored-by: Shirajum Monira --- .../Core/FemtoUniverseParticleHisto.h | 14 +- ...toUniversePairTaskTrackCascadeExtended.cxx | 498 ++++++++++++------ 2 files changed, 351 insertions(+), 161 deletions(-) diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniverseParticleHisto.h b/PWGCF/FemtoUniverse/Core/FemtoUniverseParticleHisto.h index 865efa0f36d..dc46dae8df7 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniverseParticleHisto.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniverseParticleHisto.h @@ -20,11 +20,13 @@ #ifndef PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSEPARTICLEHISTO_H_ #define PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSEPARTICLEHISTO_H_ -#include -#include #include "PWGCF/FemtoUniverse/DataModel/FemtoDerived.h" -#include "Framework/HistogramRegistry.h" + #include "CommonConstants/MathConstants.h" +#include "Framework/HistogramRegistry.h" + +#include +#include using namespace o2::framework; // o2-linter: disable=using-directive @@ -266,6 +268,10 @@ class FemtoUniverseParticleHisto if constexpr (mc == o2::aod::femtouniverse_mc_particle::MCType::kRecon) { mHistogramRegistry->fill(histFolder + HIST(o2::aod::femtouniverse_mc_particle::MCTypeName[mc]) + HIST(o2::aod::femtouniverseparticle::TempFitVarName[mParticleType]), part.pt(), part.tempFitVar()); } + if constexpr (mParticleType == o2::aod::femtouniverseparticle::ParticleType::kCascade) { + mHistogramRegistry->fill(histFolder + HIST(o2::aod::femtouniverse_mc_particle::MCTypeName[mc]) + HIST("/hInvMassXi"), part.mLambda()); + mHistogramRegistry->fill(histFolder + HIST(o2::aod::femtouniverse_mc_particle::MCTypeName[mc]) + HIST("/hInvMassOmega"), part.mAntiLambda()); + } } template @@ -318,8 +324,6 @@ class FemtoUniverseParticleHisto mHistogramRegistry->fill(histFolder + HIST(o2::aod::femtouniverse_mc_particle::MCTypeName[mc]) + HIST("/hDecayVtxX"), part.decayVtxX()); mHistogramRegistry->fill(histFolder + HIST(o2::aod::femtouniverse_mc_particle::MCTypeName[mc]) + HIST("/hDecayVtxY"), part.decayVtxY()); mHistogramRegistry->fill(histFolder + HIST(o2::aod::femtouniverse_mc_particle::MCTypeName[mc]) + HIST("/hDecayVtxZ"), part.decayVtxZ()); - mHistogramRegistry->fill(histFolder + HIST(o2::aod::femtouniverse_mc_particle::MCTypeName[mc]) + HIST("/hInvMassXi"), part.mLambda()); - mHistogramRegistry->fill(histFolder + HIST(o2::aod::femtouniverse_mc_particle::MCTypeName[mc]) + HIST("/hInvMassOmega"), part.mAntiLambda()); } } diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx index dd019a046db..f8b2582826d 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx @@ -14,22 +14,26 @@ /// \author Barbara Chytla, WUT Warsaw, barbara.chytla@cern.ch /// \author Shirajum Monira, WUT Warsaw, shirajum.monira@cern.ch -#include -#include -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/RunningWorkflowInfo.h" -#include "Framework/StepTHn.h" -#include "PWGCF/FemtoUniverse/DataModel/FemtoDerived.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniverseParticleHisto.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniverseEventHisto.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniversePairCleaner.h" #include "PWGCF/FemtoUniverse/Core/FemtoUniverseContainer.h" #include "PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseEventHisto.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniversePairCleaner.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseParticleHisto.h" #include "PWGCF/FemtoUniverse/Core/femtoUtils.h" +#include "PWGCF/FemtoUniverse/DataModel/FemtoDerived.h" + +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" #include "Framework/O2DatabasePDGPlugin.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/StepTHn.h" +#include "Framework/runDataProcessing.h" + +#include + +#include +#include using namespace o2; using namespace o2::soa; @@ -43,10 +47,8 @@ struct femtoUniversePairTaskTrackCascadeExtended { Service pdgMC; SliceCache cache; using FemtoFullParticles = soa::Join; - Preslice perCol = aod::femtouniverseparticle::fdCollisionId; - - using FemtoRecoParticles = soa::Join; - Preslice perColReco = aod::femtouniverseparticle::fdCollisionId; + using FemtoRecoFullParticles = soa::Join; + using FemtoRecoBasicParticles = soa::Join; ConfigurableAxis confChildTempFitVarpTBins{"confChildTempFitVarpTBins", {20, 0.5, 4.05}, "V0 child: pT binning of the pT vs. TempFitVar plot"}; ConfigurableAxis confChildTempFitVarBins{"confChildTempFitVarBins", {300, -0.15, 0.15}, "V0 child: binning of the TempFitVar in the pT vs. TempFitVar plot"}; @@ -83,6 +85,7 @@ struct femtoUniversePairTaskTrackCascadeExtended { Configurable confNsigmaTPCParticle{"confNsigmaTPCParticle", 3.0, "TPC Sigma for particle (track) momentum < Confmom"}; Configurable confNsigmaCombinedParticle{"confNsigmaCombinedParticle", 3.0, "TPC and TOF Sigma (combined) for particle (track) momentum > Confmom"}; Configurable confNsigmaTPCParticleChild{"confNsigmaTPCParticleChild", 3.0, "TPC Sigma for particle (daugh & bach) momentum < Confmom"}; + Configurable confCheckTOFBachelorOnly{"confCheckTOFBachelorOnly", false, "Enable TOF for Cascade bachelor only"}; Configurable confNsigmaTOFParticleChild{"confNsigmaTOFParticleChild", 3.0, "TOF Sigma for particle (daugh & bach) momentum > Confmom"}; ConfigurableAxis confkstarBins{"confkstarBins", {1500, 0., 6.}, "binning kstar"}; @@ -105,18 +108,21 @@ struct femtoUniversePairTaskTrackCascadeExtended { using FilteredFDCollisions = soa::Filtered; using FilteredFDCollision = FilteredFDCollisions::iterator; - /// Partition for particle 1 (track) - Partition partsOne = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && (aod::femtouniverseparticle::sign == confChargePart1) && (nabs(aod::femtouniverseparticle::eta) < confEta) && (aod::femtouniverseparticle::pt < confHPtPart1) && (aod::femtouniverseparticle::pt > confLPtPart1); - Partition partsOneMCgen = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kMCTruthTrack)) && (nabs(aod::femtouniverseparticle::eta) < confEta) && (aod::femtouniverseparticle::pt < confHPtPart1) && (aod::femtouniverseparticle::pt > confLPtPart1); - Partition partsOneMCreco = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && (aod::femtouniverseparticle::sign == confChargePart1) && (nabs(aod::femtouniverseparticle::eta) < confEta) && (aod::femtouniverseparticle::pt < confHPtPart1) && (aod::femtouniverseparticle::pt > confLPtPart1); + /// Partition for particle 1 using extended table (track) + Partition partsOneFull = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && (aod::femtouniverseparticle::mAntiLambda == confChargePart1) && (nabs(aod::femtouniverseparticle::eta) < confEta) && (aod::femtouniverseparticle::pt < confHPtPart1) && (aod::femtouniverseparticle::pt > confLPtPart1); + + /// Partition for particle 1 without extended table (track) + Partition partsOneBasic = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && (aod::femtouniverseparticle::mAntiLambda == confChargePart1) && (nabs(aod::femtouniverseparticle::eta) < confEta) && (aod::femtouniverseparticle::pt < confHPtPart1) && (aod::femtouniverseparticle::pt > confLPtPart1); + Partition partsOneMCgenBasic = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kMCTruthTrack)) && (nabs(aod::femtouniverseparticle::eta) < confEta) && (aod::femtouniverseparticle::pt < confHPtPart1) && (aod::femtouniverseparticle::pt > confLPtPart1); + Partition partsOneMCrecoBasic = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && (aod::femtouniverseparticle::mAntiLambda == confChargePart1) && (nabs(aod::femtouniverseparticle::eta) < confEta) && (aod::femtouniverseparticle::pt < confHPtPart1) && (aod::femtouniverseparticle::pt > confLPtPart1); - /// Partition for particle 2 (cascade) - Partition partsTwo = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kCascade)) && (aod::femtouniverseparticle::pt < confHPtPart2) && (aod::femtouniverseparticle::pt > confLPtPart2); - Partition partsTwoMCgen = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kMCTruthTrack)) && (aod::femtouniverseparticle::pt < confHPtPart2) && (aod::femtouniverseparticle::pt > confLPtPart2); - Partition partsTwoMCreco = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kCascade)) && (aod::femtouniverseparticle::pt < confHPtPart2) && (aod::femtouniverseparticle::pt > confLPtPart2); + /// Partition for particle 2 using extended table (cascade) + Partition partsTwoFull = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kCascade)) && (aod::femtouniverseparticle::pt < confHPtPart2) && (aod::femtouniverseparticle::pt > confLPtPart2); - /// Partition for cascades - Partition cascs = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kCascade)); + /// Partition for particle 2 without extended table (cascade) + Partition partsTwoBasic = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kCascade)) && (aod::femtouniverseparticle::pt < confHPtPart2) && (aod::femtouniverseparticle::pt > confLPtPart2); + Partition partsTwoMCgenBasic = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kMCTruthTrack)) && (aod::femtouniverseparticle::pt < confHPtPart2) && (aod::femtouniverseparticle::pt > confLPtPart2); + Partition partsTwoMCrecoBasic = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kCascade)) && (aod::femtouniverseparticle::pt < confHPtPart2) && (aod::femtouniverseparticle::pt > confLPtPart2); /// Histogramming for track particle FemtoUniverseParticleHisto trackHistoPartOnePos; @@ -357,9 +363,15 @@ struct femtoUniversePairTaskTrackCascadeExtended { } } PROCESS_SWITCH(femtoUniversePairTaskTrackCascadeExtended, processCascades, "Enable processing cascades", false); + + template + using hasSigma = decltype(std::declval().tpcNSigmaStorePr()); + /// track - cascade correlations - void processSameEvent(const FilteredFDCollision& col, const FemtoFullParticles& parts) + template + void doSameEvent(const FilteredFDCollision& col, const TableType& parts, PartitionType& partsOne, PartitionType& partsTwo) { + auto groupPartsOne = partsOne->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); auto groupPartsTwo = partsTwo->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); @@ -371,70 +383,110 @@ struct femtoUniversePairTaskTrackCascadeExtended { if (!invMCascade(part.mLambda(), part.mAntiLambda(), confCascType1)) /// mLambda stores Xi mass, mAntiLambda stores Omega mass continue; - cascQAHistos.fillQA(part); + if constexpr (std::experimental::is_detected::value) + cascQAHistos.fillQA(part); + else + cascQAHistos.fillQA(part); - const auto& posChild = parts.iteratorAt(part.index() - 3); - const auto& negChild = parts.iteratorAt(part.index() - 2); - const auto& bachelor = parts.iteratorAt(part.index() - 1); + const auto& posChild = parts.iteratorAt(part.globalIndex() - 3 - parts.begin().globalIndex()); + const auto& negChild = parts.iteratorAt(part.globalIndex() - 2 - parts.begin().globalIndex()); + const auto& bachelor = parts.iteratorAt(part.globalIndex() - 1 - parts.begin().globalIndex()); /// Child particles must pass this condition to be selected - if (!isParticleTPC(posChild, CascChildTable[confCascType1][0]) || !isParticleTPC(negChild, CascChildTable[confCascType1][1]) || !isParticleTPC(bachelor, CascChildTable[confCascType1][2])) - continue; + if constexpr (std::experimental::is_detected::value) { + if (!isParticleTPC(posChild, CascChildTable[confCascType1][0]) || !isParticleTPC(negChild, CascChildTable[confCascType1][1]) || !isParticleTPC(bachelor, CascChildTable[confCascType1][2])) + continue; - if (!isParticleTOF(posChild, CascChildTable[confCascType1][0]) || !isParticleTOF(negChild, CascChildTable[confCascType1][1]) || !isParticleTOF(bachelor, CascChildTable[confCascType1][2])) - continue; + if ((!confCheckTOFBachelorOnly && (!isParticleTOF(posChild, CascChildTable[confCascType1][0]) || !isParticleTOF(negChild, CascChildTable[confCascType1][1]))) || !isParticleTOF(bachelor, CascChildTable[confCascType1][2])) + continue; - posChildHistos.fillQA(posChild); - negChildHistos.fillQA(negChild); - bachHistos.fillQABase(bachelor, HIST("hBachelor")); + posChildHistos.fillQA(posChild); + negChildHistos.fillQA(negChild); + bachHistos.fillQABase(bachelor, HIST("hBachelor")); + } else { + if ((posChild.pidCut() & (1u << CascChildTable[confCascType1][0])) == 0 || (negChild.pidCut() & (1u << CascChildTable[confCascType1][1])) == 0 || (bachelor.pidCut() & (1u << CascChildTable[confCascType1][2])) == 0) + continue; + + if ((!confCheckTOFBachelorOnly && ((posChild.pidCut() & (8u << CascChildTable[confCascType1][0])) == 0 || (negChild.pidCut() & (8u << CascChildTable[confCascType1][1])) == 0)) || (bachelor.pidCut() & (8u << CascChildTable[confCascType1][2])) == 0) + continue; + posChildHistos.fillQA(posChild); + negChildHistos.fillQA(negChild); + bachHistos.fillQABase(bachelor, HIST("hBachelor")); + } rXiQA.fill(HIST("hInvMpTmult"), part.pt(), part.mLambda(), multCol); } - for (const auto& part : groupPartsOne) { - /// PID plot for track particle - const float tpcNSigmas[3] = {unPackInTable(part.tpcNSigmaStorePr()), unPackInTable(part.tpcNSigmaStorePi()), unPackInTable(part.tpcNSigmaStoreKa())}; - const float tofNSigmas[3] = {unPackInTable(part.tofNSigmaStorePr()), unPackInTable(part.tofNSigmaStorePi()), unPackInTable(part.tofNSigmaStoreKa())}; + if constexpr (std::experimental::is_detected::value) { + for (const auto& part : groupPartsOne) { + /// PID plot for track particle + const float tpcNSigmas[3] = {unPackInTable(part.tpcNSigmaStorePr()), unPackInTable(part.tpcNSigmaStorePi()), unPackInTable(part.tpcNSigmaStoreKa())}; + const float tofNSigmas[3] = {unPackInTable(part.tofNSigmaStorePr()), unPackInTable(part.tofNSigmaStorePi()), unPackInTable(part.tofNSigmaStoreKa())}; - if (!isNSigmaCombined(part.p(), tpcNSigmas[confTrackChoicePartOne], tofNSigmas[confTrackChoicePartOne])) - continue; + if (!isNSigmaCombined(part.p(), tpcNSigmas[confTrackChoicePartOne], tofNSigmas[confTrackChoicePartOne])) + continue; - if (part.sign() > 0) { - qaRegistry.fill(HIST("Tracks_pos/nSigmaTPC"), part.p(), tpcNSigmas[confTrackChoicePartOne]); - qaRegistry.fill(HIST("Tracks_pos/nSigmaTOF"), part.p(), tofNSigmas[confTrackChoicePartOne]); - trackHistoPartOnePos.fillQA(part); - } else if (part.sign() < 0) { - qaRegistry.fill(HIST("Tracks_neg/nSigmaTPC"), part.p(), tpcNSigmas[confTrackChoicePartOne]); - qaRegistry.fill(HIST("Tracks_neg/nSigmaTOF"), part.p(), tofNSigmas[confTrackChoicePartOne]); - trackHistoPartOneNeg.fillQA(part); + if (part.mAntiLambda() > 0) { + qaRegistry.fill(HIST("Tracks_pos/nSigmaTPC"), part.p(), tpcNSigmas[confTrackChoicePartOne]); + qaRegistry.fill(HIST("Tracks_pos/nSigmaTOF"), part.p(), tofNSigmas[confTrackChoicePartOne]); + trackHistoPartOnePos.fillQA(part); + } else if (part.mAntiLambda() < 0) { + qaRegistry.fill(HIST("Tracks_neg/nSigmaTPC"), part.p(), tpcNSigmas[confTrackChoicePartOne]); + qaRegistry.fill(HIST("Tracks_neg/nSigmaTOF"), part.p(), tofNSigmas[confTrackChoicePartOne]); + trackHistoPartOneNeg.fillQA(part); + } } } - for (const auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) { // Cascade inv mass cut (mLambda stores Xi mass, mAntiLambda stores Omega mass) if (!invMCascade(p2.mLambda(), p2.mAntiLambda(), confCascType1)) continue; // PID - if (!isParticleCombined(p1, confTrackChoicePartOne)) - continue; + if constexpr (std::experimental::is_detected::value) { + if (!isParticleCombined(p1, confTrackChoicePartOne)) + continue; + } else { + if ((p1.pidCut() & (64u << confTrackChoicePartOne)) == 0) + continue; + } // track cleaning if (!pairCleaner.isCleanPair(p1, p2, parts)) { continue; } - const auto& posChild = parts.iteratorAt(p2.index() - 3); - const auto& negChild = parts.iteratorAt(p2.index() - 2); - const auto& bachelor = parts.iteratorAt(p2.index() - 1); - /// Child particles must pass this condition to be selected - if (!isParticleTPC(posChild, CascChildTable[confCascType1][0]) || !isParticleTPC(negChild, CascChildTable[confCascType1][1]) || !isParticleTPC(bachelor, CascChildTable[confCascType1][2])) - continue; - if (!isParticleTOF(posChild, CascChildTable[confCascType1][0]) || !isParticleTOF(negChild, CascChildTable[confCascType1][1]) || !isParticleTOF(bachelor, CascChildTable[confCascType1][2])) - continue; + const auto& posChild = parts.iteratorAt(p2.globalIndex() - 3 - parts.begin().globalIndex()); + const auto& negChild = parts.iteratorAt(p2.globalIndex() - 2 - parts.begin().globalIndex()); + const auto& bachelor = parts.iteratorAt(p2.globalIndex() - 1 - parts.begin().globalIndex()); + /// Child particles must pass this condition to be selected + if constexpr (std::experimental::is_detected::value) { + if (!isParticleTPC(posChild, CascChildTable[confCascType1][0]) || !isParticleTPC(negChild, CascChildTable[confCascType1][1]) || !isParticleTPC(bachelor, CascChildTable[confCascType1][2])) + continue; + if ((!confCheckTOFBachelorOnly && (!isParticleTOF(posChild, CascChildTable[confCascType1][0]) || !isParticleTOF(negChild, CascChildTable[confCascType1][1]))) || !isParticleTOF(bachelor, CascChildTable[confCascType1][2])) + continue; + } else { + if ((posChild.pidCut() & (1u << CascChildTable[confCascType1][0])) == 0 || (negChild.pidCut() & (1u << CascChildTable[confCascType1][1])) == 0 || (bachelor.pidCut() & (1u << CascChildTable[confCascType1][2])) == 0) + continue; + if ((!confCheckTOFBachelorOnly && ((posChild.pidCut() & (8u << CascChildTable[confCascType1][0])) == 0 || (negChild.pidCut() & (8u << CascChildTable[confCascType1][1])) == 0)) || (bachelor.pidCut() & (8u << CascChildTable[confCascType1][2])) == 0) + continue; + } sameEventCont.setPair(p1, p2, multCol, confUse3D, 1.0f); } } + + void processSameEvent(const FilteredFDCollision& col, const FemtoFullParticles& parts) + { + doSameEvent(col, parts, partsOneFull, partsTwoFull); + } PROCESS_SWITCH(femtoUniversePairTaskTrackCascadeExtended, processSameEvent, "Enable processing same event for track - cascade", false); + + void processSameEventBitmask(const FilteredFDCollision& col, const aod::FDParticles& parts) + { + doSameEvent(col, parts, partsOneBasic, partsTwoBasic); + } + PROCESS_SWITCH(femtoUniversePairTaskTrackCascadeExtended, processSameEventBitmask, "Enable processing same event for track - cascade using bitmask for PID", false); + /// cascade - cascade correlations - void processSameEventCasc(const FilteredFDCollision& col, const FemtoFullParticles& parts) + template + void doSameEventCasc(const FilteredFDCollision& col, const TableType& parts, PartitionType& partsTwo) { const auto& magFieldTesla = col.magField(); @@ -448,23 +500,34 @@ struct femtoUniversePairTaskTrackCascadeExtended { if (!invMCascade(part.mLambda(), part.mAntiLambda(), confCascType1)) /// mLambda stores Xi mass, mAntiLambda stores Omega mass continue; - cascQAHistos.fillQA(part); + if constexpr (std::experimental::is_detected::value) + cascQAHistos.fillQA(part); + else + cascQAHistos.fillQA(part); - const auto& posChild = parts.iteratorAt(part.index() - 3); - const auto& negChild = parts.iteratorAt(part.index() - 2); - const auto& bachelor = parts.iteratorAt(part.index() - 1); + const auto& posChild = parts.iteratorAt(part.globalIndex() - 3 - parts.begin().globalIndex()); + const auto& negChild = parts.iteratorAt(part.globalIndex() - 2 - parts.begin().globalIndex()); + const auto& bachelor = parts.iteratorAt(part.globalIndex() - 1 - parts.begin().globalIndex()); /// Check daughters of first cascade - if (!isParticleTPC(posChild, CascChildTable[confCascType1][0]) || !isParticleTPC(negChild, CascChildTable[confCascType1][1]) || !isParticleTPC(bachelor, CascChildTable[confCascType1][2])) - continue; - if (!isParticleTOF(posChild, CascChildTable[confCascType1][0]) || !isParticleTOF(negChild, CascChildTable[confCascType1][1]) || !isParticleTOF(bachelor, CascChildTable[confCascType1][2])) - continue; + if constexpr (std::experimental::is_detected::value) { + if (!isParticleTPC(posChild, CascChildTable[confCascType1][0]) || !isParticleTPC(negChild, CascChildTable[confCascType1][1]) || !isParticleTPC(bachelor, CascChildTable[confCascType1][2])) + continue; + if ((!confCheckTOFBachelorOnly && (!isParticleTOF(posChild, CascChildTable[confCascType1][0]) || !isParticleTOF(negChild, CascChildTable[confCascType1][1]))) || !isParticleTOF(bachelor, CascChildTable[confCascType1][2])) + continue; - posChildHistos.fillQA(posChild); - negChildHistos.fillQA(negChild); - bachHistos.fillQABase(bachelor, HIST("hBachelor")); - /// Check daughters of second cascade - /*if (isParticleTPC(posChild, CascChildTable[confCascType2][0]) && isParticleTPC(negChild, CascChildTable[confCascType2][1]) && isParticleTPC(bachelor, CascChildTable[confCascType2][2])) { - }*/ + posChildHistos.fillQA(posChild); + negChildHistos.fillQA(negChild); + bachHistos.fillQABase(bachelor, HIST("hBachelor")); + } else { + if ((posChild.pidCut() & (1u << CascChildTable[confCascType1][0])) == 0 || (negChild.pidCut() & (1u << CascChildTable[confCascType1][1])) == 0 || (bachelor.pidCut() & (1u << CascChildTable[confCascType1][2])) == 0) + continue; + if ((!confCheckTOFBachelorOnly && ((posChild.pidCut() & (8u << CascChildTable[confCascType1][0])) == 0 || (negChild.pidCut() & (8u << CascChildTable[confCascType1][1])) == 0)) || (bachelor.pidCut() & (8u << CascChildTable[confCascType1][2])) == 0) + continue; + + posChildHistos.fillQA(posChild); + negChildHistos.fillQA(negChild); + bachHistos.fillQABase(bachelor, HIST("hBachelor")); + } } auto pairDuplicateCheckFunc = [&](auto& p1, auto& p2) -> void { @@ -494,22 +557,38 @@ struct femtoUniversePairTaskTrackCascadeExtended { return; } } - const auto& posChild1 = parts.iteratorAt(p1.index() - 3); - const auto& negChild1 = parts.iteratorAt(p1.index() - 2); - const auto& bachelor1 = parts.iteratorAt(p1.index() - 1); + + const auto& posChild1 = parts.iteratorAt(p1.globalIndex() - 3 - parts.begin().globalIndex()); + const auto& negChild1 = parts.iteratorAt(p1.globalIndex() - 2 - parts.begin().globalIndex()); + const auto& bachelor1 = parts.iteratorAt(p1.globalIndex() - 1 - parts.begin().globalIndex()); /// Child particles must pass this condition to be selected - if (!isParticleTPC(posChild1, CascChildTable[confCascType1][0]) || !isParticleTPC(negChild1, CascChildTable[confCascType1][1]) || !isParticleTPC(bachelor1, CascChildTable[confCascType1][2])) - return; - if (!isParticleTOF(posChild1, CascChildTable[confCascType1][0]) || !isParticleTOF(negChild1, CascChildTable[confCascType1][1]) || !isParticleTOF(bachelor1, CascChildTable[confCascType1][2])) - return; - const auto& posChild2 = parts.iteratorAt(p2.index() - 3); - const auto& negChild2 = parts.iteratorAt(p2.index() - 2); - const auto& bachelor2 = parts.iteratorAt(p2.index() - 1); + if constexpr (std::experimental::is_detected::value) { + if (!isParticleTPC(posChild1, CascChildTable[confCascType1][0]) || !isParticleTPC(negChild1, CascChildTable[confCascType1][1]) || !isParticleTPC(bachelor1, CascChildTable[confCascType1][2])) + return; + if ((!confCheckTOFBachelorOnly && (!isParticleTOF(posChild1, CascChildTable[confCascType1][0]) || !isParticleTOF(negChild1, CascChildTable[confCascType1][1]))) || !isParticleTOF(bachelor1, CascChildTable[confCascType1][2])) + return; + } else { + if ((posChild1.pidCut() & (1u << CascChildTable[confCascType1][0])) == 0 || (negChild1.pidCut() & (1u << CascChildTable[confCascType1][1])) == 0 || (bachelor1.pidCut() & (1u << CascChildTable[confCascType1][2])) == 0) + return; + if ((!confCheckTOFBachelorOnly && ((posChild1.pidCut() & (8u << CascChildTable[confCascType1][0])) == 0 || (negChild1.pidCut() & (8u << CascChildTable[confCascType1][1])) == 0)) || (bachelor1.pidCut() & (8u << CascChildTable[confCascType1][2])) == 0) + return; + } + + const auto& posChild2 = parts.iteratorAt(p2.globalIndex() - 3 - parts.begin().globalIndex()); + const auto& negChild2 = parts.iteratorAt(p2.globalIndex() - 2 - parts.begin().globalIndex()); + const auto& bachelor2 = parts.iteratorAt(p2.globalIndex() - 1 - parts.begin().globalIndex()); /// Child particles must pass this condition to be selected - if (!isParticleTPC(posChild2, CascChildTable[confCascType2][0]) || !isParticleTPC(negChild2, CascChildTable[confCascType2][1]) || !isParticleTPC(bachelor2, CascChildTable[confCascType2][2])) - return; - if (!isParticleTOF(posChild2, CascChildTable[confCascType2][0]) || !isParticleTOF(negChild2, CascChildTable[confCascType2][1]) || !isParticleTOF(bachelor2, CascChildTable[confCascType2][2])) - return; + if constexpr (std::experimental::is_detected::value) { + if (!isParticleTPC(posChild2, CascChildTable[confCascType2][0]) || !isParticleTPC(negChild2, CascChildTable[confCascType2][1]) || !isParticleTPC(bachelor2, CascChildTable[confCascType2][2])) + return; + if ((!confCheckTOFBachelorOnly && (!isParticleTOF(posChild2, CascChildTable[confCascType2][0]) || !isParticleTOF(negChild2, CascChildTable[confCascType2][1]))) || !isParticleTOF(bachelor2, CascChildTable[confCascType2][2])) + return; + } else { + if ((posChild2.pidCut() & (1u << CascChildTable[confCascType1][0])) == 0 || (negChild2.pidCut() & (1u << CascChildTable[confCascType1][1])) == 0 || (bachelor2.pidCut() & (1u << CascChildTable[confCascType1][2])) == 0) + return; + if ((!confCheckTOFBachelorOnly && ((posChild2.pidCut() & (8u << CascChildTable[confCascType1][0])) == 0 || (negChild2.pidCut() & (8u << CascChildTable[confCascType1][1])) == 0)) || (bachelor2.pidCut() & (8u << CascChildTable[confCascType1][2])) == 0) + return; + } sameEventCont.setPair(p1, p2, multCol, confUse3D, 1.0f); }; @@ -532,9 +611,22 @@ struct femtoUniversePairTaskTrackCascadeExtended { } } } + + void processSameEventCasc(const FilteredFDCollision& col, const FemtoFullParticles& parts) + { + doSameEventCasc(col, parts, partsTwoFull); + } PROCESS_SWITCH(femtoUniversePairTaskTrackCascadeExtended, processSameEventCasc, "Enable processing same event for cascade - cascade", false); + + void processSameEventCascBitmask(const FilteredFDCollision& col, const aod::FDParticles& parts) + { + doSameEventCasc(col, parts, partsTwoBasic); + } + PROCESS_SWITCH(femtoUniversePairTaskTrackCascadeExtended, processSameEventCascBitmask, "Enable processing same event for cascade - cascade using bitmask for PID", false); + /// track - cascade correlations - void processMixedEvent(const FilteredFDCollisions& cols, const FemtoFullParticles& parts) + template + void doMixedEvent(const FilteredFDCollisions& cols, const TableType& parts, PartitionType& partsOne, PartitionType& partsTwo) { ColumnBinningPolicy colBinningMult{{confVtxBins, confMultBins}, true}; ColumnBinningPolicy colBinningCent{{confVtxBins, confMultBins}, true}; @@ -556,17 +648,29 @@ struct femtoUniversePairTaskTrackCascadeExtended { if (!invMCascade(p2.mLambda(), p2.mAntiLambda(), confCascType1)) continue; // PID - if (!isParticleCombined(p1, confTrackChoicePartOne)) - continue; + if constexpr (std::experimental::is_detected::value) { + if (!isParticleCombined(p1, confTrackChoicePartOne)) + continue; + } else { + if ((p1.pidCut() & (64u << confTrackChoicePartOne)) == 0) + continue; + } - const auto& posChild = parts.iteratorAt(p2.index() - 3); - const auto& negChild = parts.iteratorAt(p2.index() - 2); - const auto& bachelor = parts.iteratorAt(p2.index() - 1); + const auto& posChild = parts.iteratorAt(p2.globalIndex() - 3 - parts.begin().globalIndex()); + const auto& negChild = parts.iteratorAt(p2.globalIndex() - 2 - parts.begin().globalIndex()); + const auto& bachelor = parts.iteratorAt(p2.globalIndex() - 1 - parts.begin().globalIndex()); /// Child particles must pass this condition to be selected - if (!isParticleTPC(posChild, CascChildTable[confCascType1][0]) || !isParticleTPC(negChild, CascChildTable[confCascType1][1]) || !isParticleTPC(bachelor, CascChildTable[confCascType1][2])) - continue; - if (!isParticleTOF(posChild, CascChildTable[confCascType1][0]) || !isParticleTOF(negChild, CascChildTable[confCascType1][1]) || !isParticleTOF(bachelor, CascChildTable[confCascType1][2])) - continue; + if constexpr (std::experimental::is_detected::value) { + if (!isParticleTPC(posChild, CascChildTable[confCascType1][0]) || !isParticleTPC(negChild, CascChildTable[confCascType1][1]) || !isParticleTPC(bachelor, CascChildTable[confCascType1][2])) + continue; + if ((!confCheckTOFBachelorOnly && (!isParticleTOF(posChild, CascChildTable[confCascType1][0]) || !isParticleTOF(negChild, CascChildTable[confCascType1][1]))) || !isParticleTOF(bachelor, CascChildTable[confCascType1][2])) + continue; + } else { + if ((posChild.pidCut() & (1u << CascChildTable[confCascType1][0])) == 0 || (negChild.pidCut() & (1u << CascChildTable[confCascType1][1])) == 0 || (bachelor.pidCut() & (1u << CascChildTable[confCascType1][2])) == 0) + continue; + if ((!confCheckTOFBachelorOnly && ((posChild.pidCut() & (8u << CascChildTable[confCascType1][0])) == 0 || (negChild.pidCut() & (8u << CascChildTable[confCascType1][1])) == 0)) || (bachelor.pidCut() & (8u << CascChildTable[confCascType1][2])) == 0) + continue; + } // track cleaning if (!pairCleaner.isCleanPair(p1, p2, parts)) { @@ -589,9 +693,22 @@ struct femtoUniversePairTaskTrackCascadeExtended { } } } + + void processMixedEvent(const FilteredFDCollisions& cols, const FemtoFullParticles& parts) + { + doMixedEvent(cols, parts, partsOneFull, partsTwoFull); + } PROCESS_SWITCH(femtoUniversePairTaskTrackCascadeExtended, processMixedEvent, "Enable processing mixed event for track - cascade", false); + + void processMixedEventBitmask(const FilteredFDCollisions& cols, const aod::FDParticles& parts) + { + doMixedEvent(cols, parts, partsOneBasic, partsTwoBasic); + } + PROCESS_SWITCH(femtoUniversePairTaskTrackCascadeExtended, processMixedEventBitmask, "Enable processing mixed event for track - cascade using bitmask for PID", false); + /// cascade - cascade correlations - void processMixedEventCasc(const FilteredFDCollisions& cols, const FemtoFullParticles& parts) + template + void doMixedEventCasc(const FilteredFDCollisions& cols, const TableType& parts, PartitionType& partsTwo) { ColumnBinningPolicy colBinning{{confVtxBins, confMultBins}, true}; @@ -615,22 +732,37 @@ struct femtoUniversePairTaskTrackCascadeExtended { if (!invMCascade(p2.mLambda(), p2.mAntiLambda(), confCascType2)) continue; - const auto& posChild1 = parts.iteratorAt(p1.index() - 3); - const auto& negChild1 = parts.iteratorAt(p1.index() - 2); - const auto& bachelor1 = parts.iteratorAt(p1.index() - 1); + const auto& posChild1 = parts.iteratorAt(p1.globalIndex() - 3 - parts.begin().globalIndex()); + const auto& negChild1 = parts.iteratorAt(p1.globalIndex() - 2 - parts.begin().globalIndex()); + const auto& bachelor1 = parts.iteratorAt(p1.globalIndex() - 1 - parts.begin().globalIndex()); /// Child particles must pass this condition to be selected - if (!isParticleTPC(posChild1, CascChildTable[confCascType1][0]) || !isParticleTPC(negChild1, CascChildTable[confCascType1][1]) || !isParticleTPC(bachelor1, CascChildTable[confCascType1][2])) - return; - if (!isParticleTOF(posChild1, CascChildTable[confCascType1][0]) || !isParticleTOF(negChild1, CascChildTable[confCascType1][1]) || !isParticleTOF(bachelor1, CascChildTable[confCascType1][2])) - return; - const auto& posChild2 = parts.iteratorAt(p2.index() - 3); - const auto& negChild2 = parts.iteratorAt(p2.index() - 2); - const auto& bachelor2 = parts.iteratorAt(p2.index() - 1); + if constexpr (std::experimental::is_detected::value) { + if (!isParticleTPC(posChild1, CascChildTable[confCascType1][0]) || !isParticleTPC(negChild1, CascChildTable[confCascType1][1]) || !isParticleTPC(bachelor1, CascChildTable[confCascType1][2])) + return; + if ((!confCheckTOFBachelorOnly && (!isParticleTOF(posChild1, CascChildTable[confCascType1][0]) || !isParticleTOF(negChild1, CascChildTable[confCascType1][1]))) || !isParticleTOF(bachelor1, CascChildTable[confCascType1][2])) + return; + } else { + if ((posChild1.pidCut() & (1u << CascChildTable[confCascType1][0])) == 0 || (negChild1.pidCut() & (1u << CascChildTable[confCascType1][1])) == 0 || (bachelor1.pidCut() & (1u << CascChildTable[confCascType1][2])) == 0) + return; + if ((!confCheckTOFBachelorOnly && ((posChild1.pidCut() & (8u << CascChildTable[confCascType1][0])) == 0 || (negChild1.pidCut() & (8u << CascChildTable[confCascType1][1])) == 0)) || (bachelor1.pidCut() & (8u << CascChildTable[confCascType1][2])) == 0) + return; + } + + const auto& posChild2 = parts.iteratorAt(p2.globalIndex() - 3 - parts.begin().globalIndex()); + const auto& negChild2 = parts.iteratorAt(p2.globalIndex() - 2 - parts.begin().globalIndex()); + const auto& bachelor2 = parts.iteratorAt(p2.globalIndex() - 1 - parts.begin().globalIndex()); /// Child particles must pass this condition to be selected - if (!isParticleTPC(posChild2, CascChildTable[confCascType2][0]) || !isParticleTPC(negChild2, CascChildTable[confCascType2][1]) || !isParticleTPC(bachelor2, CascChildTable[confCascType2][2])) - return; - if (!isParticleTOF(posChild2, CascChildTable[confCascType2][0]) || !isParticleTOF(negChild2, CascChildTable[confCascType2][1]) || !isParticleTOF(bachelor2, CascChildTable[confCascType2][2])) - return; + if constexpr (std::experimental::is_detected::value) { + if (!isParticleTPC(posChild2, CascChildTable[confCascType2][0]) || !isParticleTPC(negChild2, CascChildTable[confCascType2][1]) || !isParticleTPC(bachelor2, CascChildTable[confCascType2][2])) + return; + if ((!confCheckTOFBachelorOnly && (!isParticleTOF(posChild2, CascChildTable[confCascType2][0]) || !isParticleTOF(negChild2, CascChildTable[confCascType2][1]))) || !isParticleTOF(bachelor2, CascChildTable[confCascType2][2])) + return; + } else { + if ((posChild2.pidCut() & (1u << CascChildTable[confCascType1][0])) == 0 || (negChild2.pidCut() & (1u << CascChildTable[confCascType1][1])) == 0 || (bachelor2.pidCut() & (1u << CascChildTable[confCascType1][2])) == 0) + return; + if ((!confCheckTOFBachelorOnly && ((posChild2.pidCut() & (8u << CascChildTable[confCascType1][0])) == 0 || (negChild2.pidCut() & (8u << CascChildTable[confCascType1][1])) == 0)) || (bachelor2.pidCut() & (8u << CascChildTable[confCascType1][2])) == 0) + return; + } // track cleaning if (!pairCleanerCasc.isCleanPair(p1, p2, parts)) { continue; @@ -645,23 +777,35 @@ struct femtoUniversePairTaskTrackCascadeExtended { } } } + + void processMixedEventCasc(const FilteredFDCollisions& cols, const FemtoFullParticles& parts) + { + doMixedEventCasc(cols, parts, partsTwoFull); + } PROCESS_SWITCH(femtoUniversePairTaskTrackCascadeExtended, processMixedEventCasc, "Enable processing mixed event for cascade - cascade", false); + + void processMixedEventCascBitmask(const FilteredFDCollisions& cols, const aod::FDParticles& parts) + { + doMixedEventCasc(cols, parts, partsTwoBasic); + } + PROCESS_SWITCH(femtoUniversePairTaskTrackCascadeExtended, processMixedEventCascBitmask, "Enable processing mixed event for cascade - cascade using bitmask for PID", false); + // MC truth - void processSameEventMCgen(const FilteredFDCollision& col, [[maybe_unused]] const FemtoFullParticles& parts) + void processSameEventMCgen(const FilteredFDCollision& col, [[maybe_unused]] const aod::FDParticles& parts) { const int multCol = confUseCent ? col.multV0M() : col.multNtr(); - auto groupPartsOne = partsOneMCgen->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); - auto groupPartsTwo = partsTwoMCgen->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); + auto groupPartsOne = partsOneMCgenBasic->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); + auto groupPartsTwo = partsTwoMCgenBasic->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); eventHisto.fillQA(col); for (const auto& part : groupPartsTwo) { int pdgCode = static_cast(part.pidCut()); - if ((confCascType1 == 0 && pdgCode != 3334) || (confCascType1 == 2 && pdgCode != -3334) || (confCascType1 == 1 && pdgCode != 3312) || (confCascType1 == 3 && pdgCode != -3312)) + if ((confCascType1 == 0 && pdgCode != kOmegaMinus) || (confCascType1 == 2 && pdgCode != kOmegaPlusBar) || (confCascType1 == 1 && pdgCode != kXiMinus) || (confCascType1 == 3 && pdgCode != kXiPlusBar)) continue; - cascQAHistos.fillQA(part); + cascQAHistos.fillQA(part); for (const auto& part : groupPartsOne) { int pdgCode = static_cast(part.pidCut()); @@ -683,7 +827,7 @@ struct femtoUniversePairTaskTrackCascadeExtended { if (static_cast(p1.pidCut()) != confTrkPDGCodePartOne) continue; int pdgCodeCasc = static_cast(p2.pidCut()); - if ((confCascType1 == 0 && pdgCodeCasc != 3334) || (confCascType1 == 2 && pdgCodeCasc != -3334) || (confCascType1 == 1 && pdgCodeCasc != 3312) || (confCascType1 == 3 && pdgCodeCasc != -3312)) + if ((confCascType1 == 0 && pdgCodeCasc != kOmegaMinus) || (confCascType1 == 2 && pdgCodeCasc != kOmegaPlusBar) || (confCascType1 == 1 && pdgCodeCasc != kXiMinus) || (confCascType1 == 3 && pdgCodeCasc != kXiPlusBar)) continue; sameEventCont.setPair(p1, p2, multCol, confUse3D, 1.0f); } @@ -691,15 +835,15 @@ struct femtoUniversePairTaskTrackCascadeExtended { } PROCESS_SWITCH(femtoUniversePairTaskTrackCascadeExtended, processSameEventMCgen, "Enable processing same event MC truth for track - cascade", false); - void processMixedEventMCgen(const FilteredFDCollisions& cols, [[maybe_unused]] const FemtoFullParticles& parts) + void processMixedEventMCgen(const FilteredFDCollisions& cols, [[maybe_unused]] const aod::FDParticles& parts) { ColumnBinningPolicy colBinning{{confVtxBins, confMultBins}, true}; for (const auto& [collision1, collision2] : soa::selfCombinations(colBinning, 5, -1, cols, cols)) { const int multCol = confUseCent ? collision1.multV0M() : collision1.multNtr(); - auto groupPartsOne = partsOneMCgen->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); - auto groupPartsTwo = partsTwoMCgen->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache); + auto groupPartsOne = partsOneMCgenBasic->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); + auto groupPartsTwo = partsTwoMCgenBasic->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache); const auto& magFieldTesla1 = collision1.magField(); const auto& magFieldTesla2 = collision2.magField(); @@ -711,7 +855,7 @@ struct femtoUniversePairTaskTrackCascadeExtended { if (static_cast(p1.pidCut()) != confTrkPDGCodePartOne) continue; int pdgCodeCasc = static_cast(p2.pidCut()); - if ((confCascType1 == 0 && pdgCodeCasc != 3334) || (confCascType1 == 2 && pdgCodeCasc != -3334) || (confCascType1 == 1 && pdgCodeCasc != 3312) || (confCascType1 == 3 && pdgCodeCasc != -3312)) + if ((confCascType1 == 0 && pdgCodeCasc != kOmegaMinus) || (confCascType1 == 2 && pdgCodeCasc != kOmegaPlusBar) || (confCascType1 == 1 && pdgCodeCasc != kXiMinus) || (confCascType1 == 3 && pdgCodeCasc != kXiPlusBar)) continue; mixedEventCont.setPair(p1, p2, multCol, confUse3D, 1.0f); } @@ -732,10 +876,10 @@ struct femtoUniversePairTaskTrackCascadeExtended { continue; } - if ((confCascType1 == 0 && pdgCode == 3334) || (confCascType1 == 1 && pdgCode == 3312)) { + if ((confCascType1 == 0 && pdgCode == kOmegaMinus) || (confCascType1 == 1 && pdgCode == kXiMinus)) { registryMCgen.fill(HIST("plus/MCgenCasc"), part.pt(), part.eta()); continue; - } else if ((confCascType1 == 0 && pdgCode == -3334) || (confCascType1 == 1 && pdgCode == -3312)) { + } else if ((confCascType1 == 0 && pdgCode == kOmegaPlusBar) || (confCascType1 == 1 && pdgCode == kXiPlusBar)) { registryMCgen.fill(HIST("minus/MCgenCasc"), part.pt(), part.eta()); continue; } @@ -743,7 +887,7 @@ struct femtoUniversePairTaskTrackCascadeExtended { if (pdgParticle->Charge() > 0.0) { registryMCgen.fill(HIST("plus/MCgenAllPt"), part.pt()); } - if (pdgCode == 2212) { + if (pdgCode == kProton) { registryMCgen.fill(HIST("plus/MCgenPr"), part.pt(), part.eta()); registryMCgen.fill(HIST("plus/MCgenPrPt"), part.pt()); } @@ -751,7 +895,7 @@ struct femtoUniversePairTaskTrackCascadeExtended { if (pdgParticle->Charge() < 0.0) { registryMCgen.fill(HIST("minus/MCgenAllPt"), part.pt()); } - if (pdgCode == -2212) { + if (pdgCode == kProtonBar) { registryMCgen.fill(HIST("minus/MCgenPr"), part.pt(), part.eta()); registryMCgen.fill(HIST("minus/MCgenPrPt"), part.pt()); } @@ -760,7 +904,8 @@ struct femtoUniversePairTaskTrackCascadeExtended { PROCESS_SWITCH(femtoUniversePairTaskTrackCascadeExtended, processMCgen, "Process MC truth data for cascades", false); - void processMCReco(FemtoRecoParticles const& parts, aod::FdMCParticles const& mcparts) + template + void doMCReco(TableType const& parts, aod::FdMCParticles const& mcparts) { for (const auto& part : parts) { auto mcPartId = part.fdMCParticleId(); @@ -769,44 +914,85 @@ struct femtoUniversePairTaskTrackCascadeExtended { const auto& mcpart = mcparts.iteratorAt(mcPartId); // if (part.partType() == aod::femtouniverseparticle::ParticleType::kCascade) { - if ((confCascType1 == 0 && mcpart.pdgMCTruth() == 3334) || (confCascType1 == 1 && mcpart.pdgMCTruth() == 3312)) { - const auto& posChild = parts.iteratorAt(part.index() - 3); - const auto& negChild = parts.iteratorAt(part.index() - 2); - const auto& bachelor = parts.iteratorAt(part.index() - 1); + if ((confCascType1 == 0 && mcpart.pdgMCTruth() == kOmegaMinus) || (confCascType1 == 1 && mcpart.pdgMCTruth() == kXiMinus)) { + const auto& posChild = parts.iteratorAt(part.globalIndex() - 3 - parts.begin().globalIndex()); + const auto& negChild = parts.iteratorAt(part.globalIndex() - 2 - parts.begin().globalIndex()); + const auto& bachelor = parts.iteratorAt(part.globalIndex() - 1 - parts.begin().globalIndex()); /// Daughters that do not pass this condition are not selected - if (isParticleTPC(posChild, CascChildTable[confCascType1][0]) && isParticleTPC(negChild, CascChildTable[confCascType1][1]) && isParticleTPC(bachelor, CascChildTable[confCascType1][2])) { - registryMCreco.fill(HIST("plus/MCrecoCascade"), mcpart.pt(), mcpart.eta()); + if constexpr (std::experimental::is_detected::value) { + if (!isParticleTPC(posChild, CascChildTable[confCascType1][0]) || !isParticleTPC(negChild, CascChildTable[confCascType1][1]) || !isParticleTPC(bachelor, CascChildTable[confCascType1][2])) + continue; + if ((!confCheckTOFBachelorOnly && (!isParticleTOF(posChild, CascChildTable[confCascType1][0]) || !isParticleTOF(negChild, CascChildTable[confCascType1][1]))) || !isParticleTOF(bachelor, CascChildTable[confCascType1][2])) + continue; + } else { + if ((posChild.pidCut() & (1u << CascChildTable[confCascType1][0])) == 0 || (negChild.pidCut() & (1u << CascChildTable[confCascType1][1])) == 0 || (bachelor.pidCut() & (1u << CascChildTable[confCascType1][2])) == 0) + continue; + if ((!confCheckTOFBachelorOnly && ((posChild.pidCut() & (8u << CascChildTable[confCascType1][0])) == 0 || (negChild.pidCut() & (8u << CascChildTable[confCascType1][1])) == 0)) || (bachelor.pidCut() & (8u << CascChildTable[confCascType1][2])) == 0) + continue; } - } else if ((confCascType1 == 0 && mcpart.pdgMCTruth() == -3334) || (confCascType1 == 1 && mcpart.pdgMCTruth() == -3312)) { - /// Daughters that do not pass this condition are not selected - const auto& posChild = parts.iteratorAt(part.index() - 3); - const auto& negChild = parts.iteratorAt(part.index() - 2); - const auto& bachelor = parts.iteratorAt(part.index() - 1); - if (isParticleTPC(posChild, CascChildTable[confCascType1 + 2][0]) && isParticleTPC(negChild, CascChildTable[confCascType1 + 2][1]) && isParticleTPC(bachelor, CascChildTable[confCascType1 + 2][2])) { - registryMCreco.fill(HIST("minus/MCrecoCascade"), mcpart.pt(), mcpart.eta()); + registryMCreco.fill(HIST("plus/MCrecoCascade"), mcpart.pt(), mcpart.eta()); + + } else if ((confCascType1 == 0 && mcpart.pdgMCTruth() == kOmegaPlusBar) || (confCascType1 == 1 && mcpart.pdgMCTruth() == kXiPlusBar)) { + const auto& posChild = parts.iteratorAt(part.globalIndex() - 3 - parts.begin().globalIndex()); + const auto& negChild = parts.iteratorAt(part.globalIndex() - 2 - parts.begin().globalIndex()); + const auto& bachelor = parts.iteratorAt(part.globalIndex() - 1 - parts.begin().globalIndex()); + if constexpr (std::experimental::is_detected::value) { + if (!isParticleTPC(posChild, CascChildTable[confCascType1 + 2][0]) && !isParticleTPC(negChild, CascChildTable[confCascType1 + 2][1]) && !isParticleTPC(bachelor, CascChildTable[confCascType1 + 2][2])) + continue; + if ((!confCheckTOFBachelorOnly && (!isParticleTOF(posChild, CascChildTable[confCascType1 + 2][0]) || !isParticleTOF(negChild, CascChildTable[confCascType1 + 2][1]))) || !isParticleTOF(bachelor, CascChildTable[confCascType1 + 2][2])) + continue; + } else { + if ((posChild.pidCut() & (1u << CascChildTable[confCascType1 + 2][0])) == 0 || (negChild.pidCut() & (1u << CascChildTable[confCascType1 + 2][1])) == 0 || (bachelor.pidCut() & (1u << CascChildTable[confCascType1 + 2][2])) == 0) + continue; + if ((!confCheckTOFBachelorOnly && ((posChild.pidCut() & (8u << CascChildTable[confCascType1 + 2][0])) == 0 || (negChild.pidCut() & (8u << CascChildTable[confCascType1 + 2][1])) == 0)) || (bachelor.pidCut() & (8u << CascChildTable[confCascType1 + 2][2])) == 0) + continue; } + registryMCreco.fill(HIST("minus/MCrecoCascade"), mcpart.pt(), mcpart.eta()); } + } else if (part.partType() == aod::femtouniverseparticle::ParticleType::kTrack) { - if (part.sign() > 0) { + if (part.mAntiLambda() > 0) { registryMCreco.fill(HIST("plus/MCrecoAllPt"), mcpart.pt()); - if (mcpart.pdgMCTruth() == 2212 && isNSigmaCombined(part.p(), unPackInTable(part.tpcNSigmaStorePr()), unPackInTable(part.tofNSigmaStorePr()))) { - registryMCreco.fill(HIST("plus/MCrecoPr"), mcpart.pt(), mcpart.eta()); - registryMCreco.fill(HIST("plus/MCrecoPrPt"), mcpart.pt()); + if (mcpart.pdgMCTruth() != kProton) + continue; + if constexpr (std::experimental::is_detected::value) { + if (!isNSigmaCombined(part.p(), unPackInTable(part.tpcNSigmaStorePr()), unPackInTable(part.tofNSigmaStorePr()))) + continue; + } else { + if ((part.pidCut() & 64u) == 0) + continue; } - } - - if (part.sign() < 0) { + registryMCreco.fill(HIST("plus/MCrecoPr"), mcpart.pt(), mcpart.eta()); + registryMCreco.fill(HIST("plus/MCrecoPrPt"), mcpart.pt()); + } else if (part.mAntiLambda() < 0) { registryMCreco.fill(HIST("minus/MCrecoAllPt"), mcpart.pt()); - if (mcpart.pdgMCTruth() == -2212 && isNSigmaCombined(part.p(), unPackInTable(part.tpcNSigmaStorePr()), unPackInTable(part.tofNSigmaStorePr()))) { - registryMCreco.fill(HIST("minus/MCrecoPr"), mcpart.pt(), mcpart.eta()); - registryMCreco.fill(HIST("minus/MCrecoPrPt"), mcpart.pt()); + if (mcpart.pdgMCTruth() != kProtonBar) + continue; + if constexpr (std::experimental::is_detected::value) { + if (!isNSigmaCombined(part.p(), unPackInTable(part.tpcNSigmaStorePr()), unPackInTable(part.tofNSigmaStorePr()))) + continue; + } else { + if ((part.pidCut() & 64u) == 0) + continue; } + registryMCreco.fill(HIST("minus/MCrecoPr"), mcpart.pt(), mcpart.eta()); + registryMCreco.fill(HIST("minus/MCrecoPrPt"), mcpart.pt()); } } } } - PROCESS_SWITCH(femtoUniversePairTaskTrackCascadeExtended, processMCReco, "Process MC reco data for cascades", false); + void processMCReco(FemtoRecoFullParticles const& parts, aod::FdMCParticles const& mcparts) + { + doMCReco(parts, mcparts); + } + PROCESS_SWITCH(femtoUniversePairTaskTrackCascadeExtended, processMCReco, "Process MC reco data for cascades using nSigma for PID", false); + + void processMCRecoBitmask(FemtoRecoBasicParticles const& parts, aod::FdMCParticles const& mcparts) + { + doMCReco(parts, mcparts); + } + PROCESS_SWITCH(femtoUniversePairTaskTrackCascadeExtended, processMCRecoBitmask, "Process MC reco data for cascades using Bitmask for PID", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 53e8590756eb13c12e52609f09f407651fdeefcb Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Wed, 30 Jul 2025 12:41:04 +0200 Subject: [PATCH 135/345] [Common] single-device TPC PID service for testing (#12277) Co-authored-by: ALICE Builder --- Common/Core/PID/TPCPIDResponse.h | 26 +- Common/TableProducer/PID/CMakeLists.txt | 5 + Common/TableProducer/PID/pidTPC.cxx | 7 +- Common/TableProducer/PID/pidTPCModule.h | 792 +++++++++++++++++++++ Common/TableProducer/PID/pidTPCService.cxx | 118 +++ 5 files changed, 944 insertions(+), 4 deletions(-) create mode 100644 Common/TableProducer/PID/pidTPCModule.h create mode 100644 Common/TableProducer/PID/pidTPCService.cxx diff --git a/Common/Core/PID/TPCPIDResponse.h b/Common/Core/PID/TPCPIDResponse.h index f25e1acd69e..deafdf4fed2 100644 --- a/Common/Core/PID/TPCPIDResponse.h +++ b/Common/Core/PID/TPCPIDResponse.h @@ -74,12 +74,18 @@ class Response /// Gets the expected resolution of the track template float GetExpectedSigma(const CollisionType& collision, const TrackType& trk, const o2::track::PID::ID id) const; + /// Gets the expected resolution of the track with multTPC explicitly provided + template + float GetExpectedSigmaAtMultiplicity(const long multTPC, const TrackType& trk, const o2::track::PID::ID id) const; /// Gets the number of sigmas with respect the expected value template float GetNumberOfSigma(const CollisionType& collision, const TrackType& trk, const o2::track::PID::ID id) const; // Number of sigmas with respect to expected for MC, defining a tune-on-data signal value template float GetNumberOfSigmaMCTuned(const CollisionType& collision, const TrackType& trk, const o2::track::PID::ID id, float mcTunedTPCSignal) const; + // Number of sigmas with respect to expected for MC, defining a tune-on-data signal value, explicit multTPC + template + float GetNumberOfSigmaMCTunedAtMultiplicity(const long multTPC, const TrackType& trk, const o2::track::PID::ID id, float mcTunedTPCSignal) const; /// Gets the deviation to the expected signal template float GetSignalDelta(const TrackType& trk, const o2::track::PID::ID id) const; @@ -116,6 +122,14 @@ inline float Response::GetExpectedSignal(const TrackType& track, const o2::track /// Gets the expected resolution of the measurement template inline float Response::GetExpectedSigma(const CollisionType& collision, const TrackType& track, const o2::track::PID::ID id) const +{ + // use multTPC (legacy behaviour) if multTPC not provided + return Response::GetExpectedSigmaAtMultiplicity(collision.multTPC(), track, id); +} + +/// Gets the expected resolution of the measurement +template +inline float Response::GetExpectedSigmaAtMultiplicity(const long multTPC, const TrackType& track, const o2::track::PID::ID id) const { if (!track.hasTPC()) { return -999.f; @@ -133,7 +147,7 @@ inline float Response::GetExpectedSigma(const CollisionType& collision, const Tr const double dEdx = o2::tpc::BetheBlochAleph(static_cast(bg), mBetheBlochParams[0], mBetheBlochParams[1], mBetheBlochParams[2], mBetheBlochParams[3], mBetheBlochParams[4]) * std::pow(static_cast(o2::track::pid_constants::sCharges[id]), mChargeFactor); const double relReso = GetRelativeResolutiondEdx(p, mass, o2::track::pid_constants::sCharges[id], mResolutionParams[3]); - const std::vector values{1.f / dEdx, track.tgl(), std::sqrt(ncl), relReso, track.signed1Pt(), collision.multTPC() / mMultNormalization}; + const std::vector values{1.f / dEdx, track.tgl(), std::sqrt(ncl), relReso, track.signed1Pt(), multTPC / mMultNormalization}; const float reso = sqrt(pow(mResolutionParams[0], 2) * values[0] + pow(mResolutionParams[1], 2) * (values[2] * mResolutionParams[5]) * pow(values[0] / sqrt(1 + pow(values[1], 2)), mResolutionParams[2]) + values[2] * pow(values[3], 2) + pow(mResolutionParams[4] * values[4], 2) + pow(values[5] * mResolutionParams[6], 2) + pow(values[5] * (values[0] / sqrt(1 + pow(values[1], 2))) * mResolutionParams[7], 2)) * dEdx * mMIP; reso >= 0.f ? resolution = reso : resolution = -999.f; @@ -160,7 +174,13 @@ inline float Response::GetNumberOfSigma(const CollisionType& collision, const Tr template inline float Response::GetNumberOfSigmaMCTuned(const CollisionType& collision, const TrackType& trk, const o2::track::PID::ID id, float mcTunedTPCSignal) const { - if (GetExpectedSigma(collision, trk, id) < 0.) { + return Response::GetNumberOfSigmaMCTunedAtMultiplicity(collision.multTPC(), trk, id, mcTunedTPCSignal); +} + +template +inline float Response::GetNumberOfSigmaMCTunedAtMultiplicity(const long multTPC, const TrackType& trk, const o2::track::PID::ID id, float mcTunedTPCSignal) const +{ + if (GetExpectedSigmaAtMultiplicity(multTPC, trk, id) < 0.) { return -999.f; } if (GetExpectedSignal(trk, id) < 0.) { @@ -169,7 +189,7 @@ inline float Response::GetNumberOfSigmaMCTuned(const CollisionType& collision, c if (!trk.hasTPC()) { return -999.f; } - return ((mcTunedTPCSignal - GetExpectedSignal(trk, id)) / GetExpectedSigma(collision, trk, id)); + return ((mcTunedTPCSignal - GetExpectedSignal(trk, id)) / GetExpectedSigmaAtMultiplicity(multTPC, trk, id)); } /// Gets the deviation between the actual signal and the expected signal diff --git a/Common/TableProducer/PID/CMakeLists.txt b/Common/TableProducer/PID/CMakeLists.txt index afcda3e1be6..e0ea2d40ab3 100644 --- a/Common/TableProducer/PID/CMakeLists.txt +++ b/Common/TableProducer/PID/CMakeLists.txt @@ -43,6 +43,11 @@ o2physics_add_dpl_workflow(pid-tof-full # TPC +o2physics_add_dpl_workflow(pid-tpc-service + SOURCES pidTPCService.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::MLCore O2Physics::AnalysisCCDB + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(pid-tpc-base SOURCES pidTPCBase.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::AnalysisCCDB diff --git a/Common/TableProducer/PID/pidTPC.cxx b/Common/TableProducer/PID/pidTPC.cxx index e423f5a7a7d..e9c2015afbc 100644 --- a/Common/TableProducer/PID/pidTPC.cxx +++ b/Common/TableProducer/PID/pidTPC.cxx @@ -447,6 +447,11 @@ struct tpcPid { } float nSigma = -999.f; + int multTPC = 0; + if (trk.has_collision()) { + auto collision = collisions.rawIteratorAt(trk.collisionId()); + multTPC = collision.multTPC(); + } float bg = trk.tpcInnerParam() / o2::track::pid_constants::sMasses[pid]; // estimated beta-gamma for network cutoff if (useNetworkCorrection && speciesNetworkFlags[pid] && trk.has_collision() && bg > networkBetaGammaCutoff) { @@ -469,7 +474,7 @@ struct tpcPid { LOGF(fatal, "Network output-dimensions incompatible!"); } } else { - nSigma = response->GetNumberOfSigmaMCTuned(collisions.iteratorAt(trk.collisionId()), trk, pid, tpcSignal); + nSigma = response->GetNumberOfSigmaMCTunedAtMultiplicity(multTPC, trk, pid, tpcSignal); } if (flagFull) tableFull(expSigma, nSigma); diff --git a/Common/TableProducer/PID/pidTPCModule.h b/Common/TableProducer/PID/pidTPCModule.h new file mode 100644 index 00000000000..37883de0273 --- /dev/null +++ b/Common/TableProducer/PID/pidTPCModule.h @@ -0,0 +1,792 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file pidTPCModule.h +/// \brief Task to produce PID tables for TPC split for each particle. +/// Only the tables for the mass hypotheses requested are filled, and only for the requested table size +/// ("Full" or "Tiny"). The others are sent empty. +/// \author Nicolò Jacazio nicolo.jacazio@cern.ch +/// \author Christian Sonnabend christian.sonnabend@cern.ch +/// \author Annalena Kalteyer annalena.sophie.kalteyer@cern.ch +/// \author Jeremy Wilkinson jeremy.wilkinson@cern.ch + +#ifndef COMMON_TOOLS_PIDTPCMODULE_H_ +#define COMMON_TOOLS_PIDTPCMODULE_H_ + +#include +#include +#include +#include +#include +// ROOT includes +#include "TFile.h" +#include "TRandom.h" +#include "TSystem.h" + +// O2 includes +#include "MetadataHelper.h" +#include "TableHelper.h" +#include "pidTPCBase.h" + +#include "Common/CCDB/ctpRateFetcher.h" +#include "Common/Core/PID/TPCPIDResponse.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponseTPC.h" +#include "Tools/ML/model.h" + +#include "CCDB/BasicCCDBManager.h" +#include "CCDB/CcdbApi.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/Track.h" + +namespace o2::aod +{ +namespace pid +{ +struct pidTPCProducts : o2::framework::ProducesGroup { + // Intermediate tables (provide only if requested) + o2::framework::Produces dEdxCorrected; + o2::framework::Produces mult; + + // Tables produced by TPC component + o2::framework::Produces tablePIDFullEl; + o2::framework::Produces tablePIDFullMu; + o2::framework::Produces tablePIDFullPi; + o2::framework::Produces tablePIDFullKa; + o2::framework::Produces tablePIDFullPr; + o2::framework::Produces tablePIDFullDe; + o2::framework::Produces tablePIDFullTr; + o2::framework::Produces tablePIDFullHe; + o2::framework::Produces tablePIDFullAl; + + o2::framework::Produces tablePIDTinyEl; + o2::framework::Produces tablePIDTinyMu; + o2::framework::Produces tablePIDTinyPi; + o2::framework::Produces tablePIDTinyKa; + o2::framework::Produces tablePIDTinyPr; + o2::framework::Produces tablePIDTinyDe; + o2::framework::Produces tablePIDTinyTr; + o2::framework::Produces tablePIDTinyHe; + o2::framework::Produces tablePIDTinyAl; + o2::framework::Produces tableTuneOnData; +}; + +struct pidTPCConfigurables : o2::framework::ConfigurableGroup { + std::string prefix = "pidTPC"; + o2::framework::Configurable paramfile{"param-file", "", "Path to the parametrization object, if empty the parametrization is not taken from file"}; + o2::framework::Configurable ccdbPath{"ccdbPath", "Analysis/PID/TPC/Response", "Path of the TPC parametrization on the CCDB"}; + o2::framework::Configurable recoPass{"recoPass", "", "Reconstruction pass name for CCDB query (automatically takes latest object for timestamp if blank)"}; + o2::framework::Configurable ccdbTimestamp{"ccdb-timestamp", 0, "timestamp of the object used to query in CCDB the detector response. Exceptions: -1 gets the latest object, 0 gets the run dependent timestamp"}; + // Parameters for loading network from a file / downloading the file + o2::framework::Configurable useNetworkCorrection{"useNetworkCorrection", 0, "(bool) Wether or not to use the network correction for the TPC dE/dx signal"}; + o2::framework::Configurable autofetchNetworks{"autofetchNetworks", 1, "(bool) Automatically fetches networks from CCDB for the correct run number"}; + o2::framework::Configurable skipTPCOnly{"skipTPCOnly", false, "Flag to skip TPC only tracks (faster but affects the analyses that use TPC only tracks)"}; + o2::framework::Configurable networkPathLocally{"networkPathLocally", "network.onnx", "(std::string) Path to the local .onnx file. If autofetching is enabled, then this is where the files will be downloaded"}; + o2::framework::Configurable networkPathCCDB{"networkPathCCDB", "Analysis/PID/TPC/ML", "Path on CCDB"}; + o2::framework::Configurable enableNetworkOptimizations{"enableNetworkOptimizations", 1, "(bool) If the neural network correction is used, this enables GraphOptimizationLevel::ORT_ENABLE_EXTENDED in the ONNX session"}; + o2::framework::Configurable networkSetNumThreads{"networkSetNumThreads", 0, "Especially important for running on a SLURM cluster. Sets the number of threads used for execution."}; + // Configuration flags to include and exclude particle hypotheses + o2::framework::Configurable savedEdxsCorrected{"savedEdxsCorrected", -1, {"Save table with corrected dE/dx calculated on the spot. 0: off, 1: on, -1: auto"}}; + o2::framework::Configurable useCorrecteddEdx{"useCorrecteddEdx", false, "(bool) If true, use corrected dEdx value in Nsigma calculation instead of the one in the AO2D"}; + + o2::framework::Configurable pidFullEl{"pid-full-el", -1, {"Produce PID information for the Electron mass hypothesis, overrides the automatic setup: the corresponding table can be set off (0) or on (1)"}}; + o2::framework::Configurable pidFullMu{"pid-full-mu", -1, {"Produce PID information for the Muon mass hypothesis, overrides the automatic setup: the corresponding table can be set off (0) or on (1)"}}; + o2::framework::Configurable pidFullPi{"pid-full-pi", -1, {"Produce PID information for the Pion mass hypothesis, overrides the automatic setup: the corresponding table can be set off (0) or on (1)"}}; + o2::framework::Configurable pidFullKa{"pid-full-ka", -1, {"Produce PID information for the Kaon mass hypothesis, overrides the automatic setup: the corresponding table can be set off (0) or on (1)"}}; + o2::framework::Configurable pidFullPr{"pid-full-pr", -1, {"Produce PID information for the Proton mass hypothesis, overrides the automatic setup: the corresponding table can be set off (0) or on (1)"}}; + o2::framework::Configurable pidFullDe{"pid-full-de", -1, {"Produce PID information for the Deuterons mass hypothesis, overrides the automatic setup: the corresponding table can be set off (0) or on (1)"}}; + o2::framework::Configurable pidFullTr{"pid-full-tr", -1, {"Produce PID information for the Triton mass hypothesis, overrides the automatic setup: the corresponding table can be set off (0) or on (1)"}}; + o2::framework::Configurable pidFullHe{"pid-full-he", -1, {"Produce PID information for the Helium3 mass hypothesis, overrides the automatic setup: the corresponding table can be set off (0) or on (1)"}}; + o2::framework::Configurable pidFullAl{"pid-full-al", -1, {"Produce PID information for the Alpha mass hypothesis, overrides the automatic setup: the corresponding table can be set off (0) or on (1)"}}; + o2::framework::Configurable pidTinyEl{"pid-tiny-el", -1, {"Produce PID information for the Electron mass hypothesis, overrides the automatic setup: the corresponding table can be set off (0) or on (1)"}}; + o2::framework::Configurable pidTinyMu{"pid-tiny-mu", -1, {"Produce PID information for the Muon mass hypothesis, overrides the automatic setup: the corresponding table can be set off (0) or on (1)"}}; + o2::framework::Configurable pidTinyPi{"pid-tiny-pi", -1, {"Produce PID information for the Pion mass hypothesis, overrides the automatic setup: the corresponding table can be set off (0) or on (1)"}}; + o2::framework::Configurable pidTinyKa{"pid-tiny-ka", -1, {"Produce PID information for the Kaon mass hypothesis, overrides the automatic setup: the corresponding table can be set off (0) or on (1)"}}; + o2::framework::Configurable pidTinyPr{"pid-tiny-pr", -1, {"Produce PID information for the Proton mass hypothesis, overrides the automatic setup: the corresponding table can be set off (0) or on (1)"}}; + o2::framework::Configurable pidTinyDe{"pid-tiny-de", -1, {"Produce PID information for the Deuterons mass hypothesis, overrides the automatic setup: the corresponding table can be set off (0) or on (1)"}}; + o2::framework::Configurable pidTinyTr{"pid-tiny-tr", -1, {"Produce PID information for the Triton mass hypothesis, overrides the automatic setup: the corresponding table can be set off (0) or on (1)"}}; + o2::framework::Configurable pidTinyHe{"pid-tiny-he", -1, {"Produce PID information for the Helium3 mass hypothesis, overrides the automatic setup: the corresponding table can be set off (0) or on (1)"}}; + o2::framework::Configurable pidTinyAl{"pid-tiny-al", -1, {"Produce PID information for the Alpha mass hypothesis, overrides the automatic setup: the corresponding table can be set off (0) or on (1)"}}; + o2::framework::Configurable enableTuneOnDataTable{"enableTuneOnDataTable", -1, {"Produce tuned dE/dx signal table for MC to be used as raw signal in other tasks (default -1, 'only if needed'"}}; + o2::framework::Configurable useNetworkEl{"useNetworkEl", 1, {"Switch for applying neural network on the electron mass hypothesis (if network enabled) (set to 0 to disable)"}}; + o2::framework::Configurable useNetworkMu{"useNetworkMu", 1, {"Switch for applying neural network on the muon mass hypothesis (if network enabled) (set to 0 to disable)"}}; + o2::framework::Configurable useNetworkPi{"useNetworkPi", 1, {"Switch for applying neural network on the pion mass hypothesis (if network enabled) (set to 0 to disable)"}}; + o2::framework::Configurable useNetworkKa{"useNetworkKa", 1, {"Switch for applying neural network on the kaon mass hypothesis (if network enabled) (set to 0 to disable)"}}; + o2::framework::Configurable useNetworkPr{"useNetworkPr", 1, {"Switch for applying neural network on the proton mass hypothesis (if network enabled) (set to 0 to disable)"}}; + o2::framework::Configurable useNetworkDe{"useNetworkDe", 1, {"Switch for applying neural network on the deuteron mass hypothesis (if network enabled) (set to 0 to disable)"}}; + o2::framework::Configurable useNetworkTr{"useNetworkTr", 1, {"Switch for applying neural network on the triton mass hypothesis (if network enabled) (set to 0 to disable)"}}; + o2::framework::Configurable useNetworkHe{"useNetworkHe", 1, {"Switch for applying neural network on the helium3 mass hypothesis (if network enabled) (set to 0 to disable)"}}; + o2::framework::Configurable useNetworkAl{"useNetworkAl", 1, {"Switch for applying neural network on the alpha mass hypothesis (if network enabled) (set to 0 to disable)"}}; + o2::framework::Configurable networkBetaGammaCutoff{"networkBetaGammaCutoff", 0.45, {"Lower value of beta-gamma to override the NN application"}}; +}; + +// helper getter - FIXME should be separate +int getPIDIndex(const int pdgCode) // Get O2 PID index corresponding to MC PDG code +{ + switch (abs(pdgCode)) { + case 11: + return o2::track::PID::Electron; + case 13: + return o2::track::PID::Muon; + case 211: + return o2::track::PID::Pion; + case 321: + return o2::track::PID::Kaon; + case 2212: + return o2::track::PID::Proton; + case 1000010020: + return o2::track::PID::Deuteron; + case 1000010030: + return o2::track::PID::Triton; + case 1000020030: + return o2::track::PID::Helium3; + case 1000020040: + return o2::track::PID::Alpha; + default: // treat as pion if not any of the above + return o2::track::PID::Pion; + } +} + +typedef struct Str_dEdx_correction { + TMatrixD fMatrix; + bool warning = true; + + // void init(std::vector& params) + void init() + { + double elements[32] = {0.99091, -0.015053, 0.0018912, -0.012305, + 0.081387, 0.003205, -0.0087404, -0.0028608, + 0.013066, 0.017012, -0.0018469, -0.0052177, + -0.0035655, 0.0017846, 0.0019127, -0.00012964, + 0.0049428, 0.0055592, -0.0010618, -0.0016134, + -0.0059098, 0.0013335, 0.00052133, 3.1119e-05, + -0.004882, 0.00077317, -0.0013827, 0.003249, + -0.00063689, 0.0016218, -0.00045215, -1.5815e-05}; + fMatrix.ResizeTo(4, 8); + fMatrix.SetMatrixArray(elements); + } + + float fReal_fTPCSignalN(std::vector vec1, std::vector vec2) + { + float result = 0.f; + // push 1. + vec1.insert(vec1.begin(), 1.0); + vec2.insert(vec2.begin(), 1.0); + for (int i = 0; i < fMatrix.GetNrows(); i++) { + for (int j = 0; j < fMatrix.GetNcols(); j++) { + double param = fMatrix(i, j); + double value1 = i > static_cast(vec1.size()) ? 0 : vec1[i]; + double value2 = j > static_cast(vec2.size()) ? 0 : vec2[j]; + result += param * value1 * value2; + } + } + return result; + } +} Str_dEdx_correction; + +class pidTPCModule +{ + public: + pidTPCModule() + { + // constructor + } + o2::aod::pid::pidTPCConfigurables pidTPCopts; + + // TPC PID Response + o2::pid::tpc::Response* response; + + // Network correction for TPC PID response + ml::OnnxModel network; + std::map metadata; + std::map nullmetadata; + std::map headers; + std::vector speciesNetworkFlags = std::vector(9); + std::string networkVersion; + + // Parametrization configuration + bool useCCDBParam = false; + + // for dEdx correction + ctpRateFetcher mRateFetcher; + Str_dEdx_correction str_dedx_correction; + + //__________________________________________________ + template + void init(TCCDB& ccdb, TCCDBApi& ccdbApi, TContext& context, TpidTPCOpts const& external_pidtpcopts, TMetadataInfo const& metadataInfo) + { + // read in configurations from the task where it's used + pidTPCopts = external_pidtpcopts; + + if (pidTPCopts.useCorrecteddEdx.value) { + LOGF(info, "***************************************************"); + LOGF(info, " WARNING: YOU HAVE SWITCHED ON 'corrected dEdx!"); + LOGF(info, " This mode is still in development and it is meant"); + LOGF(info, " ONLY FOR EXPERTS at this time. Please switch "); + LOGF(info, " this option off UNLESS you are absolutely SURE"); + LOGF(info, " of what you're doing! You've been warned!"); + LOGF(info, "***************************************************"); + } + + // initialize PID response + response = new o2::pid::tpc::Response(); + + enableFlagIfTableRequired(context, "DEdxsCorrected", pidTPCopts.savedEdxsCorrected); + + // Checking the tables are requested in the workflow and enabling them + auto enableFlag = [&](const std::string particle, o2::framework::Configurable& flag) { + enableFlagIfTableRequired(context, "pidTPC" + particle, flag); + }; + enableFlag("FullEl", pidTPCopts.pidFullEl); + enableFlag("FullMu", pidTPCopts.pidFullMu); + enableFlag("FullPi", pidTPCopts.pidFullPi); + enableFlag("FullKa", pidTPCopts.pidFullKa); + enableFlag("FullPr", pidTPCopts.pidFullPr); + enableFlag("FullDe", pidTPCopts.pidFullDe); + enableFlag("FullTr", pidTPCopts.pidFullTr); + enableFlag("FullHe", pidTPCopts.pidFullHe); + enableFlag("FullAl", pidTPCopts.pidFullAl); + + enableFlag("El", pidTPCopts.pidTinyEl); + enableFlag("Mu", pidTPCopts.pidTinyMu); + enableFlag("Pi", pidTPCopts.pidTinyPi); + enableFlag("Ka", pidTPCopts.pidTinyKa); + enableFlag("Pr", pidTPCopts.pidTinyPr); + enableFlag("De", pidTPCopts.pidTinyDe); + enableFlag("Tr", pidTPCopts.pidTinyTr); + enableFlag("He", pidTPCopts.pidTinyHe); + enableFlag("Al", pidTPCopts.pidTinyAl); + + if (metadataInfo.isMC()) { + enableFlagIfTableRequired(context, "mcTPCTuneOnData", pidTPCopts.enableTuneOnDataTable); + } + + speciesNetworkFlags[0] = pidTPCopts.useNetworkEl; + speciesNetworkFlags[1] = pidTPCopts.useNetworkMu; + speciesNetworkFlags[2] = pidTPCopts.useNetworkPi; + speciesNetworkFlags[3] = pidTPCopts.useNetworkKa; + speciesNetworkFlags[4] = pidTPCopts.useNetworkPr; + speciesNetworkFlags[5] = pidTPCopts.useNetworkDe; + speciesNetworkFlags[6] = pidTPCopts.useNetworkTr; + speciesNetworkFlags[7] = pidTPCopts.useNetworkHe; + speciesNetworkFlags[8] = pidTPCopts.useNetworkAl; + + // Initialise metadata object for CCDB calls from AO2D metadata + if (pidTPCopts.recoPass.value == "") { + if (metadataInfo.isFullyDefined()) { + metadata["RecoPassName"] = metadataInfo.get("RecoPassName"); + LOGP(info, "Automatically setting reco pass for TPC Response to {} from AO2D", metadata["RecoPassName"]); + } + } else { + LOGP(info, "Setting reco pass for TPC response to user-defined name {}", pidTPCopts.recoPass.value); + metadata["RecoPassName"] = pidTPCopts.recoPass.value; + } + + /// TPC PID Response + const TString fname = pidTPCopts.paramfile.value; + if (fname != "") { // Loading the parametrization from file + LOGP(info, "Loading TPC response from file {}", fname.Data()); + try { + std::unique_ptr f(TFile::Open(fname, "READ")); + f->GetObject("Response", response); + } catch (...) { + LOGF(fatal, "Loading the TPC PID Response from file {} failed!", fname.Data()); + } + response->PrintAll(); + } else { + useCCDBParam = true; + const std::string path = pidTPCopts.ccdbPath.value; + const auto time = pidTPCopts.ccdbTimestamp.value; + if (time != 0) { + LOGP(info, "Initialising TPC PID response for fixed timestamp {} and reco pass {}:", time, pidTPCopts.recoPass.value); + ccdb->setTimestamp(time); + response = ccdb->template getSpecific(path, time, metadata); + headers = ccdbApi.retrieveHeaders(path, metadata, time); + if (!response) { + LOGF(warning, "Unable to find TPC parametrisation for specified pass name - falling back to latest object"); + response = ccdb->template getForTimeStamp(path, time); + headers = ccdbApi.retrieveHeaders(path, metadata, time); + networkVersion = headers["NN-Version"]; + if (!response) { + LOGF(fatal, "Unable to find any TPC object corresponding to timestamp {}!", time); + } + } + LOG(info) << "Successfully retrieved TPC PID object from CCDB for timestamp " << time << ", period " << headers["LPMProductionTag"] << ", recoPass " << headers["RecoPassName"]; + metadata["RecoPassName"] = headers["RecoPassName"]; // Force pass number for NN request to match retrieved BB + response->PrintAll(); + } + } + + /// Neural network init for TPC PID + if (!pidTPCopts.useNetworkCorrection) { + return; + } else { + /// CCDB and auto-fetching + if (!pidTPCopts.autofetchNetworks) { + if (pidTPCopts.ccdbTimestamp > 0) { + /// Fetching network for specific timestamp + LOG(info) << "Fetching network for timestamp: " << pidTPCopts.ccdbTimestamp.value; + bool retrieveSuccess = ccdbApi.retrieveBlob(pidTPCopts.networkPathCCDB.value, ".", metadata, pidTPCopts.ccdbTimestamp.value, false, pidTPCopts.networkPathLocally.value); + headers = ccdbApi.retrieveHeaders(pidTPCopts.networkPathCCDB.value, metadata, pidTPCopts.ccdbTimestamp.value); + networkVersion = headers["NN-Version"]; + if (retrieveSuccess) { + network.initModel(pidTPCopts.networkPathLocally.value, pidTPCopts.enableNetworkOptimizations.value, pidTPCopts.networkSetNumThreads.value, strtoul(headers["Valid-From"].c_str(), NULL, 0), strtoul(headers["Valid-Until"].c_str(), NULL, 0)); + std::vector dummyInput(network.getNumInputNodes(), 1.); + network.evalModel(dummyInput); /// Init the model evaluations + LOGP(info, "Retrieved NN corrections for production tag {}, pass number {}, and NN-Version {}", headers["LPMProductionTag"], headers["RecoPassName"], headers["NN-Version"]); + } else { + LOG(fatal) << "No valid NN object found matching retrieved Bethe-Bloch parametrisation for pass " << metadata["RecoPassName"] << ". Please ensure that the requested pass has dedicated NN corrections available"; + } + } else { + /// Taking the network from local file + if (pidTPCopts.networkPathLocally.value == "") { + LOG(fatal) << "Local path must be set (flag networkPathLocally)! Aborting..."; + } + LOG(info) << "Using local file [" << pidTPCopts.networkPathLocally.value << "] for the TPC PID response correction."; + network.initModel(pidTPCopts.networkPathLocally.value, pidTPCopts.enableNetworkOptimizations.value, pidTPCopts.networkSetNumThreads.value); + std::vector dummyInput(network.getNumInputNodes(), 1.); + network.evalModel(dummyInput); // This is an initialisation and might reduce the overhead of the model + } + } else { + return; + } + } + + if (pidTPCopts.useCorrecteddEdx.value && networkVersion != "5") { + LOGF(fatal, "Using corrected dE/dx with a network version other than 5 will not work. Crashing now."); + } + } // end init + + //__________________________________________________ + template + std::vector createNetworkPrediction(TCCDB& ccdb, TCCDBApi& ccdbApi, C const& collisions, M const& mults, T const& tracks, B const& bcs, const size_t size) + { + + std::vector network_prediction; + + auto start_network_total = std::chrono::high_resolution_clock::now(); + if (pidTPCopts.autofetchNetworks) { + const auto& bc = bcs.begin(); + // Initialise correct TPC response object before NN setup (for NCl normalisation) + if (useCCDBParam && pidTPCopts.ccdbTimestamp.value == 0 && !ccdb->isCachedObjectValid(pidTPCopts.ccdbPath.value, bc.timestamp())) { // Updating parametrisation only if the initial timestamp is 0 + if (pidTPCopts.recoPass.value == "") { + LOGP(info, "Retrieving latest TPC response object for timestamp {}:", bc.timestamp()); + } else { + LOGP(info, "Retrieving TPC Response for timestamp {} and recoPass {}:", bc.timestamp(), pidTPCopts.recoPass.value); + } + response = ccdb->template getSpecific(pidTPCopts.ccdbPath.value, bc.timestamp(), metadata); + headers = ccdbApi.retrieveHeaders(pidTPCopts.ccdbPath.value, metadata, bc.timestamp()); + networkVersion = headers["NN-Version"]; + if (!response) { + LOGP(warning, "!! Could not find a valid TPC response object for specific pass name {}! Falling back to latest uploaded object.", metadata["RecoPassName"]); + headers = ccdbApi.retrieveHeaders(pidTPCopts.ccdbPath.value, nullmetadata, bc.timestamp()); + response = ccdb->template getForTimeStamp(pidTPCopts.ccdbPath.value, bc.timestamp()); + if (!response) { + LOGP(fatal, "Could not find ANY TPC response object for the timestamp {}!", bc.timestamp()); + } + } + LOG(info) << "Successfully retrieved TPC PID object from CCDB for timestamp " << bc.timestamp() << ", period " << headers["LPMProductionTag"] << ", recoPass " << headers["RecoPassName"]; + metadata["RecoPassName"] = headers["RecoPassName"]; // Force pass number for NN request to match retrieved BB + response->PrintAll(); + } + + if (bc.timestamp() < network.getValidityFrom() || bc.timestamp() > network.getValidityUntil()) { // fetches network only if the runnumbers change + LOG(info) << "Fetching network for timestamp: " << bc.timestamp(); + bool retrieveSuccess = ccdbApi.retrieveBlob(pidTPCopts.networkPathCCDB.value, ".", metadata, bc.timestamp(), false, pidTPCopts.networkPathLocally.value); + headers = ccdbApi.retrieveHeaders(pidTPCopts.networkPathCCDB.value, metadata, bc.timestamp()); + networkVersion = headers["NN-Version"]; + if (retrieveSuccess) { + network.initModel(pidTPCopts.networkPathLocally.value, pidTPCopts.enableNetworkOptimizations.value, pidTPCopts.networkSetNumThreads.value, strtoul(headers["Valid-From"].c_str(), NULL, 0), strtoul(headers["Valid-Until"].c_str(), NULL, 0)); + std::vector dummyInput(network.getNumInputNodes(), 1.); + network.evalModel(dummyInput); + LOGP(info, "Retrieved NN corrections for production tag {}, pass number {}, NN-Version number{}", headers["LPMProductionTag"], headers["RecoPassName"], headers["NN-Version"]); + } else { + LOG(fatal) << "No valid NN object found matching retrieved Bethe-Bloch parametrisation for pass " << metadata["RecoPassName"] << ". Please ensure that the requested pass has dedicated NN corrections available"; + } + } + } + + // Defining some network parameters + int input_dimensions = network.getNumInputNodes(); + int output_dimensions = network.getNumOutputNodes(); + const uint64_t track_prop_size = input_dimensions * size; + const uint64_t prediction_size = output_dimensions * size; + + network_prediction = std::vector(prediction_size * 9); // For each mass hypotheses + const float nNclNormalization = response->GetNClNormalization(); + float duration_network = 0; + + std::vector track_properties(track_prop_size); + uint64_t counter_track_props = 0; + int loop_counter = 0; + + // Filling a std::vector to be evaluated by the network + // Evaluation on single tracks brings huge overhead: Thus evaluation is done on one large vector + for (int i = 0; i < 9; i++) { // Loop over particle number for which network correction is used + for (auto const& trk : tracks) { + if (!trk.hasTPC()) { + continue; + } + if (pidTPCopts.skipTPCOnly) { + if (!trk.hasITS() && !trk.hasTRD() && !trk.hasTOF()) { + continue; + } + } + track_properties[counter_track_props] = trk.tpcInnerParam(); + track_properties[counter_track_props + 1] = trk.tgl(); + track_properties[counter_track_props + 2] = trk.signed1Pt(); + track_properties[counter_track_props + 3] = o2::track::pid_constants::sMasses[i]; + track_properties[counter_track_props + 4] = trk.has_collision() ? mults[trk.collisionId()] / 11000. : 1.; + track_properties[counter_track_props + 5] = std::sqrt(nNclNormalization / trk.tpcNClsFound()); + if (input_dimensions == 7 && networkVersion == "2") { + track_properties[counter_track_props + 6] = trk.has_collision() ? collisions.iteratorAt(trk.collisionId()).ft0cOccupancyInTimeRange() / 60000. : 1.; + } + counter_track_props += input_dimensions; + } + + auto start_network_eval = std::chrono::high_resolution_clock::now(); + float* output_network = network.evalModel(track_properties); + auto stop_network_eval = std::chrono::high_resolution_clock::now(); + duration_network += std::chrono::duration>(stop_network_eval - start_network_eval).count(); + for (uint64_t i = 0; i < prediction_size; i += output_dimensions) { + for (int j = 0; j < output_dimensions; j++) { + network_prediction[i + j + prediction_size * loop_counter] = output_network[i + j]; + } + } + + counter_track_props = 0; + loop_counter += 1; + } + track_properties.clear(); + + auto stop_network_total = std::chrono::high_resolution_clock::now(); + LOG(debug) << "Neural Network for the TPC PID response correction: Time per track (eval ONNX): " << duration_network / (size * 9) << "ns ; Total time (eval ONNX): " << duration_network / 1000000000 << " s"; + LOG(debug) << "Neural Network for the TPC PID response correction: Time per track (eval + overhead): " << std::chrono::duration>(stop_network_total - start_network_total).count() / (size * 9) << "ns ; Total time (eval + overhead): " << std::chrono::duration>(stop_network_total - start_network_total).count() / 1000000000 << " s"; + + return network_prediction; + } + + //__________________________________________________ + template + void makePidTables(const int flagFull, NSF& tableFull, const int flagTiny, NST& tableTiny, const o2::track::PID::ID pid, const float tpcSignal, const T& trk, const long multTPC, const std::vector& network_prediction, const int& count_tracks, const int& tracksForNet_size) + { + if (flagFull != 1 && flagTiny != 1) { + return; + } + if (!trk.hasTPC() || tpcSignal < 0.f) { + if (flagFull) + tableFull(-999.f, -999.f); + if (flagTiny) + tableTiny(aod::pidtpc_tiny::binning::underflowBin); + return; + } + if (pidTPCopts.skipTPCOnly) { + if (!trk.hasITS() && !trk.hasTRD() && !trk.hasTOF()) { + if (flagFull) + tableFull(-999.f, -999.f); + if (flagTiny) + tableTiny(aod::pidtpc_tiny::binning::underflowBin); + return; + } + } + auto expSignal = response->GetExpectedSignal(trk, pid); + auto expSigma = trk.has_collision() ? response->GetExpectedSigmaAtMultiplicity(multTPC, trk, pid) : 0.07 * expSignal; // use default sigma value of 7% if no collision information to estimate resolution + if (expSignal < 0. || expSigma < 0.) { // skip if expected signal invalid + if (flagFull) + tableFull(-999.f, -999.f); + if (flagTiny) + tableTiny(aod::pidtpc_tiny::binning::underflowBin); + return; + } + + float nSigma = -999.f; + float bg = trk.tpcInnerParam() / o2::track::pid_constants::sMasses[pid]; // estimated beta-gamma for network cutoff + if (pidTPCopts.useNetworkCorrection && speciesNetworkFlags[pid] && trk.has_collision() && bg > pidTPCopts.networkBetaGammaCutoff) { + + // Here comes the application of the network. The output--dimensions of the network determine the application: 1: mean, 2: sigma, 3: sigma asymmetric + // For now only the option 2: sigma will be used. The other options are kept if there would be demand later on + if (network.getNumOutputNodes() == 1) { // Expected mean correction; no sigma correction + nSigma = (tpcSignal - network_prediction[count_tracks + tracksForNet_size * pid] * expSignal) / expSigma; + } else if (network.getNumOutputNodes() == 2) { // Symmetric sigma correction + expSigma = (network_prediction[2 * (count_tracks + tracksForNet_size * pid) + 1] - network_prediction[2 * (count_tracks + tracksForNet_size * pid)]) * expSignal; + nSigma = (tpcSignal / expSignal - network_prediction[2 * (count_tracks + tracksForNet_size * pid)]) / (network_prediction[2 * (count_tracks + tracksForNet_size * pid) + 1] - network_prediction[2 * (count_tracks + tracksForNet_size * pid)]); + } else if (network.getNumOutputNodes() == 3) { // Asymmetric sigma corection + if (tpcSignal / expSignal >= network_prediction[3 * (count_tracks + tracksForNet_size * pid)]) { + expSigma = (network_prediction[3 * (count_tracks + tracksForNet_size * pid) + 1] - network_prediction[3 * (count_tracks + tracksForNet_size * pid)]) * expSignal; + nSigma = (tpcSignal / expSignal - network_prediction[3 * (count_tracks + tracksForNet_size * pid)]) / (network_prediction[3 * (count_tracks + tracksForNet_size * pid) + 1] - network_prediction[3 * (count_tracks + tracksForNet_size * pid)]); + } else { + expSigma = (network_prediction[3 * (count_tracks + tracksForNet_size * pid)] - network_prediction[3 * (count_tracks + tracksForNet_size * pid) + 2]) * expSignal; + nSigma = (tpcSignal / expSignal - network_prediction[3 * (count_tracks + tracksForNet_size * pid)]) / (network_prediction[3 * (count_tracks + tracksForNet_size * pid)] - network_prediction[3 * (count_tracks + tracksForNet_size * pid) + 2]); + } + } else { + LOGF(fatal, "Network output-dimensions incompatible!"); + } + } else { + nSigma = response->GetNumberOfSigmaMCTunedAtMultiplicity(multTPC, trk, pid, tpcSignal); + } + if (flagFull) + tableFull(expSigma, nSigma); + if (flagTiny) + aod::pidtpc_tiny::binning::packInTable(nSigma, tableTiny); + }; + + //__________________________________________________ + template + void process(TCCDB& ccdb, TCCDBApi& ccdbApi, TBCs const& bcs, TCollisions const& cols, TTracks const& tracks, TTracksQA const& tracksQA, TProducts& products) + { + if (tracks.size() == 0) { + return; // empty protection + } + auto trackiterator = tracks.begin(); + if constexpr (requires { trackiterator.mcParticleId(); }) { + gRandom->SetSeed(0); // Ensure unique seed from UUID for each process call + } + + // preparatory step: we need the multiplicities for each collision + std::vector pidmults; + long totalTPCtracks = 0; + long totalTPCnotStandalone = 0; + pidmults.resize(cols.size(), 0); + + // faster counting + for (const auto& track : tracks) { + if (track.hasTPC()) { + if (track.collisionId() > -1) { + pidmults[track.collisionId()]++; + } + totalTPCtracks++; + if (track.hasITS() || track.hasTOF() || track.hasTRD()) { + totalTPCnotStandalone++; + } + } + } + + const uint64_t outTable_size = tracks.size(); + + auto reserveTable = [&outTable_size](const o2::framework::Configurable& flag, auto& table) { + if (flag.value != 1) { + return; + } + table.reserve(outTable_size); + }; + + // Prepare memory for enabled tables + reserveTable(pidTPCopts.pidFullEl, products.tablePIDFullEl); + reserveTable(pidTPCopts.pidFullMu, products.tablePIDFullMu); + reserveTable(pidTPCopts.pidFullPi, products.tablePIDFullPi); + reserveTable(pidTPCopts.pidFullKa, products.tablePIDFullKa); + reserveTable(pidTPCopts.pidFullPr, products.tablePIDFullPr); + reserveTable(pidTPCopts.pidFullDe, products.tablePIDFullDe); + reserveTable(pidTPCopts.pidFullTr, products.tablePIDFullTr); + reserveTable(pidTPCopts.pidFullHe, products.tablePIDFullHe); + reserveTable(pidTPCopts.pidFullAl, products.tablePIDFullAl); + + reserveTable(pidTPCopts.pidTinyEl, products.tablePIDTinyEl); + reserveTable(pidTPCopts.pidTinyMu, products.tablePIDTinyMu); + reserveTable(pidTPCopts.pidTinyPi, products.tablePIDTinyPi); + reserveTable(pidTPCopts.pidTinyKa, products.tablePIDTinyKa); + reserveTable(pidTPCopts.pidTinyPr, products.tablePIDTinyPr); + reserveTable(pidTPCopts.pidTinyDe, products.tablePIDTinyDe); + reserveTable(pidTPCopts.pidTinyTr, products.tablePIDTinyTr); + reserveTable(pidTPCopts.pidTinyHe, products.tablePIDTinyHe); + reserveTable(pidTPCopts.pidTinyAl, products.tablePIDTinyAl); + + const uint64_t tracksForNet_size = (pidTPCopts.skipTPCOnly) ? totalTPCnotStandalone : totalTPCtracks; + std::vector network_prediction; + + if (pidTPCopts.useNetworkCorrection) { + network_prediction = createNetworkPrediction(ccdb, ccdbApi, cols, pidmults, tracks, bcs, tracksForNet_size); + } + + uint64_t count_tracks = 0; + + //_______________________________________ + // process tracksQA in case present + std::vector indexTrack2TrackQA; + if constexpr (soa::is_table) { + for (const auto& trackQA : tracksQA) { + indexTrack2TrackQA[trackQA.trackId()] = trackQA.globalIndex(); + } + } + //_______________________________________ + + for (auto const& trk : tracks) { + // get the TPC signal to be used in the PID + float tpcSignalToEvaluatePID = trk.tpcSignal(); + + int multTPC = 0; + if (trk.has_collision()) { + multTPC = pidmults[trk.collisionId()]; + } + + // if corrected dE/dx is requested, correct it here on the spot and use that + if (pidTPCopts.useCorrecteddEdx) { + double hadronicRate; + int occupancy; + if (trk.has_collision()) { + auto collision = cols.iteratorAt(trk.collisionId()); + auto bc = collision.template bc_as(); + const int runnumber = bc.runNumber(); + hadronicRate = mRateFetcher.fetch(ccdb.service, bc.timestamp(), runnumber, "ZNC hadronic") * 1.e-3; // kHz + occupancy = collision.trackOccupancyInTimeRange(); + } else { + auto bc = bcs.begin(); + const int runnumber = bc.runNumber(); + hadronicRate = mRateFetcher.fetch(ccdb.service, bc.timestamp(), runnumber, "ZNC hadronic") * 1.e-3; // kHz + occupancy = 0; + } + + float fTPCSignal = trk.tpcSignal(); + float fNormMultTPC = multTPC / 11000.; + + float fTrackOccN = occupancy / 1000.; + float fOccTPCN = fNormMultTPC * 10; //(fNormMultTPC*10).clip(0,12) + if (fOccTPCN > 12) + fOccTPCN = 12; + else if (fOccTPCN < 0) + fOccTPCN = 0; + + float fTrackOccMeanN = hadronicRate / 5; + float side = trk.tgl() > 0 ? 1 : 0; + float a1pt = std::abs(trk.signed1Pt()); + float a1pt2 = a1pt * a1pt; + float atgl = std::abs(trk.tgl()); + float mbb0R = 50 / fTPCSignal; + if (mbb0R > 1.05) + mbb0R = 1.05; + else if (mbb0R < 0.05) + mbb0R = 0.05; + // float mbb0R = max(0.05, min(50 / fTPCSignal, 1.05)); + float a1ptmbb0R = a1pt * mbb0R; + float atglmbb0R = atgl * mbb0R; + + std::vector vec_occu = {fTrackOccN, fOccTPCN, fTrackOccMeanN}; + std::vector vec_track = {mbb0R, a1pt, atgl, atglmbb0R, a1ptmbb0R, side, a1pt2}; + + float fTPCSignalN_CR0 = str_dedx_correction.fReal_fTPCSignalN(vec_occu, vec_track); + + float mbb0R1 = 50 / (fTPCSignal / fTPCSignalN_CR0); + if (mbb0R1 > 1.05) + mbb0R1 = 1.05; + else if (mbb0R1 < 0.05) + mbb0R1 = 0.05; + + std::vector vec_track1 = {mbb0R1, a1pt, atgl, atgl * mbb0R1, a1pt * mbb0R1, side, a1pt2}; + float fTPCSignalN_CR1 = str_dedx_correction.fReal_fTPCSignalN(vec_occu, vec_track1); + + // change the signal used for PID + tpcSignalToEvaluatePID = fTPCSignal / fTPCSignalN_CR1; + + //_________________________________________________________ + // bypass TPC signal in case TracksQA information present + if constexpr (soa::is_table) { + tpcSignalToEvaluatePID = -999.f; + if (indexTrack2TrackQA[trk.globalIndex()] != -1) { + auto trackQA = tracksQA.rawIteratorAt(indexTrack2TrackQA[trk.globalIndex()]); + tpcSignalToEvaluatePID = trackQA.tpcdEdxNorm(); + } + } + //_________________________________________________________ + + if (pidTPCopts.savedEdxsCorrected) { + // populated cursor if requested or autodetected + products.dEdxCorrected(tpcSignalToEvaluatePID); + } + } + + const auto& bc = trk.has_collision() ? cols.rawIteratorAt(trk.collisionId()).template bc_as() : bcs.begin(); + if (useCCDBParam && pidTPCopts.ccdbTimestamp.value == 0 && !ccdb->isCachedObjectValid(pidTPCopts.ccdbPath.value, bc.timestamp())) { // Updating parametrisation only if the initial timestamp is 0 + if (pidTPCopts.recoPass.value == "") { + LOGP(info, "Retrieving latest TPC response object for timestamp {}:", bc.timestamp()); + } else { + LOGP(info, "Retrieving TPC Response for timestamp {} and recoPass {}:", bc.timestamp(), pidTPCopts.recoPass.value); + } + response = ccdb->template getSpecific(pidTPCopts.ccdbPath.value, bc.timestamp(), metadata); + headers = ccdbApi.retrieveHeaders(pidTPCopts.ccdbPath.value, metadata, bc.timestamp()); + if (!response) { + LOGP(warning, "!! Could not find a valid TPC response object for specific pass name {}! Falling back to latest uploaded object.", metadata["RecoPassName"]); + response = ccdb->template getForTimeStamp(pidTPCopts.ccdbPath.value, bc.timestamp()); + headers = ccdbApi.retrieveHeaders(pidTPCopts.ccdbPath.value, nullmetadata, bc.timestamp()); + if (!response) { + LOGP(fatal, "Could not find ANY TPC response object for the timestamp {}!", bc.timestamp()); + } + } + LOG(info) << "Successfully retrieved TPC PID object from CCDB for timestamp " << bc.timestamp() << ", period " << headers["LPMProductionTag"] << ", recoPass " << headers["RecoPassName"]; + response->PrintAll(); + } + + // if this is a MC process function, go for MC tune on data processing + if constexpr (requires { trk.mcParticleId(); }) { + // Perform TuneOnData sampling for MC dE/dx + float mcTunedTPCSignal = 0.; + if (!trk.hasTPC()) { + mcTunedTPCSignal = -999.f; + } else { + if (pidTPCopts.skipTPCOnly) { + if (!trk.hasITS() && !trk.hasTRD() && !trk.hasTOF()) { + mcTunedTPCSignal = -999.f; + } + } + int pid = getPIDIndex(trk.mcParticle().pdgCode()); + + auto expSignal = response->GetExpectedSignal(trk, pid); + auto expSigma = response->GetExpectedSigmaAtMultiplicity(multTPC, trk, pid); + if (expSignal < 0. || expSigma < 0.) { // if expectation invalid then give undefined signal + mcTunedTPCSignal = -999.f; + } + float bg = trk.tpcInnerParam() / o2::track::pid_constants::sMasses[pid]; // estimated beta-gamma for network cutoff + + if (pidTPCopts.useNetworkCorrection && speciesNetworkFlags[pid] && trk.has_collision() && bg > pidTPCopts.networkBetaGammaCutoff) { + auto mean = network_prediction[2 * (count_tracks + tracksForNet_size * pid)] * expSignal; // Absolute mean, i.e. the mean dE/dx value of the data in that slice, not the mean of the NSigma distribution + auto sigma = (network_prediction[2 * (count_tracks + tracksForNet_size * pid) + 1] - network_prediction[2 * (count_tracks + tracksForNet_size * pid)]) * expSignal; + if (mean < 0.f || sigma < 0.f) { + mcTunedTPCSignal = -999.f; + } else { + mcTunedTPCSignal = gRandom->Gaus(mean, sigma); + } + } else { + mcTunedTPCSignal = gRandom->Gaus(expSignal, expSigma); + } + } + tpcSignalToEvaluatePID = mcTunedTPCSignal; // pass this for further eval + if (pidTPCopts.enableTuneOnDataTable) + products.tableTuneOnData(mcTunedTPCSignal); + } + + auto makePidTablesDefault = [&trk, &tpcSignalToEvaluatePID, &multTPC, &network_prediction, &count_tracks, &tracksForNet_size, this](const int flagFull, auto& tableFull, const int flagTiny, auto& tableTiny, const o2::track::PID::ID pid) { + this->makePidTables(flagFull, tableFull, flagTiny, tableTiny, pid, tpcSignalToEvaluatePID, trk, multTPC, network_prediction, count_tracks, tracksForNet_size); + }; + + makePidTablesDefault(pidTPCopts.pidFullEl, products.tablePIDFullEl, pidTPCopts.pidTinyEl, products.tablePIDTinyEl, o2::track::PID::Electron); + makePidTablesDefault(pidTPCopts.pidFullMu, products.tablePIDFullMu, pidTPCopts.pidTinyMu, products.tablePIDTinyMu, o2::track::PID::Muon); + makePidTablesDefault(pidTPCopts.pidFullPi, products.tablePIDFullPi, pidTPCopts.pidTinyPi, products.tablePIDTinyPi, o2::track::PID::Pion); + makePidTablesDefault(pidTPCopts.pidFullKa, products.tablePIDFullKa, pidTPCopts.pidTinyKa, products.tablePIDTinyKa, o2::track::PID::Kaon); + makePidTablesDefault(pidTPCopts.pidFullPr, products.tablePIDFullPr, pidTPCopts.pidTinyPr, products.tablePIDTinyPr, o2::track::PID::Proton); + makePidTablesDefault(pidTPCopts.pidFullDe, products.tablePIDFullDe, pidTPCopts.pidTinyDe, products.tablePIDTinyDe, o2::track::PID::Deuteron); + makePidTablesDefault(pidTPCopts.pidFullTr, products.tablePIDFullTr, pidTPCopts.pidTinyTr, products.tablePIDTinyTr, o2::track::PID::Triton); + makePidTablesDefault(pidTPCopts.pidFullHe, products.tablePIDFullHe, pidTPCopts.pidTinyHe, products.tablePIDTinyHe, o2::track::PID::Helium3); + makePidTablesDefault(pidTPCopts.pidFullAl, products.tablePIDFullAl, pidTPCopts.pidTinyAl, products.tablePIDTinyAl, o2::track::PID::Alpha); + + if (trk.hasTPC() && (!pidTPCopts.skipTPCOnly || trk.hasITS() || trk.hasTRD() || trk.hasTOF())) { + count_tracks++; // Increment network track counter only if track has TPC, and (not skipping TPConly) or (is not TPConly) + } + } + } // end process function +}; + +} // namespace pid +} // namespace o2::aod + +#endif // COMMON_TOOLS_PIDTPCMODULE_H_ diff --git a/Common/TableProducer/PID/pidTPCService.cxx b/Common/TableProducer/PID/pidTPCService.cxx new file mode 100644 index 00000000000..cff700fca1c --- /dev/null +++ b/Common/TableProducer/PID/pidTPCService.cxx @@ -0,0 +1,118 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file trackPropagationTester.cxx +/// \brief testing ground for track propagation +/// \author ALICE + +//=============================================================== +// +// Modularized version of TPC PID task +// +//=============================================================== + +#include +#include +#include +#include +#include +// ROOT includes +#include "TFile.h" +#include "TRandom.h" +#include "TSystem.h" + +// O2 includes +#include "MetadataHelper.h" +#include "TableHelper.h" +#include "pidTPCBase.h" +#include "pidTPCModule.h" + +#include "Common/Core/PID/TPCPIDResponse.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponseTPC.h" +#include "Tools/ML/model.h" + +#include "CCDB/BasicCCDBManager.h" +#include "CCDB/CcdbApi.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/Track.h" + +using namespace o2; +using namespace o2::framework; + +o2::common::core::MetadataHelper metadataInfo; // Metadata helper + +struct pidTpcService { + + // CCDB boilerplate declarations + o2::framework::Configurable ccdburl{"ccdburl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Service ccdb; + o2::ccdb::CcdbApi ccdbApi; + + o2::aod::pid::pidTPCProducts products; + o2::aod::pid::pidTPCConfigurables pidTPCopts; + o2::aod::pid::pidTPCModule pidTPC; + + void init(o2::framework::InitContext& initContext) + { + // CCDB boilerplate init + ccdb->setURL(ccdburl.value); + ccdb->setFatalWhenNull(false); // manual fallback in case ccdb entry empty + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); + ccdbApi.init(ccdburl.value); + + // task-specific + pidTPC.init(ccdb, ccdbApi, initContext, pidTPCopts, metadataInfo); + } + + void processTracks(soa::Join const& collisions, soa::Join const& tracks, aod::BCsWithTimestamps const& bcs) + { + pidTPC.process(ccdb, ccdbApi, bcs, collisions, tracks, static_cast(nullptr), products); + } + void processTracksWithTracksQA(soa::Join const& collisions, soa::Join const& tracks, aod::BCsWithTimestamps const& bcs, aod::TracksQA const& tracksQA) + { + pidTPC.process(ccdb, ccdbApi, bcs, collisions, tracks, tracksQA, products); + } + + void processTracksMC(soa::Join const& collisions, soa::Join const& tracks, aod::BCsWithTimestamps const& bcs, aod::McParticles const&) + { + pidTPC.process(ccdb, ccdbApi, bcs, collisions, tracks, static_cast(nullptr), products); + } + + void processTracksIU(soa::Join const& collisions, soa::Join const& tracks, aod::BCsWithTimestamps const& bcs) + { + pidTPC.process(ccdb, ccdbApi, bcs, collisions, tracks, static_cast(nullptr), products); + } + + PROCESS_SWITCH(pidTpcService, processTracks, "Process Tracks", false); + PROCESS_SWITCH(pidTpcService, processTracksMC, "Process Tracks in MC (enables tune-on-data)", false); + PROCESS_SWITCH(pidTpcService, processTracksIU, "Process TracksIU (experimental)", true); +}; + +//**************************************************************************************** +/** + * Workflow definition. + */ +//**************************************************************************************** +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + // Parse the metadata for later too + metadataInfo.initMetadata(cfgc); + + WorkflowSpec workflow{adaptAnalysisTask(cfgc)}; + return workflow; +} From d71d1d98aae5da38638d2d2bd54f087c9dc60ef8 Mon Sep 17 00:00:00 2001 From: Shirajum Monira <38348689+Eloviyo@users.noreply.github.com> Date: Wed, 30 Jul 2025 12:43:03 +0200 Subject: [PATCH 136/345] [PWGCF] FemtoUniverse v0cascade Task -- added v0-cascade process function (#12319) Co-authored-by: Shirajum Monira --- .../FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx index 0fc168d03ef..9e2c024354e 100644 --- a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx +++ b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx @@ -480,10 +480,10 @@ struct FemtoUniverseProducerTask { void init(InitContext&) { - if ((doprocessFullData || doprocessTrackPhiData || doprocessTrackData || doprocessTrackV0 || doprocessTrackCascadeData || doprocessTrackD0mesonData || doprocessTrackD0DataML || doprocessTrackCentRun2Data || doprocessTrackV0CentRun2Data || doprocessTrackCentRun3Data || doprocessV0CentRun3Data || doprocessCascadeCentRun3Data || doprocessTrackDataCentPP) == false && (doprocessFullMC || doprocessTrackMC || doprocessTrackMCTruth || doprocessTrackMCGen || doprocessTruthAndFullMCV0 || doprocessTrackD0MC || doprocessTruthAndFullMCCasc || doprocessFullMCCent || doprocessTrackCentRun3DataMC || doprocessTruthAndFullMCCentRun3 || doprocessTruthAndFullMCCentRun3V0) == false) { + if ((doprocessFullData || doprocessTrackPhiData || doprocessTrackData || doprocessTrackV0 || doprocessTrackCascadeData || doprocessTrackV0Cascade || doprocessTrackD0mesonData || doprocessTrackD0DataML || doprocessTrackCentRun2Data || doprocessTrackV0CentRun2Data || doprocessTrackCentRun3Data || doprocessV0CentRun3Data || doprocessCascadeCentRun3Data || doprocessTrackDataCentPP) == false && (doprocessFullMC || doprocessTrackMC || doprocessTrackMCTruth || doprocessTrackMCGen || doprocessTruthAndFullMCV0 || doprocessTrackD0MC || doprocessTruthAndFullMCCasc || doprocessFullMCCent || doprocessTrackCentRun3DataMC || doprocessTruthAndFullMCCentRun3 || doprocessTruthAndFullMCCentRun3V0) == false) { LOGF(fatal, "Neither processFullData nor processFullMC enabled. Please choose one."); } - if ((doprocessFullData || doprocessTrackPhiData || doprocessTrackData || doprocessTrackV0 || doprocessTrackCascadeData || doprocessTrackD0mesonData || doprocessTrackD0DataML || doprocessTrackCentRun2Data || doprocessTrackV0CentRun2Data || doprocessTrackCentRun3Data || doprocessV0CentRun3Data || doprocessCascadeCentRun3Data || doprocessTrackDataCentPP) == true && (doprocessFullMC || doprocessTrackMC || doprocessTrackMCTruth || doprocessTrackMCGen || doprocessTruthAndFullMCV0 || doprocessTrackD0MC || doprocessTruthAndFullMCCasc || doprocessFullMCCent || doprocessTrackCentRun3DataMC || doprocessTruthAndFullMCCentRun3 || doprocessTruthAndFullMCCentRun3V0) == true) { + if ((doprocessFullData || doprocessTrackPhiData || doprocessTrackData || doprocessTrackV0 || doprocessTrackCascadeData || doprocessTrackV0Cascade || doprocessTrackD0mesonData || doprocessTrackD0DataML || doprocessTrackCentRun2Data || doprocessTrackV0CentRun2Data || doprocessTrackCentRun3Data || doprocessV0CentRun3Data || doprocessCascadeCentRun3Data || doprocessTrackDataCentPP) == true && (doprocessFullMC || doprocessTrackMC || doprocessTrackMCTruth || doprocessTrackMCGen || doprocessTruthAndFullMCV0 || doprocessTrackD0MC || doprocessTruthAndFullMCCasc || doprocessFullMCCent || doprocessTrackCentRun3DataMC || doprocessTruthAndFullMCCentRun3 || doprocessTruthAndFullMCCentRun3V0) == true) { LOGF(fatal, "Cannot enable process Data and process MC at the same time. " "Please choose one."); From 136ada2482f3ec5154fecb06d72dcf73e1c936d8 Mon Sep 17 00:00:00 2001 From: Chuntai <48704924+wuctlby@users.noreply.github.com> Date: Wed, 30 Jul 2025 14:11:47 +0200 Subject: [PATCH 137/345] [PWGHF] Use the option of occupancy estimator from HfEventSelection in candidate creators (#12304) --- PWGHF/TableProducer/candidateCreator2Prong.cxx | 8 ++++---- PWGHF/TableProducer/candidateCreator3Prong.cxx | 8 ++++---- PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/PWGHF/TableProducer/candidateCreator2Prong.cxx b/PWGHF/TableProducer/candidateCreator2Prong.cxx index e6cc3f02487..a4c7c4ced21 100644 --- a/PWGHF/TableProducer/candidateCreator2Prong.cxx +++ b/PWGHF/TableProducer/candidateCreator2Prong.cxx @@ -750,7 +750,7 @@ struct HfCandidateCreator2Prong { /// bitmask with event. selection info float centrality{-1.f}; - float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); + float occupancy = getOccupancyColl(collision, hfEvSel.occEstimator); const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections @@ -768,7 +768,7 @@ struct HfCandidateCreator2Prong { /// bitmask with event. selection info float centrality{-1.f}; - float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); + float occupancy = getOccupancyColl(collision, hfEvSel.occEstimator); const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections @@ -786,7 +786,7 @@ struct HfCandidateCreator2Prong { /// bitmask with event. selection info float centrality{-1.f}; - float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); + float occupancy = getOccupancyColl(collision, hfEvSel.occEstimator); const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections @@ -809,7 +809,7 @@ struct HfCandidateCreator2Prong { /// bitmask with event. selection info float centrality{-1.f}; - float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); + float occupancy = getOccupancyColl(collision, hfEvSel.occEstimator); const auto rejectionMask = hfEvSel.getHfCollisionRejectionMaskWithUpc(collision, centrality, ccdb, registry, bcs); /// monitor the satisfied event selections diff --git a/PWGHF/TableProducer/candidateCreator3Prong.cxx b/PWGHF/TableProducer/candidateCreator3Prong.cxx index c60300f41be..f3bfce8ba51 100644 --- a/PWGHF/TableProducer/candidateCreator3Prong.cxx +++ b/PWGHF/TableProducer/candidateCreator3Prong.cxx @@ -894,7 +894,7 @@ struct HfCandidateCreator3Prong { /// bitmask with event. selection info float centrality{-1.f}; - float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); + float occupancy = getOccupancyColl(collision, hfEvSel.occEstimator); const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections @@ -912,7 +912,7 @@ struct HfCandidateCreator3Prong { /// bitmask with event. selection info float centrality{-1.f}; - float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); + float occupancy = getOccupancyColl(collision, hfEvSel.occEstimator); const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections @@ -930,7 +930,7 @@ struct HfCandidateCreator3Prong { /// bitmask with event. selection info float centrality{-1.f}; - float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); + float occupancy = getOccupancyColl(collision, hfEvSel.occEstimator); const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections @@ -953,7 +953,7 @@ struct HfCandidateCreator3Prong { /// bitmask with event. selection info float centrality{-1.f}; - float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); + float occupancy = getOccupancyColl(collision, hfEvSel.occEstimator); const auto rejectionMask = hfEvSel.getHfCollisionRejectionMaskWithUpc(collision, centrality, ccdb, registry, bcs); /// monitor the satisfied event selections diff --git a/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx b/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx index 3d5688a6db1..5fea174e4f9 100644 --- a/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx +++ b/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx @@ -798,7 +798,7 @@ struct HfCandidateCreatorXicToXiPiPi { /// bitmask with event. selection info float centrality{-1.f}; - float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); + float occupancy = getOccupancyColl(collision, hfEvSel.occEstimator); const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections @@ -815,7 +815,7 @@ struct HfCandidateCreatorXicToXiPiPi { /// bitmask with event. selection info float centrality{-1.f}; - float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); + float occupancy = getOccupancyColl(collision, hfEvSel.occEstimator); const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections @@ -832,7 +832,7 @@ struct HfCandidateCreatorXicToXiPiPi { /// bitmask with event. selection info float centrality{-1.f}; - float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); + float occupancy = getOccupancyColl(collision, hfEvSel.occEstimator); const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); /// monitor the satisfied event selections From df8f3f1f3d630f5d39ce4cca772b88f8366e57d8 Mon Sep 17 00:00:00 2001 From: Artem Kotliarov <71133985+KotliarovAr@users.noreply.github.com> Date: Wed, 30 Jul 2025 15:23:45 +0200 Subject: [PATCH 138/345] [PWGJE] Add multiplicity selection (#12313) Co-authored-by: ALICE Action Bot --- PWGJE/Tasks/recoilJets.cxx | 679 ++++++++++++++++++++++++++----------- 1 file changed, 472 insertions(+), 207 deletions(-) diff --git a/PWGJE/Tasks/recoilJets.cxx b/PWGJE/Tasks/recoilJets.cxx index 1a7b3c785ff..8b6d2b952ea 100644 --- a/PWGJE/Tasks/recoilJets.cxx +++ b/PWGJE/Tasks/recoilJets.cxx @@ -1,4 +1,4 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// Copyright 2020-2022 CERN and copyright holders of ALICE O2. // See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. // All rights not expressly granted are reserved. // @@ -19,6 +19,7 @@ #include "PWGJE/DataModel/JetSubtraction.h" #include "Common/Core/RecoDecay.h" +#include "Common/DataModel/Multiplicity.h" #include "CommonConstants/MathConstants.h" #include "Framework/ASoA.h" @@ -29,6 +30,7 @@ #include #include #include +#include #include #include "TRandom3.h" @@ -47,63 +49,96 @@ using namespace o2::framework; using namespace o2::framework::expressions; // Shorthand notations -using FilteredColl = soa::Filtered>::iterator; -using FilteredCollPartLevel = soa::Filtered>::iterator; -using FilteredCollDetLevelGetWeight = soa::Filtered>::iterator; - -using FilteredJets = soa::Filtered>; -using FilteredJetsDetLevel = soa::Filtered>; -using FilteredJetsPartLevel = soa::Filtered>; - -using FilteredMatchedJetsDetLevel = soa::Filtered>; -using FilteredMatchedJetsPartLevel = soa::Filtered>; +using FilteredColl = + soa::Filtered>::iterator; +using FilteredCollPartLevel = + soa::Filtered>::iterator; +using FilteredCollDetLevelGetWeight = + soa::Filtered>::iterator; +using FilteredEventMultiplicity = + soa::Filtered>::iterator; + +using FilteredJets = + soa::Filtered>; +using FilteredJetsDetLevel = + soa::Filtered>; +using FilteredJetsPartLevel = + soa::Filtered>; + +using FilteredMatchedJetsDetLevel = soa::Filtered>; +using FilteredMatchedJetsPartLevel = soa::Filtered>; using FilteredTracks = soa::Filtered; +using FilteredParticles = soa::Filtered; struct RecoilJets { // List of configurable parameters Configurable evSel{"evSel", "sel8", "Choose event selection"}; - Configurable trkSel{"trkSel", "globalTracks", "Set track selection"}; + Configurable trkSel{"trkSel", "globalTracks", + "Set track selection"}; Configurable vertexZCut{"vertexZCut", 10., "Accepted z-vertex range"}; - Configurable fracSig{"fracSig", 0.9, "Fraction of events to use for signal TT"}; - Configurable bGetMissJets{"bGetMissJets", false, "Flag to get miss histo for particle level jets"}; + Configurable fracSig{"fracSig", 0.9, + "Fraction of events to use for signal TT"}; - Configurable trkPtMin{"trkPtMin", 0.15, "Minimum pT of acceptanced tracks"}; - Configurable trkPtMax{"trkPtMax", 100., "Maximum pT of acceptanced tracks"}; + Configurable trkPtMin{"trkPtMin", 0.15, + "Minimum pT of acceptanced tracks"}; + Configurable trkPtMax{"trkPtMax", 100., + "Maximum pT of acceptanced tracks"}; Configurable trkEtaCut{"trkEtaCut", 0.9, "Eta acceptance of TPC"}; Configurable jetR{"jetR", 0.4, "Jet cone radius"}; - Configurable triggerMasks{"triggerMasks", "", "Relevant trigger masks: fTrackLowPt,fTrackHighPt"}; - Configurable skipMBGapEvents{"skipMBGapEvents", false, "flag to choose to reject min. bias gap events; jet-level rejection applied at the jet finder level, here rejection is applied for collision and track process functions"}; + Configurable triggerMasks{"triggerMasks", "", + "Relevant trigger masks: fTrackLowPt,fTrackHighPt"}; + Configurable skipMBGapEvents{"skipMBGapEvents", false, + "flag to choose to reject min. bias gap events; jet-level rejection " + "applied at the jet finder level, here rejection is applied for " + "collision and track process functions"}; // List of configurable parameters for MC - Configurable pTHatExponent{"pTHatExponent", 4.0, "Exponent of the event weight for the calculation of pTHat"}; - Configurable pTHatMax{"pTHatMax", 999.0, "Maximum fraction of hard scattering for jet acceptance in MC"}; + Configurable pTHatExponent{"pTHatExponent", 4.0, + "Exponent of the event weight for the calculation of pTHat"}; + Configurable pTHatMax{"pTHatMax", 999.0, + "Maximum fraction of hard scattering for jet acceptance in MC"}; // Parameters for recoil jet selection - Configurable ptTTrefMin{"ptTTrefMin", 5., "Minimum pT of reference TT"}; - Configurable ptTTrefMax{"ptTTrefMax", 7., "Maximum pT of reference TT"}; + Configurable ptTTrefMin{"ptTTrefMin", 5., + "Minimum pT of reference TT"}; + Configurable ptTTrefMax{"ptTTrefMax", 7., + "Maximum pT of reference TT"}; Configurable ptTTsigMin{"ptTTsigMin", 20., "Minimum pT of signal TT"}; Configurable ptTTsigMax{"ptTTsigMax", 50., "Maximum pT of signal TT"}; - Configurable recoilRegion{"recoilRegion", 0.6, "Width of recoil acceptance"}; + Configurable recoilRegion{"recoilRegion", 0.6, + "Width of recoil acceptance"}; // List of configurable parameters for histograms - Configurable histJetPt{"histJetPt", 100, "Maximum value of jet pT shown in histograms"}; + Configurable histJetPt{"histJetPt", 100, + "Maximum value of jet pT shown in histograms"}; // Axes specification AxisSpec pT{histJetPt, 0.0, histJetPt * 1.0, "#it{p}_{T} (GeV/#it{c})"}; - AxisSpec jetPTcorr{histJetPt + 20, -20., histJetPt * 1.0, "#it{p}_{T, jet}^{ch, corr} (GeV/#it{c})"}; + AxisSpec jetPTcorr{histJetPt + 20, -20., histJetPt * 1.0, + "#it{p}_{T, jet}^{ch, corr} (GeV/#it{c})"}; AxisSpec phiAngle{40, 0.0, constants::math::TwoPI, "#it{#varphi} (rad)"}; - AxisSpec deltaPhiAngle{52, 0.0, constants::math::PI, "#Delta#it{#varphi} (rad)"}; + AxisSpec deltaPhiAngle{52, 0.0, constants::math::PI, + "#Delta#it{#varphi} (rad)"}; AxisSpec pseudorap{40, -1., 1., "#it{#eta}"}; AxisSpec pseudorapJets{20, -0.5, 0.5, "#it{#eta}_{jet}"}; AxisSpec jetArea{50, 0.0, 5., "Area_{jet}"}; AxisSpec rhoArea{60, 0.0, 60., "#it{#rho} #times Area_{jet}"}; AxisSpec rho{50, 0.0, 50., "#it{#rho}"}; - Preslice partJetsPerCollision = aod::jet::mcCollisionId; + Preslice partJetsPerCollision = + aod::jet::mcCollisionId; TRandom3* rand = new TRandom3(0); @@ -111,8 +146,10 @@ struct RecoilJets { Filter collisionFilter = nabs(aod::jcollision::posZ) < vertexZCut; Filter collisionFilterMC = nabs(aod::jmccollision::posZ) < vertexZCut; - // Declare filters on accepted tracks and MC particles (settings for jet reco are provided in the jet finder wagon) - Filter trackFilter = aod::jtrack::pt > trkPtMin&& aod::jtrack::pt < trkPtMax&& nabs(aod::jtrack::eta) < trkEtaCut; + // Declare filters on accepted tracks and MC particles (settings for jet reco + // are provided in the jet finder wagon) + Filter trackFilter = aod::jtrack::pt > trkPtMin&& aod::jtrack::pt < + trkPtMax&& nabs(aod::jtrack::eta) < trkEtaCut; Filter partFilter = nabs(aod::jmcparticle::eta) < trkEtaCut; // Declare filter on jets @@ -131,114 +168,264 @@ struct RecoilJets { std::string evSelToString = static_cast(evSel); std::string trkSelToString = static_cast(trkSel); - eventSelectionBits = jetderiveddatautilities::initialiseEventSelectionBits(evSelToString); - trackSelection = jetderiveddatautilities::initialiseTrackSelection(trkSelToString); - triggerMaskBits = jetderiveddatautilities::initialiseTriggerMaskBits(triggerMasks); + eventSelectionBits = + jetderiveddatautilities::initialiseEventSelectionBits(evSelToString); + trackSelection = + jetderiveddatautilities::initialiseTrackSelection(trkSelToString); + triggerMaskBits = + jetderiveddatautilities::initialiseTriggerMaskBits(triggerMasks); // List of raw and MC det. distributions if (doprocessData || doprocessMCDetLevel || doprocessMCDetLevelWeighted) { - spectra.add("hEventSelectionCount", "Count # of events in the analysis", kTH1F, {{3, 0.0, 3.}}); - spectra.get(HIST("hEventSelectionCount"))->GetXaxis()->SetBinLabel(1, "Total # of events"); - spectra.get(HIST("hEventSelectionCount"))->GetXaxis()->SetBinLabel(2, Form("# of events after sel. %s", evSelToString.data())); - spectra.get(HIST("hEventSelectionCount"))->GetXaxis()->SetBinLabel(3, "# of events w. outlier"); - - spectra.add("vertexZ", "Z vertex of collisions", kTH1F, {{60, -12., 12.}}); - spectra.add("hHasAssocMcCollision", "Has det. level coll. associat. MC coll.", kTH1F, {{2, 0.0, 2.}}); - spectra.get(HIST("hHasAssocMcCollision"))->GetXaxis()->SetBinLabel(1, "Yes"); - spectra.get(HIST("hHasAssocMcCollision"))->GetXaxis()->SetBinLabel(2, "No"); - - spectra.add("hTrackSelectionCount", "Count # of tracks in the analysis", kTH1F, {{2, 0.0, 2.}}); - spectra.get(HIST("hTrackSelectionCount"))->GetXaxis()->SetBinLabel(1, "Total # of tracks"); - spectra.get(HIST("hTrackSelectionCount"))->GetXaxis()->SetBinLabel(2, Form("# of tracks after sel. %s", trkSelToString.data())); - - spectra.add("hTrackPtEtaPhi", "Charact. of tracks", kTH3F, {pT, pseudorap, phiAngle}); - - spectra.add("hTTSig_pT", "pT spectrum of all found TT_{Sig} cand.", kTH1F, {{40, 10., 50.}}); // needed to distinguish merged data from diff. wagons - - spectra.add("hNtrig", "Total number of selected triggers per class", kTH1F, {{2, 0.0, 2.}}); + spectra.add("hEventSelectionCount", "Count # of events in the analysis", + kTH1F, {{3, 0.0, 3.}}); + spectra.get(HIST("hEventSelectionCount")) + ->GetXaxis() + ->SetBinLabel(1, "Total # of events"); + spectra.get(HIST("hEventSelectionCount")) + ->GetXaxis() + ->SetBinLabel( + 2, Form("# of events after sel. %s", evSelToString.data())); + spectra.get(HIST("hEventSelectionCount")) + ->GetXaxis() + ->SetBinLabel(3, "# of events w. outlier"); + + spectra.add("vertexZ", "Z vertex of collisions", kTH1F, + {{60, -12., 12.}}); + spectra.add("hHasAssocMcCollision", + "Has det. level coll. associat. MC coll.", kTH1F, + {{2, 0.0, 2.}}); + spectra.get(HIST("hHasAssocMcCollision")) + ->GetXaxis() + ->SetBinLabel(1, "Yes"); + spectra.get(HIST("hHasAssocMcCollision")) + ->GetXaxis() + ->SetBinLabel(2, "No"); + + spectra.add("hTrackSelectionCount", "Count # of tracks in the analysis", + kTH1F, {{2, 0.0, 2.}}); + spectra.get(HIST("hTrackSelectionCount")) + ->GetXaxis() + ->SetBinLabel(1, "Total # of tracks"); + spectra.get(HIST("hTrackSelectionCount")) + ->GetXaxis() + ->SetBinLabel( + 2, Form("# of tracks after sel. %s", trkSelToString.data())); + + spectra.add("hTrackPtEtaPhi", "Charact. of tracks", kTH3F, + {pT, pseudorap, phiAngle}); + + spectra.add( + "hTTSig_pT", "pT spectrum of all found TT_{Sig} cand.", kTH1F, + {{40, 10., + 50.}}); // needed to distinguish merged data from diff. wagons + + spectra.add("hNtrig", "Total number of selected triggers per class", + kTH1F, {{2, 0.0, 2.}}); spectra.get(HIST("hNtrig"))->GetXaxis()->SetBinLabel(1, "TT_{ref}"); spectra.get(HIST("hNtrig"))->GetXaxis()->SetBinLabel(2, "TT_{sig}"); - spectra.add("hTTRef_per_event", "Number of TT_{Ref} per event", kTH1F, {{15, 0.5, 15.5}}); - spectra.add("hTTSig_per_event", "Number of TT_{Sig} per event", kTH1F, {{10, 0.5, 10.5}}); - - spectra.add("hJetPtEtaPhiRhoArea", "Charact. of inclusive jets", kTHnSparseF, {pT, pseudorapJets, phiAngle, rho, jetArea}); - - spectra.add("hDPhi_JetPt_Corr_TTRef", "Events w. TT_{Ref}: #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH2F, {deltaPhiAngle, jetPTcorr}); - spectra.add("hDPhi_JetPt_Corr_TTSig", "Events w. TT_{Sig}: #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH2F, {deltaPhiAngle, jetPTcorr}); - spectra.add("hDPhi_JetPt_TTRef", "Events w. TT_{Ref}: #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH2F, {deltaPhiAngle, pT}); - spectra.add("hDPhi_JetPt_TTSig", "Events w. TT_{Sig}: #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH2F, {deltaPhiAngle, pT}); - - spectra.add("hRecoil_JetPt_Corr_TTRef", "Events w. TT_{Ref}: #it{p}_{T} of recoil jets", kTH1F, {jetPTcorr}); - spectra.add("hRecoil_JetPt_Corr_TTSig", "Events w. TT_{Sig}: #it{p}_{T} of recoil jets", kTH1F, {jetPTcorr}); - spectra.add("hRecoil_JetPt_TTRef", "Events w. TT_{Ref}: #it{p}_{T} of recoil jets", kTH1F, {pT}); - spectra.add("hRecoil_JetPt_TTSig", "Events w. TT_{Sig}: #it{p}_{T} of recoil jets", kTH1F, {pT}); - - spectra.add("hJetArea_JetPt_Rho_TTRef", "Events w. TT_{Ref}: A_{jet} & jet pT & #rho", kTH3F, {jetArea, pT, rho}); - spectra.add("hJetArea_JetPt_Rho_TTSig", "Events w. TT_{Sig}: A_{jet} & jet pT & #rho", kTH3F, {jetArea, pT, rho}); + spectra.add("hTTRef_per_event", "Number of TT_{Ref} per event", kTH1F, + {{15, 0.5, 15.5}}); + spectra.add("hTTSig_per_event", "Number of TT_{Sig} per event", kTH1F, + {{10, 0.5, 10.5}}); + + spectra.add("hJetPtEtaPhiRhoArea", "Charact. of inclusive jets", + kTHnSparseF, {pT, pseudorapJets, phiAngle, rho, jetArea}); + + spectra.add("hDPhi_JetPt_Corr_TTRef", + "Events w. TT_{Ref}: #Delta#varphi & #it{p}_{T, jet}^{ch}", + kTH2F, {deltaPhiAngle, jetPTcorr}); + spectra.add("hDPhi_JetPt_Corr_TTSig", + "Events w. TT_{Sig}: #Delta#varphi & #it{p}_{T, jet}^{ch}", + kTH2F, {deltaPhiAngle, jetPTcorr}); + spectra.add("hDPhi_JetPt_TTRef", + "Events w. TT_{Ref}: #Delta#varphi & #it{p}_{T, jet}^{ch}", + kTH2F, {deltaPhiAngle, pT}); + spectra.add("hDPhi_JetPt_TTSig", + "Events w. TT_{Sig}: #Delta#varphi & #it{p}_{T, jet}^{ch}", + kTH2F, {deltaPhiAngle, pT}); + + spectra.add("hRecoil_JetPt_Corr_TTRef", + "Events w. TT_{Ref}: #it{p}_{T} of recoil jets", kTH1F, + {jetPTcorr}); + spectra.add("hRecoil_JetPt_Corr_TTSig", + "Events w. TT_{Sig}: #it{p}_{T} of recoil jets", kTH1F, + {jetPTcorr}); + spectra.add("hRecoil_JetPt_TTRef", + "Events w. TT_{Ref}: #it{p}_{T} of recoil jets", kTH1F, {pT}); + spectra.add("hRecoil_JetPt_TTSig", + "Events w. TT_{Sig}: #it{p}_{T} of recoil jets", kTH1F, {pT}); + + spectra.add("hJetArea_JetPt_Rho_TTRef", + "Events w. TT_{Ref}: A_{jet} & jet pT & #rho", kTH3F, + {jetArea, pT, rho}); + spectra.add("hJetArea_JetPt_Rho_TTSig", + "Events w. TT_{Sig}: A_{jet} & jet pT & #rho", kTH3F, + {jetArea, pT, rho}); } // List of MC particle level distributions if (doprocessMCPartLevel || doprocessMCPartLevelWeighted) { - spectra.add("vertexZMC", "Z vertex of jmccollision", kTH1F, {{60, -12., 12.}}); + spectra.add("vertexZMC", "Z vertex of jmccollision", kTH1F, + {{60, -12., 12.}}); spectra.add("ptHat", "Distribution of pT hat", kTH1F, {{500, 0.0, 100.}}); - spectra.add("hPartPtEtaPhi", "Charact. of particles", kTH3F, {pT, pseudorap, phiAngle}); - spectra.add("hNtrig_Part", "Total number of selected triggers per class", kTH1F, {{2, 0.0, 2.}}); - spectra.get(HIST("hNtrig_Part"))->GetXaxis()->SetBinLabel(1, "TT_{ref}"); - spectra.get(HIST("hNtrig_Part"))->GetXaxis()->SetBinLabel(2, "TT_{sig}"); - - spectra.add("hTTRef_per_event_Part", "Number of TT_{Ref} per event", kTH1F, {{15, 0.5, 15.5}}); - spectra.add("hTTSig_per_event_Part", "Number of TT_{Sig} per event", kTH1F, {{10, 0.5, 10.5}}); - - spectra.add("hJetPtEtaPhiRhoArea_Part", "Charact. of inclusive part. level jets", kTHnSparseF, {pT, pseudorapJets, phiAngle, rho, jetArea}); - - spectra.add("hDPhi_JetPt_Corr_TTRef_Part", "Events w. TT_{Ref}: #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH2F, {deltaPhiAngle, jetPTcorr}); - spectra.add("hDPhi_JetPt_Corr_TTSig_Part", "Events w. TT_{Sig}: #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH2F, {deltaPhiAngle, jetPTcorr}); - spectra.add("hDPhi_JetPt_TTRef_Part", "Events w. TT_{Ref}: #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH2F, {deltaPhiAngle, pT}); - spectra.add("hDPhi_JetPt_TTSig_Part", "Events w. TT_{Sig}: #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH2F, {deltaPhiAngle, pT}); - - spectra.add("hRecoil_JetPt_Corr_TTRef_Part", "Events w. TT_{Ref}: #it{p}_{T} of recoil jets", kTH1F, {jetPTcorr}); - spectra.add("hRecoil_JetPt_Corr_TTSig_Part", "Events w. TT_{Sig}: #it{p}_{T} of recoil jets", kTH1F, {jetPTcorr}); - spectra.add("hRecoil_JetPt_TTRef_Part", "Events w. TT_{Ref}: #it{p}_{T} of recoil jets", kTH1F, {pT}); - spectra.add("hRecoil_JetPt_TTSig_Part", "Events w. TT_{Sig}: #it{p}_{T} of recoil jets", kTH1F, {pT}); - - spectra.add("hJetArea_JetPt_Rho_TTRef_Part", "Events w. TT_{Ref}: A_{jet} & jet pT & #rho", kTH3F, {jetArea, pT, rho}); - spectra.add("hJetArea_JetPt_Rho_TTSig_Part", "Events w. TT_{Sig}: A_{jet} & jet pT & #rho", kTH3F, {jetArea, pT, rho}); + spectra.add("hEventSelectionCountPartLevel", + "Count # of events in the part. level analysis", kTH1F, + {{2, 0.0, 2.}}); + spectra.get(HIST("hEventSelectionCountPartLevel")) + ->GetXaxis() + ->SetBinLabel(1, "Total # of events"); + spectra.get(HIST("hEventSelectionCountPartLevel")) + ->GetXaxis() + ->SetBinLabel(2, "# of events w. outlier"); + + spectra.add("hCountNumberOutliersFrameWork", + "Count # of outlier events based on flag from JE fw", kTH1F, + {{1, 0.0, 1.}}); + spectra.get(HIST("hCountNumberOutliersFrameWork")) + ->GetXaxis() + ->SetBinLabel(1, "Oulier flag true"); + + spectra.add("hPartPtEtaPhi", "Charact. of particles", kTH3F, + {pT, pseudorap, phiAngle}); + spectra.add("hNtrig_Part", "Total number of selected triggers per class", + kTH1F, {{2, 0.0, 2.}}); + spectra.get(HIST("hNtrig_Part")) + ->GetXaxis() + ->SetBinLabel(1, "TT_{ref}"); + spectra.get(HIST("hNtrig_Part")) + ->GetXaxis() + ->SetBinLabel(2, "TT_{sig}"); + + spectra.add("hTTRef_per_event_Part", "Number of TT_{Ref} per event", + kTH1F, {{15, 0.5, 15.5}}); + spectra.add("hTTSig_per_event_Part", "Number of TT_{Sig} per event", + kTH1F, {{10, 0.5, 10.5}}); + + spectra.add("hJetPtEtaPhiRhoArea_Part", + "Charact. of inclusive part. level jets", kTHnSparseF, + {pT, pseudorapJets, phiAngle, rho, jetArea}); + + spectra.add("hDPhi_JetPt_Corr_TTRef_Part", + "Events w. TT_{Ref}: #Delta#varphi & #it{p}_{T, jet}^{ch}", + kTH2F, {deltaPhiAngle, jetPTcorr}); + spectra.add("hDPhi_JetPt_Corr_TTSig_Part", + "Events w. TT_{Sig}: #Delta#varphi & #it{p}_{T, jet}^{ch}", + kTH2F, {deltaPhiAngle, jetPTcorr}); + spectra.add("hDPhi_JetPt_TTRef_Part", + "Events w. TT_{Ref}: #Delta#varphi & #it{p}_{T, jet}^{ch}", + kTH2F, {deltaPhiAngle, pT}); + spectra.add("hDPhi_JetPt_TTSig_Part", + "Events w. TT_{Sig}: #Delta#varphi & #it{p}_{T, jet}^{ch}", + kTH2F, {deltaPhiAngle, pT}); + + spectra.add("hRecoil_JetPt_Corr_TTRef_Part", + "Events w. TT_{Ref}: #it{p}_{T} of recoil jets", kTH1F, + {jetPTcorr}); + spectra.add("hRecoil_JetPt_Corr_TTSig_Part", + "Events w. TT_{Sig}: #it{p}_{T} of recoil jets", kTH1F, + {jetPTcorr}); + spectra.add("hRecoil_JetPt_TTRef_Part", + "Events w. TT_{Ref}: #it{p}_{T} of recoil jets", kTH1F, {pT}); + spectra.add("hRecoil_JetPt_TTSig_Part", + "Events w. TT_{Sig}: #it{p}_{T} of recoil jets", kTH1F, {pT}); + + spectra.add("hJetArea_JetPt_Rho_TTRef_Part", + "Events w. TT_{Ref}: A_{jet} & jet pT & #rho", kTH3F, + {jetArea, pT, rho}); + spectra.add("hJetArea_JetPt_Rho_TTSig_Part", + "Events w. TT_{Sig}: A_{jet} & jet pT & #rho", kTH3F, + {jetArea, pT, rho}); + + spectra.add("hDiffInOutlierRemove", + "Difference between pT hat from code and fw", kTH1F, + {{502, -0.2, 50.}}); } // Jet matching: part. vs. det. if (doprocessJetsMatched || doprocessJetsMatchedWeighted) { - spectra.add("hJetPt_DetLevel_vs_PartLevel", "Correlation jet pT at det. vs. part. levels", kTH2F, {{200, 0.0, 200.}, {200, 0.0, 200.}}); - // spectra.add("hJetPt_Corr_PartLevel_vs_DetLevel", "Correlation jet pT at part. vs. det. levels", kTH2F, {jetPTcorr, jetPTcorr}); - spectra.add("hJetPt_DetLevel_vs_PartLevel_RecoilJets", "Correlation recoil jet pT at part. vs. det. levels", kTH2F, {{200, 0.0, 200.}, {200, 0.0, 200.}}); - // spectra.add("hJetPt_Corr_PartLevel_vs_DetLevel_RecoilJets", "Correlation recoil jet pT at part. vs. det. levels", kTH2F, {jetPTcorr, jetPTcorr}); - - if (bGetMissJets) { - spectra.add("hMissedJets_pT", "Part. level jets w/o matched pair", kTH1F, {{200, 0.0, 200.}}); - // spectra.add("hMissedJets_Corr_pT", "Part. level jets w/o matched pair", kTH1F, {jetPTcorr}); - spectra.add("hMissedJets_pT_RecoilJets", "Part. level jets w/o matched pair", kTH1F, {{200, 0.0, 200.}}); - // spectra.add("hMissedJets_Corr_pT_RecoilJets", "Part. level jets w/o matched pair", kTH1F, {jetPTcorr}); - } else { - spectra.add("hFakeJets_pT", "Det. level jets w/o matched pair", kTH1F, {{200, 0.0, 200.}}); - // spectra.add("hFakeJets_Corr_pT", "Det. level jets w/o matched pair", kTH1F, {jetPTcorr}); - spectra.add("hFakeJets_pT_RecoilJets", "Det. level jets w/o matched pair", kTH1F, {{200, 0.0, 200.}}); - // spectra.add("hFakeJets_Corr_pT_RecoilJets", "Det. level jets w/o matched pair", kTH1F, {jetPTcorr}); - } - - spectra.add("hJetPt_resolution", "Jet p_{T} relative resolution as a func. of jet #it{p}_{T, part}", kTH2F, {{100, -5., 5.}, pT}); - spectra.add("hJetPt_resolution_RecoilJets", "Jet p_{T} relative resolution as a func. of jet #it{p}_{T, part}", kTH2F, {{100, -5., 5.}, pT}); - - spectra.add("hJetPhi_resolution", "#varphi resolution as a func. of jet #it{p}_{T, part}", kTH2F, {{40, -1., 1.}, pT}); - spectra.add("hJetPhi_resolution_RecoilJets", "#varphi resolution as a func. of jet #it{p}_{T, part}", kTH2F, {{40, -1., 1.}, pT}); + spectra.add("hJetPt_DetLevel_vs_PartLevel", + "Correlation jet pT at det. vs. part. levels", kTH2F, + {{200, 0.0, 200.}, {200, 0.0, 200.}}); + // spectra.add("hJetPt_Corr_PartLevel_vs_DetLevel", "Correlation jet pT at + // part. vs. det. levels", kTH2F, {jetPTcorr, jetPTcorr}); + spectra.add("hJetPt_DetLevel_vs_PartLevel_RecoilJets", + "Correlation recoil jet pT at part. vs. det. levels", kTH2F, + {{200, 0.0, 200.}, {200, 0.0, 200.}}); + // spectra.add("hJetPt_Corr_PartLevel_vs_DetLevel_RecoilJets", + // "Correlation recoil jet pT at part. vs. det. levels", kTH2F, + // {jetPTcorr, jetPTcorr}); + + spectra.add("hMissedJets_pT", "Part. level jets w/o matched pair", kTH1F, + {{200, 0.0, 200.}}); + // spectra.add("hMissedJets_Corr_pT", "Part. level jets w/o matched pair", + // kTH1F, {jetPTcorr}); + spectra.add("hMissedJets_pT_RecoilJets", + "Part. level jets w/o matched pair", kTH1F, + {{200, 0.0, 200.}}); + // spectra.add("hMissedJets_Corr_pT_RecoilJets", "Part. level jets w/o + // matched pair", kTH1F, {jetPTcorr}); + spectra.add("hFakeJets_pT", "Det. level jets w/o matched pair", kTH1F, + {{200, 0.0, 200.}}); + // spectra.add("hFakeJets_Corr_pT", "Det. level jets w/o matched pair", + // kTH1F, {jetPTcorr}); + spectra.add("hFakeJets_pT_RecoilJets", "Det. level jets w/o matched pair", + kTH1F, {{200, 0.0, 200.}}); + // spectra.add("hFakeJets_Corr_pT_RecoilJets", "Det. level jets w/o + // matched pair", kTH1F, {jetPTcorr}); + + spectra.add( + "hJetPt_resolution", + "Jet p_{T} relative resolution as a func. of jet #it{p}_{T, part}", + kTH2F, {{100, -5., 5.}, pT}); + spectra.add( + "hJetPt_resolution_RecoilJets", + "Jet p_{T} relative resolution as a func. of jet #it{p}_{T, part}", + kTH2F, {{100, -5., 5.}, pT}); + + spectra.add("hJetPhi_resolution", + "#varphi resolution as a func. of jet #it{p}_{T, part}", + kTH2F, {{40, -1., 1.}, pT}); + spectra.add("hJetPhi_resolution_RecoilJets", + "#varphi resolution as a func. of jet #it{p}_{T, part}", + kTH2F, {{40, -1., 1.}, pT}); + + spectra.add("hNumberMatchedJetsPerOneBaseJet", + "# of taged jets per 1 base jet vs. jet pT", kTH2F, + {{10, 0.5, 10.5}, {100, 0.0, 100.}}); + } - spectra.add("hNumberMatchedJetsPerOneBaseJet", "# of taged jets per 1 base jet vs. jet pT", kTH2F, {{10, 0.5, 10.5}, {100, 0.0, 100.}}); + if (doprocessMultiplicity) { + spectra.add("hMultFT0A", "Mult. signal from FTOA", kTH1F, + {{1500, 0.0, 30000.}}); + spectra.add("hMultFT0C", "Mult. signal from FTOC", kTH1F, + {{1500, 0.0, 30000.}}); + spectra.add("hMultFT0M", "Total mult. signal from FT0A & FTOC", kTH1F, + {{3000, 0.0, 60000.}}); + + spectra.add("hMultZNA", "Mult. signal from ZDC A-side", kTH1F, + {{500, 0.0, 10000.}}); + spectra.add("hMultZNC", "Mult. signal from ZDC C-side", kTH1F, + {{500, 0.0, 10000.}}); + spectra.add("hMultZNM", "Total mult. signal from ZDCs", kTH1F, + {{1000, 0.0, 20000.}}); + + // Correlations + spectra.add("hMultFT0A_vs_ZNA", "Correlation of signals FTOA vs ZNA", + kTH2F, {{1500, 0.0, 30000.}, {500, 0.0, 10000.}}); + spectra.add("hMultFT0C_vs_ZNC", "Correlation of signals FTOC vs ZNC", + kTH2F, {{1500, 0.0, 30000.}, {500, 0.0, 10000.}}); + spectra.add("hMultFT0M_vs_ZNM", "Correlation of signals FTOM vs ZNM", + kTH2F, {{3000, 0.0, 60000.}, {1000, 0.0, 20000.}}); } } // Fill histograms with raw or MC det. level data template - void fillHistograms(Collision const& collision, Jets const& jets, Tracks const& tracks, float weight = 1.) + void fillHistograms(Collision const& collision, Jets const& jets, + Tracks const& tracks, float weight = 1.) { bool bSigEv = false; std::vector vPhiOfTT; @@ -265,7 +452,8 @@ struct RecoilJets { continue; spectra.fill(HIST("hTrackSelectionCount"), 1.5); - spectra.fill(HIST("hTrackPtEtaPhi"), track.pt(), track.eta(), track.phi(), weight); + spectra.fill(HIST("hTrackPtEtaPhi"), track.pt(), track.eta(), track.phi(), + weight); // Search for TT candidate if (bSigEv && (track.pt() > ptTTsigMin && track.pt() < ptTTsigMax)) { @@ -294,29 +482,36 @@ struct RecoilJets { } for (const auto& jet : jets) { - spectra.fill(HIST("hJetPtEtaPhiRhoArea"), jet.pt(), jet.eta(), jet.phi(), collision.rho(), jet.area(), weight); + spectra.fill(HIST("hJetPtEtaPhiRhoArea"), jet.pt(), jet.eta(), jet.phi(), + collision.rho(), jet.area(), weight); if (nTT > 0) { auto [dphi, bRecoilJet] = isRecoilJet(jet, phiTT); if (bSigEv) { - spectra.fill(HIST("hDPhi_JetPt_Corr_TTSig"), dphi, jet.pt() - collision.rho() * jet.area(), weight); + spectra.fill(HIST("hDPhi_JetPt_Corr_TTSig"), dphi, + jet.pt() - collision.rho() * jet.area(), weight); spectra.fill(HIST("hDPhi_JetPt_TTSig"), dphi, jet.pt(), weight); - spectra.fill(HIST("hJetArea_JetPt_Rho_TTSig"), jet.area(), jet.pt(), collision.rho(), weight); + spectra.fill(HIST("hJetArea_JetPt_Rho_TTSig"), jet.area(), jet.pt(), + collision.rho(), weight); if (bRecoilJet) { - spectra.fill(HIST("hRecoil_JetPt_Corr_TTSig"), jet.pt() - collision.rho() * jet.area(), weight); + spectra.fill(HIST("hRecoil_JetPt_Corr_TTSig"), + jet.pt() - collision.rho() * jet.area(), weight); spectra.fill(HIST("hRecoil_JetPt_TTSig"), jet.pt(), weight); } } else { - spectra.fill(HIST("hDPhi_JetPt_Corr_TTRef"), dphi, jet.pt() - collision.rho() * jet.area(), weight); + spectra.fill(HIST("hDPhi_JetPt_Corr_TTRef"), dphi, + jet.pt() - collision.rho() * jet.area(), weight); spectra.fill(HIST("hDPhi_JetPt_TTRef"), dphi, jet.pt(), weight); - spectra.fill(HIST("hJetArea_JetPt_Rho_TTRef"), jet.area(), jet.pt(), collision.rho(), weight); + spectra.fill(HIST("hJetArea_JetPt_Rho_TTRef"), jet.area(), jet.pt(), + collision.rho(), weight); if (bRecoilJet) { - spectra.fill(HIST("hRecoil_JetPt_Corr_TTRef"), jet.pt() - collision.rho() * jet.area(), weight); + spectra.fill(HIST("hRecoil_JetPt_Corr_TTRef"), + jet.pt() - collision.rho() * jet.area(), weight); spectra.fill(HIST("hRecoil_JetPt_TTRef"), jet.pt(), weight); } } @@ -325,7 +520,8 @@ struct RecoilJets { } template - void fillMCPHistograms(Collision const& collision, Jets const& jets, Particles const& particles, float weight = 1.) + void fillMCPHistograms(Collision const& collision, Jets const& jets, + Particles const& particles, float weight = 1.) { bool bSigEv = false; std::vector vPhiOfTT; @@ -339,8 +535,10 @@ struct RecoilJets { bSigEv = true; for (const auto& jet : jets) { - if (jet.pt() > pTHatMax * pTHat) + if (jet.pt() > pTHatMax * pTHat) { + spectra.fill(HIST("hEventSelectionCountPartLevel"), 1.5); return; + } } for (const auto& particle : particles) { @@ -353,14 +551,17 @@ struct RecoilJets { if (bParticleNeutral || !particle.isPhysicalPrimary()) continue; - spectra.fill(HIST("hPartPtEtaPhi"), particle.pt(), particle.eta(), particle.phi(), weight); + spectra.fill(HIST("hPartPtEtaPhi"), particle.pt(), particle.eta(), + particle.phi(), weight); - if (bSigEv && (particle.pt() > ptTTsigMin && particle.pt() < ptTTsigMax)) { + if (bSigEv && + (particle.pt() > ptTTsigMin && particle.pt() < ptTTsigMax)) { vPhiOfTT.push_back(particle.phi()); ++nTT; } - if (!bSigEv && (particle.pt() > ptTTrefMin && particle.pt() < ptTTrefMax)) { + if (!bSigEv && + (particle.pt() > ptTTrefMin && particle.pt() < ptTTrefMax)) { vPhiOfTT.push_back(particle.phi()); ++nTT; } @@ -380,7 +581,8 @@ struct RecoilJets { } for (const auto& jet : jets) { - spectra.fill(HIST("hJetPtEtaPhiRhoArea_Part"), jet.pt(), jet.eta(), jet.phi(), collision.rho(), jet.area(), weight); + spectra.fill(HIST("hJetPtEtaPhiRhoArea_Part"), jet.pt(), jet.eta(), + jet.phi(), collision.rho(), jet.area(), weight); if (nTT > 0) { @@ -388,23 +590,29 @@ struct RecoilJets { if (bSigEv) { - spectra.fill(HIST("hDPhi_JetPt_Corr_TTSig_Part"), dphi, jet.pt() - collision.rho() * jet.area(), weight); + spectra.fill(HIST("hDPhi_JetPt_Corr_TTSig_Part"), dphi, + jet.pt() - collision.rho() * jet.area(), weight); spectra.fill(HIST("hDPhi_JetPt_TTSig_Part"), dphi, jet.pt(), weight); - spectra.fill(HIST("hJetArea_JetPt_Rho_TTSig_Part"), jet.area(), jet.pt(), collision.rho(), weight); + spectra.fill(HIST("hJetArea_JetPt_Rho_TTSig_Part"), jet.area(), + jet.pt(), collision.rho(), weight); if (bRecoilJet) { - spectra.fill(HIST("hRecoil_JetPt_Corr_TTSig_Part"), jet.pt() - collision.rho() * jet.area(), weight); + spectra.fill(HIST("hRecoil_JetPt_Corr_TTSig_Part"), + jet.pt() - collision.rho() * jet.area(), weight); spectra.fill(HIST("hRecoil_JetPt_TTSig_Part"), jet.pt(), weight); } } else { - spectra.fill(HIST("hDPhi_JetPt_Corr_TTRef_Part"), dphi, jet.pt() - collision.rho() * jet.area(), weight); + spectra.fill(HIST("hDPhi_JetPt_Corr_TTRef_Part"), dphi, + jet.pt() - collision.rho() * jet.area(), weight); spectra.fill(HIST("hDPhi_JetPt_TTRef_Part"), dphi, jet.pt(), weight); - spectra.fill(HIST("hJetArea_JetPt_Rho_TTRef_Part"), jet.area(), jet.pt(), collision.rho(), weight); + spectra.fill(HIST("hJetArea_JetPt_Rho_TTRef_Part"), jet.area(), + jet.pt(), collision.rho(), weight); if (bRecoilJet) { - spectra.fill(HIST("hRecoil_JetPt_Corr_TTRef_Part"), jet.pt() - collision.rho() * jet.area(), weight); + spectra.fill(HIST("hRecoil_JetPt_Corr_TTRef_Part"), + jet.pt() - collision.rho() * jet.area(), weight); spectra.fill(HIST("hRecoil_JetPt_TTRef_Part"), jet.pt(), weight); } } @@ -413,7 +621,9 @@ struct RecoilJets { } template - void fillMatchedHistograms(TracksTable const& tracks, JetsBase const& jetsBase, JetsTag const& jetsTag, float weight = 1.) + void fillMatchedHistograms(TracksTable const& tracks, + JetsBase const& jetsBase, JetsTag const& jetsTag, + float weight = 1.) { std::vector vPhiOfTT; double phiTTSig = 0.; @@ -439,13 +649,38 @@ struct RecoilJets { phiTTSig = getPhiTT(vPhiOfTT); for (const auto& jetBase : jetsBase) { - bool bIsBaseJetRecoil = get<1>(isRecoilJet(jetBase, phiTTSig)) && bIsThereTTSig; + bool bIsBaseJetRecoil = + get<1>(isRecoilJet(jetBase, phiTTSig)) && bIsThereTTSig; dataForUnfolding(jetBase, jetsTag, bIsBaseJetRecoil, weight); } } - void processData(FilteredColl const& collision, - FilteredTracks const& tracks, + template + void fillMultiplicityHistograms(Collision const& collision, + float weight = 1.0) + { + + spectra.fill(HIST("hMultFT0A"), collision.multFT0A(), weight); + spectra.fill(HIST("hMultFT0C"), collision.multFT0C(), weight); + spectra.fill(HIST("hMultFT0M"), collision.multFT0M(), weight); + + spectra.fill(HIST("hMultZNA"), collision.multZNA(), weight); + spectra.fill(HIST("hMultZNC"), collision.multZNC(), weight); + spectra.fill(HIST("hMultZNM"), collision.multZNA() + collision.multZNC(), + weight); + + // Correlations + spectra.fill(HIST("hMultFT0A_vs_ZNA"), collision.multFT0A(), + collision.multZNA(), weight); + spectra.fill(HIST("hMultFT0C_vs_ZNC"), collision.multFT0C(), + collision.multZNC(), weight); + spectra.fill(HIST("hMultFT0M_vs_ZNM"), collision.multFT0M(), + collision.multZNA() + collision.multZNC(), weight); + } + + //------------------------------------------------------------------------------ + // Process functions + void processData(FilteredColl const& collision, FilteredTracks const& tracks, FilteredJets const& jets) { spectra.fill(HIST("hEventSelectionCount"), 0.5); @@ -473,7 +708,8 @@ struct RecoilJets { spectra.fill(HIST("vertexZ"), collision.posZ()); fillHistograms(collision, jets, tracks); } - PROCESS_SWITCH(RecoilJets, processMCDetLevel, "process MC detector level", false); + PROCESS_SWITCH(RecoilJets, processMCDetLevel, "process MC detector level", + false); void processMCDetLevelWeighted(FilteredCollDetLevelGetWeight const& collision, aod::JetMcCollisions const&, @@ -497,32 +733,46 @@ struct RecoilJets { fillHistograms(collision, jets, tracks, weight); } - PROCESS_SWITCH(RecoilJets, processMCDetLevelWeighted, "process MC detector level with event weight", false); + PROCESS_SWITCH(RecoilJets, processMCDetLevelWeighted, + "process MC detector level with event weight", false); void processMCPartLevel(FilteredCollPartLevel const& collision, - aod::JetParticles const& particles, + FilteredParticles const& particles, FilteredJetsPartLevel const& jets) { + spectra.fill(HIST("hEventSelectionCountPartLevel"), 0.5); if (skipMBGapEvent(collision)) return; spectra.fill(HIST("vertexZMC"), collision.posZ()); fillMCPHistograms(collision, jets, particles); } - PROCESS_SWITCH(RecoilJets, processMCPartLevel, "process MC particle level", false); + PROCESS_SWITCH(RecoilJets, processMCPartLevel, "process MC particle level", + false); void processMCPartLevelWeighted(FilteredCollPartLevel const& collision, - aod::JetParticles const& particles, + FilteredParticles const& particles, FilteredJetsPartLevel const& jets) { + spectra.fill(HIST("hEventSelectionCountPartLevel"), 0.5); if (skipMBGapEvent(collision)) return; auto weight = collision.weight(); + + auto calcPtHat = getPtHat(weight); + auto pThatFromFW = collision.ptHard(); + spectra.fill(HIST("hDiffInOutlierRemove"), calcPtHat - pThatFromFW); + if (collision.isOutlier()) + spectra.fill(HIST("hCountNumberOutliersFrameWork"), 0.5); + + // LOG(debug) << "Difference between pT hat: " << calcPtHat - pThatFromFW; + spectra.fill(HIST("vertexZMC"), collision.posZ(), weight); fillMCPHistograms(collision, jets, particles, weight); } - PROCESS_SWITCH(RecoilJets, processMCPartLevelWeighted, "process MC particle level with event weight", false); + PROCESS_SWITCH(RecoilJets, processMCPartLevelWeighted, + "process MC particle level with event weight", false); void processJetsMatched(FilteredCollDetLevelGetWeight const& collision, aod::JetMcCollisions const&, @@ -533,35 +783,42 @@ struct RecoilJets { if (skipEvent(collision) || skipMBGapEvent(collision)) return; - auto mcpjetsPerMCCollision = mcpjets.sliceBy(partJetsPerCollision, collision.mcCollisionId()); + auto mcpjetsPerMCCollision = + mcpjets.sliceBy(partJetsPerCollision, collision.mcCollisionId()); - if (bGetMissJets) { - fillMatchedHistograms(tracks, mcpjetsPerMCCollision, mcdjets); - } else { - fillMatchedHistograms(tracks, mcdjets, mcpjetsPerMCCollision); - } + fillMatchedHistograms(tracks, mcpjetsPerMCCollision, mcdjets); } - PROCESS_SWITCH(RecoilJets, processJetsMatched, "process matching of MC jets (no weight)", false); - - void processJetsMatchedWeighted(FilteredCollDetLevelGetWeight const& collision, - aod::JetMcCollisions const&, - FilteredTracks const& tracks, - FilteredMatchedJetsDetLevel const& mcdjets, - FilteredMatchedJetsPartLevel const& mcpjets) + PROCESS_SWITCH(RecoilJets, processJetsMatched, + "process matching of MC jets (no weight)", false); + + void + processJetsMatchedWeighted(FilteredCollDetLevelGetWeight const& collision, + aod::JetMcCollisions const&, + FilteredTracks const& tracks, + FilteredMatchedJetsDetLevel const& mcdjets, + FilteredMatchedJetsPartLevel const& mcpjets) { if (skipEvent(collision) || skipMBGapEvent(collision)) return; - auto mcpjetsPerMCCollision = mcpjets.sliceBy(partJetsPerCollision, collision.mcCollisionId()); + auto mcpjetsPerMCCollision = + mcpjets.sliceBy(partJetsPerCollision, collision.mcCollisionId()); auto weight = collision.mcCollision().weight(); - if (bGetMissJets) { - fillMatchedHistograms(tracks, mcpjetsPerMCCollision, mcdjets, weight); - } else { - fillMatchedHistograms(tracks, mcdjets, mcpjetsPerMCCollision, weight); - } + fillMatchedHistograms(tracks, mcpjetsPerMCCollision, mcdjets, weight); } - PROCESS_SWITCH(RecoilJets, processJetsMatchedWeighted, "process matching of MC jets (weighted)", false); + PROCESS_SWITCH(RecoilJets, processJetsMatchedWeighted, + "process matching of MC jets (weighted)", false); + + void processMultiplicity(FilteredEventMultiplicity const& collision) + { + if (skipEvent(collision)) + return; + + fillMultiplicityHistograms(collision); + } + PROCESS_SWITCH(RecoilJets, processMultiplicity, "process multiplicity", + false); //------------------------------------------------------------------------------ // Auxiliary functions @@ -569,13 +826,17 @@ struct RecoilJets { bool skipEvent(const Collision& coll) { /// \brief: trigger cut is needed for pp data - return !jetderiveddatautilities::selectCollision(coll, eventSelectionBits) || !jetderiveddatautilities::selectTrigger(coll, triggerMaskBits); + return !jetderiveddatautilities::selectCollision(coll, + eventSelectionBits) || + !jetderiveddatautilities::selectTrigger(coll, triggerMaskBits); } template bool skipMBGapEvent(const Collision& coll) { - return skipMBGapEvents && coll.subGeneratorId() == jetderiveddatautilities::JCollisionSubGeneratorId::mbGap; + return skipMBGapEvents && + coll.subGeneratorId() == + jetderiveddatautilities::JCollisionSubGeneratorId::mbGap; } template @@ -585,10 +846,10 @@ struct RecoilJets { } template - std::tuple isRecoilJet(const Jet& jet, - double phiTT) + std::tuple isRecoilJet(const Jet& jet, double phiTT) { - double dphi = std::fabs(RecoDecay::constrainAngle(jet.phi() - phiTT, -constants::math::PI)); + double dphi = std::fabs( + RecoDecay::constrainAngle(jet.phi() - phiTT, -constants::math::PI)); return {dphi, (constants::math::PI - recoilRegion) < dphi}; } @@ -603,54 +864,58 @@ struct RecoilJets { return 10. / (std::pow(weight, 1.0 / pTHatExponent)); } - template - void dataForUnfolding(JetBase const& jetBase, JetsTag const&, bool bIsBaseJetRecoil, float weight = 1.0) + template + void dataForUnfolding(PartJet const& partJet, DetJet const& detJets, + bool bIsBaseJetRecoil, float weight = 1.0) { - bool bIsThereMatchedJet = jetBase.has_matchedJetGeo(); + bool bIsThereMatchedJet = partJet.has_matchedJetGeo(); + if (bIsThereMatchedJet) { - const auto& jetsMatched = jetBase.template matchedJetGeo_as>(); + const auto& jetsMatched = + partJet.template matchedJetGeo_as>(); for (const auto& jetMatched : jetsMatched) { - spectra.fill(HIST("hNumberMatchedJetsPerOneBaseJet"), jetsMatched.size(), jetMatched.pt(), weight); - - if (bGetMissJets) { - // Mean that base jet is particle level jet - spectra.fill(HIST("hJetPt_DetLevel_vs_PartLevel"), jetMatched.pt(), jetBase.pt(), weight); - spectra.fill(HIST("hJetPt_resolution"), (jetBase.pt() - jetMatched.pt()) / jetBase.pt(), jetBase.pt(), weight); - spectra.fill(HIST("hJetPhi_resolution"), jetBase.phi() - jetMatched.phi(), jetBase.pt(), weight); - - if (bIsBaseJetRecoil) { - spectra.fill(HIST("hJetPt_DetLevel_vs_PartLevel_RecoilJets"), jetMatched.pt(), jetBase.pt(), weight); - spectra.fill(HIST("hJetPt_resolution_RecoilJets"), (jetBase.pt() - jetMatched.pt()) / jetBase.pt(), jetBase.pt(), weight); - spectra.fill(HIST("hJetPhi_resolution_RecoilJets"), jetBase.phi() - jetMatched.phi(), jetBase.pt(), weight); - } - } else { - // Mean that base jet is detector level jet - spectra.fill(HIST("hJetPt_DetLevel_vs_PartLevel"), jetBase.pt(), jetMatched.pt(), weight); - spectra.fill(HIST("hJetPt_resolution"), (jetMatched.pt() - jetBase.pt()) / jetMatched.pt(), jetMatched.pt(), weight); - spectra.fill(HIST("hJetPhi_resolution"), jetMatched.phi() - jetBase.phi(), jetMatched.phi(), weight); - - if (bIsBaseJetRecoil) { - spectra.fill(HIST("hJetPt_DetLevel_vs_PartLevel_RecoilJets"), jetBase.pt(), jetMatched.pt(), weight); - spectra.fill(HIST("hJetPt_resolution_RecoilJets"), (jetMatched.pt() - jetBase.pt()) / jetMatched.pt(), jetMatched.pt(), weight); - spectra.fill(HIST("hJetPhi_resolution_RecoilJets"), jetMatched.phi() - jetBase.phi(), jetMatched.phi(), weight); - } + spectra.fill(HIST("hNumberMatchedJetsPerOneBaseJet"), + jetsMatched.size(), jetMatched.pt(), weight); + spectra.fill(HIST("hJetPt_DetLevel_vs_PartLevel"), jetMatched.pt(), + partJet.pt(), weight); + spectra.fill(HIST("hJetPt_resolution"), + (partJet.pt() - jetMatched.pt()) / partJet.pt(), + partJet.pt(), weight); + spectra.fill(HIST("hJetPhi_resolution"), + partJet.phi() - jetMatched.phi(), partJet.pt(), weight); + + if (bIsBaseJetRecoil) { + spectra.fill(HIST("hJetPt_DetLevel_vs_PartLevel_RecoilJets"), + jetMatched.pt(), partJet.pt(), weight); + spectra.fill(HIST("hJetPt_resolution_RecoilJets"), + (partJet.pt() - jetMatched.pt()) / partJet.pt(), + partJet.pt(), weight); + spectra.fill(HIST("hJetPhi_resolution_RecoilJets"), + partJet.phi() - jetMatched.phi(), partJet.pt(), weight); } } } else { - // No closest jet - if (bGetMissJets) { - spectra.fill(HIST("hMissedJets_pT"), jetBase.pt(), weight); - if (bIsBaseJetRecoil) - spectra.fill(HIST("hMissedJets_pT_RecoilJets"), jetBase.pt(), weight); - } else { - spectra.fill(HIST("hFakeJets_pT"), jetBase.pt(), weight); + // Miss jets + spectra.fill(HIST("hMissedJets_pT"), partJet.pt(), weight); + if (bIsBaseJetRecoil) + spectra.fill(HIST("hMissedJets_pT_RecoilJets"), partJet.pt(), weight); + } + + // Fake jets + for (const auto& detJet : detJets) { + bIsThereMatchedJet = detJet.has_matchedJetGeo(); + if (!bIsThereMatchedJet) { + spectra.fill(HIST("hFakeJets_pT"), detJet.pt(), weight); if (bIsBaseJetRecoil) - spectra.fill(HIST("hFakeJets_pT_RecoilJets"), jetBase.pt(), weight); + spectra.fill(HIST("hFakeJets_pT_RecoilJets"), detJet.pt(), weight); } } } }; -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; } +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} From a4f9c2eb67e9b438474cf86081f81675c7bd9354 Mon Sep 17 00:00:00 2001 From: feisenhu <53603353+feisenhu@users.noreply.github.com> Date: Wed, 30 Jul 2025 15:34:11 +0200 Subject: [PATCH 139/345] [PWGEM] Add DCA1 vs DCA2 hist to DielectronMC task (#12325) --- PWGEM/Dilepton/Core/DileptonMC.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/PWGEM/Dilepton/Core/DileptonMC.h b/PWGEM/Dilepton/Core/DileptonMC.h index e5add9f6e63..9d233ee25cd 100644 --- a/PWGEM/Dilepton/Core/DileptonMC.h +++ b/PWGEM/Dilepton/Core/DileptonMC.h @@ -111,6 +111,7 @@ struct DileptonMC { ConfigurableAxis ConfDPtBins{"ConfDPtBins", {220, -1.0, +10.0}, "dpt bins for output histograms"}; ConfigurableAxis ConfDCAllNarrowBins{"ConfDCAllNarrowBins", {200, 0.0, 10.0}, "narrow DCAll bins for output histograms"}; + ConfigurableAxis ConfTrackDCA{"ConfTrackDCA", {VARIABLE_WIDTH, -10, -9, -8, -7, -6, -5, -4.5, -4, -3.5, -3, -2.5, -2, -1.9, -1.8, -1.7, -1.6, -1.5, -1.4, -1.3, -1.2, -1.1, -1, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.5, 3, 3.5, 4, 4.5, 5, 6, 7, 8, 9, 10}, "DCA binning for single tacks"}; ConfigurableAxis ConfYllBins{"ConfYllBins", {VARIABLE_WIDTH, -10.f, +10.f}, "yll bins for output histograms"}; @@ -346,6 +347,8 @@ struct DileptonMC { const AxisSpec axis_dca_narrow{ConfDCAllNarrowBins, pair_dca_axis_title}; const AxisSpec axis_dpt{ConfDPtBins, "#Delta p_{T,1}^{gen-rec} + #Delta p_{T,2}^{gen-rec} (GeV/c)"}; + const AxisSpec axis_dca_track1{ConfTrackDCA, "DCA_{e,1}^{Z} (#sigma)"}; + const AxisSpec axis_dca_track2{ConfTrackDCA, "DCA_{e,2}^{Z} (#sigma)"}; const AxisSpec axis_dphi_ee{cfg_nbin_dphi_ee, -M_PI / 2., 3. / 2. * M_PI, "#Delta#varphi = #varphi_{l1} - #varphi_{l2} (rad.)"}; // for kHFll const AxisSpec axis_deta_ee{cfg_nbin_deta_ee, -2., 2., "#Delta#eta = #eta_{l1} - #eta_{l2}"}; // for kHFll @@ -438,6 +441,8 @@ struct DileptonMC { fRegistry.add("Pair/sm/NonPromptPi0/hDeltaPtvsDCA", "#Delta p_{T,1}^{gen-rec} + #Delta p_{T,2}^{gen-rec} vs. DCA_{ee}", kTH2F, {axis_dca_narrow, axis_dpt}, true); fRegistry.add("Pair/sm/PromptJPsi/hDeltaPtvsDCA", "#Delta p_{T,1}^{gen-rec} + #Delta p_{T,2}^{gen-rec} vs. DCA_{ee}", kTH2F, {axis_dca_narrow, axis_dpt}, true); fRegistry.add("Pair/sm/NonPromptJPsi/hDeltaPtvsDCA", "#Delta p_{T,1}^{gen-rec} + #Delta p_{T,2}^{gen-rec} vs. DCA_{ee}", kTH2F, {axis_dca_narrow, axis_dpt}, true); + fRegistry.add("Pair/sm/PromptPi0/hDCAz1vsDCAz2", "DCA_{z,1} vs DCA_{z,2}", kTH2F, {axis_dca_track1, axis_dca_track2}, true); + fRegistry.add("Pair/sm/PromptJPsi/hDCAz1vsDCAz2", "DCA_{z,1} vs DCA_{z,2}", kTH2F, {axis_dca_track1, axis_dca_track2}, true); } fRegistry.add("Pair/ccbar/c2l_c2l/hadron_hadron/hs", "hs pair", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_deta_ee, axis_cos_theta_cs, axis_phi_cs, axis_aco, axis_asym_pt, axis_dphi_e_ee, axis_dca}, true); @@ -1003,6 +1008,7 @@ struct DileptonMC { if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { fRegistry.fill(HIST("Pair/sm/PromptPi0/hDeltaPtvsDCA"), pair_dca, deltaPt1 + deltaPt2); fRegistry.fill(HIST("Pair/sm/PromptPi0/hMvsPhiV"), phiv, v12.M()); + fRegistry.fill(HIST("Pair/sm/PromptPi0/hDCAz1vsDCAz2"), dcaZinSigma(t1), dcaZinSigma(t2)); } } else { // non-prompt pi0 fRegistry.fill(HIST("Pair/sm/NonPromptPi0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); @@ -1043,6 +1049,7 @@ struct DileptonMC { fRegistry.fill(HIST("Pair/sm/PromptJPsi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), dphi, deta, std::fabs(cos_thetaCS), std::fabs(phiCS), aco, asym, std::fabs(dphi_e_ee), pair_dca, weight); if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { fRegistry.fill(HIST("Pair/sm/PromptJPsi/hDeltaPtvsDCA"), pair_dca, deltaPt1 + deltaPt2); + fRegistry.fill(HIST("Pair/sm/PromptJPsi/hDCAz1vsDCAz2"), dcaZinSigma(t1), dcaZinSigma(t2)); } } break; From b6c8a49c7f1eff144fca27eee344f48258ddeea9 Mon Sep 17 00:00:00 2001 From: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Date: Wed, 30 Jul 2025 16:22:05 +0200 Subject: [PATCH 140/345] [PWGLF] Fix V0DataLink filling + return calls when moving TPC only tracks (#12330) Co-authored-by: ALICE Action Bot --- .../TableProducer/Strangeness/strangenessbuilder.cxx | 8 ++++++-- PWGLF/Utils/strangenessBuilderModule.h | 12 ++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/strangenessbuilder.cxx b/PWGLF/TableProducer/Strangeness/strangenessbuilder.cxx index bca1b08b07f..d7012626b4f 100644 --- a/PWGLF/TableProducer/Strangeness/strangenessbuilder.cxx +++ b/PWGLF/TableProducer/Strangeness/strangenessbuilder.cxx @@ -1648,7 +1648,8 @@ struct StrangenessBuilder { auto const& collision = collisions.rawIteratorAt(v0.collisionId); if (!mVDriftMgr.moveTPCTrack(collision, posTrack, posTrackPar)) { - return; + products.v0dataLink(-1, -1); + continue; } } @@ -1660,7 +1661,8 @@ struct StrangenessBuilder { auto const& collision = collisions.rawIteratorAt(v0.collisionId); if (!mVDriftMgr.moveTPCTrack(collision, negTrack, negTrackPar)) { - return; + products.v0dataLink(-1, -1); + continue; } } } @@ -1925,6 +1927,8 @@ struct StrangenessBuilder { } } // enabled tables check } // constexpr requires check + } else { + products.v0dataLink(-1, -1); } } diff --git a/PWGLF/Utils/strangenessBuilderModule.h b/PWGLF/Utils/strangenessBuilderModule.h index 41d995fbb44..4673be69592 100644 --- a/PWGLF/Utils/strangenessBuilderModule.h +++ b/PWGLF/Utils/strangenessBuilderModule.h @@ -894,7 +894,7 @@ class BuilderModule posTrackPar.setPID(o2::track::PID::Electron); negTrackPar.setPID(o2::track::PID::Electron); if (!mVDriftMgr.moveTPCTrack(collision, pTrack, posTrackPar)) { - return; + continue; } } if (isNegTPCOnly) { @@ -902,7 +902,7 @@ class BuilderModule posTrackPar.setPID(o2::track::PID::Electron); negTrackPar.setPID(o2::track::PID::Electron); if (!mVDriftMgr.moveTPCTrack(collision, nTrack, negTrackPar)) { - return; + continue; } } } // end TPC drift treatment @@ -1370,7 +1370,8 @@ class BuilderModule auto const& collision = collisions.rawIteratorAt(v0.collisionId); if (!mVDriftMgr.moveTPCTrack(collision, posTrack, posTrackPar)) { - return; + products.v0dataLink(-1, -1); + continue; } } @@ -1382,7 +1383,8 @@ class BuilderModule auto const& collision = collisions.rawIteratorAt(v0.collisionId); if (!mVDriftMgr.moveTPCTrack(collision, negTrack, negTrackPar)) { - return; + products.v0dataLink(-1, -1); + continue; } } } @@ -1647,6 +1649,8 @@ class BuilderModule } } // enabled tables check } // constexpr requires check + } else { + products.v0dataLink(-1, -1); } } From 10a7bca15f2a3096ca743e2a696fb51806cc5feb Mon Sep 17 00:00:00 2001 From: creetz16 <79141119+creetz16@users.noreply.github.com> Date: Wed, 30 Jul 2025 17:08:15 +0200 Subject: [PATCH 141/345] [PWGLF] Update decay3body analysis (#12317) --- PWGLF/DataModel/Vtx3BodyTables.h | 12 +++---- .../Nuspex/decay3bodybuilder.cxx | 21 +++++++++---- PWGLF/Utils/decay3bodyBuilderHelper.h | 31 +++++++------------ 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/PWGLF/DataModel/Vtx3BodyTables.h b/PWGLF/DataModel/Vtx3BodyTables.h index 352687192eb..55bdea60789 100644 --- a/PWGLF/DataModel/Vtx3BodyTables.h +++ b/PWGLF/DataModel/Vtx3BodyTables.h @@ -67,10 +67,10 @@ DECLARE_SOA_COLUMN(DCAZTrackPiToPV, dcaZtrackPiToPv, float); //! DCAZ of pion DECLARE_SOA_COLUMN(DCAZTrackDeToPV, dcaZtrackDeToPv, float); //! DCAZ of deuteron to PV // DCAs to SV -DECLARE_SOA_COLUMN(DCATrackPrToSV, dcaTrackPrToSv, float); //! DCA of proton to SV -DECLARE_SOA_COLUMN(DCATrackPiToSV, dcaTrackPiToSv, float); //! DCA of pion to SV -DECLARE_SOA_COLUMN(DCATrackDeToSV, dcaTrackDeToSv, float); //! DCA of deuteron to SV -DECLARE_SOA_COLUMN(DCAVtxDaughters, dcaVtxdaughters, float); //! Quadratic sum of DCA between daughters at SV +DECLARE_SOA_COLUMN(DCATrackPrToSV, dcaTrackPrToSv, float); //! DCA of proton to SV +DECLARE_SOA_COLUMN(DCATrackPiToSV, dcaTrackPiToSv, float); //! DCA of pion to SV +DECLARE_SOA_COLUMN(DCATrackDeToSV, dcaTrackDeToSv, float); //! DCA of deuteron to SV +DECLARE_SOA_COLUMN(DCAVtxToDaughtersAv, dcaVtxToDaughtersAv, float); //! Quadratic sum of DCA between daughters at SV // CosPA DECLARE_SOA_COLUMN(CosPA, cosPA, float); //! Cosine of pointing angle of the 3body candidate @@ -211,7 +211,7 @@ DECLARE_SOA_TABLE(Vtx3BodyDatas, "AOD", "VTX3BODYDATA", //! vtx3body::DCAXYTrackPrToPV, vtx3body::DCAXYTrackPiToPV, vtx3body::DCAXYTrackDeToPV, vtx3body::DCAZTrackPrToPV, vtx3body::DCAZTrackPiToPV, vtx3body::DCAZTrackDeToPV, vtx3body::DCATrackPrToSV, vtx3body::DCATrackPiToSV, vtx3body::DCATrackDeToSV, - vtx3body::DCAVtxDaughters, + vtx3body::DCAVtxToDaughtersAv, vtx3body::CosPA, vtx3body::Ct, vtx3body::TPCNSigmaPr, vtx3body::TPCNSigmaPi, vtx3body::TPCNSigmaDe, vtx3body::TPCNSigmaPiBach, vtx3body::TOFNSigmaDe, @@ -260,7 +260,7 @@ DECLARE_SOA_TABLE(McVtx3BodyDatas, "AOD", "MC3BODYDATA", //! vtx3body::DCAXYTrackPrToPV, vtx3body::DCAXYTrackPiToPV, vtx3body::DCAXYTrackDeToPV, vtx3body::DCAZTrackPrToPV, vtx3body::DCAZTrackPiToPV, vtx3body::DCAZTrackDeToPV, vtx3body::DCATrackPrToSV, vtx3body::DCATrackPiToSV, vtx3body::DCATrackDeToSV, - vtx3body::DCAVtxDaughters, + vtx3body::DCAVtxToDaughtersAv, vtx3body::CosPA, vtx3body::Ct, vtx3body::TPCNSigmaPr, vtx3body::TPCNSigmaPi, vtx3body::TPCNSigmaDe, vtx3body::TPCNSigmaPiBach, vtx3body::TOFNSigmaDe, diff --git a/PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx b/PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx index a113a8ecbd8..bee3f8f9eaf 100644 --- a/PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx +++ b/PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx @@ -143,7 +143,9 @@ struct decay3bodyBuilder { // building options Configurable useKFParticle{"useKFParticle", false, "Use KFParticle for decay3body building"}; Configurable kfSetTopologicalConstraint{"kfSetTopologicalConstraint", false, "Set topological vertex constraint in case of KFParticle reconstruction"}; + Configurable buildOnlyTracked{"buildOnlyTracked", false, "Build only tracked decay3bodys"}; Configurable useSelections{"useSelections", true, "Apply selections during decay3body building"}; + Configurable useChi2Selection{"useChi2Selection", true, "Apply chi2 selection during decay3body building"}; Configurable useTPCforPion{"useTPCforPion", false, "Flag to ask for TPC info for pion track (PID, nClusters), false: pion track can be ITS only"}; Configurable acceptTPCOnly{"acceptTPCOnly", false, "Accept TPC only tracks as daughters"}; Configurable askOnlyITSMatch{"askOnlyITSMatch", true, "ask only ITS match to distinguish TPC only tracks"}; @@ -166,7 +168,7 @@ struct decay3bodyBuilder { Configurable minTOFnSigmaDeuteron{"minTOFnSigmaDeuteron", -5.0, "Min TOF nSigma of deuteron daughter"}; Configurable maxTOFnSigmaDeuteron{"maxTOFnSigmaDeuteron", 5.0, "Max TOF nSigma of deuteron daughter"}; Configurable minPDeuteronUseTOF{"minPDeuteronUseTOF", 1.0, "Min P of deuteron to use TOF PID"}; - Configurable maxDCADauAtSV{"maxDCADauAtSV", 0.5, "Max DCA of daughters at SV (quadratic sum of daughter DCAs between each other)"}; + Configurable maxDCADauToSVaverage{"maxDCADauToSVaverage", 0.5, "Max DCA of daughters to SV (quadratic sum of daughter DCAs to SV / 3)"}; // candidate selections Configurable maxRapidity{"maxRapidity", 1.0, "Max rapidity of decay3body vertex"}; Configurable minPt{"minPt", 2.0, "Min Pt of decay3body candidate"}; @@ -326,7 +328,7 @@ struct decay3bodyBuilder { helper.decay3bodyselections.minTOFnSigmaDeuteron = decay3bodyBuilderOpts.minTOFnSigmaDeuteron; helper.decay3bodyselections.maxTOFnSigmaDeuteron = decay3bodyBuilderOpts.maxTOFnSigmaDeuteron; helper.decay3bodyselections.minPDeuteronUseTOF = decay3bodyBuilderOpts.minPDeuteronUseTOF; - helper.decay3bodyselections.maxDCADauAtSV = decay3bodyBuilderOpts.maxDCADauAtSV; + helper.decay3bodyselections.maxDCADauToSVaverage = decay3bodyBuilderOpts.maxDCADauToSVaverage; helper.decay3bodyselections.maxRapidity = decay3bodyBuilderOpts.maxRapidity; helper.decay3bodyselections.minPt = decay3bodyBuilderOpts.minPt; helper.decay3bodyselections.maxPt = decay3bodyBuilderOpts.maxPt; @@ -393,7 +395,7 @@ struct decay3bodyBuilder { LOGF(info, "-~> min TOF nSigma deuteron ......: %f", decay3bodyBuilderOpts.minTOFnSigmaDeuteron.value); LOGF(info, "-~> max TOF nSigma deuteron ......: %f", decay3bodyBuilderOpts.maxTOFnSigmaDeuteron.value); LOGF(info, "-~> min p bach use TOF ...........: %f", decay3bodyBuilderOpts.minPDeuteronUseTOF.value); - LOGF(info, "-~> max DCA dau at SV ............: %f", decay3bodyBuilderOpts.maxDCADauAtSV.value); + LOGF(info, "-~> max DCA dau at SV ............: %f", decay3bodyBuilderOpts.maxDCADauToSVaverage.value); LOGF(info, "-~> max rapidity .................: %f", decay3bodyBuilderOpts.maxRapidity.value); LOGF(info, "-~> min pT .......................: %f", decay3bodyBuilderOpts.minPt.value); LOGF(info, "-~> max pT .......................: %f", decay3bodyBuilderOpts.maxPt.value); @@ -720,6 +722,11 @@ struct decay3bodyBuilder { registry.fill(HIST("Counters/hInputStatistics"), kVtx3BodyDatas, decay3bodys.size()); int lastRunNumber = -1; for (const auto& decay3body : decay3bodys) { + // only build tracked decay3body if aksed + if (decay3bodyBuilderOpts.buildOnlyTracked && fTrackedClSizeVector[decay3body.globalIndex()] == 0) { + continue; + } + // skip decay3body without assigned collision /// TODO: do we want this?? if (decay3body.collisionId() < 0) { @@ -782,6 +789,7 @@ struct decay3bodyBuilder { decay3bodyBuilderOpts.useKFParticle, decay3bodyBuilderOpts.kfSetTopologicalConstraint, decay3bodyBuilderOpts.useSelections, + decay3bodyBuilderOpts.useChi2Selection, decay3bodyBuilderOpts.useTPCforPion, decay3bodyBuilderOpts.acceptTPCOnly, decay3bodyBuilderOpts.askOnlyITSMatch, @@ -958,7 +966,7 @@ struct decay3bodyBuilder { -1., -1., -1., // trackDCAxyToPV: 0 - proton, 1 - pion, 2 - deuteron -1., -1., -1., // trackDCAzToPV: 0 - proton, 1 - pion, 2 - deuteron -1., -1., -1., // daughterDCAtoSV: 0 - proton, 1 - pion, 2 - deuteron - -1., // daughterDCAatSV + -1., // daughterDCAtoSVaverage -1., -1., // cosPA, ctau -1., -1., -1., -1., // tpcNsigma: 0 - proton, 1 - pion, 2 - deuteron, 3 - bach with pion hyp -1., // tofNsigmaDeuteron @@ -1117,7 +1125,7 @@ struct decay3bodyBuilder { helper.decay3body.trackDCAxyToPV[0], helper.decay3body.trackDCAxyToPV[1], helper.decay3body.trackDCAxyToPV[2], // 0 - proton, 1 - pion, 2 - deuteron helper.decay3body.trackDCAzToPV[0], helper.decay3body.trackDCAzToPV[1], helper.decay3body.trackDCAzToPV[2], // 0 - proton, 1 - pion, 2 - deuteron helper.decay3body.daughterDCAtoSV[0], helper.decay3body.daughterDCAtoSV[1], helper.decay3body.daughterDCAtoSV[2], // 0 - proton, 1 - pion, 2 - deuteron - helper.decay3body.daughterDCAatSV, + helper.decay3body.daughterDCAtoSVaverage, helper.decay3body.cosPA, helper.decay3body.ctau, helper.decay3body.tpcNsigma[0], helper.decay3body.tpcNsigma[1], helper.decay3body.tpcNsigma[2], helper.decay3body.tpcNsigma[2], // 0 - proton, 1 - pion, 2 - deuteron, 3 - bach with pion hyp helper.decay3body.tofNsigmaDeuteron, @@ -1146,7 +1154,7 @@ struct decay3bodyBuilder { helper.decay3body.trackDCAxyToPV[0], helper.decay3body.trackDCAxyToPV[1], helper.decay3body.trackDCAxyToPV[2], // 0 - proton, 1 - pion, 2 - deuteron helper.decay3body.trackDCAzToPV[0], helper.decay3body.trackDCAzToPV[1], helper.decay3body.trackDCAzToPV[2], // 0 - proton, 1 - pion, 2 - deuteron helper.decay3body.daughterDCAtoSV[0], helper.decay3body.daughterDCAtoSV[1], helper.decay3body.daughterDCAtoSV[2], // 0 - proton, 1 - pion, 2 - deuteron - helper.decay3body.daughterDCAatSV, + helper.decay3body.daughterDCAtoSVaverage, helper.decay3body.cosPA, helper.decay3body.ctau, helper.decay3body.tpcNsigma[0], helper.decay3body.tpcNsigma[1], helper.decay3body.tpcNsigma[2], helper.decay3body.tpcNsigma[2], // 0 - proton, 1 - pion, 2 - deuteron, 3 - bach with pion hyp helper.decay3body.tofNsigmaDeuteron, @@ -1184,6 +1192,7 @@ struct decay3bodyBuilder { decay3bodyBuilderOpts.useKFParticle, decay3bodyBuilderOpts.kfSetTopologicalConstraint, decay3bodyBuilderOpts.useSelections, + decay3bodyBuilderOpts.useChi2Selection, decay3bodyBuilderOpts.useTPCforPion, decay3bodyBuilderOpts.acceptTPCOnly, decay3bodyBuilderOpts.askOnlyITSMatch, diff --git a/PWGLF/Utils/decay3bodyBuilderHelper.h b/PWGLF/Utils/decay3bodyBuilderHelper.h index 1343bd61552..49131c16040 100644 --- a/PWGLF/Utils/decay3bodyBuilderHelper.h +++ b/PWGLF/Utils/decay3bodyBuilderHelper.h @@ -74,15 +74,11 @@ struct decay3bodyCandidate { int sign; float momentum[3]; float position[3]; - // std::array momentum = {0.0f, 0.0f, 0.0f}; - // std::array position = {0.0f, 0.0f, 0.0f}; - // float dcaToPV = 0.0f; - // float dcaxyToPV = 0.0f; float chi2 = 0.0f; float trackedClSize = 0.0f; float cosPA = 0.0f; // cosine of pointing angle float ctau = 0.0f; // ctau of the candidate - float daughterDCAatSV = 0.0f; // quadratic sum of DCA between daughters at SV + float daughterDCAtoSVaverage = 0.0f; // average of quadratic sum of daughter DCAs to SV std::array daughterDCAtoSV = {0.0f, 0.0f, 0.0f}; // 0 - pos, 1 - neg, 2 - bach // covariance matrix @@ -148,7 +144,7 @@ class decay3bodyBuilderHelper double minTOFnSigmaDeuteron; double maxTOFnSigmaDeuteron; float minPDeuteronUseTOF; - float maxDCADauAtSV; + float maxDCADauToSVaverage; // candidate float maxRapidity; float minPt; @@ -188,6 +184,7 @@ class decay3bodyBuilderHelper bool useKFParticle = false, bool kfSetTopologicalConstraint = false, bool useSelections = true, + bool useChi2Selection = true, bool useTPCforPion = false, bool acceptTPCOnly = false, bool askOnlyITSMatch = true, @@ -342,18 +339,6 @@ class decay3bodyBuilderHelper auto trackPionPt = std::sqrt(decay3body.momPion[0] * decay3body.momPion[0] + decay3body.momPion[1] * decay3body.momPion[1]); auto trackDeuteronPt = std::sqrt(decay3body.momDeuteron[0] * decay3body.momDeuteron[0] + decay3body.momDeuteron[1] * decay3body.momDeuteron[1]); - // DCA between daughters at SV - decay3body.daughterDCAatSV = std::hypot( - std::hypot(decay3body.posProton[0] - decay3body.posPion[0], - decay3body.posProton[1] - decay3body.posPion[1], - decay3body.posProton[2] - decay3body.posPion[2]), - std::hypot(decay3body.posProton[0] - decay3body.posDeuteron[0], - decay3body.posProton[1] - decay3body.posDeuteron[1], - decay3body.posProton[2] - decay3body.posDeuteron[2]), - std::hypot(decay3body.posPion[0] - decay3body.posProton[0], - decay3body.posPion[1] - decay3body.posProton[1], - decay3body.posPion[2] - decay3body.posProton[2])); - // daughter DCA to SV // proton daughter decay3body.daughterDCAtoSV[0] = std::hypot( @@ -371,6 +356,12 @@ class decay3bodyBuilderHelper decay3body.posDeuteron[1] - decay3body.position[1], decay3body.posDeuteron[2] - decay3body.position[2]); + // DCA daughters to SV average of quadratic sum + decay3body.daughterDCAtoSVaverage = (decay3body.daughterDCAtoSV[0] * decay3body.daughterDCAtoSV[0] + + decay3body.daughterDCAtoSV[1] * decay3body.daughterDCAtoSV[1] + + decay3body.daughterDCAtoSV[2] * decay3body.daughterDCAtoSV[2]) / + 3; + //_____________________________________________________ // selections after vertex fit if (useSelections) { @@ -392,7 +383,7 @@ class decay3bodyBuilderHelper } // daughter DCAs at SV - if (decay3body.daughterDCAatSV > decay3bodyselections.maxDCADauAtSV) { + if (decay3body.daughterDCAtoSVaverage > decay3bodyselections.maxDCADauToSVaverage) { decay3body = {}; return false; } @@ -418,7 +409,7 @@ class decay3bodyBuilderHelper } // vertex chi2 - if (decay3body.chi2 > decay3bodyselections.maxChi2) { + if (useChi2Selection && decay3body.chi2 > decay3bodyselections.maxChi2) { decay3body = {}; return false; } From 49b11bcb8238418d92f3eda99f16f076df33678e Mon Sep 17 00:00:00 2001 From: arvindkhuntia <31609955+arvindkhuntia@users.noreply.github.com> Date: Wed, 30 Jul 2025 20:53:23 +0530 Subject: [PATCH 142/345] [PWGJE] Fixed 3D histogram filling (#12332) Co-authored-by: Arvind Khuntia --- PWGJE/Tasks/nucleiInJets.cxx | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/PWGJE/Tasks/nucleiInJets.cxx b/PWGJE/Tasks/nucleiInJets.cxx index f85ccded8e0..dc0ee16b9de 100644 --- a/PWGJE/Tasks/nucleiInJets.cxx +++ b/PWGJE/Tasks/nucleiInJets.cxx @@ -1409,23 +1409,23 @@ struct nucleiInJets { if (addTOFplots && trk.hasTOF()) { massTOF = trk.p() * TMath::Sqrt(1.f / (trk.beta() * trk.beta()) - 1.f); if (!useTPCpreSel) { - jetHist.fill(HIST("tracksInc/proton/h2TOFmassProtonVsPt"), massTOF, trk.pt()); - jetHist.fill(HIST("tracksInc/proton/h2TOFmass2ProtonVsPt"), massTOF * massTOF - gMassProton * gMassProton, trk.pt()); - jetHist.fill(HIST("tracksInc/proton/h2TofNsigmaProtonVsPt"), trk.tofNSigmaPr(), trk.pt()); + jetHist.fill(HIST("tracksInc/proton/h2TOFmassProtonVsPt"), massTOF, trk.pt(), centrality); + jetHist.fill(HIST("tracksInc/proton/h2TOFmass2ProtonVsPt"), massTOF * massTOF - gMassProton * gMassProton, trk.pt(), centrality); + jetHist.fill(HIST("tracksInc/proton/h2TofNsigmaProtonVsPt"), trk.tofNSigmaPr(), trk.pt(), centrality); - jetHist.fill(HIST("tracksInc/deuteron/h2TOFmassDeuteronVsPt"), massTOF, trk.pt()); - jetHist.fill(HIST("tracksInc/deuteron/h2TOFmass2DeuteronVsPt"), massTOF * massTOF - gMassDeuteron * gMassDeuteron, trk.pt()); - jetHist.fill(HIST("tracksInc/deuteron/h2TofNsigmaDeuteronVsPt"), trk.tofNSigmaDe(), trk.pt()); + jetHist.fill(HIST("tracksInc/deuteron/h2TOFmassDeuteronVsPt"), massTOF, trk.pt(), centrality); + jetHist.fill(HIST("tracksInc/deuteron/h2TOFmass2DeuteronVsPt"), massTOF * massTOF - gMassDeuteron * gMassDeuteron, trk.pt(), centrality); + jetHist.fill(HIST("tracksInc/deuteron/h2TofNsigmaDeuteronVsPt"), trk.tofNSigmaDe(), trk.pt(), centrality); } else { if (std::abs(trk.tpcNSigmaPr()) < cfgnTPCPIDPr) { - jetHist.fill(HIST("tracksInc/proton/h2TOFmassProtonVsPt"), massTOF, trk.pt()); - jetHist.fill(HIST("tracksInc/proton/h2TOFmass2ProtonVsPt"), massTOF * massTOF - gMassProton * gMassProton, trk.pt()); - jetHist.fill(HIST("tracksInc/proton/h2TofNsigmaProtonVsPt"), trk.tofNSigmaPr(), trk.pt()); + jetHist.fill(HIST("tracksInc/proton/h2TOFmassProtonVsPt"), massTOF, trk.pt(), centrality); + jetHist.fill(HIST("tracksInc/proton/h2TOFmass2ProtonVsPt"), massTOF * massTOF - gMassProton * gMassProton, trk.pt(), centrality); + jetHist.fill(HIST("tracksInc/proton/h2TofNsigmaProtonVsPt"), trk.tofNSigmaPr(), trk.pt(), centrality); } if (std::abs(trk.tpcNSigmaDe()) < cfgnTPCPIDDe) { - jetHist.fill(HIST("tracksInc/deuteron/h2TOFmassDeuteronVsPt"), massTOF, trk.pt()); - jetHist.fill(HIST("tracksInc/deuteron/h2TOFmass2DeuteronVsPt"), massTOF * massTOF - gMassDeuteron * gMassDeuteron, trk.pt()); - jetHist.fill(HIST("tracksInc/deuteron/h2TofNsigmaDeuteronVsPt"), trk.tofNSigmaDe(), trk.pt()); + jetHist.fill(HIST("tracksInc/deuteron/h2TOFmassDeuteronVsPt"), massTOF, trk.pt(), centrality); + jetHist.fill(HIST("tracksInc/deuteron/h2TOFmass2DeuteronVsPt"), massTOF * massTOF - gMassDeuteron * gMassDeuteron, trk.pt(), centrality); + jetHist.fill(HIST("tracksInc/deuteron/h2TofNsigmaDeuteronVsPt"), trk.tofNSigmaDe(), trk.pt(), centrality); } } } From 110118495f917c5fbdf0e13c166546e7d1f174f2 Mon Sep 17 00:00:00 2001 From: jaelpark Date: Wed, 30 Jul 2025 20:33:27 +0200 Subject: [PATCH 143/345] [PWGCF] Add generic 2-prong MC processor (#12335) --- PWGCF/TableProducer/filter2Prong.cxx | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/PWGCF/TableProducer/filter2Prong.cxx b/PWGCF/TableProducer/filter2Prong.cxx index deb190dd778..2c594636c9e 100644 --- a/PWGCF/TableProducer/filter2Prong.cxx +++ b/PWGCF/TableProducer/filter2Prong.cxx @@ -251,6 +251,29 @@ struct Filter2Prong { } PROCESS_SWITCH(Filter2Prong, processMC, "Process MC 2-prong daughters", false); + void processMCGeneric(aod::McCollisions::iterator const&, aod::CFMcParticleRefs const& cfmcparticles) + { + // The main filter outputs the primary MC particles. Here we just resolve the daughter indices that are needed for the efficiency matching. + for (const auto& r : cfmcparticles) { + const auto& mcParticle = r.mcParticle(); + if (mcParticle.daughtersIds().size() != 2) { + output2ProngMcParts(-1, -1, aod::cf2prongtrack::Generic2Prong); // not a 2-prong + continue; + } + int prongCFId[2] = {-1, -1}; + for (uint i = 0; i < 2; ++i) { + for (const auto& cfmcpart : cfmcparticles) { + if (mcParticle.daughtersIds()[i] == cfmcpart.mcParticleId()) { + prongCFId[i] = cfmcpart.globalIndex(); + break; + } + } + } + output2ProngMcParts(prongCFId[0], prongCFId[1], aod::cf2prongtrack::Generic2Prong); // the 2-prong Phi, for example, can be checked through its daughters + } + } + PROCESS_SWITCH(Filter2Prong, processMCGeneric, "Process generic MC 2-prong daughters", false); + template bool selectionTrack(const T& candidate) { From a3f5d7241f7d39f8c0052a3772eb2c9e4471e9b4 Mon Sep 17 00:00:00 2001 From: Giorgio Alberto Lucia <87222843+GiorgioAlbertoLucia@users.noreply.github.com> Date: Wed, 30 Jul 2025 21:09:13 +0200 Subject: [PATCH 144/345] [PWGLF] Process MC allows to store hadron-he3 pairs that do not come from the li4 decay (#12324) --- PWGLF/DataModel/LFhe3HadronTables.h | 15 +- PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx | 368 ++++++++++++------ 2 files changed, 253 insertions(+), 130 deletions(-) diff --git a/PWGLF/DataModel/LFhe3HadronTables.h b/PWGLF/DataModel/LFhe3HadronTables.h index f0dbc5cc3dd..07ce17853ea 100644 --- a/PWGLF/DataModel/LFhe3HadronTables.h +++ b/PWGLF/DataModel/LFhe3HadronTables.h @@ -36,6 +36,7 @@ DECLARE_SOA_COLUMN(DCAxyHe3, dcaxyHe3, float); DECLARE_SOA_COLUMN(DCAzHe3, dcazHe3, float); DECLARE_SOA_COLUMN(DCAxyHad, dcaxyHad, float); DECLARE_SOA_COLUMN(DCAzHad, dcazHad, float); +DECLARE_SOA_COLUMN(DCApair, dcapair, float); DECLARE_SOA_COLUMN(SignalTPCHe3, signalTPCHe3, float); DECLARE_SOA_COLUMN(InnerParamTPCHe3, innerParamTPCHe3, float); @@ -75,9 +76,12 @@ DECLARE_SOA_COLUMN(Multiplicity, multiplicity, uint16_t); DECLARE_SOA_COLUMN(CentralityFT0C, centFT0C, float); DECLARE_SOA_COLUMN(MultiplicityFT0C, multiplicityFT0C, float); -DECLARE_SOA_COLUMN(IsMotherLi4, isMotherLi4, bool); -DECLARE_SOA_COLUMN(IsHe3Primary, isHe3Primary, bool); -DECLARE_SOA_COLUMN(IsHadPrimary, isHadPrimary, bool); +/* Flags: 0 - both primary, + 1 - both from Li4, + 2 - both from hypertriton, + 3 - mixed pair (a primary and one from Li4/hypertriton/material/other decays or any other combination) +*/ +DECLARE_SOA_COLUMN(Flags, flags, uint8_t); } // namespace he3HadronTablesNS @@ -92,6 +96,7 @@ DECLARE_SOA_TABLE(he3HadronTable, "AOD", "HE3HADTABLE", he3HadronTablesNS::DCAzHe3, he3HadronTablesNS::DCAxyHad, he3HadronTablesNS::DCAzHad, + he3HadronTablesNS::DCApair, he3HadronTablesNS::SignalTPCHe3, he3HadronTablesNS::InnerParamTPCHe3, he3HadronTablesNS::SignalTPCHad, @@ -120,9 +125,7 @@ DECLARE_SOA_TABLE(he3HadronTableMC, "AOD", "HE3HADTABLEMC", he3HadronTablesNS::PhiMCHad, he3HadronTablesNS::SignedPtMC, he3HadronTablesNS::MassMC, - he3HadronTablesNS::IsMotherLi4, - he3HadronTablesNS::IsHe3Primary, - he3HadronTablesNS::IsHadPrimary) + he3HadronTablesNS::Flags) DECLARE_SOA_TABLE(he3HadronMult, "AOD", "HE3HADMULT", he3HadronTablesNS::CollisionId, he3HadronTablesNS::ZVertex, diff --git a/PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx b/PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx index 547d4b08c3b..f50262bd998 100644 --- a/PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx +++ b/PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx @@ -15,30 +15,9 @@ /// \author Your Name (your.email@cern.ch) /// \since April 2025 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include // std::prev - -#include "Framework/ASoAHelpers.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/StepTHn.h" +#include "PWGLF/DataModel/EPCalibrationTables.h" +#include "PWGLF/DataModel/LFhe3HadronTables.h" +#include "PWGLF/Utils/svPoolCreator.h" #include "Common/Core/PID/PIDTOF.h" #include "Common/Core/PID/TPCPIDResponse.h" @@ -52,21 +31,40 @@ #include "Common/DataModel/PIDResponseITS.h" #include "Common/DataModel/TrackSelectionTables.h" #include "Common/TableProducer/PID/pidTOFBase.h" - #include "EventFiltering/Zorro.h" #include "EventFiltering/ZorroSummary.h" #include "CCDB/BasicCCDBManager.h" -#include "DetectorsBase/Propagator.h" -#include "DetectorsBase/GeometryManager.h" -#include "DataFormatsTPC/BetheBlochAleph.h" -#include "DataFormatsParameters/GRPObject.h" #include "DataFormatsParameters/GRPMagField.h" +#include "DataFormatsParameters/GRPObject.h" +#include "DataFormatsTPC/BetheBlochAleph.h" +#include "DetectorsBase/GeometryManager.h" +#include "DetectorsBase/Propagator.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/StepTHn.h" +#include "Framework/runDataProcessing.h" #include "ReconstructionDataFormats/Track.h" -#include "PWGLF/DataModel/EPCalibrationTables.h" -#include "PWGLF/DataModel/LFhe3HadronTables.h" -#include "PWGLF/Utils/svPoolCreator.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include // std::prev +#include +#include using namespace o2; using namespace o2::framework; @@ -86,15 +84,12 @@ namespace constexpr double betheBlochDefault[1][6]{{-1.e32, -1.e32, -1.e32, -1.e32, -1.e32, -1.e32}}; static const std::vector betheBlochParNames{"p0", "p1", "p2", "p3", "p4", "resolution"}; -// constexpr float he3Mass = o2::constants::physics::MassHelium3; -// constexpr float protonMass = o2::constants::physics::MassProton; -// constexpr float pionchargedMass = o2::constants::physics::MassPiPlus; -constexpr int Li4PDG = 1000030040; +constexpr int Li4PDG = o2::constants::physics::Pdg::kLithium4; +constexpr int H3LPDG = o2::constants::physics::Pdg::kHyperTriton; constexpr int ProtonPDG = PDG_t::kProton; constexpr int PionPDG = PDG_t::kPiPlus; constexpr int He3PDG = o2::constants::physics::Pdg::kHelium3; constexpr float CommonInite = 0.0f; -// constexpr int pichargedPDG = 211; enum Selections { kNoCuts = 0, @@ -103,6 +98,21 @@ enum Selections { kAll }; +enum Flags { + kBothPrimaries = BIT(0), + kBothFromLi4 = BIT(1), + kBothFromHypertriton = BIT(2), + kMixedPair = BIT(3), // a primary and one from Li4/hypertriton/material/other decays (or any other combination) +}; + +enum ParticleFlags { + kPhysicalPrimary = BIT(0), // primary particle + kFromLi4 = BIT(1), // from Li4 decay + kFromHypertriton = BIT(2), // from hypertriton decay + kFromMaterial = BIT(3), // from material + kFromOtherDecays = BIT(4), // from other decays +}; + } // namespace struct He3HadCandidate { @@ -124,6 +134,7 @@ struct He3HadCandidate { float dcazHe3 = -10.f; float dcaxyHad = -10.f; float dcazHad = -10.f; + float dcaPair = -10.f; // DCA between the two tracks uint16_t tpcSignalHe3 = 0u; uint16_t tpcSignalHad = 0u; @@ -163,9 +174,9 @@ struct He3HadCandidate { float etaHadMC = -99.f; float phiHadMC = -99.f; - bool isHe3Primary = false; - bool isHadPrimary = false; - bool isMotherLi4 = false; + uint8_t flagsHe3 = 0; // flags for He3 + uint8_t flagsHad = 0; // flags for hadron + uint8_t flags = 0; // flags for the pair // collision information int32_t collisionID = 0; @@ -200,6 +211,7 @@ struct he3HadronFemto { Configurable settingSaveUSandLS{"settingSaveUSandLS", true, "Save All Pairs"}; Configurable settingIsMC{"settingIsMC", false, "Run MC"}; Configurable settingFillMultiplicity{"settingFillMultiplicity", false, "Fill multiplicity table"}; + Configurable settingFillPrimariesAndMixedMc{"settingFillPrimariesAndMixedMc", false, "Fill primary MC tracks and mixed tracks (e.g. a primary track and one from Li4)"}; // Zorro Configurable settingSkimmedProcessing{"settingSkimmedProcessing", false, "Skimmed dataset processing"}; @@ -250,30 +262,30 @@ struct he3HadronFemto { { {"hVtxZBefore", "Vertex distribution in Z before selections;Z (cm)", {HistType::kTH1F, {{400, -20.0, 20.0}}}}, {"hVtxZ", "Vertex distribution in Z;Z (cm)", {HistType::kTH1F, {{400, -20.0, 20.0}}}}, - {"hCentralityFT0A", ";Centrality FT0A", {HistType::kTH1F, {{100, 0, 100.0}}}}, - {"hCentralityFT0C", ";Centrality FT0C", {HistType::kTH1F, {{100, 0, 100.0}}}}, + {"hCentralityFT0A", ";Centrality FT0A (%)", {HistType::kTH1F, {{100, 0, 100.0}}}}, + {"hCentralityFT0C", ";Centrality FT0C (%)", {HistType::kTH1F, {{100, 0, 100.0}}}}, {"hNcontributor", "Number of primary vertex contributor", {HistType::kTH1F, {{2000, 0.0f, 2000.0f}}}}, {"hTrackSel", "Accepted tracks", {HistType::kTH1F, {{Selections::kAll, -0.5, static_cast(Selections::kAll) - 0.5}}}}, {"hEvents", "; Events;", {HistType::kTH1F, {{3, -0.5, 2.5}}}}, {"hEmptyPool", "svPoolCreator did not find track pairs false/true", {HistType::kTH1F, {{2, -0.5, 1.5}}}}, - {"hDCAxyHe3", ";DCA_{xy} (cm)", {HistType::kTH1F, {{200, -5.0f, 5.0f}}}}, - {"hDCAzHe3", ";DCA_{z} (cm)", {HistType::kTH1F, {{200, -1.0f, 1.0f}}}}, - {"hNClsHe3ITS", ";N_{ITS} Cluster", {HistType::kTH1F, {{20, -10.0f, 10.0f}}}}, - {"hNClsHadITS", ";N_{ITS} Cluster", {HistType::kTH1F, {{20, -10.0f, 10.0f}}}}, - {"hChi2NClHe3ITS", ";Chi2_{ITS} Ncluster", {HistType::kTH1F, {{100, 0, 100.0f}}}}, - {"hChi2NClHadITS", ";Chi2_{ITS} Ncluster", {HistType::kTH1F, {{100, 0, 100.0f}}}}, + {"hDCAxyHe3", "^{3}He;DCA_{xy} (cm)", {HistType::kTH1F, {{200, -5.0f, 5.0f}}}}, + {"hDCAzHe3", "^{3}He;DCA_{z} (cm)", {HistType::kTH1F, {{200, -1.0f, 1.0f}}}}, + {"hNClsHe3ITS", "^{3}He;N_{ITS} Cluster", {HistType::kTH1F, {{20, -10.0f, 10.0f}}}}, + {"hNClsHadITS", "had;N_{ITS} Cluster", {HistType::kTH1F, {{20, -10.0f, 10.0f}}}}, + {"hChi2NClHe3ITS", "^{3}He;Chi2_{ITS} Ncluster", {HistType::kTH1F, {{100, 0, 100.0f}}}}, + {"hChi2NClHadITS", "had;Chi2_{ITS} Ncluster", {HistType::kTH1F, {{100, 0, 100.0f}}}}, {"hhe3HadtInvMass", "; M(^{3}He + p) (GeV/#it{c}^{2})", {HistType::kTH1F, {{300, 3.74f, 4.34f}}}}, - {"hHe3Pt", "#it{p}_{T} distribution; #it{p}_{T} (GeV/#it{c})", {HistType::kTH1F, {{240, -6.0f, 6.0f}}}}, - {"hHadronPt", "Pt distribution; #it{p}_{T} (GeV/#it{c})", {HistType::kTH1F, {{120, -3.0f, 3.0f}}}}, + {"hHe3Pt", "^{3}He; #it{p}_{T} (GeV/#it{c})", {HistType::kTH1F, {{240, -6.0f, 6.0f}}}}, + {"hHadronPt", "had; #it{p}_{T} (GeV/#it{c})", {HistType::kTH1F, {{120, -3.0f, 3.0f}}}}, {"h2dEdxHe3candidates", "dEdx distribution; #it{p} (GeV/#it{c}); dE/dx (a.u.)", {HistType::kTH2F, {{200, -5.0f, 5.0f}, {100, 0.0f, 2000.0f}}}}, {"h2NsigmaHe3TPC", "NsigmaHe3 TPC distribution; #it{p}_{T} (GeV/#it{c}); n#sigma_{TPC}(^{3}He)", {HistType::kTH2F, {{20, -5.0f, 5.0f}, {200, -5.0f, 5.0f}}}}, {"h2NsigmaHe3TPC_preselection", "NsigmaHe3 TPC distribution; #it{p}_{T} (GeV/#it{c}); n#sigma_{TPC}(^{3}He)", {HistType::kTH2F, {{100, -5.0f, 5.0f}, {400, -10.0f, 10.0f}}}}, {"h2NSigmaHe3ITS_preselection", "NsigmaHe3 ITS distribution; signed #it{p}_{T} (GeV/#it{c}); n#sigma_{ITS} ^{3}He", {HistType::kTH2F, {{50, -5.0f, 5.0f}, {120, -3.0f, 3.0f}}}}, {"h2NSigmaHe3ITS", "NsigmaHe3 ITS distribution; signed #it{p}_{T} (GeV/#it{c}); n#sigma_{ITS} ^{3}He", {HistType::kTH2F, {{50, -5.0f, 5.0f}, {120, -3.0f, 3.0f}}}}, - {"h2NsigmaHadronTPC", "NsigmaHadron TPC distribution; #it{p}_{T}(GeV/#it{c}); n#sigma_{TPC}(p)", {HistType::kTH2F, {{20, -5.0f, 5.0f}, {200, -5.0f, 5.0f}}}}, - {"h2NsigmaHadronTPC_preselection", "NsigmaHe3 TPC distribution; #it{p}_{T} (GeV/#it{c}); n#sigma_{TPC}(^{3}He)", {HistType::kTH2F, {{100, -5.0f, 5.0f}, {400, -10.0f, 10.0f}}}}, - {"h2NsigmaHadronTOF", "NsigmaHadron TOF distribution; #it{p}_{T} (GeV/#it{c}); n#sigma_{TOF}(p)", {HistType::kTH2F, {{20, -5.0f, 5.0f}, {200, -5.0f, 5.0f}}}}, - {"h2NsigmaHadronTOF_preselection", "NsigmaHadron TOF distribution; #iit{p}_{T} (GeV/#it{c}); n#sigma_{TOF}(p)", {HistType::kTH2F, {{100, -5.0f, 5.0f}, {400, -10.0f, 10.0f}}}}, + {"h2NsigmaHadronTPC", "NsigmaHadron TPC distribution; #it{p}_{T}(GeV/#it{c}); n#sigma_{TPC}(had)", {HistType::kTH2F, {{20, -5.0f, 5.0f}, {200, -5.0f, 5.0f}}}}, + {"h2NsigmaHadronTPC_preselection", "NsigmaHe3 TPC distribution; #it{p}_{T} (GeV/#it{c}); n#sigma_{TPC}(had)", {HistType::kTH2F, {{100, -5.0f, 5.0f}, {400, -10.0f, 10.0f}}}}, + {"h2NsigmaHadronTOF", "NsigmaHadron TOF distribution; #it{p}_{T} (GeV/#it{c}); n#sigma_{TOF}(had)", {HistType::kTH2F, {{20, -5.0f, 5.0f}, {200, -5.0f, 5.0f}}}}, + {"h2NsigmaHadronTOF_preselection", "NsigmaHadron TOF distribution; #it{p}_{T} (GeV/#it{c}); n#sigma_{TOF}(had)", {HistType::kTH2F, {{100, -5.0f, 5.0f}, {400, -10.0f, 10.0f}}}}, }, OutputObjHandlingPolicy::AnalysisObject, false, @@ -370,13 +382,14 @@ struct he3HadronFemto { mQaRegistry.fill(HIST("hEvents"), 0); mQaRegistry.fill(HIST("hVtxZBefore"), collision.posZ()); + auto bc = collision.template bc_as(); + initCCDB(bc); + if constexpr (isMC) { if (/*!collision.sel8() ||*/ std::abs(collision.posZ()) > settingCutVertex) { return false; } } else { - auto bc = collision.template bc_as(); - initCCDB(bc); if (!collision.sel8() || std::abs(collision.posZ()) > settingCutVertex) { return false; @@ -516,53 +529,65 @@ struct he3HadronFemto { // ================================================================================================================== - template - bool fillCandidateInfo(const Ttrack& trackHe3, const Ttrack& trackHad, const CollBracket& collBracket, const Tcollisions& collisions, He3HadCandidate& he3Hadcand, const Ttracks& /*trackTable*/, bool isMixedEvent) + template + std::array getCollisionVertex(const Tcollisions& collisions, int32_t collisionID) { - const int numCoordinates = 3; - if (!isMixedEvent) { - auto trackCovHe3 = getTrackParCov(trackHe3); - auto trackCovHad = getTrackParCov(trackHad); - int nCand = CommonInite; - try { - nCand = mFitter.process(trackCovHe3, trackCovHad); - } catch (...) { - LOG(error) << "Exception caught in DCA fitter process call!"; - return false; - } - if (nCand == 0) { - return false; - } + auto collision = collisions.rawIteratorAt(collisionID); + std::array collisionVertex = {collision.posX(), collision.posY(), collision.posZ()}; + return collisionVertex; + } - // associate collision id as the one that minimises the distance between the vertex and the PCAs of the daughters - double distanceMin = -1; - unsigned int collIdxMin = 0; - const float defaultTodistance = 0.0f; - for (int collIdx = collBracket.getMin(); collIdx <= collBracket.getMax(); collIdx++) { - auto collision = collisions.rawIteratorAt(collIdx); - std::array collVtx = {collision.posX(), collision.posY(), collision.posZ()}; - const auto& pca = mFitter.getPCACandidate(); - float distance = defaultTodistance; - for (int i = 0; i < numCoordinates; i++) { - distance += (pca[i] - collVtx[i]) * (pca[i] - collVtx[i]); - } - if (distanceMin < 0 || distance < distanceMin) { - distanceMin = distance; - collIdxMin = collIdx; - } - } + template + int32_t getCollisionID(const Ttrack& trackHe3, const Ttrack& trackHad, const CollBracket& collBracket, const Tcollisions& collisions, bool isMixedEvent) + { + if (isMixedEvent) { + return collBracket.getMin(); + } - if (!mGoodCollisions[collIdxMin]) { - return false; + auto trackCovHe3 = getTrackParCov(trackHe3); + auto trackCovHad = getTrackParCov(trackHad); + int nCand = CommonInite; + try { + nCand = mFitter.process(trackCovHe3, trackCovHad); + } catch (...) { + LOG(error) << "Exception caught in DCA fitter process call!"; + return false; + } + if (nCand == 0) { + return false; + } + + // associate collision id as the one that minimises the distance between the vertex and the PCAs of the daughters + double distanceMin = -1; + unsigned int collIdxMin = 0; + const float defaultTodistance = 0.0f; + for (int collIdx = collBracket.getMin(); collIdx <= collBracket.getMax(); collIdx++) { + std::array collisionVertex = getCollisionVertex(collisions, collIdx); + const auto& pca = mFitter.getPCACandidate(); + float distance = defaultTodistance; + for (int i = 0; i < 3; i++) { + distance += (pca[i] - collisionVertex[i]) * (pca[i] - collisionVertex[i]); + } + if (distanceMin < 0 || distance < distanceMin) { + distanceMin = distance; + collIdxMin = collIdx; } - he3Hadcand.collisionID = collIdxMin; + } - } else { - he3Hadcand.collisionID = collBracket.getMin(); + if (!mGoodCollisions[collIdxMin]) { + return false; } + return collIdxMin; + } + + template + bool fillCandidateInfo(const Ttrack& trackHe3, const Ttrack& trackHad, const CollBracket& collBracket, const Tcollisions& collisions, He3HadCandidate& he3Hadcand, const Ttracks& /*trackTable*/, bool isMixedEvent) + { + he3Hadcand.collisionID = getCollisionID(trackHe3, trackHad, collBracket, collisions, isMixedEvent); + std::array collisionVertex = getCollisionVertex(collisions, he3Hadcand.collisionID); he3Hadcand.momHe3 = std::array{trackHe3.px(), trackHe3.py(), trackHe3.pz()}; - for (int i = 0; i < numCoordinates; i++) + for (int i = 0; i < 3; i++) he3Hadcand.momHe3[i] = he3Hadcand.momHe3[i] * 2; he3Hadcand.momHad = std::array{trackHad.px(), trackHad.py(), trackHad.pz()}; float invMass = CommonInite; @@ -585,10 +610,20 @@ struct he3HadronFemto { he3Hadcand.signHe3 = trackHe3.sign(); he3Hadcand.signHad = trackHad.sign(); - he3Hadcand.dcaxyHe3 = trackHe3.dcaXY(); - he3Hadcand.dcaxyHad = trackHad.dcaXY(); - he3Hadcand.dcazHe3 = trackHe3.dcaZ(); - he3Hadcand.dcazHad = trackHad.dcaZ(); + // he3Hadcand.dcaxyHe3 = trackHe3.dcaXY(); + // he3Hadcand.dcaxyHad = trackHad.dcaXY(); + // he3Hadcand.dcazHe3 = trackHe3.dcaZ(); + // he3Hadcand.dcazHad = trackHad.dcaZ(); + auto trackCovHe3 = getTrackParCov(trackHe3); + auto trackCovHad = getTrackParCov(trackHad); + std::array dcaInfo; + o2::base::Propagator::Instance()->propagateToDCABxByBz({collisionVertex[0], collisionVertex[1], collisionVertex[2]}, trackCovHe3, 2.f, mFitter.getMatCorrType(), &dcaInfo); + he3Hadcand.dcaxyHe3 = dcaInfo[0]; + he3Hadcand.dcazHe3 = dcaInfo[1]; + o2::base::Propagator::Instance()->propagateToDCABxByBz({collisionVertex[0], collisionVertex[1], collisionVertex[2]}, trackCovHad, 2.f, mFitter.getMatCorrType(), &dcaInfo); + he3Hadcand.dcaxyHad = dcaInfo[0]; + he3Hadcand.dcazHad = dcaInfo[1]; + he3Hadcand.dcaPair = std::sqrt(std::abs(mFitter.getChi2AtPCACandidate())); he3Hadcand.tpcSignalHe3 = trackHe3.tpcSignal(); bool heliumPID = trackHe3.pidForTracking() == o2::track::PID::Helium3 || trackHe3.pidForTracking() == o2::track::PID::Alpha; @@ -645,15 +680,12 @@ struct he3HadronFemto { template void fillCandidateInfoMC(const Mc& mctrackHe3, const Mc& mctrackHad, He3HadCandidate& he3Hadcand) { - LOG(info) << "--------------------------Filling candidate info MC"; he3Hadcand.momHe3MC = mctrackHe3.pt() * (mctrackHe3.pdgCode() > 0 ? 1 : -1); he3Hadcand.etaHe3MC = mctrackHe3.eta(); he3Hadcand.phiHe3MC = mctrackHe3.phi(); he3Hadcand.momHadMC = mctrackHad.pt() * (mctrackHad.pdgCode() > 0 ? 1 : -1); he3Hadcand.etaHadMC = mctrackHad.eta(); he3Hadcand.phiHadMC = mctrackHad.phi(); - he3Hadcand.isHe3Primary = mctrackHe3.isPhysicalPrimary(); - he3Hadcand.isHadPrimary = mctrackHad.isPhysicalPrimary(); } template @@ -662,7 +694,6 @@ struct he3HadronFemto { he3Hadcand.l4PtMC = mctrackMother.pt() * (mctrackMother.pdgCode() > 0 ? 1 : -1); const double eLit = mctrackHe3.e() + mctrackHad.e(); he3Hadcand.l4MassMC = std::sqrt(eLit * eLit - mctrackMother.p() * mctrackMother.p()); - he3Hadcand.isMotherLi4 = std::abs(mctrackMother.pdgCode()) == Li4PDG; } template @@ -749,6 +780,7 @@ struct he3HadronFemto { he3Hadcand.dcazHe3, he3Hadcand.dcaxyHad, he3Hadcand.dcazHad, + he3Hadcand.dcaPair, he3Hadcand.tpcSignalHe3, he3Hadcand.momHe3TPC, he3Hadcand.tpcSignalHad, @@ -778,9 +810,7 @@ struct he3HadronFemto { he3Hadcand.phiHadMC, he3Hadcand.l4PtMC, he3Hadcand.l4MassMC, - he3Hadcand.isMotherLi4, - he3Hadcand.isHe3Primary, - he3Hadcand.isHadPrimary); + he3Hadcand.flags); } if (settingFillMultiplicity) { outputMultiplicityTable( @@ -826,6 +856,67 @@ struct he3HadronFemto { } } + template + void setMcParticleFlag(const TmcParticle& mcParticle, std::vector& mothers, uint8_t& flag) + { + if (mcParticle.isPhysicalPrimary()) { + + flag |= ParticleFlags::kPhysicalPrimary; + if (!mcParticle.has_mothers()) { + return; + } + + for (const auto& mother : mcParticle.template mothers_as()) { + mothers.push_back(mother.globalIndex()); + if (std::abs(mother.pdgCode()) == Li4PDG) { + flag |= ParticleFlags::kFromLi4; + } else if (std::abs(mother.pdgCode()) == H3LPDG) { + flag |= ParticleFlags::kFromHypertriton; + } else { + flag |= ParticleFlags::kFromOtherDecays; + } + } + + } else { + + if (!mcParticle.has_mothers()) { + flag |= ParticleFlags::kFromMaterial; + return; + } + + for (const auto& mother : mcParticle.template mothers_as()) { + mothers.push_back(mother.globalIndex()); + if (std::abs(mother.pdgCode()) == Li4PDG) { + flag |= ParticleFlags::kFromLi4; + } else if (std::abs(mother.pdgCode()) == H3LPDG) { + flag |= ParticleFlags::kFromHypertriton; + } else { + flag |= ParticleFlags::kFromOtherDecays; + } + } + } + } + + void searchForCommonMotherTrack(const std::vector& motherHe3Idxs, const std::vector& motherHadIdxs, const aod::McParticles& mcParticles, McIter& motherParticle, He3HadCandidate& he3Hadcand, bool& isMixedPair, const int motherPdgCode) + { + std::unordered_set motherHe3SetIdxs(motherHe3Idxs.begin(), motherHe3Idxs.end()); + for (const auto& motherHadIdx : motherHadIdxs) { + if (!motherHe3SetIdxs.contains(motherHadIdx)) { + continue; + } + + motherParticle = mcParticles.rawIteratorAt(motherHadIdx); + if (std::abs(motherParticle.pdgCode()) != motherPdgCode || std::abs(motherParticle.y()) > 1) { + continue; + } + isMixedPair = false; + break; + } + if (!isMixedPair) { + he3Hadcand.flags |= Flags::kBothFromLi4; + } + } + template void fillMcParticles(const Tcollisions& collisions, const TmcParticles& mcParticles, std::vector& filledMothers) { @@ -948,29 +1039,58 @@ struct he3HadronFemto { auto mctrackHe3 = heTrack.mcParticle(); auto mctrackHad = prTrack.mcParticle(); - if (std::abs(mctrackHe3.pdgCode()) != He3PDG || std::abs(mctrackHad.pdgCode()) != ProtonPDG) { + if (std::abs(mctrackHe3.pdgCode()) != He3PDG || std::abs(mctrackHad.pdgCode()) != settingHadPDGCode) { continue; } - for (const auto& mothertrack : mctrackHe3.mothers_as()) { - for (const auto& mothertrackHad : mctrackHad.mothers_as()) { - - if (mothertrack != mothertrackHad || std::abs(mothertrack.pdgCode()) != Li4PDG || std::abs(mothertrack.y()) > 1) { - continue; - } - - He3HadCandidate he3Hadcand; - if (!fillCandidateInfo(heTrack, prTrack, collBracket, collisions, he3Hadcand, tracks, /*mix*/ false)) { - continue; - } - fillCandidateInfoMC(mctrackHe3, mctrackHad, he3Hadcand); - fillMotherInfoMC(mctrackHe3, mctrackHad, mothertrack, he3Hadcand); - fillHistograms(he3Hadcand); - auto collision = collisions.rawIteratorAt(he3Hadcand.collisionID); - fillTable(he3Hadcand, collision, /*isMC*/ true); - filledMothers.push_back(mothertrack.globalIndex()); + He3HadCandidate he3Hadcand; + McIter motherParticle; + std::vector motherHe3Idxs, motherHadIdxs; + setMcParticleFlag(mctrackHe3, motherHe3Idxs, he3Hadcand.flagsHe3); + setMcParticleFlag(mctrackHad, motherHadIdxs, he3Hadcand.flagsHad); + + bool isMixedPair = true; + + if ((he3Hadcand.flagsHe3 == ParticleFlags::kPhysicalPrimary && he3Hadcand.flagsHad == ParticleFlags::kPhysicalPrimary)) { + he3Hadcand.flags |= Flags::kBothPrimaries; + isMixedPair = false; + + } else if ((he3Hadcand.flagsHe3 & ParticleFlags::kFromLi4) && (he3Hadcand.flagsHad & ParticleFlags::kFromLi4)) { + + searchForCommonMotherTrack(motherHe3Idxs, motherHadIdxs, mcParticles, motherParticle, he3Hadcand, isMixedPair, Li4PDG); + if (!isMixedPair) { + he3Hadcand.flags |= Flags::kBothFromLi4; + } + + } else if ((he3Hadcand.flagsHe3 & ParticleFlags::kFromHypertriton) && (he3Hadcand.flagsHad & ParticleFlags::kFromHypertriton)) { + + searchForCommonMotherTrack(motherHe3Idxs, motherHadIdxs, mcParticles, motherParticle, he3Hadcand, isMixedPair, H3LPDG); + if (!isMixedPair) { + he3Hadcand.flags |= Flags::kBothFromHypertriton; } } + + if (isMixedPair) { + he3Hadcand.flags |= Flags::kMixedPair; + } + + if (!settingFillPrimariesAndMixedMc && ((he3Hadcand.flags == Flags::kMixedPair) || he3Hadcand.flags == Flags::kBothPrimaries)) { + continue; + } + + if (!fillCandidateInfo(heTrack, prTrack, collBracket, collisions, he3Hadcand, tracks, /*mix*/ false)) { + continue; + } + fillCandidateInfoMC(mctrackHe3, mctrackHad, he3Hadcand); + + if ((he3Hadcand.flags == Flags::kBothFromLi4) || (he3Hadcand.flags == Flags::kBothFromHypertriton)) { + fillMotherInfoMC(mctrackHe3, mctrackHad, motherParticle, he3Hadcand); + filledMothers.push_back(motherParticle.globalIndex()); + } + + fillHistograms(he3Hadcand); + auto collision = collisions.rawIteratorAt(he3Hadcand.collisionID); + fillTable(he3Hadcand, collision, /*isMC*/ true); } } From 4aee3a19c56a9070ec3b1381796599bf844a0722 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Wed, 30 Jul 2025 21:10:11 +0200 Subject: [PATCH 145/345] [Common] improve handling of PVz QA histograms (#12287) Co-authored-by: ALICE Builder From 2f35eb712e548d69694345afaead9970840fc632 Mon Sep 17 00:00:00 2001 From: Matteo Morgante Date: Wed, 30 Jul 2025 22:17:45 +0200 Subject: [PATCH 146/345] [PWGLF] Corrected error in accessing McCollision indices (#12316) Co-authored-by: ALICE Action Bot --- PWGLF/TableProducer/Strangeness/sigmaminustask.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/sigmaminustask.cxx b/PWGLF/TableProducer/Strangeness/sigmaminustask.cxx index d60109009a5..fbf5929effc 100644 --- a/PWGLF/TableProducer/Strangeness/sigmaminustask.cxx +++ b/PWGLF/TableProducer/Strangeness/sigmaminustask.cxx @@ -114,7 +114,7 @@ struct sigmaminustask { } PROCESS_SWITCH(sigmaminustask, processData, "Data processing", true); - void processMC(CollisionsFullMC const& collisions, aod::KinkCands const& KinkCands, aod::McTrackLabels const& trackLabelsMC, aod::McParticles const& particlesMC, TracksFull const&) + void processMC(CollisionsFullMC const& collisions, aod::KinkCands const& KinkCands, aod::McTrackLabels const& trackLabelsMC, aod::McParticles const& particlesMC, aod::McCollisions const&, TracksFull const&) { for (const auto& collision : collisions) { if (std::abs(collision.posZ()) > cutzvertex || !collision.sel8()) { @@ -167,8 +167,10 @@ struct sigmaminustask { float decayRadiusMC = std::sqrt(deltaXMother * deltaXMother + deltaYMother * deltaYMother); // Check coherence of MCcollision Id for daughter MCparticle and reconstructed collision - auto mcCollision = mcTrackPiDau.template mcCollision_as(); - bool mcCollisionIdCheck = collision.mcCollisionId() == mcCollision.globalIndex(); + bool mcCollisionIdCheck = false; + if (collision.has_mcCollision()) { + mcCollisionIdCheck = collision.mcCollision().globalIndex() == mcTrackPiDau.mcCollisionId(); + } rSigmaMinus.fill(HIST("h2MassPtMCRec"), kinkCand.mothSign() * kinkCand.ptMoth(), kinkCand.mSigmaMinus()); if (mcTrackSigma.pdgCode() > 0) { From fcea16d11ae0d67f939db4cde64991ada2535400 Mon Sep 17 00:00:00 2001 From: arossi81 Date: Wed, 30 Jul 2025 23:10:12 +0200 Subject: [PATCH 147/345] =?UTF-8?q?[DPG]=20Allowing=20to=20avoid=20collisi?= =?UTF-8?q?on=20index=20in=20track=20table.=20This=20is=20needed/usef?= =?UTF-8?q?=E2=80=A6=20(#12333)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DPG/Tasks/ITS/filterTracks.cxx | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/DPG/Tasks/ITS/filterTracks.cxx b/DPG/Tasks/ITS/filterTracks.cxx index dc9c8ef777f..ed35c1dd95c 100644 --- a/DPG/Tasks/ITS/filterTracks.cxx +++ b/DPG/Tasks/ITS/filterTracks.cxx @@ -112,8 +112,9 @@ DECLARE_SOA_TABLE(FilterCollPos, "AOD", "FILTERCOLLPOS", o2::aod::collision::Chi2, o2::aod::collision::NumContrib, o2::aod::collision::CollisionTime); +DECLARE_SOA_TABLE(FiltTrackColIdx, "AOD", "FILTTRACKCOLIDX", + o2::aod::track::CollisionId); DECLARE_SOA_TABLE(FilterTrack, "AOD", "FILTERTRACK", - o2::aod::track::CollisionId, aod::filtertracks::IsInsideBeamPipe, o2::aod::track::TrackType, o2::aod::track::X, @@ -166,6 +167,7 @@ DECLARE_SOA_TABLE(GenParticles, "AOD", "GENPARTICLES", struct FilterTracks { const static int nStudiedParticlesMc = 3; + Produces filteredTracksCollIdx; Produces filteredTracksTableExtra; Produces filteredTracksTable; Produces filteredTracksTableExtraDet; @@ -182,7 +184,7 @@ struct FilterTracks { Configurable trackPtSampling{"trackPtSampling", 0, "track sampling mode"}; Configurable produceCollTableFull{"produceCollTableFull", false, "produce full collision table"}; Configurable produceCollTableLite{"produceCollTableLite", false, "produce lite collision table"}; - Configurable produceCollTableExtraLite{"produceCollTableExtraLite", true, "produce extra lite collision table"}; + Configurable produceCollTableExtraLite{"produceCollTableExtraLite", 2, "produce extra lite collision table"}; Configurable trackPtWeightLowPt{"trackPtWeightLowPt", 0.01f, "trackPtWeightLowPt"}; Configurable trackPtWeightMidPt{"trackPtWeightMidPt", 0.10f, "trackPtWeightMidPt"}; Configurable collFilterFraction{"collFilterFraction", 0.05f, "collFilterFraction"}; @@ -218,8 +220,9 @@ struct FilterTracks { void fillTableData(auto track) { + filteredTracksCollIdx(track.collisionId()); filteredTracksTableExtra(track.pt(), track.eta(), track.sign(), track.dcaXY(), track.dcaZ(), track.sigmaDcaXY2(), track.sigmaDcaZ2(), track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr(), track.tofNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPr()); - filteredTracksTable(track.collisionId(), track.isWithinBeamPipe() ? 1 : 0, track.trackType(), track.x(), track.alpha(), track.y(), track.z(), track.snp(), track.tgl(), track.signed1Pt()); + filteredTracksTable(track.isWithinBeamPipe() ? 1 : 0, track.trackType(), track.x(), track.alpha(), track.y(), track.z(), track.snp(), track.tgl(), track.signed1Pt()); filteredTracksTableExtraDet(track.itsClusterSizes(), track.itsChi2NCl(), track.tpcChi2NCl(), track.tpcNClsFound(), track.trackTime()); } @@ -302,19 +305,31 @@ struct FilterTracks { if (trackPtSampling == 0) { for (auto const& track : tracks) { fillTableData(track); + if (produceCollTableExtraLite == 2) { + filterCollPosTable(collision.posX(), collision.posY(), collision.posZ(), collision.chi2(), collision.numContrib(), collision.collisionTime()); + }; } } else { auto lowPtTracksThisColl = lowPtTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); for (auto const& track : lowPtTracksThisColl) { fillTableData(track); + if (produceCollTableExtraLite == 2) { + filterCollPosTable(collision.posX(), collision.posY(), collision.posZ(), collision.chi2(), collision.numContrib(), collision.collisionTime()); + }; } auto midPtTracksThisColl = midPtTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); for (auto const& track : midPtTracksThisColl) { fillTableData(track); + if (produceCollTableExtraLite == 2) { + filterCollPosTable(collision.posX(), collision.posY(), collision.posZ(), collision.chi2(), collision.numContrib(), collision.collisionTime()); + }; } auto highPtTracksThisColl = highPtTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); for (auto const& track : highPtTracksThisColl) { fillTableData(track); + if (produceCollTableExtraLite == 2) { + filterCollPosTable(collision.posX(), collision.posY(), collision.posZ(), collision.chi2(), collision.numContrib(), collision.collisionTime()); + }; } } } @@ -325,7 +340,7 @@ struct FilterTracks { filterCollTable(collision.bcId(), collision.posX(), collision.posY(), collision.posZ(), collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ(), collision.flags(), collision.chi2(), collision.numContrib(), collision.collisionTime(), collision.collisionTimeRes()); if (produceCollTableLite) filterCollLiteTable(collision.posX(), collision.posY(), collision.posZ(), collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ(), collision.chi2(), collision.numContrib(), collision.collisionTime()); - if (produceCollTableExtraLite) + if (produceCollTableExtraLite == 1) filterCollPosTable(collision.posX(), collision.posY(), collision.posZ(), collision.chi2(), collision.numContrib(), collision.collisionTime()); } PROCESS_SWITCH(FilterTracks, processCollisions, "process collisions", true); From 53c0b42403b7761aa847d1688551aa6dc40d68cf Mon Sep 17 00:00:00 2001 From: Shirajum Monira <38348689+Eloviyo@users.noreply.github.com> Date: Thu, 31 Jul 2025 00:15:30 +0200 Subject: [PATCH 148/345] [PWGCF] FemtoUniverse cascade task -- added MC truth process function for cascade-cascade pairs (#12338) Co-authored-by: Shirajum Monira --- ...toUniversePairTaskTrackCascadeExtended.cxx | 70 ++++++++++++++++++- 1 file changed, 69 insertions(+), 1 deletion(-) diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx index f8b2582826d..11d1bf2418e 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx @@ -790,7 +790,7 @@ struct femtoUniversePairTaskTrackCascadeExtended { } PROCESS_SWITCH(femtoUniversePairTaskTrackCascadeExtended, processMixedEventCascBitmask, "Enable processing mixed event for cascade - cascade using bitmask for PID", false); - // MC truth + // MC truth for track - cascade void processSameEventMCgen(const FilteredFDCollision& col, [[maybe_unused]] const aod::FDParticles& parts) { const int multCol = confUseCent ? col.multV0M() : col.multNtr(); @@ -835,6 +835,44 @@ struct femtoUniversePairTaskTrackCascadeExtended { } PROCESS_SWITCH(femtoUniversePairTaskTrackCascadeExtended, processSameEventMCgen, "Enable processing same event MC truth for track - cascade", false); + // MC truth for cascade - cascade + void processSameEventCascMCgen(const FilteredFDCollision& col, [[maybe_unused]] const aod::FDParticles& parts) + { + const int multCol = confUseCent ? col.multV0M() : col.multNtr(); + + auto groupPartsTwo = partsTwoMCgenBasic->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); + + eventHisto.fillQA(col); + + for (const auto& part : groupPartsTwo) { + int pdgCode = static_cast(part.pidCut()); + if ((confCascType1 == 0 && pdgCode != kOmegaMinus) || (confCascType1 == 2 && pdgCode != kOmegaPlusBar) || (confCascType1 == 1 && pdgCode != kXiMinus) || (confCascType1 == 3 && pdgCode != kXiPlusBar)) + continue; + + cascQAHistos.fillQA(part); + + auto pairProcessFunc = [&](auto& p1, auto& p2) -> void { + int pdgCodeCasc1 = static_cast(p1.pidCut()); + if ((confCascType1 == 0 && pdgCodeCasc1 != kOmegaMinus) || (confCascType1 == 2 && pdgCodeCasc1 != kOmegaPlusBar) || (confCascType1 == 1 && pdgCodeCasc1 != kXiMinus) || (confCascType1 == 3 && pdgCodeCasc1 != kXiPlusBar)) + return; + int pdgCodeCasc2 = static_cast(p2.pidCut()); + if ((confCascType2 == 0 && pdgCodeCasc2 != kOmegaMinus) || (confCascType2 == 2 && pdgCodeCasc2 != kOmegaPlusBar) || (confCascType2 == 1 && pdgCodeCasc2 != kXiMinus) || (confCascType2 == 3 && pdgCodeCasc2 != kXiPlusBar)) + return; + sameEventCont.setPair(p1, p2, multCol, confUse3D, 1.0f); + }; + + if (confCascType1 == confCascType2) { + for (const auto& [p1, p2] : combinations(CombinationsStrictlyUpperIndexPolicy(groupPartsTwo, groupPartsTwo))) + pairProcessFunc(p1, p2); + } else { + for (const auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsTwo, groupPartsTwo))) + pairProcessFunc(p1, p2); + } + } + } + PROCESS_SWITCH(femtoUniversePairTaskTrackCascadeExtended, processSameEventCascMCgen, "Enable processing same event MC truth for cascade - cascade", false); + + // MC truth for track - cascade void processMixedEventMCgen(const FilteredFDCollisions& cols, [[maybe_unused]] const aod::FDParticles& parts) { ColumnBinningPolicy colBinning{{confVtxBins, confMultBins}, true}; @@ -863,6 +901,36 @@ struct femtoUniversePairTaskTrackCascadeExtended { } PROCESS_SWITCH(femtoUniversePairTaskTrackCascadeExtended, processMixedEventMCgen, "Enable processing mixed event MC truth for track - cascade", false); + // MC truth for cascade - cascade + void processMixedEventCascMCgen(const FilteredFDCollisions& cols, [[maybe_unused]] const aod::FDParticles& parts) + { + ColumnBinningPolicy colBinning{{confVtxBins, confMultBins}, true}; + + for (const auto& [collision1, collision2] : soa::selfCombinations(colBinning, 5, -1, cols, cols)) { + const int multCol = confUseCent ? collision1.multV0M() : collision1.multNtr(); + + auto groupPartsOne = partsTwoMCgenBasic->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); + auto groupPartsTwo = partsTwoMCgenBasic->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache); + + const auto& magFieldTesla1 = collision1.magField(); + const auto& magFieldTesla2 = collision2.magField(); + + if (magFieldTesla1 != magFieldTesla2) { + continue; + } + for (const auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) { + int pdgCodeCasc1 = static_cast(p1.pidCut()); + if ((confCascType1 == 0 && pdgCodeCasc1 != kOmegaMinus) || (confCascType1 == 2 && pdgCodeCasc1 != kOmegaPlusBar) || (confCascType1 == 1 && pdgCodeCasc1 != kXiMinus) || (confCascType1 == 3 && pdgCodeCasc1 != kXiPlusBar)) + continue; + int pdgCodeCasc2 = static_cast(p2.pidCut()); + if ((confCascType2 == 0 && pdgCodeCasc2 != kOmegaMinus) || (confCascType2 == 2 && pdgCodeCasc2 != kOmegaPlusBar) || (confCascType2 == 1 && pdgCodeCasc2 != kXiMinus) || (confCascType2 == 3 && pdgCodeCasc2 != kXiPlusBar)) + continue; + mixedEventCont.setPair(p1, p2, multCol, confUse3D, 1.0f); + } + } + } + PROCESS_SWITCH(femtoUniversePairTaskTrackCascadeExtended, processMixedEventCascMCgen, "Enable processing mixed event MC truth for cascade - cascade", false); + /// This function fills MC truth particles from derived MC table void processMCgen(aod::FDParticles const& parts) { From 236e85188663d8aea44a49a8389689803cc4ccf3 Mon Sep 17 00:00:00 2001 From: dajones2 <140733426+dajones2@users.noreply.github.com> Date: Thu, 31 Jul 2025 00:10:49 +0100 Subject: [PATCH 149/345] [PWGJE] Adding outlier cut QA (#12225) --- PWGJE/Tasks/jetHadronRecoil.cxx | 41 +++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/PWGJE/Tasks/jetHadronRecoil.cxx b/PWGJE/Tasks/jetHadronRecoil.cxx index c06ba1ebb1a..22eecf4098e 100644 --- a/PWGJE/Tasks/jetHadronRecoil.cxx +++ b/PWGJE/Tasks/jetHadronRecoil.cxx @@ -129,6 +129,8 @@ struct JetHadronRecoil { {"hEtaTrack", "Track #eta;#eta;entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}}, {"hPhiTrack", "Track #phi;#phi;entries", {HistType::kTH1F, {{100, 0.0, o2::constants::math::TwoPI}}}}, {"hTrack3D", "3D tracks histogram;p_{T};#eta;#phi", {HistType::kTH3F, {{200, 0, 200}, {100, -1.0, 1.0}, {100, 0.0, o2::constants::math::TwoPI}}}}, + {"hTrackPtHard", "Tracks vs pThard;#frac{p_{T}}{#hat{p}};p_{T}", {HistType::kTH2F, {{20, 0, 5}, {200, 0, 200}}}}, + {"hPartPtHard", "Part vs pThard;#frac{p_{T}}{#hat{p}};p_{T}", {HistType::kTH2F, {{20, 0, 5}, {200, 0, 200}}}}, {"hPtTrackPtHard", "Track p_{T} vs #hat{p};p_{T};#frac{p_{T}}{#hat{p}}", {HistType::kTH2F, {{200, 0, 200}, {20, 0, 5}}}}, {"hConstituents3D", "3D constituents histogram;p_{T};#eta;#phi", {HistType::kTH3F, {{200, 0, 200}, {100, -1.0, 1.0}, {100, 0.0, o2::constants::math::TwoPI}}}}, {"hReferencePtDPhi", "jet p_{T} vs DPhi;#Delta#phi;p_{T,jet}", {HistType::kTH2F, {{100, 0, o2::constants::math::TwoPI}, {500, -100, 400}}}}, @@ -146,6 +148,8 @@ struct JetHadronRecoil { {"hJetEta", "jet #eta;#eta_{jet};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}}, {"hJetPhi", "jet #phi;#phi_{jet};entries", {HistType::kTH1F, {{100, 0.0, o2::constants::math::TwoPI}}}}, {"hJet3D", "3D jet distribution;p_{T};#eta;#phi", {HistType::kTH3F, {{500, -100, 400}, {100, -1.0, 1.0}, {100, 0.0, o2::constants::math::TwoPI}}}}, + {"hTracksvsJets", "comparing leading tracks and jets;p_{T,track};p_{T,jet};#hat{p}", {HistType::kTH3F, {{200, 0, 200}, {500, -100, 400}, {195, 5, 200}}}}, + {"hPartvsJets", "comparing leading particles and jets;p_{T,part};p_{T,jet};#hat{p}", {HistType::kTH3F, {{200, 0, 200}, {500, -100, 400}, {195, 5, 200}}}}, {"hPtPart", "Particle p_{T};p_{T};entries", {HistType::kTH1F, {{200, 0, 200}}}}, {"hEtaPart", "Particle #eta;#eta;entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}}, {"hPhiPart", "Particle #phi;#phi;entries", {HistType::kTH1F, {{100, 0.0, o2::constants::math::TwoPI}}}}, @@ -177,7 +181,7 @@ struct JetHadronRecoil { {"hPtMatched1d", "p_{T} matching 1d;p_{T,part}", {HistType::kTH1F, {{400, 0, 400}}}}, {"hDeltaRMatched1d", "#DeltaR matching 1d;#DeltaR_{part}", {HistType::kTH1F, {dRAxisPart}}}, {"hPtResolution", "p_{T} resolution;p_{T,part};Relative Resolution", {HistType::kTH2F, {{400, 0, 400}, {1000, -5.0, 5.0}}}}, - {"hPhiResolution", "#phi resolution;#p{T,part};Resolution", {HistType::kTH2F, {{400, 0, 400}, {1000, -7.0, 7.0}}}}, + {"hPhiResolution", "#phi resolution;#p_{T,part};Resolution", {HistType::kTH2F, {{400, 0, 400}, {1000, -7.0, 7.0}}}}, {"hDeltaRResolution", "#DeltaR Resolution;p_{T,part};Resolution", {HistType::kTH2F, {{400, 0, 400}, {1000, -0.15, 0.15}}}}, {"hFullMatching", "Full 6D matching;p_{T,det};p_{T,part};#phi_{det};#phi_{part};#DeltaR_{det};#DeltaR_{part}", {HistType::kTHnSparseD, {ptAxisDet, ptAxisPart, phiAxisDet, phiAxisPart, dRAxisDet, dRAxisPart}}}}}; @@ -210,11 +214,16 @@ struct JetHadronRecoil { bool isSigCol; std::vector phiTTAr; std::vector ptTTAr; + std::vector tracksAr; double phiTT = 0; double ptTT = 0; + double ptRandTrack = 0; int trigNumber = 0; + int trackNumber = 0; int nTT = 0; double leadingPT = 0; + double leadingTrackPt = 0; + double leadingJetPt = 0; float rhoReference = rho + rhoReferenceShift; float dice = rand->Rndm(); @@ -227,6 +236,10 @@ struct JetHadronRecoil { if (!jetderiveddatautilities::selectTrack(track, trackSelection)) { continue; } + tracksAr.push_back(track.pt()); + if (track.pt() > leadingTrackPt) { + leadingTrackPt = track.pt(); + } if (track.pt() > pTHatTrackMaxMCD * pTHat) { if (outlierRejectEvent) { return; @@ -253,6 +266,10 @@ struct JetHadronRecoil { registry.fill(HIST("hPtTrackPtHard"), track.pt(), track.pt() / pTHat, weight); } + trackNumber = rand->Integer(tracksAr.size()); + ptRandTrack = tracksAr[trackNumber]; + registry.fill(HIST("hTrackPtHard"), ptRandTrack / pTHat, ptRandTrack, weight); + if (nTT > 0) { trigNumber = rand->Integer(nTT); phiTT = phiTTAr[trigNumber]; @@ -274,6 +291,9 @@ struct JetHadronRecoil { } } for (const auto& jet : jets) { + if (jet.pt() > leadingJetPt) { + leadingJetPt = jet.pt(); + } if (jet.pt() > pTHatMaxMCD * pTHat) { if (outlierRejectEvent) { return; @@ -335,6 +355,7 @@ struct JetHadronRecoil { } } } + registry.fill(HIST("hTracksvsJets"), leadingTrackPt, leadingJetPt, pTHat, weight); } template @@ -343,11 +364,15 @@ struct JetHadronRecoil { bool isSigCol; std::vector phiTTAr; std::vector ptTTAr; + std::vector partAr; double phiTT = 0; double ptTT = 0; + double ptRandPart = 0; int trigNumber = 0; + int partNumber = 0; int nTT = 0; - + double leadingPartPt = 0; + double leadingJetPt = 0; float dice = rand->Rndm(); if (dice < fracSig) isSigCol = true; @@ -355,6 +380,10 @@ struct JetHadronRecoil { isSigCol = false; for (const auto& particle : particles) { + partAr.push_back(particle.pt()); + if (particle.pt() > leadingPartPt) { + leadingPartPt = particle.pt(); + } if (particle.pt() > pTHatTrackMaxMCD * pTHat) { if (outlierRejectEvent) { return; @@ -386,6 +415,10 @@ struct JetHadronRecoil { registry.fill(HIST("hPtPartPtHard"), particle.pt(), particle.pt() / pTHat, weight); } + partNumber = rand->Integer(partAr.size()); + ptRandPart = partAr[partNumber]; + registry.fill(HIST("hPartPtHard"), ptRandPart / pTHat, ptRandPart, weight); + if (nTT > 0) { trigNumber = rand->Integer(nTT); phiTT = phiTTAr[trigNumber]; @@ -403,6 +436,9 @@ struct JetHadronRecoil { } for (const auto& jet : jets) { + if (jet.pt() > leadingJetPt) { + leadingJetPt = jet.pt(); + } if (jet.pt() > pTHatMaxMCP * pTHat) { if (outlierRejectEvent) { return; @@ -450,6 +486,7 @@ struct JetHadronRecoil { } } } + registry.fill(HIST("hPartvsJets"), leadingPartPt, leadingJetPt, pTHat, weight); } template From 741651c396244b65d21c801306ad93008b52c84c Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Thu, 31 Jul 2025 01:14:32 +0200 Subject: [PATCH 150/345] [PWGEM/Dilepton] add muons in struct CheckSmearing (#12314) --- PWGEM/Dilepton/Tasks/smearing.cxx | 127 +++++++++++++++---------- PWGEM/Dilepton/Utils/MomentumSmearer.h | 19 ++-- 2 files changed, 90 insertions(+), 56 deletions(-) diff --git a/PWGEM/Dilepton/Tasks/smearing.cxx b/PWGEM/Dilepton/Tasks/smearing.cxx index 7d2404645ca..03d0b272f46 100644 --- a/PWGEM/Dilepton/Tasks/smearing.cxx +++ b/PWGEM/Dilepton/Tasks/smearing.cxx @@ -13,21 +13,21 @@ // Analysis task to produce smeared pt, eta, phi for electrons/muons in dilepton analysis // Please write to: daiki.sekihata@cern.ch -#include -#include -#include +#include "PWGEM/Dilepton/DataModel/dileptonTables.h" +#include "PWGEM/Dilepton/Utils/MomentumSmearer.h" #include "CCDB/BasicCCDBManager.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" #include "Framework/ASoA.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" #include "Framework/DataTypes.h" #include "Framework/HistogramRegistry.h" -// #include "PWGDQ/DataModel/ReducedInfoTables.h" // remove this later, because 2 data tables (covariant matrix) in this header confilict against EM tables. -#include "PWGEM/Dilepton/Utils/MomentumSmearer.h" -#include "PWGEM/Dilepton/DataModel/dileptonTables.h" +#include "Framework/runDataProcessing.h" + +#include +#include +#include using namespace o2; using namespace o2::framework; @@ -292,20 +292,16 @@ struct ApplySmearing { } void processDummyMCanalysisEM(aod::EMMCParticles const&) {} - // void processDummyMCanalysisDQ(ReducedMCTracks const&) {} PROCESS_SWITCH(ApplySmearing, processMCanalysisEM, "Run for MC analysis which uses skimmed EM data format", false); - // PROCESS_SWITCH(ApplySmearing, processMCanalysisDQ, "Run for MC analysis which uses skimmed DQ data format", false); PROCESS_SWITCH(ApplySmearing, processCocktail, "Run for cocktail analysis", false); PROCESS_SWITCH(ApplySmearing, processDummyMCanalysisEM, "Dummy process function", false); - // PROCESS_SWITCH(ApplySmearing, processDummyMCanalysisDQ, "Dummy process function", false); PROCESS_SWITCH(ApplySmearing, processDummyCocktail, "Dummy process function", true); }; struct CheckSmearing { - using EMMCParticlesWithSmearing = soa::Join; // this is only for electrons - // using MyReducedTracks = soa::Join; // this is only for electrons - using MyCocktailTracks = soa::Join; // this is only for electrons + using EMMCParticlesWithSmearing = soa::Join; + using MyCocktailTracks = soa::Join; // Run for electrons or muons Configurable fPdgCode{"cfgPdgCode", 11, "Set the type of particle to be checked"}; @@ -322,9 +318,9 @@ struct CheckSmearing { void init(o2::framework::InitContext&) { - registry.add("hCorrelation_Pt", "pT correlation;p_{T,l}^{gen} (GeV/c);p_{T,l}^{smeared} (GeV/c)", {HistType::kTH2F, {{1000, 0.0f, 10.0f}, {1000, 0.0f, 10.0f}}}); - registry.add("hCorrelation_Eta", "eta correlation;#eta_{l}^{gen};#eta_{l}^{smeared}", {HistType::kTH2F, {{200, -1.0f, +1.0f}, {200, -1.0f, +1.0f}}}); - registry.add("hCorrelation_Phi", "phi correlation;#varphi_{l}^{gen} (rad.);#varphi_{l}^{smeared} (rad.)", {HistType::kTH2F, {{100, 0.0f, TMath::TwoPi()}, {100, 0.0f, TMath::TwoPi()}}}); + registry.add("Electron/hCorrelation_Pt", "pT correlation;p_{T,l}^{gen} (GeV/c);p_{T,l}^{smeared} (GeV/c)", {HistType::kTH2F, {{1000, 0.0f, 10.0f}, {1000, 0.0f, 10.0f}}}); + registry.add("Electron/hCorrelation_Eta", "eta correlation;#eta_{l}^{gen};#eta_{l}^{smeared}", {HistType::kTH2F, {{200, -1.0f, +1.0f}, {200, -1.0f, +1.0f}}}); + registry.add("Electron/hCorrelation_Phi", "phi correlation;#varphi_{l}^{gen} (rad.);#varphi_{l}^{smeared} (rad.)", {HistType::kTH2F, {{100, 0.0f, TMath::TwoPi()}, {100, 0.0f, TMath::TwoPi()}}}); // Binning for resolution AxisSpec axisPtRes{ptResBins, "#it{p}^{gen}_{T,l} (GeV/#it{c})"}; @@ -333,16 +329,19 @@ struct CheckSmearing { AxisSpec axisDeltaphiRes{deltaphiResBins, "#varphi^{gen} - #varphi^{rec} (rad.)"}; if (!fConfigUsePtVecRes) { - registry.add("PtGen_DeltaPtOverPtGen", "", HistType::kTH2D, {axisPtRes, axisDeltaptRes}, true); - registry.add("PtGen_DeltaEta", "", HistType::kTH2D, {axisPtRes, axisDeltaetaRes}, true); - registry.add("PtGen_DeltaPhi_Neg", "", HistType::kTH2D, {axisPtRes, axisDeltaphiRes}, true); - registry.add("PtGen_DeltaPhi_Pos", "", HistType::kTH2D, {axisPtRes, axisDeltaphiRes}, true); + registry.add("Electron/PtGen_DeltaPtOverPtGen", "", HistType::kTH2D, {axisPtRes, axisDeltaptRes}, true); + registry.add("Electron/PtGen_DeltaEta", "", HistType::kTH2D, {axisPtRes, axisDeltaetaRes}, true); + registry.add("Electron/PtGen_DeltaPhi_Neg", "", HistType::kTH2D, {axisPtRes, axisDeltaphiRes}, true); + registry.add("Electron/PtGen_DeltaPhi_Pos", "", HistType::kTH2D, {axisPtRes, axisDeltaphiRes}, true); } else { - registry.add("PtGen_DeltaPtOverPtGen", "", HistType::kTH2D, {{ptResBinsVec, "#it{p}^{gen}_{T,l} (GeV/#it{c})"}, axisDeltaptRes}, true); - registry.add("PtGen_DeltaEta", "", HistType::kTH2D, {{ptResBinsVec, "#it{p}^{gen}_{T,l} (GeV/#it{c})"}, axisDeltaetaRes}, true); - registry.add("PtGen_DeltaPhi_Neg", "", HistType::kTH2D, {{ptResBinsVec, "#it{p}^{gen}_{T,l} (GeV/#it{c})"}, axisDeltaphiRes}, true); - registry.add("PtGen_DeltaPhi_Pos", "", HistType::kTH2D, {{ptResBinsVec, "#it{p}^{gen}_{T,l} (GeV/#it{c})"}, axisDeltaphiRes}, true); + registry.add("Electron/PtGen_DeltaPtOverPtGen", "", HistType::kTH2D, {{ptResBinsVec, "#it{p}^{gen}_{T,l} (GeV/#it{c})"}, axisDeltaptRes}, true); + registry.add("Electron/PtGen_DeltaEta", "", HistType::kTH2D, {{ptResBinsVec, "#it{p}^{gen}_{T,l} (GeV/#it{c})"}, axisDeltaetaRes}, true); + registry.add("Electron/PtGen_DeltaPhi_Neg", "", HistType::kTH2D, {{ptResBinsVec, "#it{p}^{gen}_{T,l} (GeV/#it{c})"}, axisDeltaphiRes}, true); + registry.add("Electron/PtGen_DeltaPhi_Pos", "", HistType::kTH2D, {{ptResBinsVec, "#it{p}^{gen}_{T,l} (GeV/#it{c})"}, axisDeltaphiRes}, true); } + + registry.addClone("Electron/", "GlobalMuon/"); + registry.addClone("Electron/", "StandaloneMuon/"); } template @@ -360,21 +359,59 @@ struct CheckSmearing { } } - float deltaptoverpt = -1000.; - if (mctrack.pt() > 0.) - deltaptoverpt = (mctrack.pt() - mctrack.ptSmeared()) / mctrack.pt(); - float deltaeta = mctrack.eta() - mctrack.etaSmeared(); - float deltaphi = mctrack.phi() - mctrack.phiSmeared(); - registry.fill(HIST("PtGen_DeltaPtOverPtGen"), mctrack.pt(), deltaptoverpt); - registry.fill(HIST("PtGen_DeltaEta"), mctrack.pt(), deltaeta); - if (mctrack.pdgCode() < 0) { - registry.fill(HIST("PtGen_DeltaPhi_Neg"), mctrack.pt(), deltaphi); - } else { - registry.fill(HIST("PtGen_DeltaPhi_Pos"), mctrack.pt(), deltaphi); + if (std::abs(mctrack.pdgCode()) == 11) { // for electrons + float deltaptoverpt = -1000.f; + if (mctrack.pt() > 0.f) { + deltaptoverpt = (mctrack.pt() - mctrack.ptSmeared()) / mctrack.pt(); + } + float deltaeta = mctrack.eta() - mctrack.etaSmeared(); + float deltaphi = mctrack.phi() - mctrack.phiSmeared(); + registry.fill(HIST("Electron/PtGen_DeltaPtOverPtGen"), mctrack.pt(), deltaptoverpt); + registry.fill(HIST("Electron/PtGen_DeltaEta"), mctrack.pt(), deltaeta); + if (mctrack.pdgCode() < 0) { // e+ + registry.fill(HIST("Electron/PtGen_DeltaPhi_Pos"), mctrack.pt(), deltaphi); + } else { // e- + registry.fill(HIST("Electron/PtGen_DeltaPhi_Neg"), mctrack.pt(), deltaphi); + } + registry.fill(HIST("Electron/hCorrelation_Pt"), mctrack.pt(), mctrack.ptSmeared()); + registry.fill(HIST("Electron/hCorrelation_Eta"), mctrack.eta(), mctrack.etaSmeared()); + registry.fill(HIST("Electron/hCorrelation_Phi"), mctrack.phi(), mctrack.phiSmeared()); + } else if (std::abs(mctrack.pdgCode()) == 13) { // for muons + float deltaptoverpt = -1000.f; + // for standalone muons + if (mctrack.pt() > 0.f) { + deltaptoverpt = (mctrack.pt() - mctrack.ptSmeared_sa_muon()) / mctrack.pt(); + } + float deltaeta = mctrack.eta() - mctrack.etaSmeared_sa_muon(); + float deltaphi = mctrack.phi() - mctrack.phiSmeared_sa_muon(); + registry.fill(HIST("StandaloneMuon/PtGen_DeltaPtOverPtGen"), mctrack.pt(), deltaptoverpt); + registry.fill(HIST("StandaloneMuon/PtGen_DeltaEta"), mctrack.pt(), deltaeta); + if (mctrack.pdgCode() < 0) { // mu+ + registry.fill(HIST("StandaloneMuon/PtGen_DeltaPhi_Pos"), mctrack.pt(), deltaphi); + } else { // mu- + registry.fill(HIST("StandaloneMuon/PtGen_DeltaPhi_Neg"), mctrack.pt(), deltaphi); + } + registry.fill(HIST("StandaloneMuon/hCorrelation_Pt"), mctrack.pt(), mctrack.ptSmeared_sa_muon()); + registry.fill(HIST("StandaloneMuon/hCorrelation_Eta"), mctrack.eta(), mctrack.etaSmeared_sa_muon()); + registry.fill(HIST("StandaloneMuon/hCorrelation_Phi"), mctrack.phi(), mctrack.phiSmeared_sa_muon()); + + // for global muons + if (mctrack.pt() > 0.f) { + deltaptoverpt = (mctrack.pt() - mctrack.ptSmeared_gl_muon()) / mctrack.pt(); + } + deltaeta = mctrack.eta() - mctrack.etaSmeared_gl_muon(); + deltaphi = mctrack.phi() - mctrack.phiSmeared_gl_muon(); + registry.fill(HIST("GlobalMuon/PtGen_DeltaPtOverPtGen"), mctrack.pt(), deltaptoverpt); + registry.fill(HIST("GlobalMuon/PtGen_DeltaEta"), mctrack.pt(), deltaeta); + if (mctrack.pdgCode() < 0) { // mu+ + registry.fill(HIST("GlobalMuon/PtGen_DeltaPhi_Pos"), mctrack.pt(), deltaphi); + } else { // mu- + registry.fill(HIST("GlobalMuon/PtGen_DeltaPhi_Neg"), mctrack.pt(), deltaphi); + } + registry.fill(HIST("GlobalMuon/hCorrelation_Pt"), mctrack.pt(), mctrack.ptSmeared_gl_muon()); + registry.fill(HIST("GlobalMuon/hCorrelation_Eta"), mctrack.eta(), mctrack.etaSmeared_gl_muon()); + registry.fill(HIST("GlobalMuon/hCorrelation_Phi"), mctrack.phi(), mctrack.phiSmeared_gl_muon()); } - registry.fill(HIST("hCorrelation_Pt"), mctrack.pt(), mctrack.ptSmeared()); - registry.fill(HIST("hCorrelation_Eta"), mctrack.eta(), mctrack.etaSmeared()); - registry.fill(HIST("hCorrelation_Phi"), mctrack.phi(), mctrack.phiSmeared()); } // end of mctrack loop } @@ -383,25 +420,17 @@ struct CheckSmearing { Check(tracksMC, mccollisions); } - // void processCheckMCanalysisDQ(MyReducedTracks const& tracksMC) - // { - // Check(tracksMC); - // } - void processCheckCocktail(MyCocktailTracks const& tracksMC) { Check(tracksMC, nullptr); } void processDummyMCanalysisEM(aod::EMMCParticles const&) {} - // void processDummyMCanalysisDQ(ReducedMCTracks const&) {} void processDummyCocktail(aod::McParticles const&) {} PROCESS_SWITCH(CheckSmearing, processCheckMCanalysisEM, "Run for MC analysis", false); - // PROCESS_SWITCH(CheckSmearing, processCheckMCanalysisDQ, "Run for MC analysis", false); PROCESS_SWITCH(CheckSmearing, processCheckCocktail, "Run for cocktail analysis", false); PROCESS_SWITCH(CheckSmearing, processDummyMCanalysisEM, "Dummy process function", false); - // PROCESS_SWITCH(CheckSmearing, processDummyMCanalysisDQ, "Dummy process function", false); PROCESS_SWITCH(CheckSmearing, processDummyCocktail, "Dummy process function", true); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGEM/Dilepton/Utils/MomentumSmearer.h b/PWGEM/Dilepton/Utils/MomentumSmearer.h index 7e36dcfed0f..10699e4c2a0 100644 --- a/PWGEM/Dilepton/Utils/MomentumSmearer.h +++ b/PWGEM/Dilepton/Utils/MomentumSmearer.h @@ -15,22 +15,27 @@ #ifndef PWGEM_DILEPTON_UTILS_MOMENTUMSMEARER_H_ #define PWGEM_DILEPTON_UTILS_MOMENTUMSMEARER_H_ -#include +#include "CCDB/BasicCCDBManager.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/Logger.h" +#include "Framework/runDataProcessing.h" +#include +#include #include #include #include #include -#include -#include -#include #include +#include -#include "CCDB/BasicCCDBManager.h" -#include "Framework/Logger.h" +#include -using namespace o2::framework; using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::soa; class MomentumSmearer { From 89990ff43e891d5f9fd1f018dde559eac773a4bf Mon Sep 17 00:00:00 2001 From: Rik Spijkers <78484875+rspijkers@users.noreply.github.com> Date: Thu, 31 Jul 2025 02:12:23 +0200 Subject: [PATCH 151/345] [PWGLF] add competing mass cut for omega's (#12339) --- .../Tasks/Strangeness/cascadecorrelations.cxx | 105 ++++++++++-------- 1 file changed, 56 insertions(+), 49 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/cascadecorrelations.cxx b/PWGLF/Tasks/Strangeness/cascadecorrelations.cxx index d1382b57370..c062c2f1a0d 100644 --- a/PWGLF/Tasks/Strangeness/cascadecorrelations.cxx +++ b/PWGLF/Tasks/Strangeness/cascadecorrelations.cxx @@ -86,6 +86,7 @@ using LabeledCascades = soa::Join; struct CascadeSelector { Service ccdb; + Service pdgDB; Produces cascflags; @@ -99,6 +100,8 @@ struct CascadeSelector { Configurable INEL{"INEL", 0, "Number of charged tracks within |eta| < 1 has to be greater than value"}; Configurable maxVertexZ{"maxVertexZ", 10., "Maximum value of z coordinate of PV"}; Configurable etaCascades{"etaCascades", 0.8, "min/max of eta for cascades"}; + Configurable doCompetingMassCut{"doCompetingMassCut", true, "Switch to apply a competing mass cut for the Omega's"}; + Configurable competingMassWindow{"competingMassWindow", 0.01, "Mass window for the competing mass cut"}; // Tracklevel Configurable tpcNsigmaBachelor{"tpcNsigmaBachelor", 3, "TPC NSigma bachelor"}; @@ -302,7 +305,7 @@ struct CascadeSelector { if (!gen.isPhysicalPrimary()) return; int genpdg = gen.pdgCode(); - if ((flag < 3 && TMath::Abs(genpdg) == 3312) || (flag > 1 && TMath::Abs(genpdg) == 3334)) { + if ((flag < 3 && std::abs(genpdg) == 3312) || (flag > 1 && std::abs(genpdg) == 3334)) { // if casc is consistent with Xi and has matched gen Xi OR cand is consistent with Omega and has matched gen omega // have to do this in case we reco true Xi with only Omega hypothesis (or vice versa) (very unlikely) registry.fill(HIST("truerec/hV0Radius"), rec.v0radius()); @@ -413,18 +416,18 @@ struct CascadeSelector { casc.v0cosPA(pvx, pvy, pvz) < v0setting_cospa || casc.casccosPA(pvx, pvy, pvz) < cascadesetting_cospa || casc.dcav0topv(pvx, pvy, pvz) < cascadesetting_mindcav0topv || - TMath::Abs(casc.mLambda() - 1.115683) > cascadesetting_v0masswindow) + std::abs(casc.mLambda() - 1.115683) > cascadesetting_v0masswindow) return 0; // It failed at least one topo selection registry.fill(HIST("hSelectionStatus"), 4); // passes topo // registry.fill(HIST("hMassXi3"), casc.mXi(), casc.pt()); - if (TMath::Abs(posTrack.eta()) > etaTracks || TMath::Abs(negTrack.eta()) > etaTracks || TMath::Abs(bachTrack.eta()) > etaTracks) + if (std::abs(posTrack.eta()) > etaTracks || std::abs(negTrack.eta()) > etaTracks || std::abs(bachTrack.eta()) > etaTracks) return 0; registry.fill(HIST("hSelectionStatus"), 5); // passes track eta - if (TMath::Abs(casc.eta()) > etaCascades) + if (std::abs(casc.eta()) > etaCascades) return 0; registry.fill(HIST("hSelectionStatus"), 6); // passes candidate eta @@ -435,28 +438,40 @@ struct CascadeSelector { // Lambda check if (casc.sign() < 0) { // Proton check: - if (TMath::Abs(posTrack.tpcNSigmaPr()) > tpcNsigmaProton) + if (std::abs(posTrack.tpcNSigmaPr()) > tpcNsigmaProton) return 0; // Pion check: - if (TMath::Abs(negTrack.tpcNSigmaPi()) > tpcNsigmaPion) + if (std::abs(negTrack.tpcNSigmaPi()) > tpcNsigmaPion) return 0; } else { // Proton check: - if (TMath::Abs(negTrack.tpcNSigmaPr()) > tpcNsigmaProton) + if (std::abs(negTrack.tpcNSigmaPr()) > tpcNsigmaProton) return 0; // Pion check: - if (TMath::Abs(posTrack.tpcNSigmaPi()) > tpcNsigmaPion) + if (std::abs(posTrack.tpcNSigmaPi()) > tpcNsigmaPion) return 0; } registry.fill(HIST("hSelectionStatus"), 7); // passes V0 daughters PID // registry.fill(HIST("hMassXi4"), casc.mXi(), casc.pt()); - // Bachelor check - if (TMath::Abs(bachTrack.tpcNSigmaPi()) < tpcNsigmaBachelor) { - if (TMath::Abs(bachTrack.tpcNSigmaKa()) < tpcNsigmaBachelor) { - // consistent with both! + // setting selection flag based on bachelor PID (and competing mass cut for omega's) + int flag = 0; + if (std::abs(bachTrack.tpcNSigmaPi()) < tpcNsigmaBachelor) + flag = 1; + if (std::abs(bachTrack.tpcNSigmaKa()) < tpcNsigmaBachelor && (!doCompetingMassCut || std::abs(pdgDB->Mass(3312) - casc.mXi()) > competingMassWindow)) + flag = 3 - flag; // 3 if only consistent with omega, 2 if consistent with both + + switch (flag) { + case 1: // only Xi + registry.fill(HIST("hSelectionStatus"), 8); // passes bach PID + if (casc.sign() < 0) { + registry.fill(HIST("hMassXiMinus"), casc.mXi(), casc.pt(), casc.yXi()); + } else { + registry.fill(HIST("hMassXiPlus"), casc.mXi(), casc.pt(), casc.yXi()); + } + break; + case 2: // Xi or Omega registry.fill(HIST("hSelectionStatus"), 8); // passes bach PID - // registry.fill(HIST("hMassXi5"), casc.mXi(), casc.pt()); if (casc.sign() < 0) { registry.fill(HIST("hMassXiMinus"), casc.mXi(), casc.pt(), casc.yXi()); registry.fill(HIST("hMassOmegaMinus"), casc.mOmega(), casc.pt(), casc.yOmega()); @@ -464,27 +479,19 @@ struct CascadeSelector { registry.fill(HIST("hMassXiPlus"), casc.mXi(), casc.pt(), casc.yXi()); registry.fill(HIST("hMassOmegaPlus"), casc.mOmega(), casc.pt(), casc.yOmega()); } - return 2; - } - registry.fill(HIST("hSelectionStatus"), 8); // passes bach PID - // registry.fill(HIST("hMassXi5"), casc.mXi(), casc.pt()); - if (casc.sign() < 0) { - registry.fill(HIST("hMassXiMinus"), casc.mXi(), casc.pt(), casc.yXi()); - } else { - registry.fill(HIST("hMassXiPlus"), casc.mXi(), casc.pt(), casc.yXi()); - } - return 1; - } else if (TMath::Abs(bachTrack.tpcNSigmaKa()) < tpcNsigmaBachelor) { - registry.fill(HIST("hSelectionStatus"), 8); // passes bach PID - if (casc.sign() < 0) { - registry.fill(HIST("hMassOmegaMinus"), casc.mOmega(), casc.pt(), casc.yOmega()); - } else { - registry.fill(HIST("hMassOmegaPlus"), casc.mOmega(), casc.pt(), casc.yOmega()); - } - return 3; + break; + case 3: // only Omega + registry.fill(HIST("hSelectionStatus"), 8); // passes bach PID + if (casc.sign() < 0) { + registry.fill(HIST("hMassOmegaMinus"), casc.mOmega(), casc.pt(), casc.yOmega()); + } else { + registry.fill(HIST("hMassOmegaPlus"), casc.mOmega(), casc.pt(), casc.yOmega()); + } + break; } - // if we reach here, the bachelor was neither pion nor kaon - return 0; + + return flag; + } // processCandidate void processGenMC(aod::McCollision const&, soa::SmallGroups> const& collisions, aod::McParticles const& mcParticles) @@ -495,7 +502,7 @@ struct CascadeSelector { for (auto const& mcPart : mcParticles) { if (!mcPart.isPhysicalPrimary()) continue; - if (TMath::Abs(mcPart.eta()) > etaCascades) + if (std::abs(mcPart.eta()) > etaCascades) continue; switch (mcPart.pdgCode()) { @@ -532,7 +539,7 @@ struct CascadeSelector { for (auto const& mcPart : mcParticles) { if (!mcPart.isPhysicalPrimary()) continue; - if (TMath::Abs(mcPart.eta()) > etaCascades) + if (std::abs(mcPart.eta()) > etaCascades) continue; switch (mcPart.pdgCode()) { @@ -857,30 +864,30 @@ struct CascadeCorrelations { double weightTrigg = 1.; double weightAssoc = 1.; - if (trigger.isSelected() <= 2 && TMath::Abs(trigger.yXi()) < maxRapidity) { // trigger Xi + if (trigger.isSelected() <= 2 && std::abs(trigger.yXi()) < maxRapidity) { // trigger Xi if (doEfficiencyCorrection) weightTrigg = trigger.sign() < 0 ? getEfficiency(hEffXiMin, trigger.pt()) : getEfficiency(hEffXiPlus, trigger.pt()); - if (assoc.isSelected() <= 2 && TMath::Abs(assoc.yXi()) < maxRapidity) { // assoc Xi + if (assoc.isSelected() <= 2 && std::abs(assoc.yXi()) < maxRapidity) { // assoc Xi if (doEfficiencyCorrection) weightAssoc = assoc.sign() < 0 ? getEfficiency(hEffXiMin, assoc.pt()) : getEfficiency(hEffXiPlus, assoc.pt()); registry.fill(HIST("hXiXi"), dphi, trigger.yXi() - assoc.yXi(), trigger.sign(), assoc.sign(), trigger.pt(), assoc.pt(), invMassXiTrigg, invMassXiAssoc, collision.posZ(), collision.multFT0M(), weightTrigg * weightAssoc); } - if (assoc.isSelected() >= 2 && TMath::Abs(assoc.yOmega()) < maxRapidity) { // assoc Omega + if (assoc.isSelected() >= 2 && std::abs(assoc.yOmega()) < maxRapidity) { // assoc Omega if (doEfficiencyCorrection) weightAssoc = assoc.sign() < 0 ? getEfficiency(hEffOmegaMin, assoc.pt()) : getEfficiency(hEffOmegaPlus, assoc.pt()); registry.fill(HIST("hXiOm"), dphi, trigger.yXi() - assoc.yOmega(), trigger.sign(), assoc.sign(), trigger.pt(), assoc.pt(), invMassXiTrigg, invMassOmAssoc, collision.posZ(), collision.multFT0M(), weightTrigg * weightAssoc); } } - if (trigger.isSelected() >= 2 && TMath::Abs(trigger.yOmega()) < maxRapidity) { // trigger Omega + if (trigger.isSelected() >= 2 && std::abs(trigger.yOmega()) < maxRapidity) { // trigger Omega if (doEfficiencyCorrection) weightTrigg = trigger.sign() < 0 ? getEfficiency(hEffOmegaMin, trigger.pt()) : getEfficiency(hEffOmegaPlus, trigger.pt()); - if (assoc.isSelected() <= 2 && TMath::Abs(assoc.yXi()) < maxRapidity) { // assoc Xi + if (assoc.isSelected() <= 2 && std::abs(assoc.yXi()) < maxRapidity) { // assoc Xi if (doEfficiencyCorrection) weightAssoc = assoc.sign() < 0 ? getEfficiency(hEffXiMin, assoc.pt()) : getEfficiency(hEffXiPlus, assoc.pt()); // if Omega-Xi, fill the Xi-Omega histogram (flip the trigger/assoc and dphy,dy signs) registry.fill(HIST("hXiOm"), RecoDecay::constrainAngle(assoc.phi() - trigger.phi(), -PIHalf), -(trigger.yOmega() - assoc.yXi()), assoc.sign(), trigger.sign(), assoc.pt(), trigger.pt(), invMassXiAssoc, invMassOmTrigg, collision.posZ(), collision.multFT0M(), weightTrigg * weightAssoc); } - if (assoc.isSelected() >= 2 && TMath::Abs(assoc.yOmega()) < maxRapidity) { // assoc Omega + if (assoc.isSelected() >= 2 && std::abs(assoc.yOmega()) < maxRapidity) { // assoc Omega if (doEfficiencyCorrection) weightAssoc = assoc.sign() < 0 ? getEfficiency(hEffOmegaMin, assoc.pt()) : getEfficiency(hEffOmegaPlus, assoc.pt()); registry.fill(HIST("hOmOm"), dphi, trigger.yOmega() - assoc.yOmega(), trigger.sign(), assoc.sign(), trigger.pt(), assoc.pt(), invMassOmTrigg, invMassOmAssoc, collision.posZ(), collision.multFT0M(), weightTrigg * weightAssoc); @@ -904,7 +911,7 @@ struct CascadeCorrelations { for (auto const& [col1, cascades1, col2, cascades2] : pair) { if (!col1.sel8() || !col2.sel8()) continue; - if (TMath::Abs(col1.posZ()) > zVertexCut || TMath::Abs(col2.posZ()) > zVertexCut) + if (std::abs(col1.posZ()) > zVertexCut || std::abs(col2.posZ()) > zVertexCut) continue; if (col1.globalIndex() == col2.globalIndex()) { registry.fill(HIST("hMEQA"), 0.5); @@ -943,30 +950,30 @@ struct CascadeCorrelations { double weightTrigg = 1.; double weightAssoc = 1.; - if (trigger.isSelected() <= 2 && TMath::Abs(trigger.yXi()) < maxRapidity) { // trigger Xi + if (trigger.isSelected() <= 2 && std::abs(trigger.yXi()) < maxRapidity) { // trigger Xi if (doEfficiencyCorrection) weightTrigg = trigger.sign() < 0 ? getEfficiency(hEffXiMin, trigger.pt()) : getEfficiency(hEffXiPlus, trigger.pt()); - if (assoc.isSelected() <= 2 && TMath::Abs(assoc.yXi()) < maxRapidity) { // assoc Xi + if (assoc.isSelected() <= 2 && std::abs(assoc.yXi()) < maxRapidity) { // assoc Xi if (doEfficiencyCorrection) weightAssoc = assoc.sign() < 0 ? getEfficiency(hEffXiMin, assoc.pt()) : getEfficiency(hEffXiPlus, assoc.pt()); registry.fill(HIST("MixedEvents/hMEXiXi"), dphi, trigger.yXi() - assoc.yXi(), trigger.sign(), assoc.sign(), trigger.pt(), assoc.pt(), invMassXiTrigg, invMassXiAssoc, col1.posZ(), col1.multFT0M(), weightTrigg * weightAssoc); } - if (assoc.isSelected() >= 2 && TMath::Abs(assoc.yOmega()) < maxRapidity) { // assoc Omega + if (assoc.isSelected() >= 2 && std::abs(assoc.yOmega()) < maxRapidity) { // assoc Omega if (doEfficiencyCorrection) weightAssoc = assoc.sign() < 0 ? getEfficiency(hEffOmegaMin, assoc.pt()) : getEfficiency(hEffOmegaPlus, assoc.pt()); registry.fill(HIST("MixedEvents/hMEXiOm"), dphi, trigger.yXi() - assoc.yOmega(), trigger.sign(), assoc.sign(), trigger.pt(), assoc.pt(), invMassXiTrigg, invMassOmAssoc, col1.posZ(), col1.multFT0M(), weightTrigg * weightAssoc); } } - if (trigger.isSelected() >= 2 && TMath::Abs(trigger.yOmega()) < maxRapidity) { // trigger Omega + if (trigger.isSelected() >= 2 && std::abs(trigger.yOmega()) < maxRapidity) { // trigger Omega if (doEfficiencyCorrection) weightTrigg = trigger.sign() < 0 ? getEfficiency(hEffOmegaMin, trigger.pt()) : getEfficiency(hEffOmegaPlus, trigger.pt()); - if (assoc.isSelected() <= 2 && TMath::Abs(assoc.yXi()) < maxRapidity) { // assoc Xi + if (assoc.isSelected() <= 2 && std::abs(assoc.yXi()) < maxRapidity) { // assoc Xi if (doEfficiencyCorrection) weightAssoc = assoc.sign() < 0 ? getEfficiency(hEffXiMin, assoc.pt()) : getEfficiency(hEffXiPlus, assoc.pt()); // if Omega-Xi, fill the Xi-Omega histogram (flip the trigger/assoc and dphy,dy signs) registry.fill(HIST("MixedEvents/hMEXiOm"), RecoDecay::constrainAngle(assoc.phi() - trigger.phi(), -PIHalf), -(trigger.yOmega() - assoc.yXi()), assoc.sign(), trigger.sign(), assoc.pt(), trigger.pt(), invMassXiAssoc, invMassOmTrigg, col1.posZ(), col1.multFT0M(), weightTrigg * weightAssoc); } - if (assoc.isSelected() >= 2 && TMath::Abs(assoc.yOmega()) < maxRapidity) { // assoc Omega + if (assoc.isSelected() >= 2 && std::abs(assoc.yOmega()) < maxRapidity) { // assoc Omega if (doEfficiencyCorrection) weightAssoc = assoc.sign() < 0 ? getEfficiency(hEffOmegaMin, assoc.pt()) : getEfficiency(hEffOmegaPlus, assoc.pt()); registry.fill(HIST("MixedEvents/hMEOmOm"), dphi, trigger.yOmega() - assoc.yOmega(), trigger.sign(), assoc.sign(), trigger.pt(), assoc.pt(), invMassOmTrigg, invMassOmAssoc, col1.posZ(), col1.multFT0M(), weightTrigg * weightAssoc); @@ -1028,7 +1035,7 @@ struct CascadeCorrelations { if (!trigger.isPhysicalPrimary() || !assoc.isPhysicalPrimary()) continue; // require the cascades to be primaries - if (TMath::Abs(trigger.eta()) > etaGenCascades) + if (std::abs(trigger.eta()) > etaGenCascades) continue; // only apply eta cut to trigger - trigger normalization still valid without introducing 2-particle-acceptance effects double dphi = RecoDecay::constrainAngle(trigger.phi() - assoc.phi(), -PIHalf); From 554460fb8f9b681b840f04fb0649e68f62c10231 Mon Sep 17 00:00:00 2001 From: Chiara De Martin <39315597+ChiaraDeMartin95@users.noreply.github.com> Date: Thu, 31 Jul 2025 03:11:14 +0200 Subject: [PATCH 152/345] [PWGLF] Fix daughter track selection (#12336) Co-authored-by: Chiara De Martin Co-authored-by: ALICE Action Bot --- .../TableProducer/Strangeness/cascadeflow.cxx | 31 +++++++++++++++---- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/cascadeflow.cxx b/PWGLF/TableProducer/Strangeness/cascadeflow.cxx index ae997e2d1fc..9c88eeae252 100644 --- a/PWGLF/TableProducer/Strangeness/cascadeflow.cxx +++ b/PWGLF/TableProducer/Strangeness/cascadeflow.cxx @@ -662,6 +662,7 @@ struct cascadeFlow { histos.add("hLambdaCandidate", "hLambdaCandidate", HistType::kTH1F, {{5, -0.5, 4.5}}); histos.add("hCascadeSignal", "hCascadeSignal", HistType::kTH1F, {{6, -0.5, 5.5}}); histos.add("hCascade", "hCascade", HistType::kTH1F, {{6, -0.5, 5.5}}); + histos.add("hCascadeDauSel", "hCascadeDauSel", HistType::kTH1F, {{2, -0.5, 1.5}}); histos.add("hLambdaDauSel", "hLambdaDauSel", HistType::kTH1F, {{3, -0.5, 2.5}}); histos.add("hALambdaDauSel", "hALambdaDauSel", HistType::kTH1F, {{3, -0.5, 2.5}}); histos.add("hXiPtvsCent", "hXiPtvsCent", HistType::kTH2F, {{100, 0, 100}, {400, 0, 20}}); @@ -901,11 +902,13 @@ struct cascadeFlow { auto bachExtra = casc.bachTrackExtra_as(); int counter = 0; - IsCascAccepted(casc, negExtra, posExtra, bachExtra, counter); + bool isCascCandidate = 0; + isCascCandidate = IsCascAccepted(casc, negExtra, posExtra, bachExtra, counter); histos.fill(HIST("hCascadeSignal"), counter); // PDG cascades - fillTrainingTable(coll, casc, pdgCode); + if (isCascCandidate) + fillTrainingTable(coll, casc, pdgCode); // I only store cascades that passed PID and track quality selections } } @@ -967,8 +970,12 @@ struct cascadeFlow { auto bachExtra = casc.bachTrackExtra_as(); int counter = 0; - IsCascAccepted(casc, negExtra, posExtra, bachExtra, counter); + bool isCascCandidate = 0; + isCascCandidate = IsCascAccepted(casc, negExtra, posExtra, bachExtra, counter); histos.fill(HIST("hCascade"), counter); + histos.fill(HIST("hCascadeDauSel"), (int)isCascCandidate); + if (!isCascCandidate) + continue; // ML selections bool isSelectedCasc[2]{false, false}; @@ -1242,8 +1249,12 @@ struct cascadeFlow { auto bachExtra = casc.bachTrackExtra_as(); int counter = 0; - IsCascAccepted(casc, negExtra, posExtra, bachExtra, counter); + bool isCascCandidate = 0; + isCascCandidate = IsCascAccepted(casc, negExtra, posExtra, bachExtra, counter); histos.fill(HIST("hCascade"), counter); + histos.fill(HIST("hCascadeDauSel"), (int)isCascCandidate); + if (!isCascCandidate) + continue; // ML selections bool isSelectedCasc[nParticles]{false, false}; @@ -1682,8 +1693,12 @@ struct cascadeFlow { auto bachExtra = casc.bachTrackExtra_as(); int counter = 0; - IsCascAccepted(casc, negExtra, posExtra, bachExtra, counter); + bool isCascCandidate = 0; + isCascCandidate = IsCascAccepted(casc, negExtra, posExtra, bachExtra, counter); histos.fill(HIST("hCascade"), counter); + histos.fill(HIST("hCascadeDauSel"), (int)isCascCandidate); + if (!isCascCandidate) + continue; // ML selections bool isSelectedCasc[nParticles]{false, false}; @@ -1828,8 +1843,12 @@ struct cascadeFlow { auto bachExtra = casc.bachTrackExtra_as(); int counter = 0; - IsCascAccepted(casc, negExtra, posExtra, bachExtra, counter); + bool isCascCandidate = 0; + isCascCandidate = IsCascAccepted(casc, negExtra, posExtra, bachExtra, counter); histos.fill(HIST("hCascade"), counter); + histos.fill(HIST("hCascadeDauSel"), (int)isCascCandidate); + if (!isCascCandidate) + continue; // ML selections bool isSelectedCasc[nParticles]{false, false}; From 040cc73d6cb672cd78e743ae09bb3a61c9a4d904 Mon Sep 17 00:00:00 2001 From: Zhiyong <71517277+Luzhiyongg@users.noreply.github.com> Date: Thu, 31 Jul 2025 05:11:56 +0200 Subject: [PATCH 153/345] [PWGCF] add QA for weighted centrality (#12337) --- .../Tasks/diHadronCor.cxx | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/PWGCF/TwoParticleCorrelations/Tasks/diHadronCor.cxx b/PWGCF/TwoParticleCorrelations/Tasks/diHadronCor.cxx index d47aff3c749..5cd6d8335e8 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/diHadronCor.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/diHadronCor.cxx @@ -262,8 +262,9 @@ struct DiHadronCor { registry.add("pTCorrected", "pTCorrected", {HistType::kTH1D, {axisPtTrigger}}); registry.add("Nch", "N_{ch}", {HistType::kTH1D, {axisMultiplicity}}); registry.add("Nch_used", "N_{ch}", {HistType::kTH1D, {axisMultiplicity}}); // histogram to see how many events are in the same and mixed event - registry.add("Centrality", hCentTitle.c_str(), {HistType::kTH1D, {axisCentrality}}); - registry.add("Centrality_used", hCentTitle.c_str(), {HistType::kTH1D, {axisCentrality}}); // histogram to see how many events are in the same and mixed event + registry.add("Centrality", hCentTitle.c_str(), {HistType::kTH1D, {{100, 0, 100}}}); + registry.add("CentralityWeighted", hCentTitle.c_str(), {HistType::kTH1D, {{100, 0, 100}}}); + registry.add("Centrality_used", hCentTitle.c_str(), {HistType::kTH1D, {{100, 0, 100}}}); // histogram to see how many events are in the same and mixed event registry.add("zVtx", "zVtx", {HistType::kTH1D, {axisVertex}}); registry.add("zVtx_used", "zVtx_used", {HistType::kTH1D, {axisVertex}}); registry.add("Trig_hist", "", {HistType::kTHnSparseF, {{axisSample, axisVertex, axisPtTrigger}}}); @@ -718,13 +719,16 @@ struct DiHadronCor { return; auto bc = collision.bc_as(); float cent = -1.; - if (!cfgCentTableUnavailable) - cent = getCentrality(collision); + float weightCent = 1.0f; if (cfgUseAdditionalEventCut && !eventSelected(collision, tracks.size(), cent, true)) return; - - if (!cfgCentTableUnavailable) + loadCorrection(bc.timestamp()); + if (!cfgCentTableUnavailable) { + cent = getCentrality(collision); + getCentralityWeight(weightCent, cent); registry.fill(HIST("Centrality"), cent); + registry.fill(HIST("CentralityWeighted"), cent, weightCent); + } registry.fill(HIST("Nch"), tracks.size()); registry.fill(HIST("zVtx"), collision.posZ()); @@ -735,12 +739,8 @@ struct DiHadronCor { return; } - loadCorrection(bc.timestamp()); registry.fill(HIST("eventcount"), SameEvent); // because its same event i put it in the 1 bin fillYield(collision, tracks); - float weightCent = 1.0f; - if (!cfgCentTableUnavailable) - getCentralityWeight(weightCent, cent); same->fillEvent(tracks.size(), CorrelationContainer::kCFStepReconstructed); fillCorrelations(tracks, tracks, collision.posZ(), SameEvent, getMagneticField(bc.timestamp()), cent, weightCent); From 6ad3a6de7fd8b7e4caec4a905d89988a38cf5284 Mon Sep 17 00:00:00 2001 From: yuanzhe <90246048+wang-yuanzhe@users.noreply.github.com> Date: Thu, 31 Jul 2025 10:00:07 +0200 Subject: [PATCH 154/345] [PWGLF] Add option for hypertriton kink analysis (#12329) --- PWGLF/DataModel/LFHyperNucleiKinkTables.h | 3 + PWGLF/TableProducer/Common/kinkBuilder.cxx | 8 + PWGLF/TableProducer/Nuspex/CMakeLists.txt | 4 +- ...igmaRecoTask.cxx => hyperkinkRecoTask.cxx} | 934 ++++++++++-------- 4 files changed, 534 insertions(+), 415 deletions(-) rename PWGLF/TableProducer/Nuspex/{hyperhelium4sigmaRecoTask.cxx => hyperkinkRecoTask.cxx} (53%) diff --git a/PWGLF/DataModel/LFHyperNucleiKinkTables.h b/PWGLF/DataModel/LFHyperNucleiKinkTables.h index 797a1d3c109..4ffd6f4ec46 100644 --- a/PWGLF/DataModel/LFHyperNucleiKinkTables.h +++ b/PWGLF/DataModel/LFHyperNucleiKinkTables.h @@ -24,6 +24,7 @@ namespace o2::aod namespace hyperkink { +DECLARE_SOA_COLUMN(MagPolarity, magPolarity, int8_t); //! Magnetic field polarity DECLARE_SOA_COLUMN(XPV, xPV, float); //! Primary vertex of the candidate (x direction) DECLARE_SOA_COLUMN(YPV, yPV, float); //! Primary vertex of the candidate (y direction) DECLARE_SOA_COLUMN(ZPV, zPV, float); //! Primary vertex of the candidate (z direction) @@ -82,6 +83,7 @@ DECLARE_SOA_COLUMN(UpdatePzMothPV, updatePzMothPV, float); //! updated pz o DECLARE_SOA_TABLE(HypKinkCand, "AOD", "HYPKINKCANDS", o2::soa::Index<>, + hyperkink::MagPolarity, hyperkink::XPV, hyperkink::YPV, hyperkink::ZPV, hyperkink::XSV, hyperkink::YSV, hyperkink::ZSV, hyperkink::IsMatter, @@ -96,6 +98,7 @@ DECLARE_SOA_TABLE(HypKinkCand, "AOD", "HYPKINKCANDS", DECLARE_SOA_TABLE(MCHypKinkCand, "AOD", "MCHYPKINKCANDS", o2::soa::Index<>, + hyperkink::MagPolarity, hyperkink::XPV, hyperkink::YPV, hyperkink::ZPV, hyperkink::XSV, hyperkink::YSV, hyperkink::ZSV, hyperkink::IsMatter, diff --git a/PWGLF/TableProducer/Common/kinkBuilder.cxx b/PWGLF/TableProducer/Common/kinkBuilder.cxx index fe1cdc61a87..eb68fe85b39 100644 --- a/PWGLF/TableProducer/Common/kinkBuilder.cxx +++ b/PWGLF/TableProducer/Common/kinkBuilder.cxx @@ -91,6 +91,7 @@ struct kinkCandidate { struct kinkBuilder { enum PartType { kSigmaMinus = 0, + kHypertriton, kHyperhelium4sigma }; Produces outputDataTable; @@ -161,6 +162,11 @@ struct kinkBuilder { mothMass = o2::constants::physics::MassSigmaMinus; chargedDauMass = o2::constants::physics::MassPiMinus; neutDauMass = o2::constants::physics::MassNeutron; + } else if (hypoMoth == kHypertriton) { + charge = 1; + mothMass = o2::constants::physics::MassHyperTriton; + chargedDauMass = o2::constants::physics::MassTriton; + neutDauMass = o2::constants::physics::MassPi0; } else if (hypoMoth == kHyperhelium4sigma) { charge = 2; mothMass = o2::constants::physics::MassHyperHelium4; @@ -199,6 +205,8 @@ struct kinkBuilder { AxisSpec massAxis(100, 1.1, 1.4, "m (GeV/#it{c}^{2})"); if (hypoMoth == kSigmaMinus) { massAxis = AxisSpec{100, 1.1, 1.4, "m (GeV/#it{c}^{2})"}; + } else if (hypoMoth == kHypertriton) { + massAxis = AxisSpec{100, 2.94, 3.2, "m (GeV/#it{c}^{2})"}; } else if (hypoMoth == kHyperhelium4sigma) { massAxis = AxisSpec{100, 3.85, 4.25, "m (GeV/#it{c}^{2})"}; } diff --git a/PWGLF/TableProducer/Nuspex/CMakeLists.txt b/PWGLF/TableProducer/Nuspex/CMakeLists.txt index 66c91c16392..2f1295a8f4f 100644 --- a/PWGLF/TableProducer/Nuspex/CMakeLists.txt +++ b/PWGLF/TableProducer/Nuspex/CMakeLists.txt @@ -94,8 +94,8 @@ o2physics_add_dpl_workflow(nuclei-flow-trees PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DetectorsBase O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(hyperhelium4sigma-reco-task - SOURCES hyperhelium4sigmaRecoTask.cxx +o2physics_add_dpl_workflow(hyperkink-reco-task + SOURCES hyperkinkRecoTask.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) diff --git a/PWGLF/TableProducer/Nuspex/hyperhelium4sigmaRecoTask.cxx b/PWGLF/TableProducer/Nuspex/hyperkinkRecoTask.cxx similarity index 53% rename from PWGLF/TableProducer/Nuspex/hyperhelium4sigmaRecoTask.cxx rename to PWGLF/TableProducer/Nuspex/hyperkinkRecoTask.cxx index 300fe513e8e..e465cee83fc 100644 --- a/PWGLF/TableProducer/Nuspex/hyperhelium4sigmaRecoTask.cxx +++ b/PWGLF/TableProducer/Nuspex/hyperkinkRecoTask.cxx @@ -9,8 +9,8 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. // -/// \file hyperhelium4sigmaRecoTask.cxx -/// \brief QA and analysis task for hyper-helium4sigma (HyperHe4S) +/// \file hyperkinkRecoTask.cxx +/// \brief QA and analysis task for kink decay of hypernuclei /// \author Yuanzhe Wang #include "PWGLF/DataModel/LFHyperNucleiKinkTables.h" @@ -48,22 +48,15 @@ using MCLabeledCollisionsFull = soa::Join; using MCLabeledTracksIU = soa::Join; -enum Channel { - k2body = 0, // helium4, pion0 - k3body_p, // triton, proton, pion0 - k3body_n, // triton, neutron, pion+ - kNDecayChannel +enum PartType { + kHypertriton = 0, + kHyperhelium4sigma }; enum DaughterType { - kDaugAlpha = 0, - kDaugTriton, - kDaugProton, - kDaugChargedPion, - kDaugNeutron, - kDaugPion0, - kNDaughterType, - kNChargedDaughterType = kDaugNeutron + kDaugCharged = 0, + kDaugNeutral, + kNDaughterType }; namespace @@ -72,104 +65,169 @@ constexpr std::array LayerRadii{2.33959f, 3.14076f, 3.91924f, 19.6213f constexpr int kITSLayers = 7; constexpr int kITSInnerBarrelLayers = 3; // constexpr int kITSOuterBarrelLayers = 4; -constexpr std::array kDaugghterPDG = { - o2::constants::physics::Pdg::kAlpha, - o2::constants::physics::Pdg::kTriton, - PDG_t::kProton, - PDG_t::kPiPlus, - PDG_t::kNeutron, - PDG_t::kPi0}; const std::array covPosSV{6.4462712107237135f, 0.1309793068144521f, 6.626654155592929f, -0.4510297694023185f, 0.16996629627762413f, 4.109195981415627f}; std::shared_ptr hMothCounter; -std::shared_ptr hMoth2BCounter; -std::shared_ptr hDaugCounter[kNChargedDaughterType]; -std::shared_ptr hDaugTPCNSigma[kNChargedDaughterType]; +std::shared_ptr hDaugCounter; +std::shared_ptr hDaugTPCNSigma; std::shared_ptr hRecoMothCounter; -std::shared_ptr hRecoDaugAlphaCounter; +std::shared_ptr hRecoDaugCounter; } // namespace //-------------------------------------------------------------- -// Check the decay channel of hyperhelium4sigma -template -Channel getDecayChannelHe4S(TMCParticle const& particle, std::vector& list) -{ - if (std::abs(particle.pdgCode()) != o2::constants::physics::Pdg::kHyperHelium4Sigma) { - return kNDecayChannel; - } +struct H3LDecay { + enum Channel { + k2bodyNeutral = 0, // triton, pion0 + k2bodyCharged, + k3bodyCharged, + kNChannel + }; - // list: charged (alpha or triton), charged or empty, neutral - list.clear(); - list.resize(3, -1); - - bool haveAlpha = false, haveTriton = false, haveProton = false, haveNeuteron = false; - bool haveAntiAlpha = false, haveAntiTriton = false, haveAntiProton = false, haveAntiNeuteron = false; - bool havePionPlus = false, havePionMinus = false, havePion0 = false; - for (const auto& mcDaughter : particle.template daughters_as()) { - if (mcDaughter.pdgCode() == o2::constants::physics::Pdg::kAlpha) { - haveAlpha = true; - list[0] = mcDaughter.globalIndex(); - } - if (mcDaughter.pdgCode() == -o2::constants::physics::Pdg::kAlpha) { - haveAntiAlpha = true; - list[0] = mcDaughter.globalIndex(); - } - if (mcDaughter.pdgCode() == o2::constants::physics::Pdg::kTriton) { - haveTriton = true; - list[0] = mcDaughter.globalIndex(); - } - if (mcDaughter.pdgCode() == -o2::constants::physics::Pdg::kTriton) { - haveAntiTriton = true; - list[0] = mcDaughter.globalIndex(); - } - if (mcDaughter.pdgCode() == PDG_t::kProton) { - haveProton = true; - list[1] = mcDaughter.globalIndex(); - } - if (mcDaughter.pdgCode() == -PDG_t::kProton) { - haveAntiProton = true; - list[1] = mcDaughter.globalIndex(); + template + static Channel getDecayChannel(TMCParticle const& particle, std::vector& list) + { + if (std::abs(particle.pdgCode()) != o2::constants::physics::Pdg::kHyperTriton) { + return kNChannel; } - if (mcDaughter.pdgCode() == PDG_t::kNeutron) { - haveNeuteron = true; - list[2] = mcDaughter.globalIndex(); + + list.clear(); + list.resize(2, -1); + + bool haveHelium3 = false, haveAntiHelium3 = false, haveDeuteron = false, haveAntiDeuteron = false; + bool haveProton = false, haveAntiProton = false, havePionPlus = false, havePionMinus = false; + bool haveTriton = false, haveAntiTriton = false, havePion0 = false; + for (const auto& mcDaughter : particle.template daughters_as()) { + if (mcDaughter.pdgCode() == o2::constants::physics::Pdg::kTriton) { + haveTriton = true; + list[0] = mcDaughter.globalIndex(); + } + if (mcDaughter.pdgCode() == -o2::constants::physics::Pdg::kTriton) { + haveAntiTriton = true; + list[0] = mcDaughter.globalIndex(); + } + if (mcDaughter.pdgCode() == PDG_t::kPi0) { + havePion0 = true; + list[1] = mcDaughter.globalIndex(); + } + if (mcDaughter.pdgCode() == o2::constants::physics::Pdg::kHelium3) { + haveHelium3 = true; + } + if (mcDaughter.pdgCode() == -o2::constants::physics::Pdg::kHelium3) { + haveAntiHelium3 = true; + } + if (mcDaughter.pdgCode() == o2::constants::physics::Pdg::kDeuteron) { + haveDeuteron = true; + } + if (mcDaughter.pdgCode() == -o2::constants::physics::Pdg::kDeuteron) { + haveAntiDeuteron = true; + } + if (mcDaughter.pdgCode() == PDG_t::kProton) { + haveProton = true; + } + if (mcDaughter.pdgCode() == -PDG_t::kProton) { + haveAntiProton = true; + } + if (mcDaughter.pdgCode() == PDG_t::kPiPlus) { + havePionPlus = true; + } + if (mcDaughter.pdgCode() == -PDG_t::kPiPlus) { + havePionMinus = true; + } } - if (mcDaughter.pdgCode() == -PDG_t::kNeutron) { - haveAntiNeuteron = true; - list[2] = mcDaughter.globalIndex(); + + if ((haveTriton && havePion0) || (haveAntiTriton && havePion0)) { + return H3LDecay::k2bodyNeutral; + } else if ((haveHelium3 && havePion0) || (haveAntiHelium3 && havePion0)) { + return H3LDecay::k2bodyCharged; + } else if ((haveDeuteron && haveProton && havePionPlus) || (haveAntiDeuteron && haveAntiProton && havePionMinus)) { + return H3LDecay::k3bodyCharged; + } else { + return kNChannel; } - if (mcDaughter.pdgCode() == PDG_t::kPiPlus) { - havePionPlus = true; - list[1] = mcDaughter.globalIndex(); + } +}; + +//-------------------------------------------------------------- +// Check the decay channel of hyperhelium4sigma +struct He4SDecay { + enum Channel { + k2body = 0, // helium4, pion0 + k3body_p, // triton, proton, pion0 + k3body_n, // triton, neutron, pion+ + kNChannel + }; + + template + static Channel getDecayChannel(TMCParticle const& particle, std::vector& list) + { + if (std::abs(particle.pdgCode()) != o2::constants::physics::Pdg::kHyperHelium4Sigma) { + return kNChannel; } - if (mcDaughter.pdgCode() == -PDG_t::kPiPlus) { - havePionMinus = true; - list[1] = mcDaughter.globalIndex(); + + list.clear(); + list.resize(2, -1); + + bool haveAlpha = false, haveTriton = false, haveProton = false, haveNeuteron = false; + bool haveAntiAlpha = false, haveAntiTriton = false, haveAntiProton = false, haveAntiNeuteron = false; + bool havePionPlus = false, havePionMinus = false, havePion0 = false; + for (const auto& mcDaughter : particle.template daughters_as()) { + if (mcDaughter.pdgCode() == o2::constants::physics::Pdg::kAlpha) { + haveAlpha = true; + list[0] = mcDaughter.globalIndex(); + } + if (mcDaughter.pdgCode() == -o2::constants::physics::Pdg::kAlpha) { + haveAntiAlpha = true; + list[0] = mcDaughter.globalIndex(); + } + if (mcDaughter.pdgCode() == o2::constants::physics::Pdg::kTriton) { + haveTriton = true; + } + if (mcDaughter.pdgCode() == -o2::constants::physics::Pdg::kTriton) { + haveAntiTriton = true; + } + if (mcDaughter.pdgCode() == PDG_t::kProton) { + haveProton = true; + } + if (mcDaughter.pdgCode() == -PDG_t::kProton) { + haveAntiProton = true; + } + if (mcDaughter.pdgCode() == PDG_t::kNeutron) { + haveNeuteron = true; + } + if (mcDaughter.pdgCode() == -PDG_t::kNeutron) { + haveAntiNeuteron = true; + } + if (mcDaughter.pdgCode() == PDG_t::kPiPlus) { + havePionPlus = true; + } + if (mcDaughter.pdgCode() == -PDG_t::kPiPlus) { + havePionMinus = true; + } + if (mcDaughter.pdgCode() == PDG_t::kPi0) { + havePion0 = true; + list[1] = mcDaughter.globalIndex(); + } } - if (mcDaughter.pdgCode() == PDG_t::kPi0) { - havePion0 = true; - list[2] = mcDaughter.globalIndex(); + + if ((haveAlpha && havePion0) || (haveAntiAlpha && havePion0)) { + return He4SDecay::k2body; + } else if ((haveTriton && haveProton && havePion0) || (haveAntiTriton && haveAntiProton && havePion0)) { + return He4SDecay::k3body_p; + } else if ((haveTriton && haveNeuteron && havePionPlus) || (haveAntiTriton && haveAntiNeuteron && havePionMinus)) { + return He4SDecay::k3body_n; } - } - if ((haveAlpha && havePion0) || (haveAntiAlpha && havePion0)) { - return k2body; - } else if ((haveTriton && haveProton && havePion0) || (haveAntiTriton && haveAntiProton && havePion0)) { - return k3body_p; - } else if ((haveTriton && haveNeuteron && havePionPlus) || (haveAntiTriton && haveAntiNeuteron && havePionMinus)) { - return k3body_n; + return kNChannel; } - - return kNDecayChannel; -} +}; //-------------------------------------------------------------- // Extract track parameters from a mcparticle, use global coordinates as the local one template o2::track::TrackParametrization getTrackParFromMC(const T& mcparticle, int charge = 1) { - int sign = mcparticle.pdgCode() > 0 ? 1 : -1; // ok for hyperhelium4sigma + int sign = mcparticle.pdgCode() > 0 ? 1 : -1; // ok for hypernuclei TrackPrecision snp = mcparticle.py() / (mcparticle.pt() + 1.e-10f); TrackPrecision tgl = mcparticle.pz() / (mcparticle.pt() + 1.e-10f); std::array arraypar = {mcparticle.vy(), mcparticle.vz(), snp, @@ -201,25 +259,38 @@ void setTrackIDForMC(std::vector& mcPartIndices, aod::McParticles const } } +//-------------------------------------------------------------- +// get ITSNSigma for daughter track +template +float getITSNSigma(const TTrack& track, o2::aod::ITSResponse& itsResponse, o2::track::PID partType) +{ + float nSigma = -999.f; + switch (partType) { + case o2::track::PID::Alpha: + nSigma = itsResponse.nSigmaITS(track); + break; + case o2::track::PID::Triton: + nSigma = itsResponse.nSigmaITS(track); + break; + default: + break; + } + return nSigma; +} + //-------------------------------------------------------------- // get TPCNSigma for daughter track template -float getTPCNSigma(const TTrack& track, const int daughterType) +float getTPCNSigma(const TTrack& track, o2::track::PID partType) { float nSigma = -999.f; - switch (daughterType) { - case kDaugAlpha: + switch (partType) { + case o2::track::PID::Alpha: nSigma = track.tpcNSigmaAl(); break; - case kDaugTriton: + case o2::track::PID::Triton: nSigma = track.tpcNSigmaTr(); break; - case kDaugProton: - nSigma = track.tpcNSigmaPr(); - break; - case kDaugChargedPion: - nSigma = track.tpcNSigmaPi(); - break; default: break; } @@ -256,7 +327,7 @@ bool refitMotherTrack(const TTrack& track, o2::track::TrackParametrizationWithEr } //-------------------------------------------------------------- -struct Hyphe4sCandidate { +struct HypKinkCandidate { bool isMatter = false; @@ -293,8 +364,8 @@ struct Hyphe4sCandidate { }; //-------------------------------------------------------------- -// analysis task for hyperhelium4sigma 2-body decay -struct Hyperhelium4sigmaRecoTask { +// analysis task for 2-body kink decay +struct HyperkinkRecoTask { Produces outputDataTable; Produces outputMCTable; @@ -302,15 +373,16 @@ struct Hyperhelium4sigmaRecoTask { Service ccdb; o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT; - std::vector mcHe4sIndices; + std::vector mcPartIndices; // Histograms are defined with HistogramRegistry HistogramRegistry registry{"registry", {}}; + Configurable hypoMoth{"hypoMoth", kHypertriton, "Mother particle hypothesis"}; // Configurable for event selection Configurable doEventCut{"doEventCut", true, "Apply event selection"}; Configurable maxZVertex{"maxZVertex", 10.0f, "Accepted z-vertex range (cm)"}; - Configurable cutNSigmaAl{"cutNSigmaAl", 5, "NSigmaTPCAlpha"}; + Configurable cutNSigmaDaug{"cutNSigmaDaug", 5, "TPC NSigmaTPC cut for daughter tracks"}; // CCDB options Configurable inputBz{"inputBz", -999, "bz field, -999 is automatic"}; @@ -324,15 +396,37 @@ struct Hyperhelium4sigmaRecoTask { o2::aod::ITSResponse itsResponse; - void init(InitContext const&) + float massChargedDaug = 999.f; + float massNeutralDaug = 999.f; + int pdgMoth = 0; + std::array pdgDaug = {o2::constants::physics::Pdg::kTriton, PDG_t::kPi0}; // pdgcode of charged (0) and neutral (1) daughter particles + o2::track::PID pidTypeDaug = o2::track::PID::Triton; + + void init(InitContext&) { + if (hypoMoth == kHypertriton) { + massChargedDaug = o2::constants::physics::MassTriton; + massNeutralDaug = o2::constants::physics::MassPi0; + pdgMoth = o2::constants::physics::Pdg::kHyperTriton; + pdgDaug[kDaugCharged] = o2::constants::physics::Pdg::kTriton; + pdgDaug[kDaugNeutral] = PDG_t::kPi0; + pidTypeDaug = o2::track::PID::Triton; + } else if (hypoMoth == kHyperhelium4sigma) { + massChargedDaug = o2::constants::physics::MassAlpha; + massNeutralDaug = o2::constants::physics::MassPi0; + pdgMoth = o2::constants::physics::Pdg::kHyperHelium4Sigma; + pdgDaug[kDaugCharged] = o2::constants::physics::Pdg::kAlpha; + pdgDaug[kDaugNeutral] = PDG_t::kPi0; + pidTypeDaug = o2::track::PID::Alpha; + } else { + LOG(fatal) << "Unknown mother particle hypothesis"; + } + // Axes const AxisSpec vertexZAxis{100, -15., 15., "vtx_{Z} [cm]"}; const AxisSpec ptAxis{50, -10, 10, "#it{p}_{T} (GeV/#it{c})"}; - const AxisSpec nSigmaAxis{120, -6.f, 6.f, "n#sigma_{#alpha}"}; + const AxisSpec nSigmaAxis{120, -6.f, 6.f, "n#sigma"}; const AxisSpec massAxis{100, 3.85, 4.25, "m (GeV/#it{c}^{2})"}; - const AxisSpec diffPxAxis{200, -10.f, 10.f, "#Delta #it{p}_{x} (GeV/#it{c})"}; - const AxisSpec diffPyAxis{200, -10.f, 10.f, "#Delta #it{p}_{y} (GeV/#it{c})"}; const AxisSpec diffPtAxis{200, -10.f, 10.f, "#Delta #it{p}_{T} (GeV/#it{c})"}; const AxisSpec diffPzAxis{200, -10.f, 10.f, "#Delta #it{p}_{z} (GeV/#it{c})"}; const AxisSpec radiusAxis{40, 0.f, 40.f, "R (cm)"}; @@ -349,24 +443,20 @@ struct Hyperhelium4sigmaRecoTask { registry.add("hDiffSVy", ";#Delta y (cm);", HistType::kTH1F, {{200, -10, 10}}); registry.add("hDiffSVz", ";#Delta z (cm);", HistType::kTH1F, {{200, -10, 10}}); registry.add("h2RecSVRVsTrueSVR", ";Reconstruced SV R (cm);True SV R (cm);", HistType::kTH2F, {radiusAxis, radiusAxis}); - registry.add("h2TrueMotherDiffPxVsRecSVR", ";Reconstruced SV R (cm);#Delta #it{p}_{T} (GeV/#it{c});", HistType::kTH2F, {radiusAxis, diffPxAxis}); - registry.add("h2TrueMotherDiffPyVsRecSVR", ";Reconstruced SV R (cm);#Delta #it{p}_{T} (GeV/#it{c});", HistType::kTH2F, {radiusAxis, diffPyAxis}); registry.add("h2TrueMotherDiffPtVsRecSVR", ";Reconstruced SV R (cm);#Delta #it{p}_{T} (GeV/#it{c});", HistType::kTH2F, {radiusAxis, diffPtAxis}); - registry.add("h2TrueMotherDiffPzVsRecSVR", ";Reconstruced SV R (cm);#Delta #it{p}_{z} (GeV/#it{c});", HistType::kTH2F, {radiusAxis, diffPzAxis}); - registry.add("h2TrueMotherDiffTglVsRecSVR", ";Reconstruced SV R (cm);#Delta tan#lambda;", HistType::kTH2F, {radiusAxis, {200, -0.1, 0.1}}); registry.add("h2TrueMotherDiffEtaVsRecSVR", ";Reconstruced SV R (cm);#Delta #eta;", HistType::kTH2F, {radiusAxis, {200, -0.1, 0.1}}); registry.add("hDiffDauPx", ";#Delta p_{x} (GeV/#it{c}); ", HistType::kTH1D, {{200, -10, 10}}); registry.add("hDiffDauPy", ";#Delta p_{y} (GeV/#it{c}); ", HistType::kTH1D, {{200, -10, 10}}); registry.add("hDiffDauPz", ";#Delta p_{z} (GeV/#it{c}); ", HistType::kTH1D, {{200, -10, 10}}); registry.add("h2TrueSignalMassPt", "h2TrueSignalMassPt", HistType::kTH2F, {{ptAxis, massAxis}}); - registry.add("h2TrueSignalNSigmaAlPt", "h2TrueSignalNSigmaAlPt", HistType::kTH2F, {{ptAxis, nSigmaAxis}}); + registry.add("h2TrueDaugTPCNSigmaPt", "h2TrueDaugTPCNSigmaPt", HistType::kTH2F, {{ptAxis, nSigmaAxis}}); registry.add("hDCAXYMothToRecSV", "hDCAXYMothToRecSV", HistType::kTH1F, {{200, -10, 10}}); registry.add("hDCAZMothToRecSV", "hDCAZMothToRecSV", HistType::kTH1F, {{200, -10, 10}}); } - registry.add("h2MassHyperhelium4sigmaPt", "h2MassHyperhelium4sigmaPt", HistType::kTH2F, {{ptAxis, massAxis}}); - registry.add("h2NSigmaAlPt", "h2NSigmaAlPt", HistType::kTH2F, {{ptAxis, nSigmaAxis}}); + registry.add("h2MothMassPt", "h2MothMassPt", HistType::kTH2F, {{ptAxis, massAxis}}); + registry.add("h2DaugTPCNSigmaPt", "h2DaugTPCNSigmaPt", HistType::kTH2F, {{ptAxis, nSigmaAxis}}); ccdb->setURL(ccdbPath); ccdb->setCaching(true); @@ -394,32 +484,32 @@ struct Hyperhelium4sigmaRecoTask { } template - void fillCandidate(Hyphe4sCandidate& hyphe4sCand, TCollision const& collision, TKindCandidate const& kinkCand, TTrack const& trackMoth, TTrack const& trackDaug) + void fillCandidate(HypKinkCandidate& hypkinkCand, TCollision const& collision, TKindCandidate const& kinkCand, TTrack const& trackMoth, TTrack const& trackDaug) { - hyphe4sCand.isMatter = kinkCand.mothSign() > 0; - hyphe4sCand.posPV[0] = collision.posX(); - hyphe4sCand.posPV[1] = collision.posY(); - hyphe4sCand.posPV[2] = collision.posZ(); - hyphe4sCand.posSV[0] = kinkCand.xDecVtx() + collision.posX(); - hyphe4sCand.posSV[1] = kinkCand.yDecVtx() + collision.posY(); - hyphe4sCand.posSV[2] = kinkCand.zDecVtx() + collision.posZ(); - - hyphe4sCand.momMothSV[0] = kinkCand.pxMoth(); - hyphe4sCand.momMothSV[1] = kinkCand.pyMoth(); - hyphe4sCand.momMothSV[2] = kinkCand.pzMoth(); - hyphe4sCand.momDaugSV[0] = kinkCand.pxDaug(); - hyphe4sCand.momDaugSV[1] = kinkCand.pyDaug(); - hyphe4sCand.momDaugSV[2] = kinkCand.pzDaug(); - - hyphe4sCand.dcaXYMothPv = kinkCand.dcaMothPv(); - hyphe4sCand.dcaXYDaugPv = kinkCand.dcaDaugPv(); - hyphe4sCand.dcaKinkTopo = kinkCand.dcaKinkTopo(); - - fillCandidateRecoMoth(hyphe4sCand, collision, trackMoth); - - hyphe4sCand.itsClusterSizeDaug = trackDaug.itsClusterSizes(); - hyphe4sCand.nSigmaTPCDaug = trackDaug.tpcNSigmaAl(); - hyphe4sCand.nSigmaITSDaug = itsResponse.nSigmaITS(trackDaug); + hypkinkCand.isMatter = kinkCand.mothSign() > 0; + hypkinkCand.posPV[0] = collision.posX(); + hypkinkCand.posPV[1] = collision.posY(); + hypkinkCand.posPV[2] = collision.posZ(); + hypkinkCand.posSV[0] = kinkCand.xDecVtx() + collision.posX(); + hypkinkCand.posSV[1] = kinkCand.yDecVtx() + collision.posY(); + hypkinkCand.posSV[2] = kinkCand.zDecVtx() + collision.posZ(); + + hypkinkCand.momMothSV[0] = kinkCand.pxMoth(); + hypkinkCand.momMothSV[1] = kinkCand.pyMoth(); + hypkinkCand.momMothSV[2] = kinkCand.pzMoth(); + hypkinkCand.momDaugSV[0] = kinkCand.pxDaug(); + hypkinkCand.momDaugSV[1] = kinkCand.pyDaug(); + hypkinkCand.momDaugSV[2] = kinkCand.pzDaug(); + + hypkinkCand.dcaXYMothPv = kinkCand.dcaMothPv(); + hypkinkCand.dcaXYDaugPv = kinkCand.dcaDaugPv(); + hypkinkCand.dcaKinkTopo = kinkCand.dcaKinkTopo(); + + fillCandidateRecoMoth(hypkinkCand, collision, trackMoth); + + hypkinkCand.itsClusterSizeDaug = trackDaug.itsClusterSizes(); + hypkinkCand.nSigmaTPCDaug = getTPCNSigma(trackDaug, pidTypeDaug); + hypkinkCand.nSigmaITSDaug = getITSNSigma(trackDaug, itsResponse, pidTypeDaug); int lastLayerMoth = 0; for (int i = 6; i >= 0; i--) { @@ -432,17 +522,17 @@ struct Hyperhelium4sigmaRecoTask { o2::base::Propagator::Instance()->PropagateToXBxByBz(trackparMother, LayerRadii[lastLayerMoth]); std::array posLastHit{-999.f}; trackparMother.getXYZGlo(posLastHit); - hyphe4sCand.lastPosMoth[0] = posLastHit[0]; - hyphe4sCand.lastPosMoth[1] = posLastHit[1]; - hyphe4sCand.lastPosMoth[2] = posLastHit[2]; + hypkinkCand.lastPosMoth[0] = posLastHit[0]; + hypkinkCand.lastPosMoth[1] = posLastHit[1]; + hypkinkCand.lastPosMoth[2] = posLastHit[2]; } template - void fillCandidateRecoMoth(Hyphe4sCandidate& hyphe4sCand, TCollision const& collision, TTrack const& trackMoth) + void fillCandidateRecoMoth(HypKinkCandidate& hypkinkCand, TCollision const& collision, TTrack const& trackMoth) { - hyphe4sCand.isMothReco = true; - hyphe4sCand.chi2ITSMoth = trackMoth.itsChi2NCl(); - hyphe4sCand.itsClusterSizeMoth = trackMoth.itsClusterSizes(); + hypkinkCand.isMothReco = true; + hypkinkCand.chi2ITSMoth = trackMoth.itsChi2NCl(); + hypkinkCand.itsClusterSizeMoth = trackMoth.itsClusterSizes(); auto motherTrackPar = getTrackParCov(trackMoth); o2::dataformats::VertexBase primaryVtx = {{collision.posX(), collision.posY(), collision.posZ()}, {collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()}}; @@ -450,34 +540,34 @@ struct Hyperhelium4sigmaRecoTask { if (o2::base::Propagator::Instance()->propagateToDCABxByBz(primaryVtx, motherTrackPar, 2.f, o2::base::Propagator::MatCorrType::USEMatCorrLUT)) { motherTrackPar.getPxPyPzGlo(pMotherPv); } - hyphe4sCand.momMothPV[0] = pMotherPv[0]; - hyphe4sCand.momMothPV[1] = pMotherPv[1]; - hyphe4sCand.momMothPV[2] = pMotherPv[2]; + hypkinkCand.momMothPV[0] = pMotherPv[0]; + hypkinkCand.momMothPV[1] = pMotherPv[1]; + hypkinkCand.momMothPV[2] = pMotherPv[2]; std::array updatePMotherPv = {-999.f}; if (motherTrackPar.update(primaryVtx)) { motherTrackPar.getPxPyPzGlo(updatePMotherPv); } - hyphe4sCand.updateMomMothPV[0] = updatePMotherPv[0]; - hyphe4sCand.updateMomMothPV[1] = updatePMotherPv[1]; - hyphe4sCand.updateMomMothPV[2] = updatePMotherPv[2]; + hypkinkCand.updateMomMothPV[0] = updatePMotherPv[0]; + hypkinkCand.updateMomMothPV[1] = updatePMotherPv[1]; + hypkinkCand.updateMomMothPV[2] = updatePMotherPv[2]; } template - void fillCandidateMCInfo(Hyphe4sCandidate& hyphe4sCand, TMCParticle const& mcMothTrack, TMCParticle const& mcDauTrack, TMCParticle const& mcNeutDauTrack) + void fillCandidateMCInfo(HypKinkCandidate& hypkinkCand, TMCParticle const& mcMothTrack, TMCParticle const& mcDaugTrack, TMCParticle const& mcNeutDauTrack) { - hyphe4sCand.truePosSV[0] = mcDauTrack.vx(); - hyphe4sCand.truePosSV[1] = mcDauTrack.vy(); - hyphe4sCand.truePosSV[2] = mcDauTrack.vz(); - hyphe4sCand.trueMomMothPV[0] = mcMothTrack.px(); - hyphe4sCand.trueMomMothPV[1] = mcMothTrack.py(); - hyphe4sCand.trueMomMothPV[2] = mcMothTrack.pz(); - hyphe4sCand.trueMomMothSV[0] = mcDauTrack.px() + mcNeutDauTrack.px(); - hyphe4sCand.trueMomMothSV[1] = mcDauTrack.py() + mcNeutDauTrack.py(); - hyphe4sCand.trueMomMothSV[2] = mcDauTrack.pz() + mcNeutDauTrack.pz(); - hyphe4sCand.trueMomDaugSV[0] = mcDauTrack.px(); - hyphe4sCand.trueMomDaugSV[1] = mcDauTrack.py(); - hyphe4sCand.trueMomDaugSV[2] = mcDauTrack.pz(); + hypkinkCand.truePosSV[0] = mcDaugTrack.vx(); + hypkinkCand.truePosSV[1] = mcDaugTrack.vy(); + hypkinkCand.truePosSV[2] = mcDaugTrack.vz(); + hypkinkCand.trueMomMothPV[0] = mcMothTrack.px(); + hypkinkCand.trueMomMothPV[1] = mcMothTrack.py(); + hypkinkCand.trueMomMothPV[2] = mcMothTrack.pz(); + hypkinkCand.trueMomMothSV[0] = mcDaugTrack.px() + mcNeutDauTrack.px(); + hypkinkCand.trueMomMothSV[1] = mcDaugTrack.py() + mcNeutDauTrack.py(); + hypkinkCand.trueMomMothSV[2] = mcDaugTrack.pz() + mcNeutDauTrack.pz(); + hypkinkCand.trueMomDaugSV[0] = mcDaugTrack.px(); + hypkinkCand.trueMomDaugSV[1] = mcDaugTrack.py(); + hypkinkCand.trueMomDaugSV[2] = mcDaugTrack.pz(); } void processData(CollisionsFull const& collisions, aod::KinkCands const& KinkCands, FullTracksExtIU const&, aod::BCs const&) @@ -500,19 +590,20 @@ struct Hyperhelium4sigmaRecoTask { registry.fill(HIST("hCandidateCounter"), 1); auto dauTrack = kinkCand.trackDaug_as(); - if (std::abs(dauTrack.tpcNSigmaAl()) > cutNSigmaAl) { + float tpcNSigmaDaug = getTPCNSigma(dauTrack, pidTypeDaug); + if (std::abs(tpcNSigmaDaug) > cutNSigmaDaug) { continue; } - float invMass = RecoDecay::m(std::array{std::array{kinkCand.pxDaug(), kinkCand.pyDaug(), kinkCand.pzDaug()}, std::array{kinkCand.pxDaugNeut(), kinkCand.pyDaugNeut(), kinkCand.pzDaugNeut()}}, std::array{o2::constants::physics::MassAlpha, o2::constants::physics::MassPi0}); + float invMass = RecoDecay::m(std::array{std::array{kinkCand.pxDaug(), kinkCand.pyDaug(), kinkCand.pzDaug()}, std::array{kinkCand.pxDaugNeut(), kinkCand.pyDaugNeut(), kinkCand.pzDaugNeut()}}, std::array{massChargedDaug, massNeutralDaug}); registry.fill(HIST("hCandidateCounter"), 2); - registry.fill(HIST("h2MassHyperhelium4sigmaPt"), kinkCand.mothSign() * kinkCand.ptMoth(), invMass); - registry.fill(HIST("h2NSigmaAlPt"), kinkCand.mothSign() * kinkCand.ptDaug(), dauTrack.tpcNSigmaAl()); + registry.fill(HIST("h2MothMassPt"), kinkCand.mothSign() * kinkCand.ptMoth(), invMass); + registry.fill(HIST("h2DaugTPCNSigmaPt"), kinkCand.mothSign() * kinkCand.ptDaug(), tpcNSigmaDaug); auto bc = collision.bc_as(); initCCDB(bc); auto motherTrack = kinkCand.trackMoth_as(); - Hyphe4sCandidate hyphe4sCand; - fillCandidate(hyphe4sCand, collision, kinkCand, motherTrack, dauTrack); + HypKinkCandidate hypkinkCand; + fillCandidate(hypkinkCand, collision, kinkCand, motherTrack, dauTrack); o2::dataformats::VertexBase primaryVtx = {{collision.posX(), collision.posY(), collision.posZ()}, {collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()}}; o2::dataformats::VertexBase secondaryVtx = {{kinkCand.xDecVtx() + collision.posX(), kinkCand.yDecVtx() + collision.posY(), kinkCand.zDecVtx() + collision.posZ()}, {covPosSV[0], covPosSV[1], covPosSV[2], covPosSV[3], covPosSV[4], covPosSV[5]}}; @@ -526,30 +617,31 @@ struct Hyperhelium4sigmaRecoTask { } outputDataTable( - hyphe4sCand.posPV[0], hyphe4sCand.posPV[1], hyphe4sCand.posPV[2], - hyphe4sCand.posSV[0], hyphe4sCand.posSV[1], hyphe4sCand.posSV[2], - hyphe4sCand.isMatter, - hyphe4sCand.lastPosMoth[0], hyphe4sCand.lastPosMoth[1], hyphe4sCand.lastPosMoth[2], - hyphe4sCand.momMothSV[0], hyphe4sCand.momMothSV[1], hyphe4sCand.momMothSV[2], + mBz > 0 ? 1 : -1, + hypkinkCand.posPV[0], hypkinkCand.posPV[1], hypkinkCand.posPV[2], + hypkinkCand.posSV[0], hypkinkCand.posSV[1], hypkinkCand.posSV[2], + hypkinkCand.isMatter, + hypkinkCand.lastPosMoth[0], hypkinkCand.lastPosMoth[1], hypkinkCand.lastPosMoth[2], + hypkinkCand.momMothSV[0], hypkinkCand.momMothSV[1], hypkinkCand.momMothSV[2], refitPPV[0], refitPPV[1], refitPPV[2], refitPSV[0], refitPSV[1], refitPSV[2], - hyphe4sCand.momDaugSV[0], hyphe4sCand.momDaugSV[1], hyphe4sCand.momDaugSV[2], - hyphe4sCand.dcaXYMothPv, hyphe4sCand.dcaXYDaugPv, hyphe4sCand.dcaKinkTopo, - hyphe4sCand.chi2ITSMoth, hyphe4sCand.itsClusterSizeMoth, hyphe4sCand.itsClusterSizeDaug, - hyphe4sCand.nSigmaTPCDaug, hyphe4sCand.nSigmaITSDaug); + hypkinkCand.momDaugSV[0], hypkinkCand.momDaugSV[1], hypkinkCand.momDaugSV[2], + hypkinkCand.dcaXYMothPv, hypkinkCand.dcaXYDaugPv, hypkinkCand.dcaKinkTopo, + hypkinkCand.chi2ITSMoth, hypkinkCand.itsClusterSizeMoth, hypkinkCand.itsClusterSizeDaug, + hypkinkCand.nSigmaTPCDaug, hypkinkCand.nSigmaITSDaug); } } - PROCESS_SWITCH(Hyperhelium4sigmaRecoTask, processData, "process data", true); + PROCESS_SWITCH(HyperkinkRecoTask, processData, "process data", true); void processMC(MCLabeledCollisionsFull const& collisions, aod::KinkCands const& KinkCands, MCLabeledTracksIU const& tracks, aod::McParticles const& particlesMC, aod::McCollisions const& mcCollisions, aod::BCs const&) { - mcHe4sIndices.clear(); + mcPartIndices.clear(); std::vector mcPartIndices; setTrackIDForMC(mcPartIndices, particlesMC, tracks); std::vector isReconstructedMCCollisions(mcCollisions.size(), false); std::vector isSelectedMCCollisions(mcCollisions.size(), false); std::vector isGoodCollisions(collisions.size(), false); - std::vector dauIDList(3, -1); + std::vector dauIDList(2, -1); for (const auto& collision : collisions) { isReconstructedMCCollisions[collision.mcCollisionId()] = true; @@ -567,18 +659,25 @@ struct Hyperhelium4sigmaRecoTask { auto motherTrack = kinkCand.trackMoth_as(); auto dauTrack = kinkCand.trackDaug_as(); - bool isTrueSignal = false; + bool isKinkSignal = false; if (motherTrack.has_mcParticle() && dauTrack.has_mcParticle()) { - auto mcMotherTrack = motherTrack.mcParticle_as(); - auto mcDauTrack = dauTrack.mcParticle_as(); - auto dChannel = getDecayChannelHe4S(mcMotherTrack, dauIDList); - if (dChannel == k2body && dauIDList[0] == mcDauTrack.globalIndex()) { - isTrueSignal = true; + auto mcMothTrack = motherTrack.mcParticle_as(); + auto mcDaugTrack = dauTrack.mcParticle_as(); + if (hypoMoth == kHypertriton) { + auto dChannel = H3LDecay::getDecayChannel(mcMothTrack, dauIDList); + if (dChannel == H3LDecay::k2bodyNeutral && dauIDList[0] == mcDaugTrack.globalIndex()) { + isKinkSignal = true; + } + } else if (hypoMoth == kHyperhelium4sigma) { + auto dChannel = He4SDecay::getDecayChannel(mcMothTrack, dauIDList); + if (dChannel == He4SDecay::k2body && dauIDList[0] == mcDaugTrack.globalIndex()) { + isKinkSignal = true; + } } } registry.fill(HIST("hCandidateCounter"), 0); - if (isTrueSignal) { + if (isKinkSignal) { registry.fill(HIST("hTrueCandidateCounter"), 0); } auto collision = kinkCand.collision_as(); @@ -586,25 +685,26 @@ struct Hyperhelium4sigmaRecoTask { continue; } registry.fill(HIST("hCandidateCounter"), 1); - if (isTrueSignal) { + if (isKinkSignal) { registry.fill(HIST("hTrueCandidateCounter"), 1); } - if (std::abs(dauTrack.tpcNSigmaAl()) > cutNSigmaAl) { + float tpcNSigmaDaug = getTPCNSigma(dauTrack, pidTypeDaug); + if (std::abs(tpcNSigmaDaug) > cutNSigmaDaug) { continue; } - float invMass = RecoDecay::m(std::array{std::array{kinkCand.pxDaug(), kinkCand.pyDaug(), kinkCand.pzDaug()}, std::array{kinkCand.pxDaugNeut(), kinkCand.pyDaugNeut(), kinkCand.pzDaugNeut()}}, std::array{o2::constants::physics::MassAlpha, o2::constants::physics::MassPi0}); + float invMass = RecoDecay::m(std::array{std::array{kinkCand.pxDaug(), kinkCand.pyDaug(), kinkCand.pzDaug()}, std::array{kinkCand.pxDaugNeut(), kinkCand.pyDaugNeut(), kinkCand.pzDaugNeut()}}, std::array{massChargedDaug, massNeutralDaug}); registry.fill(HIST("hCandidateCounter"), 2); - if (isTrueSignal) { + if (isKinkSignal) { registry.fill(HIST("hTrueCandidateCounter"), 2); } - registry.fill(HIST("h2MassHyperhelium4sigmaPt"), kinkCand.mothSign() * kinkCand.ptMoth(), invMass); - registry.fill(HIST("h2NSigmaAlPt"), kinkCand.mothSign() * kinkCand.ptDaug(), dauTrack.tpcNSigmaAl()); + registry.fill(HIST("h2MothMassPt"), kinkCand.mothSign() * kinkCand.ptMoth(), invMass); + registry.fill(HIST("h2DaugTPCNSigmaPt"), kinkCand.mothSign() * kinkCand.ptDaug(), tpcNSigmaDaug); auto bc = collision.bc_as(); initCCDB(bc); - Hyphe4sCandidate hyphe4sCand; - fillCandidate(hyphe4sCand, collision, kinkCand, motherTrack, dauTrack); + HypKinkCandidate hypkinkCand; + fillCandidate(hypkinkCand, collision, kinkCand, motherTrack, dauTrack); std::array posDecVtx = {kinkCand.xDecVtx() + collision.posX(), kinkCand.yDecVtx() + collision.posY(), kinkCand.zDecVtx() + collision.posZ()}; @@ -619,79 +719,74 @@ struct Hyperhelium4sigmaRecoTask { motherTrackPar.getPxPyPzGlo(refitPPV); } - // qa for true signal - if (isTrueSignal) { - auto mcMotherTrack = motherTrack.mcParticle_as(); - auto mcDauTrack = dauTrack.mcParticle_as(); - auto mcNeutTrack = particlesMC.rawIteratorAt(dauIDList[2]); + // QA, store mcInfo for true signals + if (isKinkSignal) { + auto mcMothTrack = motherTrack.mcParticle_as(); + auto mcDaugTrack = dauTrack.mcParticle_as(); + auto mcNeutTrack = particlesMC.rawIteratorAt(dauIDList[1]); float recSVR = std::sqrt(posDecVtx[0] * posDecVtx[0] + posDecVtx[1] * posDecVtx[1]); - registry.fill(HIST("hDiffSVx"), posDecVtx[0] - mcDauTrack.vx()); - registry.fill(HIST("hDiffSVy"), posDecVtx[1] - mcDauTrack.vy()); - registry.fill(HIST("hDiffSVz"), posDecVtx[2] - mcDauTrack.vz()); - registry.fill(HIST("h2RecSVRVsTrueSVR"), recSVR, std::hypot(mcDauTrack.vx(), mcDauTrack.vy())); - registry.fill(HIST("h2TrueMotherDiffPtVsRecSVR"), recSVR, mcMotherTrack.pt() - kinkCand.ptMoth()); - registry.fill(HIST("h2TrueMotherDiffPzVsRecSVR"), recSVR, mcMotherTrack.pz() - kinkCand.pzMoth()); - registry.fill(HIST("h2TrueMotherDiffTglVsRecSVR"), recSVR, mcMotherTrack.pz() / mcMotherTrack.pt() - motherTrack.tgl()); - registry.fill(HIST("h2TrueMotherDiffEtaVsRecSVR"), recSVR, mcMotherTrack.eta() - motherTrack.eta()); - registry.fill(HIST("hDiffDauPx"), kinkCand.pxDaug() - mcDauTrack.px()); - registry.fill(HIST("hDiffDauPy"), kinkCand.pyDaug() - mcDauTrack.py()); - registry.fill(HIST("hDiffDauPz"), kinkCand.pzDaug() - mcDauTrack.pz()); + registry.fill(HIST("hDiffSVx"), posDecVtx[0] - mcDaugTrack.vx()); + registry.fill(HIST("hDiffSVy"), posDecVtx[1] - mcDaugTrack.vy()); + registry.fill(HIST("hDiffSVz"), posDecVtx[2] - mcDaugTrack.vz()); + registry.fill(HIST("h2RecSVRVsTrueSVR"), recSVR, std::hypot(mcDaugTrack.vx(), mcDaugTrack.vy())); + registry.fill(HIST("h2TrueMotherDiffPtVsRecSVR"), recSVR, mcMothTrack.pt() - kinkCand.ptMoth()); + registry.fill(HIST("h2TrueMotherDiffEtaVsRecSVR"), recSVR, mcMothTrack.eta() - motherTrack.eta()); + registry.fill(HIST("hDiffDauPx"), kinkCand.pxDaug() - mcDaugTrack.px()); + registry.fill(HIST("hDiffDauPy"), kinkCand.pyDaug() - mcDaugTrack.py()); + registry.fill(HIST("hDiffDauPz"), kinkCand.pzDaug() - mcDaugTrack.pz()); registry.fill(HIST("h2TrueSignalMassPt"), kinkCand.mothSign() * kinkCand.ptMoth(), invMass); - registry.fill(HIST("h2TrueSignalNSigmaAlPt"), kinkCand.mothSign() * kinkCand.ptDaug(), dauTrack.tpcNSigmaAl()); + registry.fill(HIST("h2TrueDaugTPCNSigmaPt"), kinkCand.mothSign() * kinkCand.ptDaug(), tpcNSigmaDaug); - hyphe4sCand.isSignal = true; - hyphe4sCand.isSignalReco = true; - hyphe4sCand.isCollReco = true; - hyphe4sCand.isSurvEvSelection = true; - fillCandidateMCInfo(hyphe4sCand, mcMotherTrack, mcDauTrack, mcNeutTrack); - mcHe4sIndices.push_back(mcMotherTrack.globalIndex()); + hypkinkCand.isSignal = true; + hypkinkCand.isSignalReco = true; + hypkinkCand.isCollReco = true; + hypkinkCand.isSurvEvSelection = true; + fillCandidateMCInfo(hypkinkCand, mcMothTrack, mcDaugTrack, mcNeutTrack); + mcPartIndices.push_back(mcMothTrack.globalIndex()); std::array dcaInfo; - auto mcMotherTrackPar = getTrackParFromMC(mcMotherTrack, 2); - o2::base::Propagator::Instance()->propagateToDCABxByBz({posDecVtx[0], posDecVtx[1], posDecVtx[2]}, mcMotherTrackPar, 2.f, matCorr, &dcaInfo); + auto mcMothTrackPar = getTrackParFromMC(mcMothTrack, 2); + o2::base::Propagator::Instance()->propagateToDCABxByBz({posDecVtx[0], posDecVtx[1], posDecVtx[2]}, mcMothTrackPar, 2.f, matCorr, &dcaInfo); registry.fill(HIST("hDCAXYMothToRecSV"), dcaInfo[0]); registry.fill(HIST("hDCAZMothToRecSV"), dcaInfo[1]); - std::array mcPMotherSV = {-999.f, -999.f, -999.f}; - mcMotherTrackPar.getPxPyPzGlo(mcPMotherSV); - registry.fill(HIST("h2TrueMotherDiffPxVsRecSVR"), recSVR, mcPMotherSV[0] - kinkCand.pxMoth()); - registry.fill(HIST("h2TrueMotherDiffPyVsRecSVR"), recSVR, mcPMotherSV[1] - kinkCand.pyMoth()); } outputMCTable( - hyphe4sCand.posPV[0], hyphe4sCand.posPV[1], hyphe4sCand.posPV[2], - hyphe4sCand.posSV[0], hyphe4sCand.posSV[1], hyphe4sCand.posSV[2], - hyphe4sCand.isMatter, - hyphe4sCand.lastPosMoth[0], hyphe4sCand.lastPosMoth[1], hyphe4sCand.lastPosMoth[2], - hyphe4sCand.momMothSV[0], hyphe4sCand.momMothSV[1], hyphe4sCand.momMothSV[2], + mBz > 0 ? 1 : -1, + hypkinkCand.posPV[0], hypkinkCand.posPV[1], hypkinkCand.posPV[2], + hypkinkCand.posSV[0], hypkinkCand.posSV[1], hypkinkCand.posSV[2], + hypkinkCand.isMatter, + hypkinkCand.lastPosMoth[0], hypkinkCand.lastPosMoth[1], hypkinkCand.lastPosMoth[2], + hypkinkCand.momMothSV[0], hypkinkCand.momMothSV[1], hypkinkCand.momMothSV[2], refitPPV[0], refitPPV[1], refitPPV[2], refitPSV[0], refitPSV[1], refitPSV[2], - hyphe4sCand.momDaugSV[0], hyphe4sCand.momDaugSV[1], hyphe4sCand.momDaugSV[2], - hyphe4sCand.dcaXYMothPv, hyphe4sCand.dcaXYDaugPv, hyphe4sCand.dcaKinkTopo, - hyphe4sCand.chi2ITSMoth, hyphe4sCand.itsClusterSizeMoth, hyphe4sCand.itsClusterSizeDaug, - hyphe4sCand.nSigmaTPCDaug, hyphe4sCand.nSigmaITSDaug, - hyphe4sCand.isSignal, hyphe4sCand.isSignalReco, hyphe4sCand.isCollReco, hyphe4sCand.isSurvEvSelection, - hyphe4sCand.truePosSV[0], hyphe4sCand.truePosSV[1], hyphe4sCand.truePosSV[2], - hyphe4sCand.trueMomMothPV[0], hyphe4sCand.trueMomMothPV[1], hyphe4sCand.trueMomMothPV[2], - hyphe4sCand.trueMomMothSV[0], hyphe4sCand.trueMomMothSV[1], hyphe4sCand.trueMomMothSV[2], - hyphe4sCand.trueMomDaugSV[0], hyphe4sCand.trueMomDaugSV[1], hyphe4sCand.trueMomDaugSV[2], - hyphe4sCand.isMothReco, hyphe4sCand.momMothPV[0], hyphe4sCand.momMothPV[1], hyphe4sCand.momMothPV[2], - hyphe4sCand.updateMomMothPV[0], hyphe4sCand.updateMomMothPV[1], hyphe4sCand.updateMomMothPV[2]); + hypkinkCand.momDaugSV[0], hypkinkCand.momDaugSV[1], hypkinkCand.momDaugSV[2], + hypkinkCand.dcaXYMothPv, hypkinkCand.dcaXYDaugPv, hypkinkCand.dcaKinkTopo, + hypkinkCand.chi2ITSMoth, hypkinkCand.itsClusterSizeMoth, hypkinkCand.itsClusterSizeDaug, + hypkinkCand.nSigmaTPCDaug, hypkinkCand.nSigmaITSDaug, + hypkinkCand.isSignal, hypkinkCand.isSignalReco, hypkinkCand.isCollReco, hypkinkCand.isSurvEvSelection, + hypkinkCand.truePosSV[0], hypkinkCand.truePosSV[1], hypkinkCand.truePosSV[2], + hypkinkCand.trueMomMothPV[0], hypkinkCand.trueMomMothPV[1], hypkinkCand.trueMomMothPV[2], + hypkinkCand.trueMomMothSV[0], hypkinkCand.trueMomMothSV[1], hypkinkCand.trueMomMothSV[2], + hypkinkCand.trueMomDaugSV[0], hypkinkCand.trueMomDaugSV[1], hypkinkCand.trueMomDaugSV[2], + hypkinkCand.isMothReco, hypkinkCand.momMothPV[0], hypkinkCand.momMothPV[1], hypkinkCand.momMothPV[2], + hypkinkCand.updateMomMothPV[0], hypkinkCand.updateMomMothPV[1], hypkinkCand.updateMomMothPV[2]); } - // fill hyperhelium4sigma signals which are not reconstructed + // fill kink signals which are not reconstructed for (auto const& mcparticle : particlesMC) { - auto dChannel = getDecayChannelHe4S(mcparticle, dauIDList); - if (dChannel != k2body) { + auto dChannel = He4SDecay::getDecayChannel(mcparticle, dauIDList); + if (dChannel != He4SDecay::k2body) { continue; } - if (std::find(mcHe4sIndices.begin(), mcHe4sIndices.end(), mcparticle.globalIndex()) != mcHe4sIndices.end()) { + if (std::find(mcPartIndices.begin(), mcPartIndices.end(), mcparticle.globalIndex()) != mcPartIndices.end()) { continue; } - Hyphe4sCandidate hyphe4sCand; - auto mcDauTrack = particlesMC.rawIteratorAt(dauIDList[0]); - auto mcNeutTrack = particlesMC.rawIteratorAt(dauIDList[2]); - fillCandidateMCInfo(hyphe4sCand, mcparticle, mcDauTrack, mcNeutTrack); + HypKinkCandidate hypkinkCand; + auto mcDaugTrack = particlesMC.rawIteratorAt(dauIDList[0]); + auto mcNeutTrack = particlesMC.rawIteratorAt(dauIDList[1]); + fillCandidateMCInfo(hypkinkCand, mcparticle, mcDaugTrack, mcNeutTrack); if (mcPartIndices[mcparticle.globalIndex()] != -1) { auto mothTrack = tracks.rawIteratorAt(mcPartIndices[mcparticle.globalIndex()]); @@ -699,11 +794,12 @@ struct Hyperhelium4sigmaRecoTask { auto collision = mothTrack.collision_as(); auto bc = collision.template bc_as(); initCCDB(bc); - fillCandidateRecoMoth(hyphe4sCand, collision, mothTrack); + fillCandidateRecoMoth(hypkinkCand, collision, mothTrack); } } outputMCTable( + mBz > 0 ? 1 : -1, -1, -1, -1, -1, -1, -1, -1, @@ -716,20 +812,22 @@ struct Hyperhelium4sigmaRecoTask { -1, -1, -1, -1, -1, true, false, isReconstructedMCCollisions[mcparticle.mcCollisionId()], isSelectedMCCollisions[mcparticle.mcCollisionId()], - hyphe4sCand.truePosSV[0], hyphe4sCand.truePosSV[1], hyphe4sCand.truePosSV[2], - hyphe4sCand.trueMomMothPV[0], hyphe4sCand.trueMomMothPV[1], hyphe4sCand.trueMomMothPV[2], - hyphe4sCand.trueMomMothSV[0], hyphe4sCand.trueMomMothSV[1], hyphe4sCand.trueMomMothSV[2], - hyphe4sCand.trueMomDaugSV[0], hyphe4sCand.trueMomDaugSV[1], hyphe4sCand.trueMomDaugSV[2], - hyphe4sCand.isMothReco, hyphe4sCand.momMothPV[0], hyphe4sCand.momMothPV[1], hyphe4sCand.momMothPV[2], - hyphe4sCand.updateMomMothPV[0], hyphe4sCand.updateMomMothPV[1], hyphe4sCand.updateMomMothPV[2]); + hypkinkCand.truePosSV[0], hypkinkCand.truePosSV[1], hypkinkCand.truePosSV[2], + hypkinkCand.trueMomMothPV[0], hypkinkCand.trueMomMothPV[1], hypkinkCand.trueMomMothPV[2], + hypkinkCand.trueMomMothSV[0], hypkinkCand.trueMomMothSV[1], hypkinkCand.trueMomMothSV[2], + hypkinkCand.trueMomDaugSV[0], hypkinkCand.trueMomDaugSV[1], hypkinkCand.trueMomDaugSV[2], + hypkinkCand.isMothReco, hypkinkCand.momMothPV[0], hypkinkCand.momMothPV[1], hypkinkCand.momMothPV[2], + hypkinkCand.updateMomMothPV[0], hypkinkCand.updateMomMothPV[1], hypkinkCand.updateMomMothPV[2]); } } - PROCESS_SWITCH(Hyperhelium4sigmaRecoTask, processMC, "process MC", false); + PROCESS_SWITCH(HyperkinkRecoTask, processMC, "process MC", false); }; //-------------------------------------------------------------- // check the performance of mcparticle -struct Hyperhelium4sigmaQa { +struct HyperkinkQa { + + Configurable hypoMoth{"hypoMoth", kHypertriton, "Mother particle hypothesis"}; HistogramRegistry genQAHist{"genQAHist", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry recoQAHist{"recoQAHist", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; @@ -743,11 +841,38 @@ struct Hyperhelium4sigmaQa { o2::aod::ITSResponse itsResponse; + float massMoth = 999.f; + float massChargedDaug = 999.f; + float massNeutralDaug = 999.f; + int pdgMoth = 0; + std::array pdgDaug = {o2::constants::physics::Pdg::kTriton, PDG_t::kPi0}; // pdgcode of charged (0) and neutral (1) daughter particles + o2::track::PID pidTypeDaug = o2::track::PID::Triton; + void init(InitContext&) { if (doprocessMC == true) { itsResponse.setMCDefaultParameters(); + if (hypoMoth == kHypertriton) { + massMoth = o2::constants::physics::MassHyperTriton; + massChargedDaug = o2::constants::physics::MassTriton; + massNeutralDaug = o2::constants::physics::MassPi0; + pdgMoth = o2::constants::physics::Pdg::kHyperTriton; + pdgDaug[kDaugCharged] = o2::constants::physics::Pdg::kTriton; + pdgDaug[kDaugNeutral] = PDG_t::kPi0; + pidTypeDaug = o2::track::PID::Triton; + } else if (hypoMoth == kHyperhelium4sigma) { + massMoth = o2::constants::physics::MassHyperHelium4Sigma; + massChargedDaug = o2::constants::physics::MassAlpha; + massNeutralDaug = o2::constants::physics::MassPi0; + pdgMoth = o2::constants::physics::Pdg::kHyperHelium4Sigma; + pdgDaug[kDaugCharged] = o2::constants::physics::Pdg::kAlpha; + pdgDaug[kDaugNeutral] = PDG_t::kPi0; + pidTypeDaug = o2::track::PID::Alpha; + } else { + LOG(fatal) << "Unknown mother particle hypothesis"; + } + const AxisSpec pAxis{ptBins, "#it{p} (GeV/#it{c})"}; const AxisSpec ptAxis{ptBins, "#it{p}_{T} (GeV/#it{c})"}; const AxisSpec ctAxis{ctBins, "c#it{t} (cm)"}; @@ -767,62 +892,62 @@ struct Hyperhelium4sigmaQa { hMcCollCounter->GetXaxis()->SetBinLabel(1, "MC Collisions"); hMcCollCounter->GetXaxis()->SetBinLabel(2, "Reconstructed"); - auto hGenHyperHelium4SigmaCounter = genQAHist.add("hGenHyperHelium4SigmaCounter", "", HistType::kTH1F, {{11, 0.f, 11.f}}); - hGenHyperHelium4SigmaCounter->GetXaxis()->SetBinLabel(1, "He4S All"); - hGenHyperHelium4SigmaCounter->GetXaxis()->SetBinLabel(2, "Matter"); - hGenHyperHelium4SigmaCounter->GetXaxis()->SetBinLabel(3, "AntiMatter"); - hGenHyperHelium4SigmaCounter->GetXaxis()->SetBinLabel(4, "#alpha + #pi^{0}"); - hGenHyperHelium4SigmaCounter->GetXaxis()->SetBinLabel(5, "#bar{#alpha} + #pi^{0}"); - hGenHyperHelium4SigmaCounter->GetXaxis()->SetBinLabel(6, "t + p + #pi^{0}"); - hGenHyperHelium4SigmaCounter->GetXaxis()->SetBinLabel(7, "#bar{t} + #bar{p} + #pi^{0}"); - hGenHyperHelium4SigmaCounter->GetXaxis()->SetBinLabel(8, "t + n + #pi^{+}"); - hGenHyperHelium4SigmaCounter->GetXaxis()->SetBinLabel(9, "#bar{t} + #bar{n} + #pi^{+}"); - hGenHyperHelium4SigmaCounter->GetXaxis()->SetBinLabel(10, "Tracks found"); - hGenHyperHelium4SigmaCounter->GetXaxis()->SetBinLabel(11, "Unexpected"); - - auto hEvtSelectedHyperHelium4SigmaCounter = genQAHist.add("hEvtSelectedHyperHelium4SigmaCounter", "", HistType::kTH1F, {{2, 0.f, 2.f}}); - hEvtSelectedHyperHelium4SigmaCounter->GetXaxis()->SetBinLabel(1, "Generated"); - hEvtSelectedHyperHelium4SigmaCounter->GetXaxis()->SetBinLabel(2, "Survived"); - - genQAHist.add("hGenHyperHelium4SigmaP", "", HistType::kTH1F, {pAxis}); - genQAHist.add("hGenHyperHelium4SigmaPt", "", HistType::kTH1F, {ptAxis}); - genQAHist.add("hGenHyperHelium4SigmaCt", "", HistType::kTH1F, {ctAxis}); + if (hypoMoth == kHypertriton) { + auto hGenHyperMothCounter = genQAHist.add("hGenHyperMothCounter", "", HistType::kTH1F, {{10, 0.f, 10.f}}); + hGenHyperMothCounter->GetXaxis()->SetBinLabel(1, "H3L All"); + hGenHyperMothCounter->GetXaxis()->SetBinLabel(2, "Matter"); + hGenHyperMothCounter->GetXaxis()->SetBinLabel(3, "AntiMatter"); + hGenHyperMothCounter->GetXaxis()->SetBinLabel(4, "t + #pi^{0}"); + hGenHyperMothCounter->GetXaxis()->SetBinLabel(5, "#bar{t} + #pi^{0}"); + hGenHyperMothCounter->GetXaxis()->SetBinLabel(6, "he3 + #pi^{-}"); + hGenHyperMothCounter->GetXaxis()->SetBinLabel(7, "#bar{he3} + #pi^{+}"); + hGenHyperMothCounter->GetXaxis()->SetBinLabel(8, "d + p + #pi^{-}"); + hGenHyperMothCounter->GetXaxis()->SetBinLabel(9, "#bar{d} + #bar{p} + #pi^{+}"); + hGenHyperMothCounter->GetXaxis()->SetBinLabel(10, "Others"); + } else if (hypoMoth == kHyperhelium4sigma) { + auto hGenHyperMothCounter = genQAHist.add("hGenHyperMothCounter", "", HistType::kTH1F, {{10, 0.f, 10.f}}); + hGenHyperMothCounter->GetXaxis()->SetBinLabel(1, "He4S All"); + hGenHyperMothCounter->GetXaxis()->SetBinLabel(2, "Matter"); + hGenHyperMothCounter->GetXaxis()->SetBinLabel(3, "AntiMatter"); + hGenHyperMothCounter->GetXaxis()->SetBinLabel(4, "#alpha + #pi^{0}"); + hGenHyperMothCounter->GetXaxis()->SetBinLabel(5, "#bar{#alpha} + #pi^{0}"); + hGenHyperMothCounter->GetXaxis()->SetBinLabel(6, "t + p + #pi^{0}"); + hGenHyperMothCounter->GetXaxis()->SetBinLabel(7, "#bar{t} + #bar{p} + #pi^{0}"); + hGenHyperMothCounter->GetXaxis()->SetBinLabel(8, "t + n + #pi^{+}"); + hGenHyperMothCounter->GetXaxis()->SetBinLabel(9, "#bar{t} + #bar{n} + #pi^{+}"); + hGenHyperMothCounter->GetXaxis()->SetBinLabel(10, "Others"); + } + + auto hEvtSelectedHyperMothCounter = genQAHist.add("hEvtSelectedHyperMothCounter", "", HistType::kTH1F, {{2, 0.f, 2.f}}); + hEvtSelectedHyperMothCounter->GetXaxis()->SetBinLabel(1, "Generated"); + hEvtSelectedHyperMothCounter->GetXaxis()->SetBinLabel(2, "Survived"); + + genQAHist.add("hGenHyperMothP", "", HistType::kTH1F, {pAxis}); + genQAHist.add("hGenHyperMothPt", "", HistType::kTH1F, {ptAxis}); + genQAHist.add("hGenHyperMothCt", "", HistType::kTH1F, {ctAxis}); genQAHist.add("hMcRecoInvMass", "", HistType::kTH1F, {invMassAxis}); // efficiency/criteria studies for tracks which are true candidates hMothCounter = recoQAHist.add("hMothCounter", "", HistType::kTH1F, {{9, 0.f, 9.f}}); - hMoth2BCounter = recoQAHist.add("hMoth2BCounter", "", HistType::kTH1F, {{9, 0.f, 9.f}}); - for (const auto& hist : {hMothCounter, hMoth2BCounter}) { - hist->GetXaxis()->SetBinLabel(1, "Generated"); - hist->GetXaxis()->SetBinLabel(2, "Reconstructed"); - hist->GetXaxis()->SetBinLabel(3, "eta"); - hist->GetXaxis()->SetBinLabel(4, "has collision"); - hist->GetXaxis()->SetBinLabel(5, "ITSonly"); - hist->GetXaxis()->SetBinLabel(6, "ITS hits"); - hist->GetXaxis()->SetBinLabel(7, "ITS IR"); - hist->GetXaxis()->SetBinLabel(8, "ITS chi2"); - hist->GetXaxis()->SetBinLabel(9, "pt"); - } + hMothCounter->GetXaxis()->SetBinLabel(1, "Generated"); + hMothCounter->GetXaxis()->SetBinLabel(2, "Reconstructed"); + hMothCounter->GetXaxis()->SetBinLabel(3, "eta"); + hMothCounter->GetXaxis()->SetBinLabel(4, "has collision"); + hMothCounter->GetXaxis()->SetBinLabel(5, "ITSonly"); + hMothCounter->GetXaxis()->SetBinLabel(6, "ITS hits"); + hMothCounter->GetXaxis()->SetBinLabel(7, "ITS IR"); + hMothCounter->GetXaxis()->SetBinLabel(8, "ITS chi2"); + hMothCounter->GetXaxis()->SetBinLabel(9, "pt"); recoQAHist.add("h2TrueMotherDiffPtVsTrueSVR", ";Decay Vertex R (cm);#Delta p_{T} (GeV/#it{c});", HistType::kTH2F, {svRadiuAxis, diffPtAxis}); - recoQAHist.add("h2TrueMotherDiffPzVsTrueSVR", ";Decay Vertex R (cm);#Delta p_{z} (GeV/#it{c});", HistType::kTH2F, {svRadiuAxis, diffPzAxis}); - recoQAHist.add("h2TrueMotherDiffTglVsTrueSVR", ";Decay Vertex R (cm);#Delta tgl;", HistType::kTH2F, {svRadiuAxis, {200, -1.f, 1.f}}); recoQAHist.add("h2TrueMotherDiffEtaVsTrueSVR", ";Decay Vertex R (cm);#Delta #eta;", HistType::kTH2F, {svRadiuAxis, {200, -1.f, 1.f}}); recoQAHist.add("h2GoodMotherDiffPtVsTrueSVR", ";Decay Vertex R (cm);#Delta p_{T} (GeV/#it{c});", HistType::kTH2F, {svRadiuAxis, diffPtAxis}); - recoQAHist.add("h2GoodMotherDiffPzVsTrueSVR", ";Decay Vertex R (cm);#Delta p_{z} (GeV/#it{c});", HistType::kTH2F, {svRadiuAxis, diffPzAxis}); - - hDaugCounter[kDaugAlpha] = recoQAHist.add("hDaugAlphaCounter", "", HistType::kTH1F, {{9, 0.f, 9.f}}); - hDaugCounter[kDaugTriton] = recoQAHist.add("hDaugTritonCounter", "", HistType::kTH1F, {{9, 0.f, 9.f}}); - hDaugCounter[kDaugProton] = recoQAHist.add("hDaugProtonCounter", "", HistType::kTH1F, {{9, 0.f, 9.f}}); - hDaugCounter[kDaugChargedPion] = recoQAHist.add("hDaugPionCounter", "", HistType::kTH1F, {{9, 0.f, 9.f}}); - hDaugTPCNSigma[kDaugAlpha] = recoQAHist.add("hDaugAlphaTPCNSigma", "", HistType::kTH2F, {rigidityAxis, nsigmaAxis}); - hDaugTPCNSigma[kDaugTriton] = recoQAHist.add("hDaugTritonTPCNSigma", "", HistType::kTH2F, {rigidityAxis, nsigmaAxis}); - hDaugTPCNSigma[kDaugProton] = recoQAHist.add("hDaugProtonTPCNSigma", "", HistType::kTH2F, {rigidityAxis, nsigmaAxis}); - hDaugTPCNSigma[kDaugChargedPion] = recoQAHist.add("hDaugPionTPCNSigma", "", HistType::kTH2F, {rigidityAxis, nsigmaAxis}); - recoQAHist.add("hDaugAlphaITSNSigmaCheck", "", HistType::kTH2F, {rigidityAxis, itsnsigmaAxis}); + + hDaugCounter = recoQAHist.add("hDaugCounter", "", HistType::kTH1F, {{9, 0.f, 9.f}}); + hDaugTPCNSigma = recoQAHist.add("hDaugTPCNSigma", "", HistType::kTH2F, {rigidityAxis, nsigmaAxis}); hRecoMothCounter = recoQAHist.add("hRecoMothCounter", "", HistType::kTH1F, {{9, 0.f, 9.f}}); - hRecoDaugAlphaCounter = recoQAHist.add("hRecoDaugAlphaCounter", "", HistType::kTH1F, {{9, 0.f, 9.f}}); - for (const auto& hist : {hDaugCounter[kDaugAlpha], hDaugCounter[kDaugTriton], hDaugCounter[kDaugProton], hDaugCounter[kDaugChargedPion], hRecoMothCounter, hRecoDaugAlphaCounter}) { + hRecoDaugCounter = recoQAHist.add("hRecoDaugCounter", "", HistType::kTH1F, {{9, 0.f, 9.f}}); + for (const auto& hist : {hDaugCounter, hRecoMothCounter, hRecoDaugCounter}) { hist->GetXaxis()->SetBinLabel(1, "Generated"); hist->GetXaxis()->SetBinLabel(2, "Reconstructed"); hist->GetXaxis()->SetBinLabel(3, "eta"); @@ -836,21 +961,20 @@ struct Hyperhelium4sigmaQa { recoQAHist.add("hMothIsPVContributer", "", HistType::kTH1F, {{2, 0.f, 2.f}}); recoQAHist.add("hMothITSCls", "", HistType::kTH1F, {{8, 0.f, 8.f}}); - recoQAHist.add("hDaugAlphaIsPVContributer", "", HistType::kTH1F, {{2, 0.f, 2.f}}); - recoQAHist.add("hDaugAlphaITSCls", "", HistType::kTH1F, {{8, 0.f, 8.f}}); - recoQAHist.add("hDaugAlphaITSNSigma", "", HistType::kTH2F, {rigidityAxis, itsnsigmaAxis}); - recoQAHist.add("hReco2BDauAlphaPVsITSNSigma", "", HistType::kTH2F, {rigidityAxis, itsnsigmaAxis}); - recoQAHist.add("hReco2BCandidateCount", "", HistType::kTH1F, {{4, 0.f, 4.f}}); + recoQAHist.add("hDaugIsPVContributer", "", HistType::kTH1F, {{2, 0.f, 2.f}}); + recoQAHist.add("hDaugITSCls", "", HistType::kTH1F, {{8, 0.f, 8.f}}); + recoQAHist.add("hDaugITSNSigma", "", HistType::kTH2F, {rigidityAxis, itsnsigmaAxis}); + recoQAHist.add("hRecoDaugPVsITSNSigma", "", HistType::kTH2F, {rigidityAxis, itsnsigmaAxis}); + recoQAHist.add("hRecoCandidateCount", "", HistType::kTH1F, {{4, 0.f, 4.f}}); } } Configurable skipRejectedEvents{"skipRejectedEvents", false, "Flag to skip events that fail event selection cuts"}; Configurable doEventCut{"doEventCut", true, "Apply event selection"}; Configurable maxZVertex{"maxZVertex", 10.0f, "Accepted z-vertex range (cm)"}; - Configurable only2BodyDecay{"only2BodyDecay", true, "Only consider 2-body decays for hyperhelium4sigma"}; Configurable etaMax{"etaMax", 1., "eta cut for tracks"}; - Configurable minPtMoth{"minPtMoth", 0.5, "Minimum pT/z of the hyperhelium4sigma candidate"}; + Configurable minPtMoth{"minPtMoth", 0.5, "Minimum pT/z of the mother track"}; Configurable tpcPidNsigmaCut{"tpcPidNsigmaCut", 5, "tpcPidNsigmaCut"}; Configurable nTPCClusMinDaug{"nTPCClusMinDaug", 80, "daug NTPC clusters cut"}; Configurable itsMaxChi2{"itsMaxChi2", 36, "max chi2 for ITS"}; @@ -858,7 +982,7 @@ struct Hyperhelium4sigmaQa { Preslice permcCollision = o2::aod::mcparticle::mcCollisionId; - // qa for mother track selection + // QA for mother track selection template bool motherTrackCheck(const TTrack& track, const std::shared_ptr hist) { @@ -950,14 +1074,14 @@ struct Hyperhelium4sigmaQa { { // dummy process function; } - PROCESS_SWITCH(Hyperhelium4sigmaQa, processData, "process data", true); + PROCESS_SWITCH(HyperkinkQa, processData, "process data", true); void processMC(aod::McCollisions const& mcCollisions, aod::McParticles const& particlesMC, MCLabeledCollisionsFull const& collisions, MCLabeledTracksIU const& tracks, aod::BCs const&) { std::vector mcPartIndices; setTrackIDForMC(mcPartIndices, particlesMC, tracks); std::vector isSelectedMCCollisions(mcCollisions.size(), false); - std::vector dauIDList(3, -1); + std::vector dauIDList(2, -1); for (const auto& collision : collisions) { genQAHist.fill(HIST("hCollCounter"), 0.5); if (doEventCut && (!collision.selection_bit(aod::evsel::kIsTriggerTVX) || !collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || std::abs(collision.posZ()) > maxZVertex)) { @@ -980,66 +1104,75 @@ struct Hyperhelium4sigmaQa { const auto& dparticlesMC = particlesMC.sliceBy(permcCollision, mcCollision.globalIndex()); for (const auto& mcparticle : dparticlesMC) { - - bool isMatter; - if (mcparticle.pdgCode() == o2::constants::physics::Pdg::kHyperHelium4Sigma) { - isMatter = true; - } else if (mcparticle.pdgCode() == -o2::constants::physics::Pdg::kHyperHelium4Sigma) { - isMatter = false; - } else { + if (std::abs(mcparticle.pdgCode()) != pdgMoth) { continue; } - - auto dChannel = getDecayChannelHe4S(mcparticle, dauIDList); - if (dChannel == kNDecayChannel) { - genQAHist.fill(HIST("hGenHyperHelium4SigmaCounter"), 10.5); - continue; + bool isMatter = mcparticle.pdgCode() > 0; + genQAHist.fill(HIST("hGenHyperMothCounter"), 0.5); + genQAHist.fill(HIST("hGenHyperMothCounter"), isMatter ? 1.5 : 2.5); + + // QA for decay channels + bool isKinkSignal = false; + if (hypoMoth == kHypertriton) { + auto dChannel = H3LDecay::getDecayChannel(mcparticle, dauIDList); + if (dChannel == H3LDecay::k2bodyNeutral) { + genQAHist.fill(HIST("hGenHyperMothCounter"), isMatter ? 3.5 : 4.5); + isKinkSignal = true; + } else if (dChannel == H3LDecay::k2bodyCharged) { + genQAHist.fill(HIST("hGenHyperMothCounter"), isMatter ? 5.5 : 6.5); + } else if (dChannel == H3LDecay::k3bodyCharged) { + genQAHist.fill(HIST("hGenHyperMothCounter"), isMatter ? 7.5 : 8.5); + } else if (dChannel == H3LDecay::kNChannel) { + genQAHist.fill(HIST("hGenHyperMothCounter"), 9.5); + continue; + } + } else if (hypoMoth == kHyperhelium4sigma) { + auto dChannel = He4SDecay::getDecayChannel(mcparticle, dauIDList); + if (dChannel == He4SDecay::k2body) { + genQAHist.fill(HIST("hGenHyperMothCounter"), isMatter ? 3.5 : 4.5); + isKinkSignal = true; + } else if (dChannel == He4SDecay::k3body_p) { + genQAHist.fill(HIST("hGenHyperMothCounter"), isMatter ? 5.5 : 6.5); + } else if (dChannel == He4SDecay::k3body_n) { + genQAHist.fill(HIST("hGenHyperMothCounter"), isMatter ? 7.5 : 8.5); + } else if (dChannel == He4SDecay::kNChannel) { + genQAHist.fill(HIST("hGenHyperMothCounter"), 9.5); + continue; + } } - // qa for mother tracks - if (dChannel == k2body) { - recoQAHist.fill(HIST("hMoth2BCounter"), 0); - } else { - if (only2BodyDecay) { - continue; // skip 3-body decays - } + if (!isKinkSignal) { + continue; } recoQAHist.fill(HIST("hMothCounter"), 0); - genQAHist.fill(HIST("hGenHyperHelium4SigmaCounter"), 0.5); - genQAHist.fill(HIST("hGenHyperHelium4SigmaCounter"), isMatter ? 1.5 : 2.5); - genQAHist.fill(HIST("hEvtSelectedHyperHelium4SigmaCounter"), 0.5); + genQAHist.fill(HIST("hEvtSelectedHyperMothCounter"), 0.5); if (isSelectedMCCollisions[mcCollision.globalIndex()]) { - genQAHist.fill(HIST("hEvtSelectedHyperHelium4SigmaCounter"), 1.5); + genQAHist.fill(HIST("hEvtSelectedHyperMothCounter"), 1.5); } float svPos[3] = {-999, -999, -999}; std::vector> dauMom(kNDaughterType, std::vector(3, -999.0f)); for (const auto& mcparticleDaughter : mcparticle.daughters_as()) { for (int type = 0; type < kNDaughterType; type++) { - if (std::abs(mcparticleDaughter.pdgCode()) == kDaugghterPDG[type]) { + if (std::abs(mcparticleDaughter.pdgCode()) == pdgDaug[type]) { dauMom[type][0] = mcparticleDaughter.px(); dauMom[type][1] = mcparticleDaughter.py(); dauMom[type][2] = mcparticleDaughter.pz(); - if (type <= kDaugTriton) { + if (type == kDaugCharged) { svPos[0] = mcparticleDaughter.vx(); svPos[1] = mcparticleDaughter.vy(); svPos[2] = mcparticleDaughter.vz(); - } - if (type < kNChargedDaughterType) { - hDaugCounter[type]->Fill(0.f); // if daughter track is reconstructed - if (type <= kNChargedDaughterType && mcPartIndices[mcparticleDaughter.globalIndex()] != -1) { + if (mcPartIndices[mcparticleDaughter.globalIndex()] != -1) { + hDaugCounter->Fill(0.f); auto track = tracks.rawIteratorAt(mcPartIndices[mcparticleDaughter.globalIndex()]); - float tpcNSigma = getTPCNSigma(track, type); - daughterTrackCheck(track, hDaugCounter[type], tpcNSigma); + float tpcNSigma = getTPCNSigma(track, pidTypeDaug); + daughterTrackCheck(track, hDaugCounter, tpcNSigma); if (track.hasTPC()) { - hDaugTPCNSigma[type]->Fill(track.p() * track.sign(), tpcNSigma); - } - if (type == kDaugAlpha && track.itsNCls() > kITSLayers - 2) { - recoQAHist.fill(HIST("hDaugAlphaITSNSigmaCheck"), track.p() * track.sign(), itsResponse.nSigmaITS(track)); + hDaugTPCNSigma->Fill(track.p() * track.sign(), tpcNSigma); } } } @@ -1047,94 +1180,69 @@ struct Hyperhelium4sigmaQa { } } - genQAHist.fill(HIST("hGenHyperHelium4SigmaP"), mcparticle.p()); - genQAHist.fill(HIST("hGenHyperHelium4SigmaPt"), mcparticle.pt()); - float ct = RecoDecay::sqrtSumOfSquares(svPos[0] - mcparticle.vx(), svPos[1] - mcparticle.vy(), svPos[2] - mcparticle.vz()) * o2::constants::physics::MassHyperHelium4Sigma / mcparticle.p(); - genQAHist.fill(HIST("hGenHyperHelium4SigmaCt"), ct); + genQAHist.fill(HIST("hGenHyperMothP"), mcparticle.p()); + genQAHist.fill(HIST("hGenHyperMothPt"), mcparticle.pt()); + float ct = RecoDecay::sqrtSumOfSquares(svPos[0] - mcparticle.vx(), svPos[1] - mcparticle.vy(), svPos[2] - mcparticle.vz()) * massMoth / mcparticle.p(); + genQAHist.fill(HIST("hGenHyperMothCt"), ct); + float hypermothMCMass = RecoDecay::m(std::array{std::array{dauMom[kDaugCharged][0], dauMom[kDaugCharged][1], dauMom[kDaugCharged][2]}, std::array{dauMom[kDaugNeutral][0], dauMom[kDaugNeutral][1], dauMom[kDaugNeutral][2]}}, std::array{massChargedDaug, massNeutralDaug}); + genQAHist.fill(HIST("hMcRecoInvMass"), hypermothMCMass); // if mother track is reconstructed if (mcPartIndices[mcparticle.globalIndex()] != -1) { auto motherTrack = tracks.rawIteratorAt(mcPartIndices[mcparticle.globalIndex()]); bool isGoodMother = motherTrackCheck(motherTrack, hMothCounter); - if (dChannel == k2body) { - motherTrackCheck(motherTrack, hMoth2BCounter); - } float svR = RecoDecay::sqrtSumOfSquares(svPos[0], svPos[1]); float diffpt = mcparticle.pt() - 2 * motherTrack.pt(); - float diffpz = mcparticle.pz() - 2 * motherTrack.pz(); recoQAHist.fill(HIST("h2TrueMotherDiffPtVsTrueSVR"), svR, diffpt); - recoQAHist.fill(HIST("h2TrueMotherDiffPzVsTrueSVR"), svR, diffpz); - recoQAHist.fill(HIST("h2TrueMotherDiffTglVsTrueSVR"), svR, mcparticle.pz() / mcparticle.pt() - motherTrack.tgl()); recoQAHist.fill(HIST("h2TrueMotherDiffEtaVsTrueSVR"), svR, mcparticle.eta() - motherTrack.eta()); if (isGoodMother) { recoQAHist.fill(HIST("h2GoodMotherDiffPtVsTrueSVR"), svR, diffpt); - recoQAHist.fill(HIST("h2GoodMotherDiffPzVsTrueSVR"), svR, diffpz); } // if mother track and charged daughters are all reconstructed - bool isDauReconstructed = mcPartIndices[dauIDList[0]] != -1 && (dChannel == k2body ? true : mcPartIndices[dauIDList[1]] != -1); + bool isDauReconstructed = mcPartIndices[dauIDList[0]] != -1; if (isDauReconstructed) { - genQAHist.fill(HIST("hGenHyperHelium4SigmaCounter"), 9.5); - - // qa for bc matching for reconstructed tracks - if (dChannel == k2body) { - auto daughterTrack = tracks.rawIteratorAt(mcPartIndices[dauIDList[0]]); - bool isMoth = motherTrackCheck(motherTrack, hRecoMothCounter); - bool isDaug = daughterTrackCheck(daughterTrack, hRecoDaugAlphaCounter, daughterTrack.tpcNSigmaAl()); - - recoQAHist.fill(HIST("hReco2BCandidateCount"), 0.5); - recoQAHist.fill(HIST("hRecoMothCounter"), 0.5); - recoQAHist.fill(HIST("hMothITSCls"), motherTrack.itsNCls()); - recoQAHist.fill(HIST("hRecoDaugAlphaCounter"), 0.5); - recoQAHist.fill(HIST("hMothIsPVContributer"), motherTrack.isPVContributor() ? 1.5 : 0.5); - recoQAHist.fill(HIST("hDaugAlphaIsPVContributer"), daughterTrack.isPVContributor() ? 1.5 : 0.5); - - float itsNSigma = itsResponse.nSigmaITS(daughterTrack); - if (daughterTrack.hasITS()) { - recoQAHist.fill(HIST("hDaugAlphaITSNSigma"), daughterTrack.sign() * daughterTrack.p(), itsNSigma); - recoQAHist.fill(HIST("hDaugAlphaITSCls"), daughterTrack.itsNCls()); - } + auto daughterTrack = tracks.rawIteratorAt(mcPartIndices[dauIDList[0]]); + bool isMoth = motherTrackCheck(motherTrack, hRecoMothCounter); + bool isDaug = daughterTrackCheck(daughterTrack, hRecoDaugCounter, getTPCNSigma(daughterTrack, pidTypeDaug)); + + recoQAHist.fill(HIST("hRecoCandidateCount"), 0.5); + recoQAHist.fill(HIST("hRecoMothCounter"), 0.5); + recoQAHist.fill(HIST("hMothITSCls"), motherTrack.itsNCls()); + recoQAHist.fill(HIST("hRecoDaugCounter"), 0.5); + recoQAHist.fill(HIST("hMothIsPVContributer"), motherTrack.isPVContributor() ? 1.5 : 0.5); + recoQAHist.fill(HIST("hDaugIsPVContributer"), daughterTrack.isPVContributor() ? 1.5 : 0.5); + + float itsNSigma = getITSNSigma(daughterTrack, itsResponse, pidTypeDaug); + if (daughterTrack.hasITS()) { + recoQAHist.fill(HIST("hDaugITSNSigma"), daughterTrack.sign() * daughterTrack.p(), itsNSigma); + recoQAHist.fill(HIST("hDaugITSCls"), daughterTrack.itsNCls()); + } - if (motherTrack.has_collision() && daughterTrack.has_collision()) { - recoQAHist.fill(HIST("hReco2BCandidateCount"), 1.5); - if (motherTrack.collisionId() == daughterTrack.collisionId()) { - recoQAHist.fill(HIST("hReco2BCandidateCount"), 2.5); - } + if (motherTrack.has_collision() && daughterTrack.has_collision()) { + recoQAHist.fill(HIST("hRecoCandidateCount"), 1.5); + if (motherTrack.collisionId() == daughterTrack.collisionId()) { + recoQAHist.fill(HIST("hRecoCandidateCount"), 2.5); } + } - if (isMoth && isDaug) { - recoQAHist.fill(HIST("hReco2BCandidateCount"), 3.5); - recoQAHist.fill(HIST("hReco2BDauAlphaPVsITSNSigma"), daughterTrack.sign() * daughterTrack.p(), itsNSigma); - } + if (isMoth && isDaug) { + recoQAHist.fill(HIST("hRecoCandidateCount"), 3.5); + recoQAHist.fill(HIST("hRecoDaugPVsITSNSigma"), daughterTrack.sign() * daughterTrack.p(), itsNSigma); } } } - - // qa for branching ratios and invariant mass - if (dChannel == k2body) { - genQAHist.fill(HIST("hGenHyperHelium4SigmaCounter"), isMatter ? 3.5 : 4.5); - float hyperHelium4SigmaMCMass = RecoDecay::m(std::array{std::array{dauMom[kDaugAlpha][0], dauMom[kDaugAlpha][1], dauMom[kDaugAlpha][2]}, std::array{dauMom[kDaugPion0][0], dauMom[kDaugPion0][1], dauMom[kDaugPion0][2]}}, std::array{o2::constants::physics::MassAlpha, o2::constants::physics::MassPi0}); - genQAHist.fill(HIST("hMcRecoInvMass"), hyperHelium4SigmaMCMass); - } else if (dChannel == k3body_p) { - genQAHist.fill(HIST("hGenHyperHelium4SigmaCounter"), isMatter ? 5.5 : 6.5); - float hyperHelium4SigmaMCMass = RecoDecay::m(std::array{std::array{dauMom[kDaugTriton][0], dauMom[kDaugTriton][1], dauMom[kDaugTriton][2]}, std::array{dauMom[kDaugProton][0], dauMom[kDaugProton][1], dauMom[kDaugProton][2]}, std::array{dauMom[kDaugPion0][0], dauMom[kDaugPion0][1], dauMom[kDaugPion0][2]}}, std::array{o2::constants::physics::MassTriton, o2::constants::physics::MassProton, o2::constants::physics::MassPi0}); - genQAHist.fill(HIST("hMcRecoInvMass"), hyperHelium4SigmaMCMass); - } else if (dChannel == k3body_n) { - genQAHist.fill(HIST("hGenHyperHelium4SigmaCounter"), isMatter ? 7.5 : 8.5); - float hyperHelium4SigmaMCMass = RecoDecay::m(std::array{std::array{dauMom[kDaugTriton][0], dauMom[kDaugTriton][1], dauMom[kDaugTriton][2]}, std::array{dauMom[kDaugNeutron][0], dauMom[kDaugNeutron][1], dauMom[kDaugNeutron][2]}, std::array{dauMom[kDaugChargedPion][0], dauMom[kDaugChargedPion][1], dauMom[kDaugChargedPion][2]}}, std::array{o2::constants::physics::MassTriton, o2::constants::physics::MassNeutron, o2::constants::physics::MassPiPlus}); - genQAHist.fill(HIST("hMcRecoInvMass"), hyperHelium4SigmaMCMass); - } } } } - PROCESS_SWITCH(Hyperhelium4sigmaQa, processMC, "do QA for MC prodcutions", false); + PROCESS_SWITCH(HyperkinkQa, processMC, "do QA for MC prodcutions", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ - adaptAnalysisTask(cfgc), - adaptAnalysisTask(cfgc), + adaptAnalysisTask(cfgc), + adaptAnalysisTask(cfgc), }; } From a78d629fb6d1eed19a860f9424685d6fd856f9a9 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Thu, 31 Jul 2025 11:50:58 +0200 Subject: [PATCH 155/345] [PWGEM/Dilepton] update electron and event tables (#12343) --- PWGEM/Dilepton/Core/DielectronCut.h | 9 +- PWGEM/Dilepton/Core/Dilepton.h | 28 +- PWGEM/Dilepton/Core/DileptonHadronMPC.h | 17 +- PWGEM/Dilepton/Core/DileptonMC.h | 2 +- PWGEM/Dilepton/Core/EMEventCut.cxx | 2 +- PWGEM/Dilepton/Core/PhotonHBT.h | 2 +- PWGEM/Dilepton/Core/SingleTrackQC.h | 2 +- PWGEM/Dilepton/Core/SingleTrackQCMC.h | 2 +- PWGEM/Dilepton/DataModel/dileptonTables.h | 153 +- PWGEM/Dilepton/TableProducer/CMakeLists.txt | 10 - .../TableProducer/createEMEventDilepton.cxx | 5 +- .../TableProducer/filterDielectronEvent.cxx | 1722 ----------------- .../TableProducer/skimmerPrimaryElectron.cxx | 95 +- .../skimmerSecondaryElectron.cxx | 631 ------ .../TableProducer/treeCreatorElectronML.cxx | 2 +- .../Dilepton/Tasks/Converters/CMakeLists.txt | 10 + .../Tasks/Converters/electronConverter4.cxx | 157 ++ .../Tasks/Converters/eventConverter3.cxx | 54 + PWGEM/Dilepton/Tasks/prefilterDielectron.cxx | 43 +- PWGEM/Dilepton/Tasks/vpPairQC.cxx | 12 +- PWGEM/Dilepton/Tasks/vpPairQCMC.cxx | 2 +- PWGEM/Dilepton/Utils/EMTrackUtilities.h | 60 +- .../TableProducer/createEMEventPhoton.cxx | 2 +- 23 files changed, 529 insertions(+), 2493 deletions(-) delete mode 100644 PWGEM/Dilepton/TableProducer/filterDielectronEvent.cxx delete mode 100644 PWGEM/Dilepton/TableProducer/skimmerSecondaryElectron.cxx create mode 100644 PWGEM/Dilepton/Tasks/Converters/electronConverter4.cxx create mode 100644 PWGEM/Dilepton/Tasks/Converters/eventConverter3.cxx diff --git a/PWGEM/Dilepton/Core/DielectronCut.h b/PWGEM/Dilepton/Core/DielectronCut.h index cd814d7c33e..3a6d8ba22b3 100644 --- a/PWGEM/Dilepton/Core/DielectronCut.h +++ b/PWGEM/Dilepton/Core/DielectronCut.h @@ -258,14 +258,15 @@ class DielectronCut : public TNamed } template - bool PassPIDML(TTrack const& track, TCollision const& collision) const + bool PassPIDML(TTrack const&, TCollision const&) const { + return false; /*if (!PassTOFif(track)) { // Allows for pre-selection. But potentially dangerous if analyzers are not aware of it return false; }*/ - std::vector inputFeatures = mPIDMlResponse->getInputFeatures(track, collision); - float binningFeature = mPIDMlResponse->getBinningFeature(track, collision); - return mPIDMlResponse->isSelectedMl(inputFeatures, binningFeature); + // std::vector inputFeatures = mPIDMlResponse->getInputFeatures(track, collision); + // float binningFeature = mPIDMlResponse->getBinningFeature(track, collision); + // return mPIDMlResponse->isSelectedMl(inputFeatures, binningFeature); } template diff --git a/PWGEM/Dilepton/Core/Dilepton.h b/PWGEM/Dilepton/Core/Dilepton.h index 4cfb818e2ce..d0874b06b37 100644 --- a/PWGEM/Dilepton/Core/Dilepton.h +++ b/PWGEM/Dilepton/Core/Dilepton.h @@ -75,7 +75,7 @@ using MyCollision = MyCollisions::iterator; using MyCollisionsWithSWT = soa::Join; using MyCollisionWithSWT = MyCollisionsWithSWT::iterator; -using MyElectrons = soa::Join; +using MyElectrons = soa::Join; using MyElectron = MyElectrons::iterator; using FilteredMyElectrons = soa::Filtered; using FilteredMyElectron = FilteredMyElectrons::iterator; @@ -85,7 +85,7 @@ using MyMuon = MyMuons::iterator; using FilteredMyMuons = soa::Filtered; using FilteredMyMuon = FilteredMyMuons::iterator; -using MyEMH_electron = o2::aod::pwgem::dilepton::utils::EventMixingHandler, std::pair, EMTrackWithCov>; +using MyEMH_electron = o2::aod::pwgem::dilepton::utils::EventMixingHandler, std::pair, EMTrack>; using MyEMH_muon = o2::aod::pwgem::dilepton::utils::EventMixingHandler, std::pair, EMFwdTrack>; template @@ -1081,13 +1081,9 @@ struct Dilepton { used_trackIds.emplace_back(pair_tmp_id1); if (cfgDoMix) { if (t1.sign() > 0) { - emh_pos->AddTrackToEventPool(key_df_collision, EMTrackWithCov(ndf, t1.globalIndex(), collision.globalIndex(), t1.trackId(), t1.pt(), t1.eta(), t1.phi(), leptonM1, t1.sign(), t1.dcaXY(), t1.dcaZ(), possibleIds1, - t1.x(), t1.y(), t1.z(), t1.alpha(), t1.snp(), t1.tgl(), t1.cYY(), t1.cZY(), t1.cZZ(), - t1.cSnpY(), t1.cSnpZ(), t1.cSnpSnp(), t1.cTglY(), t1.cTglZ(), t1.cTglSnp(), t1.cTglTgl(), t1.c1PtY(), t1.c1PtZ(), t1.c1PtSnp(), t1.c1PtTgl(), t1.c1Pt21Pt2())); + emh_pos->AddTrackToEventPool(key_df_collision, EMTrack(ndf, t1.globalIndex(), collision.globalIndex(), t1.trackId(), t1.pt(), t1.eta(), t1.phi(), leptonM1, t1.sign(), t1.dcaXY(), t1.dcaZ(), possibleIds1, t1.cYY(), t1.cZY(), t1.cZZ())); } else { - emh_neg->AddTrackToEventPool(key_df_collision, EMTrackWithCov(ndf, t1.globalIndex(), collision.globalIndex(), t1.trackId(), t1.pt(), t1.eta(), t1.phi(), leptonM1, t1.sign(), t1.dcaXY(), t1.dcaZ(), possibleIds1, - t1.x(), t1.y(), t1.z(), t1.alpha(), t1.snp(), t1.tgl(), t1.cYY(), t1.cZY(), t1.cZZ(), - t1.cSnpY(), t1.cSnpZ(), t1.cSnpSnp(), t1.cTglY(), t1.cTglZ(), t1.cTglSnp(), t1.cTglTgl(), t1.c1PtY(), t1.c1PtZ(), t1.c1PtSnp(), t1.c1PtTgl(), t1.c1Pt21Pt2())); + emh_neg->AddTrackToEventPool(key_df_collision, EMTrack(ndf, t1.globalIndex(), collision.globalIndex(), t1.trackId(), t1.pt(), t1.eta(), t1.phi(), leptonM1, t1.sign(), t1.dcaXY(), t1.dcaZ(), possibleIds1, t1.cYY(), t1.cZY(), t1.cZZ())); } } } @@ -1095,13 +1091,9 @@ struct Dilepton { used_trackIds.emplace_back(pair_tmp_id2); if (cfgDoMix) { if (t2.sign() > 0) { - emh_pos->AddTrackToEventPool(key_df_collision, EMTrackWithCov(ndf, t2.globalIndex(), collision.globalIndex(), t2.trackId(), t2.pt(), t2.eta(), t2.phi(), leptonM2, t2.sign(), t2.dcaXY(), t2.dcaZ(), possibleIds2, - t2.x(), t2.y(), t2.z(), t2.alpha(), t2.snp(), t2.tgl(), t2.cYY(), t2.cZY(), t2.cZZ(), - t2.cSnpY(), t2.cSnpZ(), t2.cSnpSnp(), t2.cTglY(), t2.cTglZ(), t2.cTglSnp(), t2.cTglTgl(), t2.c1PtY(), t2.c1PtZ(), t2.c1PtSnp(), t2.c1PtTgl(), t2.c1Pt21Pt2())); + emh_pos->AddTrackToEventPool(key_df_collision, EMTrack(ndf, t2.globalIndex(), collision.globalIndex(), t2.trackId(), t2.pt(), t2.eta(), t2.phi(), leptonM2, t2.sign(), t2.dcaXY(), t2.dcaZ(), possibleIds2, t2.cYY(), t2.cZY(), t2.cZZ())); } else { - emh_neg->AddTrackToEventPool(key_df_collision, EMTrackWithCov(ndf, t2.globalIndex(), collision.globalIndex(), t2.trackId(), t2.pt(), t2.eta(), t2.phi(), leptonM2, t2.sign(), t2.dcaXY(), t2.dcaZ(), possibleIds2, - t2.x(), t2.y(), t2.z(), t2.alpha(), t2.snp(), t2.tgl(), t2.cYY(), t2.cZY(), t2.cZZ(), - t2.cSnpY(), t2.cSnpZ(), t2.cSnpSnp(), t2.cTglY(), t2.cTglZ(), t2.cTglSnp(), t2.cTglTgl(), t2.c1PtY(), t2.c1PtZ(), t2.c1PtSnp(), t2.c1PtTgl(), t2.c1Pt21Pt2())); + emh_neg->AddTrackToEventPool(key_df_collision, EMTrack(ndf, t2.globalIndex(), collision.globalIndex(), t2.trackId(), t2.pt(), t2.eta(), t2.phi(), leptonM2, t2.sign(), t2.dcaXY(), t2.dcaZ(), possibleIds2, t2.cYY(), t2.cZY(), t2.cZZ())); } } } @@ -1113,10 +1105,10 @@ struct Dilepton { used_trackIds.emplace_back(pair_tmp_id1); if (cfgDoMix) { if (t1.sign() > 0) { - emh_pos->AddTrackToEventPool(key_df_collision, EMFwdTrack(ndf, t1.globalIndex(), collision.globalIndex(), t1.fwdtrackId(), t1.pt(), t1.eta(), t1.phi(), o2::constants::physics::MassMuon, t1.sign(), t1.fwdDcaX(), t1.fwdDcaY(), possibleIds1, + emh_pos->AddTrackToEventPool(key_df_collision, EMFwdTrack(ndf, t1.globalIndex(), collision.globalIndex(), t1.fwdtrackId(), t1.pt(), t1.eta(), t1.phi(), leptonM1, t1.sign(), t1.fwdDcaX(), t1.fwdDcaY(), possibleIds1, t1.cXXatDCA(), t1.cXYatDCA(), t1.cYYatDCA())); } else { - emh_neg->AddTrackToEventPool(key_df_collision, EMFwdTrack(ndf, t1.globalIndex(), collision.globalIndex(), t1.fwdtrackId(), t1.pt(), t1.eta(), t1.phi(), o2::constants::physics::MassMuon, t1.sign(), t1.fwdDcaX(), t1.fwdDcaY(), possibleIds1, + emh_neg->AddTrackToEventPool(key_df_collision, EMFwdTrack(ndf, t1.globalIndex(), collision.globalIndex(), t1.fwdtrackId(), t1.pt(), t1.eta(), t1.phi(), leptonM1, t1.sign(), t1.fwdDcaX(), t1.fwdDcaY(), possibleIds1, t1.cXXatDCA(), t1.cXYatDCA(), t1.cYYatDCA())); } } @@ -1125,10 +1117,10 @@ struct Dilepton { used_trackIds.emplace_back(pair_tmp_id2); if (cfgDoMix) { if (t2.sign() > 0) { - emh_pos->AddTrackToEventPool(key_df_collision, EMFwdTrack(ndf, t2.globalIndex(), collision.globalIndex(), t2.fwdtrackId(), t2.pt(), t2.eta(), t2.phi(), o2::constants::physics::MassMuon, t2.sign(), t2.fwdDcaX(), t2.fwdDcaY(), possibleIds2, + emh_pos->AddTrackToEventPool(key_df_collision, EMFwdTrack(ndf, t2.globalIndex(), collision.globalIndex(), t2.fwdtrackId(), t2.pt(), t2.eta(), t2.phi(), leptonM2, t2.sign(), t2.fwdDcaX(), t2.fwdDcaY(), possibleIds2, t2.cXXatDCA(), t2.cXYatDCA(), t2.cYYatDCA())); } else { - emh_neg->AddTrackToEventPool(key_df_collision, EMFwdTrack(ndf, t2.globalIndex(), collision.globalIndex(), t2.fwdtrackId(), t2.pt(), t2.eta(), t2.phi(), o2::constants::physics::MassMuon, t2.sign(), t2.fwdDcaX(), t2.fwdDcaY(), possibleIds2, + emh_neg->AddTrackToEventPool(key_df_collision, EMFwdTrack(ndf, t2.globalIndex(), collision.globalIndex(), t2.fwdtrackId(), t2.pt(), t2.eta(), t2.phi(), leptonM2, t2.sign(), t2.fwdDcaX(), t2.fwdDcaY(), possibleIds2, t2.cXXatDCA(), t2.cXYatDCA(), t2.cYYatDCA())); } } diff --git a/PWGEM/Dilepton/Core/DileptonHadronMPC.h b/PWGEM/Dilepton/Core/DileptonHadronMPC.h index 9a0a2a551d3..c8108f6b046 100644 --- a/PWGEM/Dilepton/Core/DileptonHadronMPC.h +++ b/PWGEM/Dilepton/Core/DileptonHadronMPC.h @@ -77,7 +77,7 @@ using MyCollision = MyCollisions::iterator; using MyCollisionsWithSWT = soa::Join; using MyCollisionWithSWT = MyCollisionsWithSWT::iterator; -using MyElectrons = soa::Join; +using MyElectrons = soa::Join; using MyElectron = MyElectrons::iterator; using FilteredMyElectrons = soa::Filtered; using FilteredMyElectron = FilteredMyElectrons::iterator; @@ -111,7 +111,7 @@ struct DileptonHadronMPC { Configurable cfgCentMax{"cfgCentMax", 999.f, "max. centrality"}; Configurable cfgDoMix{"cfgDoMix", true, "flag for event mixing"}; Configurable ndepth_lepton{"ndepth_lepton", 100, "depth for event mixing between lepton-lepton"}; - Configurable ndepth_hadron{"ndepth_hadron", 2, "depth for event mixing between hadron-hadron"}; + Configurable ndepth_hadron{"ndepth_hadron", 1, "depth for event mixing between hadron-hadron"}; Configurable ndiff_bc_mix{"ndiff_bc_mix", 594, "difference in global BC required in mixed events"}; ConfigurableAxis ConfVtxBins{"ConfVtxBins", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"}; ConfigurableAxis ConfCentBins{"ConfCentBins", {VARIABLE_WIDTH, 0.0f, 0.1, 1, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f, 100.f, 999.f}, "Mixing bins - centrality"}; @@ -513,7 +513,7 @@ struct DileptonHadronMPC { const AxisSpec axis_deta{ConfDEtaBins, deta_axis_title}; // hadron-hadron info - const AxisSpec axis_deta_hh{ConfDEtaBins, "#Delta#eta = #eta_{h}^{trg} - #eta_{h}^{ref}"}; + const AxisSpec axis_deta_hh{60, -3, +3, "#Delta#eta = #eta_{h}^{trg} - #eta_{h}^{ref}"}; const AxisSpec axis_pt_trg{ConfPtHadronBins, "p_{T,h} (GeV/c)"}; const AxisSpec axis_eta_trg{40, -2, +2, "#eta_{h}"}; @@ -1114,11 +1114,6 @@ struct DileptonHadronMPC { fRegistry.fill(HIST("Event/after/hCollisionCounter"), o2::aod::pwgem::dilepton::utils::eventhistogram::nbin_ev); // accepted auto refTracks_per_coll = refTracks.sliceBy(perCollision_track, collision.globalIndex()); - for (const auto& track : refTracks_per_coll) { - if (fEMTrackCut.IsSelected(track)) { - fRegistry.fill(HIST("Hadron/hs"), track.pt(), track.eta(), track.phi()); - } - } auto posTracks_per_coll = posTracks.sliceByCached(perCollision, collision.globalIndex(), cache); auto negTracks_per_coll = negTracks.sliceByCached(perCollision, collision.globalIndex(), cache); @@ -1154,6 +1149,11 @@ struct DileptonHadronMPC { } if (nuls > 0 || nlspp > 0 || nlsmm > 0) { // at least 1 pair exists. + for (const auto& track : refTracks_per_coll) { + if (fEMTrackCut.IsSelected(track)) { + fRegistry.fill(HIST("Hadron/hs"), track.pt(), track.eta(), track.phi()); + } + } for (const auto& [trg, ref] : combinations(CombinationsStrictlyUpperIndexPolicy(refTracks_per_coll, refTracks_per_coll))) { fillHadronHadron<0>(collision, trg, ref, posTracks_per_coll, negTracks_per_coll); } @@ -1251,6 +1251,7 @@ struct DileptonHadronMPC { if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonHadronAnalysisType::kAzimuthalCorrelation)) { auto selected_refTracks_in_this_event = emh_ref->GetTracksPerCollision(key_df_collision); auto collisionIds_in_mixing_pool_hadron = emh_ref->GetCollisionIdsFromEventPool(key_bin); + for (const auto& mix_dfId_collisionId : collisionIds_in_mixing_pool_hadron) { int mix_dfId = mix_dfId_collisionId.first; int mix_collisionId = mix_dfId_collisionId.second; diff --git a/PWGEM/Dilepton/Core/DileptonMC.h b/PWGEM/Dilepton/Core/DileptonMC.h index 9d233ee25cd..cee135610ad 100644 --- a/PWGEM/Dilepton/Core/DileptonMC.h +++ b/PWGEM/Dilepton/Core/DileptonMC.h @@ -67,7 +67,7 @@ using MyCollision = MyCollisions::iterator; using MyMCCollisions = soa::Join; using MyMCCollision = MyMCCollisions::iterator; -using MyMCElectrons = soa::Join; +using MyMCElectrons = soa::Join; using MyMCElectron = MyMCElectrons::iterator; using FilteredMyMCElectrons = soa::Filtered; using FilteredMyMCElectron = FilteredMyMCElectrons::iterator; diff --git a/PWGEM/Dilepton/Core/EMEventCut.cxx b/PWGEM/Dilepton/Core/EMEventCut.cxx index 682c496b8e7..58e3c5be4e8 100644 --- a/PWGEM/Dilepton/Core/EMEventCut.cxx +++ b/PWGEM/Dilepton/Core/EMEventCut.cxx @@ -65,7 +65,7 @@ void EMEventCut::SetRequireVertexITSTPC(bool flag) void EMEventCut::SetRequireVertexTOFmatched(bool flag) { mRequireVertexTOFmatched = flag; - LOG(info) << "EM Event Cut, require vertex reconstructed by ITS-TPC matched track: " << mRequireVertexTOFmatched; + LOG(info) << "EM Event Cut, require vertex reconstructed by ITS-TPC-TOF matched track: " << mRequireVertexTOFmatched; } void EMEventCut::SetRequireGoodZvtxFT0vsPV(bool flag) diff --git a/PWGEM/Dilepton/Core/PhotonHBT.h b/PWGEM/Dilepton/Core/PhotonHBT.h index f9c7b46a013..85c0cb81bf7 100644 --- a/PWGEM/Dilepton/Core/PhotonHBT.h +++ b/PWGEM/Dilepton/Core/PhotonHBT.h @@ -80,7 +80,7 @@ using MyCollisionWithSWT = MyCollisionsWithSWT::iterator; using MyV0Photons = soa::Join; using MyV0Photon = MyV0Photons::iterator; -using MyTracks = soa::Join; +using MyTracks = soa::Join; using MyTrack = MyTracks::iterator; using FilteredMyTracks = soa::Filtered; using FilteredMyTrack = FilteredMyTracks::iterator; diff --git a/PWGEM/Dilepton/Core/SingleTrackQC.h b/PWGEM/Dilepton/Core/SingleTrackQC.h index 0fe4182f96a..9810d1eb63e 100644 --- a/PWGEM/Dilepton/Core/SingleTrackQC.h +++ b/PWGEM/Dilepton/Core/SingleTrackQC.h @@ -58,7 +58,7 @@ using MyCollision = MyCollisions::iterator; using MyCollisionsWithSWT = soa::Join; using MyCollisionWithSWT = MyCollisionsWithSWT::iterator; -using MyElectrons = soa::Join; +using MyElectrons = soa::Join; using MyElectron = MyElectrons::iterator; using FilteredMyElectrons = soa::Filtered; using FilteredMyElectron = FilteredMyElectrons::iterator; diff --git a/PWGEM/Dilepton/Core/SingleTrackQCMC.h b/PWGEM/Dilepton/Core/SingleTrackQCMC.h index ce5496388d6..c6b4ad94bb9 100644 --- a/PWGEM/Dilepton/Core/SingleTrackQCMC.h +++ b/PWGEM/Dilepton/Core/SingleTrackQCMC.h @@ -60,7 +60,7 @@ using MyCollision = MyCollisions::iterator; using MyMCCollisions = soa::Join; using MyMCCollision = MyMCCollisions::iterator; -using MyMCElectrons = soa::Join; +using MyMCElectrons = soa::Join; using MyMCElectron = MyMCElectrons::iterator; using FilteredMyMCElectrons = soa::Filtered; diff --git a/PWGEM/Dilepton/DataModel/dileptonTables.h b/PWGEM/Dilepton/DataModel/dileptonTables.h index d8639eaab5b..b4773327fe2 100644 --- a/PWGEM/Dilepton/DataModel/dileptonTables.h +++ b/PWGEM/Dilepton/DataModel/dileptonTables.h @@ -122,6 +122,8 @@ DECLARE_SOA_COLUMN(SpherocityPtUnWeighted, spherocity_ptunweighted, float); //! DECLARE_SOA_COLUMN(NtrackSpherocity, ntspherocity, int); DECLARE_SOA_COLUMN(IsSelected, isSelected, bool); //! MB event selection info DECLARE_SOA_COLUMN(IsEoI, isEoI, bool); //! lepton or photon exists in MB event (not for CEFP) +DECLARE_SOA_COLUMN(PosX, posX, float); //! only for treeCreatetorML.cxx +DECLARE_SOA_COLUMN(PosY, posY, float); //! only for treeCreatetorML.cxx DECLARE_SOA_COLUMN(PosZint16, posZint16, int16_t); //! this is only to reduce data size DECLARE_SOA_DYNAMIC_COLUMN(PosZ, posZ, [](int16_t posZint16) -> float { return static_cast(posZint16) * 0.1f; }); @@ -156,9 +158,17 @@ DECLARE_SOA_TABLE_VERSIONED(EMEvents_002, "AOD", "EMEVENT", 2, //! Main event collision::PosX, collision::PosY, collision::PosZ, collision::NumContrib, evsel::NumTracksInTimeRange, evsel::SumAmpFT0CInTimeRange, emevent::Sel8); -using EMEvents = EMEvents_002; +DECLARE_SOA_TABLE_VERSIONED(EMEvents_003, "AOD", "EMEVENT", 3, //! Main event information table + o2::soa::Index<>, emevent::CollisionId, bc::RunNumber, bc::GlobalBC, evsel::Alias, evsel::Selection, evsel::Rct, timestamp::Timestamp, + collision::PosZ, + collision::NumContrib, evsel::NumTracksInTimeRange, evsel::SumAmpFT0CInTimeRange, emevent::Sel8); + +using EMEvents = EMEvents_003; using EMEvent = EMEvents::iterator; +DECLARE_SOA_TABLE(EMEventsXY, "AOD", "EMEVENTXY", emevent::PosX, emevent::PosY); // joinable to EMEvents, only for treeCreatetorML.cxx +using EMEventXY = EMEventsXY::iterator; + DECLARE_SOA_TABLE(EMEventsCov, "AOD", "EMEVENTCOV", //! joinable to EMEvents collision::CovXX, collision::CovXY, collision::CovXZ, collision::CovYY, collision::CovYZ, collision::CovZZ, collision::Chi2, o2::soa::Marker<1>); using EMEventCov = EMEventsCov::iterator; @@ -396,15 +406,60 @@ DECLARE_SOA_COLUMN(CollisionId, collisionId, int); //! DECLARE_SOA_COLUMN(TrackId, trackId, int); //! DECLARE_SOA_SELF_ARRAY_INDEX_COLUMN(AmbiguousElectrons, ambiguousElectrons); DECLARE_SOA_COLUMN(IsAssociatedToMPC, isAssociatedToMPC, bool); //! is associated to most probable collision +DECLARE_SOA_COLUMN(IsAmbiguous, isAmbiguous, bool); //! is ambiguous DECLARE_SOA_COLUMN(Sign, sign, int8_t); //! DECLARE_SOA_COLUMN(PrefilterBit, pfb, uint8_t); //! DECLARE_SOA_COLUMN(PrefilterBitDerived, pfbderived, uint16_t); //! -DECLARE_SOA_COLUMN(ITSNSigmaEl, itsNSigmaEl, float); //! -DECLARE_SOA_COLUMN(ITSNSigmaMu, itsNSigmaMu, float); //! -DECLARE_SOA_COLUMN(ITSNSigmaPi, itsNSigmaPi, float); //! -DECLARE_SOA_COLUMN(ITSNSigmaKa, itsNSigmaKa, float); //! -DECLARE_SOA_COLUMN(ITSNSigmaPr, itsNSigmaPr, float); //! -// DECLARE_SOA_COLUMN(TPCSignalMC, mcTunedtpcSignal, float); //! + +DECLARE_SOA_COLUMN(ITSNSigmaEl, itsNSigmaEl, float); //! +DECLARE_SOA_COLUMN(ITSNSigmaMu, itsNSigmaMu, float); //! +DECLARE_SOA_COLUMN(ITSNSigmaPi, itsNSigmaPi, float); //! +DECLARE_SOA_COLUMN(ITSNSigmaKa, itsNSigmaKa, float); //! +DECLARE_SOA_COLUMN(ITSNSigmaPr, itsNSigmaPr, float); //! + +DECLARE_SOA_COLUMN(TPCSignalUINT16, tpcSignalUINT16, uint16_t); //! 0 - +65535 +DECLARE_SOA_COLUMN(DeDxTunedMcUINT16, mcTunedTPCSignalUINT16, uint16_t); //! 0 - +65535 +DECLARE_SOA_COLUMN(ProbElBDT, probElBDT, float); //! +// DECLARE_SOA_COLUMN(ProbEbdtUINT16, probEbdtUINT16, uint16_t); //! 0 - +65535 + +DECLARE_SOA_COLUMN(TPCChi2NClINT16, tpcChi2NClINT16, int16_t); //! -32768 - +32767 +DECLARE_SOA_COLUMN(ITSChi2NClINT16, itsChi2NClINT16, int16_t); //! -32768 - +32767 + +DECLARE_SOA_COLUMN(BetaINT16, betaINT16, int16_t); //! -32768 - +32767 +DECLARE_SOA_COLUMN(TOFChi2INT16, tofChi2INT16, int16_t); //! -32768 - +32767 + +DECLARE_SOA_COLUMN(TPCNSigmaElINT16, tpcNSigmaElINT16, int16_t); //! -32768 - +32767 +DECLARE_SOA_COLUMN(TPCNSigmaMuINT16, tpcNSigmaMuINT16, int16_t); //! -32768 - +32767 +DECLARE_SOA_COLUMN(TPCNSigmaPiINT16, tpcNSigmaPiINT16, int16_t); //! -32768 - +32767 +DECLARE_SOA_COLUMN(TPCNSigmaKaINT16, tpcNSigmaKaINT16, int16_t); //! -32768 - +32767 +DECLARE_SOA_COLUMN(TPCNSigmaPrINT16, tpcNSigmaPrINT16, int16_t); //! -32768 - +32767 + +DECLARE_SOA_COLUMN(TOFNSigmaElINT16, tofNSigmaElINT16, int16_t); //! -32768 - +32767 +DECLARE_SOA_COLUMN(TOFNSigmaMuINT16, tofNSigmaMuINT16, int16_t); //! -32768 - +32767 +DECLARE_SOA_COLUMN(TOFNSigmaPiINT16, tofNSigmaPiINT16, int16_t); //! -32768 - +32767 +DECLARE_SOA_COLUMN(TOFNSigmaKaINT16, tofNSigmaKaINT16, int16_t); //! -32768 - +32767 +DECLARE_SOA_COLUMN(TOFNSigmaPrINT16, tofNSigmaPrINT16, int16_t); //! -32768 - +32767 + +DECLARE_SOA_DYNAMIC_COLUMN(TPCSignal, tpcSignal, [](uint16_t x) -> float { return static_cast(x) * 1e-2; }); +DECLARE_SOA_DYNAMIC_COLUMN(DeDxTunedMc, mcTunedTPCSignal, [](uint16_t x) -> float { return static_cast(x) * 1e-2; }); +// DECLARE_SOA_DYNAMIC_COLUMN(ProbEbdt, probEbdt, [](uint16_t x) -> float { return static_cast(x) * 1e-4; }); +DECLARE_SOA_DYNAMIC_COLUMN(TPCChi2NCl, tpcChi2NCl, [](int16_t x) -> float { return static_cast(x) * 1e-2; }); +DECLARE_SOA_DYNAMIC_COLUMN(ITSChi2NCl, itsChi2NCl, [](int16_t x) -> float { return static_cast(x) * 1e-2; }); +DECLARE_SOA_DYNAMIC_COLUMN(Beta, beta, [](int16_t x) -> float { return static_cast(x) * 1e-3; }); +DECLARE_SOA_DYNAMIC_COLUMN(TOFChi2, tofChi2, [](int16_t x) -> float { return static_cast(x) * 1e-2; }); + +DECLARE_SOA_DYNAMIC_COLUMN(TPCNSigmaEl, tpcNSigmaEl, [](int16_t x) -> float { return static_cast(x) * 1e-2; }); +DECLARE_SOA_DYNAMIC_COLUMN(TPCNSigmaMu, tpcNSigmaMu, [](int16_t x) -> float { return static_cast(x) * 1e-2; }); +DECLARE_SOA_DYNAMIC_COLUMN(TPCNSigmaPi, tpcNSigmaPi, [](int16_t x) -> float { return static_cast(x) * 1e-2; }); +DECLARE_SOA_DYNAMIC_COLUMN(TPCNSigmaKa, tpcNSigmaKa, [](int16_t x) -> float { return static_cast(x) * 1e-2; }); +DECLARE_SOA_DYNAMIC_COLUMN(TPCNSigmaPr, tpcNSigmaPr, [](int16_t x) -> float { return static_cast(x) * 1e-2; }); + +DECLARE_SOA_DYNAMIC_COLUMN(TOFNSigmaEl, tofNSigmaEl, [](int16_t x) -> float { return static_cast(x) * 1e-2; }); +DECLARE_SOA_DYNAMIC_COLUMN(TOFNSigmaMu, tofNSigmaMu, [](int16_t x) -> float { return static_cast(x) * 1e-2; }); +DECLARE_SOA_DYNAMIC_COLUMN(TOFNSigmaPi, tofNSigmaPi, [](int16_t x) -> float { return static_cast(x) * 1e-2; }); +DECLARE_SOA_DYNAMIC_COLUMN(TOFNSigmaKa, tofNSigmaKa, [](int16_t x) -> float { return static_cast(x) * 1e-2; }); +DECLARE_SOA_DYNAMIC_COLUMN(TOFNSigmaPr, tofNSigmaPr, [](int16_t x) -> float { return static_cast(x) * 1e-2; }); + DECLARE_SOA_DYNAMIC_COLUMN(Signed1Pt, signed1Pt, [](float pt, int8_t sign) -> float { return sign * 1. / pt; }); DECLARE_SOA_DYNAMIC_COLUMN(P, p, [](float pt, float eta) -> float { return pt * std::cosh(eta); }); DECLARE_SOA_DYNAMIC_COLUMN(Px, px, [](float pt, float phi) -> float { return pt * std::cos(phi); }); @@ -549,11 +604,64 @@ DECLARE_SOA_TABLE_VERSIONED(EMPrimaryElectrons_003, "AOD", "EMPRIMARYEL", 3, //! emprimaryelectron::MeanClusterSizeITSib, emprimaryelectron::MeanClusterSizeITSob); -using EMPrimaryElectrons = EMPrimaryElectrons_003; +DECLARE_SOA_TABLE_VERSIONED(EMPrimaryElectrons_004, "AOD", "EMPRIMARYEL", 4, //! + o2::soa::Index<>, emprimaryelectron::CollisionId, + emprimaryelectron::TrackId, emprimaryelectron::Sign, + track::Pt, track::Eta, track::Phi, + track::DcaXY, track::DcaZ, aod::track::CYY, aod::track::CZY, aod::track::CZZ, + track::TPCNClsFindable, track::TPCNClsFindableMinusFound, track::TPCNClsFindableMinusCrossedRows, track::TPCNClsShared, + emprimaryelectron::TPCChi2NClINT16, track::TPCInnerParam, + emprimaryelectron::TPCSignalUINT16, emprimaryelectron::TPCNSigmaElINT16, emprimaryelectron::TPCNSigmaPiINT16, emprimaryelectron::TPCNSigmaKaINT16, emprimaryelectron::TPCNSigmaPrINT16, + emprimaryelectron::BetaINT16, emprimaryelectron::TOFNSigmaElINT16, emprimaryelectron::TOFNSigmaPiINT16, emprimaryelectron::TOFNSigmaKaINT16, emprimaryelectron::TOFNSigmaPrINT16, + track::ITSClusterSizes, + emprimaryelectron::ITSChi2NClINT16, emprimaryelectron::TOFChi2INT16, track::DetectorMap, + track::Tgl, + emprimaryelectron::IsAssociatedToMPC, emprimaryelectron::IsAmbiguous, emprimaryelectron::ProbElBDT, + emprimaryelectron::DeDxTunedMcUINT16, + + // dynamic column + track::TPCNClsFound, + track::TPCNClsCrossedRows, + track::TPCCrossedRowsOverFindableCls, + track::TPCFoundOverFindableCls, + track::TPCFractionSharedCls, + track::v001::ITSClusterMap, track::v001::ITSNCls, track::v001::ITSNClsInnerBarrel, + track::HasITS, track::HasTPC, track::HasTRD, track::HasTOF, + + emprimaryelectron::TPCSignal, + emprimaryelectron::TPCChi2NCl, + emprimaryelectron::ITSChi2NCl, + emprimaryelectron::DeDxTunedMc, + // emprimaryelectron::ProbEbdt, + emprimaryelectron::Beta, + emprimaryelectron::TOFChi2, + + emprimaryelectron::TPCNSigmaEl, + emprimaryelectron::TPCNSigmaMu, + emprimaryelectron::TPCNSigmaPi, + emprimaryelectron::TPCNSigmaKa, + emprimaryelectron::TPCNSigmaPr, + emprimaryelectron::TOFNSigmaEl, + emprimaryelectron::TOFNSigmaMu, + emprimaryelectron::TOFNSigmaPi, + emprimaryelectron::TOFNSigmaKa, + emprimaryelectron::TOFNSigmaPr, + + emprimaryelectron::Signed1Pt, + emprimaryelectron::P, + emprimaryelectron::Px, + emprimaryelectron::Py, + emprimaryelectron::Pz, + emprimaryelectron::Theta, + emprimaryelectron::MeanClusterSizeITS, + emprimaryelectron::MeanClusterSizeITSib, + emprimaryelectron::MeanClusterSizeITSob); + +using EMPrimaryElectrons = EMPrimaryElectrons_004; // iterators using EMPrimaryElectron = EMPrimaryElectrons::iterator; -DECLARE_SOA_TABLE(EMPrimaryElectronsCov, "AOD", "EMPRIMARYELCOV", //! +DECLARE_SOA_TABLE(EMPrimaryElectronsCov_000, "AOD", "EMPRIMARYELCOV", //! aod::track::CYY, aod::track::CZY, aod::track::CZZ, @@ -569,6 +677,27 @@ DECLARE_SOA_TABLE(EMPrimaryElectronsCov, "AOD", "EMPRIMARYELCOV", //! aod::track::C1PtSnp, aod::track::C1PtTgl, aod::track::C1Pt21Pt2, o2::soa::Marker<1>); + +DECLARE_SOA_TABLE_VERSIONED(EMPrimaryElectronsCov_001, "AOD", "EMPRIMARYELCOV", 1, //! + aod::track::X, + aod::track::Alpha, + aod::track::Y, + aod::track::Z, + aod::track::Snp, + aod::track::CSnpY, + aod::track::CSnpZ, + aod::track::CSnpSnp, + aod::track::CTglY, + aod::track::CTglZ, + aod::track::CTglSnp, + aod::track::CTglTgl, + aod::track::C1PtY, + aod::track::C1PtZ, + aod::track::C1PtSnp, + aod::track::C1PtTgl, + aod::track::C1Pt21Pt2); // CYY, CZY, CZZ, Tgl are in the main electron table. + +using EMPrimaryElectronsCov = EMPrimaryElectronsCov_001; // iterators using EMPrimaryElectronCov = EMPrimaryElectronsCov::iterator; @@ -694,9 +823,9 @@ DECLARE_SOA_INDEX_COLUMN(EMEvent, emevent); //! DECLARE_SOA_COLUMN(CollisionId, collisionId, int); //! DECLARE_SOA_COLUMN(TrackId, trackId, int); //! // DECLARE_SOA_COLUMN(Sign, sign, int8_t); //! -DECLARE_SOA_COLUMN(TrackBit, trackBit, uint16_t); //! -DECLARE_SOA_COLUMN(PtUINT16, ptuint16, uint16_t); //! 0 - 65536 -DECLARE_SOA_COLUMN(DcaZINT16, dcaZint16, int16_t); //! -32768 - +32768 +DECLARE_SOA_COLUMN(TrackBit, trackBit, uint16_t); //! +DECLARE_SOA_COLUMN(PtUINT16, ptuint16, uint16_t); //! 0 - 65535 +DECLARE_SOA_COLUMN(DcaZINT16, dcaZint16, int16_t); //! -32768 - +32767 DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt, [](uint16_t ptuint16) -> float { return static_cast(ptuint16) * 1e-4; }); DECLARE_SOA_DYNAMIC_COLUMN(DcaZ, dcaZ, [](int16_t dcaZint16) -> float { return static_cast(dcaZint16) * 1e-4; }); // DECLARE_SOA_DYNAMIC_COLUMN(Signed1Pt, signed1Pt, [](float pt, int8_t sign) -> float { return sign * 1. / pt; }); diff --git a/PWGEM/Dilepton/TableProducer/CMakeLists.txt b/PWGEM/Dilepton/TableProducer/CMakeLists.txt index fd2d85bb04c..d234ee0d2b4 100644 --- a/PWGEM/Dilepton/TableProducer/CMakeLists.txt +++ b/PWGEM/Dilepton/TableProducer/CMakeLists.txt @@ -35,11 +35,6 @@ o2physics_add_dpl_workflow(skimmer-primary-track PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(skimmer-secondary-electron - SOURCES skimmerSecondaryElectron.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore - COMPONENT_NAME Analysis) - o2physics_add_dpl_workflow(create-emevent-dilepton SOURCES createEMEventDilepton.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore @@ -55,11 +50,6 @@ o2physics_add_dpl_workflow(associate-mc-info-dilepton PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(filter-dielectron-event - SOURCES filterDielectronEvent.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore - COMPONENT_NAME Analysis) - o2physics_add_dpl_workflow(event-selection SOURCES eventSelection.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore diff --git a/PWGEM/Dilepton/TableProducer/createEMEventDilepton.cxx b/PWGEM/Dilepton/TableProducer/createEMEventDilepton.cxx index a6ab3c9c4c5..a08d6939ee9 100644 --- a/PWGEM/Dilepton/TableProducer/createEMEventDilepton.cxx +++ b/PWGEM/Dilepton/TableProducer/createEMEventDilepton.cxx @@ -54,6 +54,7 @@ using MyCollisionsMC_Cent_Qvec = soa::Join; struct CreateEMEventDilepton { Produces embc; Produces event; + Produces eventXY; // Produces eventcov; Produces event_mult; Produces event_cent; @@ -188,9 +189,11 @@ struct CreateEMEventDilepton { registry.fill(HIST("hEventCounter"), 2); event(collision.globalIndex(), bc.runNumber(), bc.globalBC(), collision.alias_raw(), collision.selection_raw(), collision.rct_raw(), bc.timestamp(), - collision.posX(), collision.posY(), collision.posZ(), + collision.posZ(), collision.numContrib(), collision.trackOccupancyInTimeRange(), collision.ft0cOccupancyInTimeRange()); + eventXY(collision.posX(), collision.posY()); + // eventcov(collision.covXX(), collision.covXY(), collision.covXZ(), collision.covYY(), collision.covYZ(), collision.covZZ(), collision.chi2()); event_mult(collision.multFT0A(), collision.multFT0C(), collision.multNTracksPV(), collision.multNTracksPVeta1(), collision.multNTracksPVetaHalf()); diff --git a/PWGEM/Dilepton/TableProducer/filterDielectronEvent.cxx b/PWGEM/Dilepton/TableProducer/filterDielectronEvent.cxx deleted file mode 100644 index de91b961120..00000000000 --- a/PWGEM/Dilepton/TableProducer/filterDielectronEvent.cxx +++ /dev/null @@ -1,1722 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// \brief write relevant information about primary electrons. -/// \author daiki.sekihata@cern.ch - -#include "PWGEM/Dilepton/DataModel/dileptonTables.h" -#include "PWGEM/Dilepton/Utils/EMTrackUtilities.h" -#include "PWGEM/Dilepton/Utils/PairUtilities.h" -#include "PWGEM/PhotonMeson/DataModel/gammaTables.h" - -#include "Common/Core/TableHelper.h" -#include "Common/Core/trackUtilities.h" -#include "Common/DataModel/CollisionAssociationTables.h" - -#include "CCDB/BasicCCDBManager.h" -#include "CommonConstants/PhysicsConstants.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "DataFormatsParameters/GRPObject.h" -#include "DetectorsBase/GeometryManager.h" -#include "DetectorsBase/Propagator.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" - -#include "Math/Vector4D.h" - -#include -#include -#include -#include -#include - -using namespace o2; -using namespace o2::soa; -using namespace o2::framework; -using namespace o2::framework::expressions; -using namespace o2::constants::physics; - -using namespace o2::aod::pwgem::dilepton::utils::emtrackutil; - -using MyTracks = soa::Join; -using MyTrack = MyTracks::iterator; -using MyTracksMC = soa::Join; -using MyTrackMC = MyTracksMC::iterator; - -struct filterDielectronEvent { - using MyCollisions = soa::Join; - using MyCollisionsWithSWT = soa::Join; - - SliceCache cache; - Preslice perCol = o2::aod::track::collisionId; - Produces emprimaryelectrons; - Produces emprimaryelectronscov; - Produces filter; - - // Configurables - Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Configurable grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"}; - Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; - Configurable skipGRPOquery{"skipGRPOquery", true, "skip grpo query"}; - - // Operation and minimisation criteria - Configurable fillQAHistogram{"fillQAHistogram", false, "flag to fill QA histograms"}; - Configurable d_bz_input{"d_bz_input", -999, "bz field in kG, -999 is automatic"}; - Configurable min_ncluster_tpc{"min_ncluster_tpc", 0, "min ncluster tpc"}; - Configurable mincrossedrows{"mincrossedrows", 80, "min. crossed rows"}; - Configurable min_tpc_cr_findable_ratio{"min_tpc_cr_findable_ratio", 0.8, "min. TPC Ncr/Nf ratio"}; - Configurable max_pin_for_pion_rejection{"max_pin_for_pion_rejection", 1e+10, "pion rejection is applied below this pin"}; - Configurable max_frac_shared_clusters_tpc{"max_frac_shared_clusters_tpc", 999.f, "max fraction of shared clusters in TPC"}; - Configurable min_ncluster_its{"min_ncluster_its", 4, "min ncluster its"}; - Configurable min_ncluster_itsib{"min_ncluster_itsib", 1, "min ncluster itsib"}; - Configurable maxchi2tpc{"maxchi2tpc", 5.0, "max. chi2/NclsTPC"}; - Configurable maxchi2its{"maxchi2its", 6.0, "max. chi2/NclsITS"}; - Configurable minpt{"minpt", 0.15, "min pt for track"}; - Configurable maxeta{"maxeta", 0.9, "eta acceptance"}; - Configurable dca_xy_max{"dca_xy_max", 0.1f, "max DCAxy in cm"}; - Configurable dca_z_max{"dca_z_max", 0.1f, "max DCAz in cm"}; - Configurable dca_3d_sigma_max{"dca_3d_sigma_max", 1.5, "max DCA 3D in sigma"}; - Configurable minTPCNsigmaEl{"minTPCNsigmaEl", -2.5, "min. TPC n sigma for electron inclusion"}; - Configurable maxTPCNsigmaEl{"maxTPCNsigmaEl", 3.5, "max. TPC n sigma for electron inclusion"}; - Configurable maxTOFNsigmaEl{"maxTOFNsigmaEl", 3.5, "max. TOF n sigma for electron inclusion"}; - Configurable minTPCNsigmaPi{"minTPCNsigmaPi", -1e+10, "min. TPC n sigma for pion exclusion"}; - Configurable maxTPCNsigmaPi{"maxTPCNsigmaPi", 2.0, "max. TPC n sigma for pion exclusion"}; - Configurable minTPCNsigmaKa{"minTPCNsigmaKa", -3.0, "min. TPC n sigma for kaon exclusion"}; - Configurable maxTPCNsigmaKa{"maxTPCNsigmaKa", +3.0, "max. TPC n sigma for kaon exclusion"}; - Configurable minTPCNsigmaPr{"minTPCNsigmaPr", -3.0, "min. TPC n sigma for proton exclusion"}; - Configurable maxTPCNsigmaPr{"maxTPCNsigmaPr", +3.0, "max. TPC n sigma for proton exclusion"}; - Configurable maxMee{"maxMee", 1e+10, "max mee for virtual photon selection"}; - - Configurable apply_phiv{"apply_phiv", true, "flag to apply phiv cut"}; - Configurable slope{"slope", 0.0181, "slope for mee vs. phiv"}; - Configurable intercept{"intercept", -0.0370, "intercept for mee vs. phiv"}; - - HistogramRegistry fRegistry{"output", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; - - int mRunNumber; - float d_bz; - Service ccdb; - o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE; - - void init(InitContext&) - { - mRunNumber = 0; - d_bz = 0; - - ccdb->setURL(ccdburl); - ccdb->setCaching(true); - ccdb->setLocalObjectValidityChecking(); - ccdb->setFatalWhenNull(false); - - if (fillQAHistogram) { - fRegistry.add("Track/hPt", "pT;p_{T} (GeV/c)", kTH1F, {{1000, 0.0f, 10}}, false); - fRegistry.add("Track/hQoverPt", "q/pT;q/p_{T} (GeV/c)^{-1}", kTH1F, {{400, -20, 20}}, false); - fRegistry.add("Track/hRelSigma1Pt", "relative p_{T} resolution;p_{T} (GeV/c);#sigma_{1/p_{T}} #times p_{T}", kTH2F, {{1000, 0, 10}, {100, 0, 0.1}}, false); - fRegistry.add("Track/hEtaPhi", "#eta vs. #varphi;#varphi (rad.);#eta", kTH2F, {{180, 0, 2 * M_PI}, {20, -1.0f, 1.0f}}, false); - fRegistry.add("Track/hDCAxyz", "DCA xy vs. z;DCA_{xy} (cm);DCA_{z} (cm)", kTH2F, {{200, -1.0f, 1.0f}, {200, -1.0f, 1.0f}}, false); - fRegistry.add("Track/hDCAxyzSigma", "DCA xy vs. z;DCA_{xy} (#sigma);DCA_{z} (#sigma)", kTH2F, {{200, -10.0f, 10.0f}, {200, -10.0f, 10.0f}}, false); - fRegistry.add("Track/hDCAxyRes_Pt", "DCA_{xy} resolution vs. pT;p_{T} (GeV/c);DCA_{xy} resolution (#mum)", kTH2F, {{1000, 0, 10}, {500, 0., 500}}, false); - fRegistry.add("Track/hDCAzRes_Pt", "DCA_{z} resolution vs. pT;p_{T} (GeV/c);DCA_{z} resolution (#mum)", kTH2F, {{1000, 0, 10}, {500, 0., 500}}, false); - fRegistry.add("Track/hNclsTPC", "number of TPC clusters", kTH1F, {{161, -0.5, 160.5}}, false); - fRegistry.add("Track/hNcrTPC", "number of TPC crossed rows", kTH1F, {{161, -0.5, 160.5}}, false); - fRegistry.add("Track/hChi2TPC", "chi2/number of TPC clusters", kTH1F, {{100, 0, 10}}, false); - fRegistry.add("Track/hTPCdEdx", "TPC dE/dx;p_{in} (GeV/c);TPC dE/dx (a.u.)", kTH2F, {{1000, 0, 10}, {200, 0, 200}}, false); - fRegistry.add("Track/hTPCNsigmaEl", "TPC n sigma el;p_{in} (GeV/c);n #sigma_{e}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/hTPCNsigmaMu", "TPC n sigma mu;p_{in} (GeV/c);n #sigma_{#mu}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/hTPCNsigmaPi", "TPC n sigma pi;p_{in} (GeV/c);n #sigma_{#pi}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/hTPCNsigmaKa", "TPC n sigma ka;p_{in} (GeV/c);n #sigma_{K}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/hTPCNsigmaPr", "TPC n sigma pr;p_{in} (GeV/c);n #sigma_{p}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/hTOFbeta", "TOF beta;p_{pv} (GeV/c);#beta", kTH2F, {{1000, 0, 10}, {240, 0, 1.2}}, false); - fRegistry.add("Track/hTOFNsigmaEl", "TOF n sigma el;p_{pv} (GeV/c);n #sigma_{e}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/hTOFNsigmaMu", "TOF n sigma mu;p_{pv} (GeV/c);n #sigma_{#mu}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/hTOFNsigmaPi", "TOF n sigma pi;p_{pv} (GeV/c);n #sigma_{#pi}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/hTOFNsigmaKa", "TOF n sigma ka;p_{pv} (GeV/c);n #sigma_{K}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/hTOFNsigmaPr", "TOF n sigma pr;p_{pv} (GeV/c);n #sigma_{p}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/hTPCNcr2Nf", "TPC Ncr/Nfindable", kTH1F, {{200, 0, 2}}, false); - fRegistry.add("Track/hTPCNcls2Nf", "TPC Ncls/Nfindable", kTH1F, {{200, 0, 2}}, false); - fRegistry.add("Track/hTPCNclsShared", "TPC Ncls/Nfindable;p_{T} (GeV/c);N_{cls}^{shared}/N_{cls} in TPC", kTH2F, {{1000, 0, 10}, {100, 0, 1}}, false); - fRegistry.add("Track/hNclsITS", "number of ITS clusters", kTH1F, {{8, -0.5, 7.5}}, false); - fRegistry.add("Track/hChi2ITS", "chi2/number of ITS clusters", kTH1F, {{100, 0, 10}}, false); - fRegistry.add("Track/hITSClusterMap", "ITS cluster map", kTH1F, {{128, -0.5, 127.5}}, false); - fRegistry.add("Track/hMeanClusterSizeITS", "mean cluster size ITS;p_{pv} (GeV/c); on ITS #times cos(#lambda)", kTH2F, {{1000, 0, 10}, {150, 0, 15}}, false); - fRegistry.add("Pair/before/hMvsPt", "m_{ee} vs. p_{T,ee};m_{ee} (GeV/c^{2});p_{T,ee} (GeV/c)", kTH2F, {{400, 0, 4}, {100, 0, 10}}, false); - fRegistry.add("Pair/before/hMvsPhiV", "mee vs. phiv;#varphi_{V} (rad.);m_{ee} (GeV/c^{2})", kTH2F, {{90, 0, M_PI}, {100, 0, 0.1}}, false); - fRegistry.addClone("Pair/before/", "Pair/after/"); - fRegistry.add("Pair/uls/hM", "m_{ee};m_{ee} (GeV/c^{2})", kTH1F, {{100, 0, 0.1}}, false); - fRegistry.add("Pair/lspp/hM", "m_{ee};m_{ee} (GeV/c^{2})", kTH1F, {{100, 0, 0.1}}, false); - fRegistry.add("Pair/lsmm/hM", "m_{ee};m_{ee} (GeV/c^{2})", kTH1F, {{100, 0, 0.1}}, false); - } - } - - void initCCDB(aod::BCsWithTimestamps::iterator const& bc) - { - if (mRunNumber == bc.runNumber()) { - return; - } - - // In case override, don't proceed, please - no CCDB access required - if (d_bz_input > -990) { - d_bz = d_bz_input; - o2::parameters::GRPMagField grpmag; - if (std::fabs(d_bz) > 1e-5) { - grpmag.setL3Current(30000.f / (d_bz / 5.0f)); - } - o2::base::Propagator::initFieldFromGRP(&grpmag); - mRunNumber = bc.runNumber(); - return; - } - - auto run3grp_timestamp = bc.timestamp(); - o2::parameters::GRPObject* grpo = 0x0; - o2::parameters::GRPMagField* grpmag = 0x0; - if (!skipGRPOquery) - grpo = ccdb->getForTimeStamp(grpPath, run3grp_timestamp); - if (grpo) { - o2::base::Propagator::initFieldFromGRP(grpo); - // Fetch magnetic field from ccdb for current collision - d_bz = grpo->getNominalL3Field(); - LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; - } else { - grpmag = ccdb->getForTimeStamp(grpmagPath, run3grp_timestamp); - if (!grpmag) { - LOG(fatal) << "Got nullptr from CCDB for path " << grpmagPath << " of object GRPMagField and " << grpPath << " of object GRPObject for timestamp " << run3grp_timestamp; - } - o2::base::Propagator::initFieldFromGRP(grpmag); - // Fetch magnetic field from ccdb for current collision - d_bz = std::lround(5.f * grpmag->getL3Current() / 30000.f); - LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; - } - mRunNumber = bc.runNumber(); - } - - template - bool checkTrack(TCollision const& collision, TTrack const& track) - { - if constexpr (isMC) { - if (!track.has_mcParticle()) { - return false; - } - } - - if (track.tpcChi2NCl() > maxchi2tpc) { - return false; - } - - if (track.itsChi2NCl() > maxchi2its) { - return false; - } - - if (!track.hasITS() || !track.hasTPC()) { - return false; - } - if (track.itsNCls() < min_ncluster_its) { - return false; - } - if (track.itsNClsInnerBarrel() < min_ncluster_itsib) { - return false; - } - - if (track.tpcNClsFound() < min_ncluster_tpc) { - return false; - } - - if (track.tpcNClsCrossedRows() < mincrossedrows) { - return false; - } - - if (track.tpcCrossedRowsOverFindableCls() < min_tpc_cr_findable_ratio) { - return false; - } - - if (track.tpcFractionSharedCls() > max_frac_shared_clusters_tpc) { - return false; - } - - std::array dcaInfo; - auto track_par_cov_recalc = getTrackParCov(track); - track_par_cov_recalc.setPID(o2::track::PID::Electron); - // std::array pVec_recalc = {0, 0, 0}; // px, py, pz - o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, track_par_cov_recalc, 2.f, matCorr, &dcaInfo); - // getPxPyPz(track_par_cov_recalc, pVec_recalc); - float dcaXY = dcaInfo[0]; - float dcaZ = dcaInfo[1]; - - if (std::fabs(dcaXY) > dca_xy_max || std::fabs(dcaZ) > dca_z_max) { - return false; - } - - if (track_par_cov_recalc.getPt() < minpt || std::fabs(track_par_cov_recalc.getEta()) > maxeta) { - return false; - } - - float dca_3d = 999.f; - float det = track_par_cov_recalc.getSigmaY2() * track_par_cov_recalc.getSigmaZ2() - track_par_cov_recalc.getSigmaZY() * track_par_cov_recalc.getSigmaZY(); - if (det < 0) { - dca_3d = 999.f; - } else { - float chi2 = (dcaXY * dcaXY * track_par_cov_recalc.getSigmaZ2() + dcaZ * dcaZ * track_par_cov_recalc.getSigmaY2() - 2. * dcaXY * dcaZ * track_par_cov_recalc.getSigmaZY()) / det; - dca_3d = std::sqrt(std::fabs(chi2) / 2.); - } - if (dca_3d > dca_3d_sigma_max) { - return false; - } - - return true; - } - - template - bool isElectron(TTrack const& track) - { - return isElectron_TPChadrej(track) || isElectron_TOFreq(track); - } - - template - bool isElectron_TPChadrej(TTrack const& track) - { - if (track.tpcNSigmaEl() < minTPCNsigmaEl || maxTPCNsigmaEl < track.tpcNSigmaEl()) { - return false; - } - if (minTPCNsigmaPi < track.tpcNSigmaPi() && track.tpcNSigmaPi() < maxTPCNsigmaPi && track.tpcInnerParam() < max_pin_for_pion_rejection) { - return false; - } - if (minTPCNsigmaKa < track.tpcNSigmaKa() && track.tpcNSigmaKa() < maxTPCNsigmaKa) { - return false; - } - if (minTPCNsigmaPr < track.tpcNSigmaPr() && track.tpcNSigmaPr() < maxTPCNsigmaPr) { - return false; - } - if (track.hasTOF() && (maxTOFNsigmaEl < std::fabs(track.tofNSigmaEl()))) { - return false; - } - return true; - } - - template - bool isElectron_TOFreq(TTrack const& track) - { - if (minTPCNsigmaPi < track.tpcNSigmaPi() && track.tpcNSigmaPi() < maxTPCNsigmaPi && track.tpcInnerParam() < max_pin_for_pion_rejection) { - return false; - } - return minTPCNsigmaEl < track.tpcNSigmaEl() && track.tpcNSigmaEl() < maxTPCNsigmaEl && std::fabs(track.tofNSigmaEl()) < maxTOFNsigmaEl; - } - - template - void fillTrackTable(TCollision const& collision, TTrack const& track) - { - if (std::find(stored_trackIds.begin(), stored_trackIds.end(), std::pair{collision.globalIndex(), track.globalIndex()}) == stored_trackIds.end()) { - std::array dcaInfo; - auto track_par_cov_recalc = getTrackParCov(track); - track_par_cov_recalc.setPID(o2::track::PID::Electron); - // std::array pVec_recalc = {0, 0, 0}; // px, py, pz - o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, track_par_cov_recalc, 2.f, matCorr, &dcaInfo); - // getPxPyPz(track_par_cov_recalc, pVec_recalc); - float dcaXY = dcaInfo[0]; - float dcaZ = dcaInfo[1]; - - float pt_recalc = track_par_cov_recalc.getPt(); - float eta_recalc = track_par_cov_recalc.getEta(); - float phi_recalc = track_par_cov_recalc.getPhi(); - - bool isAssociatedToMPC = collision.globalIndex() == track.collisionId(); - - emprimaryelectrons(collision.globalIndex(), track.globalIndex(), track.sign(), - pt_recalc, eta_recalc, phi_recalc, dcaXY, dcaZ, - track.tpcNClsFindable(), track.tpcNClsFindableMinusFound(), track.tpcNClsFindableMinusCrossedRows(), track.tpcNClsShared(), - track.tpcChi2NCl(), track.tpcInnerParam(), - track.tpcSignal(), track.tpcNSigmaEl(), /*track.tpcNSigmaMu(),*/ track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr(), - track.beta(), track.tofNSigmaEl(), /*track.tofNSigmaMu(),*/ track.tofNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPr(), - track.itsClusterSizes(), - // 0, 0, 0, 0, 0, - track.itsChi2NCl(), track.tofChi2(), track.detectorMap(), - track_par_cov_recalc.getX(), track_par_cov_recalc.getAlpha(), track_par_cov_recalc.getY(), track_par_cov_recalc.getZ(), track_par_cov_recalc.getSnp(), track_par_cov_recalc.getTgl(), isAssociatedToMPC, -1); - - emprimaryelectronscov( - track_par_cov_recalc.getSigmaY2(), - track_par_cov_recalc.getSigmaZY(), - track_par_cov_recalc.getSigmaZ2(), - track_par_cov_recalc.getSigmaSnpY(), - track_par_cov_recalc.getSigmaSnpZ(), - track_par_cov_recalc.getSigmaSnp2(), - track_par_cov_recalc.getSigmaTglY(), - track_par_cov_recalc.getSigmaTglZ(), - track_par_cov_recalc.getSigmaTglSnp(), - track_par_cov_recalc.getSigmaTgl2(), - track_par_cov_recalc.getSigma1PtY(), - track_par_cov_recalc.getSigma1PtZ(), - track_par_cov_recalc.getSigma1PtSnp(), - track_par_cov_recalc.getSigma1PtTgl(), - track_par_cov_recalc.getSigma1Pt2()); - - stored_trackIds.emplace_back(std::pair{collision.globalIndex(), track.globalIndex()}); - - if (fillQAHistogram) { - uint32_t itsClusterSizes = track.itsClusterSizes(); - int total_cluster_size = 0, nl = 0; - for (unsigned int layer = 0; layer < 7; layer++) { - int cluster_size_per_layer = (itsClusterSizes >> (layer * 4)) & 0xf; - if (cluster_size_per_layer > 0) { - nl++; - } - total_cluster_size += cluster_size_per_layer; - } - - fRegistry.fill(HIST("Track/hPt"), pt_recalc); - fRegistry.fill(HIST("Track/hQoverPt"), track.sign() / pt_recalc); - fRegistry.fill(HIST("Track/hRelSigma1Pt"), pt_recalc, std::sqrt(track_par_cov_recalc.getSigma1Pt2()) * pt_recalc); - fRegistry.fill(HIST("Track/hEtaPhi"), phi_recalc, eta_recalc); - fRegistry.fill(HIST("Track/hDCAxyz"), dcaXY, dcaZ); - fRegistry.fill(HIST("Track/hDCAxyzSigma"), dcaXY / std::sqrt(track_par_cov_recalc.getSigmaY2()), dcaZ / std::sqrt(track_par_cov_recalc.getSigmaZ2())); - fRegistry.fill(HIST("Track/hDCAxyRes_Pt"), pt_recalc, std::sqrt(track_par_cov_recalc.getSigmaY2()) * 1e+4); // convert cm to um - fRegistry.fill(HIST("Track/hDCAzRes_Pt"), pt_recalc, std::sqrt(track_par_cov_recalc.getSigmaZ2()) * 1e+4); // convert cm to um - fRegistry.fill(HIST("Track/hNclsITS"), track.itsNCls()); - fRegistry.fill(HIST("Track/hNclsTPC"), track.tpcNClsFound()); - fRegistry.fill(HIST("Track/hNcrTPC"), track.tpcNClsCrossedRows()); - fRegistry.fill(HIST("Track/hTPCNcr2Nf"), track.tpcCrossedRowsOverFindableCls()); - fRegistry.fill(HIST("Track/hTPCNcls2Nf"), track.tpcFoundOverFindableCls()); - fRegistry.fill(HIST("Track/hTPCNclsShared"), track.pt(), track.tpcFractionSharedCls()); - fRegistry.fill(HIST("Track/hChi2TPC"), track.tpcChi2NCl()); - fRegistry.fill(HIST("Track/hChi2ITS"), track.itsChi2NCl()); - fRegistry.fill(HIST("Track/hITSClusterMap"), track.itsClusterMap()); - fRegistry.fill(HIST("Track/hMeanClusterSizeITS"), track.p(), static_cast(total_cluster_size) / static_cast(nl) * std::cos(std::atan(track.tgl()))); - fRegistry.fill(HIST("Track/hTPCdEdx"), track.tpcInnerParam(), track.tpcSignal()); - fRegistry.fill(HIST("Track/hTPCNsigmaEl"), track.tpcInnerParam(), track.tpcNSigmaEl()); - fRegistry.fill(HIST("Track/hTPCNsigmaMu"), track.tpcInnerParam(), track.tpcNSigmaMu()); - fRegistry.fill(HIST("Track/hTPCNsigmaPi"), track.tpcInnerParam(), track.tpcNSigmaPi()); - fRegistry.fill(HIST("Track/hTPCNsigmaKa"), track.tpcInnerParam(), track.tpcNSigmaKa()); - fRegistry.fill(HIST("Track/hTPCNsigmaPr"), track.tpcInnerParam(), track.tpcNSigmaPr()); - fRegistry.fill(HIST("Track/hTOFbeta"), track.p(), track.beta()); - fRegistry.fill(HIST("Track/hTOFNsigmaEl"), track.p(), track.tofNSigmaEl()); - fRegistry.fill(HIST("Track/hTOFNsigmaMu"), track.p(), track.tofNSigmaMu()); - fRegistry.fill(HIST("Track/hTOFNsigmaPi"), track.p(), track.tofNSigmaPi()); - fRegistry.fill(HIST("Track/hTOFNsigmaKa"), track.p(), track.tofNSigmaKa()); - fRegistry.fill(HIST("Track/hTOFNsigmaPr"), track.p(), track.tofNSigmaPr()); - } - } - } - - template - o2::track::TrackParCov propagateTrack(TCollision const& collision, TTrack const& track) - { - std::array dcaInfo; - auto track_par_cov_recalc = getTrackParCov(track); - track_par_cov_recalc.setPID(o2::track::PID::Electron); - // std::array pVec_recalc = {0, 0, 0}; // px, py, pz - o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, track_par_cov_recalc, 2.f, matCorr, &dcaInfo); - // getPxPyPz(track_par_cov_recalc, pVec_recalc); - return track_par_cov_recalc; - } - - std::vector> stored_trackIds; - // std::vector> stored_pairIds; - Filter trackFilter = o2::aod::track::pt > minpt&& nabs(o2::aod::track::eta) < maxeta&& o2::aod::track::tpcChi2NCl < maxchi2tpc&& o2::aod::track::itsChi2NCl < maxchi2its&& ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::ITS) == true && ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::TPC) == true; - Filter pidFilter = minTPCNsigmaEl < o2::aod::pidtpc::tpcNSigmaEl && o2::aod::pidtpc::tpcNSigmaEl < maxTPCNsigmaEl; - using MyFilteredTracks = soa::Filtered; - - Partition posTracks = o2::aod::track::signed1Pt > 0.f; - Partition negTracks = o2::aod::track::signed1Pt < 0.f; - - // ---------- for data ---------- - - void processRec_SA(MyCollisions const& collisions, aod::BCsWithTimestamps const&, MyFilteredTracks const&) - { - stored_trackIds.reserve(posTracks.size() + negTracks.size()); - - for (auto& collision : collisions) { - auto bc = collision.template foundBC_as(); - initCCDB(bc); - - if (!collision.isSelected()) { - filter(0, 0, 0); - continue; - } - - int nee_uls = 0; - auto posTracks_per_coll = posTracks->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache); - auto negTracks_per_coll = negTracks->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache); - - for (auto& [pos, ele] : combinations(CombinationsFullIndexPolicy(posTracks_per_coll, negTracks_per_coll))) { - if (!checkTrack(collision, pos) || !checkTrack(collision, ele)) { - continue; - } - if (!isElectron(pos) || !isElectron(ele)) { - continue; - } - - ROOT::Math::PtEtaPhiMVector v1(pos.pt(), pos.eta(), pos.phi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v2(ele.pt(), ele.eta(), ele.phi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(pos.px(), pos.py(), pos.pz(), ele.px(), ele.py(), ele.pz(), pos.sign(), ele.sign(), d_bz); - - if (fillQAHistogram) { - fRegistry.fill(HIST("Pair/uls/hM"), v12.M()); - fRegistry.fill(HIST("Pair/before/hMvsPt"), v12.M(), v12.Pt()); - fRegistry.fill(HIST("Pair/before/hMvsPhiV"), phiv, v12.M()); - } - if (apply_phiv ? (v12.M() < maxMee && slope * phiv + intercept < v12.M()) : (v12.M() < maxMee)) { - fillTrackTable(collision, pos); - fillTrackTable(collision, ele); - if (fillQAHistogram) { - fRegistry.fill(HIST("Pair/after/hMvsPt"), v12.M(), v12.Pt()); - fRegistry.fill(HIST("Pair/after/hMvsPhiV"), phiv, v12.M()); - } - nee_uls++; - } - - } // end of pairing loop - - if (fillQAHistogram) { - for (auto& [pos1, pos2] : combinations(CombinationsStrictlyUpperIndexPolicy(posTracks_per_coll, posTracks_per_coll))) { - if (!checkTrack(collision, pos1) || !checkTrack(collision, pos2)) { - continue; - } - if (!isElectron(pos1) || !isElectron(pos2)) { - continue; - } - - ROOT::Math::PtEtaPhiMVector v1(pos1.pt(), pos1.eta(), pos1.phi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v2(pos2.pt(), pos2.eta(), pos2.phi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - fRegistry.fill(HIST("Pair/lspp/hM"), v12.M()); - } // end of pairing loop - - for (auto& [ele1, ele2] : combinations(CombinationsStrictlyUpperIndexPolicy(negTracks_per_coll, negTracks_per_coll))) { - if (!checkTrack(collision, ele1) || !checkTrack(collision, ele2)) { - continue; - } - if (!isElectron(ele1) || !isElectron(ele2)) { - continue; - } - - ROOT::Math::PtEtaPhiMVector v1(ele1.pt(), ele1.eta(), ele1.phi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v2(ele2.pt(), ele2.eta(), ele2.phi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - fRegistry.fill(HIST("Pair/lsmm/hM"), v12.M()); - } // end of pairing loop - } - - if (nee_uls < 1) { - filter(nee_uls, 0, 0); - continue; - } - filter(nee_uls, 0, 0); - - } // end of collision loop - - stored_trackIds.clear(); - stored_trackIds.shrink_to_fit(); - // stored_pairIds.clear(); - // stored_pairIds.shrink_to_fit(); - } - PROCESS_SWITCH(filterDielectronEvent, processRec_SA, "process reconstructed info only", true); // standalone - - Preslice trackIndicesPerCollision = aod::track_association::collisionId; - void processRec_TTCA(MyCollisions const& collisions, aod::BCsWithTimestamps const&, MyTracks const& tracks, aod::TrackAssoc const& trackIndices) - { - stored_trackIds.reserve(tracks.size() * 2); - - for (auto& collision : collisions) { - auto bc = collision.template foundBC_as(); - initCCDB(bc); - - if (!collision.isSelected()) { - filter(0, 0, 0); - continue; - } - - int nee_uls = 0; - auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, collision.globalIndex()); - std::vector posTracks_per_coll; - std::vector negTracks_per_coll; - posTracks_per_coll.reserve(trackIdsThisCollision.size()); - negTracks_per_coll.reserve(trackIdsThisCollision.size()); - - for (auto& trackId : trackIdsThisCollision) { - auto track = trackId.template track_as(); - if (!checkTrack(collision, track) || !isElectron(track)) { - continue; - } - - if (track.sign() > 0) { - posTracks_per_coll.emplace_back(track); - } else { - negTracks_per_coll.emplace_back(track); - } - } // end of track loop - - for (auto& pos : posTracks_per_coll) { - for (auto& ele : negTracks_per_coll) { - - auto pos_prop = propagateTrack(collision, pos); - auto ele_prop = propagateTrack(collision, ele); - - std::array pVec_pos = {0, 0, 0}; // px, py, pz - getPxPyPz(pos_prop, pVec_pos); - std::array pVec_ele = {0, 0, 0}; // px, py, pz - getPxPyPz(ele_prop, pVec_ele); - - ROOT::Math::PtEtaPhiMVector v1(pos_prop.getPt(), pos_prop.getEta(), pos_prop.getPhi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v2(ele_prop.getPt(), ele_prop.getEta(), ele_prop.getPhi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(pVec_pos[0], pVec_pos[1], pVec_pos[2], pVec_ele[0], pVec_ele[1], pVec_ele[2], pos.sign(), ele.sign(), d_bz); - - if (fillQAHistogram) { - fRegistry.fill(HIST("Pair/uls/hM"), v12.M()); - fRegistry.fill(HIST("Pair/before/hMvsPt"), v12.M(), v12.Pt()); - fRegistry.fill(HIST("Pair/before/hMvsPhiV"), phiv, v12.M()); - } - if (apply_phiv ? (v12.M() < maxMee && slope * phiv + intercept < v12.M()) : (v12.M() < maxMee)) { - fillTrackTable(collision, pos); - fillTrackTable(collision, ele); - if (fillQAHistogram) { - fRegistry.fill(HIST("Pair/after/hMvsPt"), v12.M(), v12.Pt()); - fRegistry.fill(HIST("Pair/after/hMvsPhiV"), phiv, v12.M()); - } - nee_uls++; - } - - } // end of negative track loop - } // end of postive track loop - - if (fillQAHistogram) { - for (auto& pos1 : posTracks_per_coll) { - for (auto& pos2 : posTracks_per_coll) { - if (pos1.globalIndex() == pos2.globalIndex()) { - continue; - } - - auto pos1_prop = propagateTrack(collision, pos1); - auto pos2_prop = propagateTrack(collision, pos2); - - std::array pVec_pos1 = {0, 0, 0}; // px, py, pz - getPxPyPz(pos1_prop, pVec_pos1); - std::array pVec_pos2 = {0, 0, 0}; // px, py, pz - getPxPyPz(pos2_prop, pVec_pos2); - - ROOT::Math::PtEtaPhiMVector v1(pos1_prop.getPt(), pos1_prop.getEta(), pos1_prop.getPhi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v2(pos2_prop.getPt(), pos2_prop.getEta(), pos2_prop.getPhi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - fRegistry.fill(HIST("Pair/lspp/hM"), v12.M()); - } // end of positive track loop - } // end of postive track loop - - for (auto& ele1 : negTracks_per_coll) { - for (auto& ele2 : negTracks_per_coll) { - if (ele1.globalIndex() == ele2.globalIndex()) { - continue; - } - - auto ele1_prop = propagateTrack(collision, ele1); - auto ele2_prop = propagateTrack(collision, ele2); - - std::array pVec_ele1 = {0, 0, 0}; // px, py, pz - getPxPyPz(ele1_prop, pVec_ele1); - std::array pVec_ele2 = {0, 0, 0}; // px, py, pz - getPxPyPz(ele2_prop, pVec_ele2); - - ROOT::Math::PtEtaPhiMVector v1(ele1_prop.getPt(), ele1_prop.getEta(), ele1_prop.getPhi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v2(ele2_prop.getPt(), ele2_prop.getEta(), ele2_prop.getPhi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - fRegistry.fill(HIST("Pair/lsmm/hM"), v12.M()); - } // end of negative track loop - } // end of negative track loop - } - - if (nee_uls < 1) { - filter(nee_uls, 0, 0); - continue; - } - - filter(nee_uls, 0, 0); - - posTracks_per_coll.clear(); - negTracks_per_coll.clear(); - posTracks_per_coll.shrink_to_fit(); - negTracks_per_coll.shrink_to_fit(); - - } // end of collision loop - - stored_trackIds.clear(); - stored_trackIds.shrink_to_fit(); - // stored_pairIds.clear(); - // stored_pairIds.shrink_to_fit(); - } - PROCESS_SWITCH(filterDielectronEvent, processRec_TTCA, "process reconstructed info only", false); // with TTCA - - // ---------- for data ---------- - - void processRec_SA_SWT(MyCollisionsWithSWT const& collisions, aod::BCsWithTimestamps const&, MyFilteredTracks const&) - { - stored_trackIds.reserve(posTracks.size() + negTracks.size()); - - for (auto& collision : collisions) { - auto bc = collision.template foundBC_as(); - initCCDB(bc); - - if (!collision.isSelected()) { - filter(0, 0, 0); - continue; - } - if (collision.swtaliastmp_raw() == 0) { - filter(0, 0, 0); - continue; - } - - int nee_uls = 0; - auto posTracks_per_coll = posTracks->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache); - auto negTracks_per_coll = negTracks->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache); - - for (auto& [pos, ele] : combinations(CombinationsFullIndexPolicy(posTracks_per_coll, negTracks_per_coll))) { - if (!checkTrack(collision, pos) || !checkTrack(collision, ele)) { - continue; - } - if (!isElectron(pos) || !isElectron(ele)) { - continue; - } - - ROOT::Math::PtEtaPhiMVector v1(pos.pt(), pos.eta(), pos.phi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v2(ele.pt(), ele.eta(), ele.phi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(pos.px(), pos.py(), pos.pz(), ele.px(), ele.py(), ele.pz(), pos.sign(), ele.sign(), d_bz); - - if (fillQAHistogram) { - fRegistry.fill(HIST("Pair/uls/hM"), v12.M()); - fRegistry.fill(HIST("Pair/before/hMvsPt"), v12.M(), v12.Pt()); - fRegistry.fill(HIST("Pair/before/hMvsPhiV"), phiv, v12.M()); - } - if (apply_phiv ? (v12.M() < maxMee && slope * phiv + intercept < v12.M()) : (v12.M() < maxMee)) { - fillTrackTable(collision, pos); - fillTrackTable(collision, ele); - if (fillQAHistogram) { - fRegistry.fill(HIST("Pair/after/hMvsPt"), v12.M(), v12.Pt()); - fRegistry.fill(HIST("Pair/after/hMvsPhiV"), phiv, v12.M()); - } - nee_uls++; - } - - } // end of pairing loop - - if (fillQAHistogram) { - for (auto& [pos1, pos2] : combinations(CombinationsStrictlyUpperIndexPolicy(posTracks_per_coll, posTracks_per_coll))) { - if (!checkTrack(collision, pos1) || !checkTrack(collision, pos2)) { - continue; - } - if (!isElectron(pos1) || !isElectron(pos2)) { - continue; - } - - ROOT::Math::PtEtaPhiMVector v1(pos1.pt(), pos1.eta(), pos1.phi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v2(pos2.pt(), pos2.eta(), pos2.phi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - fRegistry.fill(HIST("Pair/lspp/hM"), v12.M()); - } // end of pairing loop - - for (auto& [ele1, ele2] : combinations(CombinationsStrictlyUpperIndexPolicy(negTracks_per_coll, negTracks_per_coll))) { - if (!checkTrack(collision, ele1) || !checkTrack(collision, ele2)) { - continue; - } - if (!isElectron(ele1) || !isElectron(ele2)) { - continue; - } - - ROOT::Math::PtEtaPhiMVector v1(ele1.pt(), ele1.eta(), ele1.phi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v2(ele2.pt(), ele2.eta(), ele2.phi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - fRegistry.fill(HIST("Pair/lsmm/hM"), v12.M()); - } // end of pairing loop - } - - if (nee_uls < 1) { - filter(nee_uls, 0, 0); - continue; - } - filter(nee_uls, 0, 0); - - } // end of collision loop - - stored_trackIds.clear(); - stored_trackIds.shrink_to_fit(); - // stored_pairIds.clear(); - // stored_pairIds.shrink_to_fit(); - } - PROCESS_SWITCH(filterDielectronEvent, processRec_SA_SWT, "process reconstructed info only", false); // standalone - - void processRec_TTCA_SWT(MyCollisionsWithSWT const& collisions, aod::BCsWithTimestamps const&, MyTracks const& tracks, aod::TrackAssoc const& trackIndices) - { - stored_trackIds.reserve(tracks.size() * 2); - - for (auto& collision : collisions) { - auto bc = collision.template foundBC_as(); - initCCDB(bc); - - if (!collision.isSelected()) { - filter(0, 0, 0); - continue; - } - if (collision.swtaliastmp_raw() == 0) { - filter(0, 0, 0); - continue; - } - - int nee_uls = 0; - auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, collision.globalIndex()); - std::vector posTracks_per_coll; - std::vector negTracks_per_coll; - posTracks_per_coll.reserve(trackIdsThisCollision.size()); - negTracks_per_coll.reserve(trackIdsThisCollision.size()); - - for (auto& trackId : trackIdsThisCollision) { - auto track = trackId.template track_as(); - if (!checkTrack(collision, track) || !isElectron(track)) { - continue; - } - - if (track.sign() > 0) { - posTracks_per_coll.emplace_back(track); - } else { - negTracks_per_coll.emplace_back(track); - } - } // end of track loop - - for (auto& pos : posTracks_per_coll) { - for (auto& ele : negTracks_per_coll) { - - auto pos_prop = propagateTrack(collision, pos); - auto ele_prop = propagateTrack(collision, ele); - - std::array pVec_pos = {0, 0, 0}; // px, py, pz - getPxPyPz(pos_prop, pVec_pos); - std::array pVec_ele = {0, 0, 0}; // px, py, pz - getPxPyPz(ele_prop, pVec_ele); - - ROOT::Math::PtEtaPhiMVector v1(pos_prop.getPt(), pos_prop.getEta(), pos_prop.getPhi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v2(ele_prop.getPt(), ele_prop.getEta(), ele_prop.getPhi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(pVec_pos[0], pVec_pos[1], pVec_pos[2], pVec_ele[0], pVec_ele[1], pVec_ele[2], pos.sign(), ele.sign(), d_bz); - - if (fillQAHistogram) { - fRegistry.fill(HIST("Pair/uls/hM"), v12.M()); - fRegistry.fill(HIST("Pair/before/hMvsPt"), v12.M(), v12.Pt()); - fRegistry.fill(HIST("Pair/before/hMvsPhiV"), phiv, v12.M()); - } - if (apply_phiv ? (v12.M() < maxMee && slope * phiv + intercept < v12.M()) : (v12.M() < maxMee)) { - fillTrackTable(collision, pos); - fillTrackTable(collision, ele); - if (fillQAHistogram) { - fRegistry.fill(HIST("Pair/after/hMvsPt"), v12.M(), v12.Pt()); - fRegistry.fill(HIST("Pair/after/hMvsPhiV"), phiv, v12.M()); - } - nee_uls++; - } - - } // end of negative track loop - } // end of postive track loop - - if (fillQAHistogram) { - for (auto& pos1 : posTracks_per_coll) { - for (auto& pos2 : posTracks_per_coll) { - if (pos1.globalIndex() == pos2.globalIndex()) { - continue; - } - - auto pos1_prop = propagateTrack(collision, pos1); - auto pos2_prop = propagateTrack(collision, pos2); - - std::array pVec_pos1 = {0, 0, 0}; // px, py, pz - getPxPyPz(pos1_prop, pVec_pos1); - std::array pVec_pos2 = {0, 0, 0}; // px, py, pz - getPxPyPz(pos2_prop, pVec_pos2); - - ROOT::Math::PtEtaPhiMVector v1(pos1_prop.getPt(), pos1_prop.getEta(), pos1_prop.getPhi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v2(pos2_prop.getPt(), pos2_prop.getEta(), pos2_prop.getPhi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - fRegistry.fill(HIST("Pair/lspp/hM"), v12.M()); - } // end of positive track loop - } // end of postive track loop - - for (auto& ele1 : negTracks_per_coll) { - for (auto& ele2 : negTracks_per_coll) { - if (ele1.globalIndex() == ele2.globalIndex()) { - continue; - } - - auto ele1_prop = propagateTrack(collision, ele1); - auto ele2_prop = propagateTrack(collision, ele2); - - std::array pVec_ele1 = {0, 0, 0}; // px, py, pz - getPxPyPz(ele1_prop, pVec_ele1); - std::array pVec_ele2 = {0, 0, 0}; // px, py, pz - getPxPyPz(ele2_prop, pVec_ele2); - - ROOT::Math::PtEtaPhiMVector v1(ele1_prop.getPt(), ele1_prop.getEta(), ele1_prop.getPhi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v2(ele2_prop.getPt(), ele2_prop.getEta(), ele2_prop.getPhi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - fRegistry.fill(HIST("Pair/lsmm/hM"), v12.M()); - } // end of negative track loop - } // end of negative track loop - } - - if (nee_uls < 1) { - filter(nee_uls, 0, 0); - continue; - } - - filter(nee_uls, 0, 0); - - posTracks_per_coll.clear(); - negTracks_per_coll.clear(); - posTracks_per_coll.shrink_to_fit(); - negTracks_per_coll.shrink_to_fit(); - - } // end of collision loop - - stored_trackIds.clear(); - stored_trackIds.shrink_to_fit(); - // stored_pairIds.clear(); - // stored_pairIds.shrink_to_fit(); - } - PROCESS_SWITCH(filterDielectronEvent, processRec_TTCA_SWT, "process reconstructed info only", false); // with TTCA - - // ---------- for MC ---------- - - using MyFilteredTracksMC = soa::Filtered; - Partition posTracksMC = o2::aod::track::signed1Pt > 0.f; - Partition negTracksMC = o2::aod::track::signed1Pt < 0.f; - void processMC_SA(soa::Join const& collisions, aod::McCollisions const&, aod::BCsWithTimestamps const&, MyFilteredTracksMC const& tracks) - { - stored_trackIds.reserve(tracks.size()); - - for (auto& collision : collisions) { - if (!collision.has_mcCollision()) { - continue; - } - auto bc = collision.template foundBC_as(); - initCCDB(bc); - - if (!collision.isSelected()) { - filter(0, 0, 0); - continue; - } - - int nee_uls = 0; - auto posTracks_per_coll = posTracksMC->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache); - auto negTracks_per_coll = negTracksMC->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache); - - for (auto& [pos, ele] : combinations(CombinationsFullIndexPolicy(posTracks_per_coll, negTracks_per_coll))) { - if (!checkTrack(collision, pos) || !checkTrack(collision, ele)) { - continue; - } - if (!isElectron(pos) || !isElectron(ele)) { - continue; - } - - ROOT::Math::PtEtaPhiMVector v1(pos.pt(), pos.eta(), pos.phi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v2(ele.pt(), ele.eta(), ele.phi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(pos.px(), pos.py(), pos.pz(), ele.px(), ele.py(), ele.pz(), pos.sign(), ele.sign(), d_bz); - if (fillQAHistogram) { - fRegistry.fill(HIST("Pair/uls/hM"), v12.M()); - fRegistry.fill(HIST("Pair/before/hMvsPt"), v12.M(), v12.Pt()); - fRegistry.fill(HIST("Pair/before/hMvsPhiV"), phiv, v12.M()); - } - if (apply_phiv ? (v12.M() < maxMee && slope * phiv + intercept < v12.M()) : (v12.M() < maxMee)) { - fillTrackTable(collision, pos); - fillTrackTable(collision, ele); - if (fillQAHistogram) { - fRegistry.fill(HIST("Pair/after/hMvsPt"), v12.M(), v12.Pt()); - fRegistry.fill(HIST("Pair/after/hMvsPhiV"), phiv, v12.M()); - } - nee_uls++; - } - - } // end of pairing loop - - if (fillQAHistogram) { - for (auto& [pos1, pos2] : combinations(CombinationsStrictlyUpperIndexPolicy(posTracks_per_coll, posTracks_per_coll))) { - if (!checkTrack(collision, pos1) || !checkTrack(collision, pos2)) { - continue; - } - if (!isElectron(pos1) || !isElectron(pos2)) { - continue; - } - - ROOT::Math::PtEtaPhiMVector v1(pos1.pt(), pos1.eta(), pos1.phi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v2(pos2.pt(), pos2.eta(), pos2.phi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - fRegistry.fill(HIST("Pair/lspp/hM"), v12.M()); - } // end of pairing loop - - for (auto& [ele1, ele2] : combinations(CombinationsStrictlyUpperIndexPolicy(negTracks_per_coll, negTracks_per_coll))) { - if (!checkTrack(collision, ele1) || !checkTrack(collision, ele2)) { - continue; - } - if (!isElectron(ele1) || !isElectron(ele2)) { - continue; - } - - ROOT::Math::PtEtaPhiMVector v1(ele1.pt(), ele1.eta(), ele1.phi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v2(ele2.pt(), ele2.eta(), ele2.phi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - fRegistry.fill(HIST("Pair/lsmm/hM"), v12.M()); - } // end of pairing loop - } - - if (nee_uls < 1) { - filter(nee_uls, 0, 0); - continue; - } - filter(nee_uls, 0, 0); - } // end of collision loop - - stored_trackIds.clear(); - stored_trackIds.shrink_to_fit(); - // stored_pairIds.clear(); - // stored_pairIds.shrink_to_fit(); - } - PROCESS_SWITCH(filterDielectronEvent, processMC_SA, "process reconstructed and MC info ", false); - - void processMC_TTCA(soa::Join const& collisions, aod::McCollisions const&, aod::BCsWithTimestamps const&, MyTracksMC const& tracks, aod::TrackAssoc const& trackIndices) - { - stored_trackIds.reserve(tracks.size() * 2); - - for (auto& collision : collisions) { - if (!collision.has_mcCollision()) { - continue; - } - auto bc = collision.template foundBC_as(); - initCCDB(bc); - - if (!collision.isSelected()) { - filter(0, 0, 0); - continue; - } - - int nee_uls = 0; - auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, collision.globalIndex()); - std::vector posTracks_per_coll; - std::vector negTracks_per_coll; - posTracks_per_coll.reserve(trackIdsThisCollision.size()); - negTracks_per_coll.reserve(trackIdsThisCollision.size()); - - for (auto& trackId : trackIdsThisCollision) { - auto track = trackId.template track_as(); - if (!checkTrack(collision, track) || !isElectron(track)) { - continue; - } - - if (track.sign() > 0) { - posTracks_per_coll.emplace_back(track); - } else { - negTracks_per_coll.emplace_back(track); - } - } // end of track loop - - for (auto& pos : posTracks_per_coll) { - for (auto& ele : negTracks_per_coll) { - auto pos_prop = propagateTrack(collision, pos); - auto ele_prop = propagateTrack(collision, ele); - std::array pVec_pos = {0, 0, 0}; // px, py, pz - getPxPyPz(pos_prop, pVec_pos); - std::array pVec_ele = {0, 0, 0}; // px, py, pz - getPxPyPz(ele_prop, pVec_ele); - - ROOT::Math::PtEtaPhiMVector v1(pos_prop.getPt(), pos_prop.getEta(), pos_prop.getPhi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v2(ele_prop.getPt(), ele_prop.getEta(), ele_prop.getPhi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(pVec_pos[0], pVec_pos[1], pVec_pos[2], pVec_ele[0], pVec_ele[1], pVec_ele[2], pos.sign(), ele.sign(), d_bz); - if (fillQAHistogram) { - fRegistry.fill(HIST("Pair/uls/hM"), v12.M()); - fRegistry.fill(HIST("Pair/before/hMvsPt"), v12.M(), v12.Pt()); - fRegistry.fill(HIST("Pair/before/hMvsPhiV"), phiv, v12.M()); - } - if (apply_phiv ? (v12.M() < maxMee && slope * phiv + intercept < v12.M()) : (v12.M() < maxMee)) { - fillTrackTable(collision, pos); - fillTrackTable(collision, ele); - if (fillQAHistogram) { - fRegistry.fill(HIST("Pair/after/hMvsPt"), v12.M(), v12.Pt()); - fRegistry.fill(HIST("Pair/after/hMvsPhiV"), phiv, v12.M()); - } - nee_uls++; - } - - } // end of negative track loop - } // end of postive track loop - - if (fillQAHistogram) { - for (auto& pos1 : posTracks_per_coll) { - for (auto& pos2 : posTracks_per_coll) { - if (pos1.globalIndex() == pos2.globalIndex()) { - continue; - } - - auto pos1_prop = propagateTrack(collision, pos1); - auto pos2_prop = propagateTrack(collision, pos2); - - std::array pVec_pos1 = {0, 0, 0}; // px, py, pz - getPxPyPz(pos1_prop, pVec_pos1); - std::array pVec_pos2 = {0, 0, 0}; // px, py, pz - getPxPyPz(pos2_prop, pVec_pos2); - - ROOT::Math::PtEtaPhiMVector v1(pos1_prop.getPt(), pos1_prop.getEta(), pos1_prop.getPhi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v2(pos2_prop.getPt(), pos2_prop.getEta(), pos2_prop.getPhi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - fRegistry.fill(HIST("Pair/lspp/hM"), v12.M()); - } // end of positive track loop - } // end of postive track loop - - for (auto& ele1 : negTracks_per_coll) { - for (auto& ele2 : negTracks_per_coll) { - if (ele1.globalIndex() == ele2.globalIndex()) { - continue; - } - - auto ele1_prop = propagateTrack(collision, ele1); - auto ele2_prop = propagateTrack(collision, ele2); - - std::array pVec_ele1 = {0, 0, 0}; // px, py, pz - getPxPyPz(ele1_prop, pVec_ele1); - std::array pVec_ele2 = {0, 0, 0}; // px, py, pz - getPxPyPz(ele2_prop, pVec_ele2); - - ROOT::Math::PtEtaPhiMVector v1(ele1_prop.getPt(), ele1_prop.getEta(), ele1_prop.getPhi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v2(ele2_prop.getPt(), ele2_prop.getEta(), ele2_prop.getPhi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - fRegistry.fill(HIST("Pair/lsmm/hM"), v12.M()); - } // end of negative track loop - } // end of negative track loop - } - - if (nee_uls < 1) { - filter(nee_uls, 0, 0); - continue; - } - filter(nee_uls, 0, 0); - - posTracks_per_coll.clear(); - negTracks_per_coll.clear(); - posTracks_per_coll.shrink_to_fit(); - negTracks_per_coll.shrink_to_fit(); - - } // end of collision loop - - stored_trackIds.clear(); - stored_trackIds.shrink_to_fit(); - // stored_pairIds.clear(); - // stored_pairIds.shrink_to_fit(); - } - PROCESS_SWITCH(filterDielectronEvent, processMC_TTCA, "process reconstructed info only", false); // with TTCA -}; -struct prefilterPrimaryElectron { - using MyCollisions = soa::Join; - using MyCollisionsWithSWT = soa::Join; - - Produces ele_pfb; - - SliceCache cache; - Preslice perCol_track = o2::aod::track::collisionId; - PresliceUnsorted perCol_ele = o2::aod::emprimaryelectron::collisionId; - - // CCDB options - Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Configurable grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"}; - Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; - Configurable skipGRPOquery{"skipGRPOquery", true, "skip grpo query"}; - - // Operation and minimisation criteria - Configurable d_bz_input{"d_bz", -999, "bz field, -999 is automatic"}; - - Configurable max_dcaxy{"max_dcaxy", 0.3, "DCAxy To PV for loose track sample"}; - Configurable max_dcaz{"max_dcaz", 0.3, "DCAz To PV for loose track sample"}; - Configurable minpt{"minpt", 0.1, "min pt for track for loose track sample"}; - Configurable maxeta{"maxeta", 0.9, "eta acceptance for loose track sample"}; - Configurable min_ncluster_tpc{"min_ncluster_tpc", 0, "min ncluster tpc"}; - Configurable mincrossedrows{"mincrossedrows", 70, "min crossed rows"}; - Configurable max_frac_shared_clusters_tpc{"max_frac_shared_clusters_tpc", 999.f, "max fraction of shared clusters in TPC"}; - Configurable min_tpc_cr_findable_ratio{"min_tpc_cr_findable_ratio", 0.8, "min. TPC Ncr/Nf ratio"}; - Configurable maxchi2tpc{"maxchi2tpc", 5.0, "max chi2/NclsTPC"}; - Configurable maxchi2its{"maxchi2its", 6.0, "max chi2/NclsITS"}; - Configurable min_ncluster_its{"min_ncluster_its", 4, "min ncluster its"}; - Configurable min_ncluster_itsib{"min_ncluster_itsib", 1, "min ncluster itsib"}; - Configurable minTPCNsigmaEl{"minTPCNsigmaEl", -3.0, "min. TPC n sigma for electron inclusion"}; - Configurable maxTPCNsigmaEl{"maxTPCNsigmaEl", 3.0, "max. TPC n sigma for electron inclusion"}; - Configurable slope{"slope", 0.0185, "slope for m vs. phiv"}; - Configurable intercept{"intercept", -0.0280, "intercept for m vs. phiv"}; - - Configurable> max_mee_vec{"max_mee_vec", std::vector{0.08, 0.10, 0.12}, "vector fo max mee for prefilter in ULS. Please sort this by increasing order."}; // currently, 3 thoresholds are allowed. - - HistogramRegistry fRegistry{"output", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; - - int mRunNumber; - float d_bz; - Service ccdb; - o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE; - - void init(InitContext&) - { - mRunNumber = 0; - d_bz = 0; - - ccdb->setURL(ccdburl); - ccdb->setCaching(true); - ccdb->setLocalObjectValidityChecking(); - ccdb->setFatalWhenNull(false); - - if (!doprocessDummy) { - addHistograms(); - } - } - - void addHistograms() - { - fRegistry.add("Track/hPt", "pT;p_{T} (GeV/c)", kTH1F, {{1000, 0.0f, 10}}, false); - fRegistry.add("Track/hEtaPhi", "#eta vs. #varphi;#varphi (rad.);#eta", kTH2F, {{180, 0, 2 * M_PI}, {40, -1.0f, 1.0f}}, false); - fRegistry.add("Track/hTPCNsigmaEl", "loose track TPC PID", kTH2F, {{1000, 0.f, 10}, {100, -5, +5}}); - fRegistry.add("Pair/before/uls/hMvsPt", "mass vs. pT;m_{ee} (GeV/c^{2});p_{T,ee} (GeV/c)", kTH2F, {{400, 0, 4}, {100, 0, 10}}); - fRegistry.add("Pair/before/uls/hMvsPhiV", "mass vs. phiv;#varphi_{V} (rad.);m_{ee} (GeV/c^{2})", kTH2F, {{90, 0.f, M_PI}, {100, 0, 1.f}}); - fRegistry.addClone("Pair/before/uls/", "Pair/before/lspp/"); - fRegistry.addClone("Pair/before/uls/", "Pair/before/lsmm/"); - fRegistry.addClone("Pair/before/", "Pair/after/"); - } - - void initCCDB(aod::BCsWithTimestamps::iterator const& bc) - { - if (mRunNumber == bc.runNumber()) { - return; - } - - // In case override, don't proceed, please - no CCDB access required - if (d_bz_input > -990) { - d_bz = d_bz_input; - o2::parameters::GRPMagField grpmag; - if (std::fabs(d_bz) > 1e-5) { - grpmag.setL3Current(30000.f / (d_bz / 5.0f)); - } - o2::base::Propagator::initFieldFromGRP(&grpmag); - mRunNumber = bc.runNumber(); - return; - } - - auto run3grp_timestamp = bc.timestamp(); - o2::parameters::GRPObject* grpo = 0x0; - o2::parameters::GRPMagField* grpmag = 0x0; - if (!skipGRPOquery) - grpo = ccdb->getForTimeStamp(grpPath, run3grp_timestamp); - if (grpo) { - o2::base::Propagator::initFieldFromGRP(grpo); - // Fetch magnetic field from ccdb for current collision - d_bz = grpo->getNominalL3Field(); - LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; - } else { - grpmag = ccdb->getForTimeStamp(grpmagPath, run3grp_timestamp); - if (!grpmag) { - LOG(fatal) << "Got nullptr from CCDB for path " << grpmagPath << " of object GRPMagField and " << grpPath << " of object GRPObject for timestamp " << run3grp_timestamp; - } - o2::base::Propagator::initFieldFromGRP(grpmag); - // Fetch magnetic field from ccdb for current collision - d_bz = std::lround(5.f * grpmag->getL3Current() / 30000.f); - LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; - } - mRunNumber = bc.runNumber(); - } - - o2::base::Propagator::MatCorrType noMatCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE; - - template - bool checkTrack(TCollision const& collision, TTrack const& track) - { - if (!track.hasITS()) { - return false; - } - if (track.itsChi2NCl() > maxchi2its) { - return false; - } - if (track.itsNCls() < min_ncluster_its) { - return false; - } - if (track.itsNClsInnerBarrel() < min_ncluster_itsib) { - return false; - } - - if (!track.hasTPC()) { - return false; - } - if (track.tpcNSigmaEl() < minTPCNsigmaEl || maxTPCNsigmaEl < track.tpcNSigmaEl()) { - return false; - } - if (track.tpcNClsFound() < min_ncluster_tpc) { - return false; - } - if (track.tpcNClsCrossedRows() < mincrossedrows) { - return false; - } - if (track.tpcCrossedRowsOverFindableCls() < min_tpc_cr_findable_ratio) { - return false; - } - if (track.tpcFractionSharedCls() > max_frac_shared_clusters_tpc) { - return false; - } - if (track.tpcChi2NCl() > maxchi2its) { - return false; - } - - std::array dcaInfo; - auto track_par_cov_recalc = getTrackParCov(track); - // std::array pVec_recalc = {0, 0, 0}; // px, py, pz - o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, track_par_cov_recalc, 2.f, matCorr, &dcaInfo); - // getPxPyPz(track_par_cov_recalc, pVec_recalc); - - if (std::fabs(dcaInfo[0]) > max_dcaxy || std::fabs(dcaInfo[1]) > max_dcaz) { - return false; - } - - if (track_par_cov_recalc.getPt() < minpt || std::fabs(track_par_cov_recalc.getEta()) > maxeta) { - return false; - } - - return true; - } - - Preslice trackIndicesPerCollision = aod::track_association::collisionId; - - Filter trackFilter = o2::aod::track::pt > minpt&& nabs(o2::aod::track::eta) < maxeta&& ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::ITS) == true && ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::TPC) == true; - using MyFilteredTracks = soa::Filtered; - Partition posTracks = o2::aod::track::signed1Pt > 0.f; - Partition negTracks = o2::aod::track::signed1Pt < 0.f; - - Partition positrons = o2::aod::emprimaryelectron::sign > int8_t(0); - Partition electrons = o2::aod::emprimaryelectron::sign < int8_t(0); - void processSA(MyCollisions const& collisions, aod::BCsWithTimestamps const&, MyFilteredTracks const&, aod::EMPrimaryElectrons const& primaryelectrons) - { - std::unordered_map pfb_map; // map track.globalIndex -> prefilter bit - - for (auto& collision : collisions) { - auto bc = collision.template foundBC_as(); - initCCDB(bc); - if (!collision.isSelected()) { - continue; - } - - auto posTracks_per_coll = posTracks->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache); // loose track sample - auto negTracks_per_coll = negTracks->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache); // loose track sample - - auto positrons_per_coll = positrons->sliceByCachedUnsorted(o2::aod::emprimaryelectron::collisionId, collision.globalIndex(), cache); // signal sample - auto electrons_per_coll = electrons->sliceByCachedUnsorted(o2::aod::emprimaryelectron::collisionId, collision.globalIndex(), cache); // signal sample - - for (auto& pos : posTracks_per_coll) { - if (!checkTrack(collision, pos)) { // track cut is applied to loose sample - continue; - } - fRegistry.fill(HIST("Track/hPt"), pos.pt()); - fRegistry.fill(HIST("Track/hEtaPhi"), pos.phi(), pos.eta()); - } - for (auto& neg : negTracks_per_coll) { - if (!checkTrack(collision, neg)) { // track cut is applied to loose sample - continue; - } - fRegistry.fill(HIST("Track/hPt"), neg.pt()); - fRegistry.fill(HIST("Track/hEtaPhi"), neg.phi(), neg.eta()); - } - - for (auto& [ele, empos] : combinations(CombinationsFullIndexPolicy(negTracks_per_coll, positrons_per_coll))) { - // auto pos = tracks.rawIteratorAt(empos.trackId()); // use rawIterator, if the table is filtered. - if (!checkTrack(collision, ele)) { // track cut is applied to loose sample - continue; - } - if (empos.trackId() == ele.globalIndex()) { - continue; - } - - ROOT::Math::PtEtaPhiMVector v1(ele.pt(), ele.eta(), ele.phi(), o2::constants::physics::MassElectron); // loose track - ROOT::Math::PtEtaPhiMVector v2(empos.pt(), empos.eta(), empos.phi(), o2::constants::physics::MassElectron); // signal track - ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(empos.px(), empos.py(), empos.pz(), ele.px(), ele.py(), ele.pz(), empos.sign(), ele.sign(), d_bz); - fRegistry.fill(HIST("Pair/before/uls/hMvsPhiV"), phiv, v12.M()); - fRegistry.fill(HIST("Pair/before/uls/hMvsPt"), v12.M(), v12.Pt()); - if (v12.M() < max_mee_vec->at(static_cast(max_mee_vec->size()) - 1)) { - fRegistry.fill(HIST("Track/hTPCNsigmaEl"), ele.tpcInnerParam(), ele.tpcNSigmaEl()); - } - for (int i = 0; i < static_cast(max_mee_vec->size()); i++) { - if (v12.M() < max_mee_vec->at(i)) { - pfb_map[empos.globalIndex()] |= (uint8_t(1) << (static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_1) + i)); - } - } - - if (v12.M() < slope * phiv + intercept) { - pfb_map[empos.globalIndex()] |= (uint8_t(1) << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPC)); - } - - } // end of ULS pairing - - for (auto& [pos, emele] : combinations(CombinationsFullIndexPolicy(posTracks_per_coll, electrons_per_coll))) { - // auto ele = tracks.rawIteratorAt(emele.trackId()); // use rawIterator, if the table is filtered. - if (!checkTrack(collision, pos)) { // track cut is applied to loose sample - continue; - } - if (emele.trackId() == pos.globalIndex()) { - continue; - } - - ROOT::Math::PtEtaPhiMVector v1(emele.pt(), emele.eta(), emele.phi(), o2::constants::physics::MassElectron); // signal track - ROOT::Math::PtEtaPhiMVector v2(pos.pt(), pos.eta(), pos.phi(), o2::constants::physics::MassElectron); // loose track - ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(pos.px(), pos.py(), pos.pz(), emele.px(), emele.py(), emele.pz(), pos.sign(), emele.sign(), d_bz); - fRegistry.fill(HIST("Pair/before/uls/hMvsPhiV"), phiv, v12.M()); - fRegistry.fill(HIST("Pair/before/uls/hMvsPt"), v12.M(), v12.Pt()); - if (v12.M() < max_mee_vec->at(static_cast(max_mee_vec->size()) - 1)) { - fRegistry.fill(HIST("Track/hTPCNsigmaEl"), pos.tpcInnerParam(), pos.tpcNSigmaEl()); - } - for (int i = 0; i < static_cast(max_mee_vec->size()); i++) { - if (v12.M() < max_mee_vec->at(i)) { - pfb_map[emele.globalIndex()] |= (uint8_t(1) << (static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPi0_1) + i)); - } - } - - if (v12.M() < slope * phiv + intercept) { - pfb_map[emele.globalIndex()] |= (uint8_t(1) << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBit::kElFromPC)); - } - - } // end of ULS pairing - - for (auto& [pos, empos] : combinations(CombinationsFullIndexPolicy(posTracks_per_coll, positrons_per_coll))) { - // auto pos = tracks.rawIteratorAt(empos.trackId()); // use rawIterator, if the table is filtered. - if (!checkTrack(collision, pos)) { // track cut is applied to loose sample - continue; - } - if (empos.trackId() == pos.globalIndex()) { - continue; - } - - ROOT::Math::PtEtaPhiMVector v1(pos.pt(), pos.eta(), pos.phi(), o2::constants::physics::MassElectron); // loose track - ROOT::Math::PtEtaPhiMVector v2(empos.pt(), empos.eta(), empos.phi(), o2::constants::physics::MassElectron); // signal track - ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(empos.px(), empos.py(), empos.pz(), pos.px(), pos.py(), pos.pz(), empos.sign(), pos.sign(), d_bz); - fRegistry.fill(HIST("Pair/before/lspp/hMvsPhiV"), phiv, v12.M()); - fRegistry.fill(HIST("Pair/before/lspp/hMvsPt"), v12.M(), v12.Pt()); - } // end of LS++ pairing - - for (auto& [ele, emele] : combinations(CombinationsFullIndexPolicy(negTracks_per_coll, electrons_per_coll))) { - // auto ele = tracks.rawIteratorAt(emele.trackId()); // use rawIterator, if the table is filtered. - if (!checkTrack(collision, ele)) { // track cut is applied to loose sample - continue; - } - if (emele.trackId() == ele.globalIndex()) { - continue; - } - - ROOT::Math::PtEtaPhiMVector v1(ele.pt(), ele.eta(), ele.phi(), o2::constants::physics::MassElectron); // loose track - ROOT::Math::PtEtaPhiMVector v2(emele.pt(), emele.eta(), emele.phi(), o2::constants::physics::MassElectron); // signal track - ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(emele.px(), emele.py(), emele.pz(), ele.px(), ele.py(), ele.pz(), emele.sign(), ele.sign(), d_bz); - fRegistry.fill(HIST("Pair/before/lsmm/hMvsPhiV"), phiv, v12.M()); - fRegistry.fill(HIST("Pair/before/lsmm/hMvsPt"), v12.M(), v12.Pt()); - } // end of LS-- pairing - - } // end of collision loop - - for (auto& ele : primaryelectrons) { - ele_pfb(pfb_map[ele.globalIndex()]); - } - - // check prefilter - for (auto& collision : collisions) { - auto positrons_per_coll = positrons->sliceByCachedUnsorted(o2::aod::emprimaryelectron::collisionId, collision.globalIndex(), cache); // signal sample - auto electrons_per_coll = electrons->sliceByCachedUnsorted(o2::aod::emprimaryelectron::collisionId, collision.globalIndex(), cache); // signal sample - - for (auto& [ele, pos] : combinations(CombinationsFullIndexPolicy(electrons_per_coll, positrons_per_coll))) { - if (pfb_map[ele.globalIndex()] != 0 || pfb_map[pos.globalIndex()] != 0) { - continue; - } - - ROOT::Math::PtEtaPhiMVector v1(ele.pt(), ele.eta(), ele.phi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v2(pos.pt(), pos.eta(), pos.phi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(pos.px(), pos.py(), pos.pz(), ele.px(), ele.py(), ele.pz(), pos.sign(), ele.sign(), d_bz); - fRegistry.fill(HIST("Pair/after/uls/hMvsPhiV"), phiv, v12.M()); - fRegistry.fill(HIST("Pair/after/uls/hMvsPt"), v12.M(), v12.Pt()); - } // end of ULS pairing - } // end of collision loop - - pfb_map.clear(); - } - PROCESS_SWITCH(prefilterPrimaryElectron, processSA, "process SA", false); - - void processDummy(aod::EMPrimaryElectrons const& primaryelectrons) - { - for (int i = 0; i < primaryelectrons.size(); i++) { - ele_pfb(0); - } - } - PROCESS_SWITCH(prefilterPrimaryElectron, processDummy, "processDummy", true); -}; -struct associateAmbiguousElectron { - Produces em_amb_ele_ids; - - SliceCache cache; - PresliceUnsorted perTrack = o2::aod::emprimaryelectron::trackId; - std::vector ambele_self_Ids; - - void process(aod::EMPrimaryElectrons const& electrons) - { - for (auto& electron : electrons) { - auto electrons_with_same_trackId = electrons.sliceBy(perTrack, electron.trackId()); - ambele_self_Ids.reserve(electrons_with_same_trackId.size()); - for (auto& amb_ele : electrons_with_same_trackId) { - if (amb_ele.globalIndex() == electron.globalIndex()) { // don't store myself. - continue; - } - ambele_self_Ids.emplace_back(amb_ele.globalIndex()); - } - em_amb_ele_ids(ambele_self_Ids); - ambele_self_Ids.clear(); - ambele_self_Ids.shrink_to_fit(); - } - } -}; -struct createEMEvent2VP { - using MyBCs = soa::Join; - using MyQvectors = soa::Join; - - using MyCollisions = soa::Join; - using MyCollisions_Cent = soa::Join; // centrality table has dependency on multiplicity table. - using MyCollisions_Cent_Qvec = soa::Join; - - using MyCollisionsWithSWT = soa::Join; - using MyCollisionsWithSWT_Cent = soa::Join; // centrality table has dependency on multiplicity table. - using MyCollisionsWithSWT_Cent_Qvec = soa::Join; - - using MyCollisionsMC = soa::Join; - using MyCollisionsMC_Cent = soa::Join; // centrality table has dependency on multiplicity table. - using MyCollisionsMC_Cent_Qvec = soa::Join; - - Produces event; - // Produces eventcov; - Produces event_mult; - Produces event_cent; - Produces event_qvec; - Produces emswtbit; - - enum class EMEventType : int { - kEvent = 0, - kEvent_Cent = 1, - kEvent_Cent_Qvec = 2, - }; - - HistogramRegistry registry{"registry"}; - void init(o2::framework::InitContext&) - { - auto hEventCounter = registry.add("hEventCounter", "hEventCounter", kTH1I, {{7, 0.5f, 7.5f}}); - hEventCounter->GetXaxis()->SetBinLabel(1, "all"); - hEventCounter->GetXaxis()->SetBinLabel(2, "sel8"); - - registry.add("hNInspectedTVX", "N inspected TVX;run number;N_{TVX}", kTProfile, {{80000, 520000.5, 600000.5}}, true); - } - - ~createEMEvent2VP() - { - swt_names.clear(); - swt_names.shrink_to_fit(); - } - - std::vector mTOIidx; - std::vector swt_names; - uint64_t mNinspectedTVX{0}; - - int mRunNumber; - - template - void skimEvent(TCollisions const& collisions, TBCs const&) - { - for (auto& collision : collisions) { - if constexpr (isMC) { - if (!collision.has_mcCollision()) { - continue; - } - } - - if constexpr (isTriggerAnalysis) { - if (collision.swtaliastmp_raw() == 0) { - continue; - } - } - - auto bc = collision.template foundBC_as(); - - if (!collision.isSelected()) { - continue; - } - - if (!(collision.neeuls() >= 1 || collision.neeuls() + collision.ngpcm() >= 2)) { - continue; - } - - if constexpr (isTriggerAnalysis) { - emswtbit(collision.swtaliastmp_raw(), collision.nInspectedTVX()); - } - - // LOGF(info, "collision.neeuls() = %d, collision.ngpcm() = %d", collision.neeuls(), collision.ngpcm()); - // LOGF(info, "collision.multNTracksPV() = %d, collision.multFT0A() = %f, collision.multFT0C() = %f", collision.multNTracksPV(), collision.multFT0A(), collision.multFT0C()); - - registry.fill(HIST("hEventCounter"), 1); - - event(collision.globalIndex(), bc.runNumber(), bc.globalBC(), collision.alias_raw(), collision.selection_raw(), collision.rct_raw(), bc.timestamp(), - collision.posX(), collision.posY(), collision.posZ(), - collision.numContrib(), collision.trackOccupancyInTimeRange(), collision.ft0cOccupancyInTimeRange()); - - // eventcov(collision.covXX(), collision.covXY(), collision.covXZ(), collision.covYY(), collision.covYZ(), collision.covZZ(), collision.chi2()); - - event_mult(collision.multFT0A(), collision.multFT0C(), collision.multNTracksPV(), collision.multNTracksPVeta1(), collision.multNTracksPVetaHalf()); - - if constexpr (eventype == EMEventType::kEvent) { - event_cent(105.f, 105.f, 105.f); - event_qvec( - 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, - 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f); - } else if constexpr (eventype == EMEventType::kEvent_Cent) { - event_cent(collision.centFT0M(), collision.centFT0A(), collision.centFT0C()); - event_qvec( - 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, - 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f); - } else if constexpr (eventype == EMEventType::kEvent_Cent_Qvec) { - event_cent(collision.centFT0M(), collision.centFT0A(), collision.centFT0C()); - float q2xft0m = 999.f, q2yft0m = 999.f, q2xft0a = 999.f, q2yft0a = 999.f, q2xft0c = 999.f, q2yft0c = 999.f, q2xbpos = 999.f, q2ybpos = 999.f, q2xbneg = 999.f, q2ybneg = 999.f, q2xbtot = 999.f, q2ybtot = 999.f; - float q3xft0m = 999.f, q3yft0m = 999.f, q3xft0a = 999.f, q3yft0a = 999.f, q3xft0c = 999.f, q3yft0c = 999.f, q3xbpos = 999.f, q3ybpos = 999.f, q3xbneg = 999.f, q3ybneg = 999.f, q3xbtot = 999.f, q3ybtot = 999.f; - - if (collision.qvecFT0CReVec().size() >= 2) { // harmonics 2,3 - q2xft0m = collision.qvecFT0MReVec()[0], q2xft0a = collision.qvecFT0AReVec()[0], q2xft0c = collision.qvecFT0CReVec()[0], q2xbpos = collision.qvecBPosReVec()[0], q2xbneg = collision.qvecBNegReVec()[0], q2xbtot = collision.qvecBTotReVec()[0]; - q2yft0m = collision.qvecFT0MImVec()[0], q2yft0a = collision.qvecFT0AImVec()[0], q2yft0c = collision.qvecFT0CImVec()[0], q2ybpos = collision.qvecBPosImVec()[0], q2ybneg = collision.qvecBNegImVec()[0], q2ybtot = collision.qvecBTotImVec()[0]; - q3xft0m = collision.qvecFT0MReVec()[1], q3xft0a = collision.qvecFT0AReVec()[1], q3xft0c = collision.qvecFT0CReVec()[1], q3xbpos = collision.qvecBPosReVec()[1], q3xbneg = collision.qvecBNegReVec()[1], q3xbtot = collision.qvecBTotReVec()[1]; - q3yft0m = collision.qvecFT0MImVec()[1], q3yft0a = collision.qvecFT0AImVec()[1], q3yft0c = collision.qvecFT0CImVec()[1], q3ybpos = collision.qvecBPosImVec()[1], q3ybneg = collision.qvecBNegImVec()[1], q3ybtot = collision.qvecBTotImVec()[1]; - } else if (collision.qvecFT0CReVec().size() >= 1) { // harmonics 2 - q2xft0m = collision.qvecFT0MReVec()[0], q2xft0a = collision.qvecFT0AReVec()[0], q2xft0c = collision.qvecFT0CReVec()[0], q2xbpos = collision.qvecBPosReVec()[0], q2xbneg = collision.qvecBNegReVec()[0], q2xbtot = collision.qvecBTotReVec()[0]; - q2yft0m = collision.qvecFT0MImVec()[0], q2yft0a = collision.qvecFT0AImVec()[0], q2yft0c = collision.qvecFT0CImVec()[0], q2ybpos = collision.qvecBPosImVec()[0], q2ybneg = collision.qvecBNegImVec()[0], q2ybtot = collision.qvecBTotImVec()[0]; - } - event_qvec( - q2xft0m, q2yft0m, q2xft0a, q2yft0a, q2xft0c, q2yft0c, q2xbpos, q2ybpos, q2xbneg, q2ybneg, q2xbtot, q2ybtot, - q3xft0m, q3yft0m, q3xft0a, q3yft0a, q3xft0c, q3yft0c, q3xbpos, q3ybpos, q3xbneg, q3ybneg, q3xbtot, q3ybtot); - } else { - event_cent(105.f, 105.f, 105.f); - event_qvec( - 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, - 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f); - } - } // end of collision loop - } // end of skimEvent - - void processEvent(MyCollisions const& collisions, MyBCs const& bcs) - { - skimEvent(collisions, bcs); - } - PROCESS_SWITCH(createEMEvent2VP, processEvent, "process event info", false); - - void processEvent_Cent(MyCollisions_Cent const& collisions, MyBCs const& bcs) - { - skimEvent(collisions, bcs); - } - PROCESS_SWITCH(createEMEvent2VP, processEvent_Cent, "process event info", false); - - void processEvent_Cent_Qvec(MyCollisions_Cent_Qvec const& collisions, MyBCs const& bcs) - { - skimEvent(collisions, bcs); - } - PROCESS_SWITCH(createEMEvent2VP, processEvent_Cent_Qvec, "process event info", false); - - void processEvent_SWT(MyCollisionsWithSWT const& collisions, MyBCs const& bcs) - { - skimEvent(collisions, bcs); - } - PROCESS_SWITCH(createEMEvent2VP, processEvent_SWT, "process event info", false); - - void processEvent_SWT_Cent(MyCollisionsWithSWT_Cent const& collisions, MyBCs const& bcs) - { - skimEvent(collisions, bcs); - } - PROCESS_SWITCH(createEMEvent2VP, processEvent_SWT_Cent, "process event info", false); - - void processEvent_SWT_Cent_Qvec(MyCollisionsWithSWT_Cent_Qvec const& collisions, MyBCs const& bcs) - { - skimEvent(collisions, bcs); - } - PROCESS_SWITCH(createEMEvent2VP, processEvent_SWT_Cent_Qvec, "process event info", false); - - void processEventMC(MyCollisionsMC const& collisions, MyBCs const& bcs) - { - skimEvent(collisions, bcs); - } - PROCESS_SWITCH(createEMEvent2VP, processEventMC, "process event info", false); - - void processEventMC_Cent(MyCollisionsMC_Cent const& collisions, MyBCs const& bcs) - { - skimEvent(collisions, bcs); - } - PROCESS_SWITCH(createEMEvent2VP, processEventMC_Cent, "process event info", false); - - void processEventMC_Cent_Qvec(MyCollisionsMC_Cent_Qvec const& collisions, MyBCs const& bcs) - { - skimEvent(collisions, bcs); - } - PROCESS_SWITCH(createEMEvent2VP, processEventMC_Cent_Qvec, "process event info", false); - - void processDummy(aod::Collisions const&) {} - PROCESS_SWITCH(createEMEvent2VP, processDummy, "processDummy", true); -}; -struct AssociateDileptonToEMEvent2VP { - Produces v0kfeventid; - Produces prmeleventid; - - Preslice perCollision_pcm = aod::v0photonkf::collisionId; - PresliceUnsorted perCollision_el = aod::emprimaryelectron::collisionId; - - void init(o2::framework::InitContext&) {} - - template - void fillEventId(TCollisions const& collisions, TLeptons const& leptons, TEventIds& eventIds, TPreslice const& perCollision) - { - for (auto& collision : collisions) { - auto leptons_coll = leptons.sliceBy(perCollision, collision.collisionId()); - int nl = leptons_coll.size(); - // LOGF(info, "collision.collisionId() = %d , nl = %d", collision.collisionId(), nl); - for (int il = 0; il < nl; il++) { - eventIds(collision.globalIndex()); - } // end of photon loop - } // end of collision loop - } - - // This struct is for both data and MC. - // Note that reconstructed collisions without mc collisions are already rejected in CreateEMEventDilepton in MC. - - void processPCM(aod::EMEvents const& collisions, aod::V0PhotonsKF const& photons) - { - fillEventId(collisions, photons, v0kfeventid, perCollision_pcm); - } - - void processElectron(aod::EMEvents const& collisions, aod::EMPrimaryElectrons const& tracks) - { - fillEventId(collisions, tracks, prmeleventid, perCollision_el); - } - - void processDummy(aod::EMEvents const&) {} - - PROCESS_SWITCH(AssociateDileptonToEMEvent2VP, processPCM, "process pcm-event indexing", false); - PROCESS_SWITCH(AssociateDileptonToEMEvent2VP, processElectron, "process dalitzee-event indexing", false); - PROCESS_SWITCH(AssociateDileptonToEMEvent2VP, processDummy, "process dummy", true); -}; -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - return WorkflowSpec{ - adaptAnalysisTask(cfgc, TaskName{"filter-dielectron-event"}), - adaptAnalysisTask(cfgc, TaskName{"prefilter-primary-electron"}), - adaptAnalysisTask(cfgc, TaskName{"associate-ambiguous-electron"}), - adaptAnalysisTask(cfgc, TaskName{"create-emevent-2vp"}), - adaptAnalysisTask(cfgc, TaskName{"associate-dilepton-to-emevent2VP"}), - }; -} diff --git a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx index b4b9db26de5..2d5c6f5e76d 100644 --- a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx +++ b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx @@ -63,6 +63,8 @@ struct skimmerPrimaryElectron { Produces emprimaryelectrons; Produces emprimaryelectronscov; + // Produces emprimaryelectrons004; + // Configurables Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"}; @@ -282,7 +284,7 @@ struct skimmerPrimaryElectron { return false; } - if (track.itsChi2NCl() > maxchi2its) { + if (track.itsChi2NCl() < 0.f || maxchi2its < track.itsChi2NCl()) { return false; } if (track.itsNCls() < min_ncluster_its) { @@ -297,7 +299,7 @@ struct skimmerPrimaryElectron { } if (track.hasTPC()) { - if (track.tpcChi2NCl() > maxchi2tpc) { + if (track.tpcChi2NCl() < 0.f || maxchi2tpc < track.tpcChi2NCl()) { return false; } @@ -328,8 +330,6 @@ struct skimmerPrimaryElectron { float dcaXY = mDcaInfoCov.getY(); float dcaZ = mDcaInfoCov.getZ(); - // LOGF(info, "trackParCov.getSigmaY2() = %.16f, mDcaInfoCov.getSigmaY2() = %.16f, trackParCov.getSigmaZ2() = %.16f, mDcaInfoCov.getSigmaZ2() = %.16f, trackParCov.getSigmaZY() = %.16f, mDcaInfoCov.getSigmaYZ() = %.16f", trackParCov.getSigmaY2(), mDcaInfoCov.getSigmaY2(), trackParCov.getSigmaZ2(), mDcaInfoCov.getSigmaZ2(), trackParCov.getSigmaZY(), mDcaInfoCov.getSigmaYZ()); - if (std::fabs(dcaXY) > dca_xy_max || std::fabs(dcaZ) > dca_z_max) { return false; } @@ -369,6 +369,43 @@ struct skimmerPrimaryElectron { } } + // these are necessary cuts for converting float into int16_t. + if (track.hasTPC()) { + if (std::fabs(track.tpcNSigmaEl()) > 300.f) { + return false; + } + if (std::fabs(track.tpcNSigmaPi()) > 300.f) { + return false; + } + if (std::fabs(track.tpcNSigmaKa()) > 300.f) { + return false; + } + if (std::fabs(track.tpcNSigmaPr()) > 300.f) { + return false; + } + if (track.tpcSignal() > 600.f) { + return false; + } + if constexpr (isMC) { + if (track.mcTunedTPCSignal() > 600.f) { + return false; + } + } + } + if (track.hasTOF()) { + if (std::fabs(track.tofNSigmaEl()) > 300.f) { + return false; + } + if (std::fabs(track.tofNSigmaPi()) > 300.f) { + return false; + } + if (std::fabs(track.tofNSigmaKa()) > 300.f) { + return false; + } + if (std::fabs(track.tofNSigmaPr()) > 300.f) { + return false; + } + } return true; } @@ -454,26 +491,50 @@ struct skimmerPrimaryElectron { o2::math_utils::bringTo02Pi(phi_recalc); bool isAssociatedToMPC = collision.globalIndex() == track.collisionId(); - float tpcSignalMC = -1; + float mcTunedTPCSignal = 0.f; if constexpr (isMC) { - tpcSignalMC = track.mcTunedTPCSignal(); + if (track.hasTPC()) { + mcTunedTPCSignal = track.mcTunedTPCSignal(); + } } + float itsChi2NCl = (track.hasITS() && track.itsChi2NCl() > 0.f) ? track.itsChi2NCl() : -299.f; + float tpcChi2NCl = (track.hasTPC() && track.tpcChi2NCl() > 0.f) ? track.tpcChi2NCl() : -299.f; + float beta = track.hasTOF() ? track.beta() : -29.f; + float tofNSigmaEl = track.hasTOF() ? track.tofNSigmaEl() : -299.f; + float tofNSigmaPi = track.hasTOF() ? track.tofNSigmaPi() : -299.f; + float tofNSigmaKa = track.hasTOF() ? track.tofNSigmaKa() : -299.f; + float tofNSigmaPr = track.hasTOF() ? track.tofNSigmaPr() : -299.f; + float tofChi2 = track.hasTOF() ? track.tofChi2() : -299.f; + + float tpcSignal = track.hasTPC() ? track.tpcSignal() : 0.f; + float tpcNSigmaEl = track.hasTPC() ? track.tpcNSigmaEl() : -299.f; + float tpcNSigmaPi = track.hasTPC() ? track.tpcNSigmaPi() : -299.f; + float tpcNSigmaKa = track.hasTPC() ? track.tpcNSigmaKa() : -299.f; + float tpcNSigmaPr = track.hasTPC() ? track.tpcNSigmaPr() : -299.f; + emprimaryelectrons(collision.globalIndex(), track.globalIndex(), track.sign(), - pt_recalc, eta_recalc, phi_recalc, dcaXY, dcaZ, + pt_recalc, eta_recalc, phi_recalc, + dcaXY, dcaZ, trackParCov.getSigmaY2(), trackParCov.getSigmaZY(), trackParCov.getSigmaZ2(), track.tpcNClsFindable(), track.tpcNClsFindableMinusFound(), track.tpcNClsFindableMinusCrossedRows(), track.tpcNClsShared(), - track.tpcChi2NCl(), track.tpcInnerParam(), - track.tpcSignal(), track.tpcNSigmaEl(), /*track.tpcNSigmaMu(),*/ track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr(), - track.beta(), track.tofNSigmaEl(), /*track.tofNSigmaMu(),*/ track.tofNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPr(), + static_cast(tpcChi2NCl * 1e+2), track.tpcInnerParam(), + static_cast(tpcSignal * 1e+2), static_cast(tpcNSigmaEl * 1e+2), static_cast(tpcNSigmaPi * 1e+2), static_cast(tpcNSigmaKa * 1e+2), static_cast(tpcNSigmaPr * 1e+2), + static_cast(beta * 1e+3), static_cast(tofNSigmaEl * 1e+2), static_cast(tofNSigmaPi * 1e+2), static_cast(tofNSigmaKa * 1e+2), static_cast(tofNSigmaPr * 1e+2), track.itsClusterSizes(), - // track.itsNSigmaEl(), track.itsNSigmaMu(), track.itsNSigmaPi(), track.itsNSigmaKa(), track.itsNSigmaPr(), - track.itsChi2NCl(), track.tofChi2(), track.detectorMap(), - trackParCov.getX(), trackParCov.getAlpha(), trackParCov.getY(), trackParCov.getZ(), trackParCov.getSnp(), trackParCov.getTgl(), isAssociatedToMPC, tpcSignalMC); + static_cast(itsChi2NCl * 1e+2), static_cast(tofChi2 * 1e+2), track.detectorMap(), + trackParCov.getTgl(), + isAssociatedToMPC, false, 1.f, static_cast(mcTunedTPCSignal * 1e+2)); emprimaryelectronscov( - trackParCov.getSigmaY2(), - trackParCov.getSigmaZY(), - trackParCov.getSigmaZ2(), + trackParCov.getX(), + trackParCov.getAlpha(), + trackParCov.getY(), + trackParCov.getZ(), + trackParCov.getSnp(), + // trackParCov.getTgl(), + // trackParCov.getSigmaY2(), + // trackParCov.getSigmaZY(), + // trackParCov.getSigmaZ2(), trackParCov.getSigmaSnpY(), trackParCov.getSigmaSnpZ(), trackParCov.getSigmaSnp2(), @@ -536,7 +597,7 @@ struct skimmerPrimaryElectron { fRegistry.fill(HIST("Track/hChi2TOF"), track.tofChi2()); fRegistry.fill(HIST("Track/hITSClusterMap"), track.itsClusterMap()); fRegistry.fill(HIST("Track/hTPCdEdx"), track.tpcInnerParam(), track.tpcSignal()); - fRegistry.fill(HIST("Track/hTPCdEdxMC"), track.tpcInnerParam(), tpcSignalMC); + fRegistry.fill(HIST("Track/hTPCdEdxMC"), track.tpcInnerParam(), mcTunedTPCSignal); fRegistry.fill(HIST("Track/hTPCNsigmaEl"), track.tpcInnerParam(), track.tpcNSigmaEl()); fRegistry.fill(HIST("Track/hTPCNsigmaMu"), track.tpcInnerParam(), track.tpcNSigmaMu()); fRegistry.fill(HIST("Track/hTPCNsigmaPi"), track.tpcInnerParam(), track.tpcNSigmaPi()); diff --git a/PWGEM/Dilepton/TableProducer/skimmerSecondaryElectron.cxx b/PWGEM/Dilepton/TableProducer/skimmerSecondaryElectron.cxx deleted file mode 100644 index 15b99dc7349..00000000000 --- a/PWGEM/Dilepton/TableProducer/skimmerSecondaryElectron.cxx +++ /dev/null @@ -1,631 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// \brief write relevant information about primary electrons. -/// \author daiki.sekihata@cern.ch - -#include "PWGEM/Dilepton/DataModel/dileptonTables.h" -#include "PWGEM/Dilepton/Utils/PairUtilities.h" - -#include "Common/Core/trackUtilities.h" -#include "Common/DataModel/CollisionAssociationTables.h" - -#include "CCDB/BasicCCDBManager.h" -#include "CommonConstants/PhysicsConstants.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "DataFormatsParameters/GRPObject.h" -#include "DetectorsBase/GeometryManager.h" -#include "DetectorsBase/Propagator.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" - -#include "Math/Vector4D.h" - -#include -#include -#include -#include -#include -#include - -using namespace o2; -using namespace o2::soa; -using namespace o2::framework; -using namespace o2::framework::expressions; -using namespace o2::constants::physics; - -using MyCollisions = soa::Join; -using MyCollisionsMC = soa::Join; - -using MyTracks = soa::Join; -using MyTrack = MyTracks::iterator; -using MyTracksMC = soa::Join; -using MyTrackMC = MyTracksMC::iterator; - -struct skimmerSecondaryElectron { - // enum class EM_EEPairType : int { - // kULS = 0, - // kLSpp = +1, - // kLSmm = -1, - // }; - - SliceCache cache; - Preslice perCol = o2::aod::track::collisionId; - Produces emprimaryelectrons; - Produces emprimaryelectronscov; - Produces event; - Produces event_mult; - Produces event_cent; - - // Configurables - Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Configurable grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"}; - Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; - Configurable skipGRPOquery{"skipGRPOquery", true, "skip grpo query"}; - - // Operation and minimisation criteria - Configurable fillQAHistogram{"fillQAHistogram", false, "flag to fill QA histograms"}; - Configurable d_bz_input{"d_bz_input", -999, "bz field in kG, -999 is automatic"}; - Configurable min_ncluster_tpc{"min_ncluster_tpc", 10, "min ncluster tpc"}; - Configurable mincrossedrows{"mincrossedrows", 70, "min. crossed rows"}; - Configurable min_tpc_cr_findable_ratio{"min_tpc_cr_findable_ratio", 0.8, "min. TPC Ncr/Nf ratio"}; - Configurable minitsncls{"minitsncls", 4, "min. number of ITS clusters"}; - Configurable maxchi2tpc{"maxchi2tpc", 5.0, "max. chi2/NclsTPC"}; - Configurable maxchi2its{"maxchi2its", 6.0, "max. chi2/NclsITS"}; - Configurable minpt{"minpt", 0.15, "min pt for track"}; - Configurable maxeta{"maxeta", 0.9, "eta acceptance"}; - Configurable dca_xy_max{"dca_xy_max", 1.0f, "max DCAxy in cm"}; - Configurable dca_z_max{"dca_z_max", 1.0f, "max DCAz in cm"}; - Configurable dca_3d_sigma_max{"dca_3d_sigma_max", 1e+10, "max DCA 3D in sigma"}; - Configurable minTPCNsigmaEl{"minTPCNsigmaEl", -3.0, "min. TPC n sigma for electron inclusion"}; - Configurable maxTPCNsigmaEl{"maxTPCNsigmaEl", +4.0, "max. TPC n sigma for electron inclusion"}; - Configurable slope{"slope", 0.0185, "slope for m vs. phiv"}; - Configurable intercept{"intercept", -0.0280, "intercept for m vs. phiv"}; - Configurable mee_min{"mee_min", 0.0f, "minimum mee to distinguish photon conversion and dalitz decay"}; - - HistogramRegistry fRegistry{"output", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; - - std::pair> itsRequirement = {1, {0, 1, 2}}; // any hits on 3 ITS ib layers. - - int mRunNumber; - float d_bz; - Service ccdb; - o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE; - - void init(InitContext&) - { - mRunNumber = 0; - d_bz = 0; - - ccdb->setURL(ccdburl); - ccdb->setCaching(true); - ccdb->setLocalObjectValidityChecking(); - ccdb->setFatalWhenNull(false); - - if (fillQAHistogram) { - fRegistry.add("Track/hPt", "pT;p_{T} (GeV/c)", kTH1F, {{1000, 0.0f, 10}}, false); - fRegistry.add("Track/hQoverPt", "q/pT;q/p_{T} (GeV/c)^{-1}", kTH1F, {{400, -20, 20}}, false); - fRegistry.add("Track/hEtaPhi", "#eta vs. #varphi;#varphi (rad.);#eta", kTH2F, {{180, 0, 2 * M_PI}, {20, -1.0f, 1.0f}}, false); - fRegistry.add("Track/hDCAxyz", "DCA xy vs. z;DCA_{xy} (cm);DCA_{z} (cm)", kTH2F, {{200, -1.0f, 1.0f}, {200, -1.0f, 1.0f}}, false); - fRegistry.add("Track/hDCAxyzSigma", "DCA xy vs. z;DCA_{xy} (#sigma);DCA_{z} (#sigma)", kTH2F, {{200, -10.0f, 10.0f}, {200, -10.0f, 10.0f}}, false); - fRegistry.add("Track/hDCAxyRes_Pt", "DCA_{xy} resolution vs. pT;p_{T} (GeV/c);DCA_{xy} resolution (#mum)", kTH2F, {{1000, 0, 10}, {500, 0., 500}}, false); - fRegistry.add("Track/hDCAzRes_Pt", "DCA_{z} resolution vs. pT;p_{T} (GeV/c);DCA_{z} resolution (#mum)", kTH2F, {{1000, 0, 10}, {500, 0., 500}}, false); - fRegistry.add("Track/hNclsTPC", "number of TPC clusters", kTH1F, {{161, -0.5, 160.5}}, false); - fRegistry.add("Track/hNcrTPC", "number of TPC crossed rows", kTH1F, {{161, -0.5, 160.5}}, false); - fRegistry.add("Track/hChi2TPC", "chi2/number of TPC clusters", kTH1F, {{100, 0, 10}}, false); - fRegistry.add("Track/hTPCdEdx", "TPC dE/dx;p_{in} (GeV/c);TPC dE/dx (a.u.)", kTH2F, {{1000, 0, 10}, {200, 0, 200}}, false); - fRegistry.add("Track/hTPCNsigmaEl", "TPC n sigma el;p_{in} (GeV/c);n #sigma_{e}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/hTPCNsigmaMu", "TPC n sigma mu;p_{in} (GeV/c);n #sigma_{#mu}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/hTPCNsigmaPi", "TPC n sigma pi;p_{in} (GeV/c);n #sigma_{#pi}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/hTPCNsigmaKa", "TPC n sigma ka;p_{in} (GeV/c);n #sigma_{K}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/hTPCNsigmaPr", "TPC n sigma pr;p_{in} (GeV/c);n #sigma_{p}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/hTOFbeta", "TOF beta;p_{in} (GeV/c);#beta", kTH2F, {{1000, 0, 10}, {600, 0, 1.2}}, false); - fRegistry.add("Track/h1overTOFbeta", "TOF beta;p_{in} (GeV/c);1/#beta", kTH2F, {{1000, 0, 10}, {1000, 0.8, 1.8}}, false); - fRegistry.add("Track/hTOFNsigmaEl", "TOF n sigma el;p_{in} (GeV/c);n #sigma_{e}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/hTOFNsigmaMu", "TOF n sigma mu;p_{in} (GeV/c);n #sigma_{#mu}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/hTOFNsigmaPi", "TOF n sigma pi;p_{in} (GeV/c);n #sigma_{#pi}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/hTOFNsigmaKa", "TOF n sigma ka;p_{in} (GeV/c);n #sigma_{K}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/hTOFNsigmaPr", "TOF n sigma pr;p_{in} (GeV/c);n #sigma_{p}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/hTPCNcr2Nf", "TPC Ncr/Nfindable", kTH1F, {{200, 0, 2}}, false); - fRegistry.add("Track/hTPCNcls2Nf", "TPC Ncls/Nfindable", kTH1F, {{200, 0, 2}}, false); - fRegistry.add("Track/hNclsITS", "number of ITS clusters", kTH1F, {{8, -0.5, 7.5}}, false); - fRegistry.add("Track/hChi2ITS", "chi2/number of ITS clusters", kTH1F, {{100, 0, 10}}, false); - fRegistry.add("Track/hITSClusterMap", "ITS cluster map", kTH1F, {{128, -0.5, 127.5}}, false); - fRegistry.add("Track/hMeanClusterSizeITS", "mean cluster size ITS;p_{pv} (GeV/c); on ITS #times cos(#lambda)", kTH2F, {{1000, 0, 10}, {32, 0, 16}}, false); - fRegistry.add("Pair/hMvsPhiV", "mee vs. phiv;#varphi_{V} (rad.);m_{ee} (GeV/c^{2})", kTH2F, {{90, 0, M_PI}, {100, 0, 0.1}}, false); - } - } - - void initCCDB(aod::BCsWithTimestamps::iterator const& bc) - { - if (mRunNumber == bc.runNumber()) { - return; - } - - // In case override, don't proceed, please - no CCDB access required - if (d_bz_input > -990) { - d_bz = d_bz_input; - o2::parameters::GRPMagField grpmag; - if (fabs(d_bz) > 1e-5) { - grpmag.setL3Current(30000.f / (d_bz / 5.0f)); - } - o2::base::Propagator::initFieldFromGRP(&grpmag); - mRunNumber = bc.runNumber(); - return; - } - - auto run3grp_timestamp = bc.timestamp(); - o2::parameters::GRPObject* grpo = 0x0; - o2::parameters::GRPMagField* grpmag = 0x0; - if (!skipGRPOquery) - grpo = ccdb->getForTimeStamp(grpPath, run3grp_timestamp); - if (grpo) { - o2::base::Propagator::initFieldFromGRP(grpo); - // Fetch magnetic field from ccdb for current collision - d_bz = grpo->getNominalL3Field(); - LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; - } else { - grpmag = ccdb->getForTimeStamp(grpmagPath, run3grp_timestamp); - if (!grpmag) { - LOG(fatal) << "Got nullptr from CCDB for path " << grpmagPath << " of object GRPMagField and " << grpPath << " of object GRPObject for timestamp " << run3grp_timestamp; - } - o2::base::Propagator::initFieldFromGRP(grpmag); - // Fetch magnetic field from ccdb for current collision - d_bz = std::lround(5.f * grpmag->getL3Current() / 30000.f); - LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; - } - mRunNumber = bc.runNumber(); - } - - template - bool checkTrack(TTrack const& track) - { - if constexpr (isMC) { - if (!track.has_mcParticle()) { - return false; - } - } - - if (track.tpcChi2NCl() > maxchi2tpc) { - return false; - } - - if (track.itsChi2NCl() > maxchi2its) { - return false; - } - - if (!track.hasITS() || !track.hasTPC()) { - return false; - } - if (track.itsNCls() < minitsncls) { - return false; - } - - auto hits = std::count_if(itsRequirement.second.begin(), itsRequirement.second.end(), [&](auto&& requiredLayer) { return track.itsClusterMap() & (1 << requiredLayer); }); - if (hits < itsRequirement.first) { - return false; - } - - if (track.tpcNClsFound() < min_ncluster_tpc) { - return false; - } - - if (track.tpcNClsCrossedRows() < mincrossedrows) { - return false; - } - - if (track.tpcCrossedRowsOverFindableCls() < min_tpc_cr_findable_ratio) { - return false; - } - - if (abs(track.dcaXY()) > dca_xy_max || abs(track.dcaZ()) > dca_z_max) { - return false; - } - - if (track.pt() < minpt || abs(track.eta()) > maxeta) { - return false; - } - - return true; - } - - template - void fillTrackTable(TCollision const& collision, TTrack const& track) - { - if (std::find(stored_trackIds.begin(), stored_trackIds.end(), std::pair{collision.globalIndex(), track.globalIndex()}) == stored_trackIds.end()) { - std::array dcaInfo; - auto track_par_cov_recalc = getTrackParCov(track); - track_par_cov_recalc.setPID(o2::track::PID::Electron); - std::array pVec_recalc = {0, 0, 0}; // px, py, pz - o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, track_par_cov_recalc, 2.f, matCorr, &dcaInfo); - getPxPyPz(track_par_cov_recalc, pVec_recalc); - float dcaXY = dcaInfo[0]; - float dcaZ = dcaInfo[1]; - - float pt_recalc = track_par_cov_recalc.getPt(); - float eta_recalc = track_par_cov_recalc.getEta(); - float phi_recalc = track_par_cov_recalc.getPhi(); - - bool isAssociatedToMPC = collision.globalIndex() == track.collisionId(); - - emprimaryelectrons(collision.globalIndex(), track.globalIndex(), track.sign(), - pt_recalc, eta_recalc, phi_recalc, dcaXY, dcaZ, - track.tpcNClsFindable(), track.tpcNClsFindableMinusFound(), track.tpcNClsFindableMinusCrossedRows(), track.tpcNClsShared(), - track.tpcChi2NCl(), track.tpcInnerParam(), - track.tpcSignal(), track.tpcNSigmaEl(), /*track.tpcNSigmaMu(),*/ track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr(), - track.beta(), track.tofNSigmaEl(), /*track.tofNSigmaMu(),*/ track.tofNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPr(), - track.itsClusterSizes(), - // 0, 0, 0, 0, 0, - track.itsChi2NCl(), track.tofChi2(), track.detectorMap(), - track_par_cov_recalc.getX(), track_par_cov_recalc.getAlpha(), track_par_cov_recalc.getY(), track_par_cov_recalc.getZ(), track_par_cov_recalc.getSnp(), track_par_cov_recalc.getTgl(), isAssociatedToMPC, -1); - - emprimaryelectronscov( - track_par_cov_recalc.getSigmaY2(), - track_par_cov_recalc.getSigmaZY(), - track_par_cov_recalc.getSigmaZ2(), - track_par_cov_recalc.getSigmaSnpY(), - track_par_cov_recalc.getSigmaSnpZ(), - track_par_cov_recalc.getSigmaSnp2(), - track_par_cov_recalc.getSigmaTglY(), - track_par_cov_recalc.getSigmaTglZ(), - track_par_cov_recalc.getSigmaTglSnp(), - track_par_cov_recalc.getSigmaTgl2(), - track_par_cov_recalc.getSigma1PtY(), - track_par_cov_recalc.getSigma1PtZ(), - track_par_cov_recalc.getSigma1PtSnp(), - track_par_cov_recalc.getSigma1PtTgl(), - track_par_cov_recalc.getSigma1Pt2()); - - stored_trackIds.emplace_back(std::pair{collision.globalIndex(), track.globalIndex()}); - - if (fillQAHistogram) { - uint32_t itsClusterSizes = track.itsClusterSizes(); - int total_cluster_size = 0, nl = 0; - for (unsigned int layer = 3; layer < 7; layer++) { - int cluster_size_per_layer = (itsClusterSizes >> (layer * 4)) & 0xf; - if (cluster_size_per_layer > 0) { - nl++; - } - total_cluster_size += cluster_size_per_layer; - } - - fRegistry.fill(HIST("Track/hPt"), pt_recalc); - fRegistry.fill(HIST("Track/hQoverPt"), track.sign() / pt_recalc); - fRegistry.fill(HIST("Track/hEtaPhi"), phi_recalc, eta_recalc); - fRegistry.fill(HIST("Track/hDCAxyz"), dcaXY, dcaZ); - fRegistry.fill(HIST("Track/hDCAxyzSigma"), dcaXY / sqrt(track_par_cov_recalc.getSigmaY2()), dcaZ / sqrt(track_par_cov_recalc.getSigmaZ2())); - fRegistry.fill(HIST("Track/hDCAxyRes_Pt"), pt_recalc, sqrt(track_par_cov_recalc.getSigmaY2()) * 1e+4); // convert cm to um - fRegistry.fill(HIST("Track/hDCAzRes_Pt"), pt_recalc, sqrt(track_par_cov_recalc.getSigmaZ2()) * 1e+4); // convert cm to um - fRegistry.fill(HIST("Track/hNclsITS"), track.itsNCls()); - fRegistry.fill(HIST("Track/hNclsTPC"), track.tpcNClsFound()); - fRegistry.fill(HIST("Track/hNcrTPC"), track.tpcNClsCrossedRows()); - fRegistry.fill(HIST("Track/hTPCNcr2Nf"), track.tpcCrossedRowsOverFindableCls()); - fRegistry.fill(HIST("Track/hTPCNcls2Nf"), track.tpcFoundOverFindableCls()); - fRegistry.fill(HIST("Track/hChi2TPC"), track.tpcChi2NCl()); - fRegistry.fill(HIST("Track/hChi2ITS"), track.itsChi2NCl()); - fRegistry.fill(HIST("Track/hITSClusterMap"), track.itsClusterMap()); - fRegistry.fill(HIST("Track/hMeanClusterSizeITS"), track.p(), static_cast(total_cluster_size) / static_cast(nl) * std::cos(std::atan(track.tgl()))); - fRegistry.fill(HIST("Track/hTPCdEdx"), track.tpcInnerParam(), track.tpcSignal()); - fRegistry.fill(HIST("Track/hTPCNsigmaEl"), track.tpcInnerParam(), track.tpcNSigmaEl()); - fRegistry.fill(HIST("Track/hTPCNsigmaMu"), track.tpcInnerParam(), track.tpcNSigmaMu()); - fRegistry.fill(HIST("Track/hTPCNsigmaPi"), track.tpcInnerParam(), track.tpcNSigmaPi()); - fRegistry.fill(HIST("Track/hTPCNsigmaKa"), track.tpcInnerParam(), track.tpcNSigmaKa()); - fRegistry.fill(HIST("Track/hTPCNsigmaPr"), track.tpcInnerParam(), track.tpcNSigmaPr()); - fRegistry.fill(HIST("Track/hTOFbeta"), track.tpcInnerParam(), track.beta()); - fRegistry.fill(HIST("Track/h1overTOFbeta"), track.tpcInnerParam(), 1. / track.beta()); - fRegistry.fill(HIST("Track/hTOFNsigmaEl"), track.tpcInnerParam(), track.tofNSigmaEl()); - fRegistry.fill(HIST("Track/hTOFNsigmaMu"), track.tpcInnerParam(), track.tofNSigmaMu()); - fRegistry.fill(HIST("Track/hTOFNsigmaPi"), track.tpcInnerParam(), track.tofNSigmaPi()); - fRegistry.fill(HIST("Track/hTOFNsigmaKa"), track.tpcInnerParam(), track.tofNSigmaKa()); - fRegistry.fill(HIST("Track/hTOFNsigmaPr"), track.tpcInnerParam(), track.tofNSigmaPr()); - } - } - } - - std::vector> stored_trackIds; - Filter trackFilter = o2::aod::track::pt > minpt&& nabs(o2::aod::track::eta) < maxeta&& o2::aod::track::tpcChi2NCl < maxchi2tpc&& o2::aod::track::itsChi2NCl < maxchi2its&& ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::ITS) == true && ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::TPC) == true && nabs(o2::aod::track::dcaXY) < dca_xy_max&& nabs(o2::aod::track::dcaZ) < dca_z_max; - Filter pidFilter = minTPCNsigmaEl < o2::aod::pidtpc::tpcNSigmaEl && o2::aod::pidtpc::tpcNSigmaEl < maxTPCNsigmaEl; - using MyFilteredTracks = soa::Filtered; - - Partition posTracks = o2::aod::track::signed1Pt > 0.f; - Partition negTracks = o2::aod::track::signed1Pt < 0.f; - - // ---------- for data ---------- - - void processRec(MyCollisions const& collisions, aod::BCsWithTimestamps const&, MyFilteredTracks const& tracks) - { - stored_trackIds.reserve(tracks.size()); - - for (auto& collision : collisions) { - auto bc = collision.bc_as(); - initCCDB(bc); - - if (!collision.selection_bit(o2::aod::evsel::kIsTriggerTVX) || !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { - continue; - } - - auto posTracks_per_coll = posTracks->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache); // loose track sample - auto negTracks_per_coll = negTracks->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache); // loose track sample - - int npair = 0; - for (auto& [pos, neg] : combinations(CombinationsStrictlyUpperIndexPolicy(posTracks_per_coll, negTracks_per_coll))) { // ULS - - if (!checkTrack(pos) || !checkTrack(neg)) { - continue; - } - - ROOT::Math::PtEtaPhiMVector v1(pos.pt(), pos.eta(), pos.phi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v2(neg.pt(), neg.eta(), neg.phi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - float mee = v12.M(); - float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(pos.px(), pos.py(), pos.pz(), neg.px(), neg.py(), neg.pz(), pos.sign(), neg.sign(), d_bz); - - if (mee < mee_min || slope * phiv + intercept < mee) { // select phocon conversions - continue; - } - if (fillQAHistogram) { - fRegistry.fill(HIST("Pair/hMvsPhiV"), phiv, mee); - } - fillTrackTable(collision, pos); - fillTrackTable(collision, neg); - npair++; - } - - if (npair < 0.5) { - continue; - } - - event(collision.globalIndex(), bc.runNumber(), bc.globalBC(), collision.alias_raw(), collision.selection_raw(), collision.rct_raw(), bc.timestamp(), - collision.posX(), collision.posY(), collision.posZ(), - collision.numContrib(), collision.trackOccupancyInTimeRange(), collision.ft0cOccupancyInTimeRange()); - event_mult(collision.multFT0A(), collision.multFT0C(), collision.multNTracksPV(), collision.multNTracksPVeta1(), collision.multNTracksPVetaHalf()); - event_cent(collision.centFT0M(), collision.centFT0A(), collision.centFT0C()); - } // end of collision loop - - stored_trackIds.clear(); - stored_trackIds.shrink_to_fit(); - } - PROCESS_SWITCH(skimmerSecondaryElectron, processRec, "process reconstructed info only", true); // standalone - - // ---------- for MC ---------- - using MyFilteredTracksMC = soa::Filtered; - Partition posTracksMC = o2::aod::track::signed1Pt > 0.f; - Partition negTracksMC = o2::aod::track::signed1Pt < 0.f; - void processMC(MyCollisionsMC const& collisions, aod::McCollisions const&, aod::BCsWithTimestamps const&, MyFilteredTracksMC const& tracks) - { - stored_trackIds.reserve(tracks.size()); - - for (auto& collision : collisions) { - if (!collision.has_mcCollision()) { - continue; - } - auto bc = collision.bc_as(); - initCCDB(bc); - - if (!collision.selection_bit(o2::aod::evsel::kIsTriggerTVX) || !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { - continue; - } - - auto posTracks_per_coll = posTracksMC->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache); // loose track sample - auto negTracks_per_coll = negTracksMC->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache); // loose track sample - - int npair = 0; - for (auto& [pos, neg] : combinations(CombinationsStrictlyUpperIndexPolicy(posTracks_per_coll, negTracks_per_coll))) { // ULS - if (!checkTrack(pos) || !checkTrack(neg)) { - continue; - } - - ROOT::Math::PtEtaPhiMVector v1(pos.pt(), pos.eta(), pos.phi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v2(neg.pt(), neg.eta(), neg.phi(), o2::constants::physics::MassElectron); - ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - float mee = v12.M(); - float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(pos.px(), pos.py(), pos.pz(), neg.px(), neg.py(), neg.pz(), pos.sign(), neg.sign(), d_bz); - - if (mee < mee_min || slope * phiv + intercept < mee) { // select phocon conversions - continue; - } - if (fillQAHistogram) { - fRegistry.fill(HIST("Pair/hMvsPhiV"), phiv, mee); - } - fillTrackTable(collision, pos); - fillTrackTable(collision, neg); - npair++; - } - - if (npair < 0.5) { - continue; - } - - event(collision.globalIndex(), bc.runNumber(), bc.globalBC(), collision.alias_raw(), collision.selection_raw(), collision.rct_raw(), bc.timestamp(), - collision.posX(), collision.posY(), collision.posZ(), - collision.numContrib(), collision.trackOccupancyInTimeRange(), collision.ft0cOccupancyInTimeRange()); - event_mult(collision.multFT0A(), collision.multFT0C(), collision.multNTracksPV(), collision.multNTracksPVeta1(), collision.multNTracksPVetaHalf()); - event_cent(collision.centFT0M(), collision.centFT0A(), collision.centFT0C()); - } // end of collision loop - - stored_trackIds.clear(); - stored_trackIds.shrink_to_fit(); - } - PROCESS_SWITCH(skimmerSecondaryElectron, processMC, "process reconstructed and MC info ", false); -}; - -struct AssociateMCInfoSecondaryElectron { - Produces mcevents; - Produces mceventlabels; - Produces emmcparticles; - Produces emprimaryelectronmclabels; - - HistogramRegistry registry{"EMMCEvent"}; - void init(o2::framework::InitContext&) - { - auto hEventCounter = registry.add("hEventCounter", "hEventCounter", kTH1I, {{6, 0.5f, 6.5f}}); - hEventCounter->GetXaxis()->SetBinLabel(1, "all"); - hEventCounter->GetXaxis()->SetBinLabel(2, "has mc collision"); - } - - void processMC(MyCollisionsMC const& collisions, aod::McCollisions const&, aod::McParticles const& mcTracks, MyTracksMC const& o2tracks, aod::EMEvents const& emevents, aod::EMPrimaryElectrons const& emprimaryelectrons) - { - // temporary variables used for the indexing of the skimmed MC stack - std::map fNewLabels; - std::map fNewLabelsReversed; - // std::map fMCFlags; - std::map fEventIdx; - std::map fEventLabels; - int fCounters[2] = {0, 0}; //! [0] - particle counter, [1] - event counter - - for (auto& emevent : emevents) { - registry.fill(HIST("hEventCounter"), 1); - auto collision = collisions.iteratorAt(emevent.collisionId()); - auto mcCollision = collision.mcCollision(); - - if (!(fEventLabels.find(mcCollision.globalIndex()) != fEventLabels.end())) { - mcevents(mcCollision.globalIndex(), mcCollision.generatorsID(), mcCollision.posX(), mcCollision.posY(), mcCollision.posZ(), mcCollision.impactParameter(), mcCollision.eventPlaneAngle()); - fEventLabels[mcCollision.globalIndex()] = fCounters[1]; - fCounters[1]++; - } - - mceventlabels(fEventLabels.find(mcCollision.globalIndex())->second, collision.mcMask()); - } // end of reconstructed collision loop - - for (auto& emprimaryelectron : emprimaryelectrons) { - auto collision_from_el = collisions.iteratorAt(emprimaryelectron.collisionId()); - if (!collision_from_el.has_mcCollision()) { - continue; - } - auto mcCollision_from_el = collision_from_el.mcCollision(); - - auto o2track = o2tracks.iteratorAt(emprimaryelectron.trackId()); - if (!o2track.has_mcParticle()) { - continue; // If no MC particle is found, skip the dilepton - } - auto mctrack = o2track.template mcParticle_as(); - - // if the MC truth particle corresponding to this reconstructed track which is not already written, add it to the skimmed MC stack - if (!(fNewLabels.find(mctrack.globalIndex()) != fNewLabels.end())) { - fNewLabels[mctrack.globalIndex()] = fCounters[0]; - fNewLabelsReversed[fCounters[0]] = mctrack.globalIndex(); - // fMCFlags[mctrack.globalIndex()] = mcflags; - fEventIdx[mctrack.globalIndex()] = fEventLabels.find(mcCollision_from_el.globalIndex())->second; - fCounters[0]++; - } - emprimaryelectronmclabels(fNewLabels.find(mctrack.index())->second, o2track.mcMask()); - - // Next, store mother-chain of this reconstructed track. - int motherid = -999; // first mother index - if (mctrack.has_mothers()) { - motherid = mctrack.mothersIds()[0]; // first mother index - } - while (motherid > -1) { - if (motherid < mcTracks.size()) { // protect against bad mother indices. why is this needed? - auto mp = mcTracks.iteratorAt(motherid); - - // if the MC truth particle corresponding to this reconstructed track which is not already written, add it to the skimmed MC stack - if (!(fNewLabels.find(mp.globalIndex()) != fNewLabels.end())) { - fNewLabels[mp.globalIndex()] = fCounters[0]; - fNewLabelsReversed[fCounters[0]] = mp.globalIndex(); - // fMCFlags[mp.globalIndex()] = mcflags; - fEventIdx[mp.globalIndex()] = fEventLabels.find(mcCollision_from_el.globalIndex())->second; - fCounters[0]++; - } - - if (mp.has_mothers()) { - motherid = mp.mothersIds()[0]; // first mother index - } else { - motherid = -999; - } - } else { - motherid = -999; - } - } // end of mother chain loop - - } // end of em primary electron loop - - // Loop over the label map, create the mother/daughter relationships if these exist and write the skimmed MC stack - for (const auto& [newLabel, oldLabel] : fNewLabelsReversed) { - auto mctrack = mcTracks.iteratorAt(oldLabel); - // uint16_t mcflags = fMCFlags.find(oldLabel)->second; - - std::vector mothers; - if (mctrack.has_mothers()) { - for (auto& m : mctrack.mothersIds()) { - if (m < mcTracks.size()) { // protect against bad mother indices - if (fNewLabels.find(m) != fNewLabels.end()) { - mothers.push_back(fNewLabels.find(m)->second); - } - } else { - std::cout << "Mother label (" << m << ") exceeds the McParticles size (" << mcTracks.size() << ")" << std::endl; - std::cout << " Check the MC generator" << std::endl; - } - } - } - - // Note that not all daughters from the original table are preserved in the skimmed MC stack - std::vector daughters; - if (mctrack.has_daughters()) { - // int ndau = mctrack.daughtersIds()[1] - mctrack.daughtersIds()[0] + 1; - // LOGF(info, "daughter range in original MC stack pdg = %d | %d - %d , n dau = %d", mctrack.pdgCode(), mctrack.daughtersIds()[0], mctrack.daughtersIds()[1], mctrack.daughtersIds()[1] -mctrack.daughtersIds()[0] +1); - for (int d = mctrack.daughtersIds()[0]; d <= mctrack.daughtersIds()[1]; ++d) { - // TODO: remove this check as soon as issues with MC production are fixed - if (d < mcTracks.size()) { // protect against bad daughter indices - // auto dau_tmp = mcTracks.iteratorAt(d); - // // LOGF(info, "daughter pdg = %d", dau_tmp.pdgCode()); - // if ((mctrack.pdgCode() == 223 || mctrack.pdgCode() == 333) && (mctrack.isPhysicalPrimary() || mctrack.producedByGenerator())) { - // if (fNewLabels.find(d) == fNewLabels.end() && (abs(dau_tmp.pdgCode()) == 11 || abs(dau_tmp.pdgCode()) == 13)) { - // LOGF(info, "daughter lepton is not found mctrack.globalIndex() = %d, mctrack.producedByGenerator() == %d, ndau = %d | dau_tmp.globalIndex() = %d, dau_tmp.pdgCode() = %d, dau_tmp.producedByGenerator() = %d, dau_tmp.pt() = %f, dau_tmp.eta() = %f, dau_tmp.phi() = %f", mctrack.globalIndex(), mctrack.producedByGenerator(), ndau, dau_tmp.globalIndex(), dau_tmp.pdgCode(), dau_tmp.producedByGenerator(), dau_tmp.pt(), dau_tmp.eta(), dau_tmp.phi()); - // } - // } - - if (fNewLabels.find(d) != fNewLabels.end()) { - daughters.push_back(fNewLabels.find(d)->second); - } - } else { - std::cout << "Daughter label (" << d << ") exceeds the McParticles size (" << mcTracks.size() << ")" << std::endl; - std::cout << " Check the MC generator" << std::endl; - } - } - } - - emmcparticles(fEventIdx.find(oldLabel)->second, mctrack.pdgCode(), mctrack.flags(), - mothers, daughters, - mctrack.px(), mctrack.py(), mctrack.pz(), mctrack.e(), - mctrack.vx(), mctrack.vy(), mctrack.vz()); - - mothers.clear(); - mothers.shrink_to_fit(); - daughters.clear(); - daughters.shrink_to_fit(); - } // end loop over labels - - fNewLabels.clear(); - fNewLabelsReversed.clear(); - // fMCFlags.clear(); - fEventIdx.clear(); - fEventLabels.clear(); - fCounters[0] = 0; - fCounters[1] = 0; - } - - void processDummy(MyCollisions const&) {} - - PROCESS_SWITCH(AssociateMCInfoSecondaryElectron, processMC, "create em mc event table for Electron", false); - PROCESS_SWITCH(AssociateMCInfoSecondaryElectron, processDummy, "processDummy", true); -}; - -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - return WorkflowSpec{ - adaptAnalysisTask(cfgc, TaskName{"skimmer-secondary-electron"}), - adaptAnalysisTask(cfgc, TaskName{"associate-mc-info-secondary-electron"}), - }; -} diff --git a/PWGEM/Dilepton/TableProducer/treeCreatorElectronML.cxx b/PWGEM/Dilepton/TableProducer/treeCreatorElectronML.cxx index 1874e953269..79d21b1e059 100644 --- a/PWGEM/Dilepton/TableProducer/treeCreatorElectronML.cxx +++ b/PWGEM/Dilepton/TableProducer/treeCreatorElectronML.cxx @@ -651,7 +651,7 @@ struct TreeCreatorElectronML { } PROCESS_SWITCH(TreeCreatorElectronML, processSingleTrack, "produce ML input for single track level", false); - using MyFilteredCollisionsSkimmed = soa::Filtered>; + using MyFilteredCollisionsSkimmed = soa::Filtered>; using MyFilteredTracksMCSkimmed = soa::Filtered>; Preslice perCollisionSkimmed = aod::emprimaryelectron::emeventId; diff --git a/PWGEM/Dilepton/Tasks/Converters/CMakeLists.txt b/PWGEM/Dilepton/Tasks/Converters/CMakeLists.txt index 7e02c208968..31985d9d2d3 100644 --- a/PWGEM/Dilepton/Tasks/Converters/CMakeLists.txt +++ b/PWGEM/Dilepton/Tasks/Converters/CMakeLists.txt @@ -15,6 +15,11 @@ o2physics_add_dpl_workflow(event-converter2 PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(event-converter3 + SOURCES eventConverter3.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(electron-converter2 SOURCES electronConverter2.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore @@ -25,3 +30,8 @@ o2physics_add_dpl_workflow(electron-converter3 PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(electron-converter4 + SOURCES electronConverter4.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + diff --git a/PWGEM/Dilepton/Tasks/Converters/electronConverter4.cxx b/PWGEM/Dilepton/Tasks/Converters/electronConverter4.cxx new file mode 100644 index 00000000000..07161fae435 --- /dev/null +++ b/PWGEM/Dilepton/Tasks/Converters/electronConverter4.cxx @@ -0,0 +1,157 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// +// ======================== +// +// This code runs loop over ULS ee pars for virtual photon QC. +// Please write to: daiki.sekihata@cern.ch + +#include "PWGEM/Dilepton/DataModel/dileptonTables.h" + +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" + +using namespace o2; +using namespace o2::aod; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::soa; + +struct electronConverter4 { + Produces track_004; + + using MyElectrons002 = soa::Join; + void process002to004(MyElectrons002 const& tracks) + { + for (auto& track : tracks) { + float itsChi2NCl = (track.hasITS() && track.itsChi2NCl() > 0.f) ? track.itsChi2NCl() : -299.f; + float tpcChi2NCl = (track.hasTPC() && track.tpcChi2NCl() > 0.f) ? track.tpcChi2NCl() : -299.f; + float beta = track.hasTOF() ? track.beta() : -29.f; + float tofNSigmaEl = track.hasTOF() ? track.tofNSigmaEl() : -299.f; + float tofNSigmaPi = track.hasTOF() ? track.tofNSigmaPi() : -299.f; + float tofNSigmaKa = track.hasTOF() ? track.tofNSigmaKa() : -299.f; + float tofNSigmaPr = track.hasTOF() ? track.tofNSigmaPr() : -299.f; + float tofChi2 = track.hasTOF() ? track.tofChi2() : -299.f; + + float tpcSignal = track.hasTPC() ? track.tpcSignal() : -299.f; + float tpcNSigmaEl = track.hasTPC() ? track.tpcNSigmaEl() : -299.f; + float tpcNSigmaPi = track.hasTPC() ? track.tpcNSigmaPi() : -299.f; + float tpcNSigmaKa = track.hasTPC() ? track.tpcNSigmaKa() : -299.f; + float tpcNSigmaPr = track.hasTPC() ? track.tpcNSigmaPr() : -299.f; + + track_004(track.collisionId(), + track.trackId(), + track.sign(), + track.pt(), + track.eta(), + track.phi(), + track.dcaXY(), + track.dcaZ(), + track.cYY(), + track.cZY(), + track.cZZ(), + track.tpcNClsFindable(), + track.tpcNClsFindableMinusFound(), + track.tpcNClsFindableMinusCrossedRows(), + track.tpcNClsShared(), + + static_cast(tpcChi2NCl * 1e+2), + track.tpcInnerParam(), + static_cast(tpcSignal * 1e+2), + static_cast(tpcNSigmaEl * 1e+2), + static_cast(tpcNSigmaPi * 1e+2), + static_cast(tpcNSigmaKa * 1e+2), + static_cast(tpcNSigmaPr * 1e+2), + static_cast(beta * 1e+3), + static_cast(tofNSigmaEl * 1e+2), + static_cast(tofNSigmaPi * 1e+2), + static_cast(tofNSigmaKa * 1e+2), + static_cast(tofNSigmaPr * 1e+2), + track.itsClusterSizes(), + static_cast(itsChi2NCl * 1e+2), + static_cast(tofChi2 * 1e+2), + track.detectorMap(), + track.tgl(), + track.isAssociatedToMPC(), + false, + 0.f, + static_cast(0)); + } // end of track loop + } + PROCESS_SWITCH(electronConverter4, process002to004, "convert from 002 into 004", false); + + using MyElectrons003 = soa::Join; + void process003to004(MyElectrons003 const& tracks) + { + for (auto& track : tracks) { + float itsChi2NCl = track.itsChi2NCl() > 0.f ? track.itsChi2NCl() : -299.f; + float tpcChi2NCl = track.tpcChi2NCl() > 0.f ? track.tpcChi2NCl() : -299.f; + float beta = track.hasTOF() ? track.beta() : -29.f; + float tofNSigmaEl = track.hasTOF() ? track.tofNSigmaEl() : -299.f; + float tofNSigmaPi = track.hasTOF() ? track.tofNSigmaPi() : -299.f; + float tofNSigmaKa = track.hasTOF() ? track.tofNSigmaKa() : -299.f; + float tofNSigmaPr = track.hasTOF() ? track.tofNSigmaPr() : -299.f; + float tofChi2 = track.hasTOF() ? track.tofChi2() : -299.f; + + float tpcSignal = track.hasTPC() ? track.tpcSignal() : 0.f; + float mcTunedTPCSignal = track.hasTPC() ? track.mcTunedTPCSignal() : 0.f; + float tpcNSigmaEl = track.hasTPC() ? track.tpcNSigmaEl() : -299.f; + float tpcNSigmaPi = track.hasTPC() ? track.tpcNSigmaPi() : -299.f; + float tpcNSigmaKa = track.hasTPC() ? track.tpcNSigmaKa() : -299.f; + float tpcNSigmaPr = track.hasTPC() ? track.tpcNSigmaPr() : -299.f; + + track_004(track.collisionId(), + track.trackId(), + track.sign(), + track.pt(), + track.eta(), + track.phi(), + track.dcaXY(), + track.dcaZ(), + track.cYY(), + track.cZY(), + track.cZZ(), + track.tpcNClsFindable(), + track.tpcNClsFindableMinusFound(), + track.tpcNClsFindableMinusCrossedRows(), + track.tpcNClsShared(), + + static_cast(tpcChi2NCl * 1e+2), + track.tpcInnerParam(), + static_cast(tpcSignal * 1e+2), + static_cast(tpcNSigmaEl * 1e+2), + static_cast(tpcNSigmaPi * 1e+2), + static_cast(tpcNSigmaKa * 1e+2), + static_cast(tpcNSigmaPr * 1e+2), + static_cast(beta * 1e+3), + static_cast(tofNSigmaEl * 1e+2), + static_cast(tofNSigmaPi * 1e+2), + static_cast(tofNSigmaKa * 1e+2), + static_cast(tofNSigmaPr * 1e+2), + track.itsClusterSizes(), + static_cast(itsChi2NCl * 1e+2), + static_cast(tofChi2 * 1e+2), + track.detectorMap(), + track.tgl(), + track.isAssociatedToMPC(), + false, + 0.f, + static_cast(mcTunedTPCSignal)); + } // end of track loop + } + PROCESS_SWITCH(electronConverter4, process003to004, "convert from 003 into 004", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc, TaskName{"electron-converter4"})}; +} diff --git a/PWGEM/Dilepton/Tasks/Converters/eventConverter3.cxx b/PWGEM/Dilepton/Tasks/Converters/eventConverter3.cxx new file mode 100644 index 00000000000..fe22e18f859 --- /dev/null +++ b/PWGEM/Dilepton/Tasks/Converters/eventConverter3.cxx @@ -0,0 +1,54 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// +// ======================== +// +// This code runs loop over ULS ee pars for virtual photon QC. +// Please write to: daiki.sekihata@cern.ch + +#include "PWGEM/Dilepton/DataModel/dileptonTables.h" + +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" + +using namespace o2; +using namespace o2::aod; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::soa; + +struct eventConverter3 { + Produces event_003; + + void process(aod::EMEvents_002 const& collisions) + { + for (auto& collision : collisions) { + event_003( + collision.globalIndex(), + collision.runNumber(), + collision.globalBC(), + collision.alias_raw(), + collision.selection_raw(), + collision.rct_raw(), + collision.timestamp(), + collision.posZ(), + collision.numContrib(), + collision.trackOccupancyInTimeRange(), + collision.ft0cOccupancyInTimeRange()); + } // end of collision loop + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc, TaskName{"event-converter3"})}; +} diff --git a/PWGEM/Dilepton/Tasks/prefilterDielectron.cxx b/PWGEM/Dilepton/Tasks/prefilterDielectron.cxx index d1c15942c5e..16f776a093f 100644 --- a/PWGEM/Dilepton/Tasks/prefilterDielectron.cxx +++ b/PWGEM/Dilepton/Tasks/prefilterDielectron.cxx @@ -14,32 +14,33 @@ // This code produces information on prefilter for dielectron. // Please write to: daiki.sekihata@cern.ch -#include -#include -#include -#include -#include +#include "PWGEM/Dilepton/Core/DielectronCut.h" +#include "PWGEM/Dilepton/Core/EMEventCut.h" +#include "PWGEM/Dilepton/DataModel/dileptonTables.h" +#include "PWGEM/Dilepton/Utils/EMTrack.h" +#include "PWGEM/Dilepton/Utils/EventHistograms.h" +#include "PWGEM/Dilepton/Utils/PairUtilities.h" -#include "TString.h" -#include "Math/Vector4D.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/ASoAHelpers.h" #include "Common/Core/RecoDecay.h" #include "Common/Core/trackUtilities.h" -#include "DetectorsBase/Propagator.h" -#include "DetectorsBase/GeometryManager.h" -#include "DataFormatsParameters/GRPObject.h" -#include "DataFormatsParameters/GRPMagField.h" #include "CCDB/BasicCCDBManager.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "DataFormatsParameters/GRPObject.h" +#include "DetectorsBase/GeometryManager.h" +#include "DetectorsBase/Propagator.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" -#include "PWGEM/Dilepton/DataModel/dileptonTables.h" -#include "PWGEM/Dilepton/Core/DielectronCut.h" -#include "PWGEM/Dilepton/Core/EMEventCut.h" -#include "PWGEM/Dilepton/Utils/EMTrack.h" -#include "PWGEM/Dilepton/Utils/EventHistograms.h" -#include "PWGEM/Dilepton/Utils/PairUtilities.h" +#include "Math/Vector4D.h" +#include "TString.h" + +#include +#include +#include +#include +#include using namespace o2; using namespace o2::aod; @@ -52,7 +53,7 @@ using namespace o2::aod::pwgem::dilepton::utils::pairutil; using MyCollisions = soa::Join; using MyCollision = MyCollisions::iterator; -using MyTracks = soa::Join; +using MyTracks = soa::Join; using MyTrack = MyTracks::iterator; struct prefilterDielectron { diff --git a/PWGEM/Dilepton/Tasks/vpPairQC.cxx b/PWGEM/Dilepton/Tasks/vpPairQC.cxx index 098403d7ea4..452d0666acf 100644 --- a/PWGEM/Dilepton/Tasks/vpPairQC.cxx +++ b/PWGEM/Dilepton/Tasks/vpPairQC.cxx @@ -50,7 +50,7 @@ using namespace o2::aod::pwgem::dilepton::utils::emtrackutil; using MyCollisions = soa::Join; using MyCollision = MyCollisions::iterator; -using MyTracks = soa::Join; +using MyTracks = soa::Join; using MyTrack = MyTracks::iterator; struct vpPairQC { @@ -420,11 +420,6 @@ struct vpPairQC { if (track.sign() > 0) { fRegistry.fill(HIST("Track/positive/hs"), track.pt(), track.eta(), track.phi(), dca_3d, weight); fRegistry.fill(HIST("Track/positive/hQoverPt"), track.sign() / track.pt()); - fRegistry.fill(HIST("Track/positive/hPResolution"), track.p(), sigmaP(track) / track.p()); - fRegistry.fill(HIST("Track/positive/hPtResolution"), track.p(), sigmaPt(track) / track.pt()); - fRegistry.fill(HIST("Track/positive/hThetaResolution"), track.p(), sigmaTheta(track)); - fRegistry.fill(HIST("Track/positive/hEtaResolution"), track.p(), sigmaEta(track)); - fRegistry.fill(HIST("Track/positive/hPhiResolution"), track.p(), sigmaPhi(track)); fRegistry.fill(HIST("Track/positive/hDCAxyz"), track.dcaXY(), track.dcaZ()); fRegistry.fill(HIST("Track/positive/hDCAxyzSigma"), track.dcaXY() / sqrt(track.cYY()), track.dcaZ() / sqrt(track.cZZ())); fRegistry.fill(HIST("Track/positive/hDCAxyRes_Pt"), track.pt(), sqrt(track.cYY()) * 1e+4); // convert cm to um @@ -457,11 +452,6 @@ struct vpPairQC { } else { fRegistry.fill(HIST("Track/negative/hs"), track.pt(), track.eta(), track.phi(), dca_3d, weight); fRegistry.fill(HIST("Track/negative/hQoverPt"), track.sign() / track.pt()); - fRegistry.fill(HIST("Track/negative/hPResolution"), track.p(), sigmaP(track) / track.p()); - fRegistry.fill(HIST("Track/negative/hPtResolution"), track.p(), sigmaPt(track) / track.pt()); - fRegistry.fill(HIST("Track/negative/hThetaResolution"), track.p(), sigmaTheta(track)); - fRegistry.fill(HIST("Track/negative/hEtaResolution"), track.p(), sigmaEta(track)); - fRegistry.fill(HIST("Track/negative/hPhiResolution"), track.p(), sigmaPhi(track)); fRegistry.fill(HIST("Track/negative/hDCAxyz"), track.dcaXY(), track.dcaZ()); fRegistry.fill(HIST("Track/negative/hDCAxyzSigma"), track.dcaXY() / sqrt(track.cYY()), track.dcaZ() / sqrt(track.cZZ())); fRegistry.fill(HIST("Track/negative/hDCAxyRes_Pt"), track.pt(), sqrt(track.cYY()) * 1e+4); // convert cm to um diff --git a/PWGEM/Dilepton/Tasks/vpPairQCMC.cxx b/PWGEM/Dilepton/Tasks/vpPairQCMC.cxx index 9cc2c6cb77f..0325b566fad 100644 --- a/PWGEM/Dilepton/Tasks/vpPairQCMC.cxx +++ b/PWGEM/Dilepton/Tasks/vpPairQCMC.cxx @@ -50,7 +50,7 @@ using namespace o2::aod::pwgem::dilepton::utils::mcutil; using MyCollisions = soa::Join; using MyCollision = MyCollisions::iterator; -using MyMCTracks = soa::Join; +using MyMCTracks = soa::Join; using MyMCTrack = MyMCTracks::iterator; struct vpPairQCMC { diff --git a/PWGEM/Dilepton/Utils/EMTrackUtilities.h b/PWGEM/Dilepton/Utils/EMTrackUtilities.h index 087ee38d60b..d5a3f35c1e9 100644 --- a/PWGEM/Dilepton/Utils/EMTrackUtilities.h +++ b/PWGEM/Dilepton/Utils/EMTrackUtilities.h @@ -146,36 +146,36 @@ bool isBestMatch(TTrack const& track, TCut const& cut, TTracks const& tracks) } } //_______________________________________________________________________ -template -float sigmaPt(T const& track) -{ - return std::sqrt(track.c1Pt21Pt2()) / std::pow(track.signed1Pt(), 2); // pT resolution -} -//_______________________________________________________________________ -template -float sigmaPhi(T const& track) -{ - return std::sqrt(track.cSnpSnp()) / std::sqrt(1.f - std::pow(track.snp(), 2)); // phi resolution -} -//_______________________________________________________________________ -template -float sigmaTheta(T const& track) -{ - return std::sqrt(track.cTglTgl()) / (1.f + std::pow(track.tgl(), 2)); // theta resolution = lambda resolution. // lambda = pi/2 - theta. theta is polar angle. -} -//_______________________________________________________________________ -template -float sigmaEta(T const& track) -{ - return std::sqrt(track.cTglTgl()) / std::sqrt(1.f + std::pow(track.tgl(), 2)); -} -//_______________________________________________________________________ -template -float sigmaP(T const& track) -{ - // p = 1/1/pT x 1/cos(lambda); - return std::sqrt(std::pow(1.f / track.signed1Pt(), 4) * ((1.f + std::pow(track.tgl(), 2)) * track.c1Pt21Pt2() + 1.f / (1.f + std::pow(track.tgl(), 2)) * std::pow(track.signed1Pt() * track.tgl(), 2) * track.cTglTgl() - 2.f * track.signed1Pt() * track.tgl() * track.c1PtTgl())); -} +// template +// float sigmaPt(T const& track) +// { +// return std::sqrt(track.c1Pt21Pt2()) / std::pow(track.signed1Pt(), 2); // pT resolution +// } +// //_______________________________________________________________________ +// template +// float sigmaPhi(T const& track) +// { +// return std::sqrt(track.cSnpSnp()) / std::sqrt(1.f - std::pow(track.snp(), 2)); // phi resolution +// } +// //_______________________________________________________________________ +// template +// float sigmaTheta(T const& track) +// { +// return std::sqrt(track.cTglTgl()) / (1.f + std::pow(track.tgl(), 2)); // theta resolution = lambda resolution. // lambda = pi/2 - theta. theta is polar angle. +// } +// //_______________________________________________________________________ +// template +// float sigmaEta(T const& track) +// { +// return std::sqrt(track.cTglTgl()) / std::sqrt(1.f + std::pow(track.tgl(), 2)); +// } +// //_______________________________________________________________________ +// template +// float sigmaP(T const& track) +// { +// // p = 1/1/pT x 1/cos(lambda); +// return std::sqrt(std::pow(1.f / track.signed1Pt(), 4) * ((1.f + std::pow(track.tgl(), 2)) * track.c1Pt21Pt2() + 1.f / (1.f + std::pow(track.tgl(), 2)) * std::pow(track.signed1Pt() * track.tgl(), 2) * track.cTglTgl() - 2.f * track.signed1Pt() * track.tgl() * track.c1PtTgl())); +// } //_______________________________________________________________________ } // namespace o2::aod::pwgem::dilepton::utils::emtrackutil #endif // PWGEM_DILEPTON_UTILS_EMTRACKUTILITIES_H_ diff --git a/PWGEM/PhotonMeson/TableProducer/createEMEventPhoton.cxx b/PWGEM/PhotonMeson/TableProducer/createEMEventPhoton.cxx index 871bd62f35d..724b6347fa6 100644 --- a/PWGEM/PhotonMeson/TableProducer/createEMEventPhoton.cxx +++ b/PWGEM/PhotonMeson/TableProducer/createEMEventPhoton.cxx @@ -193,7 +193,7 @@ struct CreateEMEventPhoton { } event(collision.globalIndex(), bc.runNumber(), bc.globalBC(), collision.alias_raw(), collision.selection_raw(), collision.rct_raw(), bc.timestamp(), - collision.posX(), collision.posY(), collision.posZ(), + collision.posZ(), collision.numContrib(), collision.trackOccupancyInTimeRange(), collision.ft0cOccupancyInTimeRange()); // eventCov(collision.covXX(), collision.covXY(), collision.covXZ(), collision.covYY(), collision.covYZ(), collision.covZZ(), collision.chi2()); From 8f20e29e19d39799959b27552a997c6d9def852f Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Thu, 31 Jul 2025 12:14:45 +0200 Subject: [PATCH 156/345] [Common] Reorder dEdxNorm use in TPC PID (#12348) Co-authored-by: ALICE Builder --- Common/TableProducer/PID/pidTPCModule.h | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/Common/TableProducer/PID/pidTPCModule.h b/Common/TableProducer/PID/pidTPCModule.h index 37883de0273..321b6e39329 100644 --- a/Common/TableProducer/PID/pidTPCModule.h +++ b/Common/TableProducer/PID/pidTPCModule.h @@ -633,6 +633,18 @@ class pidTPCModule // if corrected dE/dx is requested, correct it here on the spot and use that if (pidTPCopts.useCorrecteddEdx) { + + //_________________________________________________________ + // bypass TPC signal in case TracksQA information present + if constexpr (soa::is_table) { + tpcSignalToEvaluatePID = -999.f; + if (indexTrack2TrackQA[trk.globalIndex()] != -1) { + auto trackQA = tracksQA.rawIteratorAt(indexTrack2TrackQA[trk.globalIndex()]); + tpcSignalToEvaluatePID = trackQA.tpcdEdxNorm(); + } + } + //_________________________________________________________ + double hadronicRate; int occupancy; if (trk.has_collision()) { @@ -648,7 +660,7 @@ class pidTPCModule occupancy = 0; } - float fTPCSignal = trk.tpcSignal(); + float fTPCSignal = tpcSignalToEvaluatePID; float fNormMultTPC = multTPC / 11000.; float fTrackOccN = occupancy / 1000.; @@ -689,17 +701,6 @@ class pidTPCModule // change the signal used for PID tpcSignalToEvaluatePID = fTPCSignal / fTPCSignalN_CR1; - //_________________________________________________________ - // bypass TPC signal in case TracksQA information present - if constexpr (soa::is_table) { - tpcSignalToEvaluatePID = -999.f; - if (indexTrack2TrackQA[trk.globalIndex()] != -1) { - auto trackQA = tracksQA.rawIteratorAt(indexTrack2TrackQA[trk.globalIndex()]); - tpcSignalToEvaluatePID = trackQA.tpcdEdxNorm(); - } - } - //_________________________________________________________ - if (pidTPCopts.savedEdxsCorrected) { // populated cursor if requested or autodetected products.dEdxCorrected(tpcSignalToEvaluatePID); From 3d5a0c52db1c04c0c8fc3c3adb7fe1f1ade87aaf Mon Sep 17 00:00:00 2001 From: jaelpark Date: Thu, 31 Jul 2025 12:37:36 +0200 Subject: [PATCH 157/345] [PWGCF] Add JCorran MC process (#12340) --- PWGCF/JCorran/Core/JFFlucAnalysis.h | 2 +- PWGCF/JCorran/Core/JQVectors.h | 2 +- PWGCF/JCorran/Tasks/jflucAnalysisTask.cxx | 51 +++++++++++++++++------ 3 files changed, 40 insertions(+), 15 deletions(-) diff --git a/PWGCF/JCorran/Core/JFFlucAnalysis.h b/PWGCF/JCorran/Core/JFFlucAnalysis.h index 01589a09849..4900e5c5b62 100644 --- a/PWGCF/JCorran/Core/JFFlucAnalysis.h +++ b/PWGCF/JCorran/Core/JFFlucAnalysis.h @@ -155,7 +155,7 @@ class JFFlucAnalysis : public TNamed Double_t corrInv = 1.0; using JInputClassIter = typename JInputClass::iterator; if constexpr (std::experimental::is_detected::value) - corrInv /= track.weightEff(); + corrInv *= track.weightEff(); if constexpr (std::experimental::is_detected::value) pht[HIST_THN_PTETA]->Fill(fCent, track.pt(), track.eta(), track.sign(), corrInv); else diff --git a/PWGCF/JCorran/Core/JQVectors.h b/PWGCF/JCorran/Core/JQVectors.h index c96aac454b7..01693ae6073 100644 --- a/PWGCF/JCorran/Core/JQVectors.h +++ b/PWGCF/JCorran/Core/JQVectors.h @@ -84,7 +84,7 @@ class JQVectors : public std::conditional_t, JQ if constexpr (std::experimental::is_detected::value) tf /= track.weightNUA(); if constexpr (std::experimental::is_detected::value) - tf /= track.weightEff(); + tf *= track.weightEff(); } } } diff --git a/PWGCF/JCorran/Tasks/jflucAnalysisTask.cxx b/PWGCF/JCorran/Tasks/jflucAnalysisTask.cxx index 6e0ba68d2df..0072f2c2a51 100644 --- a/PWGCF/JCorran/Tasks/jflucAnalysisTask.cxx +++ b/PWGCF/JCorran/Tasks/jflucAnalysisTask.cxx @@ -12,25 +12,27 @@ /// \author Dong Jo Kim (djkim@jyu.fi) /// \since Sep 2022 -#include +#include "Common/Core/TrackSelection.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/TrackSelectionTables.h" -#include "Framework/AnalysisTask.h" #include "Framework/ASoAHelpers.h" -#include "Framework/RunningWorkflowInfo.h" +#include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" - -#include "Common/DataModel/EventSelection.h" -#include "Common/Core/TrackSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/Centrality.h" +#include "Framework/RunningWorkflowInfo.h" #include "ReconstructionDataFormats/V0.h" +#include + // #include "CCDB/BasicCCDBManager.h" -#include "PWGCF/JCorran/DataModel/JCatalyst.h" -#include "PWGCF/DataModel/CorrelationsDerived.h" #include "JFFlucAnalysis.h" #include "JFFlucAnalysisO2Hist.h" + +#include "PWGCF/DataModel/CorrelationsDerived.h" +#include "PWGCF/JCorran/DataModel/JCatalyst.h" + #include "Framework/runDataProcessing.h" using namespace o2; @@ -52,6 +54,7 @@ struct jflucAnalysisTask { O2_DEFINE_CONFIGURABLE(etamax, float, 0.8, "Maximum eta for tracks"); O2_DEFINE_CONFIGURABLE(ptmin, float, 0.2, "Minimum pt for tracks"); O2_DEFINE_CONFIGURABLE(ptmax, float, 5.0, "Maximum pt for tracks"); + O2_DEFINE_CONFIGURABLE(cfgCentBinsForMC, int, 0, "0 = OFF and 1 = ON for data like multiplicity/centrality bins for MC process"); ConfigurableAxis axisMultiplicity{"axisMultiplicity", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 100.1}, "multiplicity / centrality axis for histograms"}; ConfigurableAxis phiAxis{"axisPhi", {50, 0.0, o2::constants::math::TwoPI}, "phi axis for histograms"}; @@ -60,8 +63,9 @@ struct jflucAnalysisTask { ConfigurableAxis ptAxis{"axisPt", {60, 0.0, 300.0}, "pt axis for histograms"}; ConfigurableAxis massAxis{"axisMass", {1, 0.0, 10.0}, "mass axis for histograms"}; - Filter jtrackFilter = (aod::jtrack::pt > ptmin) && (aod::jtrack::pt < ptmax); // eta cuts done by jfluc - Filter cftrackFilter = (aod::cftrack::pt > ptmin) && (aod::cftrack::pt < ptmax); // eta cuts done by jfluc + Filter jtrackFilter = (aod::jtrack::pt > ptmin) && (aod::jtrack::pt < ptmax); // eta cuts done by jfluc + Filter cftrackFilter = (aod::cftrack::pt > ptmin) && (aod::cftrack::pt < ptmax); // eta cuts done by jfluc + Filter cfmcparticleFilter = (aod::cfmcparticle::pt > ptmin) && (aod::cfmcparticle::pt < ptmax) && (aod::cfmcparticle::sign != 0); // eta cuts done by jfluc Filter cf2pFilter = (aod::cf2prongtrack::pt > ptmin) && (aod::cf2prongtrack::pt < ptmax); HistogramRegistry registry{"registry"}; @@ -74,7 +78,7 @@ struct jflucAnalysisTask { auto axisSpecZvt = AxisSpec(zvtAxis); auto axisSpecPt = AxisSpec(ptAxis); auto axisSpecMass = AxisSpec(massAxis); - if (doprocessJDerived || doprocessJDerivedCorrected || doprocessCFDerived || doprocessCFDerivedCorrected) { + if (doprocessJDerived || doprocessJDerivedCorrected || doprocessCFDerived || doprocessCFDerivedCorrected || doprocessMCCFDerived) { pcf = new JFFlucAnalysisO2Hist(registry, axisSpecMult, axisSpecPhi, axisSpecEta, axisSpecZvt, axisSpecPt, axisSpecMass, "jfluc"); pcf->AddFlags(JFFlucAnalysis::kFlucEbEWeighting); pcf->UserCreateOutputObjects(); @@ -166,6 +170,27 @@ struct jflucAnalysisTask { } PROCESS_SWITCH(jflucAnalysisTask, processCF2ProngDerivedCorrected, "Process CF derived data with 2-prongs as POI and charged particles as REF with corrections.", false); + void processMCCFDerived(aod::CFMcCollision const& mcCollision, soa::Filtered const& particles, soa::SmallGroups const& collisions) + { + auto multiplicity = mcCollision.multiplicity(); + if (cfgCentBinsForMC > 0) { + if (collisions.size() == 0) { + return; + } + for (const auto& collision : collisions) { + multiplicity = collision.multiplicity(); + } + } + pcf->Init(); + pcf->SetEventCentrality(multiplicity); + pcf->SetEventVertex(mcCollision.posZ()); + pcf->FillQA(particles); + qvecs.Calculate(particles, etamin, etamax); + pcf->SetJQVectors(&qvecs); + pcf->UserExec(""); + } + PROCESS_SWITCH(jflucAnalysisTask, processMCCFDerived, "Process CF derived MC data", false); + JFFlucAnalysis::JQVectorsT qvecs; JFFlucAnalysis::JQVectorsT qvecsRef; JFFlucAnalysisO2Hist* pcf; From 54bff00f1be565819ff4297e2b1436a1a5edb906 Mon Sep 17 00:00:00 2001 From: Anantha Padmanabhan M Nair <82643666+ananthapadmanabhan18@users.noreply.github.com> Date: Thu, 31 Jul 2025 17:42:20 +0530 Subject: [PATCH 158/345] [PWGUD] Made Events and Track Counter Seperate (#12267) --- PWGUD/Tasks/exclusiveRhoTo4Pi.cxx | 109 ++++++++++++++++++------------ 1 file changed, 64 insertions(+), 45 deletions(-) diff --git a/PWGUD/Tasks/exclusiveRhoTo4Pi.cxx b/PWGUD/Tasks/exclusiveRhoTo4Pi.cxx index 97068a4c9a9..daae60d111c 100644 --- a/PWGUD/Tasks/exclusiveRhoTo4Pi.cxx +++ b/PWGUD/Tasks/exclusiveRhoTo4Pi.cxx @@ -376,7 +376,6 @@ struct ExclusiveRhoTo4Pi { int numPiPlus = 2; int numPiMinus = 2; float zeroPointEight = 0.8; - std::vector trackSelectionParams; // Derived Data Produces sigFromData; Produces bkgFromData; @@ -440,14 +439,14 @@ struct ExclusiveRhoTo4Pi { histosData.add("vertexX", "Vertex X; Vertex X [cm]; Counts", kTH1F, {{2000, -0.05, 0.05}}); histosData.add("vertexY", "Vertex Y; Vertex Y [cm]; Counts", kTH1F, {{2000, -0.05, 0.05}}); histosData.add("vertexZ", "Vertex Z; Vertex Z [cm]; Counts", kTH1F, {{2000, -15, 15}}); - histosData.add("GapSide", "Gap Side;Gap Side; Events", kTH1F, {{4, -1.5, 2.5}}); - histosData.add("TrueGapSide", "True Gap Side; True Gap Side; Events", kTH1F, {{4, -1.5, 2.5}}); + histosData.add("GapSide", "Gap Side;Gap Side; Events", kTH1F, {{4, 0, 4}}); + histosData.add("TrueGapSide", "True Gap Side; True Gap Side; Events", kTH1F, {{4, 0, 4}}); histosData.add("occupancy", "Occupancy; Occupancy; Counts", kTH1F, {{20000, 0, 20000}}); // QA plots: tracks - histosData.add("dcaXY_all", "dcaXY; dcaXY [cm]; Counts", kTH1F, {{5000, -1, 1}}); - histosData.add("dcaXY_pions", "dcaXY_pions; dcaXY of Pions [cm]; Counts", kTH1F, {{5000, -1, 1}}); - histosData.add("dcaZ_all", "dcaZ; dcaZ [cm]; Counts", kTH1F, {{5000, -1, 1}}); - histosData.add("dcaZ_pions", "dcaZ_pions; dcaZ of Pions [cm]; Counts", kTH1F, {{5000, -1, 1}}); + histosData.add("dcaXY_all", "dcaXY; dcaXY [cm]; Counts", kTH1F, {{2000, -0.1, 0.1}}); + histosData.add("dcaXY_pions", "dcaXY_pions; dcaXY of Pions [cm]; Counts", kTH1F, {{2000, -0.1, 0.1}}); + histosData.add("dcaZ_all", "dcaZ; dcaZ [cm]; Counts", kTH1F, {{2000, -0.1, 0.1}}); + histosData.add("dcaZ_pions", "dcaZ_pions; dcaZ of Pions [cm]; Counts", kTH1F, {{2000, -0.1, 0.1}}); histosData.add("itsChi2NCl_all", "ITS Chi2/NCl; Chi2/NCl; Counts", kTH1F, {{250, 0, 50}}); histosData.add("itsChi2_all", "ITS Chi2; ITS Chi2; Counts", kTH1F, {{500, 0, 50}}); histosData.add("tpcChi2NCl_all", "TPC Chi2/NCl; Chi2/NCl; Counts", kTH1F, {{250, 0, 50}}); @@ -904,7 +903,7 @@ struct ExclusiveRhoTo4Pi { } // End of Analysis for non 0 charge events } // End of 4 Pion Analysis Process function for Pass5 Data - void processCounter(UDCollisions::iterator const& collision, UDtracks const& tracks) + void processEventCounter(UDCollisions::iterator const& collision, soa::Filtered const& tracks) { histosCounter.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 0); @@ -977,6 +976,59 @@ struct ExclusiveRhoTo4Pi { std::vector selectedPionPlusTracks; std::vector selectedPionMinusTracks; + for (const auto& t0 : tracks) { + if (!isSelectedTrack(t0, pTcut, etaCut, dcaXYcut, dcaZcut, useITStracksOnly, useTPCtracksOnly, itsChi2NClsCut, tpcChi2NClsCut, tpcNClsFindableCut)) { + continue; + } + if (selectionPIDPion(t0, useTOF, nSigmaTPCcut, nSigmaTOFcut)) { + selectedPionTracks.push_back(t0); + if (t0.sign() == 1) { + selectedPionPlusTracks.push_back(t0); + } + if (t0.sign() == -1) { + selectedPionMinusTracks.push_back(t0); + } + } // End of Selection PID Pion + } // End of loop over tracks + + int numSelectedPionTracks = static_cast(selectedPionTracks.size()); + int numPiPlusTracks = static_cast(selectedPionPlusTracks.size()); + int numPionMinusTracks = static_cast(selectedPionMinusTracks.size()); + // Events with 4 pions + if (numSelectedPionTracks != numFourPionTracks) { + return; + } + histosCounter.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 12); + + // Selecting Events with net charge = 0 + if (numPionMinusTracks == numPiMinus && numPiPlusTracks == numPiPlus) { + histosCounter.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 13); + ROOT::Math::PxPyPzMVector p1(selectedPionPlusTracks[0].px(), selectedPionPlusTracks[0].py(), selectedPionPlusTracks[0].pz(), o2::constants::physics::MassPionCharged); + ROOT::Math::PxPyPzMVector p2(selectedPionPlusTracks[1].px(), selectedPionPlusTracks[1].py(), selectedPionPlusTracks[1].pz(), o2::constants::physics::MassPionCharged); + ROOT::Math::PxPyPzMVector p3(selectedPionMinusTracks[0].px(), selectedPionMinusTracks[0].py(), selectedPionMinusTracks[0].pz(), o2::constants::physics::MassPionCharged); + ROOT::Math::PxPyPzMVector p4(selectedPionMinusTracks[1].px(), selectedPionMinusTracks[1].py(), selectedPionMinusTracks[1].pz(), o2::constants::physics::MassPionCharged); + ROOT::Math::PxPyPzMVector p1234 = p1 + p2 + p3 + p4; + + if ((p1234.Pt() < rhoPtCut) && (std::abs(p1234.Rapidity()) < rhoRapCut)) { + histosCounter.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 14); + if ((rhoMassMin < p1234.M()) && (p1234.M() < rhoMassMax)) { + histosCounter.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 15); + } + } + } // End of Zero Charge Events + + if (numPionMinusTracks != numPiMinus && numPiPlusTracks != numPiPlus) { + histosCounter.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 16); + } // End of Non Zero Charge Events + + } // End of processCounter function + + void processTrackCounter(soa::Filtered::iterator const& collision, UDtracks const& tracks) + { + // Check if the Event is reconstructed in UPC mode + if (ifCheckUPCmode && (collision.flags() != 1)) { + return; + } for (const auto& track : tracks) { histosCounter.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 0); ROOT::Math::PxPyPzMVector trackVector(track.px(), track.py(), track.pz(), o2::constants::physics::MassPionCharged); @@ -1036,52 +1088,19 @@ struct ExclusiveRhoTo4Pi { // Selection PID Pion if (selectionPIDPion(track, useTOF, nSigmaTPCcut, nSigmaTOFcut)) { histosCounter.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 11); - selectedPionTracks.push_back(track); if (track.sign() == 1) { histosCounter.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 12); - selectedPionPlusTracks.push_back(track); } if (track.sign() == -1) { histosCounter.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 13); - selectedPionMinusTracks.push_back(track); } } // End of Selection PID Pion } // End of loop over tracks - - int numSelectedPionTracks = static_cast(selectedPionTracks.size()); - int numPiPlusTracks = static_cast(selectedPionPlusTracks.size()); - int numPionMinusTracks = static_cast(selectedPionMinusTracks.size()); - // Events with 4 pions - if (numSelectedPionTracks != numFourPionTracks) { - return; - } - histosCounter.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 12); - - // Selecting Events with net charge = 0 - if (numPionMinusTracks == numPiMinus && numPiPlusTracks == numPiPlus) { - histosCounter.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 13); - ROOT::Math::PxPyPzMVector p1(selectedPionPlusTracks[0].px(), selectedPionPlusTracks[0].py(), selectedPionPlusTracks[0].pz(), o2::constants::physics::MassPionCharged); - ROOT::Math::PxPyPzMVector p2(selectedPionPlusTracks[1].px(), selectedPionPlusTracks[1].py(), selectedPionPlusTracks[1].pz(), o2::constants::physics::MassPionCharged); - ROOT::Math::PxPyPzMVector p3(selectedPionMinusTracks[0].px(), selectedPionMinusTracks[0].py(), selectedPionMinusTracks[0].pz(), o2::constants::physics::MassPionCharged); - ROOT::Math::PxPyPzMVector p4(selectedPionMinusTracks[1].px(), selectedPionMinusTracks[1].py(), selectedPionMinusTracks[1].pz(), o2::constants::physics::MassPionCharged); - ROOT::Math::PxPyPzMVector p1234 = p1 + p2 + p3 + p4; - - if ((p1234.Pt() < rhoPtCut) && (std::abs(p1234.Rapidity()) < rhoRapCut)) { - histosCounter.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 14); - if ((rhoMassMin < p1234.M()) && (p1234.M() < rhoMassMax)) { - histosCounter.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 15); - } - } - } // End of Zero Charge Events - - if (numPionMinusTracks != numPiMinus && numPiPlusTracks != numPiPlus) { - histosCounter.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 16); - } // End of Non Zero Charge Events - } // End of processCounter function - PROCESS_SWITCH(ExclusiveRhoTo4Pi, processData, "The Process for 4 Pion Analysis from data", true); - PROCESS_SWITCH(ExclusiveRhoTo4Pi, processCounter, "The Process for 4 Pion Analysis from data", true); + PROCESS_SWITCH(ExclusiveRhoTo4Pi, processData, "Data Analysis Function", true); + PROCESS_SWITCH(ExclusiveRhoTo4Pi, processEventCounter, "Event Counter Function", true); + PROCESS_SWITCH(ExclusiveRhoTo4Pi, processTrackCounter, "Track Counter Function", true); double cosThetaCollinsSoperFrame(ROOT::Math::PtEtaPhiMVector pair1, ROOT::Math::PtEtaPhiMVector pair2, ROOT::Math::PtEtaPhiMVector fourpion) { @@ -1143,7 +1162,6 @@ struct ExclusiveRhoTo4Pi { float tpcchi2nclscut, float tpcnclsfindablecut) { - ROOT::Math::PxPyPzMVector trackVector(track.px(), track.py(), track.pz(), o2::constants::physics::MassPionCharged); // pt cut if (trackVector.Pt() < ptcut) { @@ -1187,6 +1205,7 @@ struct ExclusiveRhoTo4Pi { // All cuts passed return true; } // End of Track Selection function + }; // End of Struct exclusiveRhoTo4Pi WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 19a262775bf5db3eda83df24975356829e0fd1aa Mon Sep 17 00:00:00 2001 From: Sandeep Dudi <69388148+sdudi123@users.noreply.github.com> Date: Thu, 31 Jul 2025 14:13:05 +0200 Subject: [PATCH 159/345] [PWGUD] memory issue resolve (#12292) Co-authored-by: sandeep dudi --- PWGUD/Tasks/sginclusivePhiKstarSD.cxx | 53 ++++++++++++++++----------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/PWGUD/Tasks/sginclusivePhiKstarSD.cxx b/PWGUD/Tasks/sginclusivePhiKstarSD.cxx index dad2b4d7a7d..4e139f0b763 100644 --- a/PWGUD/Tasks/sginclusivePhiKstarSD.cxx +++ b/PWGUD/Tasks/sginclusivePhiKstarSD.cxx @@ -104,6 +104,7 @@ struct SginclusivePhiKstarSD { Configurable qa{"qa", true, ""}; Configurable rapidityGap{"rapidityGap", true, ""}; + Configurable exclusive{"exclusive", false, "for double gap side "}; Configurable phi{"phi", true, ""}; Configurable rho{"rho", true, ""}; @@ -124,9 +125,10 @@ struct SginclusivePhiKstarSD { // Configurable axes for histogram ConfigurableAxis dcaAxisConfig{"dcaAxisConfig", {600, -0.3f, 0.3f}, "DCAxy & DCAz axis"}; ConfigurableAxis etaAxisConfig{"etaAxisConfig", {400, -1.0f, 1.0f}, "Pseudorapidity & Rapidity axis"}; - ConfigurableAxis VrtxXAxisConfig{"VrtxXAxisConfig", {400, -0.1f, 0.1f}, "Vertex X axis"}; - ConfigurableAxis VrtxYAxisConfig{"VrtxYAxisConfig", {200, -0.05f, 0.05f}, "Vertex Y axis"}; - ConfigurableAxis VrtxZAxisConfig{"VrtxZAxisConfig", {600, -15.0f, 15.0f}, "Vertex Z axis"}; + ConfigurableAxis vrtxXAxisConfig{"vrtxXAxisConfig", {400, -0.1f, 0.1f}, "Vertex X axis"}; + ConfigurableAxis vrtxYAxisConfig{"vrtxYAxisConfig", {200, -0.05f, 0.05f}, "Vertex Y axis"}; + ConfigurableAxis vrtxZAxisConfig{"vrtxZAxisConfig", {600, -15.0f, 15.0f}, "Vertex Z axis"}; + // ConfigurableAxis VrtxZAxisConfig{"VrtxZAxisConfig", {600, -15.0f, 15.0f}, "Vertex Z axis"}; void init(InitContext const& context) { @@ -135,9 +137,9 @@ struct SginclusivePhiKstarSD { AxisSpec dcazAxis = {dcaAxisConfig, "DCAz (cm)"}; AxisSpec etaAxis = {etaAxisConfig, "#eta"}; AxisSpec rapAxis = {etaAxisConfig, "y"}; - AxisSpec VrtxXAxis = {VrtxXAxisConfig, "Vertex X (cm)"}; - AxisSpec VrtxYAxis = {VrtxYAxisConfig, "Vertex Y (cm)"}; - AxisSpec VrtxZAxis = {VrtxZAxisConfig, "Vertex Z (cm)"}; + AxisSpec VrtxXAxis = {vrtxXAxisConfig, "Vertex X (cm)"}; + AxisSpec VrtxYAxis = {vrtxYAxisConfig, "Vertex Y (cm)"}; + AxisSpec VrtxZAxis = {vrtxZAxisConfig, "Vertex Z (cm)"}; registry.add("GapSide", "Gap Side; Entries", kTH1F, {{4, -1.5, 2.5}}); registry.add("TrueGapSide", "Gap Side; Entries", kTH1F, {{4, -1.5, 2.5}}); @@ -251,9 +253,6 @@ struct SginclusivePhiKstarSD { registry.add("hRap_ka", "Rapidity of selected Kaons; y; Counts", kTH1F, {rapAxis}); if (rapidityGap) { - registry.add("mult_0", "mult0", kTH1F, {{150, 0, 150}}); - registry.add("mult_1", "mult1", kTH1F, {{150, 0, 150}}); - registry.add("mult_2", "mult2", kTH1F, {{150, 0, 150}}); registry.add("event_rap_gap", "rap_gap", kTH1F, {{15, 0, 15.0}}); registry.add("rap_mult1", "rap_mult1", kTH1F, {{150, 0, 150}}); registry.add("rap_mult2", "rap_mult2", kTH1F, {{150, 0, 150}}); @@ -270,6 +269,10 @@ struct SginclusivePhiKstarSD { registry.add("gap_mult1", "Mult 1", kTH1F, {{100, 0.0, 100.0}}); registry.add("gap_mult2", "Mult 2", kTH1F, {{100, 0.0, 100.0}}); + registry.add("mult_0", "mult0", kTH1F, {{150, 0, 150}}); + registry.add("mult_1", "mult1", kTH1F, {{150, 0, 150}}); + registry.add("mult_2", "mult2", kTH1F, {{150, 0, 150}}); + // Multiplicity plot if (rapidityGap && phi) { registry.add("os_kk_mass_rap", "phi mass1", kTH3F, {{220, 0.98, 1.2}, {80, -2.0, 2.0}, {100, 0, 10}}); @@ -761,6 +764,15 @@ struct SginclusivePhiKstarSD { } } } + if (gapSide == 0) { + registry.fill(HIST("mult_0"), mult0); + } + if (gapSide == 1) { + registry.fill(HIST("mult_1"), mult1); + } + if (gapSide == 2) { + registry.fill(HIST("mult_2"), mult2); + } if (qa) { if (gapSide == 0) { registry.fill(HIST("V0A_0"), collision.totalFV0AmplitudeA()); @@ -768,7 +780,6 @@ struct SginclusivePhiKstarSD { registry.fill(HIST("FT0C_0"), collision.totalFT0AmplitudeC()); registry.fill(HIST("ZDC_A_0"), collision.energyCommonZNA()); registry.fill(HIST("ZDC_C_0"), collision.energyCommonZNC()); - registry.fill(HIST("mult_0"), mult0); } if (gapSide == 1) { registry.fill(HIST("V0A_1"), collision.totalFV0AmplitudeA()); @@ -776,7 +787,6 @@ struct SginclusivePhiKstarSD { registry.fill(HIST("FT0C_1"), collision.totalFT0AmplitudeC()); registry.fill(HIST("ZDC_A_1"), collision.energyCommonZNA()); registry.fill(HIST("ZDC_C_1"), collision.energyCommonZNC()); - registry.fill(HIST("mult_1"), mult1); } if (gapSide == 2) { registry.fill(HIST("V0A"), collision.totalFV0AmplitudeA()); @@ -784,7 +794,6 @@ struct SginclusivePhiKstarSD { registry.fill(HIST("FT0C"), collision.totalFT0AmplitudeC()); registry.fill(HIST("ZDC_A"), collision.energyCommonZNA()); registry.fill(HIST("ZDC_C"), collision.energyCommonZNC()); - registry.fill(HIST("mult_2"), mult2); } if (rapidityGap) { if (trackgapC > 0 && trackgapA == 0 && trackextra == 0) { @@ -1063,7 +1072,7 @@ struct SginclusivePhiKstarSD { if (gapSide == 1) { registry.fill(HIST("os_KK_pT_1"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (gapSide == 2) { + if (exclusive && gapSide == 2 && mult2 == 2) { registry.fill(HIST("os_KK_pT_2"), v01.M(), v01.Rapidity(), v01.Pt()); } } @@ -1075,7 +1084,7 @@ struct SginclusivePhiKstarSD { if (gapSide == 1) { registry.fill(HIST("os_KK_ls_pT_1"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (gapSide == 2) { + if (exclusive && gapSide == 2 && mult2 == 2) { registry.fill(HIST("os_KK_ls_pT_2"), v01.M(), v01.Rapidity(), v01.Pt()); } } @@ -1101,7 +1110,7 @@ struct SginclusivePhiKstarSD { if (gapSide == 1) { registry.fill(HIST("os_KK_rot_pT_1"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (gapSide == 2) { + if (exclusive && gapSide == 2 && mult2 == 2) { registry.fill(HIST("os_KK_rot_pT_2"), v01.M(), v01.Rapidity(), v01.Pt()); } } @@ -1114,9 +1123,9 @@ struct SginclusivePhiKstarSD { continue; if (t0.globalIndex() == t1.globalIndex()) continue; - if (rho && selectionPIDProton(t0, useTof, nsigmaTpcCut, nsigmaTofCut) && selectionPIDPion1(t1)) { + if (rho && selectionPIDProton(t0, useTof, nsigmaTpcCut, nsigmaTofCut) && selectionPIDKaon1(t1)) { v0.SetCoordinates(t0.px(), t0.py(), t0.pz(), o2::constants::physics::MassProton); - v1.SetCoordinates(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassPionCharged); + v1.SetCoordinates(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassKaonCharged); v01 = v0 + v1; // Opposite sign pairs if (t0.sign() != t1.sign()) { @@ -1126,7 +1135,7 @@ struct SginclusivePhiKstarSD { if (gapSide == 1) { registry.fill(HIST("os_pp_pT_1"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (gapSide == 2) { + if (exclusive && gapSide == 2 && mult2 == 2) { registry.fill(HIST("os_pp_pT_2"), v01.M(), v01.Rapidity(), v01.Pt()); } } // same sign pair @@ -1137,7 +1146,7 @@ struct SginclusivePhiKstarSD { if (gapSide == 1) { registry.fill(HIST("os_pp_ls_pT_1"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (gapSide == 2) { + if (exclusive && gapSide == 2 && mult2 == 2) { registry.fill(HIST("os_pp_ls_pT_2"), v01.M(), v01.Rapidity(), v01.Pt()); } } @@ -1156,7 +1165,7 @@ struct SginclusivePhiKstarSD { if (gapSide == 1) { registry.fill(HIST("os_pk_pT_1"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (gapSide == 2) { + if (exclusive && gapSide == 2 && mult2 == 2) { registry.fill(HIST("os_pk_pT_2"), v01.M(), v01.Rapidity(), v01.Pt()); } } // same sign pair @@ -1167,7 +1176,7 @@ struct SginclusivePhiKstarSD { if (gapSide == 1) { registry.fill(HIST("os_pk_ls_pT_1"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (gapSide == 2) { + if (exclusive && gapSide == 2 && mult2 == 2) { registry.fill(HIST("os_pk_ls_pT_2"), v01.M(), v01.Rapidity(), v01.Pt()); } } @@ -1192,7 +1201,7 @@ struct SginclusivePhiKstarSD { if (gapSide == 1) { registry.fill(HIST("os_pk_rot_pT_1"), v01.M(), v01.Rapidity(), v01.Pt()); } - if (gapSide == 2) { + if (exclusive && gapSide == 2 && mult2 == 2) { registry.fill(HIST("os_pk_rot_pT_2"), v01.M(), v01.Rapidity(), v01.Pt()); } } From b086b5aafaf59b765a892fa44d4babd86675c8f7 Mon Sep 17 00:00:00 2001 From: CesarOmarRA <35703156+CesarOmarRA@users.noreply.github.com> Date: Thu, 31 Jul 2025 14:13:53 +0200 Subject: [PATCH 160/345] [PWGUD] Rho prime to 4 pi (#12305) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Nicolò Jacazio Co-authored-by: Daiki Sekihata Co-authored-by: Shirajum Monira <38348689+Eloviyo@users.noreply.github.com> Co-authored-by: Shirajum Monira Co-authored-by: yuanzhe <90246048+wang-yuanzhe@users.noreply.github.com> Co-authored-by: ddobrigk Co-authored-by: ALICE Builder Co-authored-by: Fabrizio Co-authored-by: MaolinZH <109225729+MaolinZH@users.noreply.github.com> Co-authored-by: Vít Kučera Co-authored-by: Paola Vargas Torres <88360333+PaolaVT@users.noreply.github.com> Co-authored-by: mherzer <96999709+mherzer28@users.noreply.github.com> Co-authored-by: ALICE Action Bot Co-authored-by: BiaoZhang (张彪) <52267892+zhangbiao-phy@users.noreply.github.com> Co-authored-by: JStaa <39123272+JStaa@users.noreply.github.com> Co-authored-by: Noor Koster <82090643+cnkoster@users.noreply.github.com> Co-authored-by: Yash Patley <52608802+yashpatley@users.noreply.github.com> Co-authored-by: glromane <95305986+glromane@users.noreply.github.com> Co-authored-by: Rahul Verma <110929992+rahulverma012@users.noreply.github.com> Co-authored-by: Anton Alkin Co-authored-by: skundu692 <86804743+skundu692@users.noreply.github.com> Co-authored-by: Zhiyong <71517277+Luzhiyongg@users.noreply.github.com> Co-authored-by: Dawid Karpiński <40724893+davkk@users.noreply.github.com> Co-authored-by: Evgeny Kryshen Co-authored-by: Jesper Gumprecht <113693781+jesgum@users.noreply.github.com> Co-authored-by: Zhenjun Xiong <108917659+zjxiongOvO@users.noreply.github.com> Co-authored-by: Marvin Hemmer <53471402+mhemmer-cern@users.noreply.github.com> Co-authored-by: Florian Jonas Co-authored-by: altsybee Co-authored-by: Md Samsul Islam <56156956+mislam17@users.noreply.github.com> Co-authored-by: ariedel-cern <85537041+ariedel-cern@users.noreply.github.com> Co-authored-by: Kangkan Goswami Co-authored-by: Stefano Cannito <143754257+scannito@users.noreply.github.com> Co-authored-by: suyoupeng <109774812+15071832337@users.noreply.github.com> Co-authored-by: Francesco Mazzaschi <43742195+fmazzasc@users.noreply.github.com> Co-authored-by: Francesco Mazzaschi Co-authored-by: Fabio Colamaria Co-authored-by: fcolamar Co-authored-by: sashingo Co-authored-by: yhambard <127940767+yhambard@users.noreply.github.com> Co-authored-by: FDUEnrich <23210190047@m.fudan.edu.cn> Co-authored-by: EmilGorm <50658075+EmilGorm@users.noreply.github.com> Co-authored-by: aimeric-landou <46970521+aimeric-landou@users.noreply.github.com> Co-authored-by: Dongguk Kim <157434406+DonggukKim0@users.noreply.github.com> Co-authored-by: hernasab Co-authored-by: Sabrina Hernandez Co-authored-by: Ionut Cristian Arsene Co-authored-by: Ionut Cristian Arsene Co-authored-by: Peter Stratmann <80676312+pestratm@users.noreply.github.com> Co-authored-by: Debadatta3337 Co-authored-by: Debadatta3337 Co-authored-by: Josué Martínez García Co-authored-by: Gyula Bencedi Co-authored-by: Anisa Khatun Co-authored-by: akhatun Co-authored-by: dajones2 <140733426+dajones2@users.noreply.github.com> Co-authored-by: chengtt0406 <39661669+chengtt0406@users.noreply.github.com> Co-authored-by: Lars <146946151+ljoergen@users.noreply.github.com> Co-authored-by: Mario Ciacco Co-authored-by: omvazque Co-authored-by: Rik Spijkers <78484875+rspijkers@users.noreply.github.com> Co-authored-by: mhartung71 <50153519+mhartung71@users.noreply.github.com> Co-authored-by: Maximiliano Puccio Co-authored-by: Anantha Padmanabhan M Nair <82643666+ananthapadmanabhan18@users.noreply.github.com> Co-authored-by: Luca Aglietta <75362880+Luca610@users.noreply.github.com> Co-authored-by: Tao_Fang <52570362+Tao-Fang@users.noreply.github.com> Co-authored-by: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Co-authored-by: Paul Veen (paveen) <80593165+ppoava@users.noreply.github.com> Co-authored-by: GijsvWeelden <55794847+GijsvWeelden@users.noreply.github.com> Co-authored-by: Archita-Dash <91664849+Archita-Dash@users.noreply.github.com> Co-authored-by: Jerome Jung Co-authored-by: Roman Lietava Co-authored-by: Lucia Anna Tarasovicova Co-authored-by: Lucia Anna Tarasovicova Co-authored-by: lmattei01 <122298453+lmattei01@users.noreply.github.com> Co-authored-by: MATTEI Co-authored-by: Kaare Endrup Iversen <69893472+kaareendrup@users.noreply.github.com> Co-authored-by: Thorkj <154221526+Thorkj@users.noreply.github.com> Co-authored-by: Mingyu Zhang <83645570+Mingyu3360715@users.noreply.github.com> Co-authored-by: Sigurd Nese <32108009+sigurdnese@users.noreply.github.com> Co-authored-by: Samuele Cattaruzzi <124249902+scattaru@users.noreply.github.com> Co-authored-by: cterrevo Co-authored-by: Fabrizio Chinu <91954233+fchinu@users.noreply.github.com> Co-authored-by: Sergio Garcia <47090312+singiamtel@users.noreply.github.com> Co-authored-by: Ravindra Singh <56298081+singhra1994@users.noreply.github.com> Co-authored-by: blacwovie Co-authored-by: a-m-andrushko <96832230+a-m-andrushko@users.noreply.github.com> Co-authored-by: Pritam Chakraborty <47203359+prchakra@users.noreply.github.com> Co-authored-by: Nida Malik Co-authored-by: Hirak Koley Co-authored-by: sarjeetagami <162087855+sarjeetagami@users.noreply.github.com> Co-authored-by: sarjeeta gami Co-authored-by: basiach <74355517+basiach@users.noreply.github.com> Co-authored-by: Barbara Chytla Co-authored-by: Shyam Kumar Co-authored-by: Oleksii Lubynets Co-authored-by: Zhengqing Wang Co-authored-by: Rrantu <156880782+Rrantu@users.noreply.github.com> Co-authored-by: Felix Schlepper Co-authored-by: Sandeep Dudi <69388148+sdudi123@users.noreply.github.com> Co-authored-by: sandeep dudi Co-authored-by: prottayCMT <61418725+prottayCMT@users.noreply.github.com> Co-authored-by: Prottay Das Co-authored-by: Simone Ragoni <47641042+siragoni@users.noreply.github.com> Co-authored-by: creetz16 <79141119+creetz16@users.noreply.github.com> Co-authored-by: ynishida-style Co-authored-by: spucillo <93769017+spucillo@users.noreply.github.com> Co-authored-by: Javier Castillo Castellanos Co-authored-by: marcobianchi463 <121625445+marcobianchi463@users.noreply.github.com> Co-authored-by: Artem Kotliarov <71133985+KotliarovAr@users.noreply.github.com> Co-authored-by: Preet-Bhanjan Co-authored-by: Preet Pati Co-authored-by: romainschotter Co-authored-by: jaelpark Co-authored-by: Francesca Ercolessi Co-authored-by: YubiaoWang Co-authored-by: Rashi gupta <167059733+rashigupt@users.noreply.github.com> Co-authored-by: Rashi Gupta Co-authored-by: dyx-11 <1260971129@qq.com> Co-authored-by: Banajit Barman <113376372+BanajitBarman@users.noreply.github.com> Co-authored-by: fuchuncui <162277233+fuchuncui@users.noreply.github.com> Co-authored-by: sawan <124118453+sawankumawat@users.noreply.github.com> Co-authored-by: Sawan Sawan --- PWGUD/Tasks/upcRhoPrimeAnalysis.cxx | 53 ++++++++++++++++------------- 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/PWGUD/Tasks/upcRhoPrimeAnalysis.cxx b/PWGUD/Tasks/upcRhoPrimeAnalysis.cxx index d4048806854..49b6e478674 100644 --- a/PWGUD/Tasks/upcRhoPrimeAnalysis.cxx +++ b/PWGUD/Tasks/upcRhoPrimeAnalysis.cxx @@ -12,26 +12,26 @@ /// \brief Task for analysis of rho' in UPCs using UD tables (from SG producer). /// \author Cesar Ramirez, cesar.ramirez@cern.ch -#include // Para std::string -#include // Para std::vector +#include "PWGUD/Core/UPCTauCentralBarrelHelperRL.h" +#include "PWGUD/DataModel/UDTables.h" + +#include "Common/DataModel/PIDResponse.h" -#include "Framework/AnalysisTask.h" #include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" #include "Math/Vector4D.h" // similiar to TLorentzVector (which is now legacy apparently) -#include -#include "Common/DataModel/PIDResponse.h" - -#include "PWGUD/DataModel/UDTables.h" -#include "PWGUD/Core/UPCTauCentralBarrelHelperRL.h" +#include "random" +#include // Para std::string +#include // Para std::vector using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; -using FullUDSgCollision = soa::Join::iterator; +using FullUDSgCollision = soa::Join::iterator; using FullUDTracks = soa::Join; namespace o2::aod @@ -86,6 +86,10 @@ DECLARE_SOA_COLUMN(TimeZNA, timeZNA, float); DECLARE_SOA_COLUMN(TimeZNC, timeZNC, float); DECLARE_SOA_COLUMN(EnergyCommonZNA, energyCommonZNA, float); DECLARE_SOA_COLUMN(EnergyCommonZNC, energyCommonZNC, float); +DECLARE_SOA_COLUMN(IsChargeZero, isChargeZero, bool); + +DECLARE_SOA_COLUMN(OccupancyInTime, occupancyInTime, int); +DECLARE_SOA_COLUMN(HadronicRate, hadronicRate, double); } // namespace fourpi @@ -94,7 +98,7 @@ DECLARE_SOA_TABLE(SYSTEMTREE, "AOD", "SystemTree", fourpi::RunNumber, fourpi::M, fourpi::TotalFDDAmplitudeA, fourpi::TotalFDDAmplitudeC, fourpi::TimeFT0A, fourpi::TimeFT0C, fourpi::TimeFV0A, fourpi::TimeFDDA, fourpi::TimeFDDC, fourpi::NumContrib, fourpi::Sign, fourpi::TrackPt, fourpi::TrackEta, fourpi::TrackPhi, fourpi::TPCNSigmaEl, fourpi::TPCNSigmaPi, fourpi::TPCNSigmaKa, fourpi::TPCNSigmaPr, fourpi::TrackID, fourpi::IsReconstructedWithUPC, - fourpi::TimeZNA, fourpi::TimeZNC, fourpi::EnergyCommonZNA, fourpi::EnergyCommonZNC); + fourpi::TimeZNA, fourpi::TimeZNC, fourpi::EnergyCommonZNA, fourpi::EnergyCommonZNC, fourpi::IsChargeZero, fourpi::OccupancyInTime, fourpi::HadronicRate); } // namespace o2::aod struct upcRhoPrimeAnalysis { @@ -113,8 +117,8 @@ struct upcRhoPrimeAnalysis { Configurable tracksTpcNSigmaPiCut{"tracksTpcNSigmaPiCut", 3.0, "TPC nSigma pion cut"}; Configurable tracksDcaMaxCut{"tracksDcaMaxCut", 1.0, "max DCA cut on tracks"}; - Configurable systemMassMinCut{"systemMassMinCut", 0.5, "min M cut for reco system"}; - Configurable systemMassMaxCut{"systemMassMaxCut", 1.2, "max M cut for reco system"}; + Configurable systemMassMinCut{"systemMassMinCut", 0.8, "min M cut for reco system"}; + Configurable systemMassMaxCut{"systemMassMaxCut", 2.2, "max M cut for reco system"}; Configurable systemPtCut{"systemPtMaxCut", 0.1, "max pT cut for reco system"}; Configurable systemYCut{"systemYCut", 0.9, "rapiditiy cut for reco system"}; @@ -278,14 +282,14 @@ struct upcRhoPrimeAnalysis { double rapidity = system.Rapidity(); double systemPhi = system.Phi() + o2::constants::math::PI; - if (nTracks == 4 && tracksTotalCharge(cutTracks) == 0) { // 4pi system + if (nTracks == 4) { + bool isChargeZero = (tracksTotalCharge(cutTracks) == 0); std::vector vTrackPt, vTrackEta, vTrackPhi; std::vector vSign, vTrackID; std::vector vTpcNSigmaEl, vTpcNSigmaPi, vTpcNSigmaKa, vTpcNSigmaPr; for (size_t i = 0; i < cutTracks.size(); i++) { - double tPt = cutTracks[i].pt(); double tEta = eta(cutTracks[i].px(), cutTracks[i].py(), cutTracks[i].pz()); double tPhi = phi(cutTracks[i].px(), cutTracks[i].py()); @@ -310,16 +314,17 @@ struct upcRhoPrimeAnalysis { isReconstructedWithUPC = false; } - systemTree(collision.runNumber(), mass, pT, rapidity, systemPhi, collision.posX(), collision.posY(), collision.posZ(), totalCharge, - collision.totalFT0AmplitudeA(), collision.totalFT0AmplitudeC(), collision.timeFV0A(), collision.totalFDDAmplitudeA(), collision.totalFDDAmplitudeC(), - collision.timeFT0A(), collision.timeFT0C(), collision.timeFV0A(), collision.timeFDDA(), collision.timeFDDC(), - collision.numContrib(), vSign, vTrackPt, vTrackEta, vTrackPhi, vTpcNSigmaEl, vTpcNSigmaPi, vTpcNSigmaKa, vTpcNSigmaPr, vTrackID, isReconstructedWithUPC, - collision.timeZNA(), collision.timeZNC(), collision.energyCommonZNA(), collision.energyCommonZNC()); - - // registry.fill(HIST("4pi/hM"), mass); - // registry.fill(HIST("4pi/hPt"), pT); - // registry.fill(HIST("4pi/hEta"), rapiditiy); - // registry.fill(HIST("4pi/hPhi"), system); + systemTree(collision.runNumber(), mass, pT, rapidity, systemPhi, + collision.posX(), collision.posY(), collision.posZ(), totalCharge, + collision.totalFT0AmplitudeA(), collision.totalFT0AmplitudeC(), collision.timeFV0A(), + collision.totalFDDAmplitudeA(), collision.totalFDDAmplitudeC(), + collision.timeFT0A(), collision.timeFT0C(), collision.timeFV0A(), + collision.timeFDDA(), collision.timeFDDC(), collision.numContrib(), + vSign, vTrackPt, vTrackEta, vTrackPhi, + vTpcNSigmaEl, vTpcNSigmaPi, vTpcNSigmaKa, vTpcNSigmaPr, + vTrackID, isReconstructedWithUPC, collision.timeZNA(), collision.timeZNC(), + collision.energyCommonZNA(), collision.energyCommonZNC(), + isChargeZero, collision.occupancyInTime(), collision.hadronicRate()); } // std::cout<<"Hello World"< Date: Thu, 31 Jul 2025 19:21:03 +0530 Subject: [PATCH 161/345] [PWGLF] Minor correction in defining histogram (#12345) --- PWGLF/Tasks/Resonances/kstarqa.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarqa.cxx b/PWGLF/Tasks/Resonances/kstarqa.cxx index f356e53d4ab..22759156f77 100644 --- a/PWGLF/Tasks/Resonances/kstarqa.cxx +++ b/PWGLF/Tasks/Resonances/kstarqa.cxx @@ -289,9 +289,9 @@ struct Kstarqa { hInvMass.add("hAllGenCollisions1Rec", "All gen events with at least one rec event", kTH1F, {multiplicityAxis}); hInvMass.add("hAllKstarGenCollisisons", "All generated Kstar in events with rapidity in 0.5", kTH2F, {{multiplicityAxis}, {ptAxis}}); hInvMass.add("hAllKstarGenCollisisons1Rec", "All generated Kstar in events with at least one rec event in rapidity in 0.5", kTH2F, {{multiplicityAxis}, {ptAxis}}); - hInvMass.add("hAllRecCollisions", "All reconstructed events", kTH2F, {{multiplicityAxis}}); - hInvMass.add("MCcorrections/hImpactParameterRec", "Impact parameter in reconstructed MC", kTH1F, {{impactParAxis}}); - hInvMass.add("MCcorrections/hImpactParameterGen", "Impact parameter in generated MC", kTH1F, {{impactParAxis}}); + hInvMass.add("hAllRecCollisions", "All reconstructed events", kTH1F, {multiplicityAxis}); + hInvMass.add("MCcorrections/hImpactParameterRec", "Impact parameter in reconstructed MC", kTH1F, {impactParAxis}); + hInvMass.add("MCcorrections/hImpactParameterGen", "Impact parameter in generated MC", kTH1F, {impactParAxis}); hInvMass.add("MCcorrections/hImpactParametervsMultiplicity", "Impact parameter vs multiplicity in reconstructed MC", kTH1F, {{impactParAxis}, {multiplicityAxis}}); rEventSelection.add("tracksCheckData", "No. of events in the data", kTH1I, {{10, 0, 10}}); rEventSelection.add("eventsCheckGen", "No. of events in the generated MC", kTH1I, {{10, 0, 10}}); From 7191f633c9463e8bd82ff6a9a2124b2b9d7dfd75 Mon Sep 17 00:00:00 2001 From: GijsvWeelden <55794847+GijsvWeelden@users.noreply.github.com> Date: Thu, 31 Jul 2025 15:53:33 +0200 Subject: [PATCH 162/345] [PWGJE] Jet Fragmentation & V0 QA (#12344) --- PWGJE/Tasks/jetFragmentation.cxx | 87 ++++++++++++++++++++++++-------- PWGJE/Tasks/v0QA.cxx | 83 ++++++++++++++++++++---------- 2 files changed, 123 insertions(+), 47 deletions(-) diff --git a/PWGJE/Tasks/jetFragmentation.cxx b/PWGJE/Tasks/jetFragmentation.cxx index ce9bfa6fcb0..5a6104ad872 100644 --- a/PWGJE/Tasks/jetFragmentation.cxx +++ b/PWGJE/Tasks/jetFragmentation.cxx @@ -90,9 +90,9 @@ struct JetFragmentation { Configurable> ptBinsAntiLambda{"ptBinsAntiLambda", {0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 10.0, 15.0, 20.0, 25.0}, "AntiLambda pt Vals"}; // NB: these must be one shorter than ptbin vectors! - Configurable> purityK0S{"purityK0S", {0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9}, "K0S purity per pt bin"}; - Configurable> purityLambda{"purityLambda", {0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9}, "Lambda purity per pt bin"}; - Configurable> purityAntiLambda{"purityAntiLambda", {0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9}, "AntiLambda purity per pt bin"}; + Configurable> signalProbK0S{"signalProbK0S", {0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9}, "K0S signal probability per pt bin"}; + Configurable> signalProbLambda{"signalProbLambda", {0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9}, "Lambda signal probability per pt bin"}; + Configurable> signalProbAntiLambda{"signalProbAntiLambda", {0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9}, "AntiLambda signal probability per pt bin"}; Configurable vertexZCut{"vertexZCut", 10.f, "vertex z cut"}; Configurable v0EtaMin{"v0EtaMin", -0.75, "minimum data V0 eta"}; @@ -786,8 +786,15 @@ struct JetFragmentation { registry.add("matching/jets/V0/missJetPtV0TrackProj", "Misses", HistType::kTH2D, {partJetPtAxis, partZAxis}, true); // Matching - Matched K0S - registry.add("matching/jets/V0/matchDetJetPtK0STrackProjPartJetPtK0STrackProj", "Matched", HistType::kTHnSparseD, {detJetPtAxis, detZAxis, partJetPtAxis, partZAxis}, true); - registry.add("matching/jets/V0/partJetPtK0SPtDetJetPtK0SPt", "matched jet Pt, K_{S}^{0} Pt", HistType::kTHnSparseD, {partJetPtAxis, v0PtAxis, detJetPtAxis, v0PtAxis}, true); + registry.add("matching/jets/V0/partJetPtK0SPtDetJetPtK0SPt", "Matched Pt and pt", HistType::kTHnSparseD, {partJetPtAxis, v0PtAxis, detJetPtAxis, v0PtAxis}, true); + registry.add("matching/jets/V0/partJetPtK0STrackProjDetJetPtK0STrackProj", "Matched pt and z", HistType::kTHnSparseD, {partJetPtAxis, partZAxis, detJetPtAxis, detZAxis}, true); + + registry.add("matching/jets/V0/partJetPtK0SPtDetJetPtK0SPtRightCollision", "Matched Pt, right collision", HistType::kTHnSparseD, {partJetPtAxis, v0PtAxis, detJetPtAxis, v0PtAxis}, true); + registry.add("matching/jets/V0/partJetPtK0STrackProjDetJetPtK0STrackProjRightCollision", "Matched pt and z, right collision", HistType::kTHnSparseD, {partJetPtAxis, partZAxis, detJetPtAxis, detZAxis}, true); + + registry.add("matching/jets/V0/partJetPtK0SPtDetJetPtK0SPtWrongCollision", "Matched Pt, wrong collision", HistType::kTHnSparseD, {partJetPtAxis, v0PtAxis, detJetPtAxis, v0PtAxis}, true); + registry.add("matching/jets/V0/partJetPtK0STrackProjDetJetPtK0STrackProjWrongCollision", "Matched pt and z, wrong collision", HistType::kTHnSparseD, {partJetPtAxis, partZAxis, detJetPtAxis, detZAxis}, true); + // Matching - Matched K0S: pt registry.add("matching/jets/V0/partJetPtK0SPtDetJetPtK0SPtCtauLambda", "matched jet Pt, K^{0}_{S} Pt, Ctau #Lambda^{0}", HistType::kTHnSparseD, {partJetPtAxis, v0PtAxis, detJetPtAxis, v0PtAxis, v0CtauAxis}, true); registry.add("matching/jets/V0/partJetPtK0SPtDetJetPtK0SPtCtauAntiLambda", "matched jet Pt, K^{0}_{S} Pt, Ctau #bar{#Lambda}^{0}", HistType::kTHnSparseD, {partJetPtAxis, v0PtAxis, detJetPtAxis, v0PtAxis, v0CtauAxis}, true); @@ -833,8 +840,15 @@ struct JetFragmentation { registry.add("matching/jets/V0/missJetPtK0STrackProj", "Misses", HistType::kTH2D, {partJetPtAxis, partZAxis}, true); // Matching - Matched Lambda - registry.add("matching/jets/V0/matchDetJetPtLambdaTrackProjPartJetPtLambdaTrackProj", "Matched", HistType::kTHnSparseD, {detJetPtAxis, detZAxis, partJetPtAxis, partZAxis}, true); - registry.add("matching/jets/V0/partJetPtLambdaPtDetJetPtLambdaPt", "matched jet Pt, #Lambda^{0} Pt", HistType::kTHnSparseD, {partJetPtAxis, v0PtAxis, detJetPtAxis, v0PtAxis}, true); + registry.add("matching/jets/V0/partJetPtLambdaPtDetJetPtLambdaPt", "matched Pt", HistType::kTHnSparseD, {partJetPtAxis, v0PtAxis, detJetPtAxis, v0PtAxis}, true); + registry.add("matching/jets/V0/partJetPtLambdaTrackProjDetJetPtLambdaTrackProj", "Matched pt and z", HistType::kTHnSparseD, {partJetPtAxis, partZAxis, detJetPtAxis, detZAxis}, true); + + registry.add("matching/jets/V0/partJetPtLambdaPtDetJetPtLambdaPtRightCollision", "matched Pt, right collision", HistType::kTHnSparseD, {partJetPtAxis, v0PtAxis, detJetPtAxis, v0PtAxis}, true); + registry.add("matching/jets/V0/partJetPtLambdaTrackProjDetJetPtLambdaTrackProjRightCollision", "Matched pt and z, right collision", HistType::kTHnSparseD, {partJetPtAxis, partZAxis, detJetPtAxis, detZAxis}, true); + + registry.add("matching/jets/V0/partJetPtLambdaPtDetJetPtLambdaPtWrongCollision", "matched Pt, Wrong collision", HistType::kTHnSparseD, {partJetPtAxis, v0PtAxis, detJetPtAxis, v0PtAxis}, true); + registry.add("matching/jets/V0/partJetPtLambdaTrackProjDetJetPtLambdaTrackProjWrongCollision", "Matched pt and z, Wrong collision", HistType::kTHnSparseD, {partJetPtAxis, partZAxis, detJetPtAxis, detZAxis}, true); + // Matching - Matched Lambda: pt registry.add("matching/jets/V0/partJetPtLambdaPtDetJetPtLambdaPtCtauK0S", "matched jet Pt, #{K}^{0}_{S} Pt, Ctau #{K}^{0}_{S}", HistType::kTHnSparseD, {partJetPtAxis, v0PtAxis, detJetPtAxis, v0PtAxis, v0CtauAxis}, true); registry.add("matching/jets/V0/partJetPtLambdaPtDetJetPtLambdaPtCtauLambda", "matched jet Pt, #Lambda^{0} Pt, Ctau #Lambda^{0}", HistType::kTHnSparseD, {partJetPtAxis, v0PtAxis, detJetPtAxis, v0PtAxis, v0CtauAxis}, true); @@ -883,8 +897,15 @@ struct JetFragmentation { registry.add("matching/jets/V0/missJetPtLambdaTrackProj", "Misses", HistType::kTH2D, {partJetPtAxis, partZAxis}, true); // Matching - Matched AntiLambda - registry.add("matching/jets/V0/matchDetJetPtAntiLambdaTrackProjPartJetPtAntiLambdaTrackProj", "Matched", HistType::kTHnSparseD, {detJetPtAxis, detZAxis, partJetPtAxis, partZAxis}, true); - registry.add("matching/jets/V0/partJetPtAntiLambdaPtDetJetPtAntiLambdaPt", "matched jet Pt, #bar{#Lambda}^{0} Pt", HistType::kTHnSparseD, {partJetPtAxis, v0PtAxis, detJetPtAxis, v0PtAxis}, true); + registry.add("matching/jets/V0/partJetPtAntiLambdaPtDetJetPtAntiLambdaPt", "matched Pt", HistType::kTHnSparseD, {partJetPtAxis, v0PtAxis, detJetPtAxis, v0PtAxis}, true); + registry.add("matching/jets/V0/partJetPtAntiLambdaTrackProjDetJetPtAntiLambdaTrackProj", "Matched pt and z", HistType::kTHnSparseD, {partJetPtAxis, partZAxis, detJetPtAxis, detZAxis}, true); + + registry.add("matching/jets/V0/partJetPtAntiLambdaPtDetJetPtAntiLambdaPtRightCollision", "matched Pt, right collision", HistType::kTHnSparseD, {partJetPtAxis, v0PtAxis, detJetPtAxis, v0PtAxis}, true); + registry.add("matching/jets/V0/partJetPtAntiLambdaTrackProjDetJetPtAntiLambdaTrackProjRightCollision", "Matched pt and z, right collision", HistType::kTHnSparseD, {partJetPtAxis, partZAxis, detJetPtAxis, detZAxis}, true); + + registry.add("matching/jets/V0/partJetPtAntiLambdaPtDetJetPtAntiLambdaPtWrongCollision", "matched Pt, Wrong collision", HistType::kTHnSparseD, {partJetPtAxis, v0PtAxis, detJetPtAxis, v0PtAxis}, true); + registry.add("matching/jets/V0/partJetPtAntiLambdaTrackProjDetJetPtAntiLambdaTrackProjWrongCollision", "Matched pt and z, Wrong collision", HistType::kTHnSparseD, {partJetPtAxis, partZAxis, detJetPtAxis, detZAxis}, true); + // Matching - Matched AntiLambda: pt registry.add("matching/jets/V0/partJetPtAntiLambdaPtDetJetPtAntiLambdaPtCtauK0S", "matched jet Pt, #{K}^{0}_{S} Pt, Ctau #{K}^{0}_{S}", HistType::kTHnSparseD, {partJetPtAxis, v0PtAxis, detJetPtAxis, v0PtAxis, v0CtauAxis}, true); registry.add("matching/jets/V0/partJetPtAntiLambdaPtDetJetPtAntiLambdaPtCtauLambda", "matched jet Pt, #bar{#Lambda}^{0} Pt, Ctau #Lambda^{0}", HistType::kTHnSparseD, {partJetPtAxis, v0PtAxis, detJetPtAxis, v0PtAxis, v0CtauAxis}, true); @@ -1106,17 +1127,17 @@ struct JetFragmentation { if (v0.isK0SCandidate()) { int ptBin = getPtBin(v0.pt(), ptBinsK0S); if (ptBin >= 0) { - purity = purityK0S->at(ptBin); + purity = signalProbK0S->at(ptBin); } } else if (v0.isLambdaCandidate()) { int ptBin = getPtBin(v0.pt(), ptBinsLambda); if (ptBin >= 0) { - purity = purityLambda->at(ptBin); + purity = signalProbLambda->at(ptBin); } } else if (v0.isAntiLambdaCandidate()) { int ptBin = getPtBin(v0.pt(), ptBinsAntiLambda); if (ptBin >= 0) { - purity = purityAntiLambda->at(ptBin); + purity = signalProbAntiLambda->at(ptBin); } } return purity; @@ -1541,7 +1562,9 @@ struct JetFragmentation { double conePt[nCones] = {0., 0.}; int nV0sinCone[nCones] = {0, 0}; for (const auto& v0 : v0s) { - // Need to check if v0 passed jet finder selection/preselector cuts + if (v0.isRejectedCandidate()) + continue; + bool v0InCones = false; double dEta = v0.eta() - jet.eta(); double dPhi[nCones] = {RecoDecay::constrainAngle(v0.phi() - conePhi[0], -constants::math::PI), @@ -2123,6 +2146,7 @@ struct JetFragmentation { template // Reconstructed signal for in-jet V0s void fillMatchingV0FragHistograms(CollisionType const& collision, DetJetType const& detJet, PartJetType const& partJet, V0Type const& v0, ParticleType const& particle, double weight = 1.) { + bool correctCollision = (collision.mcCollisionId() == particle.mcCollisionId()); double detTrackProj = getMomFrac(detJet, v0); double partTrackProj = getMomFrac(partJet, particle); @@ -2158,8 +2182,15 @@ struct JetFragmentation { registry.fill(HIST("matching/jets/V0/partJetPtV0TrackProjDetJetPtV0TrackProjDCAd"), partJet.pt(), partTrackProj, detJet.pt(), detTrackProj, v0.dcaV0daughters(), weight); if (std::abs(particle.pdgCode()) == PDG_t::kK0Short) { // K0S - registry.fill(HIST("matching/jets/V0/matchDetJetPtK0STrackProjPartJetPtK0STrackProj"), detJet.pt(), detTrackProj, partJet.pt(), partTrackProj, weight); registry.fill(HIST("matching/jets/V0/partJetPtK0SPtDetJetPtK0SPt"), partJet.pt(), particle.pt(), detJet.pt(), v0.pt(), weight); + registry.fill(HIST("matching/jets/V0/partJetPtK0STrackProjDetJetPtK0STrackProj"), partJet.pt(), partTrackProj, detJet.pt(), detTrackProj, weight); + if (correctCollision) { + registry.fill(HIST("matching/jets/V0/partJetPtK0SPtDetJetPtK0SPtRightCollision"), partJet.pt(), particle.pt(), detJet.pt(), v0.pt(), weight); + registry.fill(HIST("matching/jets/V0/partJetPtK0STrackProjDetJetPtK0STrackProjRightCollision"), partJet.pt(), partTrackProj, detJet.pt(), detTrackProj, weight); + } else { + registry.fill(HIST("matching/jets/V0/partJetPtK0SPtDetJetPtK0SPtWrongCollision"), partJet.pt(), particle.pt(), detJet.pt(), v0.pt(), weight); + registry.fill(HIST("matching/jets/V0/partJetPtK0STrackProjDetJetPtK0STrackProjWrongCollision"), partJet.pt(), partTrackProj, detJet.pt(), detTrackProj, weight); + } registry.fill(HIST("matching/jets/V0/partJetPtK0SPtDetJetPtK0SPtCtauLambda"), partJet.pt(), particle.pt(), detJet.pt(), v0.pt(), ctauLambda, weight); registry.fill(HIST("matching/jets/V0/partJetPtK0SPtDetJetPtK0SPtCtauAntiLambda"), partJet.pt(), particle.pt(), detJet.pt(), v0.pt(), ctauAntiLambda, weight); @@ -2185,8 +2216,15 @@ struct JetFragmentation { registry.fill(HIST("matching/jets/V0/partJetPtK0STrackProjDetJetPtK0STrackProjDCAposneg"), partJet.pt(), partTrackProj, detJet.pt(), detTrackProj, v0.dcapostopv(), v0.dcanegtopv(), weight); registry.fill(HIST("matching/jets/V0/partJetPtK0STrackProjDetJetPtK0STrackProjDCAd"), partJet.pt(), partTrackProj, detJet.pt(), detTrackProj, v0.dcaV0daughters(), weight); } else if (particle.pdgCode() == PDG_t::kLambda0) { // Lambda - registry.fill(HIST("matching/jets/V0/matchDetJetPtLambdaTrackProjPartJetPtLambdaTrackProj"), detJet.pt(), detTrackProj, partJet.pt(), partTrackProj, weight); registry.fill(HIST("matching/jets/V0/partJetPtLambdaPtDetJetPtLambdaPt"), partJet.pt(), particle.pt(), detJet.pt(), v0.pt(), weight); + registry.fill(HIST("matching/jets/V0/partJetPtLambdaTrackProjDetJetPtLambdaTrackProj"), partJet.pt(), partTrackProj, detJet.pt(), detTrackProj, weight); + if (correctCollision) { + registry.fill(HIST("matching/jets/V0/partJetPtLambdaPtDetJetPtLambdaPtRightCollision"), partJet.pt(), particle.pt(), detJet.pt(), v0.pt(), weight); + registry.fill(HIST("matching/jets/V0/partJetPtLambdaTrackProjDetJetPtLambdaTrackProjRightCollision"), partJet.pt(), partTrackProj, detJet.pt(), detTrackProj, weight); + } else { + registry.fill(HIST("matching/jets/V0/partJetPtLambdaPtDetJetPtLambdaPtWrongCollision"), partJet.pt(), particle.pt(), detJet.pt(), v0.pt(), weight); + registry.fill(HIST("matching/jets/V0/partJetPtLambdaTrackProjDetJetPtLambdaTrackProjWrongCollision"), partJet.pt(), partTrackProj, detJet.pt(), detTrackProj, weight); + } registry.fill(HIST("matching/jets/V0/partJetPtLambdaPtDetJetPtLambdaPtCtauLambda"), partJet.pt(), particle.pt(), detJet.pt(), v0.pt(), ctauLambda, weight); registry.fill(HIST("matching/jets/V0/partJetPtLambdaPtDetJetPtLambdaPtCtauAntiLambda"), partJet.pt(), particle.pt(), detJet.pt(), v0.pt(), ctauAntiLambda, weight); @@ -2217,8 +2255,15 @@ struct JetFragmentation { registry.fill(HIST("matching/jets/V0/partJetPtLambdaPtDetJetPtLambdaPtLambdaReflection"), partJet.pt(), particle.pt(), detJet.pt(), v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), reflectedMass, weight); registry.fill(HIST("matching/jets/V0/partJetPtLambdaTrackProjDetJetPtLambdaTrackProjLambdaReflection"), partJet.pt(), partTrackProj, detJet.pt(), detTrackProj, v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), reflectedMass, weight); } else if (particle.pdgCode() == PDG_t::kLambda0Bar) { // AntiLambda - registry.fill(HIST("matching/jets/V0/matchDetJetPtAntiLambdaTrackProjPartJetPtAntiLambdaTrackProj"), detJet.pt(), detTrackProj, partJet.pt(), partTrackProj, weight); registry.fill(HIST("matching/jets/V0/partJetPtAntiLambdaPtDetJetPtAntiLambdaPt"), partJet.pt(), particle.pt(), detJet.pt(), v0.pt(), weight); + registry.fill(HIST("matching/jets/V0/partJetPtAntiLambdaTrackProjDetJetPtAntiLambdaTrackProj"), partJet.pt(), partTrackProj, detJet.pt(), detTrackProj, weight); + if (correctCollision) { + registry.fill(HIST("matching/jets/V0/partJetPtAntiLambdaPtDetJetPtAntiLambdaPtRightCollision"), partJet.pt(), particle.pt(), detJet.pt(), v0.pt(), weight); + registry.fill(HIST("matching/jets/V0/partJetPtAntiLambdaTrackProjDetJetPtAntiLambdaTrackProjRightCollision"), partJet.pt(), partTrackProj, detJet.pt(), detTrackProj, weight); + } else { + registry.fill(HIST("matching/jets/V0/partJetPtAntiLambdaPtDetJetPtAntiLambdaPtWrongCollision"), partJet.pt(), particle.pt(), detJet.pt(), v0.pt(), weight); + registry.fill(HIST("matching/jets/V0/partJetPtAntiLambdaTrackProjDetJetPtAntiLambdaTrackProjWrongCollision"), partJet.pt(), partTrackProj, detJet.pt(), detTrackProj, weight); + } registry.fill(HIST("matching/jets/V0/partJetPtAntiLambdaPtDetJetPtAntiLambdaPtCtauLambda"), partJet.pt(), particle.pt(), detJet.pt(), v0.pt(), ctauLambda, weight); registry.fill(HIST("matching/jets/V0/partJetPtAntiLambdaPtDetJetPtAntiLambdaPtCtauAntiLambda"), partJet.pt(), particle.pt(), detJet.pt(), v0.pt(), ctauAntiLambda, weight); @@ -2650,20 +2695,20 @@ struct JetFragmentation { if (v0.isRejectedCandidate()) continue; - float purity = getV0SignalProb(v0); + float signalProb = getV0SignalProb(v0); nV0inJet++; - wV0inJet += purity; + wV0inJet += signalProb; if (v0.isK0SCandidate()) { nK0SinJet++; - wK0SinJet += purity; + wK0SinJet += signalProb; } if (v0.isLambdaCandidate()) { nLambdainJet++; - wLambdainJet += purity; + wLambdainJet += signalProb; } if (v0.isAntiLambdaCandidate()) { nAntiLambdainJet++; - wAntiLambdainJet += purity; + wAntiLambdainJet += signalProb; } fillDataV0FragHistograms(jcoll, jet, v0); diff --git a/PWGJE/Tasks/v0QA.cxx b/PWGJE/Tasks/v0QA.cxx index 9cd648beafd..26adc61d820 100644 --- a/PWGJE/Tasks/v0QA.cxx +++ b/PWGJE/Tasks/v0QA.cxx @@ -160,8 +160,11 @@ struct V0QA { if (doprocessMcPJets) { registry.add("jets/hMcJetEvents", "MC Jet Events", {HistType::kTH1D, {{2, 0.0f, 2.0f}}}); registry.add("jets/GeneratedJetK0S", "Generated Jet K0S", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); + registry.add("jets/GeneratedJetK0SFrag", "Generated Jet K0S", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}); registry.add("jets/GeneratedJetLambda", "Generated Jet Lambda", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); + registry.add("jets/GeneratedJetLambdaFrag", "Generated Jet Lambda", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}); registry.add("jets/GeneratedJetAntiLambda", "Generated Jet AntiLambda", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); + registry.add("jets/GeneratedJetAntiLambdaFrag", "Generated Jet AntiLambda", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}); } if (doprocessCollisionAssociation) { registry.add("collisions/V0PtEta", "V0 Pt, Eta", HistType::kTH2D, {axisV0Pt, axisEta}); @@ -182,11 +185,17 @@ struct V0QA { registry.add("collisions/JetPtEtaV0Pt", "Jet Pt, Eta, V0 Pt", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); registry.add("collisions/JetPtEtaV0PtWrongColl", "Jet Pt, Eta, V0 Pt", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); registry.add("collisions/JetPtEtaK0SPtMass", "Jet Pt, Eta, K0S Pt Mass", HistType::kTHnSparseD, {axisJetPt, axisEta, axisV0Pt, axisK0SM}); + registry.add("collisions/JetPtEtaK0SFragMass", "Jet Pt, Eta, K0S Frag Mass", HistType::kTHnSparseD, {axisJetPt, axisEta, axisV0Z, axisK0SM}); registry.add("collisions/JetPtEtaK0SPtMassWrongColl", "Jet Pt, Eta, K0S Pt Mass", HistType::kTHnSparseD, {axisJetPt, axisEta, axisV0Pt, axisK0SM}); + registry.add("collisions/JetPtEtaK0SFragMassWrongColl", "Jet Pt, Eta, K0S Frag Mass", HistType::kTHnSparseD, {axisJetPt, axisEta, axisV0Z, axisK0SM}); registry.add("collisions/JetPtEtaLambdaPtMass", "Jet Pt, Eta, Lambda Pt Mass", HistType::kTHnSparseD, {axisJetPt, axisEta, axisV0Pt, axisLambdaM}); + registry.add("collisions/JetPtEtaLambdaFragMass", "Jet Pt, Eta, Lambda Frag Mass", HistType::kTHnSparseD, {axisJetPt, axisEta, axisV0Z, axisLambdaM}); registry.add("collisions/JetPtEtaLambdaPtMassWrongColl", "Jet Pt, Eta, Lambda Pt Mass", HistType::kTHnSparseD, {axisJetPt, axisEta, axisV0Pt, axisLambdaM}); + registry.add("collisions/JetPtEtaLambdaFragMassWrongColl", "Jet Pt, Eta, Lambda Frag Mass", HistType::kTHnSparseD, {axisJetPt, axisEta, axisV0Z, axisLambdaM}); registry.add("collisions/JetPtEtaAntiLambdaPtMass", "Jet Pt, Eta, AntiLambda Pt Mass", HistType::kTHnSparseD, {axisJetPt, axisEta, axisV0Pt, axisAntiLambdaM}); + registry.add("collisions/JetPtEtaAntiLambdaFragMass", "Jet Pt, Eta, AntiLambda Frag Mass", HistType::kTHnSparseD, {axisJetPt, axisEta, axisV0Z, axisAntiLambdaM}); registry.add("collisions/JetPtEtaAntiLambdaPtMassWrongColl", "Jet Pt, Eta, AntiLambda Pt Mass", HistType::kTHnSparseD, {axisJetPt, axisEta, axisV0Pt, axisAntiLambdaM}); + registry.add("collisions/JetPtEtaAntiLambdaFragMassWrongColl", "Jet Pt, Eta, AntiLambda Frag Mass", HistType::kTHnSparseD, {axisJetPt, axisEta, axisV0Z, axisAntiLambdaM}); registry.add("collisions/JetPtEtaXiMinusPtLambdaPt", "Jet Pt, #Xi^{-} Pt, #Lambda Pt", HistType::kTHnSparseD, {axisJetPt, axisEta, axisV0Pt, axisV0Pt}); registry.add("collisions/JetPtEtaXiMinusPtLambdaPtWrongColl", "Jet Pt, #Xi^{-} Pt, #Lambda Pt", HistType::kTHnSparseD, {axisJetPt, axisEta, axisV0Pt, axisV0Pt}); @@ -197,11 +206,16 @@ struct V0QA { registry.add("collisions/JetsPtEtaV0Pt", "Jets Pt, Eta, V0 Pt", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Pt}); registry.add("collisions/JetsPtEtaV0PtWrongColl", "Jets Pt, Eta, V0 Pt", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Pt}); registry.add("collisions/JetsPtEtaK0SPtMass", "Jets Pt, Eta, K0S Pt Mass", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Pt, axisK0SM}); - registry.add("collisions/JetsPtEtaK0SPtMassWrongColl", "Jets Pt, Eta, K0S Pt Mass", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Pt, axisK0SM}); + registry.add("collisions/JetsPtEtaK0SFragMass", "Jets Pt, Eta, K0S Frag Mass", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Z, axisK0SM}); + registry.add("collisions/JetsPtEtaK0SFragMassWrongColl", "Jets Pt, Eta, K0S Frag Mass", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Z, axisK0SM}); registry.add("collisions/JetsPtEtaLambdaPtMass", "Jets Pt, Eta, Lambda Pt Mass", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Pt, axisLambdaM}); + registry.add("collisions/JetsPtEtaLambdaFragMass", "Jets Pt, Eta, Lambda Frag Mass", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Z, axisLambdaM}); registry.add("collisions/JetsPtEtaLambdaPtMassWrongColl", "Jets Pt, Eta, Lambda Pt Mass", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Pt, axisLambdaM}); + registry.add("collisions/JetsPtEtaLambdaFragMassWrongColl", "Jets Pt, Eta, Lambda Frag Mass", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Z, axisLambdaM}); registry.add("collisions/JetsPtEtaAntiLambdaPtMass", "Jets Pt, Eta, AntiLambda Pt Mass", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Pt, axisAntiLambdaM}); + registry.add("collisions/JetsPtEtaAntiLambdaFragMass", "Jets Pt, Eta, AntiLambda Frag Mass", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Z, axisAntiLambdaM}); registry.add("collisions/JetsPtEtaAntiLambdaPtMassWrongColl", "Jets Pt, Eta, AntiLambda Pt Mass", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Pt, axisAntiLambdaM}); + registry.add("collisions/JetsPtEtaAntiLambdaFragMassWrongColl", "Jets Pt, Eta, AntiLambda Frag Mass", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Z, axisAntiLambdaM}); registry.add("collisions/JetsPtEtaXiMinusPtLambdaPt", "Jets Pt, Eta, #Xi^{-} Pt, #Lambda Pt", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Pt, axisV0Pt}); registry.add("collisions/JetsPtEtaXiMinusPtLambdaPtWrongColl", "Jets Pt, Eta, #Xi^{-} Pt, #Lambda Pt", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Pt, axisV0Pt}); @@ -910,12 +924,15 @@ struct V0QA { if (pv0.pdgCode() == PDG_t::kK0Short) { registry.fill(HIST("jets/GeneratedJetK0S"), jet.pt(), jet.eta(), pv0.pt(), weight); + registry.fill(HIST("jets/GeneratedJetK0SFrag"), jet.pt(), jet.eta(), pv0.pt() / jet.pt(), weight); } if (pv0.pdgCode() == PDG_t::kLambda0) { registry.fill(HIST("jets/GeneratedJetLambda"), jet.pt(), jet.eta(), pv0.pt(), weight); + registry.fill(HIST("jets/GeneratedJetLambdaFrag"), jet.pt(), jet.eta(), pv0.pt() / jet.pt(), weight); } if (pv0.pdgCode() == PDG_t::kLambda0Bar) { registry.fill(HIST("jets/GeneratedJetAntiLambda"), jet.pt(), jet.eta(), pv0.pt(), weight); + registry.fill(HIST("jets/GeneratedJetAntiLambdaFrag"), jet.pt(), jet.eta(), pv0.pt() / jet.pt(), weight); } } } @@ -991,7 +1008,7 @@ struct V0QA { void processCollisionAssociationJets(soa::Filtered::iterator const& jcoll, MCDV0JetsWithConstituents const& mcdjets, CandidatesV0MCDWithFlags const&, soa::Join const&, aod::McCollisions const&, aod::McParticles const&) { - if (!jcoll.has_mcCollision()) + if (!isCollisionReconstructed(jcoll, eventSelectionBits)) return; auto mcColl = jcoll.template mcCollision_as>(); @@ -1006,31 +1023,38 @@ struct V0QA { auto pv0 = v0.mcParticle(); bool correctCollision = (mcColl.mcCollisionId() == pv0.mcCollisionId()); int pdg = pv0.pdgCode(); + double z = v0.pt() / mcdjet.pt(); // Check V0 decay kinematics if (v0.isRejectedCandidate()) continue; - registry.fill(HIST("collisions/JetPtEtaV0Pt"), mcdjet.pt(), mcdjet.eta(), pv0.pt(), weight); + registry.fill(HIST("collisions/JetPtEtaV0Pt"), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); if (!correctCollision) { - registry.fill(HIST("collisions/JetPtEtaV0PtWrongColl"), mcdjet.pt(), mcdjet.eta(), pv0.pt(), weight); + registry.fill(HIST("collisions/JetPtEtaV0PtWrongColl"), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); } if (std::abs(pdg) == PDG_t::kK0Short) { - registry.fill(HIST("collisions/JetPtEtaK0SPtMass"), mcdjet.pt(), mcdjet.eta(), pv0.pt(), v0.mK0Short(), weight); + registry.fill(HIST("collisions/JetPtEtaK0SPtMass"), mcdjet.pt(), mcdjet.eta(), v0.pt(), v0.mK0Short(), weight); + registry.fill(HIST("collisions/JetPtEtaK0SFragMass"), mcdjet.pt(), mcdjet.eta(), z, v0.mK0Short(), weight); if (!correctCollision) { - registry.fill(HIST("collisions/JetPtEtaK0SPtMassWrongColl"), mcdjet.pt(), mcdjet.eta(), pv0.pt(), v0.mK0Short(), weight); + registry.fill(HIST("collisions/JetPtEtaK0SPtMassWrongColl"), mcdjet.pt(), mcdjet.eta(), v0.pt(), v0.mK0Short(), weight); + registry.fill(HIST("collisions/JetPtEtaK0SFragMassWrongColl"), mcdjet.pt(), mcdjet.eta(), z, v0.mK0Short(), weight); } } if (pdg == PDG_t::kLambda0) { - registry.fill(HIST("collisions/JetPtEtaLambdaPtMass"), mcdjet.pt(), mcdjet.eta(), pv0.pt(), v0.mLambda(), weight); + registry.fill(HIST("collisions/JetPtEtaLambdaPtMass"), mcdjet.pt(), mcdjet.eta(), v0.pt(), v0.mLambda(), weight); + registry.fill(HIST("collisions/JetPtEtaLambdaFragMass"), mcdjet.pt(), mcdjet.eta(), z, v0.mLambda(), weight); if (!correctCollision) { - registry.fill(HIST("collisions/JetPtEtaLambdaPtMassWrongColl"), mcdjet.pt(), mcdjet.eta(), pv0.pt(), v0.mLambda(), weight); + registry.fill(HIST("collisions/JetPtEtaLambdaPtMassWrongColl"), mcdjet.pt(), mcdjet.eta(), v0.pt(), v0.mLambda(), weight); + registry.fill(HIST("collisions/JetPtEtaLambdaFragMassWrongColl"), mcdjet.pt(), mcdjet.eta(), z, v0.mLambda(), weight); } } if (pdg == PDG_t::kLambda0Bar) { - registry.fill(HIST("collisions/JetPtEtaAntiLambdaPtMass"), mcdjet.pt(), mcdjet.eta(), pv0.pt(), v0.mAntiLambda(), weight); + registry.fill(HIST("collisions/JetPtEtaAntiLambdaPtMass"), mcdjet.pt(), mcdjet.eta(), v0.pt(), v0.mAntiLambda(), weight); + registry.fill(HIST("collisions/JetPtEtaAntiLambdaFragMass"), mcdjet.pt(), mcdjet.eta(), z, v0.mAntiLambda(), weight); if (!correctCollision) { - registry.fill(HIST("collisions/JetPtEtaAntiLambdaPtMassWrongColl"), mcdjet.pt(), mcdjet.eta(), pv0.pt(), v0.mAntiLambda(), weight); + registry.fill(HIST("collisions/JetPtEtaAntiLambdaPtMassWrongColl"), mcdjet.pt(), mcdjet.eta(), v0.pt(), v0.mAntiLambda(), weight); + registry.fill(HIST("collisions/JetPtEtaAntiLambdaFragMassWrongColl"), mcdjet.pt(), mcdjet.eta(), z, v0.mAntiLambda(), weight); } } @@ -1041,15 +1065,15 @@ struct V0QA { pdg = mother.pdgCode(); correctCollision = (mcColl.mcCollisionId() == mother.mcCollisionId()); if (pdg == PDG_t::kXiMinus) { - registry.fill(HIST("collisions/JetPtEtaXiMinusPtLambdaPt"), mcdjet.pt(), mcdjet.eta(), mother.pt(), pv0.pt(), weight); + registry.fill(HIST("collisions/JetPtEtaXiMinusPtLambdaPt"), mcdjet.pt(), mcdjet.eta(), mother.pt(), v0.pt(), weight); if (!correctCollision) { - registry.fill(HIST("collisions/JetPtEtaXiMinusPtLambdaPtWrongColl"), mcdjet.pt(), mcdjet.eta(), mother.pt(), pv0.pt(), weight); + registry.fill(HIST("collisions/JetPtEtaXiMinusPtLambdaPtWrongColl"), mcdjet.pt(), mcdjet.eta(), mother.pt(), v0.pt(), weight); } } if (pdg == PDG_t::kXiPlusBar) { - registry.fill(HIST("collisions/JetPtEtaXiPlusPtAntiLambdaPt"), mcdjet.pt(), mcdjet.eta(), mother.pt(), pv0.pt(), weight); + registry.fill(HIST("collisions/JetPtEtaXiPlusPtAntiLambdaPt"), mcdjet.pt(), mcdjet.eta(), mother.pt(), v0.pt(), weight); if (!correctCollision) { - registry.fill(HIST("collisions/JetPtEtaXiPlusPtAntiLambdaPtWrongColl"), mcdjet.pt(), mcdjet.eta(), mother.pt(), pv0.pt(), weight); + registry.fill(HIST("collisions/JetPtEtaXiPlusPtAntiLambdaPtWrongColl"), mcdjet.pt(), mcdjet.eta(), mother.pt(), v0.pt(), weight); } } } // for v0s @@ -1077,31 +1101,38 @@ struct V0QA { int pdg = pv0.pdgCode(); bool correctCollision = (mcColl.mcCollisionId() == pv0.mcCollisionId()); + double z = v0.pt() / mcdjet.pt(); // Check V0 decay kinematics if (v0.isRejectedCandidate()) continue; - registry.fill(HIST("collisions/JetsPtEtaV0Pt"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), pv0.pt(), weight); + registry.fill(HIST("collisions/JetsPtEtaV0Pt"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); if (!correctCollision) { - registry.fill(HIST("collisions/JetsPtEtaV0PtWrongColl"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), pv0.pt(), weight); + registry.fill(HIST("collisions/JetsPtEtaV0PtWrongColl"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); } if (std::abs(pdg) == PDG_t::kK0Short) { - registry.fill(HIST("collisions/JetsPtEtaK0SPtMass"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), pv0.pt(), v0.mK0Short(), weight); + registry.fill(HIST("collisions/JetsPtEtaK0SPtMass"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), v0.pt(), v0.mK0Short(), weight); + registry.fill(HIST("collisions/JetsPtEtaK0SFragMass"), mcpjet.pt(), mcdjet.eta(), z, v0.mK0Short(), weight); if (!correctCollision) { - registry.fill(HIST("collisions/JetsPtEtaK0SPtMassWrongColl"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), pv0.pt(), v0.mK0Short(), weight); + registry.fill(HIST("collisions/JetsPtEtaK0SPtMassWrongColl"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), v0.pt(), v0.mK0Short(), weight); + registry.fill(HIST("collisions/JetsPtEtaK0SFragMassWrongColl"), mcpjet.pt(), mcdjet.eta(), z, v0.mK0Short(), weight); } } if (pdg == PDG_t::kLambda0) { - registry.fill(HIST("collisions/JetsPtEtaLambdaPtMass"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), pv0.pt(), v0.mLambda(), weight); + registry.fill(HIST("collisions/JetsPtEtaLambdaPtMass"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), v0.pt(), v0.mLambda(), weight); + registry.fill(HIST("collisions/JetsPtEtaLambdaFragMass"), mcpjet.pt(), mcdjet.eta(), z, v0.mLambda(), weight); if (!correctCollision) { - registry.fill(HIST("collisions/JetsPtEtaLambdaPtMassWrongColl"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), pv0.pt(), v0.mLambda(), weight); + registry.fill(HIST("collisions/JetsPtEtaLambdaPtMassWrongColl"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), v0.pt(), v0.mLambda(), weight); + registry.fill(HIST("collisions/JetsPtEtaLambdaFragMassWrongColl"), mcpjet.pt(), mcdjet.eta(), z, v0.mLambda(), weight); } } if (pdg == PDG_t::kLambda0Bar) { - registry.fill(HIST("collisions/JetsPtEtaAntiLambdaPtMass"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), pv0.pt(), v0.mAntiLambda(), weight); + registry.fill(HIST("collisions/JetsPtEtaAntiLambdaPtMass"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), v0.pt(), v0.mAntiLambda(), weight); + registry.fill(HIST("collisions/JetsPtEtaAntiLambdaFragMass"), mcpjet.pt(), mcdjet.eta(), z, v0.mAntiLambda(), weight); if (!correctCollision) { - registry.fill(HIST("collisions/JetsPtEtaAntiLambdaPtMassWrongColl"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), pv0.pt(), v0.mAntiLambda(), weight); + registry.fill(HIST("collisions/JetsPtEtaAntiLambdaPtMassWrongColl"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), v0.pt(), v0.mAntiLambda(), weight); + registry.fill(HIST("collisions/JetsPtEtaAntiLambdaFragMassWrongColl"), mcpjet.pt(), mcdjet.eta(), z, v0.mAntiLambda(), weight); } } @@ -1112,15 +1143,15 @@ struct V0QA { pdg = mother.pdgCode(); correctCollision = (mcColl.mcCollisionId() == mother.mcCollisionId()); if (pdg == PDG_t::kXiMinus) { - registry.fill(HIST("collisions/JetsPtEtaXiMinusPtLambdaPt"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), mother.pt(), pv0.pt(), weight); + registry.fill(HIST("collisions/JetsPtEtaXiMinusPtLambdaPt"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), mother.pt(), v0.pt(), weight); if (!correctCollision) { - registry.fill(HIST("collisions/JetsPtEtaXiMinusPtLambdaPtWrongColl"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), mother.pt(), pv0.pt(), weight); + registry.fill(HIST("collisions/JetsPtEtaXiMinusPtLambdaPtWrongColl"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), mother.pt(), v0.pt(), weight); } } if (pdg == PDG_t::kXiPlusBar) { - registry.fill(HIST("collisions/JetsPtEtaXiPlusPtAntiLambdaPt"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), mother.pt(), pv0.pt(), weight); + registry.fill(HIST("collisions/JetsPtEtaXiPlusPtAntiLambdaPt"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), mother.pt(), v0.pt(), weight); if (!correctCollision) { - registry.fill(HIST("collisions/JetsPtEtaXiPlusPtAntiLambdaPtWrongColl"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), mother.pt(), pv0.pt(), weight); + registry.fill(HIST("collisions/JetsPtEtaXiPlusPtAntiLambdaPtWrongColl"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), mother.pt(), v0.pt(), weight); } } } // for pv0 From 5bedfe2ffa12d92d989468cb0aaa2c4c1d6a7a8c Mon Sep 17 00:00:00 2001 From: abmodak <67369858+abmodak@users.noreply.github.com> Date: Thu, 31 Jul 2025 16:45:39 +0200 Subject: [PATCH 163/345] [PWGCF] Fix bug in defining QA/EventHist (#12322) --- .../Tasks/longrangeCorrelation.cxx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx b/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx index 126f0580ccd..c2cf7781b53 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx @@ -154,13 +154,6 @@ struct LongrangeCorrelation { LOGF(info, "Offset for FV0-left: x = %.3f y = %.3f\n", (*offsetFV0)[0].getX(), (*offsetFV0)[0].getY()); LOGF(info, "Offset for FV0-right: x = %.3f y = %.3f\n", (*offsetFV0)[1].getX(), (*offsetFV0)[1].getY()); - auto hstat = histos.get(HIST("QA/EventHist")); - auto* x = hstat->GetXaxis(); - x->SetBinLabel(1, "All events"); - x->SetBinLabel(2, "sel8"); - x->SetBinLabel(3, "kNoSameBunchPileup"); // reject collisions in case of pileup with another collision in the same foundBC - x->SetBinLabel(4, "|vz|<10"); - std::vector corrAxis = {{axisSample, "Sample"}, {axisVtxZ, "z-vtx (cm)"}, {axisPtTrigger, "p_{T} (GeV/c)"}, @@ -176,6 +169,13 @@ struct LongrangeCorrelation { if (doprocessEventStat) { histos.add("QA/EventHist", "events", kTH1F, {axisEvent}, false); histos.add("QA/VtxZHist", "v_{z} (cm)", kTH1F, {axisVtxZ}, false); + + auto hstat = histos.get(HIST("QA/EventHist")); + auto* x = hstat->GetXaxis(); + x->SetBinLabel(1, "All events"); + x->SetBinLabel(2, "sel8"); + x->SetBinLabel(3, "kNoSameBunchPileup"); // reject collisions in case of pileup with another collision in the same foundBC + x->SetBinLabel(4, "|vz|<10"); } histos.add("Ft0aGlobal/SE/hMult", "", kTH1D, {axisMultiplicity}); From 24929d80ae951f8c9b8ac31ca6fd9b470087ec53 Mon Sep 17 00:00:00 2001 From: fuchuncui <162277233+fuchuncui@users.noreply.github.com> Date: Thu, 31 Jul 2025 22:47:38 +0800 Subject: [PATCH 164/345] [PWGCF] fix a bug about cascades competing mass rejection (#12334) --- PWGCF/Flow/Tasks/flowGfwOmegaXi.cxx | 58 ++++++++++++----------------- 1 file changed, 24 insertions(+), 34 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowGfwOmegaXi.cxx b/PWGCF/Flow/Tasks/flowGfwOmegaXi.cxx index fd0a6e5b27a..bf001b02df2 100644 --- a/PWGCF/Flow/Tasks/flowGfwOmegaXi.cxx +++ b/PWGCF/Flow/Tasks/flowGfwOmegaXi.cxx @@ -1205,27 +1205,12 @@ struct FlowGfwOmegaXi { ((std::fabs(itsResponse.nSigmaITS(bachelor)) < cfgNSigma[8]) || bachelor.pt() < lowpt) && ((std::fabs(itsResponse.nSigmaITS(posdau)) < cfgNSigma[7]) || posdau.pt() < lowpt) && ((std::fabs(itsResponse.nSigmaITS(negdau)) < cfgNSigma[6]) || negdau.pt() < lowpt)) { registry.fill(HIST("InvMassOmega_all"), casc.pt(), casc.mOmega(), casc.eta(), cent); isOmega = true; - - setCurrentParticleWeights(weff, wacc, bachelor, vtxz, 0); - fGFW->Fill(bachelor.eta(), 1, bachelor.phi(), wacc * weff * wloc, 4096); - setCurrentParticleWeights(weff, wacc, posdau, vtxz, 0); - fGFW->Fill(posdau.eta(), 1, posdau.phi(), wacc * weff * wloc, 4096); - setCurrentParticleWeights(weff, wacc, negdau, vtxz, 0); - fGFW->Fill(negdau.eta(), 1, negdau.phi(), wacc * weff * wloc, 4096); - } else if (casc.sign() > 0 && std::fabs(casc.yOmega()) < cfgCasc_rapidity && (std::fabs(bachelor.tpcNSigmaKa()) < cfgNSigma[2] && std::fabs(negdau.tpcNSigmaPr()) < cfgNSigma[1] && std::fabs(posdau.tpcNSigmaPi()) < cfgNSigma[0]) && ((std::fabs(bachelor.tofNSigmaKa()) < cfgNSigma[5] || bachelor.pt() < lowpt) && (std::fabs(negdau.tofNSigmaPr()) < cfgNSigma[4] || negdau.pt() < lowpt) && (std::fabs(posdau.tofNSigmaPi()) < cfgNSigma[3] || posdau.pt() < lowpt)) && ((std::fabs(itsResponse.nSigmaITS(bachelor)) < cfgNSigma[8]) || bachelor.pt() < lowpt) && ((std::fabs(itsResponse.nSigmaITS(posdau)) < cfgNSigma[7]) || posdau.pt() < lowpt) && ((std::fabs(itsResponse.nSigmaITS(negdau)) < cfgNSigma[6]) || negdau.pt() < lowpt)) { registry.fill(HIST("InvMassOmega_all"), casc.pt(), casc.mOmega(), casc.eta(), cent); isOmega = true; - - setCurrentParticleWeights(weff, wacc, bachelor, vtxz, 0); - fGFW->Fill(bachelor.eta(), 1, bachelor.phi(), wacc * weff * wloc, 4096); - setCurrentParticleWeights(weff, wacc, posdau, vtxz, 0); - fGFW->Fill(posdau.eta(), 1, posdau.phi(), wacc * weff * wloc, 4096); - setCurrentParticleWeights(weff, wacc, negdau, vtxz, 0); - fGFW->Fill(negdau.eta(), 1, negdau.phi(), wacc * weff * wloc, 4096); } } // Xi and antiXi @@ -1236,27 +1221,12 @@ struct FlowGfwOmegaXi { ((std::fabs(itsResponse.nSigmaITS(bachelor)) < cfgNSigma[6]) || bachelor.pt() < lowpt) && ((std::fabs(itsResponse.nSigmaITS(posdau)) < cfgNSigma[7]) || posdau.pt() < lowpt) && ((std::fabs(itsResponse.nSigmaITS(negdau)) < cfgNSigma[6]) || negdau.pt() < lowpt)) { registry.fill(HIST("InvMassXi_all"), casc.pt(), casc.mXi(), casc.eta(), cent); isXi = true; - - setCurrentParticleWeights(weff, wacc, bachelor, vtxz, 0); - fGFW->Fill(bachelor.eta(), 1, bachelor.phi(), wacc * weff * wloc, 2048); - setCurrentParticleWeights(weff, wacc, posdau, vtxz, 0); - fGFW->Fill(posdau.eta(), 1, posdau.phi(), wacc * weff * wloc, 2048); - setCurrentParticleWeights(weff, wacc, negdau, vtxz, 0); - fGFW->Fill(negdau.eta(), 1, negdau.phi(), wacc * weff * wloc, 2048); - } else if (casc.sign() > 0 && std::fabs(casc.yXi()) < cfgCasc_rapidity && (std::fabs(bachelor.tpcNSigmaPi()) < cfgNSigma[0] && std::fabs(negdau.tpcNSigmaPr()) < cfgNSigma[1] && std::fabs(posdau.tpcNSigmaPi()) < cfgNSigma[0]) && ((std::fabs(bachelor.tofNSigmaPi()) < cfgNSigma[3] || bachelor.pt() < lowpt) && (std::fabs(negdau.tofNSigmaPr()) < cfgNSigma[4] || negdau.pt() < lowpt) && (std::fabs(posdau.tofNSigmaPi()) < cfgNSigma[3] || posdau.pt() < lowpt)) && ((std::fabs(itsResponse.nSigmaITS(bachelor)) < cfgNSigma[6]) || bachelor.pt() < lowpt) && ((std::fabs(itsResponse.nSigmaITS(posdau)) < cfgNSigma[7]) || posdau.pt() < lowpt) && ((std::fabs(itsResponse.nSigmaITS(negdau)) < cfgNSigma[6]) || negdau.pt() < lowpt)) { registry.fill(HIST("InvMassXi_all"), casc.pt(), casc.mXi(), casc.eta(), cent); isXi = true; - - setCurrentParticleWeights(weff, wacc, bachelor, vtxz, 0); - fGFW->Fill(bachelor.eta(), 1, bachelor.phi(), wacc * weff * wloc, 2048); - setCurrentParticleWeights(weff, wacc, posdau, vtxz, 0); - fGFW->Fill(posdau.eta(), 1, posdau.phi(), wacc * weff * wloc, 2048); - setCurrentParticleWeights(weff, wacc, negdau, vtxz, 0); - fGFW->Fill(negdau.eta(), 1, negdau.phi(), wacc * weff * wloc, 2048); } } // fill QA @@ -1315,10 +1285,10 @@ struct FlowGfwOmegaXi { if (!negdau.hasTPC() || !negdau.hasITS()) continue; } - if (isXi && (casc.mOmega() - o2::constants::physics::MassOmegaMinus) < cascBuilderOpts.cfgcasc_compmassrej.value) { + if (isXi && std::fabs(casc.mOmega() - o2::constants::physics::MassOmegaMinus) < cascBuilderOpts.cfgcasc_compmassrej.value) { isXi = false; } - if (isOmega && (casc.mXi() - o2::constants::physics::MassXiMinus) < cascBuilderOpts.cfgcasc_compmassrej.value) { + if (isOmega && std::fabs(casc.mXi() - o2::constants::physics::MassXiMinus) < cascBuilderOpts.cfgcasc_compmassrej.value) { isXi = false; } // fill QA @@ -1331,9 +1301,19 @@ struct FlowGfwOmegaXi { registry.fill(HIST("QAhisto/Casc/hqadcaCascV0dauafter"), casc.dcaV0daughters()); } + float weffBac = 1; + float weffPos = 1; + float weffNeg = 1; + float waccBac = 1; + float waccPos = 1; + float waccNeg = 1; if (isOmega) { - if (cfgDoAccEffCorr) + if (cfgDoAccEffCorr) { setCurrentParticleWeights(weff, wacc, casc, vtxz, 4); + setCurrentParticleWeights(weffBac, waccBac, bachelor, vtxz, 0); + setCurrentParticleWeights(weffPos, waccPos, posdau, vtxz, 0); + setCurrentParticleWeights(weffNeg, waccNeg, negdau, vtxz, 0); + } if (cfgDoLocDenCorr) { int phibin = -999; phibin = hLocalDensity->FindBin(RecoDecay::constrainAngle(casc.phi(), -constants::math::PI)); @@ -1345,13 +1325,20 @@ struct FlowGfwOmegaXi { registry.fill(HIST("hEtaPhiVtxzPOIOmega"), casc.phi(), casc.eta(), vtxz, wacc); registry.fill(HIST("InvMassOmega"), casc.pt(), casc.mOmega(), casc.eta(), cent); fGFW->Fill(casc.eta(), fOmegaPtAxis->FindBin(casc.pt()) - 1 + ((fOmegaMass->FindBin(casc.mOmega()) - 1) * nOmegaPtBins), casc.phi(), wacc * weff * wloc, 4); + fGFW->Fill(bachelor.eta(), 1, bachelor.phi(), waccBac * weffBac * wloc, 4096); + fGFW->Fill(posdau.eta(), 1, posdau.phi(), waccPos * weffPos * wloc, 4096); + fGFW->Fill(negdau.eta(), 1, negdau.phi(), waccNeg * weffNeg * wloc, 4096); if (cfgOutputNUAWeights) fWeightsOmega->fill(casc.phi(), casc.eta(), vtxz, casc.pt(), cent, 0); } if (isXi) { - if (cfgDoAccEffCorr) + if (cfgDoAccEffCorr) { setCurrentParticleWeights(weff, wacc, casc, vtxz, 3); + setCurrentParticleWeights(weffBac, waccBac, bachelor, vtxz, 0); + setCurrentParticleWeights(weffPos, waccPos, posdau, vtxz, 0); + setCurrentParticleWeights(weffNeg, waccNeg, negdau, vtxz, 0); + } if (cfgDoLocDenCorr) { int phibin = -999; phibin = hLocalDensity->FindBin(RecoDecay::constrainAngle(casc.phi(), -constants::math::PI)); @@ -1363,6 +1350,9 @@ struct FlowGfwOmegaXi { registry.fill(HIST("hEtaPhiVtxzPOIXi"), casc.phi(), casc.eta(), vtxz, wacc); registry.fill(HIST("InvMassXi"), casc.pt(), casc.mXi(), casc.eta(), cent); fGFW->Fill(casc.eta(), fXiPtAxis->FindBin(casc.pt()) - 1 + ((fXiMass->FindBin(casc.mXi()) - 1) * nXiPtBins), casc.phi(), wacc * weff * wloc, 2); + fGFW->Fill(bachelor.eta(), 1, bachelor.phi(), waccBac * weffBac * wloc, 2048); + fGFW->Fill(posdau.eta(), 1, posdau.phi(), waccPos * weffPos * wloc, 2048); + fGFW->Fill(negdau.eta(), 1, negdau.phi(), waccNeg * weffNeg * wloc, 2048); if (cfgOutputNUAWeights) fWeightsXi->fill(casc.phi(), casc.eta(), vtxz, casc.pt(), cent, 0); From a58fc5b1dba8fae6a2c7030ee91abc4a4f0cca11 Mon Sep 17 00:00:00 2001 From: Preet-Bhanjan Date: Thu, 31 Jul 2025 16:57:30 +0200 Subject: [PATCH 165/345] [PWGCF] New Task for PID two particle correlations (#12350) Co-authored-by: Preet Pati Co-authored-by: ALICE Action Bot --- .../Tasks/CMakeLists.txt | 5 + .../Tasks/pidDiHadron.cxx | 717 ++++++++++++++++++ 2 files changed, 722 insertions(+) create mode 100644 PWGCF/TwoParticleCorrelations/Tasks/pidDiHadron.cxx diff --git a/PWGCF/TwoParticleCorrelations/Tasks/CMakeLists.txt b/PWGCF/TwoParticleCorrelations/Tasks/CMakeLists.txt index 3ff80210ce2..0b61a13fbb5 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/CMakeLists.txt +++ b/PWGCF/TwoParticleCorrelations/Tasks/CMakeLists.txt @@ -63,6 +63,11 @@ o2physics_add_dpl_workflow(di-hadron-cor PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGCFCore O2Physics::AnalysisCCDB O2Physics::GFWCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(pid-di-hadron + SOURCES pidDiHadron.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGCFCore O2Physics::AnalysisCCDB O2Physics::GFWCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(longrange-correlation SOURCES longrangeCorrelation.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGCFCore diff --git a/PWGCF/TwoParticleCorrelations/Tasks/pidDiHadron.cxx b/PWGCF/TwoParticleCorrelations/Tasks/pidDiHadron.cxx new file mode 100644 index 00000000000..b5190b2927c --- /dev/null +++ b/PWGCF/TwoParticleCorrelations/Tasks/pidDiHadron.cxx @@ -0,0 +1,717 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file pidDiHadron.cxx +/// \brief di-hadron correlation of PID for O-O, Pb-Pb collisions +/// \author Preet Bhanjan Pati (preet.bhanjan.pati@cern.ch), Zhiyong Lu (zhiyong.lu@cern.ch) +/// \since July/29/2025 + +#include "PWGCF/Core/CorrelationContainer.h" +#include "PWGCF/Core/PairCuts.h" +#include "PWGCF/DataModel/CorrelationsDerived.h" + +#include "Common/Core/RecoDecay.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/CollisionAssociationTables.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/PIDResponseITS.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "CommonConstants/MathConstants.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "DataFormatsParameters/GRPObject.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/StepTHn.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/PID.h" +#include "ReconstructionDataFormats/Track.h" +#include + +#include "TF1.h" +#include "TRandom3.h" +#include + +#include +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +// define the filtered collisions and tracks +#define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable NAME{#NAME, DEFAULT, HELP}; + +struct PidDiHadron { + Service ccdb; + + O2_DEFINE_CONFIGURABLE(cfgCutVtxZ, float, 10.0f, "Accepted z-vertex range") + O2_DEFINE_CONFIGURABLE(cfgCutPtMin, float, 0.2f, "minimum accepted track pT") + O2_DEFINE_CONFIGURABLE(cfgCutPtMax, float, 10.0f, "maximum accepted track pT") + O2_DEFINE_CONFIGURABLE(cfgCutEta, float, 0.8f, "Eta cut") + O2_DEFINE_CONFIGURABLE(cfgCutChi2prTPCcls, float, 2.5f, "max chi2 per TPC clusters") + O2_DEFINE_CONFIGURABLE(cfgCutTPCclu, float, 50.0f, "minimum TPC clusters") + O2_DEFINE_CONFIGURABLE(cfgCutTPCCrossedRows, float, 70.0f, "minimum TPC crossed rows") + O2_DEFINE_CONFIGURABLE(cfgCutITSclu, float, 5.0f, "minimum ITS clusters") + O2_DEFINE_CONFIGURABLE(cfgCutDCAz, float, 2.0f, "max DCA to vertex z") + O2_DEFINE_CONFIGURABLE(cfgCutMerging, float, 0.0, "Merging cut on track merge") + O2_DEFINE_CONFIGURABLE(cfgSelCollByNch, bool, true, "Select collisions by Nch or centrality") + O2_DEFINE_CONFIGURABLE(cfgCutMultMin, int, 0, "Minimum multiplicity for collision") + O2_DEFINE_CONFIGURABLE(cfgCutMultMax, int, 10, "Maximum multiplicity for collision") + O2_DEFINE_CONFIGURABLE(cfgCutCentMin, float, 60.0f, "Minimum centrality for collision") + O2_DEFINE_CONFIGURABLE(cfgCutCentMax, float, 80.0f, "Maximum centrality for collision") + O2_DEFINE_CONFIGURABLE(cfgMixEventNumMin, int, 5, "Minimum number of events to mix") + O2_DEFINE_CONFIGURABLE(cfgRadiusLow, float, 0.8, "Low radius for merging cut") + O2_DEFINE_CONFIGURABLE(cfgRadiusHigh, float, 2.5, "High radius for merging cut") + O2_DEFINE_CONFIGURABLE(cfgSampleSize, double, 10, "Sample size for mixed event") + O2_DEFINE_CONFIGURABLE(cfgCentEstimator, int, 0, "0:FT0C; 1:FT0CVariant1; 2:FT0M; 3:FT0A") + O2_DEFINE_CONFIGURABLE(cfgCentTableUnavailable, bool, false, "if a dataset does not provide centrality information") + O2_DEFINE_CONFIGURABLE(cfgUseAdditionalEventCut, bool, false, "Use additional event cut on mult correlations") + O2_DEFINE_CONFIGURABLE(cfgEvSelkNoSameBunchPileup, bool, false, "rejects collisions which are associated with the same found-by-T0 bunch crossing") + O2_DEFINE_CONFIGURABLE(cfgEvSelkNoITSROFrameBorder, bool, false, "reject events at ITS ROF border") + O2_DEFINE_CONFIGURABLE(cfgEvSelkNoTimeFrameBorder, bool, false, "reject events at TF border") + O2_DEFINE_CONFIGURABLE(cfgEvSelkIsGoodZvtxFT0vsPV, bool, false, "removes collisions with large differences between z of PV by tracks and z of PV from FT0 A-C time difference, use this cut at low multiplicities with caution") + O2_DEFINE_CONFIGURABLE(cfgEvSelkNoCollInTimeRangeStandard, bool, false, "no collisions in specified time range") + O2_DEFINE_CONFIGURABLE(cfgEvSelkIsGoodITSLayersAll, bool, true, "cut time intervals with dead ITS staves") + O2_DEFINE_CONFIGURABLE(cfgEvSelkNoCollInRofStandard, bool, false, "no other collisions in this Readout Frame with per-collision multiplicity above threshold") + O2_DEFINE_CONFIGURABLE(cfgEvSelkNoHighMultCollInPrevRof, bool, false, "veto an event if FT0C amplitude in previous ITS ROF is above threshold") + O2_DEFINE_CONFIGURABLE(cfgEvSelMultCorrelation, bool, true, "Multiplicity correlation cut") + O2_DEFINE_CONFIGURABLE(cfgEvSelV0AT0ACut, bool, true, "V0A T0A 5 sigma cut") + O2_DEFINE_CONFIGURABLE(cfgEvSelOccupancy, bool, true, "Occupancy cut") + O2_DEFINE_CONFIGURABLE(cfgCutOccupancyHigh, int, 2000, "High cut on TPC occupancy") + O2_DEFINE_CONFIGURABLE(cfgCutOccupancyLow, int, 0, "Low cut on TPC occupancy") + O2_DEFINE_CONFIGURABLE(cfgEfficiency, std::string, "", "CCDB path to efficiency object") + O2_DEFINE_CONFIGURABLE(cfgLocalEfficiency, bool, false, "Use local efficiency object") + O2_DEFINE_CONFIGURABLE(cfgVerbosity, bool, false, "Verbose output") + O2_DEFINE_CONFIGURABLE(cfgUseEventWeights, bool, false, "Use event weights for mixed event") + O2_DEFINE_CONFIGURABLE(cfgUsePtOrder, bool, false, "enable trigger pT < associated pT cut") + O2_DEFINE_CONFIGURABLE(cfgUsePtOrderInMixEvent, bool, false, "enable trigger pT < associated pT cut in mixed event") + O2_DEFINE_CONFIGURABLE(cfgPIDUseITSPID, bool, true, "Use ITS PID for particle identification") + O2_DEFINE_CONFIGURABLE(cfgPIDTofPtCut, float, 0.5f, "Minimum pt to use TOF N-sigma") + O2_DEFINE_CONFIGURABLE(cfgPIDParticle, int, 0, "1 = pion, 2 = kaon, 3 = proton, 0 for no PID") + + SliceCache cache; + + ConfigurableAxis axisVertex{"axisVertex", {10, -10, 10}, "vertex axis for histograms"}; + ConfigurableAxis axisMultiplicity{"axisMultiplicity", {VARIABLE_WIDTH, 0, 10, 20, 40, 60, 80, 100, 120, 140, 160, 180, 200, 220, 240, 260}, "multiplicity axis for histograms"}; + ConfigurableAxis axisCentrality{"axisCentrality", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}, "centrality axis for histograms"}; + ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0.2, 0.5, 1, 1.5, 2, 3, 4, 6, 10}, "pt axis for histograms"}; + ConfigurableAxis axisDeltaPhi{"axisDeltaPhi", {72, -PIHalf, PIHalf * 3}, "delta phi axis for histograms"}; + ConfigurableAxis axisDeltaEta{"axisDeltaEta", {48, -2.4, 2.4}, "delta eta axis for histograms"}; + ConfigurableAxis axisPtTrigger{"axisPtTrigger", {VARIABLE_WIDTH, 0.2, 0.5, 1, 1.5, 2, 3, 4, 6, 10}, "pt trigger axis for histograms"}; + ConfigurableAxis axisPtAssoc{"axisPtAssoc", {VARIABLE_WIDTH, 0.2, 0.5, 1, 1.5, 2, 3, 4, 6, 10}, "pt associated axis for histograms"}; + ConfigurableAxis axisVtxMix{"axisVtxMix", {VARIABLE_WIDTH, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, "vertex axis for mixed event histograms"}; + ConfigurableAxis axisMultMix{"axisMultMix", {VARIABLE_WIDTH, 0, 10, 20, 40, 60, 80, 100, 120, 140, 160, 180, 200, 220, 240, 260}, "multiplicity / centrality axis for mixed event histograms"}; + ConfigurableAxis axisSample{"axisSample", {cfgSampleSize, 0, cfgSampleSize}, "sample axis for histograms"}; + Configurable> pidTofNsigmaCut{"pidTofNsigmaCut", std::vector{1.5, 1.5, 1.5, -1.5, -1.5, -1.5}, "TOF n-sigma cut for pions_posNsigma, kaons_posNsigma, protons_posNsigma, pions_negNsigma, kaons_negNsigma, protons_negNsigma"}; + Configurable> pidItsNsigmaCut{"pidItsNsigmaCut", std::vector{3, 3, 3, -3, -3, -3}, "ITS n-sigma cut for pions_posNsigma, kaons_posNsigma, protons_posNsigma, pions_negNsigma, kaons_negNsigma, protons_negNsigma"}; + Configurable> pidTpcNsigmaCut{"pidTpcNsigmaCut", std::vector{10, 10, 10, -10, -10, -10}, "TOF n-sigma cut for pions_posNsigma, kaons_posNsigma, protons_posNsigma, pions_negNsigma, kaons_negNsigma, protons_negNsigma"}; + + ConfigurableAxis axisVertexEfficiency{"axisVertexEfficiency", {10, -10, 10}, "vertex axis for efficiency histograms"}; + ConfigurableAxis axisEtaEfficiency{"axisEtaEfficiency", {20, -1.0, 1.0}, "eta axis for efficiency histograms"}; + ConfigurableAxis axisPtEfficiency{"axisPtEfficiency", {VARIABLE_WIDTH, 0.2, 0.5, 1, 1.5, 2, 3, 4, 6, 10}, "pt axis for efficiency histograms"}; + + // make the filters and cuts. + Filter collisionFilter = (nabs(aod::collision::posZ) < cfgCutVtxZ); + Filter trackFilter = (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtMin) && (aod::track::pt < cfgCutPtMax) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t) true)) && (aod::track::tpcChi2NCl < cfgCutChi2prTPCcls) && (nabs(aod::track::dcaZ) < cfgCutDCAz); + using FilteredCollisions = soa::Filtered>; + using FilteredTracks = soa::Filtered>; + + Preslice perCollision = aod::track::collisionId; + + // Corrections + TH3D* mEfficiency = nullptr; + bool correctionsLoaded = false; + + // Define the outputs + OutputObj same{"sameEvent"}; + OutputObj mixed{"mixedEvent"}; + HistogramRegistry registry{"registry"}; + + // define global variables + TRandom3* gRandom = new TRandom3(); + enum CentEstimators { + kCentFT0C = 0, + kCentFT0CVariant1, + kCentFT0M, + kCentFV0A, + // Count the total number of enum + kCount_CentEstimators + }; + enum EventType { + SameEvent = 1, + MixedEvent = 3 + }; + std::vector tofNsigmaCut; + std::vector itsNsigmaCut; + std::vector tpcNsigmaCut; + o2::aod::ITSResponse itsResponse; + enum Particles { + PIONS, + KAONS, + PROTONS + }; + + // persistent caches + std::vector efficiencyAssociatedCache; + + TF1* fMultPVCutLow = nullptr; + TF1* fMultPVCutHigh = nullptr; + TF1* fMultCutLow = nullptr; + TF1* fMultCutHigh = nullptr; + TF1* fMultMultPVCut = nullptr; + TF1* fT0AV0AMean = nullptr; + TF1* fT0AV0ASigma = nullptr; + + void init(InitContext&) + { + if (cfgCentTableUnavailable && !cfgSelCollByNch) { + LOGF(fatal, "Centrality table is unavailable, cannot select collisions by centrality"); + } + const AxisSpec axisPhi{72, 0.0, constants::math::TwoPI, "#varphi"}; + const AxisSpec axisEta{40, -1., 1., "#eta"}; + + ccdb->setURL("http://alice-ccdb.cern.ch"); + ccdb->setCaching(true); + auto now = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); + ccdb->setCreatedNotAfter(now); + + LOGF(info, "Starting init"); + + // Event Counter + if (doprocessSame && cfgUseAdditionalEventCut) { + registry.add("hEventCountSpecific", "Number of Event;; Count", {HistType::kTH1D, {{12, 0, 12}}}); + registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(1, "after sel8"); + registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(2, "kNoSameBunchPileup"); + registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(3, "kNoITSROFrameBorder"); + registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(4, "kNoTimeFrameBorder"); + registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(5, "kIsGoodZvtxFT0vsPV"); + registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(6, "kNoCollInTimeRangeStandard"); + registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(7, "kIsGoodITSLayersAll"); + registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(8, "kNoCollInRofStandard"); + registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(9, "kNoHighMultCollInPrevRof"); + registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(10, "occupancy"); + registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(11, "MultCorrelation"); + registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(12, "cfgEvSelV0AT0ACut"); + } + + if (cfgUseAdditionalEventCut) { + fMultPVCutLow = new TF1("fMultPVCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x - 3.5*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", 0, 100); + fMultPVCutLow->SetParameters(3257.29, -121.848, 1.98492, -0.0172128, 6.47528e-05, 154.756, -1.86072, -0.0274713, 0.000633499, -3.37757e-06); + fMultPVCutHigh = new TF1("fMultPVCutHigh", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x + 3.5*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", 0, 100); + fMultPVCutHigh->SetParameters(3257.29, -121.848, 1.98492, -0.0172128, 6.47528e-05, 154.756, -1.86072, -0.0274713, 0.000633499, -3.37757e-06); + + fMultCutLow = new TF1("fMultCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x - 2.*([4]+[5]*x+[6]*x*x+[7]*x*x*x+[8]*x*x*x*x)", 0, 100); + fMultCutLow->SetParameters(1654.46, -47.2379, 0.449833, -0.0014125, 150.773, -3.67334, 0.0530503, -0.000614061, 3.15956e-06); + fMultCutHigh = new TF1("fMultCutHigh", "[0]+[1]*x+[2]*x*x+[3]*x*x*x + 3.*([4]+[5]*x+[6]*x*x+[7]*x*x*x+[8]*x*x*x*x)", 0, 100); + fMultCutHigh->SetParameters(1654.46, -47.2379, 0.449833, -0.0014125, 150.773, -3.67334, 0.0530503, -0.000614061, 3.15956e-06); + + fT0AV0AMean = new TF1("fT0AV0AMean", "[0]+[1]*x", 0, 200000); + fT0AV0AMean->SetParameters(-1601.0581, 9.417652e-01); + fT0AV0ASigma = new TF1("fT0AV0ASigma", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x", 0, 200000); + fT0AV0ASigma->SetParameters(463.4144, 6.796509e-02, -9.097136e-07, 7.971088e-12, -2.600581e-17); + } + + std::string hCentTitle = "Centrality distribution, Estimator " + std::to_string(cfgCentEstimator); + // Make histograms to check the distributions after cuts + if (doprocessSame) { + registry.add("deltaEta_deltaPhi_same", "", {HistType::kTH2D, {axisDeltaPhi, axisDeltaEta}}); // check to see the delta eta and delta phi distribution + registry.add("deltaEta_deltaPhi_mixed", "", {HistType::kTH2D, {axisDeltaPhi, axisDeltaEta}}); + registry.add("Phi", "Phi", {HistType::kTH1D, {axisPhi}}); + registry.add("Eta", "Eta", {HistType::kTH1D, {axisEta}}); + registry.add("EtaCorrected", "EtaCorrected", {HistType::kTH1D, {axisEta}}); + registry.add("pT", "pT", {HistType::kTH1D, {axisPtTrigger}}); + registry.add("pTCorrected", "pTCorrected", {HistType::kTH1D, {axisPtTrigger}}); + registry.add("Nch", "N_{ch}", {HistType::kTH1D, {axisMultiplicity}}); + registry.add("Nch_used", "N_{ch}", {HistType::kTH1D, {axisMultiplicity}}); // histogram to see how many events are in the same and mixed event + registry.add("Centrality", hCentTitle.c_str(), {HistType::kTH1D, {axisCentrality}}); + registry.add("Centrality_used", hCentTitle.c_str(), {HistType::kTH1D, {axisCentrality}}); // histogram to see how many events are in the same and mixed event + registry.add("zVtx", "zVtx", {HistType::kTH1D, {axisVertex}}); + registry.add("zVtx_used", "zVtx_used", {HistType::kTH1D, {axisVertex}}); + registry.add("Trig_hist", "", {HistType::kTHnSparseF, {{axisSample, axisVertex, axisPtTrigger}}}); + } + + registry.add("eventcount", "bin", {HistType::kTH1F, {{4, 0, 4, "bin"}}}); // histogram to see how many events are in the same and mixed event + + LOGF(info, "Initializing correlation container"); + std::vector corrAxis = {{axisSample, "Sample"}, + {axisVertex, "z-vtx (cm)"}, + {axisPtTrigger, "p_{T} (GeV/c)"}, + {axisPtAssoc, "p_{T} (GeV/c)"}, + {axisDeltaPhi, "#Delta#varphi (rad)"}, + {axisDeltaEta, "#Delta#eta"}}; + std::vector effAxis = { + {axisEtaEfficiency, "#eta"}, + {axisPtEfficiency, "p_{T} (GeV/c)"}, + {axisVertexEfficiency, "z-vtx (cm)"}, + }; + std::vector userAxis; + + same.setObject(new CorrelationContainer("sameEvent", "sameEvent", corrAxis, effAxis, userAxis)); + mixed.setObject(new CorrelationContainer("mixedEvent", "mixedEvent", corrAxis, effAxis, userAxis)); + + tofNsigmaCut = pidTofNsigmaCut; + itsNsigmaCut = pidItsNsigmaCut; + tpcNsigmaCut = pidTpcNsigmaCut; + + LOGF(info, "End of init"); + } + + int getMagneticField(uint64_t timestamp) + { + // Get the magnetic field + static o2::parameters::GRPMagField* grpo = nullptr; + if (grpo == nullptr) { + grpo = ccdb->getForTimeStamp("/GLO/Config/GRPMagField", timestamp); + if (grpo == nullptr) { + LOGF(fatal, "GRP object not found for timestamp %llu", timestamp); + return 0; + } + LOGF(info, "Retrieved GRP for timestamp %llu with magnetic field of %d kG", timestamp, grpo->getNominalL3Field()); + } + return grpo->getNominalL3Field(); + } + + template + float getCentrality(TCollision const& collision) + { + float cent; + switch (cfgCentEstimator) { + case kCentFT0C: + cent = collision.centFT0C(); + break; + case kCentFT0CVariant1: + cent = collision.centFT0CVariant1(); + break; + case kCentFT0M: + cent = collision.centFT0M(); + break; + case kCentFV0A: + cent = collision.centFV0A(); + break; + default: + cent = collision.centFT0C(); + } + return cent; + } + + template + bool trackSelected(TTrack track) + { + if (cfgPIDParticle && getNsigmaPID(track) != cfgPIDParticle) { + return false; + } + return ((track.tpcNClsFound() >= cfgCutTPCclu) && (track.tpcNClsCrossedRows() >= cfgCutTPCCrossedRows) && (track.itsNCls() >= cfgCutITSclu)); + } + + void loadEfficiency(uint64_t timestamp) + { + if (correctionsLoaded) { + return; + } + if (cfgEfficiency.value.empty() == false) { + if (cfgLocalEfficiency > 0) { + TFile* fEfficiencyTrigger = TFile::Open(cfgEfficiency.value.c_str(), "READ"); + mEfficiency = reinterpret_cast(fEfficiencyTrigger->Get("ccdb_object")); + } else { + mEfficiency = ccdb->getForTimeStamp(cfgEfficiency, timestamp); + } + if (mEfficiency == nullptr) { + LOGF(fatal, "Could not load efficiency histogram for trigger particles from %s", cfgEfficiency.value.c_str()); + } + LOGF(info, "Loaded efficiency histogram from %s (%p)", cfgEfficiency.value.c_str(), (void*)mEfficiency); + } + correctionsLoaded = true; + } + + bool getEfficiencyCorrection(float& weight_nue, float eta, float pt, float posZ) + { + float eff = 1.; + if (mEfficiency) { + int etaBin = mEfficiency->GetXaxis()->FindBin(eta); + int ptBin = mEfficiency->GetYaxis()->FindBin(pt); + int zBin = mEfficiency->GetZaxis()->FindBin(posZ); + eff = mEfficiency->GetBinContent(etaBin, ptBin, zBin); + } else { + eff = 1.0; + } + if (eff == 0) + return false; + weight_nue = 1. / eff; + return true; + } + + // fill multiple histograms + template + void fillYield(TCollision collision, TTracks tracks) // function to fill the yield and etaphi histograms. + { + float weff1 = 1; + float vtxz = collision.posZ(); + for (auto const& track1 : tracks) { + if (!trackSelected(track1)) + continue; + if (!getEfficiencyCorrection(weff1, track1.eta(), track1.pt(), vtxz)) + continue; + registry.fill(HIST("Phi"), RecoDecay::constrainAngle(track1.phi(), 0.0)); + registry.fill(HIST("Eta"), track1.eta()); + registry.fill(HIST("EtaCorrected"), track1.eta(), weff1); + registry.fill(HIST("pT"), track1.pt()); + registry.fill(HIST("pTCorrected"), track1.pt(), weff1); + } + } + + template + float getDPhiStar(TTrack const& track1, TTrackAssoc const& track2, float radius, int magField) + { + float charge1 = track1.sign(); + float charge2 = track2.sign(); + + float phi1 = track1.phi(); + float phi2 = track2.phi(); + + float pt1 = track1.pt(); + float pt2 = track2.pt(); + + int fbSign = (magField > 0) ? 1 : -1; + + float dPhiStar = phi1 - phi2 - charge1 * fbSign * std::asin(0.075 * radius / pt1) + charge2 * fbSign * std::asin(0.075 * radius / pt2); + + if (dPhiStar > constants::math::PI) + dPhiStar = constants::math::TwoPI - dPhiStar; + if (dPhiStar < -constants::math::PI) + dPhiStar = -constants::math::TwoPI - dPhiStar; + + return dPhiStar; + } + + template + void fillCorrelations(TTracks tracks1, TTracksAssoc tracks2, float posZ, int system, int magneticField, float cent, float eventWeight) // function to fill the Output functions (sparse) and the delta eta and delta phi histograms + { + // Cache efficiency for particles (too many FindBin lookups) + if (mEfficiency) { + efficiencyAssociatedCache.clear(); + efficiencyAssociatedCache.reserve(tracks2.size()); + for (const auto& track2 : tracks2) { + float weff = 1.; + getEfficiencyCorrection(weff, track2.eta(), track2.pt(), posZ); + efficiencyAssociatedCache.push_back(weff); + } + } + + if (system == SameEvent) { + if (!cfgCentTableUnavailable) + registry.fill(HIST("Centrality_used"), cent); + registry.fill(HIST("Nch_used"), tracks1.size()); + } + + int fSampleIndex = gRandom->Uniform(0, cfgSampleSize); + + float triggerWeight = 1.0f; + float associatedWeight = 1.0f; + // loop over all tracks + for (auto const& track1 : tracks1) { + + if (!trackSelected(track1)) + continue; + if (!getEfficiencyCorrection(triggerWeight, track1.eta(), track1.pt(), posZ)) + continue; + if (system == SameEvent) { + registry.fill(HIST("Trig_hist"), fSampleIndex, posZ, track1.pt(), eventWeight * triggerWeight); + } + + for (auto const& track2 : tracks2) { + + if (!trackSelected(track2)) + continue; + if (mEfficiency) { + associatedWeight = efficiencyAssociatedCache[track2.filteredIndex()]; + } + + if (!cfgUsePtOrder && track1.globalIndex() == track2.globalIndex()) + continue; // For pt-differential correlations, skip if the trigger and associate are the same track + if (cfgUsePtOrder && system == SameEvent && track1.pt() <= track2.pt()) + continue; // Without pt-differential correlations, skip if the trigger pt is less than the associate pt + if (cfgUsePtOrder && system == MixedEvent && cfgUsePtOrderInMixEvent && track1.pt() <= track2.pt()) + continue; // For pt-differential correlations in mixed events, skip if the trigger pt is less than the associate pt + + float deltaPhi = RecoDecay::constrainAngle(track1.phi() - track2.phi(), -PIHalf); + float deltaEta = track1.eta() - track2.eta(); + + if (std::abs(deltaEta) < cfgCutMerging) { + + double dPhiStarHigh = getDPhiStar(track1, track2, cfgRadiusHigh, magneticField); + double dPhiStarLow = getDPhiStar(track1, track2, cfgRadiusLow, magneticField); + + const double kLimit = 3.0 * cfgCutMerging; + + bool bIsBelow = false; + + if (std::abs(dPhiStarLow) < kLimit || std::abs(dPhiStarHigh) < kLimit || dPhiStarLow * dPhiStarHigh < 0) { + for (double rad(cfgRadiusLow); rad < cfgRadiusHigh; rad += 0.01) { + double dPhiStar = getDPhiStar(track1, track2, rad, magneticField); + if (std::abs(dPhiStar) < kLimit) { + bIsBelow = true; + break; + } + } + if (bIsBelow) + continue; + } + } + + // fill the right sparse and histograms + if (system == SameEvent) { + + same->getPairHist()->Fill(step, fSampleIndex, posZ, track1.pt(), track2.pt(), deltaPhi, deltaEta, eventWeight * triggerWeight * associatedWeight); + registry.fill(HIST("deltaEta_deltaPhi_same"), deltaPhi, deltaEta, eventWeight * triggerWeight * associatedWeight); + } else if (system == MixedEvent) { + + mixed->getPairHist()->Fill(step, fSampleIndex, posZ, track1.pt(), track2.pt(), deltaPhi, deltaEta, eventWeight * triggerWeight * associatedWeight); + registry.fill(HIST("deltaEta_deltaPhi_mixed"), deltaPhi, deltaEta, eventWeight * triggerWeight * associatedWeight); + } + } + } + } + + template + bool eventSelected(TCollision collision, const int multTrk, const float centrality, const bool fillCounter) + { + registry.fill(HIST("hEventCountSpecific"), 0.5); + if (cfgEvSelkNoSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + // rejects collisions which are associated with the same "found-by-T0" bunch crossing + // https://indico.cern.ch/event/1396220/#1-event-selection-with-its-rof + return 0; + } + if (fillCounter && cfgEvSelkNoSameBunchPileup) + registry.fill(HIST("hEventCountSpecific"), 1.5); + if (cfgEvSelkNoITSROFrameBorder && !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { + return 0; + } + if (fillCounter && cfgEvSelkNoITSROFrameBorder) + registry.fill(HIST("hEventCountSpecific"), 2.5); + if (cfgEvSelkNoTimeFrameBorder && !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { + return 0; + } + if (fillCounter && cfgEvSelkNoTimeFrameBorder) + registry.fill(HIST("hEventCountSpecific"), 3.5); + if (cfgEvSelkIsGoodZvtxFT0vsPV && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + // removes collisions with large differences between z of PV by tracks and z of PV from FT0 A-C time difference + // use this cut at low multiplicities with caution + return 0; + } + if (fillCounter && cfgEvSelkIsGoodZvtxFT0vsPV) + registry.fill(HIST("hEventCountSpecific"), 4.5); + if (cfgEvSelkNoCollInTimeRangeStandard && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + // no collisions in specified time range + return 0; + } + if (fillCounter && cfgEvSelkNoCollInTimeRangeStandard) + registry.fill(HIST("hEventCountSpecific"), 5.5); + if (cfgEvSelkIsGoodITSLayersAll && !collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + // from Jan 9 2025 AOT meeting + // cut time intervals with dead ITS staves + return 0; + } + if (fillCounter && cfgEvSelkIsGoodITSLayersAll) + registry.fill(HIST("hEventCountSpecific"), 6.5); + if (cfgEvSelkNoCollInRofStandard && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStandard)) { + // no other collisions in this Readout Frame with per-collision multiplicity above threshold + return 0; + } + if (fillCounter && cfgEvSelkNoCollInRofStandard) + registry.fill(HIST("hEventCountSpecific"), 7.5); + if (cfgEvSelkNoHighMultCollInPrevRof && !collision.selection_bit(o2::aod::evsel::kNoHighMultCollInPrevRof)) { + // veto an event if FT0C amplitude in previous ITS ROF is above threshold + return 0; + } + if (fillCounter && cfgEvSelkNoHighMultCollInPrevRof) + registry.fill(HIST("hEventCountSpecific"), 8.5); + auto occupancy = collision.trackOccupancyInTimeRange(); + if (cfgEvSelOccupancy && (occupancy < cfgCutOccupancyLow || occupancy > cfgCutOccupancyHigh)) + return 0; + if (fillCounter && cfgEvSelOccupancy) + registry.fill(HIST("hEventCountSpecific"), 9.5); + + auto multNTracksPV = collision.multNTracksPV(); + if (cfgEvSelMultCorrelation) { + if (multNTracksPV < fMultPVCutLow->Eval(centrality)) + return 0; + if (multNTracksPV > fMultPVCutHigh->Eval(centrality)) + return 0; + if (multTrk < fMultCutLow->Eval(centrality)) + return 0; + if (multTrk > fMultCutHigh->Eval(centrality)) + return 0; + } + if (fillCounter && cfgEvSelMultCorrelation) + registry.fill(HIST("hEventCountSpecific"), 10.5); + + // V0A T0A 5 sigma cut + float sigma = 5.0; + if (cfgEvSelV0AT0ACut && (std::fabs(collision.multFV0A() - fT0AV0AMean->Eval(collision.multFT0A())) > sigma * fT0AV0ASigma->Eval(collision.multFT0A()))) + return 0; + if (fillCounter && cfgEvSelV0AT0ACut) + registry.fill(HIST("hEventCountSpecific"), 11.5); + + return 1; + } + + void processSame(FilteredCollisions::iterator const& collision, FilteredTracks const& tracks, aod::BCsWithTimestamps const&) + { + if (!collision.sel8()) + return; + auto bc = collision.bc_as(); + float cent = -1.; + if (!cfgCentTableUnavailable) + cent = getCentrality(collision); + if (cfgUseAdditionalEventCut && !eventSelected(collision, tracks.size(), cent, true)) + return; + + if (!cfgCentTableUnavailable) + registry.fill(HIST("Centrality"), cent); + registry.fill(HIST("Nch"), tracks.size()); + registry.fill(HIST("zVtx"), collision.posZ()); + + if (cfgSelCollByNch && (tracks.size() < cfgCutMultMin || tracks.size() >= cfgCutMultMax)) { + return; + } + if (!cfgSelCollByNch && !cfgCentTableUnavailable && (cent < cfgCutCentMin || cent >= cfgCutCentMax)) { + return; + } + + loadEfficiency(bc.timestamp()); + registry.fill(HIST("eventcount"), SameEvent); // because its same event i put it in the 1 bin + fillYield(collision, tracks); + + same->fillEvent(tracks.size(), CorrelationContainer::kCFStepReconstructed); + fillCorrelations(tracks, tracks, collision.posZ(), SameEvent, getMagneticField(bc.timestamp()), cent, 1.0f); + } + PROCESS_SWITCH(PidDiHadron, processSame, "Process same event", true); + + // the process for filling the mixed events + void processMixed(FilteredCollisions const& collisions, FilteredTracks const& tracks, aod::BCsWithTimestamps const&) + { + + auto getTracksSize = [&tracks, this](FilteredCollisions::iterator const& collision) { + auto associatedTracks = tracks.sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), this->cache); + auto mult = associatedTracks.size(); + return mult; + }; + + using MixedBinning = FlexibleBinningPolicy, aod::collision::PosZ, decltype(getTracksSize)>; + + MixedBinning binningOnVtxAndMult{{getTracksSize}, {axisVtxMix, axisMultMix}, true}; + + auto tracksTuple = std::make_tuple(tracks, tracks); + Pair pairs{binningOnVtxAndMult, cfgMixEventNumMin, -1, collisions, tracksTuple, &cache}; // -1 is the number of the bin to skip + for (auto it = pairs.begin(); it != pairs.end(); it++) { + auto& [collision1, tracks1, collision2, tracks2] = *it; + if (!collision1.sel8() || !collision2.sel8()) + continue; + + if (cfgSelCollByNch && (tracks1.size() < cfgCutMultMin || tracks1.size() >= cfgCutMultMax)) + continue; + + if (cfgSelCollByNch && (tracks2.size() < cfgCutMultMin || tracks2.size() >= cfgCutMultMax)) + continue; + + float cent1 = -1; + float cent2 = -1; + if (!cfgCentTableUnavailable) { + cent1 = getCentrality(collision1); + cent2 = getCentrality(collision2); + } + if (cfgUseAdditionalEventCut && !eventSelected(collision1, tracks1.size(), cent1, false)) + continue; + if (cfgUseAdditionalEventCut && !eventSelected(collision2, tracks2.size(), cent2, false)) + continue; + + if (!cfgSelCollByNch && !cfgCentTableUnavailable && (cent1 < cfgCutCentMin || cent1 >= cfgCutCentMax)) + continue; + + if (!cfgSelCollByNch && !cfgCentTableUnavailable && (cent2 < cfgCutCentMin || cent2 >= cfgCutCentMax)) + continue; + + registry.fill(HIST("eventcount"), MixedEvent); // fill the mixed event in the 3 bin + auto bc = collision1.bc_as(); + loadEfficiency(bc.timestamp()); + float eventWeight = 1.0f; + if (cfgUseEventWeights) { + eventWeight = 1.0f / it.currentWindowNeighbours(); + } + + fillCorrelations(tracks1, tracks2, collision1.posZ(), MixedEvent, getMagneticField(bc.timestamp()), cent1, eventWeight); + } + } + PROCESS_SWITCH(PidDiHadron, processMixed, "Process mixed events", true); + + template + int getNsigmaPID(TTrack track) + { + // Computing Nsigma arrays for pion, kaon, and protons + std::array nSigmaTPC = {track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr()}; + std::array nSigmaTOF = {track.tofNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPr()}; + std::array nSigmaITS = {itsResponse.nSigmaITS(track), itsResponse.nSigmaITS(track), itsResponse.nSigmaITS(track)}; + int pid = -1; + + std::array nSigmaToUse = cfgPIDUseITSPID ? nSigmaITS : nSigmaTPC; // Choose which nSigma to use: TPC or ITS + std::vector detectorNsigmaCut = cfgPIDUseITSPID ? itsNsigmaCut : tpcNsigmaCut; // Choose which nSigma to use: TPC or ITS + + bool isPion, isKaon, isProton; + bool isDetectedPion = nSigmaToUse[0] < detectorNsigmaCut[0] && nSigmaToUse[0] > detectorNsigmaCut[0 + 3]; + bool isDetectedKaon = nSigmaToUse[1] < detectorNsigmaCut[1] && nSigmaToUse[1] > detectorNsigmaCut[1 + 3]; + bool isDetectedProton = nSigmaToUse[2] < detectorNsigmaCut[2] && nSigmaToUse[2] > detectorNsigmaCut[2 + 3]; + + bool isTofPion = nSigmaTOF[0] < tofNsigmaCut[0] && nSigmaTOF[0] > tofNsigmaCut[0 + 3]; + bool isTofKaon = nSigmaTOF[1] < tofNsigmaCut[1] && nSigmaTOF[1] > tofNsigmaCut[1 + 3]; + bool isTofProton = nSigmaTOF[2] < tofNsigmaCut[2] && nSigmaTOF[2] > tofNsigmaCut[2 + 3]; + + if (track.pt() > cfgPIDTofPtCut && !track.hasTOF()) { + return 0; + } else if (track.pt() > cfgPIDTofPtCut && track.hasTOF()) { + isPion = isTofPion && isDetectedPion; + isKaon = isTofKaon && isDetectedKaon; + isProton = isTofProton && isDetectedProton; + } else { + isPion = isDetectedPion; + isKaon = isDetectedKaon; + isProton = isDetectedProton; + } + + if ((isPion && isKaon) || (isPion && isProton) || (isKaon && isProton)) { + return 0; // more than one particle satisfy the criteria + } + + if (isPion) { + pid = PIONS; + } else if (isKaon) { + pid = KAONS; + } else if (isProton) { + pid = PROTONS; + } else { + return 0; // no particle satisfies the criteria + } + + return pid + 1; // shift the pid by 1, 1 = pion, 2 = kaon, 3 = proton + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc), + }; +} From 777be95aed8b630669df9c85f7d1ad73c96e9f52 Mon Sep 17 00:00:00 2001 From: Roman Lietava Date: Thu, 31 Jul 2025 18:14:16 +0200 Subject: [PATCH 166/345] [Common] fix: quick for returning rate for outside range (#12357) --- Common/CCDB/ctpRateFetcher.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Common/CCDB/ctpRateFetcher.cxx b/Common/CCDB/ctpRateFetcher.cxx index e20fc41616c..09c50d854f5 100644 --- a/Common/CCDB/ctpRateFetcher.cxx +++ b/Common/CCDB/ctpRateFetcher.cxx @@ -69,7 +69,7 @@ double ctpRateFetcher::fetchCTPratesClasses(o2::ccdb::BasicCCDBManager* /*ccdb*/ LOG(warn) << "Trigger class " << className << " not found in CTPConfiguration"; return -1.; } - auto rate{mScalers->getRateGivenT(timeStamp * 1.e-3, classIndex, inputType)}; + auto rate{mScalers->getRateGivenT(timeStamp * 1.e-3, classIndex, inputType, 1)}; return pileUpCorrection(rate.second); } @@ -77,7 +77,7 @@ double ctpRateFetcher::fetchCTPratesInputs(o2::ccdb::BasicCCDBManager* /*ccdb*/, { std::vector recs = mScalers->getScalerRecordO2(); if (recs[0].scalersInps.size() == 48) { - return pileUpCorrection(mScalers->getRateGivenT(timeStamp * 1.e-3, input, 7).second); + return pileUpCorrection(mScalers->getRateGivenT(timeStamp * 1.e-3, input, 7, 1).second); } else { LOG(error) << "Inputs not available"; return -1.; From 27e1955013a6710b8ee99ff3447e259abfc42492 Mon Sep 17 00:00:00 2001 From: sarjeetagami <162087855+sarjeetagami@users.noreply.github.com> Date: Thu, 31 Jul 2025 22:06:40 +0530 Subject: [PATCH 167/345] [PWGLF] added event selection in MC (#12356) Co-authored-by: sarjeeta gami --- .../Tasks/Resonances/phianalysisrun3_PbPb.cxx | 650 +++++++++++++----- 1 file changed, 491 insertions(+), 159 deletions(-) diff --git a/PWGLF/Tasks/Resonances/phianalysisrun3_PbPb.cxx b/PWGLF/Tasks/Resonances/phianalysisrun3_PbPb.cxx index 018814b1581..85a44210307 100644 --- a/PWGLF/Tasks/Resonances/phianalysisrun3_PbPb.cxx +++ b/PWGLF/Tasks/Resonances/phianalysisrun3_PbPb.cxx @@ -83,8 +83,8 @@ struct phianalysisrun3_PbPb { Configurable cfgCutEta{"cfgCutEta", 0.8, "Eta cut on daughter track"}; Configurable cfgCutDCAxy{"cfgCutDCAxy", 2.0f, "DCAxy range for tracks"}; Configurable cfgCutDCAz{"cfgCutDCAz", 2.0f, "DCAz range for tracks"}; - Configurable nsigmaCutTPC{"nsigmacutTPC", 2.0, "Value of the TPC Nsigma cut"}; - Configurable nsigmaCutTOF{"nsigmacutTOF", 2.0, "Value of the TOF Nsigma cut"}; + Configurable nsigmacutTPC{"nsigmacutTPC", 2.0f, "Value of the TPC Nsigma cut"}; + Configurable nsigmacutTOF{"nsigmacutTOF", 2.0f, "Value of the TOF Nsigma cut"}; Configurable nsigmaCutCombined{"nsigmaCutCombined", 3.0, "Value of the TOF Nsigma cut"}; Configurable cfgNoMixedEvents{"cfgNoMixedEvents", 5, "Number of mixed events per event"}; Configurable fillOccupancy{"fillOccupancy", true, "fill Occupancy"}; @@ -93,6 +93,8 @@ struct phianalysisrun3_PbPb { Configurable additionalEvSel2{"additionalEvSel2", true, "Additional evsel2"}; Configurable additionalEvSel3{"additionalEvSel3", true, "Additional evsel3"}; Configurable additionalEvSel4{"additionalEvSel4", true, "Additional evsel4"}; + Configurable additionalEvSel5{"additionalEvSel5", true, "Additional evsel5"}; + Configurable additionalEvSel6{"additionalEvSel6", true, "Additional evsel6"}; Configurable cfgMultFT0{"cfgMultFT0", true, "cfgMultFT0"}; Configurable iscustomDCAcut{"iscustomDCAcut", false, "iscustomDCAcut"}; Configurable ismanualDCAcut{"ismanualDCAcut", true, "ismanualDCAcut"}; @@ -104,10 +106,10 @@ struct phianalysisrun3_PbPb { Configurable cfgDeepAngle{"cfgDeepAngle", 0.04, "Deep Angle cut value"}; Configurable nBkgRotations{"nBkgRotations", 3, "Number of rotated copies (background) per each original candidate"}; Configurable fillRotation{"fillRotation", true, "fill rotation"}; - Configurable confMinRot{"confMinRot", 5.0 * TMath::Pi() / 6.0, "Minimum of rotation"}; - Configurable confMaxRot{"confMaxRot", 7.0 * TMath::Pi() / 6.0, "Maximum of rotation"}; - Configurable PDGcheck{"PDGcheck", true, "PDGcheck"}; - Configurable Reco{"Reco", true, "Reco"}; + Configurable confMinRot{"confMinRot", 5.0f * TMath::Pi() / 6.0f, "Minimum of rotation"}; + Configurable confMaxRot{"confMaxRot", 7.0f * TMath::Pi() / 6.0f, "Maximum of rotation"}; + Configurable pdgcheck{"pdgcheck", true, "pdgcheck"}; + Configurable reco{"reco", true, "reco"}; ConfigurableAxis binsImpactPar{"binsImpactPar", {VARIABLE_WIDTH, 0, 3.5, 5.67, 7.45, 8.85, 10.0, 11.21, 12.26, 13.28, 14.23, 15.27}, "Binning of the impact parameter axis"}; ConfigurableAxis binsPt{"binsPt", {VARIABLE_WIDTH, 0.0, 0.1, 0.2, 0.3, 0.4, 0.6, 0.8, 1, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0, 3.5, 4.0, 4.5, 5.0, 6.0, 7.0, 8.0, 10.0, 12.0}, "Binning of the pT axis"}; ConfigurableAxis binsCent{"binsCent", {VARIABLE_WIDTH, 0.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 110.0}, "Binning of the centrality axis"}; @@ -167,12 +169,25 @@ struct phianalysisrun3_PbPb { histos.add("h1Phi1massrec", "Phi meson Rec", kTH1F, {{200, 0.9, 1.1}}); histos.add("h1Phipt", "Phi meson Rec", kTH1F, {{200, 0.0f, 20.0f}}); histos.add("hOccupancy1", "Occupancy distribution", kTH1F, {{500, 0, 50000}}); + histos.add("h1PhifinalRec", "Phi meson Rec", kTH1F, {{200, 0.0f, 20.0f}}); + histos.add("h1Phifinalgenmass", "Phi meson gen mass", kTH1F, {{200, 0.9, 1.1}}); + histos.add("h3PhifinalRec", "Phi meson Rec", kTH3F, {{200, 0.0f, 20.0f}, {200, 0.0, 200.0}, {200, 0.9, 1.1}}); + histos.add("h1PhifinalGen", "Phi meson Gen", kTH1F, {{200, 0.0f, 20.0f}}); + histos.add("h2PhifinalGen", "Phi meson Gen", kTH2F, {{200, 0.0f, 20.0f}, {200, 0.0, 200.0}}); + histos.add("hMC1", "MC Event statistics", kTH1F, {{15, 0.0f, 15.0f}}); + histos.add("Centrec1", "MC Centrality", kTH1F, {{200, 0.0, 200.0}}); + histos.add("Centgen1", "MC Centrality", kTH1F, {{200, 0.0, 200.0}}); + histos.add("h1PhiRecsplit1", "Phi meson Rec split", kTH1F, {{200, 0.0f, 20.0f}}); histos.add("hImpactParameterGen", "Impact parameter of generated MC events", kTH1F, {impactParAxis}); histos.add("hImpactParameterRec", "Impact parameter of generated MC events", kTH1F, {impactParAxis}); histos.add("hImpactParameterGenCen", "Impact parameter of generated MC events", kTH2F, {impactParAxis, centAxis}); histos.add("hImpactParameterRecCen", "Impact parameter of generated MC events", kTH2F, {impactParAxis, centAxis}); histos.add("TOF_Nsigma_MC", "TOF NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{Kaon};", {HistType::kTH3D, {{200, -12, 12}, {200, 0.0, 200.0}, {200, 0.0f, 20.0f}}}); histos.add("TPC_Nsigma_MC", "TPC NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Kaon};", {HistType::kTH3D, {{200, -12, 12}, {200, 0.0, 200.0}, {200, 0.0f, 20.0f}}}); + histos.add("TOF_Nsigma1_MC", "TOF NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{Kaon};", {HistType::kTH3D, {{200, -12, 12}, {200, 0.0, 200.0}, {200, 0.0f, 20.0f}}}); + histos.add("TPC_Nsigma1_MC", "TPC NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Kaon};", {HistType::kTH3D, {{200, -12, 12}, {200, 0.0, 200.0}, {200, 0.0f, 20.0f}}}); + histos.add("trkDCAxy", "DCAxy distribution of positive kaon track candidates", HistType::kTH1F, {{150, -1.0f, 1.0f}}); + histos.add("trkDCAz", "DCAxy distribution of negative kaon track candidates", HistType::kTH1F, {{150, -1.0f, 1.0f}}); if (doprocessEvtLossSigLossMC) { histos.add("QAevent/hImpactParameterGen", "Impact parameter of generated MC events", kTH1F, {impactParAxis}); histos.add("QAevent/hImpactParameterRec", "Impact parameter of selected MC events", kTH1F, {impactParAxis}); @@ -255,10 +270,10 @@ struct phianalysisrun3_PbPb { if (!isNoTOF && candidate.hasTOF() && (candidate.tofNSigmaKa() * candidate.tofNSigmaKa() + candidate.tpcNSigmaKa() * candidate.tpcNSigmaKa()) < (nsigmaCutCombined * nsigmaCutCombined)) { return true; } - if (!isNoTOF && !candidate.hasTOF() && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) { + if (!isNoTOF && !candidate.hasTOF() && std::abs(candidate.tpcNSigmaKa()) < nsigmacutTPC) { return true; } - if (isNoTOF && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) { + if (isNoTOF && std::abs(candidate.tpcNSigmaKa()) < nsigmacutTPC) { return true; } return false; @@ -266,10 +281,10 @@ struct phianalysisrun3_PbPb { template bool selectionPIDpTdependent(const T& candidate) { - if (!candidate.hasTOF() && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) { + if (!candidate.hasTOF() && std::abs(candidate.tpcNSigmaKa()) < nsigmacutTPC) { return true; } - if (candidate.hasTOF() && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC && TMath::Abs(candidate.tofNSigmaKa()) < nsigmaCutTOF) { + if (candidate.hasTOF() && std::abs(candidate.tpcNSigmaKa()) < nsigmacutTPC && std::abs(candidate.tofNSigmaKa()) < nsigmacutTOF) { return true; } return false; @@ -279,17 +294,32 @@ struct phianalysisrun3_PbPb { { if (std::abs(collision.posZ()) > cfgCutVertex) return false; + if (!collision.sel8()) return false; - if (additionalEvSel2 && (!collision.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) + + if (additionalEvSel1 && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) + return false; + + if (additionalEvSel2 && !collision.selection_bit(aod::evsel::kNoITSROFrameBorder)) + return false; + + if (additionalEvSel3 && !collision.selection_bit(aod::evsel::kNoSameBunchPileup)) + return false; + + if (additionalEvSel4 && !collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) + return false; + if (additionalEvSel5 && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) return false; - if (additionalEvSel3 && (!collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard))) + if (additionalEvSel6 && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStandard)) return false; int occupancy = collision.trackOccupancyInTimeRange(); if (fillOccupancy && (occupancy > cfgCutOccupancy)) return false; + return true; } + // deep angle cut on pair to remove photon conversion template bool selectionPair(const T1& candidate1, const T2& candidate2) @@ -301,26 +331,39 @@ struct phianalysisrun3_PbPb { pz2 = candidate2.pz(); p1 = candidate1.p(); p2 = candidate2.p(); - angle = TMath::ACos((pt1 * pt2 + pz1 * pz2) / (p1 * p2)); + angle = std::acos((pt1 * pt2 + pz1 * pz2) / (p1 * p2)); if (isDeepAngle && angle < cfgDeepAngle) { return false; } return true; } template - void FillinvMass(const T1& candidate1, const T2& candidate2, float multiplicity, bool unlike, bool mix, float massd1, float massd2) + void fillinvMass(const T1& candidate1, const T2& candidate2, float multiplicity, bool unlike, bool mix, float massd1, float massd2) { - pvec0 = array{candidate1.px(), candidate1.py(), candidate1.pz()}; - pvec1 = array{candidate2.px(), candidate2.py(), candidate2.pz()}; - auto arrMom = array{pvec0, pvec1}; + pvec0 = std::array{candidate1.px(), candidate1.py(), candidate1.pz()}; + pvec1 = std::array{candidate2.px(), candidate2.py(), candidate2.pz()}; + auto arrMom = std::array, 2>{pvec0, pvec1}; + int track1Sign = candidate1.sign(); int track2Sign = candidate2.sign(); - mass = RecoDecay::m(arrMom, array{massd1, massd2}); - pT = RecoDecay::pt(array{candidate1.px() + candidate2.px(), candidate1.py() + candidate2.py()}); - rapidity = RecoDecay::y(array{candidate1.px() + candidate2.px(), candidate1.py() + candidate2.py(), candidate1.pz() + candidate2.pz()}, mass); + mass = RecoDecay::m(arrMom, std::array{massd1, massd2}); + + pT = RecoDecay::pt(std::array{ + candidate1.px() + candidate2.px(), + candidate1.py() + candidate2.py()}); + + rapidity = RecoDecay::y(std::array{ + candidate1.px() + candidate2.px(), + candidate1.py() + candidate2.py(), + candidate1.pz() + candidate2.pz()}, + mass); + + constexpr float kRapidityCut = 0.5; + constexpr int kOppositeCharge = 0; // default filling - if (std::abs(rapidity) < 0.5 && track1Sign * track2Sign < 0) { + if (std::abs(rapidity) < kRapidityCut && track1Sign * track2Sign < kOppositeCharge) { + if (unlike) { histos.fill(HIST("h3PhiInvMassUnlikeSign"), multiplicity, pT, mass); histos.fill(HIST("h2PhiRapidity"), pT, rapidity); @@ -332,7 +375,7 @@ struct phianalysisrun3_PbPb { } Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex; Filter acceptanceFilter = (nabs(aod::track::eta) < cfgCutEta && nabs(aod::track::pt) > cfgCutPT); - Filter DCAcutFilter = (nabs(aod::track::dcaXY) < cfgCutDCAxy) && (nabs(aod::track::dcaZ) < cfgCutDCAz); + Filter dcacutFilter = (nabs(aod::track::dcaXY) < cfgCutDCAxy) && (nabs(aod::track::dcaZ) < cfgCutDCAz); using EventCandidates = soa::Filtered>; using TrackCandidates = soa::Filtered>; @@ -359,7 +402,7 @@ struct phianalysisrun3_PbPb { using BinningTypeVertexContributor2 = ColumnBinningPolicy; using BinningTypeVertexContributor3 = ColumnBinningPolicy; using BinningTypeVertexContributor4 = ColumnBinningPolicy; - ROOT::Math::PxPyPzMVector PhiMesonMother, KaonPlus, KaonMinus; + ROOT::Math::PxPyPzMVector phiMesonMother, kaonPlus, kaonMinus; void processSameEvent(EventCandidates::iterator const& collision, TrackCandidates const& tracks, aod::BCs const&) { histos.fill(HIST("hEvtSelInfo"), 0.5); @@ -387,26 +430,39 @@ struct phianalysisrun3_PbPb { return; } histos.fill(HIST("hEvtSelInfo"), 6.5); + if (additionalEvSel5 && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + return; + } + histos.fill(HIST("hEvtSelInfo"), 7.5); + if (additionalEvSel6 && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStandard)) { + return; + } + histos.fill(HIST("hEvtSelInfo"), 8.5); int occupancy = collision.trackOccupancyInTimeRange(); if (fillOccupancy && (occupancy > cfgCutOccupancy)) { return; } - histos.fill(HIST("hEvtSelInfo"), 7.5); + histos.fill(HIST("hEvtSelInfo"), 9.5); float multiplicity{-1}; - if (centestimator == 0) { + const int kCentFT0C = 0; + const int kCentFT0A = 1; + const int kCentFT0M = 2; + const int kCentFV0A = 3; + + if (centestimator == kCentFT0C) { multiplicity = collision.centFT0C(); - } else if (centestimator == 1) { + } else if (centestimator == kCentFT0A) { multiplicity = collision.centFT0A(); - } else if (centestimator == 2) { + } else if (centestimator == kCentFT0M) { multiplicity = collision.centFT0M(); - } else if (centestimator == 3) { + } else if (centestimator == kCentFV0A) { multiplicity = collision.centFV0A(); } histos.fill(HIST("hCentrality"), multiplicity); histos.fill(HIST("hVtxZ"), collision.posZ()); histos.fill(HIST("hOccupancy"), occupancy); - for (auto track1 : tracks) { + for (const auto& track1 : tracks) { if (!selectionTrack(track1)) { continue; } @@ -433,7 +489,7 @@ struct phianalysisrun3_PbPb { } auto track1ID = track1.globalIndex(); - for (auto track2 : tracks) { + for (const auto& track2 : tracks) { if (!selectionTrack(track2)) { continue; } @@ -467,7 +523,7 @@ struct phianalysisrun3_PbPb { histos.fill(HIST("QAafter/TOF_TPC_Mapka_all_neg"), track1.tofNSigmaKa(), track1.tpcNSigmaKa()); } - FillinvMass(track1, track2, multiplicity, unlike, mix, massKa, massKa); + fillinvMass(track1, track2, multiplicity, unlike, mix, massKa, massKa); } if (ispTdepPID && selectionPIDpTdependent(track1) && selectionPIDpTdependent(track2)) { @@ -491,7 +547,7 @@ struct phianalysisrun3_PbPb { histos.fill(HIST("QAafter/TOF_TPC_Mapka_all_neg"), track1.tofNSigmaKa(), track1.tpcNSigmaKa()); } - FillinvMass(track1, track2, multiplicity, unlike, mix, massKa, massKa); + fillinvMass(track1, track2, multiplicity, unlike, mix, massKa, massKa); } } } @@ -504,7 +560,7 @@ struct phianalysisrun3_PbPb { //////// currently mixing the event with similar TPC multiplicity //////// BinningTypeVertexContributor1 binningOnPositions{{axisVertex, axisMultiplicity}, true}; SameKindPair pair{binningOnPositions, cfgNoMixedEvents, -1, collisions, tracksTuple, &cache}; - for (auto& [c1, tracks1, c2, tracks2] : pair) { + for (const auto& [c1, tracks1, c2, tracks2] : pair) { if (rctCut.requireRCTFlagChecker && !rctChecker(c1)) { continue; } @@ -529,6 +585,12 @@ struct phianalysisrun3_PbPb { if (additionalEvSel4 && (!c1.selection_bit(aod::evsel::kIsGoodITSLayersAll) || !c2.selection_bit(aod::evsel::kIsGoodITSLayersAll))) { continue; } + if (additionalEvSel5 && (!c1.selection_bit(aod::evsel::kNoCollInTimeRangeStandard) || !c2.selection_bit(aod::evsel::kNoCollInTimeRangeStandard))) { + continue; + } + if (additionalEvSel6 && (!c1.selection_bit(aod::evsel::kNoCollInRofStandard) || !c2.selection_bit(aod::evsel::kNoCollInRofStandard))) { + continue; + } int occupancy1 = c1.trackOccupancyInTimeRange(); int occupancy2 = c2.trackOccupancyInTimeRange(); @@ -537,7 +599,7 @@ struct phianalysisrun3_PbPb { } float multiplicity; multiplicity = c1.centFT0C(); - for (auto& [t1, t2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { + for (const auto& [t1, t2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { bool unlike = false; bool mix = true; if (!selectionTrack(t1)) { @@ -550,10 +612,10 @@ struct phianalysisrun3_PbPb { continue; } if (!ispTdepPID && selectionPID(t1) && selectionPID(t2)) { - FillinvMass(t1, t2, multiplicity, unlike, mix, massKa, massKa); + fillinvMass(t1, t2, multiplicity, unlike, mix, massKa, massKa); } if (ispTdepPID && selectionPIDpTdependent(t1) && selectionPIDpTdependent(t2)) { - FillinvMass(t1, t2, multiplicity, unlike, mix, massKa, massKa); + fillinvMass(t1, t2, multiplicity, unlike, mix, massKa, massKa); } } } @@ -565,7 +627,7 @@ struct phianalysisrun3_PbPb { //////// currently mixing the event with similar TPC multiplicity //////// BinningTypeVertexContributor2 binningOnPositions{{axisVertex, axisMultiplicity}, true}; SameKindPair pair{binningOnPositions, cfgNoMixedEvents, -1, collisions, tracksTuple, &cache}; - for (auto& [c1, tracks1, c2, tracks2] : pair) { + for (const auto& [c1, tracks1, c2, tracks2] : pair) { if (rctCut.requireRCTFlagChecker && !rctChecker(c1)) { continue; } @@ -590,6 +652,12 @@ struct phianalysisrun3_PbPb { if (additionalEvSel4 && (!c1.selection_bit(aod::evsel::kIsGoodITSLayersAll) || !c2.selection_bit(aod::evsel::kIsGoodITSLayersAll))) { continue; } + if (additionalEvSel5 && (!c1.selection_bit(aod::evsel::kNoCollInTimeRangeStandard) || !c2.selection_bit(aod::evsel::kNoCollInTimeRangeStandard))) { + continue; + } + if (additionalEvSel6 && (!c1.selection_bit(aod::evsel::kNoCollInRofStandard) || !c2.selection_bit(aod::evsel::kNoCollInRofStandard))) { + continue; + } int occupancy1 = c1.trackOccupancyInTimeRange(); int occupancy2 = c2.trackOccupancyInTimeRange(); @@ -598,7 +666,7 @@ struct phianalysisrun3_PbPb { } float multiplicity; multiplicity = c1.centFT0A(); - for (auto& [t1, t2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { + for (const auto& [t1, t2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { bool unlike = false; bool mix = true; if (!selectionTrack(t1)) { @@ -611,10 +679,10 @@ struct phianalysisrun3_PbPb { continue; } if (!ispTdepPID && selectionPID(t1) && selectionPID(t2)) { - FillinvMass(t1, t2, multiplicity, unlike, mix, massKa, massKa); + fillinvMass(t1, t2, multiplicity, unlike, mix, massKa, massKa); } if (ispTdepPID && selectionPIDpTdependent(t1) && selectionPIDpTdependent(t2)) { - FillinvMass(t1, t2, multiplicity, unlike, mix, massKa, massKa); + fillinvMass(t1, t2, multiplicity, unlike, mix, massKa, massKa); } } } @@ -627,7 +695,7 @@ struct phianalysisrun3_PbPb { //////// currently mixing the event with similar TPC multiplicity //////// BinningTypeVertexContributor3 binningOnPositions{{axisVertex, axisMultiplicity}, true}; SameKindPair pair{binningOnPositions, cfgNoMixedEvents, -1, collisions, tracksTuple, &cache}; - for (auto& [c1, tracks1, c2, tracks2] : pair) { + for (const auto& [c1, tracks1, c2, tracks2] : pair) { if (rctCut.requireRCTFlagChecker && !rctChecker(c1)) { continue; } @@ -652,6 +720,12 @@ struct phianalysisrun3_PbPb { if (additionalEvSel4 && (!c1.selection_bit(aod::evsel::kIsGoodITSLayersAll) || !c2.selection_bit(aod::evsel::kIsGoodITSLayersAll))) { continue; } + if (additionalEvSel5 && (!c1.selection_bit(aod::evsel::kNoCollInTimeRangeStandard) || !c2.selection_bit(aod::evsel::kNoCollInTimeRangeStandard))) { + continue; + } + if (additionalEvSel6 && (!c1.selection_bit(aod::evsel::kNoCollInRofStandard) || !c2.selection_bit(aod::evsel::kNoCollInRofStandard))) { + continue; + } int occupancy1 = c1.trackOccupancyInTimeRange(); int occupancy2 = c2.trackOccupancyInTimeRange(); @@ -660,7 +734,7 @@ struct phianalysisrun3_PbPb { } float multiplicity; multiplicity = c1.centFT0M(); - for (auto& [t1, t2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { + for (const auto& [t1, t2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { bool unlike = false; bool mix = true; if (!selectionTrack(t1)) { @@ -673,10 +747,10 @@ struct phianalysisrun3_PbPb { continue; } if (!ispTdepPID && selectionPID(t1) && selectionPID(t2)) { - FillinvMass(t1, t2, multiplicity, unlike, mix, massKa, massKa); + fillinvMass(t1, t2, multiplicity, unlike, mix, massKa, massKa); } if (ispTdepPID && selectionPIDpTdependent(t1) && selectionPIDpTdependent(t2)) { - FillinvMass(t1, t2, multiplicity, unlike, mix, massKa, massKa); + fillinvMass(t1, t2, multiplicity, unlike, mix, massKa, massKa); } } } @@ -689,7 +763,7 @@ struct phianalysisrun3_PbPb { //////// currently mixing the event with similar TPC multiplicity //////// BinningTypeVertexContributor4 binningOnPositions{{axisVertex, axisMultiplicity}, true}; SameKindPair pair{binningOnPositions, cfgNoMixedEvents, -1, collisions, tracksTuple, &cache}; - for (auto& [c1, tracks1, c2, tracks2] : pair) { + for (const auto& [c1, tracks1, c2, tracks2] : pair) { if (rctCut.requireRCTFlagChecker && !rctChecker(c1)) { continue; } @@ -714,6 +788,12 @@ struct phianalysisrun3_PbPb { if (additionalEvSel4 && (!c1.selection_bit(aod::evsel::kIsGoodITSLayersAll) || !c2.selection_bit(aod::evsel::kIsGoodITSLayersAll))) { continue; } + if (additionalEvSel5 && (!c1.selection_bit(aod::evsel::kNoCollInTimeRangeStandard) || !c2.selection_bit(aod::evsel::kNoCollInTimeRangeStandard))) { + continue; + } + if (additionalEvSel6 && (!c1.selection_bit(aod::evsel::kNoCollInRofStandard) || !c2.selection_bit(aod::evsel::kNoCollInRofStandard))) { + continue; + } int occupancy1 = c1.trackOccupancyInTimeRange(); int occupancy2 = c2.trackOccupancyInTimeRange(); @@ -722,7 +802,7 @@ struct phianalysisrun3_PbPb { } float multiplicity; multiplicity = c1.centFV0A(); - for (auto& [t1, t2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { + for (const auto& [t1, t2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { bool unlike = false; bool mix = true; if (!selectionTrack(t1)) { @@ -735,10 +815,10 @@ struct phianalysisrun3_PbPb { continue; } if (!ispTdepPID && selectionPID(t1) && selectionPID(t2)) { - FillinvMass(t1, t2, multiplicity, unlike, mix, massKa, massKa); + fillinvMass(t1, t2, multiplicity, unlike, mix, massKa, massKa); } if (ispTdepPID && selectionPIDpTdependent(t1) && selectionPIDpTdependent(t2)) { - FillinvMass(t1, t2, multiplicity, unlike, mix, massKa, massKa); + fillinvMass(t1, t2, multiplicity, unlike, mix, massKa, massKa); } } } @@ -766,7 +846,8 @@ struct phianalysisrun3_PbPb { histos.fill(HIST("hCentrality"), multiplicity); histos.fill(HIST("hVtxZ"), collision.posZ()); histos.fill(HIST("hOccupancy"), occupancy); - for (auto track1 : tracks) { + for (const auto& track1 : tracks) { + if (!selectionTrack(track1)) { continue; } @@ -777,7 +858,7 @@ struct phianalysisrun3_PbPb { histos.fill(HIST("QAbefore/TOF_TPC_Mapka_all"), track1.tofNSigmaKa(), track1.tpcNSigmaKa()); auto track1ID = track1.globalIndex(); - for (auto track2 : tracks) { + for (const auto& track2 : tracks) { if (!selectionTrack(track2)) { continue; } @@ -795,14 +876,14 @@ struct phianalysisrun3_PbPb { continue; } if (track1.sign() * track2.sign() < 0) { - KaonPlus = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa); - KaonMinus = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massKa); + kaonPlus = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa); + kaonMinus = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massKa); } - PhiMesonMother = KaonPlus + KaonMinus; - if (TMath::Abs(PhiMesonMother.Rapidity()) > confRapidity) { + phiMesonMother = kaonPlus + kaonMinus; + if (std::abs(phiMesonMother.Rapidity()) > confRapidity) { continue; } - histos.fill(HIST("h3PhiInvMassSame"), multiplicity, PhiMesonMother.pt(), PhiMesonMother.M()); + histos.fill(HIST("h3PhiInvMassSame"), multiplicity, phiMesonMother.pt(), phiMesonMother.M()); if (fillRotation) { for (int nrotbkg = 0; nrotbkg < nBkgRotations; nrotbkg++) { auto anglestart = confMinRot; @@ -812,14 +893,14 @@ struct phianalysisrun3_PbPb { if (track1.sign() * track2.sign() < 0) { auto rotkaonPx = track1.px() * std::cos(rotangle) - track1.py() * std::sin(rotangle); auto rotkaonPy = track1.px() * std::sin(rotangle) + track1.py() * std::cos(rotangle); - KaonPlus = ROOT::Math::PxPyPzMVector(rotkaonPx, rotkaonPy, track1.pz(), massKa); - KaonMinus = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massKa); + kaonPlus = ROOT::Math::PxPyPzMVector(rotkaonPx, rotkaonPy, track1.pz(), massKa); + kaonMinus = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massKa); } - PhiMesonMother = KaonPlus + KaonMinus; - if (TMath::Abs(PhiMesonMother.Rapidity()) > confRapidity) { + phiMesonMother = kaonPlus + kaonMinus; + if (std::abs(phiMesonMother.Rapidity()) > confRapidity) { continue; } - histos.fill(HIST("h3PhiInvMassRot"), multiplicity, PhiMesonMother.pt(), PhiMesonMother.M()); + histos.fill(HIST("h3PhiInvMassRot"), multiplicity, phiMesonMother.pt(), phiMesonMother.M()); } } } @@ -838,7 +919,7 @@ struct phianalysisrun3_PbPb { histos.fill(HIST("hMC"), 2); return; } - for (auto& RecCollision : RecCollisions) { + for (const auto& RecCollision : RecCollisions) { histos.fill(HIST("hMC"), 3); if (!RecCollision.sel8()) { histos.fill(HIST("hMC"), 4); @@ -855,16 +936,16 @@ struct phianalysisrun3_PbPb { if (fillOccupancy && (occupancy > cfgCutOccupancy)) { continue; } - if (TMath::Abs(RecCollision.posZ()) > cfgCutVertex) { + if (std::abs(RecCollision.posZ()) > cfgCutVertex) { histos.fill(HIST("hMC"), 6); continue; } histos.fill(HIST("hMC"), 7); auto centrality = RecCollision.centFT0C(); auto oldindex = -999; - auto Rectrackspart = RecTracks.sliceBy(perCollision, RecCollision.globalIndex()); + auto rectrackspart = RecTracks.sliceBy(perCollision, RecCollision.globalIndex()); // loop over reconstructed particle - for (auto track1 : Rectrackspart) { + for (const auto& track1 : rectrackspart) { if (!selectionTrack(track1)) { continue; } @@ -878,7 +959,7 @@ struct phianalysisrun3_PbPb { continue; } auto track1ID = track1.index(); - for (auto track2 : Rectrackspart) { + for (const auto& track2 : rectrackspart) { auto track2ID = track2.index(); if (track2ID <= track1ID) { continue; @@ -903,29 +984,29 @@ struct phianalysisrun3_PbPb { } const auto mctrack1 = track1.mcParticle(); const auto mctrack2 = track2.mcParticle(); - int track1PDG = TMath::Abs(mctrack1.pdgCode()); - int track2PDG = TMath::Abs(mctrack2.pdgCode()); + int track1PDG = std::abs(mctrack1.pdgCode()); + int track2PDG = std::abs(mctrack2.pdgCode()); if (!mctrack1.isPhysicalPrimary()) { continue; } if (!mctrack2.isPhysicalPrimary()) { continue; } - if (!(track1PDG == 321 && track2PDG == 321)) { + if (!(track1PDG == PDG_t::kKPlus && track2PDG == PDG_t::kKPlus)) { continue; } - for (auto& mothertrack1 : mctrack1.mothers_as()) { - for (auto& mothertrack2 : mctrack2.mothers_as()) { + for (const auto& mothertrack1 : mctrack1.mothers_as()) { + for (const auto& mothertrack2 : mctrack2.mothers_as()) { if (mothertrack1.pdgCode() != mothertrack2.pdgCode()) { continue; } if (mothertrack1 != mothertrack2) { continue; } - if (TMath::Abs(mothertrack1.y()) > confRapidity) { + if (std::abs(mothertrack1.y()) > confRapidity) { continue; } - if (PDGcheck && TMath::Abs(mothertrack1.pdgCode()) != 333) { + if (pdgcheck && std::abs(mothertrack1.pdgCode()) != o2::constants::physics::kPhi) { continue; } if (!ispTdepPID && (!selectionPID(track1) || !selectionPID(track2))) { @@ -940,65 +1021,68 @@ struct phianalysisrun3_PbPb { } oldindex = mothertrack1.globalIndex(); if (track1.sign() * track2.sign() < 0) { - KaonPlus = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa); - KaonMinus = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massKa); + kaonPlus = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa); + kaonMinus = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massKa); } - PhiMesonMother = KaonPlus + KaonMinus; + phiMesonMother = kaonPlus + kaonMinus; - if (TMath::Abs(PhiMesonMother.Rapidity()) > confRapidity) { + if (std::abs(phiMesonMother.Rapidity()) > confRapidity) { continue; } - histos.fill(HIST("h1PhiRec1"), PhiMesonMother.pt()); - histos.fill(HIST("h2PhiRec2"), PhiMesonMother.pt(), centrality); - histos.fill(HIST("h1Phimassrec"), PhiMesonMother.M()); - histos.fill(HIST("h3PhiRec3"), PhiMesonMother.pt(), centrality, PhiMesonMother.M()); + histos.fill(HIST("h1PhiRec1"), phiMesonMother.pt()); + histos.fill(HIST("h2PhiRec2"), phiMesonMother.pt(), centrality); + histos.fill(HIST("h1Phimassrec"), phiMesonMother.M()); + histos.fill(HIST("h3PhiRec3"), phiMesonMother.pt(), centrality, phiMesonMother.M()); histos.fill(HIST("Centrec"), centrality); } } } } // loop over generated particle - for (auto& mcParticle : GenParticles) { - if (TMath::Abs(mcParticle.y()) > confRapidity) { + for (const auto& mcParticle : GenParticles) { + if (std::abs(mcParticle.y()) > confRapidity) { continue; } - if (PDGcheck && mcParticle.pdgCode() != 333) { + if (pdgcheck && mcParticle.pdgCode() != o2::constants::physics::kPhi) { continue; } auto kDaughters = mcParticle.daughters_as(); - if (kDaughters.size() != 2) { + const size_t kExpectedDaughterCount = 2; + + if (kDaughters.size() != kExpectedDaughterCount) { + continue; } auto daughtp = false; auto daughtm = false; - for (auto kCurrentDaughter : kDaughters) { + for (const auto& kCurrentDaughter : kDaughters) { if (!kCurrentDaughter.isPhysicalPrimary()) { continue; } - if (kCurrentDaughter.pdgCode() == +321) { - if (genacceptancecut && kCurrentDaughter.pt() > cfgCutPT && TMath::Abs(kCurrentDaughter.eta()) < cfgCutEta) { + if (kCurrentDaughter.pdgCode() == PDG_t::kKPlus) { + if (genacceptancecut && kCurrentDaughter.pt() > cfgCutPT && std::abs(kCurrentDaughter.eta()) < cfgCutEta) { daughtp = true; } if (!genacceptancecut) { daughtp = true; } - KaonPlus = ROOT::Math::PxPyPzMVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), massKa); - } else if (kCurrentDaughter.pdgCode() == -321) { - if (genacceptancecut && kCurrentDaughter.pt() > cfgCutPT && TMath::Abs(kCurrentDaughter.eta()) < cfgCutEta) { + kaonPlus = ROOT::Math::PxPyPzMVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), massKa); + } else if (kCurrentDaughter.pdgCode() == PDG_t::kKMinus) { + if (genacceptancecut && kCurrentDaughter.pt() > cfgCutPT && std::abs(kCurrentDaughter.eta()) < cfgCutEta) { daughtm = true; } if (!genacceptancecut) { daughtm = true; } - KaonMinus = ROOT::Math::PxPyPzMVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), massKa); + kaonMinus = ROOT::Math::PxPyPzMVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), massKa); } } if (daughtp && daughtm) { - PhiMesonMother = KaonPlus + KaonMinus; - histos.fill(HIST("h1PhiGen"), PhiMesonMother.pt()); - histos.fill(HIST("h2PhiGen2"), PhiMesonMother.pt(), centrality); + phiMesonMother = kaonPlus + kaonMinus; + histos.fill(HIST("h1PhiGen"), phiMesonMother.pt()); + histos.fill(HIST("h2PhiGen2"), phiMesonMother.pt(), centrality); histos.fill(HIST("Centgen"), centrality); - histos.fill(HIST("h1Phimassgen"), PhiMesonMother.M()); + histos.fill(HIST("h1Phimassgen"), phiMesonMother.M()); } } } // rec collision loop @@ -1014,7 +1098,7 @@ struct phianalysisrun3_PbPb { } float imp = mcCollision.impactParameter(); histos.fill(HIST("hImpactParameterGen"), imp); - std::vector SelectedEvents(collisions.size()); + std::vector selectedEvents(collisions.size()); int nevts = 0; auto multiplicity = 0; for (const auto& collision : collisions) { @@ -1034,51 +1118,57 @@ struct phianalysisrun3_PbPb { histos.fill(HIST("hVtxZgen"), collision.mcCollision().posZ()); histos.fill(HIST("hImpactParameterGenCen"), imp, multiplicity); - SelectedEvents[nevts++] = collision.mcCollision_as().globalIndex(); + selectedEvents[nevts++] = collision.mcCollision_as().globalIndex(); histos.fill(HIST("hMC"), 2.5); } - SelectedEvents.resize(nevts); + selectedEvents.resize(nevts); - const auto evtReconstructedAndSelected = std::find(SelectedEvents.begin(), SelectedEvents.end(), mcCollision.globalIndex()) != SelectedEvents.end(); + const auto evtReconstructedAndSelected = std::find(selectedEvents.begin(), selectedEvents.end(), mcCollision.globalIndex()) != selectedEvents.end(); histos.fill(HIST("EL1"), imp); histos.fill(HIST("EL2"), multiplicity); - if (Reco && !evtReconstructedAndSelected) { // Check that the event is reconstructed and that the reconstructed events pass the selection + if (reco && !evtReconstructedAndSelected) { // Check that the event is reconstructed and that the reconstructed events pass the selection return; } histos.fill(HIST("ES1"), imp); histos.fill(HIST("ES2"), multiplicity); - for (auto& mcParticle : mcParticles) { - if (std::abs(mcParticle.y()) >= 0.5) { + for (const auto& mcParticle : mcParticles) { + const double kMaxAcceptedRapidity = 0.5; + + if (std::abs(mcParticle.y()) >= kMaxAcceptedRapidity) { + continue; } - if (PDGcheck && mcParticle.pdgCode() != 333) { + if (pdgcheck && mcParticle.pdgCode() != o2::constants::physics::kPhi) { continue; } auto kDaughters = mcParticle.daughters_as(); - if (kDaughters.size() != 2) { + const size_t kExpectedNumberOfDaughters = 2; + + if (kDaughters.size() != kExpectedNumberOfDaughters) { + continue; } auto daughtp = false; auto daughtm = false; - for (auto kCurrentDaughter : kDaughters) { + for (const auto& kCurrentDaughter : kDaughters) { if (!kCurrentDaughter.isPhysicalPrimary()) { continue; } - if (kCurrentDaughter.pdgCode() == +321) { + if (kCurrentDaughter.pdgCode() == PDG_t::kKPlus) { daughtp = true; - KaonPlus = ROOT::Math::PxPyPzMVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), massKa); - } else if (kCurrentDaughter.pdgCode() == -321) { + kaonPlus = ROOT::Math::PxPyPzMVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), massKa); + } else if (kCurrentDaughter.pdgCode() == PDG_t::kKMinus) { daughtm = true; - KaonMinus = ROOT::Math::PxPyPzMVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), massKa); + kaonMinus = ROOT::Math::PxPyPzMVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), massKa); } } if (daughtp && daughtm) { - PhiMesonMother = KaonPlus + KaonMinus; - histos.fill(HIST("h1PhiGen"), PhiMesonMother.pt()); - histos.fill(HIST("h2PhiGen2"), PhiMesonMother.pt(), multiplicity); - histos.fill(HIST("h2PhiGen1"), PhiMesonMother.pt(), imp); - histos.fill(HIST("h1Phimassgen"), PhiMesonMother.M()); - histos.fill(HIST("h3PhiGen3"), PhiMesonMother.pt(), multiplicity, PhiMesonMother.M()); + phiMesonMother = kaonPlus + kaonMinus; + histos.fill(HIST("h1PhiGen"), phiMesonMother.pt()); + histos.fill(HIST("h2PhiGen2"), phiMesonMother.pt(), multiplicity); + histos.fill(HIST("h2PhiGen1"), phiMesonMother.pt(), imp); + histos.fill(HIST("h1Phimassgen"), phiMesonMother.M()); + histos.fill(HIST("h3PhiGen3"), phiMesonMother.pt(), multiplicity, phiMesonMother.M()); } } } @@ -1107,7 +1197,7 @@ struct phianalysisrun3_PbPb { histos.fill(HIST("ES3"), imp); histos.fill(HIST("ES4"), multiplicity); auto oldindex = -999; - for (auto track1 : tracks) { + for (const auto& track1 : tracks) { if (!selectionTrack(track1)) { continue; } @@ -1115,7 +1205,7 @@ struct phianalysisrun3_PbPb { continue; } auto track1ID = track1.index(); - for (auto track2 : tracks) { + for (const auto& track2 : tracks) { if (!track2.has_mcParticle()) { continue; } @@ -1142,7 +1232,7 @@ struct phianalysisrun3_PbPb { if (!mctrack2.isPhysicalPrimary()) { continue; } - if (!(track1PDG == 321 && track2PDG == 321)) { + if (!(track1PDG == PDG_t::kKPlus && track2PDG == PDG_t::kKPlus)) { continue; } daughter1 = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa); @@ -1151,8 +1241,8 @@ struct phianalysisrun3_PbPb { phiMother = daughter1 + daughter2; histos.fill(HIST("h1Phi1massrec"), phiMother.M()); histos.fill(HIST("h3Phi1Rec3"), phiMother.pt(), multiplicity, phiMother.M()); - for (auto& mothertrack1 : mctrack1.mothers_as()) { - for (auto& mothertrack2 : mctrack2.mothers_as()) { + for (const auto& mothertrack1 : mctrack1.mothers_as()) { + for (const auto& mothertrack2 : mctrack2.mothers_as()) { if (mothertrack1.pdgCode() != mothertrack2.pdgCode()) { continue; } @@ -1162,10 +1252,13 @@ struct phianalysisrun3_PbPb { if (!mothertrack1.producedByGenerator()) { continue; } - if (std::abs(mothertrack1.y()) >= 0.5) { + const double kMaxRapidityCut = 0.5; + + if (std::abs(mothertrack1.y()) >= kMaxRapidityCut) { continue; } - if (PDGcheck && std::abs(mothertrack1.pdgCode()) != 333) { + + if (pdgcheck && std::abs(mothertrack1.pdgCode()) != o2::constants::physics::kPhi) { continue; } if (!ispTdepPID && (!selectionPID(track1) || !selectionPID(track2))) { @@ -1183,18 +1276,18 @@ struct phianalysisrun3_PbPb { } oldindex = mothertrack1.globalIndex(); if (track1.sign() * track2.sign() < 0) { - KaonPlus = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa); - KaonMinus = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massKa); + kaonPlus = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa); + kaonMinus = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massKa); } - PhiMesonMother = KaonPlus + KaonMinus; + phiMesonMother = kaonPlus + kaonMinus; - if (TMath::Abs(PhiMesonMother.Rapidity()) > confRapidity) { + if (std::abs(phiMesonMother.Rapidity()) > confRapidity) { continue; } - histos.fill(HIST("h1PhiRec1"), PhiMesonMother.pt()); - histos.fill(HIST("h2PhiRec2"), PhiMesonMother.pt(), multiplicity); - histos.fill(HIST("h1Phimassrec"), PhiMesonMother.M()); - histos.fill(HIST("h3PhiRec3"), PhiMesonMother.pt(), multiplicity, PhiMesonMother.M()); + histos.fill(HIST("h1PhiRec1"), phiMesonMother.pt()); + histos.fill(HIST("h2PhiRec2"), phiMesonMother.pt(), multiplicity); + histos.fill(HIST("h1Phimassrec"), phiMesonMother.M()); + histos.fill(HIST("h3PhiRec3"), phiMesonMother.pt(), multiplicity, phiMesonMother.M()); } } } @@ -1207,10 +1300,22 @@ struct phianalysisrun3_PbPb { if (!collision.sel8()) { return; } - if (additionalEvSel2 && (!collision.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { + if (additionalEvSel1 && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { return; } - if (additionalEvSel3 && (!collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard))) { + if (additionalEvSel2 && !collision.selection_bit(aod::evsel::kNoITSROFrameBorder)) { + return; + } + if (additionalEvSel3 && !collision.selection_bit(aod::evsel::kNoSameBunchPileup)) { + return; + } + if (additionalEvSel4 && !collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + return; + } + if (additionalEvSel5 && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + return; + } + if (additionalEvSel6 && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStandard)) { return; } int occupancy = collision.trackOccupancyInTimeRange(); @@ -1219,12 +1324,12 @@ struct phianalysisrun3_PbPb { } float multiplicity{-1}; multiplicity = collision.centFT0C(); - for (auto track1 : tracks) { + for (const auto& track1 : tracks) { if (!selectionTrack(track1)) { continue; } auto track1ID = track1.globalIndex(); - for (auto track2 : tracks) { + for (const auto& track2 : tracks) { if (!selectionTrack(track2)) { continue; } @@ -1242,15 +1347,15 @@ struct phianalysisrun3_PbPb { continue; } if (track1.sign() * track2.sign() < 0) { - KaonPlus = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa); - KaonMinus = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massKa); + kaonPlus = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa); + kaonMinus = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massKa); } - PhiMesonMother = KaonPlus + KaonMinus; - if (TMath::Abs(PhiMesonMother.Rapidity()) > confRapidity) { + phiMesonMother = kaonPlus + kaonMinus; + if (std::abs(phiMesonMother.Rapidity()) > confRapidity) { continue; } - histos.fill(HIST("h3PhiInvMassSameMC"), multiplicity, PhiMesonMother.pt(), PhiMesonMother.M()); - histos.fill(HIST("h1Phimasssame"), PhiMesonMother.M()); + histos.fill(HIST("h3PhiInvMassSameMC"), multiplicity, phiMesonMother.pt(), phiMesonMother.M()); + histos.fill(HIST("h1Phimasssame"), phiMesonMother.M()); if (fillRotation) { for (int nrotbkg = 0; nrotbkg < nBkgRotations; nrotbkg++) { auto anglestart = confMinRot; @@ -1260,15 +1365,15 @@ struct phianalysisrun3_PbPb { if (track1.sign() * track2.sign() < 0) { auto rotkaonPx = track1.px() * std::cos(rotangle) - track1.py() * std::sin(rotangle); auto rotkaonPy = track1.px() * std::sin(rotangle) + track1.py() * std::cos(rotangle); - KaonPlus = ROOT::Math::PxPyPzMVector(rotkaonPx, rotkaonPy, track1.pz(), massKa); - KaonMinus = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massKa); + kaonPlus = ROOT::Math::PxPyPzMVector(rotkaonPx, rotkaonPy, track1.pz(), massKa); + kaonMinus = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massKa); } - PhiMesonMother = KaonPlus + KaonMinus; - if (TMath::Abs(PhiMesonMother.Rapidity()) > confRapidity) { + phiMesonMother = kaonPlus + kaonMinus; + if (std::abs(phiMesonMother.Rapidity()) > confRapidity) { continue; } - histos.fill(HIST("h3PhiInvMassRotMC"), multiplicity, PhiMesonMother.pt(), PhiMesonMother.M()); - histos.fill(HIST("h1Phimassrot"), PhiMesonMother.M()); + histos.fill(HIST("h3PhiInvMassRotMC"), multiplicity, phiMesonMother.pt(), phiMesonMother.M()); + histos.fill(HIST("h1Phimassrot"), phiMesonMother.M()); } } } @@ -1283,23 +1388,29 @@ struct phianalysisrun3_PbPb { BinningTypeVertexContributor1 binningOnPositions{{axisVertex, axisMultiplicity}, true}; SameKindPair pairs{binningOnPositions, cfgNoMixedEvents, -1, recCollisions, tracksTuple, &cache}; - for (auto& [c1, tracks1, c2, tracks2] : pairs) { + for (const auto& [c1, tracks1, c2, tracks2] : pairs) { if (!c1.sel8()) { continue; } if (!c2.sel8()) { continue; } - if (additionalEvSel2 && (!c1.selection_bit(aod::evsel::kNoSameBunchPileup) || !c1.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { + if (additionalEvSel1 && (!c1.selection_bit(aod::evsel::kNoTimeFrameBorder) || !c2.selection_bit(aod::evsel::kNoTimeFrameBorder))) { + continue; + } + if (additionalEvSel2 && (!c1.selection_bit(aod::evsel::kNoITSROFrameBorder) || !c2.selection_bit(aod::evsel::kNoITSROFrameBorder))) { continue; } - if (additionalEvSel2 && (!c2.selection_bit(aod::evsel::kNoSameBunchPileup) || !c2.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { + if (additionalEvSel3 && (!c1.selection_bit(aod::evsel::kNoSameBunchPileup) || !c2.selection_bit(aod::evsel::kNoSameBunchPileup))) { + continue; + } + if (additionalEvSel4 && (!c1.selection_bit(aod::evsel::kIsGoodITSLayersAll) || !c2.selection_bit(aod::evsel::kIsGoodITSLayersAll))) { continue; } - if (additionalEvSel3 && (!c1.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard))) { + if (additionalEvSel5 && (!c1.selection_bit(aod::evsel::kNoCollInTimeRangeStandard) || !c2.selection_bit(aod::evsel::kNoCollInTimeRangeStandard))) { continue; } - if (additionalEvSel3 && (!c2.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard))) { + if (additionalEvSel6 && (!c1.selection_bit(aod::evsel::kNoCollInRofStandard) || !c2.selection_bit(aod::evsel::kNoCollInRofStandard))) { continue; } int occupancy1 = c1.trackOccupancyInTimeRange(); @@ -1311,7 +1422,7 @@ struct phianalysisrun3_PbPb { continue; } auto multiplicity = c1.centFT0C(); - for (auto& [t1, t2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { + for (const auto& [t1, t2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { histos.fill(HIST("hMC"), 6.5); if (!selectionTrack(t1)) { continue; @@ -1329,19 +1440,237 @@ struct phianalysisrun3_PbPb { continue; } if (t1.sign() * t2.sign() < 0) { - KaonPlus = ROOT::Math::PxPyPzMVector(t1.px(), t1.py(), t1.pz(), massKa); - KaonMinus = ROOT::Math::PxPyPzMVector(t2.px(), t2.py(), t2.pz(), massKa); + kaonPlus = ROOT::Math::PxPyPzMVector(t1.px(), t1.py(), t1.pz(), massKa); + kaonMinus = ROOT::Math::PxPyPzMVector(t2.px(), t2.py(), t2.pz(), massKa); } - PhiMesonMother = KaonPlus + KaonMinus; - if (TMath::Abs(PhiMesonMother.Rapidity()) > confRapidity) { + phiMesonMother = kaonPlus + kaonMinus; + if (std::abs(phiMesonMother.Rapidity()) > confRapidity) { continue; } - histos.fill(HIST("h3PhiInvMassMixedMC"), multiplicity, PhiMesonMother.pt(), PhiMesonMother.M()); - histos.fill(HIST("h1Phimassmix"), PhiMesonMother.M()); + histos.fill(HIST("h3PhiInvMassMixedMC"), multiplicity, phiMesonMother.pt(), phiMesonMother.M()); + histos.fill(HIST("h1Phimassmix"), phiMesonMother.M()); } } } PROCESS_SWITCH(phianalysisrun3_PbPb, processMixedEventMC, "Process Mixed event MC", true); + void processGen1(aod::McCollision const& mcCollision, aod::McParticles& mcParticles, const soa::SmallGroups& collisions) + { + histos.fill(HIST("hMC1"), 0.5); + if (std::abs(mcCollision.posZ()) < cfgCutVertex) { + histos.fill(HIST("hMC1"), 1.5); + } + std::vector selectedEvents(collisions.size()); + int nevts = 0; + auto multiplicity = -1.0; + histos.fill(HIST("Centgen1"), multiplicity); + histos.fill(HIST("hMC1"), 2.5); + for (const auto& collision : collisions) { + if (!collision.sel8() || std::abs(collision.mcCollision().posZ()) > cfgCutVertex) { + continue; + } + histos.fill(HIST("hMC1"), 3.5); + if (additionalEvSel1 && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { + continue; + } + histos.fill(HIST("hMC1"), 4.5); + if (additionalEvSel2 && !collision.selection_bit(aod::evsel::kNoITSROFrameBorder)) { + continue; + } + histos.fill(HIST("hMC1"), 5.5); + if (additionalEvSel3 && !collision.selection_bit(aod::evsel::kNoSameBunchPileup)) { + continue; + } + histos.fill(HIST("hMC1"), 6.5); + if (additionalEvSel4 && !collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + continue; + } + histos.fill(HIST("hMC1"), 7.5); + if (additionalEvSel5 && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + continue; + } + histos.fill(HIST("hMC1"), 8.5); + if (additionalEvSel6 && !collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + continue; + } + histos.fill(HIST("hMC1"), 9.5); + int occupancy = collision.trackOccupancyInTimeRange(); + if (fillOccupancy && (occupancy > cfgCutOccupancy)) { + continue; + } + histos.fill(HIST("hMC1"), 10.5); + multiplicity = collision.centFT0C(); + selectedEvents[nevts++] = collision.mcCollision_as().globalIndex(); + } + selectedEvents.resize(nevts); + const auto evtReconstructedAndSelected = std::find(selectedEvents.begin(), selectedEvents.end(), mcCollision.globalIndex()) != selectedEvents.end(); + histos.fill(HIST("hMC1"), 11.5); + if (!evtReconstructedAndSelected) { // Check that the event is reconstructed and that the reconstructed events pass the selection + return; + } + histos.fill(HIST("hMC1"), 12.5); + for (const auto& mcParticle : mcParticles) { + const double kMaxRapidityCut = 0.5; + + if (std::abs(mcParticle.y()) >= kMaxRapidityCut) { + continue; + } + + if (mcParticle.pdgCode() != o2::constants::physics::kPhi) { + continue; + } + auto kDaughters = mcParticle.daughters_as(); + const size_t kExpectedNumberOfDaughters = 2; + + if (kDaughters.size() != kExpectedNumberOfDaughters) { + + continue; + } + auto daughtp = false; + auto daughtm = false; + for (const auto& kCurrentDaughter : kDaughters) { + if (!kCurrentDaughter.isPhysicalPrimary()) { + continue; + } + if (kCurrentDaughter.pdgCode() == PDG_t::kKPlus) { + daughtp = true; + } else if (kCurrentDaughter.pdgCode() == PDG_t::kKMinus) { + daughtm = true; + } + } + if (daughtp && daughtm) { + histos.fill(HIST("h1PhifinalGen"), mcParticle.pt()); + histos.fill(HIST("h2PhifinalGen"), mcParticle.pt(), multiplicity); + } + } + } + + PROCESS_SWITCH(phianalysisrun3_PbPb, processGen1, "Process Generated", false); + void processRec1(EventCandidatesMC::iterator const& collision, TrackCandidatesMC const& tracks, aod::McParticles const& /*mcParticles*/, aod::McCollisions const& /*mcCollisions*/) + { + if (!collision.has_mcCollision()) { + return; + } + if (std::abs(collision.mcCollision().posZ()) > cfgCutVertex || !collision.sel8()) { + return; + } + if (additionalEvSel1 && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { + return; + } + + if (additionalEvSel2 && !collision.selection_bit(aod::evsel::kNoITSROFrameBorder)) { + return; + } + + if (additionalEvSel3 && !collision.selection_bit(aod::evsel::kNoSameBunchPileup)) { + return; + } + + if (additionalEvSel4 && !collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + return; + } + if (additionalEvSel5 && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + return; + } + if (additionalEvSel6 && !collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + return; + } + int occupancy = collision.trackOccupancyInTimeRange(); + if (fillOccupancy && (occupancy > cfgCutOccupancy)) { + return; + } + auto multiplicity = collision.centFT0C(); + histos.fill(HIST("Centrec1"), multiplicity); + histos.fill(HIST("hMC1"), 13.5); + auto oldindex = -999; + for (const auto& track1 : tracks) { + if (!selectionTrack(track1)) { + continue; + } + if (!track1.has_mcParticle()) { + continue; + } + auto track1ID = track1.index(); + for (const auto& track2 : tracks) { + if (!track2.has_mcParticle()) { + continue; + } + if (!selectionTrack(track2)) { + continue; + } + auto track2ID = track2.index(); + if (track2ID <= track1ID) { + continue; + } + if (!selectionPair(track1, track2)) { + continue; + } + if (track1.sign() * track2.sign() > 0) { + continue; + } + const auto mctrack1 = track1.mcParticle(); + const auto mctrack2 = track2.mcParticle(); + int track1PDG = std::abs(mctrack1.pdgCode()); + int track2PDG = std::abs(mctrack2.pdgCode()); + if (!mctrack1.isPhysicalPrimary()) { + continue; + } + if (!mctrack2.isPhysicalPrimary()) { + continue; + } + if (!(track1PDG == PDG_t::kKPlus && track2PDG == PDG_t::kKPlus)) { + continue; + } + for (const auto& mothertrack1 : mctrack1.mothers_as()) { + for (const auto& mothertrack2 : mctrack2.mothers_as()) { + if (mothertrack1.pdgCode() != mothertrack2.pdgCode()) { + continue; + } + if (mothertrack1.globalIndex() != mothertrack2.globalIndex()) { + continue; + } + if (!mothertrack1.producedByGenerator()) { + continue; + } + const double kMaxRapidityCut = 0.5; + + if (std::abs(mothertrack1.y()) >= kMaxRapidityCut) { + continue; + } + + if (std::abs(mothertrack1.pdgCode()) != o2::constants::physics::kPhi) { + continue; + } + if (!(selectionPID(track1) && selectionPID(track2))) { + continue; + } + histos.fill(HIST("TPC_Nsigma1_MC"), track1.tpcNSigmaKa(), multiplicity, track1.pt()); + histos.fill(HIST("TOF_Nsigma1_MC"), track1.tofNSigmaKa(), multiplicity, track1.pt()); + histos.fill(HIST("trkDCAxy"), track1.dcaXY()); + histos.fill(HIST("trkDCAz"), track1.dcaZ()); + if (avoidsplitrackMC && oldindex == mothertrack1.globalIndex()) { + histos.fill(HIST("h1PhiRecsplit1"), mothertrack1.pt()); + continue; + } + oldindex = mothertrack1.globalIndex(); + std::array pvec0 = {track1.px(), track1.py(), track1.pz()}; + std::array pvec1 = {track2.px(), track2.py(), track2.pz()}; + std::array, 2> arrMomrec = {pvec0, pvec1}; + + auto motherP = mothertrack1.p(); + auto motherE = mothertrack1.e(); + genMass = std::sqrt(motherE * motherE - motherP * motherP); + recMass = RecoDecay::m(arrMomrec, array{massKa, massKa}); + + histos.fill(HIST("h1PhifinalRec"), mothertrack1.pt()); + histos.fill(HIST("h3PhifinalRec"), mothertrack1.pt(), multiplicity, recMass); + histos.fill(HIST("h1Phifinalgenmass"), genMass); + } + } + } + } + } + + PROCESS_SWITCH(phianalysisrun3_PbPb, processRec1, "Process Reconstructed", false); void processEvtLossSigLossMC(aod::McCollisions::iterator const& mcCollision, aod::McParticles const& mcParticles, const soa::SmallGroups& recCollisions) { @@ -1365,7 +1694,10 @@ struct phianalysisrun3_PbPb { // Generated MC for (const auto& mcPart : mcParticles) { - if (std::abs(mcPart.y()) >= 0.5 || std::abs(mcPart.pdgCode()) != 333) + const double kMaxRapidity = 0.5; + + if (std::abs(mcPart.y()) >= kMaxRapidity || std::abs(mcPart.pdgCode()) != o2::constants::physics::kPhi) + continue; // signal loss estimation From 64a7740bf89e88683b9ce711c2a9e425c5422bd0 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Thu, 31 Jul 2025 19:29:23 +0200 Subject: [PATCH 168/345] [Common] Improve printouts for easier debugging (#12358) --- Common/Tools/MultModule.h | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/Common/Tools/MultModule.h b/Common/Tools/MultModule.h index 56078d520c2..f722643fc2e 100644 --- a/Common/Tools/MultModule.h +++ b/Common/Tools/MultModule.h @@ -452,16 +452,6 @@ class MultModule } } - opts = internalOpts; - - // list enabled tables - for (int i = 0; i < nTablesConst; i++) { - // printout to be improved in the future - if (internalOpts.mEnabledTables[i]) { - LOGF(info, " -~> Table enabled: %s, requested by %s", tableNames[i], listOfRequestors[i].Data()); - } - } - // dependency checker if (internalOpts.mEnabledTables[kCentFV0As] && !internalOpts.mEnabledTables[kFV0MultZeqs]) { internalOpts.mEnabledTables[kFV0MultZeqs] = 1; @@ -488,6 +478,14 @@ class MultModule listOfRequestors[kPVMults].Append(Form("%s ", "dependency check")); } + // list enabled tables + for (int i = 0; i < nTablesConst; i++) { + // printout to be improved in the future + if (internalOpts.mEnabledTables[i]) { + LOGF(info, " -~> Table enabled: %s, requested by %s", tableNames[i], listOfRequestors[i].Data()); + } + } + // capture the need for PYTHIA calibration in Pb-Pb runs if (metadataInfo.isMC() && mRunNumber >= 544013 && mRunNumber <= 545367) { internalOpts.generatorName.value = "PYTHIA"; @@ -502,6 +500,9 @@ class MultModule hVtxZFDDA = nullptr; hVtxZFDDC = nullptr; hVtxZNTracks = nullptr; + + // pass to the outside + opts = internalOpts; } //__________________________________________________ From 54ee6bb87d1abc9e7af3b04d26092c749b2ce384 Mon Sep 17 00:00:00 2001 From: Francesco Mazzaschi <43742195+fmazzasc@users.noreply.github.com> Date: Thu, 31 Jul 2025 19:51:28 +0200 Subject: [PATCH 169/345] [PWGLF] Fix filling of weak decaying daughters (#12347) Co-authored-by: Francesco Mazzaschi --- PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx b/PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx index f1c60d198e1..5891997bc54 100644 --- a/PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx +++ b/PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx @@ -53,6 +53,7 @@ #include "Math/Vector4D.h" #include "TRandom3.h" +#include #include #include @@ -988,6 +989,7 @@ struct nucleiSpectra { if (particle.isPhysicalPrimary()) { flags |= kIsPhysicalPrimary; nuclei::hGenNuclei[iS][particle.pdgCode() < 0]->Fill(1., particle.pt()); + // antinuclei from B hadrons are classified as physical primaries if (particle.has_mothers()) { for (auto& motherparticle : particle.mothers_as()) { if (std::find(nuclei::hfMothCodes.begin(), nuclei::hfMothCodes.end(), std::abs(motherparticle.pdgCode())) != nuclei::hfMothCodes.end()) { @@ -998,7 +1000,10 @@ struct nucleiSpectra { } } } - } else if (particle.has_mothers()) { + } else if (particle.getProcess() == TMCProcess::kPDecay) { + if (!particle.has_mothers()) { + continue; // skip secondaries from weak decay without mothers + } flags |= kIsSecondaryFromWeakDecay; for (auto& motherparticle : particle.mothers_as()) { motherPdgCode = motherparticle.pdgCode(); From 6d291bd3a913116f131ef5d3da9bb2a279258cf4 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Thu, 31 Jul 2025 20:56:33 +0200 Subject: [PATCH 170/345] [PWGEM/Dilepton] fix to #12343 (#12362) --- PWGEM/Dilepton/Core/Dilepton.h | 5 ++--- PWGEM/Dilepton/Core/DileptonMC.h | 5 ++--- PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx | 2 -- PWGEM/Dilepton/TableProducer/skimmerPrimaryTrack.cxx | 4 ++-- PWGEM/Dilepton/Tasks/Converters/electronConverter4.cxx | 4 ++-- 5 files changed, 8 insertions(+), 12 deletions(-) diff --git a/PWGEM/Dilepton/Core/Dilepton.h b/PWGEM/Dilepton/Core/Dilepton.h index d0874b06b37..31a0c0d725e 100644 --- a/PWGEM/Dilepton/Core/Dilepton.h +++ b/PWGEM/Dilepton/Core/Dilepton.h @@ -1138,8 +1138,7 @@ struct Dilepton { SliceCache cache; Preslice perCollision_electron = aod::emprimaryelectron::emeventId; - Filter trackFilter_electron = dielectroncuts.cfg_min_pt_track < o2::aod::track::pt && dielectroncuts.cfg_min_eta_track < o2::aod::track::eta && o2::aod::track::eta < dielectroncuts.cfg_max_eta_track && o2::aod::track::tpcChi2NCl < dielectroncuts.cfg_max_chi2tpc && o2::aod::track::itsChi2NCl < dielectroncuts.cfg_max_chi2its && nabs(o2::aod::track::dcaXY) < dielectroncuts.cfg_max_dcaxy && nabs(o2::aod::track::dcaZ) < dielectroncuts.cfg_max_dcaz; - Filter pidFilter_electron = dielectroncuts.cfg_min_TPCNsigmaEl < o2::aod::pidtpc::tpcNSigmaEl && o2::aod::pidtpc::tpcNSigmaEl < dielectroncuts.cfg_max_TPCNsigmaEl; + Filter trackFilter_electron = dielectroncuts.cfg_min_pt_track < o2::aod::track::pt && dielectroncuts.cfg_min_eta_track < o2::aod::track::eta && o2::aod::track::eta < dielectroncuts.cfg_max_eta_track && nabs(o2::aod::track::dcaXY) < dielectroncuts.cfg_max_dcaxy && nabs(o2::aod::track::dcaZ) < dielectroncuts.cfg_max_dcaz; Filter ttcaFilter_electron = ifnode(dielectroncuts.enableTTCA.node(), o2::aod::emprimaryelectron::isAssociatedToMPC == true || o2::aod::emprimaryelectron::isAssociatedToMPC == false, o2::aod::emprimaryelectron::isAssociatedToMPC == true); Filter prefilter_derived_electron = ifnode(dielectroncuts.cfg_apply_cuts_from_prefilter_derived.node() && dielectroncuts.cfg_prefilter_bits_derived.node() >= static_cast(1), ifnode((dielectroncuts.cfg_prefilter_bits_derived.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kMee))) > static_cast(0), (o2::aod::emprimaryelectron::pfbderived & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kMee))) <= static_cast(0), true) && @@ -1159,7 +1158,7 @@ struct Dilepton { Partition negative_electrons = o2::aod::emprimaryelectron::sign < int8_t(0); Preslice perCollision_muon = aod::emprimarymuon::emeventId; - Filter trackFilter_muon = o2::aod::fwdtrack::trackType == dimuoncuts.cfg_track_type && dimuoncuts.cfg_min_pt_track < o2::aod::fwdtrack::pt && o2::aod::fwdtrack::pt < dimuoncuts.cfg_max_pt_track && dimuoncuts.cfg_min_eta_track < o2::aod::fwdtrack::eta && o2::aod::fwdtrack::eta < dimuoncuts.cfg_max_eta_track && dimuoncuts.cfg_min_phi_track < o2::aod::fwdtrack::phi && o2::aod::fwdtrack::phi < dimuoncuts.cfg_max_phi_track; + Filter trackFilter_muon = o2::aod::fwdtrack::trackType == dimuoncuts.cfg_track_type && dimuoncuts.cfg_min_pt_track < o2::aod::fwdtrack::pt && o2::aod::fwdtrack::pt < dimuoncuts.cfg_max_pt_track && dimuoncuts.cfg_min_eta_track < o2::aod::fwdtrack::eta && o2::aod::fwdtrack::eta < dimuoncuts.cfg_max_eta_track; Filter ttcaFilter_muon = ifnode(dimuoncuts.enableTTCA.node(), o2::aod::emprimarymuon::isAssociatedToMPC == true || o2::aod::emprimarymuon::isAssociatedToMPC == false, o2::aod::emprimarymuon::isAssociatedToMPC == true); Partition positive_muons = o2::aod::emprimarymuon::sign > int8_t(0); Partition negative_muons = o2::aod::emprimarymuon::sign < int8_t(0); diff --git a/PWGEM/Dilepton/Core/DileptonMC.h b/PWGEM/Dilepton/Core/DileptonMC.h index cee135610ad..7f71c6126e9 100644 --- a/PWGEM/Dilepton/Core/DileptonMC.h +++ b/PWGEM/Dilepton/Core/DileptonMC.h @@ -1231,8 +1231,7 @@ struct DileptonMC { SliceCache cache; Preslice perCollision_electron = aod::emprimaryelectron::emeventId; - Filter trackFilter_electron = o2::aod::track::tpcChi2NCl < dielectroncuts.cfg_max_chi2tpc && o2::aod::track::itsChi2NCl < dielectroncuts.cfg_max_chi2its && nabs(o2::aod::track::dcaXY) < dielectroncuts.cfg_max_dcaxy && nabs(o2::aod::track::dcaZ) < dielectroncuts.cfg_max_dcaz; - Filter pidFilter_electron = dielectroncuts.cfg_min_TPCNsigmaEl < o2::aod::pidtpc::tpcNSigmaEl && o2::aod::pidtpc::tpcNSigmaEl < dielectroncuts.cfg_max_TPCNsigmaEl; + Filter trackFilter_electron = nabs(o2::aod::track::dcaXY) < dielectroncuts.cfg_max_dcaxy && nabs(o2::aod::track::dcaZ) < dielectroncuts.cfg_max_dcaz; Filter ttcaFilter_electron = ifnode(dielectroncuts.enableTTCA.node(), o2::aod::emprimaryelectron::isAssociatedToMPC == true || o2::aod::emprimaryelectron::isAssociatedToMPC == false, o2::aod::emprimaryelectron::isAssociatedToMPC == true); Filter prefilter_derived_electron = ifnode(dielectroncuts.cfg_apply_cuts_from_prefilter_derived.node() && dielectroncuts.cfg_prefilter_bits_derived.node() >= static_cast(1), ifnode((dielectroncuts.cfg_prefilter_bits_derived.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kMee))) > static_cast(0), (o2::aod::emprimaryelectron::pfbderived & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kMee))) <= static_cast(0), true) && @@ -1249,7 +1248,7 @@ struct DileptonMC { o2::aod::emprimaryelectron::pfb >= static_cast(0)); Preslice perCollision_muon = aod::emprimarymuon::emeventId; - Filter trackFilter_muon = o2::aod::fwdtrack::trackType == dimuoncuts.cfg_track_type && dimuoncuts.cfg_min_phi_track < o2::aod::fwdtrack::phi && o2::aod::fwdtrack::phi < dimuoncuts.cfg_max_phi_track; + Filter trackFilter_muon = o2::aod::fwdtrack::trackType == dimuoncuts.cfg_track_type; Filter ttcaFilter_muon = ifnode(dimuoncuts.enableTTCA.node(), o2::aod::emprimarymuon::isAssociatedToMPC == true || o2::aod::emprimarymuon::isAssociatedToMPC == false, o2::aod::emprimarymuon::isAssociatedToMPC == true); Filter collisionFilter_centrality = (cfgCentMin < o2::aod::cent::centFT0M && o2::aod::cent::centFT0M < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0A && o2::aod::cent::centFT0A < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0C && o2::aod::cent::centFT0C < cfgCentMax); diff --git a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx index 2d5c6f5e76d..8d19b297dcf 100644 --- a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx +++ b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx @@ -63,8 +63,6 @@ struct skimmerPrimaryElectron { Produces emprimaryelectrons; Produces emprimaryelectronscov; - // Produces emprimaryelectrons004; - // Configurables Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"}; diff --git a/PWGEM/Dilepton/TableProducer/skimmerPrimaryTrack.cxx b/PWGEM/Dilepton/TableProducer/skimmerPrimaryTrack.cxx index 65b5252bf34..e27fef61e5f 100644 --- a/PWGEM/Dilepton/TableProducer/skimmerPrimaryTrack.cxx +++ b/PWGEM/Dilepton/TableProducer/skimmerPrimaryTrack.cxx @@ -73,8 +73,8 @@ struct skimmerPrimaryTrack { Configurable d_bz_input{"d_bz_input", -999, "bz field in kG, -999 is automatic"}; Configurable minpt{"minpt", 0.2, "min pt for ITS-TPC track"}; - Configurable maxpt{"maxpt", 3.0, "max pt for ITS-TPC track"}; - Configurable maxeta{"maxeta", 1.4, "eta acceptance"}; + Configurable maxpt{"maxpt", 5.0, "max pt for ITS-TPC track"}; + Configurable maxeta{"maxeta", 0.8, "eta acceptance"}; Configurable dca_xy_max{"dca_xy_max", 0.5, "max DCAxy in cm"}; Configurable dca_z_max{"dca_z_max", 0.5, "max DCAz in cm"}; diff --git a/PWGEM/Dilepton/Tasks/Converters/electronConverter4.cxx b/PWGEM/Dilepton/Tasks/Converters/electronConverter4.cxx index 07161fae435..37186075fe9 100644 --- a/PWGEM/Dilepton/Tasks/Converters/electronConverter4.cxx +++ b/PWGEM/Dilepton/Tasks/Converters/electronConverter4.cxx @@ -32,7 +32,7 @@ struct electronConverter4 { using MyElectrons002 = soa::Join; void process002to004(MyElectrons002 const& tracks) { - for (auto& track : tracks) { + for (const auto& track : tracks) { float itsChi2NCl = (track.hasITS() && track.itsChi2NCl() > 0.f) ? track.itsChi2NCl() : -299.f; float tpcChi2NCl = (track.hasTPC() && track.tpcChi2NCl() > 0.f) ? track.tpcChi2NCl() : -299.f; float beta = track.hasTOF() ? track.beta() : -29.f; @@ -92,7 +92,7 @@ struct electronConverter4 { using MyElectrons003 = soa::Join; void process003to004(MyElectrons003 const& tracks) { - for (auto& track : tracks) { + for (const auto& track : tracks) { float itsChi2NCl = track.itsChi2NCl() > 0.f ? track.itsChi2NCl() : -299.f; float tpcChi2NCl = track.tpcChi2NCl() > 0.f ? track.tpcChi2NCl() : -299.f; float beta = track.hasTOF() ? track.beta() : -29.f; From 454f10cae139ebe5221c1f31a48466377db6a32d Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Thu, 31 Jul 2025 22:54:41 +0200 Subject: [PATCH 171/345] [PWGEM/Dilepton] quick fix in 2PC (#12364) --- PWGEM/Dilepton/Core/DileptonHadronMPC.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/PWGEM/Dilepton/Core/DileptonHadronMPC.h b/PWGEM/Dilepton/Core/DileptonHadronMPC.h index c8108f6b046..294edde1b0f 100644 --- a/PWGEM/Dilepton/Core/DileptonHadronMPC.h +++ b/PWGEM/Dilepton/Core/DileptonHadronMPC.h @@ -1046,8 +1046,7 @@ struct DileptonHadronMPC { SliceCache cache; Preslice perCollision_electron = aod::emprimaryelectron::emeventId; - Filter trackFilter_electron = dielectroncuts.cfg_min_pt_track < o2::aod::track::pt && dielectroncuts.cfg_min_eta_track < o2::aod::track::eta && o2::aod::track::eta < dielectroncuts.cfg_max_eta_track && o2::aod::track::tpcChi2NCl < dielectroncuts.cfg_max_chi2tpc && o2::aod::track::itsChi2NCl < dielectroncuts.cfg_max_chi2its && nabs(o2::aod::track::dcaXY) < dielectroncuts.cfg_max_dcaxy && nabs(o2::aod::track::dcaZ) < dielectroncuts.cfg_max_dcaz; - Filter pidFilter_electron = dielectroncuts.cfg_min_TPCNsigmaEl < o2::aod::pidtpc::tpcNSigmaEl && o2::aod::pidtpc::tpcNSigmaEl < dielectroncuts.cfg_max_TPCNsigmaEl; + Filter trackFilter_electron = dielectroncuts.cfg_min_pt_track < o2::aod::track::pt && dielectroncuts.cfg_min_eta_track < o2::aod::track::eta && o2::aod::track::eta < dielectroncuts.cfg_max_eta_track && nabs(o2::aod::track::dcaXY) < dielectroncuts.cfg_max_dcaxy && nabs(o2::aod::track::dcaZ) < dielectroncuts.cfg_max_dcaz; Filter ttcaFilter_electron = ifnode(dielectroncuts.enableTTCA.node(), o2::aod::emprimaryelectron::isAssociatedToMPC == true || o2::aod::emprimaryelectron::isAssociatedToMPC == false, o2::aod::emprimaryelectron::isAssociatedToMPC == true); Filter prefilter_derived_electron = ifnode(dielectroncuts.cfg_apply_cuts_from_prefilter_derived.node() && dielectroncuts.cfg_prefilter_bits_derived.node() >= static_cast(1), ifnode((dielectroncuts.cfg_prefilter_bits_derived.node() & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kMee))) > static_cast(0), (o2::aod::emprimaryelectron::pfbderived & static_cast(1 << int(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kMee))) <= static_cast(0), true) && From e7fdc24233b74bc434521ba88c157a8e4384821a Mon Sep 17 00:00:00 2001 From: jaelpark Date: Fri, 1 Aug 2025 03:50:08 +0200 Subject: [PATCH 172/345] [PWGCF] Fix missing MC table subscription (#12349) --- PWGCF/TableProducer/filter2Prong.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGCF/TableProducer/filter2Prong.cxx b/PWGCF/TableProducer/filter2Prong.cxx index 2c594636c9e..00f7bb58827 100644 --- a/PWGCF/TableProducer/filter2Prong.cxx +++ b/PWGCF/TableProducer/filter2Prong.cxx @@ -251,7 +251,7 @@ struct Filter2Prong { } PROCESS_SWITCH(Filter2Prong, processMC, "Process MC 2-prong daughters", false); - void processMCGeneric(aod::McCollisions::iterator const&, aod::CFMcParticleRefs const& cfmcparticles) + void processMCGeneric(aod::McCollisions::iterator const&, aod::CFMcParticleRefs const& cfmcparticles, [[maybe_unused]] aod::McParticles const& mcparticles) { // The main filter outputs the primary MC particles. Here we just resolve the daughter indices that are needed for the efficiency matching. for (const auto& r : cfmcparticles) { From 2dd8b3f6363d7ec54f37993c5daac647de395a01 Mon Sep 17 00:00:00 2001 From: Zhiyong <71517277+Luzhiyongg@users.noreply.github.com> Date: Fri, 1 Aug 2025 05:50:40 +0200 Subject: [PATCH 173/345] [PWGCF] add multiplicity correlation QA run-by-run (#12352) --- PWGCF/Flow/Tasks/flowRunbyRun.cxx | 38 +++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowRunbyRun.cxx b/PWGCF/Flow/Tasks/flowRunbyRun.cxx index 620063e1d5d..9259eb8be9e 100644 --- a/PWGCF/Flow/Tasks/flowRunbyRun.cxx +++ b/PWGCF/Flow/Tasks/flowRunbyRun.cxx @@ -68,6 +68,7 @@ struct FlowRunbyRun { O2_DEFINE_CONFIGURABLE(cfgCutDCAz, float, 2.0f, "max DCA to vertex z") O2_DEFINE_CONFIGURABLE(cfgCutDCAzPtDepEnabled, bool, false, "switch of DCAz pt dependent cut") O2_DEFINE_CONFIGURABLE(cfgUseAdditionalEventCut, bool, false, "Use additional event cut on mult correlations") + O2_DEFINE_CONFIGURABLE(cfgOutputCorrelationQA, bool, false, "Fill correlation QA histograms") O2_DEFINE_CONFIGURABLE(cfgEvSelkNoSameBunchPileup, bool, false, "rejects collisions which are associated with the same found-by-T0 bunch crossing") O2_DEFINE_CONFIGURABLE(cfgEvSelkIsGoodZvtxFT0vsPV, bool, false, "removes collisions with large differences between z of PV by tracks and z of PV from FT0 A-C time difference, use this cut at low multiplicities with caution") O2_DEFINE_CONFIGURABLE(cfgEvSelkNoCollInTimeRangeStandard, bool, false, "no collisions in specified time range") @@ -101,6 +102,10 @@ struct FlowRunbyRun { ConfigurableAxis axisEta{"axisEta", {40, -1., 1.}, "eta axis for histograms"}; ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.2, 2.4, 2.6, 2.8, 3, 3.5, 4, 5, 6, 8, 10}, "pt axis for histograms"}; ConfigurableAxis axisIndependent{"axisIndependent", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90}, "X axis for histograms"}; + ConfigurableAxis axisNch{"axisNch", {4000, 0, 4000}, "N_{ch}"}; + ConfigurableAxis axisCentForQA{"axisCentForQA", {100, 0, 100}, "centrality (%)"}; + ConfigurableAxis axisT0C{"axisT0C", {70, 0, 70000}, "N_{ch} (T0C)"}; + ConfigurableAxis axisT0A{"axisT0A", {200, 0, 200000}, "N_{ch} (T0A)"}; Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex; Filter trackFilter = ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t) true)) && (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtMin) && (aod::track::pt < cfgCutPtMax) && (aod::track::tpcChi2NCl < cfgCutChi2prTPCcls) && (nabs(aod::track::dcaZ) < cfgCutDCAz); @@ -113,7 +118,6 @@ struct FlowRunbyRun { // Connect to ccdb Service ccdb; - Configurable ccdbNoLaterThan{"ccdbNoLaterThan", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; // Define output @@ -129,6 +133,7 @@ struct FlowRunbyRun { int lastRunNumer = -1; std::vector runNumbers; // vector of run numbers std::map>> th1sList; // map of histograms for all runs + std::map>> th2sList; // map of TH2 histograms for all runs std::map>> th3sList; // map of TH3 histograms for all runs std::map>> profilesList; // map of profiles for all runs enum OutputTH1Names { @@ -142,6 +147,14 @@ struct FlowRunbyRun { hEventCountSpecific, kCount_TH1Names }; + enum OutputTH2Names { + // here are TH2 histograms + hglobalTracks_centT0C = 0, + hglobalTracks_PVTracks, + hglobalTracks_multV0A, + hcentFV0A_centFT0C, + kCount_TH2Names + }; enum OutputTH3Names { hPhiEtaVtxz = 0, kCount_TH3Names @@ -170,14 +183,15 @@ struct FlowRunbyRun { TF1* fT0AV0AMean = nullptr; TF1* fT0AV0ASigma = nullptr; - using AodCollisions = soa::Filtered>; + using AodCollisions = soa::Filtered>; using AodTracks = soa::Filtered>; void init(InitContext const&) { ccdb->setURL(ccdbUrl.value); ccdb->setCaching(true); - ccdb->setCreatedNotAfter(ccdbNoLaterThan.value); + auto now = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); + ccdb->setCreatedNotAfter(now); // Add output histograms to the registry runNumbers = cfgRunNumbers; @@ -358,6 +372,15 @@ struct FlowRunbyRun { histos[hEventCountSpecific]->GetXaxis()->SetBinLabel(10, "cfgEvSelV0AT0ACut"); th1sList.insert(std::make_pair(runNumber, histos)); + if (cfgOutputCorrelationQA) { + std::vector> th2s(kCount_TH2Names); + th2s[hglobalTracks_centT0C] = registry.add(Form("%d/globalTracks_centT0C", runNumber), "after cut;Centrality T0C;mulplicity global tracks", {HistType::kTH2D, {axisCentForQA, axisNch}}); + th2s[hglobalTracks_PVTracks] = registry.add(Form("%d/globalTracks_PVTracks", runNumber), "after cut;mulplicity PV tracks;mulplicity global tracks", {HistType::kTH2D, {axisNch, axisNch}}); + th2s[hglobalTracks_multV0A] = registry.add(Form("%d/globalTracks_multV0A", runNumber), "after cut;mulplicity V0A;mulplicity global tracks", {HistType::kTH2D, {axisT0A, axisNch}}); + th2s[hcentFV0A_centFT0C] = registry.add(Form("%d/centFV0A_centFT0C", runNumber), "after cut;Centrality T0C;Centrality V0A", {HistType::kTH2D, {axisCentForQA, axisCentForQA}}); + th2sList.insert(std::make_pair(runNumber, th2s)); + } + std::vector> profiles(kCount_TProfileNames); profiles[c22] = registry.add(Form("%d/c22", runNumber), "", {HistType::kTProfile, {axisIndependent}}); profiles[c22_gap10] = registry.add(Form("%d/c22_gap10", runNumber), "", {HistType::kTProfile, {axisIndependent}}); @@ -455,7 +478,8 @@ struct FlowRunbyRun { th1sList[runNumber][hEventCountSpecific]->Fill(8.5); // V0A T0A 5 sigma cut - if (cfgEvSelV0AT0ACut && (std::fabs(collision.multFV0A() - fT0AV0AMean->Eval(collision.multFT0A())) > 5 * fT0AV0ASigma->Eval(collision.multFT0A()))) + float nSigma = 5.; // 5 sigma cut + if (cfgEvSelV0AT0ACut && (std::fabs(collision.multFV0A() - fT0AV0AMean->Eval(collision.multFT0A())) > nSigma * fT0AV0ASigma->Eval(collision.multFT0A()))) return 0; if (cfgEvSelV0AT0ACut) th1sList[runNumber][hEventCountSpecific]->Fill(9.5); @@ -511,6 +535,12 @@ struct FlowRunbyRun { th1sList[runNumber][hVtxZ]->Fill(collision.posZ()); th1sList[runNumber][hMult]->Fill(tracks.size()); th1sList[runNumber][hCent]->Fill(collision.centFT0C()); + if (cfgOutputCorrelationQA) { + th2sList[runNumber][hglobalTracks_centT0C]->Fill(collision.centFT0C(), tracks.size()); + th2sList[runNumber][hglobalTracks_PVTracks]->Fill(collision.multNTracksPV(), tracks.size()); + th2sList[runNumber][hglobalTracks_multV0A]->Fill(collision.multFV0A(), tracks.size()); + th2sList[runNumber][hcentFV0A_centFT0C]->Fill(collision.centFT0C(), collision.centFV0A()); + } loadCorrections(bc.timestamp(), runNumber); From e114d482ac20665d84e783fa555716da991c1747 Mon Sep 17 00:00:00 2001 From: Giorgio Alberto Lucia <87222843+GiorgioAlbertoLucia@users.noreply.github.com> Date: Fri, 1 Aug 2025 08:28:00 +0200 Subject: [PATCH 174/345] [PWGLF] Fixed bug in the processing of cascades (#12354) --- .../Nuspex/LFTreeCreatorClusterStudies.cxx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/PWGLF/TableProducer/Nuspex/LFTreeCreatorClusterStudies.cxx b/PWGLF/TableProducer/Nuspex/LFTreeCreatorClusterStudies.cxx index efb6a15543e..ffa41989881 100644 --- a/PWGLF/TableProducer/Nuspex/LFTreeCreatorClusterStudies.cxx +++ b/PWGLF/TableProducer/Nuspex/LFTreeCreatorClusterStudies.cxx @@ -241,6 +241,7 @@ struct LfTreeCreatorClusterStudies { {"photon_radiusV0", "Photon conversion radius (xy) V0; radius (cm); counts", {HistType::kTH1F, {{100, 0., 100.}}}}, {"photon_conversion_position", "Photon conversion position; x (cm); y (cm)", {HistType::kTH2F, {{250, -5.f, 5.f}, {250, -5.f, 5.f}}}}, {"photon_conversion_position_layer", "Photon conversion position (ITS layers); x (cm); y (cm)", {HistType::kTH2F, {{100, -5.f, 5.f}, {100, -5.f, 5.f}}}}, + {"casc_dca_daughter_pairs", "DCA (xy) for cascade daughter pairs; DCAxy (cm); counts", {HistType::kTH1F, {{100, -0.1, 0.1}}}}, {"Xi_vs_Omega", "Mass Xi vs Omega; mass Omega (GeV/#it{c}^{2}); mass Xi (GeV/#it{c}^{2})", {HistType::kTH2F, {{50, 1.f, 2.f}, {50, 1.f, 2.f}}}}, {"massOmega", "Mass #Omega; signed #it{p}_{T} (GeV/#it{c}); mass (GeV/#it{c}^{2})", {HistType::kTH2F, {{100, -5.f, 5.f}, {100, 1.62f, 1.72f}}}}, {"massOmegaWithBkg", "Mass Omega with Background; mass Omega (GeV/#it{c}^{2}); counts", {HistType::kTH1F, {{100, 1.62f, 1.72f}}}}, @@ -420,6 +421,7 @@ struct LfTreeCreatorClusterStudies { bool qualitySelectionCascade(const double dcaCascDaughters, const double cosPA) { + m_hAnalysis.fill(HIST("casc_dca_daughter_pairs"), dcaCascDaughters); if (std::abs(dcaCascDaughters) > cascsetting_dcaCascDaughters) { return false; } @@ -616,7 +618,7 @@ struct LfTreeCreatorClusterStudies { { float beta = o2::pid::tof::Beta::GetBeta(candidate); beta = std::min(1.f - 1.e-6f, std::max(1.e-4f, beta)); /// sometimes beta > 1 or < 0, to be checked - return candidate.tpcInnerParam() * 2.f * std::sqrt(1.f / (beta * beta) - 1.f); + return candidate.tpcInnerParam() * std::sqrt(1.f / (beta * beta) - 1.f); } // ========================================================================================================= @@ -816,6 +818,7 @@ struct LfTreeCreatorClusterStudies { return; } + m_v0TrackParCovs.emplace_back(v0TrackParCov); float massV0 = fillHistogramsV0(massLambdaV0, massAntiLambdaV0, momMother, candidatePos, candidateNeg, alphaAP, qtAP, radiusV0, v0Bitmask); candidatePos.massMother = massV0; candidateNeg.massMother = massV0; @@ -942,7 +945,7 @@ struct LfTreeCreatorClusterStudies { return; } m_hAnalysis.fill(HIST("de_selections"), DeSelections::kDeNClsIts); - if (!selectionPIDtpcDe(track)) { + if (std::abs(track.tpcNSigmaDe()) > desetting_nsigmatpc) { return; } m_hAnalysis.fill(HIST("de_selections"), DeSelections::kDePIDtpc); @@ -950,7 +953,7 @@ struct LfTreeCreatorClusterStudies { return; } m_hAnalysis.fill(HIST("de_selections"), DeSelections::kDePIDtof); - m_hAnalysis.fill(HIST("nSigmaTPCDe"), track.p() * track.sign(), computeNSigmaDe(track)); + m_hAnalysis.fill(HIST("nSigmaTPCDe"), track.p() * track.sign(), track.tpcNSigmaDe()); m_hAnalysis.fill(HIST("nSigmaITSDe"), track.p() * track.sign(), m_responseITS.nSigmaITS(track.itsClusterSizes(), track.p(), track.eta())); m_hAnalysis.fill(HIST("nSigmaTOFDe"), track.p() * track.sign(), track.tofNSigmaDe()); m_hAnalysis.fill(HIST("TOFmassDe"), track.p() * track.sign(), computeTOFmassDe(track)); @@ -968,7 +971,7 @@ struct LfTreeCreatorClusterStudies { m_ClusterStudiesTableExtra( track.tpcInnerParam() * track.sign(), // pTPC_De, track.pidForTracking(), // PIDinTrk_De, - computeNSigmaDe(track), // TpcNSigma_De, + track.tpcNSigmaDe(), // TpcNSigma_De, track.tofNSigmaDe(), // TofNSigma_De, computeTOFmassDe(track), // TofMass_De, -999.f, // cosPA, From 0e2f1b18e8246f4f549fa158c739699a7c6d1eec Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Fri, 1 Aug 2025 09:13:16 +0200 Subject: [PATCH 175/345] [PWGEM/PhotonMeson,Trigger] update pcm data and add converters (#12363) --- EventFiltering/PWGEM/EMPhotonFilter.cxx | 24 +- PWGEM/PhotonMeson/Core/DalitzEECut.h | 14 +- PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h | 91 +++++-- PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h | 107 ++++++-- PWGEM/PhotonMeson/Core/V0PhotonCut.h | 30 +-- PWGEM/PhotonMeson/DataModel/gammaTables.h | 234 ++++++++++++++++-- .../TableProducer/photonconversionbuilder.cxx | 126 ++++++---- .../TableProducer/skimmerGammaConversion.cxx | 29 ++- .../skimmerPrimaryElectronFromDalitzEE.cxx | 55 ++-- PWGEM/PhotonMeson/Tasks/CMakeLists.txt | 2 + .../Tasks/Converters/CMakeLists.txt | 20 ++ .../electronFromDalitzConverter1.cxx | 84 +++++++ .../Tasks/Converters/pcmConverter1.cxx | 100 ++++++++ PWGEM/PhotonMeson/Tasks/pcmQC.cxx | 26 +- PWGEM/PhotonMeson/Tasks/pcmQCMC.cxx | 28 +-- 15 files changed, 741 insertions(+), 229 deletions(-) create mode 100644 PWGEM/PhotonMeson/Tasks/Converters/CMakeLists.txt create mode 100644 PWGEM/PhotonMeson/Tasks/Converters/electronFromDalitzConverter1.cxx create mode 100644 PWGEM/PhotonMeson/Tasks/Converters/pcmConverter1.cxx diff --git a/EventFiltering/PWGEM/EMPhotonFilter.cxx b/EventFiltering/PWGEM/EMPhotonFilter.cxx index a254c7245a1..b8901e6f006 100644 --- a/EventFiltering/PWGEM/EMPhotonFilter.cxx +++ b/EventFiltering/PWGEM/EMPhotonFilter.cxx @@ -12,16 +12,19 @@ // \brief software trigger for EM photon // \author daiki.sekihata@cern.ch -#include "Math/Vector4D.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" -#include "Common/DataModel/CaloClusters.h" -#include "DataFormatsPHOS/TriggerRecord.h" #include "PWGEM/PhotonMeson/DataModel/gammaTables.h" + +#include "Common/DataModel/CaloClusters.h" #include "EventFiltering/filterTables.h" + +#include "DataFormatsPHOS/TriggerRecord.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" +#include "Framework/runDataProcessing.h" + +#include "Math/Vector4D.h" using namespace o2; using namespace o2::soa; @@ -325,13 +328,10 @@ struct EMPhotonFilter { } // end of collision loop } - Filter PCMFilter = o2::aod::v0photonkf::dcaXYtopv < max_dcatopv_xy_v0 && o2::aod::v0photonkf::dcaZtopv < max_dcatopv_z_v0; - using filteredV0PhotonsKF = Filtered; - Filter DalitzEEFilter = o2::aod::dalitzee::sign == 0; // analyze only uls using filteredDalitzEEs = Filtered; - void process_PCM(MyCollisions const& collisions, filteredV0PhotonsKF const& v0photons, aod::V0Legs const& v0legs, filteredDalitzEEs const& dielectrons, MyPrimaryElectrons const& emprimaryelectrons) + void process_PCM(MyCollisions const& collisions, aod::V0PhotonsKF const& v0photons, aod::V0Legs const& v0legs, filteredDalitzEEs const& dielectrons, MyPrimaryElectrons const& emprimaryelectrons) { const uint8_t system = EM_Filter_PhotonType::kPCM; runFilter(collisions, v0photons, nullptr, nullptr, v0legs, dielectrons, emprimaryelectrons); @@ -351,7 +351,7 @@ struct EMPhotonFilter { runFilter(collisions, nullptr, nullptr, clusters, nullptr, nullptr, nullptr); } - void process_PCM_PHOS(MyCollisions const& collisions, filteredV0PhotonsKF const& v0photons, aod::V0Legs const& v0legs, filteredDalitzEEs const& dielectrons, MyPrimaryElectrons const& emprimaryelectrons, CluCandidates const& clusters) + void process_PCM_PHOS(MyCollisions const& collisions, aod::V0PhotonsKF const& v0photons, aod::V0Legs const& v0legs, filteredDalitzEEs const& dielectrons, MyPrimaryElectrons const& emprimaryelectrons, CluCandidates const& clusters) { const uint8_t system = EM_Filter_PhotonType::kPCM | EM_Filter_PhotonType::kPHOS; runFilter(collisions, v0photons, clusters, nullptr, v0legs, dielectrons, emprimaryelectrons); diff --git a/PWGEM/PhotonMeson/Core/DalitzEECut.h b/PWGEM/PhotonMeson/Core/DalitzEECut.h index ee94b84c19c..ddc1da18340 100644 --- a/PWGEM/PhotonMeson/Core/DalitzEECut.h +++ b/PWGEM/PhotonMeson/Core/DalitzEECut.h @@ -240,10 +240,10 @@ class DalitzEECut : public TNamed { switch (cut) { case DalitzEECuts::kTrackPtRange: - return track.pt() >= mMinTrackPt && track.pt() <= mMaxTrackPt; + return track.pt() > mMinTrackPt && track.pt() < mMaxTrackPt; case DalitzEECuts::kTrackEtaRange: - return track.eta() >= mMinTrackEta && track.eta() <= mMaxTrackEta; + return track.eta() > mMinTrackEta && track.eta() < mMaxTrackEta; case DalitzEECuts::kTPCNCls: return track.tpcNClsFound() >= mMinNClustersTPC; @@ -255,19 +255,19 @@ class DalitzEECut : public TNamed return track.tpcCrossedRowsOverFindableCls() >= mMinNCrossedRowsOverFindableClustersTPC; case DalitzEECuts::kTPCFracSharedClusters: - return track.tpcFractionSharedCls() <= mMaxFracSharedClustersTPC; + return track.tpcFractionSharedCls() < mMaxFracSharedClustersTPC; case DalitzEECuts::kTPCChi2NDF: return mMinChi2PerClusterTPC < track.tpcChi2NCl() && track.tpcChi2NCl() < mMaxChi2PerClusterTPC; case DalitzEECuts::kDCA3Dsigma: - return mMinDca3D <= dca3DinSigma(track) && dca3DinSigma(track) <= mMaxDca3D; // in sigma for single leg + return mMinDca3D < dca3DinSigma(track) && dca3DinSigma(track) < mMaxDca3D; // in sigma for single leg case DalitzEECuts::kDCAxy: - return std::fabs(track.dcaXY()) <= ((mMaxDcaXYPtDep) ? mMaxDcaXYPtDep(track.pt()) : mMaxDcaXY); + return std::fabs(track.dcaXY()) < ((mMaxDcaXYPtDep) ? mMaxDcaXYPtDep(track.pt()) : mMaxDcaXY); case DalitzEECuts::kDCAz: - return std::fabs(track.dcaZ()) <= mMaxDcaZ; + return std::fabs(track.dcaZ()) < mMaxDcaZ; case DalitzEECuts::kITSNCls: return mMinNClustersITS <= track.itsNCls() && track.itsNCls() <= mMaxNClustersITS; @@ -283,7 +283,7 @@ class DalitzEECut : public TNamed // Setters void SetPairPtRange(float minPt = 0.f, float maxPt = 1e10f); void SetPairYRange(float minY = -1e10f, float maxY = 1e10f); - void SetMeeRange(float min = 0.f, float max = 0.5); + void SetMeeRange(float min = 0.f, float max = 0.04); void SetMaxPhivPairMeeDep(std::function meeDepCut); void SelectPhotonConversion(bool flag); diff --git a/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h b/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h index 4b37b306f95..3a1b99b4ed8 100644 --- a/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h +++ b/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h @@ -71,9 +71,12 @@ using namespace o2::aod::pwgem::photon; using namespace o2::aod::pwgem::dilepton::utils::emtrackutil; using namespace o2::aod::pwgem::dilepton::utils; -using MyCollisions = soa::Join; +using MyCollisions = soa::Join; using MyCollision = MyCollisions::iterator; +using MyCollisionsWithJJMC = soa::Join; +using MyCollisionWithJJMC = MyCollisionsWithJJMC::iterator; + using MyV0Photons = soa::Filtered>; using MyV0Photon = MyV0Photons::iterator; @@ -142,18 +145,18 @@ struct Pi0EtaToGammaGamma { Configurable cfg_max_v0radius{"cfg_max_v0radius", 90.0, "max v0 radius"}; Configurable cfg_max_alpha_ap{"cfg_max_alpha_ap", 0.95, "max alpha for AP cut"}; Configurable cfg_max_qt_ap{"cfg_max_qt_ap", 0.01, "max qT for AP cut"}; - Configurable cfg_min_cospa{"cfg_min_cospa", 0.997, "min V0 CosPA"}; - Configurable cfg_max_pca{"cfg_max_pca", 3.0, "max distance btween 2 legs"}; + Configurable cfg_min_cospa{"cfg_min_cospa", 0.999, "min V0 CosPA"}; + Configurable cfg_max_pca{"cfg_max_pca", 1.5, "max distance btween 2 legs"}; Configurable cfg_max_chi2kf{"cfg_max_chi2kf", 1e+10, "max chi2/ndf with KF"}; - Configurable cfg_require_v0_with_correct_xz{"cfg_require_v0_with_correct_xz", true, "flag to select V0s with correct xz"}; + Configurable cfg_require_v0_with_correct_xz{"cfg_require_v0_with_correct_xz", false, "flag to select V0s with correct xz"}; Configurable cfg_reject_v0_on_itsib{"cfg_reject_v0_on_itsib", true, "flag to reject V0s on ITSib"}; Configurable cfg_apply_cuts_from_prefilter_derived{"cfg_apply_cuts_from_prefilter_derived", false, "flag to apply prefilter to V0"}; - Configurable cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 10, "min ncluster tpc"}; + Configurable cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 0, "min ncluster tpc"}; Configurable cfg_min_ncrossedrows{"cfg_min_ncrossedrows", 40, "min ncrossed rows"}; Configurable cfg_max_frac_shared_clusters_tpc{"cfg_max_frac_shared_clusters_tpc", 999.f, "max fraction of shared clusters in TPC"}; Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; - Configurable cfg_max_chi2its{"cfg_max_chi2its", 5.0, "max chi2/NclsITS"}; + Configurable cfg_max_chi2its{"cfg_max_chi2its", 36.0, "max chi2/NclsITS"}; Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -3.0, "min. TPC n sigma for electron"}; Configurable cfg_max_TPCNsigmaEl{"cfg_max_TPCNsigmaEl", +3.0, "max. TPC n sigma for electron"}; Configurable cfg_disable_itsonly_track{"cfg_disable_itsonly_track", false, "flag to disable ITSonly tracks"}; @@ -177,7 +180,7 @@ struct Pi0EtaToGammaGamma { Configurable cfg_min_ncluster_its{"cfg_min_ncluster_its", 5, "min ncluster its"}; Configurable cfg_min_ncrossedrows{"cfg_min_ncrossedrows", 70, "min ncrossed rows"}; Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; - Configurable cfg_max_chi2its{"cfg_max_chi2its", 5.0, "max chi2/NclsITS"}; + Configurable cfg_max_chi2its{"cfg_max_chi2its", 36.0, "max chi2/NclsITS"}; Configurable cfg_max_dcaxy{"cfg_max_dcaxy", 0.05, "max dca XY for single track in cm"}; Configurable cfg_max_dcaz{"cfg_max_dcaz", 0.05, "max dca Z for single track in cm"}; Configurable cfg_max_dca3dsigma_track{"cfg_max_dca3dsigma_track", 1.5, "max DCA 3D in sigma"}; @@ -548,8 +551,8 @@ struct Pi0EtaToGammaGamma { Preslice perCollision_phos = aod::phoscluster::emeventId; Preslice perCollision_electron = aod::emprimaryelectron::emeventId; - Partition positrons = o2::aod::emprimaryelectron::sign > int8_t(0) && static_cast(dileptoncuts.cfg_min_pt_track) < o2::aod::track::pt&& nabs(o2::aod::track::eta) < static_cast(dileptoncuts.cfg_max_eta_track) && static_cast(dileptoncuts.cfg_min_TPCNsigmaEl) < o2::aod::pidtpc::tpcNSigmaEl&& o2::aod::pidtpc::tpcNSigmaEl < static_cast(dileptoncuts.cfg_max_TPCNsigmaEl); - Partition electrons = o2::aod::emprimaryelectron::sign < int8_t(0) && static_cast(dileptoncuts.cfg_min_pt_track) < o2::aod::track::pt && nabs(o2::aod::track::eta) < static_cast(dileptoncuts.cfg_max_eta_track) && static_cast(dileptoncuts.cfg_min_TPCNsigmaEl) < o2::aod::pidtpc::tpcNSigmaEl && o2::aod::pidtpc::tpcNSigmaEl < static_cast(dileptoncuts.cfg_max_TPCNsigmaEl); + Partition positrons = o2::aod::emprimaryelectron::sign > int8_t(0) && dileptoncuts.cfg_min_pt_track < o2::aod::track::pt&& nabs(o2::aod::track::eta) < dileptoncuts.cfg_max_eta_track; + Partition electrons = o2::aod::emprimaryelectron::sign < int8_t(0) && dileptoncuts.cfg_min_pt_track < o2::aod::track::pt && nabs(o2::aod::track::eta) < dileptoncuts.cfg_max_eta_track; using MyEMH = o2::aod::pwgem::dilepton::utils::EventMixingHandler, std::pair, EMTrack>; MyEMH* emh1 = nullptr; @@ -572,7 +575,12 @@ struct Pi0EtaToGammaGamma { continue; } - if (eventcuts.onlyKeepWeightedEvents && std::fabs(collision.weight() - 1.) < 1E-10) { + float weight = 1.f; + if constexpr (std::is_same_v, FilteredMyCollisionsWithJJMC>) { + weight = collision.weight(); + } + + if (eventcuts.onlyKeepWeightedEvents && std::fabs(weight - 1.f) < 1E-10) { continue; } @@ -581,13 +589,13 @@ struct Pi0EtaToGammaGamma { continue; } - o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<0>(&fRegistry, collision, collision.weight()); + o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<0>(&fRegistry, collision, weight); if (!fEMEventCut.IsSelected(collision)) { continue; } - o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<1>(&fRegistry, collision, collision.weight()); - fRegistry.fill(HIST("Event/before/hCollisionCounter"), 12.0, collision.weight()); // accepted - fRegistry.fill(HIST("Event/after/hCollisionCounter"), 12.0, collision.weight()); // accepted + o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<1>(&fRegistry, collision, weight); + fRegistry.fill(HIST("Event/before/hCollisionCounter"), 12.0, weight); // accepted + fRegistry.fill(HIST("Event/after/hCollisionCounter"), 12.0, weight); // accepted int zbin = lower_bound(zvtx_bin_edges.begin(), zvtx_bin_edges.end(), collision.posZ()) - zvtx_bin_edges.begin() - 1; if (zbin < 0) { @@ -655,10 +663,10 @@ struct Pi0EtaToGammaGamma { } } - fRegistry.fill(HIST("Pair/same/hs"), v12.M(), v12.Pt(), collision.weight()); + fRegistry.fill(HIST("Pair/same/hs"), v12.M(), v12.Pt(), weight); if constexpr (pairtype == PairType::kEMCEMC) { - RotationBackground(v12, v1, v2, photons2_per_collision, g1.globalIndex(), g2.globalIndex(), collision.weight()); + RotationBackground(v12, v1, v2, photons2_per_collision, g1.globalIndex(), g2.globalIndex(), weight); } std::pair pair_tmp_id1 = std::make_pair(ndf, g1.globalIndex()); @@ -712,7 +720,7 @@ struct Pi0EtaToGammaGamma { continue; } - fRegistry.fill(HIST("Pair/same/hs"), veeg.M(), veeg.Pt(), collision.weight()); + fRegistry.fill(HIST("Pair/same/hs"), veeg.M(), veeg.Pt(), weight); std::pair pair_tmp_id1 = std::make_pair(ndf, g1.globalIndex()); std::tuple tuple_tmp_id2 = std::make_tuple(ndf, collision.globalIndex(), pos2.trackId(), ele2.trackId()); @@ -742,7 +750,7 @@ struct Pi0EtaToGammaGamma { continue; } - fRegistry.fill(HIST("Pair/same/hs"), v12.M(), v12.Pt(), collision.weight()); + fRegistry.fill(HIST("Pair/same/hs"), v12.M(), v12.Pt(), weight); std::pair pair_tmp_id1 = std::make_pair(ndf, g1.globalIndex()); std::pair pair_tmp_id2 = std::make_pair(ndf, g2.globalIndex()); @@ -799,7 +807,7 @@ struct Pi0EtaToGammaGamma { continue; } - fRegistry.fill(HIST("Pair/mix/hs"), v12.M(), v12.Pt(), collision.weight()); + fRegistry.fill(HIST("Pair/mix/hs"), v12.M(), v12.Pt(), weight); } } } // end of loop over mixed event pool @@ -834,7 +842,7 @@ struct Pi0EtaToGammaGamma { if (std::fabs(v12.Rapidity()) > maxY) { continue; } - fRegistry.fill(HIST("Pair/mix/hs"), v12.M(), v12.Pt(), collision.weight()); + fRegistry.fill(HIST("Pair/mix/hs"), v12.M(), v12.Pt(), weight); } } } // end of loop over mixed event pool @@ -867,7 +875,7 @@ struct Pi0EtaToGammaGamma { if (std::fabs(v12.Rapidity()) > maxY) { continue; } - fRegistry.fill(HIST("Pair/mix/hs"), v12.M(), v12.Pt(), collision.weight()); + fRegistry.fill(HIST("Pair/mix/hs"), v12.M(), v12.Pt(), weight); } } } // end of loop over mixed event pool @@ -925,9 +933,46 @@ struct Pi0EtaToGammaGamma { // } ndf++; } - PROCESS_SWITCH(Pi0EtaToGammaGamma, processAnalysis, "process pair analysis", false); + PROCESS_SWITCH(Pi0EtaToGammaGamma, processAnalysis, "process pair analysis", true); + + using FilteredMyCollisionsWithJJMC = soa::Filtered; + void processAnalysisJJMC(FilteredMyCollisionsWithJJMC const& collisions, Types const&... args) + { + // LOGF(info, "ndf = %d", ndf); + if constexpr (pairtype == PairType::kPCMPCM) { + auto v0photons = std::get<0>(std::tie(args...)); + auto v0legs = std::get<1>(std::tie(args...)); + runPairing(collisions, v0photons, v0photons, v0legs, v0legs, perCollision_pcm, perCollision_pcm, fV0PhotonCut, fV0PhotonCut); + } else if constexpr (pairtype == PairType::kPCMDalitzEE) { + auto v0photons = std::get<0>(std::tie(args...)); + auto v0legs = std::get<1>(std::tie(args...)); + auto emprimaryelectrons = std::get<2>(std::tie(args...)); + // LOGF(info, "electrons.size() = %d, positrons.size() = %d", electrons.size(), positrons.size()); + runPairing(collisions, v0photons, emprimaryelectrons, v0legs, emprimaryelectrons, perCollision_pcm, perCollision_electron, fV0PhotonCut, fDileptonCut); + } else if constexpr (pairtype == PairType::kEMCEMC) { + auto emcclusters = std::get<0>(std::tie(args...)); + runPairing(collisions, emcclusters, emcclusters, nullptr, nullptr, perCollision_emc, perCollision_emc, fEMCCut, fEMCCut); + } else if constexpr (pairtype == PairType::kPHOSPHOS) { + auto phosclusters = std::get<0>(std::tie(args...)); + runPairing(collisions, phosclusters, phosclusters, nullptr, nullptr, perCollision_phos, perCollision_phos, fPHOSCut, fPHOSCut); + } + // else if constexpr (pairtype == PairType::kPCMEMC) { + // auto v0photons = std::get<0>(std::tie(args...)); + // auto v0legs = std::get<1>(std::tie(args...)); + // auto emcclusters = std::get<2>(std::tie(args...)); + // auto emcmatchedtracks = std::get<3>(std::tie(args...)); + // runPairing(collisions, v0photons, emcclusters, v0legs, nullptr, perCollision_pcm, perCollision_emc, fV0PhotonCut, fEMCCut, emcmatchedtracks, nullptr); + // } else if constexpr (pairtype == PairType::kPCMPHOS) { + // auto v0photons = std::get<0>(std::tie(args...)); + // auto v0legs = std::get<1>(std::tie(args...)); + // auto phosclusters = std::get<2>(std::tie(args...)); + // runPairing(collisions, v0photons, phosclusters, v0legs, nullptr, perCollision_pcm, perCollision_phos, fV0PhotonCut, fPHOSCut, nullptr, nullptr); + // } + ndf++; + } + PROCESS_SWITCH(Pi0EtaToGammaGamma, processAnalysisJJMC, "process pair analysis", false); void processDummy(MyCollisions const&) {} - PROCESS_SWITCH(Pi0EtaToGammaGamma, processDummy, "Dummy function", true); + PROCESS_SWITCH(Pi0EtaToGammaGamma, processDummy, "Dummy function", false); }; #endif // PWGEM_PHOTONMESON_CORE_PI0ETATOGAMMAGAMMA_H_ diff --git a/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h b/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h index bb83f7aa0ea..2a0abf941f2 100644 --- a/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h +++ b/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h @@ -57,9 +57,12 @@ using namespace o2::aod::pwgem::photonmeson::photonpair; using namespace o2::aod::pwgem::photonmeson::utils::mcutil; using namespace o2::aod::pwgem::dilepton::utils::mcutil; -using MyCollisions = soa::Join; +using MyCollisions = soa::Join; using MyCollision = MyCollisions::iterator; +using MyCollisionsWithJJMC = soa::Join; +using MyCollisionWithJJMC = MyCollisionsWithJJMC::iterator; + using MyMCCollisions = soa::Join; using MyMCCollision = MyMCCollisions::iterator; @@ -128,17 +131,17 @@ struct Pi0EtaToGammaGammaMC { Configurable cfg_max_v0radius{"cfg_max_v0radius", 90.0, "max v0 radius"}; Configurable cfg_max_alpha_ap{"cfg_max_alpha_ap", 0.95, "max alpha for AP cut"}; Configurable cfg_max_qt_ap{"cfg_max_qt_ap", 0.01, "max qT for AP cut"}; - Configurable cfg_min_cospa{"cfg_min_cospa", 0.997, "min V0 CosPA"}; - Configurable cfg_max_pca{"cfg_max_pca", 3.0, "max distance btween 2 legs"}; + Configurable cfg_min_cospa{"cfg_min_cospa", 0.999, "min V0 CosPA"}; + Configurable cfg_max_pca{"cfg_max_pca", 1.5, "max distance btween 2 legs"}; Configurable cfg_max_chi2kf{"cfg_max_chi2kf", 1e+10, "max chi2/ndf with KF"}; - Configurable cfg_require_v0_with_correct_xz{"cfg_require_v0_with_correct_xz", true, "flag to select V0s with correct xz"}; + Configurable cfg_require_v0_with_correct_xz{"cfg_require_v0_with_correct_xz", false, "flag to select V0s with correct xz"}; Configurable cfg_reject_v0_on_itsib{"cfg_reject_v0_on_itsib", true, "flag to reject V0s on ITSib"}; Configurable cfg_apply_cuts_from_prefilter_derived{"cfg_apply_cuts_from_prefilter_derived", false, "flag to apply prefilter to V0"}; - Configurable cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 10, "min ncluster tpc"}; + Configurable cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 0, "min ncluster tpc"}; Configurable cfg_min_ncrossedrows{"cfg_min_ncrossedrows", 40, "min ncrossed rows"}; Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; - Configurable cfg_max_chi2its{"cfg_max_chi2its", 5.0, "max chi2/NclsITS"}; + Configurable cfg_max_chi2its{"cfg_max_chi2its", 36.0, "max chi2/NclsITS"}; Configurable cfg_max_frac_shared_clusters_tpc{"cfg_max_frac_shared_clusters_tpc", 999.f, "max fraction of shared clusters in TPC"}; Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -3.0, "min. TPC n sigma for electron"}; Configurable cfg_max_TPCNsigmaEl{"cfg_max_TPCNsigmaEl", +3.0, "max. TPC n sigma for electron"}; @@ -164,7 +167,7 @@ struct Pi0EtaToGammaGammaMC { Configurable cfg_min_ncrossedrows{"cfg_min_ncrossedrows", 70, "min ncrossed rows"}; Configurable cfg_max_frac_shared_clusters_tpc{"cfg_max_frac_shared_clusters_tpc", 999.f, "max fraction of shared clusters in TPC"}; Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; - Configurable cfg_max_chi2its{"cfg_max_chi2its", 5.0, "max chi2/NclsITS"}; + Configurable cfg_max_chi2its{"cfg_max_chi2its", 36.0, "max chi2/NclsITS"}; Configurable cfg_max_dcaxy{"cfg_max_dcaxy", 0.05, "max dca XY for single track in cm"}; Configurable cfg_max_dcaz{"cfg_max_dcaz", 0.05, "max dca Z for single track in cm"}; Configurable cfg_max_dca3dsigma_track{"cfg_max_dca3dsigma_track", 1.5, "max DCA 3D in sigma"}; @@ -408,8 +411,8 @@ struct Pi0EtaToGammaGammaMC { Preslice perCollision_phos = aod::phoscluster::emeventId; Preslice perCollision_electron = aod::emprimaryelectron::emeventId; - Partition positrons = o2::aod::emprimaryelectron::sign > int8_t(0) && static_cast(dileptoncuts.cfg_min_pt_track) < o2::aod::track::pt&& nabs(o2::aod::track::eta) < static_cast(dileptoncuts.cfg_max_eta_track) && static_cast(dileptoncuts.cfg_min_TPCNsigmaEl) < o2::aod::pidtpc::tpcNSigmaEl&& o2::aod::pidtpc::tpcNSigmaEl < static_cast(dileptoncuts.cfg_max_TPCNsigmaEl); - Partition electrons = o2::aod::emprimaryelectron::sign < int8_t(0) && static_cast(dileptoncuts.cfg_min_pt_track) < o2::aod::track::pt && nabs(o2::aod::track::eta) < static_cast(dileptoncuts.cfg_max_eta_track) && static_cast(dileptoncuts.cfg_min_TPCNsigmaEl) < o2::aod::pidtpc::tpcNSigmaEl && o2::aod::pidtpc::tpcNSigmaEl < static_cast(dileptoncuts.cfg_max_TPCNsigmaEl); + Partition positrons = o2::aod::emprimaryelectron::sign > int8_t(0) && dileptoncuts.cfg_min_pt_track < o2::aod::track::pt&& nabs(o2::aod::track::eta) < dileptoncuts.cfg_max_eta_track; + Partition electrons = o2::aod::emprimaryelectron::sign < int8_t(0) && dileptoncuts.cfg_min_pt_track < o2::aod::track::pt && nabs(o2::aod::track::eta) < dileptoncuts.cfg_max_eta_track; template void runTruePairing(TCollisions const& collisions, @@ -426,7 +429,12 @@ struct Pi0EtaToGammaGammaMC { continue; } - if (eventcuts.onlyKeepWeightedEvents && std::fabs(collision.weight() - 1.) < 1E-10) { + float weight = 1.f; + if constexpr (std::is_same_v, FilteredMyCollisionsWithJJMC>) { + weight = collision.weight(); + } + + if (eventcuts.onlyKeepWeightedEvents && std::fabs(weight - 1.0) < 1e-10) { continue; } @@ -435,13 +443,13 @@ struct Pi0EtaToGammaGammaMC { continue; } - o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<0>(&fRegistry, collision, collision.weight()); + o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<0>(&fRegistry, collision, weight); if (!fEMEventCut.IsSelected(collision)) { continue; } - o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<1>(&fRegistry, collision, collision.weight()); - fRegistry.fill(HIST("Event/before/hCollisionCounter"), 12.0, collision.weight()); // accepted - fRegistry.fill(HIST("Event/after/hCollisionCounter"), 12.0, collision.weight()); // accepted + o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<1>(&fRegistry, collision, weight); + fRegistry.fill(HIST("Event/before/hCollisionCounter"), 12.0, weight); // accepted + fRegistry.fill(HIST("Event/after/hCollisionCounter"), 12.0, weight); // accepted int photonid1 = -1, photonid2 = -1, pi0id = -1, etaid = -1; if constexpr (pairtype == PairType::kPCMPCM || pairtype == PairType::kPHOSPHOS || pairtype == PairType::kEMCEMC) { // same kinds pairing @@ -512,9 +520,9 @@ struct Pi0EtaToGammaGammaMC { if (g1mc.globalIndex() == g2mc.globalIndex()) { if (getMotherPDGCode(g1mc, mcparticles) == 111) - fRegistry.fill(HIST("Pair/Pi0/hs_FromSameGamma"), v12.M(), v12.Pt(), collision.weight()); + fRegistry.fill(HIST("Pair/Pi0/hs_FromSameGamma"), v12.M(), v12.Pt(), weight); else if (getMotherPDGCode(g1mc, mcparticles) == 221) - fRegistry.fill(HIST("Pair/Eta/hs_FromSameGamma"), v12.M(), v12.Pt(), collision.weight()); + fRegistry.fill(HIST("Pair/Eta/hs_FromSameGamma"), v12.M(), v12.Pt(), weight); continue; } @@ -523,13 +531,13 @@ struct Pi0EtaToGammaGammaMC { if (cfgRequireTrueAssociation && (pi0mc.emmceventId() != collision.emmceventId())) { continue; } - o2::aod::pwgem::photonmeson::utils::nmhistogram::fillTruePairInfo(&fRegistry, v12, pi0mc, mcparticles, mccollisions, f1fd_k0s_to_pi0, collision.weight()); + o2::aod::pwgem::photonmeson::utils::nmhistogram::fillTruePairInfo(&fRegistry, v12, pi0mc, mcparticles, mccollisions, f1fd_k0s_to_pi0, weight); } else if (etaid > 0) { auto etamc = mcparticles.iteratorAt(etaid); if (cfgRequireTrueAssociation && (etamc.emmceventId() != collision.emmceventId())) { continue; } - o2::aod::pwgem::photonmeson::utils::nmhistogram::fillTruePairInfo(&fRegistry, v12, etamc, mcparticles, mccollisions, f1fd_k0s_to_pi0, collision.weight()); + o2::aod::pwgem::photonmeson::utils::nmhistogram::fillTruePairInfo(&fRegistry, v12, etamc, mcparticles, mccollisions, f1fd_k0s_to_pi0, weight); } } // end of pairing loop } else if constexpr (pairtype == PairType::kPCMDalitzEE) { @@ -589,13 +597,13 @@ struct Pi0EtaToGammaGammaMC { if (cfgRequireTrueAssociation && (pi0mc.emmceventId() != collision.emmceventId())) { continue; } - o2::aod::pwgem::photonmeson::utils::nmhistogram::fillTruePairInfo(&fRegistry, veeg, pi0mc, mcparticles, mccollisions, f1fd_k0s_to_pi0, collision.weight()); + o2::aod::pwgem::photonmeson::utils::nmhistogram::fillTruePairInfo(&fRegistry, veeg, pi0mc, mcparticles, mccollisions, f1fd_k0s_to_pi0, weight); } else if (etaid > 0) { auto etamc = mcparticles.iteratorAt(etaid); if (cfgRequireTrueAssociation && (etamc.emmceventId() != collision.emmceventId())) { continue; } - o2::aod::pwgem::photonmeson::utils::nmhistogram::fillTruePairInfo(&fRegistry, veeg, etamc, mcparticles, mccollisions, f1fd_k0s_to_pi0, collision.weight()); + o2::aod::pwgem::photonmeson::utils::nmhistogram::fillTruePairInfo(&fRegistry, veeg, etamc, mcparticles, mccollisions, f1fd_k0s_to_pi0, weight); } } // end of dielectron loop } // end of pcm loop @@ -615,10 +623,10 @@ struct Pi0EtaToGammaGammaMC { } // if (pi0id > 0) { // auto pi0mc = mcparticles.iteratorAt(pi0id); - // o2::aod::pwgem::photonmeson::utils::nmhistogram::fillTruePairInfo(&fRegistry, v12, pi0mc, mcparticles, mccollisions, f1fd_k0s_to_pi0, collision.weight()); + // o2::aod::pwgem::photonmeson::utils::nmhistogram::fillTruePairInfo(&fRegistry, v12, pi0mc, mcparticles, mccollisions, f1fd_k0s_to_pi0, weight); // } else if (etaid > 0) { // auto etamc = mcparticles.iteratorAt(etaid); - // o2::aod::pwgem::photonmeson::utils::nmhistogram::fillTruePairInfo(&fRegistry, v12, etamc, mcparticles, mccollisions, f1fd_k0s_to_pi0, collision.weight()); + // o2::aod::pwgem::photonmeson::utils::nmhistogram::fillTruePairInfo(&fRegistry, v12, etamc, mcparticles, mccollisions, f1fd_k0s_to_pi0, weight); // } } // end of pairing loop } // end of pairing in same event @@ -668,7 +676,12 @@ struct Pi0EtaToGammaGammaMC { continue; // I don't know why this is necessary in simulation. } - if (eventcuts.onlyKeepWeightedEvents && std::fabs(collision.weight() - 1.) < 1E-10) { + float weight = 1.f; + if constexpr (std::is_same_v, FilteredMyCollisionsWithJJMC>) { + weight = collision.weight(); + } + + if (eventcuts.onlyKeepWeightedEvents && std::fabs(weight - 1.0) < 1e-10) { continue; } @@ -684,8 +697,8 @@ struct Pi0EtaToGammaGammaMC { auto mccollision = collision.template emmcevent_as(); auto binned_data_pi0_gen = mccollision.generatedPi0(); auto binned_data_eta_gen = mccollision.generatedEta(); - fillBinnedData<0>(binned_data_pi0_gen, collision.weight()); - fillBinnedData<1>(binned_data_eta_gen, collision.weight()); + fillBinnedData<0>(binned_data_pi0_gen, weight); + fillBinnedData<1>(binned_data_eta_gen, weight); } // end of collision loop } @@ -734,9 +747,49 @@ struct Pi0EtaToGammaGammaMC { // runPairing(collisions, v0photons, phosclusters, v0legs, nullptr, perCollision_pcm, perCollision_phos, fV0PhotonCut, fPHOSCut, nullptr, nullptr); // } } - PROCESS_SWITCH(Pi0EtaToGammaGammaMC, processAnalysis, "process pair analysis", false); + PROCESS_SWITCH(Pi0EtaToGammaGammaMC, processAnalysis, "process pair analysis", true); + + using FilteredMyCollisionsWithJJMC = soa::Filtered; + void processAnalysisJJMC(FilteredMyCollisionsWithJJMC const& collisions, MyMCCollisions const& mccollisions, aod::EMMCParticles const& mcparticles, Types const&... args) + { + if constexpr (pairtype == PairType::kPCMPCM) { + auto v0photons = std::get<0>(std::tie(args...)); + auto v0legs = std::get<1>(std::tie(args...)); + runTruePairing(collisions, v0photons, v0photons, v0legs, v0legs, perCollision_pcm, perCollision_pcm, fV0PhotonCut, fV0PhotonCut, mccollisions, mcparticles); + runGenInfo(collisions, mccollisions, mcparticles); + } else if constexpr (pairtype == PairType::kPCMDalitzEE) { + auto v0photons = std::get<0>(std::tie(args...)); + auto v0legs = std::get<1>(std::tie(args...)); + auto emprimaryelectrons = std::get<2>(std::tie(args...)); + // LOGF(info, "electrons.size() = %d, positrons.size() = %d", electrons.size(), positrons.size()); + runTruePairing(collisions, v0photons, emprimaryelectrons, v0legs, emprimaryelectrons, perCollision_pcm, perCollision_electron, fV0PhotonCut, fDileptonCut, mccollisions, mcparticles); + runGenInfo(collisions, mccollisions, mcparticles); + } else if constexpr (pairtype == PairType::kEMCEMC) { + auto emcclusters = std::get<0>(std::tie(args...)); + runTruePairing(collisions, emcclusters, emcclusters, nullptr, nullptr, perCollision_emc, perCollision_emc, fEMCCut, fEMCCut, mccollisions, mcparticles); + runGenInfo(collisions, mccollisions, mcparticles); + } + + // else if constexpr (pairtype == PairType::kPHOSPHOS) { + // auto phosclusters = std::get<0>(std::tie(args...)); + // runPairing(collisions, phosclusters, phosclusters, nullptr, nullptr, perCollision_phos, perCollision_phos, fPHOSCut, fPHOSCut, nullptr, nullptr); + // } + // else if constexpr (pairtype == PairType::kPCMEMC) { + // auto v0photons = std::get<0>(std::tie(args...)); + // auto v0legs = std::get<1>(std::tie(args...)); + // auto emcclusters = std::get<2>(std::tie(args...)); + // auto emcmatchedtracks = std::get<3>(std::tie(args...)); + // runPairing(collisions, v0photons, emcclusters, v0legs, nullptr, perCollision_pcm, perCollision_emc, fV0PhotonCut, fEMCCut, emcmatchedtracks, nullptr); + // } else if constexpr (pairtype == PairType::kPCMPHOS) { + // auto v0photons = std::get<0>(std::tie(args...)); + // auto v0legs = std::get<1>(std::tie(args...)); + // auto phosclusters = std::get<2>(std::tie(args...)); + // runPairing(collisions, v0photons, phosclusters, v0legs, nullptr, perCollision_pcm, perCollision_phos, fV0PhotonCut, fPHOSCut, nullptr, nullptr); + // } + } + PROCESS_SWITCH(Pi0EtaToGammaGammaMC, processAnalysisJJMC, "process pair analysis", false); void processDummy(MyCollisions const&) {} - PROCESS_SWITCH(Pi0EtaToGammaGammaMC, processDummy, "Dummy function", true); + PROCESS_SWITCH(Pi0EtaToGammaGammaMC, processDummy, "Dummy function", false); }; #endif // PWGEM_PHOTONMESON_CORE_PI0ETATOGAMMAGAMMAMC_H_ diff --git a/PWGEM/PhotonMeson/Core/V0PhotonCut.h b/PWGEM/PhotonMeson/Core/V0PhotonCut.h index d6064ab8786..ac4ff278e4a 100644 --- a/PWGEM/PhotonMeson/Core/V0PhotonCut.h +++ b/PWGEM/PhotonMeson/Core/V0PhotonCut.h @@ -16,16 +16,18 @@ #ifndef PWGEM_PHOTONMESON_CORE_V0PHOTONCUT_H_ #define PWGEM_PHOTONMESON_CORE_V0PHOTONCUT_H_ -#include -#include -#include -#include -#include #include "Rtypes.h" -#include "TNamed.h" -#include "TMath.h" #include "PWGEM/PhotonMeson/Utils/TrackSelection.h" + +#include "TMath.h" +#include "TNamed.h" + +#include +#include +#include +#include +#include using namespace o2::pwgem::photonmeson; class V0PhotonCut : public TNamed @@ -343,10 +345,10 @@ class V0PhotonCut : public TNamed { switch (cut) { case V0PhotonCuts::kTrackPtRange: - return track.pt() >= mMinTrackPt && track.pt() <= mMaxTrackPt; + return track.pt() > mMinTrackPt && track.pt() < mMaxTrackPt; case V0PhotonCuts::kTrackEtaRange: - return track.eta() >= mMinTrackEta && track.eta() <= mMaxTrackEta; + return track.eta() > mMinTrackEta && track.eta() < mMaxTrackEta; case V0PhotonCuts::kTPCNCls: return track.tpcNClsFound() >= mMinNClustersTPC; @@ -358,22 +360,22 @@ class V0PhotonCut : public TNamed return track.tpcCrossedRowsOverFindableCls() >= mMinNCrossedRowsOverFindableClustersTPC; case V0PhotonCuts::kTPCFracSharedClusters: - return track.tpcFractionSharedCls() <= mMaxFracSharedClustersTPC; + return track.tpcFractionSharedCls() < mMaxFracSharedClustersTPC; case V0PhotonCuts::kTPCChi2NDF: return mMinChi2PerClusterTPC < track.tpcChi2NCl() && track.tpcChi2NCl() < mMaxChi2PerClusterTPC; case V0PhotonCuts::kTPCNsigmaEl: - return track.tpcNSigmaEl() >= mMinTPCNsigmaEl && track.tpcNSigmaEl() <= mMaxTPCNsigmaEl; + return track.tpcNSigmaEl() > mMinTPCNsigmaEl && track.tpcNSigmaEl() < mMaxTPCNsigmaEl; case V0PhotonCuts::kTPCNsigmaPi: - return track.tpcNSigmaPi() >= mMinTPCNsigmaPi && track.tpcNSigmaPi() <= mMaxTPCNsigmaPi; + return track.tpcNSigmaPi() > mMinTPCNsigmaPi && track.tpcNSigmaPi() < mMaxTPCNsigmaPi; case V0PhotonCuts::kDCAxy: - return std::fabs(track.dcaXY()) <= ((mMaxDcaXYPtDep) ? mMaxDcaXYPtDep(track.pt()) : mMaxDcaXY); + return std::fabs(track.dcaXY()) < ((mMaxDcaXYPtDep) ? mMaxDcaXYPtDep(track.pt()) : mMaxDcaXY); case V0PhotonCuts::kDCAz: - return std::fabs(track.dcaZ()) <= mMaxDcaZ; + return std::fabs(track.dcaZ()) < mMaxDcaZ; case V0PhotonCuts::kITSNCls: return mMinNClustersITS <= track.itsNCls() && track.itsNCls() <= mMaxNClustersITS; diff --git a/PWGEM/PhotonMeson/DataModel/gammaTables.h b/PWGEM/PhotonMeson/DataModel/gammaTables.h index 9418e3b9221..308e27acd10 100644 --- a/PWGEM/PhotonMeson/DataModel/gammaTables.h +++ b/PWGEM/PhotonMeson/DataModel/gammaTables.h @@ -123,6 +123,34 @@ DECLARE_SOA_COLUMN(IsMoved, isMoved, bool); //! moved by drift manager. r DECLARE_SOA_COLUMN(Px, px, float); //! Px at SV DECLARE_SOA_COLUMN(Py, py, float); //! Py at SV DECLARE_SOA_COLUMN(Pz, pz, float); //! Pz at SV + +DECLARE_SOA_COLUMN(DcaXYINT16, dcaXYINT16, int16_t); //! -32768 - +32767 +DECLARE_SOA_COLUMN(DcaZINT16, dcaZINT16, int16_t); //! -32768 - +32767 + +DECLARE_SOA_COLUMN(XUINT16, xUINT16, uint16_t); //! 0 - +65535 +DECLARE_SOA_COLUMN(YINT16, yINT16, int16_t); //! 0 - +65535 +DECLARE_SOA_COLUMN(ZINT16, zINT16, int16_t); //! -32768 - +32767 + +DECLARE_SOA_COLUMN(TPCSignalUINT16, tpcSignalUINT16, uint16_t); //! 0 - +65535 +DECLARE_SOA_COLUMN(DeDxTunedMcUINT16, mcTunedTPCSignalUINT16, uint16_t); //! 0 - +65535 +DECLARE_SOA_COLUMN(TPCChi2NClINT16, tpcChi2NClINT16, int16_t); //! -32768 - +32767 +DECLARE_SOA_COLUMN(ITSChi2NClINT16, itsChi2NClINT16, int16_t); //! -32768 - +32767 +DECLARE_SOA_COLUMN(TPCNSigmaElINT16, tpcNSigmaElINT16, int16_t); //! -32768 - +32767 +DECLARE_SOA_COLUMN(TPCNSigmaPiINT16, tpcNSigmaPiINT16, int16_t); //! -32768 - +32767 +DECLARE_SOA_DYNAMIC_COLUMN(TPCSignal, tpcSignal, [](uint16_t x) -> float { return static_cast(x) * 1e-2; }); +DECLARE_SOA_DYNAMIC_COLUMN(DeDxTunedMc, mcTunedTPCSignal, [](uint16_t x) -> float { return static_cast(x) * 1e-2; }); +DECLARE_SOA_DYNAMIC_COLUMN(TPCChi2NCl, tpcChi2NCl, [](int16_t x) -> float { return static_cast(x) * 1e-2; }); +DECLARE_SOA_DYNAMIC_COLUMN(ITSChi2NCl, itsChi2NCl, [](int16_t x) -> float { return static_cast(x) * 1e-2; }); +DECLARE_SOA_DYNAMIC_COLUMN(TPCNSigmaEl, tpcNSigmaEl, [](int16_t x) -> float { return static_cast(x) * 1e-2; }); +DECLARE_SOA_DYNAMIC_COLUMN(TPCNSigmaPi, tpcNSigmaPi, [](int16_t x) -> float { return static_cast(x) * 1e-2; }); + +DECLARE_SOA_DYNAMIC_COLUMN(X, x, [](uint16_t x) -> float { return static_cast(x) * 1e-2; }); +DECLARE_SOA_DYNAMIC_COLUMN(Y, y, [](int16_t x) -> float { return static_cast(x) * 1e-2; }); +DECLARE_SOA_DYNAMIC_COLUMN(Z, z, [](int16_t x) -> float { return static_cast(x) * 1e-2; }); + +DECLARE_SOA_DYNAMIC_COLUMN(DcaXY, dcaXY, [](int16_t x) -> float { return static_cast(x) * 1e-2; }); +DECLARE_SOA_DYNAMIC_COLUMN(DcaZ, dcaZ, [](int16_t x) -> float { return static_cast(x) * 1e-2; }); + DECLARE_SOA_DYNAMIC_COLUMN(P, p, [](float px, float py, float pz) -> float { return RecoDecay::sqrtSumOfSquares(px, py, pz); }); DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt, [](float px, float py) -> float { return RecoDecay::sqrtSumOfSquares(px, py); }); DECLARE_SOA_DYNAMIC_COLUMN(Eta, eta, [](float px, float py, float pz) -> float { return RecoDecay::eta(std::array{px, py, pz}); }); @@ -173,7 +201,7 @@ DECLARE_SOA_DYNAMIC_COLUMN(MeanClusterSizeITSob, meanClusterSizeITSob, [](uint32 } }); } // namespace v0leg -DECLARE_SOA_TABLE(V0Legs, "AOD", "V0LEG", //! +DECLARE_SOA_TABLE(V0Legs_000, "AOD", "V0LEG", //! o2::soa::Index<>, v0leg::CollisionId, v0leg::TrackId, v0leg::Sign, v0leg::Px, v0leg::Py, v0leg::Pz, track::DcaXY, track::DcaZ, @@ -194,12 +222,51 @@ DECLARE_SOA_TABLE(V0Legs, "AOD", "V0LEG", //! track::TPCFoundOverFindableCls, track::TPCFractionSharedCls, track::v001::ITSClusterMap, track::v001::ITSNCls, track::v001::ITSNClsInnerBarrel, - track::HasITS, track::HasTPC, - track::HasTRD, track::HasTOF, + track::HasITS, track::HasTPC, track::HasTRD, track::HasTOF, v0leg::MeanClusterSizeITS, v0leg::MeanClusterSizeITSib, v0leg::MeanClusterSizeITSob); +DECLARE_SOA_TABLE_VERSIONED(V0Legs_001, "AOD", "V0LEG", 1, //! + o2::soa::Index<>, v0leg::CollisionId, v0leg::TrackId, v0leg::Sign, + v0leg::Px, v0leg::Py, v0leg::Pz, + v0leg::DcaXYINT16, v0leg::DcaZINT16, + track::TPCNClsFindable, track::TPCNClsFindableMinusFound, track::TPCNClsFindableMinusCrossedRows, track::TPCNClsShared, + v0leg::TPCChi2NClINT16, track::TPCInnerParam, + v0leg::TPCSignalUINT16, v0leg::TPCNSigmaElINT16, v0leg::TPCNSigmaPiINT16, + track::ITSClusterSizes, v0leg::ITSChi2NClINT16, track::DetectorMap, v0leg::DeDxTunedMcUINT16, + v0leg::XUINT16, v0leg::YINT16, v0leg::ZINT16, track::Tgl, + + // dynamic column + v0leg::P, + v0leg::Pt, + v0leg::Eta, + v0leg::Phi, + v0leg::DcaXY, + v0leg::DcaZ, + + track::TPCNClsFound, + track::TPCNClsCrossedRows, + track::TPCCrossedRowsOverFindableCls, + track::TPCFoundOverFindableCls, + track::TPCFractionSharedCls, + track::v001::ITSClusterMap, track::v001::ITSNCls, track::v001::ITSNClsInnerBarrel, + track::HasITS, track::HasTPC, track::HasTRD, track::HasTOF, + v0leg::MeanClusterSizeITS, + v0leg::MeanClusterSizeITSib, + v0leg::MeanClusterSizeITSob, + v0leg::TPCSignal, + v0leg::DeDxTunedMc, + v0leg::TPCChi2NCl, + v0leg::ITSChi2NCl, + v0leg::TPCNSigmaEl, + v0leg::TPCNSigmaPi, + v0leg::X, + v0leg::Y, + v0leg::Z); + +using V0Legs = V0Legs_001; + // iterators using V0Leg = V0Legs::iterator; @@ -216,6 +283,20 @@ DECLARE_SOA_TABLE(EMEventsWeight, "AOD", "EMEVENTWEIGHT", //! table contanint th emevent::Weight); using EMEventWeight = EMEventsWeight::iterator; +namespace oldv0photonkf +{ +DECLARE_SOA_COLUMN(MGamma, mGamma, float); //! invariant mass of dielectron at SV +DECLARE_SOA_COLUMN(DCAxyToPV, dcaXYtopv, float); //! DCAxy of V0 to PV +DECLARE_SOA_COLUMN(DCAzToPV, dcaZtopv, float); //! DCAz of V0 to PV +DECLARE_SOA_COLUMN(CosPA, cospa, float); //! +DECLARE_SOA_COLUMN(CosPAXY, cospaXY, float); //! +DECLARE_SOA_COLUMN(CosPARZ, cospaRZ, float); //! +DECLARE_SOA_COLUMN(PCA, pca, float); //! +DECLARE_SOA_COLUMN(Alpha, alpha, float); //! +DECLARE_SOA_COLUMN(QtArm, qtarm, float); //! +DECLARE_SOA_COLUMN(ChiSquareNDF, chiSquareNDF, float); //! Chi2 / NDF of the reconstructed V0 +} // namespace oldv0photonkf + namespace v0photonkf { DECLARE_SOA_INDEX_COLUMN(EMEvent, emevent); //! @@ -229,23 +310,37 @@ DECLARE_SOA_COLUMN(Vz, vz, float); //! seco DECLARE_SOA_COLUMN(Px, px, float); //! px for photon kf DECLARE_SOA_COLUMN(Py, py, float); //! py for photon kf DECLARE_SOA_COLUMN(Pz, pz, float); //! pz for photon kf -DECLARE_SOA_COLUMN(MGamma, mGamma, float); //! invariant mass of dielectron at SV -DECLARE_SOA_COLUMN(DCAxyToPV, dcaXYtopv, float); //! DCAxy of V0 to PV -DECLARE_SOA_COLUMN(DCAzToPV, dcaZtopv, float); //! DCAz of V0 to PV -DECLARE_SOA_COLUMN(CosPA, cospa, float); //! -DECLARE_SOA_COLUMN(CosPAXY, cospaXY, float); //! -DECLARE_SOA_COLUMN(CosPARZ, cospaRZ, float); //! -DECLARE_SOA_COLUMN(PCA, pca, float); //! -DECLARE_SOA_COLUMN(Alpha, alpha, float); //! -DECLARE_SOA_COLUMN(QtArm, qtarm, float); //! -DECLARE_SOA_COLUMN(ChiSquareNDF, chiSquareNDF, float); //! Chi2 / NDF of the reconstructed V0 -DECLARE_SOA_COLUMN(SigmaPx2, sigmaPx2, float); //! error^2 of px in covariant matrix -DECLARE_SOA_COLUMN(SigmaPy2, sigmaPy2, float); //! error^2 of py in covariant matrix -DECLARE_SOA_COLUMN(SigmaPz2, sigmaPz2, float); //! error^2 of pz in covariant matrix -DECLARE_SOA_COLUMN(SigmaPxPy, sigmaPxPy, float); //! error of px x py in covariant matrix -DECLARE_SOA_COLUMN(SigmaPyPz, sigmaPyPz, float); //! error of py x pz in covariant matrix -DECLARE_SOA_COLUMN(SigmaPzPx, sigmaPzPx, float); //! error of pz x px in covariant matrix -DECLARE_SOA_COLUMN(PrefilterBitDerived, pfbderived, uint16_t); //! +DECLARE_SOA_COLUMN(MGammaUINT16, mGammaUINT16, uint16_t); //! invariant mass of dielectron at SV + +DECLARE_SOA_COLUMN(DCAxyToPVINT16, dcaXYtopvINT16, int16_t); //! DCAxy of V0 to PV +DECLARE_SOA_COLUMN(DCAzToPVINT16, dcaZtopvINT16, int16_t); //! DCAz of V0 to PV +DECLARE_SOA_COLUMN(CosPAUINT16, cospaUINT16, uint16_t); //! cosine of pointing angle in 3D +DECLARE_SOA_COLUMN(CosPAXYUINT16, cospaXYUINT16, uint16_t); //! cosine of pointing angle in XY +DECLARE_SOA_COLUMN(CosPARZUINT16, cospaRZUINT16, uint16_t); //! cosine of pointing angle in RZ +DECLARE_SOA_COLUMN(PCAUINT16, pcaUINT16, uint16_t); //! distance between 2 legs at point of closest approach +DECLARE_SOA_COLUMN(AlphaINT16, alphaINT16, int16_t); //! longitudinal momentum asymmetry +DECLARE_SOA_COLUMN(QtArmUINT16, qtarmUINT16, uint16_t); //! qT +DECLARE_SOA_COLUMN(ChiSquareNDFUINT16, chiSquareNDFUINT16, uint16_t); //! Chi2 / NDF of the reconstructed V0 + +DECLARE_SOA_COLUMN(SigmaPx2, sigmaPx2, float); //! error^2 of px in covariant matrix +DECLARE_SOA_COLUMN(SigmaPy2, sigmaPy2, float); //! error^2 of py in covariant matrix +DECLARE_SOA_COLUMN(SigmaPz2, sigmaPz2, float); //! error^2 of pz in covariant matrix +DECLARE_SOA_COLUMN(SigmaPxPy, sigmaPxPy, float); //! error of px x py in covariant matrix +DECLARE_SOA_COLUMN(SigmaPyPz, sigmaPyPz, float); //! error of py x pz in covariant matrix +DECLARE_SOA_COLUMN(SigmaPzPx, sigmaPzPx, float); //! error of pz x px in covariant matrix +DECLARE_SOA_COLUMN(PrefilterBitDerived, pfbderived, uint16_t); //! + +DECLARE_SOA_DYNAMIC_COLUMN(DCAxyToPV, dcaXYtopv, [](int16_t x) -> float { return static_cast(x) * 1e-2; }); +DECLARE_SOA_DYNAMIC_COLUMN(DCAzToPV, dcaZtopv, [](int16_t x) -> float { return static_cast(x) * 1e-2; }); + +DECLARE_SOA_DYNAMIC_COLUMN(MGamma, mGamma, [](uint16_t x) -> float { return static_cast(x) * 1e-5; }); +DECLARE_SOA_DYNAMIC_COLUMN(CosPA, cospa, [](uint16_t x) -> float { return static_cast(x) * 2e-5; }); +DECLARE_SOA_DYNAMIC_COLUMN(CosPAXY, cospaXY, [](uint16_t x) -> float { return static_cast(x) * 2e-5; }); +DECLARE_SOA_DYNAMIC_COLUMN(CosPARZ, cospaRZ, [](uint16_t x) -> float { return static_cast(x) * 2e-5; }); +DECLARE_SOA_DYNAMIC_COLUMN(PCA, pca, [](uint16_t x) -> float { return static_cast(x) * 1e-4; }); +DECLARE_SOA_DYNAMIC_COLUMN(Alpha, alpha, [](int16_t x) -> float { return static_cast(x) * 1e-4; }); +DECLARE_SOA_DYNAMIC_COLUMN(QtArm, qtarm, [](uint16_t x) -> float { return static_cast(x) * 1e-5; }); +DECLARE_SOA_DYNAMIC_COLUMN(ChiSquareNDF, chiSquareNDF, [](uint16_t x) -> float { return static_cast(x) * 1e-1; }); DECLARE_SOA_DYNAMIC_COLUMN(E, e, [](float px, float py, float pz, float m = 0) -> float { return RecoDecay::sqrtSumOfSquares(px, py, pz, m); }); //! energy of v0 photn, mass to be given as argument when getter is called! DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt, [](float px, float py) -> float { return RecoDecay::sqrtSumOfSquares(px, py); }); @@ -254,15 +349,15 @@ DECLARE_SOA_DYNAMIC_COLUMN(Phi, phi, [](float px, float py) -> float { return Re DECLARE_SOA_DYNAMIC_COLUMN(P, p, [](float px, float py, float pz) -> float { return RecoDecay::sqrtSumOfSquares(px, py, pz); }); DECLARE_SOA_DYNAMIC_COLUMN(V0Radius, v0radius, [](float vx, float vy) -> float { return RecoDecay::sqrtSumOfSquares(vx, vy); }); } // namespace v0photonkf -DECLARE_SOA_TABLE(V0PhotonsKF, "AOD", "V0PHOTONKF", //! +DECLARE_SOA_TABLE(V0PhotonsKF_000, "AOD", "V0PHOTONKF", //! o2::soa::Index<>, v0photonkf::CollisionId, v0photonkf::V0Id, v0photonkf::PosTrackId, v0photonkf::NegTrackId, v0photonkf::Vx, v0photonkf::Vy, v0photonkf::Vz, v0photonkf::Px, v0photonkf::Py, v0photonkf::Pz, - v0photonkf::MGamma, - v0photonkf::DCAxyToPV, v0photonkf::DCAzToPV, - v0photonkf::CosPA, v0photonkf::CosPAXY, v0photonkf::CosPARZ, v0photonkf::PCA, - v0photonkf::Alpha, v0photonkf::QtArm, - v0photonkf::ChiSquareNDF, + oldv0photonkf::MGamma, + oldv0photonkf::DCAxyToPV, oldv0photonkf::DCAzToPV, + oldv0photonkf::CosPA, oldv0photonkf::CosPAXY, oldv0photonkf::CosPARZ, oldv0photonkf::PCA, + oldv0photonkf::Alpha, oldv0photonkf::QtArm, + oldv0photonkf::ChiSquareNDF, // dynamic column v0photonkf::E, @@ -271,6 +366,38 @@ DECLARE_SOA_TABLE(V0PhotonsKF, "AOD", "V0PHOTONKF", //! v0photonkf::Phi, v0photonkf::P, v0photonkf::V0Radius); + +DECLARE_SOA_TABLE_VERSIONED(V0PhotonsKF_001, "AOD", "V0PHOTONKF", 1, //! + o2::soa::Index<>, v0photonkf::CollisionId, v0photonkf::V0Id, v0photonkf::PosTrackId, v0photonkf::NegTrackId, + v0photonkf::Vx, v0photonkf::Vy, v0photonkf::Vz, + v0photonkf::Px, v0photonkf::Py, v0photonkf::Pz, + v0photonkf::MGammaUINT16, + v0photonkf::DCAxyToPVINT16, v0photonkf::DCAzToPVINT16, + v0photonkf::CosPAUINT16, v0photonkf::CosPAXYUINT16, v0photonkf::CosPARZUINT16, v0photonkf::PCAUINT16, + v0photonkf::AlphaINT16, v0photonkf::QtArmUINT16, + v0photonkf::ChiSquareNDFUINT16, + + // dynamic column + v0photonkf::E, + v0photonkf::Pt, + v0photonkf::Eta, + v0photonkf::Phi, + v0photonkf::P, + v0photonkf::V0Radius, + + v0photonkf::MGamma, + v0photonkf::DCAxyToPV, + v0photonkf::DCAzToPV, + v0photonkf::CosPA, + v0photonkf::CosPAXY, + v0photonkf::CosPARZ, + v0photonkf::PCA, + v0photonkf::Alpha, + v0photonkf::QtArm, + v0photonkf::ChiSquareNDF); + +using V0PhotonsKF = V0PhotonsKF_001; + // iterators using V0PhotonKF = V0PhotonsKF::iterator; @@ -287,7 +414,7 @@ DECLARE_SOA_TABLE(V0PhotonsKFPrefilterBitDerived, "AOD", "V0PHOTONKFPFBPI0", v0p // iterators using V0PhotonKFPrefilterBitDerived = V0PhotonsKFPrefilterBitDerived::iterator; -DECLARE_SOA_TABLE(EMPrimaryElectronsFromDalitz, "AOD", "EMPRIMARYELDA", //! +DECLARE_SOA_TABLE(EMPrimaryElectronsFromDalitz_000, "AOD", "EMPRIMARYELDA", //! o2::soa::Index<>, emprimaryelectron::CollisionId, emprimaryelectron::TrackId, emprimaryelectron::Sign, track::Pt, track::Eta, track::Phi, track::DcaXY, track::DcaZ, track::CYY, track::CZY, track::CZZ, @@ -314,6 +441,59 @@ DECLARE_SOA_TABLE(EMPrimaryElectronsFromDalitz, "AOD", "EMPRIMARYELDA", //! emprimaryelectron::MeanClusterSizeITS, emprimaryelectron::MeanClusterSizeITSib, emprimaryelectron::MeanClusterSizeITSob); + +DECLARE_SOA_TABLE_VERSIONED(EMPrimaryElectronsFromDalitz_001, "AOD", "EMPRIMARYELDA", 1, //! + o2::soa::Index<>, emprimaryelectron::CollisionId, + emprimaryelectron::TrackId, emprimaryelectron::Sign, + track::Pt, track::Eta, track::Phi, track::DcaXY, track::DcaZ, track::CYY, track::CZY, track::CZZ, + + // track::TPCNClsFindable, track::TPCNClsFindableMinusFound, track::TPCNClsFindableMinusCrossedRows, track::TPCNClsShared, + // track::TPCChi2NCl, track::TPCInnerParam, + // track::TPCSignal, pidtpc::TPCNSigmaEl, pidtpc::TPCNSigmaPi, + // pidtofbeta::Beta, pidtof::TOFNSigmaEl, pidtof::TOFNSigmaPi, + // track::ITSClusterSizes, track::ITSChi2NCl, track::TOFChi2, track::DetectorMap, track::Tgl, + + track::TPCNClsFindable, track::TPCNClsFindableMinusFound, track::TPCNClsFindableMinusCrossedRows, track::TPCNClsShared, + emprimaryelectron::TPCChi2NClINT16, track::TPCInnerParam, + emprimaryelectron::TPCSignalUINT16, emprimaryelectron::TPCNSigmaElINT16, emprimaryelectron::TPCNSigmaPiINT16, + emprimaryelectron::BetaINT16, emprimaryelectron::TOFNSigmaElINT16, emprimaryelectron::TOFNSigmaPiINT16, + track::ITSClusterSizes, + emprimaryelectron::ITSChi2NClINT16, emprimaryelectron::TOFChi2INT16, track::DetectorMap, track::Tgl, + emprimaryelectron::DeDxTunedMcUINT16, + + // dynamic column + track::TPCNClsFound, + track::TPCNClsCrossedRows, + track::TPCCrossedRowsOverFindableCls, + track::TPCFoundOverFindableCls, + track::v001::ITSClusterMap, track::v001::ITSNCls, track::v001::ITSNClsInnerBarrel, + track::TPCFractionSharedCls, + track::HasITS, track::HasTPC, + track::HasTRD, track::HasTOF, + + emprimaryelectron::TPCSignal, + emprimaryelectron::TPCChi2NCl, + emprimaryelectron::ITSChi2NCl, + emprimaryelectron::DeDxTunedMc, + emprimaryelectron::Beta, + emprimaryelectron::TOFChi2, + + emprimaryelectron::TPCNSigmaEl, + emprimaryelectron::TPCNSigmaPi, + emprimaryelectron::TOFNSigmaEl, + emprimaryelectron::TOFNSigmaPi, + + emprimaryelectron::Signed1Pt, + emprimaryelectron::P, + emprimaryelectron::Px, + emprimaryelectron::Py, + emprimaryelectron::Pz, + emprimaryelectron::MeanClusterSizeITS, + emprimaryelectron::MeanClusterSizeITSib, + emprimaryelectron::MeanClusterSizeITSob); + +using EMPrimaryElectronsFromDalitz = EMPrimaryElectronsFromDalitz_001; + // iterators using EMPrimaryElectronFromDalitz = EMPrimaryElectronsFromDalitz::iterator; diff --git a/PWGEM/PhotonMeson/TableProducer/photonconversionbuilder.cxx b/PWGEM/PhotonMeson/TableProducer/photonconversionbuilder.cxx index a3521b5fa4c..0a62a60af1b 100644 --- a/PWGEM/PhotonMeson/TableProducer/photonconversionbuilder.cxx +++ b/PWGEM/PhotonMeson/TableProducer/photonconversionbuilder.cxx @@ -15,43 +15,43 @@ // // \author Daiki Sekihata , Tokyo -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "Math/Vector4D.h" +#include "PWGEM/PhotonMeson/DataModel/gammaTables.h" +#include "PWGEM/PhotonMeson/Utils/PCMUtilities.h" +#include "PWGEM/PhotonMeson/Utils/TrackSelection.h" -#include "Framework/runDataProcessing.h" -#include "Framework/RunningWorkflowInfo.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" -#include "ReconstructionDataFormats/Track.h" #include "Common/Core/RecoDecay.h" -#include "Common/Core/trackUtilities.h" +#include "Common/Core/TPCVDriftManager.h" +#include "Common/Core/TableHelper.h" #include "Common/Core/TrackSelection.h" +#include "Common/Core/trackUtilities.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "DetectorsBase/Propagator.h" -#include "DetectorsBase/GeometryManager.h" -#include "DataFormatsParameters/GRPObject.h" -#include "DataFormatsParameters/GRPMagField.h" +#include "Tools/KFparticle/KFUtilities.h" + #include "CCDB/BasicCCDBManager.h" -#include "Common/Core/TableHelper.h" -#include "Common/Core/TPCVDriftManager.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "DataFormatsParameters/GRPObject.h" +#include "DetectorsBase/GeometryManager.h" +#include "DetectorsBase/Propagator.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/Track.h" -#include "Tools/KFparticle/KFUtilities.h" +#include "Math/Vector4D.h" -#include "PWGEM/PhotonMeson/DataModel/gammaTables.h" -#include "PWGEM/PhotonMeson/Utils/PCMUtilities.h" -#include "PWGEM/PhotonMeson/Utils/TrackSelection.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include using namespace o2; using namespace o2::soa; @@ -66,13 +66,13 @@ using MyCollisionsWithSWT = soa::Join; using MyCollisionsMC = soa::Join; using MyTracksIU = soa::Join; -using MyTracksIUMC = soa::Join; +using MyTracksIUMC = soa::Join; struct PhotonConversionBuilder { Produces v0photonskf; - // Produces v0photonskfcov; Produces v0legs; - Produces events_ngpcm; + // Produces v0photonskfcov; + // Produces events_ngpcm; // CCDB options Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; @@ -337,10 +337,10 @@ struct PhotonConversionBuilder { float px = kfp.GetPx(); float py = kfp.GetPy(); float cospaXY = RecoDecay::dotProd(std::array{lx, ly}, std::array{px, py}) / (RecoDecay::sqrtSumOfSquares(lx, ly) * RecoDecay::sqrtSumOfSquares(px, py)); - if (cospaXY < -1.) { - return -1.; - } else if (cospaXY > 1.) { - return 1.; + if (cospaXY < -1.f) { + return -1.f; + } else if (cospaXY > 1.f) { + return 1.f; } return cospaXY; } @@ -356,24 +356,38 @@ struct PhotonConversionBuilder { float pz = kfp.GetPz(); float cospaRZ = RecoDecay::dotProd(std::array{lt, lz}, std::array{pt, pz}) / (RecoDecay::sqrtSumOfSquares(lt, lz) * RecoDecay::sqrtSumOfSquares(pt, pz)); - if (cospaRZ < -1.) { - return -1.; - } else if (cospaRZ > 1.) { - return 1.; + if (cospaRZ < -1.f) { + return -1.f; + } else if (cospaRZ > 1.f) { + return 1.f; } return cospaRZ; } - template + template void fillTrackTable(TTrack const& track, TShiftedTrack const& shiftedtrack, TKFParticle const& kfp, const float dcaXY, const float dcaZ) { + float itsChi2NCl = (track.hasITS() && track.itsChi2NCl() > 0.f) ? track.itsChi2NCl() : -299.f; + float tpcChi2NCl = (track.hasTPC() && track.tpcChi2NCl() > 0.f) ? track.tpcChi2NCl() : -299.f; + float tpcSignal = track.hasTPC() ? track.tpcSignal() : 0.f; + float tpcNSigmaEl = track.hasTPC() ? track.tpcNSigmaEl() : -299.f; + float tpcNSigmaPi = track.hasTPC() ? track.tpcNSigmaPi() : -299.f; + + float mcTunedTPCSignal = 0.f; + if constexpr (isMC) { + mcTunedTPCSignal = track.mcTunedTPCSignal(); + if (track.hasTPC()) { + mcTunedTPCSignal = track.mcTunedTPCSignal(); + } + } + v0legs(track.collisionId(), track.globalIndex(), track.sign(), - kfp.GetPx(), kfp.GetPy(), kfp.GetPz(), dcaXY, dcaZ, + kfp.GetPx(), kfp.GetPy(), kfp.GetPz(), static_cast(dcaXY * 1e+2), static_cast(dcaZ * 1e+2), track.tpcNClsFindable(), track.tpcNClsFindableMinusFound(), track.tpcNClsFindableMinusCrossedRows(), track.tpcNClsShared(), - track.tpcChi2NCl(), track.tpcInnerParam(), track.tpcSignal(), - track.tpcNSigmaEl(), track.tpcNSigmaPi(), - track.itsClusterSizes(), track.itsChi2NCl(), track.detectorMap(), - shiftedtrack.getX(), shiftedtrack.getY(), shiftedtrack.getZ(), shiftedtrack.getTgl()); + static_cast(tpcChi2NCl * 1e+2), track.tpcInnerParam(), static_cast(tpcSignal * 1e+2), + static_cast(tpcNSigmaEl * 1e+2), static_cast(tpcNSigmaPi * 1e+2), + track.itsClusterSizes(), static_cast(itsChi2NCl * 1e+2), track.detectorMap(), static_cast(mcTunedTPCSignal * 1e+2), + static_cast(shiftedtrack.getX() * 1e+2), static_cast(shiftedtrack.getY() * 1e+2), static_cast(shiftedtrack.getZ() * 1e+2), shiftedtrack.getTgl()); } template @@ -599,6 +613,11 @@ struct PhotonConversionBuilder { return; } + float chi2kf = gammaKF_DecayVtx.GetChi2() / gammaKF_DecayVtx.GetNDF(); + if (chi2kf > 6e+3) { // protection for uint16. + return; + } + // calculate DCAxy,z to PV float v0mom = RecoDecay::sqrtSumOfSquares(gammaKF_DecayVtx.GetPx(), gammaKF_DecayVtx.GetPy(), gammaKF_DecayVtx.GetPz()); float length = RecoDecay::sqrtSumOfSquares(gammaKF_DecayVtx.GetX() - collision.posX(), gammaKF_DecayVtx.GetY() - collision.posY(), gammaKF_DecayVtx.GetZ() - collision.posZ()); @@ -639,8 +658,6 @@ struct PhotonConversionBuilder { registry.fill(HIST("V0/hCosPAXY_Rxy"), rxy, cospaXY_kf); registry.fill(HIST("V0/hCosPARZ_Rxy"), rxy, cospaRZ_kf); - float chi2kf = gammaKF_DecayVtx.GetChi2() / gammaKF_DecayVtx.GetNDF(); - for (auto& leg : {kfp_pos_DecayVtx, kfp_ele_DecayVtx}) { float legpt = RecoDecay::sqrtSumOfSquares(leg.GetPx(), leg.GetPy()); float legeta = RecoDecay::eta(std::array{leg.GetPx(), leg.GetPy(), leg.GetPz()}); @@ -667,13 +684,14 @@ struct PhotonConversionBuilder { v0photonskf(collision.globalIndex(), v0.globalIndex(), v0legs.lastIndex() + 1, v0legs.lastIndex() + 2, gammaKF_DecayVtx.GetX(), gammaKF_DecayVtx.GetY(), gammaKF_DecayVtx.GetZ(), gammaKF_PV.GetPx(), gammaKF_PV.GetPy(), gammaKF_PV.GetPz(), - v0_sv.M(), dca_xy_v0_to_pv, dca_z_v0_to_pv, - cospa_kf, cospaXY_kf, cospaRZ_kf, pca_kf, alpha, qt, chi2kf); + static_cast(v0_sv.M() * 1e+5), static_cast(dca_xy_v0_to_pv * 1e+2), static_cast(dca_z_v0_to_pv * 1e+2), + static_cast(cospa_kf * 5e+4), static_cast(cospaXY_kf * 5e+4), static_cast(cospaRZ_kf * 5e+4), + static_cast(pca_kf * 1e+4), static_cast(alpha * 1e+4), static_cast(qt * 1e+5), static_cast(chi2kf * 1e+1)); // v0photonskfcov(gammaKF_PV.GetCovariance(9), gammaKF_PV.GetCovariance(14), gammaKF_PV.GetCovariance(20), gammaKF_PV.GetCovariance(13), gammaKF_PV.GetCovariance(19), gammaKF_PV.GetCovariance(18)); - fillTrackTable(pos, pTrack, kfp_pos_DecayVtx, posdcaXY, posdcaZ); // positive leg first - fillTrackTable(ele, nTrack, kfp_ele_DecayVtx, eledcaXY, eledcaZ); // negative leg second + fillTrackTable(pos, pTrack, kfp_pos_DecayVtx, posdcaXY, posdcaZ); // positive leg first + fillTrackTable(ele, nTrack, kfp_ele_DecayVtx, eledcaXY, eledcaZ); // negative leg second } // end of fill table } @@ -800,7 +818,7 @@ struct PhotonConversionBuilder { continue; } } - events_ngpcm(nv0_map[collision.globalIndex()]); + // events_ngpcm(nv0_map[collision.globalIndex()]); } // end of collision loop pca_map.clear(); diff --git a/PWGEM/PhotonMeson/TableProducer/skimmerGammaConversion.cxx b/PWGEM/PhotonMeson/TableProducer/skimmerGammaConversion.cxx index 6a39aea8881..90726fb34de 100644 --- a/PWGEM/PhotonMeson/TableProducer/skimmerGammaConversion.cxx +++ b/PWGEM/PhotonMeson/TableProducer/skimmerGammaConversion.cxx @@ -23,38 +23,37 @@ // runme like: o2-analysis-trackselection -b --aod-file ${sourceFile} --aod-writer-json ${writerFile} | o2-analysis-timestamp -b | o2-analysis-trackextension -b | o2-analysis-lf-lambdakzerobuilder -b | o2-analysis-pid-tpc -b | o2-analysis-em-skimmermc -b -#include #include +#include #include #include // todo: remove reduantant information in GammaConversionsInfoTrue #include "PWGEM/PhotonMeson/DataModel/gammaTables.h" -#include "PWGEM/PhotonMeson/Utils/gammaConvDefinitions.h" #include "PWGEM/PhotonMeson/Utils/PCMUtilities.h" +#include "PWGEM/PhotonMeson/Utils/gammaConvDefinitions.h" #include "PWGLF/DataModel/LFStrangenessTables.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" #include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" // includes for the R recalculation -#include "DetectorsBase/Propagator.h" -#include "DetectorsBase/GeometryManager.h" -#include "DataFormatsParameters/GRPObject.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "CCDB/BasicCCDBManager.h" +#include "Common/Core/trackUtilities.h" +#include "Tools/KFparticle/KFUtilities.h" +#include "CCDB/BasicCCDBManager.h" +#include "CommonConstants/PhysicsConstants.h" #include "DCAFitter/HelixHelper.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "DataFormatsParameters/GRPObject.h" +#include "DetectorsBase/GeometryManager.h" +#include "DetectorsBase/Propagator.h" #include "ReconstructionDataFormats/TrackFwd.h" -#include "Common/Core/trackUtilities.h" -#include "CommonConstants/PhysicsConstants.h" +#include "Math/Vector4D.h" #include #include -#include "Math/Vector4D.h" - -#include "Tools/KFparticle/KFUtilities.h" using namespace o2; using namespace o2::framework; @@ -189,7 +188,7 @@ struct skimmerGammaConversion { theTrack.tpcNClsFindable(), theTrack.tpcNClsFindableMinusFound(), theTrack.tpcNClsFindableMinusCrossedRows(), theTrack.tpcNClsShared(), theTrack.tpcChi2NCl(), theTrack.tpcInnerParam(), theTrack.tpcSignal(), theTrack.tpcNSigmaEl(), theTrack.tpcNSigmaPi(), - theTrack.itsClusterSizes(), theTrack.itsChi2NCl(), theTrack.detectorMap(), + theTrack.itsClusterSizes(), theTrack.itsChi2NCl(), theTrack.detectorMap(), 0, theTrack.x(), theTrack.y(), theTrack.z(), theTrack.tgl()); } diff --git a/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryElectronFromDalitzEE.cxx b/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryElectronFromDalitzEE.cxx index b773c43cea6..8ed7db41bef 100644 --- a/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryElectronFromDalitzEE.cxx +++ b/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryElectronFromDalitzEE.cxx @@ -42,14 +42,13 @@ using namespace o2::framework::expressions; using namespace o2::constants::physics; using namespace o2::pwgem::photonmeson; -// using MyCollisions = soa::Join; using MyCollisions = soa::Join; using MyCollisionsWithSWT = soa::Join; using MyCollisionsMC = soa::Join; using MyTracks = soa::Join; using MyTrack = MyTracks::iterator; -using MyTracksMC = soa::Join; +using MyTracksMC = soa::Join; using MyTrackMC = MyTracksMC::iterator; struct skimmerPrimaryElectronFromDalitzEE { @@ -131,6 +130,7 @@ struct skimmerPrimaryElectronFromDalitzEE { fRegistry.add("Track/hTPCNcls2Nf", "TPC Ncls/Nfindable", kTH1F, {{200, 0, 2}}, false); fRegistry.add("Track/hTPCNclsShared", "TPC Ncls shared/Ncls;p_{T} (GeV/c);N_{cls}^{shared}/N_{cls} in TPC", kTH2F, {{1000, 0, 10}, {100, 0, 1}}, false); fRegistry.add("Track/hTPCdEdx", "TPC dE/dx;p_{in} (GeV/c);TPC dE/dx (a.u.)", kTH2F, {{1000, 0, 10}, {200, 0, 200}}, false); + fRegistry.add("Track/hTPCdEdxMC", "TPC dE/dx;p_{in} (GeV/c);TPC dE/dx (a.u.)", kTH2F, {{1000, 0, 10}, {200, 0, 200}}, false); fRegistry.add("Track/hTPCNsigmaEl", "TPC n sigma el;p_{in} (GeV/c);n #sigma_{e}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); fRegistry.add("Track/hTPCNsigmaPi", "TPC n sigma pi;p_{in} (GeV/c);n #sigma_{#pi}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); @@ -209,7 +209,7 @@ struct skimmerPrimaryElectronFromDalitzEE { return false; } - if (track.itsChi2NCl() > maxchi2its) { + if (track.itsChi2NCl() < 0.f || maxchi2its < track.itsChi2NCl()) { return false; } @@ -225,7 +225,7 @@ struct skimmerPrimaryElectronFromDalitzEE { } if (track.hasTPC()) { - if (track.tpcChi2NCl() > maxchi2tpc) { + if (track.tpcChi2NCl() < 0.f || maxchi2tpc < track.tpcChi2NCl()) { return false; } @@ -307,17 +307,37 @@ struct skimmerPrimaryElectronFromDalitzEE { return true; } - template + template void fillTrackTable(TCollision const& collision, TTrack const& track) { if (std::find(stored_trackIds.begin(), stored_trackIds.end(), std::make_pair(collision.globalIndex(), track.globalIndex())) == stored_trackIds.end()) { + float mcTunedTPCSignal = 0.f; + if constexpr (isMC) { + mcTunedTPCSignal = track.mcTunedTPCSignal(); + if (track.hasTPC()) { + mcTunedTPCSignal = track.mcTunedTPCSignal(); + } + } + + float itsChi2NCl = (track.hasITS() && track.itsChi2NCl() > 0.f) ? track.itsChi2NCl() : -299.f; + float tpcChi2NCl = (track.hasTPC() && track.tpcChi2NCl() > 0.f) ? track.tpcChi2NCl() : -299.f; + float beta = track.hasTOF() ? track.beta() : -29.f; + float tofNSigmaEl = track.hasTOF() ? track.tofNSigmaEl() : -299.f; + float tofNSigmaPi = track.hasTOF() ? track.tofNSigmaPi() : -299.f; + float tofChi2 = track.hasTOF() ? track.tofChi2() : -299.f; + + float tpcSignal = track.hasTPC() ? track.tpcSignal() : 0.f; + float tpcNSigmaEl = track.hasTPC() ? track.tpcNSigmaEl() : -299.f; + float tpcNSigmaPi = track.hasTPC() ? track.tpcNSigmaPi() : -299.f; + emprimaryelectrons(collision.globalIndex(), track.globalIndex(), track.sign(), track.pt(), track.eta(), track.phi(), track.dcaXY(), track.dcaZ(), track.cYY(), track.cZY(), track.cZZ(), track.tpcNClsFindable(), track.tpcNClsFindableMinusFound(), track.tpcNClsFindableMinusCrossedRows(), track.tpcNClsShared(), - track.tpcChi2NCl(), track.tpcInnerParam(), - track.tpcSignal(), track.tpcNSigmaEl(), track.tpcNSigmaPi(), - track.beta(), track.tofNSigmaEl(), track.tofNSigmaPi(), - track.itsClusterSizes(), track.itsChi2NCl(), track.tofChi2(), track.detectorMap(), track.tgl()); + + static_cast(tpcChi2NCl * 1e+2), track.tpcInnerParam(), + static_cast(tpcSignal * 1e+2), static_cast(tpcNSigmaEl * 1e+2), static_cast(tpcNSigmaPi * 1e+2), + static_cast(beta * 1e+3), static_cast(tofNSigmaEl * 1e+2), static_cast(tofNSigmaPi * 1e+2), + track.itsClusterSizes(), static_cast(itsChi2NCl * 1e+2), static_cast(tofChi2 * 1e+2), track.detectorMap(), track.tgl(), static_cast(mcTunedTPCSignal * 1e+2)); fRegistry.fill(HIST("Track/hPt"), track.pt()); fRegistry.fill(HIST("Track/hEtaPhi"), track.phi(), track.eta()); @@ -337,6 +357,7 @@ struct skimmerPrimaryElectronFromDalitzEE { fRegistry.fill(HIST("Track/hTPCNcls2Nf"), track.tpcFoundOverFindableCls()); fRegistry.fill(HIST("Track/hTPCNclsShared"), track.pt(), track.tpcFractionSharedCls()); fRegistry.fill(HIST("Track/hTPCdEdx"), track.tpcInnerParam(), track.tpcSignal()); + fRegistry.fill(HIST("Track/hTPCdEdxMC"), track.tpcInnerParam(), mcTunedTPCSignal); fRegistry.fill(HIST("Track/hTPCNsigmaEl"), track.tpcInnerParam(), track.tpcNSigmaEl()); fRegistry.fill(HIST("Track/hTPCNsigmaPi"), track.tpcInnerParam(), track.tpcNSigmaPi()); @@ -405,8 +426,8 @@ struct skimmerPrimaryElectronFromDalitzEE { if (v12.M() > maxMee) { // don't store continue; } - fillTrackTable(collision, t1); - fillTrackTable(collision, t2); + fillTrackTable(collision, t1); + fillTrackTable(collision, t2); } // end of pairing } else { // LS for (auto& [t1, t2] : combinations(CombinationsStrictlyUpperIndexPolicy(tracks1, tracks2))) { @@ -445,10 +466,6 @@ struct skimmerPrimaryElectronFromDalitzEE { continue; } - // if (collision.ngpcm() < 1) { - // continue; - // } - auto posTracks_per_coll = posTracks->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache); auto negTracks_per_coll = negTracks->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache); @@ -475,10 +492,6 @@ struct skimmerPrimaryElectronFromDalitzEE { continue; } - // if (collision.ngpcm() < 1) { - // continue; - // } - if (collision.swtaliastmp_raw() == 0) { continue; } @@ -516,10 +529,6 @@ struct skimmerPrimaryElectronFromDalitzEE { auto bc = collision.template foundBC_as(); initCCDB(bc); - // if (collision.ngpcm() < 1) { - // continue; - // } - auto posTracks_per_coll = posTracksMC->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache); auto negTracks_per_coll = negTracksMC->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache); diff --git a/PWGEM/PhotonMeson/Tasks/CMakeLists.txt b/PWGEM/PhotonMeson/Tasks/CMakeLists.txt index e839592246a..e022256a5b6 100644 --- a/PWGEM/PhotonMeson/Tasks/CMakeLists.txt +++ b/PWGEM/PhotonMeson/Tasks/CMakeLists.txt @@ -9,6 +9,8 @@ # granted to it by virtue of its status as an Intergovernmental Organization # or submit itself to any jurisdiction. +add_subdirectory(Converters) + o2physics_add_dpl_workflow(gammaconversions SOURCES gammaConversions.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2Physics::AnalysisCore diff --git a/PWGEM/PhotonMeson/Tasks/Converters/CMakeLists.txt b/PWGEM/PhotonMeson/Tasks/Converters/CMakeLists.txt new file mode 100644 index 00000000000..89aceb70f98 --- /dev/null +++ b/PWGEM/PhotonMeson/Tasks/Converters/CMakeLists.txt @@ -0,0 +1,20 @@ +# Copyright 2019-2020 CERN and copyright holders of ALICE O2. +# See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +# All rights not expressly granted are reserved. +# +# This software is distributed under the terms of the GNU General Public +# License v3 (GPL Version 3), copied verbatim in the file "COPYING". +# +# In applying this license CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization +# or submit itself to any jurisdiction. + +o2physics_add_dpl_workflow(pcm-converter1 + SOURCES pcmConverter1.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(electron-from-dalitz-converter1 + SOURCES electronFromDalitzConverter1.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) diff --git a/PWGEM/PhotonMeson/Tasks/Converters/electronFromDalitzConverter1.cxx b/PWGEM/PhotonMeson/Tasks/Converters/electronFromDalitzConverter1.cxx new file mode 100644 index 00000000000..629fab67530 --- /dev/null +++ b/PWGEM/PhotonMeson/Tasks/Converters/electronFromDalitzConverter1.cxx @@ -0,0 +1,84 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// +// ======================== +// +// This code runs loop over ULS ee pars for virtual photon QC. +// Please write to: daiki.sekihata@cern.ch + +#include "PWGEM/PhotonMeson/DataModel/gammaTables.h" + +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" + +using namespace o2; +using namespace o2::aod; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::soa; + +struct electronFromDalitzConverter1 { + Produces electron_001; + + void process(aod::EMPrimaryElectronsFromDalitz_000 const& tracks) + { + for (const auto& track : tracks) { + float itsChi2NCl = track.itsChi2NCl() > 0.f ? track.itsChi2NCl() : -299.f; + float tpcChi2NCl = track.tpcChi2NCl() > 0.f ? track.tpcChi2NCl() : -299.f; + float beta = track.hasTOF() ? track.beta() : -29.f; + float tofNSigmaEl = track.hasTOF() ? track.tofNSigmaEl() : -299.f; + float tofNSigmaPi = track.hasTOF() ? track.tofNSigmaPi() : -299.f; + float tofChi2 = track.hasTOF() ? track.tofChi2() : -299.f; + + float tpcSignal = track.hasTPC() ? track.tpcSignal() : 0.f; + float tpcNSigmaEl = track.hasTPC() ? track.tpcNSigmaEl() : -299.f; + float tpcNSigmaPi = track.hasTPC() ? track.tpcNSigmaPi() : -299.f; + + electron_001(track.collisionId(), + track.trackId(), + track.sign(), + track.pt(), + track.eta(), + track.phi(), + track.dcaXY(), + track.dcaZ(), + track.cYY(), + track.cZY(), + track.cZZ(), + track.tpcNClsFindable(), + track.tpcNClsFindableMinusFound(), + track.tpcNClsFindableMinusCrossedRows(), + track.tpcNClsShared(), + + static_cast(tpcChi2NCl * 1e+2), + track.tpcInnerParam(), + static_cast(tpcSignal * 1e+2), + static_cast(tpcNSigmaEl * 1e+2), + static_cast(tpcNSigmaPi * 1e+2), + static_cast(beta * 1e+3), + static_cast(tofNSigmaEl * 1e+2), + static_cast(tofNSigmaPi * 1e+2), + track.itsClusterSizes(), + static_cast(itsChi2NCl * 1e+2), + static_cast(tofChi2 * 1e+2), + track.detectorMap(), + track.tgl(), + 0); + + } // end of track loop + } // end of process +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc, TaskName{"electronFromDalitz-converter1"})}; +} diff --git a/PWGEM/PhotonMeson/Tasks/Converters/pcmConverter1.cxx b/PWGEM/PhotonMeson/Tasks/Converters/pcmConverter1.cxx new file mode 100644 index 00000000000..e9d7af43acd --- /dev/null +++ b/PWGEM/PhotonMeson/Tasks/Converters/pcmConverter1.cxx @@ -0,0 +1,100 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// +// ======================== +// +// This code runs loop over ULS ee pars for virtual photon QC. +// Please write to: daiki.sekihata@cern.ch + +#include "PWGEM/PhotonMeson/DataModel/gammaTables.h" + +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" + +using namespace o2; +using namespace o2::aod; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::soa; + +struct pcmConverter1 { + Produces v0photon_001; + Produces v0leg_001; + + void process(aod::V0PhotonsKF_000 const& v0s, aod::V0Legs_000 const& v0legs) + { + for (auto& v0 : v0s) { + v0photon_001( + v0.collisionId(), + v0.v0Id(), + v0.posTrackId(), + v0.negTrackId(), + v0.vx(), + v0.vy(), + v0.vz(), + v0.px(), + v0.py(), + v0.pz(), + static_cast(v0.mGamma() * 1e+5), + static_cast(v0.dcaXYtopv() * 1e+2), + static_cast(v0.dcaZtopv() * 1e+2), + static_cast(v0.cospa() * 1e+4), + static_cast(v0.cospaXY() * 1e+4), + static_cast(v0.cospaRZ() * 1e+4), + static_cast(v0.pca() * 1e+4), + static_cast(v0.alpha() * 1e+4), + static_cast(v0.qtarm() * 1e+5), + static_cast(v0.chiSquareNDF() * 1e+2)); + } // end of v0 loop + + for (auto& v0leg : v0legs) { + + float itsChi2NCl = (v0leg.hasITS() && v0leg.itsChi2NCl() > 0.f) ? v0leg.itsChi2NCl() : -299.f; + float tpcChi2NCl = (v0leg.hasTPC() && v0leg.tpcChi2NCl() > 0.f) ? v0leg.tpcChi2NCl() : -299.f; + float tpcSignal = v0leg.hasTPC() ? v0leg.tpcSignal() : 0.f; + float tpcNSigmaEl = v0leg.hasTPC() ? v0leg.tpcNSigmaEl() : -299.f; + float tpcNSigmaPi = v0leg.hasTPC() ? v0leg.tpcNSigmaPi() : -299.f; + + v0leg_001( + v0leg.collisionId(), + v0leg.trackId(), + v0leg.sign(), + v0leg.px(), + v0leg.py(), + v0leg.pz(), + static_cast(v0leg.dcaXY() * 1e+2), + static_cast(v0leg.dcaZ() * 1e+2), + v0leg.tpcNClsFindable(), + v0leg.tpcNClsFindableMinusFound(), + v0leg.tpcNClsFindableMinusCrossedRows(), + v0leg.tpcNClsShared(), + static_cast(tpcChi2NCl * 1e+2), + v0leg.tpcInnerParam(), + static_cast(tpcSignal * 1e+2), + static_cast(tpcNSigmaEl * 1e+2), + static_cast(tpcNSigmaPi * 1e+2), + v0leg.itsClusterSizes(), + static_cast(itsChi2NCl * 1e+2), + v0leg.detectorMap(), + static_cast(0), + static_cast(v0leg.x() * 1e+2), + static_cast(v0leg.y() * 1e+2), + static_cast(v0leg.z() * 1e+2), + v0leg.tgl()); + } // end of v0leg loop + } // end of process +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc, TaskName{"pcm-converter1"})}; +} diff --git a/PWGEM/PhotonMeson/Tasks/pcmQC.cxx b/PWGEM/PhotonMeson/Tasks/pcmQC.cxx index 077a1be9f7d..eaba34cec81 100644 --- a/PWGEM/PhotonMeson/Tasks/pcmQC.cxx +++ b/PWGEM/PhotonMeson/Tasks/pcmQC.cxx @@ -14,18 +14,18 @@ // This code runs loop over v0 photons for PCM QC. // Please write to: daiki.sekihata@cern.ch -#include -#include +#include "PWGEM/PhotonMeson/Core/EMPhotonEventCut.h" +#include "PWGEM/PhotonMeson/Core/V0PhotonCut.h" +#include "PWGEM/PhotonMeson/DataModel/gammaTables.h" +#include "PWGEM/PhotonMeson/Utils/PCMUtilities.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" #include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" -#include "PWGEM/PhotonMeson/Utils/PCMUtilities.h" -#include "PWGEM/PhotonMeson/DataModel/gammaTables.h" -#include "PWGEM/PhotonMeson/Core/V0PhotonCut.h" -#include "PWGEM/PhotonMeson/Core/EMPhotonEventCut.h" +#include +#include using namespace o2; using namespace o2::aod; @@ -81,16 +81,16 @@ struct PCMQC { Configurable cfg_max_v0radius{"cfg_max_v0radius", 90.0, "max v0 radius"}; Configurable cfg_max_alpha_ap{"cfg_max_alpha_ap", 0.95, "max alpha for AP cut"}; Configurable cfg_max_qt_ap{"cfg_max_qt_ap", 0.01, "max qT for AP cut"}; - Configurable cfg_min_cospa{"cfg_min_cospa", 0.997, "min V0 CosPA"}; - Configurable cfg_max_pca{"cfg_max_pca", 3.0, "max distance btween 2 legs"}; + Configurable cfg_min_cospa{"cfg_min_cospa", 0.999, "min V0 CosPA"}; + Configurable cfg_max_pca{"cfg_max_pca", 1.5, "max distance btween 2 legs"}; Configurable cfg_max_chi2kf{"cfg_max_chi2kf", 1e+10, "max chi2/ndf with KF"}; - Configurable cfg_require_v0_with_correct_xz{"cfg_require_v0_with_correct_xz", true, "flag to select V0s with correct xz"}; + Configurable cfg_require_v0_with_correct_xz{"cfg_require_v0_with_correct_xz", false, "flag to select V0s with correct xz"}; Configurable cfg_reject_v0_on_itsib{"cfg_reject_v0_on_itsib", true, "flag to reject V0s on ITSib"}; Configurable cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 0, "min ncluster tpc"}; Configurable cfg_min_ncrossedrows{"cfg_min_ncrossedrows", 40, "min ncrossed rows"}; Configurable cfg_max_frac_shared_clusters_tpc{"cfg_max_frac_shared_clusters_tpc", 999.f, "max fraction of shared clusters in TPC"}; Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; - Configurable cfg_max_chi2its{"cfg_max_chi2its", 5.0, "max chi2/NclsITS"}; + Configurable cfg_max_chi2its{"cfg_max_chi2its", 36.0, "max chi2/NclsITS"}; Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -3.0, "min. TPC n sigma for electron"}; Configurable cfg_max_TPCNsigmaEl{"cfg_max_TPCNsigmaEl", +3.0, "max. TPC n sigma for electron"}; Configurable cfg_disable_itsonly_track{"cfg_disable_itsonly_track", false, "flag to disable ITSonly tracks"}; diff --git a/PWGEM/PhotonMeson/Tasks/pcmQCMC.cxx b/PWGEM/PhotonMeson/Tasks/pcmQCMC.cxx index 0587fe75138..d2ea5619072 100644 --- a/PWGEM/PhotonMeson/Tasks/pcmQCMC.cxx +++ b/PWGEM/PhotonMeson/Tasks/pcmQCMC.cxx @@ -14,20 +14,20 @@ // This code runs loop over v0 photons for PCM QC. // Please write to: daiki.sekihata@cern.ch -#include -#include +#include "PWGEM/Dilepton/Utils/MCUtilities.h" +#include "PWGEM/PhotonMeson/Core/EMPhotonEventCut.h" +#include "PWGEM/PhotonMeson/Core/V0PhotonCut.h" +#include "PWGEM/PhotonMeson/DataModel/gammaTables.h" +#include "PWGEM/PhotonMeson/Utils/MCUtilities.h" +#include "PWGEM/PhotonMeson/Utils/PCMUtilities.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" #include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" -#include "PWGEM/PhotonMeson/DataModel/gammaTables.h" -#include "PWGEM/PhotonMeson/Utils/PCMUtilities.h" -#include "PWGEM/PhotonMeson/Utils/MCUtilities.h" -#include "PWGEM/Dilepton/Utils/MCUtilities.h" -#include "PWGEM/PhotonMeson/Core/V0PhotonCut.h" -#include "PWGEM/PhotonMeson/Core/EMPhotonEventCut.h" +#include +#include using namespace o2; using namespace o2::aod; @@ -97,16 +97,16 @@ struct PCMQCMC { Configurable cfg_max_v0radius{"cfg_max_v0radius", 90.0, "max v0 radius"}; Configurable cfg_max_alpha_ap{"cfg_max_alpha_ap", 0.95, "max alpha for AP cut"}; Configurable cfg_max_qt_ap{"cfg_max_qt_ap", 0.01, "max qT for AP cut"}; - Configurable cfg_min_cospa{"cfg_min_cospa", 0.997, "min V0 CosPA"}; + Configurable cfg_min_cospa{"cfg_min_cospa", 0.999, "min V0 CosPA"}; Configurable cfg_max_pca{"cfg_max_pca", 3.0, "max distance btween 2 legs"}; Configurable cfg_max_chi2kf{"cfg_max_chi2kf", 1e+10, "max chi2/ndf with KF"}; - Configurable cfg_require_v0_with_correct_xz{"cfg_require_v0_with_correct_xz", true, "flag to select V0s with correct xz"}; + Configurable cfg_require_v0_with_correct_xz{"cfg_require_v0_with_correct_xz", false, "flag to select V0s with correct xz"}; Configurable cfg_reject_v0_on_itsib{"cfg_reject_v0_on_itsib", true, "flag to reject V0s on ITSib"}; Configurable cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 0, "min ncluster tpc"}; Configurable cfg_min_ncrossedrows{"cfg_min_ncrossedrows", 40, "min ncrossed rows"}; Configurable cfg_max_frac_shared_clusters_tpc{"cfg_max_frac_shared_clusters_tpc", 999.f, "max fraction of shared clusters in TPC"}; Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; - Configurable cfg_max_chi2its{"cfg_max_chi2its", 5.0, "max chi2/NclsITS"}; + Configurable cfg_max_chi2its{"cfg_max_chi2its", 36.0, "max chi2/NclsITS"}; Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -3.0, "min. TPC n sigma for electron"}; Configurable cfg_max_TPCNsigmaEl{"cfg_max_TPCNsigmaEl", +3.0, "max. TPC n sigma for electron"}; Configurable cfg_disable_itsonly_track{"cfg_disable_itsonly_track", false, "flag to disable ITSonly tracks"}; From d0f79f75cd556a325e2c0c9e5dfdeddbbea4d99b Mon Sep 17 00:00:00 2001 From: arvindkhuntia <31609955+arvindkhuntia@users.noreply.github.com> Date: Fri, 1 Aug 2025 13:57:41 +0530 Subject: [PATCH 176/345] [PWGJE] Replace TMath methods with O2 ones (#12353) Co-authored-by: Arvind Khuntia --- PWGJE/Tasks/nucleiInJets.cxx | 172 +++++++++++++++++------------------ 1 file changed, 82 insertions(+), 90 deletions(-) diff --git a/PWGJE/Tasks/nucleiInJets.cxx b/PWGJE/Tasks/nucleiInJets.cxx index dc0ee16b9de..e02381a61fe 100644 --- a/PWGJE/Tasks/nucleiInJets.cxx +++ b/PWGJE/Tasks/nucleiInJets.cxx @@ -170,15 +170,6 @@ struct nucleiInJets { Configurable applySkim{"applySkim", false, "Apply skimming"}; Configurable cfgSkim{"cfgSkim", "fHighFt0Mult", "Configurable for skimming"}; - static constexpr float gMassProton = 0.93827208f; - static constexpr float gMassDeuteron = 1.87561f; - static constexpr float gMassTriton = 2.80892f; - static constexpr float gMassHelium = 2.80839f; - static constexpr int PDGProton = 2212; - static constexpr int PDGDeuteron = 1000010020; - static constexpr int PDGTriton = 1000010030; - static constexpr int PDGHelium = 1000020030; - // using EventTable = soa::Join; using EventTable = aod::JetCollisions; using EventTableMC = soa::Join; @@ -225,6 +216,7 @@ struct nucleiInJets { const AxisSpec dcaxyAxis{binsDCA, "DCAxy (cm)"}; const AxisSpec dcazAxis{binsDCA, "DCAz (cm)"}; const AxisSpec dedxAxis{binsdEdx, "d#it{E}/d#it{x} A.U."}; + const AxisSpec vzAxis{{300, -15.f, 15.f}, "Vz (cm)"}; const AxisSpec betaAxis{binsBeta, "TOF #beta"}; const AxisSpec ptZHeAxis{binsPtZHe, "#it{p}_{T}"}; @@ -246,7 +238,7 @@ struct nucleiInJets { jetHist.get(HIST("hNEventsInc"))->GetXaxis()->SetBinLabel(2, "Sel8"); jetHist.get(HIST("hNEventsInc"))->GetXaxis()->SetBinLabel(3, "|Vz|<10"); - jetHist.add("hNEventsIncVsCent", "hNEventsIncVsCent", {HistType::kTH2D, {{4, 0.f, 4.f}, {CentAxis}}}); + jetHist.add("hNEventsIncVsCent", "hNEventsIncVsCent", {HistType::kTH2D, {{vzAxis}, {CentAxis}}}); // TPC nSigma vs pT (inclusive) jetHist.add("tracksInc/proton/h3PtVsProtonNSigmaTPCVsPt", "pT(p) vs NSigmaTPC (p) vs centrality; #it{p}_{T} (GeV/#it{c}); NSigmaTPC; centrality", HistType::kTH3F, {PtAxis, {200, -10, 10}, CentAxis}); @@ -262,9 +254,9 @@ struct nucleiInJets { jetHist.add("jet/nJetsPerEvent", "nJetsPerEvent", kTH1F, {{15, .0, 15.}}); jetHist.add("mcpJet/nJetsPerEvent", "nJetsPerEvent", kTH1F, {{15, .0, 15.}}); jetHist.add("mcdJet/nJetsPerEvent", "nJetsPerEvent", kTH1F, {{15, .0, 15.}}); - jetHist.add("jet/vertexZ", "vertexZ (Jet flag)", kTH1F, {{100, -15.0, 15.0}}); - jetHist.add("vertexZ", "vertexZ (all)", kTH1F, {{100, -15.0, 15.0}}); - jetHist.add("jetOut/vertexZ", "vertexZ (without z-flag)", kTH1F, {{100, -15.0, 15.0}}); + jetHist.add("jet/vertexZ", "vertexZ (Jet flag)", kTH1F, {{vzAxis}}); + jetHist.add("vertexZ", "vertexZ (all)", kTH1F, {{vzAxis}}); + jetHist.add("jetOut/vertexZ", "vertexZ (without z-flag)", kTH1F, {{vzAxis}}); //////////////////////////// // MC //////////////////////////// @@ -275,8 +267,8 @@ struct nucleiInJets { h->GetXaxis()->SetBinLabel(3, "vz < 10"); h->GetXaxis()->SetBinLabel(4, "ingt0"); - jetHist.add("mcpJet/vertexZ", "vertexZ (All)", kTH1F, {{100, -15.0, 15.0}}); - jetHist.add("mcdJet/vertexZ", "vertexZ (All)", kTH1F, {{100, -15.0, 15.0}}); + jetHist.add("mcpJet/vertexZ", "vertexZ (All)", kTH1F, {{vzAxis}}); + jetHist.add("mcdJet/vertexZ", "vertexZ (All)", kTH1F, {{vzAxis}}); jetHist.add("mcdJet/eventStat", "vertexZ (All)", kTH1F, {{5, .0, 5.0}}); auto h1 = jetHist.get(HIST("mcdJet/eventStat")); h1->GetXaxis()->SetBinLabel(1, "All"); @@ -284,8 +276,8 @@ struct nucleiInJets { h1->GetXaxis()->SetBinLabel(3, "vz< 10"); h1->GetXaxis()->SetBinLabel(4, "ingt0"); - jetHist.add("recmatched/vertexZ", "vertexZ (All)", kTH1F, {{100, -15.0, 15.0}}); - jetHist.add("genmatched/vertexZ", "vertexZ (All)", kTH1F, {{100, -15.0, 15.0}}); + jetHist.add("recmatched/vertexZ", "vertexZ (All)", kTH1F, {{vzAxis}}); + jetHist.add("genmatched/vertexZ", "vertexZ (All)", kTH1F, {{vzAxis}}); ////////////////////////////////////////////// // inside jet @@ -497,7 +489,7 @@ struct nucleiInJets { jetHist.get(HIST("recInc/eventStat"))->GetXaxis()->SetBinLabel(2, "Sel8"); jetHist.get(HIST("recInc/eventStat"))->GetXaxis()->SetBinLabel(3, "|Vz|<10"); - jetHist.add("recInc/vertexZ", "vertexZ (inclusive)", HistType::kTH2F, {{100, -15.0, 15.0}, {CentAxis}}); + jetHist.add("recInc/vertexZ", "vertexZ (inclusive)", HistType::kTH2F, {{vzAxis}, {CentAxis}}); jetHist.add("recInc/pt/PtParticleTypeTPC", "Pt vs ParticleType vs Centrality (TPC)", HistType::kTH3F, {{100, 0.f, 10.f}, {14, -7, 7}, {100, 0, 100}}); jetHist.add("recInc/pt/PtParticleTypeTPCTOF", "Pt vs ParticleType vs Centrality (TPC+TOF)", HistType::kTH3F, {{100, 0.f, 10.f}, {14, -7, 7}, {100, 0, 100}}); jetHist.add("recInc/pt/PtParticleTypeTPCTOFVeto", "Pt vs ParticleType vs Centrality (TPC+TOF Veto)", HistType::kTH3F, {{100, 0.f, 10.f}, {14, -7, 7}, {100, 0, 100}}); @@ -645,8 +637,8 @@ struct nucleiInJets { { std::array PerpendicularConeAxisPhi = {-999.0f, -999.0f}; // build 2 perp cones in phi around the leading jet (right and left of the jet) - PerpendicularConeAxisPhi[0] = RecoDecay::constrainAngle(jetPhi + (M_PI / 2.)); // This will contrain the angel between 0-2Pi - PerpendicularConeAxisPhi[1] = RecoDecay::constrainAngle(jetPhi - (M_PI / 2.)); // This will contrain the angel between 0-2Pi + PerpendicularConeAxisPhi[0] = RecoDecay::constrainAngle(jetPhi + (o2::constants::math::PIHalf)); // This will contrain the angel between 0-2Pi + PerpendicularConeAxisPhi[1] = RecoDecay::constrainAngle(jetPhi - (o2::constants::math::PIHalf)); // This will contrain the angel between 0-2Pi return PerpendicularConeAxisPhi; } @@ -713,7 +705,7 @@ struct nucleiInJets { if (isWithLeadingJet) { double delPhi = TVector2::Phi_mpi_pi(leadingJetPtEtaPhi[2] - trk.phi()); double delEta = leadingJetPtEtaPhi[1] - trk.eta(); - double R = TMath::Sqrt((delEta * delEta) + (delPhi * delPhi)); + double R = RecoDecay::sumOfSquares(delEta, delPhi); if (R < cfgjetR) jetFlag = true; jetPt = leadingJetPtEtaPhi[0]; @@ -721,15 +713,15 @@ struct nucleiInJets { std::array perpConePhiJet = getPerpendicuarPhi(leadingJetPtEtaPhi[2]); double delPhiPerpCone1 = TVector2::Phi_mpi_pi(perpConePhiJet[0] - trk.phi()); double delPhiPerpCone2 = TVector2::Phi_mpi_pi(perpConePhiJet[1] - trk.phi()); - double RPerpCone1 = TMath::Sqrt((delEta * delEta) + (delPhiPerpCone1 * delPhiPerpCone1)); - double RPerpCone2 = TMath::Sqrt((delEta * delEta) + (delPhiPerpCone2 * delPhiPerpCone2)); + double RPerpCone1 = RecoDecay::sumOfSquares(delEta, delPhiPerpCone1); + double RPerpCone2 = RecoDecay::sumOfSquares(delEta, delPhiPerpCone2); if (RPerpCone1 < cfgjetR || RPerpCone2 < cfgjetR) jetFlagPerpCone = true; } else { for (auto const& jet : jets) { double delPhi = TVector2::Phi_mpi_pi(jet.phi() - trk.phi()); double delEta = jet.eta() - trk.eta(); - double R = TMath::Sqrt((delEta * delEta) + (delPhi * delPhi)); + double R = RecoDecay::sumOfSquares(delEta, delPhi); if (R < cfgjetR) jetFlag = true; jetPt = jet.pt(); @@ -739,7 +731,7 @@ struct nucleiInJets { // tof float massTOF = -999; if (trk.hasTOF()) { - massTOF = trk.p() * TMath::Sqrt(1.f / (trk.beta() * trk.beta()) - 1.f); + massTOF = trk.p() * std::sqrt(1.f / (trk.beta() * trk.beta()) - 1.f); } if (addTOFplots && trk.hasTOF()) { @@ -821,13 +813,13 @@ struct nucleiInJets { if (addTOFplots && trk.hasTOF()) { if (!useTPCpreSel) { jetHist.fill(HIST("tracks/proton/h2TOFmassProtonVsPt_jet"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/proton/h2TOFmass2ProtonVsPt_jet"), massTOF * massTOF - gMassProton * gMassProton, trk.pt()); + jetHist.fill(HIST("tracks/proton/h2TOFmass2ProtonVsPt_jet"), massTOF * massTOF - o2::constants::physics::MassProton * o2::constants::physics::MassProton, trk.pt()); jetHist.fill(HIST("tracks/deuteron/h2TOFmassDeuteronVsPt_jet"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/deuteron/h2TOFmass2DeuteronVsPt_jet"), massTOF * massTOF - gMassDeuteron * gMassDeuteron, trk.pt()); + jetHist.fill(HIST("tracks/deuteron/h2TOFmass2DeuteronVsPt_jet"), massTOF * massTOF - o2::constants::physics::MassDeuteron * o2::constants::physics::MassDeuteron, trk.pt()); jetHist.fill(HIST("tracks/triton/h2TOFmassTritonVsPt_jet"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/triton/h2TOFmass2TritonVsPt_jet"), massTOF * massTOF - gMassTriton * gMassTriton, trk.pt()); + jetHist.fill(HIST("tracks/triton/h2TOFmass2TritonVsPt_jet"), massTOF * massTOF - o2::constants::physics::MassTriton * o2::constants::physics::MassTriton, trk.pt()); jetHist.fill(HIST("tracks/helium/h2TOFmassHeliumVsPt_jet"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/helium/h2TOFmass2HeliumVsPt_jet"), massTOF * massTOF - gMassHelium * gMassHelium, trk.pt()); + jetHist.fill(HIST("tracks/helium/h2TOFmass2HeliumVsPt_jet"), massTOF * massTOF - o2::constants::physics::MassHelium3 * o2::constants::physics::MassHelium3, trk.pt()); jetHist.fill(HIST("tracks/proton/h2TofNsigmaProtonVsPt_jet"), trk.tofNSigmaPr(), trk.pt()); jetHist.fill(HIST("tracks/deuteron/h2TofNsigmaDeuteronVsPt_jet"), trk.tofNSigmaDe(), trk.pt()); jetHist.fill(HIST("tracks/helium/h2TofNsigmaHeliumVsPt_jet"), trk.tofNSigmaHe(), trk.pt()); @@ -837,24 +829,24 @@ struct nucleiInJets { } else { if (std::abs(trk.tpcNSigmaPr()) < cfgnTPCPIDPr) { jetHist.fill(HIST("tracks/proton/h2TOFmassProtonVsPt_jet"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/proton/h2TOFmass2ProtonVsPt_jet"), massTOF * massTOF - gMassProton * gMassProton, trk.pt()); + jetHist.fill(HIST("tracks/proton/h2TOFmass2ProtonVsPt_jet"), massTOF * massTOF - o2::constants::physics::MassProton * o2::constants::physics::MassProton, trk.pt()); jetHist.fill(HIST("tracks/proton/h2TofNsigmaProtonVsPt_jet"), trk.tofNSigmaPr(), trk.pt()); jetHist.fill(HIST("tracks/proton/h3TpcNsigmaTofNsigmaProtonVsPt_jet"), trk.tpcNSigmaPr(), trk.tofNSigmaPr(), trk.pt()); } if (std::abs(trk.tpcNSigmaDe()) < cfgnTPCPIDDe) { jetHist.fill(HIST("tracks/deuteron/h2TOFmassDeuteronVsPt_jet"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/deuteron/h2TOFmass2DeuteronVsPt_jet"), massTOF * massTOF - gMassDeuteron * gMassDeuteron, trk.pt()); + jetHist.fill(HIST("tracks/deuteron/h2TOFmass2DeuteronVsPt_jet"), massTOF * massTOF - o2::constants::physics::MassDeuteron * o2::constants::physics::MassDeuteron, trk.pt()); jetHist.fill(HIST("tracks/deuteron/h2TofNsigmaDeuteronVsPt_jet"), trk.tofNSigmaDe(), trk.pt()); jetHist.fill(HIST("tracks/deuteron/h3TpcNsigmaTofNsigmaDeuteronVsPt_jet"), trk.tpcNSigmaDe(), trk.tofNSigmaDe(), trk.pt()); } if (std::abs(trk.tpcNSigmaTr()) < cfgnTPCPIDTr) { jetHist.fill(HIST("tracks/triton/h2TOFmassTritonVsPt_jet"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/triton/h2TOFmass2TritonVsPt_jet"), massTOF * massTOF - gMassTriton * gMassTriton, trk.pt()); + jetHist.fill(HIST("tracks/triton/h2TOFmass2TritonVsPt_jet"), massTOF * massTOF - o2::constants::physics::MassTriton * o2::constants::physics::MassTriton, trk.pt()); jetHist.fill(HIST("tracks/triton/h2TofNsigmaTritonVsPt_jet"), trk.tofNSigmaTr(), trk.pt()); } if (std::abs(trk.tpcNSigmaHe()) < cfgnTPCPIDHe) { jetHist.fill(HIST("tracks/helium/h2TOFmassHeliumVsPt_jet"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/helium/h2TOFmass2HeliumVsPt_jet"), massTOF * massTOF - gMassHelium * gMassHelium, trk.pt()); + jetHist.fill(HIST("tracks/helium/h2TOFmass2HeliumVsPt_jet"), massTOF * massTOF - o2::constants::physics::MassHelium3 * o2::constants::physics::MassHelium3, trk.pt()); jetHist.fill(HIST("tracks/helium/h2TofNsigmaHeliumVsPt_jet"), trk.tofNSigmaHe(), trk.pt()); } } @@ -937,43 +929,43 @@ struct nucleiInJets { if (addTOFplots && trk.hasTOF()) { if (!useTPCpreSel) { jetHist.fill(HIST("tracks/antiProton/h2TOFmassantiProtonVsPt_jet"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/antiProton/h2TOFmass2antiProtonVsPt_jet"), massTOF * massTOF - gMassProton * gMassProton, trk.pt()); + jetHist.fill(HIST("tracks/antiProton/h2TOFmass2antiProtonVsPt_jet"), massTOF * massTOF - o2::constants::physics::MassProton * o2::constants::physics::MassProton, trk.pt()); jetHist.fill(HIST("tracks/antiProton/h2TofNsigmaantiProtonVsPt_jet"), trk.tofNSigmaPr(), trk.pt()); jetHist.fill(HIST("tracks/antiProton/h3TpcNsigmaTofNsigmaantiProtonVsPt_jet"), trk.tpcNSigmaPr(), trk.tofNSigmaPr(), trk.pt()); jetHist.fill(HIST("tracks/antiDeuteron/h2TOFmassantiDeuteronVsPt_jet"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/antiDeuteron/h2TOFmass2antiDeuteronVsPt_jet"), massTOF * massTOF - gMassDeuteron * gMassDeuteron, trk.pt()); + jetHist.fill(HIST("tracks/antiDeuteron/h2TOFmass2antiDeuteronVsPt_jet"), massTOF * massTOF - o2::constants::physics::MassDeuteron * o2::constants::physics::MassDeuteron, trk.pt()); jetHist.fill(HIST("tracks/antiDeuteron/h2TofNsigmaantiDeuteronVsPt_jet"), trk.tofNSigmaDe(), trk.pt()); jetHist.fill(HIST("tracks/antiDeuteron/h3TpcNsigmaTofNsigmaantiDeuteronVsPt_jet"), trk.tpcNSigmaDe(), trk.tofNSigmaDe(), trk.pt()); jetHist.fill(HIST("tracks/antiTriton/h2TOFmassantiTritonVsPt_jet"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/antiTriton/h2TOFmass2antiTritonVsPt_jet"), massTOF * massTOF - gMassTriton * gMassTriton, trk.pt()); + jetHist.fill(HIST("tracks/antiTriton/h2TOFmass2antiTritonVsPt_jet"), massTOF * massTOF - o2::constants::physics::MassTriton * o2::constants::physics::MassTriton, trk.pt()); jetHist.fill(HIST("tracks/antiTriton/h2TofNsigmaantiTritonVsPt_jet"), trk.tofNSigmaTr(), trk.pt()); jetHist.fill(HIST("tracks/antiHelium/h2TOFmassantiHeliumVsPt_jet"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/antiHelium/h2TOFmass2antiHeliumVsPt_jet"), massTOF * massTOF - gMassHelium * gMassHelium, trk.pt()); + jetHist.fill(HIST("tracks/antiHelium/h2TOFmass2antiHeliumVsPt_jet"), massTOF * massTOF - o2::constants::physics::MassHelium3 * o2::constants::physics::MassHelium3, trk.pt()); jetHist.fill(HIST("tracks/antiHelium/h2TofNsigmaantiHeliumVsPt_jet"), trk.tofNSigmaHe(), trk.pt()); } else { if (std::abs(trk.tpcNSigmaPr()) < cfgnTPCPIDPr) { jetHist.fill(HIST("tracks/antiProton/h2TOFmassantiProtonVsPt_jet"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/antiProton/h2TOFmass2antiProtonVsPt_jet"), massTOF * massTOF - gMassProton * gMassProton, trk.pt()); + jetHist.fill(HIST("tracks/antiProton/h2TOFmass2antiProtonVsPt_jet"), massTOF * massTOF - o2::constants::physics::MassProton * o2::constants::physics::MassProton, trk.pt()); jetHist.fill(HIST("tracks/antiProton/h2TofNsigmaantiProtonVsPt_jet"), trk.tofNSigmaPr(), trk.pt()); jetHist.fill(HIST("tracks/antiProton/h3TpcNsigmaTofNsigmaantiProtonVsPt_jet"), trk.tpcNSigmaPr(), trk.tofNSigmaPr(), trk.pt()); } if (std::abs(trk.tpcNSigmaDe()) < cfgnTPCPIDDe) { jetHist.fill(HIST("tracks/antiDeuteron/h2TOFmassantiDeuteronVsPt_jet"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/antiDeuteron/h2TOFmass2antiDeuteronVsPt_jet"), massTOF * massTOF - gMassDeuteron * gMassDeuteron, trk.pt()); + jetHist.fill(HIST("tracks/antiDeuteron/h2TOFmass2antiDeuteronVsPt_jet"), massTOF * massTOF - o2::constants::physics::MassDeuteron * o2::constants::physics::MassDeuteron, trk.pt()); jetHist.fill(HIST("tracks/antiDeuteron/h2TofNsigmaantiDeuteronVsPt_jet"), trk.tofNSigmaDe(), trk.pt()); jetHist.fill(HIST("tracks/antiDeuteron/h3TpcNsigmaTofNsigmaantiDeuteronVsPt_jet"), trk.tpcNSigmaDe(), trk.tofNSigmaDe(), trk.pt()); } if (std::abs(trk.tpcNSigmaTr()) < cfgnTPCPIDTr) { jetHist.fill(HIST("tracks/antiTriton/h2TOFmassantiTritonVsPt_jet"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/antiTriton/h2TOFmass2antiTritonVsPt_jet"), massTOF * massTOF - gMassTriton * gMassTriton, trk.pt()); + jetHist.fill(HIST("tracks/antiTriton/h2TOFmass2antiTritonVsPt_jet"), massTOF * massTOF - o2::constants::physics::MassTriton * o2::constants::physics::MassTriton, trk.pt()); jetHist.fill(HIST("tracks/antiTriton/h2TofNsigmaantiTritonVsPt_jet"), trk.tofNSigmaTr(), trk.pt()); } if (std::abs(trk.tpcNSigmaHe()) < cfgnTPCPIDHe) { jetHist.fill(HIST("tracks/antiHelium/h2TOFmassantiHeliumVsPt_jet"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/antiHelium/h2TOFmass2antiHeliumVsPt_jet"), massTOF * massTOF - gMassHelium * gMassHelium, trk.pt()); + jetHist.fill(HIST("tracks/antiHelium/h2TOFmass2antiHeliumVsPt_jet"), massTOF * massTOF - o2::constants::physics::MassHelium3 * o2::constants::physics::MassHelium3, trk.pt()); jetHist.fill(HIST("tracks/antiHelium/h2TofNsigmaantiHeliumVsPt_jet"), trk.tofNSigmaHe(), trk.pt()); } } @@ -1075,45 +1067,45 @@ struct nucleiInJets { if (addTOFplots && trk.hasTOF()) { if (!useTPCpreSel) { jetHist.fill(HIST("tracks/proton/h2TOFmassProtonVsPt"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/proton/h2TOFmass2ProtonVsPt"), massTOF * massTOF - gMassProton * gMassProton, trk.pt()); + jetHist.fill(HIST("tracks/proton/h2TOFmass2ProtonVsPt"), massTOF * massTOF - o2::constants::physics::MassProton * o2::constants::physics::MassProton, trk.pt()); jetHist.fill(HIST("tracks/proton/h2TofNsigmaProtonVsPt"), trk.tofNSigmaPr(), trk.pt()); jetHist.fill(HIST("tracks/deuteron/h2TOFmassDeuteronVsPt"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/deuteron/h2TOFmass2DeuteronVsPt"), massTOF * massTOF - gMassDeuteron * gMassDeuteron, trk.pt()); + jetHist.fill(HIST("tracks/deuteron/h2TOFmass2DeuteronVsPt"), massTOF * massTOF - o2::constants::physics::MassDeuteron * o2::constants::physics::MassDeuteron, trk.pt()); jetHist.fill(HIST("tracks/deuteron/h2TofNsigmaDeuteronVsPt"), trk.tofNSigmaDe(), trk.pt()); jetHist.fill(HIST("tracks/triton/h2TOFmassTritonVsPt"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/triton/h2TOFmass2TritonVsPt"), massTOF * massTOF - gMassTriton * gMassTriton, trk.pt()); + jetHist.fill(HIST("tracks/triton/h2TOFmass2TritonVsPt"), massTOF * massTOF - o2::constants::physics::MassTriton * o2::constants::physics::MassTriton, trk.pt()); jetHist.fill(HIST("tracks/helium/h2TofNsigmaHeliumVsPt"), trk.tofNSigmaHe(), trk.pt()); jetHist.fill(HIST("tracks/helium/h2TOFmassHeliumVsPt"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/helium/h2TOFmass2HeliumVsPt"), massTOF * massTOF - gMassHelium * gMassHelium, trk.pt()); + jetHist.fill(HIST("tracks/helium/h2TOFmass2HeliumVsPt"), massTOF * massTOF - o2::constants::physics::MassHelium3 * o2::constants::physics::MassHelium3, trk.pt()); jetHist.fill(HIST("tracks/triton/h2TofNsigmaTritonVsPt"), trk.tofNSigmaTr(), trk.pt()); } else { if (std::abs(trk.tpcNSigmaPr()) < cfgnTPCPIDPr) { jetHist.fill(HIST("tracks/proton/h2TOFmassProtonVsPt"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/proton/h2TOFmass2ProtonVsPt"), massTOF * massTOF - gMassProton * gMassProton, trk.pt()); + jetHist.fill(HIST("tracks/proton/h2TOFmass2ProtonVsPt"), massTOF * massTOF - o2::constants::physics::MassProton * o2::constants::physics::MassProton, trk.pt()); jetHist.fill(HIST("tracks/proton/h2TofNsigmaProtonVsPt"), trk.tofNSigmaPr(), trk.pt()); if (jetFlagPerpCone && isWithLeadingJet) jetHist.fill(HIST("tracks/perpCone/proton/h2TofNsigmaProtonVsPt"), trk.tofNSigmaPr(), trk.pt()); } if (std::abs(trk.tpcNSigmaDe()) < cfgnTPCPIDDe) { jetHist.fill(HIST("tracks/deuteron/h2TOFmassDeuteronVsPt"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/deuteron/h2TOFmass2DeuteronVsPt"), massTOF * massTOF - gMassDeuteron * gMassDeuteron, trk.pt()); + jetHist.fill(HIST("tracks/deuteron/h2TOFmass2DeuteronVsPt"), massTOF * massTOF - o2::constants::physics::MassDeuteron * o2::constants::physics::MassDeuteron, trk.pt()); jetHist.fill(HIST("tracks/deuteron/h2TofNsigmaDeuteronVsPt"), trk.tofNSigmaDe(), trk.pt()); if (jetFlagPerpCone && isWithLeadingJet) jetHist.fill(HIST("tracks/perpCone/deuteron/h2TofNsigmaDeuteronVsPt"), trk.tofNSigmaDe(), trk.pt()); } if (std::abs(trk.tpcNSigmaTr()) < cfgnTPCPIDTr) { jetHist.fill(HIST("tracks/triton/h2TOFmassTritonVsPt"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/triton/h2TOFmass2TritonVsPt"), massTOF * massTOF - gMassTriton * gMassTriton, trk.pt()); + jetHist.fill(HIST("tracks/triton/h2TOFmass2TritonVsPt"), massTOF * massTOF - o2::constants::physics::MassTriton * o2::constants::physics::MassTriton, trk.pt()); jetHist.fill(HIST("tracks/triton/h2TofNsigmaTritonVsPt"), trk.tofNSigmaTr(), trk.pt()); if (jetFlagPerpCone && isWithLeadingJet) jetHist.fill(HIST("tracks/perpCone/triton/h2TofNsigmaTritonVsPt"), trk.tofNSigmaTr(), trk.pt()); } if (std::abs(trk.tpcNSigmaHe()) < cfgnTPCPIDHe) { jetHist.fill(HIST("tracks/helium/h2TOFmassHeliumVsPt"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/helium/h2TOFmass2HeliumVsPt"), massTOF * massTOF - gMassHelium * gMassHelium, trk.pt()); + jetHist.fill(HIST("tracks/helium/h2TOFmass2HeliumVsPt"), massTOF * massTOF - o2::constants::physics::MassHelium3 * o2::constants::physics::MassHelium3, trk.pt()); jetHist.fill(HIST("tracks/helium/h2TofNsigmaHeliumVsPt"), trk.tofNSigmaHe(), trk.pt()); if (jetFlagPerpCone && isWithLeadingJet) jetHist.fill(HIST("tracks/perpCone/helium/h2TofNsigmaHeliumVsPt"), trk.tofNSigmaHe(), trk.pt()); @@ -1193,45 +1185,45 @@ struct nucleiInJets { if (addTOFplots && trk.hasTOF()) { if (!useTPCpreSel) { jetHist.fill(HIST("tracks/antiProton/h2TOFmassantiProtonVsPt"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/antiProton/h2TOFmass2antiProtonVsPt"), massTOF * massTOF - gMassProton * gMassProton, trk.pt()); + jetHist.fill(HIST("tracks/antiProton/h2TOFmass2antiProtonVsPt"), massTOF * massTOF - o2::constants::physics::MassProton * o2::constants::physics::MassProton, trk.pt()); jetHist.fill(HIST("tracks/antiProton/h2TofNsigmaantiProtonVsPt"), trk.tofNSigmaPr(), trk.pt()); jetHist.fill(HIST("tracks/antiDeuteron/h2TOFmassantiDeuteronVsPt"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/antiDeuteron/h2TOFmass2antiDeuteronVsPt"), massTOF * massTOF - gMassDeuteron * gMassDeuteron, trk.pt()); + jetHist.fill(HIST("tracks/antiDeuteron/h2TOFmass2antiDeuteronVsPt"), massTOF * massTOF - o2::constants::physics::MassDeuteron * o2::constants::physics::MassDeuteron, trk.pt()); jetHist.fill(HIST("tracks/antiDeuteron/h2TofNsigmaantiDeuteronVsPt"), trk.tofNSigmaDe(), trk.pt()); jetHist.fill(HIST("tracks/antiTriton/h2TOFmassantiTritonVsPt"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/antiTriton/h2TOFmass2antiTritonVsPt"), massTOF * massTOF - gMassTriton * gMassTriton, trk.pt()); + jetHist.fill(HIST("tracks/antiTriton/h2TOFmass2antiTritonVsPt"), massTOF * massTOF - o2::constants::physics::MassTriton * o2::constants::physics::MassTriton, trk.pt()); jetHist.fill(HIST("tracks/antiHelium/h2TofNsigmaantiHeliumVsPt"), trk.tofNSigmaHe(), trk.pt()); jetHist.fill(HIST("tracks/antiHelium/h2TOFmassantiHeliumVsPt"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/antiHelium/h2TOFmass2antiHeliumVsPt"), massTOF * massTOF - gMassHelium * gMassHelium, trk.pt()); + jetHist.fill(HIST("tracks/antiHelium/h2TOFmass2antiHeliumVsPt"), massTOF * massTOF - o2::constants::physics::MassHelium3 * o2::constants::physics::MassHelium3, trk.pt()); jetHist.fill(HIST("tracks/antiTriton/h2TofNsigmaantiTritonVsPt"), trk.tofNSigmaTr(), trk.pt()); } else { if (std::abs(trk.tpcNSigmaPr()) < cfgnTPCPIDPr) { jetHist.fill(HIST("tracks/antiProton/h2TOFmassantiProtonVsPt"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/antiProton/h2TOFmass2antiProtonVsPt"), massTOF * massTOF - gMassProton * gMassProton, trk.pt()); + jetHist.fill(HIST("tracks/antiProton/h2TOFmass2antiProtonVsPt"), massTOF * massTOF - o2::constants::physics::MassProton * o2::constants::physics::MassProton, trk.pt()); jetHist.fill(HIST("tracks/antiProton/h2TofNsigmaantiProtonVsPt"), trk.tofNSigmaPr(), trk.pt()); if (jetFlagPerpCone && isWithLeadingJet) jetHist.fill(HIST("tracks/perpCone/antiProton/h2TofNsigmaantiProtonVsPt"), trk.tofNSigmaPr(), trk.pt()); } if (std::abs(trk.tpcNSigmaDe()) < cfgnTPCPIDDe) { jetHist.fill(HIST("tracks/antiDeuteron/h2TOFmassantiDeuteronVsPt"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/antiDeuteron/h2TOFmass2antiDeuteronVsPt"), massTOF * massTOF - gMassDeuteron * gMassDeuteron, trk.pt()); + jetHist.fill(HIST("tracks/antiDeuteron/h2TOFmass2antiDeuteronVsPt"), massTOF * massTOF - o2::constants::physics::MassDeuteron * o2::constants::physics::MassDeuteron, trk.pt()); jetHist.fill(HIST("tracks/antiDeuteron/h2TofNsigmaantiDeuteronVsPt"), trk.tofNSigmaDe(), trk.pt()); if (jetFlagPerpCone && isWithLeadingJet) jetHist.fill(HIST("tracks/perpCone/antiDeuteron/h2TofNsigmaantiDeuteronVsPt"), trk.tofNSigmaDe(), trk.pt()); } if (std::abs(trk.tpcNSigmaTr()) < cfgnTPCPIDTr) { jetHist.fill(HIST("tracks/antiTriton/h2TOFmassantiTritonVsPt"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/antiTriton/h2TOFmass2antiTritonVsPt"), massTOF * massTOF - gMassTriton * gMassTriton, trk.pt()); + jetHist.fill(HIST("tracks/antiTriton/h2TOFmass2antiTritonVsPt"), massTOF * massTOF - o2::constants::physics::MassTriton * o2::constants::physics::MassTriton, trk.pt()); jetHist.fill(HIST("tracks/antiTriton/h2TofNsigmaantiTritonVsPt"), trk.tofNSigmaTr(), trk.pt()); if (jetFlagPerpCone && isWithLeadingJet) jetHist.fill(HIST("tracks/perpCone/antiTriton/h2TofNsigmaantiTritonVsPt"), trk.tofNSigmaTr(), trk.pt()); } if (std::abs(trk.tpcNSigmaHe()) < cfgnTPCPIDHe) { jetHist.fill(HIST("tracks/antiHelium/h2TOFmassantiHeliumVsPt"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/antiHelium/h2TOFmass2antiHeliumVsPt"), massTOF * massTOF - gMassHelium * gMassHelium, trk.pt()); + jetHist.fill(HIST("tracks/antiHelium/h2TOFmass2antiHeliumVsPt"), massTOF * massTOF - o2::constants::physics::MassHelium3 * o2::constants::physics::MassHelium3, trk.pt()); jetHist.fill(HIST("tracks/antiHelium/h2TofNsigmaantiHeliumVsPt"), trk.tofNSigmaHe(), trk.pt()); if (jetFlagPerpCone && isWithLeadingJet) jetHist.fill(HIST("tracks/perpCone/antiHelium/h2TofNsigmaantiHeliumVsPt"), trk.tofNSigmaHe(), trk.pt()); @@ -1289,7 +1281,7 @@ struct nucleiInJets { if (isWithJetEvents && nJets == 0) return; jetHist.fill(HIST("jet/h1JetEvents"), 0.5); - for (auto& track : tracks) { + for (const auto& track : tracks) { auto trk = track.track_as(); fillTrackInfo(trk, chargedjets, leadingJetWithPtEtaPhi); } @@ -1407,24 +1399,24 @@ struct nucleiInJets { } float massTOF = -999; if (addTOFplots && trk.hasTOF()) { - massTOF = trk.p() * TMath::Sqrt(1.f / (trk.beta() * trk.beta()) - 1.f); + massTOF = trk.p() * std::sqrt(1.f / (trk.beta() * trk.beta()) - 1.f); if (!useTPCpreSel) { jetHist.fill(HIST("tracksInc/proton/h2TOFmassProtonVsPt"), massTOF, trk.pt(), centrality); - jetHist.fill(HIST("tracksInc/proton/h2TOFmass2ProtonVsPt"), massTOF * massTOF - gMassProton * gMassProton, trk.pt(), centrality); + jetHist.fill(HIST("tracksInc/proton/h2TOFmass2ProtonVsPt"), massTOF * massTOF - o2::constants::physics::MassProton * o2::constants::physics::MassProton, trk.pt(), centrality); jetHist.fill(HIST("tracksInc/proton/h2TofNsigmaProtonVsPt"), trk.tofNSigmaPr(), trk.pt(), centrality); jetHist.fill(HIST("tracksInc/deuteron/h2TOFmassDeuteronVsPt"), massTOF, trk.pt(), centrality); - jetHist.fill(HIST("tracksInc/deuteron/h2TOFmass2DeuteronVsPt"), massTOF * massTOF - gMassDeuteron * gMassDeuteron, trk.pt(), centrality); + jetHist.fill(HIST("tracksInc/deuteron/h2TOFmass2DeuteronVsPt"), massTOF * massTOF - o2::constants::physics::MassDeuteron * o2::constants::physics::MassDeuteron, trk.pt(), centrality); jetHist.fill(HIST("tracksInc/deuteron/h2TofNsigmaDeuteronVsPt"), trk.tofNSigmaDe(), trk.pt(), centrality); } else { if (std::abs(trk.tpcNSigmaPr()) < cfgnTPCPIDPr) { jetHist.fill(HIST("tracksInc/proton/h2TOFmassProtonVsPt"), massTOF, trk.pt(), centrality); - jetHist.fill(HIST("tracksInc/proton/h2TOFmass2ProtonVsPt"), massTOF * massTOF - gMassProton * gMassProton, trk.pt(), centrality); + jetHist.fill(HIST("tracksInc/proton/h2TOFmass2ProtonVsPt"), massTOF * massTOF - o2::constants::physics::MassProton * o2::constants::physics::MassProton, trk.pt(), centrality); jetHist.fill(HIST("tracksInc/proton/h2TofNsigmaProtonVsPt"), trk.tofNSigmaPr(), trk.pt(), centrality); } if (std::abs(trk.tpcNSigmaDe()) < cfgnTPCPIDDe) { jetHist.fill(HIST("tracksInc/deuteron/h2TOFmassDeuteronVsPt"), massTOF, trk.pt(), centrality); - jetHist.fill(HIST("tracksInc/deuteron/h2TOFmass2DeuteronVsPt"), massTOF * massTOF - gMassDeuteron * gMassDeuteron, trk.pt(), centrality); + jetHist.fill(HIST("tracksInc/deuteron/h2TOFmass2DeuteronVsPt"), massTOF * massTOF - o2::constants::physics::MassDeuteron * o2::constants::physics::MassDeuteron, trk.pt(), centrality); jetHist.fill(HIST("tracksInc/deuteron/h2TofNsigmaDeuteronVsPt"), trk.tofNSigmaDe(), trk.pt(), centrality); } } @@ -1466,28 +1458,28 @@ struct nucleiInJets { } float massTOF = -999; if (addTOFplots && trk.hasTOF()) { - massTOF = trk.p() * TMath::Sqrt(1.f / (trk.beta() * trk.beta()) - 1.f); + massTOF = trk.p() * std::sqrt(1.f / (trk.beta() * trk.beta()) - 1.f); if (!useTPCpreSel) { jetHist.fill(HIST("tracksInc/antiProton/h2TOFmassantiProtonVsPt"), massTOF, trk.pt(), centrality); - jetHist.fill(HIST("tracksInc/antiProton/h2TOFmass2antiProtonVsPt"), massTOF * massTOF - gMassProton * gMassProton, trk.pt(), centrality); + jetHist.fill(HIST("tracksInc/antiProton/h2TOFmass2antiProtonVsPt"), massTOF * massTOF - o2::constants::physics::MassProton * o2::constants::physics::MassProton, trk.pt(), centrality); jetHist.fill(HIST("tracksInc/antiProton/h2TofNsigmaantiProtonVsPt"), trk.tofNSigmaPr(), trk.pt(), centrality); jetHist.fill(HIST("tracksInc/antiDeuteron/h2TOFmassantiDeuteronVsPt"), massTOF, trk.pt(), centrality); - jetHist.fill(HIST("tracksInc/antiDeuteron/h2TOFmass2antiDeuteronVsPt"), massTOF * massTOF - gMassDeuteron * gMassDeuteron, trk.pt(), centrality); + jetHist.fill(HIST("tracksInc/antiDeuteron/h2TOFmass2antiDeuteronVsPt"), massTOF * massTOF - o2::constants::physics::MassDeuteron * o2::constants::physics::MassDeuteron, trk.pt(), centrality); jetHist.fill(HIST("tracksInc/antiDeuteron/h2TofNsigmaantiDeuteronVsPt"), trk.tofNSigmaDe(), trk.pt(), centrality); } else { if (std::abs(trk.tpcNSigmaPr()) < cfgnTPCPIDPr) { jetHist.fill(HIST("tracksInc/antiProton/h2TOFmassantiProtonVsPt"), massTOF, trk.pt(), centrality); - jetHist.fill(HIST("tracksInc/antiProton/h2TOFmass2antiProtonVsPt"), massTOF * massTOF - gMassProton * gMassProton, trk.pt(), centrality); + jetHist.fill(HIST("tracksInc/antiProton/h2TOFmass2antiProtonVsPt"), massTOF * massTOF - o2::constants::physics::MassProton * o2::constants::physics::MassProton, trk.pt(), centrality); jetHist.fill(HIST("tracksInc/antiProton/h2TofNsigmaantiProtonVsPt"), trk.tofNSigmaPr(), trk.pt(), centrality); } if (std::abs(trk.tpcNSigmaDe()) < cfgnTPCPIDDe) { jetHist.fill(HIST("tracksInc/antiDeuteron/h2TOFmassantiDeuteronVsPt"), massTOF, trk.pt(), centrality); - jetHist.fill(HIST("tracksInc/antiDeuteron/h2TOFmass2antiDeuteronVsPt"), massTOF * massTOF - gMassDeuteron * gMassDeuteron, trk.pt(), centrality); + jetHist.fill(HIST("tracksInc/antiDeuteron/h2TOFmass2antiDeuteronVsPt"), massTOF * massTOF - o2::constants::physics::MassDeuteron * o2::constants::physics::MassDeuteron, trk.pt(), centrality); jetHist.fill(HIST("tracksInc/antiDeuteron/h2TofNsigmaantiDeuteronVsPt"), trk.tofNSigmaDe(), trk.pt(), centrality); } else { jetHist.fill(HIST("tracksInc/antiDeuteron/h2TOFmassantiDeuteronVsPt"), massTOF, trk.pt(), centrality); - jetHist.fill(HIST("tracksInc/antiDeuteron/h2TOFmass2antiDeuteronVsPt"), massTOF * massTOF - gMassDeuteron * gMassDeuteron, trk.pt(), centrality); + jetHist.fill(HIST("tracksInc/antiDeuteron/h2TOFmass2antiDeuteronVsPt"), massTOF * massTOF - o2::constants::physics::MassDeuteron * o2::constants::physics::MassDeuteron, trk.pt(), centrality); jetHist.fill(HIST("tracksInc/antiDeuteron/h2TofNsigmaantiDeuteronVsPt"), trk.tofNSigmaDe(), trk.pt(), centrality); } } @@ -1520,7 +1512,7 @@ struct nucleiInJets { jetHist.fill(HIST("mcpJet/eventStat"), 3.5); int nJets = 0; - for (auto& mcpjet : mcpjets) { + for (const auto& mcpjet : mcpjets) { jetHist.fill(HIST("mcpJet/hJetPt"), mcpjet.pt()); jetHist.fill(HIST("mcpJet/hJetEta"), mcpjet.eta()); jetHist.fill(HIST("mcpJet/hJetPhi"), mcpjet.phi()); @@ -1538,10 +1530,10 @@ struct nucleiInJets { bool jetFlag = false; // float jetPt = -999.; - for (auto& mcpjet : mcpjets) { + for (const auto& mcpjet : mcpjets) { double delPhi = TVector2::Phi_mpi_pi(mcpjet.phi() - mcParticle.phi()); double delEta = mcpjet.eta() - mcParticle.eta(); - double R = TMath::Sqrt((delEta * delEta) + (delPhi * delPhi)); + double R = RecoDecay::sqrtSumOfSquares(delEta, delPhi); if (R < cfgjetR) jetFlag = true; // jetPt = mcpjet.pt(); @@ -1594,7 +1586,7 @@ struct nucleiInJets { jetHist.fill(HIST("mcdJet/nJetsPerEvent"), nJets); if (isWithJetEvents && nJets == 0) return; - for (auto& track : tracks) { + for (const auto& track : tracks) { auto fullTrack = track.track_as(); if (!isTrackSelected(fullTrack)) continue; @@ -1611,21 +1603,21 @@ struct nucleiInJets { if (isWithLeadingJet) { double delPhi = TVector2::Phi_mpi_pi(leadingJetWithPtEtaPhi[2] - track.phi()); double delEta = leadingJetWithPtEtaPhi[1] - track.eta(); - double R = TMath::Sqrt((delEta * delEta) + (delPhi * delPhi)); + double R = RecoDecay::sqrtSumOfSquares(delEta, delPhi); if (R < cfgjetR) jetFlag = true; std::array perpConePhiJet = getPerpendicuarPhi(leadingJetWithPtEtaPhi[2]); double delPhiPerpCone1 = TVector2::Phi_mpi_pi(perpConePhiJet[0] - track.phi()); double delPhiPerpCone2 = TVector2::Phi_mpi_pi(perpConePhiJet[1] - track.phi()); - double RPerpCone1 = TMath::Sqrt((delEta * delEta) + (delPhiPerpCone1 * delPhiPerpCone1)); - double RPerpCone2 = TMath::Sqrt((delEta * delEta) + (delPhiPerpCone2 * delPhiPerpCone2)); + double RPerpCone1 = RecoDecay::sqrtSumOfSquares(delEta, delPhiPerpCone1); + double RPerpCone2 = RecoDecay::sqrtSumOfSquares(delEta, delPhiPerpCone2); if (RPerpCone1 < cfgjetR || RPerpCone2 < cfgjetR) jetFlagPerpCone = true; } else { - for (auto& mcdjet : mcdjets) { + for (const auto& mcdjet : mcdjets) { double delPhi = TVector2::Phi_mpi_pi(mcdjet.phi() - track.phi()); double delEta = mcdjet.eta() - track.eta(); - double R = TMath::Sqrt((delEta * delEta) + (delPhi * delPhi)); + double R = RecoDecay::sqrtSumOfSquares(delEta, delPhi); if (R < cfgjetR) jetFlag = true; // jetPt = mcdjet.pt(); @@ -1675,10 +1667,10 @@ struct nucleiInJets { if (mcdjets.size() == 0) return; std::vector leadingJetWithPtEtaPhi(3); - for (auto& mcdjet : mcdjets) { + for (const auto& mcdjet : mcdjets) { if (!mcdjet.has_matchedJetGeo()) continue; - for (auto& mcpjet : mcdjet.template matchedJetGeo_as()) { + for (const auto& mcpjet : mcdjet.template matchedJetGeo_as()) { if (!mcpjet.has_matchedJetGeo()) continue; @@ -1752,21 +1744,21 @@ struct nucleiInJets { if (isWithLeadingJet) { double delPhi = TVector2::Phi_mpi_pi(leadingJetWithPtEtaPhi[2] - track.phi()); double delEta = leadingJetWithPtEtaPhi[1] - track.eta(); - double R = TMath::Sqrt((delEta * delEta) + (delPhi * delPhi)); + double R = RecoDecay::sqrtSumOfSquares(delEta, delPhi); if (R < cfgjetR) jetFlag = true; std::array perpConePhiJet = getPerpendicuarPhi(leadingJetWithPtEtaPhi[2]); double delPhiPerpCone1 = TVector2::Phi_mpi_pi(perpConePhiJet[0] - track.phi()); double delPhiPerpCone2 = TVector2::Phi_mpi_pi(perpConePhiJet[1] - track.phi()); - double RPerpCone1 = TMath::Sqrt((delEta * delEta) + (delPhiPerpCone1 * delPhiPerpCone1)); - double RPerpCone2 = TMath::Sqrt((delEta * delEta) + (delPhiPerpCone2 * delPhiPerpCone2)); + double RPerpCone1 = RecoDecay::sqrtSumOfSquares(delEta, delPhiPerpCone1); + double RPerpCone2 = RecoDecay::sqrtSumOfSquares(delEta, delPhiPerpCone2); if (RPerpCone1 < cfgjetR || RPerpCone2 < cfgjetR) jetFlagPerpCone = true; } else { for (std::size_t iDJet = 0; iDJet < mcdJetPt.size(); iDJet++) { double delPhi = TVector2::Phi_mpi_pi(mcdJetPhi[iDJet] - track.phi()); double delEta = mcdJetEta[iDJet] - track.eta(); - double R = TMath::Sqrt((delEta * delEta) + (delPhi * delPhi)); + double R = RecoDecay::sqrtSumOfSquares(delEta, delPhi); if (R < cfgjetR) { jetFlag = true; @@ -1829,14 +1821,14 @@ struct nucleiInJets { if (isWithLeadingJet) { double delPhi = TVector2::Phi_mpi_pi(leadingJetWithPtEtaPhi[2] - mcParticle.phi()); double delEta = leadingJetWithPtEtaPhi[1] - mcParticle.eta(); - double R = TMath::Sqrt((delEta * delEta) + (delPhi * delPhi)); + double R = RecoDecay::sqrtSumOfSquares(delEta, delPhi); if (R < cfgjetR) jetFlagMC = true; std::array perpConePhiJet = getPerpendicuarPhi(leadingJetWithPtEtaPhi[2]); double delPhiPerpCone1 = TVector2::Phi_mpi_pi(perpConePhiJet[0] - mcParticle.phi()); double delPhiPerpCone2 = TVector2::Phi_mpi_pi(perpConePhiJet[1] - mcParticle.phi()); - double RPerpCone1 = TMath::Sqrt((delEta * delEta) + (delPhiPerpCone1 * delPhiPerpCone1)); - double RPerpCone2 = TMath::Sqrt((delEta * delEta) + (delPhiPerpCone2 * delPhiPerpCone2)); + double RPerpCone1 = RecoDecay::sqrtSumOfSquares(delEta, delPhiPerpCone1); + double RPerpCone2 = RecoDecay::sqrtSumOfSquares(delEta, delPhiPerpCone2); if (RPerpCone1 < cfgjetR || RPerpCone2 < cfgjetR) jetFlagPerpConeMC = true; } else { @@ -1844,7 +1836,7 @@ struct nucleiInJets { for (std::size_t iDJet = 0; iDJet < mcdJetPt.size(); iDJet++) { double delPhi = TVector2::Phi_mpi_pi(mcdJetPhi[iDJet] - mcParticle.phi()); double delEta = mcdJetEta[iDJet] - mcParticle.eta(); - double R = TMath::Sqrt((delEta * delEta) + (delPhi * delPhi)); + double R = RecoDecay::sqrtSumOfSquares(delEta, delPhi); if (R < cfgjetR) { jetFlagMC = true; break; @@ -1913,7 +1905,7 @@ struct nucleiInJets { jetHist.fill(HIST("genmatched/leadingJet/hGenJetPt"), leadingMCPJet.pt()); if (leadingMCPJet.has_matchedJetGeo()) { jetHist.fill(HIST("genmatched/leadingJet/hGenJetPtMatched"), leadingMCPJet.pt()); - for (auto& mcdjet : leadingMCPJet.template matchedJetGeo_as()) { + for (const auto& mcdjet : leadingMCPJet.template matchedJetGeo_as()) { // Assuming matchedJetGeo_as returns valid MCD jets; no redundant has check needed // Store jet properties mcdJetPt.push_back(mcdjet.pt()); @@ -1952,7 +1944,7 @@ struct nucleiInJets { for (std::size_t iDJet = 0; iDJet < mcpJetPt.size(); iDJet++) { double delPhi = TVector2::Phi_mpi_pi(mcpJetPhi[iDJet] - mcParticle.phi()); double delEta = mcpJetEta[iDJet] - mcParticle.eta(); - double R = TMath::Sqrt((delEta * delEta) + (delPhi * delPhi)); + double R = RecoDecay::sqrtSumOfSquares(delEta, delPhi); if (R < cfgjetR) { jetFlag = true; From 50fd5963b86e85d0a0da86972c05e9ada926bfb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Fri, 1 Aug 2025 11:35:55 +0200 Subject: [PATCH 177/345] [Common] Use metadataHelper from namespace (#11885) --- Common/Core/MetadataHelper.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Common/Core/MetadataHelper.h b/Common/Core/MetadataHelper.h index 45eb4e8651c..f3522a5d190 100644 --- a/Common/Core/MetadataHelper.h +++ b/Common/Core/MetadataHelper.h @@ -8,8 +8,6 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. - -/// /// \file TableHelper.h /// \author Nicolò Jacazio nicolo.jacazio@cern.ch /// \brief Utility to handle the metadata from the AOD @@ -70,6 +68,4 @@ struct MetadataHelper { } // namespace o2::common::core -using MetadataHelper = o2::common::core::MetadataHelper; // Alias for the MetadataHelper - #endif // COMMON_CORE_METADATAHELPER_H_ From 65d3cd32c309be163d1505811965ea7f0dea1c1f Mon Sep 17 00:00:00 2001 From: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Date: Fri, 1 Aug 2025 12:28:14 +0200 Subject: [PATCH 178/345] [PWGLF] Remove subscription to TOFPIDs table (#12361) --- PWGLF/Tasks/Strangeness/strangenessderivedbinnedinfo.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/strangenessderivedbinnedinfo.cxx b/PWGLF/Tasks/Strangeness/strangenessderivedbinnedinfo.cxx index 6e2be4e435c..a170b942d59 100644 --- a/PWGLF/Tasks/Strangeness/strangenessderivedbinnedinfo.cxx +++ b/PWGLF/Tasks/Strangeness/strangenessderivedbinnedinfo.cxx @@ -75,8 +75,8 @@ using std::array; using namespace o2::aod::rctsel; using DauTracks = soa::Join; -using V0Candidates = soa::Join; -using CascadeCandidates = soa::Join; +using V0Candidates = soa::Join; +using CascadeCandidates = soa::Join; struct strangenessderivedbinnedinfo { HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; From 51fa8b6c0b6828387697abb7cbd2ba4c39b6caf8 Mon Sep 17 00:00:00 2001 From: sashingo Date: Fri, 1 Aug 2025 20:59:20 +0900 Subject: [PATCH 179/345] [PWGHF] Z: Add eta and dE/dx axes. Add electron momentum correction factor. (#12303) --- PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx index 40739b9be59..a9b15ce7a0f 100644 --- a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx +++ b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx @@ -103,6 +103,7 @@ struct HfTaskElectronWeakBoson { Configurable massZMin{"massZMin", 60.0, "Minimum Z mass (GeV/c^2)"}; Configurable massZMax{"massZMax", 120.0, "Maximum Z mass (GeV/c^2)"}; + Configurable correctionPtElectron{"correctionPtElectron", 1.0, "momentum correction factor for decay electrons from Z boson"}; // flag for THn Configurable isTHnElectron{"isTHnElectron", true, "Enables THn for electrons"}; @@ -195,6 +196,7 @@ struct HfTaskElectronWeakBoson { const AxisSpec axisEta{20, -1.0, 1.0, "#eta"}; const AxisSpec axisPt{nBinsPt, 0, binPtmax, "p_{T}"}; const AxisSpec axisNsigma{100, -5, 5, "N#sigma"}; + const AxisSpec axisDedx{150, 0, 150, "dEdx"}; const AxisSpec axisE{nBinsE, 0, binEmax, "Energy"}; const AxisSpec axisM02{100, 0, 1, "M02"}; const AxisSpec axisdPhi{100, -0.5, 0.5, "dPhi"}; @@ -245,7 +247,7 @@ struct HfTaskElectronWeakBoson { registry.add("hInvMassZeeUls", "invariant mass for Z ULS pair", kTH2F, {{axisPt}, {axisInvMassZ}}); registry.add("hKfInvMassZeeLs", "invariant mass for Z LS pair KFp", kTH2F, {{axisPt}, {axisInvMassZ}}); registry.add("hKfInvMassZeeUls", "invariant mass for Z ULS pair KFp", kTH2F, {{axisPt}, {axisInvMassZ}}); - registry.add("hTHnElectrons", "electron info", HistType::kTHnSparseF, {axisPt, axisNsigma, axisM02, axisEop, axisIsoEnergy, axisIsoTrack}); + registry.add("hTHnElectrons", "electron info", HistType::kTHnSparseF, {axisPt, axisNsigma, axisM02, axisEop, axisIsoEnergy, axisIsoTrack, axisEta, axisDedx}); registry.add("hTHnTrMatch", "Track EMC Match", HistType::kTHnSparseF, {axisPt, axisdPhi, axisdEta}); // Z-hadron correlation histograms @@ -338,8 +340,8 @@ struct HfTaskElectronWeakBoson { KFPTrack kfpTrackAssEle = createKFPTrackFromTrack(track); KFParticle kfpAssEle(kfpTrackAssEle, pdgAss); // reco by RecoDecay - auto child1 = RecoDecayPtEtaPhi::pVector(kfpIsoEle.GetPt(), kfpIsoEle.GetEta(), kfpIsoEle.GetPhi()); - auto child2 = RecoDecayPtEtaPhi::pVector(kfpAssEle.GetPt(), kfpAssEle.GetEta(), kfpAssEle.GetPhi()); + auto child1 = RecoDecayPtEtaPhi::pVector(kfpIsoEle.GetPt() * correctionPtElectron, kfpIsoEle.GetEta(), kfpIsoEle.GetPhi()); + auto child2 = RecoDecayPtEtaPhi::pVector(kfpAssEle.GetPt() * correctionPtElectron, kfpAssEle.GetEta(), kfpAssEle.GetPhi()); double invMassEE = RecoDecay::m(std::array{child1, child2}, std::array{o2::constants::physics::MassElectron, o2::constants::physics::MassElectron}); // reco by KFparticle @@ -556,7 +558,7 @@ struct HfTaskElectronWeakBoson { int trackCount = getIsolatedTrack(track.eta(), track.phi(), track.pt(), tracks) - 1; if (match.track_as().pt() > ptTHnThresh && isTHnElectron) { - registry.fill(HIST("hTHnElectrons"), match.track_as().pt(), match.track_as().tpcNSigmaEl(), m02Emc, eop, isoEnergy, trackCount); + registry.fill(HIST("hTHnElectrons"), match.track_as().pt(), match.track_as().tpcNSigmaEl(), m02Emc, eop, isoEnergy, trackCount, track.eta(), track.tpcSignal()); } // LOG(info) << "E/p" << eop; registry.fill(HIST("hEopNsigTPC"), match.track_as().tpcNSigmaEl(), eop); From 6cfe362911caa8f417c816241e1a61468b843b1f Mon Sep 17 00:00:00 2001 From: Antonio Palasciano <52152842+apalasciano@users.noreply.github.com> Date: Fri, 1 Aug 2025 14:04:58 +0200 Subject: [PATCH 180/345] [PWGHF] D+: Add dependence on PV contributors to thnsparse (#12230) --- PWGHF/D2H/Tasks/taskDplus.cxx | 88 ++++++++++++++----- .../TableProducer/treeCreatorDplusToPiKPi.cxx | 2 + 2 files changed, 69 insertions(+), 21 deletions(-) diff --git a/PWGHF/D2H/Tasks/taskDplus.cxx b/PWGHF/D2H/Tasks/taskDplus.cxx index 30734322e9d..921d39364e6 100644 --- a/PWGHF/D2H/Tasks/taskDplus.cxx +++ b/PWGHF/D2H/Tasks/taskDplus.cxx @@ -44,6 +44,7 @@ #include +#include #include #include #include @@ -69,6 +70,7 @@ struct HfTaskDplus { Configurable> classMl{"classMl", {0, 1, 2}, "Indexes of ML scores to be stored. Three indexes max."}; Configurable storeCentrality{"storeCentrality", false, "Flag to store centrality information"}; Configurable storeOccupancy{"storeOccupancy", false, "Flag to store occupancy information"}; + Configurable storePvContributors{"storePvContributors", false, "Flag to store number of PV contributors information"}; Configurable fillMcBkgHistos{"fillMcBkgHistos", false, "Flag to fill and store histograms for MC background"}; HfHelper hfHelper; @@ -102,6 +104,7 @@ struct HfTaskDplus { ConfigurableAxis thnConfigAxisY{"thnConfigAxisY", {40, -1, 1}, "Cand. rapidity bins"}; ConfigurableAxis thnConfigAxisCent{"thnConfigAxisCent", {110, 0., 110.}, "axis for centrality"}; ConfigurableAxis thnConfigAxisOccupancy{"thnConfigAxisOccupancy", {14, 0, 14000}, "axis for occupancy"}; + ConfigurableAxis thnConfigAxisPvContributors{"thnConfigAxisPvContributors", {100, 0., 100.}, "axis for PV contributors"}; ConfigurableAxis thnConfigAxisPtBHad{"thnConfigAxisPtBHad", {25, 0., 50}, "axis for pt of B hadron decayed into D candidate"}; ConfigurableAxis thnConfigAxisFlagBHad{"thnConfigAxisFlagBHad", {5, 0., 5}, "axis for PDG of B hadron"}; ConfigurableAxis thnConfigAxisMlScore0{"thnConfigAxisMlScore0", {100, 0., 1.}, "axis for ML output score 0"}; @@ -137,6 +140,7 @@ struct HfTaskDplus { AxisSpec thnAxisFlagBHad{thnConfigAxisFlagBHad, "B Hadron flag"}; AxisSpec thnAxisCent{thnConfigAxisCent, "Centrality"}; AxisSpec thnAxisOccupancy{thnConfigAxisOccupancy, "Occupancy"}; + AxisSpec thnAxisPvContributors{thnConfigAxisPvContributors, "PV contributors"}; registry.add("hMass", "3-prong candidates;inv. mass (#pi K #pi) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{350, 1.7, 2.05}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hEta", "3-prong candidates;candidate #it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); @@ -180,13 +184,15 @@ struct HfTaskDplus { std::vector axes = {thnAxisMass, thnAxisPt}; if (doprocessDataWithMl) { - axes.insert(axes.end(), {thnAxisMlScore0, thnAxisMlScore1, thnAxisMlScore2}); + axes.push_back(thnAxisMlScore0); + axes.push_back(thnAxisMlScore1); + axes.push_back(thnAxisMlScore2); } if (storeCentrality) { - axes.insert(axes.end(), {thnAxisCent}); + axes.push_back(thnAxisCent); } if (storeOccupancy) { - axes.insert(axes.end(), {thnAxisOccupancy}); + axes.push_back(thnAxisOccupancy); } registry.add("hSparseMass", "THn for Dplus", HistType::kTHnSparseF, axes); @@ -202,22 +208,28 @@ struct HfTaskDplus { axesFD.insert(axesFD.end(), {thnAxisMlScore0, thnAxisMlScore1, thnAxisMlScore2}); } if (storeCentrality) { - axes.insert(axes.end(), {thnAxisCent}); - axesFD.insert(axesFD.end(), {thnAxisCent}); - axesGenPrompt.insert(axesGenPrompt.end(), {thnAxisCent}); - axesGenFD.insert(axesGenFD.end(), {thnAxisCent}); + axes.push_back(thnAxisCent); + axesFD.push_back(thnAxisCent); + axesGenPrompt.push_back(thnAxisCent); + axesGenFD.push_back(thnAxisCent); } if (storeOccupancy) { - axes.insert(axes.end(), {thnAxisOccupancy}); - axesFD.insert(axesFD.end(), {thnAxisOccupancy}); - axesGenPrompt.insert(axesGenPrompt.end(), {thnAxisOccupancy}); - axesGenFD.insert(axesGenFD.end(), {thnAxisOccupancy}); + axes.push_back(thnAxisOccupancy); + axesFD.push_back(thnAxisOccupancy); + axesGenPrompt.push_back(thnAxisOccupancy); + axesGenFD.push_back(thnAxisOccupancy); + } + if (storePvContributors) { + axes.push_back(thnAxisPvContributors); + axesFD.push_back(thnAxisPvContributors); + axesGenPrompt.push_back(thnAxisPvContributors); + axesGenFD.push_back(thnAxisPvContributors); } - axesFD.insert(axesFD.end(), {thnAxisPtBHad}); - axesFD.insert(axesFD.end(), {thnAxisFlagBHad}); - axesGenFD.insert(axesGenFD.end(), {thnAxisPtBHad}); - axesGenFD.insert(axesGenFD.end(), {thnAxisFlagBHad}); + axesFD.push_back(thnAxisPtBHad); + axesFD.push_back(thnAxisFlagBHad); + axesGenFD.push_back(thnAxisPtBHad); + axesGenFD.push_back(thnAxisFlagBHad); registry.add("hSparseMassPrompt", "THn for Dplus Prompt", HistType::kTHnSparseF, axes); registry.add("hSparseMassFD", "THn for Dplus FD", HistType::kTHnSparseF, axesFD); @@ -267,12 +279,14 @@ struct HfTaskDplus { /// \param flagBHad transverse momentum of beauty mother for nonprompt candidates /// \param centrality collision centrality /// \param occupancy collision occupancy + /// \param numPvContributors contributors to the PV template void fillSparseML(const T1& candidate, float ptbhad, int flagBHad, float centrality, - float occupancy) + float occupancy, + float numPvContributors) { std::vector outputMl = {-999., -999., -999.}; for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { @@ -288,6 +302,8 @@ struct HfTaskDplus { registry.fill(HIST("hSparseMassPrompt"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], centrality); } else if (!storeCentrality && storeOccupancy) { registry.fill(HIST("hSparseMassPrompt"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], occupancy); + } else if (!storeCentrality && !storeOccupancy && storePvContributors) { + registry.fill(HIST("hSparseMassPrompt"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], numPvContributors); } else { registry.fill(HIST("hSparseMassPrompt"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2]); } @@ -300,6 +316,8 @@ struct HfTaskDplus { registry.fill(HIST("hSparseMassFD"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], centrality, ptbhad, flagBHad); } else if (!storeCentrality && storeOccupancy) { registry.fill(HIST("hSparseMassFD"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], occupancy, ptbhad, flagBHad); + } else if (!storeCentrality && !storeOccupancy && storePvContributors) { + registry.fill(HIST("hSparseMassFD"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], numPvContributors); } else { registry.fill(HIST("hSparseMassFD"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], ptbhad, flagBHad); } @@ -312,6 +330,8 @@ struct HfTaskDplus { registry.fill(HIST("hSparseMassBkg"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], centrality); } else if (!storeCentrality && storeOccupancy) { registry.fill(HIST("hSparseMassBkg"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], occupancy); + } else if (!storeCentrality && !storeOccupancy && storePvContributors) { + registry.fill(HIST("hSparseMassBkg"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], numPvContributors); } else { registry.fill(HIST("hSparseMassBkg"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2]); } @@ -324,6 +344,8 @@ struct HfTaskDplus { registry.fill(HIST("hSparseMassNotMatched"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], centrality); } else if (!storeCentrality && storeOccupancy) { registry.fill(HIST("hSparseMassNotMatched"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], occupancy); + } else if (!storeCentrality && !storeOccupancy && storePvContributors) { + registry.fill(HIST("hSparseMassNotMatched"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], numPvContributors); } else { registry.fill(HIST("hSparseMassNotMatched"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2]); } @@ -335,6 +357,8 @@ struct HfTaskDplus { registry.fill(HIST("hSparseMass"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], centrality); } else if (!storeCentrality && storeOccupancy) { registry.fill(HIST("hSparseMass"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], occupancy); + } else if (!storeCentrality && !storeOccupancy && storePvContributors) { + registry.fill(HIST("hSparseMass"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2], numPvContributors); } else { registry.fill(HIST("hSparseMass"), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), outputMl[0], outputMl[1], outputMl[2]); } @@ -416,12 +440,14 @@ struct HfTaskDplus { /// \param flagGenB transverse momentum of beauty mother for nonprompt candidates /// \param centrality collision centrality /// \param occupancy collision occupancy + /// \param numPvContributors contributors to the PV template void fillSparseMcGen(const T1& particle, float ptGenB, int flagGenB, float centrality, - float occupancy) + float occupancy, + float numPvContributors) { auto yGen = RecoDecay::y(particle.pVector(), o2::constants::physics::MassDPlus); if (particle.originMcGen() == RecoDecay::OriginType::Prompt) { @@ -431,6 +457,8 @@ struct HfTaskDplus { registry.fill(HIST("hSparseMassGenPrompt"), particle.pt(), yGen, centrality); } else if (!storeCentrality && storeOccupancy) { registry.fill(HIST("hSparseMassGenPrompt"), particle.pt(), yGen, occupancy); + } else if (!storeCentrality && !storeOccupancy && storePvContributors) { + registry.fill(HIST("hSparseMassGenPrompt"), particle.pt(), yGen, numPvContributors); } else { registry.fill(HIST("hSparseMassGenPrompt"), particle.pt(), yGen); } @@ -441,6 +469,8 @@ struct HfTaskDplus { registry.fill(HIST("hSparseMassGenFD"), particle.pt(), yGen, centrality, ptGenB, flagGenB); } else if (!storeCentrality && storeOccupancy) { registry.fill(HIST("hSparseMassGenFD"), particle.pt(), yGen, occupancy, ptGenB, flagGenB); + } else if (!storeCentrality && !storeOccupancy && storePvContributors) { + registry.fill(HIST("hSparseMassGenFD"), particle.pt(), yGen, numPvContributors, ptGenB, flagGenB); } else { registry.fill(HIST("hSparseMassGenFD"), particle.pt(), yGen, ptGenB, flagGenB); } @@ -454,6 +484,7 @@ struct HfTaskDplus { { float cent{-1.f}; float occ{-1.f}; + float numPvContr{-1.f}; float ptBhad{-1.f}; int flagBHad{-1}; if constexpr (!fillMl) { @@ -477,10 +508,13 @@ struct HfTaskDplus { if (storeOccupancy && occEstimator != OccupancyEstimator::None) { occ = getOccupancyColl(collision, occEstimator); } + if (storePvContributors) { + numPvContr = collision.numContrib(); + } } fillHisto(candidate); - fillSparseML(candidate, ptBhad, flagBHad, cent, occ); + fillSparseML(candidate, ptBhad, flagBHad, cent, occ, numPvContr); } } } @@ -493,6 +527,7 @@ struct HfTaskDplus { { float cent{-1}; float occ{-1}; + float numPvContr{-1}; float ptBhad{-1}; int flagBHad{-1}; @@ -530,11 +565,14 @@ struct HfTaskDplus { if (storeOccupancy && occEstimator != OccupancyEstimator::None) { occ = getOccupancyColl(collision, occEstimator); } + if (storePvContributors) { + numPvContr = collision.numContrib(); + } } fillHisto(candidate); fillHistoMCRec(candidate); - fillSparseML(candidate, ptBhad, flagBHad, cent, occ); + fillSparseML(candidate, ptBhad, flagBHad, cent, occ, numPvContr); } // Bkg ptBhad = -1; @@ -551,8 +589,11 @@ struct HfTaskDplus { if (storeOccupancy && occEstimator != OccupancyEstimator::None) { occ = getOccupancyColl(collision, occEstimator); } + if (storePvContributors) { + numPvContr = collision.numContrib(); + } fillHistoMCRec(candidate); - fillSparseML(candidate, ptBhad, flagBHad, cent, occ); + fillSparseML(candidate, ptBhad, flagBHad, cent, occ, numPvContr); } } } @@ -570,6 +611,7 @@ struct HfTaskDplus { // MC gen. float cent{-1.}; float occ{-1.}; + float numPvContr{-1.}; float ptGenB{-1.}; int flagGenB{-1}; @@ -586,6 +628,7 @@ struct HfTaskDplus { for (const auto& particle : mcParticlesPerGenMcColl) { ptGenB = -1; flagGenB = -1; + numPvContr = -1; auto yGen = RecoDecay::y(particle.pVector(), o2::constants::physics::MassDPlus); if ((yCandGenMax >= 0. && std::abs(yGen) > yCandGenMax) || (std::abs(particle.flagMcMatchGen()) != hf_decay::hf_cand_3prong::DecayChannelMain::DplusToPiKPi)) { continue; @@ -595,9 +638,12 @@ struct HfTaskDplus { flagGenB = getBHadMotherFlag(bHadMother.pdgCode()); ptGenB = bHadMother.pt(); } + for (const auto& recCol : mcRecoCollisions) { + numPvContr = std::max(numPvContr, recCol.numContrib()); + } fillHistoMCGen(particle); if constexpr (fillMl) { - fillSparseMcGen(particle, ptGenB, flagGenB, cent, occ); + fillSparseMcGen(particle, ptGenB, flagGenB, cent, occ, numPvContr); } } } diff --git a/PWGHF/TableProducer/treeCreatorDplusToPiKPi.cxx b/PWGHF/TableProducer/treeCreatorDplusToPiKPi.cxx index b4baa783675..cc684c7003f 100644 --- a/PWGHF/TableProducer/treeCreatorDplusToPiKPi.cxx +++ b/PWGHF/TableProducer/treeCreatorDplusToPiKPi.cxx @@ -145,6 +145,7 @@ DECLARE_SOA_TABLE(HfCandDpLites, "AOD", "HFCANDDPLITE", full::Phi, full::Y, full::Centrality, + collision::NumContrib, hf_cand_3prong::FlagMcMatchRec, hf_cand_3prong::OriginMcRec, hf_cand_3prong::FlagMcDecayChanRec) @@ -370,6 +371,7 @@ struct HfTreeCreatorDplusToPiKPi { candidate.eta(), candidate.phi(), hfHelper.yDplus(candidate), + coll.numContrib(), cent, flagMc, originMc, From 3d43385d9c9be6a372dd844ee61606f7e023d9d1 Mon Sep 17 00:00:00 2001 From: Kaare Endrup Iversen <69893472+kaareendrup@users.noreply.github.com> Date: Fri, 1 Aug 2025 16:17:17 +0200 Subject: [PATCH 181/345] [PWGDQ] Add geometry loading to dilepton-track task (#12355) --- PWGDQ/Tasks/dqEfficiency.cxx | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/PWGDQ/Tasks/dqEfficiency.cxx b/PWGDQ/Tasks/dqEfficiency.cxx index 29f7b79392b..ed62df14a5e 100644 --- a/PWGDQ/Tasks/dqEfficiency.cxx +++ b/PWGDQ/Tasks/dqEfficiency.cxx @@ -1040,9 +1040,18 @@ struct AnalysisSameEventPairing { struct AnalysisDileptonTrack { Produces dileptontrackcandidatesList; OutputObj fOutputList{"output"}; + Service ccdb; + o2::base::MatLayerCylSet* lut = nullptr; + // TODO: For now this is only used to determine the position in the filter bit map for the hadron cut Configurable fConfigTrackCuts{"cfgLeptonCuts", "", "Comma separated list of barrel track cuts"}; Configurable fConfigFillCandidateTable{"cfgFillCandidateTable", false, "Produce a single flat tables with all relevant information dilepton-track candidates"}; + Configurable ccdburl{"ccdburl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable fCorrFullGeo{"cfgCorrFullGeo", false, "Use full geometry to correct for MCS effects in track propagation"}; + Configurable fNoCorr{"cfgNoCorrFwdProp", false, "Do not correct for MCS effects in track propagation"}; + Configurable lutPath{"lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"}; + Configurable geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; + Filter eventFilter = aod::dqanalysisflags::isEventSelected == 1; // Filter dileptonFilter = aod::reducedpair::mass > 2.92f && aod::reducedpair::mass < 3.16f && aod::reducedpair::sign == 0; // Filter dileptonFilter = aod::reducedpair::mass > 2.6f && aod::reducedpair::mass < 3.5f && aod::reducedpair::sign == 0; @@ -1075,6 +1084,21 @@ struct AnalysisDileptonTrack { return; } + ccdb->setURL(ccdburl.value); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + + if (fNoCorr) { + VarManager::SetupFwdDCAFitterNoCorr(); + } else if (fCorrFullGeo) { + if (!o2::base::GeometryManager::isGeometryLoaded()) { + ccdb->get(geoPath); + } + } else { + lut = o2::base::MatLayerCylSet::rectifyPtrFromFile(ccdb->get(lutPath)); + VarManager::SetupMatLUTFwdDCAFitter(lut); + } + TString sigNamesStr = fConfigMCRecSignals.value; std::unique_ptr objRecSigArray(sigNamesStr.Tokenize(",")); TString histNames; From 444709e4fafaa8d544674d8e3a95f3a28a541e3d Mon Sep 17 00:00:00 2001 From: Kaare Endrup Iversen <69893472+kaareendrup@users.noreply.github.com> Date: Fri, 1 Aug 2025 16:26:27 +0200 Subject: [PATCH 182/345] [PWGDQ] Add muon dileptontrack-table to tableReader_withAssoc (#12359) Co-authored-by: ALICE Action Bot --- PWGDQ/Tasks/tableReader_withAssoc.cxx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/PWGDQ/Tasks/tableReader_withAssoc.cxx b/PWGDQ/Tasks/tableReader_withAssoc.cxx index d6b29b461d2..162ff8f86f8 100644 --- a/PWGDQ/Tasks/tableReader_withAssoc.cxx +++ b/PWGDQ/Tasks/tableReader_withAssoc.cxx @@ -94,6 +94,7 @@ DECLARE_SOA_COLUMN(TauxyBcandidate, tauxyBcandidate, float); DECLARE_SOA_COLUMN(TauzBcandidate, tauzBcandidate, float); DECLARE_SOA_COLUMN(CosPBcandidate, cosPBcandidate, float); DECLARE_SOA_COLUMN(Chi2Bcandidate, chi2Bcandidate, float); +DECLARE_SOA_COLUMN(Ptassoc, ptassoc, float); DECLARE_SOA_COLUMN(PINassoc, pINassoc, float); DECLARE_SOA_COLUMN(Etaassoc, etaassoc, float); DECLARE_SOA_COLUMN(Ptpair, ptpair, float); @@ -139,6 +140,9 @@ DECLARE_SOA_COLUMN(LxyeePoleMass, lxyJPsi2eePoleMass, float); DECLARE_SOA_COLUMN(Lzee, lzJPsi2ee, float); DECLARE_SOA_COLUMN(AmbiguousInBunchPairs, AmbiguousJpsiPairsInBunch, bool); DECLARE_SOA_COLUMN(AmbiguousOutOfBunchPairs, AmbiguousJpsiPairsOutOfBunch, bool); +// Candidate columns for JPsi/muon correlations +DECLARE_SOA_COLUMN(DeltaEta, deltaEta, float); +DECLARE_SOA_COLUMN(DeltaPhi, deltaPhi, float); } // namespace dqanalysisflags DECLARE_SOA_TABLE(EventCuts, "AOD", "DQANAEVCUTSA", dqanalysisflags::IsEventSelected); //! joinable to ReducedEvents @@ -163,6 +167,9 @@ DECLARE_SOA_TABLE(BmesonCandidates, "AOD", "DQBMESONSA", dqanalysisflags::TPCNclsassoc, dqanalysisflags::TPCNclsleg1, dqanalysisflags::TPCNclsleg2, dqanalysisflags::TPCChi2assoc, dqanalysisflags::TPCChi2leg1, dqanalysisflags::TPCChi2leg2, dqanalysisflags::IsJpsiFromBSelected, dqanalysisflags::IsBarrelSelected); +DECLARE_SOA_TABLE(JPsiMuonCandidates, "AOD", "DQJPSIMUONA", + dqanalysisflags::DeltaEta, dqanalysisflags::DeltaPhi, + dqanalysisflags::MassDileptonCandidate, dqanalysisflags::Ptpair, dqanalysisflags::Etapair, dqanalysisflags::Ptassoc, dqanalysisflags::Etaassoc); DECLARE_SOA_TABLE(JPsieeCandidates, "AOD", "DQPSEUDOPROPER", dqanalysisflags::Massee, dqanalysisflags::Ptee, dqanalysisflags::Lxyee, dqanalysisflags::LxyeePoleMass, dqanalysisflags::Lzee, dqanalysisflags::AmbiguousInBunchPairs, dqanalysisflags::AmbiguousOutOfBunchPairs); } // namespace o2::aod @@ -2928,6 +2935,7 @@ struct AnalysisAsymmetricPairing { // tracks passing the fConfigTrackCut cut. The dileptons cuts from the same-event pairing task are auto-detected struct AnalysisDileptonTrack { Produces BmesonsTable; + Produces DileptonTrackTable; OutputObj fOutputList{"output"}; Configurable fConfigTrackCuts{"cfgTrackCuts", "kaonPID", "Comma separated list of cuts for the track to be correlated with the dileptons"}; @@ -3349,6 +3357,8 @@ struct AnalysisDileptonTrack { VarManager::FillDileptonHadron(dilepton, track, fValuesHadron); VarManager::FillDileptonTrackVertexing(event, lepton1, lepton2, track, fValuesHadron); + // Fill table for correlation analysis + DileptonTrackTable(fValuesHadron[VarManager::kDeltaEta], fValuesHadron[VarManager::kDeltaPhi], dilepton.mass(), dilepton.pt(), dilepton.eta(), track.pt(), track.eta()); } // Fill histograms for the triplets From 174347f4ba3d85268742d2ba0beb096b4af4af90 Mon Sep 17 00:00:00 2001 From: Chiara De Martin <39315597+ChiaraDeMartin95@users.noreply.github.com> Date: Fri, 1 Aug 2025 18:29:25 +0200 Subject: [PATCH 183/345] [PWGLF] fix index for bkg candidates (#12370) Co-authored-by: Chiara De Martin Co-authored-by: ALICE Action Bot --- PWGLF/TableProducer/Strangeness/cascadeflow.cxx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/cascadeflow.cxx b/PWGLF/TableProducer/Strangeness/cascadeflow.cxx index 9c88eeae252..0b930932754 100644 --- a/PWGLF/TableProducer/Strangeness/cascadeflow.cxx +++ b/PWGLF/TableProducer/Strangeness/cascadeflow.cxx @@ -1552,15 +1552,15 @@ struct cascadeFlow { histos.fill(HIST("hLambdaCandidate"), 2); if (v0.mLambda() > V0Configs.MinMassLambda && v0.mLambda() < V0Configs.MaxMassLambda && v0.mAntiLambda() > V0Configs.MinMassLambda && v0.mAntiLambda() < V0Configs.MaxMassLambda) { histos.fill(HIST("hLambdaCandidate"), 3); - continue; // in case of ambiguity between Lambda and AntiLambda, I skip the particle + continue; // in case of ambiguity between Lambda and AntiLambda, I skip the particle; checked to be zero in range 1.105 - 1.125 } if (v0.mLambda() > V0Configs.MinMassLambda && v0.mLambda() < V0Configs.MaxMassLambda) chargeIndex = 0; else if (v0.mAntiLambda() > V0Configs.MinMassLambda && v0.mAntiLambda() < V0Configs.MaxMassLambda) chargeIndex = 1; else { + chargeIndex = 2; // these are bkg candidates histos.fill(HIST("hLambdaCandidate"), 4); - continue; // in case of ambiguity between Lambda and AntiLambda, I skip the particle } } if (!isSelectedV0[0] && !isSelectedV0[1]) @@ -1601,10 +1601,14 @@ struct cascadeFlow { pzs2Lambda = cosThetaStarProton[0] * std::sin(2 * (v0.phi() - psiT0C)) / lambdav2::AlphaLambda[0] / meanCos2ThetaProtonFromLambda; cos2ThetaLambda = cosThetaStarProton[0] * cosThetaStarProton[0]; cosThetaLambda = cosThetaStarProton[0] / cascadev2::AlphaLambda[0] / meanCos2ThetaProtonFromLambda; - } else { + } else if (chargeIndex == 1) { pzs2Lambda = cosThetaStarProton[1] * std::sin(2 * (v0.phi() - psiT0C)) / lambdav2::AlphaLambda[1] / meanCos2ThetaProtonFromLambda; cos2ThetaLambda = cosThetaStarProton[1] * cosThetaStarProton[1]; cosThetaLambda = cosThetaStarProton[1] / cascadev2::AlphaLambda[1] / meanCos2ThetaProtonFromLambda; + } else { // I treat these bkg candidates as Lambdas for the purpose of calculating Pz + pzs2Lambda = cosThetaStarProton[0] * std::sin(2 * (v0.phi() - psiT0C)) / lambdav2::AlphaLambda[0] / meanCos2ThetaProtonFromLambda; + cos2ThetaLambda = cosThetaStarProton[0] * cosThetaStarProton[0]; + cosThetaLambda = cosThetaStarProton[0] / cascadev2::AlphaLambda[0] / meanCos2ThetaProtonFromLambda; } histos.fill(HIST("hv2CEPvsFT0C"), coll.centFT0C(), v2CEP); From 36134dab7c8a7777bb7268e493a2ea56149471bf Mon Sep 17 00:00:00 2001 From: dajones2 <140733426+dajones2@users.noreply.github.com> Date: Fri, 1 Aug 2025 17:36:54 +0100 Subject: [PATCH 184/345] [PWGJE] Removing random track historam (#12360) --- PWGJE/Tasks/jetHadronRecoil.cxx | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/PWGJE/Tasks/jetHadronRecoil.cxx b/PWGJE/Tasks/jetHadronRecoil.cxx index 22eecf4098e..73128a513d8 100644 --- a/PWGJE/Tasks/jetHadronRecoil.cxx +++ b/PWGJE/Tasks/jetHadronRecoil.cxx @@ -131,7 +131,6 @@ struct JetHadronRecoil { {"hTrack3D", "3D tracks histogram;p_{T};#eta;#phi", {HistType::kTH3F, {{200, 0, 200}, {100, -1.0, 1.0}, {100, 0.0, o2::constants::math::TwoPI}}}}, {"hTrackPtHard", "Tracks vs pThard;#frac{p_{T}}{#hat{p}};p_{T}", {HistType::kTH2F, {{20, 0, 5}, {200, 0, 200}}}}, {"hPartPtHard", "Part vs pThard;#frac{p_{T}}{#hat{p}};p_{T}", {HistType::kTH2F, {{20, 0, 5}, {200, 0, 200}}}}, - {"hPtTrackPtHard", "Track p_{T} vs #hat{p};p_{T};#frac{p_{T}}{#hat{p}}", {HistType::kTH2F, {{200, 0, 200}, {20, 0, 5}}}}, {"hConstituents3D", "3D constituents histogram;p_{T};#eta;#phi", {HistType::kTH3F, {{200, 0, 200}, {100, -1.0, 1.0}, {100, 0.0, o2::constants::math::TwoPI}}}}, {"hReferencePtDPhi", "jet p_{T} vs DPhi;#Delta#phi;p_{T,jet}", {HistType::kTH2F, {{100, 0, o2::constants::math::TwoPI}, {500, -100, 400}}}}, {"hReferencePtDPhiShifts", "rho shifts;#Delta#phi;p_{T,jet};shifts", {HistType::kTH3F, {{100, 0, o2::constants::math::TwoPI}, {500, -100, 400}, {20, 0.0, 2.0}}}}, @@ -214,12 +213,9 @@ struct JetHadronRecoil { bool isSigCol; std::vector phiTTAr; std::vector ptTTAr; - std::vector tracksAr; double phiTT = 0; double ptTT = 0; - double ptRandTrack = 0; int trigNumber = 0; - int trackNumber = 0; int nTT = 0; double leadingPT = 0; double leadingTrackPt = 0; @@ -236,7 +232,6 @@ struct JetHadronRecoil { if (!jetderiveddatautilities::selectTrack(track, trackSelection)) { continue; } - tracksAr.push_back(track.pt()); if (track.pt() > leadingTrackPt) { leadingTrackPt = track.pt(); } @@ -266,10 +261,6 @@ struct JetHadronRecoil { registry.fill(HIST("hPtTrackPtHard"), track.pt(), track.pt() / pTHat, weight); } - trackNumber = rand->Integer(tracksAr.size()); - ptRandTrack = tracksAr[trackNumber]; - registry.fill(HIST("hTrackPtHard"), ptRandTrack / pTHat, ptRandTrack, weight); - if (nTT > 0) { trigNumber = rand->Integer(nTT); phiTT = phiTTAr[trigNumber]; @@ -364,12 +355,9 @@ struct JetHadronRecoil { bool isSigCol; std::vector phiTTAr; std::vector ptTTAr; - std::vector partAr; double phiTT = 0; double ptTT = 0; - double ptRandPart = 0; int trigNumber = 0; - int partNumber = 0; int nTT = 0; double leadingPartPt = 0; double leadingJetPt = 0; @@ -380,7 +368,6 @@ struct JetHadronRecoil { isSigCol = false; for (const auto& particle : particles) { - partAr.push_back(particle.pt()); if (particle.pt() > leadingPartPt) { leadingPartPt = particle.pt(); } @@ -415,10 +402,6 @@ struct JetHadronRecoil { registry.fill(HIST("hPtPartPtHard"), particle.pt(), particle.pt() / pTHat, weight); } - partNumber = rand->Integer(partAr.size()); - ptRandPart = partAr[partNumber]; - registry.fill(HIST("hPartPtHard"), ptRandPart / pTHat, ptRandPart, weight); - if (nTT > 0) { trigNumber = rand->Integer(nTT); phiTT = phiTTAr[trigNumber]; From 0f7ccc090ac2c535be3c301544b5285576cffd95 Mon Sep 17 00:00:00 2001 From: ynishida-style Date: Sat, 2 Aug 2025 01:38:03 +0900 Subject: [PATCH 185/345] [PWGJE] Change the method for measuring energy loss outside the jet (#12326) --- PWGJE/Tasks/jetShape.cxx | 66 ++++++++++++++++++++++++++++++++++------ 1 file changed, 57 insertions(+), 9 deletions(-) diff --git a/PWGJE/Tasks/jetShape.cxx b/PWGJE/Tasks/jetShape.cxx index 3fe14ba6490..15dfd574c97 100644 --- a/PWGJE/Tasks/jetShape.cxx +++ b/PWGJE/Tasks/jetShape.cxx @@ -43,8 +43,8 @@ struct JetShapeTask { Configurable nBinsNSigma{"nBinsNSigma", 101, "Number of nsigma bins"}; Configurable nSigmaMin{"nSigmaMin", -10.1f, "Min value of nsigma"}; Configurable nSigmaMax{"nSigmaMax", 10.1f, "Max value of nsigma"}; - Configurable nBinsP{"nBinsP", 700, "Number of p bins"}; - Configurable nBinsPt{"nBinsPt", 500, "Number of pT bins"}; + Configurable nBinsPForDedx{"nBinsPForDedx", 700, "Number of p bins"}; + Configurable nBinsPForBeta{"nBinsPForBeta", 500, "Number of pT bins"}; Configurable nBinsTpcDedx{"nBinsTpcDedx", 500, "Number of DEdx bins"}; Configurable nBinsTofBeta{"nBinsTofBeta", 350, "Number of Beta bins"}; Configurable pMax{"pMax", 7.0f, "Max value of p"}; @@ -52,6 +52,10 @@ struct JetShapeTask { Configurable nBinsDistance{"nBinsDistance", 7, "Number of distance bins"}; Configurable distanceMax{"distanceMax", 0.7f, "Max value of distance"}; Configurable nSigmaTofCut{"nSigmaTofCut", 2.0f, "Number of sigma cut for TOF PID"}; + Configurable tpcNSigmaPrMin{"tpcNSigmaPrMin", -3.5f, "Min value of tpcNsigmaProton"}; + Configurable tpcNSigmaPrMax{"tpcNSigmaPrMax", 0.5f, "Max value of tpcNsigmaProton"}; + Configurable tpcNSigmaPiMin{"tpcNSigmaPiMin", -0.5f, "Min value of tpcNsigmaPion"}; + Configurable tpcNSigmaPiMax{"tpcNSigmaPiMax", 3.5f, "Max value of tpcNsigmaPion"}; HistogramRegistry registry{"registry", {{"tpcTofPi", "tpcTofPi", {HistType::kTHnSparseD, {{35, 0, pMax}, {nBinsNSigma, nSigmaMin, nSigmaMax}, {nBinsDistance, 0, distanceMax}}}}, @@ -60,11 +64,20 @@ struct JetShapeTask { {"tofPi", "tofPi", {HistType::kTH2F, {{50, 0, ptMax}, {nBinsNSigma, nSigmaMin, nSigmaMax}}}}, {"tpcPr", "tpcPr", {HistType::kTH2F, {{70, 0, pMax}, {nBinsNSigma, nSigmaMin, nSigmaMax}}}}, {"tofPr", "tofPr", {HistType::kTH2F, {{50, 0, ptMax}, {nBinsNSigma, nSigmaMin, nSigmaMax}}}}, - {"tpcDedx", "tpcDedx", {HistType::kTHnSparseD, {{nBinsP, 0, pMax}, {nBinsTpcDedx, 0, 1000}, {nBinsDistance, 0, distanceMax}}}}, - {"tofBeta", "tofBeta", {HistType::kTHnSparseD, {{nBinsPt, 0, ptMax}, {nBinsTofBeta, 0.4, 1.1}, {nBinsDistance, 0, distanceMax}}}}, + {"tpcDedx", "tpcDedx", {HistType::kTHnSparseD, {{nBinsPForDedx, 0, pMax}, {nBinsTpcDedx, 0, 1000}, {nBinsDistance, 0, distanceMax}}}}, + {"tpcDedxOutOfJet", "tpcDedxOutOfJet", {HistType::kTH2F, {{nBinsPForDedx, 0, pMax}, {nBinsTpcDedx, 0, 1000}}}}, + {"tofBeta", "tofBeta", {HistType::kTHnSparseD, {{nBinsPForBeta, 0, pMax}, {nBinsTofBeta, 0.4, 1.1}, {nBinsDistance, 0, distanceMax}}}}, {"pVsPtForProton", "pVsPtForProton", {HistType::kTHnSparseD, {{70, 0, pMax}, {50, 0, ptMax}, {nBinsDistance, 0, distanceMax}}}}, {"pVsPtForPion", "pVsPtPion", {HistType::kTHnSparseD, {{70, 0, pMax}, {50, 0, ptMax}, {nBinsDistance, 0, distanceMax}}}}, {"tofMass", "tofMass", {HistType::kTH1F, {{300, 0, 3}}}}, + {"trackPhi", "trackPhi", {HistType::kTH1F, {{80, -1, 7}}}}, + {"trackEta", "trackEta", {HistType::kTH1F, {{100, -1, 1}}}}, + {"trackTpcNClsCrossedRows", "trackTpcNClsCrossedRows", {HistType::kTH1F, {{50, 0, 200}}}}, + {"trackDcaXY", "trackDcaXY", {HistType::kTH1F, {{40, -10, 10}}}}, + {"trackItsChi2NCl", "trackItsChi2NCl", {HistType::kTH1F, {{60, 0, 30}}}}, + {"trackTpcChi2NCl", "trackTpcChi2NCl", {HistType::kTH1F, {{100, 0, 50}}}}, + {"trackTpcNClsFound", "trackTpcNClsFound", {HistType::kTH1F, {{100, 0, 200}}}}, + {"trackItsNCls", "trackItsNCls", {HistType::kTH1F, {{10, 0, 10}}}}, {"jetPt", "jet pT;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}}, {"jetEta", "jet #eta;#eta_{jet};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}}, {"jetPhi", "jet #phi;#phi_{jet};entries", {HistType::kTH1F, {{80, -1.0, 7.}}}}, @@ -179,6 +192,7 @@ struct JetShapeTask { float ptCorr = jet.pt() - collision.rho() * jet.area(); for (const auto& track : tracks) { + float preDeltaPhi1 = track.phi() - jet.phi(); float deltaPhi1 = RecoDecay::constrainAngle(preDeltaPhi1); float deltaEta = track.eta() - jet.eta(); @@ -200,8 +214,8 @@ struct JetShapeTask { float preDeltaPhiBg1 = track.phi() - phiBg1; float preDeltaPhiBg2 = track.phi() - phiBg2; - float deltaPhiBg1 = RecoDecay::constrainAngle(preDeltaPhiBg1); - float deltaPhiBg2 = RecoDecay::constrainAngle(preDeltaPhiBg2); + float deltaPhiBg1 = RecoDecay::constrainAngle(preDeltaPhiBg1, -o2::constants::math::PI); + float deltaPhiBg2 = RecoDecay::constrainAngle(preDeltaPhiBg2, -o2::constants::math::PI); float distanceBg1 = std::sqrt(deltaEta * deltaEta + deltaPhiBg1 * deltaPhiBg1); float distanceBg2 = std::sqrt(deltaEta * deltaEta + deltaPhiBg2 * deltaPhiBg2); @@ -257,6 +271,16 @@ struct JetShapeTask { // tracks conditions for (const auto& track : tracks) { + + registry.fill(HIST("trackTpcNClsCrossedRows"), track.tpcNClsCrossedRows()); + registry.fill(HIST("trackDcaXY"), track.dcaXY()); + registry.fill(HIST("trackItsChi2NCl"), track.itsChi2NCl()); + registry.fill(HIST("trackTpcChi2NCl"), track.tpcChi2NCl()); + registry.fill(HIST("trackTpcNClsFound"), track.tpcNClsFound()); + registry.fill(HIST("trackItsNCls"), track.itsNCls()); + registry.fill(HIST("trackEta"), track.eta()); + registry.fill(HIST("trackPhi"), track.phi()); + if (std::abs(track.eta()) > etaTrUp) continue; if (track.tpcNClsCrossedRows() < nclcrossTpcMin) @@ -289,18 +313,42 @@ struct JetShapeTask { // calculate distance from jet axis float distance = std::sqrt(deltaEta * deltaEta + deltaPhi1 * deltaPhi1); + // Define perpendicular cone axes in phi + float phiBg1 = jet.phi() + (o2::constants::math::PIHalf); + float phiBg2 = jet.phi() - (o2::constants::math::PIHalf); + + // Calculate delta phi for background cones + float preDeltaPhiBg1 = track.phi() - phiBg1; + float preDeltaPhiBg2 = track.phi() - phiBg2; + float deltaPhiBg1 = RecoDecay::constrainAngle(preDeltaPhiBg1, -o2::constants::math::PI); + float deltaPhiBg2 = RecoDecay::constrainAngle(preDeltaPhiBg2, -o2::constants::math::PI); + + // Calculate distance to background cone axes + // Note: deltaEta is the same for all cones at the same eta + float distanceBg1 = std::sqrt(deltaEta * deltaEta + deltaPhiBg1 * deltaPhiBg1); + float distanceBg2 = std::sqrt(deltaEta * deltaEta + deltaPhiBg2 * deltaPhiBg2); + + // Fill histogram if track is inside one of the perpendicular cones + if (distanceBg1 < jetR || distanceBg2 < jetR) { + registry.fill(HIST("tpcDedxOutOfJet"), track.p(), track.tpcSignal()); + } + registry.fill(HIST("distanceVsTrackpt"), distance, track.pt()); registry.fill(HIST("tpcDedx"), track.p(), track.tpcSignal(), distance); - registry.fill(HIST("tofBeta"), track.pt(), track.beta(), distance); + registry.fill(HIST("tofBeta"), track.p(), track.beta(), distance); if (std::abs(track.tofNSigmaPr()) < nSigmaTofCut) { - registry.fill(HIST("pVsPtForProton"), track.p(), track.pt(), distance); registry.fill(HIST("tpcTofPr"), track.p(), track.tpcNSigmaPr(), distance); + if (track.tpcNSigmaPr() > tpcNSigmaPrMin && track.tpcNSigmaPr() < tpcNSigmaPrMax) { + registry.fill(HIST("pVsPtForProton"), track.p(), track.pt(), distance); + } } if (std::abs(track.tofNSigmaPi()) < nSigmaTofCut) { - registry.fill(HIST("pVsPtForPion"), track.p(), track.pt(), distance); registry.fill(HIST("tpcTofPi"), track.p(), track.tpcNSigmaPi(), distance); + if (track.tpcNSigmaPi() > tpcNSigmaPiMin && track.tpcNSigmaPi() < tpcNSigmaPiMax) { + registry.fill(HIST("pVsPtForPion"), track.p(), track.pt(), distance); + } } } } From 859656821a22ee5b21b36965a28b783e0b7fd4b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= Date: Fri, 1 Aug 2025 19:21:28 +0200 Subject: [PATCH 186/345] O2 linter: Accept (almost) any exception reason (#12342) --- Scripts/o2_linter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Scripts/o2_linter.py b/Scripts/o2_linter.py index af7de5f101b..2aa8fefb24f 100644 --- a/Scripts/o2_linter.py +++ b/Scripts/o2_linter.py @@ -248,7 +248,7 @@ def is_disabled(self, line: str, prefix_comment="//") -> bool: if self.name in line: self.n_disabled += 1 # Look for a comment with a reason for disabling. - if re.search(r" \([\w\s]{3,}\)", line): + if re.search(r" \(.{3,}\)", line): return True return False From 8ad1036fedaaf00cdd096e8075c0325675c538eb Mon Sep 17 00:00:00 2001 From: Gyula Bencedi Date: Fri, 1 Aug 2025 20:29:21 +0200 Subject: [PATCH 187/345] [PWGLF] Fix memory issues (#12373) --- .../GlobalEventProperties/flattenictyPikp.cxx | 487 +++++++++++------- 1 file changed, 291 insertions(+), 196 deletions(-) diff --git a/PWGLF/Tasks/GlobalEventProperties/flattenictyPikp.cxx b/PWGLF/Tasks/GlobalEventProperties/flattenictyPikp.cxx index 56a932dd705..101898b826d 100644 --- a/PWGLF/Tasks/GlobalEventProperties/flattenictyPikp.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/flattenictyPikp.cxx @@ -193,17 +193,18 @@ struct FlattenictyPikp { int runNumber{-1}; Configurable multEst{"multEst", 1, "0: without multiplicity; 1: MultFT0M; 2: MultTPC"}; - Configurable applyCalibGain{"applyCalibGain", true, "equalize detector amplitudes"}; + Configurable applyCalibGain{"applyCalibGain", false, "equalize detector amplitudes"}; Configurable applyCalibVtx{"applyCalibVtx", false, "equalize Amp vs vtx"}; - Configurable applyCalibDeDx{"applyCalibDeDx", true, "calibration of dedx signal"}; + Configurable applyCalibDeDx{"applyCalibDeDx", false, "calibration of dedx signal"}; Configurable cfgFillTrackQaHist{"cfgFillTrackQaHist", false, "fill track QA histograms"}; + Configurable cfgFilldEdxCalibHist{"cfgFilldEdxCalibHist", false, "fill dEdx calibration histograms"}; Configurable cfgFilldEdxQaHist{"cfgFilldEdxQaHist", false, "fill dEdx QA histograms"}; Configurable cfgFillNsigmaQAHist{"cfgFillNsigmaQAHist", false, "fill nsigma QA histograms"}; - Configurable cfgFillChrgType{"cfgFillChrgType", true, "fill histograms per charge types"}; - Configurable> paramsFuncMIPposEta{"paramsFuncMIPposEta", std::vector{-1.f}, "parameters of pol2"}; - Configurable> paramsFuncMIPnegEta{"paramsFuncMIPnegEta", std::vector{-1.f}, "parameters of pol2"}; - Configurable> paramsFuncPlateuPosEta{"paramsFuncPlateuPosEta", std::vector{-1.f}, "parameters of pol2"}; - Configurable> paramsFuncPlateuNegEta{"paramsFuncPlateuNegEta", std::vector{-1.f}, "parameters of pol2"}; + Configurable cfgFillV0Hist{"cfgFillV0Hist", false, "fill V0 histograms"}; + Configurable cfgFillChrgType{"cfgFillChrgType", false, "fill histograms per charge types"}; + Configurable> paramsFuncMIPpos{"paramsFuncMIPpos", std::vector{-1.f}, "parameters of pol2"}; + Configurable> paramsFuncMIPneg{"paramsFuncMIPneg", std::vector{-1.f}, "parameters of pol2"}; + Configurable> paramsFuncMIPall{"paramsFuncMIPall", std::vector{-1.f}, "parameters of pol2"}; Configurable cfgGainEqCcdbPath{"cfgGainEqCcdbPath", "Users/g/gbencedi/flattenicity/GainEq", "CCDB path for gain equalization constants"}; Configurable cfgVtxEqCcdbPath{"cfgVtxEqCcdbPath", "Users/g/gbencedi/flattenicity/ZvtxEq", "CCDB path for z-vertex equalization constants"}; Configurable cfgUseCcdbForRun{"cfgUseCcdbForRun", true, "Get ccdb object based on run number instead of timestamp"}; @@ -227,17 +228,21 @@ struct FlattenictyPikp { struct : ConfigurableGroup { ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0.1, 0.12, 0.14, 0.16, 0.18, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.2, 3.4, 3.6, 3.8, 4.0, 4.5, 5.0, 5.5, 6.0, 6.5, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 18.0, 20.0}, "pT binning"}; - ConfigurableAxis axisMultPerc{"axisMultPerc", {100, 0, 100}, "Multiplicity percentiles binning"}; - ConfigurableAxis axisVertexZ{"axisVertexZ", {60, -15., 15.}, "Vertex z binning"}; + ConfigurableAxis axisFlatPerc{"axisFlatPerc", {102, -0.01, 1.01}, "Flattenicity percentiles binning"}; + ConfigurableAxis axisMultPerc{"axisMultPerc", {20, 0, 100}, "Multiplicity percentiles binning"}; + ConfigurableAxis axisVertexZ{"axisVertexZ", {80, -20., 20.}, "Vertex z binning"}; ConfigurableAxis axisMult{"axisMult", {301, -0.5, 300.5}, "Multiplicity binning"}; ConfigurableAxis axisDCAxy{"axisDCAxy", {200, -5, 5}, "DCAxy binning"}; ConfigurableAxis axisDCAz{"axisDCAz", {200, -5, 5}, "DCAz binning"}; ConfigurableAxis axisPhi = {"axisPhi", {60, 0, constants::math::TwoPI}, "#varphi binning"}; ConfigurableAxis axisPhiMod = {"axisPhiMod", {100, 0, constants::math::PI / 9}, "fmod(#varphi,#pi/9)"}; ConfigurableAxis axisEta = {"axisEta", {8, -0.8, 0.8}, "#eta binning"}; - ConfigurableAxis axisDedx{"axisDedx", {1000, 0, 1000}, "dE/dx binning"}; + ConfigurableAxis axisDedx{"axisDedx", {100, 0, 100}, "dE/dx binning"}; ConfigurableAxis axisNsigmaTPC{"axisNsigmaTPC", {200, -10, 10}, "nsigmaTPC binning"}; ConfigurableAxis axisNsigmaTOF{"axisNsigmaTOF", {200, -10, 10}, "nsigmaTOF binning"}; + ConfigurableAxis axisAmplFV0{"axsAmplFV0", {4096, 0, 4096}, "FV0 amplitude (ADC) binning"}; + ConfigurableAxis axisAmplFV0Sum{"axisAmplFV0Sum", {4096, 0, 4096 * 49}, "FV0 amplitude sum (ADC) binning"}; + ConfigurableAxis axisChannelFV0{"axisChannelFV0", {49, 0., 49.}, "FV0 channel ID binning"}; } binOpt; struct : ConfigurableGroup { @@ -309,22 +314,27 @@ struct FlattenictyPikp { TF1* fPhiCutLow = nullptr; TF1* fPhiCutHigh = nullptr; - std::unique_ptr fDeDxVsEtaPos = nullptr; - std::unique_ptr fDeDxVsEtaNeg = nullptr; - std::unique_ptr fEDeDxVsEtaPos = nullptr; - std::unique_ptr fEDeDxVsEtaNeg = nullptr; + std::vector> fDeDxVsEta; + std::vector> vecParams; void init(InitContext&) { - auto vecParamsMIPposEta = (std::vector)paramsFuncMIPposEta; - auto vecParamsMIPnegEta = (std::vector)paramsFuncMIPnegEta; - auto vecParamsPlateuPosEta = (std::vector)paramsFuncPlateuPosEta; - auto vecParamsPlateuNegEta = (std::vector)paramsFuncPlateuNegEta; + auto vecParamsMIPpos = (std::vector)paramsFuncMIPpos; + auto vecParamsMIPneg = (std::vector)paramsFuncMIPneg; + auto vecParamsMIPall = (std::vector)paramsFuncMIPall; - fDeDxVsEtaPos = setFuncPars(vecParamsMIPposEta); - fDeDxVsEtaNeg = setFuncPars(vecParamsMIPnegEta); - fEDeDxVsEtaPos = setFuncPars(vecParamsPlateuPosEta); - fEDeDxVsEtaNeg = setFuncPars(vecParamsPlateuNegEta); + auto addVec = [&](std::vector>& targetVec, const std::string& name) { + targetVec.emplace_back(vecParamsMIPpos); + targetVec.emplace_back(vecParamsMIPneg); + targetVec.emplace_back(vecParamsMIPall); + if (!vecParams.size()) { + LOG(info) << "size of " << name << "is zero."; + } + }; + addVec(vecParams, "vecParams"); + for (const auto& params : vecParams) { + fDeDxVsEta.emplace_back(setFuncPars(params)); + } ccdb->setURL(ccdbConf.ccdbUrl.value); ccdb->setCaching(true); @@ -353,8 +363,8 @@ struct FlattenictyPikp { const AxisSpec chargeAxis{2, -2.f, 2.f, "Charge"}; const AxisSpec dEdxAxis{binOpt.axisDedx, "TPC dEdx (a.u.)"}; - const AxisSpec vtxzAxis{100, -20, 20, "Z_{vtx} (cm)"}; - const AxisSpec flatAxis{102, -0.01, 1.01, "Flat FV0"}; + const AxisSpec vtxzAxis{binOpt.axisVertexZ, "Z_{vtx} (cm)"}; + const AxisSpec flatAxis{binOpt.axisFlatPerc, "Flat FV0"}; const AxisSpec etaAxis{binOpt.axisEta, "#eta"}; const AxisSpec phiAxis{binOpt.axisPhi, "#varphi"}; const AxisSpec phiAxisMod{binOpt.axisPhiMod, "fmod(#varphi,#pi/9)"}; @@ -366,8 +376,9 @@ struct FlattenictyPikp { const AxisSpec clTpcAxis{160, 0, 160, "Number of clusters in TPC"}; const AxisSpec nSigmaTPCAxis{binOpt.axisNsigmaTPC, "n#sigma_{TPC}"}; const AxisSpec nSigmaTOFAxis{binOpt.axisNsigmaTOF, "n#sigma_{TOF}"}; - const AxisSpec amplitudeFT0 = {5000, 0, 10000, "FT0 amplitude"}; - const AxisSpec channelFT0Axis = {220, 0.0, 220.0, "FT0 channel"}; + const AxisSpec amplitudeFV0{binOpt.axisAmplFV0, "FV0 amplitude (ADC)"}; + const AxisSpec amplitudeFV0Sum{binOpt.axisAmplFV0Sum, "FV0 amplitude sm (ADC)"}; + const AxisSpec channelFV0Axis{binOpt.axisChannelFV0, "FV0 channel ID"}; AxisSpec multAxis{binOpt.axisMultPerc, "multiplicity estimator"}; @@ -385,7 +396,7 @@ struct FlattenictyPikp { } // Event counter - flatchrg.add("Events/hEvtSel", "Number of events; Cut; #Events Passed Cut", {HistType::kTH1D, {{nEvtSel, 0, nEvtSel}}}); + flatchrg.add("Events/hEvtSel", "Number of events; Cut; #Events Passed Cut", {HistType::kTH1F, {{nEvtSel, 0, nEvtSel}}}); flatchrg.get(HIST("Events/hEvtSel"))->GetXaxis()->SetBinLabel(evtSelAll + 1, "Events read"); flatchrg.get(HIST("Events/hEvtSel"))->GetXaxis()->SetBinLabel(evtSelSel8 + 1, "Evt. sel8"); flatchrg.get(HIST("Events/hEvtSel"))->GetXaxis()->SetBinLabel(evtSelNoITSROFrameBorder + 1, "NoITSROFrameBorder"); @@ -397,7 +408,7 @@ struct FlattenictyPikp { flatchrg.get(HIST("Events/hEvtSel"))->GetXaxis()->SetBinLabel(evtSelVtxZ + 1, "Vtx-z pos"); flatchrg.get(HIST("Events/hEvtSel"))->GetXaxis()->SetBinLabel(evtSelINELgt0 + 1, "INEL>0"); // Track counter - flatchrg.add("Tracks/hTrkSel", "Number of tracks; Cut; #Tracks Passed Cut", {HistType::kTH1D, {{nTrkSel, 0, nTrkSel}}}); + flatchrg.add("Tracks/hTrkSel", "Number of tracks; Cut; #Tracks Passed Cut", {HistType::kTH1F, {{nTrkSel, 0, nTrkSel}}}); flatchrg.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelEta + 1, "Eta"); flatchrg.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelPt + 1, "Pt"); flatchrg.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelDCA + 1, "DCA"); @@ -411,50 +422,59 @@ struct FlattenictyPikp { } if (doprocessFlat) { - flatchrg.add("Events/hVtxZ", "Measured vertex z position", HistType::kTH1D, {vtxzAxis}); - flatchrg.add("Events/hFlatVsMultEst", "hFlatVsMultEst", HistType::kTH2D, {flatAxis, multAxis}); - flatchrg.add("Tracks/postSel/hPVsPtEta", "; #it{p} (GeV/#it{c}); #it{p}_{T} (GeV/#it{c}); #eta;", {HistType::kTH3D, {pAxis, ptAxis, etaAxis}}); + flatchrg.add("Events/hVtxZ", "Measured vertex z position", HistType::kTH1F, {vtxzAxis}); + flatchrg.add("Events/hFlatVsMultEst", "hFlatVsMultEst", HistType::kTH2F, {flatAxis, multAxis}); + flatchrg.add("Tracks/postSel/hPVsPtEta", "; #it{p} (GeV/#it{c}); #it{p}_{T} (GeV/#it{c}); #eta;", {HistType::kTH3F, {pAxis, ptAxis, etaAxis}}); if (cfgFillTrackQaHist || cfgFilldEdxQaHist || cfgFillNsigmaQAHist) { if (cfgFillTrackQaHist) { - flatchrg.add("Tracks/postSel/hPtPhi", "; #it{p}_{T} (GeV/#it{c}); fmod(#varphi,#pi/9)", {HistType::kTH2D, {ptAxis, phiAxisMod}}); - flatchrg.add("Tracks/postSel/hPtVsWOcutDCA", "hPtVsWOcutDCA", HistType::kTH2D, {ptAxis, dcaXYAxis}); - flatchrg.add("Tracks/postSel/hPt", "", HistType::kTH1D, {ptAxis}); - flatchrg.add("Tracks/postSel/hPhi", "", HistType::kTH1D, {phiAxis}); - flatchrg.add("Tracks/postSel/hEta", "", HistType::kTH1D, {etaAxis}); - flatchrg.add("Tracks/postSel/hDCAXYvsPt", "", HistType::kTH2D, {ptAxis, dcaXYAxis}); - flatchrg.add("Tracks/postSel/hDCAZvsPt", "", HistType::kTH2D, {ptAxis, dcaZAxis}); + flatchrg.add("Tracks/postSel/hPtPhi", "; #it{p}_{T} (GeV/#it{c}); fmod(#varphi,#pi/9)", {HistType::kTH2F, {ptAxis, phiAxisMod}}); + flatchrg.add("Tracks/postSel/hPtVsWOcutDCA", "hPtVsWOcutDCA", HistType::kTH2F, {ptAxis, dcaXYAxis}); + flatchrg.add("Tracks/postSel/hPt", "", HistType::kTH1F, {ptAxis}); + flatchrg.add("Tracks/postSel/hPhi", "", HistType::kTH1F, {phiAxis}); + flatchrg.add("Tracks/postSel/hEta", "", HistType::kTH1F, {etaAxis}); + flatchrg.add("Tracks/postSel/hDCAXYvsPt", "", HistType::kTH2F, {ptAxis, dcaXYAxis}); + flatchrg.add("Tracks/postSel/hDCAZvsPt", "", HistType::kTH2F, {ptAxis, dcaZAxis}); // tpc - flatchrg.add("Tracks/postSel/hPtPhiTPCCluster", "; #it{p}_{T} (GeV/#it{c}); fmod(#varphi,#pi/9); N_{cluster}", {HistType::kTHnSparseD, {ptAxis, phiAxisMod, clTpcAxis}}); - flatchrg.add("Tracks/postSel/hShTpcClvsPt", "", {HistType::kTH2D, {ptAxis, shCluserAxis}}); - flatchrg.add("Tracks/postSel/hCrossTPCvsPt", "", {HistType::kTH2D, {ptAxis, clTpcAxis}}); - flatchrg.add("Tracks/postSel/hTPCCluster", "N_{cluster}", HistType::kTH1D, {clTpcAxis}); - flatchrg.add("Tracks/postSel/tpcNClsShared", " ; # shared TPC clusters TPC", HistType::kTH1D, {{165, -0.5, 164.5}}); - flatchrg.add("Tracks/postSel/tpcCrossedRows", " ; # crossed TPC rows", HistType::kTH1D, {{165, -0.5, 164.5}}); - flatchrg.add("Tracks/postSel/tpcCrossedRowsOverFindableCls", " ; crossed rows / findable TPC clusters", HistType::kTH1D, {{60, 0.7, 1.3}}); + if (cfgStoreThnSparse) { + flatchrg.add("Tracks/postSel/hPtPhiTPCCluster", "; #it{p}_{T} (GeV/#it{c}); fmod(#varphi,#pi/9); N_{cluster}", {HistType::kTHnSparseF, {ptAxis, phiAxisMod, clTpcAxis}}); + } else { + flatchrg.add("Tracks/postSel/hPtPhiTPCCluster", "; #it{p}_{T} (GeV/#it{c}); fmod(#varphi,#pi/9); N_{cluster}", {HistType::kTH2F, {ptAxis, phiAxisMod}}); + } + flatchrg.add("Tracks/postSel/hShTpcClvsPt", "", {HistType::kTH2F, {ptAxis, shCluserAxis}}); + flatchrg.add("Tracks/postSel/hCrossTPCvsPt", "", {HistType::kTH2F, {ptAxis, clTpcAxis}}); + flatchrg.add("Tracks/postSel/hTPCCluster", "N_{cluster}", HistType::kTH1F, {clTpcAxis}); + flatchrg.add("Tracks/postSel/tpcNClsShared", " ; # shared TPC clusters TPC", HistType::kTH1F, {{165, -0.5, 164.5}}); + flatchrg.add("Tracks/postSel/tpcCrossedRows", " ; # crossed TPC rows", HistType::kTH1F, {{165, -0.5, 164.5}}); + flatchrg.add("Tracks/postSel/tpcCrossedRowsOverFindableCls", " ; crossed rows / findable TPC clusters", HistType::kTH1F, {{60, 0.7, 1.3}}); // its - flatchrg.add("Tracks/postSel/itsNCls", " ; # ITS clusters", HistType::kTH1D, {{8, -0.5, 7.5}}); - flatchrg.add("Tracks/postSel/hChi2ITSTrkSegment", "chi2ITS", HistType::kTH1D, {{100, -0.5, 99.5}}); + flatchrg.add("Tracks/postSel/itsNCls", " ; # ITS clusters", HistType::kTH1F, {{8, -0.5, 7.5}}); + flatchrg.add("Tracks/postSel/hChi2ITSTrkSegment", "chi2ITS", HistType::kTH1F, {{100, -0.5, 99.5}}); // tof - flatchrg.add("Tracks/postSel/hTOFPvsBeta", "Beta from TOF; #it{p} (GeV/#it{c}); #beta", {HistType::kTH2D, {pAxis, {120, 0.0, 1.2}}}); - flatchrg.add("Tracks/postSel/hTOFpi", "Primary Pions from TOF; #eta; #it{p} (GeV/#it{c}); dEdx", {HistType::kTHnSparseD, {etaAxis, pAxis, dEdxAxis}}); + flatchrg.add("Tracks/postSel/hTOFPvsBeta", "Beta from TOF; #it{p} (GeV/#it{c}); #beta", {HistType::kTH2F, {pAxis, {120, 0.0, 1.2}}}); + if (cfgStoreThnSparse) { + flatchrg.add("Tracks/postSel/hTOFpi", "Primary Pions from TOF; #eta; #it{p} (GeV/#it{c}); dEdx", {HistType::kTHnSparseF, {etaAxis, pAxis, dEdxAxis}}); + } else { + flatchrg.add("Tracks/postSel/hTOFpi", "Primary Pions from TOF; #eta; #it{p} (GeV/#it{c}); dEdx", {HistType::kTH3F, {etaAxis, pAxis, dEdxAxis}}); + } } if (cfgFilldEdxQaHist) { - flatchrg.add("Tracks/postCalib/all/hMIP", "; mult; flat; #eta; #LT dE/dx #GT_{MIP, primary tracks};", {HistType::kTHnSparseD, {multAxis, flatAxis, etaAxis, dEdxAxis}}); - flatchrg.add("Tracks/postCalib/all/hPlateau", "; mult; flat; #eta; #LT dE/dx #GT_{Plateau, primary tracks};", {HistType::kTHnSparseD, {multAxis, flatAxis, etaAxis, dEdxAxis}}); - flatchrg.add("Tracks/postCalib/all/hMIPVsEta", "; #eta; #LT dE/dx #GT_{MIP, primary tracks};", {HistType::kTH2D, {etaAxis, dEdxAxis}}); - flatchrg.add("Tracks/postCalib/all/pMIPVsEta", "; #eta; #LT dE/dx #GT_{MIP, primary tracks};", {HistType::kTProfile, {etaAxis}}); - flatchrg.add("Tracks/postCalib/all/hMIPVsPhi", "; #varphi; #LT dE/dx #GT_{MIP, primary tracks};", {HistType::kTH2D, {phiAxis, dEdxAxis}}); + if (cfgStoreThnSparse) { + flatchrg.add("Tracks/postCalib/all/hMIP", "; mult; flat; #eta; #LT dE/dx #GT_{MIP, primary tracks};", {HistType::kTHnSparseF, {multAxis, flatAxis, etaAxis, dEdxAxis}}); + flatchrg.add("Tracks/postCalib/all/hPlateau", "; mult; flat; #eta; #LT dE/dx #GT_{Plateau, primary tracks};", {HistType::kTHnSparseF, {multAxis, flatAxis, etaAxis, dEdxAxis}}); + } else { + flatchrg.add("Tracks/postCalib/all/hMIP", "; #eta; #LT dE/dx #GT_{MIP, primary tracks};", {HistType::kTH2F, {etaAxis, dEdxAxis}}); + flatchrg.add("Tracks/postCalib/all/hPlateau", "; #eta; #LT dE/dx #GT_{Plateau, primary tracks};", {HistType::kTH2F, {etaAxis, dEdxAxis}}); + } + flatchrg.add("Tracks/postCalib/all/hMIPVsPhi", "; #varphi; #LT dE/dx #GT_{MIP, primary tracks};", {HistType::kTH2F, {phiAxis, dEdxAxis}}); flatchrg.add("Tracks/postCalib/all/pMIPVsPhi", "; #varphi; #LT dE/dx #GT_{MIP, primary tracks};", {HistType::kTProfile, {phiAxis}}); - flatchrg.add("Tracks/postCalib/all/hMIPVsPhiVsEta", "; #varphi; #LT dE/dx #GT_{MIP, primary tracks}; #eta;", {HistType::kTH3D, {phiAxis, dEdxAxis, etaAxis}}); - flatchrg.add("Tracks/postCalib/all/hPlateauVsEta", "; #eta; #LT dE/dx #GT_{Plateau, primary tracks};", {HistType::kTH2D, {etaAxis, dEdxAxis}}); - flatchrg.add("Tracks/postCalib/all/pPlateauVsEta", "; #eta; #LT dE/dx #GT_{Plateau, primary tracks};", {HistType::kTProfile, {etaAxis}}); - flatchrg.add("Tracks/postCalib/all/hPlateauVsPhi", "; #varphi; #LT dE/dx #GT_{Plateau, primary tracks};", {HistType::kTH2D, {phiAxis, dEdxAxis}}); + flatchrg.add("Tracks/postCalib/all/hMIPVsPhiVsEta", "; #varphi; #LT dE/dx #GT_{MIP, primary tracks}; #eta;", {HistType::kTH3F, {phiAxis, dEdxAxis, etaAxis}}); + flatchrg.add("Tracks/postCalib/all/hPlateauVsPhi", "; #varphi; #LT dE/dx #GT_{Plateau, primary tracks};", {HistType::kTH2F, {phiAxis, dEdxAxis}}); flatchrg.add("Tracks/postCalib/all/pPlateauVsPhi", "; #varphi; #LT dE/dx #GT_{Plateau, primary tracks};", {HistType::kTProfile, {phiAxis}}); - flatchrg.add("Tracks/postCalib/all/hPlateauVsPhiVsEta", "; #varphi; #LT dE/dx #GT_{Plateau, primary tracks}; #eta;", {HistType::kTH3D, {phiAxis, dEdxAxis, etaAxis}}); + flatchrg.add("Tracks/postCalib/all/hPlateauVsPhiVsEta", "; #varphi; #LT dE/dx #GT_{Plateau, primary tracks}; #eta;", {HistType::kTH3F, {phiAxis, dEdxAxis, etaAxis}}); + flatchrg.addClone("Tracks/postCalib/all/", "Tracks/preCalib/all/"); if (cfgFillChrgType) { flatchrg.addClone("Tracks/postCalib/all/", "Tracks/postCalib/pos/"); flatchrg.addClone("Tracks/postCalib/all/", "Tracks/postCalib/neg/"); - flatchrg.addClone("Tracks/postCalib/all/", "Tracks/preCalib/all/"); flatchrg.addClone("Tracks/preCalib/all/", "Tracks/preCalib/pos/"); flatchrg.addClone("Tracks/preCalib/all/", "Tracks/preCalib/neg/"); } @@ -462,49 +482,61 @@ struct FlattenictyPikp { if (cfgFillNsigmaQAHist) { for (int i = 0; i < NpartChrg; i++) { const std::string strID = Form("/%s/%s", (i < Npart) ? "pos" : "neg", Pid[i % Npart]); - hPtNsigmaTPC[i] = flatchrg.add("Tracks/hPtNsigmaTPC" + strID, " ; p_{T} (GeV/c)", HistType::kTH2D, {ptAxis, nSigmaTPCAxis}); if (cfgStoreThnSparse) { - hThPtNsigmaTPC[i] = flatchrg.add("Tracks/hThPtNsigmaTPC" + strID, " ; p_{T} (GeV/c)", HistType::kTHnSparseD, {ptAxis, nSigmaTPCAxis, multAxis, flatAxis}); + hThPtNsigmaTPC[i] = flatchrg.add("Tracks/hThPtNsigmaTPC" + strID, " ; p_{T} (GeV/c)", HistType::kTHnSparseF, {ptAxis, nSigmaTPCAxis, multAxis, flatAxis}); + } else { + hPtNsigmaTPC[i] = flatchrg.add("Tracks/hPtNsigmaTPC" + strID, " ; p_{T} (GeV/c)", HistType::kTH2F, {ptAxis, nSigmaTPCAxis}); } - hPtNsigmaTOF[i] = flatchrg.add("Tracks/hPtNsigmaTOF" + strID, " ; p_{T} (GeV/c)", HistType::kTH2D, {ptAxis, nSigmaTOFAxis}); - hPtNsigmaTPCTOF[i] = flatchrg.add("Tracks/hPtNsigmaTPCTOF" + strID, PidChrg[i], HistType::kTH2D, {nSigmaTPCAxis, nSigmaTOFAxis}); + hPtNsigmaTOF[i] = flatchrg.add("Tracks/hPtNsigmaTOF" + strID, " ; p_{T} (GeV/c)", HistType::kTH2F, {ptAxis, nSigmaTOFAxis}); + hPtNsigmaTPCTOF[i] = flatchrg.add("Tracks/hPtNsigmaTPCTOF" + strID, PidChrg[i], HistType::kTH2F, {nSigmaTPCAxis, nSigmaTOFAxis}); } } } flatchrg.addClone("Tracks/postSel/", "Tracks/preSel/"); // FV0 QA - flatchrg.add("FV0/hFV0AmplWCalib", "", HistType::kTH2D, {{48, -0.5, 47.5, "channel"}, {500, -0.5, +19999.5, "FV0 amplitude"}}); - flatchrg.add("FV0/hFV0AmplvsVtxzWoCalib", "", HistType::kTH2D, {{30, -15.0, +15.0, "z vtx (cm)"}, {1000, -0.5, +39999.5, "FV0 amplitude"}}); - flatchrg.add("FV0/hFV0AmplvsVtxzCalib", "", HistType::kTH2D, {{30, -15.0, +15.0, "z vtx (cm)"}, {1000, -0.5, +39999.5, "FV0 amplitude"}}); - flatchrg.add("FV0/hFV0amp", "", {HistType::kTH2D, {channelFT0Axis, amplitudeFT0}}); - flatchrg.add("FV0/pFV0amp", "", HistType::kTProfile, {channelFT0Axis}); - flatchrg.add("FV0/hFV0ampCorr", "", {HistType::kTH2D, {channelFT0Axis, amplitudeFT0}}); + flatchrg.add("FV0/hFV0AmplWCalib", "", {HistType::kTH2F, {channelFV0Axis, amplitudeFV0}}); + flatchrg.add("FV0/hFV0AmplvsVtxzWoCalib", "", {HistType::kTH2F, {vtxzAxis, amplitudeFV0Sum}}); + flatchrg.add("FV0/hFV0AmplvsVtxzCalib", "", {HistType::kTH2F, {vtxzAxis, amplitudeFV0Sum}}); + flatchrg.add("FV0/hFV0amp", "", {HistType::kTH2F, {channelFV0Axis, amplitudeFV0}}); + flatchrg.add("FV0/pFV0amp", "", HistType::kTProfile, {channelFV0Axis}); + flatchrg.add("FV0/hFV0ampCorr", "", {HistType::kTH2F, {channelFV0Axis, amplitudeFV0}}); // V0's QA - flatchrg.add("Tracks/V0qa/hV0Pt", "pT", HistType::kTH1D, {{100, 0.0f, 10}}); - flatchrg.add("Tracks/V0qa/hV0ArmPod", ";#alpha; #it{q}_T", HistType::kTH2D, {{200, -1.0f, +1.0f}, {250, 0.0f, 0.25f}}); + flatchrg.add("Tracks/V0qa/hV0Pt", "pT", HistType::kTH1F, {{100, 0.0f, 10}}); + flatchrg.add("Tracks/V0qa/hV0ArmPod", ";#alpha; #it{q}_T", HistType::kTH2F, {{200, -1.0f, +1.0f}, {250, 0.0f, 0.25f}}); // dEdx PID - flatchrg.add({"Tracks/all/hdEdx", "; #eta; mult; flat; #it{p} (GeV/#it{c}); dEdx", {HistType::kTHnSparseD, {etaAxis, multAxis, flatAxis, pAxis, dEdxAxis}}}); + flatchrg.add({"Tracks/all/hdEdx", "; #eta; mult; flat; #it{p} (GeV/#it{c}); dEdx", {HistType::kTHnSparseF, {etaAxis, multAxis, flatAxis, pAxis, dEdxAxis}}}); // Clean samples - flatchrg.add({"Tracks/CleanTof/all/hPiTof", "; #eta; mult; flat; #it{p} (GeV/#it{c}); dEdx", {HistType::kTHnSparseD, {etaAxis, multAxis, flatAxis, pAxis, dEdxAxis}}}); - flatchrg.add({"Tracks/CleanV0/pos/hEV0", "; #eta; mult; flat; #it{p} (GeV/#it{c}); dEdx", {HistType::kTHnSparseD, {etaAxis, multAxis, flatAxis, pAxis, dEdxAxis}}}); - flatchrg.add({"Tracks/CleanV0/pos/hPiV0", "; #eta; mult; flat; #it{p} (GeV/#it{c}); dEdx", {HistType::kTHnSparseD, {etaAxis, multAxis, flatAxis, pAxis, dEdxAxis}}}); - flatchrg.add({"Tracks/CleanV0/pos/hPV0", "; #eta; mult; flat; #it{p} (GeV/#it{c}); dEdx", {HistType::kTHnSparseD, {etaAxis, multAxis, flatAxis, pAxis, dEdxAxis}}}); - flatchrg.addClone("Tracks/CleanV0/pos/", "Tracks/CleanV0/neg/"); + if (cfgFillV0Hist) { + if (cfgStoreThnSparse) { + flatchrg.add({"Tracks/CleanTof/all/hPiTof", "; #eta; mult; flat; #it{p} (GeV/#it{c}); dEdx", {HistType::kTHnSparseF, {etaAxis, multAxis, flatAxis, pAxis, dEdxAxis}}}); + flatchrg.add({"Tracks/CleanV0/pos/hEV0", "; #eta; mult; flat; #it{p} (GeV/#it{c}); dEdx", {HistType::kTHnSparseF, {etaAxis, multAxis, flatAxis, pAxis, dEdxAxis}}}); + flatchrg.add({"Tracks/CleanV0/pos/hPiV0", "; #eta; mult; flat; #it{p} (GeV/#it{c}); dEdx", {HistType::kTHnSparseF, {etaAxis, multAxis, flatAxis, pAxis, dEdxAxis}}}); + flatchrg.add({"Tracks/CleanV0/pos/hPV0", "; #eta; mult; flat; #it{p} (GeV/#it{c}); dEdx", {HistType::kTHnSparseF, {etaAxis, multAxis, flatAxis, pAxis, dEdxAxis}}}); + } else { + flatchrg.add({"Tracks/CleanTof/all/hPiTof", "; #eta; mult; flat; #it{p} (GeV/#it{c}); dEdx", {HistType::kTH3F, {etaAxis, pAxis, dEdxAxis}}}); + flatchrg.add({"Tracks/CleanV0/pos/hEV0", "; #eta; mult; flat; #it{p} (GeV/#it{c}); dEdx", {HistType::kTH3F, {etaAxis, pAxis, dEdxAxis}}}); + flatchrg.add({"Tracks/CleanV0/pos/hPiV0", "; #eta; mult; flat; #it{p} (GeV/#it{c}); dEdx", {HistType::kTH3F, {etaAxis, pAxis, dEdxAxis}}}); + flatchrg.add({"Tracks/CleanV0/pos/hPV0", "; #eta; mult; flat; #it{p} (GeV/#it{c}); dEdx", {HistType::kTH3F, {etaAxis, pAxis, dEdxAxis}}}); + } + flatchrg.addClone("Tracks/CleanV0/pos/", "Tracks/CleanV0/neg/"); + if (cfgFillChrgType) { + flatchrg.addClone("Tracks/CleanTof/all/", "Tracks/CleanTof/pos/"); + flatchrg.addClone("Tracks/CleanTof/all/", "Tracks/CleanTof/neg/"); + } + } if (cfgFillChrgType) { flatchrg.addClone("Tracks/all/", "Tracks/pos/"); flatchrg.addClone("Tracks/all/", "Tracks/neg/"); - flatchrg.addClone("Tracks/CleanTof/all/", "Tracks/CleanTof/pos/"); - flatchrg.addClone("Tracks/CleanTof/all/", "Tracks/CleanTof/neg/"); } } if (doprocessMC) { - auto h = flatchrg.add("hEvtGenRec", "Generated and Reconstructed MC Collisions", kTH1D, {{3, 0.5, 3.5}}); + auto h = flatchrg.add("hEvtGenRec", "Generated and Reconstructed MC Collisions", kTH1F, {{3, 0.5, 3.5}}); h->GetXaxis()->SetBinLabel(1, "Gen coll"); h->GetXaxis()->SetBinLabel(2, "Rec coll"); h->GetXaxis()->SetBinLabel(3, "INEL>0"); - flatchrg.add("hEvtMcGenColls", "Number of events; Cut; #Events Passed Cut", {HistType::kTH1D, {{5, 0.5, 5.5}}}); + flatchrg.add("hEvtMcGenColls", "Number of events; Cut; #Events Passed Cut", {HistType::kTH1F, {{5, 0.5, 5.5}}}); flatchrg.get(HIST("hEvtMcGenColls"))->GetXaxis()->SetBinLabel(1, "Gen. coll"); flatchrg.get(HIST("hEvtMcGenColls"))->GetXaxis()->SetBinLabel(2, "At least 1 reco"); flatchrg.get(HIST("hEvtMcGenColls"))->GetXaxis()->SetBinLabel(3, "Reco. coll."); @@ -512,32 +544,32 @@ struct FlattenictyPikp { for (int i = 0; i < NpartChrg; i++) { const std::string strID = Form("/%s/%s", (i < Npart) ? "pos" : "neg", Pid[i % Npart]); - hPtGenRecEvt[i] = flatchrg.add("Tracks/hPtGenRecEvt" + strID, " ; p_{T} (GeV/c)", HistType::kTH1D, {ptAxis}); - hPtGenPrimRecEvt[i] = flatchrg.add("Tracks/hPtGenPrimRecEvt" + strID, " ; p_{T} (GeV/c)", HistType::kTH1D, {ptAxis}); - hPtEffGenPrim[i] = flatchrg.add("Tracks/hPtEffGenPrim" + strID, " ; p_{T} (GeV/c)", HistType::kTH3D, {multAxis, flatAxis, ptAxis}); - hPtEffGenWeak[i] = flatchrg.add("Tracks/hPtEffGenWeak" + strID, " ; p_{T} (GeV/c)", HistType::kTH3D, {multAxis, flatAxis, ptAxis}); - hPtEffGenMat[i] = flatchrg.add("Tracks/hPtEffGenMat" + strID, " ; p_{T} (GeV/c)", HistType::kTH3D, {multAxis, flatAxis, ptAxis}); - hPtEffRecPrim[i] = flatchrg.add("Tracks/hPtEffRecPrim" + strID, " ; p_{T} (GeV/c)", HistType::kTH3D, {multAxis, flatAxis, ptAxis}); - hPtEffRecWeak[i] = flatchrg.add("Tracks/hPtEffRecWeak" + strID, " ; p_{T} (GeV/c)", HistType::kTH3D, {multAxis, flatAxis, ptAxis}); - hPtEffRecMat[i] = flatchrg.add("Tracks/hPtEffRecMat" + strID, " ; p_{T} (GeV/c)", HistType::kTH3D, {multAxis, flatAxis, ptAxis}); - hDCAxyBadCollPrim[i] = flatchrg.add("Tracks/hDCAxyBadCollPrim" + strID, " ; p_{T} (GeV/c)", HistType::kTH2D, {ptAxis, dcaXYAxis}); - hDCAxyBadCollWeak[i] = flatchrg.add("Tracks/hDCAxyBadCollWeak" + strID, " ; p_{T} (GeV/c)", HistType::kTH2D, {ptAxis, dcaXYAxis}); - hDCAxyBadCollMat[i] = flatchrg.add("Tracks/hDCAxyBadCollMat" + strID, " ; p_{T} (GeV/c)", HistType::kTH2D, {ptAxis, dcaXYAxis}); - hPtVsDCAxyPrim[i] = flatchrg.add("Tracks/hPtVsDCAxyPrim" + strID, " ; p_{T} (GeV/c)", HistType::kTH2D, {ptAxis, dcaXYAxis}); - hPtVsDCAxyWeak[i] = flatchrg.add("Tracks/hPtVsDCAxyWeak" + strID, " ; p_{T} (GeV/c)", HistType::kTH2D, {ptAxis, dcaXYAxis}); - hPtVsDCAxyMat[i] = flatchrg.add("Tracks/hPtVsDCAxyMat" + strID, " ; p_{T} (GeV/c)", HistType::kTH2D, {ptAxis, dcaXYAxis}); - } - - flatchrg.add({"hPtOut", " ; p_{T} (GeV/c)", {HistType::kTH1D, {ptAxis}}}); - flatchrg.add({"hPtOutPrim", " ; p_{T} (GeV/c)", {HistType::kTH1D, {ptAxis}}}); - flatchrg.add({"hPtOutNoEtaCut", " ; p_{T} (GeV/c)", {HistType::kTH1D, {ptAxis}}}); - flatchrg.add({"PtOutFakes", " ; p_{T} (GeV/c)", {HistType::kTH1D, {ptAxis}}}); - flatchrg.add("hPtVsDCAxyPrimAll", "hPtVsDCAxyPrimAll", HistType::kTH2D, {ptAxis, dcaXYAxis}); - flatchrg.add("hPtVsDCAxyWeakAll", "hPtVsDCAxyWeakAll", HistType::kTH2D, {ptAxis, dcaXYAxis}); - flatchrg.add("hPtVsDCAxyMatAll", "hPtVsDCAxyMatAll", HistType::kTH2D, {ptAxis, dcaXYAxis}); - flatchrg.add("hPtVsDCAxyAll", "hPtVsDCAxyAll", HistType::kTH2D, {ptAxis, dcaXYAxis}); - flatchrg.add({"ResponseGen", " ; N_{part}; F_{FV0};", {HistType::kTHnSparseD, {multAxis, flatAxis}}}); - flatchrg.add("h1flatencityFV0MCGen", "", HistType::kTH1D, {{102, -0.01, 1.01, "1-flatencityFV0"}}); + hPtGenRecEvt[i] = flatchrg.add("Tracks/hPtGenRecEvt" + strID, " ; p_{T} (GeV/c)", HistType::kTH1F, {ptAxis}); + hPtGenPrimRecEvt[i] = flatchrg.add("Tracks/hPtGenPrimRecEvt" + strID, " ; p_{T} (GeV/c)", HistType::kTH1F, {ptAxis}); + hPtEffGenPrim[i] = flatchrg.add("Tracks/hPtEffGenPrim" + strID, " ; p_{T} (GeV/c)", HistType::kTH3F, {multAxis, flatAxis, ptAxis}); + hPtEffGenWeak[i] = flatchrg.add("Tracks/hPtEffGenWeak" + strID, " ; p_{T} (GeV/c)", HistType::kTH3F, {multAxis, flatAxis, ptAxis}); + hPtEffGenMat[i] = flatchrg.add("Tracks/hPtEffGenMat" + strID, " ; p_{T} (GeV/c)", HistType::kTH3F, {multAxis, flatAxis, ptAxis}); + hPtEffRecPrim[i] = flatchrg.add("Tracks/hPtEffRecPrim" + strID, " ; p_{T} (GeV/c)", HistType::kTH3F, {multAxis, flatAxis, ptAxis}); + hPtEffRecWeak[i] = flatchrg.add("Tracks/hPtEffRecWeak" + strID, " ; p_{T} (GeV/c)", HistType::kTH3F, {multAxis, flatAxis, ptAxis}); + hPtEffRecMat[i] = flatchrg.add("Tracks/hPtEffRecMat" + strID, " ; p_{T} (GeV/c)", HistType::kTH3F, {multAxis, flatAxis, ptAxis}); + hDCAxyBadCollPrim[i] = flatchrg.add("Tracks/hDCAxyBadCollPrim" + strID, " ; p_{T} (GeV/c)", HistType::kTH2F, {ptAxis, dcaXYAxis}); + hDCAxyBadCollWeak[i] = flatchrg.add("Tracks/hDCAxyBadCollWeak" + strID, " ; p_{T} (GeV/c)", HistType::kTH2F, {ptAxis, dcaXYAxis}); + hDCAxyBadCollMat[i] = flatchrg.add("Tracks/hDCAxyBadCollMat" + strID, " ; p_{T} (GeV/c)", HistType::kTH2F, {ptAxis, dcaXYAxis}); + hPtVsDCAxyPrim[i] = flatchrg.add("Tracks/hPtVsDCAxyPrim" + strID, " ; p_{T} (GeV/c)", HistType::kTH2F, {ptAxis, dcaXYAxis}); + hPtVsDCAxyWeak[i] = flatchrg.add("Tracks/hPtVsDCAxyWeak" + strID, " ; p_{T} (GeV/c)", HistType::kTH2F, {ptAxis, dcaXYAxis}); + hPtVsDCAxyMat[i] = flatchrg.add("Tracks/hPtVsDCAxyMat" + strID, " ; p_{T} (GeV/c)", HistType::kTH2F, {ptAxis, dcaXYAxis}); + } + + flatchrg.add({"hPtOut", " ; p_{T} (GeV/c)", {HistType::kTH1F, {ptAxis}}}); + flatchrg.add({"hPtOutPrim", " ; p_{T} (GeV/c)", {HistType::kTH1F, {ptAxis}}}); + flatchrg.add({"hPtOutNoEtaCut", " ; p_{T} (GeV/c)", {HistType::kTH1F, {ptAxis}}}); + flatchrg.add({"PtOutFakes", " ; p_{T} (GeV/c)", {HistType::kTH1F, {ptAxis}}}); + flatchrg.add("hPtVsDCAxyPrimAll", "hPtVsDCAxyPrimAll", HistType::kTH2F, {ptAxis, dcaXYAxis}); + flatchrg.add("hPtVsDCAxyWeakAll", "hPtVsDCAxyWeakAll", HistType::kTH2F, {ptAxis, dcaXYAxis}); + flatchrg.add("hPtVsDCAxyMatAll", "hPtVsDCAxyMatAll", HistType::kTH2F, {ptAxis, dcaXYAxis}); + flatchrg.add("hPtVsDCAxyAll", "hPtVsDCAxyAll", HistType::kTH2F, {ptAxis, dcaXYAxis}); + flatchrg.add({"ResponseGen", " ; N_{part}; F_{FV0};", {HistType::kTHnSparseF, {multAxis, flatAxis}}}); + flatchrg.add("h1flatencityFV0MCGen", "", HistType::kTH1F, {{102, -0.01, 1.01, "1-flatencityFV0"}}); // Hash list for efficiency listEfficiency.setObject(new THashList); @@ -553,37 +585,40 @@ struct FlattenictyPikp { if (doprocessMCclosure) { for (int i = 0; i < Npart; i++) { - flatchrg.add({fmt::format(kPtMCclosurePrimF.data(), kSpeciesAll[i]).c_str(), " ; p_{T} (GeV/c)", {HistType::kTH3D, {multAxis, flatAxis, ptAxis}}}); + flatchrg.add({fmt::format(kPtMCclosurePrimF.data(), kSpeciesAll[i]).c_str(), " ; p_{T} (GeV/c)", {HistType::kTH3F, {multAxis, flatAxis, ptAxis}}}); } } if (doprocessSgnLoss) { - flatchrg.add("hFlatMCGenRecColl", "hFlatMCGenRecColl", {HistType::kTH1D, {flatAxis}}); - flatchrg.add("hFlatMCGen", "hFlatMCGen", {HistType::kTH1D, {flatAxis}}); + flatchrg.add("hFlatMCGenRecColl", "hFlatMCGenRecColl", {HistType::kTH1F, {flatAxis}}); + flatchrg.add("hFlatMCGen", "hFlatMCGen", {HistType::kTH1F, {flatAxis}}); // Event counter - flatchrg.add("hEvtMcGen", "hEvtMcGen", {HistType::kTH1D, {{4, 0.f, 4.f}}}); + flatchrg.add("hEvtMcGen", "hEvtMcGen", {HistType::kTH1F, {{4, 0.f, 4.f}}}); flatchrg.get(HIST("hEvtMcGen"))->GetXaxis()->SetBinLabel(1, "all"); flatchrg.get(HIST("hEvtMcGen"))->GetXaxis()->SetBinLabel(2, "z-vtx"); flatchrg.get(HIST("hEvtMcGen"))->GetXaxis()->SetBinLabel(3, "INELgt0"); - flatchrg.add("hEvtMCRec", "hEvtMCRec", {HistType::kTH1D, {{4, 0.f, 4.f}}}); + flatchrg.add("hEvtMCRec", "hEvtMCRec", {HistType::kTH1F, {{4, 0.f, 4.f}}}); flatchrg.get(HIST("hEvtMCRec"))->GetXaxis()->SetBinLabel(1, "all"); flatchrg.get(HIST("hEvtMCRec"))->GetXaxis()->SetBinLabel(2, "evt sel"); flatchrg.get(HIST("hEvtMCRec"))->GetXaxis()->SetBinLabel(3, "INELgt0"); - flatchrg.add("hEvtMcGenRecColl", "hEvtMcGenRecColl", {HistType::kTH1D, {{2, 0.f, 2.f}}}); + flatchrg.add("hEvtMcGenRecColl", "hEvtMcGenRecColl", {HistType::kTH1F, {{2, 0.f, 2.f}}}); flatchrg.get(HIST("hEvtMcGenRecColl"))->GetXaxis()->SetBinLabel(1, "INEL"); flatchrg.get(HIST("hEvtMcGenRecColl"))->GetXaxis()->SetBinLabel(2, "INELgt0"); - flatchrg.add("hFlatGenINELgt0", "hFlatGenINELgt0", {HistType::kTH1D, {flatAxis}}); + flatchrg.add("hFlatGenINELgt0", "hFlatGenINELgt0", {HistType::kTH1F, {flatAxis}}); for (int i = 0; i < NpartChrg; ++i) { - flatchrg.add({fmt::format(kPtGenPrimSgnF.data(), kSpecies[i]).c_str(), " ; p_{T} (GeV/c)", {HistType::kTH3D, {multAxis, flatAxis, ptAxis}}}); - flatchrg.add({fmt::format(kPtGenPrimSgnINELF.data(), kSpecies[i]).c_str(), " ; p_{T} (GeV/c)", {HistType::kTH3D, {multAxis, flatAxis, ptAxis}}}); - flatchrg.add({fmt::format(kPtRecCollPrimSgnF.data(), kSpecies[i]).c_str(), " ; p_{T} (GeV/c)", {HistType::kTH3D, {multAxis, flatAxis, ptAxis}}}); - flatchrg.add({fmt::format(kPtRecCollPrimSgnINELF.data(), kSpecies[i]).c_str(), " ; p_{T} (GeV/c)", {HistType::kTH3D, {multAxis, flatAxis, ptAxis}}}); - flatchrg.add({fmt::format(kPtGenRecCollPrimSgnF.data(), kSpecies[i]).c_str(), " ; p_{T} (GeV/c)", {HistType::kTH3D, {multAxis, flatAxis, ptAxis}}}); - flatchrg.add({fmt::format(kPtGenRecCollPrimSgnINELF.data(), kSpecies[i]).c_str(), " ; p_{T} (GeV/c)", {HistType::kTH3D, {multAxis, flatAxis, ptAxis}}}); + flatchrg.add({fmt::format(kPtGenPrimSgnF.data(), kSpecies[i]).c_str(), " ; p_{T} (GeV/c)", {HistType::kTH3F, {multAxis, flatAxis, ptAxis}}}); + flatchrg.add({fmt::format(kPtGenPrimSgnINELF.data(), kSpecies[i]).c_str(), " ; p_{T} (GeV/c)", {HistType::kTH3F, {multAxis, flatAxis, ptAxis}}}); + flatchrg.add({fmt::format(kPtRecCollPrimSgnF.data(), kSpecies[i]).c_str(), " ; p_{T} (GeV/c)", {HistType::kTH3F, {multAxis, flatAxis, ptAxis}}}); + flatchrg.add({fmt::format(kPtRecCollPrimSgnINELF.data(), kSpecies[i]).c_str(), " ; p_{T} (GeV/c)", {HistType::kTH3F, {multAxis, flatAxis, ptAxis}}}); + flatchrg.add({fmt::format(kPtGenRecCollPrimSgnF.data(), kSpecies[i]).c_str(), " ; p_{T} (GeV/c)", {HistType::kTH3F, {multAxis, flatAxis, ptAxis}}}); + flatchrg.add({fmt::format(kPtGenRecCollPrimSgnINELF.data(), kSpecies[i]).c_str(), " ; p_{T} (GeV/c)", {HistType::kTH3F, {multAxis, flatAxis, ptAxis}}}); } } + + LOG(info) << "Size of the histograms:"; + flatchrg.print(); } void initCCDB(aod::BCsWithTimestamps::iterator const& bc) @@ -701,7 +736,6 @@ struct FlattenictyPikp { for (const auto& track : tracks) { float dEdx = track.tpcSignal(); - bool posP = (track.sign() * track.tpcInnerParam() > 0) ? true : false; if (cfgFillTrackQaHist) { fillTrackQA(track); } @@ -711,98 +745,145 @@ struct FlattenictyPikp { if (cfgFillTrackQaHist) { fillTrackQA(track); } - if (cfgFilldEdxQaHist) { - filldEdxQA(track, collision, dEdx); - if (posP) { - filldEdxQA(track, collision, dEdx); + if (cfgFilldEdxCalibHist && cfgFilldEdxQaHist) { + if (cfgFillChrgType) { + if (track.sign() * track.tpcInnerParam() > 0) { + filldEdxQA(track, collision, dEdx); + } else { + filldEdxQA(track, collision, dEdx); + } } else { - filldEdxQA(track, collision, dEdx); + filldEdxQA(track, collision, dEdx); } } if (applyCalibDeDx) { - dEdx *= (50.0 / getCalibration(true, track.eta())); - } - if (cfgFilldEdxQaHist) { - filldEdxQA(track, collision, dEdx); - if (posP) { - filldEdxQA(track, collision, dEdx); + if (cfgFillChrgType) { + dEdx *= (50.0 / getCalibration(fDeDxVsEta, track)); + if (cfgFilldEdxQaHist) { + if (track.sign() * track.tpcInnerParam() > 0) { + filldEdxQA(track, collision, dEdx); + } else { + filldEdxQA(track, collision, dEdx); + } + } } else { - filldEdxQA(track, collision, dEdx); + dEdx *= (50.0 / getCalibration(fDeDxVsEta, track)); + if (cfgFilldEdxQaHist) { + filldEdxQA(track, collision, dEdx); + } } } // PID TPC dEdx - flatchrg.fill(HIST(kPrefix) + HIST(kCharge[kAll]) + HIST("hdEdx"), track.eta(), mult, flat, track.tpcInnerParam(), dEdx); - if (posP) { - flatchrg.fill(HIST(kPrefix) + HIST(kCharge[kPos]) + HIST("hdEdx"), track.eta(), mult, flat, track.tpcInnerParam(), dEdx); + if (cfgFillChrgType) { + if (track.sign() * track.tpcInnerParam() > 0) { + flatchrg.fill(HIST(kPrefix) + HIST(kCharge[kPos]) + HIST("hdEdx"), track.eta(), mult, flat, track.tpcInnerParam(), dEdx); + } else { + flatchrg.fill(HIST(kPrefix) + HIST(kCharge[kNeg]) + HIST("hdEdx"), track.eta(), mult, flat, track.tpcInnerParam(), dEdx); + } } else { - flatchrg.fill(HIST(kPrefix) + HIST(kCharge[kNeg]) + HIST("hdEdx"), track.eta(), mult, flat, track.tpcInnerParam(), dEdx); + flatchrg.fill(HIST(kPrefix) + HIST(kCharge[kAll]) + HIST("hdEdx"), track.eta(), mult, flat, track.tpcInnerParam(), dEdx); } // TOF pions - if (track.hasTOF() && track.beta() > 1.) { - if (selTOFPi(track)) { - flatchrg.fill(HIST(kPrefixCleanTof) + HIST(kCharge[kAll]) + HIST("hPiTof"), track.eta(), mult, flat, track.tpcInnerParam(), dEdx); - if (posP) { - flatchrg.fill(HIST(kPrefixCleanTof) + HIST(kCharge[kPos]) + HIST("hPiTof"), track.eta(), mult, flat, track.tpcInnerParam(), dEdx); - } else { - flatchrg.fill(HIST(kPrefixCleanTof) + HIST(kCharge[kNeg]) + HIST("hPiTof"), track.eta(), mult, flat, track.tpcInnerParam(), dEdx); + if (cfgFillV0Hist) { + if (track.hasTOF() && track.beta() > 1.) { + if (selTOFPi(track)) { + if (cfgFillChrgType) { + if (track.sign() * track.tpcInnerParam() > 0) { + if (cfgStoreThnSparse) { + flatchrg.fill(HIST(kPrefixCleanTof) + HIST(kCharge[kPos]) + HIST("hPiTof"), track.eta(), mult, flat, track.tpcInnerParam(), dEdx); + } else { + flatchrg.fill(HIST(kPrefixCleanTof) + HIST(kCharge[kPos]) + HIST("hPiTof"), track.eta(), track.tpcInnerParam(), dEdx); + } + } else { + if (cfgStoreThnSparse) { + flatchrg.fill(HIST(kPrefixCleanTof) + HIST(kCharge[kNeg]) + HIST("hPiTof"), track.eta(), mult, flat, track.tpcInnerParam(), dEdx); + } else { + flatchrg.fill(HIST(kPrefixCleanTof) + HIST(kCharge[kNeg]) + HIST("hPiTof"), track.eta(), track.tpcInnerParam(), dEdx); + } + } + } else { + if (cfgStoreThnSparse) { + flatchrg.fill(HIST(kPrefixCleanTof) + HIST(kCharge[kAll]) + HIST("hPiTof"), track.eta(), mult, flat, track.tpcInnerParam(), dEdx); + } else { + flatchrg.fill(HIST(kPrefixCleanTof) + HIST(kCharge[kAll]) + HIST("hPiTof"), track.eta(), track.tpcInnerParam(), dEdx); + } + } } } } } // V0s - for (const auto& v0 : v0s) { - if (!isGoodV0Track(v0, tracks)) { - continue; - } + if (cfgFillV0Hist) { + for (const auto& v0 : v0s) { + if (!isGoodV0Track(v0, tracks)) { + continue; + } - const auto& posTrack = v0.template posTrack_as(); - const auto& negTrack = v0.template negTrack_as(); - float dEdxPos = posTrack.tpcSignal(); - float dEdxNeg = negTrack.tpcSignal(); + const auto& posTrack = v0.template posTrack_as(); + const auto& negTrack = v0.template negTrack_as(); + float dEdxPos = posTrack.tpcSignal(); + float dEdxNeg = negTrack.tpcSignal(); - if (applyCalibDeDx) { - dEdxPos *= (50.0 / getCalibration(true, posTrack.eta())); - dEdxNeg *= (50.0 / getCalibration(true, negTrack.eta())); - } + if (applyCalibDeDx) { + dEdxPos *= (50.0 / getCalibration(fDeDxVsEta, posTrack)); + dEdxNeg *= (50.0 / getCalibration(fDeDxVsEta, negTrack)); + } - if (selectTypeV0s(v0, posTrack, negTrack) == kGa) { // Gamma selection - flatchrg.fill(HIST(kPrefixCleanV0) + HIST(kCharge[kPos]) + HIST("hEV0"), posTrack.eta(), mult, flat, posTrack.sign() * posTrack.tpcInnerParam(), dEdxPos); - flatchrg.fill(HIST(kPrefixCleanV0) + HIST(kCharge[kNeg]) + HIST("hEV0"), negTrack.eta(), mult, flat, negTrack.sign() * negTrack.tpcInnerParam(), dEdxNeg); - } - if (selectTypeV0s(v0, posTrack, negTrack) == kKz) { // K0S -> pi + pi - flatchrg.fill(HIST(kPrefixCleanV0) + HIST(kCharge[kPos]) + HIST("hPiV0"), posTrack.eta(), mult, flat, posTrack.sign() * posTrack.tpcInnerParam(), dEdxPos); - flatchrg.fill(HIST(kPrefixCleanV0) + HIST(kCharge[kNeg]) + HIST("hPiV0"), negTrack.eta(), mult, flat, negTrack.sign() * negTrack.tpcInnerParam(), dEdxNeg); - } - if (selectTypeV0s(v0, posTrack, negTrack) == kLam) { // L -> p + pi- - flatchrg.fill(HIST(kPrefixCleanV0) + HIST(kCharge[kPos]) + HIST("hPV0"), posTrack.eta(), mult, flat, posTrack.sign() * posTrack.tpcInnerParam(), dEdxPos); - flatchrg.fill(HIST(kPrefixCleanV0) + HIST(kCharge[kNeg]) + HIST("hPV0"), negTrack.eta(), mult, flat, negTrack.sign() * negTrack.tpcInnerParam(), dEdxNeg); - } - if (selectTypeV0s(v0, posTrack, negTrack) == kaLam) { // L -> p + pi- - flatchrg.fill(HIST(kPrefixCleanV0) + HIST(kCharge[kPos]) + HIST("hPiV0"), posTrack.eta(), mult, flat, posTrack.sign() * posTrack.tpcInnerParam(), dEdxPos); - flatchrg.fill(HIST(kPrefixCleanV0) + HIST(kCharge[kNeg]) + HIST("hPiV0"), negTrack.eta(), mult, flat, negTrack.sign() * negTrack.tpcInnerParam(), dEdxNeg); + if (selectTypeV0s(v0, posTrack, negTrack) == kGa) { // Gamma selection + if (cfgStoreThnSparse) { + flatchrg.fill(HIST(kPrefixCleanV0) + HIST(kCharge[kPos]) + HIST("hEV0"), posTrack.eta(), mult, flat, posTrack.sign() * posTrack.tpcInnerParam(), dEdxPos); + flatchrg.fill(HIST(kPrefixCleanV0) + HIST(kCharge[kNeg]) + HIST("hEV0"), negTrack.eta(), mult, flat, negTrack.sign() * negTrack.tpcInnerParam(), dEdxNeg); + } else { + flatchrg.fill(HIST(kPrefixCleanV0) + HIST(kCharge[kPos]) + HIST("hEV0"), posTrack.eta(), posTrack.sign() * posTrack.tpcInnerParam(), dEdxPos); + flatchrg.fill(HIST(kPrefixCleanV0) + HIST(kCharge[kNeg]) + HIST("hEV0"), negTrack.eta(), negTrack.sign() * negTrack.tpcInnerParam(), dEdxNeg); + } + } + if (selectTypeV0s(v0, posTrack, negTrack) == kKz) { // K0S -> pi + pi + if (cfgStoreThnSparse) { + flatchrg.fill(HIST(kPrefixCleanV0) + HIST(kCharge[kPos]) + HIST("hPiV0"), posTrack.eta(), mult, flat, posTrack.sign() * posTrack.tpcInnerParam(), dEdxPos); + flatchrg.fill(HIST(kPrefixCleanV0) + HIST(kCharge[kNeg]) + HIST("hPiV0"), negTrack.eta(), mult, flat, negTrack.sign() * negTrack.tpcInnerParam(), dEdxNeg); + } else { + flatchrg.fill(HIST(kPrefixCleanV0) + HIST(kCharge[kPos]) + HIST("hPiV0"), posTrack.eta(), posTrack.sign() * posTrack.tpcInnerParam(), dEdxPos); + flatchrg.fill(HIST(kPrefixCleanV0) + HIST(kCharge[kNeg]) + HIST("hPiV0"), negTrack.eta(), negTrack.sign() * negTrack.tpcInnerParam(), dEdxNeg); + } + } + if (selectTypeV0s(v0, posTrack, negTrack) == kLam) { // L -> p + pi- + if (cfgStoreThnSparse) { + flatchrg.fill(HIST(kPrefixCleanV0) + HIST(kCharge[kPos]) + HIST("hPV0"), posTrack.eta(), mult, flat, posTrack.sign() * posTrack.tpcInnerParam(), dEdxPos); + flatchrg.fill(HIST(kPrefixCleanV0) + HIST(kCharge[kNeg]) + HIST("hPV0"), negTrack.eta(), mult, flat, negTrack.sign() * negTrack.tpcInnerParam(), dEdxNeg); + } else { + flatchrg.fill(HIST(kPrefixCleanV0) + HIST(kCharge[kPos]) + HIST("hPV0"), posTrack.eta(), posTrack.sign() * posTrack.tpcInnerParam(), dEdxPos); + flatchrg.fill(HIST(kPrefixCleanV0) + HIST(kCharge[kNeg]) + HIST("hPV0"), negTrack.eta(), negTrack.sign() * negTrack.tpcInnerParam(), dEdxNeg); + } + } + if (selectTypeV0s(v0, posTrack, negTrack) == kaLam) { // L -> p + pi- + if (cfgStoreThnSparse) { + flatchrg.fill(HIST(kPrefixCleanV0) + HIST(kCharge[kPos]) + HIST("hPiV0"), posTrack.eta(), mult, flat, posTrack.sign() * posTrack.tpcInnerParam(), dEdxPos); + flatchrg.fill(HIST(kPrefixCleanV0) + HIST(kCharge[kNeg]) + HIST("hPiV0"), negTrack.eta(), mult, flat, negTrack.sign() * negTrack.tpcInnerParam(), dEdxNeg); + } else { + flatchrg.fill(HIST(kPrefixCleanV0) + HIST(kCharge[kPos]) + HIST("hPiV0"), posTrack.eta(), posTrack.sign() * posTrack.tpcInnerParam(), dEdxPos); + flatchrg.fill(HIST(kPrefixCleanV0) + HIST(kCharge[kNeg]) + HIST("hPiV0"), negTrack.eta(), negTrack.sign() * negTrack.tpcInnerParam(), dEdxNeg); + } + } } } } - float getCalibration(bool isMIP, const float& eta) + template + float getCalibration(std::vector> const& fCalib, V const& track) { - double valCalib = 999.0; - if (eta < 0.) { - if (isMIP) { - valCalib = fDeDxVsEtaNeg->Eval(eta); - // LOGF(info, "--------> \t fDeDxVsEtaNeg->Eval(%f) = %f", eta, valCalib); + float valCalib = -1.; + if constexpr (isChrg) { + if (track.sign() * track.tpcInnerParam() > 0) { + valCalib = fCalib.at(0)->Eval(track.eta()); } else { - valCalib = fEDeDxVsEtaNeg->Eval(eta); + valCalib = fCalib.at(1)->Eval(track.eta()); } } else { - if (isMIP) { - valCalib = fDeDxVsEtaPos->Eval(eta); - } else { - valCalib = fEDeDxVsEtaPos->Eval(eta); - } + valCalib = fCalib.at(2)->Eval(track.eta()); } return valCalib; } @@ -837,7 +918,11 @@ struct FlattenictyPikp { if (cfgFillTrackQaHist) { flatchrg.fill(HIST("Tracks/preSel/hPtPhi"), track.pt(), phimodn); if (track.hasTPC() && track.hasITS()) { - flatchrg.fill(HIST("Tracks/preSel/hPtPhiTPCCluster"), track.pt(), phimodn, track.tpcNClsFindable() - track.tpcNClsFindableMinusFound()); + if (cfgStoreThnSparse) { + flatchrg.fill(HIST("Tracks/preSel/hPtPhiTPCCluster"), track.pt(), phimodn, track.tpcNClsFindable() - track.tpcNClsFindableMinusFound()); + } else { + flatchrg.fill(HIST("Tracks/preSel/hPtPhiTPCCluster"), track.pt(), phimodn); + } } } if (phimodn < fphiCutHigh->Eval(track.pt()) && phimodn > fphiCutLow->Eval(track.pt())) { @@ -846,7 +931,11 @@ struct FlattenictyPikp { if (cfgFillTrackQaHist) { flatchrg.fill(HIST("Tracks/postSel/hPtPhi"), track.pt(), phimodn); if (track.hasTPC() && track.hasITS()) { - flatchrg.fill(HIST("Tracks/postSel/hPtPhiTPCCluster"), track.pt(), phimodn, track.tpcNClsFindable() - track.tpcNClsFindableMinusFound()); + if (cfgStoreThnSparse) { + flatchrg.fill(HIST("Tracks/postSel/hPtPhiTPCCluster"), track.pt(), phimodn, track.tpcNClsFindable() - track.tpcNClsFindableMinusFound()); + } else { + flatchrg.fill(HIST("Tracks/postSel/hPtPhiTPCCluster"), track.pt(), phimodn); + } } } return true; @@ -1000,14 +1089,16 @@ struct FlattenictyPikp { } if (track.sign() > 0) { - hPtNsigmaTPC[pid]->Fill(track.pt(), valTPCnsigma); if (cfgStoreThnSparse) { hThPtNsigmaTPC[pid]->Fill(track.pt(), valTPCnsigma, mult, flat); + } else { + hPtNsigmaTPC[pid]->Fill(track.pt(), valTPCnsigma); } } else { - hPtNsigmaTPC[pid + Npart]->Fill(track.pt(), valTPCnsigma); if (cfgStoreThnSparse) { hThPtNsigmaTPC[pid + Npart]->Fill(track.pt(), valTPCnsigma, mult, flat); + } else { + hPtNsigmaTPC[pid + Npart]->Fill(track.pt(), valTPCnsigma); } } if (!track.hasTOF()) { @@ -1069,18 +1160,22 @@ struct FlattenictyPikp { if constexpr (fillHist) { if (track.tpcInnerParam() >= trkSelOpt.cfgMomMIPMin && track.tpcInnerParam() <= trkSelOpt.cfgMomMIPMax) { if (dEdx > trkSelOpt.cfgDeDxMIPMin && dEdx < trkSelOpt.cfgDeDxMIPMax) { // MIP pions - flatchrg.fill(HIST(kPrefix) + HIST(kStatCalib[ft]) + HIST(kCharge[chrg]) + HIST("hMIP"), mult, flat, track.eta(), dEdx); - flatchrg.fill(HIST(kPrefix) + HIST(kStatCalib[ft]) + HIST(kCharge[chrg]) + HIST("hMIPVsEta"), track.eta(), dEdx); - flatchrg.fill(HIST(kPrefix) + HIST(kStatCalib[ft]) + HIST(kCharge[chrg]) + HIST("pMIPVsEta"), track.eta(), dEdx); + if (cfgStoreThnSparse) { + flatchrg.fill(HIST(kPrefix) + HIST(kStatCalib[ft]) + HIST(kCharge[chrg]) + HIST("hMIP"), mult, flat, track.eta(), dEdx); + } else { + flatchrg.fill(HIST(kPrefix) + HIST(kStatCalib[ft]) + HIST(kCharge[chrg]) + HIST("hMIP"), track.eta(), dEdx); + } flatchrg.fill(HIST(kPrefix) + HIST(kStatCalib[ft]) + HIST(kCharge[chrg]) + HIST("hMIPVsPhi"), track.phi(), dEdx); flatchrg.fill(HIST(kPrefix) + HIST(kStatCalib[ft]) + HIST(kCharge[chrg]) + HIST("hMIPVsPhiVsEta"), track.phi(), dEdx, track.eta()); flatchrg.fill(HIST(kPrefix) + HIST(kStatCalib[ft]) + HIST(kCharge[chrg]) + HIST("pMIPVsPhi"), track.phi(), dEdx); } if (dEdx > trkSelOpt.cfgDeDxMIPMax + 10. && dEdx < trkSelOpt.cfgDeDxMIPMax + 30.) { // Plateau electrons if (std::abs(track.beta() - 1) < trkSelOpt.cfgBetaPlateuMax) { - flatchrg.fill(HIST(kPrefix) + HIST(kStatCalib[ft]) + HIST(kCharge[chrg]) + HIST("hPlateau"), mult, flat, track.eta(), dEdx); - flatchrg.fill(HIST(kPrefix) + HIST(kStatCalib[ft]) + HIST(kCharge[chrg]) + HIST("hPlateauVsEta"), track.eta(), dEdx); - flatchrg.fill(HIST(kPrefix) + HIST(kStatCalib[ft]) + HIST(kCharge[chrg]) + HIST("pPlateauVsEta"), track.eta(), dEdx); + if (cfgStoreThnSparse) { + flatchrg.fill(HIST(kPrefix) + HIST(kStatCalib[ft]) + HIST(kCharge[chrg]) + HIST("hPlateau"), mult, flat, track.eta(), dEdx); + } else { + flatchrg.fill(HIST(kPrefix) + HIST(kStatCalib[ft]) + HIST(kCharge[chrg]) + HIST("hPlateau"), track.eta(), dEdx); + } flatchrg.fill(HIST(kPrefix) + HIST(kStatCalib[ft]) + HIST(kCharge[chrg]) + HIST("hPlateauVsPhi"), track.phi(), dEdx); flatchrg.fill(HIST(kPrefix) + HIST(kStatCalib[ft]) + HIST(kCharge[chrg]) + HIST("hPlateauVsPhiVsEta"), track.phi(), dEdx, track.eta()); flatchrg.fill(HIST(kPrefix) + HIST(kStatCalib[ft]) + HIST(kCharge[chrg]) + HIST("pPlateauVsPhi"), track.phi(), dEdx); @@ -1533,8 +1628,8 @@ struct FlattenictyPikp { constexpr int kHistIdx = id + pidSgn * Npart; auto kIdx = static_cast(id); const std::string strID = Form("/%s/%s", (pidSgn == 0 && id < Npart) ? "pos" : "neg", Pid[kIdx]); - hPtEffRec[kHistIdx] = flatchrg.add("Tracks/hPtEffRec" + strID, " ; p_{T} (GeV/c)", HistType::kTH1D, {ptAxis}); - hPtEffGen[kHistIdx] = flatchrg.add("Tracks/hPtEffGen" + strID, " ; p_{T} (GeV/c)", HistType::kTH1D, {ptAxis}); + hPtEffRec[kHistIdx] = flatchrg.add("Tracks/hPtEffRec" + strID, " ; p_{T} (GeV/c)", HistType::kTH1F, {ptAxis}); + hPtEffGen[kHistIdx] = flatchrg.add("Tracks/hPtEffGen" + strID, " ; p_{T} (GeV/c)", HistType::kTH1F, {ptAxis}); } template From 1670c2a4c5f8db98065e63159e5ab9cd06f0abd0 Mon Sep 17 00:00:00 2001 From: Junlee Kim Date: Sat, 2 Aug 2025 04:35:01 +0900 Subject: [PATCH 188/345] [Common/EventPlane] eta selection with configurable (#12367) Co-authored-by: ALICE Action Bot --- Common/TableProducer/qVectorsTable.cxx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Common/TableProducer/qVectorsTable.cxx b/Common/TableProducer/qVectorsTable.cxx index 9de8faf028f..e27fecb3c8c 100644 --- a/Common/TableProducer/qVectorsTable.cxx +++ b/Common/TableProducer/qVectorsTable.cxx @@ -19,11 +19,13 @@ /// // C++/ROOT includes. +#include +#include + #include #include +#include #include -#include -#include // o2Physics includes. #include "Framework/AnalysisDataModel.h" @@ -78,6 +80,9 @@ struct qVectorsTable { Configurable cfgMinPtOnTPC{"cfgMinPtOnTPC", 0.15, "minimum transverse momentum selection for TPC tracks participating in Q-vector reconstruction"}; Configurable cfgMaxPtOnTPC{"cfgMaxPtOnTPC", 5., "maximum transverse momentum selection for TPC tracks participating in Q-vector reconstruction"}; + Configurable cfgEtaMax{"cfgEtaMax", 0.8, "Maximum pseudorapidiy for charged track"}; + Configurable cfgEtaMin{"cfgEtaMin", -0.8, "Minimum pseudorapidiy for charged track"}; + Configurable cfgCorrLevel{"cfgCorrLevel", 4, "calibration step: 0 = no corr, 1 = gain corr, 2 = rectr, 3 = twist, 4 = full"}; Configurable> cfgnMods{"cfgnMods", {2, 3}, "Modulation of interest"}; Configurable cfgMaxCentrality{"cfgMaxCentrality", 100.f, "max. centrality for Q vector calibration"}; @@ -437,7 +442,10 @@ struct qVectorsTable { continue; } histosQA.fill(HIST("ChTracks"), trk.pt(), trk.eta(), trk.phi(), cent); - if (std::abs(trk.eta()) > 0.8) { + if (trk.eta() > cfgEtaMax) { + continue; + } + if (trk.eta() < cfgEtaMin) { continue; } qVectTPCall[0] += trk.pt() * std::cos(trk.phi() * nmode); From 37a75988082ad6a3a0674286930b98beaf70ac44 Mon Sep 17 00:00:00 2001 From: Marvin Hemmer <53471402+mhemmer-cern@users.noreply.github.com> Date: Sat, 2 Aug 2025 00:22:23 +0200 Subject: [PATCH 189/345] [PWGJE,EMCAL-670] Fix emcalcorrectiontask when running over JJ MC (#12381) --- PWGJE/Core/utilsBcSelEMC.h | 2 +- PWGJE/Core/utilsTrackMatchingEMC.h | 8 +- PWGJE/TableProducer/emcalCorrectionTask.cxx | 15 +- PWGJE/Tasks/CMakeLists.txt | 4 + PWGJE/Tasks/taskEmcExtensiveMcQa.cxx | 195 ++++++++++++++++++++ 5 files changed, 212 insertions(+), 12 deletions(-) create mode 100644 PWGJE/Tasks/taskEmcExtensiveMcQa.cxx diff --git a/PWGJE/Core/utilsBcSelEMC.h b/PWGJE/Core/utilsBcSelEMC.h index 7c23436e876..603e5190655 100644 --- a/PWGJE/Core/utilsBcSelEMC.h +++ b/PWGJE/Core/utilsBcSelEMC.h @@ -44,7 +44,7 @@ enum EventRejection { NEventRejection }; -o2::framework::AxisSpec axisEvents = {EventRejection::NEventRejection, -0.5f, +EventRejection::NEventRejection - 0.5f, ""}; +inline o2::framework::AxisSpec axisEvents = {EventRejection::NEventRejection, -0.5f, +EventRejection::NEventRejection - 0.5f, ""}; /// \brief Function to put labels on monitoring histogram /// \param hRejection monitoring histogram diff --git a/PWGJE/Core/utilsTrackMatchingEMC.h b/PWGJE/Core/utilsTrackMatchingEMC.h index 6256c712ff3..05790a3fb88 100644 --- a/PWGJE/Core/utilsTrackMatchingEMC.h +++ b/PWGJE/Core/utilsTrackMatchingEMC.h @@ -63,10 +63,6 @@ MatchResult matchTracksToCluster( const std::size_t nTracks = trackEta.size(); MatchResult result; - result.matchIndexTrack.resize(nClusters); - result.matchDeltaPhi.resize(nClusters); - result.matchDeltaEta.resize(nClusters); - if (nClusters == 0 || nTracks == 0) { // There are no jets, so nothing to be done. return result; @@ -79,6 +75,10 @@ MatchResult matchTracksToCluster( throw std::invalid_argument("track collection eta and phi sizes don't match. Check the inputs."); } + result.matchIndexTrack.resize(nClusters); + result.matchDeltaPhi.resize(nClusters); + result.matchDeltaEta.resize(nClusters); + // Build the KD-trees using vectors // We build two trees: // treeBase, which contains the base collection. diff --git a/PWGJE/TableProducer/emcalCorrectionTask.cxx b/PWGJE/TableProducer/emcalCorrectionTask.cxx index 72f7941fa9e..1935748a4a0 100644 --- a/PWGJE/TableProducer/emcalCorrectionTask.cxx +++ b/PWGJE/TableProducer/emcalCorrectionTask.cxx @@ -577,9 +577,8 @@ struct EmcalCorrectionTask { // Adding -1 and later when filling the clusterID<->cellID table skip all cases where this is -1 if (cellIndicesBC.size() < cellsBC.size()) { cellIndicesBC.reserve(cellsBC.size()); - for (size_t iMissing = 0; iMissing < (cellsBC.size() - cellIndicesBC.size()); ++iMissing) { - cellIndicesBC.emplace_back(-1); - } + size_t nMissing = cellsBC.size() - cellIndicesBC.size(); + cellIndicesBC.insert(cellIndicesBC.end(), nMissing, -1); } if (emcCrossTalkConf.createHistograms.value) { for (const auto& cell : cellsBC) { @@ -877,10 +876,12 @@ struct EmcalCorrectionTask { mHistManager.fill(HIST("hClusterFCrossSigmaShortE"), cluster.E(), cluster.getFCross(), cluster.getM20()); } if (indexMapPair && trackGlobalIndex) { - for (unsigned int iTrack = 0; iTrack < indexMapPair->matchIndexTrack[iCluster].size(); iTrack++) { - if (indexMapPair->matchIndexTrack[iCluster][iTrack] >= 0) { - LOG(debug) << "Found track " << (*trackGlobalIndex)[indexMapPair->matchIndexTrack[iCluster][iTrack]] << " in cluster " << cluster.getID(); - matchedTracks(clusters.lastIndex(), (*trackGlobalIndex)[indexMapPair->matchIndexTrack[iCluster][iTrack]], indexMapPair->matchDeltaPhi[iCluster][iTrack], indexMapPair->matchDeltaEta[iCluster][iTrack]); + if (iCluster < indexMapPair->matchIndexTrack.size() && indexMapPair->matchIndexTrack.size() > 0) { + for (unsigned int iTrack = 0; iTrack < indexMapPair->matchIndexTrack[iCluster].size(); iTrack++) { + if (indexMapPair->matchIndexTrack[iCluster][iTrack] >= 0) { + LOG(debug) << "Found track " << (*trackGlobalIndex)[indexMapPair->matchIndexTrack[iCluster][iTrack]] << " in cluster " << cluster.getID(); + matchedTracks(clusters.lastIndex(), (*trackGlobalIndex)[indexMapPair->matchIndexTrack[iCluster][iTrack]], indexMapPair->matchDeltaPhi[iCluster][iTrack], indexMapPair->matchDeltaEta[iCluster][iTrack]); + } } } } diff --git a/PWGJE/Tasks/CMakeLists.txt b/PWGJE/Tasks/CMakeLists.txt index 08fbfde7fc4..05ab2be9eea 100644 --- a/PWGJE/Tasks/CMakeLists.txt +++ b/PWGJE/Tasks/CMakeLists.txt @@ -54,6 +54,10 @@ o2physics_add_dpl_workflow(photon-charged-trigger-correlation SOURCES photonChargedTriggerCorrelation.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(task-emc-extensive-mc-qa + SOURCES taskEmcExtensiveMcQa.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2::EMCALBase O2Physics::AnalysisCore O2Physics::EventFilteringUtils + COMPONENT_NAME Analysis) if(FastJet_FOUND) o2physics_add_dpl_workflow(jet-background-analysis diff --git a/PWGJE/Tasks/taskEmcExtensiveMcQa.cxx b/PWGJE/Tasks/taskEmcExtensiveMcQa.cxx new file mode 100644 index 00000000000..002e2f3c711 --- /dev/null +++ b/PWGJE/Tasks/taskEmcExtensiveMcQa.cxx @@ -0,0 +1,195 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file taskEmcExtensiveMcQa.cxx +/// \brief Exensive monitoring task for EMCal clusters in MC +/// \author Marvin Hemmer , Goethe University Frankfurt +/// \since 31.07.2025 + +#include "PWGJE/DataModel/EMCALClusters.h" +// HF headers for event selection +#include "PWGHF/Core/CentralityEstimation.h" +#include "PWGHF/Utils/utilsEvSelHf.h" + +#include "Common/CCDB/ctpRateFetcher.h" +#include "Common/DataModel/EventSelection.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +using namespace o2::aod; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::hf_evsel; +using namespace o2::hf_centrality; +using CollisionEvSels = o2::soa::Join; +using BcEvSelIt = o2::soa::Join::iterator; +using SelectedClusters = o2::soa::Filtered>; + +enum PoI { + kPhoton = 0, + kElectron = 1, + kHadron = 2, + kNPoI = 3 +}; + +/// \struct TaskEmcExtensiveMcQa +struct TaskEmcExtensiveMcQa { + + static constexpr int NSM = 20; // there 20 supermodlues for the EMCal + std::array arrPoIPDG = {22, 11}; + + SliceCache cache; + Preslice psClusterPerCollision = o2::aod::emcalcluster::collisionId; + Preslice perCluster = o2::aod::emcalclustercell::emcalclusterId; + + HistogramRegistry mHistManager{"EMCalExtensiveMCQAHistograms"}; + + o2::emcal::Geometry* mGeometry = nullptr; + o2::framework::Service ccdb; + + ctpRateFetcher rateFetcher; + HfEventSelection hfEvSel; + HfEventSelectionMc hfEvSelMc; + + // configurable parameters + Configurable applyEvSels{"applyEvSels", true, "Flag to apply event selection."}; + Configurable clusterDefinition{"clusterDefinition", 10, "cluster definition to be selected, e.g. 10=kV3Default"}; + Configurable ctpFetcherSource{"ctpFetcherSource", "T0VTX", "Source for CTP rate fetching, e.g. T0VTX, T0CE, T0SC, ZNC (hadronic)"}; + Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + + // configurable axis + ConfigurableAxis nClustersBinning{"nClustersBinning", {201, -0.5, 200.5}, "binning for the number of clusters"}; + + ConfigurableAxis clusterEnergy{"clusterEnergy", {100, 0., 10}, "binning for the cluster energy in GeV"}; + ConfigurableAxis clusterTimeBinning{"clusterTimeBinning", {1500, -600, 900}, "binning for the cluster time in ns"}; + ConfigurableAxis clusterM02{"clusterM02", {100, 0., 2.0}, "binning for the cluster M02"}; + ConfigurableAxis clusterNCellBinning{"clusterNCellBinning", {100, 0.5, 100.5}, "binning for the number of cells per cluster"}; + ConfigurableAxis clusterOriginRadius{"clusterOriginRadius", {225, 0., 450}, "binning for the radial original point of the main contributor of a cluster"}; + + std::vector mCellTime; + + /// \brief Create output histograms and initialize geometry + void init(InitContext const&) + { + // load geometry just in case we need it + mGeometry = o2::emcal::Geometry::GetInstanceFromRunNumber(300000); + + // create common axes + const AxisSpec numberClustersAxis{nClustersBinning, "#it{N}_{cl}/ #it{N}_{event}"}; + const AxisSpec axisParticle = {PoI::kNPoI, -0.5f, +PoI::kNPoI - 0.5f, ""}; + const AxisSpec axisEnergy{clusterEnergy, "#it{E}_{cl} (GeV)"}; + const AxisSpec axisTime{clusterTimeBinning, "#it{t}_{cl} (ns)"}; + const AxisSpec axisM02{clusterM02, "#it{M}_{02}"}; + const AxisSpec axisNCell{clusterNCellBinning, "#it{N}_{cells}"}; + const AxisSpec axisRadius{clusterOriginRadius, "#it{R}_{origin} (cm)"}; + + // create histograms + + // event properties + mHistManager.add("numberOfClustersEvents", "number of clusters per event (selected events)", HistType::kTH1D, {numberClustersAxis}); + + // cluster properties (matched clusters) + mHistManager.add("hSparseClusterQA", "THn for Cluster QA", HistType::kTHnSparseF, {axisEnergy, axisTime, axisM02, axisNCell, axisRadius, axisParticle}); + mHistManager.add("clusterEtaPhi", "Eta and phi of cluster", HistType::kTH2F, {{140, -0.7, 0.7}, {360, 0, o2::constants::math::TwoPI}}); + + hfEvSel.addHistograms(mHistManager); + + ccdb->setURL(ccdbUrl); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + } + + template + bool isCollSelected(const Coll& coll) + { + float cent{-1.f}; + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(coll, cent, ccdb, mHistManager); + /// monitor the satisfied event selections + hfEvSel.fillHistograms(coll, rejectionMask, cent); + return rejectionMask == 0; + } + + /// \brief returns the PoI type of a mcparticle + /// \param mcparticle is the mcparticle we want to find the PoI type + /// \param mcparticles table containing the mcparticles + /// \return PoI type of the given mcparticle + template + int findPoIType(T const& mcparticle, TMCs const& mcparticles) + { + if (!mcparticle.has_mothers()) { + return -1; + } + + int motherid = mcparticle.mothersIds()[0]; + auto mother = mcparticles.iteratorAt(motherid); + auto it = std::find(arrPoIPDG.begin(), arrPoIPDG.end(), std::abs(mother.pdgCode())); + if (it != arrPoIPDG.end()) { + return *it; + } else { + return PoI::kHadron; + } + } + + Filter clusterDefinitionSelection = (o2::aod::emcalcluster::definition == clusterDefinition); + + /// \brief Process EMCAL clusters that are matched to a collisions + void processCollisions(CollisionEvSels const& collisions, SelectedClusters const& clusters, McParticles const& mcparticles) + { + + for (const auto& collision : collisions) { + if (applyEvSels && !isCollSelected(collision)) { + continue; + } + + auto groupedClusters = clusters.sliceBy(psClusterPerCollision, collision.globalIndex()); + mHistManager.fill(HIST("numberOfClustersEvents"), groupedClusters.size()); + + for (const auto& cluster : groupedClusters) { + mHistManager.fill(HIST("clusterEtaPhi"), cluster.eta(), cluster.phi()); + // axisEnergy, axisTime, axisM02, axisNCell, axisRadius, axisParticle + if (cluster.mcParticle().size() == 0) { + LOG(info) << "Somehow cluster.mcParticle().size() == 0!"; + continue; + } + auto mainMcParticle = cluster.mcParticle_as()[0]; + float radius = std::hypot(mainMcParticle.px(), mainMcParticle.py()); + mHistManager.fill(HIST("hSparseClusterQA"), cluster.energy(), cluster.time(), cluster.m02(), cluster.nCells(), radius, findPoIType(mainMcParticle, mcparticles)); + } + } + } + PROCESS_SWITCH(TaskEmcExtensiveMcQa, processCollisions, "Process clusters from collision", true); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + WorkflowSpec workflow{ + adaptAnalysisTask(cfgc)}; + return workflow; +} From 669d5d6a72fa454803e23bbe0611026a23660279 Mon Sep 17 00:00:00 2001 From: sawan <124118453+sawankumawat@users.noreply.github.com> Date: Sat, 2 Aug 2025 03:59:46 +0530 Subject: [PATCH 190/345] [PWGLF] Minor changes in histogram (#12366) Co-authored-by: Sawan Sawan --- PWGLF/Tasks/Resonances/kstarqa.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarqa.cxx b/PWGLF/Tasks/Resonances/kstarqa.cxx index 22759156f77..8f50d2f224c 100644 --- a/PWGLF/Tasks/Resonances/kstarqa.cxx +++ b/PWGLF/Tasks/Resonances/kstarqa.cxx @@ -103,6 +103,7 @@ struct Kstarqa { Configurable cfgITSChi2NCl{"cfgITSChi2NCl", 36.0, "ITS Chi2/NCl"}; Configurable cfgTPCChi2NCl{"cfgTPCChi2NCl", 4.0, "TPC Chi2/NCl"}; Configurable cfgUseITSTPCRefit{"cfgUseITSTPCRefit", false, "Require ITS Refit"}; + Configurable isNoCollInTimeRangeStandard{"isNoCollInTimeRangeStandard", false, "No collision in time range standard"}; // cuts on mother Configurable isApplyCutsOnMother{"isApplyCutsOnMother", false, "Enable additional cuts on Kstar mother"}; @@ -292,7 +293,7 @@ struct Kstarqa { hInvMass.add("hAllRecCollisions", "All reconstructed events", kTH1F, {multiplicityAxis}); hInvMass.add("MCcorrections/hImpactParameterRec", "Impact parameter in reconstructed MC", kTH1F, {impactParAxis}); hInvMass.add("MCcorrections/hImpactParameterGen", "Impact parameter in generated MC", kTH1F, {impactParAxis}); - hInvMass.add("MCcorrections/hImpactParametervsMultiplicity", "Impact parameter vs multiplicity in reconstructed MC", kTH1F, {{impactParAxis}, {multiplicityAxis}}); + hInvMass.add("MCcorrections/hImpactParametervsMultiplicity", "Impact parameter vs multiplicity in reconstructed MC", kTH2F, {{impactParAxis}, {multiplicityAxis}}); rEventSelection.add("tracksCheckData", "No. of events in the data", kTH1I, {{10, 0, 10}}); rEventSelection.add("eventsCheckGen", "No. of events in the generated MC", kTH1I, {{10, 0, 10}}); rEventSelection.add("recMCparticles", "No. of events in the reconstructed MC", kTH1I, {{20, 0, 20}}); @@ -376,7 +377,7 @@ struct Kstarqa { if (fillHist) rEventSelection.fill(HIST("hEventCut"), 6); - if (selectionConfig.isApplyOccCut && (!collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard))) + if (selectionConfig.isNoCollInTimeRangeStandard && (!collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard))) return false; if (selectionConfig.isApplyOccCut && (std::abs(collision.trackOccupancyInTimeRange()) > selectionConfig.configOccCut)) @@ -835,7 +836,6 @@ struct Kstarqa { int occupancy = collision.trackOccupancyInTimeRange(); rEventSelection.fill(HIST("hOccupancy"), occupancy); - multiplicity = -1; if (cSelectMultEstimator == kFT0M) { From 80680df5cf6f7aae63cf2d95444f5e40c45cf00a Mon Sep 17 00:00:00 2001 From: Neelkamal Mallick <104082831+nmallick19@users.noreply.github.com> Date: Sat, 2 Aug 2025 01:30:50 +0300 Subject: [PATCH 191/345] =?UTF-8?q?[PWGCF]=20Added=20Event=20trigger=2013,?= =?UTF-8?q?=20Track=20selection:=20nclustersTPC,=20chi2pe=E2=80=A6=20(#123?= =?UTF-8?q?77)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: ALICE Action Bot --- PWGCF/TableProducer/filterCorrelations.cxx | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/PWGCF/TableProducer/filterCorrelations.cxx b/PWGCF/TableProducer/filterCorrelations.cxx index 572e4c6c886..95fd3ae951f 100644 --- a/PWGCF/TableProducer/filterCorrelations.cxx +++ b/PWGCF/TableProducer/filterCorrelations.cxx @@ -55,6 +55,9 @@ struct FilterCF { kTrackSelected = BIT(0), kITS5Clusters = BIT(1), kTPCCrossedRows = BIT(2), + kTPCClusters = BIT(3), + kchi2perTPC = BIT(4), + kchi2perITS = BIT(5), }; enum TrackSelectionCuts2 : uint8_t { @@ -68,7 +71,7 @@ struct FilterCF { O2_DEFINE_CONFIGURABLE(cfgCutMCPt, float, 0.5f, "Minimal pT for particles") O2_DEFINE_CONFIGURABLE(cfgCutMCEta, float, 0.8f, "Eta range for particles") O2_DEFINE_CONFIGURABLE(cfgVerbosity, int, 1, "Verbosity level (0 = major, 1 = per collision)") - O2_DEFINE_CONFIGURABLE(cfgTrigger, int, 7, "Trigger choice: (0 = none, 7 = sel7, 8 = sel8, 9 = sel8 + kNoSameBunchPileup + kIsGoodZvtxFT0vsPV, 10 = sel8 before April, 2024, 11 = sel8 for MC, 12 = sel8 with low occupancy cut)") + O2_DEFINE_CONFIGURABLE(cfgTrigger, int, 7, "Trigger choice: (0 = none, 7 = sel7, 8 = sel8, 9 = sel8 + kNoSameBunchPileup + kIsGoodZvtxFT0vsPV, 10 = sel8 before April, 2024, 11 = sel8 for MC, 12 = sel8 with low occupancy cut, 13 = sel8 + kNoSameBunchPileup + kIsGoodITSLayersAll -- for OO/NeNe) ") O2_DEFINE_CONFIGURABLE(cfgMinOcc, int, 0, "minimum occupancy selection") O2_DEFINE_CONFIGURABLE(cfgMaxOcc, int, 3000, "maximum occupancy selection") O2_DEFINE_CONFIGURABLE(cfgCollisionFlags, uint16_t, aod::collision::CollisionFlagsRun2::Run2VertexerTracks, "Request collision flags if non-zero (0 = off, 1 = Run2VertexerTracks)") @@ -84,6 +87,9 @@ struct FilterCF { O2_DEFINE_CONFIGURABLE(dcazmax, float, 999.f, "maximum dcaz of tracks") O2_DEFINE_CONFIGURABLE(itsnclusters, int, 5, "minimum number of ITS clusters for tracks") O2_DEFINE_CONFIGURABLE(tpcncrossedrows, int, 80, "minimum number of TPC crossed rows for tracks") + O2_DEFINE_CONFIGURABLE(tpcnclusters, int, 50, "minimum number of TPC clusters found") + O2_DEFINE_CONFIGURABLE(chi2pertpccluster, float, 2.5, "maximum Chi2 / cluster for the TPC track segment") + O2_DEFINE_CONFIGURABLE(chi2peritscluster, float, 36, "maximum Chi2 / cluster for the ITS track segment") // Filters and input definitions Filter collisionZVtxFilter = nabs(aod::collision::posZ) < cfgCutVertex; @@ -140,6 +146,8 @@ struct FilterCF { return isMultSelected && collision.sel8() && collision.selection_bit(aod::evsel::kNoSameBunchPileup) && collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) && collision.selection_bit(aod::evsel::kNoCollInTimeRangeStandard) && collision.selection_bit(aod::evsel::kIsGoodITSLayersAll); else return false; + } else if (cfgTrigger == 13) { // relevant for OO/NeNe + return isMultSelected && collision.sel8() && collision.selection_bit(aod::evsel::kNoSameBunchPileup) && collision.selection_bit(aod::evsel::kIsGoodITSLayersAll); } return false; } @@ -205,6 +213,15 @@ struct FilterCF { if (track.tpcNClsCrossedRows() >= tpcncrossedrows) { trackType |= kTPCCrossedRows; } + if (track.tpcNClsFound() >= tpcnclusters) { + trackType |= kTPCClusters; + } + if (track.tpcChi2NCl() <= chi2pertpccluster) { + trackType |= kchi2perTPC; + } + if (track.itsChi2NCl() <= chi2peritscluster) { + trackType |= kchi2perITS; + } } return trackType; } else if (cfgTrackSelection == 2) { From ee86fccb39a93bf7d3a3209b83cfc4c222c29f88 Mon Sep 17 00:00:00 2001 From: altsybee Date: Sat, 2 Aug 2025 01:21:03 +0200 Subject: [PATCH 192/345] [DPG] adding new QA task to monitor outliers and pileup in OO and NeNe (#12365) --- DPG/Tasks/AOTEvent/CMakeLists.txt | 5 + DPG/Tasks/AOTEvent/eventSelectionQa.cxx | 2 +- DPG/Tasks/AOTEvent/lightIonsEvSelQa.cxx | 1079 +++++++++++++++++++++++ 3 files changed, 1085 insertions(+), 1 deletion(-) create mode 100644 DPG/Tasks/AOTEvent/lightIonsEvSelQa.cxx diff --git a/DPG/Tasks/AOTEvent/CMakeLists.txt b/DPG/Tasks/AOTEvent/CMakeLists.txt index 83503f45254..59e049e6356 100644 --- a/DPG/Tasks/AOTEvent/CMakeLists.txt +++ b/DPG/Tasks/AOTEvent/CMakeLists.txt @@ -44,6 +44,11 @@ o2physics_add_dpl_workflow(rof-occupancy-qa PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::AnalysisCCDB O2::DetectorsBase COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(light-ions-evsel-qa + SOURCES lightIonsEvSelQa.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::AnalysisCCDB O2::DetectorsBase + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(occupancy-vs-dedx-qa SOURCES dEdxVsOccupancyWithTrackQAinfo.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::AnalysisCCDB O2::DetectorsBase diff --git a/DPG/Tasks/AOTEvent/eventSelectionQa.cxx b/DPG/Tasks/AOTEvent/eventSelectionQa.cxx index c02ac2deda5..e890b9fbab9 100644 --- a/DPG/Tasks/AOTEvent/eventSelectionQa.cxx +++ b/DPG/Tasks/AOTEvent/eventSelectionQa.cxx @@ -1185,7 +1185,7 @@ struct EventSelectionQaTask { histos.fill(HIST("occupancyQA/tpcNCrossedRows_vs_V0A_vs_occupancy"), multV0A, track.tpcNClsFindable() - tpcNClsFindableMinusCrossedRowsCorrected, occupancyByTracks); } } // end of hasTPC - if (track.tpcNClsFound() > 50 && track.tpcNClsCrossedRows() > 80 && track.itsChi2NCl() < 36 && track.tpcChi2NCl() < 4) { + if (col.sel8() && fabs(col.posZ()) < 10 && track.tpcNClsFound() > 50 && track.tpcNClsCrossedRows() > 80 && track.itsChi2NCl() < 36 && track.tpcChi2NCl() < 4) { nContributorsAfterEtaTPCCuts++; // ROF border QA histos.fill(HIST("ITSROFborderQA/hFoundBC_kTVX_nITSlayers_for_ITSTPCtracks"), localBC, track.itsNCls()); diff --git a/DPG/Tasks/AOTEvent/lightIonsEvSelQa.cxx b/DPG/Tasks/AOTEvent/lightIonsEvSelQa.cxx new file mode 100644 index 00000000000..f079f43a3ec --- /dev/null +++ b/DPG/Tasks/AOTEvent/lightIonsEvSelQa.cxx @@ -0,0 +1,1079 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file detectorOccupancyQa.cxx +/// \brief Occupancy QA task +/// +/// \author Igor Altsybeev + +#include "Common/CCDB/EventSelectionParams.h" +#include "Common/Core/TrackSelection.h" +#include "Common/Core/TrackSelectionDefaults.h" +// #include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/FT0Corrected.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "CCDB/BasicCCDBManager.h" +#include "CommonDataFormat/BunchFilling.h" +#include "DataFormatsFT0/Digit.h" +#include "DataFormatsFT0/RecPoints.h" +#include "DataFormatsParameters/AggregatedRunInfo.h" +#include "DataFormatsParameters/GRPECSObject.h" +#include "DataFormatsParameters/GRPLHCIFData.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/runDataProcessing.h" + +#include "TH1F.h" +#include "TH2F.h" +#include "TH3.h" + +#include +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::aod::evsel; + +using BCsRun3 = soa::Join; +using ColEvSels = soa::Join; //, aod::CentFT0Cs>; +// using FullTracksIU = soa::Join; +using FullTracksIU = soa::Join; + +struct LightIonsEvSelQa { + Configurable confCutMinTPCcls{"MinNumTPCcls", 50, "min number of TPC clusters for a current event"}; // o2-linter: disable=name/configurable (temporary fix) + Configurable nBinsTracks{"nBinsTracks", 450, "N bins in n tracks histo"}; // o2-linter: disable=name/configurable (temporary fix) + Configurable nMaxTracks{"nMaxTracks", 450, "N max in n tracks histo"}; // o2-linter: disable=name/configurable (temporary fix) + Configurable nMaxGlobalTracks{"nMaxGlobalTracks", 450, "N max in n tracks histo"}; // o2-linter: disable=name/configurable (temporary fix) + Configurable nBinsMultFwd{"nBinsMultFwd", 1000, "N bins in mult fwd histo"}; // o2-linter: disable=name/configurable (temporary fix) + Configurable nMaxMultFwd{"nMaxMultFwd", 100000, "N max in mult fwd histo"}; // o2-linter: disable=name/configurable (temporary fix) + Configurable timeBinWidthInSec{"TimeBinWidthInSec", 10, "Width of time bins in seconds"}; // o2-linter: disable=name/configurable (temporary fix) + + Configurable nSigmaForVzDiff{"nSigmaForVzDiff", 3.0, "n +/- sigma for diff vZ"}; // o2-linter: disable=name/configurable (temporary fix) + Configurable safetyDiffMargin{"SafetyDiffVzMargin", 0.4, "margin for diff vZ, cm"}; // o2-linter: disable=name/configurable (temporary fix) + + uint64_t minGlobalBC = 0; + Service ccdb; + HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + bool* applySelection = NULL; + int nBCsPerOrbit = 3564; + int lastRunNumber = -1; + double maxSec = 1; + double minSec = 0; + int64_t bcSOR = 0; // global bc of the start of the first orbit, setting 0 by default for unanchored MC + int64_t nBCsPerTF = 32 * nBCsPerOrbit; // duration of TF in bcs, should be 128*3564 or 32*3564, setting 128 orbits by default sfor unanchored MC + + // save time "slices" for several collisions for QA + bool flagFillQAtimeOccupHist = false; + int nCollisionsForTimeBinQA = 40; + int counterQAtimeOccupHistos = 0; + + void init(InitContext&) + { + // ccdb->setURL("http://ccdb-test.cern.ch:8080"); + ccdb->setURL("http://alice-ccdb.cern.ch"); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + + // const AxisSpec axisBCinTF{static_cast(nBCsPerTF), 0, static_cast(nBCsPerTF), "bc in TF"}; + // histos.add("hNcolVsBcInTF/hNcolVsBcInTF", ";bc in TF; n collisions", kTH1F, {axisBCinTF}); + // histos.add("hNcolVsBcInTF/hNcolVsBcInTF_vertexTOFmatched", ";bc in TF; n collisions", kTH1F, {axisBCinTF}); + + // ############## + const AxisSpec axisBCs{nBCsPerOrbit, 0., static_cast(nBCsPerOrbit), ""}; + + histos.add("bcQA/hBcFV0", "", kTH1F, {axisBCs}); + histos.add("bcQA/pastActivity/hBcFV0", "", kTH1F, {axisBCs}); + histos.add("bcQA/futureActivity/hBcFV0", "", kTH1F, {axisBCs}); + histos.add("bcQA/noPastActivity/hBcFV0", "", kTH1F, {axisBCs}); + histos.add("bcQA/noFutureActivity/hBcFV0", "", kTH1F, {axisBCs}); + histos.add("bcQA/noPastFutureActivity/hBcFV0", "", kTH1F, {axisBCs}); + + histos.add("bcQA/hBcFT0", "", kTH1F, {axisBCs}); + histos.add("bcQA/pastActivity/hBcFT0", "", kTH1F, {axisBCs}); + histos.add("bcQA/futureActivity/hBcFT0", "", kTH1F, {axisBCs}); + histos.add("bcQA/noPastActivity/hBcFT0", "", kTH1F, {axisBCs}); + histos.add("bcQA/noFutureActivity/hBcFT0", "", kTH1F, {axisBCs}); + histos.add("bcQA/noPastFutureActivity/hBcFT0", "", kTH1F, {axisBCs}); + + histos.add("bcQA/hBcFDD", "", kTH1F, {axisBCs}); + histos.add("bcQA/pastActivity/hBcFDD", "", kTH1F, {axisBCs}); + histos.add("bcQA/futureActivity/hBcFDD", "", kTH1F, {axisBCs}); + histos.add("bcQA/hBcZDC", "", kTH1F, {axisBCs}); + histos.add("bcQA/pastActivity/hBcZDC", "", kTH1F, {axisBCs}); + histos.add("bcQA/futureActivity/hBcZDC", "", kTH1F, {axisBCs}); + + const AxisSpec axisNtracks{nBinsTracks, -0.5, nMaxTracks - 0.5, "n tracks"}; + const AxisSpec axisNtracksGlobal{nBinsTracks, -0.5, nMaxGlobalTracks - 0.5, "n tracks"}; + const AxisSpec axisMultV0A{nBinsMultFwd, 0., static_cast(nMaxMultFwd), "mult V0A"}; + const AxisSpec axisMultFT0A{nBinsMultFwd, 0., static_cast(nMaxMultFwd * 0.4), "mult FT0C"}; + const AxisSpec axisMultFT0C{nBinsMultFwd, 0., static_cast(nMaxMultFwd * 0.15), "mult FT0C"}; + const AxisSpec axisMultT0M{nBinsMultFwd * 2, 0., static_cast(nMaxMultFwd * 0.4), "mult FT0M"}; + + const AxisSpec axisVtxZ{800, -20., 20., ""}; + const AxisSpec axisBcDiff{600, -300., 300., "bc difference"}; + + const AxisSpec axisNcontrib{801, -0.5, 800.5, "n contributors"}; + const AxisSpec axisColTimeRes{1500, 0., 1500., "collision time resolution (ns)"}; + + histos.add("noSpecSelections/hBcColNoSel8", "", kTH1F, {axisBCs}); + // histos.add("noSpecSelections/hBcColNoSel8TOF", "", kTH1F, {axisBCs}); + histos.add("noSpecSelections/hBcTVX", "", kTH1F, {axisBCs}); + histos.add("noSpecSelections/hBcFT0", "", kTH1F, {axisBCs}); + histos.add("noSpecSelections/hBcFV0", "", kTH1F, {axisBCs}); + histos.add("noSpecSelections/hBcFDD", "", kTH1F, {axisBCs}); + histos.add("noSpecSelections/hBcZDC", "", kTH1F, {axisBCs}); + histos.add("noSpecSelections/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); + histos.add("noSpecSelections/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); + histos.add("noSpecSelections/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("noSpecSelections/nTracksPV_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracks}); + histos.add("noSpecSelections/nTracksPV_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracks}); + histos.add("noSpecSelections/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); + histos.add("noSpecSelections/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); + histos.add("noSpecSelections/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); + histos.add("noSpecSelections/hTVXvsBcDiff", "", kTH1F, {axisBcDiff}); + histos.add("noSpecSelections/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); + histos.add("noSpecSelections/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); + + histos.add("noPileup/hBcColNoSel8", "", kTH1F, {axisBCs}); + histos.add("noPileup/hBcTVX", "", kTH1F, {axisBCs}); + histos.add("noPileup/hBcFT0", "", kTH1F, {axisBCs}); + histos.add("noPileup/hBcFV0", "", kTH1F, {axisBCs}); + histos.add("noPileup/hBcFDD", "", kTH1F, {axisBCs}); + histos.add("noPileup/hBcZDC", "", kTH1F, {axisBCs}); + histos.add("noPileup/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); + histos.add("noPileup/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); + histos.add("noPileup/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("noPileup/nTracksPV_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracks}); + histos.add("noPileup/nTracksPV_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracks}); + histos.add("noPileup/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); + histos.add("noPileup/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); + histos.add("noPileup/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); + histos.add("noPileup/hTVXvsBcDiff", "", kTH1F, {axisBcDiff}); + histos.add("noPileup/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); + histos.add("noPileup/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); + + histos.add("pvTOFmatched/hBcColNoSel8", "", kTH1F, {axisBCs}); + histos.add("pvTOFmatched/hBcColNoSel8TOF", "", kTH1F, {axisBCs}); + histos.add("pvTOFmatched/hBcTVX", "", kTH1F, {axisBCs}); + histos.add("pvTOFmatched/hBcFT0", "", kTH1F, {axisBCs}); + histos.add("pvTOFmatched/hBcFV0", "", kTH1F, {axisBCs}); + histos.add("pvTOFmatched/hBcFDD", "", kTH1F, {axisBCs}); + histos.add("pvTOFmatched/hBcZDC", "", kTH1F, {axisBCs}); + histos.add("pvTOFmatched/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); + histos.add("pvTOFmatched/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); + histos.add("pvTOFmatched/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("pvTOFmatched/nTracksPV_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracks}); + histos.add("pvTOFmatched/nTracksPV_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracks}); + histos.add("pvTOFmatched/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); + histos.add("pvTOFmatched/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); + histos.add("pvTOFmatched/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); + histos.add("pvTOFmatched/hTVXvsBcDiff", "", kTH1F, {axisBcDiff}); + histos.add("pvTOFmatched/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); + histos.add("pvTOFmatched/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); + + histos.add("bcDiffCut/hBcColNoSel8", "", kTH1F, {axisBCs}); + histos.add("bcDiffCut/hBcColNoSel8TOF", "", kTH1F, {axisBCs}); + histos.add("bcDiffCut/hBcTVX", "", kTH1F, {axisBCs}); + histos.add("bcDiffCut/hBcFT0", "", kTH1F, {axisBCs}); + histos.add("bcDiffCut/hBcFV0", "", kTH1F, {axisBCs}); + histos.add("bcDiffCut/hBcFDD", "", kTH1F, {axisBCs}); + histos.add("bcDiffCut/hBcZDC", "", kTH1F, {axisBCs}); + histos.add("bcDiffCut/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); + histos.add("bcDiffCut/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); + histos.add("bcDiffCut/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("bcDiffCut/nTracksPV_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracks}); + histos.add("bcDiffCut/nTracksPV_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracks}); + histos.add("bcDiffCut/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); + histos.add("bcDiffCut/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); + histos.add("bcDiffCut/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); + histos.add("bcDiffCut/hTVXvsBcDiff", "", kTH1F, {axisBcDiff}); + histos.add("bcDiffCut/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); + histos.add("bcDiffCut/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); + + histos.add("narrowTimeVeto/hBcColNoSel8", "", kTH1F, {axisBCs}); + histos.add("narrowTimeVeto/hBcTVX", "", kTH1F, {axisBCs}); + histos.add("narrowTimeVeto/hBcFT0", "", kTH1F, {axisBCs}); + histos.add("narrowTimeVeto/hBcFV0", "", kTH1F, {axisBCs}); + histos.add("narrowTimeVeto/hBcFDD", "", kTH1F, {axisBCs}); + histos.add("narrowTimeVeto/hBcZDC", "", kTH1F, {axisBCs}); + histos.add("narrowTimeVeto/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); + histos.add("narrowTimeVeto/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); + histos.add("narrowTimeVeto/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("narrowTimeVeto/nTracksPV_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracks}); + histos.add("narrowTimeVeto/nTracksPV_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracks}); + histos.add("narrowTimeVeto/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); + histos.add("narrowTimeVeto/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); + histos.add("narrowTimeVeto/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); + histos.add("narrowTimeVeto/hTVXvsBcDiff", "", kTH1F, {axisBcDiff}); + histos.add("narrowTimeVeto/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); + histos.add("narrowTimeVeto/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); + + histos.add("noCollSameROF/hBcColNoSel8", "", kTH1F, {axisBCs}); + histos.add("noCollSameROF/hBcTVX", "", kTH1F, {axisBCs}); + histos.add("noCollSameROF/hBcFT0", "", kTH1F, {axisBCs}); + histos.add("noCollSameROF/hBcFV0", "", kTH1F, {axisBCs}); + histos.add("noCollSameROF/hBcFDD", "", kTH1F, {axisBCs}); + histos.add("noCollSameROF/hBcZDC", "", kTH1F, {axisBCs}); + histos.add("noCollSameROF/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); + histos.add("noCollSameROF/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); + histos.add("noCollSameROF/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("noCollSameROF/nTracksPV_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracks}); + histos.add("noCollSameROF/nTracksPV_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracks}); + histos.add("noCollSameROF/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); + histos.add("noCollSameROF/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); + histos.add("noCollSameROF/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); + histos.add("noCollSameROF/hTVXvsBcDiff", "", kTH1F, {axisBcDiff}); + histos.add("noCollSameROF/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); + histos.add("noCollSameROF/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); + + histos.add("noPileup_LowMultCut/hBcColNoSel8", "", kTH1F, {axisBCs}); + histos.add("noPileup_LowMultCut/hBcTVX", "", kTH1F, {axisBCs}); + histos.add("noPileup_LowMultCut/hBcFT0", "", kTH1F, {axisBCs}); + histos.add("noPileup_LowMultCut/hBcFV0", "", kTH1F, {axisBCs}); + histos.add("noPileup_LowMultCut/hBcFDD", "", kTH1F, {axisBCs}); + histos.add("noPileup_LowMultCut/hBcZDC", "", kTH1F, {axisBCs}); + histos.add("noPileup_LowMultCut/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); + histos.add("noPileup_LowMultCut/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); + histos.add("noPileup_LowMultCut/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("noPileup_LowMultCut/nTracksPV_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracks}); + histos.add("noPileup_LowMultCut/nTracksPV_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracks}); + histos.add("noPileup_LowMultCut/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); + histos.add("noPileup_LowMultCut/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); + histos.add("noPileup_LowMultCut/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); + histos.add("noPileup_LowMultCut/hTVXvsBcDiff", "", kTH1F, {axisBcDiff}); + histos.add("noPileup_LowMultCut/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); + histos.add("noPileup_LowMultCut/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); + + histos.add("noPileup_HighMultCloudCut/hBcColNoSel8", "", kTH1F, {axisBCs}); + histos.add("noPileup_HighMultCloudCut/hBcTVX", "", kTH1F, {axisBCs}); + histos.add("noPileup_HighMultCloudCut/hBcFT0", "", kTH1F, {axisBCs}); + histos.add("noPileup_HighMultCloudCut/hBcFV0", "", kTH1F, {axisBCs}); + histos.add("noPileup_HighMultCloudCut/hBcFDD", "", kTH1F, {axisBCs}); + histos.add("noPileup_HighMultCloudCut/hBcZDC", "", kTH1F, {axisBCs}); + histos.add("noPileup_HighMultCloudCut/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); + histos.add("noPileup_HighMultCloudCut/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); + histos.add("noPileup_HighMultCloudCut/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("noPileup_HighMultCloudCut/nTracksPV_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracks}); + histos.add("noPileup_HighMultCloudCut/nTracksPV_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracks}); + histos.add("noPileup_HighMultCloudCut/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); + histos.add("noPileup_HighMultCloudCut/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); + histos.add("noPileup_HighMultCloudCut/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); + histos.add("noPileup_HighMultCloudCut/hTVXvsBcDiff", "", kTH1F, {axisBcDiff}); + histos.add("noPileup_HighMultCloudCut/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); + histos.add("noPileup_HighMultCloudCut/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); + + histos.add("badVzDiff/hBcColNoSel8", "", kTH1F, {axisBCs}); + histos.add("badVzDiff/hBcTVX", "", kTH1F, {axisBCs}); + histos.add("badVzDiff/hBcFT0", "", kTH1F, {axisBCs}); + histos.add("badVzDiff/hBcFV0", "", kTH1F, {axisBCs}); + histos.add("badVzDiff/hBcFDD", "", kTH1F, {axisBCs}); + histos.add("badVzDiff/hBcZDC", "", kTH1F, {axisBCs}); + histos.add("badVzDiff/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); + histos.add("badVzDiff/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); + histos.add("badVzDiff/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("badVzDiff/nTracksPV_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracks}); + histos.add("badVzDiff/nTracksPV_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracks}); + histos.add("badVzDiff/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); + histos.add("badVzDiff/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); + histos.add("badVzDiff/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); + histos.add("badVzDiff/hTVXvsBcDiff", "", kTH1F, {axisBcDiff}); + histos.add("badVzDiff/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); + histos.add("badVzDiff/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); + + histos.add("goodVzDiff/hBcColNoSel8", "", kTH1F, {axisBCs}); + histos.add("goodVzDiff/hBcTVX", "", kTH1F, {axisBCs}); + histos.add("goodVzDiff/hBcFT0", "", kTH1F, {axisBCs}); + histos.add("goodVzDiff/hBcFV0", "", kTH1F, {axisBCs}); + histos.add("goodVzDiff/hBcFDD", "", kTH1F, {axisBCs}); + histos.add("goodVzDiff/hBcZDC", "", kTH1F, {axisBCs}); + histos.add("goodVzDiff/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); + histos.add("goodVzDiff/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); + histos.add("goodVzDiff/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("goodVzDiff/nTracksPV_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracks}); + histos.add("goodVzDiff/nTracksPV_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracks}); + histos.add("goodVzDiff/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); + histos.add("goodVzDiff/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); + histos.add("goodVzDiff/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); + histos.add("goodVzDiff/hTVXvsBcDiff", "", kTH1F, {axisBcDiff}); + histos.add("goodVzDiff/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); + histos.add("goodVzDiff/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); + + histos.add("noPastActivity/hBcColNoSel8", "", kTH1F, {axisBCs}); + histos.add("noPastActivity/hBcTVX", "", kTH1F, {axisBCs}); + histos.add("noPastActivity/hBcFT0", "", kTH1F, {axisBCs}); + histos.add("noPastActivity/hBcFV0", "", kTH1F, {axisBCs}); + histos.add("noPastActivity/hBcFDD", "", kTH1F, {axisBCs}); + histos.add("noPastActivity/hBcZDC", "", kTH1F, {axisBCs}); + histos.add("noPastActivity/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); + histos.add("noPastActivity/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); + histos.add("noPastActivity/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("noPastActivity/nTracksPV_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracks}); + histos.add("noPastActivity/nTracksPV_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracks}); + histos.add("noPastActivity/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); + histos.add("noPastActivity/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); + histos.add("noPastActivity/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); + histos.add("noPastActivity/hTVXvsBcDiff", "", kTH1F, {axisBcDiff}); + histos.add("noPastActivity/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); + histos.add("noPastActivity/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); + + histos.add("noFT0activityNearby/hBcColNoSel8", "", kTH1F, {axisBCs}); + histos.add("noFT0activityNearby/hBcTVX", "", kTH1F, {axisBCs}); + histos.add("noFT0activityNearby/hBcFT0", "", kTH1F, {axisBCs}); + histos.add("noFT0activityNearby/hBcFV0", "", kTH1F, {axisBCs}); + histos.add("noFT0activityNearby/hBcFDD", "", kTH1F, {axisBCs}); + histos.add("noFT0activityNearby/hBcZDC", "", kTH1F, {axisBCs}); + histos.add("noFT0activityNearby/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); + histos.add("noFT0activityNearby/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); + histos.add("noFT0activityNearby/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("noFT0activityNearby/nTracksPV_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracks}); + histos.add("noFT0activityNearby/nTracksPV_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracks}); + histos.add("noFT0activityNearby/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); + histos.add("noFT0activityNearby/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); + histos.add("noFT0activityNearby/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); + histos.add("noFT0activityNearby/hTVXvsBcDiff", "", kTH1F, {axisBcDiff}); + histos.add("noFT0activityNearby/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); + histos.add("noFT0activityNearby/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); + + histos.add("noPileup_cutByVzDiff_pvTOF_noFT0act/hBcColNoSel8", "", kTH1F, {axisBCs}); + histos.add("noPileup_cutByVzDiff_pvTOF_noFT0act/hBcTVX", "", kTH1F, {axisBCs}); + histos.add("noPileup_cutByVzDiff_pvTOF_noFT0act/hBcFT0", "", kTH1F, {axisBCs}); + histos.add("noPileup_cutByVzDiff_pvTOF_noFT0act/hBcFV0", "", kTH1F, {axisBCs}); + histos.add("noPileup_cutByVzDiff_pvTOF_noFT0act/hBcFDD", "", kTH1F, {axisBCs}); + histos.add("noPileup_cutByVzDiff_pvTOF_noFT0act/hBcZDC", "", kTH1F, {axisBCs}); + histos.add("noPileup_cutByVzDiff_pvTOF_noFT0act/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); + histos.add("noPileup_cutByVzDiff_pvTOF_noFT0act/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); + histos.add("noPileup_cutByVzDiff_pvTOF_noFT0act/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("noPileup_cutByVzDiff_pvTOF_noFT0act/nTracksPV_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracks}); + histos.add("noPileup_cutByVzDiff_pvTOF_noFT0act/nTracksPV_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracks}); + histos.add("noPileup_cutByVzDiff_pvTOF_noFT0act/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); + histos.add("noPileup_cutByVzDiff_pvTOF_noFT0act/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); + histos.add("noPileup_cutByVzDiff_pvTOF_noFT0act/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); + histos.add("noPileup_cutByVzDiff_pvTOF_noFT0act/hTVXvsBcDiff", "", kTH1F, {axisBcDiff}); + histos.add("noPileup_cutByVzDiff_pvTOF_noFT0act/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); + histos.add("noPileup_cutByVzDiff_pvTOF_noFT0act/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); + } + + Preslice perCollision = aod::track::collisionId; + + int32_t findClosest(int64_t globalBC, std::map& bcs) + { + auto it = bcs.lower_bound(globalBC); + int64_t bc1 = it->first; + int32_t index1 = it->second; + if (it != bcs.begin()) + --it; + int64_t bc2 = it->first; + int32_t index2 = it->second; + int64_t dbc1 = std::abs(bc1 - globalBC); + int64_t dbc2 = std::abs(bc2 - globalBC); + return (dbc1 <= dbc2) ? index1 : index2; + } + + // ##### + void processRun3( + ColEvSels const& cols, + FullTracksIU const& tracks, + BCsRun3 const& bcs, + aod::FT0s const&) + { + int runNumber = bcs.iteratorAt(0).runNumber(); + if (runNumber != lastRunNumber) { + lastRunNumber = runNumber; // do it only once + + int64_t tsSOR = 0; // dummy start-of-run timestamp + int64_t tsEOR = 1; // dummy end-of-run timestamp + + if (runNumber >= 500000) { + auto runInfo = o2::parameters::AggregatedRunInfo::buildAggregatedRunInfo(o2::ccdb::BasicCCDBManager::instance(), runNumber); + // first bc of the first orbit + bcSOR = runInfo.orbitSOR * o2::constants::lhc::LHCMaxBunches; + // duration of TF in bcs + nBCsPerTF = runInfo.orbitsPerTF * o2::constants::lhc::LHCMaxBunches; + + // start-of-run timestamp + tsSOR = runInfo.sor; + // end-of-run timestamp + tsEOR = runInfo.eor; + + LOGP(info, "bcSOR = {}, nBCsPerTF = {}", bcSOR, nBCsPerTF); + } + + minSec = floor(tsSOR / 1000.); + maxSec = ceil(tsEOR / 1000.); + int nTimeBins = static_cast((maxSec - minSec) / timeBinWidthInSec); + double timeInterval = nTimeBins * timeBinWidthInSec; + + const AxisSpec axisSeconds{nTimeBins, 0, timeInterval, "seconds"}; + histos.add("hSecondsCollisions/noPU", "", kTH1D, {axisSeconds}); + histos.add("hSecondsCollisions/noPU_underLine", "", kTH1D, {axisSeconds}); + histos.add("hSecondsCollisions/noPU_grassOnTheRight", "", kTH1D, {axisSeconds}); + histos.add("hSecondsCollisions/noPU_good", "", kTH1D, {axisSeconds}); + + } // end of runNumber check + + // vectors of TVX flags used for past-future studies + int nBCs = bcs.size(); + std::vector vIsTVX(nBCs, 0); + std::vector vGlobalBCs(nBCs, 0); + + std::vector vPastActivity(nBCs, 0); + std::vector vFutureActivity(nBCs, 0); + std::vector vNearbyFT0activity(nBCs, 0); + + // create maps from globalBC to bc index for TVX or FT0-OR fired bcs + // to be used for closest TVX (FT0-OR) searches + std::map mapGlobalBcWithTVX; + std::map mapGlobalBcWithTOR; + + // ### BC loop + for (const auto& bc : bcs) { + uint64_t globalBC = bc.globalBC(); + + int indexBc = bc.globalIndex(); + + if (bc.selection_bit(kIsBBT0A) || bc.selection_bit(kIsBBT0C)) { + mapGlobalBcWithTOR[globalBC] = indexBc; + } + if (bc.selection_bit(kIsTriggerTVX)) { + mapGlobalBcWithTVX[globalBC] = indexBc; + } + + // fill TVX flags for past-future searches + vIsTVX[indexBc] = bc.selection_bit(kIsTriggerTVX); + vGlobalBCs[indexBc] = globalBC; + + // ### checking nearby activities + int deltaIndex = 0; // backward move counts + int deltaBC = 0; // current difference wrt globalBC + int maxDeltaBC = 30; // maximum difference + + bool nearbyFT0activity = 0; + + // past + bool pastActivityFT0 = 0; + bool pastActivityFDD = 0; + bool pastActivityFV0 = 0; + while (deltaBC < maxDeltaBC) { + deltaIndex++; + if (bc.globalIndex() - deltaIndex < 0) { + break; + } + const auto& bcPast = bcs.iteratorAt(bc.globalIndex() - deltaIndex); + deltaBC = globalBC - bcPast.globalBC(); + if (deltaBC < maxDeltaBC) { + pastActivityFT0 |= bcPast.has_ft0(); + pastActivityFV0 |= bcPast.has_fv0a(); + pastActivityFDD |= bcPast.has_fdd(); + } + if (deltaBC < 2) { + if (bcPast.has_ft0()) { + std::bitset<8> triggers = bcPast.ft0().triggerMask(); + nearbyFT0activity |= triggers[o2::ft0::RecPoints::ETriggerBits::kIsActiveSideA]; + } + } + } + bool pastActivity = pastActivityFT0 | pastActivityFV0 | pastActivityFDD; + vPastActivity[indexBc] = pastActivity; + + // future + deltaIndex = 0; + deltaBC = 0; + bool futureActivityFT0 = 0; + bool futureActivityFDD = 0; + bool futureActivityFV0 = 0; + while (deltaBC < maxDeltaBC) { + deltaIndex++; + if (bc.globalIndex() + deltaIndex >= bcs.size()) { + break; + } + const auto& bcFuture = bcs.iteratorAt(bc.globalIndex() + deltaIndex); + deltaBC = bcFuture.globalBC() - globalBC; + if (deltaBC < maxDeltaBC) { + futureActivityFT0 |= bcFuture.has_ft0(); + futureActivityFV0 |= bcFuture.has_fv0a(); + futureActivityFDD |= bcFuture.has_fdd(); + } + if (deltaBC < 2) { + if (bcFuture.has_ft0()) { + std::bitset<8> triggers = bcFuture.ft0().triggerMask(); + nearbyFT0activity |= triggers[o2::ft0::RecPoints::ETriggerBits::kIsActiveSideA]; + } + } + } + bool futureActivity = futureActivityFT0 | futureActivityFV0 | futureActivityFDD; + vFutureActivity[indexBc] = futureActivity; + vNearbyFT0activity[indexBc] = nearbyFT0activity; + + // monitor BCs with nearby activity: + + int localBC = globalBC % nBCsPerOrbit; + if (bc.has_fv0a()) { + histos.fill(HIST("bcQA/hBcFV0"), localBC); + if (pastActivity) + histos.fill(HIST("bcQA/pastActivity/hBcFV0"), localBC); + if (futureActivity) + histos.fill(HIST("bcQA/futureActivity/hBcFV0"), localBC); + if (!pastActivity) + histos.fill(HIST("bcQA/noPastActivity/hBcFV0"), localBC); + if (!futureActivity) + histos.fill(HIST("bcQA/noFutureActivity/hBcFV0"), localBC); + if (!pastActivity && !futureActivity) + histos.fill(HIST("bcQA/noPastFutureActivity/hBcFV0"), localBC); + } + if (bc.has_ft0()) { + histos.fill(HIST("bcQA/hBcFT0"), localBC); + if (pastActivity) + histos.fill(HIST("bcQA/pastActivity/hBcFT0"), localBC); + if (futureActivity) + histos.fill(HIST("bcQA/futureActivity/hBcFT0"), localBC); + if (!pastActivity) + histos.fill(HIST("bcQA/noPastActivity/hBcFT0"), localBC); + if (!futureActivity) + histos.fill(HIST("bcQA/noFutureActivity/hBcFT0"), localBC); + if (!pastActivity && !futureActivity) + histos.fill(HIST("bcQA/noPastFutureActivity/hBcFT0"), localBC); + } + if (bc.has_fdd()) { + histos.fill(HIST("bcQA/hBcFDD"), localBC); + if (pastActivity) + histos.fill(HIST("bcQA/pastActivity/hBcFDD"), localBC); + if (futureActivity) + histos.fill(HIST("bcQA/futureActivity/hBcFDD"), localBC); + } + if (bc.has_zdc()) { + histos.fill(HIST("bcQA/hBcZDC"), localBC); + if (pastActivity) + histos.fill(HIST("bcQA/pastActivity/hBcZDC"), localBC); + if (futureActivity) + histos.fill(HIST("bcQA/futureActivity/hBcZDC"), localBC); + } + + } // end of bc loop + + // ### collision loop + for (const auto& col : cols) { + if (std::abs(col.posZ()) > 10) + continue; + + const auto& foundBC = col.foundBC_as(); + uint64_t globalBC = foundBC.globalBC(); + // uint64_t orbit = globalBC / nBCsPerOrbit; + int localBC = globalBC % nBCsPerOrbit; + + int64_t ts = foundBC.timestamp(); + double secFromSOR = ts / 1000. - minSec; + + // search for nearest ft0a&ft0c entry + uint64_t globalOrigBC = col.bc_as().globalBC(); + int32_t indexClosestTVX = findClosest(globalOrigBC, mapGlobalBcWithTVX); + int bcToClosestTVXdiff = static_cast(globalOrigBC - vGlobalBCs[indexClosestTVX]); + + // selection decisions: + bool noPU = col.selection_bit(kNoSameBunchPileup); + bool pvTOFmatched = col.selection_bit(kIsVertexTOFmatched); + bool narrowDeltaTimeVeto = col.selection_bit(kNoCollInTimeRangeNarrow); + bool noCollSameROF = col.selection_bit(kNoCollInRofStrict); + bool bcDiffCut = (bcToClosestTVXdiff == 0); + + auto bcIndex = foundBC.globalIndex(); + // bool noNearbyActivity = (vPastActivity[bcIndex] == 0 && vFutureActivity[bcIndex] == 0); + bool noPastActivity = (vPastActivity[bcIndex] == 0); + + // ### count tracks of different types + int nPVtracks = 0; + int nGlobalTracks = 0; + // int nTOFtracks = 0; + auto tracksGrouped = tracks.sliceBy(perCollision, col.globalIndex()); + for (const auto& track : tracksGrouped) { + if (!track.isPVContributor()) { + continue; + } + if (track.itsNCls() < 5) + continue; + if (track.pt() < 0.2 || track.pt() > 10) + continue; + if (std::abs(track.eta()) > 0.8) + continue; + + nPVtracks++; + // nTOFtracks += track.hasTOF(); + + if (track.hasITS() && track.hasTPC() && track.tpcNClsFound() > 50 && track.tpcNClsCrossedRows() > 50 && track.tpcChi2NCl() < 4) + nGlobalTracks++; + } // end of track loop + + bool hasFT0 = foundBC.has_ft0(); + bool hasFV0A = foundBC.has_fv0a(); + + // bool noFT0activityNearby = false; + bool noFT0activityNearby = (vNearbyFT0activity[bcIndex] == 0); + // check kIsFlangeEvent + if (hasFT0) { + std::bitset<8> triggers = foundBC.ft0().triggerMask(); + if (triggers[o2::ft0::RecPoints::ETriggerBits::kIsFlangeEvent]) + noFT0activityNearby = false; + } + + float vZ = col.posZ(); + float vZft0 = hasFT0 ? foundBC.ft0().posZ() : -1000; + float diffVz = vZft0 - vZ; + + float multV0A = hasFV0A ? col.multFV0A() : 0; + float multT0A = hasFT0 ? col.multFT0A() : 0; + float multT0C = hasFT0 ? col.multFT0C() : 0; + + float multT0M = multT0A + multT0C; + // bool badVzDiff = col.selection_bit(kIsGoodZvtxFT0vsPV); + // bool badVzDiff = hasFT0 && (multT0M > 5000) && (diffVz < -2.5 || diffVz > 2.5); + float meanDiff = 0.0; // cm + // O-O + if (lastRunNumber == 564356) + meanDiff = -0.01; + if (lastRunNumber == 564359) + meanDiff = -0.17; + if (lastRunNumber == 564373) + meanDiff = 0.99; + if (lastRunNumber == 564374) + meanDiff = 0.57; + // Ne-Ne + if (lastRunNumber == 564468) + meanDiff = -0.51; + if (lastRunNumber == 564468) + meanDiff = -0.60; + + // float stdDev = (multT0M > 20) ? 0.54 + 6.46 / sqrt(multT0M) : 2.0; // cm + float stdDev = (multT0M > 10) ? 0.144723 + 13.5345 / sqrt(multT0M) : 1.5; // cm + if (multT0M > 4000) + stdDev = 0.35; // cm + bool badVzDiff = diffVz < (meanDiff - stdDev * nSigmaForVzDiff - safetyDiffMargin) || diffVz > (meanDiff + stdDev * nSigmaForVzDiff + safetyDiffMargin); + + bool underLine = false; + if (hasFT0 && nPVtracks < 45. / 40000 * multV0A - 4 && nPVtracks < 20) { + underLine = true; + } + bool grassOnTheRight = false; + if (hasFT0 && nPVtracks < 220. / 40000 * multV0A - 100 && nPVtracks >= 25) { + grassOnTheRight = true; + } + + // vs time + if (noPU) { + histos.fill(HIST("hSecondsCollisions/noPU"), secFromSOR); + if (underLine) + histos.fill(HIST("hSecondsCollisions/noPU_underLine"), secFromSOR); + if (grassOnTheRight) + histos.fill(HIST("hSecondsCollisions/noPU_grassOnTheRight"), secFromSOR); + if (!underLine && !grassOnTheRight) + histos.fill(HIST("hSecondsCollisions/noPU_good"), secFromSOR); + } + + // study bc diff: + int nContributors = col.numContrib(); + float timeRes = col.collisionTimeRes(); + // int64_t bcInTF = (globalBC - bcSOR) % nBCsPerTF; + // if (col.selection_bit(kIsVertexTOFmatched)) { + // histos.fill(HIST("hColBcDiffVsNcontribWithTOF"), nContributors, bcToClosestTVXdiff); + // histos.fill(HIST("hColTimeResVsNcontribWithTOF"), nContributors, timeRes); + // histos.fill(HIST("hBcColTOF"), localBC); + // } + + histos.fill(HIST("noSpecSelections/hBcColNoSel8"), localBC); + + if (noPU) { + histos.fill(HIST("noPileup/hBcColNoSel8"), localBC); + } + if (pvTOFmatched) { + histos.fill(HIST("pvTOFmatched/hBcColNoSel8"), localBC); + } + if (bcDiffCut) { + histos.fill(HIST("bcDiffCut/hBcColNoSel8"), localBC); + } + if (noPastActivity) { + histos.fill(HIST("noPastActivity/hBcColNoSel8"), localBC); + } + if (noFT0activityNearby) { + histos.fill(HIST("noFT0activityNearby/hBcColNoSel8"), localBC); + } + if (badVzDiff) { + histos.fill(HIST("badVzDiff/hBcColNoSel8"), localBC); + } + if (!badVzDiff) { + histos.fill(HIST("goodVzDiff/hBcColNoSel8"), localBC); + } + if (narrowDeltaTimeVeto) { + histos.fill(HIST("narrowTimeVeto/hBcColNoSel8"), localBC); + } + if (noCollSameROF) { + histos.fill(HIST("noCollSameROF/hBcColNoSel8"), localBC); + } + if (noPU && underLine) { + histos.fill(HIST("noPileup_LowMultCut/hBcColNoSel8"), localBC); + } + if (noPU && grassOnTheRight) { + histos.fill(HIST("noPileup_HighMultCloudCut/hBcColNoSel8"), localBC); + } + if (noPU && pvTOFmatched && !badVzDiff && noFT0activityNearby) { // noPileup_cutByVzDiff_pvTOF_noFT0act + histos.fill(HIST("noPileup_cutByVzDiff_pvTOF_noFT0act/hBcColNoSel8"), localBC); + } + + // only here cut on sel8: + if (!col.sel8()) + continue; + + histos.fill(HIST("noSpecSelections/hBcTVX"), localBC); + histos.fill(HIST("noSpecSelections/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); + histos.fill(HIST("noSpecSelections/hColTimeResVsNcontrib"), nContributors, timeRes); + + if (noPU) { + histos.fill(HIST("noPileup/hBcTVX"), localBC); + histos.fill(HIST("noPileup/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); + histos.fill(HIST("noPileup/hColTimeResVsNcontrib"), nContributors, timeRes); + } + if (pvTOFmatched) { + histos.fill(HIST("pvTOFmatched/hBcTVX"), localBC); + histos.fill(HIST("pvTOFmatched/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); + histos.fill(HIST("pvTOFmatched/hColTimeResVsNcontrib"), nContributors, timeRes); + } + if (bcDiffCut) { + histos.fill(HIST("bcDiffCut/hBcTVX"), localBC); + histos.fill(HIST("bcDiffCut/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); + histos.fill(HIST("bcDiffCut/hColTimeResVsNcontrib"), nContributors, timeRes); + } + if (noPastActivity) { + histos.fill(HIST("noPastActivity/hBcTVX"), localBC); + histos.fill(HIST("noPastActivity/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); + histos.fill(HIST("noPastActivity/hColTimeResVsNcontrib"), nContributors, timeRes); + } + if (noFT0activityNearby) { + histos.fill(HIST("noFT0activityNearby/hBcTVX"), localBC); + histos.fill(HIST("noFT0activityNearby/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); + histos.fill(HIST("noFT0activityNearby/hColTimeResVsNcontrib"), nContributors, timeRes); + } + if (badVzDiff) { + histos.fill(HIST("badVzDiff/hBcTVX"), localBC); + histos.fill(HIST("badVzDiff/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); + histos.fill(HIST("badVzDiff/hColTimeResVsNcontrib"), nContributors, timeRes); + } + if (!badVzDiff) { + histos.fill(HIST("goodVzDiff/hBcTVX"), localBC); + histos.fill(HIST("goodVzDiff/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); + histos.fill(HIST("goodVzDiff/hColTimeResVsNcontrib"), nContributors, timeRes); + } + if (narrowDeltaTimeVeto) { + histos.fill(HIST("narrowTimeVeto/hBcTVX"), localBC); + histos.fill(HIST("narrowTimeVeto/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); + histos.fill(HIST("narrowTimeVeto/hColTimeResVsNcontrib"), nContributors, timeRes); + } + if (noCollSameROF) { + histos.fill(HIST("noCollSameROF/hBcTVX"), localBC); + histos.fill(HIST("noCollSameROF/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); + histos.fill(HIST("noCollSameROF/hColTimeResVsNcontrib"), nContributors, timeRes); + } + if (noPU && underLine) { + histos.fill(HIST("noPileup_LowMultCut/hBcTVX"), localBC); + histos.fill(HIST("noPileup_LowMultCut/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); + histos.fill(HIST("noPileup_LowMultCut/hColTimeResVsNcontrib"), nContributors, timeRes); + } + if (noPU && grassOnTheRight) { + histos.fill(HIST("noPileup_HighMultCloudCut/hBcTVX"), localBC); + histos.fill(HIST("noPileup_HighMultCloudCut/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); + histos.fill(HIST("noPileup_HighMultCloudCut/hColTimeResVsNcontrib"), nContributors, timeRes); + } + if (noPU && pvTOFmatched && !badVzDiff && noFT0activityNearby) { // noPileup_cutByVzDiff_pvTOF_noFT0act + histos.fill(HIST("noPileup_cutByVzDiff_pvTOF_noFT0act/hBcTVX"), localBC); + histos.fill(HIST("noPileup_cutByVzDiff_pvTOF_noFT0act/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); + histos.fill(HIST("noPileup_cutByVzDiff_pvTOF_noFT0act/hColTimeResVsNcontrib"), nContributors, timeRes); + } + + if (foundBC.has_ft0()) { + // float multT0A = foundBC.has_ft0() ? foundBC.ft0().sumAmpA() : -999.f; + // float multT0C = foundBC.has_ft0() ? foundBC.ft0().sumAmpC() : -999.f; + + histos.fill(HIST("noSpecSelections/hBcFT0"), localBC); + histos.fill(HIST("noSpecSelections/hVtxFT0VsVtxCol"), vZft0, vZ); + histos.fill(HIST("noSpecSelections/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); + histos.fill(HIST("noSpecSelections/nTracksPV_vs_T0A"), multT0A, nPVtracks); + histos.fill(HIST("noSpecSelections/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracks); + histos.fill(HIST("noSpecSelections/nTracksPV_vs_T0C"), multT0C, nPVtracks); + histos.fill(HIST("noSpecSelections/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracks); + + if (noPU) { + histos.fill(HIST("noPileup/hBcFT0"), localBC); + histos.fill(HIST("noPileup/hVtxFT0VsVtxCol"), vZft0, vZ); + histos.fill(HIST("noPileup/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); + histos.fill(HIST("noPileup/nTracksPV_vs_T0A"), multT0A, nPVtracks); + histos.fill(HIST("noPileup/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracks); + histos.fill(HIST("noPileup/nTracksPV_vs_T0C"), multT0C, nPVtracks); + histos.fill(HIST("noPileup/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracks); + } + if (pvTOFmatched) { + histos.fill(HIST("pvTOFmatched/hBcFT0"), localBC); + histos.fill(HIST("pvTOFmatched/hVtxFT0VsVtxCol"), vZft0, vZ); + histos.fill(HIST("pvTOFmatched/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); + histos.fill(HIST("pvTOFmatched/nTracksPV_vs_T0A"), multT0A, nPVtracks); + histos.fill(HIST("pvTOFmatched/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracks); + histos.fill(HIST("pvTOFmatched/nTracksPV_vs_T0C"), multT0C, nPVtracks); + histos.fill(HIST("pvTOFmatched/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracks); + } + if (bcDiffCut) { + histos.fill(HIST("bcDiffCut/hBcFT0"), localBC); + histos.fill(HIST("bcDiffCut/hVtxFT0VsVtxCol"), vZft0, vZ); + histos.fill(HIST("bcDiffCut/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); + histos.fill(HIST("bcDiffCut/nTracksPV_vs_T0A"), multT0A, nPVtracks); + histos.fill(HIST("bcDiffCut/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracks); + histos.fill(HIST("bcDiffCut/nTracksPV_vs_T0C"), multT0C, nPVtracks); + histos.fill(HIST("bcDiffCut/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracks); + } + if (badVzDiff) { + histos.fill(HIST("badVzDiff/hBcFT0"), localBC); + histos.fill(HIST("badVzDiff/hVtxFT0VsVtxCol"), vZft0, vZ); + histos.fill(HIST("badVzDiff/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); + histos.fill(HIST("badVzDiff/nTracksPV_vs_T0A"), multT0A, nPVtracks); + histos.fill(HIST("badVzDiff/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracks); + histos.fill(HIST("badVzDiff/nTracksPV_vs_T0C"), multT0C, nPVtracks); + histos.fill(HIST("badVzDiff/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracks); + } + if (!badVzDiff) { + histos.fill(HIST("goodVzDiff/hBcFT0"), localBC); + histos.fill(HIST("goodVzDiff/hVtxFT0VsVtxCol"), vZft0, vZ); + histos.fill(HIST("goodVzDiff/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); + histos.fill(HIST("goodVzDiff/nTracksPV_vs_T0A"), multT0A, nPVtracks); + histos.fill(HIST("goodVzDiff/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracks); + histos.fill(HIST("goodVzDiff/nTracksPV_vs_T0C"), multT0C, nPVtracks); + histos.fill(HIST("goodVzDiff/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracks); + } + if (noPastActivity) { + histos.fill(HIST("noPastActivity/hBcFT0"), localBC); + histos.fill(HIST("noPastActivity/hVtxFT0VsVtxCol"), vZft0, vZ); + histos.fill(HIST("noPastActivity/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); + histos.fill(HIST("noPastActivity/nTracksPV_vs_T0A"), multT0A, nPVtracks); + histos.fill(HIST("noPastActivity/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracks); + histos.fill(HIST("noPastActivity/nTracksPV_vs_T0C"), multT0C, nPVtracks); + histos.fill(HIST("noPastActivity/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracks); + } + if (noFT0activityNearby) { + histos.fill(HIST("noFT0activityNearby/hBcFT0"), localBC); + histos.fill(HIST("noFT0activityNearby/hVtxFT0VsVtxCol"), vZft0, vZ); + histos.fill(HIST("noFT0activityNearby/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); + histos.fill(HIST("noFT0activityNearby/nTracksPV_vs_T0A"), multT0A, nPVtracks); + histos.fill(HIST("noFT0activityNearby/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracks); + histos.fill(HIST("noFT0activityNearby/nTracksPV_vs_T0C"), multT0C, nPVtracks); + histos.fill(HIST("noFT0activityNearby/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracks); + } + if (narrowDeltaTimeVeto) { + histos.fill(HIST("narrowTimeVeto/hBcFT0"), localBC); + histos.fill(HIST("narrowTimeVeto/hVtxFT0VsVtxCol"), vZft0, vZ); + histos.fill(HIST("narrowTimeVeto/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); + histos.fill(HIST("narrowTimeVeto/nTracksPV_vs_T0A"), multT0A, nPVtracks); + histos.fill(HIST("narrowTimeVeto/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracks); + histos.fill(HIST("narrowTimeVeto/nTracksPV_vs_T0C"), multT0C, nPVtracks); + histos.fill(HIST("narrowTimeVeto/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracks); + } + if (noCollSameROF) { + histos.fill(HIST("noCollSameROF/hBcFT0"), localBC); + histos.fill(HIST("noCollSameROF/hVtxFT0VsVtxCol"), vZft0, vZ); + histos.fill(HIST("noCollSameROF/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); + histos.fill(HIST("noCollSameROF/nTracksPV_vs_T0A"), multT0A, nPVtracks); + histos.fill(HIST("noCollSameROF/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracks); + histos.fill(HIST("noCollSameROF/nTracksPV_vs_T0C"), multT0C, nPVtracks); + histos.fill(HIST("noCollSameROF/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracks); + } + if (noPU && underLine) { + histos.fill(HIST("noPileup_LowMultCut/hBcFT0"), localBC); + histos.fill(HIST("noPileup_LowMultCut/hVtxFT0VsVtxCol"), vZft0, vZ); + histos.fill(HIST("noPileup_LowMultCut/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); + histos.fill(HIST("noPileup_LowMultCut/nTracksPV_vs_T0A"), multT0A, nPVtracks); + histos.fill(HIST("noPileup_LowMultCut/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracks); + histos.fill(HIST("noPileup_LowMultCut/nTracksPV_vs_T0C"), multT0C, nPVtracks); + histos.fill(HIST("noPileup_LowMultCut/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracks); + } + if (noPU && grassOnTheRight) { + histos.fill(HIST("noPileup_HighMultCloudCut/hBcFT0"), localBC); + histos.fill(HIST("noPileup_HighMultCloudCut/hVtxFT0VsVtxCol"), vZft0, vZ); + histos.fill(HIST("noPileup_HighMultCloudCut/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); + histos.fill(HIST("noPileup_HighMultCloudCut/nTracksPV_vs_T0A"), multT0A, nPVtracks); + histos.fill(HIST("noPileup_HighMultCloudCut/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracks); + histos.fill(HIST("noPileup_HighMultCloudCut/nTracksPV_vs_T0C"), multT0C, nPVtracks); + histos.fill(HIST("noPileup_HighMultCloudCut/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracks); + } + if (noPU && pvTOFmatched && !badVzDiff && noFT0activityNearby) { // noPileup_cutByVzDiff_pvTOF_noFT0act + histos.fill(HIST("noPileup_cutByVzDiff_pvTOF_noFT0act/hBcFT0"), localBC); + histos.fill(HIST("noPileup_cutByVzDiff_pvTOF_noFT0act/hVtxFT0VsVtxCol"), vZft0, vZ); + histos.fill(HIST("noPileup_cutByVzDiff_pvTOF_noFT0act/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); + histos.fill(HIST("noPileup_cutByVzDiff_pvTOF_noFT0act/nTracksPV_vs_T0A"), multT0A, nPVtracks); + histos.fill(HIST("noPileup_cutByVzDiff_pvTOF_noFT0act/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracks); + histos.fill(HIST("noPileup_cutByVzDiff_pvTOF_noFT0act/nTracksPV_vs_T0C"), multT0C, nPVtracks); + histos.fill(HIST("noPileup_cutByVzDiff_pvTOF_noFT0act/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracks); + } + } + + if (foundBC.has_fv0a()) { + histos.fill(HIST("noSpecSelections/hBcFV0"), localBC); + histos.fill(HIST("noSpecSelections/nTracksPV_vs_V0A"), multV0A, nPVtracks); + histos.fill(HIST("noSpecSelections/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracks); + if (noPU) { + histos.fill(HIST("noPileup/hBcFV0"), localBC); + histos.fill(HIST("noPileup/nTracksPV_vs_V0A"), multV0A, nPVtracks); + histos.fill(HIST("noPileup/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracks); + } + if (pvTOFmatched) { + histos.fill(HIST("pvTOFmatched/hBcFV0"), localBC); + histos.fill(HIST("pvTOFmatched/nTracksPV_vs_V0A"), multV0A, nPVtracks); + histos.fill(HIST("pvTOFmatched/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracks); + } + if (bcDiffCut) { + histos.fill(HIST("bcDiffCut/hBcFV0"), localBC); + histos.fill(HIST("bcDiffCut/nTracksPV_vs_V0A"), multV0A, nPVtracks); + histos.fill(HIST("bcDiffCut/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracks); + } + if (badVzDiff) { + histos.fill(HIST("badVzDiff/hBcFV0"), localBC); + histos.fill(HIST("badVzDiff/nTracksPV_vs_V0A"), multV0A, nPVtracks); + histos.fill(HIST("badVzDiff/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracks); + } + if (!badVzDiff) { + histos.fill(HIST("goodVzDiff/hBcFV0"), localBC); + histos.fill(HIST("goodVzDiff/nTracksPV_vs_V0A"), multV0A, nPVtracks); + histos.fill(HIST("goodVzDiff/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracks); + } + if (noPastActivity) { + histos.fill(HIST("noPastActivity/hBcFV0"), localBC); + histos.fill(HIST("noPastActivity/nTracksPV_vs_V0A"), multV0A, nPVtracks); + histos.fill(HIST("noPastActivity/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracks); + } + if (noFT0activityNearby) { + histos.fill(HIST("noFT0activityNearby/hBcFV0"), localBC); + histos.fill(HIST("noFT0activityNearby/nTracksPV_vs_V0A"), multV0A, nPVtracks); + histos.fill(HIST("noFT0activityNearby/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracks); + } + if (narrowDeltaTimeVeto) { + histos.fill(HIST("narrowTimeVeto/hBcFV0"), localBC); + histos.fill(HIST("narrowTimeVeto/nTracksPV_vs_V0A"), multV0A, nPVtracks); + histos.fill(HIST("narrowTimeVeto/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracks); + } + if (noCollSameROF) { + histos.fill(HIST("noCollSameROF/hBcFV0"), localBC); + histos.fill(HIST("noCollSameROF/nTracksPV_vs_V0A"), multV0A, nPVtracks); + histos.fill(HIST("noCollSameROF/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracks); + } + if (noPU && underLine) { + histos.fill(HIST("noPileup_LowMultCut/hBcFV0"), localBC); + histos.fill(HIST("noPileup_LowMultCut/nTracksPV_vs_V0A"), multV0A, nPVtracks); + histos.fill(HIST("noPileup_LowMultCut/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracks); + } + if (noPU && grassOnTheRight) { + histos.fill(HIST("noPileup_HighMultCloudCut/hBcFV0"), localBC); + histos.fill(HIST("noPileup_HighMultCloudCut/nTracksPV_vs_V0A"), multV0A, nPVtracks); + histos.fill(HIST("noPileup_HighMultCloudCut/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracks); + } + if (noPU && pvTOFmatched && !badVzDiff && noFT0activityNearby) { // noPileup_cutByVzDiff_pvTOF_noFT0act + histos.fill(HIST("noPileup_cutByVzDiff_pvTOF_noFT0act/hBcFV0"), localBC); + histos.fill(HIST("noPileup_cutByVzDiff_pvTOF_noFT0act/nTracksPV_vs_V0A"), multV0A, nPVtracks); + histos.fill(HIST("noPileup_cutByVzDiff_pvTOF_noFT0act/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracks); + } + } + if (foundBC.has_zdc()) { + histos.fill(HIST("noSpecSelections/hBcZDC"), localBC); + if (noPU) { + histos.fill(HIST("noPileup/hBcZDC"), localBC); + } + if (pvTOFmatched) { + histos.fill(HIST("pvTOFmatched/hBcZDC"), localBC); + } + if (bcDiffCut) { + histos.fill(HIST("bcDiffCut/hBcZDC"), localBC); + } + if (badVzDiff) { + histos.fill(HIST("badVzDiff/hBcZDC"), localBC); + } + if (!badVzDiff) { + histos.fill(HIST("goodVzDiff/hBcZDC"), localBC); + } + if (noPastActivity) { + histos.fill(HIST("noPastActivity/hBcZDC"), localBC); + } + if (noFT0activityNearby) { + histos.fill(HIST("noFT0activityNearby/hBcZDC"), localBC); + } + if (narrowDeltaTimeVeto) { + histos.fill(HIST("narrowTimeVeto/hBcZDC"), localBC); + } + if (noCollSameROF) { + histos.fill(HIST("noCollSameROF/hBcZDC"), localBC); + } + if (noPU && underLine) { + histos.fill(HIST("noPileup_LowMultCut/hBcZDC"), localBC); + } + if (noPU && grassOnTheRight) { + histos.fill(HIST("noPileup_HighMultCloudCut/hBcZDC"), localBC); + } + if (noPU && pvTOFmatched && !badVzDiff && noFT0activityNearby) { // noPileup_cutByVzDiff_pvTOF_noFT0act + histos.fill(HIST("noPileup_cutByVzDiff_pvTOF_noFT0act/hBcZDC"), localBC); + } + } + + // bc diff + // auto bc = col.bc_as(); + auto bcOriginal = globalOrigBC % 3564; + float bcDiff = bcOriginal - localBC; + + histos.fill(HIST("noSpecSelections/hTVXvsBcDiff"), bcDiff); + if (noPU) { + histos.fill(HIST("noPileup/hTVXvsBcDiff"), bcDiff); + } + if (pvTOFmatched) { + histos.fill(HIST("pvTOFmatched/hTVXvsBcDiff"), bcDiff); + } + if (bcDiffCut) { + histos.fill(HIST("bcDiffCut/hTVXvsBcDiff"), bcDiff); + } + if (badVzDiff) { + histos.fill(HIST("badVzDiff/hTVXvsBcDiff"), bcDiff); + } + if (!badVzDiff) { + histos.fill(HIST("goodVzDiff/hTVXvsBcDiff"), bcDiff); + } + if (noPastActivity) { + histos.fill(HIST("noPastActivity/hTVXvsBcDiff"), bcDiff); + } + if (noFT0activityNearby) { + histos.fill(HIST("noFT0activityNearby/hTVXvsBcDiff"), bcDiff); + } + if (narrowDeltaTimeVeto) { + histos.fill(HIST("narrowTimeVeto/hTVXvsBcDiff"), bcDiff); + } + if (noCollSameROF) { + histos.fill(HIST("noCollSameROF/hTVXvsBcDiff"), bcDiff); + } + if (noPU && underLine) { + histos.fill(HIST("noPileup_LowMultCut/hTVXvsBcDiff"), bcDiff); + } + if (noPU && grassOnTheRight) { + histos.fill(HIST("noPileup_HighMultCloudCut/hTVXvsBcDiff"), bcDiff); + } + if (noPU && pvTOFmatched && !badVzDiff && noFT0activityNearby) { // noPileup_cutByVzDiff_pvTOF_noFT0act + histos.fill(HIST("noPileup_cutByVzDiff_pvTOF_noFT0act/hTVXvsBcDiff"), bcDiff); + } + + } // end of collisions loop + } + PROCESS_SWITCH(LightIonsEvSelQa, processRun3, "Process Run3 tracking vs detector occupancy QA", true); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} From 53944f2566cf1b6f11b4ea75ef5e109f5aa9447f Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Sat, 2 Aug 2025 02:30:44 +0200 Subject: [PATCH 193/345] [PWGEM/Dilepton] update 2PC (#12379) Co-authored-by: ALICE Action Bot --- PWGEM/Dilepton/Core/EMTrackCut.h | 8 ++-- PWGEM/Dilepton/DataModel/dileptonTables.h | 42 +++---------------- .../TableProducer/createEMEventDilepton.cxx | 3 ++ .../TableProducer/skimmerPrimaryTrack.cxx | 28 +++++++++---- PWGEM/Dilepton/Utils/EMTrackUtilities.h | 6 ++- 5 files changed, 39 insertions(+), 48 deletions(-) diff --git a/PWGEM/Dilepton/Core/EMTrackCut.h b/PWGEM/Dilepton/Core/EMTrackCut.h index a5d62b45ac0..58503b8a82e 100644 --- a/PWGEM/Dilepton/Core/EMTrackCut.h +++ b/PWGEM/Dilepton/Core/EMTrackCut.h @@ -140,11 +140,11 @@ class EMTrackCut : public TNamed case EMTrackCuts::kTrackPhiRange: return track.phi() > mMinTrackPhi && track.phi() < mMaxTrackPhi; - case EMTrackCuts::kDCAxy: - return std::fabs(track.dcaXY()) < ((mMaxDcaXYPtDep) ? mMaxDcaXYPtDep(track.pt()) : mMaxDcaXY); + // case EMTrackCuts::kDCAxy: + // return std::fabs(track.dcaXY()) < ((mMaxDcaXYPtDep) ? mMaxDcaXYPtDep(track.pt()) : mMaxDcaXY); - case EMTrackCuts::kDCAz: - return std::fabs(track.dcaZ()) < mMaxDcaZ; + // case EMTrackCuts::kDCAz: + // return std::fabs(track.dcaZ()) < mMaxDcaZ; case EMTrackCuts::kTrackBit: { // for (int i = 0; i < 10; i++) { diff --git a/PWGEM/Dilepton/DataModel/dileptonTables.h b/PWGEM/Dilepton/DataModel/dileptonTables.h index b4773327fe2..74b9d1b604d 100644 --- a/PWGEM/Dilepton/DataModel/dileptonTables.h +++ b/PWGEM/Dilepton/DataModel/dileptonTables.h @@ -822,42 +822,12 @@ namespace emprimarytrack DECLARE_SOA_INDEX_COLUMN(EMEvent, emevent); //! DECLARE_SOA_COLUMN(CollisionId, collisionId, int); //! DECLARE_SOA_COLUMN(TrackId, trackId, int); //! -// DECLARE_SOA_COLUMN(Sign, sign, int8_t); //! +DECLARE_SOA_COLUMN(Sign, sign, int8_t); //! DECLARE_SOA_COLUMN(TrackBit, trackBit, uint16_t); //! -DECLARE_SOA_COLUMN(PtUINT16, ptuint16, uint16_t); //! 0 - 65535 -DECLARE_SOA_COLUMN(DcaZINT16, dcaZint16, int16_t); //! -32768 - +32767 -DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt, [](uint16_t ptuint16) -> float { return static_cast(ptuint16) * 1e-4; }); -DECLARE_SOA_DYNAMIC_COLUMN(DcaZ, dcaZ, [](int16_t dcaZint16) -> float { return static_cast(dcaZint16) * 1e-4; }); -// DECLARE_SOA_DYNAMIC_COLUMN(Signed1Pt, signed1Pt, [](float pt, int8_t sign) -> float { return sign * 1. / pt; }); -// DECLARE_SOA_DYNAMIC_COLUMN(P, p, [](float pt, float eta) -> float { return pt * std::cosh(eta); }); -// DECLARE_SOA_DYNAMIC_COLUMN(Px, px, [](float pt, float phi) -> float { return pt * std::cos(phi); }); -// DECLARE_SOA_DYNAMIC_COLUMN(Py, py, [](float pt, float phi) -> float { return pt * std::sin(phi); }); -// DECLARE_SOA_DYNAMIC_COLUMN(Pz, pz, [](float pt, float eta) -> float { return pt * std::sinh(eta); }); } // namespace emprimarytrack -DECLARE_SOA_TABLE_VERSIONED(EMPrimaryTracks_000, "AOD", "EMPRIMARYTRACK", 0, //! - o2::soa::Index<>, emprimarytrack::CollisionId, emprimarytrack::TrackId, /* emprimarytrack::Sign,*/ - emprimarytrack::PtUINT16, track::Eta, track::Phi, track::DcaXY, emprimarytrack::DcaZINT16, emprimarytrack::TrackBit, - - // track::TPCNClsFindable, track::TPCNClsFindableMinusFound, track::TPCNClsFindableMinusCrossedRows, track::TPCNClsShared, track::TPCChi2NCl, - // track::ITSClusterSizes, track::ITSChi2NCl, track::DetectorMap, - - // // dynamic column - // track::TPCNClsFound, - // track::TPCNClsCrossedRows, - // track::TPCCrossedRowsOverFindableCls, - // track::TPCFoundOverFindableCls, - // track::TPCFractionSharedCls, - // track::v001::ITSClusterMap, track::v001::ITSNCls, track::v001::ITSNClsInnerBarrel, - - // track::HasITS, track::HasTPC, track::HasTRD, track::HasTOF, - // emprimarytrack::Signed1Pt, - // emprimarytrack::P, - // emprimarytrack::Px, - // emprimarytrack::Py, - // emprimarytrack::Pz - emprimarytrack::Pt, - emprimarytrack::DcaZ); +DECLARE_SOA_TABLE_VERSIONED(EMPrimaryTracks_000, "AOD", "EMPRIMARYTRACK", 0, //! primary charged track table for 2PC + o2::soa::Index<>, emprimarytrack::CollisionId, emprimarytrack::TrackId, emprimarytrack::Sign, track::Pt, track::Eta, track::Phi, emprimarytrack::TrackBit); using EMPrimaryTracks = EMPrimaryTracks_000; // iterators @@ -867,9 +837,9 @@ DECLARE_SOA_TABLE(EMPrimaryTrackEMEventIds, "AOD", "PRMTRKEMEVENTID", emprimaryt // iterators using EMPrimaryTrackEMEventId = EMPrimaryTrackEMEventIds::iterator; -// DECLARE_SOA_TABLE(EMPrimaryTrackEMEventIdsTMP, "AOD", "PRMTRKEVIDTMP", track::CollisionId); // To be joined with EMPrimaryTracks in associateDileptonToEMEvent -// // iterators -// using EMPrimaryTrackEMEventIdTMP = EMPrimaryTrackEMEventIdsTMP::iterator; +DECLARE_SOA_TABLE(EMPrimaryTrackEMEventIdsTMP, "AOD", "PRMTRKEVIDTMP", track::CollisionId); // To be joined with EMPrimaryTracks in associateDileptonToEMEvent +// iterators +using EMPrimaryTrackEMEventIdTMP = EMPrimaryTrackEMEventIdsTMP::iterator; // Dummy data for MC namespace emdummydata diff --git a/PWGEM/Dilepton/TableProducer/createEMEventDilepton.cxx b/PWGEM/Dilepton/TableProducer/createEMEventDilepton.cxx index a08d6939ee9..b8575494195 100644 --- a/PWGEM/Dilepton/TableProducer/createEMEventDilepton.cxx +++ b/PWGEM/Dilepton/TableProducer/createEMEventDilepton.cxx @@ -32,6 +32,7 @@ #include using namespace o2; +using namespace o2::aod; using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::soa; @@ -307,6 +308,7 @@ struct AssociateDileptonToEMEvent { PresliceUnsorted perCollision_el = aod::emprimaryelectron::collisionId; PresliceUnsorted perCollision_mu = aod::emprimarymuon::collisionId; Preslice perCollision_track = aod::emprimarytrack::collisionId; + // Preslice perCollision_track = aod::track::collisionId; void init(o2::framework::InitContext&) {} @@ -342,6 +344,7 @@ struct AssociateDileptonToEMEvent { } void processChargedTrack(aod::EMEvents const& collisions, aod::EMPrimaryTracks const& tracks) + // void processChargedTrack(aod::EMEvents const& collisions, aod::EMPrimaryTrackEMEventIdsTMP const& tracks) { fillEventId(collisions, tracks, prmtrackeventid, perCollision_track); } diff --git a/PWGEM/Dilepton/TableProducer/skimmerPrimaryTrack.cxx b/PWGEM/Dilepton/TableProducer/skimmerPrimaryTrack.cxx index e27fef61e5f..2da9262c0dc 100644 --- a/PWGEM/Dilepton/TableProducer/skimmerPrimaryTrack.cxx +++ b/PWGEM/Dilepton/TableProducer/skimmerPrimaryTrack.cxx @@ -75,13 +75,13 @@ struct skimmerPrimaryTrack { Configurable minpt{"minpt", 0.2, "min pt for ITS-TPC track"}; Configurable maxpt{"maxpt", 5.0, "max pt for ITS-TPC track"}; Configurable maxeta{"maxeta", 0.8, "eta acceptance"}; - Configurable dca_xy_max{"dca_xy_max", 0.5, "max DCAxy in cm"}; - Configurable dca_z_max{"dca_z_max", 0.5, "max DCAz in cm"}; + Configurable dca_xy_max{"dca_xy_max", 1.0, "max DCAxy in cm"}; + Configurable dca_z_max{"dca_z_max", 1.0, "max DCAz in cm"}; + Configurable max_frac_shared_clusters_tpc{"max_frac_shared_clusters_tpc", 999.f, "max fraction of shared clusters in TPC"}; // Configurable min_ncluster_tpc{"min_ncluster_tpc", 0, "min ncluster tpc"}; // Configurable mincrossedrows{"mincrossedrows", 70, "min. crossed rows"}; // Configurable min_tpc_cr_findable_ratio{"min_tpc_cr_findable_ratio", 0.8, "min. TPC Ncr/Nf ratio"}; - // Configurable max_frac_shared_clusters_tpc{"max_frac_shared_clusters_tpc", 999.f, "max fraction of shared clusters in TPC"}; // Configurable min_ncluster_its{"min_ncluster_its", 4, "min ncluster its"}; // Configurable min_ncluster_itsib{"min_ncluster_itsib", 1, "min ncluster itsib"}; // Configurable maxchi2tpc{"maxchi2tpc", 5.0, "max. chi2/NclsTPC"}; @@ -225,9 +225,9 @@ struct skimmerPrimaryTrack { return false; } - // if (track.tpcFractionSharedCls() > max_frac_shared_clusters_tpc) { - // return false; - // } + if (track.tpcFractionSharedCls() > max_frac_shared_clusters_tpc) { + return false; + } o2::dataformats::DCA mDcaInfoCov; mDcaInfoCov.set(999, 999, 999, 999, 999); @@ -317,7 +317,21 @@ struct skimmerPrimaryTrack { trackBit |= static_cast(RefTrackBit::kFracSharedTPC07); } - emprimarytracks(collision.globalIndex(), track.globalIndex(), static_cast(pt * 1e+4), eta, phi, dcaXY, static_cast(dcaZ * 1e+4), trackBit); + if (std::fabs(dcaZ) < 0.5) { + trackBit |= static_cast(RefTrackBit::kDCAz05cm); + } + if (std::fabs(dcaZ) < 0.3) { + trackBit |= static_cast(RefTrackBit::kDCAz03cm); + } + + if (std::fabs(dcaXY) < 0.5) { + trackBit |= static_cast(RefTrackBit::kDCAxy05cm); + } + if (std::fabs(dcaXY) < 0.3) { + trackBit |= static_cast(RefTrackBit::kDCAxy03cm); + } + + emprimarytracks(collision.globalIndex(), track.globalIndex(), track.sign(), pt, eta, phi, trackBit); // prmtrackeventidtmp(collision.globalIndex()); stored_trackIds.emplace_back(std::pair{collision.globalIndex(), track.globalIndex()}); diff --git a/PWGEM/Dilepton/Utils/EMTrackUtilities.h b/PWGEM/Dilepton/Utils/EMTrackUtilities.h index d5a3f35c1e9..5c5b21e6ea0 100644 --- a/PWGEM/Dilepton/Utils/EMTrackUtilities.h +++ b/PWGEM/Dilepton/Utils/EMTrackUtilities.h @@ -27,7 +27,7 @@ namespace o2::aod::pwgem::dilepton::utils::emtrackutil { -enum class RefTrackBit : uint16_t { // This is not for leptons, but charged particles for ref. flow. +enum class RefTrackBit : uint16_t { // This is not for leptons, but charged tracks for reference flow. kNclsITS5 = 1, kNclsITS6 = 2, kNcrTPC70 = 4, @@ -38,6 +38,10 @@ enum class RefTrackBit : uint16_t { // This is not for leptons, but charged part kChi2TPC4 = 128, kChi2TPC3 = 256, kFracSharedTPC07 = 512, + kDCAxy05cm = 1024, // default is 1 cm + kDCAxy03cm = 2048, + kDCAz05cm = 4096, // default is 1cm + kDCAz03cm = 8192, }; //_______________________________________________________________________ From fb1c3e32ff798f95632f3dc167d29bb4f77e9796 Mon Sep 17 00:00:00 2001 From: Paola Vargas Torres <88360333+PaolaVT@users.noreply.github.com> Date: Fri, 1 Aug 2025 20:31:09 -0600 Subject: [PATCH 194/345] [PWGLF] The analysis task dedxPidAnalysis.cxx was added (#12388) --- PWGLF/Tasks/Nuspex/CMakeLists.txt | 5 + PWGLF/Tasks/Nuspex/dedxPidAnalysis.cxx | 852 +++++++++++++++++++++++++ 2 files changed, 857 insertions(+) create mode 100644 PWGLF/Tasks/Nuspex/dedxPidAnalysis.cxx diff --git a/PWGLF/Tasks/Nuspex/CMakeLists.txt b/PWGLF/Tasks/Nuspex/CMakeLists.txt index 05b1bc2ca8e..8e86feab651 100644 --- a/PWGLF/Tasks/Nuspex/CMakeLists.txt +++ b/PWGLF/Tasks/Nuspex/CMakeLists.txt @@ -150,4 +150,9 @@ o2physics_add_dpl_workflow(he3-lambda-derived-analysis PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(dedx-pid-analysis + SOURCES dedxPidAnalysis.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + endif() diff --git a/PWGLF/Tasks/Nuspex/dedxPidAnalysis.cxx b/PWGLF/Tasks/Nuspex/dedxPidAnalysis.cxx new file mode 100644 index 00000000000..d688f0c8e72 --- /dev/null +++ b/PWGLF/Tasks/Nuspex/dedxPidAnalysis.cxx @@ -0,0 +1,852 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +/// +/// \author Paola Vargas Torres (paola.vargas.torres@cern.ch) +/// \since January 8, 2025 +/// \file dedxPidAnalysis.cxx +/// \brief Analysis to do PID + +#include "PWGLF/DataModel/LFStrangenessTables.h" + +#include "Common/Core/RecoDecay.h" +#include "Common/Core/TrackSelection.h" +#include "Common/Core/TrackSelectionDefaults.h" +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/Track.h" + +#include "TF1.h" + +using namespace o2; +using namespace o2::framework; +using namespace constants::physics; + +using PIDTracks = soa::Join< + aod::Tracks, aod::TracksExtra, aod::TrackSelectionExtension, aod::TracksDCA, aod::TrackSelection, + aod::pidTOFFullPi, aod::pidTOFFullPr, aod::pidTOFFullEl, aod::pidTOFbeta>; + +using SelectedCollisions = soa::Join; + +struct DedxPidAnalysis { + + // dE/dx for all charged particles + HistogramRegistry registryDeDx{ + "registryDeDx", + {}, + OutputObjHandlingPolicy::AnalysisObject, + true, + true}; + // Constant values + static constexpr int kEtaIntervals = 8; + static constexpr int kParticlesType = 4; + float tpcCut = 0.6; + float pionMin = 0.35; + float pionMax = 0.45; + float elTofCut = 0.1; + float pionTofCut = 1.0; + float invMassCut = 0.01; + float invMassCutGamma = 0.0015; + float magField = 1; + float pTcut = 2.0; + + // Configurable Parameters + // Tracks cuts + Configurable minTPCnClsFound{"minTPCnClsFound", 70.0f, + "min number of found TPC clusters"}; + Configurable minNCrossedRowsTPC{"minNCrossedRowsTPC", 70.0f, "min number of found TPC crossed rows"}; + Configurable maxChi2TPC{"maxChi2TPC", 4.0f, + "max chi2 per cluster TPC"}; + Configurable maxChi2ITS{"maxChi2ITS", 36.0f, + "max chi2 per cluster ITS"}; + Configurable maxZDistanceToIP{"maxZDistanceToIP", 10.0f, + "max z distance to IP"}; + Configurable etaMin{"etaMin", -0.8f, "etaMin"}; + Configurable etaMax{"etaMax", +0.8f, "etaMax"}; + Configurable minNCrossedRowsOverFindableClustersTPC{"minNCrossedRowsOverFindableClustersTPC", 0.8f, "Additional cut on the minimum value of the ratio between crossed rows and findable clusters in the TPC"}; + Configurable maxDCAz{"maxDCAz", 2.f, "maxDCAz"}; + // v0 cuts + Configurable v0cospaMin{"v0cospaMin", 0.998f, "Minimum V0 CosPA"}; + Configurable minimumV0Radius{"minimumV0Radius", 0.5f, + "Minimum V0 Radius"}; + Configurable maximumV0Radius{"maximumV0Radius", 100.0f, + "Maximum V0 Radius"}; + Configurable dcaV0DaughtersMax{"dcaV0DaughtersMax", 0.5f, + "Maximum DCA Daughters"}; + Configurable nsigmaTOFmax{"nsigmaTOFmax", 3.0f, "Maximum nsigma TOF"}; + Configurable minMassK0s{"minMassK0s", 0.4f, "Minimum Mass K0s"}; + Configurable maxMassK0s{"maxMassK0s", 0.6f, "Maximum Mass K0s"}; + Configurable minMassLambda{"minMassLambda", 1.1f, + "Minimum Mass Lambda"}; + Configurable maxMassLambda{"maxMassLambda", 1.2f, + "Maximum Mass Lambda"}; + Configurable minMassGamma{"minMassGamma", 0.000922f, + "Minimum Mass Gamma"}; + Configurable maxMassGamma{"maxMassGamma", 0.002022f, + "Maximum Mass Gamma"}; + Configurable nclCut{"nclCut", 135.0f, + "ncl Cut"}; + Configurable calibrationMode{"calibrationMode", false, "calibration mode"}; + Configurable additionalCuts{"additionalCuts", true, "additional cuts"}; + // Histograms names + static constexpr std::string_view kDedxvsMomentumPos[kParticlesType] = {"dEdx_vs_Momentum_all_Pos", "dEdx_vs_Momentum_Pi_v0_Pos", "dEdx_vs_Momentum_Pr_v0_Pos", "dEdx_vs_Momentum_El_v0_Pos"}; + static constexpr std::string_view kDedxvsMomentumNeg[kParticlesType] = {"dEdx_vs_Momentum_all_Neg", "dEdx_vs_Momentum_Pi_v0_Neg", "dEdx_vs_Momentum_Pr_v0_Neg", "dEdx_vs_Momentum_El_v0_Neg"}; + static constexpr std::string_view kNclDedxMomentumNegBefore[kEtaIntervals] = {"Ncl_vs_dEdx_vs_Momentum_Neg_1_Before", "Ncl_vs_dEdx_vs_Momentum_Neg_2_Before", "Ncl_vs_dEdx_vs_Momentum_Neg_3_Before", "Ncl_vs_dEdx_vs_Momentum_Neg_4_Before", "Ncl_vs_dEdx_vs_Momentum_Neg_5_Before", "Ncl_vs_dEdx_vs_Momentum_Neg_6_Before", "Ncl_vs_dEdx_vs_Momentum_Neg_7_Before", "Ncl_vs_dEdx_vs_Momentum_Neg_8_Before"}; + static constexpr std::string_view kNclDedxMomentumPosBefore[kEtaIntervals] = {"Ncl_vs_dEdx_vs_Momentum_Pos_1_Before", "Ncl_vs_dEdx_vs_Momentum_Pos_2_Before", "Ncl_vs_dEdx_vs_Momentum_Pos_3_Before", "Ncl_vs_dEdx_vs_Momentum_Pos_4_Before", "Ncl_vs_dEdx_vs_Momentum_Pos_5_Before", "Ncl_vs_dEdx_vs_Momentum_Pos_6_Before", "Ncl_vs_dEdx_vs_Momentum_Pos_7_Before", "Ncl_vs_dEdx_vs_Momentum_Pos_8_Before"}; + static constexpr std::string_view kNclDedxMomentumNegAfter[kEtaIntervals] = {"Ncl_vs_dEdx_vs_Momentum_Neg_1_After", "Ncl_vs_dEdx_vs_Momentum_Neg_2_After", "Ncl_vs_dEdx_vs_Momentum_Neg_3_After", "Ncl_vs_dEdx_vs_Momentum_Neg_4_After", "Ncl_vs_dEdx_vs_Momentum_Neg_5_After", "Ncl_vs_dEdx_vs_Momentum_Neg_6_After", "Ncl_vs_dEdx_vs_Momentum_Neg_7_After", "Ncl_vs_dEdx_vs_Momentum_Neg_8_After"}; + static constexpr std::string_view kNclDedxMomentumPosAfter[kEtaIntervals] = {"Ncl_vs_dEdx_vs_Momentum_Pos_1_After", "Ncl_vs_dEdx_vs_Momentum_Pos_2_After", "Ncl_vs_dEdx_vs_Momentum_Pos_3_After", "Ncl_vs_dEdx_vs_Momentum_Pos_4_After", "Ncl_vs_dEdx_vs_Momentum_Pos_5_After", "Ncl_vs_dEdx_vs_Momentum_Pos_6_After", "Ncl_vs_dEdx_vs_Momentum_Pos_7_After", "Ncl_vs_dEdx_vs_Momentum_Pos_8_After"}; + static constexpr double EtaCut[kEtaIntervals + 1] = {-0.8, -0.6, -0.4, -0.2, 0.0, 0.2, 0.4, 0.6, 0.8}; + Configurable> calibrationFactorNeg{"calibrationFactorNeg", {50.4011, 50.4764, 50.186, 49.2955, 48.8222, 49.4273, 49.9292, 50.0556}, "negative calibration factors"}; + Configurable> calibrationFactorPos{"calibrationFactorPos", {50.5157, 50.6359, 50.3198, 49.3345, 48.9197, 49.4931, 50.0188, 50.1406}, "positive calibration factors"}; + ConfigurableAxis binP{"binP", {VARIABLE_WIDTH, 0.1, 0.12, 0.14, 0.16, 0.18, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.2, 3.4, 3.6, 3.8, 4.0, 4.5, 5.0, 5.5, 6.0, 6.5, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 18.0, 20.0}, ""}; + + // phi cut fits + TF1* fphiCutHigh = nullptr; + TF1* fphiCutLow = nullptr; + + TrackSelection myTrackSelection() + { + TrackSelection selectedTracks; + selectedTracks.SetPtRange(0.1f, 1e10f); + selectedTracks.SetEtaRange(etaMin, etaMax); + selectedTracks.SetRequireITSRefit(true); + selectedTracks.SetRequireTPCRefit(true); + selectedTracks.SetMinNCrossedRowsTPC(minNCrossedRowsTPC); + selectedTracks.SetMinNCrossedRowsOverFindableClustersTPC(minNCrossedRowsOverFindableClustersTPC); + selectedTracks.SetMaxChi2PerClusterTPC(maxChi2TPC); + selectedTracks.SetRequireHitsInITSLayers(1, {0, 1}); + selectedTracks.SetMaxChi2PerClusterITS(maxChi2ITS); + selectedTracks.SetMaxDcaXYPtDep([](float pt) { return 0.0105f + 0.0350f / std::pow(pt, 1.1f); }); + selectedTracks.SetMaxDcaZ(maxDCAz); + selectedTracks.SetRequireGoldenChi2(true); + + return selectedTracks; + } + + TrackSelection mySelectionPrim; + + void init(InitContext const&) + { + AxisSpec dedxAxis{100, 0.0, 100.0, "dE/dx (a. u.)"}; + AxisSpec ptAxis = {binP, "pT (GeV/c)"}; + AxisSpec etaAxis{8, -0.8, 0.8, "#eta"}; + AxisSpec pAxis = {binP, "#it{p}/Z (GeV/c)"}; + fphiCutLow = new TF1("StandardPhiCutLow", "0.119297/x/x+pi/18.0-0.000379693", 0, 50); + fphiCutHigh = new TF1("StandardPhiCutHigh", "0.16685/x+pi/18.0+0.00981942", 0, 50); + if (calibrationMode) { + // MIP for pions + registryDeDx.add( + "hdEdx_vs_eta_Neg_Pi", "dE/dx", HistType::kTH2F, + {{etaAxis}, {dedxAxis}}); + registryDeDx.add( + "hdEdx_vs_eta_Pos_Pi", "dE/dx", HistType::kTH2F, + {{etaAxis}, {dedxAxis}}); + // MIP for electrons + registryDeDx.add( + "hdEdx_vs_eta_vs_p_Neg_El", "dE/dx", HistType::kTH3F, + {{etaAxis}, {dedxAxis}, {pAxis}}); + registryDeDx.add( + "hdEdx_vs_eta_vs_p_Pos_El", "dE/dx", HistType::kTH3F, + {{etaAxis}, {dedxAxis}, {pAxis}}); + // Pions from TOF + registryDeDx.add( + "hdEdx_vs_eta_vs_p_Neg_TOF", "dE/dx", HistType::kTH3F, + {{etaAxis}, {dedxAxis}, {pAxis}}); + registryDeDx.add( + "hdEdx_vs_eta_vs_p_Pos_TOF", "dE/dx", HistType::kTH3F, + {{etaAxis}, {dedxAxis}, {pAxis}}); + + } else { + // MIP for pions + registryDeDx.add( + "hdEdx_vs_eta_Neg_calibrated_Pi", "dE/dx", HistType::kTH2F, + {{etaAxis}, {dedxAxis}}); + + registryDeDx.add( + "hdEdx_vs_eta_Pos_calibrated_Pi", "dE/dx", HistType::kTH2F, + {{etaAxis}, {dedxAxis}}); + + // MIP for electrons + registryDeDx.add( + "hdEdx_vs_eta_vs_p_Neg_calibrated_El", "dE/dx", HistType::kTH3F, + {{etaAxis}, {dedxAxis}, {pAxis}}); + + registryDeDx.add( + "hdEdx_vs_eta_vs_p_Pos_calibrated_El", "dE/dx", HistType::kTH3F, + {{etaAxis}, {dedxAxis}, {pAxis}}); + + // Pions from TOF + registryDeDx.add( + "hdEdx_vs_eta_vs_p_Neg_calibrated_TOF", "dE/dx", HistType::kTH3F, + {{etaAxis}, {dedxAxis}, {pAxis}}); + + registryDeDx.add( + "hdEdx_vs_eta_vs_p_Pos_calibrated_TOF", "dE/dx", HistType::kTH3F, + {{etaAxis}, {dedxAxis}, {pAxis}}); + + // pt vs p + registryDeDx.add( + "hp_vs_pt_all_Neg", "p_vs_pT", HistType::kTH2F, + {{ptAxis}, {pAxis}}); + registryDeDx.add( + "hp_vs_pt_all_Pos", "p_vs_pT", HistType::kTH2F, + {{ptAxis}, {pAxis}}); + + // De/Dx for ch and v0 particles + for (int i = 0; i < kParticlesType; ++i) { + registryDeDx.add(kDedxvsMomentumPos[i].data(), "dE/dx", HistType::kTH3F, + {{pAxis}, {dedxAxis}, {etaAxis}}); + registryDeDx.add(kDedxvsMomentumNeg[i].data(), "dE/dx", HistType::kTH3F, + {{pAxis}, {dedxAxis}, {etaAxis}}); + } + } + + registryDeDx.add( + "hdEdx_vs_phi", "dE/dx", HistType::kTH2F, + {{100, 0.0, 6.4, "#phi"}, {dedxAxis}}); + + // phi cut + registryDeDx.add( + "hpt_vs_phi_Ncl_After", "phi cut", HistType::kTH3F, + {{ptAxis}, {100, 0.0, 0.4, "#varphi^{'}"}, {100, 0, 160, "N_{cl}"}}); + + registryDeDx.add( + "hpt_vs_phi_Ncl_Before", "phi cut", HistType::kTH3F, + {{ptAxis}, {100, 0.0, 0.4, "#varphi^{'}"}, {100, 0, 160, "N_{cl}"}}); + + // Ncl vs de/dx + + for (int i = 0; i < kEtaIntervals; ++i) { + registryDeDx.add(kNclDedxMomentumPosBefore[i].data(), "Ncl vs dE/dx vs Momentum Positive before", HistType::kTH3F, + {{100, 0, 160, "N_{cl}"}, {dedxAxis}, {pAxis}}); + registryDeDx.add(kNclDedxMomentumNegBefore[i].data(), "Ncl vs dE/dx vs Momentum Negative before", HistType::kTH3F, + {{100, 0, 160, "N_{cl}"}, {dedxAxis}, {pAxis}}); + + registryDeDx.add(kNclDedxMomentumPosAfter[i].data(), "Ncl vs dE/dx vs Momentum Positive after", HistType::kTH3F, + {{100, 0, 160, "N_{cl}"}, {dedxAxis}, {pAxis}}); + registryDeDx.add(kNclDedxMomentumNegAfter[i].data(), "Ncl vs dE/dx vs Momentum Negative after", HistType::kTH3F, + {{100, 0, 160, "N_{cl}"}, {dedxAxis}, {pAxis}}); + } + + // beta plot + registryDeDx.add( + "hbeta_vs_p_Neg", "beta", HistType::kTH2F, + {{pAxis}, {100, 0.0, 1.1, "#beta"}}); + + registryDeDx.add( + "hbeta_vs_p_Pos", "beta", HistType::kTH2F, + {{pAxis}, {100, 0.0, 1.1, "#beta"}}); + + // Event Counter + registryDeDx.add("histRecVtxZData", "collision z position", HistType::kTH1F, {{100, -20.0, +20.0, "z_{vtx} (cm)"}}); + + mySelectionPrim = myTrackSelection(); + } + + // Single-Track Selection + template + bool passedSingleTrackSelection(const T1& track, const C& /*collision*/) + { + // Single-Track Selections + if (!track.hasTPC()) + return false; + if (track.tpcNClsFound() < minTPCnClsFound) + return false; + if (track.tpcNClsCrossedRows() < minNCrossedRowsTPC) + return false; + if (track.tpcChi2NCl() > maxChi2TPC) + return false; + if (track.eta() < etaMin || track.eta() > etaMax) + return false; + + return true; + } + + // General V0 Selections + template + bool passedV0Selection(const T1& v0, const C& /*collision*/) + { + if (v0.v0cosPA() < v0cospaMin) + return false; + if (v0.v0radius() < minimumV0Radius || v0.v0radius() > maximumV0Radius) + return false; + + return true; + } + + // K0s Selections + template + bool passedK0Selection(const T1& v0, const T2& ntrack, const T2& ptrack, + const C& collision) + { + // Single-Track Selections + if (!passedSingleTrackSelection(ptrack, collision)) + return false; + if (!passedSingleTrackSelection(ntrack, collision)) + return false; + + if (ptrack.tpcInnerParam() > tpcCut) { + if (!ptrack.hasTOF()) + return false; + if (std::abs(ptrack.tofNSigmaPi()) > nsigmaTOFmax) + return false; + } + + if (ntrack.tpcInnerParam() > tpcCut) { + if (!ntrack.hasTOF()) + return false; + if (std::abs(ntrack.tofNSigmaPi()) > nsigmaTOFmax) + return false; + } + + // Invariant-Mass Selection + if (v0.mK0Short() < minMassK0s || v0.mK0Short() > maxMassK0s) + return false; + + return true; + } + + // Lambda Selections + template + bool passedLambdaSelection(const T1& v0, const T2& ntrack, const T2& ptrack, + const C& collision) + { + // Single-Track Selections + if (!passedSingleTrackSelection(ptrack, collision)) + return false; + if (!passedSingleTrackSelection(ntrack, collision)) + return false; + + if (ptrack.tpcInnerParam() > tpcCut) { + if (!ptrack.hasTOF()) + return false; + if (std::abs(ptrack.tofNSigmaPr()) > nsigmaTOFmax) + return false; + } + + if (ntrack.tpcInnerParam() > tpcCut) { + if (!ntrack.hasTOF()) + return false; + if (std::abs(ntrack.tofNSigmaPi()) > nsigmaTOFmax) + return false; + } + + // Invariant-Mass Selection + if (v0.mLambda() < minMassLambda || v0.mLambda() > maxMassLambda) + return false; + + return true; + } + + // AntiLambda Selections + template + bool passedAntiLambdaSelection(const T1& v0, const T2& ntrack, + const T2& ptrack, const C& collision) + { + + // Single-Track Selections + if (!passedSingleTrackSelection(ptrack, collision)) + return false; + if (!passedSingleTrackSelection(ntrack, collision)) + return false; + + if (ptrack.tpcInnerParam() > tpcCut) { + if (!ptrack.hasTOF()) + return false; + if (std::abs(ptrack.tofNSigmaPi()) > nsigmaTOFmax) + return false; + } + + if (ntrack.tpcInnerParam() > tpcCut) { + if (!ntrack.hasTOF()) + return false; + if (std::abs(ntrack.tofNSigmaPr()) > nsigmaTOFmax) + return false; + } + + // Invariant-Mass Selection + if (v0.mAntiLambda() < minMassLambda || v0.mAntiLambda() > maxMassLambda) + return false; + + return true; + } + + // Gamma Selections + template + bool passedGammaSelection(const T1& v0, const T2& ntrack, const T2& ptrack, + const C& collision) + { + // Single-Track Selections + if (!passedSingleTrackSelection(ptrack, collision)) + return false; + if (!passedSingleTrackSelection(ntrack, collision)) + return false; + + if (ptrack.tpcInnerParam() > tpcCut) { + if (!ptrack.hasTOF()) + return false; + if (std::abs(ptrack.tofNSigmaEl()) > nsigmaTOFmax) + return false; + } + + if (ntrack.tpcInnerParam() > tpcCut) { + if (!ntrack.hasTOF()) + return false; + if (std::abs(ntrack.tofNSigmaEl()) > nsigmaTOFmax) + return false; + } + + // Invariant-Mass Selection + if (v0.mGamma() < minMassGamma || v0.mGamma() > maxMassGamma) + return false; + + return true; + } + + // Phi cut + template + bool passedPhiCut(const T& trk, float magField, const TF1& fphiCutLow, const TF1& fphiCutHigh) + { + float pt = trk.pt(); + float phi = trk.phi(); + int charge = trk.sign(); + float eta = trk.eta(); + auto nTPCCl = trk.tpcNClsFindable() - trk.tpcNClsFindableMinusFound(); + float sigP = trk.sign() * trk.tpcInnerParam(); + + if (pt < pTcut) + return true; + + if (magField < 0) // for negatve polarity field + phi = o2::constants::math::TwoPI - phi; + if (charge < 0) // for negatve charge + phi = o2::constants::math::TwoPI - phi; + + // to center gap in the middle + phi += o2::constants::math::PI / 18.0f; + phi = std::fmod(phi, o2::constants::math::PI / 9.0f); + + registryDeDx.fill(HIST("hpt_vs_phi_Ncl_Before"), pt, phi, nTPCCl); + + // cut phi + if (phi < fphiCutHigh.Eval(pt) && phi > fphiCutLow.Eval(pt)) + return false; // reject track + + if (eta > EtaCut[0] && eta < EtaCut[1]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclDedxMomentumNegBefore[0]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclDedxMomentumPosBefore[0]), nTPCCl, trk.tpcSignal(), sigP); + } + } else if (eta > EtaCut[1] && eta < EtaCut[2]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclDedxMomentumNegBefore[1]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclDedxMomentumPosBefore[1]), nTPCCl, trk.tpcSignal(), sigP); + } + } else if (eta > EtaCut[2] && eta < EtaCut[3]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclDedxMomentumNegBefore[2]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclDedxMomentumPosBefore[2]), nTPCCl, trk.tpcSignal(), sigP); + } + } else if (eta > EtaCut[3] && eta < EtaCut[4]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclDedxMomentumNegBefore[3]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclDedxMomentumPosBefore[3]), nTPCCl, trk.tpcSignal(), sigP); + } + } else if (eta > EtaCut[4] && eta < EtaCut[5]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclDedxMomentumNegBefore[4]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclDedxMomentumPosBefore[4]), nTPCCl, trk.tpcSignal(), sigP); + } + } else if (eta > EtaCut[5] && eta < EtaCut[6]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclDedxMomentumNegBefore[5]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclDedxMomentumPosBefore[5]), nTPCCl, trk.tpcSignal(), sigP); + } + } else if (eta > EtaCut[6] && eta < EtaCut[7]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclDedxMomentumNegBefore[6]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclDedxMomentumPosBefore[6]), nTPCCl, trk.tpcSignal(), sigP); + } + } else if (eta > EtaCut[7] && eta < EtaCut[8]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclDedxMomentumNegBefore[7]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclDedxMomentumPosBefore[7]), nTPCCl, trk.tpcSignal(), sigP); + } + } + + // cut Ncl + if (nTPCCl < nclCut) + return false; + + registryDeDx.fill(HIST("hpt_vs_phi_Ncl_After"), pt, phi, nTPCCl); + + if (eta > EtaCut[0] && eta < EtaCut[1]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclDedxMomentumNegAfter[0]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclDedxMomentumPosAfter[0]), nTPCCl, trk.tpcSignal(), sigP); + } + } else if (eta > EtaCut[1] && eta < EtaCut[2]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclDedxMomentumNegAfter[1]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclDedxMomentumPosAfter[1]), nTPCCl, trk.tpcSignal(), sigP); + } + } else if (eta > EtaCut[2] && eta < EtaCut[3]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclDedxMomentumNegAfter[2]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclDedxMomentumPosAfter[2]), nTPCCl, trk.tpcSignal(), sigP); + } + } else if (eta > EtaCut[3] && eta < EtaCut[4]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclDedxMomentumNegAfter[3]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclDedxMomentumPosAfter[3]), nTPCCl, trk.tpcSignal(), sigP); + } + } else if (eta > EtaCut[4] && eta < EtaCut[5]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclDedxMomentumNegAfter[4]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclDedxMomentumPosAfter[4]), nTPCCl, trk.tpcSignal(), sigP); + } + } else if (eta > EtaCut[5] && eta < EtaCut[6]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclDedxMomentumNegAfter[5]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclDedxMomentumPosAfter[5]), nTPCCl, trk.tpcSignal(), sigP); + } + } else if (eta > EtaCut[6] && eta < EtaCut[7]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclDedxMomentumNegAfter[6]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclDedxMomentumPosAfter[6]), nTPCCl, trk.tpcSignal(), sigP); + } + } else if (eta > EtaCut[7] && eta < EtaCut[8]) { + if (sigP < 0) { + registryDeDx.fill(HIST(kNclDedxMomentumNegAfter[7]), nTPCCl, trk.tpcSignal(), std::abs(sigP)); + } else { + registryDeDx.fill(HIST(kNclDedxMomentumPosAfter[7]), nTPCCl, trk.tpcSignal(), sigP); + } + } + + return true; + } + + // Phi cut Secondaries + template + bool passedPhiCutSecondaries(const T& trk, float magField, const TF1& fphiCutLow, const TF1& fphiCutHigh) + { + float pt = trk.pt(); + float phi = trk.phi(); + int charge = trk.sign(); + auto nTPCCl = trk.tpcNClsFindable() - trk.tpcNClsFindableMinusFound(); + + if (pt < pTcut) + return true; + + if (magField < 0) // for negatve polarity field + phi = o2::constants::math::TwoPI - phi; + if (charge < 0) // for negatve charge + phi = o2::constants::math::TwoPI - phi; + + // to center gap in the middle + phi += o2::constants::math::PI / 18.0f; + phi = std::fmod(phi, o2::constants::math::PI / 9.0f); + + // cut phi + if (phi < fphiCutHigh.Eval(pt) && phi > fphiCutLow.Eval(pt)) + return false; // reject track + + // cut Ncl + if (nTPCCl < nclCut) + return false; + + return true; + } + + // Process Data + void process(SelectedCollisions::iterator const& collision, + aod::V0Datas const& fullV0s, PIDTracks const& tracks) + { + // Event Selection + if (!collision.sel8()) + return; + + if (additionalCuts) { + if (!collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) + return; + + if (!collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) + return; + + if (std::abs(collision.posZ()) >= maxZDistanceToIP) + return; + + if (!collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) + return; + } + + // Event Counter + registryDeDx.fill(HIST("histRecVtxZData"), collision.posZ()); + + // Kaons + for (const auto& trk : tracks) { + + // track Selection + if (!passedSingleTrackSelection(trk, collision)) + continue; + + if (!mySelectionPrim.IsSelected(trk)) + continue; + + // phi and Ncl cut + if (!passedPhiCut(trk, magField, *fphiCutLow, *fphiCutHigh)) + continue; + + float signedP = trk.sign() * trk.tpcInnerParam(); + + // MIP calibration for pions + if (trk.tpcInnerParam() >= pionMin && trk.tpcInnerParam() <= pionMax) { + if (calibrationMode) { + if (signedP < 0) { + registryDeDx.fill(HIST("hdEdx_vs_eta_Neg_Pi"), trk.eta(), trk.tpcSignal()); + } else { + registryDeDx.fill(HIST("hdEdx_vs_eta_Pos_Pi"), trk.eta(), trk.tpcSignal()); + } + + } else { + for (int i = 0; i < kEtaIntervals; ++i) { + if (trk.eta() > EtaCut[i] && trk.eta() < EtaCut[i + 1]) { + if (signedP < 0) { + registryDeDx.fill(HIST("hdEdx_vs_eta_Neg_calibrated_Pi"), trk.eta(), trk.tpcSignal() * 50 / calibrationFactorNeg->at(i)); + } else { + registryDeDx.fill(HIST("hdEdx_vs_eta_Pos_calibrated_Pi"), trk.eta(), trk.tpcSignal() * 50 / calibrationFactorPos->at(i)); + } + } + } + } + } + // Beta from TOF + if (signedP < 0) { + registryDeDx.fill(HIST("hbeta_vs_p_Neg"), std::abs(signedP), trk.beta()); + } else { + registryDeDx.fill(HIST("hbeta_vs_p_Pos"), signedP, trk.beta()); + } + // Electrons from TOF + if (std::abs(trk.beta() - 1) < elTofCut) { // beta cut + if (calibrationMode) { + if (signedP < 0) { + registryDeDx.fill(HIST("hdEdx_vs_eta_vs_p_Neg_El"), trk.eta(), trk.tpcSignal(), std::abs(signedP)); + } else { + registryDeDx.fill(HIST("hdEdx_vs_eta_vs_p_Pos_El"), trk.eta(), trk.tpcSignal(), signedP); + } + } else { + for (int i = 0; i < kEtaIntervals; ++i) { + if (trk.eta() > EtaCut[i] && trk.eta() < EtaCut[i + 1]) { + if (signedP < 0) { + registryDeDx.fill(HIST("hdEdx_vs_eta_vs_p_Neg_calibrated_El"), trk.eta(), trk.tpcSignal() * 50 / calibrationFactorNeg->at(i), std::abs(signedP)); + } else { + registryDeDx.fill(HIST("hdEdx_vs_eta_vs_p_Pos_calibrated_El"), trk.eta(), trk.tpcSignal() * 50 / calibrationFactorPos->at(i), signedP); + } + } + } + } + } + // pions from TOF + if (trk.beta() > pionTofCut && trk.beta() < pionTofCut + 0.05) { // beta cut + if (calibrationMode) { + if (signedP < 0) { + registryDeDx.fill(HIST("hdEdx_vs_eta_vs_p_Neg_TOF"), trk.eta(), trk.tpcSignal(), std::abs(signedP)); + } else { + registryDeDx.fill(HIST("hdEdx_vs_eta_vs_p_Pos_TOF"), trk.eta(), trk.tpcSignal(), signedP); + } + } else { + for (int i = 0; i < kEtaIntervals; ++i) { + if (trk.eta() > EtaCut[i] && trk.eta() < EtaCut[i + 1]) { + if (signedP < 0) { + registryDeDx.fill(HIST("hdEdx_vs_eta_vs_p_Neg_calibrated_TOF"), trk.eta(), trk.tpcSignal() * 50 / calibrationFactorNeg->at(i), std::abs(signedP)); + } else { + registryDeDx.fill(HIST("hdEdx_vs_eta_vs_p_Pos_calibrated_TOF"), trk.eta(), trk.tpcSignal() * 50 / calibrationFactorPos->at(i), signedP); + } + } + } + } + } + + registryDeDx.fill(HIST("hdEdx_vs_phi"), trk.phi(), trk.tpcSignal()); + + if (!calibrationMode) { + for (int i = 0; i < kEtaIntervals; ++i) { + if (trk.eta() > EtaCut[i] && trk.eta() < EtaCut[i + 1]) { + if (signedP > 0) { + registryDeDx.fill(HIST(kDedxvsMomentumPos[0]), signedP, trk.tpcSignal() * 50 / calibrationFactorPos->at(i), trk.eta()); + registryDeDx.fill(HIST("hp_vs_pt_all_Pos"), trk.pt(), signedP); + } else { + registryDeDx.fill(HIST(kDedxvsMomentumNeg[0]), std::abs(signedP), trk.tpcSignal() * 50 / calibrationFactorNeg->at(i), trk.eta()); + registryDeDx.fill(HIST("hp_vs_pt_all_Neg"), trk.pt(), std::abs(signedP)); + } + } + } + } + } + + // Loop over Reconstructed V0s + if (!calibrationMode) { + for (const auto& v0 : fullV0s) { + + // Standard V0 Selections + if (!passedV0Selection(v0, collision)) { + continue; + } + + if (v0.dcaV0daughters() > dcaV0DaughtersMax) { + continue; + } + + // Positive and Negative Tracks + const auto& posTrack = v0.posTrack_as(); + const auto& negTrack = v0.negTrack_as(); + + if (!posTrack.passedTPCRefit()) + continue; + if (!negTrack.passedTPCRefit()) + continue; + // phi and Ncl cut + if (!passedPhiCutSecondaries(posTrack, magField, *fphiCutLow, *fphiCutHigh)) + continue; + + if (!passedPhiCutSecondaries(negTrack, magField, *fphiCutLow, *fphiCutHigh)) + continue; + + float signedPpos = posTrack.sign() * posTrack.tpcInnerParam(); + float signedPneg = negTrack.sign() * negTrack.tpcInnerParam(); + + float pxPos = posTrack.px(); + float pyPos = posTrack.py(); + float pzPos = posTrack.pz(); + + float pxNeg = negTrack.px(); + float pyNeg = negTrack.py(); + float pzNeg = negTrack.pz(); + + const float gammaMass = 2 * MassElectron; // GeV/c^2 + + // K0s Selection + if (passedK0Selection(v0, negTrack, posTrack, collision)) { + float ePosPi = posTrack.energy(MassPionCharged); + float eNegPi = negTrack.energy(MassPionCharged); + + float invMass = std::sqrt((eNegPi + ePosPi) * (eNegPi + ePosPi) - ((pxNeg + pxPos) * (pxNeg + pxPos) + (pyNeg + pyPos) * (pyNeg + pyPos) + (pzNeg + pzPos) * (pzNeg + pzPos))); + + if (std::abs(invMass - MassK0Short) > invMassCut) { + continue; + } + + for (int i = 0; i < kEtaIntervals; ++i) { + if (negTrack.eta() > EtaCut[i] && negTrack.eta() < EtaCut[i + 1]) { + registryDeDx.fill(HIST(kDedxvsMomentumNeg[1]), std::abs(signedPneg), negTrack.tpcSignal() * 50 / calibrationFactorNeg->at(i), negTrack.eta()); + } + if (posTrack.eta() > EtaCut[i] && posTrack.eta() < EtaCut[i + 1]) { + registryDeDx.fill(HIST(kDedxvsMomentumPos[1]), signedPpos, posTrack.tpcSignal() * 50 / calibrationFactorPos->at(i), posTrack.eta()); + } + } + } + + // Lambda Selection + if (passedLambdaSelection(v0, negTrack, posTrack, collision)) { + + float ePosPr = posTrack.energy(MassProton); + float eNegPi = negTrack.energy(MassPionCharged); + + float invMass = std::sqrt((eNegPi + ePosPr) * (eNegPi + ePosPr) - ((pxNeg + pxPos) * (pxNeg + pxPos) + (pyNeg + pyPos) * (pyNeg + pyPos) + (pzNeg + pzPos) * (pzNeg + pzPos))); + + if (std::abs(invMass - MassLambda) > invMassCut) { + continue; + } + + for (int i = 0; i < kEtaIntervals; ++i) { + if (negTrack.eta() > EtaCut[i] && negTrack.eta() < EtaCut[i + 1]) { + registryDeDx.fill(HIST(kDedxvsMomentumNeg[1]), std::abs(signedPneg), negTrack.tpcSignal() * 50 / calibrationFactorNeg->at(i), negTrack.eta()); + } + if (posTrack.eta() > EtaCut[i] && posTrack.eta() < EtaCut[i + 1]) { + registryDeDx.fill(HIST(kDedxvsMomentumPos[2]), signedPpos, posTrack.tpcSignal() * 50 / calibrationFactorPos->at(i), posTrack.eta()); + } + } + } + + // AntiLambda Selection + if (passedAntiLambdaSelection(v0, negTrack, posTrack, collision)) { + + float ePosPi = posTrack.energy(MassPionCharged); + float eNegPr = negTrack.energy(MassProton); + + float invMass = std::sqrt((eNegPr + ePosPi) * (eNegPr + ePosPi) - ((pxNeg + pxPos) * (pxNeg + pxPos) + (pyNeg + pyPos) * (pyNeg + pyPos) + (pzNeg + pzPos) * (pzNeg + pzPos))); + + if (std::abs(invMass - MassLambda) > invMassCut) { + continue; + } + + for (int i = 0; i < kEtaIntervals; ++i) { + if (negTrack.eta() > EtaCut[i] && negTrack.eta() < EtaCut[i + 1]) { + registryDeDx.fill(HIST(kDedxvsMomentumNeg[2]), std::abs(signedPneg), negTrack.tpcSignal() * 50 / calibrationFactorNeg->at(i), negTrack.eta()); + } + if (posTrack.eta() > EtaCut[i] && posTrack.eta() < EtaCut[i + 1]) { + registryDeDx.fill(HIST(kDedxvsMomentumPos[1]), signedPpos, posTrack.tpcSignal() * 50 / calibrationFactorPos->at(i), posTrack.eta()); + } + } + } + + // Gamma Selection + if (passedGammaSelection(v0, negTrack, posTrack, collision)) { + + float ePosEl = posTrack.energy(MassElectron); + float eNegEl = negTrack.energy(MassElectron); + + float invMass = std::sqrt((eNegEl + ePosEl) * (eNegEl + ePosEl) - ((pxNeg + pxPos) * (pxNeg + pxPos) + (pyNeg + pyPos) * (pyNeg + pyPos) + (pzNeg + pzPos) * (pzNeg + pzPos))); + + if (std::abs(invMass - gammaMass) > invMassCutGamma) { + continue; + } + + for (int i = 0; i < kEtaIntervals; ++i) { + if (negTrack.eta() > EtaCut[i] && negTrack.eta() < EtaCut[i + 1]) { + registryDeDx.fill(HIST(kDedxvsMomentumNeg[3]), std::abs(signedPneg), negTrack.tpcSignal() * 50 / calibrationFactorNeg->at(i), negTrack.eta()); + } + if (posTrack.eta() > EtaCut[i] && posTrack.eta() < EtaCut[i + 1]) { + registryDeDx.fill(HIST(kDedxvsMomentumPos[3]), signedPpos, posTrack.tpcSignal() * 50 / calibrationFactorPos->at(i), posTrack.eta()); + } + } + } + } + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} From 5c9f3c1578760a544a7411020f2c348dd07f6fe0 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Sat, 2 Aug 2025 06:26:49 +0200 Subject: [PATCH 195/345] [PWGEM/Dilepton] update treeCreatorElectronMLDDA.cxx (#12380) --- .../treeCreatorElectronMLDDA.cxx | 57 ++++++++++++++----- 1 file changed, 43 insertions(+), 14 deletions(-) diff --git a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx index 0a5527d1428..08b3f7ad8f3 100644 --- a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx +++ b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx @@ -119,10 +119,15 @@ struct TreeCreatorElectronMLDDA { Configurable d_bz_input{"d_bz_input", -999, "bz field, -999 is automatic"}; Configurable useMatCorrType{"useMatCorrType", 2, "0: none, 1: TGeo, 2: LUT"}; - Configurable downscaling_electron{"downscaling_electron", 0.01, "down scaling factor to store electron"}; - Configurable downscaling_pion{"downscaling_pion", 0.01, "down scaling factor to store pion"}; - Configurable downscaling_kaon{"downscaling_kaon", 1.1, "down scaling factor to store kaon"}; - Configurable downscaling_proton{"downscaling_proton", 0.01, "down scaling factor to store proton"}; + Configurable downscaling_electron_highP{"downscaling_electron_highP", 1.1, "down scaling factor to store electron at high p"}; + Configurable downscaling_pion_highP{"downscaling_pion_highP", 1.1, "down scaling factor to store pion at high p"}; + Configurable downscaling_kaon_highP{"downscaling_kaon_highP", 1.1, "down scaling factor to store kaon at high p"}; + Configurable downscaling_proton_highP{"downscaling_proton_highP", 1.1, "down scaling factor to store proton at high p"}; + + Configurable downscaling_electron_lowP{"downscaling_electron_lowP", 0.01, "down scaling factor to store electron at low p"}; + Configurable downscaling_pion_lowP{"downscaling_pion_lowP", 0.01, "down scaling factor to store pion at low p"}; + Configurable downscaling_kaon_lowP{"downscaling_kaon_lowP", 1.1, "down scaling factor to store kaon at low p"}; + Configurable downscaling_proton_lowP{"downscaling_proton_lowP", 0.01, "down scaling factor to store proton at low p"}; Configurable max_p_for_downscaling_electron{"max_p_for_downscaling_electron", 2.0, "max p to apply down scaling factor to store electron"}; Configurable max_p_for_downscaling_pion{"max_p_for_downscaling_pion", 2.0, "max p to apply down scaling factor to store pion"}; @@ -588,20 +593,44 @@ struct TreeCreatorElectronMLDDA { // float dcaZ = mDcaInfoCov.getZ(); if (pidlabel == static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kElectron)) { - if (dist01(engine) > downscaling_electron && trackParCov.getP() < max_p_for_downscaling_electron) { - return; + if (trackParCov.getP() < max_p_for_downscaling_electron) { + if (dist01(engine) > downscaling_electron_lowP) { + return; + } + } else { + if (dist01(engine) > downscaling_electron_highP) { + return; + } } } else if (pidlabel == static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kPion)) { - if (dist01(engine) > downscaling_pion && trackParCov.getP() < max_p_for_downscaling_pion) { - return; + if (trackParCov.getP() < max_p_for_downscaling_pion) { + if (dist01(engine) > downscaling_pion_lowP) { + return; + } + } else { + if (dist01(engine) > downscaling_pion_highP) { + return; + } } } else if (pidlabel == static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kKaon)) { - if (dist01(engine) > downscaling_kaon && trackParCov.getP() < max_p_for_downscaling_kaon) { - return; + if (trackParCov.getP() < max_p_for_downscaling_kaon) { + if (dist01(engine) > downscaling_kaon_lowP) { + return; + } + } else { + if (dist01(engine) > downscaling_kaon_highP) { + return; + } } } else if (pidlabel == static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kProton)) { - if (dist01(engine) > downscaling_proton && trackParCov.getP() < max_p_for_downscaling_proton) { - return; + if (trackParCov.getP() < max_p_for_downscaling_proton) { + if (dist01(engine) > downscaling_proton_lowP) { + return; + } + } else { + if (dist01(engine) > downscaling_proton_highP) { + return; + } } } @@ -700,10 +729,10 @@ struct TreeCreatorElectronMLDDA { } //! type of V0. 0: built solely for cascades (does not pass standard V0 cuts), 1: standard 2, 3: photon-like with TPC-only use. Regular analysis should always use type 1. - Filter v0Filter = o2::aod::v0data::v0Type == uint8_t(1) && o2::aod::v0data::v0cosPA > v0cuts.cfg_min_cospa.value&& o2::aod::v0data::dcaV0daughters v0cuts.cfg_min_dcaxy_v0leg&& nabs(o2::aod::v0data::dcanegtopv) > v0cuts.cfg_min_dcaxy_v0leg; + Filter v0Filter = o2::aod::v0data::v0Type == uint8_t(1) && o2::aod::v0data::v0cosPA > v0cuts.cfg_min_cospa&& o2::aod::v0data::dcaV0daughters v0cuts.cfg_min_dcaxy_v0leg&& nabs(o2::aod::v0data::dcanegtopv) > v0cuts.cfg_min_dcaxy_v0leg; using filteredV0s = soa::Filtered; - Filter cascadeFilter = o2::aod::cascdata::dcacascdaughters < cascadecuts.cfg_max_dcadau.value && nabs(o2::aod::cascdata::dcanegtopv) > cascadecuts.cfg_min_dcaxy_v0leg&& nabs(o2::aod::cascdata::dcanegtopv) > cascadecuts.cfg_min_dcaxy_v0leg&& nabs(o2::aod::cascdata::dcabachtopv) > cascadecuts.cfg_min_dcaxy_bachelor; + Filter cascadeFilter = o2::aod::cascdata::dcacascdaughters < cascadecuts.cfg_max_dcadau && nabs(o2::aod::cascdata::dcanegtopv) > cascadecuts.cfg_min_dcaxy_v0leg&& nabs(o2::aod::cascdata::dcanegtopv) > cascadecuts.cfg_min_dcaxy_v0leg&& nabs(o2::aod::cascdata::dcabachtopv) > cascadecuts.cfg_min_dcaxy_bachelor; using filteredCascades = soa::Filtered; Filter collisionFilter_track_occupancy = eventcuts.cfgTrackOccupancyMin <= o2::aod::evsel::trackOccupancyInTimeRange && o2::aod::evsel::trackOccupancyInTimeRange < eventcuts.cfgTrackOccupancyMax; From 5edd5156325fe622e000a2e69c229c41d460e658 Mon Sep 17 00:00:00 2001 From: hernasab Date: Sat, 2 Aug 2025 00:26:49 -0500 Subject: [PATCH 196/345] [PWGCF] added histos and condition for pZDC (#12387) Co-authored-by: Sabrina Hernandez --- PWGCF/Flow/Tasks/flowZdcTask.cxx | 55 +++++++++++++++++++++++--------- 1 file changed, 40 insertions(+), 15 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowZdcTask.cxx b/PWGCF/Flow/Tasks/flowZdcTask.cxx index 0d8a4acfd8c..478a21ee4fc 100644 --- a/PWGCF/Flow/Tasks/flowZdcTask.cxx +++ b/PWGCF/Flow/Tasks/flowZdcTask.cxx @@ -62,6 +62,7 @@ struct FlowZdcTask { Configurable maxZem{"maxZem", 3099.5, "Max ZEM signal"}; // for ZDC info and analysis Configurable nBinsAmp{"nBinsAmp", 1025, "nbinsAmp"}; + Configurable nBinsCent{"nBinsCent", 90, "nBinsCent"}; Configurable maxZn{"maxZn", 125.5, "Max ZN signal"}; Configurable vtxRange{"vtxRange", 10.0f, "Vertex Z range to consider"}; Configurable etaRange{"etaRange", 1.0f, "Eta range to consider"}; @@ -76,6 +77,7 @@ struct FlowZdcTask { Configurable nBinsZP{"nBinsZP", 160, "N bins ZP"}; Configurable minNch{"minNch", 0, "Min Nch (|eta|<0.8)"}; Configurable maxNch{"maxNch", 2500, "Max Nch (|eta|<0.8)"}; + Configurable oneNeutron{"oneNeutron", 1.0, "one neutron, energy or integer"}; Configurable nBinsTDC{"nBinsTDC", 150, "nbinsTDC"}; Configurable minTdc{"minTdc", -15.0, "minimum TDC"}; Configurable maxTdc{"maxTdc", 15.0, "maximum TDC"}; @@ -95,6 +97,7 @@ struct FlowZdcTask { Configurable applyEff{"applyEff", true, "Apply track-by-track efficiency correction"}; Configurable applyFD{"applyFD", false, "Apply track-by-track feed down correction"}; Configurable correctNch{"correctNch", true, "Correct also Nch"}; + Configurable isOneNeutronFound{"isOneNeutronFound", true, "Require at least 1 neutron in ZNA/ZNC to fill ZPA/ZPC"}; Configurable nSigmaNchCut{"nSigmaNchCut", 1., "nSigma Nch selection"}; Configurable minNchSel{"minNchSel", 5., "min Nch Selection"}; @@ -305,6 +308,10 @@ struct FlowZdcTask { histos.add("ZNAVsNch", ";#it{N}_{ch} (|#eta|<0.8);ZNA;", kTH2F, {{{nBinsNch, minNch, maxNch}, {nBinsZDC, minNch, maxZn}}}); histos.add("ZNVsNch", ";#it{N}_{ch} (|#eta|<0.8);ZNA+ZNC;", kTH2F, {{{nBinsNch, minNch, maxNch}, {nBinsZDC, minNch, maxZn}}}); histos.add("ZNDifVsNch", ";#it{N}_{ch} (|#eta|<0.8);ZNA-ZNC;", kTH2F, {{{nBinsNch, minNch, maxNch}, {100, -50., 50.}}}); + histos.add("ZPAvsCent", ";centFT0C;ZPA", kTH2F, {{{axisCent}, {nBinsZDC, -0.5, maxZp}}}); + histos.add("ZPCvsCent", ";centFT0C;ZPC", kTH2F, {{{axisCent}, {nBinsZDC, -0.5, maxZp}}}); + histos.add("pZPAvsFT0Ccent", ";FT0C centrality;ZPA Amplitude", kTProfile, {{nBinsCent, minT0CcentCut, maxT0CcentCut}}); + histos.add("pZPCvsFT0Ccent", ";FT0C centrality;ZPC Amplitude", kTProfile, {{nBinsCent, minT0CcentCut, maxT0CcentCut}}); } ccdb->setURL("http://alice-ccdb.cern.ch"); @@ -403,6 +410,7 @@ struct FlowZdcTask { void processQA(ColEvSels::iterator const& collision, BCsRun3 const& /*bcs*/, aod::Zdcs const& /*zdcsData*/, aod::FV0As const& /*fv0as*/, aod::FT0s const& /*ft0s*/, TheFilteredTracks const& tracks) { const auto& foundBC = collision.foundBC_as(); + const auto cent = collision.centFT0C(); if (!isEventSelected(collision)) { return; } @@ -533,39 +541,56 @@ struct FlowZdcTask { } histos.fill(HIST("zPos"), collision.posZ()); histos.fill(HIST("T0Ccent"), collision.centFT0C()); - histos.fill(HIST("ZNCcvsZNCsum"), sumZNC / cfgCollisionEnergy, zdc.energyCommonZNC() / cfgCollisionEnergy); histos.fill(HIST("ZNAcvsZNAsum"), sumZNA / cfgCollisionEnergy, zdc.energyCommonZNA() / cfgCollisionEnergy); histos.fill(HIST("ZPCcvsZPCsum"), sumZPC / cfgCollisionEnergy, zdc.energyCommonZPC() / cfgCollisionEnergy); histos.fill(HIST("ZPAcvsZPAsum"), sumZPA / cfgCollisionEnergy, zdc.energyCommonZPA() / cfgCollisionEnergy); - histos.fill(HIST("GlbTracks"), glbTracks); + + // Neutron ZDC histos.fill(HIST("ZNA"), znA); histos.fill(HIST("ZNC"), znC); - histos.fill(HIST("ZPA"), zpA); - histos.fill(HIST("ZPC"), zpC); histos.fill(HIST("ZNASector"), sumZNA / cfgCollisionEnergy); histos.fill(HIST("ZNCSector"), sumZNC / cfgCollisionEnergy); - histos.fill(HIST("ZPASector"), sumZPA / cfgCollisionEnergy); - histos.fill(HIST("ZPCSector"), sumZPC / cfgCollisionEnergy); histos.fill(HIST("ZN"), znA + znC); - histos.fill(HIST("ZNAVsZNC"), znC, znA); - histos.fill(HIST("ZNAVsZPA"), zpA, znA); - histos.fill(HIST("ZNCVsZPC"), zpC, znC); - histos.fill(HIST("ZPAVsZPC"), zpC, zpA); histos.fill(HIST("ZNVsZEM"), sumZEMs, sumZNs); histos.fill(HIST("ZNCVstdc"), tZNC, znC); histos.fill(HIST("ZNAVstdc"), tZNA, znA); histos.fill(HIST("ZPCVstdc"), tZPC, zpC); - histos.fill(HIST("ZPAVstdc"), tZPA, zpA); - histos.fill(HIST("ZEM1Vstdc"), tZEM1, aZEM1); - histos.fill(HIST("ZEM2Vstdc"), tZEM2, aZEM2); - histos.fill(HIST("debunch"), tZDCdif, tZDCsum); - histos.fill(HIST("ZNVsFT0A"), aT0A / 100., sumZNs); histos.fill(HIST("ZNVsFT0C"), aT0C / 100., sumZNs); histos.fill(HIST("ZNVsFT0M"), (aT0A + aT0C) / 100., sumZNs); + // Proton ZDC + if (!isOneNeutronFound || znA >= oneNeutron) { + histos.fill(HIST("ZPA"), zpA); + histos.fill(HIST("ZPASector"), sumZPA / cfgCollisionEnergy); + histos.fill(HIST("ZPAVstdc"), tZPA, zpA); + histos.fill(HIST("ZPAvsCent"), cent, zpA); + if (std::isfinite(zpA) && !std::isnan(zpA) && + cent >= minT0CcentCut && cent < maxT0CcentCut) { + histos.fill(HIST("pZPAvsFT0Ccent"), cent, zpA); + } + } + if (!isOneNeutronFound || znC >= oneNeutron) { + histos.fill(HIST("ZPC"), zpC); + histos.fill(HIST("ZPCSector"), sumZPC / cfgCollisionEnergy); + histos.fill(HIST("ZPCvsCent"), cent, zpC); + if (std::isfinite(zpC) && !std::isnan(zpC) && + cent >= minT0CcentCut && cent < maxT0CcentCut) { + histos.fill(HIST("pZPCvsFT0Ccent"), cent, zpC); + } + } + + // ZDC Correlations + histos.fill(HIST("ZNAVsZNC"), znC, znA); + histos.fill(HIST("ZNAVsZPA"), zpA, znA); + histos.fill(HIST("ZNCVsZPC"), zpC, znC); + histos.fill(HIST("ZPAVsZPC"), zpC, zpA); + histos.fill(HIST("ZEM1Vstdc"), tZEM1, aZEM1); + histos.fill(HIST("ZEM2Vstdc"), tZEM2, aZEM2); + histos.fill(HIST("debunch"), tZDCdif, tZDCsum); + if (sumZNs > znBasedCut) { return; } From 0249818b1d31032da050685e43605a1078d0a5fe Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Sat, 2 Aug 2025 09:23:16 +0200 Subject: [PATCH 197/345] [PWGEM/Dilepton] update on dphiPosition (#12389) --- PWGEM/Dilepton/Core/DielectronCut.cxx | 7 +- PWGEM/Dilepton/Core/DielectronCut.h | 20 +++++- PWGEM/Dilepton/Core/Dilepton.h | 9 +-- PWGEM/Dilepton/Core/DileptonHadronMPC.h | 12 ++-- PWGEM/Dilepton/Core/DileptonMC.h | 10 +-- PWGEM/Dilepton/Core/PhotonHBT.h | 9 +-- PWGEM/Dilepton/Tasks/prefilterDielectron.cxx | 74 +++++++++++++++----- PWGEM/Dilepton/Tasks/vpPairQC.cxx | 3 +- PWGEM/Dilepton/Tasks/vpPairQCMC.cxx | 3 +- 9 files changed, 104 insertions(+), 43 deletions(-) diff --git a/PWGEM/Dilepton/Core/DielectronCut.cxx b/PWGEM/Dilepton/Core/DielectronCut.cxx index f320a801cc2..7f86c7babbe 100644 --- a/PWGEM/Dilepton/Core/DielectronCut.cxx +++ b/PWGEM/Dilepton/Core/DielectronCut.cxx @@ -67,12 +67,13 @@ void DielectronCut::SelectPhotonConversion(bool flag) mSelectPC = flag; LOG(info) << "Dielectron Cut, select photon conversion: " << mSelectPC; } -void DielectronCut::SetMindEtadPhi(bool flag, float min_deta, float min_dphi) +void DielectronCut::SetMindEtadPhi(bool flag1, bool flag2, float min_deta, float min_dphi) { - mApplydEtadPhi = flag; + mApplydEtadPhi = flag1; + mApplydEtadPhiPosition = flag2; mMinDeltaEta = min_deta; mMinDeltaPhi = min_dphi; - LOG(info) << "Dielectron Cut, set apply deta-dphi cut: " << mApplydEtadPhi << " min_deta: " << mMinDeltaEta << " min_dphi: " << mMinDeltaPhi; + LOG(info) << "Dielectron Cut, set apply deta-dphi cut: " << mApplydEtadPhi << " apply deta-dphi* cut: " << mApplydEtadPhiPosition << " min_deta: " << mMinDeltaEta << " min_dphi: " << mMinDeltaPhi; } void DielectronCut::SetRequireDifferentSides(bool flag) { diff --git a/PWGEM/Dilepton/Core/DielectronCut.h b/PWGEM/Dilepton/Core/DielectronCut.h index 3a6d8ba22b3..0dc108b05c5 100644 --- a/PWGEM/Dilepton/Core/DielectronCut.h +++ b/PWGEM/Dilepton/Core/DielectronCut.h @@ -101,7 +101,7 @@ class DielectronCut : public TNamed } template - bool IsSelectedPair(TTrack1 const& t1, TTrack2 const& t2, const float bz) const + bool IsSelectedPair(TTrack1 const& t1, TTrack2 const& t2, const float bz, const float refR) const { ROOT::Math::PtEtaPhiMVector v1(t1.pt(), t1.eta(), t1.phi(), o2::constants::physics::MassElectron); ROOT::Math::PtEtaPhiMVector v2(t2.pt(), t2.eta(), t2.phi(), o2::constants::physics::MassElectron); @@ -137,6 +137,10 @@ class DielectronCut : public TNamed return false; } + if (mApplydEtadPhi && mApplydEtadPhiPosition) { // applying both cuts is not allowed. + return false; + } + float deta = v1.Eta() - v2.Eta(); float dphi = v1.Phi() - v2.Phi(); o2::math_utils::bringToPMPi(dphi); @@ -144,6 +148,17 @@ class DielectronCut : public TNamed return false; } + float phiPosition1 = t1.phi() + std::asin(t1.sign() * 0.30282 * (bz * 0.1) * refR / (2.f * t1.pt())); + float phiPosition2 = t2.phi() + std::asin(t2.sign() * 0.30282 * (bz * 0.1) * refR / (2.f * t2.pt())); + + phiPosition1 = RecoDecay::constrainAngle(phiPosition1, 0, 1); // 0-2pi + phiPosition2 = RecoDecay::constrainAngle(phiPosition2, 0, 1); // 0-2pi + float dphiPosition = phiPosition1 - phiPosition2; + o2::math_utils::bringToPMPi(dphiPosition); + if (mApplydEtadPhiPosition && std::pow(deta / mMinDeltaEta, 2) + std::pow(dphiPosition / mMinDeltaPhi, 2) < 1.f) { + return false; + } + return true; } @@ -444,7 +459,7 @@ class DielectronCut : public TNamed void SetPairOpAng(float minOpAng = 0.f, float maxOpAng = 1e10f); void SetMaxMeePhiVDep(std::function phivDepCut, float min_phiv, float max_phiv); void SelectPhotonConversion(bool flag); - void SetMindEtadPhi(bool flag, float min_deta, float min_dphi); + void SetMindEtadPhi(bool applydEtadPhi, bool applydEtadPhiPosition, float min_deta, float min_dphi); void SetRequireDifferentSides(bool flag); void SetTrackPtRange(float minPt = 0.f, float maxPt = 1e10f); @@ -517,6 +532,7 @@ class DielectronCut : public TNamed std::function mMaxMeePhiVDep{}; // max mee as a function of phiv bool mSelectPC{false}; // flag to select photon conversion used in mMaxPhivPairMeeDep bool mApplydEtadPhi{false}; // flag to apply deta, dphi cut between 2 tracks + bool mApplydEtadPhiPosition{false}; // flag to apply deta, dphi cut between 2 tracks float mMinDeltaEta{0.f}; float mMinDeltaPhi{0.f}; float mMinOpAng{0.f}, mMaxOpAng{1e10f}; diff --git a/PWGEM/Dilepton/Core/Dilepton.h b/PWGEM/Dilepton/Core/Dilepton.h index 31a0c0d725e..531a1eb1043 100644 --- a/PWGEM/Dilepton/Core/Dilepton.h +++ b/PWGEM/Dilepton/Core/Dilepton.h @@ -178,7 +178,8 @@ struct Dilepton { Configurable cfg_phiv_intercept{"cfg_phiv_intercept", -0.0280, "intercept for m vs. phiv"}; Configurable cfg_min_phiv{"cfg_min_phiv", 0.0, "min phiv (constant)"}; Configurable cfg_max_phiv{"cfg_max_phiv", 3.2, "max phiv (constant)"}; - Configurable cfg_apply_detadphi{"cfg_apply_detadphi", false, "flag to apply deta-dphi elliptic cut"}; + Configurable cfg_apply_detadphi{"cfg_apply_detadphi", false, "flag to apply deta-dphi elliptic cut at PV"}; + Configurable cfg_apply_detadphiposition{"cfg_apply_detadphiposition", false, "flag to apply deta-dphi elliptic cut at certain radius"}; Configurable cfg_min_deta{"cfg_min_deta", 0.02, "min deta between 2 electrons (elliptic cut)"}; Configurable cfg_min_dphi{"cfg_min_dphi", 0.2, "min dphi between 2 electrons (elliptic cut)"}; Configurable cfg_min_opang{"cfg_min_opang", 0.0, "min opening angle"}; @@ -673,7 +674,7 @@ struct Dilepton { fDielectronCut.SetPairDCARange(dielectroncuts.cfg_min_pair_dca3d, dielectroncuts.cfg_max_pair_dca3d); // in sigma fDielectronCut.SetMaxMeePhiVDep([&](float phiv) { return dielectroncuts.cfg_phiv_intercept + phiv * dielectroncuts.cfg_phiv_slope; }, dielectroncuts.cfg_min_phiv, dielectroncuts.cfg_max_phiv); fDielectronCut.ApplyPhiV(dielectroncuts.cfg_apply_phiv); - fDielectronCut.SetMindEtadPhi(dielectroncuts.cfg_apply_detadphi, dielectroncuts.cfg_min_deta, dielectroncuts.cfg_min_dphi); + fDielectronCut.SetMindEtadPhi(dielectroncuts.cfg_apply_detadphi, dielectroncuts.cfg_apply_detadphiposition, dielectroncuts.cfg_min_deta, dielectroncuts.cfg_min_dphi); fDielectronCut.SetPairOpAng(dielectroncuts.cfg_min_opang, dielectroncuts.cfg_max_opang); fDielectronCut.SetRequireDifferentSides(dielectroncuts.cfg_require_diff_sides); @@ -858,7 +859,7 @@ struct Dilepton { } if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - if (!cut.IsSelectedPair(t1, t2, d_bz)) { + if (!cut.IsSelectedPair(t1, t2, d_bz, dielectroncuts.cfgRefR)) { return false; } } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { @@ -1403,7 +1404,7 @@ struct Dilepton { } if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - if (!cut.IsSelectedPair(t1, t2, d_bz)) { + if (!cut.IsSelectedPair(t1, t2, d_bz, dielectroncuts.cfgRefR)) { return false; } } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { diff --git a/PWGEM/Dilepton/Core/DileptonHadronMPC.h b/PWGEM/Dilepton/Core/DileptonHadronMPC.h index 294edde1b0f..2e1d94ab6bd 100644 --- a/PWGEM/Dilepton/Core/DileptonHadronMPC.h +++ b/PWGEM/Dilepton/Core/DileptonHadronMPC.h @@ -183,7 +183,8 @@ struct DileptonHadronMPC { Configurable cfg_phiv_intercept{"cfg_phiv_intercept", -0.0280, "intercept for m vs. phiv"}; Configurable cfg_min_phiv{"cfg_min_phiv", 0.0, "min phiv (constant)"}; Configurable cfg_max_phiv{"cfg_max_phiv", 3.2, "max phiv (constant)"}; - Configurable cfg_apply_detadphi{"cfg_apply_detadphi", false, "flag to apply deta-dphi elliptic cut"}; + Configurable cfg_apply_detadphi{"cfg_apply_detadphi", false, "flag to apply deta-dphi elliptic cut at PV"}; + Configurable cfg_apply_detadphiposition{"cfg_apply_detadphiposition", false, "flag to apply deta-dphi elliptic cut at certain radius"}; Configurable cfg_min_deta{"cfg_min_deta", 0.02, "min deta between 2 electrons (elliptic cut)"}; Configurable cfg_min_dphi{"cfg_min_dphi", 0.2, "min dphi between 2 electrons (elliptic cut)"}; @@ -210,6 +211,7 @@ struct DileptonHadronMPC { Configurable cfg_max_dcaz{"cfg_max_dcaz", 1.0, "max dca Z for single track in cm"}; Configurable cfg_require_itsib_any{"cfg_require_itsib_any", false, "flag to require ITS ib any hits"}; Configurable cfg_require_itsib_1st{"cfg_require_itsib_1st", true, "flag to require ITS ib 1st hit"}; + Configurable cfgRefR{"cfgRefR", 1.2, "reference R (in m) for extrapolation"}; // https://cds.cern.ch/record/1419204 Configurable cfg_pid_scheme{"cfg_pid_scheme", static_cast(DielectronCut::PIDSchemes::kTPChadrejORTOFreq), "pid scheme [kTOFreq : 0, kTPChadrej : 1, kTPChadrejORTOFreq : 2, kTPConly : 3, kTOFif : 4, kPIDML : 5, kTPChadrejORTOFreq_woTOFif : 6]"}; Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -2.0, "min. TPC n sigma for electron inclusion"}; @@ -588,7 +590,7 @@ struct DileptonHadronMPC { fDielectronCut.SetPairDCARange(dielectroncuts.cfg_min_pair_dca3d, dielectroncuts.cfg_max_pair_dca3d); // in sigma fDielectronCut.SetMaxMeePhiVDep([&](float phiv) { return dielectroncuts.cfg_phiv_intercept + phiv * dielectroncuts.cfg_phiv_slope; }, dielectroncuts.cfg_min_phiv, dielectroncuts.cfg_max_phiv); fDielectronCut.ApplyPhiV(dielectroncuts.cfg_apply_phiv); - fDielectronCut.SetMindEtadPhi(dielectroncuts.cfg_apply_detadphi, dielectroncuts.cfg_min_deta, dielectroncuts.cfg_min_dphi); + fDielectronCut.SetMindEtadPhi(dielectroncuts.cfg_apply_detadphi, dielectroncuts.cfg_apply_detadphiposition, dielectroncuts.cfg_min_deta, dielectroncuts.cfg_min_dphi); fDielectronCut.SetPairOpAng(0.f, 6.3); fDielectronCut.SetRequireDifferentSides(false); @@ -744,7 +746,7 @@ struct DileptonHadronMPC { } if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - if (!cut.IsSelectedPair(t1, t2, d_bz)) { + if (!cut.IsSelectedPair(t1, t2, d_bz, dielectroncuts.cfgRefR)) { return false; } } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { @@ -915,7 +917,7 @@ struct DileptonHadronMPC { } if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - if (!cut.IsSelectedPair(t1, t2, d_bz)) { + if (!cut.IsSelectedPair(t1, t2, d_bz, dielectroncuts.cfgRefR)) { return false; } } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { @@ -1312,7 +1314,7 @@ struct DileptonHadronMPC { } if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - if (!cut.IsSelectedPair(t1, t2, d_bz)) { + if (!cut.IsSelectedPair(t1, t2, d_bz, dielectroncuts.cfgRefR)) { return false; } } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { diff --git a/PWGEM/Dilepton/Core/DileptonMC.h b/PWGEM/Dilepton/Core/DileptonMC.h index 7f71c6126e9..46e7ecbe9be 100644 --- a/PWGEM/Dilepton/Core/DileptonMC.h +++ b/PWGEM/Dilepton/Core/DileptonMC.h @@ -173,7 +173,8 @@ struct DileptonMC { Configurable cfg_phiv_intercept{"cfg_phiv_intercept", -0.0280, "intercept for m vs. phiv"}; Configurable cfg_min_phiv{"cfg_min_phiv", 0.0, "min phiv (constant)"}; Configurable cfg_max_phiv{"cfg_max_phiv", 3.2, "max phiv (constant)"}; - Configurable cfg_apply_detadphi{"cfg_apply_detadphi", false, "flag to apply deta-dphi elliptic cut"}; + Configurable cfg_apply_detadphi{"cfg_apply_detadphi", false, "flag to apply deta-dphi elliptic cut at PV"}; + Configurable cfg_apply_detadphiposition{"cfg_apply_detadphiposition", false, "flag to apply deta-dphi elliptic cut at certain radius"}; Configurable cfg_min_deta{"cfg_min_deta", 0.02, "min deta between 2 electrons (elliptic cut)"}; Configurable cfg_min_dphi{"cfg_min_dphi", 0.2, "min dphi between 2 electrons (elliptic cut)"}; Configurable cfg_min_opang{"cfg_min_opang", 0.0, "min opening angle"}; @@ -209,6 +210,7 @@ struct DileptonMC { Configurable cfg_max_its_cluster_size{"cfg_max_its_cluster_size", 16.f, "max ITS cluster size"}; Configurable cfg_min_rel_diff_pin{"cfg_min_rel_diff_pin", -1e+10, "min rel. diff. between pin and ppv"}; Configurable cfg_max_rel_diff_pin{"cfg_max_rel_diff_pin", +1e+10, "max rel. diff. between pin and ppv"}; + Configurable cfgRefR{"cfgRefR", 1.2, "reference R (in m) for extrapolation"}; // https://cds.cern.ch/record/1419204 Configurable cfg_pid_scheme{"cfg_pid_scheme", static_cast(DielectronCut::PIDSchemes::kTPChadrejORTOFreq), "pid scheme [kTOFreq : 0, kTPChadrej : 1, kTPChadrejORTOFreq : 2, kTPConly : 3, kTOFif = 4, kPIDML = 5]"}; Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -2.0, "min. TPC n sigma for electron inclusion"}; @@ -651,7 +653,7 @@ struct DileptonMC { fDielectronCut.SetPairDCARange(dielectroncuts.cfg_min_pair_dca3d, dielectroncuts.cfg_max_pair_dca3d); // in sigma fDielectronCut.SetMaxMeePhiVDep([&](float phiv) { return dielectroncuts.cfg_phiv_intercept + phiv * dielectroncuts.cfg_phiv_slope; }, dielectroncuts.cfg_min_phiv, dielectroncuts.cfg_max_phiv); fDielectronCut.ApplyPhiV(dielectroncuts.cfg_apply_phiv); - fDielectronCut.SetMindEtadPhi(dielectroncuts.cfg_apply_detadphi, dielectroncuts.cfg_min_deta, dielectroncuts.cfg_min_dphi); + fDielectronCut.SetMindEtadPhi(dielectroncuts.cfg_apply_detadphi, dielectroncuts.cfg_apply_detadphiposition, dielectroncuts.cfg_min_deta, dielectroncuts.cfg_min_dphi); fDielectronCut.SetPairOpAng(dielectroncuts.cfg_min_opang, dielectroncuts.cfg_max_opang); fDielectronCut.SetRequireDifferentSides(dielectroncuts.cfg_require_diff_sides); @@ -828,7 +830,7 @@ struct DileptonMC { return false; } } - if (!cut.IsSelectedPair(t1, t2, d_bz)) { + if (!cut.IsSelectedPair(t1, t2, d_bz, dielectroncuts.cfgRefR)) { return false; } } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { @@ -1895,7 +1897,7 @@ struct DileptonMC { } if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { - if (!cut.template IsSelectedPair(t1, t2, d_bz)) { + if (!cut.template IsSelectedPair(t1, t2, d_bz, dielectroncuts.cfgRefR)) { return false; } } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { diff --git a/PWGEM/Dilepton/Core/PhotonHBT.h b/PWGEM/Dilepton/Core/PhotonHBT.h index 85c0cb81bf7..6dde60789ea 100644 --- a/PWGEM/Dilepton/Core/PhotonHBT.h +++ b/PWGEM/Dilepton/Core/PhotonHBT.h @@ -213,6 +213,7 @@ struct PhotonHBT { Configurable cfg_max_rel_diff_pin{"cfg_max_rel_diff_pin", +1e+10, "max rel. diff. between pin and ppv"}; Configurable cfg_require_itsib_any{"cfg_require_itsib_any", false, "flag to require ITS ib any hits"}; Configurable cfg_require_itsib_1st{"cfg_require_itsib_1st", true, "flag to require ITS ib 1st hit"}; + Configurable cfgRefR{"cfgRefR", 1.2, "reference R (in m) for extrapolation"}; // https://cds.cern.ch/record/1419204 Configurable cfg_pid_scheme{"cfg_pid_scheme", static_cast(DielectronCut::PIDSchemes::kTPChadrejORTOFreq), "pid scheme [kTOFreq : 0, kTPChadrej : 1, kTPChadrejORTOFreq : 2, kTPConly : 3, kTOFif = 4, kPIDML = 5]"}; Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -2.0, "min. TPC n sigma for electron inclusion"}; @@ -849,7 +850,7 @@ struct PhotonHBT { continue; } } - if (!cut1.IsSelectedPair(pos1, ele1, d_bz)) { + if (!cut1.IsSelectedPair(pos1, ele1, d_bz, dielectroncuts.cfgRefR)) { continue; } @@ -877,7 +878,7 @@ struct PhotonHBT { continue; } } - if (!cut2.IsSelectedPair(pos2, ele2, d_bz)) { + if (!cut2.IsSelectedPair(pos2, ele2, d_bz, dielectroncuts.cfgRefR)) { continue; } @@ -995,7 +996,7 @@ struct PhotonHBT { continue; } } - if (!cut2.IsSelectedPair(pos2, ele2, d_bz)) { + if (!cut2.IsSelectedPair(pos2, ele2, d_bz, dielectroncuts.cfgRefR)) { continue; } @@ -1363,7 +1364,7 @@ struct PhotonHBT { continue; } } - if (!cut.IsSelectedPair(pos, ele, d_bz)) { + if (!cut.IsSelectedPair(pos, ele, d_bz, dielectroncuts.cfgRefR)) { continue; } passed_pairIds.emplace_back(std::make_pair(pos.globalIndex(), ele.globalIndex())); diff --git a/PWGEM/Dilepton/Tasks/prefilterDielectron.cxx b/PWGEM/Dilepton/Tasks/prefilterDielectron.cxx index 16f776a093f..d3a12ec6481 100644 --- a/PWGEM/Dilepton/Tasks/prefilterDielectron.cxx +++ b/PWGEM/Dilepton/Tasks/prefilterDielectron.cxx @@ -102,12 +102,14 @@ struct prefilterDielectron { Configurable cfg_max_phiv{"cfg_max_phiv", 3.2, "max phiv"}; // region to be rejected // for deta-dphi prefilter - Configurable cfg_apply_detadphi_uls{"cfg_apply_detadphi_uls", false, "flag to apply generator deta-dphi elliptic cut in ULS"}; // region to be rejected - Configurable cfg_apply_detadphi_ls{"cfg_apply_detadphi_ls", false, "flag to apply generator deta-dphi elliptic cut in LS"}; // region to be rejected - Configurable cfg_min_deta_ls{"cfg_min_deta_ls", 0.04, "deta between 2 electrons (elliptic cut)"}; // region to be rejected - Configurable cfg_min_dphi_ls{"cfg_min_dphi_ls", 0.2, "dphi between 2 electrons (elliptic cut)"}; // region to be rejected - Configurable cfg_min_deta_uls{"cfg_min_deta_uls", 0.04, "deta between 2 electrons (elliptic cut)"}; // region to be rejected - Configurable cfg_min_dphi_uls{"cfg_min_dphi_uls", 0.2, "dphi between 2 electrons (elliptic cut)"}; // region to be rejected + Configurable cfg_apply_detadphi_uls{"cfg_apply_detadphi_uls", false, "flag to apply generator deta-dphi elliptic cut in ULS"}; // region to be rejected + Configurable cfg_apply_detadphi_ls{"cfg_apply_detadphi_ls", false, "flag to apply generator deta-dphi elliptic cut in LS"}; // region to be rejected + Configurable cfg_apply_detadphiposition_uls{"cfg_apply_detadphiposition_uls", false, "flag to apply generator deta-dphi elliptic cut in ULS"}; // region to be rejected + Configurable cfg_apply_detadphiposition_ls{"cfg_apply_detadphiposition_ls", false, "flag to apply generator deta-dphi elliptic cut in LS"}; // region to be rejected + Configurable cfg_min_deta_ls{"cfg_min_deta_ls", 0.04, "deta between 2 electrons (elliptic cut)"}; // region to be rejected + Configurable cfg_min_dphi_ls{"cfg_min_dphi_ls", 0.2, "dphi between 2 electrons (elliptic cut)"}; // region to be rejected + Configurable cfg_min_deta_uls{"cfg_min_deta_uls", 0.04, "deta between 2 electrons (elliptic cut)"}; // region to be rejected + Configurable cfg_min_dphi_uls{"cfg_min_dphi_uls", 0.2, "dphi between 2 electrons (elliptic cut)"}; // region to be rejected Configurable cfg_min_pt_track{"cfg_min_pt_track", 0.2, "min pT for single track"}; Configurable cfg_max_pt_track{"cfg_max_pt_track", 1e+10, "max pT for single track"}; @@ -171,6 +173,19 @@ struct prefilterDielectron { void init(InitContext& /*context*/) { + if (dielectroncuts.cfg_apply_detadphi_ls && dielectroncuts.cfg_apply_detadphiposition_ls) { + LOG(fatal) << "Please choose deta-dphi prefiter either at PV or certain radius"; + } + if (dielectroncuts.cfg_apply_detadphi_uls && dielectroncuts.cfg_apply_detadphiposition_uls) { + LOG(fatal) << "Please choose deta-dphi prefiter either at PV or certain radius"; + } + if (dielectroncuts.cfg_apply_detadphi_uls && dielectroncuts.cfg_apply_detadphiposition_ls) { + LOG(fatal) << "Please choose deta-dphi prefiter either at PV or certain radius"; + } + if (dielectroncuts.cfg_apply_detadphi_ls && dielectroncuts.cfg_apply_detadphiposition_uls) { + LOG(fatal) << "Please choose deta-dphi prefiter either at PV or certain radius"; + } + DefineEMEventCut(); DefineDielectronCut(); addhistograms(); @@ -268,7 +283,7 @@ struct prefilterDielectron { fDielectronCut.SetPairDCARange(0.f, 1e+10); // in sigma fDielectronCut.ApplyPhiV(false); fDielectronCut.ApplyPrefilter(false); - fDielectronCut.SetMindEtadPhi(false, 1.f, 1.f); + fDielectronCut.SetMindEtadPhi(false, false, 1.f, 1.f); fDielectronCut.SetPairOpAng(0.f, 3.2f); fDielectronCut.SetRequireDifferentSides(false); @@ -408,11 +423,18 @@ struct prefilterDielectron { map_pfb[ele.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kPhiV); } - if (dielectroncuts.cfg_apply_detadphi_uls && std::pow(deta / dielectroncuts.cfg_min_deta_uls, 2) + std::pow(dphi / dielectroncuts.cfg_min_dphi_uls, 2) < 1.f) { - map_pfb[pos.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kSplitOrMergedTrackULS); - map_pfb[ele.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kSplitOrMergedTrackULS); + if (dielectroncuts.cfg_apply_detadphiposition_uls) { + if (std::pow(deta / dielectroncuts.cfg_min_deta_uls, 2) + std::pow(dphiPosition / dielectroncuts.cfg_min_dphi_uls, 2) < 1.f) { + map_pfb[pos.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kSplitOrMergedTrackULS); + map_pfb[ele.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kSplitOrMergedTrackULS); + } + } else if (dielectroncuts.cfg_apply_detadphi_uls) { + if (std::pow(deta / dielectroncuts.cfg_min_deta_uls, 2) + std::pow(dphi / dielectroncuts.cfg_min_dphi_uls, 2) < 1.f) { + map_pfb[pos.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kSplitOrMergedTrackULS); + map_pfb[ele.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kSplitOrMergedTrackULS); + } } - } + } // end of ULS pairing for (auto& [pos1, pos2] : combinations(CombinationsStrictlyUpperIndexPolicy(posTracks_per_coll, posTracks_per_coll))) { // LS++ if (!fDielectronCut.IsSelectedTrack(pos1) || !fDielectronCut.IsSelectedTrack(pos2)) { @@ -441,11 +463,18 @@ struct prefilterDielectron { fRegistry.fill(HIST("Pair/before/lspp/hDeltaEtaDeltaPhi"), dphi, deta); fRegistry.fill(HIST("Pair/before/lspp/hDeltaEtaDeltaPhiPosition"), dphiPosition, deta); - if (dielectroncuts.cfg_apply_detadphi_ls && std::pow(deta / dielectroncuts.cfg_min_deta_ls, 2) + std::pow(dphi / dielectroncuts.cfg_min_dphi_ls, 2) < 1.f) { - map_pfb[pos1.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kSplitOrMergedTrackLS); - map_pfb[pos2.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kSplitOrMergedTrackLS); + if (dielectroncuts.cfg_apply_detadphiposition_ls) { + if (std::pow(deta / dielectroncuts.cfg_min_deta_ls, 2) + std::pow(dphiPosition / dielectroncuts.cfg_min_dphi_ls, 2) < 1.f) { + map_pfb[pos1.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kSplitOrMergedTrackLS); + map_pfb[pos2.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kSplitOrMergedTrackLS); + } + } else if (dielectroncuts.cfg_apply_detadphi_ls) { + if (std::pow(deta / dielectroncuts.cfg_min_deta_ls, 2) + std::pow(dphi / dielectroncuts.cfg_min_dphi_ls, 2) < 1.f) { + map_pfb[pos1.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kSplitOrMergedTrackLS); + map_pfb[pos2.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kSplitOrMergedTrackLS); + } } - } + } // end of LS++ pairing for (auto& [ele1, ele2] : combinations(CombinationsStrictlyUpperIndexPolicy(negTracks_per_coll, negTracks_per_coll))) { // LS-- if (!fDielectronCut.IsSelectedTrack(ele1) || !fDielectronCut.IsSelectedTrack(ele2)) { @@ -474,11 +503,18 @@ struct prefilterDielectron { fRegistry.fill(HIST("Pair/before/lsmm/hDeltaEtaDeltaPhi"), dphi, deta); fRegistry.fill(HIST("Pair/before/lsmm/hDeltaEtaDeltaPhiPosition"), dphiPosition, deta); - if (dielectroncuts.cfg_apply_detadphi_ls && std::pow(deta / dielectroncuts.cfg_min_deta_ls, 2) + std::pow(dphi / dielectroncuts.cfg_min_dphi_ls, 2) < 1.f) { - map_pfb[ele1.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kSplitOrMergedTrackLS); - map_pfb[ele2.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kSplitOrMergedTrackLS); + if (dielectroncuts.cfg_apply_detadphiposition_ls) { + if (std::pow(deta / dielectroncuts.cfg_min_deta_ls, 2) + std::pow(dphiPosition / dielectroncuts.cfg_min_dphi_ls, 2) < 1.f) { + map_pfb[ele1.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kSplitOrMergedTrackLS); + map_pfb[ele2.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kSplitOrMergedTrackLS); + } + } else if (dielectroncuts.cfg_apply_detadphi_ls) { + if (std::pow(deta / dielectroncuts.cfg_min_deta_ls, 2) + std::pow(dphi / dielectroncuts.cfg_min_dphi_ls, 2) < 1.f) { + map_pfb[ele1.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kSplitOrMergedTrackLS); + map_pfb[ele2.globalIndex()] |= 1 << static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonPrefilterBitDerived::kSplitOrMergedTrackLS); + } } - } + } // end of LS-- pairing } // end of collision loop diff --git a/PWGEM/Dilepton/Tasks/vpPairQC.cxx b/PWGEM/Dilepton/Tasks/vpPairQC.cxx index 452d0666acf..891fa7e333b 100644 --- a/PWGEM/Dilepton/Tasks/vpPairQC.cxx +++ b/PWGEM/Dilepton/Tasks/vpPairQC.cxx @@ -126,6 +126,7 @@ struct vpPairQC { Configurable cfg_max_its_cluster_size{"cfg_max_its_cluster_size", 16.f, "max ITS cluster size"}; Configurable cfg_min_rel_diff_pin{"cfg_min_rel_diff_pin", -1e+10, "min rel. diff. between pin and ppv"}; Configurable cfg_max_rel_diff_pin{"cfg_max_rel_diff_pin", +1e+10, "max rel. diff. between pin and ppv"}; + Configurable cfgRefR{"cfgRefR", 1.2, "reference R (in m) for extrapolation"}; // https://cds.cern.ch/record/1419204 Configurable cfg_pid_scheme{"cfg_pid_scheme", static_cast(DielectronCut::PIDSchemes::kTOFif), "pid scheme [kTOFreq : 0, kTPChadrej : 1, kTPChadrejORTOFreq : 2, kTPConly : 3, kTOFif : 4, kPIDML : 5]"}; Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -2.0, "min. TPC n sigma for electron inclusion"}; @@ -381,7 +382,7 @@ struct vpPairQC { return false; } - if (!fDielectronCut.IsSelectedPair(t1, t2, d_bz)) { + if (!fDielectronCut.IsSelectedPair(t1, t2, d_bz, dielectroncuts.cfgRefR)) { return false; } diff --git a/PWGEM/Dilepton/Tasks/vpPairQCMC.cxx b/PWGEM/Dilepton/Tasks/vpPairQCMC.cxx index 0325b566fad..d470a92afa2 100644 --- a/PWGEM/Dilepton/Tasks/vpPairQCMC.cxx +++ b/PWGEM/Dilepton/Tasks/vpPairQCMC.cxx @@ -126,6 +126,7 @@ struct vpPairQCMC { Configurable cfg_max_its_cluster_size{"cfg_max_its_cluster_size", 16.f, "max ITS cluster size"}; Configurable cfg_min_rel_diff_pin{"cfg_min_rel_diff_pin", -1e+10, "min rel. diff. between pin and ppv"}; Configurable cfg_max_rel_diff_pin{"cfg_max_rel_diff_pin", +1e+10, "max rel. diff. between pin and ppv"}; + Configurable cfgRefR{"cfgRefR", 1.2, "reference R (in m) for extrapolation"}; // https://cds.cern.ch/record/1419204 Configurable cfg_pid_scheme{"cfg_pid_scheme", static_cast(DielectronCut::PIDSchemes::kTOFif), "pid scheme [kTOFreq : 0, kTPChadrej : 1, kTPChadrejORTOFreq : 2, kTPConly : 3, kTOFif : 4, kPIDML : 5]"}; Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -2.0, "min. TPC n sigma for electron inclusion"}; @@ -411,7 +412,7 @@ struct vpPairQCMC { return false; } - if (!fDielectronCut.IsSelectedPair(t1, t2, d_bz)) { + if (!fDielectronCut.IsSelectedPair(t1, t2, d_bz, dielectroncuts.cfgRefR)) { return false; } From 302e071c2849405a226215311b6a5d1585822247 Mon Sep 17 00:00:00 2001 From: Junlee Kim Date: Sat, 2 Aug 2025 16:26:57 +0900 Subject: [PATCH 198/345] [PWGLF] adding sign for two particle polarization (#12368) --- PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx b/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx index 70f39e55dea..43e10b719b8 100644 --- a/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx +++ b/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx @@ -182,6 +182,8 @@ struct lambdaTwoPartPolarization { ROOT::Math::PxPyPzMVector ProtonVec1, PionVec1, LambdaVec1, ProtonBoostedVec1, PionBoostedVec1; ROOT::Math::PxPyPzMVector ProtonVec2, PionVec2, LambdaVec2, ProtonBoostedVec2, PionBoostedVec2; + int V01Tag; + int V02Tag; double costhetastar1; double costhetastar2; @@ -292,10 +294,12 @@ struct lambdaTwoPartPolarization { if (LambdaTag) { ProtonVec1 = ROOT::Math::PxPyPzMVector(v01.pxpos(), v01.pypos(), v01.pzpos(), massPr); PionVec1 = ROOT::Math::PxPyPzMVector(v01.pxneg(), v01.pyneg(), v01.pzneg(), massPi); + V01Tag = 0; } if (aLambdaTag) { ProtonVec1 = ROOT::Math::PxPyPzMVector(v01.pxneg(), v01.pyneg(), v01.pzneg(), massPr); PionVec1 = ROOT::Math::PxPyPzMVector(v01.pxpos(), v01.pypos(), v01.pzpos(), massPi); + V01Tag = 1; } LambdaVec1 = ProtonVec1 + PionVec1; LambdaVec1.SetM(massLambda); @@ -337,10 +341,12 @@ struct lambdaTwoPartPolarization { if (LambdaTag) { ProtonVec2 = ROOT::Math::PxPyPzMVector(v02.pxpos(), v02.pypos(), v02.pzpos(), massPr); PionVec2 = ROOT::Math::PxPyPzMVector(v02.pxneg(), v02.pyneg(), v02.pzneg(), massPi); + V02Tag = 0; } if (aLambdaTag) { ProtonVec2 = ROOT::Math::PxPyPzMVector(v02.pxneg(), v02.pyneg(), v02.pzneg(), massPr); PionVec2 = ROOT::Math::PxPyPzMVector(v02.pxpos(), v02.pypos(), v02.pzpos(), massPi); + V02Tag = 1; } LambdaVec2 = ProtonVec2 + PionVec2; LambdaVec2.SetM(massLambda); @@ -356,6 +362,10 @@ struct lambdaTwoPartPolarization { weight *= cfgEffCor ? 1.0 / EffMap->GetBinContent(EffMap->GetXaxis()->FindBin(v02.pt()), EffMap->GetYaxis()->FindBin(centrality)) : 1.; weight *= cfgAccCor ? 1.0 / AccMap->GetBinContent(AccMap->GetXaxis()->FindBin(v02.pt()), AccMap->GetYaxis()->FindBin(v02.yLambda())) : 1.; + if (V01Tag != V02Tag) { + weight *= -1.0; + } + dphi = TVector2::Phi_0_2pi(v01.phi() - v02.phi()); if (dphi > constants::math::PI * 1.5) { dphi -= constants::math::PI * 2.0; From 265c4317c8c46ccd5fe003d1213c624fce649b09 Mon Sep 17 00:00:00 2001 From: Zhiyong <71517277+Luzhiyongg@users.noreply.github.com> Date: Sat, 2 Aug 2025 13:55:50 +0200 Subject: [PATCH 199/345] [PWGCF] add global vs multV0A cut in di-hadron (#12393) --- PWGCF/Flow/Tasks/flowTask.cxx | 4 +- .../Tasks/diHadronCor.cxx | 93 +++++++++++-------- 2 files changed, 57 insertions(+), 40 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowTask.cxx b/PWGCF/Flow/Tasks/flowTask.cxx index ed94b5ce88a..9f27ffa0005 100644 --- a/PWGCF/Flow/Tasks/flowTask.cxx +++ b/PWGCF/Flow/Tasks/flowTask.cxx @@ -251,11 +251,11 @@ struct FlowTask { registry.add("hVtxZ", "Vexter Z distribution", {HistType::kTH1D, {axisVertex}}); registry.add("hMult", "Multiplicity distribution", {HistType::kTH1D, {{3000, 0.5, 3000.5}}}); std::string hCentTitle = "Centrality distribution, Estimator " + std::to_string(cfgCentEstimator); - registry.add("hCent", hCentTitle.c_str(), {HistType::kTH1D, {{90, 0, 90}}}); + registry.add("hCent", hCentTitle.c_str(), {HistType::kTH1D, {{100, 0, 100}}}); if (doprocessMCGen) { registry.add("MCGen/MChVtxZ", "Vexter Z distribution", {HistType::kTH1D, {axisVertex}}); registry.add("MCGen/MChMult", "Multiplicity distribution", {HistType::kTH1D, {{3000, 0.5, 3000.5}}}); - registry.add("MCGen/MChCent", hCentTitle.c_str(), {HistType::kTH1D, {{90, 0, 90}}}); + registry.add("MCGen/MChCent", hCentTitle.c_str(), {HistType::kTH1D, {{100, 0, 100}}}); } if (!cfgUseSmallMemory) { registry.add("BeforeSel8_globalTracks_centT0C", "before sel8;Centrality T0C;mulplicity global tracks", {HistType::kTH2D, {axisCentForQA, axisNch}}); diff --git a/PWGCF/TwoParticleCorrelations/Tasks/diHadronCor.cxx b/PWGCF/TwoParticleCorrelations/Tasks/diHadronCor.cxx index 5cd6d8335e8..03d38b71db4 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/diHadronCor.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/diHadronCor.cxx @@ -108,13 +108,28 @@ struct DiHadronCor { Configurable> cfgMultT0CCutPars{"cfgMultT0CCutPars", std::vector{143.04, -4.58368, 0.0766055, -0.000727796, 2.86153e-06, 23.3108, -0.36304, 0.00437706, -4.717e-05, 1.98332e-07}, "Global multiplicity vs T0C centrality cut parameter values"}; O2_DEFINE_CONFIGURABLE(cfgMultPVT0CCutEnabled, bool, false, "Enable PV multiplicity vs T0C centrality cut") Configurable> cfgMultPVT0CCutPars{"cfgMultPVT0CCutPars", std::vector{195.357, -6.15194, 0.101313, -0.000955828, 3.74793e-06, 30.0326, -0.43322, 0.00476265, -5.11206e-05, 2.13613e-07}, "PV multiplicity vs T0C centrality cut parameter values"}; - O2_DEFINE_CONFIGURABLE(cfgMultMultHighCutFunction, std::string, "[0]+[1]*x + 5.*([2]+[3]*x)", "Functional for multiplicity correlation cut"); - O2_DEFINE_CONFIGURABLE(cfgMultMultLowCutFunction, std::string, "[0]+[1]*x - 5.*([2]+[3]*x)", "Functional for multiplicity correlation cut"); + O2_DEFINE_CONFIGURABLE(cfgMultMultPVHighCutFunction, std::string, "[0]+[1]*x + 5.*([2]+[3]*x)", "Functional for multiplicity correlation cut"); + O2_DEFINE_CONFIGURABLE(cfgMultMultPVLowCutFunction, std::string, "[0]+[1]*x - 5.*([2]+[3]*x)", "Functional for multiplicity correlation cut"); O2_DEFINE_CONFIGURABLE(cfgMultGlobalPVCutEnabled, bool, false, "Enable global multiplicity vs PV multiplicity cut") Configurable> cfgMultGlobalPVCutPars{"cfgMultGlobalPVCutPars", std::vector{-0.140809, 0.734344, 2.77495, 0.0165935}, "PV multiplicity vs T0C centrality cut parameter values"}; + O2_DEFINE_CONFIGURABLE(cfgMultMultV0AHighCutFunction, std::string, "[0] + [1]*x + [2]*x*x + [3]*x*x*x + [4]*x*x*x*x + 4.*([5] + [6]*x + [7]*x*x + [8]*x*x*x + [9]*x*x*x*x)", "Functional for multiplicity correlation cut"); + O2_DEFINE_CONFIGURABLE(cfgMultMultV0ALowCutFunction, std::string, "[0] + [1]*x + [2]*x*x + [3]*x*x*x + [4]*x*x*x*x - 3.*([5] + [6]*x + [7]*x*x + [8]*x*x*x + [9]*x*x*x*x)", "Functional for multiplicity correlation cut"); + O2_DEFINE_CONFIGURABLE(cfgMultMultV0ACutEnabled, bool, false, "Enable global multiplicity vs V0A multiplicity cut") + Configurable> cfgMultMultV0ACutPars{"cfgMultMultV0ACutPars", std::vector{534.893, 184.344, 0.423539, -0.00331436, 5.34622e-06, 871.239, 53.3735, -0.203528, 0.000122758, 5.41027e-07}, "Global multiplicity vs V0A multiplicity cut parameter values"}; std::vector multT0CCutPars; std::vector multPVT0CCutPars; std::vector multGlobalPVCutPars; + std::vector multMultV0ACutPars; + TF1* fMultPVT0CCutLow = nullptr; + TF1* fMultPVT0CCutHigh = nullptr; + TF1* fMultT0CCutLow = nullptr; + TF1* fMultT0CCutHigh = nullptr; + TF1* fMultGlobalPVCutLow = nullptr; + TF1* fMultGlobalPVCutHigh = nullptr; + TF1* fMultMultV0ACutLow = nullptr; + TF1* fMultMultV0ACutHigh = nullptr; + TF1* fT0AV0AMean = nullptr; + TF1* fT0AV0ASigma = nullptr; } cfgFuncParas; SliceCache cache; @@ -183,16 +198,6 @@ struct DiHadronCor { // persistent caches std::vector efficiencyAssociatedCache; - // Additional Event selection cuts - Copy from flowGenericFramework.cxx - TF1* fMultPVT0CCutLow = nullptr; - TF1* fMultPVT0CCutHigh = nullptr; - TF1* fMultT0CCutLow = nullptr; - TF1* fMultT0CCutHigh = nullptr; - TF1* fMultGlobalPVCutLow = nullptr; - TF1* fMultGlobalPVCutHigh = nullptr; - TF1* fT0AV0AMean = nullptr; - TF1* fT0AV0ASigma = nullptr; - void init(InitContext&) { if (cfgCentTableUnavailable && !cfgSelCollByNch) { @@ -229,25 +234,31 @@ struct DiHadronCor { cfgFuncParas.multT0CCutPars = cfgFuncParas.cfgMultT0CCutPars; cfgFuncParas.multPVT0CCutPars = cfgFuncParas.cfgMultPVT0CCutPars; cfgFuncParas.multGlobalPVCutPars = cfgFuncParas.cfgMultGlobalPVCutPars; - fMultPVT0CCutLow = new TF1("fMultPVT0CCutLow", cfgFuncParas.cfgMultCentLowCutFunction->c_str(), 0, 100); - fMultPVT0CCutLow->SetParameters(&(cfgFuncParas.multPVT0CCutPars[0])); - fMultPVT0CCutHigh = new TF1("fMultPVT0CCutHigh", cfgFuncParas.cfgMultCentHighCutFunction->c_str(), 0, 100); - fMultPVT0CCutHigh->SetParameters(&(cfgFuncParas.multPVT0CCutPars[0])); - - fMultT0CCutLow = new TF1("fMultT0CCutLow", cfgFuncParas.cfgMultCentLowCutFunction->c_str(), 0, 100); - fMultT0CCutLow->SetParameters(&(cfgFuncParas.multT0CCutPars[0])); - fMultT0CCutHigh = new TF1("fMultT0CCutHigh", cfgFuncParas.cfgMultCentHighCutFunction->c_str(), 0, 100); - fMultT0CCutHigh->SetParameters(&(cfgFuncParas.multT0CCutPars[0])); - - fMultGlobalPVCutLow = new TF1("fMultGlobalPVCutLow", cfgFuncParas.cfgMultMultLowCutFunction->c_str(), 0, 4000); - fMultGlobalPVCutLow->SetParameters(&(cfgFuncParas.multGlobalPVCutPars[0])); - fMultGlobalPVCutHigh = new TF1("fMultGlobalPVCutHigh", cfgFuncParas.cfgMultMultHighCutFunction->c_str(), 0, 4000); - fMultGlobalPVCutHigh->SetParameters(&(cfgFuncParas.multGlobalPVCutPars[0])); - - fT0AV0AMean = new TF1("fT0AV0AMean", "[0]+[1]*x", 0, 200000); - fT0AV0AMean->SetParameters(-1601.0581, 9.417652e-01); - fT0AV0ASigma = new TF1("fT0AV0ASigma", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x", 0, 200000); - fT0AV0ASigma->SetParameters(463.4144, 6.796509e-02, -9.097136e-07, 7.971088e-12, -2.600581e-17); + cfgFuncParas.multMultV0ACutPars = cfgFuncParas.cfgMultMultV0ACutPars; + cfgFuncParas.fMultPVT0CCutLow = new TF1("fMultPVT0CCutLow", cfgFuncParas.cfgMultCentLowCutFunction->c_str(), 0, 100); + cfgFuncParas.fMultPVT0CCutLow->SetParameters(&(cfgFuncParas.multPVT0CCutPars[0])); + cfgFuncParas.fMultPVT0CCutHigh = new TF1("fMultPVT0CCutHigh", cfgFuncParas.cfgMultCentHighCutFunction->c_str(), 0, 100); + cfgFuncParas.fMultPVT0CCutHigh->SetParameters(&(cfgFuncParas.multPVT0CCutPars[0])); + + cfgFuncParas.fMultT0CCutLow = new TF1("fMultT0CCutLow", cfgFuncParas.cfgMultCentLowCutFunction->c_str(), 0, 100); + cfgFuncParas.fMultT0CCutLow->SetParameters(&(cfgFuncParas.multT0CCutPars[0])); + cfgFuncParas.fMultT0CCutHigh = new TF1("fMultT0CCutHigh", cfgFuncParas.cfgMultCentHighCutFunction->c_str(), 0, 100); + cfgFuncParas.fMultT0CCutHigh->SetParameters(&(cfgFuncParas.multT0CCutPars[0])); + + cfgFuncParas.fMultGlobalPVCutLow = new TF1("fMultGlobalPVCutLow", cfgFuncParas.cfgMultMultPVLowCutFunction->c_str(), 0, 4000); + cfgFuncParas.fMultGlobalPVCutLow->SetParameters(&(cfgFuncParas.multGlobalPVCutPars[0])); + cfgFuncParas.fMultGlobalPVCutHigh = new TF1("fMultGlobalPVCutHigh", cfgFuncParas.cfgMultMultPVHighCutFunction->c_str(), 0, 4000); + cfgFuncParas.fMultGlobalPVCutHigh->SetParameters(&(cfgFuncParas.multGlobalPVCutPars[0])); + + cfgFuncParas.fMultMultV0ACutLow = new TF1("fMultMultV0ACutLow", cfgFuncParas.cfgMultMultV0ALowCutFunction->c_str(), 0, 4000); + cfgFuncParas.fMultMultV0ACutLow->SetParameters(&(cfgFuncParas.multMultV0ACutPars[0])); + cfgFuncParas.fMultMultV0ACutHigh = new TF1("fMultMultV0ACutHigh", cfgFuncParas.cfgMultMultV0AHighCutFunction->c_str(), 0, 4000); + cfgFuncParas.fMultMultV0ACutHigh->SetParameters(&(cfgFuncParas.multMultV0ACutPars[0])); + + cfgFuncParas.fT0AV0AMean = new TF1("fT0AV0AMean", "[0]+[1]*x", 0, 200000); + cfgFuncParas.fT0AV0AMean->SetParameters(-1601.0581, 9.417652e-01); + cfgFuncParas.fT0AV0ASigma = new TF1("fT0AV0ASigma", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x", 0, 200000); + cfgFuncParas.fT0AV0ASigma->SetParameters(463.4144, 6.796509e-02, -9.097136e-07, 7.971088e-12, -2.600581e-17); } std::string hCentTitle = "Centrality distribution, Estimator " + std::to_string(cfgCentEstimator); @@ -682,21 +693,27 @@ struct DiHadronCor { auto multNTracksPV = collision.multNTracksPV(); if (cfgEvSelMultCorrelation) { if (cfgFuncParas.cfgMultPVT0CCutEnabled) { - if (multNTracksPV < fMultPVT0CCutLow->Eval(centrality)) + if (multNTracksPV < cfgFuncParas.fMultPVT0CCutLow->Eval(centrality)) return 0; - if (multNTracksPV > fMultPVT0CCutHigh->Eval(centrality)) + if (multNTracksPV > cfgFuncParas.fMultPVT0CCutHigh->Eval(centrality)) return 0; } if (cfgFuncParas.cfgMultT0CCutEnabled) { - if (multTrk < fMultT0CCutLow->Eval(centrality)) + if (multTrk < cfgFuncParas.fMultT0CCutLow->Eval(centrality)) return 0; - if (multTrk > fMultT0CCutHigh->Eval(centrality)) + if (multTrk > cfgFuncParas.fMultT0CCutHigh->Eval(centrality)) return 0; } if (cfgFuncParas.cfgMultGlobalPVCutEnabled) { - if (multTrk < fMultGlobalPVCutLow->Eval(multNTracksPV)) + if (multTrk < cfgFuncParas.fMultGlobalPVCutLow->Eval(multNTracksPV)) + return 0; + if (multTrk > cfgFuncParas.fMultGlobalPVCutHigh->Eval(multNTracksPV)) + return 0; + } + if (cfgFuncParas.cfgMultMultV0ACutEnabled) { + if (collision.multFV0A() < cfgFuncParas.fMultMultV0ACutLow->Eval(multTrk)) return 0; - if (multTrk > fMultGlobalPVCutHigh->Eval(multNTracksPV)) + if (collision.multFV0A() > cfgFuncParas.fMultMultV0ACutHigh->Eval(multTrk)) return 0; } } @@ -705,7 +722,7 @@ struct DiHadronCor { // V0A T0A 5 sigma cut float sigma = 5.0; - if (cfgEvSelV0AT0ACut && (std::fabs(collision.multFV0A() - fT0AV0AMean->Eval(collision.multFT0A())) > sigma * fT0AV0ASigma->Eval(collision.multFT0A()))) + if (cfgEvSelV0AT0ACut && (std::fabs(collision.multFV0A() - cfgFuncParas.fT0AV0AMean->Eval(collision.multFT0A())) > sigma * cfgFuncParas.fT0AV0ASigma->Eval(collision.multFT0A()))) return 0; if (fillCounter && cfgEvSelV0AT0ACut) registry.fill(HIST("hEventCountSpecific"), 11.5); From 7f8298e27cd1939384fc7ba23cb7438774970fa7 Mon Sep 17 00:00:00 2001 From: Steffimro <63045530+Steffimro@users.noreply.github.com> Date: Sat, 2 Aug 2025 15:09:06 +0200 Subject: [PATCH 200/345] [PWGEM] Add task to compare V0s from LF and EM builder (#12383) --- PWGEM/PhotonMeson/Tasks/CMakeLists.txt | 6 + PWGEM/PhotonMeson/Tasks/compconvbuilder.cxx | 889 ++++++++++++++++++++ 2 files changed, 895 insertions(+) create mode 100644 PWGEM/PhotonMeson/Tasks/compconvbuilder.cxx diff --git a/PWGEM/PhotonMeson/Tasks/CMakeLists.txt b/PWGEM/PhotonMeson/Tasks/CMakeLists.txt index e022256a5b6..332cafc0795 100644 --- a/PWGEM/PhotonMeson/Tasks/CMakeLists.txt +++ b/PWGEM/PhotonMeson/Tasks/CMakeLists.txt @@ -161,6 +161,12 @@ o2physics_add_dpl_workflow(diphoton-hadron-mpc-pcmpcm PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGEMPhotonMesonCore COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(compconvbuilder + SOURCES compconvbuilder.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGEMPhotonMesonCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(diphoton-hadron-mpc-pcmdalitzee SOURCES diphotonHadronMPCPCMDalitzEE.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGEMPhotonMesonCore diff --git a/PWGEM/PhotonMeson/Tasks/compconvbuilder.cxx b/PWGEM/PhotonMeson/Tasks/compconvbuilder.cxx new file mode 100644 index 00000000000..5512191322c --- /dev/null +++ b/PWGEM/PhotonMeson/Tasks/compconvbuilder.cxx @@ -0,0 +1,889 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file compconvbuilder.cxx +/// \brief QA task for photons in the EM and LF builder +/// +/// \author S. Mrozinski, smrozins@cern.ch + +#include "PWGEM/Dilepton/Utils/MCUtilities.h" +#include "PWGEM/PhotonMeson/Core/EMPhotonEventCut.h" +#include "PWGEM/PhotonMeson/DataModel/gammaTables.h" +#include "PWGEM/PhotonMeson/Utils/MCUtilities.h" +#include "PWGEM/PhotonMeson/Utils/PCMUtilities.h" +#include "PWGEM/PhotonMeson/Utils/PairUtilities.h" +#include "PWGLF/DataModel/LFParticleIdentification.h" +#include "PWGLF/DataModel/LFStrangenessMLTables.h" +#include "PWGLF/DataModel/LFStrangenessPIDTables.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" + +#include "Common/Core/RecoDecay.h" +#include "Common/Core/TPCVDriftManager.h" +#include "Common/Core/TrackSelection.h" +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/McCollisionExtra.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "CCDB/BasicCCDBManager.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "DataFormatsParameters/GRPObject.h" +#include "DetectorsBase/GeometryManager.h" +#include "DetectorsBase/Propagator.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/Track.h" + +#include +#include +#include +#include +#include +#include +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::aod; +using namespace o2::soa; + +using namespace o2::aod::pwgem::photon; +using namespace o2::aod::pwgem::dilepton::utils::mcutil; +using namespace o2::aod::pwgem::photonmeson::utils::mcutil; + +using MyV0Photons = soa::Join; +using MyMCV0Legs = soa::Join; +using MyMCV0Leg = MyMCV0Legs::iterator; + +using MyCollisions = soa::Join; +using MyCollision = MyCollisions::iterator; + +using MyMCCollisions = soa::Join; +using MyMCCollision = MyMCCollisions::iterator; + +using MyStraCollisions = soa::Join; +using MyStraCollision = MyStraCollisions::iterator; + +using MyTracksIUMC = soa::Join; +using MyMCParticles = aod::McParticles; + +using V0DerivedMCDatas = soa::Join; + +using dauTracks = soa::Join; + +struct Convbuildercomp { + HistogramRegistry registry{"Convbuildercomp"}; + + enum conversionBuilderID { + EMBuilder = 0, + LFBuilder = 1, + EMOnly = 2, + LFOnly = 3, + Common = 4 + }; + + static constexpr std::string_view conversionBuilder[5] = {"EMBuilder/", "LFBuilder/", "EMOnly/", "LFOnly/", "Common/"}; + static constexpr std::string_view event_types[2] = {"before/", "after/"}; + + EMPhotonEventCut fEMEventCut; + struct : ConfigurableGroup { + std::string prefix = "eventcut_group"; + Configurable cfgZvtxMax{"cfgZvtxMax", 10.f, "max. Zvtx"}; + Configurable cfgRequireSel8{"cfgRequireSel8", true, "require sel8 in event cut"}; + Configurable cfgRequireFT0AND{"cfgRequireFT0AND", true, "require FT0AND in event cut"}; + Configurable cfgRequireNoTFB{"cfgRequireNoTFB", true, "require No time frame border in event cut"}; + Configurable cfgRequireNoITSROFB{"cfgRequireNoITSROFB", true, "require no ITS readout frame border in event cut"}; + Configurable cfgRequireNoSameBunchPileup{"cfgRequireNoSameBunchPileup", false, "require no same bunch pileup in event cut"}; + Configurable cfgRequireVertexITSTPC{"cfgRequireVertexITSTPC", false, "require Vertex ITSTPC in event cut"}; // ITS-TPC matched track contributes PV. + Configurable cfgRequireGoodZvtxFT0vsPV{"cfgRequireGoodZvtxFT0vsPV", false, "require good Zvtx between FT0 vs. PV in event cut"}; + Configurable cfgTrackOccupancyMin{"cfgTrackOccupancyMin", -2, "min. occupancy"}; + Configurable cfgTrackOccupancyMax{"cfgTrackOccupancyMax", 1000000000, "max. occupancy"}; + Configurable cfgFT0COccupancyMin{"cfgFT0COccupancyMin", -2, "min. FT0C occupancy"}; + Configurable cfgFT0COccupancyMax{"cfgFT0COccupancyMax", 1000000000, "max. FT0C occupancy"}; + Configurable cfgRequireNoCollInTimeRangeStandard{"cfgRequireNoCollInTimeRangeStandard", false, "require no collision in time range standard"}; + Configurable cfgRequireNoCollInTimeRangeStrict{"cfgRequireNoCollInTimeRangeStrict", false, "require no collision in time range strict"}; + Configurable cfgRequireNoCollInITSROFStandard{"cfgRequireNoCollInITSROFStandard", false, "require no collision in time range standard"}; + Configurable cfgRequireNoCollInITSROFStrict{"cfgRequireNoCollInITSROFStrict", false, "require no collision in time range strict"}; + Configurable cfgRequireNoHighMultCollInPrevRof{"cfgRequireNoHighMultCollInPrevRof", false, "require no HM collision in previous ITS ROF"}; + } eventcuts; + + void DefineEMEventCut() + { + fEMEventCut = EMPhotonEventCut("fEMEventCut", "fEMEventCut"); + fEMEventCut.SetRequireSel8(eventcuts.cfgRequireSel8); + fEMEventCut.SetRequireFT0AND(eventcuts.cfgRequireFT0AND); + fEMEventCut.SetZvtxRange(-eventcuts.cfgZvtxMax, +eventcuts.cfgZvtxMax); + fEMEventCut.SetRequireNoTFB(eventcuts.cfgRequireNoTFB); + fEMEventCut.SetRequireNoITSROFB(eventcuts.cfgRequireNoITSROFB); + fEMEventCut.SetRequireNoSameBunchPileup(eventcuts.cfgRequireNoSameBunchPileup); + fEMEventCut.SetRequireVertexITSTPC(eventcuts.cfgRequireVertexITSTPC); + fEMEventCut.SetRequireGoodZvtxFT0vsPV(eventcuts.cfgRequireGoodZvtxFT0vsPV); + fEMEventCut.SetRequireNoCollInTimeRangeStandard(eventcuts.cfgRequireNoCollInTimeRangeStandard); + fEMEventCut.SetRequireNoCollInTimeRangeStrict(eventcuts.cfgRequireNoCollInTimeRangeStrict); + fEMEventCut.SetRequireNoCollInITSROFStandard(eventcuts.cfgRequireNoCollInITSROFStandard); + fEMEventCut.SetRequireNoCollInITSROFStrict(eventcuts.cfgRequireNoCollInITSROFStrict); + fEMEventCut.SetRequireNoHighMultCollInPrevRof(eventcuts.cfgRequireNoHighMultCollInPrevRof); + } + + // Link V0-photons to their collision + Preslice perV0PhotonCollision = aod::v0photonkf::emeventId; + + void init(InitContext const& /*ctx*/) + { + + DefineEMEventCut(); + + for (int i = 0; i < 5; ++i) { + + registry.add(string(conversionBuilder[i]) + "hPt", ";p_{T} (GeV/c); Counts", kTH1F, {{1000, 0., 10.}}); + registry.add(string(conversionBuilder[i]) + "hR", ";R_{conv} (cm); Counts", kTH1F, {{100, 0., 100.}}); + + registry.add(string(conversionBuilder[i]) + "hEta", ";#eta; Counts", kTH1F, {{200, -1.0f, 1.0f}}); + + registry.add(string(conversionBuilder[i]) + "hcosPA", ";R_{conv} (cm); Counts", kTH1F, {{100, 0.99f, 1.0f}}); + + registry.add(string(conversionBuilder[i]) + "MatchedDeltaRec", ";#Delta colID_{rec};Counts", kTH1F, {{21, -10.5, 10.5}}); + + registry.add(string(conversionBuilder[i]) + "hZ", ";z (cm);Counts", kTH1F, {{200, -100, 100}}); + + registry.add(string(conversionBuilder[i]) + "hZR", "conversion point in RZ;Z (cm);R_{xy} (cm)", kTH2F, {{200, -100, 100}, {200, 0.0f, 100.0f}}); + + registry.add(string(conversionBuilder[i]) + "hAP", "AP plot;#alpha;q_{T} (GeV/c)", kTH2F, {{200, -1.0f, +1.0f}, {250, 0.0f, 0.25f}}); + + registry.add(string(conversionBuilder[i]) + "ResolutionGen/Z_res", "Conversion radius resolution;z_{conv, gen} (cm);R_{conv, gen} (cm);#varphi_{gen} (rad.);#eta_{gen};p_{T, gen};z_{conv, rec} - z_{conv, gen} (cm);", + kTHnSparseF, + {{200, -100, 100}, + {200, 0, 100}, + {90, 0, 2 * M_PI}, + {200, -1.0f, 1.0f}, + {500, 0, 10}, + {120, -30, 30} + + }, + false); + + registry.add(string(conversionBuilder[i]) + "ResolutionGen/R_res", "Conversion radius resolution;z_{conv, gen} (cm);R_{conv, gen} (cm);#varphi_{gen} (rad.);#eta_{gen};p_{T, gen};R_{conv, rec} - R_{conv, gen} (cm);", + kTHnSparseF, + {{200, -100, 100}, + {200, 0, 100}, + {90, 0, 2 * M_PI}, + {200, -1.0f, 1.0f}, + {500, 0, 10}, + {120, -30, 30} + + }, + false); + + registry.add(string(conversionBuilder[i]) + "ResolutionGen/Phi_res", "#varphi resolution;z_{conv, gen} (cm);R_{conv, gen} (cm);#varphi_{gen} (rad.);#eta_{gen};p_{T, gen};#varphi_{conv, rec} - #varphi_{conv, gen} (cm);", + kTHnSparseF, + {{200, -100, 100}, + {200, 0, 100}, + {90, 0, 2 * M_PI}, + {200, -1.0f, 1.0f}, + {500, 0, 10}, + {100, -0.2f, 0.2f} + + }, + false); + + registry.add(string(conversionBuilder[i]) + "ResolutionGen/Pt_res", "Conversion radius resolution;z_{conv, gen} (cm);R_{conv, gen} (cm);#varphi_{gen} (rad.);#eta_{gen};p_{T, gen};p_{T, rec} - p_{T, gen}/p_{T, gen};", + kTHnSparseF, + {{200, -100, 100}, + {200, 0, 100}, + {90, 0, 2 * M_PI}, + {200, -1.0f, 1.0f}, + {500, 0, 10}, + {200, -1.0f, 1.0f} + + }, + false); + + registry.add(string(conversionBuilder[i]) + "ResolutionGen/Eta_res", "Conversion radius resolution;z_{conv, gen} (cm);R_{conv, gen} (cm);#varphi_{gen} (rad.);#eta_{gen};p_{T, gen};#eta_{conv, rec} - #eta_{conv, gen} (cm);", + kTHnSparseF, + {{200, -100, 100}, + {200, 0, 100}, + {90, 0, 2 * M_PI}, + {200, -1.0f, 1.0f}, + {500, 0, 10}, + {100, -0.5f, 0.5f} + + }, + false); + + registry.add(string(conversionBuilder[i]) + "ResolutionRec/Z_res", "Conversion radius resolution;z_{conv, rec} (cm);R_{conv, rec} (cm);#varphi_{rec} (rad.);#eta_{rec};p_{T, rec};z_{conv, rec} - z_{conv, gen} (cm);", + kTHnSparseF, + {{200, -100, 100}, + {200, 0, 100}, + {90, 0, 2 * M_PI}, + {200, -1.0f, 1.0f}, + {500, 0, 10}, + {120, -30, 30} + + }, + false); + + registry.add(string(conversionBuilder[i]) + "ResolutionRec/R_res", "Conversion radius resolution;z_{conv, rec} (cm);R_{conv, rec} (cm);#varphi_{rec} (rad.);#eta_{rec};p_{T, rec};R_{conv, rec} - R_{conv, gen} (cm);", + kTHnSparseF, + {{200, -100, 100}, + {200, 0, 100}, + {90, 0, 2 * M_PI}, + {200, -1.0f, 1.0f}, + {500, 0, 10}, + {120, -30, 30} + + }, + false); + + registry.add(string(conversionBuilder[i]) + "ResolutionRec/Phi_res", "#varphi resolution;z_{conv, rec} (cm);R_{conv, rec} (cm);#varphi_{rec} (rad.);#eta_{rec};p_{T, rec};#varphi_{conv, rec} - #varphi_{conv, gen} (cm);", + kTHnSparseF, + {{200, -100, 100}, + {200, 0, 100}, + {90, 0, 2 * M_PI}, + {200, -1.0f, 1.0f}, + {500, 0, 10}, + {100, -0.2f, 0.2f} + + }, + false); + + registry.add(string(conversionBuilder[i]) + "ResolutionRec/Pt_res", "Conversion radius resolution;z_{conv, rec} (cm);R_{conv, rec} (cm);#varphi_{rec} (rad.);#eta_{rec};p_{T, rec};p_{T, rec} - p_{T, gen}/p_{T, gen};", + kTHnSparseF, + {{200, -100, 100}, + {200, 0, 100}, + {90, 0, 2 * M_PI}, + {200, -1.0f, 1.0f}, + {500, 0, 10}, + {200, -1.0f, 1.0f} + + }, + false); + + registry.add(string(conversionBuilder[i]) + "ResolutionRec/Eta_res", "Conversion radius resolution;z_{conv, rec} (cm);R_{conv, rec} (cm);#varphi_{rec} (rad.);#eta_{rec};p_{T, rec};#eta_{conv, rec} - #eta_{conv, gen} (cm);", + kTHnSparseF, + {{200, -100, 100}, + {200, 0, 100}, + {90, 0, 2 * M_PI}, + {200, -1.0f, 1.0f}, + {500, 0, 10}, + {100, -0.5f, 0.5f} + + }, + false); + registry.add(string(conversionBuilder[i]) + "ConvInfo", "Conversion radius resolution;x_{conv} (cm);y_{conv} (cm);z_{conv} (cm);R_{conv} (cm);#varphi (rad.);#eta;p_{T, gen};", + kTHnSparseF, + { + {200, -100, 100}, + {200, -100, 100}, + {200, -100, 100}, + {200, 0, 100}, + {90, 0, 2 * M_PI}, + {200, -1.0f, 1.0f}, + {500, 0, 10}, + + }, + false); + + registry.add(string(conversionBuilder[i]) + "V0Leg/Asymmetry", "", kTH1F, {{100, 0, 1}}); + + auto hCollisionCounter = registry.add(string(conversionBuilder[i]) + "Event/before/hCollisionCounter", "collision counter;;Number of events", kTH1F, {{10, 0.5, 10.5}}, false); + hCollisionCounter->GetXaxis()->SetBinLabel(1, "all"); + hCollisionCounter->GetXaxis()->SetBinLabel(2, "No TF border"); + hCollisionCounter->GetXaxis()->SetBinLabel(3, "No ITS ROF border"); + hCollisionCounter->GetXaxis()->SetBinLabel(4, "No Same Bunch Pileup"); + hCollisionCounter->GetXaxis()->SetBinLabel(5, "Is Vertex ITSTPC"); + hCollisionCounter->GetXaxis()->SetBinLabel(6, "Is Good Zvtx FT0vsPV"); + hCollisionCounter->GetXaxis()->SetBinLabel(7, "FT0AND"); + hCollisionCounter->GetXaxis()->SetBinLabel(8, "sel8"); + hCollisionCounter->GetXaxis()->SetBinLabel(9, "|Z_{vtx}| < 10 cm"); + hCollisionCounter->GetXaxis()->SetBinLabel(10, "accepted"); + + registry.add(string(conversionBuilder[i]) + "Event/before/hZvtx", "vertex z; Z_{vtx} (cm)", kTH1F, {{100, -50, +50}}, false); + registry.add(string(conversionBuilder[i]) + "Event/before/hMultNTracksPV", "hMultNTracksPV; N_{track} to PV", kTH1F, {{6001, -0.5, 6000.5}}, false); + registry.add(string(conversionBuilder[i]) + "Event/before/hMultNTracksPVeta1", "hMultNTracksPVeta1; N_{track} to PV", kTH1F, {{6001, -0.5, 6000.5}}, false); + registry.add(string(conversionBuilder[i]) + "Event/before/hMultFT0", "hMultFT0;mult. FT0A;mult. FT0C", kTH2F, {{300, 0, 6000}, {300, 0, 6000}}, false); + registry.add(string(conversionBuilder[i]) + "Event/before/hCentFT0A", "hCentFT0A;centrality FT0A (%)", kTH1F, {{110, 0, 110}}, false); + registry.add(string(conversionBuilder[i]) + "Event/before/hCentFT0C", "hCentFT0C;centrality FT0C (%)", kTH1F, {{110, 0, 110}}, false); + registry.add(string(conversionBuilder[i]) + "Event/before/hCentFT0M", "hCentFT0M;centrality FT0M (%)", kTH1F, {{110, 0, 110}}, false); + registry.add(string(conversionBuilder[i]) + "Event/before/hCentFT0MvsMultNTracksPV", "hCentFT0MvsMultNTracksPV;centrality FT0M (%);N_{track} to PV", kTH2F, {{110, 0, 110}, {600, 0, 6000}}, false); + registry.add(string(conversionBuilder[i]) + "Event/before/hMultFT0MvsMultNTracksPV", "hMultFT0MvsMultNTracksPV;mult. FT0M;N_{track} to PV", kTH2F, {{600, 0, 6000}, {600, 0, 6000}}, false); + registry.addClone(string(conversionBuilder[i]) + "Event/before/", string(conversionBuilder[i]) + "Event/after/"); + } + + registry.add("truePhotons/hPt_Converted", "Converted Photons; p_{T} (GeV/c); Counts", kTH1F, {{100, 0., 10.}}); + registry.add("truePhotons/hR_Converted", "Converted Photons; R (cm); Counts", kTH1F, {{100, 0., 100.}}); + + registry.add("truePhotons/Sparse_Converted", "Conversion radius resolution;x_{conv} (cm);z_{conv} (cm);y_{conv} (cm);R_{conv} (cm);#varphi (rad.);#eta;p_{T, gen};", + kTHnSparseF, + {{200, -100, 100}, + {200, -100, 100}, + {200, -100, 100}, + {200, 0, 100}, + {90, 0, 2 * M_PI}, + {200, -1.0f, 1.0f}, + {500, 0, 10}}, + false); + + auto h = registry.add("EMBuilder/hV0SignType", "Crosscheck", kTH1F, {{3, 0.5, 4.5}}, false); + h->GetXaxis()->SetBinLabel(1, "Same-sign"); + h->GetXaxis()->SetBinLabel(2, "Opposite-sign"); + h->GetXaxis()->SetBinLabel(3, "Zero-sign"); + + auto h2 = registry.add("EMBuilder/hV0ElectronPositronTrue", "pair in MC truth;;counts", kTH1F, {{2, -0.5, 1.5}}); + h2->GetXaxis()->SetBinLabel(1, "Mismatch"); + h2->GetXaxis()->SetBinLabel(2, "Good"); + } + + template + void fillEventInfo(TCollision const& collision, const float /*weight*/ = 1.f) + { + registry.fill(HIST(conversionBuilder[type]) + HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 1.0); + + if (collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { + registry.fill(HIST(conversionBuilder[type]) + HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 2.0); + } + if (collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { + registry.fill(HIST(conversionBuilder[type]) + HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 3.0); + } + if (collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + registry.fill(HIST(conversionBuilder[type]) + HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 4.0); + } + if (collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { + registry.fill(HIST(conversionBuilder[type]) + HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 5.0); + } + if (collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + registry.fill(HIST(conversionBuilder[type]) + HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 6.0); + } + + if (collision.selection_bit(o2::aod::evsel::kIsTriggerTVX)) { + registry.fill(HIST(conversionBuilder[type]) + HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 7.0); + } + + if (collision.sel8()) { + registry.fill(HIST(conversionBuilder[type]) + HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 8.0); + } + if (std::fabs(collision.posZ()) < 10.0) { + registry.fill(HIST(conversionBuilder[type]) + HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 9.0); + } + + registry.fill(HIST(conversionBuilder[type]) + HIST("Event/") + HIST(event_types[ev_id]) + HIST("hMultNTracksPVeta1"), collision.multNTracksPVeta1()); + } + + template + void fillLegInfo(auto& v0, auto& posleg, auto& negleg) + { + if constexpr (type == 0) { + + float ptPos = posleg.pt(); + float ptNeg = negleg.pt(); + float asym = (ptPos - ptNeg) / (ptPos + ptNeg); + + registry.fill(HIST(conversionBuilder[type]) + HIST("V0Leg/Asymmetry"), asym); + + } else { + + float ptPos = v0.postrackpt(); + float ptNeg = negleg.negtrackpt(); + float asym = (ptPos - ptNeg) / (ptPos + ptNeg); + + registry.fill(HIST(conversionBuilder[type]) + HIST("V0Leg/Asymmetry"), asym); + } + } + + template + void fillV0Info(auto& v0, auto& v0MC, auto& mcleg) + { + registry.fill(HIST(conversionBuilder[type]) + HIST("hPt"), v0.pt()); + registry.fill(HIST(conversionBuilder[type]) + HIST("hEta"), v0.eta()); + registry.fill(HIST(conversionBuilder[type]) + HIST("hAP"), v0.alpha(), v0.qtarm()); + + if constexpr (type == 0 || type == 2) { + registry.fill(HIST(conversionBuilder[type]) + HIST("hZ"), v0.vz()); + registry.fill(HIST(conversionBuilder[type]) + HIST("hcosPA"), v0.cospa()); + registry.fill(HIST(conversionBuilder[type]) + HIST("hZR"), v0.vz(), v0.v0radius()); + + float deltapT = v0.pt() - v0MC.pt(); + float deltaZ = v0.vz() - mcleg.vz(); + float deltaPhi = v0.phi() - v0MC.phi(); + float deltaEta = v0.eta() - v0MC.eta(); + float deltaR = v0.v0radius() - std::sqrt(std::pow(mcleg.vx(), 2) + std::pow(mcleg.vy(), 2)); + + registry.fill(HIST(conversionBuilder[type]) + HIST("ResolutionGen/Z_res"), + mcleg.vz(), + std::sqrt(std::pow(mcleg.vx(), 2) + std::pow(mcleg.vy(), 2)), + v0MC.phi(), + v0MC.eta(), + v0MC.pt(), + deltaZ); + + registry.fill(HIST(conversionBuilder[type]) + HIST("ResolutionGen/R_res"), + mcleg.vz(), + std::sqrt(std::pow(mcleg.vx(), 2) + std::pow(mcleg.vy(), 2)), + v0MC.phi(), + v0MC.eta(), + v0MC.pt(), + deltaR); + + registry.fill(HIST(conversionBuilder[type]) + HIST("ResolutionGen/Phi_res"), + mcleg.vz(), + std::sqrt(std::pow(mcleg.vx(), 2) + std::pow(mcleg.vy(), 2)), + v0MC.phi(), + v0MC.eta(), + v0MC.pt(), + deltaPhi); + + registry.fill(HIST(conversionBuilder[type]) + HIST("ResolutionGen/Pt_res"), + mcleg.vz(), + std::sqrt(std::pow(mcleg.vx(), 2) + std::pow(mcleg.vy(), 2)), + v0MC.phi(), + v0MC.eta(), + v0MC.pt(), + deltapT); + + registry.fill(HIST(conversionBuilder[type]) + HIST("ResolutionGen/Eta_res"), + mcleg.vz(), + std::sqrt(std::pow(mcleg.vx(), 2) + std::pow(mcleg.vy(), 2)), + v0MC.phi(), + v0MC.eta(), + v0MC.pt(), + deltaEta); + + registry.fill(HIST(conversionBuilder[type]) + HIST("ResolutionRec/Z_res"), + v0.vz(), + v0.v0radius(), + v0.phi(), + v0.eta(), + v0.pt(), + deltaZ); + + registry.fill(HIST(conversionBuilder[type]) + HIST("ResolutionRec/R_res"), + v0.vz(), + v0.v0radius(), + v0.phi(), + v0.eta(), + v0.pt(), + deltaR); + + registry.fill(HIST(conversionBuilder[type]) + HIST("ResolutionRec/Phi_res"), + v0.vz(), + v0.v0radius(), + v0.phi(), + v0.eta(), + v0.pt(), + deltaPhi); + + registry.fill(HIST(conversionBuilder[type]) + HIST("ResolutionRec/Pt_res"), + v0.vz(), + v0.v0radius(), + v0.phi(), + v0.eta(), + v0.pt(), + deltapT); + + registry.fill(HIST(conversionBuilder[type]) + HIST("ResolutionRec/Eta_res"), + v0.vz(), + v0.v0radius(), + v0.phi(), + v0.eta(), + v0.pt(), + deltaEta); + + registry.fill(HIST(conversionBuilder[type]) + HIST("ConvInfo"), + v0.vx(), // 0 + v0.vy(), // 1 + v0.vz(), // 2 + v0.v0radius(), // 3 + v0.phi(), // 4 + v0.eta(), // 5 + v0.pt()); // 6 + + } else { + registry.fill(HIST(conversionBuilder[type]) + HIST("hZ"), v0.z()); + registry.fill(HIST(conversionBuilder[type]) + HIST("hcosPA"), v0.v0cosPA()); + registry.fill(HIST(conversionBuilder[type]) + HIST("hZR"), v0.z(), v0.v0radius()); + + float deltaR = v0.v0radius() - std::hypot(v0MC.xMC(), v0MC.yMC()); + + float phiRec = v0.phi(); + if (phiRec < 0) { + phiRec += 2.0f * static_cast(M_PI); + } + + float phiMC = std::atan2(v0MC.pyMC(), v0MC.pxMC()); + if (phiMC < 0) { + phiMC += 2.0f * static_cast(M_PI); + } + + float deltaPhi = phiRec - phiMC; + if (deltaPhi < 0) { + deltaPhi += 2.0f * static_cast(M_PI); + } + + float etaGen = 0.5f * std::log((std::hypot(v0MC.pxMC(), v0MC.pyMC(), v0MC.pzMC()) + v0MC.pzMC()) / (std::hypot(v0MC.pxMC(), v0MC.pyMC(), v0MC.pzMC()) - v0MC.pzMC())); + + float etaRec = 0.5f * std::log((std::hypot(v0.px(), v0.py(), v0.pz()) + v0.pz()) / (std::hypot(v0.px(), v0.py(), v0.pz()) - v0.pz())); + + float deltapT = v0.pt() - v0MC.ptMC(); + float deltaEta = etaRec - etaGen; + float deltaZ = v0.z() - v0MC.zMC(); + + registry.fill(HIST(conversionBuilder[type]) + HIST("ResolutionGen/Z_res"), + v0MC.zMC(), + std::hypot(v0MC.xMC(), v0MC.yMC()), + phiMC, + etaGen, + v0MC.ptMC(), + deltaZ); + + registry.fill(HIST(conversionBuilder[type]) + HIST("ResolutionGen/R_res"), + v0MC.zMC(), + std::hypot(v0MC.xMC(), v0MC.yMC()), + phiMC, + etaGen, + v0MC.ptMC(), + deltaR); + + registry.fill(HIST(conversionBuilder[type]) + HIST("ResolutionGen/Phi_res"), + v0MC.zMC(), + std::hypot(v0MC.xMC(), v0MC.yMC()), + phiMC, + etaGen, + v0MC.ptMC(), + deltaPhi); + + registry.fill(HIST(conversionBuilder[type]) + HIST("ResolutionGen/Pt_res"), + v0MC.zMC(), + std::hypot(v0MC.xMC(), v0MC.yMC()), + phiMC, + etaGen, + v0MC.ptMC(), + deltapT); + + registry.fill(HIST(conversionBuilder[type]) + HIST("ResolutionGen/Eta_res"), + v0MC.zMC(), + std::hypot(v0MC.xMC(), v0MC.yMC()), + phiMC, + etaGen, + v0MC.ptMC(), + deltaEta); + + registry.fill(HIST(conversionBuilder[type]) + HIST("ResolutionRec/Z_res"), + v0.z(), + v0.v0radius(), + phiRec, + v0.eta(), + v0.pt(), + deltaZ); + + registry.fill(HIST(conversionBuilder[type]) + HIST("ResolutionRec/R_res"), + v0.z(), + v0.v0radius(), + phiRec, + v0.eta(), + v0.pt(), + deltaR); + + registry.fill(HIST(conversionBuilder[type]) + HIST("ResolutionRec/Phi_res"), + v0.z(), + v0.v0radius(), + phiRec, + v0.eta(), + v0.pt(), + deltaPhi); + + registry.fill(HIST(conversionBuilder[type]) + HIST("ResolutionRec/Eta_res"), + v0.z(), + v0.v0radius(), + phiRec, + v0.eta(), + v0.pt(), + deltaEta); + + registry.fill(HIST(conversionBuilder[type]) + HIST("ResolutionRec/Pt_res"), + v0.z(), + v0.v0radius(), + phiRec, + v0.eta(), + v0.pt(), + deltapT); + + registry.fill(HIST(conversionBuilder[type]) + HIST("ConvInfo"), + v0.x(), + v0.y(), + v0.z(), + v0.v0radius(), + phiRec, + v0.eta(), + v0.pt()); + } + + registry.fill(HIST(conversionBuilder[type]) + HIST("hR"), v0.v0radius()); + } + + Preslice perCollisionMCDerived = o2::aod::v0data::straCollisionId; + + void processLFV0sMC(MyStraCollisions const& stracollisions, + soa::Join const&, + V0DerivedMCDatas const& strangeV0s) + { + + for (auto& collision : stracollisions) { + + fillEventInfo<0, LFBuilder>(collision); + + if (!fEMEventCut.IsSelected(collision)) { + continue; + } + + fillEventInfo<1, LFBuilder>(collision); + + registry.fill(HIST((conversionBuilder[1])) + HIST("Event/before/hCollisionCounter"), 10.0); + registry.fill(HIST((conversionBuilder[1])) + HIST("Event/after/hCollisionCounter"), 10.0); // accepted + + auto myV0s = strangeV0s.sliceBy(perCollisionMCDerived, collision.globalIndex()); + + for (auto const& v0 : myV0s) { + if (!v0.has_v0MCCore()) { + continue; + } + + auto v0MC = v0.v0MCCore_as>(); + + if (v0MC.pdgCode() != 22 || !v0MC.isPhysicalPrimary()) { + continue; + } + + auto posTrack = v0.template posTrackExtra_as(); + + fillV0Info(v0, v0MC, posTrack); + } + } + } + + Preslice perCollision = aod::v0photonkf::emeventId; + + void processEMV0sMC(MyV0Photons const& v0s, aod::EMMCParticles const& mcparticles, MyMCV0Legs const&, MyCollisions const& collisions) + { + + for (auto& collision : collisions) { + + fillEventInfo<0, EMBuilder>(collision); + + if (!fEMEventCut.IsSelected(collision)) { + continue; + } + fillEventInfo<1, EMBuilder>(collision); + + registry.fill(HIST((conversionBuilder[0])) + HIST("Event/before/hCollisionCounter"), 10.0); // accepted + registry.fill(HIST((conversionBuilder[0])) + HIST("Event/after/hCollisionCounter"), 10.0); // accepted + + auto V0Photons_coll = v0s.sliceBy(perCollision, collision.globalIndex()); + + for (auto const& v0 : V0Photons_coll) { + + auto pos = v0.posTrack_as(); + auto ele = v0.negTrack_as(); + auto posmc = pos.template emmcparticle_as(); + auto elemc = ele.template emmcparticle_as(); + + int photonid = FindCommonMotherFrom2Prongs(posmc, elemc, -11, 11, 22, mcparticles); + + auto mcphoton = mcparticles.iteratorAt(photonid); + + if (mcphoton.isPhysicalPrimary()) { + + fillV0Info(v0, mcphoton, elemc); + } + + if (pos.sign() * ele.sign() > 0) { + registry.fill(HIST("EMBuilder/hV0SignType"), 1); // same-sign + } else if (pos.sign() * ele.sign() < 0) { + registry.fill(HIST("EMBuilder/hV0SignType"), 2); // opposite-sign + } else { + registry.fill(HIST("EMBuilder/hV0SignType"), 3); // zero or undefined + } + + if ((posmc.pdgCode() == 11 && elemc.pdgCode() == -11) || (posmc.pdgCode() == -11 && elemc.pdgCode() == 11)) { + registry.fill(HIST("EMBuilder/hV0ElectronPositronTrue"), 1); // good + } else { + registry.fill(HIST("EMBuilder/hV0ElectronPositronTrue"), 0); // mismatch + } + } + } + } + + PresliceUnsorted perMcCollision = aod::emmcparticle::emmceventId; + + void processConvV0s(MyCollisions const& collisions, + aod::EMMCParticles const& mcparticles, + MyTracksIUMC const& tracks) + { + for (auto& collision : collisions) { + + if (!fEMEventCut.IsSelected(collision)) { + continue; + } + + auto mccollision = collision.template emmcevent_as(); + + auto mcstack = mcparticles.sliceBy(perMcCollision, mccollision.globalIndex()); + auto mctracks_coll = mcparticles.sliceBy(perMcCollision, mccollision.globalIndex()); + + std::unordered_map mc2trk; + for (auto& trk : tracks) { + if (trk.mcParticleId() >= 0) { + mc2trk[trk.mcParticleId()] = trk.globalIndex(); + } + } + + for (auto& mc : mctracks_coll) { + if (mc.pdgCode() != 22 || !mc.isPhysicalPrimary()) { + continue; + } + + auto daughters = mc.daughtersIds(); + if (daughters.size() != 2) { + continue; + } + + auto d1 = mcparticles.iteratorAt(daughters[0]); + auto d2 = mcparticles.iteratorAt(daughters[1]); + + if (std::abs(d1.pdgCode()) != 11 || std::abs(d2.pdgCode()) != 11) { + continue; + } + + float r = std::hypot(d1.vx(), d1.vy()); + if (r < 5.0f || r > 90.0f) { + continue; + } + + registry.fill(HIST("truePhotons/hPt_Converted"), mc.pt()); + registry.fill(HIST("truePhotons/hR_Converted"), r); + + registry.fill(HIST("truePhotons/Sparse_Converted"), d1.vx(), mc.y(), d1.vz(), r, mc.phi(), mc.eta(), mc.pt()); + + int id1 = mc2trk.count(d1.globalIndex()) ? mc2trk[d1.globalIndex()] : -1; + int id2 = mc2trk.count(d2.globalIndex()) ? mc2trk[d2.globalIndex()] : -1; + if (id1 < 0 || id2 < 0) { + continue; + } + } + } + } + + Preslice perEMCollision = aod::v0photonkf::emeventId; + + void processMatchCategories( + MyCollisions const& collisions, + MyTracksIUMC const& tracksgen, + MyV0Photons const& emV0s, + soa::Join const&, + V0DerivedMCDatas const& lfV0s, + MyMCV0Legs const&, + aod::McParticles const& mcparticles, + dauTracks const&) + { + std::unordered_map trackToMcLabel; + for (auto const& t : tracksgen) { + int label = t.mcParticleId(); + if (label >= 0) { + trackToMcLabel[t.globalIndex()] = label; + } + } + + for (auto& collision : collisions) { + if (!fEMEventCut.IsSelected(collision)) + continue; + + fillEventInfo<1, EMBuilder>(collision); + + auto emSlice = emV0s.sliceBy(perEMCollision, collision.globalIndex()); + auto lfSlice = lfV0s.sliceBy(perCollisionMCDerived, collision.globalIndex()); + + using EMIt = decltype(emSlice.begin()); + using LFIt = decltype(lfSlice.begin()); + struct Entry { + std::optional emIt; + std::optional lfIt; + }; + std::unordered_map table; + + for (EMIt it = emSlice.begin(); it != emSlice.end(); ++it) { + auto posmc = it.posTrack_as() + .emmcparticle_as(); + auto negmc = it.negTrack_as() + .emmcparticle_as(); + int pid = FindCommonMotherFrom2Prongs(posmc, negmc, + -11, 11, 22, mcparticles); + if (pid >= 0) + table[pid].emIt = it; + } + + for (LFIt it = lfSlice.begin(); it != lfSlice.end(); ++it) { + int posTrackIndex = it.posTrackId(); + auto negTrackIndex = it.negTrackId(); + + if (!trackToMcLabel.count(posTrackIndex) || !trackToMcLabel.count(negTrackIndex)) + continue; + auto posmc = mcparticles.iteratorAt(trackToMcLabel[posTrackIndex]); + auto negmc = mcparticles.iteratorAt(trackToMcLabel[negTrackIndex]); + int pid = FindCommonMotherFrom2Prongs(posmc, negmc, + -11, 11, 22, mcparticles); + if (pid >= 0) + table[pid].lfIt = it; + } + + for (auto const& [pid, entry] : table) { + auto mcphoton = mcparticles.iteratorAt(pid); + + if (entry.emIt.has_value() && entry.lfIt.has_value()) { + // --- Common V0 --- + auto& lfV0 = *entry.lfIt.value(); + auto v0MC = lfV0.template v0MCCore_as< + soa::Join>(); + auto posTrack = lfV0.template posTrackExtra_as(); + fillV0Info(lfV0, v0MC, posTrack); + + } else if (entry.emIt.has_value()) { + // --- EM-only V0 --- + auto& emV0 = *entry.emIt.value(); + auto negmc = emV0.negTrack_as() + .emmcparticle_as(); + fillV0Info(emV0, mcphoton, negmc); + + } else if (entry.lfIt.has_value()) { + // --- LF-only V0 --- + auto& lfV0 = *entry.lfIt.value(); + auto v0MC = lfV0.template v0MCCore_as< + soa::Join>(); + auto posTrack = lfV0.template posTrackExtra_as(); + fillV0Info(lfV0, v0MC, posTrack); + } + } + } + } + + PROCESS_SWITCH(Convbuildercomp, processMatchCategories, "Process V0s matched via MC photon", false); + PROCESS_SWITCH(Convbuildercomp, processLFV0sMC, "Process LF Builder V0s", true); + PROCESS_SWITCH(Convbuildercomp, processEMV0sMC, "Process EM Builder V0s", false); + PROCESS_SWITCH(Convbuildercomp, processConvV0s, "Process generated converted V0s", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfg) +{ + return WorkflowSpec{adaptAnalysisTask(cfg)}; +} From 4fe4c369df34a5a82d8f79bc12aafa32217a53e1 Mon Sep 17 00:00:00 2001 From: sawan <124118453+sawankumawat@users.noreply.github.com> Date: Sat, 2 Aug 2025 19:57:48 +0530 Subject: [PATCH 201/345] [PWGLF] Added pT dependent DCAxy cut (#12394) Co-authored-by: Sawan Sawan --- PWGLF/Tasks/Resonances/kstarqa.cxx | 39 ++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarqa.cxx b/PWGLF/Tasks/Resonances/kstarqa.cxx index 8f50d2f224c..45e63edae2e 100644 --- a/PWGLF/Tasks/Resonances/kstarqa.cxx +++ b/PWGLF/Tasks/Resonances/kstarqa.cxx @@ -104,6 +104,7 @@ struct Kstarqa { Configurable cfgTPCChi2NCl{"cfgTPCChi2NCl", 4.0, "TPC Chi2/NCl"}; Configurable cfgUseITSTPCRefit{"cfgUseITSTPCRefit", false, "Require ITS Refit"}; Configurable isNoCollInTimeRangeStandard{"isNoCollInTimeRangeStandard", false, "No collision in time range standard"}; + Configurable isApplyPtDepDCAxyCut{"isApplyPtDepDCAxyCut", false, "Apply pT dependent DCAxy cut"}; // cuts on mother Configurable isApplyCutsOnMother{"isApplyCutsOnMother", false, "Enable additional cuts on Kstar mother"}; @@ -419,8 +420,13 @@ struct Kstarqa { return false; if (std::abs(candidate.eta()) > selectionConfig.cfgCutEta) return false; - if (std::abs(candidate.dcaXY()) > selectionConfig.cfgCutDCAxy) - return false; + if (!selectionConfig.isApplyPtDepDCAxyCut) { + if (std::abs(candidate.dcaXY()) > selectionConfig.cfgCutDCAxy) + return false; + } else { + if (std::abs(candidate.dcaXY()) > (0.0105 + 0.035 / std::pow(candidate.pt(), 1.1))) + return false; + } if (std::abs(candidate.dcaZ()) > selectionConfig.cfgCutDCAz) return false; if (candidate.tpcCrossedRowsOverFindableCls() < selectionConfig.cfgRCRFC) @@ -660,7 +666,7 @@ struct Kstarqa { using EventCandidatesMC = soa::Join; using TrackCandidatesMC = soa::Filtered>; - using EventMCGenerated = soa::Join; // aod::CentNGlobals, aod::CentNTPVs, aod::CentMFTs + using EventMCGenerated = soa::Join; // aod::CentNGlobals, aod::CentNTPVs, aod::CentMFTs //*********Varibles declaration*************** float multiplicity{-1.0}, theta2; @@ -829,13 +835,13 @@ struct Kstarqa { // if (!collision.sel8()) { // return; // } + int occupancy = collision.trackOccupancyInTimeRange(); + rEventSelection.fill(HIST("hOccupancy"), occupancy); if (!selectionEvent(collision, true)) { return; } - int occupancy = collision.trackOccupancyInTimeRange(); - rEventSelection.fill(HIST("hOccupancy"), occupancy); multiplicity = -1; if (cSelectMultEstimator == kFT0M) { @@ -1058,7 +1064,8 @@ struct Kstarqa { PROCESS_SWITCH(Kstarqa, processME, "Process Mixed event", true); - void processGen(EventMCGenerated::iterator const& mcCollision, aod::McParticles const& mcParticles, const soa::SmallGroups& collisions) + // void processGen(EventMCGenerated::iterator const& mcCollision, aod::McParticles const& mcParticles, const soa::SmallGroups& collisions) + void processGen(aod::McCollision const& mcCollision, aod::McParticles const& mcParticles, const soa::SmallGroups& collisions) { rEventSelection.fill(HIST("eventsCheckGen"), 0.5); @@ -1079,9 +1086,9 @@ struct Kstarqa { multiplicity = -1.0; // float impactParameter = mcCollision.impactParameter(); - if (selectionConfig.isINELgt0 && !mcCollision.isInelGt0()) { - return; - } + // if (selectionConfig.isINELgt0 && !mcCollision.isInelGt0()) { + // return; + // } rEventSelection.fill(HIST("eventsCheckGen"), 2.5); for (const auto& collision : collisions) { @@ -1122,12 +1129,16 @@ struct Kstarqa { for (const auto& mcParticle : mcParticles) { if (std::abs(mcParticle.y()) < selectionConfig.rapidityMotherData && std::abs(mcParticle.pdgCode()) == o2::constants::physics::kK0Star892) { + // if (inelgt0MCgen) { hInvMass.fill(HIST("hAllKstarGenCollisisons"), multiplicity, mcParticle.pt()); + // } } } const auto evtReconstructedAndSelected = std::find(selectedEvents.begin(), selectedEvents.end(), mcCollision.globalIndex()) != selectedEvents.end(); + // if (inelgt0MCgen) { hInvMass.fill(HIST("hAllGenCollisions"), multiplicity); + // } if (!cAllGenCollisions && !evtReconstructedAndSelected) { // Check that the event is reconstructed and that the reconstructed events pass the selection return; } @@ -1183,11 +1194,13 @@ struct Kstarqa { } PROCESS_SWITCH(Kstarqa, processGen, "Process Generated", false); - void processEvtLossSigLossMC(EventMCGenerated::iterator const& mcCollision, aod::McParticles const& mcParticles, const soa::SmallGroups& recCollisions) + // void processEvtLossSigLossMC(EventMCGenerated::iterator const& mcCollision, aod::McParticles const& mcParticles, const soa::SmallGroups& recCollisions) + void processEvtLossSigLossMC(aod::McCollisions::iterator const& mcCollision, aod::McParticles const& mcParticles, const soa::SmallGroups& recCollisions) { - if (selectionConfig.isINELgt0 && !mcCollision.isInelGt0()) { - return; - } + // if (selectionConfig.isINELgt0 && !mcCollision.isInelGt0()) { + // return; + // } + auto impactPar = mcCollision.impactParameter(); hInvMass.fill(HIST("MCcorrections/hImpactParameterGen"), impactPar); From 6e5abe31eb45bfa3d29cb3c5e3b1d03407cf04b1 Mon Sep 17 00:00:00 2001 From: Luca Aglietta <75362880+Luca610@users.noreply.github.com> Date: Sat, 2 Aug 2025 19:25:04 +0200 Subject: [PATCH 202/345] [PWGHF] Fixed bug in D-track resonance workflow (#12386) --- PWGHF/D2H/DataModel/ReducedDataModel.h | 1 + .../candidateCreatorCharmResoReduced.cxx | 17 +++++++++-------- .../dataCreatorCharmResoReduced.cxx | 7 +++++-- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/PWGHF/D2H/DataModel/ReducedDataModel.h b/PWGHF/D2H/DataModel/ReducedDataModel.h index 82df09123da..06b219be522 100644 --- a/PWGHF/D2H/DataModel/ReducedDataModel.h +++ b/PWGHF/D2H/DataModel/ReducedDataModel.h @@ -1274,6 +1274,7 @@ DECLARE_SOA_TABLE(HfRedVzeros, "AOD", "HFREDVZERO", //! Table with V0 candidate DECLARE_SOA_TABLE(HfRedTrkNoParams, "AOD", "HFREDTRKNOPARAM", //! Table with tracks without track parameters for resonances reduced workflow o2::soa::Index<>, // Indices + hf_track_index_reduced::TrackId, hf_track_index_reduced::HfRedCollisionId, // Static hf_track_vars_reduced::Px, diff --git a/PWGHF/D2H/TableProducer/candidateCreatorCharmResoReduced.cxx b/PWGHF/D2H/TableProducer/candidateCreatorCharmResoReduced.cxx index 55ba9628f9a..f5f8734c652 100644 --- a/PWGHF/D2H/TableProducer/candidateCreatorCharmResoReduced.cxx +++ b/PWGHF/D2H/TableProducer/candidateCreatorCharmResoReduced.cxx @@ -102,23 +102,27 @@ struct HfCandidateCreatorCharmResoReduced { Produces rowCandidateResoIndices2PrTrks; // D Configurables struct : ConfigurableGroup { + std::string prefix = "dmesonsCuts"; Configurable> binsPtD{"binsPtD", std::vector{hf_cuts_d_daughter::vecBinsPt}, "pT bin limits for D daughter cuts"}; Configurable> cutsD{"cutsD", {hf_cuts_d_daughter::Cuts[0], hf_cuts_d_daughter::NBinsPt, hf_cuts_d_daughter::NCutVars, hf_cuts_d_daughter::labelsPt, hf_cuts_d_daughter::labelsCutVar}, "D daughter selections"}; Configurable keepSideBands{"keepSideBands", false, "flag to keep events from D meson sidebands for backgorund estimation"}; } cfgDmesCuts; // V0 cuts configurables struct : ConfigurableGroup { + std::string prefix = "v0Cuts"; Configurable> cutsV0{"cutsV0", {hf_cuts_v0_daughter::Cuts[0], hf_cuts_v0_daughter::NBinsPt, hf_cuts_v0_daughter::NCutVars, hf_cuts_v0_daughter::labelsPt, hf_cuts_v0_daughter::labelsCutVar}, "V0 daughter selections"}; Configurable> binsPtV0{"binsPtV0", std::vector{hf_cuts_v0_daughter::vecBinsPt}, "pT bin limits for V0 daughter cuts"}; Configurable v0Type{"v0Type", 0, "V0 type to be selected (0: K0s, 1: Lambda"}; } cfgV0Cuts; // Track cuts configurables struct : ConfigurableGroup { + std::string prefix = "trackCuts"; Configurable> cutsTrk{"cutsTrk", {hf_cuts_track_daughter::Cuts[0], hf_cuts_track_daughter::NCutVars, hf_cuts_track_daughter::labelsCutVar}, "Track daughter selections, set to -1 to disable cuts"}; Configurable massHypo{"massHypo", 1, "Mass Hypothesis for the track daughters (0: pion, 1: kaon, 2: proton)"}; } cfgTrackCuts; // Mixed Event configurables struct : ConfigurableGroup { + std::string prefix = "mixedEvent"; Configurable numberEventsMixed{"numberEventsMixed", 5, "Number of events mixed in ME process"}; Configurable numberEventsToSkip{"numberEventsToSkip", -1, "Number of events to Skip in ME process"}; ConfigurableAxis multPoolBins{"multPoolBins", {VARIABLE_WIDTH, 0., 45., 60., 75., 95, 250}, "event multiplicity pools (PV contributors for now)"}; @@ -126,6 +130,7 @@ struct HfCandidateCreatorCharmResoReduced { } cfgMixedEvent; // Histogram axes configurables struct : ConfigurableGroup { + std::string prefix = "histAxes"; ConfigurableAxis axisPtD{"axisPtD", {100, 0., 50}, "#it{p}_{T} (GeV/#it{c})"}; ConfigurableAxis axisPtV0{"axisPtV0", {100, 0., 50}, "#it{p}_{T} (GeV/#it{c})"}; ConfigurableAxis axisPtReso{"axisPtReso", {100, 0., 50}, "#it{p}_{T} (GeV/#it{c})"}; @@ -691,10 +696,8 @@ struct HfCandidateCreatorCharmResoReduced { bool alreadyCounted{false}; for (const auto& candV0Tr : candsV0Tr) { if constexpr (bachType == BachelorType::V0) { // Case: V0 - if (rejectPairsWithCommonDaughter) { - if (std::find(dDaughtersIDs.begin(), dDaughtersIDs.end(), candV0Tr.prong0Id()) != dDaughtersIDs.end() || std::find(dDaughtersIDs.begin(), dDaughtersIDs.end(), candV0Tr.prong1Id()) != dDaughtersIDs.end()) { - continue; - } + if (rejectPairsWithCommonDaughter && (std::find(dDaughtersIDs.begin(), dDaughtersIDs.end(), candV0Tr.prong0Id()) != dDaughtersIDs.end() || std::find(dDaughtersIDs.begin(), dDaughtersIDs.end(), candV0Tr.prong1Id()) != dDaughtersIDs.end())) { + continue; } if (!isV0Selected(candV0Tr)) { continue; @@ -704,10 +707,8 @@ struct HfCandidateCreatorCharmResoReduced { alreadyCounted = true; } } else if constexpr (bachType == BachelorType::Track) { // Case: Track - if (rejectPairsWithCommonDaughter) { - if (std::find(dDaughtersIDs.begin(), dDaughtersIDs.end(), candV0Tr.globalIndex()) != dDaughtersIDs.end()) { - continue; - } + if (rejectPairsWithCommonDaughter && std::find(dDaughtersIDs.begin(), dDaughtersIDs.end(), candV0Tr.trackId()) != dDaughtersIDs.end()) { + continue; } if (!isTrackSelected(candV0Tr)) { continue; diff --git a/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx index a2584dc5b06..85dcc0d8b82 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx @@ -162,7 +162,7 @@ struct HfDataCreatorCharmResoReduced { // selection single tracks struct : ConfigurableGroup { - std::string prefix = "single_tracks"; + std::string prefix = "singleTracks"; Configurable setTrackSelections{"setTrackSelections", 2, "flag to apply track selections: 0=none; 1=global track w/o DCA selection; 2=global track; 3=only ITS quality"}; Configurable maxEta{"maxEta", 0.8, "maximum pseudorapidity for single tracks to be paired with D mesons"}; Configurable minPt{"minPt", 0.1, "minimum pT for single tracks to be paired with D mesons"}; @@ -173,6 +173,7 @@ struct HfDataCreatorCharmResoReduced { // QA histograms struct : ConfigurableGroup { + std::string prefix = "qaPlots"; Configurable applyCutsForQaHistograms{"applyCutsForQaHistograms", true, "flag to apply cuts to QA histograms"}; Configurable cutMassDstarMin{"cutMassDstarMin", 0.143, "minimum mass for Dstar candidates"}; Configurable cutMassDstarMax{"cutMassDstarMax", 0.155, "maximum mass for Dstar candidates"}; @@ -929,6 +930,7 @@ struct HfDataCreatorCharmResoReduced { SETBIT(debugMcRec, hf_decay::hf_cand_reso::PartialMatchMc::D0Matched); origin = candCharmBach.originMcRec(); } + flagTrack = getMatchingFlagTrack(bachelorTrack); if (hf_decay::hf_cand_2prong::daughtersD0Main.contains(static_cast(std::abs(flagCharmBach))) && flagTrack == hf_decay::hf_cand_reso::PartialMatchMc::PionMatched) { auto arrDaughtersReso = std::array{vecDaughtersReso[0], vecDaughtersReso[1], bachelorTrack}; auto pdgCodesDzeroDaughters = hf_decay::hf_cand_2prong::daughtersD0Main.at(static_cast(std::abs(flagCharmBach))); @@ -1436,7 +1438,8 @@ struct HfDataCreatorCharmResoReduced { } // end of DType switch // fill track table if (!selectedTracks.count(track.globalIndex())) { - hfTrackNoParam(indexHfReducedCollision, + hfTrackNoParam(track.globalIndex(), + indexHfReducedCollision, track.px(), track.py(), track.pz(), track.sign(), track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr(), track.tofNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPr(), From 5bc5100a7deec389f2dfa6735bb03ceb9d5b45aa Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Sat, 2 Aug 2025 21:52:23 +0200 Subject: [PATCH 203/345] [PWGEM/PhotonMeson] reduce data size of ele from dalitz (#12397) --- .../skimmerPrimaryElectronFromDalitzEE.cxx | 298 ++++++++++++------ 1 file changed, 198 insertions(+), 100 deletions(-) diff --git a/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryElectronFromDalitzEE.cxx b/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryElectronFromDalitzEE.cxx index 8ed7db41bef..5f814376546 100644 --- a/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryElectronFromDalitzEE.cxx +++ b/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryElectronFromDalitzEE.cxx @@ -54,6 +54,7 @@ using MyTrackMC = MyTracksMC::iterator; struct skimmerPrimaryElectronFromDalitzEE { SliceCache cache; Preslice perCol = o2::aod::track::collisionId; + Preslice perCol_pcm = o2::aod::v0photonkf::collisionId; Produces emprimaryelectrons; // Configurables @@ -88,6 +89,8 @@ struct skimmerPrimaryElectronFromDalitzEE { Configurable includeITSsa{"includeITSsa", false, "Flag to include ITSsa tracks"}; Configurable maxpt_itssa{"maxpt_itssa", 0.15, "max pt for ITSsa track"}; Configurable maxMeanITSClusterSize{"maxMeanITSClusterSize", 16, "max x cos(lambda)"}; + Configurable slope{"slope", 0.0185, "slope for m vs. phiv"}; + Configurable intercept{"intercept", -0.0380, "intercept for m vs. phiv"}; HistogramRegistry fRegistry{"output", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; static constexpr std::string_view dileptonSigns[3] = {"uls/", "lspp/", "lsmm/"}; @@ -114,7 +117,7 @@ struct skimmerPrimaryElectronFromDalitzEE { fRegistry.add("Track/hPt", "pT;p_{T} (GeV/c)", kTH1F, {{1000, 0.0f, 10}}, false); fRegistry.add("Track/hEtaPhi", "#eta vs. #varphi;#varphi (rad.);#eta", kTH2F, {{180, 0, 2 * M_PI}, {400, -2.0f, 2.0f}}, false); fRegistry.add("Track/hQoverPt", "q/pT;q/p_{T} (GeV/c)^{-1}", kTH1F, {{400, -20, 20}}, false); - fRegistry.add("Track/hRelDeltaPt", "pT resolution;p_{T} (GeV/c);#Deltap_{T}/p_{T}", kTH2F, {{1000, 0, 10}, {100, 0, 1}}, false); + fRegistry.add("Track/hRelDeltaPt", "pT resolution;p_{T} (GeV/c);#Deltap_{T}/p_{T}", kTH2F, {{1000, 0, 10}, {100, 0, 0.1}}, false); fRegistry.add("Track/hDCAxyz", "DCA xy vs. z;DCA_{xy} (cm);DCA_{z} (cm)", kTH2F, {{200, -1.0f, 1.0f}, {200, -1.0f, 1.0f}}, false); fRegistry.add("Track/hDCAxy_Pt", "DCA_{xy} vs. pT;p_{T} (GeV/c);DCA_{xy} (cm)", kTH2F, {{200, 0, 10}, {200, -1, 1}}, false); fRegistry.add("Track/hDCAz_Pt", "DCA_{z} vs. pT;p_{T} (GeV/c);DCA_{z} (cm)", kTH2F, {{200, 0, 10}, {200, -1, 1}}, false); @@ -136,7 +139,7 @@ struct skimmerPrimaryElectronFromDalitzEE { // ITS fRegistry.add("Track/hNclsITS", "number of ITS clusters", kTH1F, {{8, -0.5, 7.5}}, false); - fRegistry.add("Track/hChi2ITS", "chi2/number of ITS clusters", kTH1F, {{100, 0, 10}}, false); + fRegistry.add("Track/hChi2ITS", "chi2/number of ITS clusters", kTH1F, {{400, 0, 40}}, false); fRegistry.add("Track/hITSClusterMap", "ITS cluster map", kTH1F, {{128, -0.5, 127.5}}, false); fRegistry.add("Track/hMeanClusterSizeITS", "mean cluster size ITS;p_{pv} (GeV/c); #times cos(#lambda)", kTH2F, {{1000, 0, 10}, {150, 0, 15}}, false); fRegistry.add("Track/hMeanClusterSizeITSib", "mean cluster size ITSib;p_{pv} (GeV/c); #times cos(#lambda)", kTH2F, {{1000, 0, 10}, {150, 0, 15}}, false); @@ -310,98 +313,106 @@ struct skimmerPrimaryElectronFromDalitzEE { template void fillTrackTable(TCollision const& collision, TTrack const& track) { - if (std::find(stored_trackIds.begin(), stored_trackIds.end(), std::make_pair(collision.globalIndex(), track.globalIndex())) == stored_trackIds.end()) { - float mcTunedTPCSignal = 0.f; - if constexpr (isMC) { + float mcTunedTPCSignal = 0.f; + if constexpr (isMC) { + mcTunedTPCSignal = track.mcTunedTPCSignal(); + if (track.hasTPC()) { mcTunedTPCSignal = track.mcTunedTPCSignal(); - if (track.hasTPC()) { - mcTunedTPCSignal = track.mcTunedTPCSignal(); - } } + } - float itsChi2NCl = (track.hasITS() && track.itsChi2NCl() > 0.f) ? track.itsChi2NCl() : -299.f; - float tpcChi2NCl = (track.hasTPC() && track.tpcChi2NCl() > 0.f) ? track.tpcChi2NCl() : -299.f; - float beta = track.hasTOF() ? track.beta() : -29.f; - float tofNSigmaEl = track.hasTOF() ? track.tofNSigmaEl() : -299.f; - float tofNSigmaPi = track.hasTOF() ? track.tofNSigmaPi() : -299.f; - float tofChi2 = track.hasTOF() ? track.tofChi2() : -299.f; - - float tpcSignal = track.hasTPC() ? track.tpcSignal() : 0.f; - float tpcNSigmaEl = track.hasTPC() ? track.tpcNSigmaEl() : -299.f; - float tpcNSigmaPi = track.hasTPC() ? track.tpcNSigmaPi() : -299.f; - - emprimaryelectrons(collision.globalIndex(), track.globalIndex(), track.sign(), - track.pt(), track.eta(), track.phi(), track.dcaXY(), track.dcaZ(), track.cYY(), track.cZY(), track.cZZ(), - track.tpcNClsFindable(), track.tpcNClsFindableMinusFound(), track.tpcNClsFindableMinusCrossedRows(), track.tpcNClsShared(), - - static_cast(tpcChi2NCl * 1e+2), track.tpcInnerParam(), - static_cast(tpcSignal * 1e+2), static_cast(tpcNSigmaEl * 1e+2), static_cast(tpcNSigmaPi * 1e+2), - static_cast(beta * 1e+3), static_cast(tofNSigmaEl * 1e+2), static_cast(tofNSigmaPi * 1e+2), - track.itsClusterSizes(), static_cast(itsChi2NCl * 1e+2), static_cast(tofChi2 * 1e+2), track.detectorMap(), track.tgl(), static_cast(mcTunedTPCSignal * 1e+2)); - - fRegistry.fill(HIST("Track/hPt"), track.pt()); - fRegistry.fill(HIST("Track/hEtaPhi"), track.phi(), track.eta()); - fRegistry.fill(HIST("Track/hQoverPt"), track.sign() / track.pt()); - fRegistry.fill(HIST("Track/hRelDeltaPt"), track.pt(), track.sigma1Pt() * track.pt()); - fRegistry.fill(HIST("Track/hDCAxyz"), track.dcaXY(), track.dcaZ()); - fRegistry.fill(HIST("Track/hDCAxy_Pt"), track.pt(), track.dcaXY()); - fRegistry.fill(HIST("Track/hDCAz_Pt"), track.pt(), track.dcaZ()); - fRegistry.fill(HIST("Track/hDCAxyzSigma"), track.dcaXY() / std::sqrt(track.cYY()), track.dcaZ() / std::sqrt(track.cZZ())); - fRegistry.fill(HIST("Track/hDCAxyRes_Pt"), track.pt(), std::sqrt(track.cYY()) * 1e+4); // convert cm to um - fRegistry.fill(HIST("Track/hDCAzRes_Pt"), track.pt(), std::sqrt(track.cZZ()) * 1e+4); // convert cm to um - - fRegistry.fill(HIST("Track/hNclsTPC"), track.tpcNClsFound()); - fRegistry.fill(HIST("Track/hNcrTPC"), track.tpcNClsCrossedRows()); - fRegistry.fill(HIST("Track/hChi2TPC"), track.tpcChi2NCl()); - fRegistry.fill(HIST("Track/hTPCNcr2Nf"), track.tpcCrossedRowsOverFindableCls()); - fRegistry.fill(HIST("Track/hTPCNcls2Nf"), track.tpcFoundOverFindableCls()); - fRegistry.fill(HIST("Track/hTPCNclsShared"), track.pt(), track.tpcFractionSharedCls()); - fRegistry.fill(HIST("Track/hTPCdEdx"), track.tpcInnerParam(), track.tpcSignal()); - fRegistry.fill(HIST("Track/hTPCdEdxMC"), track.tpcInnerParam(), mcTunedTPCSignal); - fRegistry.fill(HIST("Track/hTPCNsigmaEl"), track.tpcInnerParam(), track.tpcNSigmaEl()); - fRegistry.fill(HIST("Track/hTPCNsigmaPi"), track.tpcInnerParam(), track.tpcNSigmaPi()); - - fRegistry.fill(HIST("Track/hChi2TOF"), track.tofChi2()); - fRegistry.fill(HIST("Track/hTOFbeta"), track.p(), track.beta()); - fRegistry.fill(HIST("Track/hTOFNsigmaEl"), track.p(), track.tofNSigmaEl()); - fRegistry.fill(HIST("Track/hTOFNsigmaPi"), track.p(), track.tofNSigmaPi()); - - fRegistry.fill(HIST("Track/hNclsITS"), track.itsNCls()); - fRegistry.fill(HIST("Track/hChi2ITS"), track.itsChi2NCl()); - fRegistry.fill(HIST("Track/hITSClusterMap"), track.itsClusterMap()); + float itsChi2NCl = (track.hasITS() && track.itsChi2NCl() > 0.f) ? track.itsChi2NCl() : -299.f; + float tpcChi2NCl = (track.hasTPC() && track.tpcChi2NCl() > 0.f) ? track.tpcChi2NCl() : -299.f; + float beta = track.hasTOF() ? track.beta() : -29.f; + float tofNSigmaEl = track.hasTOF() ? track.tofNSigmaEl() : -299.f; + float tofNSigmaPi = track.hasTOF() ? track.tofNSigmaPi() : -299.f; + float tofChi2 = track.hasTOF() ? track.tofChi2() : -299.f; + + float tpcSignal = track.hasTPC() ? track.tpcSignal() : 0.f; + float tpcNSigmaEl = track.hasTPC() ? track.tpcNSigmaEl() : -299.f; + float tpcNSigmaPi = track.hasTPC() ? track.tpcNSigmaPi() : -299.f; + + emprimaryelectrons(collision.globalIndex(), track.globalIndex(), track.sign(), + track.pt(), track.eta(), track.phi(), track.dcaXY(), track.dcaZ(), track.cYY(), track.cZY(), track.cZZ(), + track.tpcNClsFindable(), track.tpcNClsFindableMinusFound(), track.tpcNClsFindableMinusCrossedRows(), track.tpcNClsShared(), + + static_cast(tpcChi2NCl * 1e+2), track.tpcInnerParam(), + static_cast(tpcSignal * 1e+2), static_cast(tpcNSigmaEl * 1e+2), static_cast(tpcNSigmaPi * 1e+2), + static_cast(beta * 1e+3), static_cast(tofNSigmaEl * 1e+2), static_cast(tofNSigmaPi * 1e+2), + track.itsClusterSizes(), static_cast(itsChi2NCl * 1e+2), static_cast(tofChi2 * 1e+2), track.detectorMap(), track.tgl(), static_cast(mcTunedTPCSignal * 1e+2)); + } - int total_cluster_size = 0, nl = 0; - for (unsigned int layer = 0; layer < 7; layer++) { - int cluster_size_per_layer = track.itsClsSizeInLayer(layer); - if (cluster_size_per_layer > 0) { - nl++; - } - total_cluster_size += cluster_size_per_layer; + template + void fillTrackHistograms(TTrack const& track) + { + float mcTunedTPCSignal = 0.f; + if constexpr (isMC) { + mcTunedTPCSignal = track.mcTunedTPCSignal(); + if (track.hasTPC()) { + mcTunedTPCSignal = track.mcTunedTPCSignal(); } + } - int total_cluster_size_ib = 0, nl_ib = 0; - for (unsigned int layer = 0; layer < 3; layer++) { - int cluster_size_per_layer = track.itsClsSizeInLayer(layer); - if (cluster_size_per_layer > 0) { - nl_ib++; - } - total_cluster_size_ib += cluster_size_per_layer; + fRegistry.fill(HIST("Track/hPt"), track.pt()); + fRegistry.fill(HIST("Track/hEtaPhi"), track.phi(), track.eta()); + fRegistry.fill(HIST("Track/hQoverPt"), track.sign() / track.pt()); + fRegistry.fill(HIST("Track/hRelDeltaPt"), track.pt(), track.sigma1Pt() * track.pt()); + fRegistry.fill(HIST("Track/hDCAxyz"), track.dcaXY(), track.dcaZ()); + fRegistry.fill(HIST("Track/hDCAxy_Pt"), track.pt(), track.dcaXY()); + fRegistry.fill(HIST("Track/hDCAz_Pt"), track.pt(), track.dcaZ()); + fRegistry.fill(HIST("Track/hDCAxyzSigma"), track.dcaXY() / std::sqrt(track.cYY()), track.dcaZ() / std::sqrt(track.cZZ())); + fRegistry.fill(HIST("Track/hDCAxyRes_Pt"), track.pt(), std::sqrt(track.cYY()) * 1e+4); // convert cm to um + fRegistry.fill(HIST("Track/hDCAzRes_Pt"), track.pt(), std::sqrt(track.cZZ()) * 1e+4); // convert cm to um + + fRegistry.fill(HIST("Track/hNclsTPC"), track.tpcNClsFound()); + fRegistry.fill(HIST("Track/hNcrTPC"), track.tpcNClsCrossedRows()); + fRegistry.fill(HIST("Track/hChi2TPC"), track.tpcChi2NCl()); + fRegistry.fill(HIST("Track/hTPCNcr2Nf"), track.tpcCrossedRowsOverFindableCls()); + fRegistry.fill(HIST("Track/hTPCNcls2Nf"), track.tpcFoundOverFindableCls()); + fRegistry.fill(HIST("Track/hTPCNclsShared"), track.pt(), track.tpcFractionSharedCls()); + fRegistry.fill(HIST("Track/hTPCdEdx"), track.tpcInnerParam(), track.tpcSignal()); + fRegistry.fill(HIST("Track/hTPCdEdxMC"), track.tpcInnerParam(), mcTunedTPCSignal); + fRegistry.fill(HIST("Track/hTPCNsigmaEl"), track.tpcInnerParam(), track.tpcNSigmaEl()); + fRegistry.fill(HIST("Track/hTPCNsigmaPi"), track.tpcInnerParam(), track.tpcNSigmaPi()); + + fRegistry.fill(HIST("Track/hChi2TOF"), track.tofChi2()); + fRegistry.fill(HIST("Track/hTOFbeta"), track.p(), track.beta()); + fRegistry.fill(HIST("Track/hTOFNsigmaEl"), track.p(), track.tofNSigmaEl()); + fRegistry.fill(HIST("Track/hTOFNsigmaPi"), track.p(), track.tofNSigmaPi()); + + fRegistry.fill(HIST("Track/hNclsITS"), track.itsNCls()); + fRegistry.fill(HIST("Track/hChi2ITS"), track.itsChi2NCl()); + fRegistry.fill(HIST("Track/hITSClusterMap"), track.itsClusterMap()); + + int total_cluster_size = 0, nl = 0; + for (unsigned int layer = 0; layer < 7; layer++) { + int cluster_size_per_layer = track.itsClsSizeInLayer(layer); + if (cluster_size_per_layer > 0) { + nl++; } + total_cluster_size += cluster_size_per_layer; + } - int total_cluster_size_ob = 0, nl_ob = 0; - for (unsigned int layer = 3; layer < 7; layer++) { - int cluster_size_per_layer = track.itsClsSizeInLayer(layer); - if (cluster_size_per_layer > 0) { - nl_ob++; - } - total_cluster_size_ob += cluster_size_per_layer; + int total_cluster_size_ib = 0, nl_ib = 0; + for (unsigned int layer = 0; layer < 3; layer++) { + int cluster_size_per_layer = track.itsClsSizeInLayer(layer); + if (cluster_size_per_layer > 0) { + nl_ib++; } - fRegistry.fill(HIST("Track/hMeanClusterSizeITS"), track.p(), static_cast(total_cluster_size) / static_cast(nl) * std::cos(std::atan(track.tgl()))); - fRegistry.fill(HIST("Track/hMeanClusterSizeITSib"), track.p(), static_cast(total_cluster_size_ib) / static_cast(nl_ib) * std::cos(std::atan(track.tgl()))); - fRegistry.fill(HIST("Track/hMeanClusterSizeITSob"), track.p(), static_cast(total_cluster_size_ob) / static_cast(nl_ob) * std::cos(std::atan(track.tgl()))); + total_cluster_size_ib += cluster_size_per_layer; + } - stored_trackIds.emplace_back(std::make_pair(collision.globalIndex(), track.globalIndex())); + int total_cluster_size_ob = 0, nl_ob = 0; + for (unsigned int layer = 3; layer < 7; layer++) { + int cluster_size_per_layer = track.itsClsSizeInLayer(layer); + if (cluster_size_per_layer > 0) { + nl_ob++; + } + total_cluster_size_ob += cluster_size_per_layer; } + fRegistry.fill(HIST("Track/hMeanClusterSizeITS"), track.p(), static_cast(total_cluster_size) / static_cast(nl) * std::cos(std::atan(track.tgl()))); + fRegistry.fill(HIST("Track/hMeanClusterSizeITSib"), track.p(), static_cast(total_cluster_size_ib) / static_cast(nl_ib) * std::cos(std::atan(track.tgl()))); + fRegistry.fill(HIST("Track/hMeanClusterSizeITSob"), track.p(), static_cast(total_cluster_size_ob) / static_cast(nl_ob) * std::cos(std::atan(track.tgl()))); } template @@ -426,9 +437,35 @@ struct skimmerPrimaryElectronFromDalitzEE { if (v12.M() > maxMee) { // don't store continue; } - fillTrackTable(collision, t1); - fillTrackTable(collision, t2); - } // end of pairing + + if (v12.M() < slope * phiv + intercept) { + continue; + } + + if (t1.sign() > 0) { // for positron + if (std::find(acceptedPosTrackIds_per_collision.begin(), acceptedPosTrackIds_per_collision.end(), t1.globalIndex()) == acceptedPosTrackIds_per_collision.end()) { + fillTrackHistograms(t1); + acceptedPosTrackIds_per_collision.emplace_back(t1.globalIndex()); + } + } else { // for electron + if (std::find(acceptedNegTrackIds_per_collision.begin(), acceptedNegTrackIds_per_collision.end(), t1.globalIndex()) == acceptedNegTrackIds_per_collision.end()) { + fillTrackHistograms(t1); + acceptedNegTrackIds_per_collision.emplace_back(t1.globalIndex()); + } + } + + if (t2.sign() > 0) { // for positron + if (std::find(acceptedPosTrackIds_per_collision.begin(), acceptedPosTrackIds_per_collision.end(), t2.globalIndex()) == acceptedPosTrackIds_per_collision.end()) { + fillTrackHistograms(t2); + acceptedPosTrackIds_per_collision.emplace_back(t2.globalIndex()); + } + } else { // for electron + if (std::find(acceptedNegTrackIds_per_collision.begin(), acceptedNegTrackIds_per_collision.end(), t2.globalIndex()) == acceptedNegTrackIds_per_collision.end()) { + fillTrackHistograms(t2); + acceptedNegTrackIds_per_collision.emplace_back(t2.globalIndex()); + } + } + } // end of ULS pairing } else { // LS for (auto& [t1, t2] : combinations(CombinationsStrictlyUpperIndexPolicy(tracks1, tracks2))) { if (!checkTrack(collision, t1) || !checkTrack(collision, t2)) { @@ -444,18 +481,20 @@ struct skimmerPrimaryElectronFromDalitzEE { float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(t1.px(), t1.py(), t1.pz(), t2.px(), t2.py(), t2.pz(), t1.sign(), t2.sign(), d_bz); fRegistry.fill(HIST("Pair/") + HIST(dileptonSigns[pairtype]) + HIST("hMvsPt"), v12.M(), v12.Pt()); fRegistry.fill(HIST("Pair/") + HIST(dileptonSigns[pairtype]) + HIST("hMvsPhiV"), phiv, v12.M()); - } // end of pairing + } // end of LS pairing } } - std::vector> stored_trackIds; - Filter trackFilter = o2::aod::track::pt > minpt&& nabs(o2::aod::track::eta) < maxeta&& o2::aod::track::itsChi2NCl < maxchi2its&& ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::ITS) == true && nabs(o2::aod::track::dcaXY) < dca_xy_max&& nabs(o2::aod::track::dcaZ) < dca_z_max; + std::vector acceptedPosTrackIds_per_collision; + std::vector acceptedNegTrackIds_per_collision; + std::vector> stored_trackIds; + Filter trackFilter = minpt < o2::aod::track::pt && nabs(o2::aod::track::eta) < maxeta && o2::aod::track::itsChi2NCl < maxchi2its && ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::ITS) == true && nabs(o2::aod::track::dcaXY) < dca_xy_max && nabs(o2::aod::track::dcaZ) < dca_z_max; using MyFilteredTracks = soa::Filtered; Partition posTracks = o2::aod::track::signed1Pt > 0.f; Partition negTracks = o2::aod::track::signed1Pt < 0.f; // ---------- for data ---------- - void processRec(MyCollisions const& collisions, aod::BCsWithTimestamps const&, MyFilteredTracks const& tracks) + void processRec(MyCollisions const& collisions, aod::BCsWithTimestamps const&, MyFilteredTracks const& tracks, aod::V0PhotonsKF const& v0photons) { stored_trackIds.reserve(tracks.size()); @@ -466,14 +505,34 @@ struct skimmerPrimaryElectronFromDalitzEE { continue; } - auto posTracks_per_coll = posTracks->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache); - auto negTracks_per_coll = negTracks->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache); + const auto& v0photons_per_coll = v0photons.sliceBy(perCol_pcm, collision.globalIndex()); + const auto& posTracks_per_coll = posTracks->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache); + const auto& negTracks_per_coll = negTracks->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache); + acceptedPosTrackIds_per_collision.reserve(posTracks_per_coll.size()); + acceptedNegTrackIds_per_collision.reserve(negTracks_per_coll.size()); fillPairInfo(collision, posTracks_per_coll, negTracks_per_coll); // ULS if (fillLS) { fillPairInfo(collision, posTracks_per_coll, posTracks_per_coll); // LS++ fillPairInfo(collision, negTracks_per_coll, negTracks_per_coll); // LS-- } + + if ((v0photons_per_coll.size() >= 1 && acceptedPosTrackIds_per_collision.size() >= 1 && acceptedNegTrackIds_per_collision.size() >= 1) || (acceptedPosTrackIds_per_collision.size() >= 2 && acceptedNegTrackIds_per_collision.size() >= 2)) { + // LOGF(info, "v0photons_per_coll.size() = %d, acceptedPosTrackIds_per_collision.size() = %d, acceptedNegTrackIds_per_collision.size() = %d", v0photons_per_coll.size(), acceptedPosTrackIds_per_collision.size(), acceptedNegTrackIds_per_collision.size()); + for (const auto& posId : acceptedPosTrackIds_per_collision) { + const auto& pos = tracks.rawIteratorAt(posId); + fillTrackTable(collision, pos); + } + for (const auto& eleId : acceptedNegTrackIds_per_collision) { + const auto& ele = tracks.rawIteratorAt(eleId); + fillTrackTable(collision, ele); + } + } + + acceptedPosTrackIds_per_collision.clear(); + acceptedPosTrackIds_per_collision.shrink_to_fit(); + acceptedNegTrackIds_per_collision.clear(); + acceptedNegTrackIds_per_collision.shrink_to_fit(); } // end of collision loop stored_trackIds.clear(); @@ -481,7 +540,7 @@ struct skimmerPrimaryElectronFromDalitzEE { } PROCESS_SWITCH(skimmerPrimaryElectronFromDalitzEE, processRec, "process reconstructed info only", true); // standalone - void processRec_SWT(MyCollisionsWithSWT const& collisions, aod::BCsWithTimestamps const&, MyFilteredTracks const& tracks) + void processRec_SWT(MyCollisionsWithSWT const& collisions, aod::BCsWithTimestamps const&, MyFilteredTracks const& tracks, aod::V0PhotonsKF const& v0photons) { stored_trackIds.reserve(tracks.size()); @@ -496,14 +555,34 @@ struct skimmerPrimaryElectronFromDalitzEE { continue; } - auto posTracks_per_coll = posTracks->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache); - auto negTracks_per_coll = negTracks->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache); + const auto& v0photons_per_coll = v0photons.sliceBy(perCol_pcm, collision.globalIndex()); + const auto& posTracks_per_coll = posTracks->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache); + const auto& negTracks_per_coll = negTracks->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache); + acceptedPosTrackIds_per_collision.reserve(posTracks_per_coll.size()); + acceptedNegTrackIds_per_collision.reserve(negTracks_per_coll.size()); fillPairInfo(collision, posTracks_per_coll, negTracks_per_coll); // ULS if (fillLS) { fillPairInfo(collision, posTracks_per_coll, posTracks_per_coll); // LS++ fillPairInfo(collision, negTracks_per_coll, negTracks_per_coll); // LS-- } + + if ((v0photons_per_coll.size() >= 1 && acceptedPosTrackIds_per_collision.size() >= 1 && acceptedNegTrackIds_per_collision.size() >= 1) || (acceptedPosTrackIds_per_collision.size() >= 2 && acceptedNegTrackIds_per_collision.size() >= 2)) { + // LOGF(info, "v0photons_per_coll.size() = %d, acceptedPosTrackIds_per_collision.size() = %d, acceptedNegTrackIds_per_collision.size() = %d", v0photons_per_coll.size(), acceptedPosTrackIds_per_collision.size(), acceptedNegTrackIds_per_collision.size()); + for (const auto& posId : acceptedPosTrackIds_per_collision) { + const auto& pos = tracks.rawIteratorAt(posId); + fillTrackTable(collision, pos); + } + for (const auto& eleId : acceptedNegTrackIds_per_collision) { + const auto& ele = tracks.rawIteratorAt(eleId); + fillTrackTable(collision, ele); + } + } + + acceptedPosTrackIds_per_collision.clear(); + acceptedPosTrackIds_per_collision.shrink_to_fit(); + acceptedNegTrackIds_per_collision.clear(); + acceptedNegTrackIds_per_collision.shrink_to_fit(); } // end of collision loop stored_trackIds.clear(); @@ -515,28 +594,47 @@ struct skimmerPrimaryElectronFromDalitzEE { Partition posTracksMC = o2::aod::track::signed1Pt > 0.f; Partition negTracksMC = o2::aod::track::signed1Pt < 0.f; // ---------- for MC ---------- - void processMC(MyCollisionsMC const& collisions, aod::McCollisions const&, aod::BCsWithTimestamps const&, MyFilteredTracksMC const& tracks) + void processMC(MyCollisionsMC const& collisions, aod::McCollisions const&, aod::BCsWithTimestamps const&, MyFilteredTracksMC const& tracks, aod::V0PhotonsKF const& v0photons) { stored_trackIds.reserve(tracks.size()); for (const auto& collision : collisions) { + auto bc = collision.template foundBC_as(); + initCCDB(bc); if (!collision.has_mcCollision()) { continue; } if (!collision.isSelected()) { continue; } - auto bc = collision.template foundBC_as(); - initCCDB(bc); - auto posTracks_per_coll = posTracksMC->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache); - auto negTracks_per_coll = negTracksMC->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache); + const auto& v0photons_per_coll = v0photons.sliceBy(perCol_pcm, collision.globalIndex()); + const auto& posTracks_per_coll = posTracksMC->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache); + const auto& negTracks_per_coll = negTracksMC->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache); + acceptedPosTrackIds_per_collision.reserve(posTracks_per_coll.size()); + acceptedNegTrackIds_per_collision.reserve(negTracks_per_coll.size()); fillPairInfo(collision, posTracks_per_coll, negTracks_per_coll); // ULS if (fillLS) { fillPairInfo(collision, posTracks_per_coll, posTracks_per_coll); // LS++ fillPairInfo(collision, negTracks_per_coll, negTracks_per_coll); // LS-- } + if ((v0photons_per_coll.size() >= 1 && acceptedPosTrackIds_per_collision.size() >= 1 && acceptedNegTrackIds_per_collision.size() >= 1) || (acceptedPosTrackIds_per_collision.size() >= 2 && acceptedNegTrackIds_per_collision.size() >= 2)) { + // LOGF(info, "v0photons_per_coll.size() = %d, acceptedPosTrackIds_per_collision.size() = %d, acceptedNegTrackIds_per_collision.size() = %d", v0photons_per_coll.size(), acceptedPosTrackIds_per_collision.size(), acceptedNegTrackIds_per_collision.size()); + for (const auto& posId : acceptedPosTrackIds_per_collision) { + const auto& pos = tracks.rawIteratorAt(posId); + fillTrackTable(collision, pos); + } + for (const auto& eleId : acceptedNegTrackIds_per_collision) { + const auto& ele = tracks.rawIteratorAt(eleId); + fillTrackTable(collision, ele); + } + } + + acceptedPosTrackIds_per_collision.clear(); + acceptedPosTrackIds_per_collision.shrink_to_fit(); + acceptedNegTrackIds_per_collision.clear(); + acceptedNegTrackIds_per_collision.shrink_to_fit(); } // end of collision loop stored_trackIds.clear(); From 8f4c4ea371ff133b119bf5d8cc878007a9e18e65 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Sun, 3 Aug 2025 03:31:55 +0200 Subject: [PATCH 204/345] [PWGEM/Dilepton] remove unnecessary function in filterEoI.cxx (#12399) --- PWGEM/Dilepton/TableProducer/filterEoI.cxx | 53 ++++++---------------- 1 file changed, 15 insertions(+), 38 deletions(-) diff --git a/PWGEM/Dilepton/TableProducer/filterEoI.cxx b/PWGEM/Dilepton/TableProducer/filterEoI.cxx index dcbb33f9ec2..ef232718485 100644 --- a/PWGEM/Dilepton/TableProducer/filterEoI.cxx +++ b/PWGEM/Dilepton/TableProducer/filterEoI.cxx @@ -32,43 +32,37 @@ struct filterEoI { kElectron = 0x1, kFwdMuon = 0x2, kPCM = 0x4, - kElectronFromDalitz = 0x8, }; Produces emeoi; Configurable minNElectrons{"minNElectrons", 1, "min number of e+ or e- at midrapidity"}; Configurable minNMuons{"minNMuons", 1, "min number of mu+ or mu- at forward rapidity"}; Configurable minNV0s{"minNV0s", 1, "min number of v0 photons at midrapidity"}; - Configurable minNElectronsFromDalitz{"minNElectronsFromDalitz", 1, "min number of e+ or e- from dalitz decay at midrapidity"}; HistogramRegistry fRegistry{"output"}; void init(o2::framework::InitContext&) { - auto hEventCounter = fRegistry.add("hEventCounter", "hEventCounter", kTH1D, {{9, 0.5f, 9.5f}}); + auto hEventCounter = fRegistry.add("hEventCounter", "hEventCounter", kTH1D, {{7, 0.5f, 7.5f}}); hEventCounter->GetXaxis()->SetBinLabel(1, "all"); hEventCounter->GetXaxis()->SetBinLabel(2, "event with electron"); hEventCounter->GetXaxis()->SetBinLabel(3, "event with forward muon"); hEventCounter->GetXaxis()->SetBinLabel(4, "event with v0"); - hEventCounter->GetXaxis()->SetBinLabel(5, "event with electron from dalitz"); - hEventCounter->GetXaxis()->SetBinLabel(6, "event with electron or forward muon"); - hEventCounter->GetXaxis()->SetBinLabel(7, "event with electron and forward muon"); - hEventCounter->GetXaxis()->SetBinLabel(8, "event with electron or forward muon or v0"); - hEventCounter->GetXaxis()->SetBinLabel(9, "event with v0 or electron from dalitz"); + hEventCounter->GetXaxis()->SetBinLabel(5, "event with electron or forward muon"); + hEventCounter->GetXaxis()->SetBinLabel(6, "event with electron and forward muon"); + hEventCounter->GetXaxis()->SetBinLabel(7, "event with electron or forward muon or v0"); } SliceCache cache; Preslice perCollision_el = aod::emprimaryelectron::collisionId; Preslice perCollision_mu = aod::emprimarymuon::collisionId; Preslice perCollision_v0 = aod::v0photonkf::collisionId; - Preslice perCollision_elda = aod::emprimaryelectron::collisionId; - template - void selectEoI(TCollisions const& collisions, TElectrons const& electrons, TMuons const& muons, TV0s const& v0s, TElectronsFromDalitz const& electronsda) + template + void selectEoI(TCollisions const& collisions, TElectrons const& electrons, TMuons const& muons, TV0s const& v0s) { for (const auto& collision : collisions) { bool does_electron_exist = false; bool does_fwdmuon_exist = false; bool does_pcm_exist = false; - bool does_electronda_exist = false; fRegistry.fill(HIST("hEventCounter"), 1); if constexpr (static_cast(system & kElectron)) { @@ -92,28 +86,18 @@ struct filterEoI { fRegistry.fill(HIST("hEventCounter"), 4); } } - if constexpr (static_cast(system & kElectronFromDalitz)) { - auto electronsda_coll = electronsda.sliceBy(perCollision_elda, collision.globalIndex()); - if (electronsda_coll.size() >= minNElectronsFromDalitz) { - does_electronda_exist = true; - fRegistry.fill(HIST("hEventCounter"), 5); - } - } if (does_electron_exist || does_fwdmuon_exist) { - fRegistry.fill(HIST("hEventCounter"), 6); + fRegistry.fill(HIST("hEventCounter"), 5); } if (does_electron_exist && does_fwdmuon_exist) { - fRegistry.fill(HIST("hEventCounter"), 7); + fRegistry.fill(HIST("hEventCounter"), 6); } if (does_electron_exist || does_fwdmuon_exist || does_pcm_exist) { - fRegistry.fill(HIST("hEventCounter"), 8); - } - if (does_electronda_exist || does_pcm_exist) { - fRegistry.fill(HIST("hEventCounter"), 9); + fRegistry.fill(HIST("hEventCounter"), 7); } - emeoi(does_electron_exist || does_fwdmuon_exist || does_pcm_exist || does_electronda_exist); + emeoi(does_electron_exist || does_fwdmuon_exist || does_pcm_exist); } // end of collision loop @@ -122,37 +106,31 @@ struct filterEoI { void process_Electron(aod::Collisions const& collisions, aod::EMPrimaryElectrons const& electrons) { const uint8_t sysflag = kElectron; - selectEoI(collisions, electrons, nullptr, nullptr, nullptr); + selectEoI(collisions, electrons, nullptr, nullptr); } void process_FwdMuon(aod::Collisions const& collisions, aod::EMPrimaryMuons const& muons) { const uint8_t sysflag = kFwdMuon; - selectEoI(collisions, nullptr, muons, nullptr, nullptr); + selectEoI(collisions, nullptr, muons, nullptr); } void process_Electron_FwdMuon(aod::Collisions const& collisions, aod::EMPrimaryElectrons const& electrons, aod::EMPrimaryMuons const& muons) { const uint8_t sysflag = kElectron | kFwdMuon; - selectEoI(collisions, electrons, muons, nullptr, nullptr); + selectEoI(collisions, electrons, muons, nullptr); } void process_PCM(aod::Collisions const& collisions, aod::V0PhotonsKF const& v0s) { const uint8_t sysflag = kPCM; - selectEoI(collisions, nullptr, nullptr, v0s, nullptr); + selectEoI(collisions, nullptr, nullptr, v0s); } void process_Electron_FwdMuon_PCM(aod::Collisions const& collisions, aod::EMPrimaryElectrons const& electrons, aod::EMPrimaryMuons const& muons, aod::V0PhotonsKF const& v0s) { const uint8_t sysflag = kElectron | kFwdMuon | kPCM; - selectEoI(collisions, electrons, muons, v0s, nullptr); - } - - void process_PCM_ElectronFromDalitz(aod::Collisions const& collisions, aod::V0PhotonsKF const& v0s, aod::EMPrimaryElectronsFromDalitz const& electronsda) - { - const uint8_t sysflag = kPCM | kElectronFromDalitz; - selectEoI(collisions, nullptr, nullptr, v0s, electronsda); + selectEoI(collisions, electrons, muons, v0s); } void processDummy(aod::Collisions const& collisions) @@ -167,7 +145,6 @@ struct filterEoI { PROCESS_SWITCH(filterEoI, process_PCM, "create filter bit for PCM", false); PROCESS_SWITCH(filterEoI, process_Electron_FwdMuon, "create filter bit for Electron, FwdMuon", false); PROCESS_SWITCH(filterEoI, process_Electron_FwdMuon_PCM, "create filter bit for Electron, FwdMuon, PCM", false); - PROCESS_SWITCH(filterEoI, process_PCM_ElectronFromDalitz, "create filter bit for PCM, electron from dalitz", false); PROCESS_SWITCH(filterEoI, processDummy, "processDummy", true); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 0192e47ddacdd2b7933e12f7ecb0022c509f3665 Mon Sep 17 00:00:00 2001 From: Shirajum Monira <38348689+Eloviyo@users.noreply.github.com> Date: Sun, 3 Aug 2025 08:09:17 +0200 Subject: [PATCH 205/345] [PWGCF] FemtoUniverse v0cascade task -- added zorro software trigger (#12398) Co-authored-by: Shirajum Monira --- .../femtoUniverseProducerTask.cxx | 145 ++++++++++-------- 1 file changed, 83 insertions(+), 62 deletions(-) diff --git a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx index 9e2c024354e..1415e905f39 100644 --- a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx +++ b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx @@ -38,6 +38,8 @@ #include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/TrackSelectionTables.h" +#include "EventFiltering/Zorro.h" +#include "EventFiltering/ZorroSummary.h" #include "CommonConstants/PhysicsConstants.h" #include "DataFormatsParameters/GRPMagField.h" @@ -59,6 +61,7 @@ #include #include #include +#include #include using namespace o2; @@ -138,31 +141,35 @@ struct FemtoUniverseProducerTask { Configurable confStoreMCmothers{"confStoreMCmothers", false, "MC truth: Fill with not only primary particles and store mothers' PDG in tempFitVar."}; Configurable confFillCollExt{"confFillCollExt", false, "Option to fill collision extended table"}; + /// Event filtering (used for v0-cascade analysis) + Configurable zorroMask{"zorroMask", "", "zorro trigger class to select on (empty: none)"}; + /// Event cuts FemtoUniverseCollisionSelection colCuts; - Configurable confEvtUseTPCmult{"confEvtUseTPCmult", false, "Use multiplicity based on the number of tracks with TPC information"}; - Configurable confEvtZvtx{"confEvtZvtx", 10.f, "Evt sel: Max. z-Vertex (cm)"}; - Configurable confEvtTriggerCheck{"confEvtTriggerCheck", true, "Evt sel: check for trigger"}; - Configurable confEvtTriggerSel{"confEvtTriggerSel", kINT7, "Evt sel: trigger"}; - Configurable confEvtOfflineCheck{"confEvtOfflineCheck", false, "Evt sel: check for offline selection"}; - Configurable confIsActivateV0{"confIsActivateV0", false, "Activate filling of V0 into femtouniverse tables"}; - Configurable confActivateSecondaries{"confActivateSecondaries", false, "Fill secondary MC gen particles that were reconstructed"}; - Configurable confIsActivateCascade{"confIsActivateCascade", false, "Activate filling of Cascade into femtouniverse tables"}; - Configurable confIsActivatePhi{"confIsActivatePhi", false, "Activate filling of Phi into femtouniverse tables"}; - Configurable confIsActiveD0{"confIsActiveD0", false, "Activate filling FU tables for D0/D0bar mesons"}; - Configurable confMCTruthAnalysisWithPID{"confMCTruthAnalysisWithPID", true, "1: take only particles with specified PDG, 0: all particles (for MC Truth)"}; - Configurable> confMCTruthPDGCodes{"confMCTruthPDGCodes", std::vector{211, -211, 2212, -2212, 333}, "PDG of particles to be stored"}; - Configurable confCentFT0Min{"confCentFT0Min", 0.f, "Min CentFT0 value for centrality selection"}; - Configurable confCentFT0Max{"confCentFT0Max", 200.f, "Max CentFT0 value for centrality selection"}; - Configurable confEvIsGoodZvtxFT0vsPV{"confEvIsGoodZvtxFT0vsPV", true, "Require kIsGoodZvtxFT0vsPV selection on Events."}; - Configurable confEvNoSameBunchPileup{"confEvNoSameBunchPileup", true, "Require kNoSameBunchPileup selection on Events."}; - Configurable confIsUsePileUp{"confIsUsePileUp", true, "Required for choosing whether to run the pile-up cuts"}; - Configurable confEvIsVertexITSTPC{"confEvIsVertexITSTPC", true, "Require kIsVertexITSTPC selection on Events"}; - Configurable confTPCOccupancyMin{"confTPCOccupancyMin", 0, "Minimum value for TPC Occupancy selection"}; - Configurable confTPCOccupancyMax{"confTPCOccupancyMax", 500, "Maximum value for TPC Occupancy selection"}; - - Filter customCollCentFilter = (aod::cent::centFT0C > confCentFT0Min) && - (aod::cent::centFT0C < confCentFT0Max); + struct : o2::framework::ConfigurableGroup { + Configurable confEvtUseTPCmult{"confEvtUseTPCmult", false, "Use multiplicity based on the number of tracks with TPC information"}; + Configurable confEvtZvtx{"confEvtZvtx", 10.f, "Evt sel: Max. z-Vertex (cm)"}; + Configurable confEvtTriggerCheck{"confEvtTriggerCheck", true, "Evt sel: check for trigger"}; + Configurable confEvtTriggerSel{"confEvtTriggerSel", kINT7, "Evt sel: trigger"}; + Configurable confEvtOfflineCheck{"confEvtOfflineCheck", false, "Evt sel: check for offline selection"}; + Configurable confIsActivateV0{"confIsActivateV0", false, "Activate filling of V0 into femtouniverse tables"}; + Configurable confActivateSecondaries{"confActivateSecondaries", false, "Fill secondary MC gen particles that were reconstructed"}; + Configurable confIsActivateCascade{"confIsActivateCascade", false, "Activate filling of Cascade into femtouniverse tables"}; + Configurable confIsActivatePhi{"confIsActivatePhi", false, "Activate filling of Phi into femtouniverse tables"}; + Configurable confIsActiveD0{"confIsActiveD0", false, "Activate filling FU tables for D0/D0bar mesons"}; + Configurable confMCTruthAnalysisWithPID{"confMCTruthAnalysisWithPID", true, "1: take only particles with specified PDG, 0: all particles (for MC Truth)"}; + Configurable> confMCTruthPDGCodes{"confMCTruthPDGCodes", std::vector{211, -211, 2212, -2212, 333}, "PDG of particles to be stored"}; + Configurable confCentFT0Min{"confCentFT0Min", 0.f, "Min CentFT0 value for centrality selection"}; + Configurable confCentFT0Max{"confCentFT0Max", 200.f, "Max CentFT0 value for centrality selection"}; + Configurable confEvIsGoodZvtxFT0vsPV{"confEvIsGoodZvtxFT0vsPV", true, "Require kIsGoodZvtxFT0vsPV selection on Events."}; + Configurable confEvNoSameBunchPileup{"confEvNoSameBunchPileup", true, "Require kNoSameBunchPileup selection on Events."}; + Configurable confIsUsePileUp{"confIsUsePileUp", true, "Required for choosing whether to run the pile-up cuts"}; + Configurable confEvIsVertexITSTPC{"confEvIsVertexITSTPC", true, "Require kIsVertexITSTPC selection on Events"}; + Configurable confTPCOccupancyMin{"confTPCOccupancyMin", 0, "Minimum value for TPC Occupancy selection"}; + Configurable confTPCOccupancyMax{"confTPCOccupancyMax", 500, "Maximum value for TPC Occupancy selection"}; + } ConfGeneral; + Filter customCollCentFilter = (aod::cent::centFT0C > ConfGeneral.confCentFT0Min) && + (aod::cent::centFT0C < ConfGeneral.confCentFT0Max); // just sanity check to make sure in case there are problems in conversion or // MC production it does not affect results @@ -201,7 +208,6 @@ struct FemtoUniverseProducerTask { // V0 FemtoUniverseV0Selection v0Cuts; struct : o2::framework::ConfigurableGroup { - // Configurable confIsFillV0s{"confIsFillV0s", false, "Choice to fill V0s"}; //Commented: not used configurable Configurable> confV0Sign{FemtoUniverseV0Selection::getSelectionName(femto_universe_v0_selection::kV0Sign, "ConfV0"), std::vector{-1, 1}, FemtoUniverseV0Selection::getSelectionHelper(femto_universe_v0_selection::kV0Sign, "V0 selection: ")}; Configurable> confV0PtMin{FemtoUniverseV0Selection::getSelectionName(femto_universe_v0_selection::kV0pTMin, "ConfV0"), std::vector{0.3f, 0.4f, 0.5f}, FemtoUniverseV0Selection::getSelectionHelper(femto_universe_v0_selection::kV0pTMin, "V0 selection: ")}; Configurable> confV0PtMax{FemtoUniverseV0Selection::getSelectionName(femto_universe_v0_selection::kV0pTMax, "ConfV0"), std::vector{3.3f, 3.4f, 3.5f}, FemtoUniverseV0Selection::getSelectionHelper(femto_universe_v0_selection::kV0pTMax, "V0 selection: ")}; @@ -250,7 +256,6 @@ struct FemtoUniverseProducerTask { // CASCADE FemtoUniverseCascadeSelection cascadeCuts; struct : o2::framework::ConfigurableGroup { - // Configurable confIsFillCascades{"confIsFillCascades", false, "Choice to fill cascades"}; //Commented: not used configurable Configurable> confCascSign{FemtoUniverseCascadeSelection::getSelectionName(femto_universe_cascade_selection::kCascadeSign, "ConfCasc"), std::vector{-1, 1}, FemtoUniverseCascadeSelection::getSelectionHelper(femto_universe_cascade_selection::kCascadeSign, "Cascade selection: ")}; Configurable> confCascPtMin{FemtoUniverseCascadeSelection::getSelectionName(femto_universe_cascade_selection::kCascadepTMin, "ConfCasc"), std::vector{0.3f, 0.4f, 0.5f}, FemtoUniverseCascadeSelection::getSelectionHelper(femto_universe_cascade_selection::kCascadepTMin, "Cascade selection: ")}; Configurable> confCascPtMax{FemtoUniverseCascadeSelection::getSelectionName(femto_universe_cascade_selection::kCascadepTMax, "ConfCasc"), std::vector{3.3f, 3.4f, 3.5f}, FemtoUniverseCascadeSelection::getSelectionHelper(femto_universe_cascade_selection::kCascadepTMax, "Cascade selection: ")}; @@ -284,10 +289,6 @@ struct FemtoUniverseProducerTask { Configurable confXiInvMassUpLimit{"confXiInvMassUpLimit", 1.40, "Upper limit of the Xi invariant mass"}; Configurable confOmegaInvMassLowLimit{"confOmegaInvMassLowLimit", 1.60, "Lower limit of the Omega invariant mass"}; Configurable confOmegaInvMassUpLimit{"confOmegaInvMassUpLimit", 1.80, "Upper limit of the Omega invariant mass"}; - - // Configurable confCascRejectCompetingMass{"confCascRejectCompetingMass", false, "Switch on to reject Omegas (for Xi) or Xis (for Omegas)"}; - // Configurable confCascInvCompetingMassLowLimit{"confCascInvCompetingMassLowLimit", 1.66, "Lower limit of the cascade invariant mass for competing mass rejection"}; - // Configurable confCascInvCompetingMassUpLimit{"confCascInvCompetingMassUpLimit", 1.68, "Upper limit of the cascade invariant mass for competing mass rejection"}; } ConfCascadeSelection; // PHI @@ -463,6 +464,23 @@ struct FemtoUniverseProducerTask { return mask; } + Zorro zorro; + OutputObj zorroSummary{"zorroSummary"}; + int mRunNumberZorro = 0; + + HistogramRegistry qaRegistry{"QAHistos", {}, OutputObjHandlingPolicy::QAObject}; + HistogramRegistry cascadeQaRegistry{"CascadeQAHistos", {}, OutputObjHandlingPolicy::QAObject}; + + void initZorro(aod::BCsWithTimestamps::iterator const& bc) + { + if (mRunNumberZorro == bc.runNumber()) + return; + + zorro.initCCDB(ccdb.service, bc.runNumber(), bc.timestamp(), zorroMask.value); + zorro.populateHistRegistry(qaRegistry, bc.runNumber()); + mRunNumberZorro = bc.runNumber(); + } + /// \todo should we add filter on min value pT/eta of V0 and daughters? /*Filter v0Filter = (nabs(aod::v0data::x) < V0DecVtxMax.value) && (nabs(aod::v0data::y) < V0DecVtxMax.value) && @@ -470,9 +488,6 @@ struct FemtoUniverseProducerTask { // (aod::v0data::v0radius > V0TranRadV0Min.value); to be added, not working // for now do not know why - HistogramRegistry qaRegistry{"QAHistos", {}, OutputObjHandlingPolicy::QAObject}; - HistogramRegistry cascadeQaRegistry{"CascadeQAHistos", {}, OutputObjHandlingPolicy::QAObject}; - int mRunNumber = 0; float mMagField; Service ccdb; /// Accessing the CCDB @@ -489,7 +504,9 @@ struct FemtoUniverseProducerTask { "Please choose one."); } - colCuts.setCuts(confEvtZvtx, confEvtTriggerCheck, confEvtTriggerSel, confEvtOfflineCheck, confIsRun3, confCentFT0Min, confCentFT0Max); + zorroSummary.setObject(zorro.getZorroSummary()); + + colCuts.setCuts(ConfGeneral.confEvtZvtx, ConfGeneral.confEvtTriggerCheck, ConfGeneral.confEvtTriggerSel, ConfGeneral.confEvtOfflineCheck, confIsRun3, ConfGeneral.confCentFT0Min, ConfGeneral.confCentFT0Max); colCuts.init(&qaRegistry); trackCuts.setSelection(ConfTrkSelection.confTrkCharge, femto_universe_track_selection::kSign, femto_universe_selection::kEqual); @@ -514,7 +531,7 @@ struct FemtoUniverseProducerTask { /// different type! // v0Cuts.setSelection(ConfV0Selection->getRow(0), // femto_universe_v0_selection::kDecVtxMax, femto_universe_selection::kAbsUpperLimit); - if (confIsActivateV0) { + if (ConfGeneral.confIsActivateV0) { // initializing for V0 v0Cuts.setSelection(ConfV0Selection.confV0Sign, femto_universe_v0_selection::kV0Sign, femto_universe_selection::kEqual); v0Cuts.setSelection(ConfV0Selection.confV0PtMin, femto_universe_v0_selection::kV0pTMin, femto_universe_selection::kLowerLimit); @@ -557,7 +574,7 @@ struct FemtoUniverseProducerTask { // } } - if (confIsActivateCascade) { + if (ConfGeneral.confIsActivateCascade) { // initializing for cascades cascadeCuts.setSelection(ConfCascadeSelection.confCascSign, femto_universe_cascade_selection::kCascadeSign, femto_universe_selection::kEqual); cascadeCuts.setSelection(ConfCascadeSelection.confCascPtMin, femto_universe_cascade_selection::kCascadepTMin, femto_universe_selection::kLowerLimit); @@ -604,13 +621,9 @@ struct FemtoUniverseProducerTask { cascadeCuts.init(&cascadeQaRegistry); // invmass cuts cascadeCuts.setInvMassLimits(ConfCascadeSelection.confXiInvMassLowLimit, ConfCascadeSelection.confOmegaInvMassLowLimit, ConfCascadeSelection.confXiInvMassUpLimit, ConfCascadeSelection.confOmegaInvMassUpLimit); - - /*if (ConfCascadeSelection.confCascRejectCompetingMass) { - cascadeCuts.setCompetingInvMassLimits(ConfCascadeSelection.confCascInvCompetingMassLowLimit, ConfCascadeSelection.confCascInvCompetingMassUpLimit); - }*/ } - if (confIsActivatePhi) { + if (ConfGeneral.confIsActivatePhi) { // initializing for Phi meson phiCuts.init(&qaRegistry); } @@ -891,7 +904,7 @@ struct FemtoUniverseProducerTask { /// FemtoUniverseRun2 is defined V0M/2 multNtr = col.multTracklets(); } - if (confEvtUseTPCmult) { + if (ConfGeneral.confEvtUseTPCmult) { multNtr = col.multTPC(); } @@ -903,11 +916,19 @@ struct FemtoUniverseProducerTask { if (!colCuts.isSelected(col)) { return false; } - if (!confIsUsePileUp) { + + if (zorroMask.value != "") { + auto bc = col.template bc_as(); + initZorro(bc); + if (!zorro.isSelected(col.template bc_as().globalBC())) + return false; + } + + if (!ConfGeneral.confIsUsePileUp) { outputCollision(vtxZ, mult, multNtr, confDoSpher ? colCuts.computeSphericity(col, tracks) : 2, mMagField); colCuts.fillQA(col); return true; - } else if ((!confEvNoSameBunchPileup || col.selection_bit(aod::evsel::kNoSameBunchPileup)) && (!confEvIsGoodZvtxFT0vsPV || col.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) && (!confEvIsVertexITSTPC || col.selection_bit(aod::evsel::kIsVertexITSTPC))) { + } else if ((!ConfGeneral.confEvNoSameBunchPileup || col.selection_bit(aod::evsel::kNoSameBunchPileup)) && (!ConfGeneral.confEvIsGoodZvtxFT0vsPV || col.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) && (!ConfGeneral.confEvIsVertexITSTPC || col.selection_bit(aod::evsel::kIsVertexITSTPC))) { outputCollision(vtxZ, mult, multNtr, confDoSpher ? colCuts.computeSphericity(col, tracks) : 2, mMagField); colCuts.fillQA(col); return true; @@ -930,7 +951,7 @@ struct FemtoUniverseProducerTask { /// FemtoUniverseRun2 is defined V0M/2 multNtr = col.multTracklets(); } - if (confEvtUseTPCmult) { + if (ConfGeneral.confEvtUseTPCmult) { multNtr = col.multTPC(); } @@ -942,11 +963,11 @@ struct FemtoUniverseProducerTask { if (!colCuts.isSelected(col)) { return false; } - if (!confIsUsePileUp) { + if (!ConfGeneral.confIsUsePileUp) { outputCollision(vtxZ, mult, multNtr, confDoSpher ? colCuts.computeSphericity(col, tracks) : 2, mMagField); colCuts.fillQA(col); return true; - } else if ((!confEvNoSameBunchPileup || col.selection_bit(aod::evsel::kNoSameBunchPileup)) && (!confEvIsGoodZvtxFT0vsPV || col.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) && (!confEvIsVertexITSTPC || col.selection_bit(aod::evsel::kIsVertexITSTPC))) { + } else if ((!ConfGeneral.confEvNoSameBunchPileup || col.selection_bit(aod::evsel::kNoSameBunchPileup)) && (!ConfGeneral.confEvIsGoodZvtxFT0vsPV || col.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) && (!ConfGeneral.confEvIsVertexITSTPC || col.selection_bit(aod::evsel::kIsVertexITSTPC))) { outputCollision(vtxZ, mult, multNtr, confDoSpher ? colCuts.computeSphericity(col, tracks) : 2, mMagField); colCuts.fillQA(col); return true; @@ -963,7 +984,7 @@ struct FemtoUniverseProducerTask { float mult = confIsRun3 ? c.multFV0M() : 0.5 * (c.multFV0M()); int multNtr = confIsRun3 ? c.multNTracksPV() : c.multTracklets(); - if (std::abs(vtxZ) > confEvtZvtx) { + if (std::abs(vtxZ) > ConfGeneral.confEvtZvtx) { continue; } @@ -1009,7 +1030,7 @@ struct FemtoUniverseProducerTask { // in case of trigger run - store such collisions but don't store any // particle candidates for such collisions - if (!colCuts.isSelectedRun3(col) || (occupancy < confTPCOccupancyMin || occupancy > confTPCOccupancyMax)) { + if (!colCuts.isSelectedRun3(col) || (occupancy < ConfGeneral.confTPCOccupancyMin || occupancy > ConfGeneral.confTPCOccupancyMax)) { return false; } else { if (col.selection_bit(aod::evsel::kNoSameBunchPileup) && @@ -1031,7 +1052,7 @@ struct FemtoUniverseProducerTask { { const auto vtxZ = col.posZ(); - if (std::abs(vtxZ) > confEvtZvtx) { + if (std::abs(vtxZ) > ConfGeneral.confEvtZvtx) { return false; } else { outputCollision(vtxZ, 0, 0, 2, mMagField); @@ -1710,15 +1731,15 @@ struct FemtoUniverseProducerTask { uint32_t pdgCode = static_cast(particle.pdgCode()); - if (confMCTruthAnalysisWithPID) { + if (ConfGeneral.confMCTruthAnalysisWithPID) { bool pass = false; - std::vector tmpPDGCodes = confMCTruthPDGCodes; // necessary due to some features of the Configurable + std::vector tmpPDGCodes = ConfGeneral.confMCTruthPDGCodes; // necessary due to some features of the Configurable for (auto const& pdg : tmpPDGCodes) { if (static_cast(pdg) == static_cast(pdgCode)) { if (pdgCode == 333) { // && (recoMcIds && recoMcIds->get().contains(particle.globalIndex()))) { // ATTENTION: all Phi mesons are NOT primary particles pass = true; } else { - if (confStoreMCmothers || particle.isPhysicalPrimary() || (confActivateSecondaries && recoMcIds && recoMcIds->get().contains(particle.globalIndex()))) + if (confStoreMCmothers || particle.isPhysicalPrimary() || (ConfGeneral.confActivateSecondaries && recoMcIds && recoMcIds->get().contains(particle.globalIndex()))) pass = true; } } @@ -1746,7 +1767,7 @@ struct FemtoUniverseProducerTask { continue; } - if (confIsActivateCascade) + if (ConfGeneral.confIsActivateCascade) childIDs.push_back(0); outputParts(outputCollision.lastIndex(), particle.pt(), @@ -1775,7 +1796,7 @@ struct FemtoUniverseProducerTask { childIDs[0] = 0; childIDs[1] = 0; auto minDaughs = 2ul; - if (confIsActivateCascade) { + if (ConfGeneral.confIsActivateCascade) { childIDs.push_back(0); minDaughs = 3ul; } @@ -1836,9 +1857,9 @@ struct FemtoUniverseProducerTask { uint32_t pdgCode = static_cast(particle.pdgCode()); - if (confMCTruthAnalysisWithPID) { + if (ConfGeneral.confMCTruthAnalysisWithPID) { bool pass = false; - std::vector tmpPDGCodes = confMCTruthPDGCodes; // necessary due to some features of the Configurable + std::vector tmpPDGCodes = ConfGeneral.confMCTruthPDGCodes; // necessary due to some features of the Configurable for (auto const& pdg : tmpPDGCodes) { if (static_cast(pdg) == static_cast(pdgCode)) { if (pdgCode == 333) { // && (recoMcIds && recoMcIds->get().contains(particle.globalIndex()))) { // ATTENTION: all Phi mesons are NOT primary particles @@ -1846,7 +1867,7 @@ struct FemtoUniverseProducerTask { } else if (pdgCode == 421) { pass = true; } else { - if (particle.isPhysicalPrimary() || (confActivateSecondaries && recoMcIds && recoMcIds->get().contains(particle.globalIndex()))) + if (particle.isPhysicalPrimary() || (ConfGeneral.confActivateSecondaries && recoMcIds && recoMcIds->get().contains(particle.globalIndex()))) pass = true; } } @@ -1860,7 +1881,7 @@ struct FemtoUniverseProducerTask { tmpIDtrack.push_back(particle.globalIndex()); continue; } - if (confIsActiveD0) { + if (ConfGeneral.confIsActiveD0) { auto mcD0origin = aod::femtouniverseparticle::ParticleType::kMCTruthTrack; float ptGenB = -1; @@ -1957,10 +1978,10 @@ struct FemtoUniverseProducerTask { const auto colcheck = fillCollisions(col, tracks); if (colcheck) { fillTracks(tracks); - if (confIsActivateV0) { + if (ConfGeneral.confIsActivateV0) { fillV0(col, fullV0s, tracks); } - if (confIsActivatePhi) { + if (ConfGeneral.confIsActivatePhi) { fillPhi(col, tracks); } } @@ -2016,10 +2037,10 @@ struct FemtoUniverseProducerTask { const auto colcheck = fillCollisions(col, tracks); if (colcheck) { fillTracks(tracks); - if (confIsActivateV0) { + if (ConfGeneral.confIsActivateV0) { fillV0(col, fullV0s, tracks); } - if (confIsActivateCascade) { + if (ConfGeneral.confIsActivateCascade) { fillCascade(col, fullCascades, tracks); } } From 3ec52032a454fd9f9de4306f39f8fe0e91608b3f Mon Sep 17 00:00:00 2001 From: yuanzhe <90246048+wang-yuanzhe@users.noreply.github.com> Date: Sun, 3 Aug 2025 09:08:08 +0200 Subject: [PATCH 206/345] [PWGLF,Trigger] Update tofpidgeneric for secondary tracks to use TOFResoParamsV3 (#12395) Co-authored-by: ALICE Action Bot --- EventFiltering/PWGLF/nucleiFilter.cxx | 126 ++--- PWGLF/DataModel/LFHyperNucleiKinkTables.h | 5 +- PWGLF/DataModel/LFPIDTOFGenericTables.h | 59 +++ PWGLF/DataModel/pidTOFGeneric.h | 220 -------- PWGLF/TableProducer/Nuspex/CMakeLists.txt | 2 +- .../Nuspex/decay3bodybuilder.cxx | 99 +--- .../Nuspex/hyperkinkRecoTask.cxx | 149 ++++-- PWGLF/TableProducer/Nuspex/pidTOFGeneric.cxx | 479 ++++++++--------- .../Nuspex/reduced3bodyCreator.cxx | 79 +-- PWGLF/TableProducer/Nuspex/trHeAnalysis.cxx | 15 +- PWGLF/Utils/pidTOFGeneric.h | 496 ++++++++++++++++++ 11 files changed, 972 insertions(+), 757 deletions(-) create mode 100644 PWGLF/DataModel/LFPIDTOFGenericTables.h delete mode 100644 PWGLF/DataModel/pidTOFGeneric.h create mode 100644 PWGLF/Utils/pidTOFGeneric.h diff --git a/EventFiltering/PWGLF/nucleiFilter.cxx b/EventFiltering/PWGLF/nucleiFilter.cxx index 54f3ed507ad..443df675533 100644 --- a/EventFiltering/PWGLF/nucleiFilter.cxx +++ b/EventFiltering/PWGLF/nucleiFilter.cxx @@ -10,42 +10,48 @@ // or submit itself to any jurisdiction. // O2 includes -#include -#include +#include "../filterTables.h" -#include "Math/Vector4D.h" -#include "Math/GenVector/Boost.h" +#include "PWGLF/DataModel/LFPIDTOFGenericTables.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGLF/DataModel/Vtx3BodyTables.h" +#include "PWGLF/Utils/pidTOFGeneric.h" + +#include "Common/Core/PID/PIDTOF.h" +#include "Common/Core/trackUtilities.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/TrackSelectionTables.h" + +#include "CCDB/BasicCCDBManager.h" +#include "DCAFitter/DCAFitterN.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "DataFormatsParameters/GRPObject.h" +#include "DataFormatsTOF/ParameterContainers.h" #include "DataFormatsTPC/BetheBlochAleph.h" +#include "DetectorsBase/GeometryManager.h" +#include "DetectorsBase/Propagator.h" +#include "Framework/ASoAHelpers.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" -#include "Framework/ASoAHelpers.h" #include "Framework/HistogramRegistry.h" #include "Framework/runDataProcessing.h" #include "ReconstructionDataFormats/Track.h" -#include "PWGLF/DataModel/Vtx3BodyTables.h" -#include "../filterTables.h" +#include "Math/GenVector/Boost.h" +#include "Math/Vector4D.h" -#include "ReconstructionDataFormats/Track.h" -#include "Common/Core/trackUtilities.h" -#include "DetectorsBase/Propagator.h" -#include "DetectorsBase/GeometryManager.h" -#include "DataFormatsParameters/GRPObject.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "DataFormatsTOF/ParameterContainers.h" -#include "CCDB/BasicCCDBManager.h" -#include "DCAFitter/DCAFitterN.h" -#include "PWGLF/DataModel/pidTOFGeneric.h" -#include "PWGLF/DataModel/LFStrangenessTables.h" -#include "Common/Core/PID/PIDTOF.h" +#include +#include +#include +#include using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; +o2::common::core::MetadataHelper metadataInfo; + namespace { @@ -120,7 +126,9 @@ struct nucleiFilter { o2::base::MatLayerCylSet* lut = nullptr; o2::vertexing::DCAFitterN<2> fitter2body; o2::vertexing::DCAFitterN<3> fitter3body; - o2::pid::tof::TOFResoParamsV2 mRespParamsV2; + // TOF response and input parameters + o2::pid::tof::TOFResoParamsV3 mRespParamsV3; + o2::aod::pidtofgeneric::TOFCalibConfig mTOFCalibConfig; // TOF Calib configuration // configurable for hypertriton 3body decay struct : ConfigurableGroup { Configurable bFieldInput{"trgH3L3Body.mBz", -999, "bz field, -999 is automatic"}; @@ -153,20 +161,12 @@ struct nucleiFilter { Configurable grpmagPath{"trgH3L3Body.grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; Configurable lutPath{"trgH3L3Body.lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"}; Configurable geoPath{"trgH3L3Body.geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; - // CCDB TOF PID paras - Configurable timestamp{"trgH3L3Body.ccdb-timestamp", -1, "timestamp of the object"}; - Configurable paramFileName{"trgH3L3Body.paramFileName", "", "Path to the parametrization object. If empty the parametrization is not taken from file"}; - Configurable parametrizationPath{"trgH3L3Body.parametrizationPath", "TOF/Calib/Params", "Path of the TOF parametrization on the CCDB or in the file, if the paramFileName is not empty"}; - Configurable passName{"trgH3L3Body.passName", "", "Name of the pass inside of the CCDB parameter collection. If empty, the automatically deceted from metadata (to be implemented!!!)"}; - Configurable timeShiftCCDBPath{"trgH3L3Body.timeShiftCCDBPath", "", "Path of the TOF time shift vs eta. If empty none is taken"}; - Configurable loadResponseFromCCDB{"trgH3L3Body.loadResponseFromCCDB", false, "Flag to load the response from the CCDB"}; - Configurable fatalOnPassNotAvailable{"trgH3L3Body.fatalOnPassNotAvailable", false, "Flag to throw a fatal if the pass is not available in the retrieved CCDB object"}; } trgH3L3Body; HistogramRegistry qaHists{"qaHists", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; OutputObj hProcessedEvents{TH1D("hProcessedEvents", ";;Number of filtered events", kNtriggers + 1, -0.5, static_cast(kNtriggers) + 0.5)}; - void init(InitContext&) + void init(InitContext& initContext) { std::vector ptBinning = {0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.8, 2.0, 2.2, 2.4, 2.8, 3.2, 3.6, 4., 5.}; @@ -214,6 +214,11 @@ struct nucleiFilter { ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); ccdb->setFatalWhenNull(false); + + // Initialization of TOF PID parameters for fH3L3Body + mTOFCalibConfig.metadataInfo = metadataInfo; + mTOFCalibConfig.inheritFromBaseTask(initContext); + mTOFCalibConfig.initSetup(mRespParamsV3, ccdb); // Getting the parametrization parameters } void initCCDB(aod::BCsWithTimestamps::iterator const& bc) @@ -264,65 +269,7 @@ struct nucleiFilter { o2::base::Propagator::Instance()->setMatLUT(lut); } - // Initial TOF PID Paras, copied from pidTOF.cxx - trgH3L3Body.timestamp.value = bc.timestamp(); - ccdb->setTimestamp(trgH3L3Body.timestamp.value); - // Not later than now objects - ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); - // TODO: implement the automatic pass name detection from metadata - if (trgH3L3Body.passName.value == "") { - trgH3L3Body.passName.value = "unanchored"; // temporary default - LOG(warning) << "Passed autodetect mode for pass, not implemented yet, waiting for metadata. Taking '" << trgH3L3Body.passName.value << "'"; - } - LOG(info) << "Using parameter collection, starting from pass '" << trgH3L3Body.passName.value << "'"; - - const std::string fname = trgH3L3Body.paramFileName.value; - if (!fname.empty()) { // Loading the parametrization from file - LOG(info) << "Loading exp. sigma parametrization from file " << fname << ", using param: " << trgH3L3Body.parametrizationPath.value; - if (1) { - o2::tof::ParameterCollection paramCollection; - paramCollection.loadParamFromFile(fname, trgH3L3Body.parametrizationPath.value); - LOG(info) << "+++ Loaded parameter collection from file +++"; - if (!paramCollection.retrieveParameters(mRespParamsV2, trgH3L3Body.passName.value)) { - if (trgH3L3Body.fatalOnPassNotAvailable) { - LOGF(fatal, "Pass '%s' not available in the retrieved CCDB object", trgH3L3Body.passName.value.data()); - } else { - LOGF(warning, "Pass '%s' not available in the retrieved CCDB object", trgH3L3Body.passName.value.data()); - } - } else { - mRespParamsV2.setShiftParameters(paramCollection.getPars(trgH3L3Body.passName.value)); - mRespParamsV2.printShiftParameters(); - } - } else { - mRespParamsV2.loadParamFromFile(fname.data(), trgH3L3Body.parametrizationPath.value); - } - } else if (trgH3L3Body.loadResponseFromCCDB) { // Loading it from CCDB - LOG(info) << "Loading exp. sigma parametrization from CCDB, using path: " << trgH3L3Body.parametrizationPath.value << " for timestamp " << trgH3L3Body.timestamp.value; - o2::tof::ParameterCollection* paramCollection = ccdb->getForTimeStamp(trgH3L3Body.parametrizationPath.value, trgH3L3Body.timestamp.value); - paramCollection->print(); - if (!paramCollection->retrieveParameters(mRespParamsV2, trgH3L3Body.passName.value)) { // Attempt at loading the parameters with the pass defined - if (trgH3L3Body.fatalOnPassNotAvailable) { - LOGF(fatal, "Pass '%s' not available in the retrieved CCDB object", trgH3L3Body.passName.value.data()); - } else { - LOGF(warning, "Pass '%s' not available in the retrieved CCDB object", trgH3L3Body.passName.value.data()); - } - } else { // Pass is available, load non standard parameters - mRespParamsV2.setShiftParameters(paramCollection->getPars(trgH3L3Body.passName.value)); - mRespParamsV2.printShiftParameters(); - } - } - mRespParamsV2.print(); - if (trgH3L3Body.timeShiftCCDBPath.value != "") { - if (trgH3L3Body.timeShiftCCDBPath.value.find(".root") != std::string::npos) { - mRespParamsV2.setTimeShiftParameters(trgH3L3Body.timeShiftCCDBPath.value, "gmean_Pos", true); - mRespParamsV2.setTimeShiftParameters(trgH3L3Body.timeShiftCCDBPath.value, "gmean_Neg", false); - } else { - mRespParamsV2.setTimeShiftParameters(ccdb->getForTimeStamp(Form("%s/pos", trgH3L3Body.timeShiftCCDBPath.value.c_str()), trgH3L3Body.timestamp.value), true); - mRespParamsV2.setTimeShiftParameters(ccdb->getForTimeStamp(Form("%s/neg", trgH3L3Body.timeShiftCCDBPath.value.c_str()), trgH3L3Body.timestamp.value), false); - } - } - - bachelorTOFPID.SetParams(mRespParamsV2); + mTOFCalibConfig.processSetup(mRespParamsV3, ccdb, bc); } enum { @@ -568,7 +515,7 @@ struct nucleiFilter { float tofNSigmaDeuteron = -999; if (track2.has_collision() && track2.hasTOF()) { auto originalcol = track2.collision_as(); - tofNSigmaDeuteron = bachelorTOFPID.GetTOFNSigma(track2, originalcol, collision); + tofNSigmaDeuteron = bachelorTOFPID.GetTOFNSigma(mRespParamsV3, track2, originalcol, collision); } if (track2.p() > trgH3L3Body.minDeuteronPUseTOF && (tofNSigmaDeuteron < trgH3L3Body.tofPIDNSigmaMin || tofNSigmaDeuteron > trgH3L3Body.tofPIDNSigmaMax)) { continue; @@ -671,6 +618,7 @@ struct nucleiFilter { WorkflowSpec defineDataProcessing(ConfigContext const& cfg) { + metadataInfo.initMetadata(cfg); return WorkflowSpec{ adaptAnalysisTask(cfg)}; } diff --git a/PWGLF/DataModel/LFHyperNucleiKinkTables.h b/PWGLF/DataModel/LFHyperNucleiKinkTables.h index 4ffd6f4ec46..3f064f5225f 100644 --- a/PWGLF/DataModel/LFHyperNucleiKinkTables.h +++ b/PWGLF/DataModel/LFHyperNucleiKinkTables.h @@ -55,6 +55,7 @@ DECLARE_SOA_COLUMN(ItsClusterSizesMoth, itsClusterSizesMoth, uint32_t); //! ITS DECLARE_SOA_COLUMN(ItsClusterSizesDaug, itsClusterSizesDaug, uint32_t); //! ITS cluster size of the daughter track DECLARE_SOA_COLUMN(NSigmaTPCDaug, nSigmaTPCDaug, float); //! Number of tpc sigmas of the daughter track DECLARE_SOA_COLUMN(NSigmaITSDaug, nSigmaITSDaug, float); //! Number of ITS sigmas of the daughter track +DECLARE_SOA_COLUMN(NSigmaTOFDaug, nSigmaTOFDaug, float); //! Number of TOF sigmas of the daughter track DECLARE_SOA_COLUMN(IsSignal, isSignal, bool); //! bool: true for hyperhelium4signal DECLARE_SOA_COLUMN(IsSignalReco, isSignalReco, bool); //! bool: true if the signal is reconstructed @@ -94,7 +95,7 @@ DECLARE_SOA_TABLE(HypKinkCand, "AOD", "HYPKINKCANDS", hyperkink::PxDaugSV, hyperkink::PyDaugSV, hyperkink::PzDaugSV, hyperkink::DcaMothPv, hyperkink::DcaDaugPv, hyperkink::DcaKinkTopo, hyperkink::ItsChi2Moth, hyperkink::ItsClusterSizesMoth, hyperkink::ItsClusterSizesDaug, - hyperkink::NSigmaTPCDaug, hyperkink::NSigmaITSDaug); + hyperkink::NSigmaTPCDaug, hyperkink::NSigmaITSDaug, hyperkink::NSigmaTOFDaug); DECLARE_SOA_TABLE(MCHypKinkCand, "AOD", "MCHYPKINKCANDS", o2::soa::Index<>, @@ -109,7 +110,7 @@ DECLARE_SOA_TABLE(MCHypKinkCand, "AOD", "MCHYPKINKCANDS", hyperkink::PxDaugSV, hyperkink::PyDaugSV, hyperkink::PzDaugSV, hyperkink::DcaMothPv, hyperkink::DcaDaugPv, hyperkink::DcaKinkTopo, hyperkink::ItsChi2Moth, hyperkink::ItsClusterSizesMoth, hyperkink::ItsClusterSizesDaug, - hyperkink::NSigmaTPCDaug, hyperkink::NSigmaITSDaug, + hyperkink::NSigmaTPCDaug, hyperkink::NSigmaITSDaug, hyperkink::NSigmaTOFDaug, hyperkink::IsSignal, hyperkink::IsSignalReco, hyperkink::IsCollReco, hyperkink::IsSurvEvSelection, hyperkink::TrueXSV, hyperkink::TrueYSV, hyperkink::TrueZSV, hyperkink::TruePxMothPV, hyperkink::TruePyMothPV, hyperkink::TruePzMothPV, diff --git a/PWGLF/DataModel/LFPIDTOFGenericTables.h b/PWGLF/DataModel/LFPIDTOFGenericTables.h new file mode 100644 index 00000000000..3a52a8a8ca5 --- /dev/null +++ b/PWGLF/DataModel/LFPIDTOFGenericTables.h @@ -0,0 +1,59 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// +/// \file LFPIDTOFGenericTables.h +/// \brief Table for event time without remving track bias +/// \author Yuanzhe Wang + +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" + +#ifndef PWGLF_DATAMODEL_LFPIDTOFGENERICTABLES_H_ +#define PWGLF_DATAMODEL_LFPIDTOFGENERICTABLES_H_ +#include "Common/Core/PID/PIDTOF.h" + +#include "CommonDataFormat/InteractionRecord.h" + +namespace o2::aod +{ +namespace evtime +{ + +DECLARE_SOA_COLUMN(EvTime, evTime, float); //! Event time. Can be obtained via a combination of detectors e.g. TOF, FT0A, FT0C +DECLARE_SOA_COLUMN(EvTimeErr, evTimeErr, float); //! Error of event time. Can be obtained via a combination of detectors e.g. TOF, FT0A, FT0C +DECLARE_SOA_COLUMN(EvTimeTOF, evTimeTOF, float); //! Event time computed with the TOF detector +DECLARE_SOA_COLUMN(EvTimeTOFErr, evTimeTOFErr, float); //! Error of the event time computed with the TOF detector +DECLARE_SOA_COLUMN(EvTimeFT0, evTimeFT0, float); //! Event time computed with the FT0 detector +DECLARE_SOA_COLUMN(EvTimeFT0Err, evTimeFT0Err, float); //! Error of the event time computed with the FT0 detector +} // namespace evtime + +DECLARE_SOA_TABLE(EvTimeTOFFT0, "AOD", "EvTimeTOFFT0", //! Table of the event time. One entry per collision. + evtime::EvTime, + evtime::EvTimeErr, + evtime::EvTimeTOF, + evtime::EvTimeTOFErr, + evtime::EvTimeFT0, + evtime::EvTimeFT0Err); + +namespace tracktime +{ + +DECLARE_SOA_COLUMN(EvTimeForTrack, evTimeForTrack, float); //! Event time. Removed the bias for the specific track +DECLARE_SOA_COLUMN(EvTimeErrForTrack, evTimeErrForTrack, float); //! Error of event time. Removed the bias for the specific track +} // namespace tracktime + +DECLARE_SOA_TABLE(EvTimeTOFFT0ForTrack, "AOD", "EvTimeForTrack", //! Table of the event time. One entry per track. + tracktime::EvTimeForTrack, + tracktime::EvTimeErrForTrack); + +} // namespace o2::aod + +#endif // PWGLF_DATAMODEL_LFPIDTOFGENERICTABLES_H_ diff --git a/PWGLF/DataModel/pidTOFGeneric.h b/PWGLF/DataModel/pidTOFGeneric.h deleted file mode 100644 index a0d287a7643..00000000000 --- a/PWGLF/DataModel/pidTOFGeneric.h +++ /dev/null @@ -1,220 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -#ifndef PWGLF_DATAMODEL_PIDTOFGENERIC_H_ -#define PWGLF_DATAMODEL_PIDTOFGENERIC_H_ -#include "CommonDataFormat/InteractionRecord.h" -#include "Common/Core/PID/PIDTOF.h" - -namespace o2::aod -{ -namespace evtime -{ - -DECLARE_SOA_COLUMN(EvTime, evTime, float); //! Event time. Can be obtained via a combination of detectors e.g. TOF, FT0A, FT0C -DECLARE_SOA_COLUMN(EvTimeErr, evTimeErr, float); //! Error of event time. Can be obtained via a combination of detectors e.g. TOF, FT0A, FT0C -DECLARE_SOA_COLUMN(EvTimeTOF, evTimeTOF, float); //! Event time computed with the TOF detector -DECLARE_SOA_COLUMN(EvTimeTOFErr, evTimeTOFErr, float); //! Error of the event time computed with the TOF detector -DECLARE_SOA_COLUMN(EvTimeFT0, evTimeFT0, float); //! Event time computed with the FT0 detector -DECLARE_SOA_COLUMN(EvTimeFT0Err, evTimeFT0Err, float); //! Error of the event time computed with the FT0 detector -} // namespace evtime - -DECLARE_SOA_TABLE(EvTimeTOFFT0, "AOD", "EvTimeTOFFT0", //! Table of the event time. One entry per collision. - evtime::EvTime, - evtime::EvTimeErr, - evtime::EvTimeTOF, - evtime::EvTimeTOFErr, - evtime::EvTimeFT0, - evtime::EvTimeFT0Err); - -namespace tracktime -{ - -DECLARE_SOA_COLUMN(EvTimeForTrack, evTimeForTrack, float); //! Event time. Removed the bias for the specific track -DECLARE_SOA_COLUMN(EvTimeErrForTrack, evTimeErrForTrack, float); //! Error of event time. Removed the bias for the specific track -} // namespace tracktime - -DECLARE_SOA_TABLE(EvTimeTOFFT0ForTrack, "AOD", "EvTimeForTrack", //! Table of the event time. One entry per track. - tracktime::EvTimeForTrack, - tracktime::EvTimeErrForTrack); - -namespace pidtofgeneric -{ - -static constexpr float kCSPEED = TMath::C() * 1.0e2f * 1.0e-12f; // c in cm/ps - -template -class TofPidNewCollision -{ - public: - TofPidNewCollision() = default; - ~TofPidNewCollision() = default; - - o2::pid::tof::TOFResoParamsV2 mRespParamsV2; - o2::track::PID::ID pidType; - - template - using ResponseImplementation = o2::pid::tof::ExpTimes; - static constexpr auto responseEl = ResponseImplementation(); - static constexpr auto responseMu = ResponseImplementation(); - static constexpr auto responsePi = ResponseImplementation(); - static constexpr auto responseKa = ResponseImplementation(); - static constexpr auto responsePr = ResponseImplementation(); - static constexpr auto responseDe = ResponseImplementation(); - static constexpr auto responseTr = ResponseImplementation(); - static constexpr auto responseHe = ResponseImplementation(); - static constexpr auto responseAl = ResponseImplementation(); - - void SetParams(o2::pid::tof::TOFResoParamsV2 const& para) - { - mRespParamsV2.setParameters(para); - } - - void SetPidType(o2::track::PID::ID pidId) - { - pidType = pidId; - } - - template - float GetTOFNSigma(o2::track::PID::ID pidId, TTrack const& track, TCollision const& originalcol, TCollision const& correctedcol, bool EnableBCAO2D = true); - - template - float GetTOFNSigma(TTrack const& track, TCollision const& originalcol, TCollision const& correctedcol, bool EnableBCAO2D = true); - - float GetTOFNSigma(TTrack const& track); - float GetTOFNSigma(o2::track::PID::ID pidId, TTrack const& track); - - float CalculateTOFNSigma(o2::track::PID::ID pidId, TTrack const& track, double tofsignal, double evTime, double evTimeErr) - { - - float expSigma, tofNsigma = -999; - - switch (pidId) { - case 0: - expSigma = responseEl.GetExpectedSigma(mRespParamsV2, track, tofsignal, evTimeErr); - tofNsigma = (tofsignal - evTime - responseEl.GetCorrectedExpectedSignal(mRespParamsV2, track)) / expSigma; - break; - case 1: - expSigma = responseMu.GetExpectedSigma(mRespParamsV2, track, tofsignal, evTimeErr); - tofNsigma = (tofsignal - evTime - responseMu.GetCorrectedExpectedSignal(mRespParamsV2, track)) / expSigma; - break; - case 2: - expSigma = responsePi.GetExpectedSigma(mRespParamsV2, track, tofsignal, evTimeErr); - tofNsigma = (tofsignal - evTime - responsePi.GetCorrectedExpectedSignal(mRespParamsV2, track)) / expSigma; - break; - case 3: - expSigma = responseKa.GetExpectedSigma(mRespParamsV2, track, tofsignal, evTimeErr); - tofNsigma = (tofsignal - evTime - responseKa.GetCorrectedExpectedSignal(mRespParamsV2, track)) / expSigma; - break; - case 4: - expSigma = responsePr.GetExpectedSigma(mRespParamsV2, track, tofsignal, evTimeErr); - tofNsigma = (tofsignal - evTime - responsePr.GetCorrectedExpectedSignal(mRespParamsV2, track)) / expSigma; - break; - case 5: - expSigma = responseDe.GetExpectedSigma(mRespParamsV2, track, tofsignal, evTimeErr); - tofNsigma = (tofsignal - evTime - responseDe.GetCorrectedExpectedSignal(mRespParamsV2, track)) / expSigma; - break; - case 6: - expSigma = responseTr.GetExpectedSigma(mRespParamsV2, track, tofsignal, evTimeErr); - tofNsigma = (tofsignal - evTime - responseTr.GetCorrectedExpectedSignal(mRespParamsV2, track)) / expSigma; - break; - case 7: - expSigma = responseHe.GetExpectedSigma(mRespParamsV2, track, tofsignal, evTimeErr); - tofNsigma = (tofsignal - evTime - responseHe.GetCorrectedExpectedSignal(mRespParamsV2, track)) / expSigma; - break; - case 8: - expSigma = responseAl.GetExpectedSigma(mRespParamsV2, track, tofsignal, evTimeErr); - tofNsigma = (tofsignal - evTime - responseAl.GetCorrectedExpectedSignal(mRespParamsV2, track)) / expSigma; - break; - default: - LOG(fatal) << "Wrong particle ID in TofPidSecondary class"; - return -999; - } - - return tofNsigma; - } -}; - -template -template -float TofPidNewCollision::GetTOFNSigma(o2::track::PID::ID pidId, TTrack const& track, TCollision const& originalcol, TCollision const& correctedcol, bool EnableBCAO2D) -{ - - if (!track.has_collision() || !track.hasTOF()) { - return -999; - } - - float mMassHyp = o2::track::pid_constants::sMasses2Z[track.pidForTracking()]; - float expTime = track.length() * sqrt((mMassHyp * mMassHyp) + (track.tofExpMom() * track.tofExpMom())) / (kCSPEED * track.tofExpMom()); // L*E/(p*c) = L/v - - float evTime = correctedcol.evTime(); - float evTimeErr = correctedcol.evTimeErr(); - float tofsignal = track.trackTime() * 1000 + expTime; // in ps - - if (originalcol.globalIndex() == correctedcol.globalIndex()) { - evTime = track.evTimeForTrack(); - evTimeErr = track.evTimeErrForTrack(); - } else { - if (EnableBCAO2D) { - auto originalbc = originalcol.template bc_as(); - auto correctedbc = correctedcol.template bc_as(); - o2::InteractionRecord originalIR = o2::InteractionRecord::long2IR(originalbc.globalBC()); - o2::InteractionRecord correctedIR = o2::InteractionRecord::long2IR(correctedbc.globalBC()); - tofsignal += originalIR.differenceInBCNS(correctedIR) * 1000; - } else { - auto originalbc = originalcol.template foundBC_as(); - auto correctedbc = correctedcol.template foundBC_as(); - o2::InteractionRecord originalIR = o2::InteractionRecord::long2IR(originalbc.globalBC()); - o2::InteractionRecord correctedIR = o2::InteractionRecord::long2IR(correctedbc.globalBC()); - tofsignal += originalIR.differenceInBCNS(correctedIR) * 1000; - } - } - - float tofNsigma = CalculateTOFNSigma(pidId, track, tofsignal, evTime, evTimeErr); - return tofNsigma; -} - -template -template -float TofPidNewCollision::GetTOFNSigma(TTrack const& track, TCollision const& originalcol, TCollision const& correctedcol, bool EnableBCAO2D) -{ - return GetTOFNSigma(pidType, track, originalcol, correctedcol, EnableBCAO2D); -} - -template -float TofPidNewCollision::GetTOFNSigma(o2::track::PID::ID pidId, TTrack const& track) -{ - - if (!track.has_collision() || !track.hasTOF()) { - return -999; - } - - float mMassHyp = o2::track::pid_constants::sMasses2Z[track.pidForTracking()]; - float expTime = track.length() * sqrt((mMassHyp * mMassHyp) + (track.tofExpMom() * track.tofExpMom())) / (kCSPEED * track.tofExpMom()); // L*E/(p*c) = L/v - - float evTime = track.evTimeForTrack(); - float evTimeErr = track.evTimeErrForTrack(); - float tofsignal = track.trackTime() * 1000 + expTime; // in ps - - float tofNsigma = CalculateTOFNSigma(pidId, track, tofsignal, evTime, evTimeErr); - return tofNsigma; -} - -template -float TofPidNewCollision::GetTOFNSigma(TTrack const& track) -{ - return GetTOFNSigma(pidType, track); -} - -} // namespace pidtofgeneric -} // namespace o2::aod - -#endif // PWGLF_DATAMODEL_PIDTOFGENERIC_H_ diff --git a/PWGLF/TableProducer/Nuspex/CMakeLists.txt b/PWGLF/TableProducer/Nuspex/CMakeLists.txt index 2f1295a8f4f..98dac784da5 100644 --- a/PWGLF/TableProducer/Nuspex/CMakeLists.txt +++ b/PWGLF/TableProducer/Nuspex/CMakeLists.txt @@ -96,7 +96,7 @@ o2physics_add_dpl_workflow(nuclei-flow-trees o2physics_add_dpl_workflow(hyperkink-reco-task SOURCES hyperkinkRecoTask.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::TOFBase COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(he3-lambda-analysis diff --git a/PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx b/PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx index bee3f8f9eaf..7757cbc72a1 100644 --- a/PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx +++ b/PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx @@ -17,10 +17,11 @@ #include "TableHelper.h" +#include "PWGLF/DataModel/LFPIDTOFGenericTables.h" #include "PWGLF/DataModel/Reduced3BodyTables.h" #include "PWGLF/DataModel/Vtx3BodyTables.h" -#include "PWGLF/DataModel/pidTOFGeneric.h" #include "PWGLF/Utils/decay3bodyBuilderHelper.h" +#include "PWGLF/Utils/pidTOFGeneric.h" #include "Common/Core/PID/PIDTOF.h" #include "Common/Core/RecoDecay.h" @@ -66,6 +67,8 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; +o2::common::core::MetadataHelper metadataInfo; + static constexpr int nParameters = 1; static const std::vector tableNames{ "Decay3BodyIndices", @@ -204,17 +207,6 @@ struct decay3bodyBuilder { Configurable maxDCAZ3Body{"maxDCAZ3Body", 1.0, "Max DCA Z of 3body"}; } mixingOpts; - struct : ConfigurableGroup { - std::string prefix = "tofPIDOpts"; - Configurable timestamp{"ccdb-timestamp", -1, "timestamp of the object"}; - Configurable paramFileName{"paramFileName", "", "Path to the parametrization object. If empty the parametrization is not taken from file"}; - Configurable parametrizationPath{"parametrizationPath", "TOF/Calib/Params", "Path of the TOF parametrization on the CCDB or in the file, if the paramFileName is not empty"}; - Configurable passName{"passName", "", "Name of the pass inside of the CCDB parameter collection. If empty, the automatically deceted from metadata (to be implemented!!!)"}; - Configurable timeShiftCCDBPath{"timeShiftCCDBPath", "", "Path of the TOF time shift vs eta. If empty none is taken"}; - Configurable loadResponseFromCCDB{"loadResponseFromCCDB", false, "Flag to load the response from the CCDB"}; - Configurable fatalOnPassNotAvailable{"fatalOnPassNotAvailable", true, "Flag to throw a fatal if the pass is not available in the retrieved CCDB object"}; - } tofPIDOpts; - // Helper struct to contain MC information prior to filling struct mc3Bodyinfo { int label; @@ -256,7 +248,9 @@ struct decay3bodyBuilder { // bachelor TOF PID o2::aod::pidtofgeneric::TofPidNewCollision bachelorTOFPID; // to be updated in Init based on the hypothesis o2::aod::pidtofgeneric::TofPidNewCollision bachelorTOFPIDLabeled; // to be updated in Init based on the hypothesis - o2::pid::tof::TOFResoParamsV2 mRespParamsV2; + // TOF response and input parameters + o2::pid::tof::TOFResoParamsV3 mRespParamsV3; + o2::aod::pidtofgeneric::TOFCalibConfig mTOFCalibConfig; // TOF Calib configuration // 3body mixing using Binning3BodyKF = ColumnBinningPolicy; @@ -274,7 +268,7 @@ struct decay3bodyBuilder { // MC info std::vector isGoodCollision; - void init(InitContext&) + void init(InitContext& initContext) { zorroSummary.setObject(zorro.getZorroSummary()); @@ -289,6 +283,11 @@ struct decay3bodyBuilder { ccdb->setLocalObjectValidityChecking(); ccdb->setFatalWhenNull(false); + // TOF PID parameters initialization + mTOFCalibConfig.metadataInfo = metadataInfo; + mTOFCalibConfig.inheritFromBaseTask(initContext); + mTOFCalibConfig.initSetup(mRespParamsV3, ccdb); + // Set material correction if (useMatCorrType == 1) { LOGF(info, "TGeo correction requested, loading geometry"); @@ -528,66 +527,7 @@ struct decay3bodyBuilder { // mark run as configured mRunNumber = bc.runNumber(); - // Initial TOF PID Paras, copied from PIDTOF.h - tofPIDOpts.timestamp.value = bc.timestamp(); - ccdb->setTimestamp(tofPIDOpts.timestamp.value); - // Not later than now objects - ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); - // TODO: implement the automatic pass name detection from metadata - if (tofPIDOpts.passName.value == "") { - tofPIDOpts.passName.value = "unanchored"; // temporary default - LOG(warning) << "Passed autodetect mode for pass, not implemented yet, waiting for metadata. Taking '" << tofPIDOpts.passName.value << "'"; - } - LOG(info) << "Using parameter collection, starting from pass '" << tofPIDOpts.passName.value << "'"; - - const std::string fname = tofPIDOpts.paramFileName.value; - if (!fname.empty()) { // Loading the parametrization from file - LOG(info) << "Loading exp. sigma parametrization from file " << fname << ", using param: " << tofPIDOpts.parametrizationPath.value; - if (1) { - o2::tof::ParameterCollection paramCollection; - paramCollection.loadParamFromFile(fname, tofPIDOpts.parametrizationPath.value); - LOG(info) << "+++ Loaded parameter collection from file +++"; - if (!paramCollection.retrieveParameters(mRespParamsV2, tofPIDOpts.passName.value)) { - if (tofPIDOpts.fatalOnPassNotAvailable) { - LOGF(fatal, "Pass '%s' not available in the retrieved CCDB object", tofPIDOpts.passName.value.data()); - } else { - LOGF(warning, "Pass '%s' not available in the retrieved CCDB object", tofPIDOpts.passName.value.data()); - } - } else { - mRespParamsV2.setShiftParameters(paramCollection.getPars(tofPIDOpts.passName.value)); - mRespParamsV2.printShiftParameters(); - } - } else { - mRespParamsV2.loadParamFromFile(fname.data(), tofPIDOpts.parametrizationPath.value); - } - } else if (tofPIDOpts.loadResponseFromCCDB) { // Loading it from CCDB - LOG(info) << "Loading exp. sigma parametrization from CCDB, using path: " << tofPIDOpts.parametrizationPath.value << " for timestamp " << tofPIDOpts.timestamp.value; - o2::tof::ParameterCollection* paramCollection = ccdb->getForTimeStamp(tofPIDOpts.parametrizationPath.value, tofPIDOpts.timestamp.value); - paramCollection->print(); - if (!paramCollection->retrieveParameters(mRespParamsV2, tofPIDOpts.passName.value)) { // Attempt at loading the parameters with the pass defined - if (tofPIDOpts.fatalOnPassNotAvailable) { - LOGF(fatal, "Pass '%s' not available in the retrieved CCDB object", tofPIDOpts.passName.value.data()); - } else { - LOGF(warning, "Pass '%s' not available in the retrieved CCDB object", tofPIDOpts.passName.value.data()); - } - } else { // Pass is available, load non standard parameters - mRespParamsV2.setShiftParameters(paramCollection->getPars(tofPIDOpts.passName.value)); - mRespParamsV2.printShiftParameters(); - } - } - mRespParamsV2.print(); - if (tofPIDOpts.timeShiftCCDBPath.value != "") { - if (tofPIDOpts.timeShiftCCDBPath.value.find(".root") != std::string::npos) { - mRespParamsV2.setTimeShiftParameters(tofPIDOpts.timeShiftCCDBPath.value, "gmean_Pos", true); - mRespParamsV2.setTimeShiftParameters(tofPIDOpts.timeShiftCCDBPath.value, "gmean_Neg", false); - } else { - mRespParamsV2.setTimeShiftParameters(ccdb->getForTimeStamp(Form("%s/pos", tofPIDOpts.timeShiftCCDBPath.value.c_str()), tofPIDOpts.timestamp.value), true); - mRespParamsV2.setTimeShiftParameters(ccdb->getForTimeStamp(Form("%s/neg", tofPIDOpts.timeShiftCCDBPath.value.c_str()), tofPIDOpts.timestamp.value), false); - } - } - - bachelorTOFPID.SetParams(mRespParamsV2); - bachelorTOFPIDLabeled.SetParams(mRespParamsV2); + mTOFCalibConfig.processSetup(mRespParamsV3, ccdb, bc); return true; } @@ -772,9 +712,9 @@ struct decay3bodyBuilder { tofNSigmaDeuteron = trackDeuteron.tofNSigmaDe(); } else if constexpr (soa::is_table) { // running over AO2Ds if constexpr (soa::is_table) { // running over MC (track table with labels) - tofNSigmaDeuteron = getTOFnSigma(collision, trackDeuteron); + tofNSigmaDeuteron = getTOFnSigma(mRespParamsV3, collision, trackDeuteron); } else { // running over real data - tofNSigmaDeuteron = getTOFnSigma(collision, trackDeuteron); + tofNSigmaDeuteron = getTOFnSigma(mRespParamsV3, collision, trackDeuteron); } } @@ -1087,15 +1027,15 @@ struct decay3bodyBuilder { // ______________________________________________________________ // function to calculate correct TOF nSigma for deuteron track template - double getTOFnSigma(TCollision const& collision, TTrack const& track) + double getTOFnSigma(o2::pid::tof::TOFResoParamsV3 const& parameters, TCollision const& collision, TTrack const& track) { // TOF PID of deuteron if (track.has_collision() && track.hasTOF()) { auto originalcol = track.template collision_as(); if constexpr (isMC) { - return bachelorTOFPIDLabeled.GetTOFNSigma(track, originalcol, collision); + return bachelorTOFPIDLabeled.GetTOFNSigma(parameters, track, originalcol, collision); } else { - return bachelorTOFPID.GetTOFNSigma(track, originalcol, collision); + return bachelorTOFPID.GetTOFNSigma(parameters, track, originalcol, collision); } } return -999; @@ -1385,6 +1325,7 @@ struct decay3bodyBuilder { WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { + metadataInfo.initMetadata(cfgc); return WorkflowSpec{ adaptAnalysisTask(cfgc)}; } diff --git a/PWGLF/TableProducer/Nuspex/hyperkinkRecoTask.cxx b/PWGLF/TableProducer/Nuspex/hyperkinkRecoTask.cxx index e465cee83fc..7d2d3fe82e6 100644 --- a/PWGLF/TableProducer/Nuspex/hyperkinkRecoTask.cxx +++ b/PWGLF/TableProducer/Nuspex/hyperkinkRecoTask.cxx @@ -15,6 +15,8 @@ #include "PWGLF/DataModel/LFHyperNucleiKinkTables.h" #include "PWGLF/DataModel/LFKinkDecayTables.h" +#include "PWGLF/DataModel/LFPIDTOFGenericTables.h" +#include "PWGLF/Utils/pidTOFGeneric.h" #include "Common/Core/RecoDecay.h" #include "Common/Core/trackUtilities.h" @@ -43,10 +45,12 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; -using CollisionsFull = soa::Join; +o2::common::core::MetadataHelper metadataInfo; + +using CollisionsFull = soa::Join; using MCLabeledCollisionsFull = soa::Join; -using FullTracksExtIU = soa::Join; -using MCLabeledTracksIU = soa::Join; +using FullTracksExtIU = soa::Join; +using MCLabeledTracksIU = soa::Join; enum PartType { kHypertriton = 0, @@ -278,6 +282,25 @@ float getITSNSigma(const TTrack& track, o2::aod::ITSResponse& itsResponse, o2::t return nSigma; } +//-------------------------------------------------------------- +// get default TOFNSigma for daughter track +template +float getDefaultTOFNSigma(const TTrack& track, o2::track::PID partType) +{ + float nSigma = -999.f; + switch (partType) { + case o2::track::PID::Alpha: + nSigma = track.tofNSigmaAl(); + break; + case o2::track::PID::Triton: + nSigma = track.tofNSigmaTr(); + break; + default: + break; + } + return nSigma; +} + //-------------------------------------------------------------- // get TPCNSigma for daughter track template @@ -346,6 +369,7 @@ struct HypKinkCandidate { uint32_t itsClusterSizeDaug = 0u; float nSigmaTPCDaug = -999.f; float nSigmaITSDaug = -999.f; + float nSigmaTOFDaug = -999.f; // recalculated TOF NSigma // mc information bool isSignal = false; @@ -382,7 +406,8 @@ struct HyperkinkRecoTask { // Configurable for event selection Configurable doEventCut{"doEventCut", true, "Apply event selection"}; Configurable maxZVertex{"maxZVertex", 10.0f, "Accepted z-vertex range (cm)"}; - Configurable cutNSigmaDaug{"cutNSigmaDaug", 5, "TPC NSigmaTPC cut for daughter tracks"}; + Configurable cutTPCNSigmaDaug{"cutTPCNSigmaDaug", 5, "TPC NSigma cut for daughter tracks"}; + Configurable cutTOFNSigmaDaug{"cutTOFNSigmaDaug", 1000, "TOF NSigma cut for daughter tracks"}; // CCDB options Configurable inputBz{"inputBz", -999, "bz field, -999 is automatic"}; @@ -402,7 +427,14 @@ struct HyperkinkRecoTask { std::array pdgDaug = {o2::constants::physics::Pdg::kTriton, PDG_t::kPi0}; // pdgcode of charged (0) and neutral (1) daughter particles o2::track::PID pidTypeDaug = o2::track::PID::Triton; - void init(InitContext&) + // secondary TOF PID + o2::aod::pidtofgeneric::TofPidNewCollision secondaryTOFPID; // to be updated in Init based on the hypothesis + o2::aod::pidtofgeneric::TofPidNewCollision secondaryTOFPIDLabeled; // to be updated in Init based on the hypothesis + // TOF response and input parameters + o2::pid::tof::TOFResoParamsV3 mRespParamsV3; + o2::aod::pidtofgeneric::TOFCalibConfig mTOFCalibConfig; // TOF Calib configuration + + void init(InitContext& initContext) { if (hypoMoth == kHypertriton) { massChargedDaug = o2::constants::physics::MassTriton; @@ -453,6 +485,11 @@ struct HyperkinkRecoTask { registry.add("hDCAXYMothToRecSV", "hDCAXYMothToRecSV", HistType::kTH1F, {{200, -10, 10}}); registry.add("hDCAZMothToRecSV", "hDCAZMothToRecSV", HistType::kTH1F, {{200, -10, 10}}); + + registry.add("hDaugOldTOFNSigma_CorrectCol", "hDaugOldTOFNSigma_CorrectCol", HistType::kTH1F, {{600, -300, 300}}); + registry.add("hDaugOldTOFNSigma_WrongCol", "hDaugOldTOFNSigma_WrongCol", HistType::kTH1F, {{600, -300, 300}}); + registry.add("hDaugNewTOFNSigma_CorrectCol", "hDaugNewTOFNSigma_CorrectCol", HistType::kTH1F, {{600, -300, 300}}); + registry.add("hDaugNewTOFNSigma_WrongCol", "hDaugNewTOFNSigma_WrongCol", HistType::kTH1F, {{600, -300, 300}}); } registry.add("h2MothMassPt", "h2MothMassPt", HistType::kTH2F, {{ptAxis, massAxis}}); @@ -462,9 +499,15 @@ struct HyperkinkRecoTask { ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); ccdb->setFatalWhenNull(false); + + mTOFCalibConfig.metadataInfo = metadataInfo; + mTOFCalibConfig.inheritFromBaseTask(initContext); + mTOFCalibConfig.initSetup(mRespParamsV3, ccdb); + secondaryTOFPID.SetPidType(pidTypeDaug); + secondaryTOFPIDLabeled.SetPidType(pidTypeDaug); } - void initCCDB(aod::BCs::iterator const& bc) + void initCCDB(aod::BCsWithTimestamps::iterator const& bc) { if (mRunNumber == bc.runNumber()) { return; @@ -481,6 +524,24 @@ struct HyperkinkRecoTask { } o2::base::Propagator::Instance()->setMatLUT(lut); LOG(info) << "Task initialized for run " << mRunNumber << " with magnetic field " << mBz << " kZG"; + + mTOFCalibConfig.processSetup(mRespParamsV3, ccdb, bc); + } + + // ______________________________________________________________ + // get recalulate TOFNSigma for daughter track + template + double getTOFNSigma(o2::pid::tof::TOFResoParamsV3 const& parameters, TTrack const& track, TCollision const& collision, TCollision const& originalcol) + { + // TOF PID of deuteron + if (track.has_collision() && track.hasTOF()) { + if constexpr (isMC) { + return secondaryTOFPIDLabeled.GetTOFNSigma(parameters, track, originalcol, collision); + } else { + return secondaryTOFPID.GetTOFNSigma(parameters, track, originalcol, collision); + } + } + return -999; } template @@ -554,7 +615,7 @@ struct HyperkinkRecoTask { } template - void fillCandidateMCInfo(HypKinkCandidate& hypkinkCand, TMCParticle const& mcMothTrack, TMCParticle const& mcDaugTrack, TMCParticle const& mcNeutDauTrack) + void fillCandidateMCInfo(HypKinkCandidate& hypkinkCand, TMCParticle const& mcMothTrack, TMCParticle const& mcDaugTrack, TMCParticle const& mcNeutDaugTrack) { hypkinkCand.truePosSV[0] = mcDaugTrack.vx(); hypkinkCand.truePosSV[1] = mcDaugTrack.vy(); @@ -562,15 +623,15 @@ struct HyperkinkRecoTask { hypkinkCand.trueMomMothPV[0] = mcMothTrack.px(); hypkinkCand.trueMomMothPV[1] = mcMothTrack.py(); hypkinkCand.trueMomMothPV[2] = mcMothTrack.pz(); - hypkinkCand.trueMomMothSV[0] = mcDaugTrack.px() + mcNeutDauTrack.px(); - hypkinkCand.trueMomMothSV[1] = mcDaugTrack.py() + mcNeutDauTrack.py(); - hypkinkCand.trueMomMothSV[2] = mcDaugTrack.pz() + mcNeutDauTrack.pz(); + hypkinkCand.trueMomMothSV[0] = mcDaugTrack.px() + mcNeutDaugTrack.px(); + hypkinkCand.trueMomMothSV[1] = mcDaugTrack.py() + mcNeutDaugTrack.py(); + hypkinkCand.trueMomMothSV[2] = mcDaugTrack.pz() + mcNeutDaugTrack.pz(); hypkinkCand.trueMomDaugSV[0] = mcDaugTrack.px(); hypkinkCand.trueMomDaugSV[1] = mcDaugTrack.py(); hypkinkCand.trueMomDaugSV[2] = mcDaugTrack.pz(); } - void processData(CollisionsFull const& collisions, aod::KinkCands const& KinkCands, FullTracksExtIU const&, aod::BCs const&) + void processData(CollisionsFull const& collisions, aod::KinkCands const& KinkCands, FullTracksExtIU const&, aod::BCsWithTimestamps const&) { for (const auto& collision : collisions) { registry.fill(HIST("hEventCounter"), 0); @@ -589,9 +650,9 @@ struct HyperkinkRecoTask { } registry.fill(HIST("hCandidateCounter"), 1); - auto dauTrack = kinkCand.trackDaug_as(); - float tpcNSigmaDaug = getTPCNSigma(dauTrack, pidTypeDaug); - if (std::abs(tpcNSigmaDaug) > cutNSigmaDaug) { + auto daugTrack = kinkCand.trackDaug_as(); + float tpcNSigmaDaug = getTPCNSigma(daugTrack, pidTypeDaug); + if (std::abs(tpcNSigmaDaug) > cutTPCNSigmaDaug) { continue; } float invMass = RecoDecay::m(std::array{std::array{kinkCand.pxDaug(), kinkCand.pyDaug(), kinkCand.pzDaug()}, std::array{kinkCand.pxDaugNeut(), kinkCand.pyDaugNeut(), kinkCand.pzDaugNeut()}}, std::array{massChargedDaug, massNeutralDaug}); @@ -599,11 +660,20 @@ struct HyperkinkRecoTask { registry.fill(HIST("h2MothMassPt"), kinkCand.mothSign() * kinkCand.ptMoth(), invMass); registry.fill(HIST("h2DaugTPCNSigmaPt"), kinkCand.mothSign() * kinkCand.ptDaug(), tpcNSigmaDaug); - auto bc = collision.bc_as(); + auto bc = collision.bc_as(); initCCDB(bc); auto motherTrack = kinkCand.trackMoth_as(); HypKinkCandidate hypkinkCand; - fillCandidate(hypkinkCand, collision, kinkCand, motherTrack, dauTrack); + fillCandidate(hypkinkCand, collision, kinkCand, motherTrack, daugTrack); + float nSigmaTOF = -999.f; + if (daugTrack.hasTOF() && daugTrack.has_collision()) { + auto originalDaugCol = daugTrack.collision_as(); + nSigmaTOF = getTOFNSigma(mRespParamsV3, daugTrack, collision, originalDaugCol); + } + if (std::abs(nSigmaTOF) > cutTOFNSigmaDaug) { + continue; + } + hypkinkCand.nSigmaTOFDaug = nSigmaTOF; o2::dataformats::VertexBase primaryVtx = {{collision.posX(), collision.posY(), collision.posZ()}, {collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()}}; o2::dataformats::VertexBase secondaryVtx = {{kinkCand.xDecVtx() + collision.posX(), kinkCand.yDecVtx() + collision.posY(), kinkCand.zDecVtx() + collision.posZ()}, {covPosSV[0], covPosSV[1], covPosSV[2], covPosSV[3], covPosSV[4], covPosSV[5]}}; @@ -628,12 +698,12 @@ struct HyperkinkRecoTask { hypkinkCand.momDaugSV[0], hypkinkCand.momDaugSV[1], hypkinkCand.momDaugSV[2], hypkinkCand.dcaXYMothPv, hypkinkCand.dcaXYDaugPv, hypkinkCand.dcaKinkTopo, hypkinkCand.chi2ITSMoth, hypkinkCand.itsClusterSizeMoth, hypkinkCand.itsClusterSizeDaug, - hypkinkCand.nSigmaTPCDaug, hypkinkCand.nSigmaITSDaug); + hypkinkCand.nSigmaTPCDaug, hypkinkCand.nSigmaITSDaug, hypkinkCand.nSigmaTOFDaug); } } PROCESS_SWITCH(HyperkinkRecoTask, processData, "process data", true); - void processMC(MCLabeledCollisionsFull const& collisions, aod::KinkCands const& KinkCands, MCLabeledTracksIU const& tracks, aod::McParticles const& particlesMC, aod::McCollisions const& mcCollisions, aod::BCs const&) + void processMC(MCLabeledCollisionsFull const& collisions, aod::KinkCands const& KinkCands, MCLabeledTracksIU const& tracks, aod::McParticles const& particlesMC, aod::McCollisions const& mcCollisions, aod::BCsWithTimestamps const&) { mcPartIndices.clear(); std::vector mcPartIndices; @@ -657,12 +727,12 @@ struct HyperkinkRecoTask { for (const auto& kinkCand : KinkCands) { auto motherTrack = kinkCand.trackMoth_as(); - auto dauTrack = kinkCand.trackDaug_as(); + auto daugTrack = kinkCand.trackDaug_as(); bool isKinkSignal = false; - if (motherTrack.has_mcParticle() && dauTrack.has_mcParticle()) { + if (motherTrack.has_mcParticle() && daugTrack.has_mcParticle()) { auto mcMothTrack = motherTrack.mcParticle_as(); - auto mcDaugTrack = dauTrack.mcParticle_as(); + auto mcDaugTrack = daugTrack.mcParticle_as(); if (hypoMoth == kHypertriton) { auto dChannel = H3LDecay::getDecayChannel(mcMothTrack, dauIDList); if (dChannel == H3LDecay::k2bodyNeutral && dauIDList[0] == mcDaugTrack.globalIndex()) { @@ -689,8 +759,8 @@ struct HyperkinkRecoTask { registry.fill(HIST("hTrueCandidateCounter"), 1); } - float tpcNSigmaDaug = getTPCNSigma(dauTrack, pidTypeDaug); - if (std::abs(tpcNSigmaDaug) > cutNSigmaDaug) { + float tpcNSigmaDaug = getTPCNSigma(daugTrack, pidTypeDaug); + if (std::abs(tpcNSigmaDaug) > cutTPCNSigmaDaug) { continue; } float invMass = RecoDecay::m(std::array{std::array{kinkCand.pxDaug(), kinkCand.pyDaug(), kinkCand.pzDaug()}, std::array{kinkCand.pxDaugNeut(), kinkCand.pyDaugNeut(), kinkCand.pzDaugNeut()}}, std::array{massChargedDaug, massNeutralDaug}); @@ -701,10 +771,27 @@ struct HyperkinkRecoTask { registry.fill(HIST("h2MothMassPt"), kinkCand.mothSign() * kinkCand.ptMoth(), invMass); registry.fill(HIST("h2DaugTPCNSigmaPt"), kinkCand.mothSign() * kinkCand.ptDaug(), tpcNSigmaDaug); - auto bc = collision.bc_as(); + auto bc = collision.bc_as(); initCCDB(bc); HypKinkCandidate hypkinkCand; - fillCandidate(hypkinkCand, collision, kinkCand, motherTrack, dauTrack); + fillCandidate(hypkinkCand, collision, kinkCand, motherTrack, daugTrack); + float nSigmaTOF = -999.f; + if (daugTrack.hasTOF() && daugTrack.has_collision()) { + auto originalDaugCol = daugTrack.collision_as(); + float defaultNSigmaTOF = getDefaultTOFNSigma(daugTrack, pidTypeDaug); + nSigmaTOF = getTOFNSigma(mRespParamsV3, daugTrack, collision, originalDaugCol); + if (originalDaugCol.globalIndex() == collision.globalIndex()) { + registry.fill(HIST("hDaugOldTOFNSigma_CorrectCol"), defaultNSigmaTOF); + registry.fill(HIST("hDaugNewTOFNSigma_CorrectCol"), nSigmaTOF); + } else { + registry.fill(HIST("hDaugOldTOFNSigma_WrongCol"), defaultNSigmaTOF); + registry.fill(HIST("hDaugNewTOFNSigma_WrongCol"), nSigmaTOF); + } + } + if (std::abs(nSigmaTOF) > cutTOFNSigmaDaug) { + continue; + } + hypkinkCand.nSigmaTOFDaug = nSigmaTOF; std::array posDecVtx = {kinkCand.xDecVtx() + collision.posX(), kinkCand.yDecVtx() + collision.posY(), kinkCand.zDecVtx() + collision.posZ()}; @@ -722,7 +809,7 @@ struct HyperkinkRecoTask { // QA, store mcInfo for true signals if (isKinkSignal) { auto mcMothTrack = motherTrack.mcParticle_as(); - auto mcDaugTrack = dauTrack.mcParticle_as(); + auto mcDaugTrack = daugTrack.mcParticle_as(); auto mcNeutTrack = particlesMC.rawIteratorAt(dauIDList[1]); float recSVR = std::sqrt(posDecVtx[0] * posDecVtx[0] + posDecVtx[1] * posDecVtx[1]); registry.fill(HIST("hDiffSVx"), posDecVtx[0] - mcDaugTrack.vx()); @@ -763,7 +850,7 @@ struct HyperkinkRecoTask { hypkinkCand.momDaugSV[0], hypkinkCand.momDaugSV[1], hypkinkCand.momDaugSV[2], hypkinkCand.dcaXYMothPv, hypkinkCand.dcaXYDaugPv, hypkinkCand.dcaKinkTopo, hypkinkCand.chi2ITSMoth, hypkinkCand.itsClusterSizeMoth, hypkinkCand.itsClusterSizeDaug, - hypkinkCand.nSigmaTPCDaug, hypkinkCand.nSigmaITSDaug, + hypkinkCand.nSigmaTPCDaug, hypkinkCand.nSigmaITSDaug, hypkinkCand.nSigmaTOFDaug, hypkinkCand.isSignal, hypkinkCand.isSignalReco, hypkinkCand.isCollReco, hypkinkCand.isSurvEvSelection, hypkinkCand.truePosSV[0], hypkinkCand.truePosSV[1], hypkinkCand.truePosSV[2], hypkinkCand.trueMomMothPV[0], hypkinkCand.trueMomMothPV[1], hypkinkCand.trueMomMothPV[2], @@ -792,7 +879,7 @@ struct HyperkinkRecoTask { auto mothTrack = tracks.rawIteratorAt(mcPartIndices[mcparticle.globalIndex()]); if (mothTrack.has_collision()) { auto collision = mothTrack.collision_as(); - auto bc = collision.template bc_as(); + auto bc = collision.template bc_as(); initCCDB(bc); fillCandidateRecoMoth(hypkinkCand, collision, mothTrack); } @@ -810,7 +897,7 @@ struct HyperkinkRecoTask { -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, + -1, -1, -1, true, false, isReconstructedMCCollisions[mcparticle.mcCollisionId()], isSelectedMCCollisions[mcparticle.mcCollisionId()], hypkinkCand.truePosSV[0], hypkinkCand.truePosSV[1], hypkinkCand.truePosSV[2], hypkinkCand.trueMomMothPV[0], hypkinkCand.trueMomMothPV[1], hypkinkCand.trueMomMothPV[2], @@ -1076,7 +1163,7 @@ struct HyperkinkQa { } PROCESS_SWITCH(HyperkinkQa, processData, "process data", true); - void processMC(aod::McCollisions const& mcCollisions, aod::McParticles const& particlesMC, MCLabeledCollisionsFull const& collisions, MCLabeledTracksIU const& tracks, aod::BCs const&) + void processMC(aod::McCollisions const& mcCollisions, aod::McParticles const& particlesMC, MCLabeledCollisionsFull const& collisions, MCLabeledTracksIU const& tracks, aod::BCsWithTimestamps const&) { std::vector mcPartIndices; setTrackIDForMC(mcPartIndices, particlesMC, tracks); @@ -1241,7 +1328,9 @@ struct HyperkinkQa { WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { + metadataInfo.initMetadata(cfgc); return WorkflowSpec{ + // Parse the metadata adaptAnalysisTask(cfgc), adaptAnalysisTask(cfgc), }; diff --git a/PWGLF/TableProducer/Nuspex/pidTOFGeneric.cxx b/PWGLF/TableProducer/Nuspex/pidTOFGeneric.cxx index 9997d4d27c8..7a3afb2b71d 100644 --- a/PWGLF/TableProducer/Nuspex/pidTOFGeneric.cxx +++ b/PWGLF/TableProducer/Nuspex/pidTOFGeneric.cxx @@ -11,33 +11,37 @@ /// /// \file pidTOFGeneric.cxx -/// \origin Based on pidTOFBase.cxx +/// \origin Based on pidTOFMerged.cxx /// \brief Task to produce event Time obtained from TOF and FT0. -/// In order to redo TOF PID for tracks which are linked to wrong collisions +/// In order to redo TOF PID for secondary tracks which are linked to wrong collisions +/// \author Yuanzhe Wang /// +#include #include #include -#include // O2 includes #include "CCDB/BasicCCDBManager.h" -#include "TOFBase/EventTimeMaker.h" #include "Framework/AnalysisTask.h" #include "ReconstructionDataFormats/Track.h" +#include "TOFBase/EventTimeMaker.h" // O2Physics includes +#include "PWGLF/DataModel/LFPIDTOFGenericTables.h" +#include "PWGLF/Utils/pidTOFGeneric.h" + #include "Common/Core/TableHelper.h" -#include "Common/DataModel/TrackSelectionTables.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/FT0Corrected.h" #include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" + #include "Framework/HistogramRegistry.h" #include "Framework/runDataProcessing.h" -#include "PID/ParamBase.h" #include "PID/PIDTOF.h" -#include "PWGLF/DataModel/pidTOFGeneric.h" +#include "PID/ParamBase.h" using namespace o2; using namespace o2::framework; @@ -45,13 +49,19 @@ using namespace o2::pid; using namespace o2::framework::expressions; using namespace o2::track; +o2::common::core::MetadataHelper metadataInfo; + /// Selection criteria for tracks used for TOF event time float trackSampleMinMomentum = 0.5f; float trackSampleMaxMomentum = 2.f; template bool filterForTOFEventTime(const trackType& tr) { - return (tr.hasTOF() && tr.p() > trackSampleMinMomentum && tr.p() < trackSampleMaxMomentum && (tr.trackType() == o2::aod::track::TrackTypeEnum::Track || tr.trackType() == o2::aod::track::TrackTypeEnum::TrackIU)); + return (tr.hasTOF() && + tr.p() > trackSampleMinMomentum && tr.p() < trackSampleMaxMomentum && + tr.hasITS() && + tr.hasTPC() && + (tr.trackType() == o2::aod::track::TrackTypeEnum::Track || tr.trackType() == o2::aod::track::TrackTypeEnum::TrackIU)); } // accept all /// Specialization of TOF event time maker @@ -69,342 +79,275 @@ o2::tof::eventTimeContainer evTimeMakerForTracks(const trackTypeContainer& track } /// Task to produce the event time tables for generic TOF PID +/// Modified based on pidTOFMerge.cxx struct pidTOFGeneric { // Tables to produce Produces tableEvTime; // Table for global event time Produces tableEvTimeForTrack; // Table for event time after removing bias from the track - static constexpr float diamond = 6.0; // Collision diamond used in the estimation of the TOF event time - static constexpr float errDiamond = diamond * 33.356409f; - static constexpr float weightDiamond = 1.f / (errDiamond * errDiamond); + static constexpr bool kRemoveTOFEvTimeBias = true; // Flag to subtract the Ev. Time bias for low multiplicity events with TOF + static constexpr float kDiamond = 6.0; // Collision diamond used in the estimation of the TOF event time + static constexpr float kErrDiamond = kDiamond * 33.356409f; + static constexpr float kWeightDiamond = 1.f / (kErrDiamond * kErrDiamond); bool enableTable = false; - // Detector response and input parameters - o2::pid::tof::TOFResoParamsV2 mRespParamsV2; - Service ccdb; - Configurable inheritFromBaseTask{"inheritFromBaseTask", true, "Flag to iherit all common configurables from the TOF base task"}; + Configurable fastTOFPID{"fastTOFPID", false, "Flag to enable computeEvTimeFast for evTimeMaker"}; - // CCDB configuration (inherited from TOF signal task) - Configurable url{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Configurable timestamp{"ccdb-timestamp", -1, "timestamp of the object"}; // Event time configurations Configurable minMomentum{"minMomentum", 0.5f, "Minimum momentum to select track sample for TOF event time"}; Configurable maxMomentum{"maxMomentum", 2.0f, "Maximum momentum to select track sample for TOF event time"}; Configurable maxEvTimeTOF{"maxEvTimeTOF", 100000.0f, "Maximum value of the TOF event time"}; Configurable sel8TOFEvTime{"sel8TOFEvTime", false, "Flag to compute the ev. time only for events that pass the sel8 ev. selection"}; + Configurable mComputeEvTimeWithTOF{"computeEvTimeWithTOF", -1, "Compute ev. time with TOF. -1 (autoset), 0 no, 1 yes"}; + Configurable mComputeEvTimeWithFT0{"computeEvTimeWithFT0", -1, "Compute ev. time with FT0. -1 (autoset), 0 no, 1 yes"}; Configurable maxNtracksInSet{"maxNtracksInSet", 10, "Size of the set to consider for the TOF ev. time computation"}; - // TOF Calib configuration - Configurable paramFileName{"paramFileName", "", "Path to the parametrization object. If empty the parametrization is not taken from file"}; - Configurable parametrizationPath{"parametrizationPath", "TOF/Calib/Params", "Path of the TOF parametrization on the CCDB or in the file, if the paramFileName is not empty"}; - Configurable passName{"passName", "", "Name of the pass inside of the CCDB parameter collection. If empty, the automatically deceted from metadata (to be implemented!!!)"}; - Configurable loadResponseFromCCDB{"loadResponseFromCCDB", false, "Flag to load the response from the CCDB"}; - Configurable enableTimeDependentResponse{"enableTimeDependentResponse", false, "Flag to use the collision timestamp to fetch the PID Response"}; - Configurable fatalOnPassNotAvailable{"fatalOnPassNotAvailable", true, "Flag to throw a fatal if the pass is not available in the retrieved CCDB object"}; + + // TOF response and input parameters + o2::pid::tof::TOFResoParamsV3 mRespParamsV3; + Service ccdb; + o2::aod::pidtofgeneric::TOFCalibConfig mTOFCalibConfig; // TOF Calib configuration void init(o2::framework::InitContext& initContext) { - if (inheritFromBaseTask.value) { - if (!getTaskOptionValue(initContext, "tof-signal", "ccdb-url", url.value, true)) { - LOG(fatal) << "Could not get ccdb-url from tof-signal task"; - } - if (!getTaskOptionValue(initContext, "tof-signal", "ccdb-timestamp", timestamp.value, true)) { - LOG(fatal) << "Could not get ccdb-timestamp from tof-signal task"; - } - } - - trackSampleMinMomentum = minMomentum; - trackSampleMaxMomentum = maxMomentum; - LOG(info) << "Configuring track sample for TOF ev. time: " << trackSampleMinMomentum << " < p < " << trackSampleMaxMomentum; - // Check that both processes are not enabled - int nEnabled = 0; - if (doprocessNoFT0 == true) { - LOGF(info, "Enabling process function: processNoFT0"); - nEnabled++; - } - if (doprocessFT0 == true) { - LOGF(info, "Enabling process function: processFT0"); - nEnabled++; - } - if (doprocessOnlyFT0 == true) { - LOGF(info, "Enabling process function: processOnlyFT0"); - nEnabled++; - } - if (nEnabled > 1) { - LOGF(fatal, "Cannot enable more process functions at the same time. Please choose one."); - } + mTOFCalibConfig.metadataInfo = metadataInfo; + mTOFCalibConfig.inheritFromBaseTask(initContext); // Checking that the table is requested in the workflow and enabling it enableTable = isTableRequiredInWorkflow(initContext, "EvTimeTOFFT0") || isTableRequiredInWorkflow(initContext, "EvTimeTOFFT0ForTrack"); if (!enableTable) { LOG(info) << "Table for global Event time is not required, disabling it"; - return; + // return; //TODO: uncomment this line } + enableTable = true; // Force enabling the table for now LOG(info) << "Table EvTimeTOFFT0 enabled!"; - if (sel8TOFEvTime.value == true) { - LOG(info) << "TOF event time will be computed for collisions that pass the event selection only!"; - } - // Getting the parametrization parameters - ccdb->setURL(url.value); - ccdb->setTimestamp(timestamp.value); - ccdb->setCaching(true); - ccdb->setLocalObjectValidityChecking(); - // Not later than now objects - ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); - // - - // TODO: implement the automatic pass name detection from metadata - if (passName.value == "") { - passName.value = "unanchored"; // temporary default - LOG(warning) << "Passed autodetect mode for pass, not implemented yet, waiting for metadata. Taking '" << passName.value << "'"; - } - LOG(info) << "Using parameter collection, starting from pass '" << passName.value << "'"; - - const std::string fname = paramFileName.value; - if (!fname.empty()) { // Loading the parametrization from file - LOG(info) << "Loading exp. sigma parametrization from file " << fname << ", using param: " << parametrizationPath.value; - if (1) { - o2::tof::ParameterCollection paramCollection; - paramCollection.loadParamFromFile(fname, parametrizationPath.value); - LOG(info) << "+++ Loaded parameter collection from file +++"; - if (!paramCollection.retrieveParameters(mRespParamsV2, passName.value)) { - if (fatalOnPassNotAvailable) { - LOGF(fatal, "Pass '%s' not available in the retrieved CCDB object", passName.value.data()); - } else { - LOGF(warning, "Pass '%s' not available in the retrieved CCDB object", passName.value.data()); - } - } else { - mRespParamsV2.setShiftParameters(paramCollection.getPars(passName.value)); - mRespParamsV2.printShiftParameters(); - } - } else { - mRespParamsV2.loadParamFromFile(fname.data(), parametrizationPath.value); - } - } else if (loadResponseFromCCDB) { // Loading it from CCDB - LOG(info) << "Loading exp. sigma parametrization from CCDB, using path: " << parametrizationPath.value << " for timestamp " << timestamp.value; - - o2::tof::ParameterCollection* paramCollection = ccdb->getForTimeStamp(parametrizationPath.value, timestamp.value); - paramCollection->print(); - if (!paramCollection->retrieveParameters(mRespParamsV2, passName.value)) { - if (fatalOnPassNotAvailable) { - LOGF(fatal, "Pass '%s' not available in the retrieved CCDB object", passName.value.data()); - } else { - LOGF(warning, "Pass '%s' not available in the retrieved CCDB object", passName.value.data()); + if (mTOFCalibConfig.autoSetProcessFunctions()) { + LOG(info) << "Autodetecting process functions"; + if (metadataInfo.isFullyDefined()) { + if (metadataInfo.isRun3()) { + doprocessRun3.value = true; } - } else { - mRespParamsV2.setShiftParameters(paramCollection->getPars(passName.value)); - mRespParamsV2.printShiftParameters(); } } - mRespParamsV2.print(); - o2::tof::eventTimeContainer::setMaxNtracksInSet(maxNtracksInSet.value); - o2::tof::eventTimeContainer::printConfig(); - } - /// - /// Process function to prepare the event time on Run 3 data without the FT0 - using TrksEvTime = soa::Join; - // Define slice per collision - Preslice perCollision = aod::track::collisionId; - template - using ResponseImplementationEvTime = o2::pid::tof::ExpTimes; - using EvTimeCollisions = soa::Join; - void processNoFT0(TrksEvTime& tracks, - EvTimeCollisions const& collisions) - { - if (!enableTable) { - return; - } - tableEvTime.reserve(collisions.size()); - tableEvTimeForTrack.reserve(tracks.size()); - - // for tracks not assigned to a collision - for (auto track : tracks) { - if (!track.has_collision()) { - tableEvTimeForTrack(0.f, 999.f); + if (metadataInfo.isFullyDefined()) { + if (!metadataInfo.isRun3()) { + LOG(fatal) << "Run3 process not supported in pidTOFGeneric task"; } } - for (auto const& collision : collisions) { // Loop on collisions - const auto& tracksInCollision = tracks.sliceBy(perCollision, collision.globalIndex()); - if ((sel8TOFEvTime.value == true) && !collision.sel8()) { - tableEvTime(0.f, 999.f, 0.f, 999.f, 0.f, 999.f); - for (int i = 0; i < tracksInCollision.size(); i++) { - tableEvTimeForTrack(0.f, 999.f); - } - continue; - } - - // First make table for event time - const auto evTimeTOF = evTimeMakerForTracks(tracksInCollision, mRespParamsV2, diamond, fastTOFPID); - int nGoodTracksForTOF = 0; // count for ntrackIndex for removeBias() - float et = evTimeTOF.mEventTime; - float erret = evTimeTOF.mEventTimeError; + trackSampleMinMomentum = minMomentum; + trackSampleMaxMomentum = maxMomentum; + LOG(info) << "Configuring track sample for TOF ev. time: " << trackSampleMinMomentum << " < p < " << trackSampleMaxMomentum; - if (erret < errDiamond && (maxEvTimeTOF <= 0.f || abs(et) < maxEvTimeTOF)) { - } else { - et = 0.f; - erret = errDiamond; - } - tableEvTime(et, erret, et, erret, 0.f, 999.f); - for (auto const& track : tracksInCollision) { - evTimeTOF.removeBias(track, nGoodTracksForTOF, et, erret, 2); - if (erret < errDiamond && (maxEvTimeTOF <= 0.f || abs(et) < maxEvTimeTOF)) { - } else { - et = 0.f; - erret = errDiamond; - } - tableEvTimeForTrack(et, erret); - } + if (sel8TOFEvTime.value == true) { + LOG(info) << "TOF event time will be computed for collisions that pass the event selection only!"; } + mTOFCalibConfig.initSetup(mRespParamsV3, ccdb); // Getting the parametrization parameters + + o2::tof::eventTimeContainer::setMaxNtracksInSet(maxNtracksInSet.value); + o2::tof::eventTimeContainer::printConfig(); } - PROCESS_SWITCH(pidTOFGeneric, processNoFT0, "Process without FT0", false); + + void process(aod::BCs const&) {} /// - /// Process function to prepare the event for each track on Run 3 data with the FT0 + /// Process function to prepare the event for each track on Run 3 data without the FT0 + // Define slice per collision + using Run3Cols = aod::Collisions; + using EvTimeCollisions = soa::Join; using EvTimeCollisionsFT0 = soa::Join; - void processFT0(TrksEvTime& tracks, - aod::FT0s const&, - EvTimeCollisionsFT0 const& collisions) + using Run3Trks = o2::soa::Join; + using Run3TrksWtof = soa::Join; + Preslice perCollision = aod::track::collisionId; + template + using ResponseImplementationEvTime = o2::pid::tof::ExpTimes; + + void processRun3(Run3TrksWtof const& tracks, + aod::FT0s const&, + EvTimeCollisionsFT0 const& collisions, + aod::BCsWithTimestamps const& bcs) { if (!enableTable) { return; } + LOG(debug) << "Processing Run3 data for TOF event time"; + tableEvTime.reserve(collisions.size()); tableEvTimeForTrack.reserve(tracks.size()); - std::vector tEvTimeForTrack; - std::vector tEvTimeErrForTrack; - tEvTimeForTrack.resize(tracks.size()); - tEvTimeErrForTrack.resize(tracks.size()); - - // for tracks not assigned to a collision - for (auto track : tracks) { - if (!track.has_collision()) { - tEvTimeForTrack[track.globalIndex()] = 0.f; - tEvTimeErrForTrack[track.globalIndex()] = 999.f; + mTOFCalibConfig.processSetup(mRespParamsV3, ccdb, bcs.iteratorAt(0)); // Update the calibration parameters + + // Autoset the processing mode for the event time computation + if (mComputeEvTimeWithTOF == -1 || mComputeEvTimeWithFT0 == -1) { + switch (mTOFCalibConfig.collisionSystem()) { + case CollisionSystemType::kCollSyspp: // pp + mComputeEvTimeWithTOF.value = ((mComputeEvTimeWithTOF == -1) ? 0 : mComputeEvTimeWithTOF.value); + mComputeEvTimeWithFT0.value = ((mComputeEvTimeWithFT0 == -1) ? 1 : mComputeEvTimeWithFT0.value); + break; + case CollisionSystemType::kCollSysPbPb: // PbPb + mComputeEvTimeWithTOF.value = ((mComputeEvTimeWithTOF == -1) ? 1 : mComputeEvTimeWithTOF.value); + mComputeEvTimeWithFT0.value = ((mComputeEvTimeWithFT0 == -1) ? 0 : mComputeEvTimeWithFT0.value); + break; + default: + LOG(fatal) << "Collision system " << mTOFCalibConfig.collisionSystem() << " " << CollisionSystemType::getCollisionSystemName(mTOFCalibConfig.collisionSystem()) << " not supported for TOF event time computation"; + break; } } + LOG(debug) << "Running on " << CollisionSystemType::getCollisionSystemName(mTOFCalibConfig.collisionSystem()) << " mComputeEvTimeWithTOF " << mComputeEvTimeWithTOF.value << " mComputeEvTimeWithFT0 " << mComputeEvTimeWithFT0.value; - for (auto const& collision : collisions) { // Loop on collisions - const auto& tracksInCollision = tracks.sliceBy(perCollision, collision.globalIndex()); - if ((sel8TOFEvTime.value == true) && !collision.sel8()) { - tableEvTime(0.f, 999.f, 0.f, 999.f, 0.f, 999.f); - for (auto track : tracksInCollision) { - tEvTimeForTrack[track.globalIndex()] = 0.f; - tEvTimeErrForTrack[track.globalIndex()] = 999.f; + if (mComputeEvTimeWithTOF == 1 && mComputeEvTimeWithFT0 == 1) { + int lastCollisionId = -1; // Last collision ID analysed + for (auto const& t : tracks) { // Loop on collisions + if (!t.has_collision() || ((sel8TOFEvTime.value == true) && !t.collision_as().sel8())) { // Track was not assigned, cannot compute event time or event did not pass the event selection + tableEvTimeForTrack(0.f, 999.f); + continue; } - continue; - } - - // Compute the TOF event time - const auto evTimeTOF = evTimeMakerForTracks(tracksInCollision, mRespParamsV2, diamond, fastTOFPID); - - float t0TOF[2] = {static_cast(evTimeTOF.mEventTime), static_cast(evTimeTOF.mEventTimeError)}; // Value and error of TOF - float t0AC[2] = {.0f, 999.f}; // Value and error of T0A or T0C or T0AC + if (t.collisionId() == lastCollisionId) { // Event time from this collision is already in the table + continue; + } + /// Create new table for the tracks in a collision + lastCollisionId = t.collisionId(); /// Cache last collision ID - float eventTime = 0.f; - float sumOfWeights = 0.f; - float weight = 0.f; + const auto& tracksInCollision = tracks.sliceBy(perCollision, lastCollisionId); + const auto& collision = t.collision_as(); - if (t0TOF[1] < errDiamond && (maxEvTimeTOF <= 0 || abs(t0TOF[0]) < maxEvTimeTOF)) { - weight = 1.f / (t0TOF[1] * t0TOF[1]); - eventTime += t0TOF[0] * weight; - sumOfWeights += weight; - } + // Compute the TOF event time + const auto evTimeMakerTOF = evTimeMakerForTracks(tracksInCollision, mRespParamsV3, kDiamond, fastTOFPID); - if (collision.has_foundFT0()) { // T0 measurement is available - // const auto& ft0 = collision.foundFT0(); - if (collision.t0ACValid()) { - t0AC[0] = collision.t0AC() * 1000.f; - t0AC[1] = collision.t0resolution() * 1000.f; - } + float t0AC[2] = {.0f, 999.f}; // Value and error of T0A or T0C or T0AC + float t0TOF[2] = {static_cast(evTimeMakerTOF.mEventTime), static_cast(evTimeMakerTOF.mEventTimeError)}; // Value and error of TOF - weight = 1.f / (t0AC[1] * t0AC[1]); - eventTime += t0AC[0] * weight; - sumOfWeights += weight; - } + int nGoodTracksForTOF = 0; + float eventTime = 0.f; + float sumOfWeights = 0.f; + float weight = 0.f; - if (sumOfWeights < weightDiamond) { // avoiding sumOfWeights = 0 or worse that diamond - eventTime = 0; - sumOfWeights = weightDiamond; - } - tableEvTime(eventTime / sumOfWeights, sqrt(1. / sumOfWeights), t0TOF[0], t0TOF[1], t0AC[0], t0AC[1]); - - int nGoodTracksForTOF = 0; // count for ntrackIndex for removeBias() - for (auto const& track : tracksInCollision) { - // Reset the event time - eventTime = 0.f; - sumOfWeights = 0.f; - weight = 0.f; - // Remove the bias on TOF ev. time - evTimeTOF.removeBias(track, nGoodTracksForTOF, t0TOF[0], t0TOF[1], 2); - if (t0TOF[1] < errDiamond && (maxEvTimeTOF <= 0 || abs(t0TOF[0]) < maxEvTimeTOF)) { + if (t0TOF[1] < kErrDiamond && (maxEvTimeTOF <= 0 || std::abs(t0TOF[0]) < maxEvTimeTOF)) { weight = 1.f / (t0TOF[1] * t0TOF[1]); eventTime += t0TOF[0] * weight; sumOfWeights += weight; } - // Add the contribution from FT0 if it is available, t0AC is already calculated - if (collision.has_foundFT0()) { + if (collision.has_foundFT0()) { // T0 measurement is available + // const auto& ft0 = collision.foundFT0(); + if (collision.t0ACValid()) { + t0AC[0] = collision.t0AC() * 1000.f; + t0AC[1] = collision.t0resolution() * 1000.f; + } + weight = 1.f / (t0AC[1] * t0AC[1]); eventTime += t0AC[0] * weight; sumOfWeights += weight; } - if (sumOfWeights < weightDiamond) { // avoiding sumOfWeights = 0 or worse that diamond - eventTime = 0; - sumOfWeights = weightDiamond; + tableEvTime(eventTime / sumOfWeights, std::sqrt(1. / sumOfWeights), t0TOF[0], t0TOF[1], t0AC[0], t0AC[1]); + + for (auto const& trk : tracksInCollision) { // Loop on Tracks + // Reset the event time + eventTime = 0.f; + sumOfWeights = 0.f; + weight = 0.f; + // Remove the bias on TOF ev. time + if constexpr (kRemoveTOFEvTimeBias) { + evTimeMakerTOF.removeBias(trk, nGoodTracksForTOF, t0TOF[0], t0TOF[1], 2); + } + if (t0TOF[1] < kErrDiamond && (maxEvTimeTOF <= 0 || std::abs(t0TOF[0]) < maxEvTimeTOF)) { + weight = 1.f / (t0TOF[1] * t0TOF[1]); + eventTime += t0TOF[0] * weight; + sumOfWeights += weight; + } + + if (collision.has_foundFT0()) { // T0 measurement is available + // const auto& ft0 = collision.foundFT0(); + if (collision.t0ACValid()) { + t0AC[0] = collision.t0AC() * 1000.f; + t0AC[1] = collision.t0resolution() * 1000.f; + } + + weight = 1.f / (t0AC[1] * t0AC[1]); + eventTime += t0AC[0] * weight; + sumOfWeights += weight; + } + + if (sumOfWeights < kWeightDiamond) { // avoiding sumOfWeights = 0 or worse that kDiamond + eventTime = 0; + sumOfWeights = kWeightDiamond; + } + tableEvTimeForTrack(eventTime / sumOfWeights, std::sqrt(1. / sumOfWeights)); } - tEvTimeForTrack[track.globalIndex()] = eventTime / sumOfWeights; - tEvTimeErrForTrack[track.globalIndex()] = sqrt(1. / sumOfWeights); } - } - for (int i = 0; i < tracks.size(); i++) { - tableEvTimeForTrack(tEvTimeForTrack[i], tEvTimeErrForTrack[i]); - } - } - PROCESS_SWITCH(pidTOFGeneric, processFT0, "Process with FT0", true); + } else if (mComputeEvTimeWithTOF == 1 && mComputeEvTimeWithFT0 == 0) { + int lastCollisionId = -1; // Last collision ID analysed + for (auto const& t : tracks) { // Loop on collisions + if (!t.has_collision() || ((sel8TOFEvTime.value == true) && !t.collision_as().sel8())) { // Track was not assigned, cannot compute event time or event did not pass the event selection + tableEvTimeForTrack(0.f, 999.f); + continue; + } + if (t.collisionId() == lastCollisionId) { // Event time from this collision is already in the table + continue; + } + /// Create new table for the tracks in a collision + lastCollisionId = t.collisionId(); /// Cache last collision ID - /// - /// Process function to prepare the event time on Run 3 data with only the FT0 - void processOnlyFT0(EvTimeCollisionsFT0 const& collisions, - TrksEvTime& tracks, - aod::FT0s const&) - { - if (!enableTable) { - return; - } - tableEvTime.reserve(collisions.size()); - tableEvTimeForTrack.reserve(tracks.size()); + const auto& tracksInCollision = tracks.sliceBy(perCollision, lastCollisionId); - // for tracks not assigned to a collision - for (auto track : tracks) { - if (!track.has_collision()) { - tableEvTimeForTrack(0.f, 999.f); - } - } + // First make table for event time + const auto evTimeMakerTOF = evTimeMakerForTracks(tracksInCollision, mRespParamsV3, kDiamond, fastTOFPID); + int nGoodTracksForTOF = 0; + float et = evTimeMakerTOF.mEventTime; + float erret = evTimeMakerTOF.mEventTimeError; - for (auto const& collision : collisions) { - const auto& tracksInCollision = tracks.sliceBy(perCollision, collision.globalIndex()); - if (collision.has_foundFT0()) { // T0 measurement is available - // const auto& ft0 = collision.foundFT0(); - if (collision.t0ACValid()) { - tableEvTime(collision.t0AC() * 1000.f, collision.t0resolution() * 1000.f, 0.f, 999.f, collision.t0AC() * 1000.f, collision.t0resolution() * 1000.f); - for (int i = 0; i < tracks.size(); i++) { - tableEvTimeForTrack(collision.t0AC() * 1000.f, collision.t0resolution() * 1000.f); + if (erret < kErrDiamond && (maxEvTimeTOF <= 0.f || std::abs(et) < maxEvTimeTOF)) { + } else { + et = 0.f; + erret = kErrDiamond; + } + tableEvTime(et, erret, et, erret, 0.f, 999.f); + + for (auto const& trk : tracksInCollision) { // Loop on Tracks + if constexpr (kRemoveTOFEvTimeBias) { + evTimeMakerTOF.removeBias(trk, nGoodTracksForTOF, et, erret, 2); + } + if (erret < kErrDiamond && (maxEvTimeTOF <= 0.f || std::abs(et) < maxEvTimeTOF)) { + } else { + et = 0.f; + erret = kErrDiamond; } - return; + tableEvTimeForTrack(et, erret); + } + } + } else if (mComputeEvTimeWithTOF == 0 && mComputeEvTimeWithFT0 == 1) { + for (const auto& track : tracks) { + if (!track.has_collision()) { + tableEvTimeForTrack(0.f, 999.f); } } - tableEvTime(0.f, 999.f, 0.f, 999.f, 0.f, 999.f); - for (int i = 0; i < tracksInCollision.size(); i++) { - tableEvTimeForTrack(0.f, 999.f); + + for (auto const& collision : collisions) { + const auto& tracksInCollision = tracks.sliceBy(perCollision, collision.globalIndex()); + if (collision.has_foundFT0()) { // T0 measurement is available + // const auto& ft0 = collision.foundFT0(); + if (collision.t0ACValid()) { + tableEvTime(collision.t0AC() * 1000.f, collision.t0resolution() * 1000.f, 0.f, 999.f, collision.t0AC() * 1000.f, collision.t0resolution() * 1000.f); + for (int i = 0; i < tracksInCollision.size(); i++) { + tableEvTimeForTrack(collision.t0AC() * 1000.f, collision.t0resolution() * 1000.f); + } + continue; + } + } + tableEvTime(0.f, 999.f, 0.f, 999.f, 0.f, 999.f); + for (int i = 0; i < tracksInCollision.size(); i++) { + tableEvTimeForTrack(0.f, 999.f); + } } + } else { + LOG(fatal) << "Invalid configuration for TOF event time computation"; } } - PROCESS_SWITCH(pidTOFGeneric, processOnlyFT0, "Process only with FT0", false); + PROCESS_SWITCH(pidTOFGeneric, processRun3, "Process the Run3 data", true); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { + metadataInfo.initMetadata(cfgc); return WorkflowSpec{ adaptAnalysisTask(cfgc)}; } diff --git a/PWGLF/TableProducer/Nuspex/reduced3bodyCreator.cxx b/PWGLF/TableProducer/Nuspex/reduced3bodyCreator.cxx index 091f0b03580..e164dc2794c 100644 --- a/PWGLF/TableProducer/Nuspex/reduced3bodyCreator.cxx +++ b/PWGLF/TableProducer/Nuspex/reduced3bodyCreator.cxx @@ -16,8 +16,9 @@ #include "TableHelper.h" +#include "PWGLF/DataModel/LFPIDTOFGenericTables.h" #include "PWGLF/DataModel/Reduced3BodyTables.h" -#include "PWGLF/DataModel/pidTOFGeneric.h" +#include "PWGLF/Utils/pidTOFGeneric.h" #include "Common/Core/PID/PIDTOF.h" #include "Common/Core/RecoDecay.h" @@ -64,6 +65,8 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; +o2::common::core::MetadataHelper metadataInfo; + using FullTracksExtIU = soa::Join; using FullTracksExtPIDIU = soa::Join; @@ -112,14 +115,16 @@ struct reduced3bodyCreator { int mRunNumber; float mBz; - o2::pid::tof::TOFResoParamsV2 mRespParamsV2; + // TOF response and input parameters + o2::pid::tof::TOFResoParamsV3 mRespParamsV3; + o2::aod::pidtofgeneric::TOFCalibConfig mTOFCalibConfig; // TOF Calib configuration // tracked cluster size std::vector fTrackedClSizeVector; HistogramRegistry registry{"registry", {}}; - void init(InitContext&) + void init(InitContext& initContext) { mRunNumber = 0; zorroSummary.setObject(zorro.getZorroSummary()); @@ -130,6 +135,11 @@ struct reduced3bodyCreator { ccdb->setLocalObjectValidityChecking(); ccdb->setFatalWhenNull(false); + // TOF PID parameters initialization + mTOFCalibConfig.metadataInfo = metadataInfo; + mTOFCalibConfig.inheritFromBaseTask(initContext); + mTOFCalibConfig.initSetup(mRespParamsV3, ccdb); + fitter3body.setPropagateToPCA(true); fitter3body.setMaxR(200.); //->maxRIni3body fitter3body.setMinParamChange(1e-3); @@ -186,66 +196,8 @@ struct reduced3bodyCreator { KFParticle::SetField(mBz); #endif - // Initial TOF PID Paras, copied from PIDTOF.h - timestamp.value = bc.timestamp(); - ccdb->setTimestamp(timestamp.value); - // Not later than now objects - ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); - // TODO: implement the automatic pass name detection from metadata - if (passName.value == "") { - passName.value = "unanchored"; // temporary default - LOG(warning) << "Passed autodetect mode for pass, not implemented yet, waiting for metadata. Taking '" << passName.value << "'"; - } - LOG(info) << "Using parameter collection, starting from pass '" << passName.value << "'"; - - const std::string fname = paramFileName.value; - if (!fname.empty()) { // Loading the parametrization from file - LOG(info) << "Loading exp. sigma parametrization from file " << fname << ", using param: " << parametrizationPath.value; - if (1) { - o2::tof::ParameterCollection paramCollection; - paramCollection.loadParamFromFile(fname, parametrizationPath.value); - LOG(info) << "+++ Loaded parameter collection from file +++"; - if (!paramCollection.retrieveParameters(mRespParamsV2, passName.value)) { - if (fatalOnPassNotAvailable) { - LOGF(fatal, "Pass '%s' not available in the retrieved CCDB object", passName.value.data()); - } else { - LOGF(warning, "Pass '%s' not available in the retrieved CCDB object", passName.value.data()); - } - } else { - mRespParamsV2.setShiftParameters(paramCollection.getPars(passName.value)); - mRespParamsV2.printShiftParameters(); - } - } else { - mRespParamsV2.loadParamFromFile(fname.data(), parametrizationPath.value); - } - } else if (loadResponseFromCCDB) { // Loading it from CCDB - LOG(info) << "Loading exp. sigma parametrization from CCDB, using path: " << parametrizationPath.value << " for timestamp " << timestamp.value; - o2::tof::ParameterCollection* paramCollection = ccdb->getForTimeStamp(parametrizationPath.value, timestamp.value); - paramCollection->print(); - if (!paramCollection->retrieveParameters(mRespParamsV2, passName.value)) { // Attempt at loading the parameters with the pass defined - if (fatalOnPassNotAvailable) { - LOGF(fatal, "Pass '%s' not available in the retrieved CCDB object", passName.value.data()); - } else { - LOGF(warning, "Pass '%s' not available in the retrieved CCDB object", passName.value.data()); - } - } else { // Pass is available, load non standard parameters - mRespParamsV2.setShiftParameters(paramCollection->getPars(passName.value)); - mRespParamsV2.printShiftParameters(); - } - } - mRespParamsV2.print(); - if (timeShiftCCDBPath.value != "") { - if (timeShiftCCDBPath.value.find(".root") != std::string::npos) { - mRespParamsV2.setTimeShiftParameters(timeShiftCCDBPath.value, "gmean_Pos", true); - mRespParamsV2.setTimeShiftParameters(timeShiftCCDBPath.value, "gmean_Neg", false); - } else { - mRespParamsV2.setTimeShiftParameters(ccdb->getForTimeStamp(Form("%s/pos", timeShiftCCDBPath.value.c_str()), timestamp.value), true); - mRespParamsV2.setTimeShiftParameters(ccdb->getForTimeStamp(Form("%s/neg", timeShiftCCDBPath.value.c_str()), timestamp.value), false); - } - } - fitter3body.setBz(mBz); - bachelorTOFPID.SetParams(mRespParamsV2); + mTOFCalibConfig.processSetup(mRespParamsV3, ccdb, bc); } //------------------------------------------------------------------ @@ -388,7 +340,7 @@ struct reduced3bodyCreator { // TOF PID of bachelor must be calcualted here // ---------------------------------------------- auto originalcol = daughter2.template collision_as(); - double tofNSigmaBach = bachelorTOFPID.GetTOFNSigma(daughter2, originalcol, collision); + double tofNSigmaBach = bachelorTOFPID.GetTOFNSigma(mRespParamsV3, daughter2, originalcol, collision); // ---------------------------------------------- // -------- save reduced track table with decay3body daughters ---------- @@ -469,6 +421,7 @@ struct reduced3bodyInitializer { WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { + metadataInfo.initMetadata(cfgc); return WorkflowSpec{ adaptAnalysisTask(cfgc), adaptAnalysisTask(cfgc), diff --git a/PWGLF/TableProducer/Nuspex/trHeAnalysis.cxx b/PWGLF/TableProducer/Nuspex/trHeAnalysis.cxx index 3d3e2b61d2c..7fe17c42d4a 100644 --- a/PWGLF/TableProducer/Nuspex/trHeAnalysis.cxx +++ b/PWGLF/TableProducer/Nuspex/trHeAnalysis.cxx @@ -16,8 +16,11 @@ /// /// \author Matthias Herzer , Goethe University Frankfurt /// -#include -#include +#include "PWGLF/DataModel/LFNucleiTables.h" +#include "PWGLF/DataModel/LFPIDTOFGenericTables.h" +#include "PWGLF/DataModel/LFParticleIdentification.h" +#include "PWGLF/Utils/pidTOFGeneric.h" + #include "Common/CCDB/EventSelectionParams.h" #include "Common/Core/PID/TPCPIDResponse.h" #include "Common/Core/trackUtilities.h" @@ -26,18 +29,20 @@ #include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/TrackSelectionTables.h" + #include "Framework/ASoAHelpers.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" #include "Framework/runDataProcessing.h" -#include "PWGLF/DataModel/LFNucleiTables.h" -#include "PWGLF/DataModel/LFParticleIdentification.h" #include "ReconstructionDataFormats/PID.h" #include "ReconstructionDataFormats/Track.h" -#include "PWGLF/DataModel/pidTOFGeneric.h" + #include +#include +#include + namespace o2::aod { namespace h3_data diff --git a/PWGLF/Utils/pidTOFGeneric.h b/PWGLF/Utils/pidTOFGeneric.h new file mode 100644 index 00000000000..3e7dfd58c23 --- /dev/null +++ b/PWGLF/Utils/pidTOFGeneric.h @@ -0,0 +1,496 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// +/// \file pidTOFGeneric.h +/// \brief Utilities to recalculate secondary tracks TOF PID +/// \author Yuanzhe Wang +/// + +#ifndef PWGLF_UTILS_PIDTOFGENERIC_H_ +#define PWGLF_UTILS_PIDTOFGENERIC_H_ +#include "CollisionTypeHelper.h" +#include "MetadataHelper.h" +#include "TableHelper.h" + +#include "Common/Core/PID/PIDTOF.h" + +#include "CommonDataFormat/InteractionRecord.h" + +#include +#include + +namespace o2::aod +{ + +namespace pidtofgeneric +{ + +// Configuration common to all tasks, copied from pidTOFMerge.cxx but add metadataInfo as a member variable +struct TOFCalibConfig { + template + void init(const CfgType& opt) + { + mUrl = opt.cfgUrl.value; + mPathGrpLhcIf = opt.cfgPathGrpLhcIf.value; + mTimestamp = opt.cfgTimestamp.value; + mTimeShiftCCDBPathPos = opt.cfgTimeShiftCCDBPathPos.value; + mTimeShiftCCDBPathNeg = opt.cfgTimeShiftCCDBPathNeg.value; + mTimeShiftCCDBPathPosMC = opt.cfgTimeShiftCCDBPathPosMC.value; + mTimeShiftCCDBPathNegMC = opt.cfgTimeShiftCCDBPathNegMC.value; + mParamFileName = opt.cfgParamFileName.value; + mParametrizationPath = opt.cfgParametrizationPath.value; + mReconstructionPass = opt.cfgReconstructionPass.value; + mReconstructionPassDefault = opt.cfgReconstructionPassDefault.value; + mFatalOnPassNotAvailable = opt.cfgFatalOnPassNotAvailable.value; + mEnableTimeDependentResponse = opt.cfgEnableTimeDependentResponse.value; + mCollisionSystem = opt.cfgCollisionSystem.value; + mAutoSetProcessFunctions = opt.cfgAutoSetProcessFunctions.value; + } + + template + void getCfg(o2::framework::InitContext& initContext, const std::string name, VType& v, const std::string task) + { + if (!getTaskOptionValue(initContext, task, name, v, false)) { + LOG(fatal) << "Could not get " << name << " from " << task << " task"; + } + } + + void inheritFromBaseTask(o2::framework::InitContext& initContext, const std::string task = "tof-signal") + { + mInitMode = 2; + getCfg(initContext, "ccdb-url", mUrl, task); + getCfg(initContext, "ccdb-path-grplhcif", mPathGrpLhcIf, task); + getCfg(initContext, "ccdb-timestamp", mTimestamp, task); + getCfg(initContext, "timeShiftCCDBPathPos", mTimeShiftCCDBPathPos, task); + getCfg(initContext, "timeShiftCCDBPathNeg", mTimeShiftCCDBPathNeg, task); + getCfg(initContext, "timeShiftCCDBPathPosMC", mTimeShiftCCDBPathPosMC, task); + getCfg(initContext, "timeShiftCCDBPathNegMC", mTimeShiftCCDBPathNegMC, task); + getCfg(initContext, "paramFileName", mParamFileName, task); + getCfg(initContext, "parametrizationPath", mParametrizationPath, task); + getCfg(initContext, "reconstructionPass", mReconstructionPass, task); + getCfg(initContext, "reconstructionPassDefault", mReconstructionPassDefault, task); + getCfg(initContext, "fatalOnPassNotAvailable", mFatalOnPassNotAvailable, task); + getCfg(initContext, "enableTimeDependentResponse", mEnableTimeDependentResponse, task); + getCfg(initContext, "collisionSystem", mCollisionSystem, task); + getCfg(initContext, "autoSetProcessFunctions", mAutoSetProcessFunctions, task); + } + // @brief Set up the configuration from the calibration object from the init function of the task + template + void initSetup(o2::pid::tof::TOFResoParamsV3& mRespParamsV3, + CCDBObject ccdb) + { + mInitMode = 1; + // First we set the CCDB manager + ccdb->setURL(mUrl); + ccdb->setTimestamp(mTimestamp); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + // Not later than now objects + ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); + + // Then the information about the metadata + if (mReconstructionPass == "metadata") { + LOG(info) << "Getting pass from metadata"; + if (metadataInfo.isMC()) { + mReconstructionPass = metadataInfo.get("AnchorPassName"); + } else { + mReconstructionPass = metadataInfo.get("RecoPassName"); + } + LOG(info) << "Passed autodetect mode for pass. Taking '" << mReconstructionPass << "'"; + } + LOG(info) << "Using parameter collection, starting from pass '" << mReconstructionPass << "'"; + + if (!mParamFileName.empty()) { // Loading the parametrization from file + LOG(info) << "Loading exp. sigma parametrization from file " << mParamFileName << ", using param: " << mParametrizationPath << " and pass " << mReconstructionPass; + o2::tof::ParameterCollection paramCollection; + paramCollection.loadParamFromFile(mParamFileName, mParametrizationPath); + LOG(info) << "+++ Loaded parameter collection from file +++"; + if (!paramCollection.retrieveParameters(mRespParamsV3, mReconstructionPass)) { + if (mFatalOnPassNotAvailable) { + LOG(fatal) << "Pass '" << mReconstructionPass << "' not available in the retrieved object from file"; + } else { + LOG(warning) << "Pass '" << mReconstructionPass << "' not available in the retrieved object from file, fetching '" << mReconstructionPassDefault << "'"; + if (!paramCollection.retrieveParameters(mRespParamsV3, mReconstructionPassDefault)) { + paramCollection.print(); + LOG(fatal) << "Cannot get default pass for calibration " << mReconstructionPassDefault; + } else { + if (metadataInfo.isRun3()) { + mRespParamsV3.setResolutionParametrization(paramCollection.getPars(mReconstructionPassDefault)); + } else { + mRespParamsV3.setResolutionParametrizationRun2(paramCollection.getPars(mReconstructionPassDefault)); + } + mRespParamsV3.setMomentumChargeShiftParameters(paramCollection.getPars(mReconstructionPassDefault)); + } + } + } else { // Pass is available, load non standard parameters + if (metadataInfo.isRun3()) { + mRespParamsV3.setResolutionParametrization(paramCollection.getPars(mReconstructionPass)); + } else { + mRespParamsV3.setResolutionParametrizationRun2(paramCollection.getPars(mReconstructionPass)); + } + mRespParamsV3.setMomentumChargeShiftParameters(paramCollection.getPars(mReconstructionPass)); + } + } else if (!mEnableTimeDependentResponse) { // Loading it from CCDB + LOG(info) << "Loading initial exp. sigma parametrization from CCDB, using path: " << mParametrizationPath << " for timestamp " << mTimestamp; + o2::tof::ParameterCollection* paramCollection = ccdb->template getSpecific(mParametrizationPath, mTimestamp); + if (!paramCollection->retrieveParameters(mRespParamsV3, mReconstructionPass)) { // Attempt at loading the parameters with the pass defined + if (mFatalOnPassNotAvailable) { + LOG(fatal) << "Pass '" << mReconstructionPass << "' not available in the retrieved CCDB object"; + } else { + LOG(warning) << "Pass '" << mReconstructionPass << "' not available in the retrieved CCDB object, fetching '" << mReconstructionPassDefault << "'"; + if (!paramCollection->retrieveParameters(mRespParamsV3, mReconstructionPassDefault)) { + paramCollection->print(); + LOG(fatal) << "Cannot get default pass for calibration " << mReconstructionPassDefault; + } else { + if (metadataInfo.isRun3()) { + mRespParamsV3.setResolutionParametrization(paramCollection->getPars(mReconstructionPassDefault)); + } else { + mRespParamsV3.setResolutionParametrizationRun2(paramCollection->getPars(mReconstructionPassDefault)); + } + mRespParamsV3.setMomentumChargeShiftParameters(paramCollection->getPars(mReconstructionPassDefault)); + } + } + } else { // Pass is available, load non standard parameters + if (metadataInfo.isRun3()) { + mRespParamsV3.setResolutionParametrization(paramCollection->getPars(mReconstructionPass)); + } else { + mRespParamsV3.setResolutionParametrizationRun2(paramCollection->getPars(mReconstructionPass)); + } + mRespParamsV3.setMomentumChargeShiftParameters(paramCollection->getPars(mReconstructionPass)); + } + } + + // Loading additional calibration objects + std::map metadata; + if (!mReconstructionPass.empty()) { + metadata["RecoPassName"] = mReconstructionPass; + } + + auto updateTimeShift = [&](const std::string& nameShift, bool isPositive) { + if (nameShift.empty()) { + return; + } + const bool isFromFile = nameShift.find(".root") != std::string::npos; + if (isFromFile) { + LOG(info) << "Initializing the time shift for " << (isPositive ? "positive" : "negative") << " from file '" << nameShift << "'"; + mRespParamsV3.setTimeShiftParameters(nameShift, "ccdb_object", isPositive); + } else if (!mEnableTimeDependentResponse) { // If the response is fixed fetch it at the init time + LOG(info) << "Initializing the time shift for " << (isPositive ? "positive" : "negative") + << " from ccdb '" << nameShift << "' and timestamp " << mTimestamp + << " and pass '" << mReconstructionPass << "'"; + ccdb->setFatalWhenNull(false); + mRespParamsV3.setTimeShiftParameters(ccdb->template getSpecific(nameShift, mTimestamp, metadata), isPositive); + ccdb->setFatalWhenNull(true); + } + LOG(info) << " test getTimeShift at 0 " << (isPositive ? "pos" : "neg") << ": " + << mRespParamsV3.getTimeShift(0, isPositive); + }; + + const std::string nameShiftPos = metadataInfo.isMC() ? mTimeShiftCCDBPathPosMC : mTimeShiftCCDBPathPos; + updateTimeShift(nameShiftPos, true); + const std::string nameShiftNeg = metadataInfo.isMC() ? mTimeShiftCCDBPathNegMC : mTimeShiftCCDBPathNeg; + updateTimeShift(nameShiftNeg, false); + + // Calibration object is defined + LOG(info) << "Parametrization at init time:"; + mRespParamsV3.printFullConfig(); + } + + template + void processSetup(o2::pid::tof::TOFResoParamsV3& mRespParamsV3, + CCDBObject ccdb, + const BcType& bc) + { + LOG(debug) << "Processing setup for run number " << bc.runNumber() << " from run " << mLastRunNumber; + // First we check if this run number was already processed + if (mLastRunNumber == bc.runNumber()) { + return; + } + LOG(info) << "Updating the parametrization from last run " << mLastRunNumber << " to " << bc.runNumber() << " and timestamp from " << mTimestamp << " " << bc.timestamp(); + mLastRunNumber = bc.runNumber(); + mTimestamp = bc.timestamp(); + + // Check the beam type + if (mCollisionSystem == -1) { + o2::parameters::GRPLHCIFData* grpo = ccdb->template getSpecific(mPathGrpLhcIf, + mTimestamp); + mCollisionSystem = CollisionSystemType::getCollisionTypeFromGrp(grpo); + } else { + LOG(debug) << "Not setting collisions system as already set to " << mCollisionSystem << " " << CollisionSystemType::getCollisionSystemName(mCollisionSystem); + } + + if (!mEnableTimeDependentResponse) { + return; + } + LOG(info) << "Updating parametrization from path '" << mParametrizationPath << "' and timestamp " << mTimestamp << " and reconstruction pass '" << mReconstructionPass << "' for run number " << bc.runNumber(); + if (mParamFileName.empty()) { // Not loading if parametrization was taken from file + LOG(info) << "Updating parametrization from ccdb"; + const o2::tof::ParameterCollection* paramCollection = ccdb->template getSpecific(mParametrizationPath, mTimestamp); + if (!paramCollection->retrieveParameters(mRespParamsV3, mReconstructionPass)) { + if (mFatalOnPassNotAvailable) { + LOGF(fatal, "Pass '%s' not available in the retrieved CCDB object", mReconstructionPass.data()); + } else { + LOGF(warning, "Pass '%s' not available in the retrieved CCDB object, fetching '%s'", mReconstructionPass.data(), mReconstructionPassDefault.data()); + if (!paramCollection->retrieveParameters(mRespParamsV3, mReconstructionPassDefault)) { + paramCollection->print(); + LOG(fatal) << "Cannot get default pass for calibration " << mReconstructionPassDefault; + } else { // Found the default case + if (metadataInfo.isRun3()) { + mRespParamsV3.setResolutionParametrization(paramCollection->getPars(mReconstructionPassDefault)); + } else { + mRespParamsV3.setResolutionParametrizationRun2(paramCollection->getPars(mReconstructionPassDefault)); + } + mRespParamsV3.setMomentumChargeShiftParameters(paramCollection->getPars(mReconstructionPassDefault)); + } + } + } else { // Found the non default case + if (metadataInfo.isRun3()) { + mRespParamsV3.setResolutionParametrization(paramCollection->getPars(mReconstructionPass)); + } else { + mRespParamsV3.setResolutionParametrizationRun2(paramCollection->getPars(mReconstructionPass)); + } + mRespParamsV3.setMomentumChargeShiftParameters(paramCollection->getPars(mReconstructionPass)); + } + } + + // Loading additional calibration objects + std::map metadata; + if (!mReconstructionPass.empty()) { + metadata["RecoPassName"] = mReconstructionPass; + } + + auto updateTimeShift = [&](const std::string& nameShift, bool isPositive) { + if (nameShift.empty()) { + return; + } + const bool isFromFile = nameShift.find(".root") != std::string::npos; + if (isFromFile) { + return; + } + LOG(info) << "Updating the time shift for " << (isPositive ? "positive" : "negative") + << " from ccdb '" << nameShift << "' and timestamp " << mTimestamp + << " and pass '" << mReconstructionPass << "'"; + ccdb->setFatalWhenNull(false); + mRespParamsV3.setTimeShiftParameters(ccdb->template getSpecific(nameShift, mTimestamp, metadata), isPositive); + ccdb->setFatalWhenNull(true); + LOG(info) << " test getTimeShift at 0 " << (isPositive ? "pos" : "neg") << ": " + << mRespParamsV3.getTimeShift(0, isPositive); + }; + + updateTimeShift(metadataInfo.isMC() ? mTimeShiftCCDBPathPosMC : mTimeShiftCCDBPathPos, true); + updateTimeShift(metadataInfo.isMC() ? mTimeShiftCCDBPathNegMC : mTimeShiftCCDBPathNeg, false); + + LOG(info) << "Parametrization at setup time:"; + mRespParamsV3.printFullConfig(); + } + + bool autoSetProcessFunctions() const { return mAutoSetProcessFunctions; } + int collisionSystem() const { return mCollisionSystem; } + + o2::common::core::MetadataHelper metadataInfo; // additional member variable to store metadata information compared to pidTOFMerge.cxx + + private: + int mLastRunNumber = -1; // Last run number for which the calibration was loaded + int mInitMode = 0; // 0: no init, 1: init, 2: inherit + + // Configurable options + std::string mUrl; + std::string mPathGrpLhcIf; + int64_t mTimestamp; + std::string mTimeShiftCCDBPathPos; + std::string mTimeShiftCCDBPathNeg; + std::string mTimeShiftCCDBPathPosMC; + std::string mTimeShiftCCDBPathNegMC; + std::string mParamFileName; + std::string mParametrizationPath; + std::string mReconstructionPass; + std::string mReconstructionPassDefault; + bool mFatalOnPassNotAvailable; + bool mEnableTimeDependentResponse; + int mCollisionSystem; + bool mAutoSetProcessFunctions; +}; + +static constexpr float kCSPEED = TMath::C() * 1.0e2f * 1.0e-12f; // c in cm/ps + +template +class TofPidNewCollision +{ + public: + TofPidNewCollision() = default; + ~TofPidNewCollision() = default; + + o2::pid::tof::TOFResoParamsV3 mRespParamsV3; + o2::track::PID::ID pidType; + + template + using ResponseImplementation = o2::pid::tof::ExpTimes; + static constexpr auto responseEl = ResponseImplementation(); + static constexpr auto responseMu = ResponseImplementation(); + static constexpr auto responsePi = ResponseImplementation(); + static constexpr auto responseKa = ResponseImplementation(); + static constexpr auto responsePr = ResponseImplementation(); + static constexpr auto responseDe = ResponseImplementation(); + static constexpr auto responseTr = ResponseImplementation(); + static constexpr auto responseHe = ResponseImplementation(); + static constexpr auto responseAl = ResponseImplementation(); + + void SetParams(o2::pid::tof::TOFResoParamsV3 const& para) + { + mRespParamsV3.setParameters(para); + } + + void SetPidType(o2::track::PID::ID pidId) + { + pidType = pidId; + } + + template + float GetTOFNSigma(o2::track::PID::ID pidId, const ParamType& parameters, TTrack const& track, TCollision const& originalcol, TCollision const& correctedcol, bool EnableBCAO2D = true); + + template + float GetTOFNSigma(const ParamType& parameters, TTrack const& track, TCollision const& originalcol, TCollision const& correctedcol, bool EnableBCAO2D = true); + + template + float GetTOFNSigma(const ParamType& parameters, TTrack const& track); + template + float GetTOFNSigma(o2::track::PID::ID pidId, const ParamType& parameters, TTrack const& track); + + template + float CalculateTOFNSigma(o2::track::PID::ID pidId, const ParamType& parameters, TTrack const& track, double tofsignal, double evTime, double evTimeErr) + { + + float expSigma, tofNsigma = -999; + + switch (pidId) { + case 0: + expSigma = responseEl.GetExpectedSigma(parameters, track, tofsignal, evTimeErr); + tofNsigma = (tofsignal - evTime - responseEl.GetCorrectedExpectedSignal(parameters, track)) / expSigma; + break; + case 1: + expSigma = responseMu.GetExpectedSigma(parameters, track, tofsignal, evTimeErr); + tofNsigma = (tofsignal - evTime - responseMu.GetCorrectedExpectedSignal(parameters, track)) / expSigma; + break; + case 2: + expSigma = responsePi.GetExpectedSigma(parameters, track, tofsignal, evTimeErr); + tofNsigma = (tofsignal - evTime - responsePi.GetCorrectedExpectedSignal(parameters, track)) / expSigma; + break; + case 3: + expSigma = responseKa.GetExpectedSigma(parameters, track, tofsignal, evTimeErr); + tofNsigma = (tofsignal - evTime - responseKa.GetCorrectedExpectedSignal(parameters, track)) / expSigma; + break; + case 4: + expSigma = responsePr.GetExpectedSigma(parameters, track, tofsignal, evTimeErr); + tofNsigma = (tofsignal - evTime - responsePr.GetCorrectedExpectedSignal(parameters, track)) / expSigma; + break; + case 5: + expSigma = responseDe.GetExpectedSigma(parameters, track, tofsignal, evTimeErr); + tofNsigma = (tofsignal - evTime - responseDe.GetCorrectedExpectedSignal(parameters, track)) / expSigma; + break; + case 6: + expSigma = responseTr.GetExpectedSigma(parameters, track, tofsignal, evTimeErr); + tofNsigma = (tofsignal - evTime - responseTr.GetCorrectedExpectedSignal(parameters, track)) / expSigma; + break; + case 7: + expSigma = responseHe.GetExpectedSigma(parameters, track, tofsignal, evTimeErr); + tofNsigma = (tofsignal - evTime - responseHe.GetCorrectedExpectedSignal(parameters, track)) / expSigma; + break; + case 8: + expSigma = responseAl.GetExpectedSigma(parameters, track, tofsignal, evTimeErr); + tofNsigma = (tofsignal - evTime - responseAl.GetCorrectedExpectedSignal(parameters, track)) / expSigma; + break; + default: + LOG(fatal) << "Wrong particle ID in TofPidSecondary class"; + return -999; + } + + return tofNsigma; + } +}; + +template +template +float TofPidNewCollision::GetTOFNSigma(o2::track::PID::ID pidId, const ParamType& parameters, TTrack const& track, TCollision const& originalcol, TCollision const& correctedcol, bool EnableBCAO2D) +{ + + if (!track.has_collision() || !track.hasTOF()) { + return -999; + } + + float mMassHyp = o2::track::pid_constants::sMasses2Z[track.pidForTracking()]; + float expTime = track.length() * std::sqrt((mMassHyp * mMassHyp) + (track.tofExpMom() * track.tofExpMom())) / (kCSPEED * track.tofExpMom()); // L*E/(p*c) = L/v + + float evTime = correctedcol.evTime(); + float evTimeErr = correctedcol.evTimeErr(); + float tofsignal = track.trackTime() * 1000 + expTime; // in ps + + if (originalcol.globalIndex() == correctedcol.globalIndex()) { + evTime = track.evTimeForTrack(); + evTimeErr = track.evTimeErrForTrack(); + } else { + if (EnableBCAO2D) { + auto originalbc = originalcol.template bc_as(); + auto correctedbc = correctedcol.template bc_as(); + o2::InteractionRecord originalIR = o2::InteractionRecord::long2IR(originalbc.globalBC()); + o2::InteractionRecord correctedIR = o2::InteractionRecord::long2IR(correctedbc.globalBC()); + tofsignal += originalIR.differenceInBCNS(correctedIR) * 1000; + } else { + auto originalbc = originalcol.template foundBC_as(); + auto correctedbc = correctedcol.template foundBC_as(); + o2::InteractionRecord originalIR = o2::InteractionRecord::long2IR(originalbc.globalBC()); + o2::InteractionRecord correctedIR = o2::InteractionRecord::long2IR(correctedbc.globalBC()); + tofsignal += originalIR.differenceInBCNS(correctedIR) * 1000; + } + } + + float tofNsigma = CalculateTOFNSigma(pidId, parameters, track, tofsignal, evTime, evTimeErr); + return tofNsigma; +} + +template +template +float TofPidNewCollision::GetTOFNSigma(const ParamType& parameters, TTrack const& track, TCollision const& originalcol, TCollision const& correctedcol, bool EnableBCAO2D) +{ + return GetTOFNSigma(pidType, parameters, track, originalcol, correctedcol, EnableBCAO2D); +} + +template +template +float TofPidNewCollision::GetTOFNSigma(o2::track::PID::ID pidId, const ParamType& parameters, TTrack const& track) +{ + + if (!track.has_collision() || !track.hasTOF()) { + return -999; + } + + float mMassHyp = o2::track::pid_constants::sMasses2Z[track.pidForTracking()]; + float expTime = track.length() * std::sqrt((mMassHyp * mMassHyp) + (track.tofExpMom() * track.tofExpMom())) / (kCSPEED * track.tofExpMom()); // L*E/(p*c) = L/v + + float evTime = track.evTimeForTrack(); + float evTimeErr = track.evTimeErrForTrack(); + float tofsignal = track.trackTime() * 1000 + expTime; // in ps + + float tofNsigma = CalculateTOFNSigma(pidId, parameters, track, tofsignal, evTime, evTimeErr); + return tofNsigma; +} + +template +template +float TofPidNewCollision::GetTOFNSigma(const ParamType& parameters, TTrack const& track) +{ + return GetTOFNSigma(pidType, parameters, track); +} + +} // namespace pidtofgeneric +} // namespace o2::aod + +#endif // PWGLF_UTILS_PIDTOFGENERIC_H_ From 4d32fbe5bac08034788839c6e38f279874e99359 Mon Sep 17 00:00:00 2001 From: Nida Malik Date: Sun, 3 Aug 2025 16:37:24 +0530 Subject: [PATCH 207/345] [PWGCF] Add histogram for efficiency correction (#12374) --- .../Tasks/netchargeFluctuations.cxx | 767 +++++++++--------- 1 file changed, 384 insertions(+), 383 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx index d248c5d6620..bced27ce135 100644 --- a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx @@ -29,6 +29,7 @@ #include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/TrackSelectionTables.h" +#include "CCDB/BasicCCDBManager.h" #include "CommonConstants/MathConstants.h" #include "CommonConstants/PhysicsConstants.h" #include "Framework/ASoAHelpers.h" @@ -43,7 +44,8 @@ #include "TProfile2D.h" #include "TRandom3.h" -#include +#include +#include // Include for std::vector using namespace o2; using namespace o2::framework; @@ -55,50 +57,6 @@ namespace o2 { namespace aod { -namespace net_charge -{ -DECLARE_SOA_COLUMN(PosCharge, posCharge, float); -DECLARE_SOA_COLUMN(NegCharge, negCharge, float); -DECLARE_SOA_COLUMN(PosSqCharge, posSqCharge, float); -DECLARE_SOA_COLUMN(NegSqCharge, negSqCharge, float); -DECLARE_SOA_COLUMN(TermPCharge, termPCharge, float); -DECLARE_SOA_COLUMN(TermNCharge, termNCharge, float); -DECLARE_SOA_COLUMN(PosNegCharge, posNegCharge, float); -DECLARE_SOA_COLUMN(Centrality, centrality, float); -} // namespace net_charge - -namespace net_charge_gen -{ -DECLARE_SOA_COLUMN(PosCharge, posCharge, float); -DECLARE_SOA_COLUMN(NegCharge, negCharge, float); -DECLARE_SOA_COLUMN(PosSqCharge, posSqCharge, float); -DECLARE_SOA_COLUMN(NegSqCharge, negSqCharge, float); -DECLARE_SOA_COLUMN(TermPCharge, termPCharge, float); -DECLARE_SOA_COLUMN(TermNCharge, termNCharge, float); -DECLARE_SOA_COLUMN(PosNegCharge, posNegCharge, float); -DECLARE_SOA_COLUMN(Centrality, centrality, float); -} // namespace net_charge_gen - -DECLARE_SOA_TABLE(NetCharge, "AOD", "NETChargefluct", - net_charge::PosCharge, - net_charge::NegCharge, - net_charge::PosSqCharge, - net_charge::NegSqCharge, - net_charge::TermPCharge, - net_charge::TermNCharge, - net_charge::PosNegCharge, - net_charge::Centrality); - -DECLARE_SOA_TABLE(NetChargeGen, "AOD", "NETfluctGen", - net_charge_gen::PosCharge, - net_charge_gen::NegCharge, - net_charge_gen::PosSqCharge, - net_charge_gen::NegSqCharge, - net_charge_gen::TermPCharge, - net_charge_gen::TermNCharge, - net_charge_gen::PosNegCharge, - net_charge_gen::Centrality); - using MyCollisionsRun2 = soa::Join; using MyCollisionRun2 = MyCollisionsRun2::iterator; using MyCollisionsRun3 = soa::Join; @@ -123,13 +81,17 @@ enum RunType { }; struct NetchargeFluctuations { - Produces netCharge; - Produces netChargeGen; Service pdgService; - + Service ccdb; + TRandom3* fRndm = new TRandom3(0); HistogramRegistry histogramRegistry{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; // Configurables + Configurable ccdbNoLaterThan{"ccdbNoLaterThan", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; + Configurable cfgUrlCCDB{"cfgUrlCCDB", "http://alice-ccdb.cern.ch", "url of ccdb"}; + Configurable cfgPathCCDB{"cfgPathCCDB", "Users/n/nimalik/efftest", "Path for ccdb-object"}; + Configurable cfgLoadEff{"cfgLoadEff", true, "Load efficiency"}; + Configurable vertexZcut{"vertexZcut", 10.f, "Vertex Z"}; Configurable etaCut{"etaCut", 0.8, "Eta cut"}; Configurable ptMinCut{"ptMinCut", 0.2, "Pt min cut"}; @@ -139,17 +101,29 @@ struct NetchargeFluctuations { Configurable tpcCrossCut{"tpcCrossCut", 70, "TPC crossrows cut"}; Configurable itsChiCut{"itsChiCut", 70, "ITS chi2 cluster cut"}; Configurable tpcChiCut{"tpcChiCut", 70, "TPC chi2 cluster cut"}; - + Configurable centMin{"centMin", 0.0f, "cenrality min for delta eta"}; + Configurable centMax{"centMax", 10.0f, "cenrality max for delta eta"}; + Configurable cfgNSubsample{"cfgNSubsample", 30, "Number of subsamples for Error"}; + Configurable deltaEta{"deltaEta", 8, "Delta eta bin count"}; + Configurable threshold{"threshold", 1e-6, "Delta eta bin count"}; // Event selections - Configurable cSel8Trig{"cSel8Trig", true, "Sel8 (T0A + T0C) Selection Run3"}; // sel8 - Configurable cInt7Trig{"cInt7Trig", true, "kINT7 MB Trigger"}; // kINT7 - Configurable cSel7Trig{"cSel7Trig", true, "Sel7 (V0A + V0C) Selection Run2"}; // sel7 - Configurable cTFBorder{"cTFBorder", false, "Timeframe Border Selection"}; // pileup - Configurable cNoItsROBorder{"cNoItsROBorder", false, "No ITSRO Border Cut"}; // pileup - Configurable cItsTpcVtx{"cItsTpcVtx", false, "ITS+TPC Vertex Selection"}; // pileup - Configurable cPileupReject{"cPileupReject", false, "Pileup rejection"}; // pileup - Configurable cZVtxTimeDiff{"cZVtxTimeDiff", false, "z-vtx time diff selection"}; // pileup - Configurable cIsGoodITSLayers{"cIsGoodITSLayers", false, "Good ITS Layers All"}; // pileup + Configurable cSel8Trig{"cSel8Trig", true, "Sel8 (T0A + T0C) Selection Run3"}; // sel8 + Configurable cInt7Trig{"cInt7Trig", true, "kINT7 MB Trigger"}; // kINT7 + Configurable cSel7Trig{"cSel7Trig", true, "Sel7 (V0A + V0C) Selection Run2"}; // sel7 + Configurable cTFBorder{"cTFBorder", false, "Timeframe Border Selection"}; // pileup + Configurable cNoItsROBorder{"cNoItsROBorder", false, "No ITSRO Border Cut"}; // pileup + Configurable cItsTpcVtx{"cItsTpcVtx", false, "ITS+TPC Vertex Selection"}; // pileup + Configurable cPileupReject{"cPileupReject", false, "Pileup rejection"}; // pileup + Configurable cZVtxTimeDiff{"cZVtxTimeDiff", false, "z-vtx time diff selection"}; // pileup + Configurable cfgUseGoodItsLayerAllCut{"cfgUseGoodItsLayerAllCut", false, "Good ITS Layers All"}; // pileup + Configurable cDcaXy{"cDcaXy", false, "Dca XY cut"}; + Configurable cDcaZ{"cDcaZ", false, "Dca Z cut"}; + Configurable cTpcCr{"cTpcCr", false, "tpc crossrows"}; + Configurable cItsChi{"cItsChi", false, "ITS chi"}; + Configurable cTpcChi{"cTpcChi", false, "TPC chi"}; + + // CCDB efficiency histograms + TH2D* efficiency = nullptr; // Initialization void init(o2::framework::InitContext&) @@ -158,8 +132,8 @@ struct NetchargeFluctuations { const AxisSpec dcaAxis = {250, -0.5, 0.5, "DCA_{xy} (cm)"}; const AxisSpec dcazAxis = {250, -0.5, 0.5, "DCA_{z} (cm)"}; const AxisSpec ptAxis = {70, 0.0, 7.0, "#it{p}_{T} (GeV/#it{c})"}; - const AxisSpec etaAxis = {200, -1., 1., "#eta"}; - const AxisSpec cent1Axis = {10, 0., 100., "centrality"}; + const AxisSpec etaAxis = {20, -1., 1., "#eta"}; + const AxisSpec deltaEtaAxis = {9, 0, 1.8, "#eta"}; const AxisSpec centAxis = {100, 0., 100., "centrality"}; const AxisSpec multAxis = {200, 0., 10000., "FT0M Amplitude"}; const AxisSpec tpcChiAxis = {1400, 0., 7., "Chi2"}; @@ -167,72 +141,133 @@ struct NetchargeFluctuations { const AxisSpec crossedRowAxis = {1600, 0., 160., "TPC Crossed rows"}; const AxisSpec eventsAxis = {10, 0, 10, ""}; const AxisSpec signAxis = {20, -10, 10, ""}; - const AxisSpec nchAxis = {3000, 0, 3000, "Nch"}; + const AxisSpec nchAxis = {5000, 0, 5000, "Nch"}; + const AxisSpec nch1Axis = {1500, 0, 1500, "Nch"}; const AxisSpec nchpAxis = {50000, 0, 50000, "Nch"}; - histogramRegistry.add("hVtxZ_before", "", kTH1F, {vtxzAxis}); - histogramRegistry.add("hDcaXY_before", "", kTH1F, {dcaAxis}); - histogramRegistry.add("hDcaZ_before", "", kTH1F, {dcazAxis}); - histogramRegistry.add("hTPCchi2perCluster_before", "", kTH1D, {tpcChiAxis}); - histogramRegistry.add("hITSchi2perCluster_before", "", kTH1D, {itsChiAxis}); - histogramRegistry.add("hTPCCrossedrows_before", "", kTH1D, {crossedRowAxis}); - histogramRegistry.add("hPtDcaXY_before", "", kTH2D, {ptAxis, dcaAxis}); - histogramRegistry.add("hPtDcaZ_before", "", kTH2D, {ptAxis, dcazAxis}); - histogramRegistry.add("hVtxZ_after", "", kTH1F, {vtxzAxis}); - histogramRegistry.add("hDcaXY_after", "", kTH1F, {dcaAxis}); - histogramRegistry.add("hDcaZ_after", "", kTH1F, {dcazAxis}); - histogramRegistry.add("hTPCchi2perCluster_after", "", kTH1D, {tpcChiAxis}); - histogramRegistry.add("hITSchi2perCluster_after", "", kTH1D, {itsChiAxis}); - histogramRegistry.add("hTPCCrossedrows_after", "", kTH1D, {crossedRowAxis}); - histogramRegistry.add("hPtDcaXY_after", "", kTH2D, {ptAxis, dcaAxis}); - histogramRegistry.add("hPtDcaZ_after", "", kTH2D, {ptAxis, dcazAxis}); - histogramRegistry.add("hEta", "", kTH1F, {etaAxis}); - histogramRegistry.add("hPt", "", kTH1F, {ptAxis}); - histogramRegistry.add("hCentrality", "", kTH1F, {centAxis}); - histogramRegistry.add("hMultiplicity", "", kTH1F, {multAxis}); - histogramRegistry.add("gen_hVtxZ_before", "", kTH1F, {vtxzAxis}); - histogramRegistry.add("gen_hVtxZ_after", "", kTH1F, {vtxzAxis}); - histogramRegistry.add("gen_hEta", "", kTH1F, {etaAxis}); - histogramRegistry.add("gen_hSign", "", kTH1F, {signAxis}); - histogramRegistry.add("gen_hPt", "", kTH1F, {ptAxis}); - - histogramRegistry.add("nch", "", kTH1D, {nchAxis}); - histogramRegistry.add("nch0", "", kTH1D, {nchAxis}); - histogramRegistry.add("nch1", "", kTH1D, {nchAxis}); - histogramRegistry.add("nch2", "", kTH1D, {nchAxis}); - histogramRegistry.add("nch3", "", kTH1D, {nchAxis}); - histogramRegistry.add("nch4", "", kTH1D, {nchAxis}); - histogramRegistry.add("nch5", "", kTH1D, {nchAxis}); - histogramRegistry.add("nch6", "", kTH1D, {nchAxis}); - histogramRegistry.add("nch7", "", kTH1D, {nchAxis}); - histogramRegistry.add("nch8", "", kTH1D, {nchAxis}); - histogramRegistry.add("nch9", "", kTH1D, {nchAxis}); - histogramRegistry.add("nch_pos", "", kTH1D, {nchAxis}); - histogramRegistry.add("nch_neg", "", kTH1D, {nchAxis}); - histogramRegistry.add("nch_negpos", "", kTH1D, {nchpAxis}); - - histogramRegistry.add("nch_cent", "", kTH2D, {centAxis, nchAxis}); - histogramRegistry.add("nch_pos_cent", "", kTH2D, {centAxis, nchAxis}); - histogramRegistry.add("nch_neg_cent", "", kTH2D, {centAxis, nchAxis}); - histogramRegistry.add("nch_negpos_cent", "", kTH2D, {centAxis, nchpAxis}); + std::vector centBining = {0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}; + AxisSpec cent1Axis = {centBining, "Multiplicity percentile from FT0M (%)"}; + + auto noSubsample = static_cast(cfgNSubsample); + float maxSubsample = 1.0 * noSubsample; + AxisSpec subsampleAxis = {noSubsample, 0.0, maxSubsample, "subsample no."}; + + histogramRegistry.add("data/hVtxZ_before", "", kTH1F, {vtxzAxis}); + histogramRegistry.add("data/hDcaXY_before", "", kTH1F, {dcaAxis}); + histogramRegistry.add("data/hDcaZ_before", "", kTH1F, {dcazAxis}); + histogramRegistry.add("data/hTPCchi2perCluster_before", "", kTH1D, {tpcChiAxis}); + histogramRegistry.add("data/hITSchi2perCluster_before", "", kTH1D, {itsChiAxis}); + histogramRegistry.add("data/hTPCCrossedrows_before", "", kTH1D, {crossedRowAxis}); + histogramRegistry.add("data/hPtDcaXY_before", "", kTH2D, {ptAxis, dcaAxis}); + histogramRegistry.add("data/hPtDcaZ_before", "", kTH2D, {ptAxis, dcazAxis}); + histogramRegistry.add("data/hVtxZ_after", "", kTH1F, {vtxzAxis}); + histogramRegistry.add("data/hDcaXY_after", "", kTH1F, {dcaAxis}); + histogramRegistry.add("data/hDcaZ_after", "", kTH1F, {dcazAxis}); + histogramRegistry.add("data/hTPCchi2perCluster_after", "", kTH1D, {tpcChiAxis}); + histogramRegistry.add("data/hITSchi2perCluster_after", "", kTH1D, {itsChiAxis}); + histogramRegistry.add("data/hTPCCrossedrows_after", "", kTH1D, {crossedRowAxis}); + histogramRegistry.add("data/hPtDcaXY_after", "", kTH2D, {ptAxis, dcaAxis}); + histogramRegistry.add("data/hPtDcaZ_after", "", kTH2D, {ptAxis, dcazAxis}); + histogramRegistry.add("data/hEta", "", kTH1F, {etaAxis}); + histogramRegistry.add("data/hEta_cent", "", kTH2F, {cent1Axis, etaAxis}); + histogramRegistry.add("data/hPt", "", kTH1F, {ptAxis}); + histogramRegistry.add("data/hPt_cent", "", kTH2F, {cent1Axis, ptAxis}); + histogramRegistry.add("data/hPt_eta", "", kTH2F, {ptAxis, etaAxis}); + histogramRegistry.add("data/hCentrality", "", kTH1F, {centAxis}); + histogramRegistry.add("data/hMultiplicity", "", kTH1F, {multAxis}); + + histogramRegistry.add("gen/hPt_eta", "", kTH2F, {ptAxis, etaAxis}); + histogramRegistry.add("gen/hVtxZ_before", "", kTH1F, {vtxzAxis}); + histogramRegistry.add("gen/hVtxZ_after", "", kTH1F, {vtxzAxis}); + histogramRegistry.add("gen/hEta", "", kTH1F, {etaAxis}); + histogramRegistry.add("gen/hEta_cent", "", kTH2F, {centAxis, etaAxis}); + histogramRegistry.add("gen/hSign", "", kTH1F, {signAxis}); + histogramRegistry.add("gen/hPt", "", kTH1F, {ptAxis}); + histogramRegistry.add("gen/hPt_cent", "", kTH2F, {centAxis, ptAxis}); + histogramRegistry.add("gen/nch", "", kTH1F, {nchAxis}); + + histogramRegistry.add("mult_dist/nch", "", kTH1D, {nchAxis}); + histogramRegistry.add("mult_dist/nch_pos", "", kTH1D, {nchAxis}); + histogramRegistry.add("mult_dist/nch_neg", "", kTH1D, {nchAxis}); + histogramRegistry.add("mult_dist/nch_negpos", "", kTH1D, {nchpAxis}); + histogramRegistry.add("mult_dist/nch_cent", "", kTH2D, {centAxis, nchAxis}); + histogramRegistry.add("mult_dist/nch_pos_cent", "", kTH2D, {centAxis, nchAxis}); + histogramRegistry.add("mult_dist/nch_neg_cent", "", kTH2D, {centAxis, nchAxis}); + histogramRegistry.add("mult_dist/nch_negpos_cent", "", kTH2D, {centAxis, nchpAxis}); + + histogramRegistry.add("delta_eta/cent", "Centrality", kTH1F, {cent1Axis}); + histogramRegistry.add("delta_eta/track_eta", "eta", kTH1F, {etaAxis}); + histogramRegistry.add("delta_eta/pos", "delta_eta vs fpos", kTProfile, {deltaEtaAxis}); + histogramRegistry.add("delta_eta/neg", "delta_eta vs fneg", kTProfile, {deltaEtaAxis}); + histogramRegistry.add("delta_eta/termp", "delta_eta vs termp", kTProfile, {deltaEtaAxis}); + histogramRegistry.add("delta_eta/termn", "delta_eta vs termn", kTProfile, {deltaEtaAxis}); + histogramRegistry.add("delta_eta/pos_sq", "delta_eta vs sqfpos", kTProfile, {deltaEtaAxis}); + histogramRegistry.add("delta_eta/neg_sq", "delta_eta vs sqfneg", kTProfile, {deltaEtaAxis}); + histogramRegistry.add("delta_eta/posneg", "delta_eta vs fpos*fneg", kTProfile, {deltaEtaAxis}); + + histogramRegistry.add("cent/pos", "cent vs fpos", kTProfile, {cent1Axis}); + histogramRegistry.add("cent/neg", "cent vs fneg", kTProfile, {cent1Axis}); + histogramRegistry.add("cent/termp", "cent vs termp", kTProfile, {cent1Axis}); + histogramRegistry.add("cent/termn", "cent vs termn", kTProfile, {cent1Axis}); + histogramRegistry.add("cent/pos_sq", "cent vs sqfpos", kTProfile, {cent1Axis}); + histogramRegistry.add("cent/neg_sq", "cent vs sqfneg", kTProfile, {cent1Axis}); + histogramRegistry.add("cent/posneg", "cent vs fpos*fneg", kTProfile, {cent1Axis}); + + histogramRegistry.add("cent/gen_pos", "cent vs fpos", kTProfile, {cent1Axis}); + histogramRegistry.add("cent/gen_neg", "cent vs fneg", kTProfile, {cent1Axis}); + histogramRegistry.add("cent/gen_termp", "cent vs termp", kTProfile, {cent1Axis}); + histogramRegistry.add("cent/gen_termn", "cent vs termn", kTProfile, {cent1Axis}); + histogramRegistry.add("cent/gen_pos_sq", "cent vs sqfpos", kTProfile, {cent1Axis}); + histogramRegistry.add("cent/gen_neg_sq", "cent vs sqfneg", kTProfile, {cent1Axis}); + histogramRegistry.add("cent/gen_posneg", "cent vs fpos*fneg", kTProfile, {cent1Axis}); + histogramRegistry.add("cent/gen_nch", "cent vs nch", kTProfile, {centAxis}); + + histogramRegistry.add("cor/hPt_cor", "", kTH1F, {ptAxis}); + histogramRegistry.add("cor/hEta_cor", "", kTH1F, {etaAxis}); + histogramRegistry.add("cor/nch_vs_nchCor", "", kTProfile, {nchAxis}); + histogramRegistry.add("cor/nchCor", "", kTH1F, {nchAxis}); + histogramRegistry.add("cor/cent_nchCor", "", kTH2F, {centAxis, nchAxis}); + histogramRegistry.add("cor/fpos_cent", "", kTProfile, {centAxis}); + histogramRegistry.add("cor/fneg_cent", "", kTProfile, {centAxis}); + + histogramRegistry.add("subsample/pos", "", kTProfile2D, {cent1Axis, subsampleAxis}); + histogramRegistry.add("subsample/neg", "", kTProfile2D, {cent1Axis, subsampleAxis}); + histogramRegistry.add("subsample/termp", "", kTProfile2D, {cent1Axis, subsampleAxis}); + histogramRegistry.add("subsample/termn", "", kTProfile2D, {cent1Axis, subsampleAxis}); + histogramRegistry.add("subsample/pos_sq", "", kTProfile2D, {cent1Axis, subsampleAxis}); + histogramRegistry.add("subsample/neg_sq", "", kTProfile2D, {cent1Axis, subsampleAxis}); + histogramRegistry.add("subsample/posneg", "", kTProfile2D, {cent1Axis, subsampleAxis}); + + if (cfgLoadEff) { + ccdb->setURL(cfgUrlCCDB.value); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + + // ccdb->setCreatedNotAfter(ccdbNoLaterThan.value); + // LOGF(info, "Getting object %s", ccdbPath.value.data()); + + TList* list = ccdb->getForTimeStamp(cfgPathCCDB.value, -1); + efficiency = reinterpret_cast(list->FindObject("efficiency_Run3")); + if (!efficiency) { + LOGF(info, "FATAL!! Could not find required histograms in CCDB"); + } + } } + template bool selCollision(C const& coll, float& cent, float& mult) { - histogramRegistry.fill(HIST("hVtxZ_before"), coll.posZ()); - if (std::abs(coll.posZ()) > vertexZcut) { + if (std::abs(coll.posZ()) > vertexZcut) return false; - } if constexpr (run == kRun3) { - if (cSel8Trig && !coll.sel8()) { return false; } // require min bias trigger cent = coll.centFT0M(); // centrality for run3 mult = coll.multFT0M(); // multiplicity for run3 - } else { + } else if constexpr (run == kRun2) { if (cInt7Trig && !coll.alias_bit(kINT7)) { return false; } @@ -243,276 +278,267 @@ struct NetchargeFluctuations { mult = coll.multFV0M(); // multiplicity for run2 } - if (cNoItsROBorder && !coll.selection_bit(aod::evsel::kNoITSROFrameBorder)) { + if (cNoItsROBorder && !coll.selection_bit(aod::evsel::kNoITSROFrameBorder)) return false; - } - - if (cTFBorder && !coll.selection_bit(aod::evsel::kNoTimeFrameBorder)) { + if (cTFBorder && !coll.selection_bit(aod::evsel::kNoTimeFrameBorder)) return false; - } - - if (cPileupReject && !coll.selection_bit(aod::evsel::kNoSameBunchPileup)) { + if (cPileupReject && !coll.selection_bit(aod::evsel::kNoSameBunchPileup)) return false; - } - - if (cZVtxTimeDiff && !coll.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { + if (cZVtxTimeDiff && !coll.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) return false; - } - - if (cItsTpcVtx && !coll.selection_bit(aod::evsel::kIsVertexITSTPC)) { + if (cItsTpcVtx && !coll.selection_bit(aod::evsel::kIsVertexITSTPC)) + return false; + if (cfgUseGoodItsLayerAllCut && !(coll.selection_bit(aod::evsel::kIsGoodITSLayersAll))) return false; - } - histogramRegistry.fill(HIST("hVtxZ_after"), coll.posZ()); - histogramRegistry.fill(HIST("hCentrality"), cent); - histogramRegistry.fill(HIST("hMultiplicity"), mult); return true; } + template void fillBeforeQA(T const& track) { - histogramRegistry.fill(HIST("hTPCchi2perCluster_before"), track.tpcChi2NCl()); - histogramRegistry.fill(HIST("hITSchi2perCluster_before"), track.itsChi2NCl()); - histogramRegistry.fill(HIST("hTPCCrossedrows_before"), track.tpcNClsCrossedRows()); - histogramRegistry.fill(HIST("hDcaXY_before"), track.dcaXY()); - histogramRegistry.fill(HIST("hDcaZ_before"), track.dcaZ()); - histogramRegistry.fill(HIST("hPtDcaXY_before"), track.pt(), track.dcaXY()); - histogramRegistry.fill(HIST("hPtDcaZ_before"), track.pt(), track.dcaZ()); + histogramRegistry.fill(HIST("data/hTPCchi2perCluster_before"), track.tpcChi2NCl()); + histogramRegistry.fill(HIST("data/hITSchi2perCluster_before"), track.itsChi2NCl()); + histogramRegistry.fill(HIST("data/hTPCCrossedrows_before"), track.tpcNClsCrossedRows()); + histogramRegistry.fill(HIST("data/hDcaXY_before"), track.dcaXY()); + histogramRegistry.fill(HIST("data/hDcaZ_before"), track.dcaZ()); + histogramRegistry.fill(HIST("data/hPtDcaXY_before"), track.pt(), track.dcaXY()); + histogramRegistry.fill(HIST("data/hPtDcaZ_before"), track.pt(), track.dcaZ()); } template void fillAfterQA(T const& track) { - histogramRegistry.fill(HIST("hDcaXY_after"), track.dcaXY()); - histogramRegistry.fill(HIST("hDcaZ_after"), track.dcaZ()); - histogramRegistry.fill(HIST("hPt"), track.pt()); - histogramRegistry.fill(HIST("hEta"), track.eta()); - histogramRegistry.fill(HIST("hPtDcaXY_after"), track.pt(), track.dcaXY()); - histogramRegistry.fill(HIST("hPtDcaZ_after"), track.pt(), track.dcaZ()); - histogramRegistry.fill(HIST("hTPCCrossedrows_after"), track.tpcNClsCrossedRows()); - histogramRegistry.fill(HIST("hTPCchi2perCluster_after"), track.tpcChi2NCl()); - histogramRegistry.fill(HIST("hITSchi2perCluster_after"), track.itsChi2NCl()); - } - - template - void nchDistribution(N const& nch, C const& cent) - { - constexpr int kCent0Min = 0, kCent0Max = 5; - constexpr int kCent1Min = 5, kCent1Max = 10; - constexpr int kCent2Min = 10, kCent2Max = 20; - constexpr int kCent3Min = 20, kCent3Max = 30; - constexpr int kCent4Min = 30, kCent4Max = 40; - constexpr int kCent5Min = 40, kCent5Max = 50; - constexpr int kCent6Min = 50, kCent6Max = 60; - constexpr int kCent7Min = 60, kCent7Max = 70; - constexpr int kCent8Min = 70, kCent8Max = 80; - constexpr int kCent9Min = 80, kCent9Max = 90; - - histogramRegistry.fill(HIST("nch"), nch); - histogramRegistry.fill(HIST("nch_cent"), cent, nch); - - if (cent >= kCent0Min && cent < kCent0Max) - histogramRegistry.fill(HIST("nch0"), nch); - else if (cent >= kCent1Min && cent < kCent1Max) - histogramRegistry.fill(HIST("nch1"), nch); - else if (cent >= kCent2Min && cent < kCent2Max) - histogramRegistry.fill(HIST("nch2"), nch); - else if (cent >= kCent3Min && cent < kCent3Max) - histogramRegistry.fill(HIST("nch3"), nch); - else if (cent >= kCent4Min && cent < kCent4Max) - histogramRegistry.fill(HIST("nch4"), nch); - else if (cent >= kCent5Min && cent < kCent5Max) - histogramRegistry.fill(HIST("nch5"), nch); - else if (cent >= kCent6Min && cent < kCent6Max) - histogramRegistry.fill(HIST("nch6"), nch); - else if (cent >= kCent7Min && cent < kCent7Max) - histogramRegistry.fill(HIST("nch7"), nch); - else if (cent >= kCent8Min && cent < kCent8Max) - histogramRegistry.fill(HIST("nch8"), nch); - else if (cent >= kCent9Min && cent < kCent9Max) - histogramRegistry.fill(HIST("nch9"), nch); + histogramRegistry.fill(HIST("data/hDcaXY_after"), track.dcaXY()); + histogramRegistry.fill(HIST("data/hDcaZ_after"), track.dcaZ()); + histogramRegistry.fill(HIST("data/hPt"), track.pt()); + histogramRegistry.fill(HIST("data/hEta"), track.eta()); + histogramRegistry.fill(HIST("data/hPt_eta"), track.pt(), track.eta()); + histogramRegistry.fill(HIST("data/hPtDcaXY_after"), track.pt(), track.dcaXY()); + histogramRegistry.fill(HIST("data/hPtDcaZ_after"), track.pt(), track.dcaZ()); + histogramRegistry.fill(HIST("data/hTPCCrossedrows_after"), track.tpcNClsCrossedRows()); + histogramRegistry.fill(HIST("data/hTPCchi2perCluster_after"), track.tpcChi2NCl()); + histogramRegistry.fill(HIST("data/hITSchi2perCluster_after"), track.itsChi2NCl()); } template bool selTrack(T const& track) { - if (!track.isGlobalTrack()) { + if (!track.isGlobalTrack()) return false; - } // accept only global tracks - - if (std::fabs(track.eta()) >= etaCut) { + if (std::fabs(track.eta()) >= etaCut) return false; - } - - if (track.pt() <= ptMinCut || track.pt() >= ptMaxCut) { + if (track.pt() <= ptMinCut || track.pt() >= ptMaxCut) return false; - } - - if (track.sign() == 0) { + if (track.sign() == 0) return false; - } - /* if (std::fabs(track.dcaXY()) > dcaXYCut) { - return false; - } - - if (std::fabs(track.dcaZ()) > dcaZCut) { - return false ; - }*/ - - /* - if (track.tpcNClsCrossedRows() < tpcCrossCut) { + if (cDcaXy && std::fabs(track.dcaXY()) > dcaXYCut) return false; - } - - if (track.itsChi2NCl() > itsChiCut) { + if (cDcaZ && std::fabs(track.dcaZ()) > dcaZCut) return false; - } - - if (track.tpcChi2NCl() > tpcChiCut) { + if (cTpcCr && track.tpcNClsCrossedRows() < tpcCrossCut) + return false; + if (cItsChi && track.itsChi2NCl() > itsChiCut) + return false; + if (cTpcChi && track.tpcChi2NCl() > tpcChiCut) return false; - } - -*/ return true; } + double getEfficiency(double pt, double eta, TH2D* hEff) + { + if (!hEff) { + LOGF(error, "Efficiency histogram is null — check CCDB loading."); + return 1e-6; + } + int binX = hEff->GetXaxis()->FindBin(pt); + int binY = hEff->GetYaxis()->FindBin(eta); + if (binX < 1 || binX > hEff->GetNbinsX() || binY < 1 || binY > hEff->GetNbinsY()) { + LOGF(warn, "pt or eta out of histogram bounds: pt = %f, eta = %f", pt, eta); + return 1e-6; + } + double eff = hEff->GetBinContent(binX, binY); + return eff; + } + + void fillHistograms(float nch, float cent, float fpos, float fneg, float posneg, float termp, float termn) + { + histogramRegistry.fill(HIST("mult_dist/nch"), nch); + histogramRegistry.fill(HIST("mult_dist/nch_cent"), cent, nch); + histogramRegistry.fill(HIST("mult_dist/nch_pos"), fpos); + histogramRegistry.fill(HIST("mult_dist/nch_pos_cent"), cent, fpos); + histogramRegistry.fill(HIST("mult_dist/nch_neg"), fneg); + histogramRegistry.fill(HIST("mult_dist/nch_neg_cent"), cent, fneg); + histogramRegistry.fill(HIST("mult_dist/nch_negpos"), posneg); + histogramRegistry.fill(HIST("mult_dist/nch_negpos_cent"), cent, posneg); + + histogramRegistry.fill(HIST("cent/pos"), cent, fpos); + histogramRegistry.fill(HIST("cent/neg"), cent, fneg); + histogramRegistry.fill(HIST("cent/termp"), cent, termp); + histogramRegistry.fill(HIST("cent/termn"), cent, termn); + histogramRegistry.fill(HIST("cent/pos_sq"), cent, fpos * fpos); + histogramRegistry.fill(HIST("cent/neg_sq"), cent, fneg * fneg); + histogramRegistry.fill(HIST("cent/posneg"), cent, posneg); + + float lRandom = fRndm->Rndm(); + int sampleIndex = static_cast(cfgNSubsample * lRandom); + + histogramRegistry.fill(HIST("subsample/pos"), cent, sampleIndex, fpos); + histogramRegistry.fill(HIST("subsample/neg"), cent, sampleIndex, fneg); + histogramRegistry.fill(HIST("subsample/termp"), cent, sampleIndex, termp); + histogramRegistry.fill(HIST("subsample/termn"), cent, sampleIndex, termn); + histogramRegistry.fill(HIST("subsample/pos_sq"), cent, sampleIndex, fpos * fpos); + histogramRegistry.fill(HIST("subsample/neg_sq"), cent, sampleIndex, fneg * fneg); + histogramRegistry.fill(HIST("subsample/posneg"), cent, sampleIndex, posneg); + } + template void calculationData(C const& coll, T const& tracks) { float cent = -1, mult = -1; + histogramRegistry.fill(HIST("data/hVtxZ_before"), coll.posZ()); if (!selCollision(coll, cent, mult)) { return; } + histogramRegistry.fill(HIST("data/hVtxZ_after"), coll.posZ()); + histogramRegistry.fill(HIST("data/hCentrality"), cent); + histogramRegistry.fill(HIST("data/hMultiplicity"), mult); + int fpos = 0, fneg = 0, posneg = 0, termn = 0, termp = 0; - int nch = 0; + int nch = 0, nchCor = 0; + double posWeight = 0, negWeight = 0; for (const auto& track : tracks) { fillBeforeQA(track); - - if (!selTrack(track)) { + if (!selTrack(track)) continue; - } nch += 1; - fillAfterQA(track); + histogramRegistry.fill(HIST("data/hEta_cent"), cent, track.eta()); + histogramRegistry.fill(HIST("data/hPt_cent"), cent, track.pt()); + + double eff = getEfficiency(track.pt(), track.eta(), efficiency); + if (eff < threshold) + continue; + double weight = 1.0 / eff; + + histogramRegistry.fill(HIST("cor/hPt_cor"), track.pt(), weight); + histogramRegistry.fill(HIST("cor/hEta_cor"), track.eta(), weight); + + nchCor += weight; if (track.sign() == 1) { fpos += 1; + posWeight += weight; } else if (track.sign() == -1) { fneg += 1; + negWeight += weight; } + } // track termp = fpos * (fpos - 1); termn = fneg * (fneg - 1); posneg = fpos * fneg; - - nchDistribution(nch, cent); - - histogramRegistry.fill(HIST("nch_pos"), fpos); - histogramRegistry.fill(HIST("nch_pos_cent"), cent, fpos); - histogramRegistry.fill(HIST("nch_neg"), fneg); - histogramRegistry.fill(HIST("nch_neg_cent"), cent, fneg); - histogramRegistry.fill(HIST("nch_negpos"), posneg); - histogramRegistry.fill(HIST("nch_negpos_cent"), cent, posneg); - - netCharge(fpos, fneg, fpos * fpos, fneg * fneg, termp, termn, posneg, cent); + histogramRegistry.fill(HIST("cor/nch_vs_nchCor"), nch, nchCor); + histogramRegistry.fill(HIST("cor/nchCor"), nchCor); + histogramRegistry.fill(HIST("cor/cent_nchCor"), cent, nchCor); + histogramRegistry.fill(HIST("cor/fpos_cent"), cent, posWeight); + histogramRegistry.fill(HIST("cor/fneg_cent"), cent, negWeight); + fillHistograms(nch, cent, fpos, fneg, posneg, termp, termn); } template void calculationMc(C const& coll, T const& inputTracks, M const& mcCollisions, P const& mcParticles) { (void)mcCollisions; - if (!coll.has_mcCollision()) { return; } - histogramRegistry.fill(HIST("gen_hVtxZ_before"), coll.mcCollision().posZ()); - + histogramRegistry.fill(HIST("gen/hVtxZ_before"), coll.mcCollision().posZ()); float cent = -1, mult = -1; - + histogramRegistry.fill(HIST("data/hVtxZ_before"), coll.posZ()); if (!selCollision(coll, cent, mult)) { return; } + histogramRegistry.fill(HIST("data/hVtxZ_after"), coll.posZ()); + histogramRegistry.fill(HIST("data/hCentrality"), cent); + histogramRegistry.fill(HIST("data/hMultiplicity"), mult); int fpos = 0, fneg = 0, posneg = 0, termn = 0, termp = 0; - int nch = 0; + int nch = 0, nchCor = 0; + double posRecWeight = 0, negRecWeight = 0; for (const auto& track : inputTracks) { - fillBeforeQA(track); - - if (!selTrack(track)) { + if (!selTrack(track)) continue; - } nch += 1; - fillAfterQA(track); + histogramRegistry.fill(HIST("data/hEta_cent"), cent, track.eta()); + histogramRegistry.fill(HIST("data/hPt_cent"), cent, track.pt()); + + double eff = getEfficiency(track.pt(), track.eta(), efficiency); + if (eff < threshold) + continue; + double weight = 1.0 / eff; + histogramRegistry.fill(HIST("cor/hPt_cor"), track.pt(), weight); + histogramRegistry.fill(HIST("cor/hEta_cor"), track.eta(), weight); + nchCor += weight; if (track.sign() == 1) { fpos += 1; + posRecWeight += weight; } else if (track.sign() == -1) { fneg += 1; + negRecWeight += weight; } } // track termp = fpos * (fpos - 1); - termn = fneg * (fneg - 1); - posneg = fpos * fneg; - nchDistribution(nch, cent); + termn = fneg * (fneg - 1); - histogramRegistry.fill(HIST("nch_pos"), fpos); - histogramRegistry.fill(HIST("nch_pos_cent"), cent, fpos); - histogramRegistry.fill(HIST("nch_neg"), fneg); - histogramRegistry.fill(HIST("nch_neg_cent"), cent, fneg); - histogramRegistry.fill(HIST("nch_negpos"), posneg); - histogramRegistry.fill(HIST("nch_negpos_cent"), cent, posneg); + posneg = fpos * fneg; + histogramRegistry.fill(HIST("cor/nch_vs_nchCor"), nch, nchCor); + histogramRegistry.fill(HIST("cor/nchCor"), nchCor); + histogramRegistry.fill(HIST("cor/cent_nchCor"), cent, nchCor); + histogramRegistry.fill(HIST("cor/fpos_cent"), cent, posRecWeight); + histogramRegistry.fill(HIST("cor/fneg_cent"), cent, negRecWeight); - netCharge(fpos, fneg, fpos * fpos, fneg * fneg, termp, termn, posneg, cent); + fillHistograms(nch, cent, fpos, fneg, posneg, termp, termn); - int posGen = 0, negGen = 0, posNegGen = 0, termNGen = 0, termPGen = 0; + int posGen = 0, negGen = 0, posNegGen = 0, termNGen = 0, termPGen = 0, nchGen = 0; const auto& mccolgen = coll.template mcCollision_as(); - - /* if (std::abs(mccolgen.posZ()) > vertexZcut) { - return; - }*/ - + if (std::abs(mccolgen.posZ()) > vertexZcut) + return; const auto& mcpartgen = mcParticles.sliceByCached(aod::mcparticle::mcCollisionId, mccolgen.globalIndex(), cache); - histogramRegistry.fill(HIST("gen_hVtxZ_after"), mccolgen.posZ()); - + histogramRegistry.fill(HIST("gen/hVtxZ_after"), mccolgen.posZ()); for (const auto& mcpart : mcpartgen) { - - if (!mcpart.isPhysicalPrimary()) { + if (!mcpart.isPhysicalPrimary()) continue; - } int pid = mcpart.pdgCode(); auto sign = 0; auto* pd = pdgService->GetParticle(pid); if (pd != nullptr) { sign = pd->Charge() / 3.; } - - if (sign == 0) { + if (sign == 0) continue; - } - - if (std::abs(pid) != kElectron && std::abs(pid) != kMuonMinus && std::abs(pid) != kPiPlus && std::abs(pid) != kKPlus && std::abs(pid) != kProton) { + if (std::abs(pid) != kElectron && std::abs(pid) != kMuonMinus && std::abs(pid) != kPiPlus && std::abs(pid) != kKPlus && std::abs(pid) != kProton) continue; - } - if (std::fabs(mcpart.eta()) > etaCut) continue; - if ((mcpart.pt() <= ptMinCut) || (mcpart.pt() >= ptMaxCut)) continue; - - histogramRegistry.fill(HIST("gen_hPt"), mcpart.pt()); - histogramRegistry.fill(HIST("gen_hEta"), mcpart.eta()); - histogramRegistry.fill(HIST("gen_hSign"), sign); - + histogramRegistry.fill(HIST("gen/hPt"), mcpart.pt()); + histogramRegistry.fill(HIST("gen/hPt_cent"), cent, mcpart.pt()); + histogramRegistry.fill(HIST("gen/hEta"), mcpart.eta()); + histogramRegistry.fill(HIST("gen/hEta_cent"), cent, mcpart.eta()); + histogramRegistry.fill(HIST("gen/hSign"), sign); + histogramRegistry.fill(HIST("gen/hPt_eta"), mcpart.pt(), mcpart.eta()); + nchGen += 1; if (sign == 1) { posGen += 1; } - if (sign == -1) { negGen += 1; } @@ -520,151 +546,126 @@ struct NetchargeFluctuations { termPGen = posGen * (posGen - 1); termNGen = negGen * (negGen - 1); posNegGen = posGen * negGen; - - netChargeGen(posGen, negGen, posGen * posGen, negGen * negGen, - termPGen, termNGen, posNegGen, cent); + histogramRegistry.fill(HIST("cent/gen_pos"), cent, posGen); + histogramRegistry.fill(HIST("cent/gen_neg"), cent, negGen); + histogramRegistry.fill(HIST("cent/gen_termp"), cent, termPGen); + histogramRegistry.fill(HIST("cent/gen_termn"), cent, termNGen); + histogramRegistry.fill(HIST("cent/gen_pos_sq"), cent, posGen * posGen); + histogramRegistry.fill(HIST("cent/gen_neg_sq"), cent, negGen * negGen); + histogramRegistry.fill(HIST("cent/gen_posneg"), cent, posNegGen); + histogramRegistry.fill(HIST("cent/gen_nch"), cent, nchGen); + histogramRegistry.fill(HIST("gen/nch"), nchGen); } // void + template + void calculationDeltaEta(C const& coll, T const& tracks, float deta1, float deta2) + { + float cent = -1, mult = -1; + if (!selCollision(coll, cent, mult)) + return; + if (!(cent >= centMin && cent < centMax)) + return; + histogramRegistry.fill(HIST("delta_eta/cent"), cent); + + int fpos = 0, fneg = 0, posneg = 0, termn = 0, termp = 0; + for (const auto& track : tracks) { + if (!selTrack(track)) + continue; + double eta = track.eta(); + if (eta < deta1 || eta > deta2) + continue; + + histogramRegistry.fill(HIST("delta_eta/track_eta"), eta); + + if (track.sign() == 1) + fpos++; + else if (track.sign() == -1) + fneg++; + } + termp = fpos * (fpos - 1); + termn = fneg * (fneg - 1); + posneg = fpos * fneg; + + float deltaEtaWidth = deta2 - deta1 + 1e-5f; + + histogramRegistry.fill(HIST("delta_eta/pos"), deltaEtaWidth, fpos); + histogramRegistry.fill(HIST("delta_eta/neg"), deltaEtaWidth, fneg); + histogramRegistry.fill(HIST("delta_eta/termp"), deltaEtaWidth, termp); + histogramRegistry.fill(HIST("delta_eta/termn"), deltaEtaWidth, termn); + histogramRegistry.fill(HIST("delta_eta/pos_sq"), deltaEtaWidth, fpos * fpos); + histogramRegistry.fill(HIST("delta_eta/neg_sq"), deltaEtaWidth, fneg * fneg); + histogramRegistry.fill(HIST("delta_eta/posneg"), deltaEtaWidth, posneg); + } + SliceCache cache; Preslice mcTrack = o2::aod::mcparticle::mcCollisionId; + // process function for Data Run3 void processDataRun3(aod::MyCollisionRun3 const& coll, aod::MyTracks const& tracks) { calculationData(coll, tracks); + for (int ii = 0; ii < deltaEta; ii++) { + float etaMin = -0.1f * (ii + 1); + float etaMax = 0.1f * (ii + 1); + + calculationDeltaEta(coll, tracks, etaMin, etaMax); + } } - PROCESS_SWITCH(NetchargeFluctuations, processDataRun3, "Process for Run3 DATA", true); + PROCESS_SWITCH(NetchargeFluctuations, processDataRun3, "Process for Run3 DATA", false); + // process function for Data Run2 void processDataRun2(aod::MyCollisionRun2 const& coll, aod::MyTracks const& tracks) { calculationData(coll, tracks); + for (int ii = 0; ii < deltaEta; ii++) { + float etaMin = -0.1f * (ii + 1); // -0.1, -0.2, ..., -0.8 + float etaMax = 0.1f * (ii + 1); // +0.1, +0.2, ..., +0.8 + + calculationDeltaEta(coll, tracks, etaMin, etaMax); + } } PROCESS_SWITCH(NetchargeFluctuations, processDataRun2, "Process for Run2 DATA", false); + // process function for MC Run3 + void processMcRun3(aod::MyMCCollisionRun3 const& coll, aod::MyMCTracks const& inputTracks, aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) { calculationMc(coll, inputTracks, mcCollisions, mcParticles); + + for (int ii = 0; ii < deltaEta; ii++) { + float etaMin = -0.1f * (ii + 1); + float etaMax = 0.1f * (ii + 1); + + calculationDeltaEta(coll, inputTracks, etaMin, etaMax); + } } PROCESS_SWITCH(NetchargeFluctuations, processMcRun3, "Process reconstructed", false); + // process function for MC Run2 + void processMcRun2(aod::MyMCCollisionRun2 const& coll, aod::MyMCTracks const& inputTracks, aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) { calculationMc(coll, inputTracks, mcCollisions, mcParticles); - } + for (int ii = 0; ii < deltaEta; ii++) { + float etaMin = -0.1f * (ii + 1); // -0.1, -0.2, ..., -0.8 + float etaMax = 0.1f * (ii + 1); // +0.1, +0.2, ..., +0.8 - PROCESS_SWITCH(NetchargeFluctuations, processMcRun2, "Process reconstructed", false); - -}; // struct - -struct NetchargeAnalysis { - Configurable cfSubSample{"cfSubSample", 30, "Number of subsamples"}; - HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject}; - std::vector>> net; - std::vector>> subSample; - std::vector>> genSubSample; - TRandom3* fRndm = new TRandom3(0); - - void init(o2::framework::InitContext&) - { - std::vector centBinning = {0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}; - AxisSpec centAxis = {centBinning, "centrality"}; - - registry.add("data/pos_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("data/neg_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("data/termp_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("data/termn_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("data/pos_sq_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("data/neg_sq_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("data/posneg_vs_cent", "", {HistType::kTProfile, {centAxis}}); - - registry.add("gen/pos_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("gen/neg_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("gen/termp_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("gen/termn_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("gen/pos_sq_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("gen/neg_sq_vs_cent", "", {HistType::kTProfile, {centAxis}}); - registry.add("gen/posneg_vs_cent", "", {HistType::kTProfile, {centAxis}}); - - subSample.resize(cfSubSample); - genSubSample.resize(cfSubSample); - - for (int i = 0; i < cfSubSample; ++i) { - subSample[i].resize(7); - genSubSample[i].resize(7); - - subSample[i][0] = std::get>(registry.add(Form("data/subSample_%d/pos_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - subSample[i][1] = std::get>(registry.add(Form("data/subSample_%d/neg_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - subSample[i][2] = std::get>(registry.add(Form("data/subSample_%d/termp_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - subSample[i][3] = std::get>(registry.add(Form("data/subSample_%d/termn_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - subSample[i][4] = std::get>(registry.add(Form("data/subSample_%d/pos_sq_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - subSample[i][5] = std::get>(registry.add(Form("data/subSample_%d/neg_sq_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - subSample[i][6] = std::get>(registry.add(Form("data/subSample_%d/posneg_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - - genSubSample[i][0] = std::get>(registry.add(Form("gen/genSubSample_%d/pos_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - genSubSample[i][1] = std::get>(registry.add(Form("gen/genSubSample_%d/neg_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - genSubSample[i][2] = std::get>(registry.add(Form("gen/genSubSample_%d/termp_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - genSubSample[i][3] = std::get>(registry.add(Form("gen/genSubSample_%d/termn_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - genSubSample[i][4] = std::get>(registry.add(Form("gen/genSubSample_%d/pos_sq_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - genSubSample[i][5] = std::get>(registry.add(Form("gen/genSubSample_%d/neg_sq_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); - genSubSample[i][6] = std::get>(registry.add(Form("gen/genSubSample_%d/posneg_vs_cent", i), "", {HistType::kTProfile, {centAxis}})); + calculationDeltaEta(coll, inputTracks, etaMin, etaMax); } + } - } // void - - void processData(aod::NetCharge::iterator const& event_netcharge) - { - registry.get(HIST("data/pos_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.posCharge()); - registry.get(HIST("data/neg_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.negCharge()); - registry.get(HIST("data/termp_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.termPCharge()); - registry.get(HIST("data/termn_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.termNCharge()); - registry.get(HIST("data/pos_sq_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.posSqCharge()); - registry.get(HIST("data/neg_sq_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.negSqCharge()); - registry.get(HIST("data/posneg_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.posNegCharge()); - - int sampleIndex = static_cast(cfSubSample * fRndm->Rndm()); - subSample[sampleIndex][0]->Fill(event_netcharge.centrality(), event_netcharge.posCharge()); - subSample[sampleIndex][1]->Fill(event_netcharge.centrality(), event_netcharge.negCharge()); - subSample[sampleIndex][2]->Fill(event_netcharge.centrality(), event_netcharge.termPCharge()); - subSample[sampleIndex][3]->Fill(event_netcharge.centrality(), event_netcharge.termNCharge()); - subSample[sampleIndex][4]->Fill(event_netcharge.centrality(), event_netcharge.posSqCharge()); - subSample[sampleIndex][5]->Fill(event_netcharge.centrality(), event_netcharge.negSqCharge()); - subSample[sampleIndex][6]->Fill(event_netcharge.centrality(), event_netcharge.posNegCharge()); - } // void - PROCESS_SWITCH(NetchargeAnalysis, processData, "Process reconstructed and Data", true); - - void processGen(aod::NetChargeGen::iterator const& event_netcharge) - { - registry.get(HIST("gen/pos_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.posCharge()); - registry.get(HIST("gen/neg_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.negCharge()); - registry.get(HIST("gen/termp_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.termPCharge()); - registry.get(HIST("gen/termn_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.termNCharge()); - registry.get(HIST("gen/pos_sq_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.posSqCharge()); - registry.get(HIST("gen/neg_sq_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.negSqCharge()); - registry.get(HIST("gen/posneg_vs_cent"))->Fill(event_netcharge.centrality(), event_netcharge.posNegCharge()); - - int sampleIndex = static_cast(cfSubSample * fRndm->Rndm()); - genSubSample[sampleIndex][0]->Fill(event_netcharge.centrality(), event_netcharge.posCharge()); - genSubSample[sampleIndex][1]->Fill(event_netcharge.centrality(), event_netcharge.negCharge()); - genSubSample[sampleIndex][2]->Fill(event_netcharge.centrality(), event_netcharge.termPCharge()); - genSubSample[sampleIndex][3]->Fill(event_netcharge.centrality(), event_netcharge.termNCharge()); - genSubSample[sampleIndex][4]->Fill(event_netcharge.centrality(), event_netcharge.posSqCharge()); - genSubSample[sampleIndex][5]->Fill(event_netcharge.centrality(), event_netcharge.negSqCharge()); - genSubSample[sampleIndex][6]->Fill(event_netcharge.centrality(), event_netcharge.posNegCharge()); - } // void - PROCESS_SWITCH(NetchargeAnalysis, processGen, "Process generated", true); - -}; // struct Netcharge_analysis + PROCESS_SWITCH(NetchargeFluctuations, processMcRun2, "Process reconstructed", true); +}; +// struct WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ - {adaptAnalysisTask(cfgc)}, - {adaptAnalysisTask(cfgc)} - - }; + {adaptAnalysisTask(cfgc)}}; } From f6feb07b8981375be754623cbf00c373f1abbdf2 Mon Sep 17 00:00:00 2001 From: blacwovie Date: Sun, 3 Aug 2025 19:16:54 +0800 Subject: [PATCH 208/345] [PWGCF] Update PiDeuteronFemto.cxx (#12402) Co-authored-by: ALICE Action Bot --- PWGCF/Femto/TableProducer/PiDeuteronFemto.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/PWGCF/Femto/TableProducer/PiDeuteronFemto.cxx b/PWGCF/Femto/TableProducer/PiDeuteronFemto.cxx index dbfd962f801..6eaf78e8036 100644 --- a/PWGCF/Femto/TableProducer/PiDeuteronFemto.cxx +++ b/PWGCF/Femto/TableProducer/PiDeuteronFemto.cxx @@ -404,13 +404,10 @@ struct PiDeuteronFemto { mQaRegistry.fill(HIST("h2NsigmaPiTPC_preselection"), candidate.tpcInnerParam(), tpcNSigmaPi); if (std::abs(candidate.pt()) < settingCutPiptMin || std::abs(candidate.pt()) > settingCutPiptMax) return false; - if (candidate.hasTOF() && candidate.tpcInnerParam() > settingCutPinMinTOFPi) { + if (candidate.hasTOF() && candidate.tpcInnerParam() >= settingCutPinMinTOFPi) { auto tofNSigmaPi = candidate.tofNSigmaPi(); auto combNsigma = std::sqrt(tofNSigmaPi * tofNSigmaPi + tpcNSigmaPi * tpcNSigmaPi); - if (std::abs(tpcNSigmaPi) > settingCutNsigmaTPCPi) { - return false; - } mQaRegistry.fill(HIST("h2NsigmaPiTOF_preselection"), candidate.pt(), tofNSigmaPi); if (combNsigma > settingCutNsigmaTOFTPCPi) { return false; @@ -419,7 +416,10 @@ struct PiDeuteronFemto { mQaRegistry.fill(HIST("h2NsigmaPiTOF"), candidate.sign() * candidate.pt(), tofNSigmaPi); mQaRegistry.fill(HIST("h2NsigmaPiComb"), candidate.sign() * candidate.pt(), combNsigma); return true; - } else if (std::abs(tpcNSigmaPi) < settingCutNsigmaTPCPi) { + } else if (candidate.tpcInnerParam() < settingCutPinMinTOFPi) { + if (std::abs(tpcNSigmaPi) > settingCutNsigmaTPCPi) { + return false; + } mQaRegistry.fill(HIST("h2NsigmaPiTPC"), candidate.sign() * candidate.pt(), tpcNSigmaPi); return true; } From f9458c23ff4ae221faa49c15c6819b6b353099ee Mon Sep 17 00:00:00 2001 From: altsybee Date: Sun, 3 Aug 2025 14:17:40 +0200 Subject: [PATCH 209/345] [DPG] tuning of evsel cuts (#12403) --- DPG/Tasks/AOTEvent/lightIonsEvSelQa.cxx | 525 +++++++++++++----------- 1 file changed, 287 insertions(+), 238 deletions(-) diff --git a/DPG/Tasks/AOTEvent/lightIonsEvSelQa.cxx b/DPG/Tasks/AOTEvent/lightIonsEvSelQa.cxx index f079f43a3ec..59c88b55171 100644 --- a/DPG/Tasks/AOTEvent/lightIonsEvSelQa.cxx +++ b/DPG/Tasks/AOTEvent/lightIonsEvSelQa.cxx @@ -146,45 +146,45 @@ struct LightIonsEvSelQa { histos.add("noSpecSelections/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); histos.add("noSpecSelections/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); - histos.add("noPileup/hBcColNoSel8", "", kTH1F, {axisBCs}); - histos.add("noPileup/hBcTVX", "", kTH1F, {axisBCs}); - histos.add("noPileup/hBcFT0", "", kTH1F, {axisBCs}); - histos.add("noPileup/hBcFV0", "", kTH1F, {axisBCs}); - histos.add("noPileup/hBcFDD", "", kTH1F, {axisBCs}); - histos.add("noPileup/hBcZDC", "", kTH1F, {axisBCs}); - histos.add("noPileup/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); - histos.add("noPileup/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); - histos.add("noPileup/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); - histos.add("noPileup/nTracksPV_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracks}); - histos.add("noPileup/nTracksPV_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracks}); - histos.add("noPileup/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); - histos.add("noPileup/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); - histos.add("noPileup/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); - histos.add("noPileup/hTVXvsBcDiff", "", kTH1F, {axisBcDiff}); - histos.add("noPileup/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); - histos.add("noPileup/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); - - histos.add("pvTOFmatched/hBcColNoSel8", "", kTH1F, {axisBCs}); - histos.add("pvTOFmatched/hBcColNoSel8TOF", "", kTH1F, {axisBCs}); - histos.add("pvTOFmatched/hBcTVX", "", kTH1F, {axisBCs}); - histos.add("pvTOFmatched/hBcFT0", "", kTH1F, {axisBCs}); - histos.add("pvTOFmatched/hBcFV0", "", kTH1F, {axisBCs}); - histos.add("pvTOFmatched/hBcFDD", "", kTH1F, {axisBCs}); - histos.add("pvTOFmatched/hBcZDC", "", kTH1F, {axisBCs}); - histos.add("pvTOFmatched/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); - histos.add("pvTOFmatched/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); - histos.add("pvTOFmatched/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); - histos.add("pvTOFmatched/nTracksPV_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracks}); - histos.add("pvTOFmatched/nTracksPV_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracks}); - histos.add("pvTOFmatched/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); - histos.add("pvTOFmatched/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); - histos.add("pvTOFmatched/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); - histos.add("pvTOFmatched/hTVXvsBcDiff", "", kTH1F, {axisBcDiff}); - histos.add("pvTOFmatched/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); - histos.add("pvTOFmatched/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); + histos.add("noPU/hBcColNoSel8", "", kTH1F, {axisBCs}); + histos.add("noPU/hBcTVX", "", kTH1F, {axisBCs}); + histos.add("noPU/hBcFT0", "", kTH1F, {axisBCs}); + histos.add("noPU/hBcFV0", "", kTH1F, {axisBCs}); + histos.add("noPU/hBcFDD", "", kTH1F, {axisBCs}); + histos.add("noPU/hBcZDC", "", kTH1F, {axisBCs}); + histos.add("noPU/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); + histos.add("noPU/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); + histos.add("noPU/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("noPU/nTracksPV_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracks}); + histos.add("noPU/nTracksPV_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracks}); + histos.add("noPU/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); + histos.add("noPU/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); + histos.add("noPU/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); + histos.add("noPU/hTVXvsBcDiff", "", kTH1F, {axisBcDiff}); + histos.add("noPU/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); + histos.add("noPU/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); + + histos.add("noPU_pvTOFmatched/hBcColNoSel8", "", kTH1F, {axisBCs}); + // histos.add("noPU_pvTOFmatched/hBcColNoSel8TOF", "", kTH1F, {axisBCs}); + histos.add("noPU_pvTOFmatched/hBcTVX", "", kTH1F, {axisBCs}); + histos.add("noPU_pvTOFmatched/hBcFT0", "", kTH1F, {axisBCs}); + histos.add("noPU_pvTOFmatched/hBcFV0", "", kTH1F, {axisBCs}); + histos.add("noPU_pvTOFmatched/hBcFDD", "", kTH1F, {axisBCs}); + histos.add("noPU_pvTOFmatched/hBcZDC", "", kTH1F, {axisBCs}); + histos.add("noPU_pvTOFmatched/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); + histos.add("noPU_pvTOFmatched/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); + histos.add("noPU_pvTOFmatched/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("noPU_pvTOFmatched/nTracksPV_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracks}); + histos.add("noPU_pvTOFmatched/nTracksPV_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracks}); + histos.add("noPU_pvTOFmatched/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); + histos.add("noPU_pvTOFmatched/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); + histos.add("noPU_pvTOFmatched/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); + histos.add("noPU_pvTOFmatched/hTVXvsBcDiff", "", kTH1F, {axisBcDiff}); + histos.add("noPU_pvTOFmatched/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); + histos.add("noPU_pvTOFmatched/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); histos.add("bcDiffCut/hBcColNoSel8", "", kTH1F, {axisBCs}); - histos.add("bcDiffCut/hBcColNoSel8TOF", "", kTH1F, {axisBCs}); + // histos.add("bcDiffCut/hBcColNoSel8TOF", "", kTH1F, {axisBCs}); histos.add("bcDiffCut/hBcTVX", "", kTH1F, {axisBCs}); histos.add("bcDiffCut/hBcFT0", "", kTH1F, {axisBCs}); histos.add("bcDiffCut/hBcFV0", "", kTH1F, {axisBCs}); @@ -220,6 +220,24 @@ struct LightIonsEvSelQa { histos.add("narrowTimeVeto/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); histos.add("narrowTimeVeto/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); + histos.add("strictTimeVeto/hBcColNoSel8", "", kTH1F, {axisBCs}); + histos.add("strictTimeVeto/hBcTVX", "", kTH1F, {axisBCs}); + histos.add("strictTimeVeto/hBcFT0", "", kTH1F, {axisBCs}); + histos.add("strictTimeVeto/hBcFV0", "", kTH1F, {axisBCs}); + histos.add("strictTimeVeto/hBcFDD", "", kTH1F, {axisBCs}); + histos.add("strictTimeVeto/hBcZDC", "", kTH1F, {axisBCs}); + histos.add("strictTimeVeto/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); + histos.add("strictTimeVeto/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); + histos.add("strictTimeVeto/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("strictTimeVeto/nTracksPV_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracks}); + histos.add("strictTimeVeto/nTracksPV_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracks}); + histos.add("strictTimeVeto/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); + histos.add("strictTimeVeto/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); + histos.add("strictTimeVeto/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); + histos.add("strictTimeVeto/hTVXvsBcDiff", "", kTH1F, {axisBcDiff}); + histos.add("strictTimeVeto/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); + histos.add("strictTimeVeto/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); + histos.add("noCollSameROF/hBcColNoSel8", "", kTH1F, {axisBCs}); histos.add("noCollSameROF/hBcTVX", "", kTH1F, {axisBCs}); histos.add("noCollSameROF/hBcFT0", "", kTH1F, {axisBCs}); @@ -238,41 +256,41 @@ struct LightIonsEvSelQa { histos.add("noCollSameROF/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); histos.add("noCollSameROF/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); - histos.add("noPileup_LowMultCut/hBcColNoSel8", "", kTH1F, {axisBCs}); - histos.add("noPileup_LowMultCut/hBcTVX", "", kTH1F, {axisBCs}); - histos.add("noPileup_LowMultCut/hBcFT0", "", kTH1F, {axisBCs}); - histos.add("noPileup_LowMultCut/hBcFV0", "", kTH1F, {axisBCs}); - histos.add("noPileup_LowMultCut/hBcFDD", "", kTH1F, {axisBCs}); - histos.add("noPileup_LowMultCut/hBcZDC", "", kTH1F, {axisBCs}); - histos.add("noPileup_LowMultCut/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); - histos.add("noPileup_LowMultCut/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); - histos.add("noPileup_LowMultCut/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); - histos.add("noPileup_LowMultCut/nTracksPV_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracks}); - histos.add("noPileup_LowMultCut/nTracksPV_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracks}); - histos.add("noPileup_LowMultCut/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); - histos.add("noPileup_LowMultCut/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); - histos.add("noPileup_LowMultCut/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); - histos.add("noPileup_LowMultCut/hTVXvsBcDiff", "", kTH1F, {axisBcDiff}); - histos.add("noPileup_LowMultCut/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); - histos.add("noPileup_LowMultCut/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); - - histos.add("noPileup_HighMultCloudCut/hBcColNoSel8", "", kTH1F, {axisBCs}); - histos.add("noPileup_HighMultCloudCut/hBcTVX", "", kTH1F, {axisBCs}); - histos.add("noPileup_HighMultCloudCut/hBcFT0", "", kTH1F, {axisBCs}); - histos.add("noPileup_HighMultCloudCut/hBcFV0", "", kTH1F, {axisBCs}); - histos.add("noPileup_HighMultCloudCut/hBcFDD", "", kTH1F, {axisBCs}); - histos.add("noPileup_HighMultCloudCut/hBcZDC", "", kTH1F, {axisBCs}); - histos.add("noPileup_HighMultCloudCut/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); - histos.add("noPileup_HighMultCloudCut/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); - histos.add("noPileup_HighMultCloudCut/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); - histos.add("noPileup_HighMultCloudCut/nTracksPV_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracks}); - histos.add("noPileup_HighMultCloudCut/nTracksPV_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracks}); - histos.add("noPileup_HighMultCloudCut/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); - histos.add("noPileup_HighMultCloudCut/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); - histos.add("noPileup_HighMultCloudCut/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); - histos.add("noPileup_HighMultCloudCut/hTVXvsBcDiff", "", kTH1F, {axisBcDiff}); - histos.add("noPileup_HighMultCloudCut/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); - histos.add("noPileup_HighMultCloudCut/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); + histos.add("noPU_LowMultCut/hBcColNoSel8", "", kTH1F, {axisBCs}); + histos.add("noPU_LowMultCut/hBcTVX", "", kTH1F, {axisBCs}); + histos.add("noPU_LowMultCut/hBcFT0", "", kTH1F, {axisBCs}); + histos.add("noPU_LowMultCut/hBcFV0", "", kTH1F, {axisBCs}); + histos.add("noPU_LowMultCut/hBcFDD", "", kTH1F, {axisBCs}); + histos.add("noPU_LowMultCut/hBcZDC", "", kTH1F, {axisBCs}); + histos.add("noPU_LowMultCut/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); + histos.add("noPU_LowMultCut/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); + histos.add("noPU_LowMultCut/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("noPU_LowMultCut/nTracksPV_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracks}); + histos.add("noPU_LowMultCut/nTracksPV_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracks}); + histos.add("noPU_LowMultCut/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); + histos.add("noPU_LowMultCut/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); + histos.add("noPU_LowMultCut/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); + histos.add("noPU_LowMultCut/hTVXvsBcDiff", "", kTH1F, {axisBcDiff}); + histos.add("noPU_LowMultCut/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); + histos.add("noPU_LowMultCut/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); + + histos.add("noPU_HighMultCloudCut/hBcColNoSel8", "", kTH1F, {axisBCs}); + histos.add("noPU_HighMultCloudCut/hBcTVX", "", kTH1F, {axisBCs}); + histos.add("noPU_HighMultCloudCut/hBcFT0", "", kTH1F, {axisBCs}); + histos.add("noPU_HighMultCloudCut/hBcFV0", "", kTH1F, {axisBCs}); + histos.add("noPU_HighMultCloudCut/hBcFDD", "", kTH1F, {axisBCs}); + histos.add("noPU_HighMultCloudCut/hBcZDC", "", kTH1F, {axisBCs}); + histos.add("noPU_HighMultCloudCut/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); + histos.add("noPU_HighMultCloudCut/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); + histos.add("noPU_HighMultCloudCut/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("noPU_HighMultCloudCut/nTracksPV_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracks}); + histos.add("noPU_HighMultCloudCut/nTracksPV_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracks}); + histos.add("noPU_HighMultCloudCut/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); + histos.add("noPU_HighMultCloudCut/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); + histos.add("noPU_HighMultCloudCut/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); + histos.add("noPU_HighMultCloudCut/hTVXvsBcDiff", "", kTH1F, {axisBcDiff}); + histos.add("noPU_HighMultCloudCut/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); + histos.add("noPU_HighMultCloudCut/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); histos.add("badVzDiff/hBcColNoSel8", "", kTH1F, {axisBCs}); histos.add("badVzDiff/hBcTVX", "", kTH1F, {axisBCs}); @@ -292,23 +310,23 @@ struct LightIonsEvSelQa { histos.add("badVzDiff/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); histos.add("badVzDiff/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); - histos.add("goodVzDiff/hBcColNoSel8", "", kTH1F, {axisBCs}); - histos.add("goodVzDiff/hBcTVX", "", kTH1F, {axisBCs}); - histos.add("goodVzDiff/hBcFT0", "", kTH1F, {axisBCs}); - histos.add("goodVzDiff/hBcFV0", "", kTH1F, {axisBCs}); - histos.add("goodVzDiff/hBcFDD", "", kTH1F, {axisBCs}); - histos.add("goodVzDiff/hBcZDC", "", kTH1F, {axisBCs}); - histos.add("goodVzDiff/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); - histos.add("goodVzDiff/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); - histos.add("goodVzDiff/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); - histos.add("goodVzDiff/nTracksPV_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracks}); - histos.add("goodVzDiff/nTracksPV_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracks}); - histos.add("goodVzDiff/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); - histos.add("goodVzDiff/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); - histos.add("goodVzDiff/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); - histos.add("goodVzDiff/hTVXvsBcDiff", "", kTH1F, {axisBcDiff}); - histos.add("goodVzDiff/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); - histos.add("goodVzDiff/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); + histos.add("noPU_goodVzDiff/hBcColNoSel8", "", kTH1F, {axisBCs}); + histos.add("noPU_goodVzDiff/hBcTVX", "", kTH1F, {axisBCs}); + histos.add("noPU_goodVzDiff/hBcFT0", "", kTH1F, {axisBCs}); + histos.add("noPU_goodVzDiff/hBcFV0", "", kTH1F, {axisBCs}); + histos.add("noPU_goodVzDiff/hBcFDD", "", kTH1F, {axisBCs}); + histos.add("noPU_goodVzDiff/hBcZDC", "", kTH1F, {axisBCs}); + histos.add("noPU_goodVzDiff/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); + histos.add("noPU_goodVzDiff/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); + histos.add("noPU_goodVzDiff/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("noPU_goodVzDiff/nTracksPV_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracks}); + histos.add("noPU_goodVzDiff/nTracksPV_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracks}); + histos.add("noPU_goodVzDiff/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); + histos.add("noPU_goodVzDiff/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); + histos.add("noPU_goodVzDiff/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); + histos.add("noPU_goodVzDiff/hTVXvsBcDiff", "", kTH1F, {axisBcDiff}); + histos.add("noPU_goodVzDiff/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); + histos.add("noPU_goodVzDiff/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); histos.add("noPastActivity/hBcColNoSel8", "", kTH1F, {axisBCs}); histos.add("noPastActivity/hBcTVX", "", kTH1F, {axisBCs}); @@ -346,23 +364,23 @@ struct LightIonsEvSelQa { histos.add("noFT0activityNearby/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); histos.add("noFT0activityNearby/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); - histos.add("noPileup_cutByVzDiff_pvTOF_noFT0act/hBcColNoSel8", "", kTH1F, {axisBCs}); - histos.add("noPileup_cutByVzDiff_pvTOF_noFT0act/hBcTVX", "", kTH1F, {axisBCs}); - histos.add("noPileup_cutByVzDiff_pvTOF_noFT0act/hBcFT0", "", kTH1F, {axisBCs}); - histos.add("noPileup_cutByVzDiff_pvTOF_noFT0act/hBcFV0", "", kTH1F, {axisBCs}); - histos.add("noPileup_cutByVzDiff_pvTOF_noFT0act/hBcFDD", "", kTH1F, {axisBCs}); - histos.add("noPileup_cutByVzDiff_pvTOF_noFT0act/hBcZDC", "", kTH1F, {axisBCs}); - histos.add("noPileup_cutByVzDiff_pvTOF_noFT0act/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); - histos.add("noPileup_cutByVzDiff_pvTOF_noFT0act/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); - histos.add("noPileup_cutByVzDiff_pvTOF_noFT0act/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); - histos.add("noPileup_cutByVzDiff_pvTOF_noFT0act/nTracksPV_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracks}); - histos.add("noPileup_cutByVzDiff_pvTOF_noFT0act/nTracksPV_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracks}); - histos.add("noPileup_cutByVzDiff_pvTOF_noFT0act/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); - histos.add("noPileup_cutByVzDiff_pvTOF_noFT0act/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); - histos.add("noPileup_cutByVzDiff_pvTOF_noFT0act/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); - histos.add("noPileup_cutByVzDiff_pvTOF_noFT0act/hTVXvsBcDiff", "", kTH1F, {axisBcDiff}); - histos.add("noPileup_cutByVzDiff_pvTOF_noFT0act/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); - histos.add("noPileup_cutByVzDiff_pvTOF_noFT0act/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); + histos.add("noPU_cutByVzDiff_pvTOF/hBcColNoSel8", "", kTH1F, {axisBCs}); + histos.add("noPU_cutByVzDiff_pvTOF/hBcTVX", "", kTH1F, {axisBCs}); + histos.add("noPU_cutByVzDiff_pvTOF/hBcFT0", "", kTH1F, {axisBCs}); + histos.add("noPU_cutByVzDiff_pvTOF/hBcFV0", "", kTH1F, {axisBCs}); + histos.add("noPU_cutByVzDiff_pvTOF/hBcFDD", "", kTH1F, {axisBCs}); + histos.add("noPU_cutByVzDiff_pvTOF/hBcZDC", "", kTH1F, {axisBCs}); + histos.add("noPU_cutByVzDiff_pvTOF/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); + histos.add("noPU_cutByVzDiff_pvTOF/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); + histos.add("noPU_cutByVzDiff_pvTOF/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("noPU_cutByVzDiff_pvTOF/nTracksPV_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracks}); + histos.add("noPU_cutByVzDiff_pvTOF/nTracksPV_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracks}); + histos.add("noPU_cutByVzDiff_pvTOF/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); + histos.add("noPU_cutByVzDiff_pvTOF/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); + histos.add("noPU_cutByVzDiff_pvTOF/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); + histos.add("noPU_cutByVzDiff_pvTOF/hTVXvsBcDiff", "", kTH1F, {axisBcDiff}); + histos.add("noPU_cutByVzDiff_pvTOF/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); + histos.add("noPU_cutByVzDiff_pvTOF/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); } Preslice perCollision = aod::track::collisionId; @@ -416,6 +434,7 @@ struct LightIonsEvSelQa { double timeInterval = nTimeBins * timeBinWidthInSec; const AxisSpec axisSeconds{nTimeBins, 0, timeInterval, "seconds"}; + histos.add("hSecondsCollisions/sel8", "", kTH1D, {axisSeconds}); histos.add("hSecondsCollisions/noPU", "", kTH1D, {axisSeconds}); histos.add("hSecondsCollisions/noPU_underLine", "", kTH1D, {axisSeconds}); histos.add("hSecondsCollisions/noPU_grassOnTheRight", "", kTH1D, {axisSeconds}); @@ -583,7 +602,8 @@ struct LightIonsEvSelQa { // selection decisions: bool noPU = col.selection_bit(kNoSameBunchPileup); bool pvTOFmatched = col.selection_bit(kIsVertexTOFmatched); - bool narrowDeltaTimeVeto = col.selection_bit(kNoCollInTimeRangeNarrow); + bool narrowTimeVeto = col.selection_bit(kNoCollInTimeRangeNarrow); + bool strictTimeVeto = col.selection_bit(kNoCollInTimeRangeStrict); bool noCollSameROF = col.selection_bit(kNoCollInRofStrict); bool bcDiffCut = (bcToClosestTVXdiff == 0); @@ -668,17 +688,6 @@ struct LightIonsEvSelQa { grassOnTheRight = true; } - // vs time - if (noPU) { - histos.fill(HIST("hSecondsCollisions/noPU"), secFromSOR); - if (underLine) - histos.fill(HIST("hSecondsCollisions/noPU_underLine"), secFromSOR); - if (grassOnTheRight) - histos.fill(HIST("hSecondsCollisions/noPU_grassOnTheRight"), secFromSOR); - if (!underLine && !grassOnTheRight) - histos.fill(HIST("hSecondsCollisions/noPU_good"), secFromSOR); - } - // study bc diff: int nContributors = col.numContrib(); float timeRes = col.collisionTimeRes(); @@ -692,10 +701,10 @@ struct LightIonsEvSelQa { histos.fill(HIST("noSpecSelections/hBcColNoSel8"), localBC); if (noPU) { - histos.fill(HIST("noPileup/hBcColNoSel8"), localBC); + histos.fill(HIST("noPU/hBcColNoSel8"), localBC); } - if (pvTOFmatched) { - histos.fill(HIST("pvTOFmatched/hBcColNoSel8"), localBC); + if (noPU && pvTOFmatched) { + histos.fill(HIST("noPU_pvTOFmatched/hBcColNoSel8"), localBC); } if (bcDiffCut) { histos.fill(HIST("bcDiffCut/hBcColNoSel8"), localBC); @@ -709,42 +718,57 @@ struct LightIonsEvSelQa { if (badVzDiff) { histos.fill(HIST("badVzDiff/hBcColNoSel8"), localBC); } - if (!badVzDiff) { - histos.fill(HIST("goodVzDiff/hBcColNoSel8"), localBC); + if (noPU && !badVzDiff) { + histos.fill(HIST("noPU_goodVzDiff/hBcColNoSel8"), localBC); } - if (narrowDeltaTimeVeto) { + if (narrowTimeVeto) { histos.fill(HIST("narrowTimeVeto/hBcColNoSel8"), localBC); } + if (strictTimeVeto) { + histos.fill(HIST("strictTimeVeto/hBcColNoSel8"), localBC); + } if (noCollSameROF) { histos.fill(HIST("noCollSameROF/hBcColNoSel8"), localBC); } if (noPU && underLine) { - histos.fill(HIST("noPileup_LowMultCut/hBcColNoSel8"), localBC); + histos.fill(HIST("noPU_LowMultCut/hBcColNoSel8"), localBC); } if (noPU && grassOnTheRight) { - histos.fill(HIST("noPileup_HighMultCloudCut/hBcColNoSel8"), localBC); + histos.fill(HIST("noPU_HighMultCloudCut/hBcColNoSel8"), localBC); } - if (noPU && pvTOFmatched && !badVzDiff && noFT0activityNearby) { // noPileup_cutByVzDiff_pvTOF_noFT0act - histos.fill(HIST("noPileup_cutByVzDiff_pvTOF_noFT0act/hBcColNoSel8"), localBC); + if (noPU && pvTOFmatched && !badVzDiff) { // noPileup_cutByVzDiff_pvTOF_noFT0act + histos.fill(HIST("noPU_cutByVzDiff_pvTOF/hBcColNoSel8"), localBC); } // only here cut on sel8: if (!col.sel8()) continue; + // vs time + histos.fill(HIST("hSecondsCollisions/sel8"), secFromSOR); + if (noPU) { + histos.fill(HIST("hSecondsCollisions/noPU"), secFromSOR); + if (underLine) + histos.fill(HIST("hSecondsCollisions/noPU_underLine"), secFromSOR); + if (grassOnTheRight) + histos.fill(HIST("hSecondsCollisions/noPU_grassOnTheRight"), secFromSOR); + if (!underLine && !grassOnTheRight) + histos.fill(HIST("hSecondsCollisions/noPU_good"), secFromSOR); + } + histos.fill(HIST("noSpecSelections/hBcTVX"), localBC); histos.fill(HIST("noSpecSelections/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); histos.fill(HIST("noSpecSelections/hColTimeResVsNcontrib"), nContributors, timeRes); if (noPU) { - histos.fill(HIST("noPileup/hBcTVX"), localBC); - histos.fill(HIST("noPileup/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); - histos.fill(HIST("noPileup/hColTimeResVsNcontrib"), nContributors, timeRes); + histos.fill(HIST("noPU/hBcTVX"), localBC); + histos.fill(HIST("noPU/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); + histos.fill(HIST("noPU/hColTimeResVsNcontrib"), nContributors, timeRes); } - if (pvTOFmatched) { - histos.fill(HIST("pvTOFmatched/hBcTVX"), localBC); - histos.fill(HIST("pvTOFmatched/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); - histos.fill(HIST("pvTOFmatched/hColTimeResVsNcontrib"), nContributors, timeRes); + if (noPU && pvTOFmatched) { + histos.fill(HIST("noPU_pvTOFmatched/hBcTVX"), localBC); + histos.fill(HIST("noPU_pvTOFmatched/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); + histos.fill(HIST("noPU_pvTOFmatched/hColTimeResVsNcontrib"), nContributors, timeRes); } if (bcDiffCut) { histos.fill(HIST("bcDiffCut/hBcTVX"), localBC); @@ -766,35 +790,40 @@ struct LightIonsEvSelQa { histos.fill(HIST("badVzDiff/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); histos.fill(HIST("badVzDiff/hColTimeResVsNcontrib"), nContributors, timeRes); } - if (!badVzDiff) { - histos.fill(HIST("goodVzDiff/hBcTVX"), localBC); - histos.fill(HIST("goodVzDiff/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); - histos.fill(HIST("goodVzDiff/hColTimeResVsNcontrib"), nContributors, timeRes); + if (noPU && !badVzDiff) { + histos.fill(HIST("noPU_goodVzDiff/hBcTVX"), localBC); + histos.fill(HIST("noPU_goodVzDiff/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); + histos.fill(HIST("noPU_goodVzDiff/hColTimeResVsNcontrib"), nContributors, timeRes); } - if (narrowDeltaTimeVeto) { + if (narrowTimeVeto) { histos.fill(HIST("narrowTimeVeto/hBcTVX"), localBC); histos.fill(HIST("narrowTimeVeto/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); histos.fill(HIST("narrowTimeVeto/hColTimeResVsNcontrib"), nContributors, timeRes); } + if (strictTimeVeto) { + histos.fill(HIST("strictTimeVeto/hBcTVX"), localBC); + histos.fill(HIST("strictTimeVeto/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); + histos.fill(HIST("strictTimeVeto/hColTimeResVsNcontrib"), nContributors, timeRes); + } if (noCollSameROF) { histos.fill(HIST("noCollSameROF/hBcTVX"), localBC); histos.fill(HIST("noCollSameROF/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); histos.fill(HIST("noCollSameROF/hColTimeResVsNcontrib"), nContributors, timeRes); } if (noPU && underLine) { - histos.fill(HIST("noPileup_LowMultCut/hBcTVX"), localBC); - histos.fill(HIST("noPileup_LowMultCut/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); - histos.fill(HIST("noPileup_LowMultCut/hColTimeResVsNcontrib"), nContributors, timeRes); + histos.fill(HIST("noPU_LowMultCut/hBcTVX"), localBC); + histos.fill(HIST("noPU_LowMultCut/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); + histos.fill(HIST("noPU_LowMultCut/hColTimeResVsNcontrib"), nContributors, timeRes); } if (noPU && grassOnTheRight) { - histos.fill(HIST("noPileup_HighMultCloudCut/hBcTVX"), localBC); - histos.fill(HIST("noPileup_HighMultCloudCut/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); - histos.fill(HIST("noPileup_HighMultCloudCut/hColTimeResVsNcontrib"), nContributors, timeRes); + histos.fill(HIST("noPU_HighMultCloudCut/hBcTVX"), localBC); + histos.fill(HIST("noPU_HighMultCloudCut/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); + histos.fill(HIST("noPU_HighMultCloudCut/hColTimeResVsNcontrib"), nContributors, timeRes); } - if (noPU && pvTOFmatched && !badVzDiff && noFT0activityNearby) { // noPileup_cutByVzDiff_pvTOF_noFT0act - histos.fill(HIST("noPileup_cutByVzDiff_pvTOF_noFT0act/hBcTVX"), localBC); - histos.fill(HIST("noPileup_cutByVzDiff_pvTOF_noFT0act/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); - histos.fill(HIST("noPileup_cutByVzDiff_pvTOF_noFT0act/hColTimeResVsNcontrib"), nContributors, timeRes); + if (noPU && pvTOFmatched && !badVzDiff) { // noPileup_cutByVzDiff_pvTOF_noFT0act + histos.fill(HIST("noPU_cutByVzDiff_pvTOF/hBcTVX"), localBC); + histos.fill(HIST("noPU_cutByVzDiff_pvTOF/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); + histos.fill(HIST("noPU_cutByVzDiff_pvTOF/hColTimeResVsNcontrib"), nContributors, timeRes); } if (foundBC.has_ft0()) { @@ -810,22 +839,22 @@ struct LightIonsEvSelQa { histos.fill(HIST("noSpecSelections/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracks); if (noPU) { - histos.fill(HIST("noPileup/hBcFT0"), localBC); - histos.fill(HIST("noPileup/hVtxFT0VsVtxCol"), vZft0, vZ); - histos.fill(HIST("noPileup/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); - histos.fill(HIST("noPileup/nTracksPV_vs_T0A"), multT0A, nPVtracks); - histos.fill(HIST("noPileup/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracks); - histos.fill(HIST("noPileup/nTracksPV_vs_T0C"), multT0C, nPVtracks); - histos.fill(HIST("noPileup/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracks); + histos.fill(HIST("noPU/hBcFT0"), localBC); + histos.fill(HIST("noPU/hVtxFT0VsVtxCol"), vZft0, vZ); + histos.fill(HIST("noPU/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); + histos.fill(HIST("noPU/nTracksPV_vs_T0A"), multT0A, nPVtracks); + histos.fill(HIST("noPU/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracks); + histos.fill(HIST("noPU/nTracksPV_vs_T0C"), multT0C, nPVtracks); + histos.fill(HIST("noPU/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracks); } - if (pvTOFmatched) { - histos.fill(HIST("pvTOFmatched/hBcFT0"), localBC); - histos.fill(HIST("pvTOFmatched/hVtxFT0VsVtxCol"), vZft0, vZ); - histos.fill(HIST("pvTOFmatched/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); - histos.fill(HIST("pvTOFmatched/nTracksPV_vs_T0A"), multT0A, nPVtracks); - histos.fill(HIST("pvTOFmatched/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracks); - histos.fill(HIST("pvTOFmatched/nTracksPV_vs_T0C"), multT0C, nPVtracks); - histos.fill(HIST("pvTOFmatched/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracks); + if (noPU && pvTOFmatched) { + histos.fill(HIST("noPU_pvTOFmatched/hBcFT0"), localBC); + histos.fill(HIST("noPU_pvTOFmatched/hVtxFT0VsVtxCol"), vZft0, vZ); + histos.fill(HIST("noPU_pvTOFmatched/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); + histos.fill(HIST("noPU_pvTOFmatched/nTracksPV_vs_T0A"), multT0A, nPVtracks); + histos.fill(HIST("noPU_pvTOFmatched/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracks); + histos.fill(HIST("noPU_pvTOFmatched/nTracksPV_vs_T0C"), multT0C, nPVtracks); + histos.fill(HIST("noPU_pvTOFmatched/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracks); } if (bcDiffCut) { histos.fill(HIST("bcDiffCut/hBcFT0"), localBC); @@ -845,14 +874,14 @@ struct LightIonsEvSelQa { histos.fill(HIST("badVzDiff/nTracksPV_vs_T0C"), multT0C, nPVtracks); histos.fill(HIST("badVzDiff/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracks); } - if (!badVzDiff) { - histos.fill(HIST("goodVzDiff/hBcFT0"), localBC); - histos.fill(HIST("goodVzDiff/hVtxFT0VsVtxCol"), vZft0, vZ); - histos.fill(HIST("goodVzDiff/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); - histos.fill(HIST("goodVzDiff/nTracksPV_vs_T0A"), multT0A, nPVtracks); - histos.fill(HIST("goodVzDiff/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracks); - histos.fill(HIST("goodVzDiff/nTracksPV_vs_T0C"), multT0C, nPVtracks); - histos.fill(HIST("goodVzDiff/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracks); + if (noPU && !badVzDiff) { + histos.fill(HIST("noPU_goodVzDiff/hBcFT0"), localBC); + histos.fill(HIST("noPU_goodVzDiff/hVtxFT0VsVtxCol"), vZft0, vZ); + histos.fill(HIST("noPU_goodVzDiff/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); + histos.fill(HIST("noPU_goodVzDiff/nTracksPV_vs_T0A"), multT0A, nPVtracks); + histos.fill(HIST("noPU_goodVzDiff/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracks); + histos.fill(HIST("noPU_goodVzDiff/nTracksPV_vs_T0C"), multT0C, nPVtracks); + histos.fill(HIST("noPU_goodVzDiff/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracks); } if (noPastActivity) { histos.fill(HIST("noPastActivity/hBcFT0"), localBC); @@ -872,7 +901,7 @@ struct LightIonsEvSelQa { histos.fill(HIST("noFT0activityNearby/nTracksPV_vs_T0C"), multT0C, nPVtracks); histos.fill(HIST("noFT0activityNearby/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracks); } - if (narrowDeltaTimeVeto) { + if (narrowTimeVeto) { histos.fill(HIST("narrowTimeVeto/hBcFT0"), localBC); histos.fill(HIST("narrowTimeVeto/hVtxFT0VsVtxCol"), vZft0, vZ); histos.fill(HIST("narrowTimeVeto/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); @@ -881,6 +910,15 @@ struct LightIonsEvSelQa { histos.fill(HIST("narrowTimeVeto/nTracksPV_vs_T0C"), multT0C, nPVtracks); histos.fill(HIST("narrowTimeVeto/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracks); } + if (strictTimeVeto) { + histos.fill(HIST("strictTimeVeto/hBcFT0"), localBC); + histos.fill(HIST("strictTimeVeto/hVtxFT0VsVtxCol"), vZft0, vZ); + histos.fill(HIST("strictTimeVeto/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); + histos.fill(HIST("strictTimeVeto/nTracksPV_vs_T0A"), multT0A, nPVtracks); + histos.fill(HIST("strictTimeVeto/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracks); + histos.fill(HIST("strictTimeVeto/nTracksPV_vs_T0C"), multT0C, nPVtracks); + histos.fill(HIST("strictTimeVeto/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracks); + } if (noCollSameROF) { histos.fill(HIST("noCollSameROF/hBcFT0"), localBC); histos.fill(HIST("noCollSameROF/hVtxFT0VsVtxCol"), vZft0, vZ); @@ -891,31 +929,31 @@ struct LightIonsEvSelQa { histos.fill(HIST("noCollSameROF/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracks); } if (noPU && underLine) { - histos.fill(HIST("noPileup_LowMultCut/hBcFT0"), localBC); - histos.fill(HIST("noPileup_LowMultCut/hVtxFT0VsVtxCol"), vZft0, vZ); - histos.fill(HIST("noPileup_LowMultCut/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); - histos.fill(HIST("noPileup_LowMultCut/nTracksPV_vs_T0A"), multT0A, nPVtracks); - histos.fill(HIST("noPileup_LowMultCut/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracks); - histos.fill(HIST("noPileup_LowMultCut/nTracksPV_vs_T0C"), multT0C, nPVtracks); - histos.fill(HIST("noPileup_LowMultCut/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracks); + histos.fill(HIST("noPU_LowMultCut/hBcFT0"), localBC); + histos.fill(HIST("noPU_LowMultCut/hVtxFT0VsVtxCol"), vZft0, vZ); + histos.fill(HIST("noPU_LowMultCut/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); + histos.fill(HIST("noPU_LowMultCut/nTracksPV_vs_T0A"), multT0A, nPVtracks); + histos.fill(HIST("noPU_LowMultCut/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracks); + histos.fill(HIST("noPU_LowMultCut/nTracksPV_vs_T0C"), multT0C, nPVtracks); + histos.fill(HIST("noPU_LowMultCut/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracks); } if (noPU && grassOnTheRight) { - histos.fill(HIST("noPileup_HighMultCloudCut/hBcFT0"), localBC); - histos.fill(HIST("noPileup_HighMultCloudCut/hVtxFT0VsVtxCol"), vZft0, vZ); - histos.fill(HIST("noPileup_HighMultCloudCut/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); - histos.fill(HIST("noPileup_HighMultCloudCut/nTracksPV_vs_T0A"), multT0A, nPVtracks); - histos.fill(HIST("noPileup_HighMultCloudCut/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracks); - histos.fill(HIST("noPileup_HighMultCloudCut/nTracksPV_vs_T0C"), multT0C, nPVtracks); - histos.fill(HIST("noPileup_HighMultCloudCut/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracks); + histos.fill(HIST("noPU_HighMultCloudCut/hBcFT0"), localBC); + histos.fill(HIST("noPU_HighMultCloudCut/hVtxFT0VsVtxCol"), vZft0, vZ); + histos.fill(HIST("noPU_HighMultCloudCut/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); + histos.fill(HIST("noPU_HighMultCloudCut/nTracksPV_vs_T0A"), multT0A, nPVtracks); + histos.fill(HIST("noPU_HighMultCloudCut/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracks); + histos.fill(HIST("noPU_HighMultCloudCut/nTracksPV_vs_T0C"), multT0C, nPVtracks); + histos.fill(HIST("noPU_HighMultCloudCut/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracks); } - if (noPU && pvTOFmatched && !badVzDiff && noFT0activityNearby) { // noPileup_cutByVzDiff_pvTOF_noFT0act - histos.fill(HIST("noPileup_cutByVzDiff_pvTOF_noFT0act/hBcFT0"), localBC); - histos.fill(HIST("noPileup_cutByVzDiff_pvTOF_noFT0act/hVtxFT0VsVtxCol"), vZft0, vZ); - histos.fill(HIST("noPileup_cutByVzDiff_pvTOF_noFT0act/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); - histos.fill(HIST("noPileup_cutByVzDiff_pvTOF_noFT0act/nTracksPV_vs_T0A"), multT0A, nPVtracks); - histos.fill(HIST("noPileup_cutByVzDiff_pvTOF_noFT0act/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracks); - histos.fill(HIST("noPileup_cutByVzDiff_pvTOF_noFT0act/nTracksPV_vs_T0C"), multT0C, nPVtracks); - histos.fill(HIST("noPileup_cutByVzDiff_pvTOF_noFT0act/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracks); + if (noPU && pvTOFmatched && !badVzDiff) { // noPileup_cutByVzDiff_pvTOF_noFT0act + histos.fill(HIST("noPU_cutByVzDiff_pvTOF/hBcFT0"), localBC); + histos.fill(HIST("noPU_cutByVzDiff_pvTOF/hVtxFT0VsVtxCol"), vZft0, vZ); + histos.fill(HIST("noPU_cutByVzDiff_pvTOF/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); + histos.fill(HIST("noPU_cutByVzDiff_pvTOF/nTracksPV_vs_T0A"), multT0A, nPVtracks); + histos.fill(HIST("noPU_cutByVzDiff_pvTOF/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracks); + histos.fill(HIST("noPU_cutByVzDiff_pvTOF/nTracksPV_vs_T0C"), multT0C, nPVtracks); + histos.fill(HIST("noPU_cutByVzDiff_pvTOF/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracks); } } @@ -924,14 +962,14 @@ struct LightIonsEvSelQa { histos.fill(HIST("noSpecSelections/nTracksPV_vs_V0A"), multV0A, nPVtracks); histos.fill(HIST("noSpecSelections/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracks); if (noPU) { - histos.fill(HIST("noPileup/hBcFV0"), localBC); - histos.fill(HIST("noPileup/nTracksPV_vs_V0A"), multV0A, nPVtracks); - histos.fill(HIST("noPileup/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracks); + histos.fill(HIST("noPU/hBcFV0"), localBC); + histos.fill(HIST("noPU/nTracksPV_vs_V0A"), multV0A, nPVtracks); + histos.fill(HIST("noPU/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracks); } - if (pvTOFmatched) { - histos.fill(HIST("pvTOFmatched/hBcFV0"), localBC); - histos.fill(HIST("pvTOFmatched/nTracksPV_vs_V0A"), multV0A, nPVtracks); - histos.fill(HIST("pvTOFmatched/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracks); + if (noPU && pvTOFmatched) { + histos.fill(HIST("noPU_pvTOFmatched/hBcFV0"), localBC); + histos.fill(HIST("noPU_pvTOFmatched/nTracksPV_vs_V0A"), multV0A, nPVtracks); + histos.fill(HIST("noPU_pvTOFmatched/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracks); } if (bcDiffCut) { histos.fill(HIST("bcDiffCut/hBcFV0"), localBC); @@ -943,10 +981,10 @@ struct LightIonsEvSelQa { histos.fill(HIST("badVzDiff/nTracksPV_vs_V0A"), multV0A, nPVtracks); histos.fill(HIST("badVzDiff/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracks); } - if (!badVzDiff) { - histos.fill(HIST("goodVzDiff/hBcFV0"), localBC); - histos.fill(HIST("goodVzDiff/nTracksPV_vs_V0A"), multV0A, nPVtracks); - histos.fill(HIST("goodVzDiff/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracks); + if (noPU && !badVzDiff) { + histos.fill(HIST("noPU_goodVzDiff/hBcFV0"), localBC); + histos.fill(HIST("noPU_goodVzDiff/nTracksPV_vs_V0A"), multV0A, nPVtracks); + histos.fill(HIST("noPU_goodVzDiff/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracks); } if (noPastActivity) { histos.fill(HIST("noPastActivity/hBcFV0"), localBC); @@ -958,39 +996,44 @@ struct LightIonsEvSelQa { histos.fill(HIST("noFT0activityNearby/nTracksPV_vs_V0A"), multV0A, nPVtracks); histos.fill(HIST("noFT0activityNearby/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracks); } - if (narrowDeltaTimeVeto) { + if (narrowTimeVeto) { histos.fill(HIST("narrowTimeVeto/hBcFV0"), localBC); histos.fill(HIST("narrowTimeVeto/nTracksPV_vs_V0A"), multV0A, nPVtracks); histos.fill(HIST("narrowTimeVeto/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracks); } + if (strictTimeVeto) { + histos.fill(HIST("strictTimeVeto/hBcFV0"), localBC); + histos.fill(HIST("strictTimeVeto/nTracksPV_vs_V0A"), multV0A, nPVtracks); + histos.fill(HIST("strictTimeVeto/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracks); + } if (noCollSameROF) { histos.fill(HIST("noCollSameROF/hBcFV0"), localBC); histos.fill(HIST("noCollSameROF/nTracksPV_vs_V0A"), multV0A, nPVtracks); histos.fill(HIST("noCollSameROF/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracks); } if (noPU && underLine) { - histos.fill(HIST("noPileup_LowMultCut/hBcFV0"), localBC); - histos.fill(HIST("noPileup_LowMultCut/nTracksPV_vs_V0A"), multV0A, nPVtracks); - histos.fill(HIST("noPileup_LowMultCut/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracks); + histos.fill(HIST("noPU_LowMultCut/hBcFV0"), localBC); + histos.fill(HIST("noPU_LowMultCut/nTracksPV_vs_V0A"), multV0A, nPVtracks); + histos.fill(HIST("noPU_LowMultCut/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracks); } if (noPU && grassOnTheRight) { - histos.fill(HIST("noPileup_HighMultCloudCut/hBcFV0"), localBC); - histos.fill(HIST("noPileup_HighMultCloudCut/nTracksPV_vs_V0A"), multV0A, nPVtracks); - histos.fill(HIST("noPileup_HighMultCloudCut/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracks); + histos.fill(HIST("noPU_HighMultCloudCut/hBcFV0"), localBC); + histos.fill(HIST("noPU_HighMultCloudCut/nTracksPV_vs_V0A"), multV0A, nPVtracks); + histos.fill(HIST("noPU_HighMultCloudCut/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracks); } - if (noPU && pvTOFmatched && !badVzDiff && noFT0activityNearby) { // noPileup_cutByVzDiff_pvTOF_noFT0act - histos.fill(HIST("noPileup_cutByVzDiff_pvTOF_noFT0act/hBcFV0"), localBC); - histos.fill(HIST("noPileup_cutByVzDiff_pvTOF_noFT0act/nTracksPV_vs_V0A"), multV0A, nPVtracks); - histos.fill(HIST("noPileup_cutByVzDiff_pvTOF_noFT0act/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracks); + if (noPU && pvTOFmatched && !badVzDiff) { // noPileup_cutByVzDiff_pvTOF_noFT0act + histos.fill(HIST("noPU_cutByVzDiff_pvTOF/hBcFV0"), localBC); + histos.fill(HIST("noPU_cutByVzDiff_pvTOF/nTracksPV_vs_V0A"), multV0A, nPVtracks); + histos.fill(HIST("noPU_cutByVzDiff_pvTOF/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracks); } } if (foundBC.has_zdc()) { histos.fill(HIST("noSpecSelections/hBcZDC"), localBC); if (noPU) { - histos.fill(HIST("noPileup/hBcZDC"), localBC); + histos.fill(HIST("noPU/hBcZDC"), localBC); } - if (pvTOFmatched) { - histos.fill(HIST("pvTOFmatched/hBcZDC"), localBC); + if (noPU && pvTOFmatched) { + histos.fill(HIST("noPU_pvTOFmatched/hBcZDC"), localBC); } if (bcDiffCut) { histos.fill(HIST("bcDiffCut/hBcZDC"), localBC); @@ -998,8 +1041,8 @@ struct LightIonsEvSelQa { if (badVzDiff) { histos.fill(HIST("badVzDiff/hBcZDC"), localBC); } - if (!badVzDiff) { - histos.fill(HIST("goodVzDiff/hBcZDC"), localBC); + if (noPU && !badVzDiff) { + histos.fill(HIST("noPU_goodVzDiff/hBcZDC"), localBC); } if (noPastActivity) { histos.fill(HIST("noPastActivity/hBcZDC"), localBC); @@ -1007,20 +1050,23 @@ struct LightIonsEvSelQa { if (noFT0activityNearby) { histos.fill(HIST("noFT0activityNearby/hBcZDC"), localBC); } - if (narrowDeltaTimeVeto) { + if (narrowTimeVeto) { histos.fill(HIST("narrowTimeVeto/hBcZDC"), localBC); } + if (strictTimeVeto) { + histos.fill(HIST("strictTimeVeto/hBcZDC"), localBC); + } if (noCollSameROF) { histos.fill(HIST("noCollSameROF/hBcZDC"), localBC); } if (noPU && underLine) { - histos.fill(HIST("noPileup_LowMultCut/hBcZDC"), localBC); + histos.fill(HIST("noPU_LowMultCut/hBcZDC"), localBC); } if (noPU && grassOnTheRight) { - histos.fill(HIST("noPileup_HighMultCloudCut/hBcZDC"), localBC); + histos.fill(HIST("noPU_HighMultCloudCut/hBcZDC"), localBC); } - if (noPU && pvTOFmatched && !badVzDiff && noFT0activityNearby) { // noPileup_cutByVzDiff_pvTOF_noFT0act - histos.fill(HIST("noPileup_cutByVzDiff_pvTOF_noFT0act/hBcZDC"), localBC); + if (noPU && pvTOFmatched && !badVzDiff) { // noPileup_cutByVzDiff_pvTOF_noFT0act + histos.fill(HIST("noPU_cutByVzDiff_pvTOF/hBcZDC"), localBC); } } @@ -1031,10 +1077,10 @@ struct LightIonsEvSelQa { histos.fill(HIST("noSpecSelections/hTVXvsBcDiff"), bcDiff); if (noPU) { - histos.fill(HIST("noPileup/hTVXvsBcDiff"), bcDiff); + histos.fill(HIST("noPU/hTVXvsBcDiff"), bcDiff); } - if (pvTOFmatched) { - histos.fill(HIST("pvTOFmatched/hTVXvsBcDiff"), bcDiff); + if (noPU && pvTOFmatched) { + histos.fill(HIST("noPU_pvTOFmatched/hTVXvsBcDiff"), bcDiff); } if (bcDiffCut) { histos.fill(HIST("bcDiffCut/hTVXvsBcDiff"), bcDiff); @@ -1042,8 +1088,8 @@ struct LightIonsEvSelQa { if (badVzDiff) { histos.fill(HIST("badVzDiff/hTVXvsBcDiff"), bcDiff); } - if (!badVzDiff) { - histos.fill(HIST("goodVzDiff/hTVXvsBcDiff"), bcDiff); + if (noPU && !badVzDiff) { + histos.fill(HIST("noPU_goodVzDiff/hTVXvsBcDiff"), bcDiff); } if (noPastActivity) { histos.fill(HIST("noPastActivity/hTVXvsBcDiff"), bcDiff); @@ -1051,20 +1097,23 @@ struct LightIonsEvSelQa { if (noFT0activityNearby) { histos.fill(HIST("noFT0activityNearby/hTVXvsBcDiff"), bcDiff); } - if (narrowDeltaTimeVeto) { + if (narrowTimeVeto) { histos.fill(HIST("narrowTimeVeto/hTVXvsBcDiff"), bcDiff); } + if (strictTimeVeto) { + histos.fill(HIST("strictTimeVeto/hTVXvsBcDiff"), bcDiff); + } if (noCollSameROF) { histos.fill(HIST("noCollSameROF/hTVXvsBcDiff"), bcDiff); } if (noPU && underLine) { - histos.fill(HIST("noPileup_LowMultCut/hTVXvsBcDiff"), bcDiff); + histos.fill(HIST("noPU_LowMultCut/hTVXvsBcDiff"), bcDiff); } if (noPU && grassOnTheRight) { - histos.fill(HIST("noPileup_HighMultCloudCut/hTVXvsBcDiff"), bcDiff); + histos.fill(HIST("noPU_HighMultCloudCut/hTVXvsBcDiff"), bcDiff); } - if (noPU && pvTOFmatched && !badVzDiff && noFT0activityNearby) { // noPileup_cutByVzDiff_pvTOF_noFT0act - histos.fill(HIST("noPileup_cutByVzDiff_pvTOF_noFT0act/hTVXvsBcDiff"), bcDiff); + if (noPU && pvTOFmatched && !badVzDiff) { // noPileup_cutByVzDiff_pvTOF_noFT0act + histos.fill(HIST("noPU_cutByVzDiff_pvTOF/hTVXvsBcDiff"), bcDiff); } } // end of collisions loop From a24f6039c08021d4435dc772d08b21d07f9559cf Mon Sep 17 00:00:00 2001 From: Anantha Padmanabhan M Nair <82643666+ananthapadmanabhan18@users.noreply.github.com> Date: Mon, 4 Aug 2025 00:24:34 +0530 Subject: [PATCH 210/345] [PWGUD] Modified the counter histograms (#12400) --- PWGUD/Tasks/exclusiveRhoTo4Pi.cxx | 413 +++++++++++++++++------------- 1 file changed, 236 insertions(+), 177 deletions(-) diff --git a/PWGUD/Tasks/exclusiveRhoTo4Pi.cxx b/PWGUD/Tasks/exclusiveRhoTo4Pi.cxx index daae60d111c..b6ce41e54f7 100644 --- a/PWGUD/Tasks/exclusiveRhoTo4Pi.cxx +++ b/PWGUD/Tasks/exclusiveRhoTo4Pi.cxx @@ -36,6 +36,7 @@ #include #include +#include #include using namespace std; @@ -44,6 +45,12 @@ using namespace o2::aod; using namespace o2::framework; using namespace o2::framework::expressions; +using PtEtaPhiMVector = ROOT::Math::PtEtaPhiMVector; +using Boost = ROOT::Math::Boost; +using XYZVectorF = ROOT::Math::XYZVectorF; +using PxPyPzEVector = ROOT::Math::PxPyPzEVector; +using PxPyPzMVector = ROOT::Math::PxPyPzMVector; + namespace o2::aod { namespace branch @@ -151,11 +158,15 @@ DECLARE_SOA_COLUMN(FourPionEta, fourPionEta, double); DECLARE_SOA_COLUMN(FourPionPhi, fourPionPhi, double); DECLARE_SOA_COLUMN(FourPionRapidity, fourPionRapidity, double); DECLARE_SOA_COLUMN(FourPionMass, fourPionMass, double); -// Four Pion Phi Pair 1, Pair 2, CosTheta Pair 1, CosTheta Pair 2 +// Collin-Soper Angles DECLARE_SOA_COLUMN(FourPionPhiPair1, fourPionPhiPair1, double); DECLARE_SOA_COLUMN(FourPionPhiPair2, fourPionPhiPair2, double); +DECLARE_SOA_COLUMN(FourPionPhiPair3, fourPionPhiPair3, double); +DECLARE_SOA_COLUMN(FourPionPhiPair4, fourPionPhiPair4, double); DECLARE_SOA_COLUMN(FourPionCosThetaPair1, fourPionCosThetaPair1, double); DECLARE_SOA_COLUMN(FourPionCosThetaPair2, fourPionCosThetaPair2, double); +DECLARE_SOA_COLUMN(FourPionCosThetaPair3, fourPionCosThetaPair3, double); +DECLARE_SOA_COLUMN(FourPionCosThetaPair4, fourPionCosThetaPair4, double); } // namespace branch DECLARE_SOA_TABLE(SignalData, "AOD", "signalData", @@ -262,8 +273,12 @@ DECLARE_SOA_TABLE(SignalData, "AOD", "signalData", branch::FourPionMass, branch::FourPionPhiPair1, branch::FourPionPhiPair2, + branch::FourPionPhiPair3, + branch::FourPionPhiPair4, branch::FourPionCosThetaPair1, - branch::FourPionCosThetaPair2); + branch::FourPionCosThetaPair2, + branch::FourPionCosThetaPair3, + branch::FourPionCosThetaPair4); DECLARE_SOA_TABLE(BkgroundData, "AOD", "bkgroundData", branch::RunNumber, @@ -376,6 +391,14 @@ struct ExclusiveRhoTo4Pi { int numPiPlus = 2; int numPiMinus = 2; float zeroPointEight = 0.8; + double mRho0 = 0.77526; // GeV/c^2 + // Run Numbers + static int runNos[113]; + static int numRunNums; + // static std::string eventLabels[12]; + // static std::string trackLabels[14]; + // static int numTrackCuts; + // static int numEventCuts; // Derived Data Produces sigFromData; Produces bkgFromData; @@ -404,7 +427,7 @@ struct ExclusiveRhoTo4Pi { Configurable useTPCtracksOnly{"useTPCtracksOnly", true, "only use tracks with hit in TPC"}; Configurable itsChi2NClsCut{"itsChi2NClsCut", 36, "ITS Chi2NCls"}; Configurable tpcChi2NClsCut{"tpcChi2NClsCut", 4.0, "TPC Chi2NCls"}; - Configurable tpcNClsFindableCut{"tpcNClsFindableCut", 70, "Min TPC Findable Clusters"}; + Configurable tpcNClsFindableCut{"tpcNClsFindableCut", 70, "Min TPC Findable Clusters"}; // Configurable PID parameters Configurable useTOF{"useTOF", true, "if track has TOF use TOF"}; Configurable nSigmaTPCcut{"nSigmaTPCcut", 3, "TPC cut"}; @@ -425,8 +448,14 @@ struct ExclusiveRhoTo4Pi { void init(InitContext const&) { // QA plots: Event and Track Counter - histosCounter.add("EventsCounts_vs_runNo", "Number of Selected 4-Pion Events per Run; Run Number; Number of Events", kTH2F, {{1355, 544013, 545367}, {20, 0, 20}}); - histosCounter.add("TracksCounts_vs_runNo", "Number of Selected Tracks per Run; Run Number; Number of Tracks", kTH2F, {{1355, 544013, 545367}, {20, 0, 20}}); + histosCounter.add("EventsCounts_vs_runNo", "Number of Selected 4-Pion Events per Run; Run Number; Number of Events", kTH2F, {{113, 0, 113}, {12, 0, 12}}); + histosCounter.add("TracksCounts_vs_runNo", "Number of Selected Tracks per Run; Run Number; Number of Tracks", kTH2F, {{113, 0, 113}, {14, 0, 14}}); + histosCounter.add("fourPionCounts_0c", "Four Pion Counts; Run Number; Events", kTH1F, {{113, 0, 113}}); + histosCounter.add("fourPionCounts_0c_within_rap", "Four Pion Counts; Run Number; Events", kTH1F, {{113, 0, 113}}); + histosCounter.add("fourPionCounts_0c_selected", "Four Pion Counts; Run Number; Events", kTH1F, {{113, 0, 113}}); + histosCounter.add("fourPionCounts_n0c", "Four Pion Counts; Run Number; Events", kTH1F, {{113, 0, 113}}); + histosCounter.add("fourPionCounts_n0c_within_rap", "Four Pion Counts; Run Number; Events", kTH1F, {{113, 0, 113}}); + histosCounter.add("fourPionCounts_n0c_selected", "Four Pion Counts; Run Number; Events", kTH1F, {{113, 0, 113}}); // QA plots: event selection histosData.add("UPCmode", "UPC mode; Events", kTH1F, {{5, 0, 5}}); histosData.add("FT0A", "T0A amplitude", kTH1F, {{500, 0.0, 500.0}}); @@ -521,20 +550,9 @@ struct ExclusiveRhoTo4Pi { histosData.add("fourpion_mass_non_0_charge_domA", "Invariant Mass Distribution of non 0 charge Events with PID Selection of Pi for p_{T} < 0.15 GeV/c; m(#pi^{+}#pi^{-}#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {invMassAxis}); // pT < 0.15GeV histosData.add("fourpion_mass_non_0_charge_domB", "Invariant Mass Distribution of non 0 charge Events with PID Selection of Pi for 0.15< p_{T} < 0.80 GeV/c; m(#pi^{+}#pi^{-}#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {invMassAxis}); // 0.15GeV < pT < 0.8GeV histosData.add("fourpion_mass_non_0_charge_domC", "Invariant Mass Distribution of non 0 charge Events with PID Selection of Pi for p_{T} > 0.80 GeV/c; m(#pi^{+}#pi^{-}#pi^{+}#pi^{-}) [GeV/c]", kTH1F, {invMassAxis}); // 0.8GeV < pT - // Collin Soper Theta and Phi - histosData.add("collin_soper_phi_1", "#phi Distribution; #phi; Events", kTH1F, {phiAxis}); - histosData.add("collin_soper_phi_2", "#phi Distribution; #phi; Events", kTH1F, {phiAxis}); - histosData.add("collin_soper_costheta_1", "#theta Distribution;cos(#theta); Counts", kTH1F, {cosThetaAxis}); - histosData.add("collin_soper_costheta_2", "#theta Distribution;cos(#theta); Counts", kTH1F, {cosThetaAxis}); - histosData.add("phi_vs_costheta_1", "Phi vs cosTheta; #phi; cos(#theta)", kTH2F, {phiAxis, cosThetaAxis}); - histosData.add("phi_vs_costheta_2", "Phi vs cosTheta; #phi; cos(#theta)", kTH2F, {phiAxis, cosThetaAxis}); // Collin Soper Theta and Phi after selection - histosData.add("collin_soper_phi_small_mass", "#phi Distribution; #phi; Events", kTH1F, {phiAxis}); - histosData.add("collin_soper_phi_large_mass", "#phi Distribution; #phi; Events", kTH1F, {phiAxis}); - histosData.add("collin_soper_costheta_small_mass", "#theta Distribution;cos(#theta); Counts", kTH1F, {cosThetaAxis}); - histosData.add("collin_soper_costheta_large_mass", "#theta Distribution;cos(#theta); Counts", kTH1F, {cosThetaAxis}); - histosData.add("phi_vs_costheta_small_mass", "Phi vs cosTheta for small mass; #phi; cos(#theta)", kTH2F, {phiAxis, cosThetaAxis}); - histosData.add("phi_vs_costheta_large_mass", "Phi vs cosTheta for large mass; #phi; cos(#theta)", kTH2F, {phiAxis, cosThetaAxis}); + histosData.add("CSphi_vs_CScosTheta", "Phi vs cosTheta for small mass; #phi; cos(#theta)", kTH2F, {phiAxis, cosThetaAxis}); + setHistBinLabels(); } // End of init function //--------------------------------------------------------------------------------------------------------------------------------------------- @@ -546,6 +564,9 @@ struct ExclusiveRhoTo4Pi { Filter bcSelectionCuts = (o2::aod::udcollision::sbp == sbpCut) && (o2::aod::udcollision::itsROFb == itsROFbCut) && (o2::aod::udcollision::vtxITSTPC == vtxITSTPCcut) && (o2::aod::udcollision::tfb == tfbCut); // Track Cuts Filter onlyPVtracks = o2::aod::udtrack::isPVContributor == useOnlyPVtracks; + Filter tpcchi2nclsFilter = o2::aod::track::tpcChi2NCl <= tpcChi2NClsCut; + Filter itschi2nclsFilter = o2::aod::track::itsChi2NCl <= itsChi2NClsCut; + Filter tpcCuts = (nabs(o2::aod::pidtpc::tpcNSigmaPi) <= nSigmaTPCcut); //--------------------------------------------------------------------------------------------------------------------------------------------- using UDtracks = soa::Join; @@ -553,6 +574,9 @@ struct ExclusiveRhoTo4Pi { void processData(soa::Filtered::iterator const& collision, soa::Filtered const& tracks) { + + int runIndex = getRunNumberIndex(collision.runNumber()); + // Check if the Event is reconstructed in UPC mode if (ifCheckUPCmode && (collision.flags() != 1)) { return; @@ -600,7 +624,7 @@ struct ExclusiveRhoTo4Pi { int numPionMinusTracks = static_cast(selectedPionMinusTracks.size()); for (int i = 0; i < numSelectedTracks; i++) { - ROOT::Math::PxPyPzMVector selectedTrackVector(selectedTracks[i].px(), selectedTracks[i].py(), selectedTracks[i].pz(), o2::constants::physics::MassPionCharged); + PxPyPzMVector selectedTrackVector(selectedTracks[i].px(), selectedTracks[i].py(), selectedTracks[i].pz(), o2::constants::physics::MassPionCharged); histosData.fill(HIST("pT_track_all"), selectedTrackVector.Pt()); histosData.fill(HIST("eta_track_all"), selectedTrackVector.Eta()); histosData.fill(HIST("phi_track_all"), selectedTrackVector.Phi()); @@ -621,7 +645,7 @@ struct ExclusiveRhoTo4Pi { } // End of loop over tracks with selection only for (int i = 0; i < numSelectedPionTracks; i++) { - ROOT::Math::PxPyPzMVector selectedPionTrackVector(selectedPionTracks[i].px(), selectedPionTracks[i].py(), selectedPionTracks[i].pz(), o2::constants::physics::MassPionCharged); + PxPyPzMVector selectedPionTrackVector(selectedPionTracks[i].px(), selectedPionTracks[i].py(), selectedPionTracks[i].pz(), o2::constants::physics::MassPionCharged); histosData.fill(HIST("pT_track_pions"), selectedPionTrackVector.Pt()); histosData.fill(HIST("eta_track_pions"), selectedPionTrackVector.Eta()); @@ -663,12 +687,12 @@ struct ExclusiveRhoTo4Pi { // Selecting Events with net charge = 0 if (numPionMinusTracks == numPiMinus && numPiPlusTracks == numPiPlus) { - ROOT::Math::PtEtaPhiMVector k1, k2, k3, k4, k1234, k13, k14, k23, k24; + PtEtaPhiMVector k1, k2, k3, k4, k1234, k13, k14, k23, k24; - ROOT::Math::PxPyPzMVector p1(selectedPionPlusTracks[0].px(), selectedPionPlusTracks[0].py(), selectedPionPlusTracks[0].pz(), o2::constants::physics::MassPionCharged); - ROOT::Math::PxPyPzMVector p2(selectedPionPlusTracks[1].px(), selectedPionPlusTracks[1].py(), selectedPionPlusTracks[1].pz(), o2::constants::physics::MassPionCharged); - ROOT::Math::PxPyPzMVector p3(selectedPionMinusTracks[0].px(), selectedPionMinusTracks[0].py(), selectedPionMinusTracks[0].pz(), o2::constants::physics::MassPionCharged); - ROOT::Math::PxPyPzMVector p4(selectedPionMinusTracks[1].px(), selectedPionMinusTracks[1].py(), selectedPionMinusTracks[1].pz(), o2::constants::physics::MassPionCharged); + PxPyPzMVector p1(selectedPionPlusTracks[0].px(), selectedPionPlusTracks[0].py(), selectedPionPlusTracks[0].pz(), o2::constants::physics::MassPionCharged); + PxPyPzMVector p2(selectedPionPlusTracks[1].px(), selectedPionPlusTracks[1].py(), selectedPionPlusTracks[1].pz(), o2::constants::physics::MassPionCharged); + PxPyPzMVector p3(selectedPionMinusTracks[0].px(), selectedPionMinusTracks[0].py(), selectedPionMinusTracks[0].pz(), o2::constants::physics::MassPionCharged); + PxPyPzMVector p4(selectedPionMinusTracks[1].px(), selectedPionMinusTracks[1].py(), selectedPionMinusTracks[1].pz(), o2::constants::physics::MassPionCharged); histosData.fill(HIST("pT_track_pions_contributed"), p1.Pt()); histosData.fill(HIST("pT_track_pions_contributed"), p2.Pt()); @@ -695,7 +719,7 @@ struct ExclusiveRhoTo4Pi { k3.SetCoordinates(p3.Pt(), p3.Eta(), p3.Phi(), o2::constants::physics::MassPionCharged); k4.SetCoordinates(p4.Pt(), p4.Eta(), p4.Phi(), o2::constants::physics::MassPionCharged); - ROOT::Math::PxPyPzMVector p1234 = p1 + p2 + p3 + p4; + PxPyPzMVector p1234 = p1 + p2 + p3 + p4; k1234 = k1 + k2 + k3 + k4; k13 = k1 + k3; @@ -709,10 +733,14 @@ struct ExclusiveRhoTo4Pi { histosData.fill(HIST("fourpion_rap_0_charge"), p1234.Rapidity()); histosData.fill(HIST("fourpion_mass_0_charge"), p1234.M()); - double fourPiPhiPair1 = phiCollinsSoperFrame(k13, k24, k1234); - double fourPiPhiPair2 = phiCollinsSoperFrame(k14, k23, k1234); - double fourPiCosThetaPair1 = cosThetaCollinsSoperFrame(k13, k24, k1234); - double fourPiCosThetaPair2 = cosThetaCollinsSoperFrame(k14, k23, k1234); + double fourPiPhiPair1 = collinSoperPhi(k13, k1234); + double fourPiPhiPair2 = collinSoperPhi(k14, k1234); + double fourPiPhiPair3 = collinSoperPhi(k23, k1234); + double fourPiPhiPair4 = collinSoperPhi(k24, k1234); + double fourPiCosThetaPair1 = collinSoperCosTheta(k13, k1234); + double fourPiCosThetaPair2 = collinSoperCosTheta(k14, k1234); + double fourPiCosThetaPair3 = collinSoperCosTheta(k23, k1234); + double fourPiCosThetaPair4 = collinSoperCosTheta(k24, k1234); sigFromData( // run number @@ -767,7 +795,10 @@ struct ExclusiveRhoTo4Pi { // Four Mass p1234.M(), // Four Collins Soper Phi and CosTheta - fourPiPhiPair1, fourPiPhiPair2, fourPiCosThetaPair1, fourPiCosThetaPair2); + fourPiPhiPair1, fourPiPhiPair2, fourPiPhiPair3, fourPiPhiPair4, + fourPiCosThetaPair1, fourPiCosThetaPair2, fourPiCosThetaPair3, fourPiCosThetaPair4); + + histosCounter.fill(HIST("fourPionCounts_0c"), runIndex); if (std::fabs(p1234.Rapidity()) < rhoRapCut) { histosData.fill(HIST("fourpion_pT_0_charge_within_rap"), p1234.Pt()); @@ -775,38 +806,34 @@ struct ExclusiveRhoTo4Pi { histosData.fill(HIST("fourpion_phi_0_charge_within_rap"), p1234.Phi()); histosData.fill(HIST("fourpion_rap_0_charge_within_rap"), p1234.Rapidity()); histosData.fill(HIST("fourpion_mass_0_charge_within_rap"), p1234.M()); + histosCounter.fill(HIST("fourPionCounts_0c_within_rap"), runIndex); if (p1234.Pt() < rhoPtCut) { - // Fill the Invariant Mass Histogram - histosData.fill(HIST("fourpion_mass_0_charge_domA"), p1234.M()); - // Two Pion Masses - histosData.fill(HIST("twopion_mass_1"), (p1 + p3).M()); - histosData.fill(HIST("twopion_mass_2"), (p1 + p4).M()); - histosData.fill(HIST("twopion_mass_3"), (p2 + p3).M()); - histosData.fill(HIST("twopion_mass_4"), (p2 + p4).M()); - // Fill the Collins-Soper Frame histograms - histosData.fill(HIST("collin_soper_phi_1"), fourPiPhiPair1); - histosData.fill(HIST("collin_soper_phi_2"), fourPiPhiPair2); - histosData.fill(HIST("collin_soper_costheta_1"), fourPiCosThetaPair1); - histosData.fill(HIST("collin_soper_costheta_2"), fourPiCosThetaPair2); - histosData.fill(HIST("phi_vs_costheta_1"), fourPiPhiPair1, fourPiCosThetaPair1); - histosData.fill(HIST("phi_vs_costheta_2"), fourPiPhiPair2, fourPiCosThetaPair2); - // Small Mass CosTheta and Phi - if ((k13.M() + k24.M()) > (k14.M() + k23.M())) { - histosData.fill(HIST("collin_soper_phi_large_mass"), fourPiPhiPair1); - histosData.fill(HIST("collin_soper_costheta_large_mass"), fourPiCosThetaPair1); - histosData.fill(HIST("phi_vs_costheta_large_mass"), fourPiPhiPair1, fourPiCosThetaPair1); - histosData.fill(HIST("collin_soper_phi_small_mass"), fourPiPhiPair2); - histosData.fill(HIST("collin_soper_costheta_small_mass"), fourPiCosThetaPair2); - histosData.fill(HIST("phi_vs_costheta_small_mass"), fourPiPhiPair2, fourPiCosThetaPair2); - } else { - histosData.fill(HIST("collin_soper_phi_small_mass"), fourPiPhiPair1); - histosData.fill(HIST("collin_soper_costheta_small_mass"), fourPiCosThetaPair1); - histosData.fill(HIST("phi_vs_costheta_small_mass"), fourPiPhiPair1, fourPiCosThetaPair1); - histosData.fill(HIST("collin_soper_phi_large_mass"), fourPiPhiPair2); - histosData.fill(HIST("collin_soper_costheta_large_mass"), fourPiCosThetaPair2); - histosData.fill(HIST("phi_vs_costheta_large_mass"), fourPiPhiPair2, fourPiCosThetaPair2); - } - } + if (rhoMassMin < p1234.M() && p1234.M() < rhoMassMax) { + // Selected Four Pion Events + histosCounter.fill(HIST("fourPionCounts_0c_selected"), runIndex); + // Fill the Invariant Mass Histogram + histosData.fill(HIST("fourpion_mass_0_charge_domA"), p1234.M()); + // Two Pion Masses + histosData.fill(HIST("twopion_mass_1"), (p1 + p3).M()); + histosData.fill(HIST("twopion_mass_2"), (p1 + p4).M()); + histosData.fill(HIST("twopion_mass_3"), (p2 + p3).M()); + histosData.fill(HIST("twopion_mass_4"), (p2 + p4).M()); + // Fill the Collins-Soper Frame histograms + double mDiff13 = std::abs((k13.M() - mRho0)); + double mDiff14 = std::abs((k14.M() - mRho0)); + double mDiff23 = std::abs((k23.M() - mRho0)); + double mDiff24 = std::abs((k24.M() - mRho0)); + if ((mDiff13 < mDiff14) && (mDiff13 < mDiff23) && (mDiff13 < mDiff24)) { + histosData.fill(HIST("CSphi_vs_CScosTheta"), fourPiPhiPair1, fourPiCosThetaPair1); + } else if ((mDiff14 < mDiff13) && (mDiff14 < mDiff23) && (mDiff14 < mDiff24)) { + histosData.fill(HIST("CSphi_vs_CScosTheta"), fourPiPhiPair2, fourPiCosThetaPair2); + } else if ((mDiff23 < mDiff13) && (mDiff23 < mDiff14) && (mDiff23 < mDiff24)) { + histosData.fill(HIST("CSphi_vs_CScosTheta"), fourPiPhiPair3, fourPiCosThetaPair3); + } else if ((mDiff24 < mDiff13) && (mDiff24 < mDiff14) && (mDiff24 < mDiff23)) { + histosData.fill(HIST("CSphi_vs_CScosTheta"), fourPiPhiPair4, fourPiCosThetaPair4); + } + } // End of Pt selection for rho mass + } // End of Pt selection for rho mass if (p1234.Pt() > rhoPtCut && p1234.Pt() < zeroPointEight) { histosData.fill(HIST("fourpion_mass_0_charge_domB"), p1234.M()); } @@ -819,11 +846,11 @@ struct ExclusiveRhoTo4Pi { // Selecting Events with net charge != 0 for estimation of background if (numPionMinusTracks != numPiMinus && numPiPlusTracks != numPiPlus) { - ROOT::Math::PxPyPzMVector p1(selectedPionTracks[0].px(), selectedPionTracks[0].py(), selectedPionTracks[0].pz(), o2::constants::physics::MassPionCharged); - ROOT::Math::PxPyPzMVector p2(selectedPionTracks[1].px(), selectedPionTracks[1].py(), selectedPionTracks[1].pz(), o2::constants::physics::MassPionCharged); - ROOT::Math::PxPyPzMVector p3(selectedPionTracks[2].px(), selectedPionTracks[2].py(), selectedPionTracks[2].pz(), o2::constants::physics::MassPionCharged); - ROOT::Math::PxPyPzMVector p4(selectedPionTracks[3].px(), selectedPionTracks[3].py(), selectedPionTracks[3].pz(), o2::constants::physics::MassPionCharged); - ROOT::Math::PxPyPzMVector p1234 = p1 + p2 + p3 + p4; + PxPyPzMVector p1(selectedPionTracks[0].px(), selectedPionTracks[0].py(), selectedPionTracks[0].pz(), o2::constants::physics::MassPionCharged); + PxPyPzMVector p2(selectedPionTracks[1].px(), selectedPionTracks[1].py(), selectedPionTracks[1].pz(), o2::constants::physics::MassPionCharged); + PxPyPzMVector p3(selectedPionTracks[2].px(), selectedPionTracks[2].py(), selectedPionTracks[2].pz(), o2::constants::physics::MassPionCharged); + PxPyPzMVector p4(selectedPionTracks[3].px(), selectedPionTracks[3].py(), selectedPionTracks[3].pz(), o2::constants::physics::MassPionCharged); + PxPyPzMVector p1234 = p1 + p2 + p3 + p4; histosData.fill(HIST("fourpion_pT_non_0_charge"), p1234.Pt()); histosData.fill(HIST("fourpion_eta_non_0_charge"), p1234.Eta()); @@ -884,14 +911,18 @@ struct ExclusiveRhoTo4Pi { // Four Mass p1234.M()); + histosCounter.fill(HIST("fourPionCounts_n0c"), runIndex); + if (std::fabs(p1234.Rapidity()) < rhoRapCut) { histosData.fill(HIST("fourpion_pT_non_0_charge_within_rap"), p1234.Pt()); histosData.fill(HIST("fourpion_eta_non_0_charge_within_rap"), p1234.Eta()); histosData.fill(HIST("fourpion_phi_non_0_charge_within_rap"), p1234.Phi()); histosData.fill(HIST("fourpion_rap_non_0_charge_within_rap"), p1234.Rapidity()); histosData.fill(HIST("fourpion_mass_non_0_charge_within_rap"), p1234.M()); + histosCounter.fill(HIST("fourPionCounts_n0c_within_rap"), runIndex); if (p1234.Pt() < rhoPtCut) { histosData.fill(HIST("fourpion_mass_non_0_charge_domA"), p1234.M()); + histosCounter.fill(HIST("fourPionCounts_n0c_selected"), runIndex); } if (p1234.Pt() > rhoPtCut && p1234.Pt() < zeroPointEight) { histosData.fill(HIST("fourpion_mass_non_0_charge_domB"), p1234.M()); @@ -903,155 +934,106 @@ struct ExclusiveRhoTo4Pi { } // End of Analysis for non 0 charge events } // End of 4 Pion Analysis Process function for Pass5 Data - void processEventCounter(UDCollisions::iterator const& collision, soa::Filtered const& tracks) + void processEventCounter(UDCollisions::iterator const& collision) { - histosCounter.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 0); + histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 0); // UPC mode if (ifCheckUPCmode && collision.flags() != 1) { return; } - histosCounter.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 1); + histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 1); // vtxITSTPC if (collision.vtxITSTPC() != vtxITSTPCcut) { return; } - histosCounter.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 2); + histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 2); // sbp if (collision.sbp() != sbpCut) { return; } - histosCounter.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 3); + histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 3); // itsROFb if (collision.itsROFb() != itsROFbCut) { return; } - histosCounter.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 4); + histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 4); // tfb if (collision.tfb() != tfbCut) { return; } - histosCounter.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 5); + histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 5); // FT0A if (collision.totalFT0AmplitudeA() > ft0aCut) { return; } - histosCounter.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 6); + histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 6); // FT0C if (collision.totalFT0AmplitudeC() > ft0cCut) { return; } - histosCounter.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 7); + histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 7); // FV0A if (collision.totalFV0AmplitudeA() > fv0Cut) { return; } - histosCounter.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 8); + histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 8); // ZDC if (collision.energyCommonZNA() > zdcCut || collision.energyCommonZNC() > zdcCut) { return; } - histosCounter.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 9); + histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 9); // numContributors if (collision.numContrib() != numPVContrib) { return; } - histosCounter.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 10); + histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 10); // vertexZ if (std::abs(collision.posZ()) > vZCut) { return; } - histosCounter.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 11); - - std::vector selectedPionTracks; - std::vector selectedPionPlusTracks; - std::vector selectedPionMinusTracks; - - for (const auto& t0 : tracks) { - if (!isSelectedTrack(t0, pTcut, etaCut, dcaXYcut, dcaZcut, useITStracksOnly, useTPCtracksOnly, itsChi2NClsCut, tpcChi2NClsCut, tpcNClsFindableCut)) { - continue; - } - if (selectionPIDPion(t0, useTOF, nSigmaTPCcut, nSigmaTOFcut)) { - selectedPionTracks.push_back(t0); - if (t0.sign() == 1) { - selectedPionPlusTracks.push_back(t0); - } - if (t0.sign() == -1) { - selectedPionMinusTracks.push_back(t0); - } - } // End of Selection PID Pion - } // End of loop over tracks - - int numSelectedPionTracks = static_cast(selectedPionTracks.size()); - int numPiPlusTracks = static_cast(selectedPionPlusTracks.size()); - int numPionMinusTracks = static_cast(selectedPionMinusTracks.size()); - // Events with 4 pions - if (numSelectedPionTracks != numFourPionTracks) { - return; - } - histosCounter.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 12); - - // Selecting Events with net charge = 0 - if (numPionMinusTracks == numPiMinus && numPiPlusTracks == numPiPlus) { - histosCounter.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 13); - ROOT::Math::PxPyPzMVector p1(selectedPionPlusTracks[0].px(), selectedPionPlusTracks[0].py(), selectedPionPlusTracks[0].pz(), o2::constants::physics::MassPionCharged); - ROOT::Math::PxPyPzMVector p2(selectedPionPlusTracks[1].px(), selectedPionPlusTracks[1].py(), selectedPionPlusTracks[1].pz(), o2::constants::physics::MassPionCharged); - ROOT::Math::PxPyPzMVector p3(selectedPionMinusTracks[0].px(), selectedPionMinusTracks[0].py(), selectedPionMinusTracks[0].pz(), o2::constants::physics::MassPionCharged); - ROOT::Math::PxPyPzMVector p4(selectedPionMinusTracks[1].px(), selectedPionMinusTracks[1].py(), selectedPionMinusTracks[1].pz(), o2::constants::physics::MassPionCharged); - ROOT::Math::PxPyPzMVector p1234 = p1 + p2 + p3 + p4; - - if ((p1234.Pt() < rhoPtCut) && (std::abs(p1234.Rapidity()) < rhoRapCut)) { - histosCounter.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 14); - if ((rhoMassMin < p1234.M()) && (p1234.M() < rhoMassMax)) { - histosCounter.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 15); - } - } - } // End of Zero Charge Events - - if (numPionMinusTracks != numPiMinus && numPiPlusTracks != numPiPlus) { - histosCounter.fill(HIST("EventsCounts_vs_runNo"), collision.runNumber(), 16); - } // End of Non Zero Charge Events - + histosCounter.fill(HIST("EventsCounts_vs_runNo"), getRunNumberIndex(collision.runNumber()), 11); } // End of processCounter function void processTrackCounter(soa::Filtered::iterator const& collision, UDtracks const& tracks) { + int runIndex = getRunNumberIndex(collision.runNumber()); // Check if the Event is reconstructed in UPC mode if (ifCheckUPCmode && (collision.flags() != 1)) { return; } for (const auto& track : tracks) { - histosCounter.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 0); - ROOT::Math::PxPyPzMVector trackVector(track.px(), track.py(), track.pz(), o2::constants::physics::MassPionCharged); + histosCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 0); + PxPyPzMVector trackVector(track.px(), track.py(), track.pz(), o2::constants::physics::MassPionCharged); // is PV contributor if (track.isPVContributor() != useOnlyPVtracks) { continue; } - histosCounter.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 1); + histosCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 1); // pt cut if (trackVector.Pt() < pTcut) { continue; } - histosCounter.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 2); + histosCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 2); // eta cut if (std::abs(trackVector.Eta()) > etaCut) { continue; } - histosCounter.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 3); + histosCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 3); // DCA Z cut if (std::abs(track.dcaZ()) > dcaZcut) { continue; } - histosCounter.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 4); + histosCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 4); // DCA XY cut float maxDCAxy = 0.0105 + 0.035 / std::pow(trackVector.Pt(), 1.1); if (dcaXYcut == 0 && (std::fabs(track.dcaXY()) > maxDCAxy)) { @@ -1059,40 +1041,40 @@ struct ExclusiveRhoTo4Pi { } else if (dcaXYcut != 0 && (std::fabs(track.dcaXY()) > dcaXYcut)) { continue; } - histosCounter.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 5); + histosCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 5); // ITS Track only if (useITStracksOnly && !track.hasITS()) { continue; } - histosCounter.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 6); + histosCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 6); // TPC Track only if (useTPCtracksOnly && !track.hasTPC()) { continue; } - histosCounter.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 7); + histosCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 7); // ITS Chi2 N Clusters cut if (track.hasITS() && track.itsChi2NCl() > itsChi2NClsCut) { continue; } - histosCounter.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 8); + histosCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 8); // TPC Chi2 N Clusters cut if (track.hasTPC() && track.tpcChi2NCl() > tpcChi2NClsCut) { continue; } - histosCounter.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 9); + histosCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 9); // TPC N Clusters Findable cut if (track.hasTPC() && track.tpcNClsFindable() < tpcNClsFindableCut) { continue; } - histosCounter.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 10); + histosCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 10); // Selection PID Pion if (selectionPIDPion(track, useTOF, nSigmaTPCcut, nSigmaTOFcut)) { - histosCounter.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 11); + histosCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 11); if (track.sign() == 1) { - histosCounter.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 12); + histosCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 12); } if (track.sign() == -1) { - histosCounter.fill(HIST("TracksCounts_vs_runNo"), collision.runNumber(), 13); + histosCounter.fill(HIST("TracksCounts_vs_runNo"), runIndex, 13); } } // End of Selection PID Pion } // End of loop over tracks @@ -1102,52 +1084,44 @@ struct ExclusiveRhoTo4Pi { PROCESS_SWITCH(ExclusiveRhoTo4Pi, processEventCounter, "Event Counter Function", true); PROCESS_SWITCH(ExclusiveRhoTo4Pi, processTrackCounter, "Track Counter Function", true); - double cosThetaCollinsSoperFrame(ROOT::Math::PtEtaPhiMVector pair1, ROOT::Math::PtEtaPhiMVector pair2, ROOT::Math::PtEtaPhiMVector fourpion) + double collinSoperPhi(PtEtaPhiMVector twoPionVector, PtEtaPhiMVector fourPionVector) { + // Half of the energy per pair of the colliding nucleons. double halfSqrtSnn = 2680.; double massOfLead208 = 193.6823; double momentumBeam = std::sqrt(halfSqrtSnn * halfSqrtSnn * 208 * 208 - massOfLead208 * massOfLead208); - ROOT::Math::PxPyPzEVector pProjCM(0., 0., -momentumBeam, halfSqrtSnn * 208); // projectile - ROOT::Math::PxPyPzEVector pTargCM(0., 0., momentumBeam, halfSqrtSnn * 208); // target - ROOT::Math::PtEtaPhiMVector v1 = pair1; - ROOT::Math::PtEtaPhiMVector v2 = pair2; - ROOT::Math::PtEtaPhiMVector v12 = fourpion; + PxPyPzEVector pProjCM(0., 0., -momentumBeam, halfSqrtSnn * 208); // projectile + PxPyPzEVector pTargCM(0., 0., momentumBeam, halfSqrtSnn * 208); // target // Boost to center of mass frame - ROOT::Math::Boost boostv12{v12.BoostToCM()}; - ROOT::Math::XYZVectorF v1CM{(boostv12(v1).Vect()).Unit()}; - ROOT::Math::XYZVectorF v2CM{(boostv12(v2).Vect()).Unit()}; - ROOT::Math::XYZVectorF beam1CM{(boostv12(pProjCM).Vect()).Unit()}; - ROOT::Math::XYZVectorF beam2CM{(boostv12(pTargCM).Vect()).Unit()}; + Boost boosTo4PiCM{fourPionVector.BoostToCM()}; + XYZVectorF twoPionVectorCM{(boosTo4PiCM(twoPionVector).Vect()).Unit()}; + XYZVectorF beam1CM{(boosTo4PiCM(pProjCM).Vect()).Unit()}; + XYZVectorF beam2CM{(boosTo4PiCM(pTargCM).Vect()).Unit()}; // Axes - ROOT::Math::XYZVectorF zaxisCS{((beam1CM.Unit() - beam2CM.Unit()).Unit())}; - double cosThetaCS = zaxisCS.Dot((v1CM)); - return cosThetaCS; + XYZVectorF zaxisCS{((beam1CM.Unit() - beam2CM.Unit()).Unit())}; + XYZVectorF yaxisCS{(beam1CM.Cross(beam2CM)).Unit()}; + XYZVectorF xaxisCS{(yaxisCS.Cross(zaxisCS)).Unit()}; + double phi = std::atan2(yaxisCS.Dot(twoPionVectorCM), xaxisCS.Dot(twoPionVectorCM)); + return phi; } - double phiCollinsSoperFrame(ROOT::Math::PtEtaPhiMVector pair1, ROOT::Math::PtEtaPhiMVector pair2, ROOT::Math::PtEtaPhiMVector fourpion) + double collinSoperCosTheta(PtEtaPhiMVector twoPionVector, PtEtaPhiMVector fourPionVector) { // Half of the energy per pair of the colliding nucleons. double halfSqrtSnn = 2680.; double massOfLead208 = 193.6823; double momentumBeam = std::sqrt(halfSqrtSnn * halfSqrtSnn * 208 * 208 - massOfLead208 * massOfLead208); - ROOT::Math::PxPyPzEVector pProjCM(0., 0., -momentumBeam, halfSqrtSnn * 208); // projectile - ROOT::Math::PxPyPzEVector pTargCM(0., 0., momentumBeam, halfSqrtSnn * 208); // target - ROOT::Math::PtEtaPhiMVector v1 = pair1; - ROOT::Math::PtEtaPhiMVector v2 = pair2; - ROOT::Math::PtEtaPhiMVector v12 = fourpion; + PxPyPzEVector pProjCM(0., 0., -momentumBeam, halfSqrtSnn * 208); // projectile + PxPyPzEVector pTargCM(0., 0., momentumBeam, halfSqrtSnn * 208); // target // Boost to center of mass frame - ROOT::Math::Boost boostv12{v12.BoostToCM()}; - ROOT::Math::XYZVectorF v1CM{(boostv12(v1).Vect()).Unit()}; - ROOT::Math::XYZVectorF v2CM{(boostv12(v2).Vect()).Unit()}; - ROOT::Math::XYZVectorF beam1CM{(boostv12(pProjCM).Vect()).Unit()}; - ROOT::Math::XYZVectorF beam2CM{(boostv12(pTargCM).Vect()).Unit()}; + Boost boosTo4PiCM{fourPionVector.BoostToCM()}; + XYZVectorF twoPionVectorCM{(boosTo4PiCM(twoPionVector).Vect()).Unit()}; + XYZVectorF beam1CM{(boosTo4PiCM(pProjCM).Vect()).Unit()}; + XYZVectorF beam2CM{(boosTo4PiCM(pTargCM).Vect()).Unit()}; // Axes - ROOT::Math::XYZVectorF zaxisCS{((beam1CM.Unit() - beam2CM.Unit()).Unit())}; - ROOT::Math::XYZVectorF yaxisCS{(beam1CM.Cross(beam2CM)).Unit()}; - ROOT::Math::XYZVectorF xaxisCS{(yaxisCS.Cross(zaxisCS)).Unit()}; - - double phi = std::atan2(yaxisCS.Dot(v1CM), xaxisCS.Dot(v1CM)); - return phi; + XYZVectorF zaxisCS{((beam1CM.Unit() - beam2CM.Unit()).Unit())}; + double cosThetaCS = zaxisCS.Dot(twoPionVectorCM); + return cosThetaCS; } template @@ -1162,7 +1136,7 @@ struct ExclusiveRhoTo4Pi { float tpcchi2nclscut, float tpcnclsfindablecut) { - ROOT::Math::PxPyPzMVector trackVector(track.px(), track.py(), track.pz(), o2::constants::physics::MassPionCharged); + PxPyPzMVector trackVector(track.px(), track.py(), track.pz(), o2::constants::physics::MassPionCharged); // pt cut if (trackVector.Pt() < ptcut) { return false; @@ -1206,8 +1180,93 @@ struct ExclusiveRhoTo4Pi { return true; } // End of Track Selection function + int getRunNumberIndex(int runNumber) + { + for (int i = 0; i < numRunNums; ++i) { + if (runNos[i] == runNumber) { + return i; + } + } + return -1; // Not found + } // End of getRunNumberIndex function + + void setHistBinLabels() + { + + std::string eventLabels[12] = { + "No Cuts", "UPC mode", "vtxITSTPC=1", "sbp=1", "itsROFb=1", "tfb=1", + "FT0A <= 50", "FT0C <= 50", "FV0A <= 50", "ZDC <= 0", + "n PV Contrib = 4", "V_{z} < 10cm"}; + + int numEventCuts = 12; + + std::string trackLabels[14] = { + "No Cuts", "isPVContributor", "pT > 0.15 GeV/c", "|#eta| < 0.9", "DCA Z < 2 cm", + "DCA XY cut", "hasITS", "hasTPC", "itsChi2NCl < 36", "tpcChi2NCl < 4", + "tpcNClsFindable < 70", "#pi tracks", "#pi^{+} tracks", "#pi^{-} tracks"}; + int numTrackCuts = 14; + + auto h1 = histosCounter.get(HIST("EventsCounts_vs_runNo")); + auto h2 = histosCounter.get(HIST("TracksCounts_vs_runNo")); + auto h3 = histosCounter.get(HIST("fourPionCounts_0c")); + auto h4 = histosCounter.get(HIST("fourPionCounts_0c_within_rap")); + auto h5 = histosCounter.get(HIST("fourPionCounts_0c_selected")); + auto h6 = histosCounter.get(HIST("fourPionCounts_n0c")); + auto h7 = histosCounter.get(HIST("fourPionCounts_n0c_within_rap")); + auto h8 = histosCounter.get(HIST("fourPionCounts_n0c_selected")); + + for (int i = 0; i < numRunNums; ++i) { + h1->GetXaxis()->SetBinLabel(i + 1, std::to_string(runNos[i]).c_str()); + h2->GetXaxis()->SetBinLabel(i + 1, std::to_string(runNos[i]).c_str()); + h3->GetXaxis()->SetBinLabel(i + 1, std::to_string(runNos[i]).c_str()); + h4->GetXaxis()->SetBinLabel(i + 1, std::to_string(runNos[i]).c_str()); + h5->GetXaxis()->SetBinLabel(i + 1, std::to_string(runNos[i]).c_str()); + h6->GetXaxis()->SetBinLabel(i + 1, std::to_string(runNos[i]).c_str()); + h7->GetXaxis()->SetBinLabel(i + 1, std::to_string(runNos[i]).c_str()); + h8->GetXaxis()->SetBinLabel(i + 1, std::to_string(runNos[i]).c_str()); + } + for (int i = 0; i < numEventCuts; ++i) { + h1->GetYaxis()->SetBinLabel(i + 1, eventLabels[i].c_str()); + } + for (int i = 0; i < numTrackCuts; ++i) { + h2->GetYaxis()->SetBinLabel(i + 1, trackLabels[i].c_str()); + } + } // end of setHistBinLabels function + }; // End of Struct exclusiveRhoTo4Pi +int ExclusiveRhoTo4Pi::runNos[113] = { + 544013, 544028, 544032, 544091, 544095, 544098, 544116, 544121, 544122, 544123, + 544124, 544184, 544185, 544389, 544390, 544391, 544392, 544451, 544454, 544474, + 544475, 544476, 544477, 544490, 544491, 544492, 544508, 544510, 544511, 544512, + 544514, 544515, 544518, 544548, 544549, 544550, 544551, 544564, 544565, 544567, + 544568, 544580, 544582, 544583, 544585, 544614, 544640, 544652, 544653, 544672, + 544674, 544692, 544693, 544694, 544696, 544739, 544742, 544754, 544767, 544794, + 544795, 544797, 544813, 544868, 544886, 544887, 544896, 544911, 544913, 544914, + 544917, 544931, 544947, 544961, 544963, 544964, 544968, 544991, 544992, 545004, + 545008, 545009, 545041, 545042, 545044, 545047, 545060, 545062, 545063, 545064, + 545066, 545086, 545103, 545117, 545171, 545184, 545185, 545210, 545222, 545223, + 545246, 545249, 545262, 545289, 545291, 545294, 545295, 545296, 545311, 545312, + 545332, 545345, 545367}; + +int ExclusiveRhoTo4Pi::numRunNums = 113; + +// std::string ExclusiveRhoTo4Pi::eventLabels[12] = { +// "No Cuts","UPC mode","vtxITSTPC=1","sbp=1","itsROFb=1","tfb=1", +// "FT0A <= 50","FT0C <= 50","FV0A <= 50","ZDC <= 0", +// "n PV Contrib = 4","V_{z} < 10cm" +// }; + +// int ExclusiveRhoTo4Pi::numEventCuts = 20; + +// std::string ExclusiveRhoTo4Pi::trackLabels[14] = { +// "No Cuts","isPVContributor","pT > 0.15 GeV/c","|#eta| < 0.9","DCA Z < 2 cm", +// "DCA XY cut","hasITS","hasTPC","itsChi2NCl < 36","tpcChi2NCl < 4", +// "tpcNClsFindable < 70","#pi tracks","#pi^{+} tracks","#pi^{-} tracks" +// }; +// +// int ExclusiveRhoTo4Pi::numTrackCuts = 14; + WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ From 8ece91962bb7e920e3533b9d870e38c3fc65bf37 Mon Sep 17 00:00:00 2001 From: Steffimro <63045530+Steffimro@users.noreply.github.com> Date: Sun, 3 Aug 2025 21:44:41 +0200 Subject: [PATCH 211/345] [PWGEM] Deleted V0TOFNsigma subscription + updates table subscription (#12404) --- PWGEM/PhotonMeson/Tasks/compconvbuilder.cxx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/PWGEM/PhotonMeson/Tasks/compconvbuilder.cxx b/PWGEM/PhotonMeson/Tasks/compconvbuilder.cxx index 5512191322c..90710659c74 100644 --- a/PWGEM/PhotonMeson/Tasks/compconvbuilder.cxx +++ b/PWGEM/PhotonMeson/Tasks/compconvbuilder.cxx @@ -81,7 +81,7 @@ using MyStraCollision = MyStraCollisions::iterator; using MyTracksIUMC = soa::Join; using MyMCParticles = aod::McParticles; -using V0DerivedMCDatas = soa::Join; +using V0DerivedMCDatas = soa::Join; using dauTracks = soa::Join; @@ -637,7 +637,8 @@ struct Convbuildercomp { void processLFV0sMC(MyStraCollisions const& stracollisions, soa::Join const&, - V0DerivedMCDatas const& strangeV0s) + V0DerivedMCDatas const& strangeV0s, + dauTracks const&) { for (auto& collision : stracollisions) { @@ -728,6 +729,7 @@ struct Convbuildercomp { PresliceUnsorted perMcCollision = aod::emmcparticle::emmceventId; void processConvV0s(MyCollisions const& collisions, + MyMCCollisions const&, aod::EMMCParticles const& mcparticles, MyTracksIUMC const& tracks) { @@ -785,15 +787,15 @@ struct Convbuildercomp { } } - Preslice perEMCollision = aod::v0photonkf::emeventId; - void processMatchCategories( MyCollisions const& collisions, + aod::EMMCEvents const&, MyTracksIUMC const& tracksgen, MyV0Photons const& emV0s, soa::Join const&, V0DerivedMCDatas const& lfV0s, MyMCV0Legs const&, + aod::EMMCParticles const&, aod::McParticles const& mcparticles, dauTracks const&) { @@ -811,7 +813,7 @@ struct Convbuildercomp { fillEventInfo<1, EMBuilder>(collision); - auto emSlice = emV0s.sliceBy(perEMCollision, collision.globalIndex()); + auto emSlice = emV0s.sliceBy(perCollision, collision.globalIndex()); auto lfSlice = lfV0s.sliceBy(perCollisionMCDerived, collision.globalIndex()); using EMIt = decltype(emSlice.begin()); From 31f7d46f08a508b89d19e94845326c344df7da21 Mon Sep 17 00:00:00 2001 From: Nasir Mehdi Malik <89008506+nasirmehdimalik@users.noreply.github.com> Date: Mon, 4 Aug 2025 07:23:36 +0530 Subject: [PATCH 212/345] [PWGLF] Fixed some parts still using 1D in 2D histogram (#12371) --- PWGLF/Tasks/Resonances/lambda1520_PbPb.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGLF/Tasks/Resonances/lambda1520_PbPb.cxx b/PWGLF/Tasks/Resonances/lambda1520_PbPb.cxx index d032d0c90aa..830722b4bbf 100644 --- a/PWGLF/Tasks/Resonances/lambda1520_PbPb.cxx +++ b/PWGLF/Tasks/Resonances/lambda1520_PbPb.cxx @@ -555,7 +555,7 @@ struct lambdaAnalysis_pb { { auto mult = collision.cent(); - histos.fill(HIST("Event/h1d_ft0_mult_percentile"), mult); + histos.fill(HIST("Event/h1d_ft0_mult_percentile"), mult, 100); fillDataHistos(tracks, tracks, mult); // get MC pT-spectra From 599cde90df09bed03729edb033b130676fa2d7e4 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Mon, 4 Aug 2025 09:19:38 +0200 Subject: [PATCH 213/345] [Trigger,PWGEM] fix std (#12372) --- EventFiltering/PWGEM/EMPhotonFilter.cxx | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/EventFiltering/PWGEM/EMPhotonFilter.cxx b/EventFiltering/PWGEM/EMPhotonFilter.cxx index b8901e6f006..3e88524a89b 100644 --- a/EventFiltering/PWGEM/EMPhotonFilter.cxx +++ b/EventFiltering/PWGEM/EMPhotonFilter.cxx @@ -131,7 +131,7 @@ struct EMPhotonFilter { return false; } - if (track.pt() < minpt || abs(track.eta()) > maxeta) { + if (track.pt() < minpt || std::fabs(track.eta()) > maxeta) { return false; } @@ -161,7 +161,7 @@ struct EMPhotonFilter { dca_3d = 999.f; } else { float chi2 = (track.dcaXY() * track.dcaXY() * track.cZZ() + track.dcaZ() * track.dcaZ() * track.cYY() - 2. * track.dcaXY() * track.dcaZ() * track.cZY()) / det; - dca_3d = std::sqrt(std::abs(chi2) / 2.); + dca_3d = std::sqrt(std::fabs(chi2) / 2.); } if (dca_3d > dca_3d_sigma_max) { return false; @@ -177,23 +177,23 @@ struct EMPhotonFilter { template void runFilter(TCollisions const& collisions, TPhotons1 const& photons1, TPhotons2 const& photons2, TPhotons3 const& /*photons3*/, TV0Legs const&, TDielectrons const& dielectrons, TEMPrimaryElectrons const& /*emprimaryelectrons*/) { - for (auto& collision : collisions) { + for (const auto& collision : collisions) { mHistManager.fill(HIST("hEventCounter"), 1.); bool keepEvent[kNtrg]{false}; if (collision.sel8()) { mHistManager.fill(HIST("hEventCounter"), 2.); } - if (abs(collision.posZ()) < 10.f) { + if (std::fabs(collision.posZ()) < 10.f) { mHistManager.fill(HIST("hEventCounter"), 3.); } if (collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { mHistManager.fill(HIST("hEventCounter"), 4.); } - if (collision.sel8() && abs(collision.posZ()) < 10.f) { + if (collision.sel8() && std::fabs(collision.posZ()) < 10.f) { mHistManager.fill(HIST("hEventCounter"), 5.); } - if (collision.sel8() && abs(collision.posZ()) < 10.f && collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { + if (collision.sel8() && std::fabs(collision.posZ()) < 10.f && collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { mHistManager.fill(HIST("hEventCounter"), 6.); } @@ -206,7 +206,7 @@ struct EMPhotonFilter { auto photons1_per_coll = photons1.sliceBy(perCollision_pcm, collision.globalIndex()); auto dielectrons_per_coll = dielectrons.sliceBy(perCollision_ee, collision.globalIndex()); - for (auto& v0photon : photons1_per_coll) { + for (const auto& v0photon : photons1_per_coll) { auto pos_sv = v0photon.template posTrack_as(); auto ele_sv = v0photon.template negTrack_as(); if (!isSelectedSecondary(pos_sv) || !isSelectedSecondary(ele_sv)) { @@ -218,7 +218,7 @@ struct EMPhotonFilter { } } // end of single v0 photon loop - for (auto& [g1, g2] : combinations(CombinationsFullIndexPolicy(photons1_per_coll, dielectrons_per_coll))) { + for (const auto& [g1, g2] : combinations(CombinationsFullIndexPolicy(photons1_per_coll, dielectrons_per_coll))) { auto pos_sv = g1.template posTrack_as(); auto ele_sv = g1.template negTrack_as(); if (!isSelectedSecondary(pos_sv) || !isSelectedSecondary(ele_sv)) { @@ -282,8 +282,8 @@ struct EMPhotonFilter { if (clu2.trackdist() < 1.) { // select neutral clusters. Disp, Ncell cuts? continue; } - double m = pow(clu.e() + clu2.e(), 2) - pow(clu.px() + clu2.px(), 2) - - pow(clu.py() + clu2.py(), 2) - pow(clu.pz() + clu2.pz(), 2); + double m = std::pow(clu.e() + clu2.e(), 2) - std::pow(clu.px() + clu2.px(), 2) - + std::pow(clu.py() + clu2.py(), 2) - std::pow(clu.pz() + clu2.pz(), 2); if (m > ePair * ePair) { keepEvent[kPHOS_Pair] |= true; break; From fb9995f60f82bfd2e404fc0b556f1e145fe3728d Mon Sep 17 00:00:00 2001 From: basiach <74355517+basiach@users.noreply.github.com> Date: Mon, 4 Aug 2025 10:35:15 +0200 Subject: [PATCH 214/345] [PWGCF] FemtoUniverse - Removing double QA histos, unused valiable, changing comments for cascades (#12407) Co-authored-by: Barbara Chytla Co-authored-by: ALICE Action Bot --- .../Core/FemtoUniverseCascadeSelection.h | 14 ++++----- ...toUniversePairTaskTrackCascadeExtended.cxx | 31 +++++-------------- 2 files changed, 14 insertions(+), 31 deletions(-) diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniverseCascadeSelection.h b/PWGCF/FemtoUniverse/Core/FemtoUniverseCascadeSelection.h index 3a389da705e..ff8206ea551 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniverseCascadeSelection.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniverseCascadeSelection.h @@ -252,9 +252,9 @@ class FemtoUniverseCascadeSelection femto_universe_selection::kLowerLimit, // cascade tran rad min femto_universe_selection::kUpperLimit, // cascade tran rad max femto_universe_selection::kUpperLimit, // cascade maximum distance of decay vertex to PV - femto_universe_selection::kLowerLimit, // DCA pos to PV max - femto_universe_selection::kLowerLimit, // DCA neg to PV max - femto_universe_selection::kLowerLimit, // DCA bach to PV max + femto_universe_selection::kLowerLimit, // DCA pos to PV min + femto_universe_selection::kLowerLimit, // DCA neg to PV min + femto_universe_selection::kLowerLimit, // DCA bach to PV min femto_universe_selection::kLowerLimit, // DCA v0 to PV max femto_universe_selection::kLowerLimit, // v0 mass min femto_universe_selection::kUpperLimit, // v0 mass max @@ -276,10 +276,10 @@ class FemtoUniverseCascadeSelection "Minimum cascade transverse radius (cm)", "Maximum cascade transverse radius (cm)", "Maximum distance of cascade from primary vertex", - "Maximum DCA of positive track form primary vertex", - "Maximum DCA of negative track form primary vertex", - "Maximum DCA of bachelor track form primary vertex", - "Maximum DCA of v0 form primary vertex", + "Minimum DCA of positive track form primary vertex", + "Minimum DCA of negative track form primary vertex", + "Minimum DCA of bachelor track form primary vertex", + "Minimum DCA of v0 form primary vertex", "Minimum V0 mass", "Maximum V0 mass"}; ///< Helper information for the ///< different selections diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx index 11d1bf2418e..63decd49fbe 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx @@ -54,7 +54,6 @@ struct femtoUniversePairTaskTrackCascadeExtended { ConfigurableAxis confChildTempFitVarBins{"confChildTempFitVarBins", {300, -0.15, 0.15}, "V0 child: binning of the TempFitVar in the pT vs. TempFitVar plot"}; Configurable confCascInvMassLowLimit{"confCascInvMassLowLimit", 1.315, "Lower limit of the Casc invariant mass"}; Configurable confCascInvMassUpLimit{"confCascInvMassUpLimit", 1.325, "Upper limit of the Casc invariant mass"}; - Configurable confCascTranRad{"confCascTranRad", 0.5, "Cascade transverse radius"}; Configurable confNSigmaTPCPion{"confNSigmaTPCPion", 4, "NSigmaTPCPion"}; Configurable confNSigmaTPCProton{"confNSigmaTPCProton", 4, "NSigmaTPCProton"}; @@ -299,29 +298,17 @@ struct femtoUniversePairTaskTrackCascadeExtended { } } - void processCascades([[maybe_unused]] const FilteredFDCollision& col, const FemtoFullParticles& parts, const aod::FDCascParticles& fdcascs) + void processCascadeQA([[maybe_unused]] const FilteredFDCollision& col, const FemtoFullParticles& parts, const aod::FDCascParticles& fdcascs) { - // auto groupCascs = cascs->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); - // const int multCol = col.multNtr(); - for (const auto& casc : fdcascs) { const auto& part = casc.fdParticle_as(); rXiQA.fill(HIST("hMassXi"), part.mLambda()); - // if (!invMCascade(casc.mLambda(), casc.mAntiLambda())) - // continue; - const auto& posChild = parts.iteratorAt(part.globalIndex() - 3 - parts.begin().globalIndex()); const auto& negChild = parts.iteratorAt(part.globalIndex() - 2 - parts.begin().globalIndex()); const auto& bachelor = parts.iteratorAt(part.globalIndex() - 1 - parts.begin().globalIndex()); - // if (casc.transRadius() < confCascTranRad) - // continue; - // std::cout< confNSigmaTPCProton) { continue; @@ -356,13 +343,9 @@ struct femtoUniversePairTaskTrackCascadeExtended { rXiQA.fill(HIST("hDcaBachtoPV"), casc.dcabachtopv()); rXiQA.fill(HIST("hDcaV0toPV"), casc.dcav0topv()); rXiQA.fill(HIST("hInvMpT"), part.pt(), part.mLambda()); - - posChildHistos.fillQA(posChild); - negChildHistos.fillQA(negChild); - bachHistos.fillQABase(bachelor, HIST("hBachelor")); } } - PROCESS_SWITCH(femtoUniversePairTaskTrackCascadeExtended, processCascades, "Enable processing cascades", false); + PROCESS_SWITCH(femtoUniversePairTaskTrackCascadeExtended, processCascadeQA, "Enable processing cascades", false); template using hasSigma = decltype(std::declval().tpcNSigmaStorePr()); @@ -383,11 +366,6 @@ struct femtoUniversePairTaskTrackCascadeExtended { if (!invMCascade(part.mLambda(), part.mAntiLambda(), confCascType1)) /// mLambda stores Xi mass, mAntiLambda stores Omega mass continue; - if constexpr (std::experimental::is_detected::value) - cascQAHistos.fillQA(part); - else - cascQAHistos.fillQA(part); - const auto& posChild = parts.iteratorAt(part.globalIndex() - 3 - parts.begin().globalIndex()); const auto& negChild = parts.iteratorAt(part.globalIndex() - 2 - parts.begin().globalIndex()); const auto& bachelor = parts.iteratorAt(part.globalIndex() - 1 - parts.begin().globalIndex()); @@ -409,6 +387,11 @@ struct femtoUniversePairTaskTrackCascadeExtended { if ((!confCheckTOFBachelorOnly && ((posChild.pidCut() & (8u << CascChildTable[confCascType1][0])) == 0 || (negChild.pidCut() & (8u << CascChildTable[confCascType1][1])) == 0)) || (bachelor.pidCut() & (8u << CascChildTable[confCascType1][2])) == 0) continue; + if constexpr (std::experimental::is_detected::value) + cascQAHistos.fillQA(part); + else + cascQAHistos.fillQA(part); + posChildHistos.fillQA(posChild); negChildHistos.fillQA(negChild); bachHistos.fillQABase(bachelor, HIST("hBachelor")); From bb9540524192e175dee3df066021d916672590c3 Mon Sep 17 00:00:00 2001 From: arvindkhuntia <31609955+arvindkhuntia@users.noreply.github.com> Date: Mon, 4 Aug 2025 14:23:00 +0530 Subject: [PATCH 215/345] [PWGJE] Bug fixed (#12391) Co-authored-by: Arvind Khuntia --- PWGJE/Tasks/nucleiInJets.cxx | 99 ++++++++++++++++++------------------ 1 file changed, 49 insertions(+), 50 deletions(-) diff --git a/PWGJE/Tasks/nucleiInJets.cxx b/PWGJE/Tasks/nucleiInJets.cxx index e02381a61fe..37fb0764947 100644 --- a/PWGJE/Tasks/nucleiInJets.cxx +++ b/PWGJE/Tasks/nucleiInJets.cxx @@ -59,6 +59,7 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; +using namespace o2::constants::physics; struct nucleiInJets { enum Particle { @@ -88,19 +89,19 @@ struct nucleiInJets { case -2212: // antip return -Particle::kProton; - case 1000010020: // Deuteron + case Pdg::kDeuteron: // Deuteron return Particle::kDeuteron; - case -1000010020: // AntiDeuteron + case -Pdg::kDeuteron: // AntiDeuteron return -Particle::kDeuteron; - case 1000010030: // Triton + case Pdg::kTriton: // Triton return Particle::kTriton; - case -1000010030: // AntiTriton + case -Pdg::kTriton: // AntiTriton return -Particle::kTriton; - case 1000020030: // Helium + case Pdg::kHelium3: // Helium return Particle::kHelium; - case -1000020030: // AntiHelium + case -Pdg::kHelium3: // AntiHelium return -Particle::kHelium; default: return 0; // Default case for unknown or unmapped PDG codes @@ -216,7 +217,7 @@ struct nucleiInJets { const AxisSpec dcaxyAxis{binsDCA, "DCAxy (cm)"}; const AxisSpec dcazAxis{binsDCA, "DCAz (cm)"}; const AxisSpec dedxAxis{binsdEdx, "d#it{E}/d#it{x} A.U."}; - const AxisSpec vzAxis{{300, -15.f, 15.f}, "Vz (cm)"}; + const AxisSpec vzAxis{300, -15.f, 15.f, "Vz (cm)"}; const AxisSpec betaAxis{binsBeta, "TOF #beta"}; const AxisSpec ptZHeAxis{binsPtZHe, "#it{p}_{T}"}; @@ -813,13 +814,13 @@ struct nucleiInJets { if (addTOFplots && trk.hasTOF()) { if (!useTPCpreSel) { jetHist.fill(HIST("tracks/proton/h2TOFmassProtonVsPt_jet"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/proton/h2TOFmass2ProtonVsPt_jet"), massTOF * massTOF - o2::constants::physics::MassProton * o2::constants::physics::MassProton, trk.pt()); + jetHist.fill(HIST("tracks/proton/h2TOFmass2ProtonVsPt_jet"), massTOF * massTOF - MassProton * MassProton, trk.pt()); jetHist.fill(HIST("tracks/deuteron/h2TOFmassDeuteronVsPt_jet"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/deuteron/h2TOFmass2DeuteronVsPt_jet"), massTOF * massTOF - o2::constants::physics::MassDeuteron * o2::constants::physics::MassDeuteron, trk.pt()); + jetHist.fill(HIST("tracks/deuteron/h2TOFmass2DeuteronVsPt_jet"), massTOF * massTOF - MassDeuteron * MassDeuteron, trk.pt()); jetHist.fill(HIST("tracks/triton/h2TOFmassTritonVsPt_jet"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/triton/h2TOFmass2TritonVsPt_jet"), massTOF * massTOF - o2::constants::physics::MassTriton * o2::constants::physics::MassTriton, trk.pt()); + jetHist.fill(HIST("tracks/triton/h2TOFmass2TritonVsPt_jet"), massTOF * massTOF - MassTriton * MassTriton, trk.pt()); jetHist.fill(HIST("tracks/helium/h2TOFmassHeliumVsPt_jet"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/helium/h2TOFmass2HeliumVsPt_jet"), massTOF * massTOF - o2::constants::physics::MassHelium3 * o2::constants::physics::MassHelium3, trk.pt()); + jetHist.fill(HIST("tracks/helium/h2TOFmass2HeliumVsPt_jet"), massTOF * massTOF - MassHelium3 * MassHelium3, trk.pt()); jetHist.fill(HIST("tracks/proton/h2TofNsigmaProtonVsPt_jet"), trk.tofNSigmaPr(), trk.pt()); jetHist.fill(HIST("tracks/deuteron/h2TofNsigmaDeuteronVsPt_jet"), trk.tofNSigmaDe(), trk.pt()); jetHist.fill(HIST("tracks/helium/h2TofNsigmaHeliumVsPt_jet"), trk.tofNSigmaHe(), trk.pt()); @@ -829,24 +830,24 @@ struct nucleiInJets { } else { if (std::abs(trk.tpcNSigmaPr()) < cfgnTPCPIDPr) { jetHist.fill(HIST("tracks/proton/h2TOFmassProtonVsPt_jet"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/proton/h2TOFmass2ProtonVsPt_jet"), massTOF * massTOF - o2::constants::physics::MassProton * o2::constants::physics::MassProton, trk.pt()); + jetHist.fill(HIST("tracks/proton/h2TOFmass2ProtonVsPt_jet"), massTOF * massTOF - MassProton * MassProton, trk.pt()); jetHist.fill(HIST("tracks/proton/h2TofNsigmaProtonVsPt_jet"), trk.tofNSigmaPr(), trk.pt()); jetHist.fill(HIST("tracks/proton/h3TpcNsigmaTofNsigmaProtonVsPt_jet"), trk.tpcNSigmaPr(), trk.tofNSigmaPr(), trk.pt()); } if (std::abs(trk.tpcNSigmaDe()) < cfgnTPCPIDDe) { jetHist.fill(HIST("tracks/deuteron/h2TOFmassDeuteronVsPt_jet"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/deuteron/h2TOFmass2DeuteronVsPt_jet"), massTOF * massTOF - o2::constants::physics::MassDeuteron * o2::constants::physics::MassDeuteron, trk.pt()); + jetHist.fill(HIST("tracks/deuteron/h2TOFmass2DeuteronVsPt_jet"), massTOF * massTOF - MassDeuteron * MassDeuteron, trk.pt()); jetHist.fill(HIST("tracks/deuteron/h2TofNsigmaDeuteronVsPt_jet"), trk.tofNSigmaDe(), trk.pt()); jetHist.fill(HIST("tracks/deuteron/h3TpcNsigmaTofNsigmaDeuteronVsPt_jet"), trk.tpcNSigmaDe(), trk.tofNSigmaDe(), trk.pt()); } if (std::abs(trk.tpcNSigmaTr()) < cfgnTPCPIDTr) { jetHist.fill(HIST("tracks/triton/h2TOFmassTritonVsPt_jet"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/triton/h2TOFmass2TritonVsPt_jet"), massTOF * massTOF - o2::constants::physics::MassTriton * o2::constants::physics::MassTriton, trk.pt()); + jetHist.fill(HIST("tracks/triton/h2TOFmass2TritonVsPt_jet"), massTOF * massTOF - MassTriton * MassTriton, trk.pt()); jetHist.fill(HIST("tracks/triton/h2TofNsigmaTritonVsPt_jet"), trk.tofNSigmaTr(), trk.pt()); } if (std::abs(trk.tpcNSigmaHe()) < cfgnTPCPIDHe) { jetHist.fill(HIST("tracks/helium/h2TOFmassHeliumVsPt_jet"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/helium/h2TOFmass2HeliumVsPt_jet"), massTOF * massTOF - o2::constants::physics::MassHelium3 * o2::constants::physics::MassHelium3, trk.pt()); + jetHist.fill(HIST("tracks/helium/h2TOFmass2HeliumVsPt_jet"), massTOF * massTOF - MassHelium3 * MassHelium3, trk.pt()); jetHist.fill(HIST("tracks/helium/h2TofNsigmaHeliumVsPt_jet"), trk.tofNSigmaHe(), trk.pt()); } } @@ -929,43 +930,41 @@ struct nucleiInJets { if (addTOFplots && trk.hasTOF()) { if (!useTPCpreSel) { jetHist.fill(HIST("tracks/antiProton/h2TOFmassantiProtonVsPt_jet"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/antiProton/h2TOFmass2antiProtonVsPt_jet"), massTOF * massTOF - o2::constants::physics::MassProton * o2::constants::physics::MassProton, trk.pt()); + jetHist.fill(HIST("tracks/antiProton/h2TOFmass2antiProtonVsPt_jet"), massTOF * massTOF - MassProton * MassProton, trk.pt()); jetHist.fill(HIST("tracks/antiProton/h2TofNsigmaantiProtonVsPt_jet"), trk.tofNSigmaPr(), trk.pt()); jetHist.fill(HIST("tracks/antiProton/h3TpcNsigmaTofNsigmaantiProtonVsPt_jet"), trk.tpcNSigmaPr(), trk.tofNSigmaPr(), trk.pt()); - jetHist.fill(HIST("tracks/antiDeuteron/h2TOFmassantiDeuteronVsPt_jet"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/antiDeuteron/h2TOFmass2antiDeuteronVsPt_jet"), massTOF * massTOF - o2::constants::physics::MassDeuteron * o2::constants::physics::MassDeuteron, trk.pt()); + jetHist.fill(HIST("tracks/antiDeuteron/h2TOFmass2antiDeuteronVsPt_jet"), massTOF * massTOF - MassDeuteron * MassDeuteron, trk.pt()); jetHist.fill(HIST("tracks/antiDeuteron/h2TofNsigmaantiDeuteronVsPt_jet"), trk.tofNSigmaDe(), trk.pt()); jetHist.fill(HIST("tracks/antiDeuteron/h3TpcNsigmaTofNsigmaantiDeuteronVsPt_jet"), trk.tpcNSigmaDe(), trk.tofNSigmaDe(), trk.pt()); jetHist.fill(HIST("tracks/antiTriton/h2TOFmassantiTritonVsPt_jet"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/antiTriton/h2TOFmass2antiTritonVsPt_jet"), massTOF * massTOF - o2::constants::physics::MassTriton * o2::constants::physics::MassTriton, trk.pt()); + jetHist.fill(HIST("tracks/antiTriton/h2TOFmass2antiTritonVsPt_jet"), massTOF * massTOF - MassTriton * MassTriton, trk.pt()); jetHist.fill(HIST("tracks/antiTriton/h2TofNsigmaantiTritonVsPt_jet"), trk.tofNSigmaTr(), trk.pt()); - jetHist.fill(HIST("tracks/antiHelium/h2TOFmassantiHeliumVsPt_jet"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/antiHelium/h2TOFmass2antiHeliumVsPt_jet"), massTOF * massTOF - o2::constants::physics::MassHelium3 * o2::constants::physics::MassHelium3, trk.pt()); + jetHist.fill(HIST("tracks/antiHelium/h2TOFmass2antiHeliumVsPt_jet"), massTOF * massTOF - MassHelium3 * MassHelium3, trk.pt()); jetHist.fill(HIST("tracks/antiHelium/h2TofNsigmaantiHeliumVsPt_jet"), trk.tofNSigmaHe(), trk.pt()); } else { if (std::abs(trk.tpcNSigmaPr()) < cfgnTPCPIDPr) { jetHist.fill(HIST("tracks/antiProton/h2TOFmassantiProtonVsPt_jet"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/antiProton/h2TOFmass2antiProtonVsPt_jet"), massTOF * massTOF - o2::constants::physics::MassProton * o2::constants::physics::MassProton, trk.pt()); + jetHist.fill(HIST("tracks/antiProton/h2TOFmass2antiProtonVsPt_jet"), massTOF * massTOF - MassProton * MassProton, trk.pt()); jetHist.fill(HIST("tracks/antiProton/h2TofNsigmaantiProtonVsPt_jet"), trk.tofNSigmaPr(), trk.pt()); jetHist.fill(HIST("tracks/antiProton/h3TpcNsigmaTofNsigmaantiProtonVsPt_jet"), trk.tpcNSigmaPr(), trk.tofNSigmaPr(), trk.pt()); } if (std::abs(trk.tpcNSigmaDe()) < cfgnTPCPIDDe) { jetHist.fill(HIST("tracks/antiDeuteron/h2TOFmassantiDeuteronVsPt_jet"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/antiDeuteron/h2TOFmass2antiDeuteronVsPt_jet"), massTOF * massTOF - o2::constants::physics::MassDeuteron * o2::constants::physics::MassDeuteron, trk.pt()); + jetHist.fill(HIST("tracks/antiDeuteron/h2TOFmass2antiDeuteronVsPt_jet"), massTOF * massTOF - MassDeuteron * MassDeuteron, trk.pt()); jetHist.fill(HIST("tracks/antiDeuteron/h2TofNsigmaantiDeuteronVsPt_jet"), trk.tofNSigmaDe(), trk.pt()); jetHist.fill(HIST("tracks/antiDeuteron/h3TpcNsigmaTofNsigmaantiDeuteronVsPt_jet"), trk.tpcNSigmaDe(), trk.tofNSigmaDe(), trk.pt()); } if (std::abs(trk.tpcNSigmaTr()) < cfgnTPCPIDTr) { jetHist.fill(HIST("tracks/antiTriton/h2TOFmassantiTritonVsPt_jet"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/antiTriton/h2TOFmass2antiTritonVsPt_jet"), massTOF * massTOF - o2::constants::physics::MassTriton * o2::constants::physics::MassTriton, trk.pt()); + jetHist.fill(HIST("tracks/antiTriton/h2TOFmass2antiTritonVsPt_jet"), massTOF * massTOF - MassTriton * MassTriton, trk.pt()); jetHist.fill(HIST("tracks/antiTriton/h2TofNsigmaantiTritonVsPt_jet"), trk.tofNSigmaTr(), trk.pt()); } if (std::abs(trk.tpcNSigmaHe()) < cfgnTPCPIDHe) { jetHist.fill(HIST("tracks/antiHelium/h2TOFmassantiHeliumVsPt_jet"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/antiHelium/h2TOFmass2antiHeliumVsPt_jet"), massTOF * massTOF - o2::constants::physics::MassHelium3 * o2::constants::physics::MassHelium3, trk.pt()); + jetHist.fill(HIST("tracks/antiHelium/h2TOFmass2antiHeliumVsPt_jet"), massTOF * massTOF - MassHelium3 * MassHelium3, trk.pt()); jetHist.fill(HIST("tracks/antiHelium/h2TofNsigmaantiHeliumVsPt_jet"), trk.tofNSigmaHe(), trk.pt()); } } @@ -1067,45 +1066,45 @@ struct nucleiInJets { if (addTOFplots && trk.hasTOF()) { if (!useTPCpreSel) { jetHist.fill(HIST("tracks/proton/h2TOFmassProtonVsPt"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/proton/h2TOFmass2ProtonVsPt"), massTOF * massTOF - o2::constants::physics::MassProton * o2::constants::physics::MassProton, trk.pt()); + jetHist.fill(HIST("tracks/proton/h2TOFmass2ProtonVsPt"), massTOF * massTOF - MassProton * MassProton, trk.pt()); jetHist.fill(HIST("tracks/proton/h2TofNsigmaProtonVsPt"), trk.tofNSigmaPr(), trk.pt()); jetHist.fill(HIST("tracks/deuteron/h2TOFmassDeuteronVsPt"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/deuteron/h2TOFmass2DeuteronVsPt"), massTOF * massTOF - o2::constants::physics::MassDeuteron * o2::constants::physics::MassDeuteron, trk.pt()); + jetHist.fill(HIST("tracks/deuteron/h2TOFmass2DeuteronVsPt"), massTOF * massTOF - MassDeuteron * MassDeuteron, trk.pt()); jetHist.fill(HIST("tracks/deuteron/h2TofNsigmaDeuteronVsPt"), trk.tofNSigmaDe(), trk.pt()); jetHist.fill(HIST("tracks/triton/h2TOFmassTritonVsPt"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/triton/h2TOFmass2TritonVsPt"), massTOF * massTOF - o2::constants::physics::MassTriton * o2::constants::physics::MassTriton, trk.pt()); + jetHist.fill(HIST("tracks/triton/h2TOFmass2TritonVsPt"), massTOF * massTOF - MassTriton * MassTriton, trk.pt()); jetHist.fill(HIST("tracks/helium/h2TofNsigmaHeliumVsPt"), trk.tofNSigmaHe(), trk.pt()); jetHist.fill(HIST("tracks/helium/h2TOFmassHeliumVsPt"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/helium/h2TOFmass2HeliumVsPt"), massTOF * massTOF - o2::constants::physics::MassHelium3 * o2::constants::physics::MassHelium3, trk.pt()); + jetHist.fill(HIST("tracks/helium/h2TOFmass2HeliumVsPt"), massTOF * massTOF - MassHelium3 * MassHelium3, trk.pt()); jetHist.fill(HIST("tracks/triton/h2TofNsigmaTritonVsPt"), trk.tofNSigmaTr(), trk.pt()); } else { if (std::abs(trk.tpcNSigmaPr()) < cfgnTPCPIDPr) { jetHist.fill(HIST("tracks/proton/h2TOFmassProtonVsPt"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/proton/h2TOFmass2ProtonVsPt"), massTOF * massTOF - o2::constants::physics::MassProton * o2::constants::physics::MassProton, trk.pt()); + jetHist.fill(HIST("tracks/proton/h2TOFmass2ProtonVsPt"), massTOF * massTOF - MassProton * MassProton, trk.pt()); jetHist.fill(HIST("tracks/proton/h2TofNsigmaProtonVsPt"), trk.tofNSigmaPr(), trk.pt()); if (jetFlagPerpCone && isWithLeadingJet) jetHist.fill(HIST("tracks/perpCone/proton/h2TofNsigmaProtonVsPt"), trk.tofNSigmaPr(), trk.pt()); } if (std::abs(trk.tpcNSigmaDe()) < cfgnTPCPIDDe) { jetHist.fill(HIST("tracks/deuteron/h2TOFmassDeuteronVsPt"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/deuteron/h2TOFmass2DeuteronVsPt"), massTOF * massTOF - o2::constants::physics::MassDeuteron * o2::constants::physics::MassDeuteron, trk.pt()); + jetHist.fill(HIST("tracks/deuteron/h2TOFmass2DeuteronVsPt"), massTOF * massTOF - MassDeuteron * MassDeuteron, trk.pt()); jetHist.fill(HIST("tracks/deuteron/h2TofNsigmaDeuteronVsPt"), trk.tofNSigmaDe(), trk.pt()); if (jetFlagPerpCone && isWithLeadingJet) jetHist.fill(HIST("tracks/perpCone/deuteron/h2TofNsigmaDeuteronVsPt"), trk.tofNSigmaDe(), trk.pt()); } if (std::abs(trk.tpcNSigmaTr()) < cfgnTPCPIDTr) { jetHist.fill(HIST("tracks/triton/h2TOFmassTritonVsPt"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/triton/h2TOFmass2TritonVsPt"), massTOF * massTOF - o2::constants::physics::MassTriton * o2::constants::physics::MassTriton, trk.pt()); + jetHist.fill(HIST("tracks/triton/h2TOFmass2TritonVsPt"), massTOF * massTOF - MassTriton * MassTriton, trk.pt()); jetHist.fill(HIST("tracks/triton/h2TofNsigmaTritonVsPt"), trk.tofNSigmaTr(), trk.pt()); if (jetFlagPerpCone && isWithLeadingJet) jetHist.fill(HIST("tracks/perpCone/triton/h2TofNsigmaTritonVsPt"), trk.tofNSigmaTr(), trk.pt()); } if (std::abs(trk.tpcNSigmaHe()) < cfgnTPCPIDHe) { jetHist.fill(HIST("tracks/helium/h2TOFmassHeliumVsPt"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/helium/h2TOFmass2HeliumVsPt"), massTOF * massTOF - o2::constants::physics::MassHelium3 * o2::constants::physics::MassHelium3, trk.pt()); + jetHist.fill(HIST("tracks/helium/h2TOFmass2HeliumVsPt"), massTOF * massTOF - MassHelium3 * MassHelium3, trk.pt()); jetHist.fill(HIST("tracks/helium/h2TofNsigmaHeliumVsPt"), trk.tofNSigmaHe(), trk.pt()); if (jetFlagPerpCone && isWithLeadingJet) jetHist.fill(HIST("tracks/perpCone/helium/h2TofNsigmaHeliumVsPt"), trk.tofNSigmaHe(), trk.pt()); @@ -1185,45 +1184,45 @@ struct nucleiInJets { if (addTOFplots && trk.hasTOF()) { if (!useTPCpreSel) { jetHist.fill(HIST("tracks/antiProton/h2TOFmassantiProtonVsPt"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/antiProton/h2TOFmass2antiProtonVsPt"), massTOF * massTOF - o2::constants::physics::MassProton * o2::constants::physics::MassProton, trk.pt()); + jetHist.fill(HIST("tracks/antiProton/h2TOFmass2antiProtonVsPt"), massTOF * massTOF - MassProton * MassProton, trk.pt()); jetHist.fill(HIST("tracks/antiProton/h2TofNsigmaantiProtonVsPt"), trk.tofNSigmaPr(), trk.pt()); jetHist.fill(HIST("tracks/antiDeuteron/h2TOFmassantiDeuteronVsPt"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/antiDeuteron/h2TOFmass2antiDeuteronVsPt"), massTOF * massTOF - o2::constants::physics::MassDeuteron * o2::constants::physics::MassDeuteron, trk.pt()); + jetHist.fill(HIST("tracks/antiDeuteron/h2TOFmass2antiDeuteronVsPt"), massTOF * massTOF - MassDeuteron * MassDeuteron, trk.pt()); jetHist.fill(HIST("tracks/antiDeuteron/h2TofNsigmaantiDeuteronVsPt"), trk.tofNSigmaDe(), trk.pt()); jetHist.fill(HIST("tracks/antiTriton/h2TOFmassantiTritonVsPt"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/antiTriton/h2TOFmass2antiTritonVsPt"), massTOF * massTOF - o2::constants::physics::MassTriton * o2::constants::physics::MassTriton, trk.pt()); + jetHist.fill(HIST("tracks/antiTriton/h2TOFmass2antiTritonVsPt"), massTOF * massTOF - MassTriton * MassTriton, trk.pt()); jetHist.fill(HIST("tracks/antiHelium/h2TofNsigmaantiHeliumVsPt"), trk.tofNSigmaHe(), trk.pt()); jetHist.fill(HIST("tracks/antiHelium/h2TOFmassantiHeliumVsPt"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/antiHelium/h2TOFmass2antiHeliumVsPt"), massTOF * massTOF - o2::constants::physics::MassHelium3 * o2::constants::physics::MassHelium3, trk.pt()); + jetHist.fill(HIST("tracks/antiHelium/h2TOFmass2antiHeliumVsPt"), massTOF * massTOF - MassHelium3 * MassHelium3, trk.pt()); jetHist.fill(HIST("tracks/antiTriton/h2TofNsigmaantiTritonVsPt"), trk.tofNSigmaTr(), trk.pt()); } else { if (std::abs(trk.tpcNSigmaPr()) < cfgnTPCPIDPr) { jetHist.fill(HIST("tracks/antiProton/h2TOFmassantiProtonVsPt"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/antiProton/h2TOFmass2antiProtonVsPt"), massTOF * massTOF - o2::constants::physics::MassProton * o2::constants::physics::MassProton, trk.pt()); + jetHist.fill(HIST("tracks/antiProton/h2TOFmass2antiProtonVsPt"), massTOF * massTOF - MassProton * MassProton, trk.pt()); jetHist.fill(HIST("tracks/antiProton/h2TofNsigmaantiProtonVsPt"), trk.tofNSigmaPr(), trk.pt()); if (jetFlagPerpCone && isWithLeadingJet) jetHist.fill(HIST("tracks/perpCone/antiProton/h2TofNsigmaantiProtonVsPt"), trk.tofNSigmaPr(), trk.pt()); } if (std::abs(trk.tpcNSigmaDe()) < cfgnTPCPIDDe) { jetHist.fill(HIST("tracks/antiDeuteron/h2TOFmassantiDeuteronVsPt"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/antiDeuteron/h2TOFmass2antiDeuteronVsPt"), massTOF * massTOF - o2::constants::physics::MassDeuteron * o2::constants::physics::MassDeuteron, trk.pt()); + jetHist.fill(HIST("tracks/antiDeuteron/h2TOFmass2antiDeuteronVsPt"), massTOF * massTOF - MassDeuteron * MassDeuteron, trk.pt()); jetHist.fill(HIST("tracks/antiDeuteron/h2TofNsigmaantiDeuteronVsPt"), trk.tofNSigmaDe(), trk.pt()); if (jetFlagPerpCone && isWithLeadingJet) jetHist.fill(HIST("tracks/perpCone/antiDeuteron/h2TofNsigmaantiDeuteronVsPt"), trk.tofNSigmaDe(), trk.pt()); } if (std::abs(trk.tpcNSigmaTr()) < cfgnTPCPIDTr) { jetHist.fill(HIST("tracks/antiTriton/h2TOFmassantiTritonVsPt"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/antiTriton/h2TOFmass2antiTritonVsPt"), massTOF * massTOF - o2::constants::physics::MassTriton * o2::constants::physics::MassTriton, trk.pt()); + jetHist.fill(HIST("tracks/antiTriton/h2TOFmass2antiTritonVsPt"), massTOF * massTOF - MassTriton * MassTriton, trk.pt()); jetHist.fill(HIST("tracks/antiTriton/h2TofNsigmaantiTritonVsPt"), trk.tofNSigmaTr(), trk.pt()); if (jetFlagPerpCone && isWithLeadingJet) jetHist.fill(HIST("tracks/perpCone/antiTriton/h2TofNsigmaantiTritonVsPt"), trk.tofNSigmaTr(), trk.pt()); } if (std::abs(trk.tpcNSigmaHe()) < cfgnTPCPIDHe) { jetHist.fill(HIST("tracks/antiHelium/h2TOFmassantiHeliumVsPt"), massTOF, trk.pt()); - jetHist.fill(HIST("tracks/antiHelium/h2TOFmass2antiHeliumVsPt"), massTOF * massTOF - o2::constants::physics::MassHelium3 * o2::constants::physics::MassHelium3, trk.pt()); + jetHist.fill(HIST("tracks/antiHelium/h2TOFmass2antiHeliumVsPt"), massTOF * massTOF - MassHelium3 * MassHelium3, trk.pt()); jetHist.fill(HIST("tracks/antiHelium/h2TofNsigmaantiHeliumVsPt"), trk.tofNSigmaHe(), trk.pt()); if (jetFlagPerpCone && isWithLeadingJet) jetHist.fill(HIST("tracks/perpCone/antiHelium/h2TofNsigmaantiHeliumVsPt"), trk.tofNSigmaHe(), trk.pt()); @@ -1402,21 +1401,21 @@ struct nucleiInJets { massTOF = trk.p() * std::sqrt(1.f / (trk.beta() * trk.beta()) - 1.f); if (!useTPCpreSel) { jetHist.fill(HIST("tracksInc/proton/h2TOFmassProtonVsPt"), massTOF, trk.pt(), centrality); - jetHist.fill(HIST("tracksInc/proton/h2TOFmass2ProtonVsPt"), massTOF * massTOF - o2::constants::physics::MassProton * o2::constants::physics::MassProton, trk.pt(), centrality); + jetHist.fill(HIST("tracksInc/proton/h2TOFmass2ProtonVsPt"), massTOF * massTOF - MassProton * MassProton, trk.pt(), centrality); jetHist.fill(HIST("tracksInc/proton/h2TofNsigmaProtonVsPt"), trk.tofNSigmaPr(), trk.pt(), centrality); jetHist.fill(HIST("tracksInc/deuteron/h2TOFmassDeuteronVsPt"), massTOF, trk.pt(), centrality); - jetHist.fill(HIST("tracksInc/deuteron/h2TOFmass2DeuteronVsPt"), massTOF * massTOF - o2::constants::physics::MassDeuteron * o2::constants::physics::MassDeuteron, trk.pt(), centrality); + jetHist.fill(HIST("tracksInc/deuteron/h2TOFmass2DeuteronVsPt"), massTOF * massTOF - MassDeuteron * MassDeuteron, trk.pt(), centrality); jetHist.fill(HIST("tracksInc/deuteron/h2TofNsigmaDeuteronVsPt"), trk.tofNSigmaDe(), trk.pt(), centrality); } else { if (std::abs(trk.tpcNSigmaPr()) < cfgnTPCPIDPr) { jetHist.fill(HIST("tracksInc/proton/h2TOFmassProtonVsPt"), massTOF, trk.pt(), centrality); - jetHist.fill(HIST("tracksInc/proton/h2TOFmass2ProtonVsPt"), massTOF * massTOF - o2::constants::physics::MassProton * o2::constants::physics::MassProton, trk.pt(), centrality); + jetHist.fill(HIST("tracksInc/proton/h2TOFmass2ProtonVsPt"), massTOF * massTOF - MassProton * MassProton, trk.pt(), centrality); jetHist.fill(HIST("tracksInc/proton/h2TofNsigmaProtonVsPt"), trk.tofNSigmaPr(), trk.pt(), centrality); } if (std::abs(trk.tpcNSigmaDe()) < cfgnTPCPIDDe) { jetHist.fill(HIST("tracksInc/deuteron/h2TOFmassDeuteronVsPt"), massTOF, trk.pt(), centrality); - jetHist.fill(HIST("tracksInc/deuteron/h2TOFmass2DeuteronVsPt"), massTOF * massTOF - o2::constants::physics::MassDeuteron * o2::constants::physics::MassDeuteron, trk.pt(), centrality); + jetHist.fill(HIST("tracksInc/deuteron/h2TOFmass2DeuteronVsPt"), massTOF * massTOF - MassDeuteron * MassDeuteron, trk.pt(), centrality); jetHist.fill(HIST("tracksInc/deuteron/h2TofNsigmaDeuteronVsPt"), trk.tofNSigmaDe(), trk.pt(), centrality); } } @@ -1461,25 +1460,25 @@ struct nucleiInJets { massTOF = trk.p() * std::sqrt(1.f / (trk.beta() * trk.beta()) - 1.f); if (!useTPCpreSel) { jetHist.fill(HIST("tracksInc/antiProton/h2TOFmassantiProtonVsPt"), massTOF, trk.pt(), centrality); - jetHist.fill(HIST("tracksInc/antiProton/h2TOFmass2antiProtonVsPt"), massTOF * massTOF - o2::constants::physics::MassProton * o2::constants::physics::MassProton, trk.pt(), centrality); + jetHist.fill(HIST("tracksInc/antiProton/h2TOFmass2antiProtonVsPt"), massTOF * massTOF - MassProton * MassProton, trk.pt(), centrality); jetHist.fill(HIST("tracksInc/antiProton/h2TofNsigmaantiProtonVsPt"), trk.tofNSigmaPr(), trk.pt(), centrality); jetHist.fill(HIST("tracksInc/antiDeuteron/h2TOFmassantiDeuteronVsPt"), massTOF, trk.pt(), centrality); - jetHist.fill(HIST("tracksInc/antiDeuteron/h2TOFmass2antiDeuteronVsPt"), massTOF * massTOF - o2::constants::physics::MassDeuteron * o2::constants::physics::MassDeuteron, trk.pt(), centrality); + jetHist.fill(HIST("tracksInc/antiDeuteron/h2TOFmass2antiDeuteronVsPt"), massTOF * massTOF - MassDeuteron * MassDeuteron, trk.pt(), centrality); jetHist.fill(HIST("tracksInc/antiDeuteron/h2TofNsigmaantiDeuteronVsPt"), trk.tofNSigmaDe(), trk.pt(), centrality); } else { if (std::abs(trk.tpcNSigmaPr()) < cfgnTPCPIDPr) { jetHist.fill(HIST("tracksInc/antiProton/h2TOFmassantiProtonVsPt"), massTOF, trk.pt(), centrality); - jetHist.fill(HIST("tracksInc/antiProton/h2TOFmass2antiProtonVsPt"), massTOF * massTOF - o2::constants::physics::MassProton * o2::constants::physics::MassProton, trk.pt(), centrality); + jetHist.fill(HIST("tracksInc/antiProton/h2TOFmass2antiProtonVsPt"), massTOF * massTOF - MassProton * MassProton, trk.pt(), centrality); jetHist.fill(HIST("tracksInc/antiProton/h2TofNsigmaantiProtonVsPt"), trk.tofNSigmaPr(), trk.pt(), centrality); } if (std::abs(trk.tpcNSigmaDe()) < cfgnTPCPIDDe) { jetHist.fill(HIST("tracksInc/antiDeuteron/h2TOFmassantiDeuteronVsPt"), massTOF, trk.pt(), centrality); - jetHist.fill(HIST("tracksInc/antiDeuteron/h2TOFmass2antiDeuteronVsPt"), massTOF * massTOF - o2::constants::physics::MassDeuteron * o2::constants::physics::MassDeuteron, trk.pt(), centrality); + jetHist.fill(HIST("tracksInc/antiDeuteron/h2TOFmass2antiDeuteronVsPt"), massTOF * massTOF - MassDeuteron * MassDeuteron, trk.pt(), centrality); jetHist.fill(HIST("tracksInc/antiDeuteron/h2TofNsigmaantiDeuteronVsPt"), trk.tofNSigmaDe(), trk.pt(), centrality); } else { jetHist.fill(HIST("tracksInc/antiDeuteron/h2TOFmassantiDeuteronVsPt"), massTOF, trk.pt(), centrality); - jetHist.fill(HIST("tracksInc/antiDeuteron/h2TOFmass2antiDeuteronVsPt"), massTOF * massTOF - o2::constants::physics::MassDeuteron * o2::constants::physics::MassDeuteron, trk.pt(), centrality); + jetHist.fill(HIST("tracksInc/antiDeuteron/h2TOFmass2antiDeuteronVsPt"), massTOF * massTOF - MassDeuteron * MassDeuteron, trk.pt(), centrality); jetHist.fill(HIST("tracksInc/antiDeuteron/h2TofNsigmaantiDeuteronVsPt"), trk.tofNSigmaDe(), trk.pt(), centrality); } } From a15a5948e0e55728aa2a7d174c805ce1ffda49fe Mon Sep 17 00:00:00 2001 From: Archita-Dash <91664849+Archita-Dash@users.noreply.github.com> Date: Mon, 4 Aug 2025 10:53:37 +0200 Subject: [PATCH 216/345] [PWGJE] Trigger+ Multiplicity+ LeadingConstituentCuts+ Modified MCCollision Matching + QA Split vertices + Zorro (#12385) Co-authored-by: ALICE Action Bot --- .../emcalClusterHadronicCorrectionTask.cxx | 2 +- PWGJE/Tasks/CMakeLists.txt | 1 + PWGJE/Tasks/fullJetSpectra.cxx | 1310 ++++++++++++++--- 3 files changed, 1107 insertions(+), 206 deletions(-) diff --git a/PWGJE/TableProducer/emcalClusterHadronicCorrectionTask.cxx b/PWGJE/TableProducer/emcalClusterHadronicCorrectionTask.cxx index 4e4cdedd197..67672c53222 100644 --- a/PWGJE/TableProducer/emcalClusterHadronicCorrectionTask.cxx +++ b/PWGJE/TableProducer/emcalClusterHadronicCorrectionTask.cxx @@ -87,7 +87,7 @@ struct EmcalClusterHadronicCorrectionTask { registry.add("h_Ecluster2", "; Ecluster2 (GeV); entries", {HistType::kTH1F, {{350, 0., 350.}}}); registry.add("h_EclusterAll1", "; EclusterAll1 (GeV); entries", {HistType::kTH1F, {{350, 0., 350.}}}); registry.add("h_EclusterAll2", "; EclusterAll2 (GeV); entries", {HistType::kTH1F, {{350, 0., 350.}}}); - registry.add("h_ClsTime", "Cluster time distribution of uncorrected cluster E; #it{t}_{cls} (ns); entries", {HistType::kTH1F, {{500, -250., 250.}}}); + registry.add("h_ClsTime", "Cluster time distribution of uncorrected cluster E; #it{t}_{cls} (ns); entries", {HistType::kTH1F, {{1500, -600., 900.}}}); registry.add("h_ClsM02", "Cluster M02 distribution of uncorrected cluster E; #it{M}_{02}; entries", {HistType::kTH1F, {{400, 0., 5.}}}); registry.add("h2_ClsEvsNmatches", "Original cluster energy vs Nmatches; Cls E w/o correction (GeV); Nmatches", {HistType::kTH2F, {{350, 0., 350.}, {100, -0.5, 21.}}}); registry.add("h2_ClsEvsEcluster1", "; Cls E w/o correction (GeV); Ecluster1 (GeV)", {HistType::kTH2F, {{350, 0., 350.}, {350, 0., 350.}}}); diff --git a/PWGJE/Tasks/CMakeLists.txt b/PWGJE/Tasks/CMakeLists.txt index 05ab2be9eea..3b0d896108c 100644 --- a/PWGJE/Tasks/CMakeLists.txt +++ b/PWGJE/Tasks/CMakeLists.txt @@ -276,6 +276,7 @@ if(FastJet_FOUND) o2physics_add_dpl_workflow(full-jet-spectra SOURCES fullJetSpectra.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore + O2Physics::AnalysisCCDB O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(bjet-tagging-ml SOURCES bjetTaggingML.cxx diff --git a/PWGJE/Tasks/fullJetSpectra.cxx b/PWGJE/Tasks/fullJetSpectra.cxx index bd2deac8148..99570de96bc 100644 --- a/PWGJE/Tasks/fullJetSpectra.cxx +++ b/PWGJE/Tasks/fullJetSpectra.cxx @@ -22,7 +22,10 @@ #include "PWGJE/DataModel/JetReducedData.h" #include "Common/CCDB/TriggerAliases.h" +#include "EventFiltering/Zorro.h" +#include "EventFiltering/ZorroSummary.h" +#include "CCDB/BasicCCDBManager.h" #include "Framework/ASoA.h" #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" @@ -64,8 +67,10 @@ struct FullJetSpectra { Configurable centralityMax{"centralityMax", 999.0, "maximum centrality"}; Configurable doEMCALEventWorkaround{"doEMCALEventWorkaround", false, "apply the workaround to read the EMC trigger bit by requiring a cell content in the EMCAL"}; Configurable doMBGapTrigger{"doMBGapTrigger", true, "set to true only when using MB-Gap Trigger JJ MC to reject MB events at the collision and track level"}; - // Configurable doMBMC{"doMBMC", false, "set to true only when using MB MC"}; - Configurable checkMcCollisionIsMatched{"checkMcCollisionIsMatched", false, "0: count whole MCcollisions, 1: select MCcollisions which only have their correspond collisions"}; + + // Software Trigger configurables + Configurable doSoftwareTriggerSelection{"doSoftwareTriggerSelection", false, "set to true when using triggered datasets"}; + Configurable triggerMasks{"triggerMasks", "fJetFullHighPt", "possible JE Trigger masks: fJetChLowPt,fJetChHighPt,fEMCALReadout,fJetFullHighPt,fJetFullLowPt"}; // Jet configurables Configurable selectedJetsRadius{"selectedJetsRadius", 0.4, "resolution parameter for histograms without radius"}; @@ -77,7 +82,12 @@ struct FullJetSpectra { Configurable jetPhiMin{"jetPhiMin", 1.80, "minimum jet phi"}; // phi_jet_min for R = 0.4 is 1.80 Configurable jetPhiMax{"jetPhiMax", 2.86, "maximum jet phi"}; // phi_jet_min for R = 0.4 is 2.86 Configurable jetAreaFractionMin{"jetAreaFractionMin", -99.0, "used to make a cut on the jet areas"}; - Configurable leadingConstituentPtMin{"leadingConstituentPtMin", -99.0, "minimum pT selection on jet constituent"}; + + // Leading track and cluster pT configurables + Configurable leadingTrackPtMin{"leadingTrackPtMin", -99.0, "minimum pT selection on jet tracks"}; + Configurable leadingTrackPtMax{"leadingTrackPtMax", 999.0, "maximum pT selection on jet tracks"}; + Configurable leadingClusterPtMin{"leadingClusterPtMin", -99.0, "minimum pT selection on jet clusters"}; + Configurable leadingClusterPtMax{"leadingClusterPtMax", 999.0, "maximum pT selection on jet clusters"}; // Track configurables Configurable trackpTMin{"trackpTMin", 0.15, "minimum track pT"}; @@ -108,14 +118,41 @@ struct FullJetSpectra { int trackSelection = -1; const float kJetAreaFractionMinThreshold = -98.0f; - const float kLeadingConstituentPtMinThreshold = -98.0f; + const float kLeadingTrackPtMinThreshold = -98.0f; + const float kLeadingTrackPtMaxThreshold = 9998.0f; + const float kLeadingClusterPtMinThreshold = -98.0f; + const float kLeadingClusterPtMaxThreshold = 9998.0f; + std::vector eventSelectionBits; std::vector filledJetR; std::vector jetRadiiValues; - + std::vector triggerMaskBits; std::string particleSelection; Service pdgDatabase; + Service ccdb; + + // Instantiate the Zorro processor for skimmed data and define an output object + Zorro zorro; + OutputObj zorroSummary{"zorroSummary"}; + + // Multiplicity Utilities + // struct CentClass { + // const char* name; + // float min; + // float max; + // }; + // // Define multiplicity classes here (example: MB(0-100), HM(0-1), 1-10, 10-20, 20-40, 40-60, 60-100) + // static constexpr int nCentClasses = 4; + // CentClass centClasses[nCentClasses] = { + // {"MB", 0.0, 100.0}, + // {"HM", 0.0, 1.0}, + // {"1_10", 1.0, 10.0}, + // {"10_20", 10.0, 20.0}, + // {"20_40", 20.0, 40.0}, + // {"40_60", 40.0, 60.0}, + // {"60_100", 60.0, 100.0} + // }; // Random splitter instance /* TRandom3 randGen; @@ -174,6 +211,24 @@ struct FullJetSpectra { hDetcollisionCounter->GetXaxis()->SetBinLabel(8, "EMCAcceptedDetColl"); } + if (doprocessJetsTriggeredData) { + auto hDetTrigcollisionCounter = registry.get(HIST("hDetTrigcollisionCounter")); + hDetTrigcollisionCounter->GetXaxis()->SetBinLabel(1, "allDetTrigColl"); + hDetTrigcollisionCounter->GetXaxis()->SetBinLabel(2, "DetTrigCollAfterZorroSelection"); + hDetTrigcollisionCounter->GetXaxis()->SetBinLabel(3, "DetTrigCollWithVertexZ"); + hDetTrigcollisionCounter->GetXaxis()->SetBinLabel(4, "EventsNotSatisfyingEventSelection"); + hDetTrigcollisionCounter->GetXaxis()->SetBinLabel(5, "EMCreadoutDetTrigEventsWithkTVXinEMC"); + hDetTrigcollisionCounter->GetXaxis()->SetBinLabel(6, "OnlyHighPt+NoLowPt+NoMB"); + hDetTrigcollisionCounter->GetXaxis()->SetBinLabel(7, "OnlyLowPt+NoMB"); + hDetTrigcollisionCounter->GetXaxis()->SetBinLabel(8, "OnlyMB"); + hDetTrigcollisionCounter->GetXaxis()->SetBinLabel(9, "FullJetHighPt+FullJetLowPt"); + // hDetTrigcollisionCounter->GetXaxis()->SetBinLabel(9, "EMCAcceptedDetTrigCollWithLow+HighFullJetTriggers"); + hDetTrigcollisionCounter->GetXaxis()->SetBinLabel(10, "FullJetHighPt+MB"); + hDetTrigcollisionCounter->GetXaxis()->SetBinLabel(11, "FullJetLowPt+MB"); + hDetTrigcollisionCounter->GetXaxis()->SetBinLabel(12, "AllRejectedTrigOverlaps"); + hDetTrigcollisionCounter->GetXaxis()->SetBinLabel(13, "EMCAcceptedDetTrigColl"); + } + if (doprocessJetsMCP || doprocessJetsMCPWeighted) { auto hPartcollisionCounter = registry.get(HIST("hPartcollisionCounter")); hPartcollisionCounter->GetXaxis()->SetBinLabel(1, "allMcColl"); @@ -200,15 +255,52 @@ struct FullJetSpectra { hMatchedcollisionCounter->GetXaxis()->SetBinLabel(9, "EMCAcceptedDetColl"); } - if (doprocessMBCollisionsDATAWithMultiplicity || doprocessMBCollisionsWithMultiplicity || doprocessCollisionsWeightedWithMultiplicity) { + if (doprocessMBCollisionsDATAWithMultiplicity || doprocessMBMCDCollisionsWithMultiplicity) { auto hEventmultiplicityCounter = registry.get(HIST("hEventmultiplicityCounter")); hEventmultiplicityCounter->GetXaxis()->SetBinLabel(1, "allDetColl"); hEventmultiplicityCounter->GetXaxis()->SetBinLabel(2, "DetCollWithVertexZ"); + hEventmultiplicityCounter->GetXaxis()->SetBinLabel(3, "EventsNotSatisfyingEventSelection"); + hEventmultiplicityCounter->GetXaxis()->SetBinLabel(4, "EMCreadoutDetEventsWithkTVXinEMC"); + hEventmultiplicityCounter->GetXaxis()->SetBinLabel(5, "AllRejectedEventsAfterEMCEventSelection"); + hEventmultiplicityCounter->GetXaxis()->SetBinLabel(6, "EMCAcceptedDetColl"); + } + + if (doprocessMCDCollisionsWeightedWithMultiplicity) { + auto hEventmultiplicityCounter = registry.get(HIST("hEventmultiplicityCounter")); + hEventmultiplicityCounter->GetXaxis()->SetBinLabel(1, "allWeightedDetColl"); + hEventmultiplicityCounter->GetXaxis()->SetBinLabel(2, "WeightedDetCollWithVertexZ"); hEventmultiplicityCounter->GetXaxis()->SetBinLabel(3, "MBRejectedDetEvents"); - hEventmultiplicityCounter->GetXaxis()->SetBinLabel(4, "EventsNotSatisfyingEventSelection"); - hEventmultiplicityCounter->GetXaxis()->SetBinLabel(5, "EMCreadoutDetEventsWithkTVXinEMC"); - hEventmultiplicityCounter->GetXaxis()->SetBinLabel(6, "AllRejectedEventsAfterEMCEventSelection"); - hEventmultiplicityCounter->GetXaxis()->SetBinLabel(7, "EMCAcceptedDetColl"); + hEventmultiplicityCounter->GetXaxis()->SetBinLabel(4, "WeightedEventsNotSatisfyingEventSelection"); + hEventmultiplicityCounter->GetXaxis()->SetBinLabel(5, "EMCreadoutWeightedDetEventsWithkTVXinEMC"); + hEventmultiplicityCounter->GetXaxis()->SetBinLabel(6, "AllRejectedWeightedEventsAfterEMCEventSelection"); + hEventmultiplicityCounter->GetXaxis()->SetBinLabel(7, "EMCAcceptedWeightedDetColl"); + hEventmultiplicityCounter->GetXaxis()->SetBinLabel(8, "EMCAcceptedWeightedCollAfterTrackSel"); + } + + if (doprocessMBMCPCollisionsWithMultiplicity) { + auto hPartEventmultiplicityCounter = registry.get(HIST("hPartEventmultiplicityCounter")); + hPartEventmultiplicityCounter->GetXaxis()->SetBinLabel(1, "allMcColl"); + hPartEventmultiplicityCounter->GetXaxis()->SetBinLabel(2, "McCollWithVertexZ"); + hPartEventmultiplicityCounter->GetXaxis()->SetBinLabel(3, "RejectedPartCollWithOutliers"); + hPartEventmultiplicityCounter->GetXaxis()->SetBinLabel(4, "MBRejectedPartEvents"); + hPartEventmultiplicityCounter->GetXaxis()->SetBinLabel(5, "RejectedPartCollForDetCollWithSize0or<1"); + hPartEventmultiplicityCounter->GetXaxis()->SetBinLabel(6, "AcceptedPartCollWithSize>=1"); + hPartEventmultiplicityCounter->GetXaxis()->SetBinLabel(7, "EMCreadoutDetEventsWithkTVXinEMC"); + hPartEventmultiplicityCounter->GetXaxis()->SetBinLabel(8, "AllRejectedPartEventsAfterEMCEventSelection"); + hPartEventmultiplicityCounter->GetXaxis()->SetBinLabel(9, "EMCAcceptedPartColl"); + } + + if (doprocessMBMCPCollisionsWeightedWithMultiplicity) { + auto hPartEventmultiplicityCounter = registry.get(HIST("hPartEventmultiplicityCounter")); + hPartEventmultiplicityCounter->GetXaxis()->SetBinLabel(1, "allWeightedMcColl"); + hPartEventmultiplicityCounter->GetXaxis()->SetBinLabel(2, "WeightedMcCollWithVertexZ"); + hPartEventmultiplicityCounter->GetXaxis()->SetBinLabel(3, "RejectedWeightedPartCollWithOutliers"); + hPartEventmultiplicityCounter->GetXaxis()->SetBinLabel(4, "MBRejectedPartEvents"); + hPartEventmultiplicityCounter->GetXaxis()->SetBinLabel(5, "RejectedWeightedPartCollForDetCollWithSize0or<1"); + hPartEventmultiplicityCounter->GetXaxis()->SetBinLabel(6, "AcceptedWeightedPartCollWithSize>=1"); + hPartEventmultiplicityCounter->GetXaxis()->SetBinLabel(7, "EMCreadoutDetEventsWithkTVXinEMC"); + hPartEventmultiplicityCounter->GetXaxis()->SetBinLabel(8, "AllRejectedWeightedPartEventsAfterEMCEventSelection"); + hPartEventmultiplicityCounter->GetXaxis()->SetBinLabel(9, "EMCAcceptedWeightedPartColl"); } } @@ -222,8 +314,10 @@ struct FullJetSpectra { */ void init(o2::framework::InitContext&) { + trackSelection = jetderiveddatautilities::initialiseTrackSelection(static_cast(trackSelections)); eventSelectionBits = jetderiveddatautilities::initialiseEventSelectionBits(static_cast(eventSelections)); + triggerMaskBits = jetderiveddatautilities::initialiseTriggerMaskBits(triggerMasks); particleSelection = static_cast(particleSelections); jetRadiiValues = (std::vector)jetRadii; @@ -320,6 +414,9 @@ struct FullJetSpectra { registry.add("h2_track_etaphi", "jet_track #eta vs jet_track #varphi; #eta_{track};#varphi_{track}", {HistType::kTH2F, {{500, -5., 5.}, {160, -1., 7.}}}); registry.add("h2_jet_etaphi", "jet #eta vs jet #varphi; #eta_{jet};#varphi_{jet}", {HistType::kTH2F, {{100, -1., 1.}, {160, -1., 7.}}}); } + if (doprocessJetsTriggeredData) { + registry.add("hDetTrigcollisionCounter", "event status;;entries", {HistType::kTH1F, {{14, 0.0, 14.}}}); + } if (doprocessJetsMCP || doprocessJetsMCPWeighted) { registry.add("hPartcollisionCounter", "event status;event status;entries", {HistType::kTH1F, {{10, 0.0, 10.0}}}); @@ -389,23 +486,96 @@ struct FullJetSpectra { registry.add("h2_full_matchedmcpjet_pt", "Matched MCP jet in EMC Fiducial Acceptance #it{p}_{T,part};#it{p}_{T,part} (GeV/c); Ncounts", {HistType::kTH2F, {{350, 0., 350.}, {10000, 0., 10000.}}}); // Response Matrix - registry.add("h_full_jet_ResponseMatrix", "Full Jets Response Matrix; p_{T,det} (GeV/c); p_{T,part} (GeV/c)", {HistType::kTH2F, {{350, 0., 350.}, {350, 0., 350.}}}); + registry.add("h_full_jet_ResponseMatrix", "Full Jets Response Matrix; p_{T,det} (GeV/c); p_{T,part} (GeV/c)", {HistType::kTH2F, {{500, 0., 500.}, {500, 0., 500.}}}); } - if (doprocessCollisionsWeightedWithMultiplicity || doprocessMBCollisionsWithMultiplicity || doprocessMBCollisionsDATAWithMultiplicity) { + if (doprocessMBCollisionsDATAWithMultiplicity || doprocessMBMCDCollisionsWithMultiplicity || doprocessMCDCollisionsWeightedWithMultiplicity) { registry.add("hEventmultiplicityCounter", "event status;event status;entries", {HistType::kTH1F, {{10, 0.0, 10.0}}}); registry.add("h_FT0Mults_occupancy", "", {HistType::kTH1F, {{3500, 0., 3500.}}}); - registry.add("h2_full_jet_FT0Amplitude", "; FT0C Amplitude; Counts", {HistType::kTH1F, {{3500, 0., 3500.}}}); - registry.add("h2_full_jet_jetpTDetVsFT0Mults", "; p_{T,det} (GeV/c); FT0C Multiplicity", {HistType::kTH2F, {{350, 0., 350.}, {3500, 0., 3500.}}}); - registry.add("h3_full_jet_jetpTDet_FT0Mults_nef", "; p_{T,det} (GeV/c); FT0C Multiplicity, nef", {HistType::kTH3F, {{350, 0., 350.}, {3500, 0., 3500.}, {105, 0.0, 1.05}}}); + + registry.add("h_all_fulljet_Njets", "Full Jet Multiplicity (per Event)", {HistType::kTH1F, {{20, 0., 20.}}}); + registry.add("h_Leading_full_jet_pt", "#it{p}_{T,leading jet};#it{p}_{T_leading jet} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0., 350.}}}); + registry.add("h2_full_jet_leadingJetPt_vs_counts", ";#it{p}_{T_leading jet} (GeV/#it{c}); Counts", {HistType::kTH2F, {{350, 0., 350.}, {20, 0., 20.}}}); + registry.add("h_SubLeading_full_jet_pt", "#it{p}_{T,leading jet};#it{p}_{T_leading jet} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0., 350.}}}); + registry.add("h2_full_jet_subLeadingJetPt_vs_counts", ";#it{p}_{T_leading jet} (GeV/#it{c}); Counts", {HistType::kTH2F, {{350, 0., 350.}, {20, 0., 20.}}}); + // Inside Jet Loop: + // CASE 1: + registry.add("h_all_fulljet_pt", "#it{p}_{T,fulljet};#it{p}_{T_fulljet} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0., 350.}}}); + registry.add("h_all_fulljet_Nch", ";N_{ch};", {HistType::kTH1F, {{50, 0., 50.}}}); + registry.add("h_all_fulljet_NEF", ";NEF;", {HistType::kTH1F, {{105, 0., 1.05}}}); + registry.add("h2_all_fulljet_jetpTDet_vs_FT0Mults", "; p_{T,det} (GeV/c); FT0M Multiplicity", {HistType::kTH2F, {{350, 0., 350.}, {3500, 0., 3500.}}}); + registry.add("h2_all_fulljet_jetpTDet_vs_Nch", ";#it{p}_{T_fulljet} (GeV/#it{c}); N_{ch}", {HistType::kTH2F, {{350, 0., 350.}, {50, 0., 50.}}}); + registry.add("h3_full_jet_jetpTDet_FT0Mults_nef", "; p_{T,det} (GeV/c); FT0M Multiplicity, nef", {HistType::kTH3F, {{350, 0., 350.}, {50, 0., 50.}, {105, 0.0, 1.05}}}); + // CASE 2: + registry.add("h_leading_fulljet_pt", "#it{p}_{T,Leading fulljet};#it{p}_{T_Leadingfulljet} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0., 350.}}}); + registry.add("h_leading_fulljet_Nch", ";N_{ch};", {HistType::kTH1F, {{50, 0., 50.}}}); + registry.add("h_leading_fulljet_NEF", ";NEF;", {HistType::kTH1F, {{105, 0., 1.05}}}); + registry.add("h2_leading_fulljet_jetpTDet_vs_FT0Mults", ";Leading p_{T,det} (GeV/c); FT0M Multiplicity", {HistType::kTH2F, {{350, 0., 350.}, {3500, 0., 3500.}}}); + registry.add("h2_leading_fulljet_jetpTDet_vs_Nch", ";#it{p}_{T_Leadingfulljet} (GeV/#it{c}); N_{ch}", {HistType::kTH2F, {{350, 0., 350.}, {50, 0., 50.}}}); + registry.add("h3_leading_fulljet_jetpTDet_FT0Mults_nef", "; Leading p_{T,det} (GeV/c); FT0M Multiplicity, nef", {HistType::kTH3F, {{350, 0., 350.}, {50, 0., 50.}, {105, 0.0, 1.05}}}); + // CASE 3: + registry.add("h_subleading_fulljet_pt", "#it{p}_{T,SubLeading fulljet};#it{p}_{T_SubLeadingfulljet} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0., 350.}}}); + registry.add("h_subleading_fulljet_Nch", ";N_{ch};", {HistType::kTH1F, {{50, 0., 50.}}}); + registry.add("h_subleading_fulljet_NEF", ";NEF;", {HistType::kTH1F, {{105, 0., 1.05}}}); + registry.add("h2_subleading_fulljet_jetpTDet_vs_FT0Mults", ";SubLeading p_{T,det} (GeV/c); FT0M Multiplicity", {HistType::kTH2F, {{350, 0., 350.}, {3500, 0., 3500.}}}); + registry.add("h2_subleading_fulljet_jetpTDet_vs_Nch", ";#it{p}_{T_SubLeadingfulljet} (GeV/#it{c}); N_{ch}", {HistType::kTH2F, {{350, 0., 350.}, {50, 0., 50.}}}); + registry.add("h3_subleading_fulljet_jetpTDet_FT0Mults_nef", "; SubLeading p_{T,det} (GeV/c); FT0M Multiplicity, nef", {HistType::kTH3F, {{350, 0., 350.}, {50, 0., 50.}, {105, 0.0, 1.05}}}); + } + + if (doprocessMBMCPCollisionsWithMultiplicity || doprocessMBMCPCollisionsWeightedWithMultiplicity) { + registry.add("hPartEventmultiplicityCounter", "event status;event status;entries", {HistType::kTH1F, {{11, 0.0, 11.0}}}); + registry.add("hRecoMatchesPerMcCollision", "split vertices QA;;entries", {HistType::kTH1F, {{5, 0.0, 5.0}}}); + registry.add("hMCCollMatchedFT0Mult", "", {HistType::kTH1F, {{3500, 0., 3500.}}}); + registry.add("hMCCollMatchedFT0Cent", "", {HistType::kTH1F, {{105, 0., 105.}}}); + + registry.add("h_all_fulljet_Njets_part", "Full Jet Multiplicity (per Event)", {HistType::kTH1F, {{20, 0., 20.}}}); + registry.add("h_Leading_full_jet_pt_part", "#it{p}_{T,leading jet};#it{p}_{T_leading jet} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0., 350.}}}); + registry.add("h2_full_jet_leadingJetPt_vs_counts_part", ";#it{p}_{T_leading jet} (GeV/#it{c}); Counts", {HistType::kTH2F, {{350, 0., 350.}, {20, 0., 20.}}}); + registry.add("h_SubLeading_full_jet_pt_part", "#it{p}_{T,leading jet};#it{p}_{T_leading jet} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0., 350.}}}); + registry.add("h2_full_jet_subLeadingJetPt_vs_counts_part", ";#it{p}_{T_leading jet} (GeV/#it{c}); Counts", {HistType::kTH2F, {{350, 0., 350.}, {20, 0., 20.}}}); + + // Inside Jet Loop: + // CASE 1: + registry.add("h_all_fulljet_pt_part", "#it{p}_{T,fulljet};#it{p}_{T_fulljet} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0., 350.}}}); + registry.add("h_all_fulljet_Nch_part", ";N_{ch};", {HistType::kTH1F, {{50, 0., 50.}}}); + registry.add("h_all_fulljet_Nne_part", ";N_{ne};", {HistType::kTH1F, {{100, 0., 100.}}}); + registry.add("h_all_fulljet_NEF_part", ";NEF;", {HistType::kTH1F, {{105, 0., 1.05}}}); + registry.add("h2_all_fulljet_jetpT_vs_FT0Mults_part", "; p_{T,part} (GeV/c); FT0M Multiplicity", {HistType::kTH2F, {{350, 0., 350.}, {3500, 0., 3500.}}}); + registry.add("h2_all_fulljet_jetpT_vs_Nch_part", ";#it{p}_{T_fulljet} (GeV/#it{c}); N_{ch}", {HistType::kTH2F, {{350, 0., 350.}, {50, 0., 50.}}}); + registry.add("h3_full_jet_jetpT_FT0Mults_nef_part", "; p_{T,part} (GeV/c); FT0M Multiplicity, nef", {HistType::kTH3F, {{350, 0., 350.}, {50, 0., 50.}, {105, 0.0, 1.05}}}); + // CASE 2: + registry.add("h_leading_fulljet_pt_part", "#it{p}_{T,Leading fulljet};#it{p}_{T_Leadingfulljet} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0., 350.}}}); + registry.add("h_leading_fulljet_Nch_part", ";N_{ch};", {HistType::kTH1F, {{50, 0., 50.}}}); + registry.add("h_leading_fulljet_Nne_part", ";N_{ne};", {HistType::kTH1F, {{100, 0., 100.}}}); + registry.add("h_leading_fulljet_NEF_part", ";NEF;", {HistType::kTH1F, {{105, 0., 1.05}}}); + registry.add("h2_leading_fulljet_jetpT_vs_FT0Mults_part", ";Leading p_{T,part} (GeV/c); FT0M Multiplicity", {HistType::kTH2F, {{350, 0., 350.}, {3500, 0., 3500.}}}); + registry.add("h2_leading_fulljet_jetpT_vs_Nch_part", ";#it{p}_{T_Leadingfulljet} (GeV/#it{c}); N_{ch}", {HistType::kTH2F, {{350, 0., 350.}, {50, 0., 50.}}}); + registry.add("h3_leading_fulljet_jetpT_FT0Mults_nef_part", "; Leading p_{T,part} (GeV/c); FT0M Multiplicity, nef", {HistType::kTH3F, {{350, 0., 350.}, {50, 0., 50.}, {105, 0.0, 1.05}}}); + // CASE 3: + registry.add("h_subleading_fulljet_pt_part", "#it{p}_{T,SubLeading fulljet};#it{p}_{T_SubLeadingfulljet} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0., 350.}}}); + registry.add("h_subleading_fulljet_Nch_part", ";N_{ch};", {HistType::kTH1F, {{50, 0., 50.}}}); + registry.add("h_subleading_fulljet_Nne_part", ";N_{ne};", {HistType::kTH1F, {{100, 0., 100.}}}); + registry.add("h_subleading_fulljet_NEF_part", ";NEF;", {HistType::kTH1F, {{105, 0., 1.05}}}); + registry.add("h2_subleading_fulljet_jetpT_vs_FT0Mults_part", ";SubLeading p_{T,part} (GeV/c); FT0M Multiplicity", {HistType::kTH2F, {{350, 0., 350.}, {3500, 0., 3500.}}}); + registry.add("h2_subleading_fulljet_jetpT_vs_Nch_part", ";#it{p}_{T_SubLeadingfulljet} (GeV/#it{c}); N_{ch}", {HistType::kTH2F, {{350, 0., 350.}, {50, 0., 50.}}}); + registry.add("h3_subleading_fulljet_jetpT_FT0Mults_nef_part", "; SubLeading p_{T,part} (GeV/c); FT0M Multiplicity, nef", {HistType::kTH3F, {{350, 0., 350.}, {50, 0., 50.}, {105, 0.0, 1.05}}}); } // Label the histograms labelCollisionHistograms(registry); // labelMCSplitHistogram(registry); - } // init + // Initialize CCDB access and histogram registry for Zorro processing + template + void initCCDB(const BCType& bc) + { + if (doSoftwareTriggerSelection) { + zorro.initCCDB(ccdb.service, bc.runNumber(), bc.timestamp(), triggerMasks.value); + zorro.populateHistRegistry(registry, bc.runNumber()); + } + } + // Get or generate random value for a specific MC collision /* float getMCCollisionRandomValue(int64_t mcCollisionId) { if (!doMcClosure) return 0.0f; @@ -428,7 +598,9 @@ struct FullJetSpectra { return randomVal; } */ - using EMCCollisionsData = o2::soa::Join; // JetCollisions with EMCAL Collision Labels + using EMCCollisionsData = o2::soa::Join; // JetCollisions with EMCAL Collision Labels + using EMCCollisionsTriggeredData = o2::soa::Join; + using EMCCollisionsMCD = o2::soa::Join; // where, JetCollisionsMCD = JetCollisions+JMcCollisionLbs using FullJetTableDataJoined = soa::Join; @@ -446,37 +618,88 @@ struct FullJetSpectra { // Applying some cuts(filters) on collisions, tracks, clusters Filter eventCuts = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centFT0M >= centralityMin && aod::jcollision::centFT0M < centralityMax); - // Filter EMCeventCuts = (nabs(aod::collision::posZ) < vertexZCut && aod::collision::v >= centralityMin && aod::collision::centFT0M < centralityMax); + // Filter EMCeventCuts = (nabs(aod::collision::posZ) < vertexZCut && aod::collision::centrality >= centralityMin && aod::collision::centrality < centralityMax); Filter trackCuts = (aod::jtrack::pt >= trackpTMin && aod::jtrack::pt < trackpTMax && aod::jtrack::eta > trackEtaMin && aod::jtrack::eta < trackEtaMax && aod::jtrack::phi >= trackPhiMin && aod::jtrack::phi <= trackPhiMax); aod::EMCALClusterDefinition clusterDefinition = aod::emcalcluster::getClusterDefinitionFromString(clusterDefinitionS.value); Filter clusterFilter = (aod::jcluster::definition == static_cast(clusterDefinition) && aod::jcluster::eta > clusterEtaMin && aod::jcluster::eta < clusterEtaMax && aod::jcluster::phi >= clusterPhiMin && aod::jcluster::phi <= clusterPhiMax && aod::jcluster::energy >= clusterEnergyMin && aod::jcluster::time > clusterTimeMin && aod::jcluster::time < clusterTimeMax && (clusterRejectExotics && aod::jcluster::isExotic != true)); Preslice JetMCPPerMcCollision = aod::jet::mcCollisionId; PresliceUnsorted> CollisionsPerMCPCollision = aod::jmccollisionlb::mcCollisionId; - template - bool isAcceptedJet(U const& jet) + template + bool isAcceptedRecoJet(U const& jet) { + // if (jetAreaFractionMin > kJetAreaFractionMinThreshold) { + // if (jet.area() < jetAreaFractionMin * o2::constants::math::PI * (jet.r() / 100.0) * (jet.r() / 100.0)) { + // return false; + // } + // } - if (jetAreaFractionMin > kJetAreaFractionMinThreshold) { - if (jet.area() < jetAreaFractionMin * o2::constants::math::PI * (jet.r() / 100.0) * (jet.r() / 100.0)) { + // --- Track cuts: ALL tracks must satisfy 0.15 <= pT <= 200 or 150 GeV/c--- + if (leadingTrackPtMin > kLeadingTrackPtMinThreshold || leadingTrackPtMax < kLeadingTrackPtMaxThreshold) { + bool hasValidTrack = false; + for (const auto& constituent : jet.template tracks_as()) { + const float pt = constituent.pt(); + // Reject if ANY track fails min or max cut + if ((leadingTrackPtMin > kLeadingTrackPtMinThreshold && pt < leadingTrackPtMin) || + (leadingTrackPtMax < kLeadingTrackPtMaxThreshold && pt > leadingTrackPtMax)) { + return false; + } + hasValidTrack = true; // At least one track exists (if needed) + } + // Reject if no tracks exist (edge case) + if (leadingTrackPtMin > kLeadingTrackPtMinThreshold && !hasValidTrack) { return false; } } - if (leadingConstituentPtMin > kLeadingConstituentPtMinThreshold) { - bool isMinleadingConstituent = false; - for (const auto& constituent : jet.template tracks_as()) { - if (constituent.pt() >= leadingConstituentPtMin) { - isMinleadingConstituent = true; - break; + + // --- Cluster cuts: ALL clusters must satisfy min <= pT <= max == 0.3 <= pT <= 250 + if (leadingClusterPtMin > kLeadingClusterPtMinThreshold || leadingClusterPtMax < kLeadingClusterPtMaxThreshold) { + bool hasValidCluster = false; + for (const auto& cluster : jet.template clusters_as()) { + const double pt = cluster.energy() / std::cosh(cluster.eta()); + // Reject if ANY cluster fails min or max cut + if ((leadingClusterPtMin > kLeadingClusterPtMinThreshold && pt < leadingClusterPtMin) || + (leadingClusterPtMax < kLeadingClusterPtMaxThreshold && pt > leadingClusterPtMax)) { + return false; } + hasValidCluster = true; // At least one cluster exists + } + // Reject if no clusters exist (edge case) + if (leadingClusterPtMin > kLeadingClusterPtMinThreshold && !hasValidCluster) { + return false; } + } + return true; + } // isAcceptedRecoJet ends - if (!isMinleadingConstituent) { + template + bool isAcceptedPartJet(U const& jet) + { + // if (jetAreaFractionMin > kJetAreaFractionMinThreshold) { + // if (jet.area() < jetAreaFractionMin * o2::constants::math::PI * (jet.r() / 100.0) * (jet.r() / 100.0)) { + // return false; + // } + // } + // track pt Min cut at the Part level: 0 < pT <= 200 or 150 GeV/c + if (leadingTrackPtMin > kLeadingTrackPtMinThreshold || leadingTrackPtMax < kLeadingTrackPtMaxThreshold) { + bool hasValidParticle = false; + for (const auto& constituent : jet.template tracks_as()) { + const float pt = constituent.pt(); + // Reject if ANY particle fails min or max cut + if ((leadingTrackPtMin > kLeadingTrackPtMinThreshold && pt < leadingTrackPtMin) || + (leadingTrackPtMax < kLeadingTrackPtMaxThreshold && pt > leadingTrackPtMax)) { + return false; + } + hasValidParticle = true; // At least one track exists (if needed) + } + // Reject if no particle exist (edge case) + if (leadingTrackPtMin > kLeadingTrackPtMinThreshold && !hasValidParticle) { return false; } } return true; } + template void fillJetHistograms(T const& jet, float weight = 1.0) { @@ -676,38 +899,34 @@ struct FullJetSpectra { } registry.fill(HIST("hDetcollisionCounter"), 1.5); // DetCollWithVertexZ - if (doMBGapTrigger && collision.subGeneratorId() == jetderiveddatautilities::JCollisionSubGeneratorId::mbGap) { - registry.fill(HIST("hDetcollisionCounter"), 2.5); // MBRejectedDetEvents - return; - } if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits, doMBGapTrigger)) { - registry.fill(HIST("hDetcollisionCounter"), 3.5); // EventsNotSatisfyingEventSelection + registry.fill(HIST("hDetcollisionCounter"), 2.5); // EventsNotSatisfyingEventSelection return; } if (doEMCALEventWorkaround) { if (collision.isEmcalReadout() && !collision.isAmbiguous()) { // i.e. EMCAL has a cell content eventAccepted = true; if (collision.alias_bit(kTVXinEMC)) { - registry.fill(HIST("hDetcollisionCounter"), 4.5); // EMCreadoutDetEventsWithkTVXinEMC + registry.fill(HIST("hDetcollisionCounter"), 3.5); // EMCreadoutDetEventsWithkTVXinEMC } } } else { if (!collision.isAmbiguous() && jetderiveddatautilities::eventEMCAL(collision) && collision.alias_bit(kTVXinEMC)) { - registry.fill(HIST("hDetcollisionCounter"), 4.5); // EMCreadoutDetEventsWithkTVXinEMC + registry.fill(HIST("hDetcollisionCounter"), 3.5); // EMCreadoutDetEventsWithkTVXinEMC eventAccepted = true; } } if (!eventAccepted) { for (auto const& jet : jets) { - if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax) || !isAcceptedJet(jet)) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax) || !isAcceptedRecoJet(jet)) { fillRejectedJetHistograms(jet, 1.0); } } - registry.fill(HIST("hDetcollisionCounter"), 5.5); // AllRejectedDetEventsAfterEMCEventSelection + registry.fill(HIST("hDetcollisionCounter"), 4.5); // AllRejectedDetEventsAfterEMCEventSelection return; } - registry.fill(HIST("hDetcollisionCounter"), 6.5); // EMCAcceptedDetColl + registry.fill(HIST("hDetcollisionCounter"), 5.5); // EMCAcceptedDetColl for (auto const& jet : jets) { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { @@ -716,7 +935,7 @@ struct FullJetSpectra { if (jet.phi() < jetPhiMin || jet.phi() > jetPhiMax) { continue; } - if (!isAcceptedJet(jet)) { + if (!isAcceptedRecoJet(jet)) { continue; } fillJetHistograms(jet); @@ -724,6 +943,126 @@ struct FullJetSpectra { } PROCESS_SWITCH(FullJetSpectra, processJetsData, "Full Jets Data", false); + void processJetsTriggeredData(soa::Filtered::iterator const& collision, FullJetTableDataJoined const& /*jets*/, + aod::JetTracks const&, aod::JetClusters const&, aod::JBCs const&) + { + // bool eventAccepted = false; + + registry.fill(HIST("hDetTrigcollisionCounter"), 0.5); // allDetTrigColl + + // Get BC info associated with the collision before applying any event selections + auto bc = collision.bc_as(); + // Initialize CCDB objects using the BC info + initCCDB(bc); + // If SoftwareTriggerSelection (i.e. skimming) is enabled, skip this event unless it passes Zorro selection + if (doSoftwareTriggerSelection && !zorro.isSelected(bc.globalBC())) { + return; + } + registry.fill(HIST("hDetTrigcollisionCounter"), 1.5); // DetTrigCollAfterZorroSelection + + if (std::fabs(collision.posZ()) > vertexZCut) { + return; + } + registry.fill(HIST("hDetTrigcollisionCounter"), 2.5); // DetTrigCollWithVertexZ + + if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits) || !jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { + registry.fill(HIST("hDetTrigcollisionCounter"), 3.5); // EventsNotSatisfyingEvent+TriggerSelection + return; + } + //- should this kTVX HW trigger be still in place?? + if (!collision.isAmbiguous() && jetderiveddatautilities::eventEMCAL(collision) && collision.alias_bit(kTVXinEMC)) { + // eventAccepted = true; + registry.fill(HIST("hDetTrigcollisionCounter"), 4.5); // EMCreadoutDetTrigEventsWithkTVXinEMC + } + // split event selections based on selected triggers - + // make sure there're no trigger overlaps: when analysing JetFullHighPt-> check no JetFullLowPt and kTVXinEMC are fired + // when analysing JetFullLowPt, check kTVXinEMC isn't fired! + // apply exclusive trigger bit selections for event selection + // use a flag and fill QA for trigger overlap - + // - how often you reject a higher pT trig because lower trigs were fired : 5 cases -> 2D hist as a funtn of jet pT + // - check how often the ChJet Trigs were fired for every fullJetTrig fired.(don't reject these events but only for QA) + + // Get trigger status + bool hasFullJetHighPt = jetderiveddatautilities::selectTrigger(collision, jetderiveddatautilities::JTrigSel::JetFullHighPt); + bool hasFullJetLowPt = jetderiveddatautilities::selectTrigger(collision, jetderiveddatautilities::JTrigSel::JetFullLowPt); + bool hasMB = jetderiveddatautilities::selectTrigger(collision, jetderiveddatautilities::JTrigSel::EMCALReadout); + + //*****Step 1: Check for pure triggers (NO overlaps)***** + + // Case 1: hasFullJetHighPt && !hasFullJetLowPt && !hasMB : Pure FullJetHighPt + // i.e. for every JetFullHighPt trig that was fired, check the low triggers weren't fired + if (hasFullJetHighPt && !hasFullJetLowPt && !hasMB) { + registry.fill(HIST("hDetTrigcollisionCounter"), 5.5); // OnlyHighPt+NoLowPt+NoMB + } + // Case 2: hasFullJetLowPt && !hasMB : Pure FullJetLowPt + // i.e. for every hasFullJetLowPt trig that was fired, check the MB trig wasn't fired + if (hasFullJetLowPt && !hasMB) { + registry.fill(HIST("hDetTrigcollisionCounter"), 6.5); // OnlyLowPt+NoMB + } + // Case 3: hasMB && !hasFullJetLowPt && !hasFullJetHighPt : Pure MB + // i.e. for every MB trig that was fired, check the higher trigs weren't fired + if (hasMB && !hasFullJetLowPt && !hasFullJetHighPt) { + registry.fill(HIST("hDetTrigcollisionCounter"), 7.5); // OnlyMB + } + + //*****Step 2: Check for trigger overlap cases (for QA):***** + + if (hasFullJetHighPt && hasFullJetLowPt) { + registry.fill(HIST("hDetTrigcollisionCounter"), 8.5); // FullJetHighPt+FullJetLowPt + } + if (hasFullJetHighPt && hasMB) { + registry.fill(HIST("hDetTrigcollisionCounter"), 9.5); // FullJetHighPt+MB + } + if (hasFullJetLowPt && hasMB) { + registry.fill(HIST("hDetTrigcollisionCounter"), 10.5); // FullJetLowPt+MB + } + + //*****Step 3: Reject ALL overlapping events by applying EXCLUSIVE Trigger Selections ***** + // Skip further processing if ANY overlaps exist + if ((hasFullJetHighPt && (hasFullJetLowPt || hasMB)) || (hasFullJetLowPt && hasMB)) { + registry.fill(HIST("hDetTrigcollisionCounter"), 11.5); // AllRejectedTrigOverlaps + return; + } + registry.fill(HIST("hDetTrigcollisionCounter"), 12.5); // EMCAcceptedDetTrigColl + // if (!eventAccepted) { + // // for (auto const& jet : jets) { + // // if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax) || !isAcceptedRecoJet(jet)) { + // // fillRejectedJetHistograms(jet, 1.0); + // // } + // // } + // registry.fill(HIST("hDetTrigcollisionCounter"), 4.5); // AllRejectedDetTrigEventsAfterEMCEventSelection + // return; + // } + // registry.fill(HIST("hDetTrigcollisionCounter"), 5.5); // EMCAcceptedDetTrigCollWithkTVXinEMC + // + + // if (jetderiveddatautilities::selectTrigger(collision, jetderiveddatautilities::JTrigSel::JetChLowPt)) { + // registry.fill(HIST("hDetTrigcollisionCounter"), 8.5); // EMCAcceptedDetTrigCollWithLowChargedJetTriggers + // eventAccepted = true; + // } + // if (jetderiveddatautilities::selectTrigger(collision, jetderiveddatautilities::JTrigSel::JetChHighPt)) { + // registry.fill(HIST("hDetTrigcollisionCounter"), 9.5); // EMCAcceptedDetTrigCollWithHighChargedJetTriggers + // eventAccepted = true; + // } + + // if (jetderiveddatautilities::selectTrigger(collision, jetderiveddatautilities::JTrigSel::JetFullLowPt) && jetderiveddatautilities::selectTrigger(collision, jetderiveddatautilities::JTrigSel::JetFullHighPt)) { + // registry.fill(HIST("hDetTrigcollisionCounter"), 8.5); // EMCAcceptedDetTrigCollWithLow+HighFullJetTriggers + // } + // for (auto const& jet : jets) { + // if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + // continue; + // } + // if (jet.phi() < jetPhiMin || jet.phi() > jetPhiMax) { + // continue; + // } + // if (!isAcceptedRecoJet(jet)) { + // continue; + // } + // fillJetHistograms(jet); + // } + } + PROCESS_SWITCH(FullJetSpectra, processJetsTriggeredData, "Full Jets Triggered Data", false); + void processJetsMCD(soa::Filtered::iterator const& collision, JetTableMCDJoined const& jets, aod::JetTracks const&, aod::JetClusters const&) { bool eventAccepted = false; @@ -782,8 +1121,8 @@ struct FullJetSpectra { } if (doEMCALEventWorkaround) { if (collision.isEmcalReadout() && !collision.isAmbiguous()) { // i.e. EMCAL has a cell content - eventAccepted = true; if (collision.alias_bit(kTVXinEMC)) { + eventAccepted = true; registry.fill(HIST("hDetcollisionCounter"), 5.5); // EMCreadoutDetEventsWithkTVXinEMC } } @@ -796,7 +1135,7 @@ struct FullJetSpectra { if (!eventAccepted) { for (auto const& jet : jets) { - if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax) || !isAcceptedJet(jet)) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax) || !isAcceptedRecoJet(jet)) { fillRejectedJetHistograms(jet, 1.0); } } @@ -812,7 +1151,7 @@ struct FullJetSpectra { if (jet.phi() < jetPhiMin || jet.phi() > jetPhiMax) { continue; } - if (!isAcceptedJet(jet)) { + if (!isAcceptedRecoJet(jet)) { continue; } fillJetHistograms(jet); @@ -876,8 +1215,8 @@ struct FullJetSpectra { } if (doEMCALEventWorkaround) { if (collision.isEmcalReadout() && !collision.isAmbiguous()) { // i.e. EMCAL has a cell content - eventAccepted = true; if (collision.alias_bit(kTVXinEMC)) { + eventAccepted = true; registry.fill(HIST("hDetcollisionCounter"), 5.5, collision.mcCollision().weight()); // EMCreadoutDetEventsWithkTVXinEMC } } @@ -890,7 +1229,7 @@ struct FullJetSpectra { if (!eventAccepted) { for (auto const& jet : jets) { - if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax) || !isAcceptedJet(jet)) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax) || !isAcceptedRecoJet(jet)) { fillRejectedJetHistograms(jet, collision.mcCollision().weight()); } } @@ -906,7 +1245,7 @@ struct FullJetSpectra { if (jet.phi() < jetPhiMin || jet.phi() > jetPhiMax) { continue; } - if (!isAcceptedJet(jet)) { + if (!isAcceptedRecoJet(jet)) { continue; } fillJetHistograms(jet, collision.mcCollision().weight()); @@ -952,38 +1291,38 @@ struct FullJetSpectra { return; } registry.fill(HIST("hPartcollisionCounter"), 1.5); // McCollWithVertexZ - if (collisions.size() < 1) { - return; - } - registry.fill(HIST("hPartcollisionCounter"), 2.5); // PartCollWithSize>1 - - if (collisions.size() == 0) { - registry.fill(HIST("hPartcollisionCounter"), 3.5); // RejectedPartCollForDetCollWithSize0 - return; - } // outlier check: for every outlier jet, reject the whole event for (auto const& jet : jets) { if (jet.pt() > pTHatMaxMCP * pTHat || pTHat < pTHatAbsoluteMin) { - registry.fill(HIST("hPartcollisionCounter"), 4.5); // RejectedPartCollWithOutliers + registry.fill(HIST("hPartcollisionCounter"), 2.5); // RejectedPartCollWithOutliers return; } } if (doMBGapTrigger && mccollision.subGeneratorId() == jetderiveddatautilities::JCollisionSubGeneratorId::mbGap) { // Fill rejected MB events; - registry.fill(HIST("hPartcollisionCounter"), 5.5); // MBRejectedPartEvents + registry.fill(HIST("hPartcollisionCounter"), 3.5); // MBRejectedPartEvents + return; + } + + auto collisionspermcpjet = collisions.sliceBy(CollisionsPerMCPCollision, mccollision.globalIndex()); + registry.fill(HIST("hRecoMatchesPerMcCollision"), collisionspermcpjet.size()); // for split vertices QA + + if (collisionspermcpjet.size() == 0 || collisionspermcpjet.size() < 1) { + registry.fill(HIST("hPartcollisionCounter"), 4.5); // RejectedPartCollForDetCollWithSize0or<1 return; } + registry.fill(HIST("hPartcollisionCounter"), 5.5); // AcceptedPartCollWithSize>=1 - for (auto const& collision : collisions) { + for (auto const& collision : collisionspermcpjet) { if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits, doMBGapTrigger)) { - return; + continue; } if (doEMCALEventWorkaround) { if (collision.isEmcalReadout() && !collision.isAmbiguous()) { // i.e. EMCAL has a cell content - eventAccepted = true; if (collision.alias_bit(kTVXinEMC)) { + eventAccepted = true; registry.fill(HIST("hPartcollisionCounter"), 6.5); // EMCreadoutDetEventsWithkTVXinEMC } } @@ -998,24 +1337,16 @@ struct FullJetSpectra { registry.fill(HIST("hPartcollisionCounter"), 7.5); // AllRejectedPartEventsAfterEMCEventSelection return; } - registry.fill(HIST("hPartcollisionCounter"), 8.5); // EMCAcceptedWeightedPartColl + registry.fill(HIST("hPartcollisionCounter"), 8.5); // EMCAcceptedPartColl for (auto const& jet : jets) { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(jet)) { + if (!isAcceptedPartJet(jet)) { continue; } - if (checkMcCollisionIsMatched) { // basically checks if the same collisions are generated at the Part level as those at the Det level - auto collisionspermcpjet = collisions.sliceBy(CollisionsPerMCPCollision, jet.mcCollisionId()); - if (collisionspermcpjet.size() >= 1 && jetderiveddatautilities::selectCollision(collisionspermcpjet.begin(), eventSelectionBits)) { - // Now here for every matched collision, I fill the corresponding jet histograms. - fillMCPHistograms(jet); - } - } else { - fillMCPHistograms(jet); - } + fillMCPHistograms(jet); } } PROCESS_SWITCH(FullJetSpectra, processJetsMCP, "Full Jets at Particle Level", false); @@ -1057,45 +1388,45 @@ struct FullJetSpectra { return; } registry.fill(HIST("hPartcollisionCounter"), 1.5, mccollision.weight()); // McCollWithVertexZ - if (collisions.size() < 1) { - return; - } - registry.fill(HIST("hPartcollisionCounter"), 2.5, mccollision.weight()); // PartCollWithSize>1 - - if (collisions.size() == 0) { - registry.fill(HIST("hPartcollisionCounter"), 3.5, mccollision.weight()); // RejectedPartCollForDetCollWithSize0 - return; - } // outlier check: for every outlier jet, reject the whole event for (auto const& jet : jets) { if (jet.pt() > pTHatMaxMCP * pTHat || pTHat < pTHatAbsoluteMin) { - registry.fill(HIST("hPartcollisionCounter"), 4.5, mccollision.weight()); // RejectedPartCollWithOutliers + registry.fill(HIST("hPartcollisionCounter"), 2.5, mccollision.weight()); // RejectedPartCollWithOutliers return; } } if (doMBGapTrigger && mccollision.subGeneratorId() == jetderiveddatautilities::JCollisionSubGeneratorId::mbGap) { // Fill rejected MB events - registry.fill(HIST("hPartcollisionCounter"), 5.5, mccollision.weight()); // MBRejectedPartEvents + registry.fill(HIST("hPartcollisionCounter"), 3.5, mccollision.weight()); // MBRejectedPartEvents + return; + } + + auto collisionspermcpjet = collisions.sliceBy(CollisionsPerMCPCollision, mccollision.globalIndex()); + registry.fill(HIST("hRecoMatchesPerMcCollision"), collisionspermcpjet.size(), mccollision.weight()); // for split vertices QA + + if (collisionspermcpjet.size() == 0 || collisionspermcpjet.size() < 1) { + registry.fill(HIST("hPartcollisionCounter"), 4.5, mccollision.weight()); // RejectedPartCollForDetCollWithSize0or<1 return; } + registry.fill(HIST("hPartcollisionCounter"), 5.5, mccollision.weight()); // AcceptedPartCollWithSize>=1 - for (auto const& collision : collisions) { + for (auto const& collision : collisionspermcpjet) { if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits, doMBGapTrigger)) { - return; + continue; } if (doEMCALEventWorkaround) { if (collision.isEmcalReadout() && !collision.isAmbiguous()) { // i.e. EMCAL has a cell content - eventAccepted = true; if (collision.alias_bit(kTVXinEMC)) { - registry.fill(HIST("hPartcollisionCounter"), 6.5, mccollision.weight()); // EMCreadoutDetJJEventsWithkTVXinEMC + eventAccepted = true; + registry.fill(HIST("hPartcollisionCounter"), 6.5, mccollision.weight()); // EMCreadoutDetEventsWithkTVXinEMC } } } else { if (!collision.isAmbiguous() && jetderiveddatautilities::eventEMCAL(collision) && collision.alias_bit(kTVXinEMC)) { eventAccepted = true; - registry.fill(HIST("hPartcollisionCounter"), 6.5, mccollision.weight()); // EMCreadoutDetJJEventsWithkTVXinEMC + registry.fill(HIST("hPartcollisionCounter"), 6.5, mccollision.weight()); // EMCreadoutDetEventsWithkTVXinEMC } } } @@ -1110,22 +1441,13 @@ struct FullJetSpectra { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { return; } - if (!isAcceptedJet(jet)) { + if (!isAcceptedPartJet(jet)) { return; } if (doMBGapTrigger && jet.eventWeight() == 1) { return; } - - if (checkMcCollisionIsMatched) { - auto collisionspermcpjet = collisions.sliceBy(CollisionsPerMCPCollision, jet.mcCollisionId()); - - if (collisionspermcpjet.size() >= 1 && jetderiveddatautilities::selectCollision(collisionspermcpjet.begin(), eventSelectionBits)) { - fillMCPHistograms(jet, jet.eventWeight()); - } - } else { - fillMCPHistograms(jet, jet.eventWeight()); - } + fillMCPHistograms(jet, jet.eventWeight()); } } PROCESS_SWITCH(FullJetSpectra, processJetsMCPWeighted, "Full Jets at Particle Level on weighted events", false); @@ -1197,8 +1519,8 @@ struct FullJetSpectra { } if (doEMCALEventWorkaround) { if (collision.isEmcalReadout() && !collision.isAmbiguous()) { // i.e. EMCAL has a cell content - eventAccepted = true; if (collision.alias_bit(kTVXinEMC)) { + eventAccepted = true; registry.fill(HIST("hMatchedcollisionCounter"), 6.5); // EMCreadoutDetEventsWithkTVXinEMC } } @@ -1215,6 +1537,9 @@ struct FullJetSpectra { registry.fill(HIST("hMatchedcollisionCounter"), 8.5); // EMCAcceptedDetColl for (const auto& mcdjet : mcdjets) { + if (!isAcceptedRecoJet(mcdjet)) { + continue; + } if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } @@ -1224,10 +1549,11 @@ struct FullJetSpectra { registry.fill(HIST("h2_full_fakemcdjets"), mcdjet.pt(), fakeMcdJet, 1.0); continue; } - if (!isAcceptedJet(mcdjet)) { - continue; - } + for (const auto& mcpjet : mcdjet.template matchedJetGeo_as()) { + if (!isAcceptedPartJet(mcpjet)) { + return; + } // apply emcal fiducial cuts to the matched particle level jets if (mcpjet.eta() > jetEtaMax || mcpjet.eta() < jetEtaMin || mcpjet.phi() > jetPhiMax || mcpjet.phi() < jetPhiMin) { fakeMcpJet++; @@ -1313,8 +1639,8 @@ struct FullJetSpectra { } if (doEMCALEventWorkaround) { if (collision.isEmcalReadout() && !collision.isAmbiguous()) { // i.e. EMCAL has a cell content - eventAccepted = true; if (collision.alias_bit(kTVXinEMC)) { + eventAccepted = true; registry.fill(HIST("hMatchedcollisionCounter"), 6.5, eventWeight); // EMCreadoutDetJJEventsWithkTVXinEMC } } @@ -1331,6 +1657,9 @@ struct FullJetSpectra { registry.fill(HIST("hMatchedcollisionCounter"), 8.5, eventWeight); // EMCAcceptedDetColl for (const auto& mcdjet : mcdjets) { + if (!isAcceptedRecoJet(mcdjet)) { + continue; + } // Check if MCD jet is within the EMCAL fiducial region; if not then flag it as a fake jet if (mcdjet.phi() < jetPhiMin || mcdjet.phi() > jetPhiMax || mcdjet.eta() < jetEtaMin || mcdjet.eta() > jetEtaMax) { fakeMcdJet++; @@ -1340,11 +1669,11 @@ struct FullJetSpectra { if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(mcdjet)) { - continue; - } for (const auto& mcpjet : mcdjet.template matchedJetGeo_as()) { + if (!isAcceptedPartJet(mcpjet)) { + return; + } // apply emcal fiducial cuts to the matched particle level jets - if the matched mcp jet lies outside of the EMCAL fiducial, flag it as a fake jet if (mcpjet.eta() > jetEtaMax || mcpjet.eta() < jetEtaMin || mcpjet.phi() > jetPhiMax || mcpjet.phi() < jetPhiMin) { fakeMcpJet++; @@ -1414,8 +1743,8 @@ struct FullJetSpectra { if (doEMCALEventWorkaround) { if (collision.isEmcalReadout() && !collision.isAmbiguous()) { // i.e. EMCAL has a cell content - eventAccepted = true; if (collision.alias_bit(kTVXinEMC)) { + eventAccepted = true; registry.fill(HIST("hCollisionsUnweighted"), 4.5); // EMCreadoutDetEventsWithkTVXinEMC } } @@ -1473,8 +1802,8 @@ struct FullJetSpectra { if (doEMCALEventWorkaround) { if (collision.isEmcalReadout() && !collision.isAmbiguous()) { // i.e. EMCAL has a cell content - eventAccepted = true; if (collision.alias_bit(kTVXinEMC)) { + eventAccepted = true; registry.fill(HIST("hCollisionsUnweighted"), 4.5); // EMCreadoutDetEventsWithkTVXinEMC } } @@ -1537,9 +1866,9 @@ struct FullJetSpectra { if (doEMCALEventWorkaround) { if (collision.isEmcalReadout() && !collision.isAmbiguous()) { // i.e. EMCAL has a cell content - eventAccepted = true; fillTrackHistograms(tracks, clusters, eventWeight); if (collision.alias_bit(kTVXinEMC)) { + eventAccepted = true; registry.fill(HIST("hCollisionsWeighted"), 4.5, eventWeight); // EMCreadoutDetJJEventsWithkTVXinEMC } } @@ -1567,89 +1896,168 @@ struct FullJetSpectra { } PROCESS_SWITCH(FullJetSpectra, processTracksWeighted, "Full Jet tracks weighted", false); - void processCollisionsWeightedWithMultiplicity(soa::Filtered::iterator const& collision, JetTableMCDWeightedJoined const& mcdjets, aod::JMcCollisions const&, soa::Filtered const& tracks, soa::Filtered const& clusters) + void processMBCollisionsDATAWithMultiplicity(soa::Filtered::iterator const& collision, FullJetTableDataJoined const& jets, aod::JetTracks const& /*tracks*/, aod::JetClusters const& /*clusters*/) { bool eventAccepted = false; - float eventWeight = collision.mcCollision().weight(); - float neutralEnergy = 0.0; - registry.fill(HIST("hEventmultiplicityCounter"), 0.5, eventWeight); // allDetColl + registry.fill(HIST("hEventmultiplicityCounter"), 0.5); // allDetColl if (std::fabs(collision.posZ()) > vertexZCut) { - registry.fill(HIST("hEventmultiplicityCounter"), 1.5, eventWeight); // DetCollWithVertexZ - return; - } - if (doMBGapTrigger && collision.subGeneratorId() == jetderiveddatautilities::JCollisionSubGeneratorId::mbGap) { - registry.fill(HIST("hEventmultiplicityCounter"), 2.5, eventWeight); // MBRejectedDetEvents return; } + registry.fill(HIST("hEventmultiplicityCounter"), 1.5); // DetCollWithVertexZ + if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits, doMBGapTrigger)) { - registry.fill(HIST("hEventmultiplicityCounter"), 3.5, eventWeight); // EventsNotSatisfyingEventSelection - return; - } - if (doMBGapTrigger && eventWeight == 1) { - registry.fill(HIST("hEventmultiplicityCounter"), 2.5, eventWeight); // MBRejectedDetEvents + registry.fill(HIST("hEventmultiplicityCounter"), 2.5); // EventsNotSatisfyingEventSelection return; } if (doEMCALEventWorkaround) { if (collision.isEmcalReadout() && !collision.isAmbiguous()) { // i.e. EMCAL has a cell content - eventAccepted = true; - fillTrackHistograms(tracks, clusters, eventWeight); if (collision.alias_bit(kTVXinEMC)) { - registry.fill(HIST("hEventmultiplicityCounter"), 4.5, eventWeight); // EMCreadoutDetJJEventsWithkTVXinEMC + eventAccepted = true; + registry.fill(HIST("hEventmultiplicityCounter"), 3.5); // EMCreadoutDetEventsWithkTVXinEMC } } } else { if (!collision.isAmbiguous() && jetderiveddatautilities::eventEMCAL(collision) && collision.alias_bit(kTVXinEMC)) { eventAccepted = true; - registry.fill(HIST("hEventmultiplicityCounter"), 4.5, eventWeight); // EMCreadoutDetJJEventsWithkTVXinEMC + registry.fill(HIST("hEventmultiplicityCounter"), 3.5); // EMCreadoutDetEventsWithkTVXinEMC } } if (!eventAccepted) { - registry.fill(HIST("hEventmultiplicityCounter"), 5.5, eventWeight); // AllRejectedDetEventsAfterEMCEventSelection + registry.fill(HIST("hEventmultiplicityCounter"), 4.5); // AllRejectedDetEventsAfterEMCEventSelection return; } - registry.fill(HIST("hCollisionsWeighted"), 6.5); // EMCAcceptedWeightedDetColl + registry.fill(HIST("hEventmultiplicityCounter"), 5.5); // EMCAcceptedDetColl - for (auto const& track : tracks) { - if (!jetderiveddatautilities::selectTrack(track, trackSelection)) { + registry.fill(HIST("h_FT0Mults_occupancy"), collision.multFT0M()); + + // Jet processing - NEW IMPLEMENTATION + std::vector::iterator> selectedJets; + // static int eventCounter = 0; + int nJetsThisEvent = 0; + // Debug output + // std::cout << "===== Event " << ++eventCounter << " (Collision ID: " << collision.globalIndex() << ") =====" << std::endl; + + // Verify jet-collision association + for (auto const& jet : jets) { + if (jet.collisionId() != collision.globalIndex()) { + std::cout << "WARNING: Jet with pT " << jet.pt() << " belongs to collision " << jet.collisionId() + << " but processing collision " << collision.globalIndex() << std::endl; continue; } - } - registry.fill(HIST("hEventmultiplicityCounter"), 7.5, eventWeight); // EMCAcceptedWeightedCollAfterTrackSel - registry.fill(HIST("h_FT0Mults_occupancy"), collision.multFT0M(), eventWeight); - for (auto const& mcdjet : mcdjets) { - float pTHat = 10. / (std::pow(eventWeight, 1.0 / pTHatExponent)); - if (mcdjet.pt() > pTHatMaxMCD * pTHat || pTHat < pTHatAbsoluteMin) { // MCD jets outlier rejection - return; - } - if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) continue; - } - if (mcdjet.phi() < jetPhiMin || mcdjet.phi() > jetPhiMax) { + if (jet.phi() < jetPhiMin || jet.phi() > jetPhiMax) continue; - } - if (!isAcceptedJet(mcdjet)) { + if (!isAcceptedRecoJet(jet)) continue; + + selectedJets.push_back(jet); + nJetsThisEvent++; + // std::cout << "Selected jet pT: " << jet.pt() << " (collision ID: " << jet.collisionId() << ")" << std::endl; + } + // 1. Sort selected jets by pT before processing + std::sort(selectedJets.begin(), selectedJets.end(), + [](auto const& a, auto const& b) { return (*a).pt() > (*b).pt(); }); + + // std::cout << "Number of selected jets: " << selectedJets.size() << std::endl; + + // // 2. Reset counters for each event + // int numberOfChargedParticles = 0; + // int totalNumberOfChargedParticles = 0; + // int leadingJetCount = 0; + // + // std::cout << "Number of selected jets per event: " << selectedJets.size() << std::endl; + // for (const auto& jetIter : selectedJets) { + // std::cout << "Jet pT of selectedJets: " << (*jetIter).pt() << std::endl; + // } + // //Checking Event Counter + // static int eventCounter = 0; + // std::cout << "===== Event " << ++eventCounter << " =====" << std::endl; + // std::cout << "******************************************** " << std::endl; + if (selectedJets.size() == 0) { // no jets = no leading jet + return; + } + + if (selectedJets.size() > 0) { + // Jet multiplicity per event + registry.fill(HIST("h_all_fulljet_Njets"), selectedJets.size(), 1.0); + + // Select Leading Jet for N_ch calculation (for every leading jet that is found). There's always one leading jet per event! + auto const& leadingJet = *selectedJets[0]; + auto const& leadingJetPt = leadingJet.pt(); // jet pT distribution of the leading jet + // std::cout << "Leading Jet pT: " << leadingJetPt << std::endl; + registry.fill(HIST("h_Leading_full_jet_pt"), leadingJetPt, 1.0); + registry.fill(HIST("h2_full_jet_leadingJetPt_vs_counts"), leadingJetPt, nJetsThisEvent, 1.0); + } + + if (selectedJets.size() > 1) { + auto const& subLeadingJet = *selectedJets[1]; + auto const& subLeadingJetPt = subLeadingJet.pt(); // jet pT distribution of the subleading jet i.e. 2nd leading jet + registry.fill(HIST("h_SubLeading_full_jet_pt"), subLeadingJetPt, 1.0); + registry.fill(HIST("h2_full_jet_subLeadingJetPt_vs_counts"), subLeadingJetPt, nJetsThisEvent, 1.0); + } + // Process ALL selected jets (not just leading) + for (size_t i = 0; i < selectedJets.size(); i++) { + auto const& jet = *selectedJets[i]; + float jetPt = jet.pt(); + bool isLeading = (i == 0); + bool isSubLeading = (i == 1 && selectedJets.size() > 1); // first sub-leading jet + + // Count charged particles(NCh) for this jet + int numberOfChargedParticles = 0; + for (const auto& jettrack : jet.tracks_as()) { + if (jetderiveddatautilities::selectTrack(jettrack, trackSelection)) { + numberOfChargedParticles++; + } else + continue; } - registry.fill(HIST("h2_full_jet_jetpTDetVsFT0Mults"), mcdjet.pt(), collision.multFT0M(), eventWeight); - for (auto const& cluster : clusters) { - neutralEnergy += cluster.energy(); + // Calculate neutral energy fraction for this jet + float neutralEnergy = 0.0; + for (const auto& jetcluster : jet.clusters_as()) { + neutralEnergy += jetcluster.energy(); + } + float nef = neutralEnergy / jet.energy(); + + // CASE 1: Fill histograms for ALL selected jets + registry.fill(HIST("h_all_fulljet_pt"), jetPt, 1.0); + registry.fill(HIST("h_all_fulljet_Nch"), numberOfChargedParticles, 1.0); + registry.fill(HIST("h_all_fulljet_NEF"), nef, 1.0); + registry.fill(HIST("h2_all_fulljet_jetpTDet_vs_FT0Mults"), jetPt, collision.multFT0M(), 1.0); + registry.fill(HIST("h2_all_fulljet_jetpTDet_vs_Nch"), jetPt, numberOfChargedParticles, 1.0); + registry.fill(HIST("h3_full_jet_jetpTDet_FT0Mults_nef"), jetPt, collision.multFT0M(), nef, 1.0); + + // CASE 2: Additional leading jet processing + if (isLeading) { + registry.fill(HIST("h_leading_fulljet_pt"), jetPt, 1.0); + registry.fill(HIST("h_leading_fulljet_Nch"), numberOfChargedParticles, 1.0); + registry.fill(HIST("h_leading_fulljet_NEF"), nef, 1.0); + registry.fill(HIST("h2_leading_fulljet_jetpTDet_vs_FT0Mults"), jetPt, collision.multFT0M(), 1.0); + registry.fill(HIST("h2_leading_fulljet_jetpTDet_vs_Nch"), jetPt, numberOfChargedParticles, 1.0); + registry.fill(HIST("h3_leading_fulljet_jetpTDet_FT0Mults_nef"), jetPt, collision.multFT0M(), nef, 1.0); + } + + // CASE 3: Additional first sub-leading jet processing + if (isSubLeading) { + registry.fill(HIST("h_subleading_fulljet_pt"), jetPt, 1.0); + registry.fill(HIST("h_subleading_fulljet_Nch"), numberOfChargedParticles, 1.0); + registry.fill(HIST("h_subleading_fulljet_NEF"), nef, 1.0); + registry.fill(HIST("h2_subleading_fulljet_jetpTDet_vs_FT0Mults"), jetPt, collision.multFT0M(), 1.0); + registry.fill(HIST("h2_subleading_fulljet_jetpTDet_vs_Nch"), jetPt, numberOfChargedParticles, 1.0); + registry.fill(HIST("h3_subleading_fulljet_jetpTDet_FT0Mults_nef"), jetPt, collision.multFT0M(), nef, 1.0); } - auto nef = neutralEnergy / mcdjet.energy(); - registry.fill(HIST("h3_full_jet_jetpTDet_FT0Mults_nef"), mcdjet.pt(), collision.multFT0M(), nef, eventWeight); } } - PROCESS_SWITCH(FullJetSpectra, processCollisionsWeightedWithMultiplicity, "Weighted Collisions for Full Jets Multiplicity Studies", false); + PROCESS_SWITCH(FullJetSpectra, processMBCollisionsDATAWithMultiplicity, "MB DATA Collisions for Full Jets Multiplicity Studies", false); - void processMBCollisionsWithMultiplicity(soa::Filtered::iterator const& collision, JetTableMCDJoined const& mcdjets, aod::JMcCollisions const&, soa::Filtered const& tracks, soa::Filtered const& clusters) + void processMBMCDCollisionsWithMultiplicity(soa::Filtered::iterator const& collision, JetTableMCDJoined const& mcdjets, aod::JMcCollisions const&, aod::JetTracks const& /*tracks*/, aod::JetClusters const& /*clusters*/) { bool eventAccepted = false; - float pTHat = 10. / (std::pow(1.0, 1.0 / pTHatExponent)); - float neutralEnergy = 0.0; + // float pTHat = 10. / (std::pow(1.0, 1.0 / pTHatExponent)); registry.fill(HIST("hEventmultiplicityCounter"), 0.5); // allDetColl if (std::fabs(collision.posZ()) > vertexZCut) { @@ -1657,136 +2065,628 @@ struct FullJetSpectra { } registry.fill(HIST("hEventmultiplicityCounter"), 1.5); // DetCollWithVertexZ - if (doMBGapTrigger && collision.subGeneratorId() == jetderiveddatautilities::JCollisionSubGeneratorId::mbGap) { - registry.fill(HIST("hEventmultiplicityCounter"), 2.5); // MBRejectedDetEvents - return; - } if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits, doMBGapTrigger)) { - registry.fill(HIST("hEventmultiplicityCounter"), 3.5); // EventsNotSatisfyingEventSelection + registry.fill(HIST("hEventmultiplicityCounter"), 2.5); // EventsNotSatisfyingEventSelection return; } if (doEMCALEventWorkaround) { if (collision.isEmcalReadout() && !collision.isAmbiguous()) { // i.e. EMCAL has a cell content eventAccepted = true; - fillTrackHistograms(tracks, clusters, 1.0); + // fillTrackHistograms(tracks, clusters, 1.0); if (collision.alias_bit(kTVXinEMC)) { - registry.fill(HIST("hEventmultiplicityCounter"), 4.5); // EMCreadoutDetEventsWithkTVXinEMC + registry.fill(HIST("hEventmultiplicityCounter"), 3.5); // EMCreadoutDetEventsWithkTVXinEMC } } } else { if (!collision.isAmbiguous() && jetderiveddatautilities::eventEMCAL(collision) && collision.alias_bit(kTVXinEMC)) { eventAccepted = true; - registry.fill(HIST("hEventmultiplicityCounter"), 4.5); // EMCreadoutDetEventsWithkTVXinEMC + registry.fill(HIST("hEventmultiplicityCounter"), 3.5); // EMCreadoutDetEventsWithkTVXinEMC } } if (!eventAccepted) { - registry.fill(HIST("hEventmultiplicityCounter"), 5.5); // AllRejectedDetEventsAfterEMCEventSelection + registry.fill(HIST("hEventmultiplicityCounter"), 4.5); // AllRejectedDetEventsAfterEMCEventSelection return; } - registry.fill(HIST("hEventmultiplicityCounter"), 6.5); // EMCAcceptedDetColl + registry.fill(HIST("hEventmultiplicityCounter"), 5.5); // EMCAcceptedDetColl - for (auto const& track : tracks) { - if (!jetderiveddatautilities::selectTrack(track, trackSelection)) { - continue; - } - } - registry.fill(HIST("hEventmultiplicityCounter"), 7.5); // EMCAcceptedCollAfterTrackSel registry.fill(HIST("h_FT0Mults_occupancy"), collision.multFT0M()); + std::vector::iterator> selectedJets; + // static int eventCounter = 0; + int nJetsThisEvent = 0; + // Debug output + // std::cout << "===== Event " << ++eventCounter << " (Collision ID: " << collision.globalIndex() << ") =====" << std::endl; + + // Verify jet-collision association for (auto const& mcdjet : mcdjets) { - if (mcdjet.pt() > pTHatMaxMCD * pTHat || pTHat < pTHatAbsoluteMin) { // MCD (Detector Level) Outlier Rejection - return; - } - if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + if (mcdjet.collisionId() != collision.globalIndex()) { + std::cout << "WARNING: Jet with pT " << mcdjet.pt() << " belongs to collision " << mcdjet.collisionId() + << " but processing collision " << collision.globalIndex() << std::endl; continue; } - if (mcdjet.phi() < jetPhiMin || mcdjet.phi() > jetPhiMax) { + + if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) continue; - } - if (!isAcceptedJet(mcdjet)) { + if (mcdjet.phi() < jetPhiMin || mcdjet.phi() > jetPhiMax) + continue; + if (!isAcceptedRecoJet(mcdjet)) continue; + + selectedJets.push_back(mcdjet); + nJetsThisEvent++; + // std::cout << "Selected jet pT: " << jet.pt() << " (collision ID: " << jet.collisionId() << ")" << std::endl; + } + // 1. Sort selected jets by pT before processing + std::sort(selectedJets.begin(), selectedJets.end(), + [](auto const& a, auto const& b) { return (*a).pt() > (*b).pt(); }); + + if (selectedJets.size() == 0) { // no jets = no leading jet + return; + } + + if (selectedJets.size() > 0) { + // Jet multiplicity per event + registry.fill(HIST("h_all_fulljet_Njets"), selectedJets.size(), 1.0); + + // Select Leading Jet for N_ch calculation (for every leading jet that is found). There's always one leading jet per event! + auto const& leadingJet = *selectedJets[0]; + auto const& leadingJetPt = leadingJet.pt(); // jet pT distribution of the leading jet + // std::cout << "Leading Jet pT: " << leadingJetPt << std::endl; + registry.fill(HIST("h_Leading_full_jet_pt"), leadingJetPt, 1.0); + registry.fill(HIST("h2_full_jet_leadingJetPt_vs_counts"), leadingJetPt, nJetsThisEvent, 1.0); + } + + if (selectedJets.size() > 1) { + auto const& subLeadingJet = *selectedJets[1]; + auto const& subLeadingJetPt = subLeadingJet.pt(); // jet pT distribution of the subleading jet i.e. 2nd leading jet + registry.fill(HIST("h_SubLeading_full_jet_pt"), subLeadingJetPt, 1.0); + registry.fill(HIST("h2_full_jet_subLeadingJetPt_vs_counts"), subLeadingJetPt, nJetsThisEvent, 1.0); + } + // Process ALL selected jets (not just leading) + for (size_t i = 0; i < selectedJets.size(); i++) { + auto const& jet = *selectedJets[i]; + float jetPt = jet.pt(); + bool isLeading = (i == 0); + bool isSubLeading = (i == 1 && selectedJets.size() > 1); // first sub-leading jet + + // Count charged particles(NCh) for this jet + int numberOfChargedParticles = 0; + for (const auto& jettrack : jet.tracks_as()) { + if (jetderiveddatautilities::selectTrack(jettrack, trackSelection)) { + numberOfChargedParticles++; + } else + continue; } - registry.fill(HIST("h2_full_jet_jetpTDetVsFT0Mults"), mcdjet.pt(), collision.multFT0M(), 1.0); - for (auto const& cluster : clusters) { - neutralEnergy += cluster.energy(); + // Calculate neutral energy fraction for this jet + float neutralEnergy = 0.0; + for (const auto& jetcluster : jet.clusters_as()) { + neutralEnergy += jetcluster.energy(); + } + float nef = neutralEnergy / jet.energy(); + + // CASE 1: Fill histograms for ALL selected jets + registry.fill(HIST("h_all_fulljet_pt"), jetPt, 1.0); + registry.fill(HIST("h_all_fulljet_Nch"), numberOfChargedParticles, 1.0); + registry.fill(HIST("h_all_fulljet_NEF"), nef, 1.0); + registry.fill(HIST("h2_all_fulljet_jetpTDet_vs_FT0Mults"), jetPt, collision.multFT0M(), 1.0); + registry.fill(HIST("h2_all_fulljet_jetpTDet_vs_Nch"), jetPt, numberOfChargedParticles, 1.0); + registry.fill(HIST("h3_full_jet_jetpTDet_FT0Mults_nef"), jetPt, collision.multFT0M(), nef, 1.0); + + // CASE 2: Additional leading jet processing + if (isLeading) { + registry.fill(HIST("h_leading_fulljet_pt"), jetPt, 1.0); + registry.fill(HIST("h_leading_fulljet_Nch"), numberOfChargedParticles, 1.0); + registry.fill(HIST("h_leading_fulljet_NEF"), nef, 1.0); + registry.fill(HIST("h2_leading_fulljet_jetpTDet_vs_FT0Mults"), jetPt, collision.multFT0M(), 1.0); + registry.fill(HIST("h2_leading_fulljet_jetpTDet_vs_Nch"), jetPt, numberOfChargedParticles, 1.0); + registry.fill(HIST("h3_leading_fulljet_jetpTDet_FT0Mults_nef"), jetPt, collision.multFT0M(), nef, 1.0); + } + + // CASE 3: Additional first sub-leading jet processing + if (isSubLeading) { + registry.fill(HIST("h_subleading_fulljet_pt"), jetPt, 1.0); + registry.fill(HIST("h_subleading_fulljet_Nch"), numberOfChargedParticles, 1.0); + registry.fill(HIST("h_subleading_fulljet_NEF"), nef, 1.0); + registry.fill(HIST("h2_subleading_fulljet_jetpTDet_vs_FT0Mults"), jetPt, collision.multFT0M(), 1.0); + registry.fill(HIST("h2_subleading_fulljet_jetpTDet_vs_Nch"), jetPt, numberOfChargedParticles, 1.0); + registry.fill(HIST("h3_subleading_fulljet_jetpTDet_FT0Mults_nef"), jetPt, collision.multFT0M(), nef, 1.0); } - auto nef = neutralEnergy / mcdjet.energy(); - registry.fill(HIST("h3_full_jet_jetpTDet_FT0Mults_nef"), mcdjet.pt(), collision.multFT0M(), nef, 1.0); } } - PROCESS_SWITCH(FullJetSpectra, processMBCollisionsWithMultiplicity, "MB MCD Collisions for Full Jets Multiplicity Studies", false); + PROCESS_SWITCH(FullJetSpectra, processMBMCDCollisionsWithMultiplicity, "MB MCD Collisions for Full Jets Multiplicity Studies", false); - void processMBCollisionsDATAWithMultiplicity(soa::Filtered::iterator const& collision, FullJetTableDataJoined const& jets, soa::Filtered const& tracks, soa::Filtered const& clusters) + void processMCDCollisionsWeightedWithMultiplicity(soa::Filtered::iterator const& collision, JetTableMCDWeightedJoined const& mcdjets, aod::JMcCollisions const&, aod::JetTracks const& tracks, aod::JetClusters const& clusters) { bool eventAccepted = false; - float neutralEnergy = 0.0; + float eventWeight = collision.mcCollision().weight(); - registry.fill(HIST("hEventmultiplicityCounter"), 0.5); // allDetColl + registry.fill(HIST("hEventmultiplicityCounter"), 0.5, eventWeight); // allWeightedDetColl if (std::fabs(collision.posZ()) > vertexZCut) { return; } - registry.fill(HIST("hEventmultiplicityCounter"), 1.5); // DetCollWithVertexZ + registry.fill(HIST("hEventmultiplicityCounter"), 1.5, eventWeight); // WeightedDetCollWithVertexZ + if (doMBGapTrigger && collision.subGeneratorId() == jetderiveddatautilities::JCollisionSubGeneratorId::mbGap) { - registry.fill(HIST("hEventmultiplicityCounter"), 2.5); // MBRejectedDetEvents + registry.fill(HIST("hEventmultiplicityCounter"), 2.5, eventWeight); // MBRejectedDetEvents return; } if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits, doMBGapTrigger)) { - registry.fill(HIST("hEventmultiplicityCounter"), 3.5); // EventsNotSatisfyingEventSelection + registry.fill(HIST("hEventmultiplicityCounter"), 3.5, eventWeight); // WeightedEventsNotSatisfyingEventSelection + return; + } + if (doMBGapTrigger && eventWeight == 1) { + registry.fill(HIST("hEventmultiplicityCounter"), 2.5, eventWeight); // MBRejectedDetEvents return; } if (doEMCALEventWorkaround) { if (collision.isEmcalReadout() && !collision.isAmbiguous()) { // i.e. EMCAL has a cell content eventAccepted = true; - fillTrackHistograms(tracks, clusters, 1.0); + fillTrackHistograms(tracks, clusters, eventWeight); if (collision.alias_bit(kTVXinEMC)) { - registry.fill(HIST("hEventmultiplicityCounter"), 4.5); // EMCreadoutDetEventsWithkTVXinEMC + registry.fill(HIST("hEventmultiplicityCounter"), 4.5, eventWeight); // EMCreadoutWeightedDetJJEventsWithkTVXinEMC } } } else { if (!collision.isAmbiguous() && jetderiveddatautilities::eventEMCAL(collision) && collision.alias_bit(kTVXinEMC)) { eventAccepted = true; - registry.fill(HIST("hEventmultiplicityCounter"), 4.5); // EMCreadoutDetEventsWithkTVXinEMC + registry.fill(HIST("hEventmultiplicityCounter"), 4.5, eventWeight); // EMCreadoutWeightedDetJJEventsWithkTVXinEMC } } if (!eventAccepted) { - registry.fill(HIST("hEventmultiplicityCounter"), 5.5); // AllRejectedDetEventsAfterEMCEventSelection + registry.fill(HIST("hEventmultiplicityCounter"), 5.5, eventWeight); // AllRejectedWeightedDetEventsAfterEMCEventSelection return; } - registry.fill(HIST("hEventmultiplicityCounter"), 6.5); // EMCAcceptedDetColl - + registry.fill(HIST("hEventmultiplicityCounter"), 6.5, eventWeight); // EMCAcceptedWeightedDetColl for (auto const& track : tracks) { if (!jetderiveddatautilities::selectTrack(track, trackSelection)) { continue; } } - registry.fill(HIST("hEventmultiplicityCounter"), 7.5); // EMCAcceptedCollAfterTrackSel - registry.fill(HIST("h_FT0Mults_occupancy"), collision.multFT0M()); + registry.fill(HIST("hEventmultiplicityCounter"), 7.5, eventWeight); // EMCAcceptedWeightedCollAfterTrackSel + + registry.fill(HIST("h_FT0Mults_occupancy"), collision.multFT0M(), eventWeight); + + std::vector::iterator> selectedJets; + int nJetsThisEvent = 0; + + for (auto const& mcdjet : mcdjets) { + float pTHat = 10. / (std::pow(eventWeight, 1.0 / pTHatExponent)); + + if (mcdjet.collisionId() != collision.globalIndex()) { + std::cout << "WARNING: Jet with pT " << mcdjet.pt() << " belongs to collision " << mcdjet.collisionId() + << " but processing collision " << collision.globalIndex() << std::endl; + continue; + } + if (mcdjet.pt() > pTHatMaxMCD * pTHat || pTHat < pTHatAbsoluteMin) { // MCD jets outlier rejection + return; + } + if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } + if (mcdjet.phi() < jetPhiMin || mcdjet.phi() > jetPhiMax) { + continue; + } + if (!isAcceptedRecoJet(mcdjet)) { + continue; + } + selectedJets.push_back(mcdjet); + nJetsThisEvent++; + } + // 1. Sort selected jets by pT before processing + std::sort(selectedJets.begin(), selectedJets.end(), + [](auto const& a, auto const& b) { return (*a).pt() > (*b).pt(); }); + + if (selectedJets.size() == 0) { // no jets = no leading jet + return; + } + if (selectedJets.size() > 0) { + // Jet multiplicity per event + registry.fill(HIST("h_all_fulljet_Njets"), selectedJets.size(), eventWeight); + + // Select Leading Jet for N_ch calculation (for every leading jet that is found). There's always one leading jet per event! + auto const& leadingJet = *selectedJets[0]; + auto const& leadingJetPt = leadingJet.pt(); // jet pT distribution of the leading jet + // std::cout << "Leading Jet pT: " << leadingJetPt << std::endl; + registry.fill(HIST("h_Leading_full_jet_pt"), leadingJetPt, eventWeight); + registry.fill(HIST("h2_full_jet_leadingJetPt_vs_counts"), leadingJetPt, nJetsThisEvent, eventWeight); + } + + if (selectedJets.size() > 1) { + auto const& subLeadingJet = *selectedJets[1]; + auto const& subLeadingJetPt = subLeadingJet.pt(); // jet pT distribution of the subleading jet i.e. 2nd leading jet + registry.fill(HIST("h_SubLeading_full_jet_pt"), subLeadingJetPt, eventWeight); + registry.fill(HIST("h2_full_jet_subLeadingJetPt_vs_counts"), subLeadingJetPt, nJetsThisEvent, eventWeight); + } + // Process ALL selected jets (not just leading) + for (size_t i = 0; i < selectedJets.size(); i++) { + auto const& jet = *selectedJets[i]; + float jetPt = jet.pt(); + bool isLeading = (i == 0); + bool isSubLeading = (i == 1 && selectedJets.size() > 1); // first sub-leading jet + + // Count charged particles(NCh) for this jet + int numberOfChargedParticles = 0; + for (const auto& jettrack : jet.tracks_as()) { + if (jetderiveddatautilities::selectTrack(jettrack, trackSelection)) { + numberOfChargedParticles++; + } else + continue; + } + + // Calculate neutral energy fraction for this jet + float neutralEnergy = 0.0; + for (const auto& jetcluster : jet.clusters_as()) { + neutralEnergy += jetcluster.energy(); + } + float nef = neutralEnergy / jet.energy(); + + // CASE 1: Fill histograms for ALL selected jets + registry.fill(HIST("h_all_fulljet_pt"), jetPt, eventWeight); + registry.fill(HIST("h_all_fulljet_Nch"), numberOfChargedParticles, eventWeight); + registry.fill(HIST("h_all_fulljet_NEF"), nef, eventWeight); + registry.fill(HIST("h2_all_fulljet_jetpTDet_vs_FT0Mults"), jetPt, collision.multFT0M(), eventWeight); + registry.fill(HIST("h2_all_fulljet_jetpTDet_vs_Nch"), jetPt, numberOfChargedParticles, eventWeight); + registry.fill(HIST("h3_full_jet_jetpTDet_FT0Mults_nef"), jetPt, collision.multFT0M(), nef, eventWeight); + + // CASE 2: Additional leading jet processing + if (isLeading) { + registry.fill(HIST("h_leading_fulljet_pt"), jetPt, eventWeight); + registry.fill(HIST("h_leading_fulljet_Nch"), numberOfChargedParticles, eventWeight); + registry.fill(HIST("h_leading_fulljet_NEF"), nef, eventWeight); + registry.fill(HIST("h2_leading_fulljet_jetpTDet_vs_FT0Mults"), jetPt, collision.multFT0M(), eventWeight); + registry.fill(HIST("h2_leading_fulljet_jetpTDet_vs_Nch"), jetPt, numberOfChargedParticles, eventWeight); + registry.fill(HIST("h3_leading_fulljet_jetpTDet_FT0Mults_nef"), jetPt, collision.multFT0M(), nef, eventWeight); + } + + // CASE 3: Additional first sub-leading jet processing + if (isSubLeading) { + registry.fill(HIST("h_subleading_fulljet_pt"), jetPt, eventWeight); + registry.fill(HIST("h_subleading_fulljet_Nch"), numberOfChargedParticles, eventWeight); + registry.fill(HIST("h_subleading_fulljet_NEF"), nef, eventWeight); + registry.fill(HIST("h2_subleading_fulljet_jetpTDet_vs_FT0Mults"), jetPt, collision.multFT0M(), eventWeight); + registry.fill(HIST("h2_subleading_fulljet_jetpTDet_vs_Nch"), jetPt, numberOfChargedParticles, eventWeight); + registry.fill(HIST("h3_subleading_fulljet_jetpTDet_FT0Mults_nef"), jetPt, collision.multFT0M(), nef, eventWeight); + } + } + } + PROCESS_SWITCH(FullJetSpectra, processMCDCollisionsWeightedWithMultiplicity, "Weighted MCD Collisions for Full Jets Multiplicity Studies", false); + + void processMBMCPCollisionsWithMultiplicity(aod::JetMcCollision const& mccollision, + JetTableMCPJoined const& jets, aod::JetParticles const& /*particles*/, + soa::SmallGroups const& collisions) + { + bool eventAccepted = false; + double weight = 1.0; + float pTHat = 10. / (std::pow(weight, 1.0 / pTHatExponent)); + float mcpMult = 0.0f; + float mcpCent = 0.0f; + + registry.fill(HIST("hPartEventmultiplicityCounter"), 0.5); // allMcColl + if (std::fabs(mccollision.posZ()) > vertexZCut) { + return; + } + registry.fill(HIST("hPartEventmultiplicityCounter"), 1.5); // McCollWithVertexZ + + // outlier check: for every outlier jet, reject the whole event for (auto const& jet : jets) { - if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + if (jet.pt() > pTHatMaxMCP * pTHat || pTHat < pTHatAbsoluteMin) { + registry.fill(HIST("hPartEventmultiplicityCounter"), 2.5); // RejectedPartCollWithOutliers + return; + } + } + + if (doMBGapTrigger && mccollision.subGeneratorId() == jetderiveddatautilities::JCollisionSubGeneratorId::mbGap) { + // Fill rejected MB events; + registry.fill(HIST("hPartEventmultiplicityCounter"), 3.5); // MBRejectedPartEvents + return; + } + + // Perform MC Collision matching, i.e. match the current MC collision to its associated reco (MCD) collision + // to get the corresponding FT0M component at the particle level + auto collisionspermcpjet = collisions.sliceBy(CollisionsPerMCPCollision, mccollision.globalIndex()); + registry.fill(HIST("hRecoMatchesPerMcCollision"), collisionspermcpjet.size()); // for split vertices QA + + if (collisionspermcpjet.size() == 0 || collisionspermcpjet.size() < 1) { + registry.fill(HIST("hPartEventmultiplicityCounter"), 4.5); // RejectedPartCollForDetCollWithSize0or<1 + return; + } + registry.fill(HIST("hPartEventmultiplicityCounter"), 5.5); // AcceptedPartCollWithSize>1 + + for (auto const& collision : collisionspermcpjet) { + if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits, doMBGapTrigger)) { continue; } - if (jet.phi() < jetPhiMin || jet.phi() > jetPhiMax) { + if (doEMCALEventWorkaround) { + if (collision.isEmcalReadout() && !collision.isAmbiguous()) { // i.e. EMCAL has a cell content + if (collision.alias_bit(kTVXinEMC)) { + eventAccepted = true; + registry.fill(HIST("hPartEventmultiplicityCounter"), 6.5); // EMCreadoutDetEventsWithkTVXinEMC + } + } + } else { + if (!collision.isAmbiguous() && jetderiveddatautilities::eventEMCAL(collision) && collision.alias_bit(kTVXinEMC)) { + eventAccepted = true; + registry.fill(HIST("hPartEventmultiplicityCounter"), 6.5); // EMCreadoutDetEventsWithkTVXinEMC + } + } + mcpMult += collision.multFT0M(); + mcpCent += collision.centFT0M(); + } // collision loop ends + + if (!eventAccepted) { + registry.fill(HIST("hPartEventmultiplicityCounter"), 7.5); // AllRejectedPartEventsAfterEMCEventSelection + return; + } + registry.fill(HIST("hPartEventmultiplicityCounter"), 8.5); // EMCAcceptedPartColl + registry.fill(HIST("hMCCollMatchedFT0Mult"), mcpMult); + registry.fill(HIST("hMCCollMatchedFT0Cent"), mcpCent); + + std::vector::iterator> selectedJets; + int nJetsThisEvent = 0; + + for (auto const& jet : jets) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) + continue; + if (jet.phi() < jetPhiMin || jet.phi() > jetPhiMax) + continue; + if (!isAcceptedPartJet(jet)) continue; + + selectedJets.push_back(jet); + nJetsThisEvent++; + } + // 1. Sort selected jets by pT before processing + std::sort(selectedJets.begin(), selectedJets.end(), + [](auto const& a, auto const& b) { return (*a).pt() > (*b).pt(); }); + + if (selectedJets.size() == 0) { // no jets = no leading jet + return; + } + + if (selectedJets.size() > 0) { + // Jet multiplicity per event + registry.fill(HIST("h_all_fulljet_Njets_part"), selectedJets.size(), 1.0); + + // Select Leading Jet for N_ch calculation (for every leading jet that is found). There's always one leading jet per event! + auto const& leadingJet = *selectedJets[0]; + auto const& leadingJetPt = leadingJet.pt(); // jet pT distribution of the leading jet + // std::cout << "Leading Jet pT: " << leadingJetPt << std::endl; + registry.fill(HIST("h_Leading_full_jet_pt_part"), leadingJetPt, 1.0); + registry.fill(HIST("h2_full_jet_leadingJetPt_vs_counts_part"), leadingJetPt, nJetsThisEvent, 1.0); + } + + if (selectedJets.size() > 1) { + auto const& subLeadingJet = *selectedJets[1]; + auto const& subLeadingJetPt = subLeadingJet.pt(); // jet pT distribution of the subleading jet i.e. 2nd leading jet + registry.fill(HIST("h_SubLeading_full_jet_pt_part"), subLeadingJetPt, 1.0); + registry.fill(HIST("h2_full_jet_subLeadingJetPt_vs_counts_part"), subLeadingJetPt, nJetsThisEvent, 1.0); + } + // Process ALL selected jets (not just leading) + for (size_t i = 0; i < selectedJets.size(); i++) { + auto const& jet = *selectedJets[i]; + float jetPt = jet.pt(); + bool isLeading = (i == 0); + bool isSubLeading = (i == 1 && selectedJets.size() > 1); // first sub-leading jet + + // Count charged particles(NCh) and neutral particles (NNe) for this jet + int numberOfChargedParticles = 0; + int numberOfNeutralParticles = 0; + float neutralEnergy = 0.0f; + for (const auto& constituent : jet.tracks_as()) { + auto pdgParticle = pdgDatabase->GetParticle(constituent.pdgCode()); + if (pdgParticle->Charge() == 0) { + numberOfNeutralParticles++; + neutralEnergy += constituent.e(); + } else { + numberOfChargedParticles++; + } + } + float nef = neutralEnergy / jet.energy(); + + // CASE 1: Fill histograms for ALL selected jets + registry.fill(HIST("h_all_fulljet_pt_part"), jetPt, 1.0); + registry.fill(HIST("h_all_fulljet_Nch_part"), numberOfChargedParticles, 1.0); + registry.fill(HIST("h_all_fulljet_Nne_part"), numberOfNeutralParticles, 1.0); + registry.fill(HIST("h_all_fulljet_NEF_part"), nef, 1.0); + registry.fill(HIST("h2_all_fulljet_jetpT_vs_FT0Mults_part"), jetPt, mcpMult, 1.0); + registry.fill(HIST("h2_all_fulljet_jetpT_vs_Nch_part"), jetPt, numberOfChargedParticles, 1.0); + registry.fill(HIST("h3_full_jet_jetpT_FT0Mults_nef_part"), jetPt, mcpMult, nef, 1.0); + + // CASE 2: Additional leading jet processing + if (isLeading) { + registry.fill(HIST("h_leading_fulljet_pt_part"), jetPt, 1.0); + registry.fill(HIST("h_leading_fulljet_Nch_part"), numberOfChargedParticles, 1.0); + registry.fill(HIST("h_leading_fulljet_Nne_part"), numberOfNeutralParticles, 1.0); + registry.fill(HIST("h_leading_fulljet_NEF_part"), nef, 1.0); + registry.fill(HIST("h2_leading_fulljet_jetpT_vs_FT0Mults_part"), jetPt, mcpMult, 1.0); + registry.fill(HIST("h2_leading_fulljet_jetpT_vs_Nch_part"), jetPt, numberOfChargedParticles, 1.0); + registry.fill(HIST("h3_leading_fulljet_jetpT_FT0Mults_nef_part"), jetPt, mcpMult, nef, 1.0); + } + + // CASE 3: Additional first sub-leading jet processing + if (isSubLeading) { + registry.fill(HIST("h_subleading_fulljet_pt_part"), jetPt, 1.0); + registry.fill(HIST("h_subleading_fulljet_Nch_part"), numberOfChargedParticles, 1.0); + registry.fill(HIST("h_subleading_fulljet_Nne_part"), numberOfNeutralParticles, 1.0); + registry.fill(HIST("h_subleading_fulljet_NEF_part"), nef, 1.0); + registry.fill(HIST("h2_subleading_fulljet_jetpT_vs_FT0Mults_part"), jetPt, mcpMult, 1.0); + registry.fill(HIST("h2_subleading_fulljet_jetpT_vs_Nch_part"), jetPt, numberOfChargedParticles, 1.0); + registry.fill(HIST("h3_subleading_fulljet_jetpT_FT0Mults_nef_part"), jetPt, mcpMult, nef, 1.0); + } + } + } + PROCESS_SWITCH(FullJetSpectra, processMBMCPCollisionsWithMultiplicity, "MB MCP Collisions for Full Jets Multiplicity Studies", false); + + void processMBMCPCollisionsWeightedWithMultiplicity(aod::JetMcCollision const& mccollision, + JetTableMCPWeightedJoined const& jets, aod::JetParticles const& /*particles*/, + soa::SmallGroups const& collisions) + { + bool eventAccepted = false; + float pTHat = 10. / (std::pow(mccollision.weight(), 1.0 / pTHatExponent)); + float mcpMult = 0.0f; + float mcpCent = 0.0f; + + registry.fill(HIST("hPartEventmultiplicityCounter"), 0.5, mccollision.weight()); // allWeightedMcColl + if (std::fabs(mccollision.posZ()) > vertexZCut) { + return; + } + registry.fill(HIST("hPartEventmultiplicityCounter"), 1.5, mccollision.weight()); // WeightedMcCollWithVertexZ + + // outlier check: for every outlier jet, reject the whole event + for (auto const& jet : jets) { + if (jet.pt() > pTHatMaxMCP * pTHat || pTHat < pTHatAbsoluteMin) { + registry.fill(HIST("hPartEventmultiplicityCounter"), 2.5, mccollision.weight()); // RejectedWeightedPartCollWithOutliers + return; } - if (!isAcceptedJet(jet)) { + } + + if (doMBGapTrigger && mccollision.subGeneratorId() == jetderiveddatautilities::JCollisionSubGeneratorId::mbGap) { + // Fill rejected MB events; + registry.fill(HIST("hPartEventmultiplicityCounter"), 3.5, mccollision.weight()); // MBRejectedPartEvents + return; + } + + // Perform MC Collision matching, i.e. match the current MC collision to its associated reco (MCD) collision + // to get the corresponding FT0M component at the particle level + auto collisionspermcpjet = collisions.sliceBy(CollisionsPerMCPCollision, mccollision.globalIndex()); + registry.fill(HIST("hRecoMatchesPerMcCollision"), collisionspermcpjet.size(), mccollision.weight()); // for split vertices QA + + if (collisionspermcpjet.size() == 0 || collisionspermcpjet.size() < 1) { + registry.fill(HIST("hPartEventmultiplicityCounter"), 4.5, mccollision.weight()); // RejectedWeightedPartCollForDetCollWithSize0or<1 + return; + } + registry.fill(HIST("hPartEventmultiplicityCounter"), 5.5, mccollision.weight()); // AcceptedWeightedPartCollWithSize>1 + + for (auto const& collision : collisionspermcpjet) { + if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits, doMBGapTrigger)) { continue; } - registry.fill(HIST("h2_full_jet_jetpTDetVsFT0Mults"), jet.pt(), collision.multFT0M(), 1.0); + if (doEMCALEventWorkaround) { + if (collision.isEmcalReadout() && !collision.isAmbiguous()) { // i.e. EMCAL has a cell content + if (collision.alias_bit(kTVXinEMC)) { + eventAccepted = true; + registry.fill(HIST("hPartEventmultiplicityCounter"), 6.5, mccollision.weight()); // EMCreadoutDetEventsWithkTVXinEMC + } + } + } else { + if (!collision.isAmbiguous() && jetderiveddatautilities::eventEMCAL(collision) && collision.alias_bit(kTVXinEMC)) { + eventAccepted = true; + registry.fill(HIST("hPartEventmultiplicityCounter"), 6.5, mccollision.weight()); // EMCreadoutDetEventsWithkTVXinEMC + } + } + mcpMult += collision.multFT0M(); + mcpCent += collision.centFT0M(); + } // collision loop ends - for (auto const& cluster : clusters) { - neutralEnergy += cluster.energy(); + if (!eventAccepted) { + registry.fill(HIST("hPartEventmultiplicityCounter"), 7.5, mccollision.weight()); // AllRejectedWeightedPartEventsAfterEMCEventSelection + return; + } + registry.fill(HIST("hPartEventmultiplicityCounter"), 8.5, mccollision.weight()); // EMCAcceptedWeightedPartColl + registry.fill(HIST("hMCCollMatchedFT0Mult"), mcpMult, mccollision.weight()); + registry.fill(HIST("hMCCollMatchedFT0Cent"), mcpCent, mccollision.weight()); + + std::vector::iterator> selectedJets; + int nJetsThisEvent = 0; + + for (auto const& jet : jets) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) + continue; + if (jet.phi() < jetPhiMin || jet.phi() > jetPhiMax) + continue; + if (!isAcceptedPartJet(jet)) + continue; + + selectedJets.push_back(jet); + nJetsThisEvent++; + } + // 1. Sort selected jets by pT before processing + std::sort(selectedJets.begin(), selectedJets.end(), + [](auto const& a, auto const& b) { return (*a).pt() > (*b).pt(); }); + + if (selectedJets.size() == 0) { // no jets = no leading jet + return; + } + + if (selectedJets.size() > 0) { + // Jet multiplicity per event + registry.fill(HIST("h_all_fulljet_Njets_part"), selectedJets.size(), mccollision.weight()); + + // Select Leading Jet for N_ch calculation (for every leading jet that is found). There's always one leading jet per event! + auto const& leadingJet = *selectedJets[0]; + auto const& leadingJetPt = leadingJet.pt(); // jet pT distribution of the leading jet + // std::cout << "Leading Jet pT: " << leadingJetPt << std::endl; + registry.fill(HIST("h_Leading_full_jet_pt_part"), leadingJetPt, mccollision.weight()); + registry.fill(HIST("h2_full_jet_leadingJetPt_vs_counts_part"), leadingJetPt, nJetsThisEvent, mccollision.weight()); + } + + if (selectedJets.size() > 1) { + auto const& subLeadingJet = *selectedJets[1]; + auto const& subLeadingJetPt = subLeadingJet.pt(); // jet pT distribution of the subleading jet i.e. 2nd leading jet + registry.fill(HIST("h_SubLeading_full_jet_pt_part"), subLeadingJetPt, mccollision.weight()); + registry.fill(HIST("h2_full_jet_subLeadingJetPt_vs_counts_part"), subLeadingJetPt, nJetsThisEvent, mccollision.weight()); + } + // Process ALL selected jets (not just leading) + for (size_t i = 0; i < selectedJets.size(); i++) { + auto const& jet = *selectedJets[i]; + float jetPt = jet.pt(); + bool isLeading = (i == 0); + bool isSubLeading = (i == 1 && selectedJets.size() > 1); // first sub-leading jet + + // Count charged particles(NCh) and neutral particles (NNe) for this jet + int numberOfChargedParticles = 0; + int numberOfNeutralParticles = 0; + float neutralEnergy = 0.0f; + for (const auto& constituent : jet.tracks_as()) { + auto pdgParticle = pdgDatabase->GetParticle(constituent.pdgCode()); + if (pdgParticle->Charge() == 0) { + numberOfNeutralParticles++; + neutralEnergy += constituent.e(); + } else { + numberOfChargedParticles++; + } + } + float nef = neutralEnergy / jet.energy(); + + // CASE 1: Fill histograms for ALL selected jets + registry.fill(HIST("h_all_fulljet_pt_part"), jetPt, mccollision.weight()); + registry.fill(HIST("h_all_fulljet_Nch_part"), numberOfChargedParticles, mccollision.weight()); + registry.fill(HIST("h_all_fulljet_Nne_part"), numberOfNeutralParticles, mccollision.weight()); + registry.fill(HIST("h_all_fulljet_NEF_part"), nef, mccollision.weight()); + registry.fill(HIST("h2_all_fulljet_jetpT_vs_FT0Mults_part"), jetPt, mcpMult, mccollision.weight()); + registry.fill(HIST("h2_all_fulljet_jetpT_vs_Nch_part"), jetPt, numberOfChargedParticles, mccollision.weight()); + registry.fill(HIST("h3_full_jet_jetpT_FT0Mults_nef_part"), jetPt, mcpMult, nef, mccollision.weight()); + + // CASE 2: Additional leading jet processing + if (isLeading) { + registry.fill(HIST("h_leading_fulljet_pt_part"), jetPt, mccollision.weight()); + registry.fill(HIST("h_leading_fulljet_Nch_part"), numberOfChargedParticles, mccollision.weight()); + registry.fill(HIST("h_leading_fulljet_Nne_part"), numberOfNeutralParticles, mccollision.weight()); + registry.fill(HIST("h_leading_fulljet_NEF_part"), nef, mccollision.weight()); + registry.fill(HIST("h2_leading_fulljet_jetpT_vs_FT0Mults_part"), jetPt, mcpMult, mccollision.weight()); + registry.fill(HIST("h2_leading_fulljet_jetpT_vs_Nch_part"), jetPt, numberOfChargedParticles, mccollision.weight()); + registry.fill(HIST("h3_leading_fulljet_jetpT_FT0Mults_nef_part"), jetPt, mcpMult, nef, mccollision.weight()); + } + + // CASE 3: Additional first sub-leading jet processing + if (isSubLeading) { + registry.fill(HIST("h_subleading_fulljet_pt_part"), jetPt, mccollision.weight()); + registry.fill(HIST("h_subleading_fulljet_Nch_part"), numberOfChargedParticles, mccollision.weight()); + registry.fill(HIST("h_subleading_fulljet_Nne_part"), numberOfNeutralParticles, mccollision.weight()); + registry.fill(HIST("h_subleading_fulljet_NEF_part"), nef, mccollision.weight()); + registry.fill(HIST("h2_subleading_fulljet_jetpT_vs_FT0Mults_part"), jetPt, mcpMult, mccollision.weight()); + registry.fill(HIST("h2_subleading_fulljet_jetpT_vs_Nch_part"), jetPt, numberOfChargedParticles, mccollision.weight()); + registry.fill(HIST("h3_subleading_fulljet_jetpT_FT0Mults_nef_part"), jetPt, mcpMult, nef, mccollision.weight()); } - auto nef = neutralEnergy / jet.energy(); - registry.fill(HIST("h3_full_jet_jetpTDet_FT0Mults_nef"), jet.pt(), collision.multFT0M(), nef, 1.0); } } - PROCESS_SWITCH(FullJetSpectra, processMBCollisionsDATAWithMultiplicity, "MB DATA Collisions for Full Jets Multiplicity Studies", false); + PROCESS_SWITCH(FullJetSpectra, processMBMCPCollisionsWeightedWithMultiplicity, "MB MCP Weighted Collisions for Full Jets Multiplicity Studies", false); }; // struct From d8f5a258bf6b649588e38b397812c07e8d005e29 Mon Sep 17 00:00:00 2001 From: peressounko Date: Mon, 4 Aug 2025 13:12:29 +0300 Subject: [PATCH 217/345] [PWGEM] event selection fixes (#12408) Co-authored-by: peressounko --- PWGEM/Tasks/phosPi0.cxx | 273 +++++++++++++++++++++++----------------- 1 file changed, 156 insertions(+), 117 deletions(-) diff --git a/PWGEM/Tasks/phosPi0.cxx b/PWGEM/Tasks/phosPi0.cxx index a47aaa0d485..d9eca400242 100644 --- a/PWGEM/Tasks/phosPi0.cxx +++ b/PWGEM/Tasks/phosPi0.cxx @@ -14,34 +14,35 @@ /// \author Dmitri Peresunko /// -#include -#include -#include -#include -#include -#include -#include - #include "Common/DataModel/CaloClusters.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Multiplicity.h" +#include "EventFiltering/Zorro.h" +#include "EventFiltering/ZorroSummary.h" -#include "Framework/ConfigParamSpec.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" +#include "CCDB/BasicCCDBManager.h" +#include "CommonDataFormat/InteractionRecord.h" +#include "DataFormatsParameters/GRPLHCIFData.h" #include "Framework/ASoA.h" #include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/ConfigParamSpec.h" #include "Framework/HistogramRegistry.h" +#include "Framework/runDataProcessing.h" +#include "PHOSBase/Geometry.h" -#include "EventFiltering/Zorro.h" -#include "EventFiltering/ZorroSummary.h" +#include -#include "PHOSBase/Geometry.h" -#include "CommonDataFormat/InteractionRecord.h" -#include "CCDB/BasicCCDBManager.h" -#include "DataFormatsParameters/GRPLHCIFData.h" +#include +#include +#include +#include +#include +#include +#include +#include using namespace o2; using namespace o2::aod::evsel; @@ -52,7 +53,7 @@ struct PhosPi0 { Configurable skimmedProcessing{"skimmedProcessing", false, "Skimmed dataset processing"}; Configurable trigName{"trigName", "fPHOSPhoton", "name of offline trigger"}; Configurable zorroCCDBpath{"zorroCCDBpath", "/Users/m/mpuccio/EventFiltering/OTS/", "path to the zorro ccdb objects"}; - Configurable evSelTrig{"evSelTrig", aod::evsel::kIsTriggerTVX, "Select events with this trigger"}; + Configurable evSelTrig{"evSelTrig", kTVXinPHOS, "Select events with this trigger"}; Configurable isMC{"isMC", false, "to fill MC histograms"}; Configurable minCluE{"minCluE", 0.3, "Minimum cluster energy for analysis"}; Configurable minCluTime{"minCluTime", -25.e-9, "Min. cluster time"}; @@ -107,14 +108,19 @@ struct PhosPi0 { int mRunNumber = 0; // Current run number int mixedEventBin = 0; // Which list of Mixed use for mixing std::vector mCurEvent; - static constexpr int kMaxMixBins = 20; // maximal number of kinds of events for mixing + static constexpr int kMixBinsZ = 20; + static constexpr int kMixBinsPhi = 6; + static constexpr int kMaxMixBins = kMixBinsZ * kMixBinsPhi + 1; // maximal number of bins of events for mixing: vtx*event plane + hard + static constexpr double kEmixCut = 10.; // minimal clu energy for special hard mixing bin + static constexpr int kHardMixBin = kMaxMixBins - 1; // special hard mixing bin + std::array>, kMaxMixBins> mMixedEvents; std::array>, kMaxMixBins> mAmbMixedEvents; int mPrevMCColId = -1; // mark MC collissions already scanned // fast access to histos TH1* hColl; - TH3 *hReMod, *hMiMod; + TH3 *hReMod, *hMiMod, *hReAsym, *hMiAsym; TH2 *hReAll, *hReDisp, *hReCPV, *hReBoth, *hSignalAll, *hPi0SignalAll, *hPi0SignalCPV, *hPi0SignalDisp, *hPi0SignalBoth, *hMiAll, *hMiDisp, *hMiCPV, *hMiBoth; TH2 *hReOneAll, *hReOneDisp, *hReOneCPV, *hReOneBoth, *hMiOneAll, *hMiOneDisp, *hMiOneCPV, *hMiOneBoth; @@ -154,8 +160,8 @@ struct PhosPi0 { hColl->GetXaxis()->SetBinLabel(4, "T0a&&T0c"); hColl->GetXaxis()->SetBinLabel(5, "kTVXinPHOS"); hColl->GetXaxis()->SetBinLabel(6, "kIsTriggerTVX"); - hColl->GetXaxis()->SetBinLabel(7, "PHOSClu"); - hColl->GetXaxis()->SetBinLabel(8, "PHOSClu&&kTVXinPHOS"); + hColl->GetXaxis()->SetBinLabel(7, "kPHOS"); + hColl->GetXaxis()->SetBinLabel(8, "kPHOS&&kTVXinPHOS"); hColl->GetXaxis()->SetBinLabel(9, "Accepted"); auto h2{std::get>(mHistManager.add("eventsBC", "Number of events per trigger", HistType::kTH1F, {{8, 0., 8.}}))}; @@ -186,6 +192,7 @@ struct PhosPi0 { mHistManager.add("cluCPVOcc", "Cluster with CPV occupancy", HistType::kTH3F, {phiAxis, zAxis, modAxis}); mHistManager.add("cluDispOcc", "Cluster with Disp occupancy", HistType::kTH3F, {phiAxis, zAxis, modAxis}); mHistManager.add("cluBothOcc", "Cluster with Both occupancy", HistType::kTH3F, {phiAxis, zAxis, modAxis}); + mHistManager.add("qvec", "qvector", HistType::kTH2F, {{10, 0, o2::constants::math::PI, "#phi", "#phi (rad)"}, {10, 0., 1., "|q|", "|q|"}}); } hReMod = std::get>(mHistManager.add("mggReModComb", "inv mass per module", @@ -203,6 +210,9 @@ struct PhosPi0 { hReBoth = std::get>(mHistManager.add("mggReBoth", "inv mass for centrality", HistType::kTH2F, {mggAxis, ptAxis})) .get(); + hReAsym = std::get>(mHistManager.add("mggReAsym", "inv mass vs pt vs asym", + HistType::kTH3F, {mggAxis, ptAxis, {10, 0., 1., "asym", "a"}})) + .get(); hReOneAll = std::get>(mHistManager.add("mggReOneAll", "inv mass for centrality", HistType::kTH2F, {mggAxis, ptAxis})) .get(); @@ -262,6 +272,9 @@ struct PhosPi0 { hMiBoth = std::get>(mHistManager.add("mggMiBoth", "inv mass for centrality", HistType::kTH2F, {mggAxis, ptAxis})) .get(); + hMiAsym = std::get>(mHistManager.add("mggMiAsym", "inv mass vs pt vs asym", + HistType::kTH3F, {mggAxis, ptAxis, {10, 0., 1., "asym", "a"}})) + .get(); hMiOneAll = std::get>(mHistManager.add("mggMiOneAll", "inv mass for centrality", HistType::kTH2F, {mggAxis, ptAxis})) .get(); @@ -306,25 +319,28 @@ struct PhosPi0 { /// \brief Process PHOS data void processData(SelCollisions::iterator const& col, aod::CaloClusters const& clusters, + aod::FullTracks const& tracks, aod::BCsWithTimestamps const&) { aod::McParticles const* mcPart = nullptr; - scanAll(col, clusters, mcPart); + scanAll(col, clusters, tracks, mcPart); } PROCESS_SWITCH(PhosPi0, processData, "processData", true); void processMC(SelCollisionsMC::iterator const& col, McClusters const& clusters, + aod::FullTracks const& tracks, aod::McParticles const& mcPart, aod::McCollisions const& /*mcCol*/, aod::BCsWithTimestamps const&) { - scanAll(col, clusters, &mcPart); + scanAll(col, clusters, tracks, &mcPart); } PROCESS_SWITCH(PhosPi0, processMC, "processMC", false); template void scanAll(TCollision& col, TClusters& clusters, + aod::FullTracks const& tracks, aod::McParticles const* mcPart) { mixedEventBin = 0; @@ -341,7 +357,7 @@ struct PhosPi0 { return; /// } } else { - if (!col.selection_bit(evSelTrig)) { + if (!col.alias_bit(evSelTrig)) { return; } } @@ -350,13 +366,14 @@ struct PhosPi0 { const double vtxCut = 10.; double vtxZ = col.posZ(); mHistManager.fill(HIST("vertex"), vtxZ); - bool isColSelected = false; - if constexpr (isMC) { - isColSelected = (col.selection_bit(kIsTriggerTVX) && (clusters.size() > 0)); - } else { - isColSelected = col.selection_bit(evSelTrig) && std::abs(vtxZ) < vtxCut; // col.alias_bit(evSelTrig) - // collision.selection_bit(aod::evsel::kNoTimeFrameBorder); - } + bool isColSelected = col.alias_bit(evSelTrig) && std::abs(vtxZ) < vtxCut; + ; + // if constexpr (isMC) { + // isColSelected = (col.selection_bit(kIsTriggerTVX) && (clusters.size() > 0)); + // } else { + // isColSelected = col.alias_bit(evSelTrig) && std::abs(vtxZ) < vtxCut; // + // // collision.selection_bit(aod::evsel::kNoTimeFrameBorder); + // } if (col.selection_bit(kIsBBT0A) || col.selection_bit(kIsBBT0C)) { hColl->Fill(2.5); @@ -367,58 +384,33 @@ struct PhosPi0 { if (col.alias_bit(kTVXinPHOS)) { hColl->Fill(4.5); } - if (col.selection_bit(kIsTriggerTVX)) { + if (col.alias_bit(kIsTriggerTVX)) { hColl->Fill(5.5); } - if (clusters.size() > 0) { + if (col.alias_bit(kPHOS)) { hColl->Fill(6.5); if (col.alias_bit(kTVXinPHOS)) { hColl->Fill(7.5); } } - // //Event Plane| jet orientation - // if (flag & (kProton | kDeuteron | kTriton | kHe3 | kHe4) || doprocessMC) { /// ignore PID pre-selections for the MC - // if constexpr (std::is_same::value) { - // nuclei::candidates_flow.emplace_back(NucleusCandidateFlow{ - // collision.centFV0A(), - // collision.centFT0M(), - // collision.centFT0A(), - // collision.centFT0C(), - // collision.psiFT0A(), - // collision.multFT0A(), - // collision.psiFT0C(), - // collision.multFT0C(), - // collision.psiTPC(), - // collision.psiTPCL(), - // collision.psiTPCR(), - // collision.multTPC()}); - // } else if constexpr (std::is_same::value) { - // nuclei::candidates_flow.emplace_back(NucleusCandidateFlow{ - // collision.centFV0A(), - // collision.centFT0M(), - // collision.centFT0A(), - // collision.centFT0C(), - // 0.5 * std::atan2(collision.qvecFT0AIm(), collision.qvecFT0ARe()), - // collision.multFT0A(), - // 0.5 * std::atan2(collision.qvecFT0CIm(), collision.qvecFT0CRe()), - // collision.multFT0C(), - // -999., - // 0.5 * std::atan2(collision.qvecBNegIm(), collision.qvecBNegRe()), - // 0.5 * std::atan2(collision.qvecBPosIm(), collision.qvecBPosRe()), - // collision.multTPC()}); - // } - - int mult = 1.; // multiplicity TODO!!! - mixedEventBin = findMixedEventBin(vtxZ, mult); if (!isColSelected) { return; } hColl->Fill(8.5); + int mult = 1.; // multiplicity TODO!!! + std::pair q = evalQvec(tracks); + + // find proper event for mixing + // note, that if one find hard cluster in PHOS later, it will change bin to special one + mixedEventBin = findMixedEventBin(vtxZ, mult, q); + // Fill MC distributions // pion rapidity, pt, phi // secondary pi0s + const double rMax = 0.5; // consider pi0s within this radius as primary + const double yMax = 0.5; // rapidity range if constexpr (isMC) { // check current collision Id for clusters int cluMcBCId = -1; @@ -444,16 +436,16 @@ struct PhosPi0 { if (part.mcCollision().bcId() != col.bcId()) { continue; } - if (part.pdgCode() == 111) { + if (part.pdgCode() == PDG_t::kPi0) { double r = std::sqrt(std::pow(part.vx(), 2) + std::pow(part.vy(), 2)); - if (r < 0.5) { + if (r < rMax) { mHistManager.fill(HIST("hMCPi0RapPrim"), part.y()); } - if (std::abs(part.y()) < .5) { + if (std::abs(part.y()) < yMax) { double pt = part.pt(); mHistManager.fill(HIST("hMCPi0SpAll"), pt); double phiVtx = std::atan2(part.vy(), part.vx()); - if (r > 0.5) { + if (r > rMax) { mHistManager.fill(HIST("hMCPi0SecVtx"), r, phiVtx); } else { mHistManager.fill(HIST("hMCPi0SpPrim"), pt); @@ -482,11 +474,14 @@ struct PhosPi0 { clu.m02() < minM02) { continue; } + if (clu.e() > kEmixCut) { + mixedEventBin = kHardMixBin; + } if (fillQC) { mHistManager.fill(HIST("cluSp"), clu.e(), clu.mod()); if (clu.e() > minOccE) { mHistManager.fill(HIST("cluOcc"), clu.x(), clu.z(), clu.mod()); - if (clu.trackdist() > 2.) { + if (clu.trackdist() > cpvCut) { mHistManager.fill(HIST("cluCPVOcc"), clu.x(), clu.z(), clu.mod()); mHistManager.fill(HIST("cluSpCPV"), clu.e(), clu.mod()); if (testLambda(clu.e(), clu.m02(), clu.m20())) { @@ -529,6 +524,7 @@ struct PhosPi0 { } hReMod->Fill(m, pt, modComb, w); hReAll->Fill(m, pt, w); + hReAsym->Fill(m, pt, std::abs((ph1.e - ph2.e) / (ph1.e + ph2.e)), w); hReOneAll->Fill(m, ph1.pt(), w); hReOneAll->Fill(m, ph2.pt(), w); if (ph1.isCPVOK()) { @@ -550,28 +546,32 @@ struct PhosPi0 { } } // Test time eff - if (std::abs(ph1.time - timeOffset) < 12.5e-9) { // strict cut on first photon - if (std::abs(ph2.time - timeOffset) < 100.e-9) { + const double tofCut1 = 12.5e-9; + const double tofCut2 = 30.e-9; + const double tofCut3 = 50.e-9; + const double tofCut4 = 100.e-9; + if (std::abs(ph1.time - timeOffset) < tofCut1) { // strict cut on first photon + if (std::abs(ph2.time - timeOffset) < tofCut4) { hReTime100->Fill(m, ph2.pt()); - if (std::abs(ph2.time - timeOffset) < 50.e-9) { + if (std::abs(ph2.time - timeOffset) < tofCut3) { hReTime50->Fill(m, ph2.pt()); - if (std::abs(ph2.time - timeOffset) < 30.e-9) { + if (std::abs(ph2.time - timeOffset) < tofCut2) { hReTime30->Fill(m, ph2.pt()); - if (std::abs(ph2.time - timeOffset) < 12.5e-9) { + if (std::abs(ph2.time - timeOffset) < tofCut1) { hReTime12->Fill(m, ph2.pt()); } } } } } - if (std::abs(ph2.time - timeOffset) < 12.5e-9) { // strict cut on first photon - if (std::abs(ph1.time - timeOffset) < 100.e-9) { + if (std::abs(ph2.time - timeOffset) < tofCut1) { // strict cut on first photon + if (std::abs(ph1.time - timeOffset) < tofCut4) { hReTime100->Fill(m, ph1.pt()); - if (std::abs(ph1.time - timeOffset) < 50.e-9) { + if (std::abs(ph1.time - timeOffset) < tofCut3) { hReTime50->Fill(m, ph1.pt()); - if (std::abs(ph1.time - timeOffset) < 30.e-9) { + if (std::abs(ph1.time - timeOffset) < tofCut2) { hReTime30->Fill(m, ph1.pt()); - if (std::abs(ph1.time - timeOffset) < 12.5e-9) { + if (std::abs(ph1.time - timeOffset) < tofCut1) { hReTime12->Fill(m, ph1.pt()); } } @@ -584,7 +584,7 @@ struct PhosPi0 { int cp = commonParentPDG(ph1.label, ph2.label, mcPart); if (cp != 0) { hSignalAll->Fill(m, pt, w); - if (cp == 111) { + if (cp == PDG_t::kPi0) { isPi0 = true; hPi0SignalAll->Fill(m, pt, w); } @@ -633,6 +633,7 @@ struct PhosPi0 { } hMiMod->Fill(m, pt, modComb, w); hMiAll->Fill(m, pt, w); + hMiAsym->Fill(m, pt, std::abs((ph1.e - ph2.e) / (ph1.e + ph2.e)), w); hMiOneAll->Fill(m, ph1.pt(), w); hMiOneAll->Fill(m, ph2.pt(), w); if (ph1.isCPVOK()) { @@ -681,9 +682,10 @@ struct PhosPi0 { mixedEventBin = 0; mHistManager.fill(HIST("eventsBC"), 0.); - double vtxZ = 0; // no vtx info - int mult = 1.; // multiplicity TODO!!! - mixedEventBin = findMixedEventBin(vtxZ, mult); + double vtxZ = 0; // no vtx info + int mult = 1.; // multiplicity TODO!!! + std::pair q{0, 0}; // fake q-vector as no tracks + mixedEventBin = findMixedEventBin(vtxZ, mult, q); if (!isSelected) { return; @@ -709,7 +711,7 @@ struct PhosPi0 { mHistManager.fill(HIST("cluSp"), clu.e(), clu.mod()); if (clu.e() > minOccE) { mHistManager.fill(HIST("cluOcc"), clu.x(), clu.z(), clu.mod()); - if (clu.trackdist() > 2.) { + if (clu.trackdist() > cpvCut) { mHistManager.fill(HIST("cluCPVOcc"), clu.x(), clu.z(), clu.mod()); mHistManager.fill(HIST("cluSpCPV"), clu.e(), clu.mod()); if (testLambda(clu.e(), clu.m02(), clu.m20())) { @@ -809,7 +811,7 @@ struct PhosPi0 { if (d == 1) { return 3 + std::min(m1, m2); } - if (d == 2) { + if (d == 2) { // o2-linter: disable=magic-number (algoritm value) return 6 + std::min(m1, m2); } return 9; @@ -819,11 +821,11 @@ struct PhosPi0 { { // Parameterization for full dispersion // Parameterizatino for full dispersion - float l2Mean = 1.53126 + 9.50835e+06 / (1. + 1.08728e+07 * pt + 1.73420e+06 * pt * pt); - float l1Mean = 1.12365 + 0.123770 * std::exp(-pt * 0.246551) + 5.30000e-03 * pt; - float l2Sigma = 6.48260e-02 + 7.60261e+10 / (1. + 1.53012e+11 * pt + 5.01265e+05 * pt * pt) + 9.00000e-03 * pt; - float l1Sigma = 4.44719e-04 + 6.99839e-01 / (1. + 1.22497e+00 * pt + 6.78604e-07 * pt * pt) + 9.00000e-03 * pt; - float c = -0.35 - 0.550 * std::exp(-0.390730 * pt); + float l2Mean = 1.53126 + 9.50835e+06 / (1. + 1.08728e+07 * pt + 1.73420e+06 * pt * pt); // o2-linter: disable=magic-number (fixed parameterization) + float l1Mean = 1.12365 + 0.123770 * std::exp(-pt * 0.246551) + 5.30000e-03 * pt; // o2-linter: disable=magic-number (fixed parameterization) + float l2Sigma = 6.48260e-02 + 7.60261e+10 / (1. + 1.53012e+11 * pt + 5.01265e+05 * pt * pt) + 9.00000e-03 * pt; // o2-linter: disable=magic-number (fixed parameterization) + float l1Sigma = 4.44719e-04 + 6.99839e-01 / (1. + 1.22497e+00 * pt + 6.78604e-07 * pt * pt) + 9.00000e-03 * pt; // o2-linter: disable=magic-number (fixed parameterization) + float c = -0.35 - 0.550 * std::exp(-0.390730 * pt); // o2-linter: disable=magic-number (fixed parameterization) return 0.5 * (l1 - l1Mean) * (l1 - l1Mean) / l1Sigma / l1Sigma + 0.5 * (l2 - l2Mean) * (l2 - l2Mean) / l2Sigma / l2Sigma + @@ -831,17 +833,27 @@ struct PhosPi0 { 4.; } //_____________________________________________________________________________ - int findMixedEventBin(double vtxZ, double /*mult */) + int findMixedEventBin(double vtxZ, double /*mult*/, std::pair& q) { // calculate index for event mixing const double zwidth = 1.; // Width of zvtx bin - int res = static_cast((vtxZ + 10.) / zwidth); - - if (res < 0) - return 0; - if (res >= kMaxMixBins) - return kMaxMixBins - 1; - return res; + int iz = static_cast((vtxZ + 10.) / zwidth); + + if (iz < 0) + iz = 0; + if (iz >= kMixBinsZ) + iz = kMixBinsZ - 1; + + // event plane orientation + double phi = 0.5 * std::atan2(q.second, q.first); // 1/2 due to second order flow harmonic + while (phi < 0) + phi += o2::constants::math::PI; + while (phi > o2::constants::math::PI) + phi -= o2::constants::math::PI; + int iphi = static_cast(kMixBinsPhi * phi / o2::constants::math::PI); + mHistManager.fill(HIST("qvec"), phi, std::sqrt(q.first * q.first + q.second * q.second)); + + return iz * iphi; } //---------------------------------------- int commonParentPDG(int lab1, int lab2, aod::McParticles const* mcParticles) @@ -857,13 +869,16 @@ struct PhosPi0 { return mcParticles->iteratorAt(iparent1).pdgCode(); } auto parent2 = mcParticles->iteratorAt(iparent2); - if (parent2.mothersIds().size() == 0 || parent2.pdgCode() == 21 || std::abs(parent2.pdgCode()) < 11 || std::abs(parent2.pdgCode()) > 5000) { // no parents, parent not quark/gluon, strings + // no parents, parent not quark/gluon, strings + if (parent2.mothersIds().size() == 0 || parent2.pdgCode() == 21 || // o2-linter: disable=pdg/explicit-code (no code) o2-linter: disable=magic-number (pdg value) + std::abs(parent2.pdgCode()) < 11 || std::abs(parent2.pdgCode()) > 5000) { // o2-linter: disable=pdg/explicit-code (no code) o2-linter: disable=magic-number (pdg value) break; } iparent2 = parent2.mothersIds()[0]; } auto parent1 = mcParticles->iteratorAt(iparent1); - if (parent1.mothersIds().size() == 0 || parent1.pdgCode() == 21 || std::abs(parent1.pdgCode()) < 11 || std::abs(parent1.pdgCode()) > 5000) { // no parents, parent not quark/gluon, strings + // no parents, parent not quark/gluon, strings + if (parent1.mothersIds().size() == 0 || parent1.pdgCode() == 21 || std::abs(parent1.pdgCode()) < 11 || std::abs(parent1.pdgCode()) > 5000) { // o2-linter: disable=pdg/explicit-code (no code) o2-linter: disable=magic-number (pdg value) return 0; } iparent1 = parent1.mothersIds()[0]; @@ -879,24 +894,24 @@ struct PhosPi0 { if (tofEffParam == 0) { return 1.; } - if (tofEffParam == 1) { // Run2 100 ns + if (tofEffParam == 1) { // Run2 100 ns //o2-linter: disable=magic-number (local parameterization) // parameterization 01.08.2020 - if (en > 1.1) + if (en > 1.1) // o2-linter: disable=magic-number (local parameterization) en = 1.1; - if (en < 0.11) + if (en < 0.11) // o2-linter: disable=magic-number (local parameterization) en = 0.11; - return std::exp((-1.15295e+05 + 2.26754e+05 * en - 1.26063e+05 * en * en + en * en * en) / - (1. - 3.16443e+05 * en + 3.68044e+06 * en * en + en * en * en)); + return std::exp((-1.15295e+05 + 2.26754e+05 * en - 1.26063e+05 * en * en + en * en * en) / // o2-linter: disable=magic-number (local parameterization) + (1. - 3.16443e+05 * en + 3.68044e+06 * en * en + en * en * en)); // o2-linter: disable=magic-number (local parameterization) } - if (tofEffParam == 2) { // Run2 30 ns - if (en > 1.6) + if (tofEffParam == 2) { // Run2 30 ns //o2-linter: disable=magic-number (kind of TOF parameterization) + if (en > 1.6) // o2-linter: disable=magic-number (local parameterization) en = 1.6; - return 1. / (1. + std::exp((4.83230e+01 - 8.89758e+01 * en + 1.10897e+03 * en * en - 5.73755e+03 * en * en * en - - 1.43777e+03 * en * en * en * en) / - (1. - 1.23667e+02 * en + 1.07255e+03 * en * en + 5.87221e+02 * en * en * en))); + return 1. / (1. + std::exp((4.83230e+01 - 8.89758e+01 * en + 1.10897e+03 * en * en - 5.73755e+03 * en * en * en - // o2-linter: disable=magic-number (local parameterization) + 1.43777e+03 * en * en * en * en) / // o2-linter: disable=magic-number (local parameterization) + (1. - 1.23667e+02 * en + 1.07255e+03 * en * en + 5.87221e+02 * en * en * en))); // o2-linter: disable=magic-number (local parameterization) } - if (tofEffParam == 2) { // Run2 12.5 ns - if (en < 4.6) { + if (tofEffParam == 3) { // Run2 12.5 ns //o2-linter: disable=magic-number (local parameterization) + if (en < 4.6) { // o2-linter: disable=magic-number (local parameterization) return std::exp(3.64952e-03 * (-5.80032e+01 - 1.53442e+02 * en + 1.30994e+02 * en * en + -3.53094e+01 * en * en * en + en * en * en * en) / (-7.75638e-02 + 8.64761e-01 * en + 1.22320e+00 * en * en - 1.00177e+00 * en * en * en + en * en * en * en)); @@ -907,6 +922,30 @@ struct PhosPi0 { } return 1.; } + //_____________________________________________________________________________ + std::pair evalQvec(aod::FullTracks const& tracks) + { + // calculate approximate q-vector for event + const int ord = 2; // flow order + std::pair q{0, 0}; + int ntr = 0; + for (const auto& track : tracks) { + if (!track.has_collision()) { // ignore orphan tracks without collision + continue; + } + // if (!track.isGlobalTrack()) { // only global tracks + // continue; + // } + q.first += std::cos(ord * track.phi()); + q.second += std::sin(ord * track.phi()); + ntr++; + } + if (ntr > 0) { + q.first /= ntr; + q.second /= ntr; + } + return q; + } }; o2::framework::WorkflowSpec defineDataProcessing(o2::framework::ConfigContext const& cfgc) From 2e21ca38e62b395ae45fae9e65413c93f19b80fb Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Mon, 4 Aug 2025 13:33:01 +0200 Subject: [PATCH 218/345] [PWGLF] One more minor optimization change to str builder module (#12412) --- PWGLF/Utils/strangenessBuilderModule.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/PWGLF/Utils/strangenessBuilderModule.h b/PWGLF/Utils/strangenessBuilderModule.h index 4673be69592..fc33a44f40c 100644 --- a/PWGLF/Utils/strangenessBuilderModule.h +++ b/PWGLF/Utils/strangenessBuilderModule.h @@ -1338,6 +1338,12 @@ class BuilderModule for (size_t iv0 = 0; iv0 < v0List.size(); iv0++) { const auto& v0 = v0List[sorted_v0[iv0]]; + if (!v0BuilderOpts.generatePhotonCandidates.value && v0.v0Type > 1) { + // skip photons if not requested + products.v0dataLink(-1, -1); + continue; + } + if (!baseOpts.mEnabledTables[kV0CoresBase] && v0Map[iv0] == -2) { // this v0 hasn't been used by cascades and we're not generating V0s, so skip it products.v0dataLink(-1, -1); @@ -1389,7 +1395,7 @@ class BuilderModule } } - if (!straHelper.buildV0Candidate(v0.collisionId, pvX, pvY, pvZ, posTrack, negTrack, posTrackPar, negTrackPar, v0.isCollinearV0, baseOpts.mEnabledTables[kV0Covs], true)) { + if (!straHelper.buildV0Candidate(v0.collisionId, pvX, pvY, pvZ, posTrack, negTrack, posTrackPar, negTrackPar, v0.isCollinearV0, baseOpts.mEnabledTables[kV0Covs], v0BuilderOpts.generatePhotonCandidates)) { products.v0dataLink(-1, -1); continue; } From e3f1e1de1cf70a63b7922b93662a67def3893d81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= Date: Mon, 4 Aug 2025 14:20:44 +0200 Subject: [PATCH 219/345] [PWGDQ,PWGEM,PWGLF] Use fully qualified names for std::string in configurables (#12384) --- PWGDQ/TableProducer/tableMaker.cxx | 71 ++++++----- PWGDQ/TableProducer/tableMaker_withAssoc.cxx | 71 ++++++----- PWGDQ/Tasks/TagAndProbe.cxx | 4 +- PWGDQ/Tasks/dqCorrelation.cxx | 59 ++++----- PWGDQ/Tasks/dqEfficiency.cxx | 39 +++--- PWGDQ/Tasks/dqEfficiency_withAssoc.cxx | 116 ++++++++--------- PWGDQ/Tasks/filterPP.cxx | 58 +++++---- PWGDQ/Tasks/filterPPwithAssociation.cxx | 114 +++++++++-------- PWGDQ/Tasks/mchAlignRecord.cxx | 86 +++++++------ PWGDQ/Tasks/muonDCA.cxx | 15 +-- PWGDQ/Tasks/tableReader.cxx | 94 +++++++------- PWGDQ/Tasks/tableReader_withAssoc.cxx | 119 +++++++++--------- PWGEM/Dilepton/Tasks/emEfficiencyEE.cxx | 68 +++++----- PWGEM/Dilepton/Tasks/tableReaderBarrel.cxx | 74 +++++------ .../Tasks/Strangeness/hStrangeCorrelation.cxx | 2 +- 15 files changed, 513 insertions(+), 477 deletions(-) diff --git a/PWGDQ/TableProducer/tableMaker.cxx b/PWGDQ/TableProducer/tableMaker.cxx index 87d1183d385..7ebb5876bf5 100644 --- a/PWGDQ/TableProducer/tableMaker.cxx +++ b/PWGDQ/TableProducer/tableMaker.cxx @@ -24,45 +24,48 @@ #include #include // other includes -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/DataTypes.h" -#include "Framework/runDataProcessing.h" -#include "CCDB/BasicCCDBManager.h" -#include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/Centrality.h" +#include "PWGDQ/Core/AnalysisCompositeCut.h" +#include "PWGDQ/Core/AnalysisCut.h" +#include "PWGDQ/Core/CutsLibrary.h" +#include "PWGDQ/Core/HistogramManager.h" +#include "PWGDQ/Core/HistogramsLibrary.h" +#include "PWGDQ/Core/VarManager.h" +#include "PWGDQ/DataModel/ReducedInfoTables.h" + #include "Common/CCDB/TriggerAliases.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/CollisionAssociationTables.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/FwdTrackReAlignTables.h" +#include "Common/DataModel/MftmchMatchingML.h" +#include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/MftmchMatchingML.h" -#include "Common/DataModel/FwdTrackReAlignTables.h" -#include "PWGDQ/DataModel/ReducedInfoTables.h" -#include "PWGDQ/Core/VarManager.h" -#include "PWGDQ/Core/HistogramManager.h" -#include "PWGDQ/Core/AnalysisCut.h" -#include "PWGDQ/Core/AnalysisCompositeCut.h" -#include "PWGDQ/Core/HistogramsLibrary.h" -#include "PWGDQ/Core/CutsLibrary.h" -#include "DataFormatsGlobalTracking/RecoContainerCreateTracksVariadic.h" -#include "DetectorsVertexing/VertexTrackMatcher.h" -#include "ReconstructionDataFormats/PrimaryVertex.h" -#include "ReconstructionDataFormats/VtxTrackIndex.h" -#include "ReconstructionDataFormats/VtxTrackRef.h" -#include "DataFormatsITSMFT/ROFRecord.h" +#include "EventFiltering/Zorro.h" + +#include "CCDB/BasicCCDBManager.h" #include "CommonDataFormat/InteractionRecord.h" -#include "DetectorsVertexing/PVertexerParams.h" -#include "MathUtils/Primitive2D.h" #include "DataFormatsGlobalTracking/RecoContainer.h" -#include "Common/DataModel/CollisionAssociationTables.h" +#include "DataFormatsGlobalTracking/RecoContainerCreateTracksVariadic.h" +#include "DataFormatsITSMFT/ROFRecord.h" #include "DataFormatsParameters/GRPMagField.h" #include "DataFormatsParameters/GRPObject.h" +#include "DetectorsBase/GeometryManager.h" +#include "DetectorsBase/Propagator.h" +#include "DetectorsVertexing/PVertexerParams.h" +#include "DetectorsVertexing/VertexTrackMatcher.h" #include "Field/MagneticField.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/DataTypes.h" +#include "Framework/runDataProcessing.h" +#include "MathUtils/Primitive2D.h" +#include "ReconstructionDataFormats/PrimaryVertex.h" +#include "ReconstructionDataFormats/VtxTrackIndex.h" +#include "ReconstructionDataFormats/VtxTrackRef.h" + #include "TGeoGlobalMagField.h" -#include "DetectorsBase/Propagator.h" -#include "DetectorsBase/GeometryManager.h" -#include "EventFiltering/Zorro.h" using std::cout; using std::endl; @@ -191,15 +194,15 @@ struct TableMaker { struct : ConfigurableGroup { Configurable fConfigRunZorro{"cfgRunZorro", false, "Enable event selection with zorro"}; - Configurable fConfigZorroTrigMask{"cfgZorroTriggerMask", "fDiMuon", "DQ Trigger masks: fSingleE,fLMeeIMR,fLMeeHMR,fDiElectron,fSingleMuLow,fSingleMuHigh,fDiMuon"}; + Configurable fConfigZorroTrigMask{"cfgZorroTriggerMask", "fDiMuon", "DQ Trigger masks: fSingleE,fLMeeIMR,fLMeeHMR,fDiElectron,fSingleMuLow,fSingleMuHigh,fDiMuon"}; Configurable fConfigRunZorroSel{"cfgRunZorroSel", false, "Select events with trigger mask"}; Configurable fBcTolerance{"cfgBcTolerance", 100, "Number of BCs of margin for software triggers"}; } useZorro; struct : ConfigurableGroup { - Configurable fConfigCcdbUrl{"useCCDBConfigurations.ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Configurable fConfigCcdbPathTPC{"useCCDBConfigurations.ccdb-path-tpc", "Users/z/zhxiong/TPCPID/PostCalib", "base path to the ccdb object"}; - Configurable fConfigCcdbPathZorro{"useCCDBConfigurations.ccdb-path-zorro", "/Users/m/mpuccio/EventFiltering/OTS/", "base path to the ccdb object for zorro"}; + Configurable fConfigCcdbUrl{"useCCDBConfigurations.ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable fConfigCcdbPathTPC{"useCCDBConfigurations.ccdb-path-tpc", "Users/z/zhxiong/TPCPID/PostCalib", "base path to the ccdb object"}; + Configurable fConfigCcdbPathZorro{"useCCDBConfigurations.ccdb-path-zorro", "/Users/m/mpuccio/EventFiltering/OTS/", "base path to the ccdb object for zorro"}; } useCCDBConfigurations; Configurable fConfigNoLaterThan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; diff --git a/PWGDQ/TableProducer/tableMaker_withAssoc.cxx b/PWGDQ/TableProducer/tableMaker_withAssoc.cxx index 3b3d4c4e0af..00587ffce7f 100644 --- a/PWGDQ/TableProducer/tableMaker_withAssoc.cxx +++ b/PWGDQ/TableProducer/tableMaker_withAssoc.cxx @@ -23,46 +23,49 @@ #include #include // other includes -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/DataTypes.h" -#include "Framework/runDataProcessing.h" -#include "CCDB/BasicCCDBManager.h" -#include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/Centrality.h" +#include "PWGDQ/Core/AnalysisCompositeCut.h" +#include "PWGDQ/Core/AnalysisCut.h" +#include "PWGDQ/Core/CutsLibrary.h" +#include "PWGDQ/Core/HistogramManager.h" +#include "PWGDQ/Core/HistogramsLibrary.h" +#include "PWGDQ/Core/VarManager.h" +#include "PWGDQ/DataModel/ReducedInfoTables.h" + #include "Common/CCDB/TriggerAliases.h" +#include "Common/Core/TableHelper.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/CollisionAssociationTables.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/FwdTrackReAlignTables.h" +#include "Common/DataModel/MftmchMatchingML.h" +#include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/MftmchMatchingML.h" -#include "Common/DataModel/FwdTrackReAlignTables.h" -#include "Common/Core/TableHelper.h" -#include "PWGDQ/DataModel/ReducedInfoTables.h" -#include "PWGDQ/Core/VarManager.h" -#include "PWGDQ/Core/HistogramManager.h" -#include "PWGDQ/Core/AnalysisCut.h" -#include "PWGDQ/Core/AnalysisCompositeCut.h" -#include "PWGDQ/Core/HistogramsLibrary.h" -#include "PWGDQ/Core/CutsLibrary.h" -#include "DataFormatsGlobalTracking/RecoContainerCreateTracksVariadic.h" -#include "DetectorsVertexing/VertexTrackMatcher.h" -#include "ReconstructionDataFormats/PrimaryVertex.h" -#include "ReconstructionDataFormats/VtxTrackIndex.h" -#include "ReconstructionDataFormats/VtxTrackRef.h" -#include "DataFormatsITSMFT/ROFRecord.h" +#include "EventFiltering/Zorro.h" + +#include "CCDB/BasicCCDBManager.h" #include "CommonDataFormat/InteractionRecord.h" -#include "DetectorsVertexing/PVertexerParams.h" -#include "MathUtils/Primitive2D.h" #include "DataFormatsGlobalTracking/RecoContainer.h" -#include "Common/DataModel/CollisionAssociationTables.h" +#include "DataFormatsGlobalTracking/RecoContainerCreateTracksVariadic.h" +#include "DataFormatsITSMFT/ROFRecord.h" #include "DataFormatsParameters/GRPMagField.h" #include "DataFormatsParameters/GRPObject.h" +#include "DetectorsBase/GeometryManager.h" +#include "DetectorsBase/Propagator.h" +#include "DetectorsVertexing/PVertexerParams.h" +#include "DetectorsVertexing/VertexTrackMatcher.h" #include "Field/MagneticField.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/DataTypes.h" +#include "Framework/runDataProcessing.h" +#include "MathUtils/Primitive2D.h" +#include "ReconstructionDataFormats/PrimaryVertex.h" +#include "ReconstructionDataFormats/VtxTrackIndex.h" +#include "ReconstructionDataFormats/VtxTrackRef.h" + #include "TGeoGlobalMagField.h" -#include "DetectorsBase/Propagator.h" -#include "DetectorsBase/GeometryManager.h" -#include "EventFiltering/Zorro.h" using namespace o2; using namespace o2::framework; @@ -225,9 +228,9 @@ struct TableMaker { // CCDB connection configurables struct : ConfigurableGroup { - Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Configurable fConfigCcdbPathTPC{"ccdb-path-tpc", "Users/z/zhxiong/TPCPID/PostCalib", "base path to the ccdb object"}; - Configurable fConfigCcdbPathZorro{"ccdb-path-zorro", "/Users/m/mpuccio/EventFiltering/OTS/Chunked/", "base path to the ccdb object for zorro"}; + Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable fConfigCcdbPathTPC{"ccdb-path-tpc", "Users/z/zhxiong/TPCPID/PostCalib", "base path to the ccdb object"}; + Configurable fConfigCcdbPathZorro{"ccdb-path-zorro", "/Users/m/mpuccio/EventFiltering/OTS/Chunked/", "base path to the ccdb object for zorro"}; Configurable fConfigNoLaterThan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; Configurable fConfigGeoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; Configurable fConfigGrpMagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; diff --git a/PWGDQ/Tasks/TagAndProbe.cxx b/PWGDQ/Tasks/TagAndProbe.cxx index 33bfe2ea06c..2a35b33b87e 100644 --- a/PWGDQ/Tasks/TagAndProbe.cxx +++ b/PWGDQ/Tasks/TagAndProbe.cxx @@ -116,7 +116,7 @@ struct AnalysisTagAndProbe { OutputObj fOutputList{"output"}; struct : ConfigurableGroup { - Configurable muon{"cfgMuonCuts", "", "Comma separated list of muon cuts"}; + Configurable muon{"cfgMuonCuts", "", "Comma separated list of muon cuts"}; // TODO: Add pair cuts via JSON } fConfigCuts; @@ -124,7 +124,7 @@ struct AnalysisTagAndProbe { Configurable fConfigQA{"cfgQA", true, "If true, fill output histograms"}; struct : ConfigurableGroup { - Configurable url{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable url{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable grpMagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; Configurable lutPath{"lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"}; Configurable geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; diff --git a/PWGDQ/Tasks/dqCorrelation.cxx b/PWGDQ/Tasks/dqCorrelation.cxx index 950e82364cb..ec240fa66fe 100644 --- a/PWGDQ/Tasks/dqCorrelation.cxx +++ b/PWGDQ/Tasks/dqCorrelation.cxx @@ -11,44 +11,45 @@ /// @author Victor Valencia // Contact: iarsene@cern.ch, i.c.arsene@fys.uio.no // -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "CCDB/BasicCCDBManager.h" -#include "DataFormatsParameters/GRPObject.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" #include "PWGCF/GenericFramework/Core/FlowContainer.h" -#include "PWGCF/GenericFramework/Core/GFWCumulant.h" #include "PWGCF/GenericFramework/Core/GFW.h" +#include "PWGCF/GenericFramework/Core/GFWCumulant.h" +#include "PWGCF/GenericFramework/Core/GFWPowerArray.h" #include "PWGCF/GenericFramework/Core/GFWWeights.h" -#include "PWGDQ/DataModel/ReducedInfoTables.h" -#include "PWGDQ/Core/VarManager.h" -#include "PWGDQ/Core/HistogramManager.h" -#include "PWGDQ/Core/MixingHandler.h" -#include "PWGDQ/Core/AnalysisCut.h" #include "PWGDQ/Core/AnalysisCompositeCut.h" -#include "PWGDQ/Core/HistogramsLibrary.h" +#include "PWGDQ/Core/AnalysisCut.h" #include "PWGDQ/Core/CutsLibrary.h" +#include "PWGDQ/Core/HistogramManager.h" +#include "PWGDQ/Core/HistogramsLibrary.h" +#include "PWGDQ/Core/MixingHandler.h" #include "PWGDQ/Core/MixingLibrary.h" +#include "PWGDQ/Core/VarManager.h" +#include "PWGDQ/DataModel/ReducedInfoTables.h" + +#include "CCDB/BasicCCDBManager.h" #include "DataFormatsParameters/GRPMagField.h" -#include "Field/MagneticField.h" -#include "TGeoGlobalMagField.h" -#include "DetectorsBase/Propagator.h" +#include "DataFormatsParameters/GRPObject.h" #include "DetectorsBase/GeometryManager.h" +#include "DetectorsBase/Propagator.h" +#include "Field/MagneticField.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" -#include "PWGCF/GenericFramework/Core/GFWPowerArray.h" +#include "TGeoGlobalMagField.h" #include "TProfile.h" +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include using std::cout; using std::endl; @@ -118,7 +119,7 @@ struct DqCumulantFlow { ConfigurableAxis axisMass{"axisMass", {40, 2, 4}, "mass axis for histograms"}; Configurable fConfigNPow{"cfgNPow", 0, "Power of weights for Q vector"}; // Configurables for the reference flow - Configurable fConfigTrackCuts{"cfgLeptonCuts", "jpsiO2MCdebugCuts2", "Comma separated list of barrel track cuts"}; + Configurable fConfigTrackCuts{"cfgLeptonCuts", "jpsiO2MCdebugCuts2", "Comma separated list of barrel track cuts"}; Configurable fConfigCutPtMin{"cfgCutPtMin", 1.0f, "Minimal pT for tracks"}; Configurable fConfigCutPtMax{"cfgCutPtMax", 12.0f, "Maximal pT for tracks"}; Configurable fConfigCutEtaMin{"cfgCutEtaMin", -0.8f, "Eta min range for tracks"}; diff --git a/PWGDQ/Tasks/dqEfficiency.cxx b/PWGDQ/Tasks/dqEfficiency.cxx index ed62df14a5e..bcbaa4fe1bf 100644 --- a/PWGDQ/Tasks/dqEfficiency.cxx +++ b/PWGDQ/Tasks/dqEfficiency.cxx @@ -13,30 +13,33 @@ // // Analysis task for processing O2::DQ MC skimmed AODs // -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "PWGDQ/DataModel/ReducedInfoTables.h" -#include "PWGDQ/Core/VarManager.h" -#include "PWGDQ/Core/HistogramManager.h" -#include "PWGDQ/Core/AnalysisCut.h" #include "PWGDQ/Core/AnalysisCompositeCut.h" -#include "PWGDQ/Core/HistogramsLibrary.h" +#include "PWGDQ/Core/AnalysisCut.h" #include "PWGDQ/Core/CutsLibrary.h" +#include "PWGDQ/Core/HistogramManager.h" +#include "PWGDQ/Core/HistogramsLibrary.h" #include "PWGDQ/Core/MCSignal.h" #include "PWGDQ/Core/MCSignalLibrary.h" +#include "PWGDQ/Core/VarManager.h" +#include "PWGDQ/DataModel/ReducedInfoTables.h" + #include "CCDB/BasicCCDBManager.h" #include "DataFormatsParameters/GRPMagField.h" #include "DetectorsBase/GeometryManager.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include using std::cout; using std::endl; @@ -1044,7 +1047,7 @@ struct AnalysisDileptonTrack { o2::base::MatLayerCylSet* lut = nullptr; // TODO: For now this is only used to determine the position in the filter bit map for the hadron cut - Configurable fConfigTrackCuts{"cfgLeptonCuts", "", "Comma separated list of barrel track cuts"}; + Configurable fConfigTrackCuts{"cfgLeptonCuts", "", "Comma separated list of barrel track cuts"}; Configurable fConfigFillCandidateTable{"cfgFillCandidateTable", false, "Produce a single flat tables with all relevant information dilepton-track candidates"}; Configurable ccdburl{"ccdburl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable fCorrFullGeo{"cfgCorrFullGeo", false, "Use full geometry to correct for MCS effects in track propagation"}; diff --git a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx index 17ae4e76d22..6351a49157f 100644 --- a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx +++ b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx @@ -12,43 +12,47 @@ // Contact: iarsene@cern.ch, i.c.arsene@fys.uio.no // Configurable workflow for running several DQ or other PWG analyses -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "CCDB/BasicCCDBManager.h" -#include "DataFormatsParameters/GRPObject.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/AnalysisHelpers.h" -#include "PWGDQ/DataModel/ReducedInfoTables.h" -#include "PWGDQ/Core/VarManager.h" -#include "PWGDQ/Core/HistogramManager.h" -#include "PWGDQ/Core/MixingHandler.h" -#include "PWGDQ/Core/AnalysisCut.h" #include "PWGDQ/Core/AnalysisCompositeCut.h" -#include "PWGDQ/Core/HistogramsLibrary.h" +#include "PWGDQ/Core/AnalysisCut.h" #include "PWGDQ/Core/CutsLibrary.h" -#include "PWGDQ/Core/MixingLibrary.h" +#include "PWGDQ/Core/HistogramManager.h" +#include "PWGDQ/Core/HistogramsLibrary.h" #include "PWGDQ/Core/MCSignal.h" #include "PWGDQ/Core/MCSignalLibrary.h" +#include "PWGDQ/Core/MixingHandler.h" +#include "PWGDQ/Core/MixingLibrary.h" +#include "PWGDQ/Core/VarManager.h" +#include "PWGDQ/DataModel/ReducedInfoTables.h" + +#include "Common/Core/TableHelper.h" + +#include "CCDB/BasicCCDBManager.h" #include "DataFormatsParameters/GRPMagField.h" +#include "DataFormatsParameters/GRPObject.h" +#include "DetectorsBase/GeometryManager.h" +#include "DetectorsBase/Propagator.h" #include "Field/MagneticField.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" + #include "TGeoGlobalMagField.h" -#include "DetectorsBase/Propagator.h" -#include "DetectorsBase/GeometryManager.h" -#include "Common/Core/TableHelper.h" +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include using std::cout; using std::endl; @@ -210,8 +214,8 @@ struct AnalysisEventSelection { Produces eventSel; OutputObj fOutputList{"output"}; - Configurable fConfigEventCuts{"cfgEventCuts", "eventStandard", "Event selection"}; - Configurable fConfigEventCutsJSON{"cfgEventCutsJSON", "", "Additional event cuts specified in JSON format"}; + Configurable fConfigEventCuts{"cfgEventCuts", "eventStandard", "Event selection"}; + Configurable fConfigEventCutsJSON{"cfgEventCutsJSON", "", "Additional event cuts specified in JSON format"}; Configurable fConfigQA{"cfgQA", false, "If true, fill QA histograms"}; Configurable fConfigAddEventHistogram{"cfgAddEventHistogram", "", "Comma separated list of histograms"}; Configurable fConfigAddEventMCHistogram{"cfgAddEventMCHistogram", "generator", "Comma separated list of histograms"}; @@ -221,7 +225,7 @@ struct AnalysisEventSelection { Configurable fConfigSplitCollisionsDeltaBC{"splitCollisionsDeltaBC", 100, "maximum delta-BC between two collisions to consider them as split candidates; do not apply if value is negative"}; Configurable fConfigCheckSplitCollisions{"checkSplitCollisions", false, "If true, run the split collision check and fill histograms"}; - Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable fConfigNoLaterThan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; HistogramManager* fHistMan = nullptr; @@ -430,14 +434,14 @@ struct AnalysisTrackSelection { Produces trackAmbiguities; OutputObj fOutputList{"output"}; - Configurable fConfigCuts{"cfgTrackCuts", "jpsiO2MCdebugCuts2", "Comma separated list of barrel track cuts"}; + Configurable fConfigCuts{"cfgTrackCuts", "jpsiO2MCdebugCuts2", "Comma separated list of barrel track cuts"}; Configurable fConfigCutsJSON{"cfgBarrelTrackCutsJSON", "", "Additional list of barrel track cuts in JSON format"}; Configurable fConfigQA{"cfgQA", false, "If true, fill QA histograms"}; - Configurable fConfigAddTrackHistogram{"cfgAddTrackHistogram", "", "Comma separated list of histograms"}; + Configurable fConfigAddTrackHistogram{"cfgAddTrackHistogram", "", "Comma separated list of histograms"}; Configurable fConfigAddJSONHistograms{"cfgAddJSONHistograms", "", "Histograms in JSON format"}; Configurable fConfigPublishAmbiguity{"cfgPublishAmbiguity", true, "If true, publish ambiguity table and fill QA histograms"}; - Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Configurable fConfigCcdbPathTPC{"ccdb-path-tpc", "Users/z/zhxiong/TPCPID/PostCalib", "base path to the ccdb object"}; + Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable fConfigCcdbPathTPC{"ccdb-path-tpc", "Users/z/zhxiong/TPCPID/PostCalib", "base path to the ccdb object"}; Configurable fConfigNoLaterThan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; Configurable fConfigComputeTPCpostCalib{"cfgTPCpostCalib", false, "If true, compute TPC post-calibrated n-sigmas"}; Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; @@ -534,7 +538,7 @@ struct AnalysisTrackSelection { DefineHistograms(fHistMan, "TrackBarrel_AmbiguityInBunch;TrackBarrel_AmbiguityOutOfBunch;", "ambiguity"); } dqhistograms::AddHistogramsFromJSON(fHistMan, fConfigAddJSONHistograms.value.c_str()); // ad-hoc histograms via JSON - VarManager::SetUseVars(fHistMan->GetUsedVars()); // provide the list of required variables so that VarManager knows what to fill + VarManager::SetUseVars(fHistMan->GetUsedVars()); // provide the list of required variables so that VarManager knows what to fill fOutputList.setObject(fHistMan->GetMainHistogramList()); } @@ -755,13 +759,13 @@ struct AnalysisMuonSelection { Produces muonAmbiguities; OutputObj fOutputList{"output"}; - Configurable fConfigCuts{"cfgMuonCuts", "muonQualityCuts", "Comma separated list of muon cuts"}; + Configurable fConfigCuts{"cfgMuonCuts", "muonQualityCuts", "Comma separated list of muon cuts"}; Configurable fConfigCutsJSON{"cfgMuonCutsJSON", "", "Additional list of muon cuts in JSON format"}; Configurable fConfigQA{"cfgQA", false, "If true, fill QA histograms"}; Configurable fConfigAddMuonHistogram{"cfgAddMuonHistogram", "", "Comma separated list of histograms"}; Configurable fConfigAddJSONHistograms{"cfgAddJSONHistograms", "", "Histograms in JSON format"}; Configurable fConfigPublishAmbiguity{"cfgPublishAmbiguity", true, "If true, publish ambiguity table and fill QA histograms"}; - Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; Configurable fConfigNoLaterThan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; Configurable fConfigGeoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; @@ -856,9 +860,9 @@ struct AnalysisMuonSelection { histClasses += "Muon_AmbiguityInBunch;Muon_AmbiguityOutOfBunch;"; } - DefineHistograms(fHistMan, histClasses.Data(), fConfigAddMuonHistogram.value.data()); // define all histograms + DefineHistograms(fHistMan, histClasses.Data(), fConfigAddMuonHistogram.value.data()); // define all histograms dqhistograms::AddHistogramsFromJSON(fHistMan, fConfigAddJSONHistograms.value.c_str()); // ad-hoc histograms via JSON - VarManager::SetUseVars(fHistMan->GetUsedVars()); // provide the list of required variables so that VarManager knows what to fill + VarManager::SetUseVars(fHistMan->GetUsedVars()); // provide the list of required variables so that VarManager knows what to fill fOutputList.setObject(fHistMan->GetMainHistogramList()); } @@ -1260,9 +1264,9 @@ struct AnalysisSameEventPairing { OutputObj fOutputList{"output"}; struct : ConfigurableGroup { - Configurable track{"cfgTrackCuts", "jpsiO2MCdebugCuts2", "Comma separated list of barrel track cuts"}; - Configurable muon{"cfgMuonCuts", "", "Comma separated list of muon cuts"}; - Configurable pair{"cfgPairCuts", "", "Comma separated list of pair cuts, !!! Use only if you know what you are doing, otherwise leave empty"}; + Configurable track{"cfgTrackCuts", "jpsiO2MCdebugCuts2", "Comma separated list of barrel track cuts"}; + Configurable muon{"cfgMuonCuts", "", "Comma separated list of muon cuts"}; + Configurable pair{"cfgPairCuts", "", "Comma separated list of pair cuts, !!! Use only if you know what you are doing, otherwise leave empty"}; // TODO: Add pair cuts via JSON } fConfigCuts; @@ -1271,7 +1275,7 @@ struct AnalysisSameEventPairing { Configurable fConfigAddJSONHistograms{"cfgAddJSONHistograms", "", "Histograms in JSON format"}; struct : ConfigurableGroup { - Configurable url{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable url{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable grpMagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; Configurable lutPath{"lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"}; Configurable geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; @@ -1638,9 +1642,9 @@ struct AnalysisSameEventPairing { VarManager::SetCollisionSystem((TString)fConfigOptions.collisionSystem, fConfigOptions.centerMassEnergy); // set collision system and center of mass energy - DefineHistograms(fHistMan, histNames.Data(), fConfigAddSEPHistogram.value.data()); // define all histograms + DefineHistograms(fHistMan, histNames.Data(), fConfigAddSEPHistogram.value.data()); // define all histograms dqhistograms::AddHistogramsFromJSON(fHistMan, fConfigAddJSONHistograms.value.c_str()); // ad-hoc histograms via JSON - VarManager::SetUseVars(fHistMan->GetUsedVars()); // provide the list of required variables so that VarManager knows what to fill + VarManager::SetUseVars(fHistMan->GetUsedVars()); // provide the list of required variables so that VarManager knows what to fill fOutputList.setObject(fHistMan->GetMainHistogramList()); } @@ -2240,13 +2244,13 @@ struct AnalysisAsymmetricPairing { OutputObj fOutputList{"output"}; // Configurables - Configurable fConfigLegCuts{"cfgLegCuts", "", ":[:],[:[:],...]"}; + Configurable fConfigLegCuts{"cfgLegCuts", "", ":[:],[:[:],...]"}; Configurable fConfigLegAFilterMask{"cfgLegAFilterMask", 0, "Filter mask corresponding to cuts in event-selection"}; Configurable fConfigLegBFilterMask{"cfgLegBFilterMask", 0, "Filter mask corresponding to cuts in event-selection"}; Configurable fConfigLegCFilterMask{"cfgLegCFilterMask", 0, "Filter mask corresponding to cuts in event-selection"}; - Configurable fConfigCommonTrackCuts{"cfgCommonTrackCuts", "", "Comma separated list of cuts to be applied to all legs"}; - Configurable fConfigPairCuts{"cfgPairCuts", "", "Comma separated list of pair cuts"}; - Configurable fConfigPairCutsJSON{"cfgPairCutsJSON", "", "Additional list of pair cuts in JSON format"}; + Configurable fConfigCommonTrackCuts{"cfgCommonTrackCuts", "", "Comma separated list of cuts to be applied to all legs"}; + Configurable fConfigPairCuts{"cfgPairCuts", "", "Comma separated list of pair cuts"}; + Configurable fConfigPairCutsJSON{"cfgPairCutsJSON", "", "Additional list of pair cuts in JSON format"}; Configurable fConfigSkipAmbiguousIdCombinations{"cfgSkipAmbiguousIdCombinations", true, "Choose whether to skip pairs/triples which pass a stricter combination of cuts, e.g. KKPi triplets for D+ -> KPiPi"}; Configurable fConfigHistogramSubgroups{"cfgAsymmetricPairingHistogramsSubgroups", "barrel,vertexing", "Comma separated list of asymmetric-pairing histogram subgroups"}; @@ -2256,7 +2260,7 @@ struct AnalysisAsymmetricPairing { Configurable fConfigQA{"cfgQA", false, "If true, fill QA histograms"}; Configurable fConfigAddJSONHistograms{"cfgAddJSONHistograms", "", "Histograms in JSON format"}; - Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable fConfigGRPMagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; Configurable fConfigUseRemoteField{"cfgUseRemoteField", false, "Choose whether to fetch the magnetic field from ccdb or set it manually"}; Configurable fConfigMagField{"cfgMagField", 5.0f, "Manually set magnetic field"}; @@ -2660,7 +2664,7 @@ struct AnalysisAsymmetricPairing { VarManager::SetupMatLUTFwdDCAFitter(fLUT); dqhistograms::AddHistogramsFromJSON(fHistMan, fConfigAddJSONHistograms.value.c_str()); // ad-hoc histograms via JSON - VarManager::SetUseVars(fHistMan->GetUsedVars()); // provide the list of required variables so that VarManager knows what to fill + VarManager::SetUseVars(fHistMan->GetUsedVars()); // provide the list of required variables so that VarManager knows what to fill fOutputList.setObject(fHistMan->GetMainHistogramList()); } @@ -2820,7 +2824,7 @@ struct AnalysisAsymmetricPairing { for (int icut = 0; icut < fNLegCuts; icut++) { if (twoTrackFilter & (static_cast(1) << icut)) { isAmbi = (twoTrackFilter & (static_cast(1) << 30)) || (twoTrackFilter & (static_cast(1) << 31)); - if (sign1 * sign2 < 0) { // +- pairs + if (sign1 * sign2 < 0) { // +- pairs fHistMan->FillHistClass(Form("PairsBarrelSEPM_%s", fLegCutNames[icut].Data()), VarManager::fgValues); // reconstructed, unmatched if (isAmbi && fConfigQA) { fHistMan->FillHistClass(Form("PairsBarrelSEPM_ambiguous_%s", fLegCutNames[icut].Data()), VarManager::fgValues); @@ -3239,7 +3243,7 @@ struct AnalysisDileptonTrack { Produces BmesonsTable; OutputObj fOutputList{"output"}; - Configurable fConfigTrackCuts{"cfgTrackCuts", "kaonPID", "Comma separated list of track cuts to be correlated with the dileptons"}; + Configurable fConfigTrackCuts{"cfgTrackCuts", "kaonPID", "Comma separated list of track cuts to be correlated with the dileptons"}; Configurable fConfigDileptonLowMass{"cfgDileptonLowMass", 2.8, "Low mass cut for the dileptons used in analysis"}; Configurable fConfigDileptonHighMass{"cfgDileptonHighMass", 3.2, "High mass cut for the dileptons used in analysis"}; Configurable fConfigDileptonpTCut{"cfgDileptonpTCut", 0.0, "pT cut for dileptons used in the triplet vertexing"}; diff --git a/PWGDQ/Tasks/filterPP.cxx b/PWGDQ/Tasks/filterPP.cxx index c9239f8366d..4f3527f07ca 100644 --- a/PWGDQ/Tasks/filterPP.cxx +++ b/PWGDQ/Tasks/filterPP.cxx @@ -11,35 +11,39 @@ // // Contact: iarsene@cern.ch, i.c.arsene@fys.uio.no // -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/DataTypes.h" -#include "Framework/runDataProcessing.h" -#include "CCDB/BasicCCDBManager.h" -#include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/Centrality.h" +#include "PWGDQ/Core/AnalysisCompositeCut.h" +#include "PWGDQ/Core/AnalysisCut.h" +#include "PWGDQ/Core/CutsLibrary.h" +#include "PWGDQ/Core/HistogramManager.h" +#include "PWGDQ/Core/HistogramsLibrary.h" +#include "PWGDQ/Core/VarManager.h" +#include "PWGDQ/DataModel/ReducedInfoTables.h" + #include "Common/CCDB/TriggerAliases.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/TrackSelectionTables.h" #include "EventFiltering/filterTables.h" -#include "PWGDQ/DataModel/ReducedInfoTables.h" -#include "PWGDQ/Core/VarManager.h" -#include "PWGDQ/Core/HistogramManager.h" -#include "PWGDQ/Core/AnalysisCut.h" -#include "PWGDQ/Core/AnalysisCompositeCut.h" -#include "PWGDQ/Core/HistogramsLibrary.h" -#include "PWGDQ/Core/CutsLibrary.h" + +#include "CCDB/BasicCCDBManager.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/DataTypes.h" +#include "Framework/runDataProcessing.h" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include using std::cout; using std::endl; @@ -179,8 +183,8 @@ struct DQBarrelTrackSelection { Configurable fConfigCuts{"cfgBarrelTrackCuts", "jpsiPID1", "Comma separated list of barrel track cuts"}; Configurable fConfigQA{"cfgWithQA", false, "If true, fill QA histograms"}; - Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Configurable fConfigCcdbPathTPC{"ccdb-path-tpc", "Users/i/iarsene/Calib/TPCpostCalib", "base path to the ccdb object"}; + Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable fConfigCcdbPathTPC{"ccdb-path-tpc", "Users/i/iarsene/Calib/TPCpostCalib", "base path to the ccdb object"}; Configurable fConfigNoLaterThan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; Configurable fConfigComputeTPCpostCalib{"cfgTPCpostCalib", false, "If true, compute TPC post-calibrated n-sigmas"}; diff --git a/PWGDQ/Tasks/filterPPwithAssociation.cxx b/PWGDQ/Tasks/filterPPwithAssociation.cxx index 532482e641b..90d1e4942b4 100644 --- a/PWGDQ/Tasks/filterPPwithAssociation.cxx +++ b/PWGDQ/Tasks/filterPPwithAssociation.cxx @@ -11,44 +11,48 @@ // // Contact: iarsene@cern.ch, i.c.arsene@fys.uio.no // -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/DataTypes.h" -#include "Framework/runDataProcessing.h" -#include "CCDB/BasicCCDBManager.h" -#include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/Centrality.h" +#include "PWGDQ/Core/AnalysisCompositeCut.h" +#include "PWGDQ/Core/AnalysisCut.h" +#include "PWGDQ/Core/CutsLibrary.h" +#include "PWGDQ/Core/HistogramManager.h" +#include "PWGDQ/Core/HistogramsLibrary.h" +#include "PWGDQ/Core/VarManager.h" +#include "PWGDQ/DataModel/ReducedInfoTables.h" + #include "Common/CCDB/TriggerAliases.h" +#include "Common/Core/CollisionAssociation.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/CollisionAssociationTables.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/TrackSelectionTables.h" #include "EventFiltering/filterTables.h" -#include "PWGDQ/DataModel/ReducedInfoTables.h" -#include "PWGDQ/Core/VarManager.h" -#include "PWGDQ/Core/HistogramManager.h" -#include "PWGDQ/Core/AnalysisCut.h" -#include "PWGDQ/Core/AnalysisCompositeCut.h" -#include "PWGDQ/Core/HistogramsLibrary.h" -#include "PWGDQ/Core/CutsLibrary.h" + +#include "CCDB/BasicCCDBManager.h" #include "CommonConstants/LHCConstants.h" -#include "Common/Core/CollisionAssociation.h" -#include "Common/DataModel/CollisionAssociationTables.h" #include "DataFormatsParameters/GRPMagField.h" #include "DataFormatsParameters/GRPObject.h" +#include "DetectorsBase/GeometryManager.h" +#include "DetectorsBase/Propagator.h" #include "Field/MagneticField.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/DataTypes.h" +#include "Framework/runDataProcessing.h" + #include "TGeoGlobalMagField.h" -#include "DetectorsBase/Propagator.h" -#include "DetectorsBase/GeometryManager.h" +#include +#include +#include + +#include +#include +#include +#include +#include +#include using std::cout; using std::endl; @@ -83,9 +87,9 @@ DECLARE_SOA_COLUMN(IsDQBarrelSelected, isDQBarrelSelected, uint32_t); DECLARE_SOA_COLUMN(IsDQMuonSelected, isDQMuonSelected, uint32_t); DECLARE_SOA_COLUMN(IsDQEMuBarrelSelected, isDQEMuBarrelSelected, uint32_t); // for electron-muon pair DECLARE_SOA_COLUMN(IsDQEMuMuonSelected, isDQEMuMuonSelected, uint32_t); // for electron-muon pair -DECLARE_SOA_INDEX_COLUMN(Collision, collision); //! Collision index -DECLARE_SOA_INDEX_COLUMN(Track, track); //! Track index -DECLARE_SOA_INDEX_COLUMN(FwdTrack, fwdtrack); //! FwdTrack index +DECLARE_SOA_INDEX_COLUMN(Collision, collision); //! Collision index +DECLARE_SOA_INDEX_COLUMN(Track, track); //! Track index +DECLARE_SOA_INDEX_COLUMN(FwdTrack, fwdtrack); //! FwdTrack index } // namespace dqppfilter DECLARE_SOA_TABLE(DQEventCuts, "AOD", "DQEVENTCUTS", dqppfilter::IsDQEventSelected); @@ -160,7 +164,7 @@ struct DQEventSelectionTask { fHistMan->SetDefaultVarNames(VarManager::fgVariableNames, VarManager::fgVariableUnits); DefineHistograms(fHistMan, "Event_BeforeCuts;Event_AfterCuts;", fConfigHistClasses.value); // define all histograms - VarManager::SetUseVars(fHistMan->GetUsedVars()); // provide the list of required variables so that VarManager knows what to fill + VarManager::SetUseVars(fHistMan->GetUsedVars()); // provide the list of required variables so that VarManager knows what to fill fOutputList.setObject(fHistMan->GetMainHistogramList()); } } @@ -210,8 +214,8 @@ struct DQBarrelTrackSelection { Configurable fConfigQA{"cfgWithQA", false, "If true, fill QA histograms"}; Configurable fConfigHistClasses{"cfgHistClasses", "its,tpcpid,dca", "If true, fill QA histograms"}; Configurable fPropTrack{"cfgPropTrack", true, "Propgate tracks to associated collision to recalculate DCA and momentum vector"}; - Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Configurable fConfigCcdbPathTPC{"ccdb-path-tpc", "Users/i/iarsene/Calib/TPCpostCalib", "base path to the ccdb object"}; + Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable fConfigCcdbPathTPC{"ccdb-path-tpc", "Users/i/iarsene/Calib/TPCpostCalib", "base path to the ccdb object"}; Configurable fConfigNoLaterThan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; Configurable fConfigComputeTPCpostCalib{"cfgTPCpostCalib", false, "If true, compute TPC post-calibrated n-sigmas"}; @@ -266,7 +270,7 @@ struct DQBarrelTrackSelection { } DefineHistograms(fHistMan, cutNames.Data(), fConfigHistClasses.value); // define all histograms - VarManager::SetUseVars(fHistMan->GetUsedVars()); // provide the list of required variables so that VarManager knows what to fill + VarManager::SetUseVars(fHistMan->GetUsedVars()); // provide the list of required variables so that VarManager knows what to fill fOutputList.setObject(fHistMan->GetMainHistogramList()); // CCDB configuration @@ -384,7 +388,7 @@ struct DQMuonsSelection { Configurable fConfigQA{"cfgWithQA", false, "If true, fill QA histograms"}; Configurable fConfigHistClasses{"cfgHistClasses", "muon", "If true, fill QA histograms"}; Configurable fPropMuon{"cfgPropMuon", false, "Propgate muon tracks through absorber"}; - Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; @@ -441,7 +445,7 @@ struct DQMuonsSelection { } DefineHistograms(fHistMan, cutNames.Data(), fConfigHistClasses.value); // define all histograms - VarManager::SetUseVars(fHistMan->GetUsedVars()); // provide the list of required variables so that VarManager knows what to fill + VarManager::SetUseVars(fHistMan->GetUsedVars()); // provide the list of required variables so that VarManager knows what to fill fOutputList.setObject(fHistMan->GetMainHistogramList()); } } @@ -530,7 +534,7 @@ struct DQFilterPPTask { Configurable fConfigFilterLsMuonsPairs{"cfgWithMuonLS", "false", "Comma separated list of booleans for each trigger, If true, also select like sign (--/++) muon pairs"}; Configurable fConfigFilterLsElectronMuonsPairs{"cfgWithElectronMuonLS", "false", "Comma separated list of booleans for each trigger, If true, also select like sign (--/++) muon pairs"}; Configurable fPropMuon{"cfgPropMuon", false, "Propgate muon tracks through absorber"}; - Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; @@ -539,21 +543,21 @@ struct DQFilterPPTask { int fCurrentRun; // needed to detect if the run changed and trigger update of calibrations etc. - int fNBarrelCuts; // number of barrel selections - int fNMuonCuts; // number of muon selections - int fNElectronMuonCuts; // number of electron-muon selections - std::vector fBarrelRunPairing; // bit map on whether the selections require pairing (barrel) - std::vector fMuonRunPairing; // bit map on whether the selections require pairing (muon) - std::vector fElectronMuonRunPairing; // bit map on whether the selections require pairing (e-mu) - std::vector fBarrelNreqObjs; // minimal number of tracks/pairs required (barrel) - std::vector fMuonNreqObjs; // minimal number of tracks/pairs required (muon) - std::vector fElectronMuonNreqObjs; // minimal number of electron-muon pairs required - std::map fBarrelPairCuts; // map of barrel pair cuts - std::map fMuonPairCuts; // map of muon pair cuts + int fNBarrelCuts; // number of barrel selections + int fNMuonCuts; // number of muon selections + int fNElectronMuonCuts; // number of electron-muon selections + std::vector fBarrelRunPairing; // bit map on whether the selections require pairing (barrel) + std::vector fMuonRunPairing; // bit map on whether the selections require pairing (muon) + std::vector fElectronMuonRunPairing; // bit map on whether the selections require pairing (e-mu) + std::vector fBarrelNreqObjs; // minimal number of tracks/pairs required (barrel) + std::vector fMuonNreqObjs; // minimal number of tracks/pairs required (muon) + std::vector fElectronMuonNreqObjs; // minimal number of electron-muon pairs required + std::map fBarrelPairCuts; // map of barrel pair cuts + std::map fMuonPairCuts; // map of muon pair cuts std::map fElectronMuonPairCuts; // map of electron-muon pair cuts - std::map fBarrelPairHistNames; // map with names of the barrel pairing histogram directories - std::map fMuonPairHistNames; // map with names of the muon pairing histogram directories - std::map fElectronMuonPairHistNames; // map with names of the electron-muon pairing histogram directories + std::map fBarrelPairHistNames; // map with names of the barrel pairing histogram directories + std::map fMuonPairHistNames; // map with names of the muon pairing histogram directories + std::map fElectronMuonPairHistNames; // map with names of the electron-muon pairing histogram directories std::map fFiltersMap; // map of filters for events that passed at least one filter std::map> fCEFPfilters; // map of CEFP filters for events that passed at least one filter @@ -771,7 +775,7 @@ struct DQFilterPPTask { if (objCountersBarrel[i] > 1) { // pairing has to be enabled and at least two tracks are needed pairingMask |= (static_cast(1) << i); } - objCountersBarrel[i] = 0; // reset counters for selections where pairing is needed (count pairs instead) + objCountersBarrel[i] = 0; // reset counters for selections where pairing is needed (count pairs instead) taggedCollisions[i].clear(); // empty the list of tagged collisions if pairing is needed (so we count just events with pairs or containing selected pair legs) } } @@ -848,7 +852,7 @@ struct DQFilterPPTask { if (objCountersMuon[i] > 1) { pairingMask |= (static_cast(1) << i); } - objCountersMuon[i] = 0; // reset counters for selections where pairing is needed (count pairs instead) + objCountersMuon[i] = 0; // reset counters for selections where pairing is needed (count pairs instead) taggedCollisions[i + fNBarrelCuts].clear(); // empty the list of tagged collisions if pairing is needed (so we count just events with pairs or containing selected pair legs) } } diff --git a/PWGDQ/Tasks/mchAlignRecord.cxx b/PWGDQ/Tasks/mchAlignRecord.cxx index 2f612493b6e..c3dbce0865f 100644 --- a/PWGDQ/Tasks/mchAlignRecord.cxx +++ b/PWGDQ/Tasks/mchAlignRecord.cxx @@ -14,63 +14,61 @@ /// /// \author Chi ZHANG, CEA-Saclay, chi.zhang@cern.ch -#include -#include -#include -#include -#include -#include -#include +#include "PWGDQ/Core/VarManager.h" + +#include "Common/DataModel/EventSelection.h" +#include "CCDB/BasicCCDBManager.h" +#include "CommonConstants/LHCConstants.h" +#include "CommonUtils/NameConf.h" +#include "DataFormatsMCH/Cluster.h" +#include "DataFormatsMCH/TrackMCH.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "DataFormatsParameters/GRPObject.h" +#include "DetectorsBase/GRPGeomHelper.h" +#include "DetectorsBase/GeometryManager.h" +#include "DetectorsBase/Propagator.h" +#include "DetectorsCommonDataFormats/AlignParam.h" +#include "DetectorsCommonDataFormats/DetID.h" +#include "DetectorsCommonDataFormats/DetectorNameConf.h" #include "Framework/AnalysisTask.h" +#include "Framework/CallbackService.h" +#include "Framework/Logger.h" #include "Framework/runDataProcessing.h" +#include "MCHAlign/Aligner.h" +#include "MCHBase/TrackerParam.h" +#include "MCHGeometryTransformer/Transformations.h" +#include "MCHTracking/Track.h" +#include "MCHTracking/TrackExtrap.h" +#include "MCHTracking/TrackFitter.h" +#include "MCHTracking/TrackParam.h" +#include "ReconstructionDataFormats/TrackMCHMID.h" #include +#include #include #include #include +#include +#include #include #include #include +#include #include #include #include #include #include #include -#include -#include -#include -#include -#include - -#include "CommonConstants/LHCConstants.h" -#include "CommonUtils/NameConf.h" -#include "Common/DataModel/EventSelection.h" -#include "PWGDQ/Core/VarManager.h" -#include "DataFormatsParameters/GRPObject.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "DetectorsBase/GeometryManager.h" -#include "DetectorsBase/GRPGeomHelper.h" -#include "DetectorsBase/Propagator.h" -#include "Framework/Logger.h" -#include "Framework/CallbackService.h" -#include "CCDB/BasicCCDBManager.h" - -#include "MCHGeometryTransformer/Transformations.h" -#include "DataFormatsMCH/Cluster.h" -#include "DataFormatsMCH/TrackMCH.h" -#include "MCHTracking/Track.h" -#include "MCHTracking/TrackExtrap.h" -#include "MCHTracking/TrackParam.h" -#include "MCHTracking/TrackFitter.h" -#include "MCHBase/TrackerParam.h" -#include "ReconstructionDataFormats/TrackMCHMID.h" -#include "MCHAlign/Aligner.h" -#include "DetectorsCommonDataFormats/AlignParam.h" -#include "DetectorsCommonDataFormats/DetID.h" -#include "DetectorsCommonDataFormats/DetectorNameConf.h" +#include +#include +#include +#include +#include +#include +#include using namespace o2; using namespace o2::framework; @@ -105,13 +103,13 @@ struct mchAlignRecordTask { map transformNew; mch::geo::TransformationCreator transformation; - Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Configurable geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; - Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; - Configurable fFixChamber{"fix-chamber", "", "Fixing chamber"}; + Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; + Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; + Configurable fFixChamber{"fix-chamber", "", "Fixing chamber"}; Configurable fDoNewGeo{"do-realign", false, "Transform to a given new geometry"}; Configurable fDoEvaluation{"do-evaluation", false, "Enable storage of residuals"}; - Configurable fConfigNewGeoFile{"new-geo", "o2sim_geometry-aligned.root", "New geometry for transformation"}; + Configurable fConfigNewGeoFile{"new-geo", "o2sim_geometry-aligned.root", "New geometry for transformation"}; Configurable fAllowedVarX{"variation-x", 2.0, "Allowed variation for x axis in cm"}; Configurable fAllowedVarY{"variation-y", 0.3, "Allowed variation for y axis in cm"}; Configurable fAllowedVarPhi{"variation-phi", 0.002, "Allowed variation for phi axis in rad"}; diff --git a/PWGDQ/Tasks/muonDCA.cxx b/PWGDQ/Tasks/muonDCA.cxx index b2031418d5c..897ed273322 100644 --- a/PWGDQ/Tasks/muonDCA.cxx +++ b/PWGDQ/Tasks/muonDCA.cxx @@ -13,14 +13,15 @@ /// \brief Task to compute and evaluate DCA quantities /// \author Nicolas Bizé , SUBATECH // -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/ASoAHelpers.h" -#include "GlobalTracking/MatchGlobalFwd.h" +#include "PWGDQ/Core/VarManager.h" +#include "PWGDQ/DataModel/ReducedInfoTables.h" + #include "CCDB/BasicCCDBManager.h" #include "DataFormatsParameters/GRPMagField.h" -#include "PWGDQ/DataModel/ReducedInfoTables.h" -#include "PWGDQ/Core/VarManager.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" +#include "GlobalTracking/MatchGlobalFwd.h" using namespace o2; using namespace o2::framework; @@ -44,7 +45,7 @@ struct muonExtrap { Produces dcaTable; Configurable geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; - Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Service fCCDB; o2::parameters::GRPMagField* grpmag = nullptr; // for run 3, we access GRPMagField from GLO/Config/GRPMagField diff --git a/PWGDQ/Tasks/tableReader.cxx b/PWGDQ/Tasks/tableReader.cxx index ece46047109..888be5a6d67 100644 --- a/PWGDQ/Tasks/tableReader.cxx +++ b/PWGDQ/Tasks/tableReader.cxx @@ -11,39 +11,43 @@ // // Contact: iarsene@cern.ch, i.c.arsene@fys.uio.no // -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "CCDB/BasicCCDBManager.h" -#include "DataFormatsParameters/GRPObject.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" -#include "PWGDQ/DataModel/ReducedInfoTables.h" -#include "PWGDQ/Core/VarManager.h" -#include "PWGDQ/Core/HistogramManager.h" -#include "PWGDQ/Core/MixingHandler.h" -#include "PWGDQ/Core/AnalysisCut.h" #include "PWGDQ/Core/AnalysisCompositeCut.h" -#include "PWGDQ/Core/HistogramsLibrary.h" +#include "PWGDQ/Core/AnalysisCut.h" #include "PWGDQ/Core/CutsLibrary.h" +#include "PWGDQ/Core/HistogramManager.h" +#include "PWGDQ/Core/HistogramsLibrary.h" +#include "PWGDQ/Core/MixingHandler.h" #include "PWGDQ/Core/MixingLibrary.h" +#include "PWGDQ/Core/VarManager.h" +#include "PWGDQ/DataModel/ReducedInfoTables.h" + +#include "Common/CCDB/EventSelectionParams.h" + +#include "CCDB/BasicCCDBManager.h" #include "DataFormatsParameters/GRPMagField.h" -#include "Field/MagneticField.h" -#include "TGeoGlobalMagField.h" -#include "DetectorsBase/Propagator.h" +#include "DataFormatsParameters/GRPObject.h" #include "DetectorsBase/GeometryManager.h" +#include "DetectorsBase/Propagator.h" +#include "Field/MagneticField.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" #include "ITSMFTBase/DPLAlpideParam.h" -#include "Common/CCDB/EventSelectionParams.h" + +#include "TGeoGlobalMagField.h" +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include using std::cout; using std::endl; @@ -157,14 +161,14 @@ struct AnalysisEventSelection { Produces hash; OutputObj fOutputList{"output"}; // TODO: Provide the mixing variables and binning directly via configurables (e.g. vectors of float) - Configurable fConfigMixingVariables{"cfgMixingVars", "", "Mixing configs separated by a comma, default no mixing"}; - Configurable fConfigEventCuts{"cfgEventCuts", "eventStandard", "Event selection"}; + Configurable fConfigMixingVariables{"cfgMixingVars", "", "Mixing configs separated by a comma, default no mixing"}; + Configurable fConfigEventCuts{"cfgEventCuts", "eventStandard", "Event selection"}; Configurable fConfigQA{"cfgQA", false, "If true, fill QA histograms"}; Configurable fConfigRunZorro{"cfgRunZorro", false, "Enable event selection with zorro [WARNING: under debug, do not enable!]"}; Configurable fConfigITSROFrameStartBorderMargin{"ITSROFrameStartBorderMargin", -1, "Number of bcs at the start of ITS RO Frame border. Take from CCDB if -1"}; Configurable fConfigITSROFrameEndBorderMargin{"ITSROFrameEndBorderMargin", -1, "Number of bcs at the end of ITS RO Frame border. Take from CCDB if -1"}; Configurable fConfigAddEventHistogram{"cfgAddEventHistogram", "", "Comma separated list of histograms"}; - Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; HistogramManager* fHistMan = nullptr; MixingHandler* fMixHandler = nullptr; @@ -318,12 +322,12 @@ struct AnalysisTrackSelection { // for candidate electron selection (+ eventual prefilter cuts) and other needs like quarkonium - hadron correlations // The user must ensure using them properly in the tasks downstream // NOTE: For now, the candidate electron cuts must be provided first, then followed by any other needed selections - Configurable fConfigCuts{"cfgTrackCuts", "jpsiO2MCdebugCuts2", "Comma separated list of barrel track cuts"}; + Configurable fConfigCuts{"cfgTrackCuts", "jpsiO2MCdebugCuts2", "Comma separated list of barrel track cuts"}; Configurable fConfigQA{"cfgQA", false, "If true, fill QA histograms"}; - Configurable fConfigAddTrackHistogram{"cfgAddTrackHistogram", "", "Comma separated list of histograms"}; + Configurable fConfigAddTrackHistogram{"cfgAddTrackHistogram", "", "Comma separated list of histograms"}; Configurable fConfigPrefilterCutId{"cfgPrefilterCutId", 32, "Id of the Prefilter track cut (starting at 0)"}; // In order to create another column prefilter (should be temporary before improving cut selection in configurables, then displaced to AnalysisPrefilterSelection) - Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Configurable fConfigCcdbPathTPC{"ccdb-path-tpc", "Users/z/zhxiong/TPCPID/PostCalib", "base path to the ccdb object"}; + Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable fConfigCcdbPathTPC{"ccdb-path-tpc", "Users/z/zhxiong/TPCPID/PostCalib", "base path to the ccdb object"}; Configurable fConfigNoLaterThan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; Configurable fConfigComputeTPCpostCalib{"cfgTPCpostCalib", false, "If true, compute TPC post-calibrated n-sigmas"}; Configurable fConfigRunPeriods{"cfgRunPeriods", "LHC22f", "run periods for used data"}; @@ -453,7 +457,7 @@ struct AnalysisTrackSelection { struct AnalysisMuonSelection { Produces muonSel; OutputObj fOutputList{"output"}; - Configurable fConfigCuts{"cfgMuonCuts", "muonQualityCuts", "Comma separated list of muon cuts"}; + Configurable fConfigCuts{"cfgMuonCuts", "muonQualityCuts", "Comma separated list of muon cuts"}; Configurable fConfigQA{"cfgQA", false, "If true, fill QA histograms"}; Configurable fConfigAddMuonHistogram{"cfgAddMuonHistogram", "", "Comma separated list of histograms"}; @@ -673,14 +677,14 @@ struct AnalysisEventMixing { // single particle selection tasks to preserve the correspondence between the track cut name and its // bit position in the cuts bitmap // TODO: Create a configurable to specify exactly on which of the bits one should run the event mixing - Configurable fConfigTrackCuts{"cfgTrackCuts", "", "Comma separated list of barrel track cuts"}; - Configurable fConfigMuonCuts{"cfgMuonCuts", "", "Comma separated list of muon cuts"}; + Configurable fConfigTrackCuts{"cfgTrackCuts", "", "Comma separated list of barrel track cuts"}; + Configurable fConfigMuonCuts{"cfgMuonCuts", "", "Comma separated list of muon cuts"}; Configurable fConfigMixingDepth{"cfgMixingDepth", 100, "Number of Events stored for event mixing"}; Configurable fConfigAddEventMixingHistogram{"cfgAddEventMixingHistogram", "", "Comma separated list of histograms"}; Configurable ccdburl{"ccdburl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; Configurable fConfigAmbiguousHist{"cfgAmbiHist", false, "Enable Ambiguous histograms for time association studies"}; - Configurable ccdbPathFlow{"ccdb-path-flow", "Users/c/chizh/FlowResolution", "path to the ccdb object for flow resolution factors"}; + Configurable ccdbPathFlow{"ccdb-path-flow", "Users/c/chizh/FlowResolution", "path to the ccdb object for flow resolution factors"}; Configurable fConfigFlowReso{"cfgFlowReso", false, "Enable loading of flow resolution factors from CCDB"}; Configurable fConfigSingleMuCumulants{"cfgSingleMuCumulants", false, "Enable loading of flow resolution factors from CCDB"}; Configurable fConfigAddJSONHistograms{"cfgAddJSONHistograms", "", "Histograms in JSON format"}; @@ -1023,12 +1027,12 @@ struct AnalysisSameEventPairing { int fCurrentRun; // needed to detect if the run changed and trigger update of calibrations etc. OutputObj fOutputList{"output"}; - Configurable fConfigTrackCuts{"cfgTrackCuts", "jpsiO2MCdebugCuts2", "Comma separated list of barrel track cuts"}; - Configurable fConfigMuonCuts{"cfgMuonCuts", "", "Comma separated list of muon cuts"}; - Configurable fConfigPairCuts{"cfgPairCuts", "", "Comma separated list of pair cuts"}; - Configurable url{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Configurable ccdbPath{"ccdb-path", "Users/lm", "base path to the ccdb object"}; - Configurable ccdbPathFlow{"ccdb-path-flow", "Users/c/chizh/FlowResolution", "path to the ccdb object for flow resolution factors"}; + Configurable fConfigTrackCuts{"cfgTrackCuts", "jpsiO2MCdebugCuts2", "Comma separated list of barrel track cuts"}; + Configurable fConfigMuonCuts{"cfgMuonCuts", "", "Comma separated list of muon cuts"}; + Configurable fConfigPairCuts{"cfgPairCuts", "", "Comma separated list of pair cuts"}; + Configurable url{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable ccdbPath{"ccdb-path", "Users/lm", "base path to the ccdb object"}; + Configurable ccdbPathFlow{"ccdb-path-flow", "Users/c/chizh/FlowResolution", "path to the ccdb object for flow resolution factors"}; Configurable fConfigFlowReso{"cfgFlowReso", false, "Enable loading of flow resolution factors from CCDB"}; Configurable nolaterthan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; Configurable fConfigAddSEPHistogram{"cfgAddSEPHistogram", "", "Comma separated list of histograms"}; @@ -1738,7 +1742,7 @@ struct AnalysisDileptonHadron { OutputObj fOutputList{"output"}; // TODO: For now this is only used to determine the position in the filter bit map for the hadron cut - Configurable fConfigTrackCuts{"cfgLeptonCuts", "jpsiO2MCdebugCuts2", "Comma separated list of barrel track cuts"}; + Configurable fConfigTrackCuts{"cfgLeptonCuts", "jpsiO2MCdebugCuts2", "Comma separated list of barrel track cuts"}; // comment: add list of subgroups (must define subgroups under ) Configurable fConfigAddDileptonHadHistogram{"cfgAddDileptonHadHistogram", "", "Comma separated list of histograms"}; Configurable fConfigMixingDepth{"cfgMixingDepth", 5, "Event mixing pool depth"}; diff --git a/PWGDQ/Tasks/tableReader_withAssoc.cxx b/PWGDQ/Tasks/tableReader_withAssoc.cxx index 162ff8f86f8..139476d3b71 100644 --- a/PWGDQ/Tasks/tableReader_withAssoc.cxx +++ b/PWGDQ/Tasks/tableReader_withAssoc.cxx @@ -12,51 +12,54 @@ // Contact: iarsene@cern.ch, i.c.arsene@fys.uio.no // Configurable workflow for running several DQ or other PWG analyses +#include "PWGDQ/Core/AnalysisCompositeCut.h" +#include "PWGDQ/Core/AnalysisCut.h" +#include "PWGDQ/Core/CutsLibrary.h" +#include "PWGDQ/Core/HistogramManager.h" +#include "PWGDQ/Core/HistogramsLibrary.h" +#include "PWGDQ/Core/MixingHandler.h" +#include "PWGDQ/Core/MixingLibrary.h" +#include "PWGDQ/Core/VarManager.h" +#include "PWGDQ/DataModel/ReducedInfoTables.h" + +#include "Common/CCDB/EventSelectionParams.h" +#include "Common/Core/TableHelper.h" + +#include "CCDB/BasicCCDBManager.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "DataFormatsParameters/GRPObject.h" +#include "DetectorsBase/GeometryManager.h" +#include "DetectorsBase/Propagator.h" +#include "Field/MagneticField.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/Configurable.h" +#include "Framework/OutputObjHeader.h" +#include "Framework/runDataProcessing.h" +#include "ITSMFTBase/DPLAlpideParam.h" + +#include "TGeoGlobalMagField.h" +#include +#include +#include +#include +#include +#include + +#include #include #include #include #include +#include +#include #include -#include -#include -#include #include -#include #include -#include #include -#include -#include -#include -#include -#include -#include -#include "CCDB/BasicCCDBManager.h" -#include "DataFormatsParameters/GRPObject.h" -#include "Framework/AnalysisHelpers.h" -#include "Framework/Configurable.h" -#include "Framework/OutputObjHeader.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" -#include "PWGDQ/DataModel/ReducedInfoTables.h" -#include "PWGDQ/Core/VarManager.h" -#include "PWGDQ/Core/HistogramManager.h" -#include "PWGDQ/Core/MixingHandler.h" -#include "PWGDQ/Core/AnalysisCut.h" -#include "PWGDQ/Core/AnalysisCompositeCut.h" -#include "PWGDQ/Core/HistogramsLibrary.h" -#include "PWGDQ/Core/CutsLibrary.h" -#include "PWGDQ/Core/MixingLibrary.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "Field/MagneticField.h" -#include "TGeoGlobalMagField.h" -#include "DetectorsBase/Propagator.h" -#include "DetectorsBase/GeometryManager.h" -#include "Common/Core/TableHelper.h" -#include "ITSMFTBase/DPLAlpideParam.h" -#include "Common/CCDB/EventSelectionParams.h" +#include using std::cout; using std::endl; @@ -247,9 +250,9 @@ struct AnalysisEventSelection { OutputObj fOutputList{"output"}; // TODO: Provide the mixing variables and binning directly via configurables (e.g. vectors of float) - Configurable fConfigMixingVariables{"cfgMixingVars", "", "Mixing configs separated by a comma, default no mixing"}; - Configurable fConfigEventCuts{"cfgEventCuts", "eventStandard", "Event selection"}; - Configurable fConfigEventCutsJSON{"cfgEventCutsJSON", "", "Additional event cuts specified in JSON format"}; + Configurable fConfigMixingVariables{"cfgMixingVars", "", "Mixing configs separated by a comma, default no mixing"}; + Configurable fConfigEventCuts{"cfgEventCuts", "eventStandard", "Event selection"}; + Configurable fConfigEventCutsJSON{"cfgEventCutsJSON", "", "Additional event cuts specified in JSON format"}; Configurable fConfigAddEventHistogram{"cfgAddEventHistogram", "", "Comma separated list of histograms"}; Configurable fConfigAddJSONHistograms{"cfgAddJSONHistograms", "", "Add event histograms defined via JSON formatting (see HistogramsLibrary)"}; Configurable fConfigQA{"cfgQA", true, "If true, QA histograms will be created and filled"}; @@ -262,7 +265,7 @@ struct AnalysisEventSelection { Configurable fConfigCheckSplitCollisions{"cfgCheckSplitCollisions", false, "If true, run the split collision check and fill histograms"}; Configurable fConfigRunZorro{"cfgRunZorro", false, "Enable event selection with zorro [WARNING: under debug, do not enable!]"}; - Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable fConfigNoLaterThan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; HistogramManager* fHistMan = nullptr; @@ -542,15 +545,15 @@ struct AnalysisTrackSelection { Produces trackAmbiguities; OutputObj fOutputList{"output"}; - Configurable fConfigCuts{"cfgTrackCuts", "jpsiO2MCdebugCuts2", "Comma separated list of barrel track cuts"}; + Configurable fConfigCuts{"cfgTrackCuts", "jpsiO2MCdebugCuts2", "Comma separated list of barrel track cuts"}; Configurable fConfigCutsJSON{"cfgBarrelTrackCutsJSON", "", "Additional list of barrel track cuts in JSON format"}; - Configurable fConfigAddTrackHistogram{"cfgAddTrackHistogram", "", "Comma separated list of histograms"}; + Configurable fConfigAddTrackHistogram{"cfgAddTrackHistogram", "", "Comma separated list of histograms"}; Configurable fConfigAddJSONHistograms{"cfgAddJSONHistograms", "", "Histograms in JSON format"}; Configurable fConfigQA{"cfgQA", false, "If true, fill QA histograms"}; Configurable fConfigPublishAmbiguity{"cfgPublishAmbiguity", true, "If true, publish ambiguity table and fill QA histograms"}; - Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Configurable fConfigCcdbPathTPC{"ccdb-path-tpc", "Users/z/zhxiong/TPCPID/PostCalib", "base path to the ccdb object"}; + Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable fConfigCcdbPathTPC{"ccdb-path-tpc", "Users/z/zhxiong/TPCPID/PostCalib", "base path to the ccdb object"}; Configurable fConfigNoLaterThan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; Configurable fConfigComputeTPCpostCalib{"cfgTPCpostCalib", false, "If true, compute TPC post-calibrated n-sigmas"}; @@ -794,14 +797,14 @@ struct AnalysisMuonSelection { Produces muonAmbiguities; OutputObj fOutputList{"output"}; - Configurable fConfigCuts{"cfgMuonCuts", "muonQualityCuts", "Comma separated list of muon cuts"}; + Configurable fConfigCuts{"cfgMuonCuts", "muonQualityCuts", "Comma separated list of muon cuts"}; Configurable fConfigCutsJSON{"cfgMuonCutsJSON", "", "Additional list of muon cuts in JSON format"}; Configurable fConfigQA{"cfgQA", false, "If true, fill QA histograms"}; Configurable fConfigAddMuonHistogram{"cfgAddMuonHistogram", "", "Comma separated list of histograms"}; Configurable fConfigAddJSONHistograms{"cfgAddJSONHistograms", "", "Histograms in JSON format"}; Configurable fConfigPublishAmbiguity{"cfgPublishAmbiguity", true, "If true, publish ambiguity table and fill QA histograms"}; - Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; Configurable fConfigNoLaterThan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; Configurable fConfigGeoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; @@ -1207,9 +1210,9 @@ struct AnalysisSameEventPairing { OutputObj fOutputList{"output"}; struct : ConfigurableGroup { - Configurable track{"cfgTrackCuts", "jpsiO2MCdebugCuts2", "Comma separated list of barrel track cuts"}; - Configurable muon{"cfgMuonCuts", "", "Comma separated list of muon cuts"}; - Configurable pair{"cfgPairCuts", "", "Comma separated list of pair cuts"}; + Configurable track{"cfgTrackCuts", "jpsiO2MCdebugCuts2", "Comma separated list of barrel track cuts"}; + Configurable muon{"cfgMuonCuts", "", "Comma separated list of muon cuts"}; + Configurable pair{"cfgPairCuts", "", "Comma separated list of pair cuts"}; Configurable event{"cfgRemoveCollSplittingCandidates", false, "If true, remove collision splitting candidates as determined by the event selection task upstream"}; // TODO: Add pair cuts via JSON } fConfigCuts; @@ -1221,7 +1224,7 @@ struct AnalysisSameEventPairing { Configurable fConfigQA{"cfgQA", true, "If true, fill output histograms"}; struct : ConfigurableGroup { - Configurable url{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable url{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable grpMagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; Configurable lutPath{"lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"}; Configurable geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; @@ -2213,13 +2216,13 @@ struct AnalysisAsymmetricPairing { OutputObj fOutputList{"output"}; // Configurables - Configurable fConfigLegCuts{"cfgLegCuts", "", ":[:],[:[:],...]"}; + Configurable fConfigLegCuts{"cfgLegCuts", "", ":[:],[:[:],...]"}; Configurable fConfigLegAFilterMask{"cfgLegAFilterMask", 0, "Filter mask corresponding to cuts in track-selection"}; Configurable fConfigLegBFilterMask{"cfgLegBFilterMask", 0, "Filter mask corresponding to cuts in track-selection"}; Configurable fConfigLegCFilterMask{"cfgLegCFilterMask", 0, "Filter mask corresponding to cuts in track-selection"}; - Configurable fConfigCommonTrackCuts{"cfgCommonTrackCuts", "", "Comma separated list of cuts to be applied to all legs"}; - Configurable fConfigPairCuts{"cfgPairCuts", "", "Comma separated list of pair cuts"}; - Configurable fConfigPairCutsJSON{"cfgPairCutsJSON", "", "Additional list of pair cuts in JSON format"}; + Configurable fConfigCommonTrackCuts{"cfgCommonTrackCuts", "", "Comma separated list of cuts to be applied to all legs"}; + Configurable fConfigPairCuts{"cfgPairCuts", "", "Comma separated list of pair cuts"}; + Configurable fConfigPairCutsJSON{"cfgPairCutsJSON", "", "Additional list of pair cuts in JSON format"}; Configurable fConfigSkipAmbiguousIdCombinations{"cfgSkipAmbiguousIdCombinations", true, "Choose whether to skip pairs/triples which pass a stricter combination of cuts, e.g. KKPi triplets for D+ -> KPiPi"}; Configurable fConfigHistogramSubgroups{"cfgAsymmetricPairingHistogramsSubgroups", "barrel,vertexing", "Comma separated list of asymmetric-pairing histogram subgroups"}; @@ -2228,7 +2231,7 @@ struct AnalysisAsymmetricPairing { Configurable fConfigReflectedHistograms{"cfgReflectedHistograms", false, "Include separate histograms for pairs which are reflections of previously counted pairs"}; Configurable fConfigAddJSONHistograms{"cfgAddJSONHistograms", "", "Histograms in JSON format"}; - Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable fConfigGRPMagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; Configurable fConfigUseRemoteField{"cfgUseRemoteField", false, "Choose whether to fetch the magnetic field from ccdb or set it manually"}; Configurable fConfigMagField{"cfgMagField", 5.0f, "Manually set magnetic field"}; @@ -2938,7 +2941,7 @@ struct AnalysisDileptonTrack { Produces DileptonTrackTable; OutputObj fOutputList{"output"}; - Configurable fConfigTrackCuts{"cfgTrackCuts", "kaonPID", "Comma separated list of cuts for the track to be correlated with the dileptons"}; + Configurable fConfigTrackCuts{"cfgTrackCuts", "kaonPID", "Comma separated list of cuts for the track to be correlated with the dileptons"}; Configurable fConfigDileptonLowMass{"cfgDileptonLowMass", 2.8, "Low mass cut for the dileptons used in analysis"}; Configurable fConfigDileptonHighMass{"cfgDileptonHighMass", 3.2, "High mass cut for the dileptons used in analysis"}; Configurable fConfigDileptonpTCut{"cfgDileptonpTCut", 0.0, "pT cut for dileptons used in the triplet vertexing"}; @@ -2953,7 +2956,7 @@ struct AnalysisDileptonTrack { Configurable fConfigGRPmagPath{"cfgGrpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; Configurable fConfigMagField{"cfgMagField", 5.0f, "Manually set magnetic field"}; - Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable fConfigNoLaterThan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; Configurable fConfigGeoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; diff --git a/PWGEM/Dilepton/Tasks/emEfficiencyEE.cxx b/PWGEM/Dilepton/Tasks/emEfficiencyEE.cxx index 7cc41a190d2..76b523ec64c 100644 --- a/PWGEM/Dilepton/Tasks/emEfficiencyEE.cxx +++ b/PWGEM/Dilepton/Tasks/emEfficiencyEE.cxx @@ -12,41 +12,45 @@ // // Analysis task for calculating single electron and dielectron efficiency // -#include -#include -#include -#include -#include -#include -#include -#include "CCDB/BasicCCDBManager.h" -#include "DataFormatsParameters/GRPObject.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/ASoA.h" -#include "Framework/DataTypes.h" -#include "Framework/HistogramRegistry.h" -#include "PWGDQ/Core/VarManager.h" -#include "PWGDQ/Core/HistogramManager.h" -#include "PWGDQ/Core/AnalysisCut.h" #include "PWGDQ/Core/AnalysisCompositeCut.h" -#include "PWGDQ/Core/HistogramsLibrary.h" +#include "PWGDQ/Core/AnalysisCut.h" #include "PWGDQ/Core/CutsLibrary.h" +#include "PWGDQ/Core/HistogramManager.h" +#include "PWGDQ/Core/HistogramsLibrary.h" #include "PWGDQ/Core/MCSignal.h" #include "PWGDQ/Core/MCSignalLibrary.h" +#include "PWGDQ/Core/VarManager.h" #include "PWGDQ/DataModel/ReducedInfoTables.h" +#include "PWGEM/Dilepton/DataModel/dileptonTables.h" + +#include "Common/CCDB/TriggerAliases.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/Centrality.h" -#include "Common/CCDB/TriggerAliases.h" + +#include "CCDB/BasicCCDBManager.h" #include "DataFormatsParameters/GRPMagField.h" +#include "DataFormatsParameters/GRPObject.h" #include "Field/MagneticField.h" +#include "Framework/ASoA.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/DataTypes.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/runDataProcessing.h" + #include "TGeoGlobalMagField.h" -#include "PWGEM/Dilepton/DataModel/dileptonTables.h" +#include +#include +#include +#include +#include + +#include +#include using std::cout; using std::endl; @@ -457,7 +461,7 @@ struct AnalysisTrackSelection { ConfigurableAxis deltaphiResBins{"deltaphiResBins", {500, -0.5f, 0.5f}, "DeltaPhi binning for resolution"}; Configurable fConfigQA{"cfgQA", false, "If true, fill QA histograms"}; - Configurable fConfigAddTrackHistogram{"cfgAddTrackHistogram", "", "Comma separated list of histograms"}; + Configurable fConfigAddTrackHistogram{"cfgAddTrackHistogram", "", "Comma separated list of histograms"}; // output lists OutputObj fOutputQA{"SingleElectronQA"}; @@ -1027,8 +1031,8 @@ struct AnalysisTrackSelection { fHistManQA->FillHistClass(fHistNamesMCMatchedQA[j][i].Data(), VarManager::fgValues); } } // end loop over cuts - } // end loop over MC signals - } // end loop over reconstructed track belonging to the events + } // end loop over MC signals + } // end loop over reconstructed track belonging to the events } template @@ -1275,8 +1279,8 @@ struct AnalysisTrackSelection { fHistManQA->FillHistClass(fHistNamesMCMatchedQA[j][i].Data(), VarManager::fgValues); } } // end loop over cuts - } // end loop over MC signals - } // end loop over reconstructed track belonging to the events + } // end loop over MC signals + } // end loop over reconstructed track belonging to the events } void processSkimmed(soa::Filtered const& events, MyBarrelTracks const& tracks, ReducedMCEvents const& eventsMC, ReducedMCTracks const& tracksMC) @@ -1601,7 +1605,7 @@ struct AnalysisSameEventPairing { runRecPair(groupedTracks, tracksMC); } } // end loop over reconstructed event - } // end loop pairing function + } // end loop pairing function template void runMCPairing(TEventMC const& /*eventMC*/, TTracksMC const& tracksMC) @@ -1716,7 +1720,7 @@ struct AnalysisSameEventPairing { } } } // end of true pairing loop - } // end runMCGen + } // end runMCGen template void runRecPair(TTracks const& tracks, TTracksMC const& /*tracksMC*/) diff --git a/PWGEM/Dilepton/Tasks/tableReaderBarrel.cxx b/PWGEM/Dilepton/Tasks/tableReaderBarrel.cxx index 819a85efe65..9787a5bae04 100644 --- a/PWGEM/Dilepton/Tasks/tableReaderBarrel.cxx +++ b/PWGEM/Dilepton/Tasks/tableReaderBarrel.cxx @@ -12,39 +12,43 @@ // Contact: iarsene@cern.ch, i.c.arsene@fys.uio.no // -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "CCDB/BasicCCDBManager.h" -#include "DataFormatsParameters/GRPObject.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" -#include "PWGDQ/DataModel/ReducedInfoTables.h" -#include "PWGDQ/Core/VarManager.h" -#include "PWGDQ/Core/HistogramManager.h" -#include "PWGDQ/Core/MixingHandler.h" -#include "PWGDQ/Core/AnalysisCut.h" #include "PWGDQ/Core/AnalysisCompositeCut.h" -#include "PWGDQ/Core/HistogramsLibrary.h" +#include "PWGDQ/Core/AnalysisCut.h" #include "PWGDQ/Core/CutsLibrary.h" +#include "PWGDQ/Core/HistogramManager.h" +#include "PWGDQ/Core/HistogramsLibrary.h" +#include "PWGDQ/Core/MixingHandler.h" #include "PWGDQ/Core/MixingLibrary.h" +#include "PWGDQ/Core/VarManager.h" +#include "PWGDQ/DataModel/ReducedInfoTables.h" + +#include "Common/CCDB/EventSelectionParams.h" + +#include "CCDB/BasicCCDBManager.h" #include "DataFormatsParameters/GRPMagField.h" -#include "Field/MagneticField.h" -#include "TGeoGlobalMagField.h" -#include "DetectorsBase/Propagator.h" +#include "DataFormatsParameters/GRPObject.h" #include "DetectorsBase/GeometryManager.h" +#include "DetectorsBase/Propagator.h" +#include "Field/MagneticField.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" #include "ITSMFTBase/DPLAlpideParam.h" -#include "Common/CCDB/EventSelectionParams.h" + +#include "TGeoGlobalMagField.h" +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include using std::cout; using std::endl; @@ -123,12 +127,12 @@ struct AnalysisEventSelection { Produces hash; OutputObj fOutputList{"output"}; // TODO: Provide the mixing variables and binning directly via configurables (e.g. vectors of float) - Configurable fConfigMixingVariables{"cfgMixingVars", "", "Mixing configs separated by a comma, default no mixing"}; + Configurable fConfigMixingVariables{"cfgMixingVars", "", "Mixing configs separated by a comma, default no mixing"}; Configurable fConfigQA{"cfgQA", false, "If true, fill QA histograms"}; Configurable fConfigITSROFrameStartBorderMargin{"ITSROFrameStartBorderMargin", -1, "Number of bcs at the start of ITS RO Frame border. Take from CCDB if -1"}; Configurable fConfigITSROFrameEndBorderMargin{"ITSROFrameEndBorderMargin", -1, "Number of bcs at the end of ITS RO Frame border. Take from CCDB if -1"}; Configurable fConfigAddEventHistogram{"cfgAddEventHistogram", "", "Comma separated list of histograms"}; - Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; AnalysisCompositeCut* fEventCut; struct : ConfigurableGroup { @@ -284,10 +288,10 @@ struct AnalysisTrackSelection { // NOTE: For now, the candidate electron cuts must be provided first, then followed by any other needed selections Configurable fConfigQA{"cfgQA", false, "If true, fill QA histograms"}; Configurable fConfigQAIfSelEvt{"cfgQAIfSelEvt", true, "If true, fill QA only for selected events"}; - Configurable fConfigAddTrackHistogram{"cfgAddTrackHistogram", "", "Comma separated list of histograms"}; + Configurable fConfigAddTrackHistogram{"cfgAddTrackHistogram", "", "Comma separated list of histograms"}; Configurable fConfigPrefilterCutId{"cfgPrefilterCutId", 32, "Id of the Prefilter track cut (starting at 0)"}; // In order to create another column prefilter (should be temporary before improving cut selection in configurables, then displaced to AnalysisPrefilterSelection) - Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Configurable fConfigCcdbPathTPC{"ccdb-path-tpc", "Users/z/zhxiong/TPCPID/PostCalib", "base path to the ccdb object"}; + Configurable fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable fConfigCcdbPathTPC{"ccdb-path-tpc", "Users/z/zhxiong/TPCPID/PostCalib", "base path to the ccdb object"}; Configurable fConfigNoLaterThan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; Configurable fConfigComputeTPCpostCalib{"cfgTPCpostCalib", false, "If true, compute TPC post-calibrated n-sigmas"}; Configurable fConfigRunPeriods{"cfgRunPeriods", "LHC22f", "run periods for used data"}; @@ -948,8 +952,8 @@ struct AnalysisSameEventPairing { OutputObj fOutputList{"output"}; Configurable fConfigNbTrackCut{"cfgNbTrackCut", 1, "Number of track cuts without prefilter cut, need to be consistent with the track selection"}; Configurable fConfigNbPairCut{"cfgNbPairCut", 1, "Number of pair cuts, need to be below 4 right now"}; - Configurable url{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Configurable ccdbPath{"ccdb-path", "Users/lm", "base path to the ccdb object"}; + Configurable url{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable ccdbPath{"ccdb-path", "Users/lm", "base path to the ccdb object"}; Configurable nolaterthan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; Configurable fConfigAddSEPHistogram{"cfgAddSEPHistogram", "", "Comma separated list of histograms"}; Configurable ccdburl{"ccdburl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; @@ -1072,7 +1076,7 @@ struct AnalysisSameEventPairing { } } - if (fConfigNbTrackCut > 0 && fConfigNbTrackCut < 31) { // if track cuts + if (fConfigNbTrackCut > 0 && fConfigNbTrackCut < 31) { // if track cuts for (std::size_t icut = 0; icut < fConfigNbTrackCut; ++icut) { // loop over track cuts fTwoTrackFilterMask |= (static_cast(1) << icut); // no pair cuts diff --git a/PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx b/PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx index 09dbb89bb22..95e0671ea26 100644 --- a/PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx +++ b/PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx @@ -62,7 +62,7 @@ struct HStrangeCorrelation { HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; // event filtering - Configurable zorroMask{"zorroMask", "", "zorro trigger class to select on (empty: none)"}; + Configurable zorroMask{"zorroMask", "", "zorro trigger class to select on (empty: none)"}; Zorro zorro; OutputObj zorroSummary{"zorroSummary"}; From efa5269da6c468fb68541f8e86f6403e8c295457 Mon Sep 17 00:00:00 2001 From: Marvin Hemmer <53471402+mhemmer-cern@users.noreply.github.com> Date: Mon, 4 Aug 2025 15:57:17 +0200 Subject: [PATCH 220/345] [PWGEM] PhotonMeson/Tasks/compconvbuilder: Fix linter and includes (#12410) --- PWGEM/PhotonMeson/Tasks/compconvbuilder.cxx | 331 ++++++++++---------- 1 file changed, 158 insertions(+), 173 deletions(-) diff --git a/PWGEM/PhotonMeson/Tasks/compconvbuilder.cxx b/PWGEM/PhotonMeson/Tasks/compconvbuilder.cxx index 90710659c74..d2aafe07b2f 100644 --- a/PWGEM/PhotonMeson/Tasks/compconvbuilder.cxx +++ b/PWGEM/PhotonMeson/Tasks/compconvbuilder.cxx @@ -11,59 +11,47 @@ /// \file compconvbuilder.cxx /// \brief QA task for photons in the EM and LF builder -/// /// \author S. Mrozinski, smrozins@cern.ch #include "PWGEM/Dilepton/Utils/MCUtilities.h" #include "PWGEM/PhotonMeson/Core/EMPhotonEventCut.h" #include "PWGEM/PhotonMeson/DataModel/gammaTables.h" -#include "PWGEM/PhotonMeson/Utils/MCUtilities.h" -#include "PWGEM/PhotonMeson/Utils/PCMUtilities.h" -#include "PWGEM/PhotonMeson/Utils/PairUtilities.h" -#include "PWGLF/DataModel/LFParticleIdentification.h" #include "PWGLF/DataModel/LFStrangenessMLTables.h" #include "PWGLF/DataModel/LFStrangenessPIDTables.h" #include "PWGLF/DataModel/LFStrangenessTables.h" +#include "Common/CCDB/EventSelectionParams.h" #include "Common/Core/RecoDecay.h" -#include "Common/Core/TPCVDriftManager.h" -#include "Common/Core/TrackSelection.h" -#include "Common/Core/trackUtilities.h" -#include "Common/DataModel/Centrality.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/McCollisionExtra.h" -#include "Common/DataModel/PIDResponse.h" -#include "Common/DataModel/TrackSelectionTables.h" - -#include "CCDB/BasicCCDBManager.h" -#include "DataFormatsParameters/GRPMagField.h" -#include "DataFormatsParameters/GRPObject.h" -#include "DetectorsBase/GeometryManager.h" -#include "DetectorsBase/Propagator.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisHelpers.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/runDataProcessing.h" -#include "ReconstructionDataFormats/Track.h" - -#include -#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include #include #include +#include #include #include -#include using namespace o2; using namespace o2::framework; using namespace o2::aod; using namespace o2::soa; +using namespace o2::constants; -using namespace o2::aod::pwgem::photon; using namespace o2::aod::pwgem::dilepton::utils::mcutil; -using namespace o2::aod::pwgem::photonmeson::utils::mcutil; using MyV0Photons = soa::Join; using MyMCV0Legs = soa::Join; @@ -79,25 +67,25 @@ using MyStraCollisions = soa::Join; -using MyMCParticles = aod::McParticles; using V0DerivedMCDatas = soa::Join; -using dauTracks = soa::Join; +using DauTracks = soa::Join; -struct Convbuildercomp { - HistogramRegistry registry{"Convbuildercomp"}; +struct Compconvbuilder { + HistogramRegistry registry{"Compconvbuilder"}; - enum conversionBuilderID { + enum ConversionBuilderID { EMBuilder = 0, LFBuilder = 1, EMOnly = 2, LFOnly = 3, - Common = 4 + Common = 4, + NConversionBuilder }; - static constexpr std::string_view conversionBuilder[5] = {"EMBuilder/", "LFBuilder/", "EMOnly/", "LFOnly/", "Common/"}; - static constexpr std::string_view event_types[2] = {"before/", "after/"}; + static constexpr std::string_view kConversionBuilder[NConversionBuilder] = {"EMBuilder/", "LFBuilder/", "EMOnly/", "LFOnly/", "Common/"}; + static constexpr std::string_view kEventTypes[2] = {"before/", "after/"}; EMPhotonEventCut fEMEventCut; struct : ConfigurableGroup { @@ -121,7 +109,7 @@ struct Convbuildercomp { Configurable cfgRequireNoHighMultCollInPrevRof{"cfgRequireNoHighMultCollInPrevRof", false, "require no HM collision in previous ITS ROF"}; } eventcuts; - void DefineEMEventCut() + void defineEMEventCut() { fEMEventCut = EMPhotonEventCut("fEMEventCut", "fEMEventCut"); fEMEventCut.SetRequireSel8(eventcuts.cfgRequireSel8); @@ -145,30 +133,30 @@ struct Convbuildercomp { void init(InitContext const& /*ctx*/) { - DefineEMEventCut(); + defineEMEventCut(); - for (int i = 0; i < 5; ++i) { + for (int i = 0; i < NConversionBuilder; ++i) { - registry.add(string(conversionBuilder[i]) + "hPt", ";p_{T} (GeV/c); Counts", kTH1F, {{1000, 0., 10.}}); - registry.add(string(conversionBuilder[i]) + "hR", ";R_{conv} (cm); Counts", kTH1F, {{100, 0., 100.}}); + registry.add(string(kConversionBuilder[i]) + "hPt", ";p_{T} (GeV/c); Counts", kTH1F, {{1000, 0., 10.}}); + registry.add(string(kConversionBuilder[i]) + "hR", ";R_{conv} (cm); Counts", kTH1F, {{100, 0., 100.}}); - registry.add(string(conversionBuilder[i]) + "hEta", ";#eta; Counts", kTH1F, {{200, -1.0f, 1.0f}}); + registry.add(string(kConversionBuilder[i]) + "hEta", ";#eta; Counts", kTH1F, {{200, -1.0f, 1.0f}}); - registry.add(string(conversionBuilder[i]) + "hcosPA", ";R_{conv} (cm); Counts", kTH1F, {{100, 0.99f, 1.0f}}); + registry.add(string(kConversionBuilder[i]) + "hcosPA", ";R_{conv} (cm); Counts", kTH1F, {{100, 0.99f, 1.0f}}); - registry.add(string(conversionBuilder[i]) + "MatchedDeltaRec", ";#Delta colID_{rec};Counts", kTH1F, {{21, -10.5, 10.5}}); + registry.add(string(kConversionBuilder[i]) + "MatchedDeltaRec", ";#Delta colID_{rec};Counts", kTH1F, {{21, -10.5, 10.5}}); - registry.add(string(conversionBuilder[i]) + "hZ", ";z (cm);Counts", kTH1F, {{200, -100, 100}}); + registry.add(string(kConversionBuilder[i]) + "hZ", ";z (cm);Counts", kTH1F, {{200, -100, 100}}); - registry.add(string(conversionBuilder[i]) + "hZR", "conversion point in RZ;Z (cm);R_{xy} (cm)", kTH2F, {{200, -100, 100}, {200, 0.0f, 100.0f}}); + registry.add(string(kConversionBuilder[i]) + "hZR", "conversion point in RZ;Z (cm);R_{xy} (cm)", kTH2F, {{200, -100, 100}, {200, 0.0f, 100.0f}}); - registry.add(string(conversionBuilder[i]) + "hAP", "AP plot;#alpha;q_{T} (GeV/c)", kTH2F, {{200, -1.0f, +1.0f}, {250, 0.0f, 0.25f}}); + registry.add(string(kConversionBuilder[i]) + "hAP", "AP plot;#alpha;q_{T} (GeV/c)", kTH2F, {{200, -1.0f, +1.0f}, {250, 0.0f, 0.25f}}); - registry.add(string(conversionBuilder[i]) + "ResolutionGen/Z_res", "Conversion radius resolution;z_{conv, gen} (cm);R_{conv, gen} (cm);#varphi_{gen} (rad.);#eta_{gen};p_{T, gen};z_{conv, rec} - z_{conv, gen} (cm);", + registry.add(string(kConversionBuilder[i]) + "ResolutionGen/Z_res", "Conversion radius resolution;z_{conv, gen} (cm);R_{conv, gen} (cm);#varphi_{gen} (rad.);#eta_{gen};p_{T, gen};z_{conv, rec} - z_{conv, gen} (cm);", kTHnSparseF, {{200, -100, 100}, {200, 0, 100}, - {90, 0, 2 * M_PI}, + {90, 0, math::TwoPI}, {200, -1.0f, 1.0f}, {500, 0, 10}, {120, -30, 30} @@ -176,11 +164,11 @@ struct Convbuildercomp { }, false); - registry.add(string(conversionBuilder[i]) + "ResolutionGen/R_res", "Conversion radius resolution;z_{conv, gen} (cm);R_{conv, gen} (cm);#varphi_{gen} (rad.);#eta_{gen};p_{T, gen};R_{conv, rec} - R_{conv, gen} (cm);", + registry.add(string(kConversionBuilder[i]) + "ResolutionGen/R_res", "Conversion radius resolution;z_{conv, gen} (cm);R_{conv, gen} (cm);#varphi_{gen} (rad.);#eta_{gen};p_{T, gen};R_{conv, rec} - R_{conv, gen} (cm);", kTHnSparseF, {{200, -100, 100}, {200, 0, 100}, - {90, 0, 2 * M_PI}, + {90, 0, math::TwoPI}, {200, -1.0f, 1.0f}, {500, 0, 10}, {120, -30, 30} @@ -188,11 +176,11 @@ struct Convbuildercomp { }, false); - registry.add(string(conversionBuilder[i]) + "ResolutionGen/Phi_res", "#varphi resolution;z_{conv, gen} (cm);R_{conv, gen} (cm);#varphi_{gen} (rad.);#eta_{gen};p_{T, gen};#varphi_{conv, rec} - #varphi_{conv, gen} (cm);", + registry.add(string(kConversionBuilder[i]) + "ResolutionGen/Phi_res", "#varphi resolution;z_{conv, gen} (cm);R_{conv, gen} (cm);#varphi_{gen} (rad.);#eta_{gen};p_{T, gen};#varphi_{conv, rec} - #varphi_{conv, gen} (cm);", kTHnSparseF, {{200, -100, 100}, {200, 0, 100}, - {90, 0, 2 * M_PI}, + {90, 0, math::TwoPI}, {200, -1.0f, 1.0f}, {500, 0, 10}, {100, -0.2f, 0.2f} @@ -200,11 +188,11 @@ struct Convbuildercomp { }, false); - registry.add(string(conversionBuilder[i]) + "ResolutionGen/Pt_res", "Conversion radius resolution;z_{conv, gen} (cm);R_{conv, gen} (cm);#varphi_{gen} (rad.);#eta_{gen};p_{T, gen};p_{T, rec} - p_{T, gen}/p_{T, gen};", + registry.add(string(kConversionBuilder[i]) + "ResolutionGen/Pt_res", "Conversion radius resolution;z_{conv, gen} (cm);R_{conv, gen} (cm);#varphi_{gen} (rad.);#eta_{gen};p_{T, gen};p_{T, rec} - p_{T, gen}/p_{T, gen};", kTHnSparseF, {{200, -100, 100}, {200, 0, 100}, - {90, 0, 2 * M_PI}, + {90, 0, math::TwoPI}, {200, -1.0f, 1.0f}, {500, 0, 10}, {200, -1.0f, 1.0f} @@ -212,11 +200,11 @@ struct Convbuildercomp { }, false); - registry.add(string(conversionBuilder[i]) + "ResolutionGen/Eta_res", "Conversion radius resolution;z_{conv, gen} (cm);R_{conv, gen} (cm);#varphi_{gen} (rad.);#eta_{gen};p_{T, gen};#eta_{conv, rec} - #eta_{conv, gen} (cm);", + registry.add(string(kConversionBuilder[i]) + "ResolutionGen/Eta_res", "Conversion radius resolution;z_{conv, gen} (cm);R_{conv, gen} (cm);#varphi_{gen} (rad.);#eta_{gen};p_{T, gen};#eta_{conv, rec} - #eta_{conv, gen} (cm);", kTHnSparseF, {{200, -100, 100}, {200, 0, 100}, - {90, 0, 2 * M_PI}, + {90, 0, math::TwoPI}, {200, -1.0f, 1.0f}, {500, 0, 10}, {100, -0.5f, 0.5f} @@ -224,11 +212,11 @@ struct Convbuildercomp { }, false); - registry.add(string(conversionBuilder[i]) + "ResolutionRec/Z_res", "Conversion radius resolution;z_{conv, rec} (cm);R_{conv, rec} (cm);#varphi_{rec} (rad.);#eta_{rec};p_{T, rec};z_{conv, rec} - z_{conv, gen} (cm);", + registry.add(string(kConversionBuilder[i]) + "ResolutionRec/Z_res", "Conversion radius resolution;z_{conv, rec} (cm);R_{conv, rec} (cm);#varphi_{rec} (rad.);#eta_{rec};p_{T, rec};z_{conv, rec} - z_{conv, gen} (cm);", kTHnSparseF, {{200, -100, 100}, {200, 0, 100}, - {90, 0, 2 * M_PI}, + {90, 0, math::TwoPI}, {200, -1.0f, 1.0f}, {500, 0, 10}, {120, -30, 30} @@ -236,11 +224,11 @@ struct Convbuildercomp { }, false); - registry.add(string(conversionBuilder[i]) + "ResolutionRec/R_res", "Conversion radius resolution;z_{conv, rec} (cm);R_{conv, rec} (cm);#varphi_{rec} (rad.);#eta_{rec};p_{T, rec};R_{conv, rec} - R_{conv, gen} (cm);", + registry.add(string(kConversionBuilder[i]) + "ResolutionRec/R_res", "Conversion radius resolution;z_{conv, rec} (cm);R_{conv, rec} (cm);#varphi_{rec} (rad.);#eta_{rec};p_{T, rec};R_{conv, rec} - R_{conv, gen} (cm);", kTHnSparseF, {{200, -100, 100}, {200, 0, 100}, - {90, 0, 2 * M_PI}, + {90, 0, math::TwoPI}, {200, -1.0f, 1.0f}, {500, 0, 10}, {120, -30, 30} @@ -248,11 +236,11 @@ struct Convbuildercomp { }, false); - registry.add(string(conversionBuilder[i]) + "ResolutionRec/Phi_res", "#varphi resolution;z_{conv, rec} (cm);R_{conv, rec} (cm);#varphi_{rec} (rad.);#eta_{rec};p_{T, rec};#varphi_{conv, rec} - #varphi_{conv, gen} (cm);", + registry.add(string(kConversionBuilder[i]) + "ResolutionRec/Phi_res", "#varphi resolution;z_{conv, rec} (cm);R_{conv, rec} (cm);#varphi_{rec} (rad.);#eta_{rec};p_{T, rec};#varphi_{conv, rec} - #varphi_{conv, gen} (cm);", kTHnSparseF, {{200, -100, 100}, {200, 0, 100}, - {90, 0, 2 * M_PI}, + {90, 0, math::TwoPI}, {200, -1.0f, 1.0f}, {500, 0, 10}, {100, -0.2f, 0.2f} @@ -260,11 +248,11 @@ struct Convbuildercomp { }, false); - registry.add(string(conversionBuilder[i]) + "ResolutionRec/Pt_res", "Conversion radius resolution;z_{conv, rec} (cm);R_{conv, rec} (cm);#varphi_{rec} (rad.);#eta_{rec};p_{T, rec};p_{T, rec} - p_{T, gen}/p_{T, gen};", + registry.add(string(kConversionBuilder[i]) + "ResolutionRec/Pt_res", "Conversion radius resolution;z_{conv, rec} (cm);R_{conv, rec} (cm);#varphi_{rec} (rad.);#eta_{rec};p_{T, rec};p_{T, rec} - p_{T, gen}/p_{T, gen};", kTHnSparseF, {{200, -100, 100}, {200, 0, 100}, - {90, 0, 2 * M_PI}, + {90, 0, math::TwoPI}, {200, -1.0f, 1.0f}, {500, 0, 10}, {200, -1.0f, 1.0f} @@ -272,34 +260,34 @@ struct Convbuildercomp { }, false); - registry.add(string(conversionBuilder[i]) + "ResolutionRec/Eta_res", "Conversion radius resolution;z_{conv, rec} (cm);R_{conv, rec} (cm);#varphi_{rec} (rad.);#eta_{rec};p_{T, rec};#eta_{conv, rec} - #eta_{conv, gen} (cm);", + registry.add(string(kConversionBuilder[i]) + "ResolutionRec/Eta_res", "Conversion radius resolution;z_{conv, rec} (cm);R_{conv, rec} (cm);#varphi_{rec} (rad.);#eta_{rec};p_{T, rec};#eta_{conv, rec} - #eta_{conv, gen} (cm);", kTHnSparseF, {{200, -100, 100}, {200, 0, 100}, - {90, 0, 2 * M_PI}, + {90, 0, math::TwoPI}, {200, -1.0f, 1.0f}, {500, 0, 10}, {100, -0.5f, 0.5f} }, false); - registry.add(string(conversionBuilder[i]) + "ConvInfo", "Conversion radius resolution;x_{conv} (cm);y_{conv} (cm);z_{conv} (cm);R_{conv} (cm);#varphi (rad.);#eta;p_{T, gen};", + registry.add(string(kConversionBuilder[i]) + "ConvInfo", "Conversion radius resolution;x_{conv} (cm);y_{conv} (cm);z_{conv} (cm);R_{conv} (cm);#varphi (rad.);#eta;p_{T, gen};", kTHnSparseF, { {200, -100, 100}, {200, -100, 100}, {200, -100, 100}, {200, 0, 100}, - {90, 0, 2 * M_PI}, + {90, 0, math::TwoPI}, {200, -1.0f, 1.0f}, {500, 0, 10}, }, false); - registry.add(string(conversionBuilder[i]) + "V0Leg/Asymmetry", "", kTH1F, {{100, 0, 1}}); + registry.add(string(kConversionBuilder[i]) + "V0Leg/Asymmetry", "", kTH1F, {{100, 0, 1}}); - auto hCollisionCounter = registry.add(string(conversionBuilder[i]) + "Event/before/hCollisionCounter", "collision counter;;Number of events", kTH1F, {{10, 0.5, 10.5}}, false); + auto hCollisionCounter = registry.add(string(kConversionBuilder[i]) + "Event/before/hCollisionCounter", "collision counter;;Number of events", kTH1F, {{10, 0.5, 10.5}}, false); hCollisionCounter->GetXaxis()->SetBinLabel(1, "all"); hCollisionCounter->GetXaxis()->SetBinLabel(2, "No TF border"); hCollisionCounter->GetXaxis()->SetBinLabel(3, "No ITS ROF border"); @@ -311,16 +299,16 @@ struct Convbuildercomp { hCollisionCounter->GetXaxis()->SetBinLabel(9, "|Z_{vtx}| < 10 cm"); hCollisionCounter->GetXaxis()->SetBinLabel(10, "accepted"); - registry.add(string(conversionBuilder[i]) + "Event/before/hZvtx", "vertex z; Z_{vtx} (cm)", kTH1F, {{100, -50, +50}}, false); - registry.add(string(conversionBuilder[i]) + "Event/before/hMultNTracksPV", "hMultNTracksPV; N_{track} to PV", kTH1F, {{6001, -0.5, 6000.5}}, false); - registry.add(string(conversionBuilder[i]) + "Event/before/hMultNTracksPVeta1", "hMultNTracksPVeta1; N_{track} to PV", kTH1F, {{6001, -0.5, 6000.5}}, false); - registry.add(string(conversionBuilder[i]) + "Event/before/hMultFT0", "hMultFT0;mult. FT0A;mult. FT0C", kTH2F, {{300, 0, 6000}, {300, 0, 6000}}, false); - registry.add(string(conversionBuilder[i]) + "Event/before/hCentFT0A", "hCentFT0A;centrality FT0A (%)", kTH1F, {{110, 0, 110}}, false); - registry.add(string(conversionBuilder[i]) + "Event/before/hCentFT0C", "hCentFT0C;centrality FT0C (%)", kTH1F, {{110, 0, 110}}, false); - registry.add(string(conversionBuilder[i]) + "Event/before/hCentFT0M", "hCentFT0M;centrality FT0M (%)", kTH1F, {{110, 0, 110}}, false); - registry.add(string(conversionBuilder[i]) + "Event/before/hCentFT0MvsMultNTracksPV", "hCentFT0MvsMultNTracksPV;centrality FT0M (%);N_{track} to PV", kTH2F, {{110, 0, 110}, {600, 0, 6000}}, false); - registry.add(string(conversionBuilder[i]) + "Event/before/hMultFT0MvsMultNTracksPV", "hMultFT0MvsMultNTracksPV;mult. FT0M;N_{track} to PV", kTH2F, {{600, 0, 6000}, {600, 0, 6000}}, false); - registry.addClone(string(conversionBuilder[i]) + "Event/before/", string(conversionBuilder[i]) + "Event/after/"); + registry.add(string(kConversionBuilder[i]) + "Event/before/hZvtx", "vertex z; Z_{vtx} (cm)", kTH1F, {{100, -50, +50}}, false); + registry.add(string(kConversionBuilder[i]) + "Event/before/hMultNTracksPV", "hMultNTracksPV; N_{track} to PV", kTH1F, {{6001, -0.5, 6000.5}}, false); + registry.add(string(kConversionBuilder[i]) + "Event/before/hMultNTracksPVeta1", "hMultNTracksPVeta1; N_{track} to PV", kTH1F, {{6001, -0.5, 6000.5}}, false); + registry.add(string(kConversionBuilder[i]) + "Event/before/hMultFT0", "hMultFT0;mult. FT0A;mult. FT0C", kTH2F, {{300, 0, 6000}, {300, 0, 6000}}, false); + registry.add(string(kConversionBuilder[i]) + "Event/before/hCentFT0A", "hCentFT0A;centrality FT0A (%)", kTH1F, {{110, 0, 110}}, false); + registry.add(string(kConversionBuilder[i]) + "Event/before/hCentFT0C", "hCentFT0C;centrality FT0C (%)", kTH1F, {{110, 0, 110}}, false); + registry.add(string(kConversionBuilder[i]) + "Event/before/hCentFT0M", "hCentFT0M;centrality FT0M (%)", kTH1F, {{110, 0, 110}}, false); + registry.add(string(kConversionBuilder[i]) + "Event/before/hCentFT0MvsMultNTracksPV", "hCentFT0MvsMultNTracksPV;centrality FT0M (%);N_{track} to PV", kTH2F, {{110, 0, 110}, {600, 0, 6000}}, false); + registry.add(string(kConversionBuilder[i]) + "Event/before/hMultFT0MvsMultNTracksPV", "hMultFT0MvsMultNTracksPV;mult. FT0M;N_{track} to PV", kTH2F, {{600, 0, 6000}, {600, 0, 6000}}, false); + registry.addClone(string(kConversionBuilder[i]) + "Event/before/", string(kConversionBuilder[i]) + "Event/after/"); } registry.add("truePhotons/hPt_Converted", "Converted Photons; p_{T} (GeV/c); Counts", kTH1F, {{100, 0., 10.}}); @@ -332,7 +320,7 @@ struct Convbuildercomp { {200, -100, 100}, {200, -100, 100}, {200, 0, 100}, - {90, 0, 2 * M_PI}, + {90, 0, math::TwoPI}, {200, -1.0f, 1.0f}, {500, 0, 10}}, false); @@ -350,36 +338,36 @@ struct Convbuildercomp { template void fillEventInfo(TCollision const& collision, const float /*weight*/ = 1.f) { - registry.fill(HIST(conversionBuilder[type]) + HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 1.0); + registry.fill(HIST(kConversionBuilder[type]) + HIST("Event/") + HIST(kEventTypes[ev_id]) + HIST("hCollisionCounter"), 1.0); if (collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { - registry.fill(HIST(conversionBuilder[type]) + HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 2.0); + registry.fill(HIST(kConversionBuilder[type]) + HIST("Event/") + HIST(kEventTypes[ev_id]) + HIST("hCollisionCounter"), 2.0); } if (collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { - registry.fill(HIST(conversionBuilder[type]) + HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 3.0); + registry.fill(HIST(kConversionBuilder[type]) + HIST("Event/") + HIST(kEventTypes[ev_id]) + HIST("hCollisionCounter"), 3.0); } if (collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { - registry.fill(HIST(conversionBuilder[type]) + HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 4.0); + registry.fill(HIST(kConversionBuilder[type]) + HIST("Event/") + HIST(kEventTypes[ev_id]) + HIST("hCollisionCounter"), 4.0); } if (collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { - registry.fill(HIST(conversionBuilder[type]) + HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 5.0); + registry.fill(HIST(kConversionBuilder[type]) + HIST("Event/") + HIST(kEventTypes[ev_id]) + HIST("hCollisionCounter"), 5.0); } if (collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { - registry.fill(HIST(conversionBuilder[type]) + HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 6.0); + registry.fill(HIST(kConversionBuilder[type]) + HIST("Event/") + HIST(kEventTypes[ev_id]) + HIST("hCollisionCounter"), 6.0); } if (collision.selection_bit(o2::aod::evsel::kIsTriggerTVX)) { - registry.fill(HIST(conversionBuilder[type]) + HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 7.0); + registry.fill(HIST(kConversionBuilder[type]) + HIST("Event/") + HIST(kEventTypes[ev_id]) + HIST("hCollisionCounter"), 7.0); } if (collision.sel8()) { - registry.fill(HIST(conversionBuilder[type]) + HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 8.0); + registry.fill(HIST(kConversionBuilder[type]) + HIST("Event/") + HIST(kEventTypes[ev_id]) + HIST("hCollisionCounter"), 8.0); } - if (std::fabs(collision.posZ()) < 10.0) { - registry.fill(HIST(conversionBuilder[type]) + HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCollisionCounter"), 9.0); + if (std::fabs(collision.posZ()) < eventcuts.cfgZvtxMax) { + registry.fill(HIST(kConversionBuilder[type]) + HIST("Event/") + HIST(kEventTypes[ev_id]) + HIST("hCollisionCounter"), 9.0); } - registry.fill(HIST(conversionBuilder[type]) + HIST("Event/") + HIST(event_types[ev_id]) + HIST("hMultNTracksPVeta1"), collision.multNTracksPVeta1()); + registry.fill(HIST(kConversionBuilder[type]) + HIST("Event/") + HIST(kEventTypes[ev_id]) + HIST("hMultNTracksPVeta1"), collision.multNTracksPVeta1()); } template @@ -391,7 +379,7 @@ struct Convbuildercomp { float ptNeg = negleg.pt(); float asym = (ptPos - ptNeg) / (ptPos + ptNeg); - registry.fill(HIST(conversionBuilder[type]) + HIST("V0Leg/Asymmetry"), asym); + registry.fill(HIST(kConversionBuilder[type]) + HIST("V0Leg/Asymmetry"), asym); } else { @@ -399,21 +387,21 @@ struct Convbuildercomp { float ptNeg = negleg.negtrackpt(); float asym = (ptPos - ptNeg) / (ptPos + ptNeg); - registry.fill(HIST(conversionBuilder[type]) + HIST("V0Leg/Asymmetry"), asym); + registry.fill(HIST(kConversionBuilder[type]) + HIST("V0Leg/Asymmetry"), asym); } } template void fillV0Info(auto& v0, auto& v0MC, auto& mcleg) { - registry.fill(HIST(conversionBuilder[type]) + HIST("hPt"), v0.pt()); - registry.fill(HIST(conversionBuilder[type]) + HIST("hEta"), v0.eta()); - registry.fill(HIST(conversionBuilder[type]) + HIST("hAP"), v0.alpha(), v0.qtarm()); + registry.fill(HIST(kConversionBuilder[type]) + HIST("hPt"), v0.pt()); + registry.fill(HIST(kConversionBuilder[type]) + HIST("hEta"), v0.eta()); + registry.fill(HIST(kConversionBuilder[type]) + HIST("hAP"), v0.alpha(), v0.qtarm()); - if constexpr (type == 0 || type == 2) { - registry.fill(HIST(conversionBuilder[type]) + HIST("hZ"), v0.vz()); - registry.fill(HIST(conversionBuilder[type]) + HIST("hcosPA"), v0.cospa()); - registry.fill(HIST(conversionBuilder[type]) + HIST("hZR"), v0.vz(), v0.v0radius()); + if constexpr (type == EMBuilder || type == EMOnly) { + registry.fill(HIST(kConversionBuilder[type]) + HIST("hZ"), v0.vz()); + registry.fill(HIST(kConversionBuilder[type]) + HIST("hcosPA"), v0.cospa()); + registry.fill(HIST(kConversionBuilder[type]) + HIST("hZR"), v0.vz(), v0.v0radius()); float deltapT = v0.pt() - v0MC.pt(); float deltaZ = v0.vz() - mcleg.vz(); @@ -421,7 +409,7 @@ struct Convbuildercomp { float deltaEta = v0.eta() - v0MC.eta(); float deltaR = v0.v0radius() - std::sqrt(std::pow(mcleg.vx(), 2) + std::pow(mcleg.vy(), 2)); - registry.fill(HIST(conversionBuilder[type]) + HIST("ResolutionGen/Z_res"), + registry.fill(HIST(kConversionBuilder[type]) + HIST("ResolutionGen/Z_res"), mcleg.vz(), std::sqrt(std::pow(mcleg.vx(), 2) + std::pow(mcleg.vy(), 2)), v0MC.phi(), @@ -429,7 +417,7 @@ struct Convbuildercomp { v0MC.pt(), deltaZ); - registry.fill(HIST(conversionBuilder[type]) + HIST("ResolutionGen/R_res"), + registry.fill(HIST(kConversionBuilder[type]) + HIST("ResolutionGen/R_res"), mcleg.vz(), std::sqrt(std::pow(mcleg.vx(), 2) + std::pow(mcleg.vy(), 2)), v0MC.phi(), @@ -437,7 +425,7 @@ struct Convbuildercomp { v0MC.pt(), deltaR); - registry.fill(HIST(conversionBuilder[type]) + HIST("ResolutionGen/Phi_res"), + registry.fill(HIST(kConversionBuilder[type]) + HIST("ResolutionGen/Phi_res"), mcleg.vz(), std::sqrt(std::pow(mcleg.vx(), 2) + std::pow(mcleg.vy(), 2)), v0MC.phi(), @@ -445,7 +433,7 @@ struct Convbuildercomp { v0MC.pt(), deltaPhi); - registry.fill(HIST(conversionBuilder[type]) + HIST("ResolutionGen/Pt_res"), + registry.fill(HIST(kConversionBuilder[type]) + HIST("ResolutionGen/Pt_res"), mcleg.vz(), std::sqrt(std::pow(mcleg.vx(), 2) + std::pow(mcleg.vy(), 2)), v0MC.phi(), @@ -453,7 +441,7 @@ struct Convbuildercomp { v0MC.pt(), deltapT); - registry.fill(HIST(conversionBuilder[type]) + HIST("ResolutionGen/Eta_res"), + registry.fill(HIST(kConversionBuilder[type]) + HIST("ResolutionGen/Eta_res"), mcleg.vz(), std::sqrt(std::pow(mcleg.vx(), 2) + std::pow(mcleg.vy(), 2)), v0MC.phi(), @@ -461,7 +449,7 @@ struct Convbuildercomp { v0MC.pt(), deltaEta); - registry.fill(HIST(conversionBuilder[type]) + HIST("ResolutionRec/Z_res"), + registry.fill(HIST(kConversionBuilder[type]) + HIST("ResolutionRec/Z_res"), v0.vz(), v0.v0radius(), v0.phi(), @@ -469,7 +457,7 @@ struct Convbuildercomp { v0.pt(), deltaZ); - registry.fill(HIST(conversionBuilder[type]) + HIST("ResolutionRec/R_res"), + registry.fill(HIST(kConversionBuilder[type]) + HIST("ResolutionRec/R_res"), v0.vz(), v0.v0radius(), v0.phi(), @@ -477,7 +465,7 @@ struct Convbuildercomp { v0.pt(), deltaR); - registry.fill(HIST(conversionBuilder[type]) + HIST("ResolutionRec/Phi_res"), + registry.fill(HIST(kConversionBuilder[type]) + HIST("ResolutionRec/Phi_res"), v0.vz(), v0.v0radius(), v0.phi(), @@ -485,7 +473,7 @@ struct Convbuildercomp { v0.pt(), deltaPhi); - registry.fill(HIST(conversionBuilder[type]) + HIST("ResolutionRec/Pt_res"), + registry.fill(HIST(kConversionBuilder[type]) + HIST("ResolutionRec/Pt_res"), v0.vz(), v0.v0radius(), v0.phi(), @@ -493,7 +481,7 @@ struct Convbuildercomp { v0.pt(), deltapT); - registry.fill(HIST(conversionBuilder[type]) + HIST("ResolutionRec/Eta_res"), + registry.fill(HIST(kConversionBuilder[type]) + HIST("ResolutionRec/Eta_res"), v0.vz(), v0.v0radius(), v0.phi(), @@ -501,7 +489,7 @@ struct Convbuildercomp { v0.pt(), deltaEta); - registry.fill(HIST(conversionBuilder[type]) + HIST("ConvInfo"), + registry.fill(HIST(kConversionBuilder[type]) + HIST("ConvInfo"), v0.vx(), // 0 v0.vy(), // 1 v0.vz(), // 2 @@ -511,26 +499,20 @@ struct Convbuildercomp { v0.pt()); // 6 } else { - registry.fill(HIST(conversionBuilder[type]) + HIST("hZ"), v0.z()); - registry.fill(HIST(conversionBuilder[type]) + HIST("hcosPA"), v0.v0cosPA()); - registry.fill(HIST(conversionBuilder[type]) + HIST("hZR"), v0.z(), v0.v0radius()); + registry.fill(HIST(kConversionBuilder[type]) + HIST("hZ"), v0.z()); + registry.fill(HIST(kConversionBuilder[type]) + HIST("hcosPA"), v0.v0cosPA()); + registry.fill(HIST(kConversionBuilder[type]) + HIST("hZR"), v0.z(), v0.v0radius()); float deltaR = v0.v0radius() - std::hypot(v0MC.xMC(), v0MC.yMC()); float phiRec = v0.phi(); - if (phiRec < 0) { - phiRec += 2.0f * static_cast(M_PI); - } + RecoDecay::constrainAngle(phiRec); float phiMC = std::atan2(v0MC.pyMC(), v0MC.pxMC()); - if (phiMC < 0) { - phiMC += 2.0f * static_cast(M_PI); - } + RecoDecay::constrainAngle(phiMC); float deltaPhi = phiRec - phiMC; - if (deltaPhi < 0) { - deltaPhi += 2.0f * static_cast(M_PI); - } + RecoDecay::constrainAngle(deltaPhi); float etaGen = 0.5f * std::log((std::hypot(v0MC.pxMC(), v0MC.pyMC(), v0MC.pzMC()) + v0MC.pzMC()) / (std::hypot(v0MC.pxMC(), v0MC.pyMC(), v0MC.pzMC()) - v0MC.pzMC())); @@ -540,7 +522,7 @@ struct Convbuildercomp { float deltaEta = etaRec - etaGen; float deltaZ = v0.z() - v0MC.zMC(); - registry.fill(HIST(conversionBuilder[type]) + HIST("ResolutionGen/Z_res"), + registry.fill(HIST(kConversionBuilder[type]) + HIST("ResolutionGen/Z_res"), v0MC.zMC(), std::hypot(v0MC.xMC(), v0MC.yMC()), phiMC, @@ -548,7 +530,7 @@ struct Convbuildercomp { v0MC.ptMC(), deltaZ); - registry.fill(HIST(conversionBuilder[type]) + HIST("ResolutionGen/R_res"), + registry.fill(HIST(kConversionBuilder[type]) + HIST("ResolutionGen/R_res"), v0MC.zMC(), std::hypot(v0MC.xMC(), v0MC.yMC()), phiMC, @@ -556,7 +538,7 @@ struct Convbuildercomp { v0MC.ptMC(), deltaR); - registry.fill(HIST(conversionBuilder[type]) + HIST("ResolutionGen/Phi_res"), + registry.fill(HIST(kConversionBuilder[type]) + HIST("ResolutionGen/Phi_res"), v0MC.zMC(), std::hypot(v0MC.xMC(), v0MC.yMC()), phiMC, @@ -564,7 +546,7 @@ struct Convbuildercomp { v0MC.ptMC(), deltaPhi); - registry.fill(HIST(conversionBuilder[type]) + HIST("ResolutionGen/Pt_res"), + registry.fill(HIST(kConversionBuilder[type]) + HIST("ResolutionGen/Pt_res"), v0MC.zMC(), std::hypot(v0MC.xMC(), v0MC.yMC()), phiMC, @@ -572,7 +554,7 @@ struct Convbuildercomp { v0MC.ptMC(), deltapT); - registry.fill(HIST(conversionBuilder[type]) + HIST("ResolutionGen/Eta_res"), + registry.fill(HIST(kConversionBuilder[type]) + HIST("ResolutionGen/Eta_res"), v0MC.zMC(), std::hypot(v0MC.xMC(), v0MC.yMC()), phiMC, @@ -580,7 +562,7 @@ struct Convbuildercomp { v0MC.ptMC(), deltaEta); - registry.fill(HIST(conversionBuilder[type]) + HIST("ResolutionRec/Z_res"), + registry.fill(HIST(kConversionBuilder[type]) + HIST("ResolutionRec/Z_res"), v0.z(), v0.v0radius(), phiRec, @@ -588,7 +570,7 @@ struct Convbuildercomp { v0.pt(), deltaZ); - registry.fill(HIST(conversionBuilder[type]) + HIST("ResolutionRec/R_res"), + registry.fill(HIST(kConversionBuilder[type]) + HIST("ResolutionRec/R_res"), v0.z(), v0.v0radius(), phiRec, @@ -596,7 +578,7 @@ struct Convbuildercomp { v0.pt(), deltaR); - registry.fill(HIST(conversionBuilder[type]) + HIST("ResolutionRec/Phi_res"), + registry.fill(HIST(kConversionBuilder[type]) + HIST("ResolutionRec/Phi_res"), v0.z(), v0.v0radius(), phiRec, @@ -604,7 +586,7 @@ struct Convbuildercomp { v0.pt(), deltaPhi); - registry.fill(HIST(conversionBuilder[type]) + HIST("ResolutionRec/Eta_res"), + registry.fill(HIST(kConversionBuilder[type]) + HIST("ResolutionRec/Eta_res"), v0.z(), v0.v0radius(), phiRec, @@ -612,7 +594,7 @@ struct Convbuildercomp { v0.pt(), deltaEta); - registry.fill(HIST(conversionBuilder[type]) + HIST("ResolutionRec/Pt_res"), + registry.fill(HIST(kConversionBuilder[type]) + HIST("ResolutionRec/Pt_res"), v0.z(), v0.v0radius(), phiRec, @@ -620,7 +602,7 @@ struct Convbuildercomp { v0.pt(), deltapT); - registry.fill(HIST(conversionBuilder[type]) + HIST("ConvInfo"), + registry.fill(HIST(kConversionBuilder[type]) + HIST("ConvInfo"), v0.x(), v0.y(), v0.z(), @@ -630,7 +612,7 @@ struct Convbuildercomp { v0.pt()); } - registry.fill(HIST(conversionBuilder[type]) + HIST("hR"), v0.v0radius()); + registry.fill(HIST(kConversionBuilder[type]) + HIST("hR"), v0.v0radius()); } Preslice perCollisionMCDerived = o2::aod::v0data::straCollisionId; @@ -638,10 +620,10 @@ struct Convbuildercomp { void processLFV0sMC(MyStraCollisions const& stracollisions, soa::Join const&, V0DerivedMCDatas const& strangeV0s, - dauTracks const&) + DauTracks const&) { - for (auto& collision : stracollisions) { + for (const auto& collision : stracollisions) { fillEventInfo<0, LFBuilder>(collision); @@ -651,8 +633,8 @@ struct Convbuildercomp { fillEventInfo<1, LFBuilder>(collision); - registry.fill(HIST((conversionBuilder[1])) + HIST("Event/before/hCollisionCounter"), 10.0); - registry.fill(HIST((conversionBuilder[1])) + HIST("Event/after/hCollisionCounter"), 10.0); // accepted + registry.fill(HIST((kConversionBuilder[1])) + HIST("Event/before/hCollisionCounter"), 10.0); + registry.fill(HIST((kConversionBuilder[1])) + HIST("Event/after/hCollisionCounter"), 10.0); // accepted auto myV0s = strangeV0s.sliceBy(perCollisionMCDerived, collision.globalIndex()); @@ -663,11 +645,11 @@ struct Convbuildercomp { auto v0MC = v0.v0MCCore_as>(); - if (v0MC.pdgCode() != 22 || !v0MC.isPhysicalPrimary()) { + if (v0MC.pdgCode() != kGamma || !v0MC.isPhysicalPrimary()) { continue; } - auto posTrack = v0.template posTrackExtra_as(); + auto posTrack = v0.template posTrackExtra_as(); fillV0Info(v0, v0MC, posTrack); } @@ -679,7 +661,7 @@ struct Convbuildercomp { void processEMV0sMC(MyV0Photons const& v0s, aod::EMMCParticles const& mcparticles, MyMCV0Legs const&, MyCollisions const& collisions) { - for (auto& collision : collisions) { + for (const auto& collision : collisions) { fillEventInfo<0, EMBuilder>(collision); @@ -688,19 +670,19 @@ struct Convbuildercomp { } fillEventInfo<1, EMBuilder>(collision); - registry.fill(HIST((conversionBuilder[0])) + HIST("Event/before/hCollisionCounter"), 10.0); // accepted - registry.fill(HIST((conversionBuilder[0])) + HIST("Event/after/hCollisionCounter"), 10.0); // accepted + registry.fill(HIST((kConversionBuilder[0])) + HIST("Event/before/hCollisionCounter"), 10.0); // accepted + registry.fill(HIST((kConversionBuilder[0])) + HIST("Event/after/hCollisionCounter"), 10.0); // accepted - auto V0Photons_coll = v0s.sliceBy(perCollision, collision.globalIndex()); + auto v0PhotonsColl = v0s.sliceBy(perCollision, collision.globalIndex()); - for (auto const& v0 : V0Photons_coll) { + for (auto const& v0 : v0PhotonsColl) { auto pos = v0.posTrack_as(); auto ele = v0.negTrack_as(); auto posmc = pos.template emmcparticle_as(); auto elemc = ele.template emmcparticle_as(); - int photonid = FindCommonMotherFrom2Prongs(posmc, elemc, -11, 11, 22, mcparticles); + int photonid = FindCommonMotherFrom2Prongs(posmc, elemc, kPositron, kElectron, kGamma, mcparticles); auto mcphoton = mcparticles.iteratorAt(photonid); @@ -717,7 +699,7 @@ struct Convbuildercomp { registry.fill(HIST("EMBuilder/hV0SignType"), 3); // zero or undefined } - if ((posmc.pdgCode() == 11 && elemc.pdgCode() == -11) || (posmc.pdgCode() == -11 && elemc.pdgCode() == 11)) { + if ((posmc.pdgCode() == kElectron && elemc.pdgCode() == kPositron) || (posmc.pdgCode() == kPositron && elemc.pdgCode() == kElectron)) { registry.fill(HIST("EMBuilder/hV0ElectronPositronTrue"), 1); // good } else { registry.fill(HIST("EMBuilder/hV0ElectronPositronTrue"), 0); // mismatch @@ -733,7 +715,10 @@ struct Convbuildercomp { aod::EMMCParticles const& mcparticles, MyTracksIUMC const& tracks) { - for (auto& collision : collisions) { + for (const auto& collision : collisions) { + + const float minR = 5.0f; + const float maxR = 90.f; if (!fEMEventCut.IsSelected(collision)) { continue; @@ -742,34 +727,34 @@ struct Convbuildercomp { auto mccollision = collision.template emmcevent_as(); auto mcstack = mcparticles.sliceBy(perMcCollision, mccollision.globalIndex()); - auto mctracks_coll = mcparticles.sliceBy(perMcCollision, mccollision.globalIndex()); + auto mcTracksColl = mcparticles.sliceBy(perMcCollision, mccollision.globalIndex()); std::unordered_map mc2trk; - for (auto& trk : tracks) { + for (const auto& trk : tracks) { if (trk.mcParticleId() >= 0) { mc2trk[trk.mcParticleId()] = trk.globalIndex(); } } - for (auto& mc : mctracks_coll) { - if (mc.pdgCode() != 22 || !mc.isPhysicalPrimary()) { + for (const auto& mc : mcTracksColl) { + if (mc.pdgCode() != kGamma || !mc.isPhysicalPrimary()) { continue; } auto daughters = mc.daughtersIds(); - if (daughters.size() != 2) { + if (daughters.size() != 2) { // o2-linter: disable=magic-number (this is pretty clear and not magic) continue; } auto d1 = mcparticles.iteratorAt(daughters[0]); auto d2 = mcparticles.iteratorAt(daughters[1]); - if (std::abs(d1.pdgCode()) != 11 || std::abs(d2.pdgCode()) != 11) { + if (std::abs(d1.pdgCode()) != kElectron || std::abs(d2.pdgCode()) != kElectron) { continue; } float r = std::hypot(d1.vx(), d1.vy()); - if (r < 5.0f || r > 90.0f) { + if (r < minR || r > maxR) { continue; } @@ -797,7 +782,7 @@ struct Convbuildercomp { MyMCV0Legs const&, aod::EMMCParticles const&, aod::McParticles const& mcparticles, - dauTracks const&) + DauTracks const&) { std::unordered_map trackToMcLabel; for (auto const& t : tracksgen) { @@ -807,7 +792,7 @@ struct Convbuildercomp { } } - for (auto& collision : collisions) { + for (const auto& collision : collisions) { if (!fEMEventCut.IsSelected(collision)) continue; @@ -830,7 +815,7 @@ struct Convbuildercomp { auto negmc = it.negTrack_as() .emmcparticle_as(); int pid = FindCommonMotherFrom2Prongs(posmc, negmc, - -11, 11, 22, mcparticles); + kPositron, kElectron, kGamma, mcparticles); if (pid >= 0) table[pid].emIt = it; } @@ -844,7 +829,7 @@ struct Convbuildercomp { auto posmc = mcparticles.iteratorAt(trackToMcLabel[posTrackIndex]); auto negmc = mcparticles.iteratorAt(trackToMcLabel[negTrackIndex]); int pid = FindCommonMotherFrom2Prongs(posmc, negmc, - -11, 11, 22, mcparticles); + kPositron, kElectron, kGamma, mcparticles); if (pid >= 0) table[pid].lfIt = it; } @@ -857,7 +842,7 @@ struct Convbuildercomp { auto& lfV0 = *entry.lfIt.value(); auto v0MC = lfV0.template v0MCCore_as< soa::Join>(); - auto posTrack = lfV0.template posTrackExtra_as(); + auto posTrack = lfV0.template posTrackExtra_as(); fillV0Info(lfV0, v0MC, posTrack); } else if (entry.emIt.has_value()) { @@ -872,20 +857,20 @@ struct Convbuildercomp { auto& lfV0 = *entry.lfIt.value(); auto v0MC = lfV0.template v0MCCore_as< soa::Join>(); - auto posTrack = lfV0.template posTrackExtra_as(); + auto posTrack = lfV0.template posTrackExtra_as(); fillV0Info(lfV0, v0MC, posTrack); } } } } - PROCESS_SWITCH(Convbuildercomp, processMatchCategories, "Process V0s matched via MC photon", false); - PROCESS_SWITCH(Convbuildercomp, processLFV0sMC, "Process LF Builder V0s", true); - PROCESS_SWITCH(Convbuildercomp, processEMV0sMC, "Process EM Builder V0s", false); - PROCESS_SWITCH(Convbuildercomp, processConvV0s, "Process generated converted V0s", false); + PROCESS_SWITCH(Compconvbuilder, processMatchCategories, "Process V0s matched via MC photon", false); + PROCESS_SWITCH(Compconvbuilder, processLFV0sMC, "Process LF Builder V0s", true); + PROCESS_SWITCH(Compconvbuilder, processEMV0sMC, "Process EM Builder V0s", false); + PROCESS_SWITCH(Compconvbuilder, processConvV0s, "Process generated converted V0s", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfg) { - return WorkflowSpec{adaptAnalysisTask(cfg)}; + return WorkflowSpec{adaptAnalysisTask(cfg)}; } From 9134d2f8bde018e789ce7a71381e1467f5b0802a Mon Sep 17 00:00:00 2001 From: Neelkamal Mallick <104082831+nmallick19@users.noreply.github.com> Date: Mon, 4 Aug 2025 17:50:09 +0300 Subject: [PATCH 221/345] [PWGCF] cfgTrackBitMask type changed to uint16_t (#12406) --- PWGCF/Tasks/correlations.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGCF/Tasks/correlations.cxx b/PWGCF/Tasks/correlations.cxx index 941f9541612..044699d8f1e 100644 --- a/PWGCF/Tasks/correlations.cxx +++ b/PWGCF/Tasks/correlations.cxx @@ -84,7 +84,7 @@ struct CorrelationTask { O2_DEFINE_CONFIGURABLE(cfgTwoTrackCutMinRadius, float, 0.8f, "Two track cut: radius in m from which two track cuts are applied"); O2_DEFINE_CONFIGURABLE(cfgLocalEfficiency, int, 0, "0 = OFF and 1 = ON for local efficiency"); O2_DEFINE_CONFIGURABLE(cfgCentBinsForMC, int, 0, "0 = OFF and 1 = ON for data like multiplicity/centrality bins for MC steps"); - O2_DEFINE_CONFIGURABLE(cfgTrackBitMask, uint8_t, 0, "BitMask for track selection systematics; refer to the enum TrackSelectionCuts in filtering task"); + O2_DEFINE_CONFIGURABLE(cfgTrackBitMask, uint16_t, 0, "BitMask for track selection systematics; refer to the enum TrackSelectionCuts in filtering task"); // Suggested values: Photon: 0.004; K0 and Lambda: 0.005 Configurable> cfgPairCut{"cfgPairCut", {kCfgPairCutDefaults[0], 5, {"Photon", "K0", "Lambda", "Phi", "Rho"}}, "Pair cuts on various particles"}; From 1d1b90d45326aea7407cd90a8fad8fd62145758b Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Mon, 4 Aug 2025 17:55:01 +0200 Subject: [PATCH 222/345] [PWGEM/Dilepton] add a trigger (#12420) --- PWGEM/Dilepton/DataModel/dileptonTables.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/PWGEM/Dilepton/DataModel/dileptonTables.h b/PWGEM/Dilepton/DataModel/dileptonTables.h index 74b9d1b604d..e528e15c2ef 100644 --- a/PWGEM/Dilepton/DataModel/dileptonTables.h +++ b/PWGEM/Dilepton/DataModel/dileptonTables.h @@ -41,6 +41,7 @@ enum class swtAliases : int { // software trigger aliases for EM kSingleMuLow, kSingleMuHigh, kDiMuon, + kHighFt0cFv0Mult, kNaliases }; @@ -54,6 +55,7 @@ const std::unordered_map aliasLabels = { {"fSingleMuLow", static_cast(o2::aod::pwgem::dilepton::swt::swtAliases::kSingleMuLow)}, {"fSingleMuHigh", static_cast(o2::aod::pwgem::dilepton::swt::swtAliases::kSingleMuHigh)}, {"fDiMuon", static_cast(o2::aod::pwgem::dilepton::swt::swtAliases::kDiMuon)}, + {"fHighFt0cFv0Mult", static_cast(o2::aod::pwgem::dilepton::swt::swtAliases::kHighFt0cFv0Mult)}, }; } // namespace pwgem::dilepton::swt From 0a5fae4cd8bebbf11e2cb871cb1b70d222e76b42 Mon Sep 17 00:00:00 2001 From: Junlee Kim Date: Tue, 5 Aug 2025 00:57:09 +0900 Subject: [PATCH 223/345] [PWGLF] relative azimuthal angle to be configurable (#12405) --- PWGLF/Tasks/Resonances/f0980pbpbanalysis.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGLF/Tasks/Resonances/f0980pbpbanalysis.cxx b/PWGLF/Tasks/Resonances/f0980pbpbanalysis.cxx index 96abd0ca43a..4279f99bbc0 100644 --- a/PWGLF/Tasks/Resonances/f0980pbpbanalysis.cxx +++ b/PWGLF/Tasks/Resonances/f0980pbpbanalysis.cxx @@ -135,6 +135,7 @@ struct F0980pbpbanalysis { ConfigurableAxis massAxis{"massAxis", {400, 0.2, 2.2}, "Invariant mass axis"}; ConfigurableAxis ptAxis{"ptAxis", {VARIABLE_WIDTH, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.8, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 6.0, 7.0, 8.0, 10.0, 13.0, 20.0}, "Transverse momentum Binning"}; ConfigurableAxis centAxis{"centAxis", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 100}, "Centrality interval"}; + ConfigurableAxis epAxis{"epAxis", {6, 0.0, o2::constants::math::TwoPI}, "EP axis"}; // for event mixing SliceCache cache; @@ -591,7 +592,6 @@ struct F0980pbpbanalysis { void init(o2::framework::InitContext&) { - AxisSpec epAxis = {6, 0.0, o2::constants::math::TwoPI}; AxisSpec qaCentAxis = {110, 0, 110}; AxisSpec qaVzAxis = {100, -20, 20}; AxisSpec qaPIDAxis = {100, -10, 10}; From 9036cfe9139378c068f0fc832d9f3b046152e754 Mon Sep 17 00:00:00 2001 From: Swati <69241911+SwatiSaha-1997@users.noreply.github.com> Date: Mon, 4 Aug 2025 23:48:35 +0530 Subject: [PATCH 224/345] [PWGCF] Added multiplicity correlation based cuts for event selection (#12414) --- .../Tasks/MeanptFluctuations.cxx | 280 +++++++++++++----- 1 file changed, 213 insertions(+), 67 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/MeanptFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/MeanptFluctuations.cxx index e184f65c5a1..89c00f981a7 100644 --- a/PWGCF/EbyEFluctuations/Tasks/MeanptFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/MeanptFluctuations.cxx @@ -46,16 +46,16 @@ namespace o2::aod { -namespace ptQn +namespace pt_qn { DECLARE_SOA_COLUMN(Q1, q1, float); //! sum of pT of tracks in an event DECLARE_SOA_COLUMN(Q2, q2, float); //! sum of (pT)^2 of tracks in an event DECLARE_SOA_COLUMN(Q3, q3, float); //! sum of (pT)^3 of tracks in an event DECLARE_SOA_COLUMN(Q4, q4, float); //! sum of (pT)^4 of tracks in an event -DECLARE_SOA_COLUMN(N_ch, n_ch, float); //! no of charged particles/multiplicity in an event +DECLARE_SOA_COLUMN(Nch, nch, float); //! no of charged particles/multiplicity in an event DECLARE_SOA_COLUMN(Centrality, centrality, float); //! Centrality of event -} // namespace ptQn -DECLARE_SOA_TABLE(MultPtQn, "AOD", "PTQN", ptQn::Q1, ptQn::Q2, ptQn::Q3, ptQn::Q4, ptQn::N_ch, ptQn::Centrality); //! table to store e-by-e sum of pT, (pT)^2, (pT)^3, (pT)^4 of tracks, multiplicity and centrality +} // namespace pt_qn +DECLARE_SOA_TABLE(MultPtQn, "AOD", "PTQN", pt_qn::Q1, pt_qn::Q2, pt_qn::Q3, pt_qn::Q4, pt_qn::Nch, pt_qn::Centrality); //! table to store e-by-e sum of pT, (pT)^2, (pT)^3, (pT)^4 of tracks, multiplicity and centrality } // namespace o2::aod using namespace o2; @@ -64,9 +64,11 @@ using namespace o2::framework::expressions; #define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable NAME{#NAME, DEFAULT, HELP}; -struct MeanptFluctuations_QA_QnTable { +struct MeanptFluctuationsQAQnTable { Configurable cfgCutVertex{"cfgCutVertex", 10.0f, "Accepted z-vertex range"}; + Configurable cfgCutPreSelEta{"cfgCutPreSelEta", 0.8f, "|eta| cfgCutPreSelPt{"cfgCutPreSelPt", 5.0f, "Maximum allowed pT"}; Configurable cfgCutPtLower{"cfgCutPtLower", 0.2f, "Lower pT cut"}; Configurable cfgCutPtUpper{"cfgCutPtUpper", 3.0f, "Higher pT cut"}; Configurable cfgCutTpcChi2NCl{"cfgCutTpcChi2NCl", 2.5f, "Maximum TPCchi2NCl"}; @@ -82,23 +84,61 @@ struct MeanptFluctuations_QA_QnTable { Configurable cfgEvSelkNoTimeFrameBorder{"cfgEvSelkNoTimeFrameBorder", true, "TimeFrame border event selection cut"}; Configurable cfgCentralityEstimator{"cfgCentralityEstimator", 1, "Centrlaity estimatore choice: 1-->FT0C, 2-->FT0A; 3-->FT0M, 4-->FV0A"}; + O2_DEFINE_CONFIGURABLE(cfgEvSelMultCorrelation, bool, true, "Multiplicity correlation cut") + O2_DEFINE_CONFIGURABLE(cfgEvSelV0AT0ACut, bool, true, "V0A T0A 5 sigma cut") + struct : ConfigurableGroup { + O2_DEFINE_CONFIGURABLE(cfgMultCentHighCutFunction, std::string, "[0] + [1]*x + [2]*x*x + [3]*x*x*x + [4]*x*x*x*x + 10.*([5] + [6]*x + [7]*x*x + [8]*x*x*x + [9]*x*x*x*x)", "Functional for multiplicity correlation cut"); + O2_DEFINE_CONFIGURABLE(cfgMultCentLowCutFunction, std::string, "[0] + [1]*x + [2]*x*x + [3]*x*x*x + [4]*x*x*x*x - 3.*([5] + [6]*x + [7]*x*x + [8]*x*x*x + [9]*x*x*x*x)", "Functional for multiplicity correlation cut"); + O2_DEFINE_CONFIGURABLE(cfgMultT0CCutEnabled, bool, false, "Enable Global multiplicity vs T0C centrality cut") + Configurable> cfgMultT0CCutPars{"cfgMultT0CCutPars", std::vector{143.04, -4.58368, 0.0766055, -0.000727796, 2.86153e-06, 23.3108, -0.36304, 0.00437706, -4.717e-05, 1.98332e-07}, "Global multiplicity vs T0C centrality cut parameter values"}; + O2_DEFINE_CONFIGURABLE(cfgMultPVT0CCutEnabled, bool, false, "Enable PV multiplicity vs T0C centrality cut") + Configurable> cfgMultPVT0CCutPars{"cfgMultPVT0CCutPars", std::vector{195.357, -6.15194, 0.101313, -0.000955828, 3.74793e-06, 30.0326, -0.43322, 0.00476265, -5.11206e-05, 2.13613e-07}, "PV multiplicity vs T0C centrality cut parameter values"}; + + O2_DEFINE_CONFIGURABLE(cfgMultMultPVHighCutFunction, std::string, "[0]+[1]*x + 5.*([2]+[3]*x)", "Functional for multiplicity correlation cut"); + O2_DEFINE_CONFIGURABLE(cfgMultMultPVLowCutFunction, std::string, "[0]+[1]*x - 5.*([2]+[3]*x)", "Functional for multiplicity correlation cut"); + O2_DEFINE_CONFIGURABLE(cfgMultGlobalPVCutEnabled, bool, false, "Enable global multiplicity vs PV multiplicity cut") + Configurable> cfgMultGlobalPVCutPars{"cfgMultGlobalPVCutPars", std::vector{-0.140809, 0.734344, 2.77495, 0.0165935}, "PV multiplicity vs T0C centrality cut parameter values"}; + + O2_DEFINE_CONFIGURABLE(cfgMultMultV0AHighCutFunction, std::string, "[0] + [1]*x + [2]*x*x + [3]*x*x*x + [4]*x*x*x*x + 4.*([5] + [6]*x + [7]*x*x + [8]*x*x*x + [9]*x*x*x*x)", "Functional for multiplicity correlation cut"); + O2_DEFINE_CONFIGURABLE(cfgMultMultV0ALowCutFunction, std::string, "[0] + [1]*x + [2]*x*x + [3]*x*x*x + [4]*x*x*x*x - 3.*([5] + [6]*x + [7]*x*x + [8]*x*x*x + [9]*x*x*x*x)", "Functional for multiplicity correlation cut"); + O2_DEFINE_CONFIGURABLE(cfgMultMultV0ACutEnabled, bool, false, "Enable global multiplicity vs V0A multiplicity cut") + Configurable> cfgMultMultV0ACutPars{"cfgMultMultV0ACutPars", std::vector{534.893, 184.344, 0.423539, -0.00331436, 5.34622e-06, 871.239, 53.3735, -0.203528, 0.000122758, 5.41027e-07}, "Global multiplicity vs V0A multiplicity cut parameter values"}; + + std::vector multT0CCutPars; + std::vector multPVT0CCutPars; + std::vector multGlobalPVCutPars; + std::vector multMultV0ACutPars; + TF1* fMultPVT0CCutLow = nullptr; + TF1* fMultPVT0CCutHigh = nullptr; + TF1* fMultT0CCutLow = nullptr; + TF1* fMultT0CCutHigh = nullptr; + TF1* fMultGlobalPVCutLow = nullptr; + TF1* fMultGlobalPVCutHigh = nullptr; + TF1* fMultMultV0ACutLow = nullptr; + TF1* fMultMultV0ACutHigh = nullptr; + TF1* fT0AV0AMean = nullptr; + TF1* fT0AV0ASigma = nullptr; + + } cfgFuncParas; + O2_DEFINE_CONFIGURABLE(cfgUse22sEventCut, bool, true, "Use 22s event cut on mult correlations") + O2_DEFINE_CONFIGURABLE(cfgUseSmallIonAdditionalEventCut, bool, true, "Use additional event cut on mult correlations for small ions") // Filter command*********** Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex; - Filter trackFilter = (nabs(aod::track::eta) < 0.8f) && (aod::track::pt > cfgCutPtLower) && (aod::track::pt < 5.0f) && (requireGlobalTrackInFilter()) && (aod::track::tpcChi2NCl < cfgCutTpcChi2NCl) && (aod::track::itsChi2NCl < cfgCutItsChi2NCl) && (nabs(aod::track::dcaZ) < cfgCutTrackDcaZ); + Filter trackFilter = (nabs(aod::track::eta) < cfgCutPreSelEta) && (aod::track::pt > cfgCutPtLower) && (aod::track::pt < cfgCutPreSelPt) && (requireGlobalTrackInFilter()) && (aod::track::tpcChi2NCl < cfgCutTpcChi2NCl) && (aod::track::itsChi2NCl < cfgCutItsChi2NCl) && (nabs(aod::track::dcaZ) < cfgCutTrackDcaZ); // Connect to ccdb Service ccdb; - Configurable nolaterthan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; - Configurable url{"ccdb-url", "http://ccdb-test.cern.ch:8080", "url of the ccdb repository"}; + Configurable ccdbnolaterthan{"ccdbnolaterthan", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; + Configurable ccdburl{"ccdburl", "http://ccdb-test.cern.ch:8080", "url of the ccdb repository"}; HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; // filtering collisions and tracks*********** - using aodCollisions = soa::Filtered>; + using AodCollisions = soa::Filtered>; // using aodCollisions = soa::Filtered>; - using aodTracks = soa::Filtered>; + using AodTracks = soa::Filtered>; // Event selection cuts - Alex TF1* fMultPVCutLow = nullptr; @@ -131,6 +171,20 @@ struct MeanptFluctuations_QA_QnTable { histos.add("hMeanPt", "", kTProfile, {centAxis}); histos.add("Hist2D_globalTracks_PVTracks", "", {HistType::kTH2D, {nchAxis, nchAxis}}); histos.add("Hist2D_cent_nch", "", {HistType::kTH2D, {nchAxis, centAxis}}); + // before selection + histos.add("His2D_globalTracks_PVTracks_beforeSel", "", {HistType::kTH2D, {nchAxis, nchAxis}}); + histos.add("His2D_globalTracks_centFT0C_beforeSel", "", {HistType::kTH2D, {centAxis, nchAxis}}); + histos.add("His2D_PVTracks_centFT0C_beforeSel", "", {HistType::kTH2D, {centAxis, nchAxis}}); + histos.add("His2D_globalTracks_V0ATracks_beforeSel", "", {HistType::kTH2D, {nchAxis, nchAxis}}); + histos.add("His2D_globalTracks_T0ATracks_beforeSel", "", {HistType::kTH2D, {nchAxis, nchAxis}}); + histos.add("His2D_V0ATracks_T0CTracks_beforeSel", "", {HistType::kTH2D, {nchAxis, nchAxis}}); + // after selection + histos.add("His2D_globalTracks_PVTracks_afterSel", "", {HistType::kTH2D, {nchAxis, nchAxis}}); + histos.add("His2D_globalTracks_centFT0C_afterSel", "", {HistType::kTH2D, {centAxis, nchAxis}}); + histos.add("His2D_PVTracks_centFT0C_afterSel", "", {HistType::kTH2D, {centAxis, nchAxis}}); + histos.add("His2D_globalTracks_V0ATracks_afterSel", "", {HistType::kTH2D, {nchAxis, nchAxis}}); + histos.add("His2D_globalTracks_T0ATracks_afterSel", "", {HistType::kTH2D, {nchAxis, nchAxis}}); + histos.add("His2D_V0ATracks_T0CTracks_afterSel", "", {HistType::kTH2D, {nchAxis, nchAxis}}); // Event selection - Alex if (cfgUse22sEventCut) { @@ -147,6 +201,33 @@ struct MeanptFluctuations_QA_QnTable { fMultMultPVCut->SetParameters(-0.1, 0.785, -4.7e-05); } + if (cfgEvSelMultCorrelation) { + cfgFuncParas.multT0CCutPars = cfgFuncParas.cfgMultT0CCutPars; + cfgFuncParas.multPVT0CCutPars = cfgFuncParas.cfgMultPVT0CCutPars; + cfgFuncParas.multGlobalPVCutPars = cfgFuncParas.cfgMultGlobalPVCutPars; + cfgFuncParas.multMultV0ACutPars = cfgFuncParas.cfgMultMultV0ACutPars; + cfgFuncParas.fMultPVT0CCutLow = new TF1("fMultPVT0CCutLow", cfgFuncParas.cfgMultCentLowCutFunction->c_str(), 0, 100); + cfgFuncParas.fMultPVT0CCutLow->SetParameters(&(cfgFuncParas.multPVT0CCutPars[0])); + cfgFuncParas.fMultPVT0CCutHigh = new TF1("fMultPVT0CCutHigh", cfgFuncParas.cfgMultCentHighCutFunction->c_str(), 0, 100); + cfgFuncParas.fMultPVT0CCutHigh->SetParameters(&(cfgFuncParas.multPVT0CCutPars[0])); + cfgFuncParas.fMultT0CCutLow = new TF1("fMultT0CCutLow", cfgFuncParas.cfgMultCentLowCutFunction->c_str(), 0, 100); + cfgFuncParas.fMultT0CCutLow->SetParameters(&(cfgFuncParas.multT0CCutPars[0])); + cfgFuncParas.fMultT0CCutHigh = new TF1("fMultT0CCutHigh", cfgFuncParas.cfgMultCentHighCutFunction->c_str(), 0, 100); + cfgFuncParas.fMultT0CCutHigh->SetParameters(&(cfgFuncParas.multT0CCutPars[0])); + cfgFuncParas.fMultGlobalPVCutLow = new TF1("fMultGlobalPVCutLow", cfgFuncParas.cfgMultMultPVLowCutFunction->c_str(), 0, 4000); + cfgFuncParas.fMultGlobalPVCutLow->SetParameters(&(cfgFuncParas.multGlobalPVCutPars[0])); + cfgFuncParas.fMultGlobalPVCutHigh = new TF1("fMultGlobalPVCutHigh", cfgFuncParas.cfgMultMultPVHighCutFunction->c_str(), 0, 4000); + cfgFuncParas.fMultGlobalPVCutHigh->SetParameters(&(cfgFuncParas.multGlobalPVCutPars[0])); + cfgFuncParas.fMultMultV0ACutLow = new TF1("fMultMultV0ACutLow", cfgFuncParas.cfgMultMultV0ALowCutFunction->c_str(), 0, 4000); + cfgFuncParas.fMultMultV0ACutLow->SetParameters(&(cfgFuncParas.multMultV0ACutPars[0])); + cfgFuncParas.fMultMultV0ACutHigh = new TF1("fMultMultV0ACutHigh", cfgFuncParas.cfgMultMultV0AHighCutFunction->c_str(), 0, 4000); + cfgFuncParas.fMultMultV0ACutHigh->SetParameters(&(cfgFuncParas.multMultV0ACutPars[0])); + cfgFuncParas.fT0AV0AMean = new TF1("fT0AV0AMean", "[0]+[1]*x", 0, 200000); + cfgFuncParas.fT0AV0AMean->SetParameters(-1601.0581, 9.417652e-01); + cfgFuncParas.fT0AV0ASigma = new TF1("fT0AV0ASigma", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x", 0, 200000); + cfgFuncParas.fT0AV0ASigma->SetParameters(463.4144, 6.796509e-02, -9.097136e-07, 7.971088e-12, -2.600581e-17); + } + } //! end init function template @@ -160,7 +241,9 @@ struct MeanptFluctuations_QA_QnTable { if (collision.numContrib() > 1) { vtxz = collision.posZ(); float zRes = std::sqrt(collision.covZZ()); - if (zRes > 0.25 && collision.numContrib() < 20) + float zResMax = 0.25; + float numContribMin = 20; + if (zRes > zResMax && collision.numContrib() < numContribMin) vtxz = -999; } auto multNTracksPV = collision.multNTracksPV(); @@ -181,10 +264,52 @@ struct MeanptFluctuations_QA_QnTable { return 1; } - Produces mult_ptQn; + template + bool eventSelectedSmallion(TCollision collision, const int multTrk, const float centrality) + { + auto multNTracksPV = collision.multNTracksPV(); + + if (cfgEvSelMultCorrelation) { + if (cfgFuncParas.cfgMultPVT0CCutEnabled) { + if (multNTracksPV < cfgFuncParas.fMultPVT0CCutLow->Eval(centrality)) + return 0; + if (multNTracksPV > cfgFuncParas.fMultPVT0CCutHigh->Eval(centrality)) + return 0; + } + + if (cfgFuncParas.cfgMultT0CCutEnabled) { + if (multTrk < cfgFuncParas.fMultT0CCutLow->Eval(centrality)) + return 0; + if (multTrk > cfgFuncParas.fMultT0CCutHigh->Eval(centrality)) + return 0; + } + + if (cfgFuncParas.cfgMultGlobalPVCutEnabled) { + if (multTrk < cfgFuncParas.fMultGlobalPVCutLow->Eval(multNTracksPV)) + return 0; + if (multTrk > cfgFuncParas.fMultGlobalPVCutHigh->Eval(multNTracksPV)) + return 0; + } + + if (cfgFuncParas.cfgMultMultV0ACutEnabled) { + if (collision.multFV0A() < cfgFuncParas.fMultMultV0ACutLow->Eval(multTrk)) + return 0; + if (collision.multFV0A() > cfgFuncParas.fMultMultV0ACutHigh->Eval(multTrk)) + return 0; + } + } + + float sigma = 5.0; + if (cfgEvSelV0AT0ACut && (std::fabs(collision.multFV0A() - cfgFuncParas.fT0AV0AMean->Eval(collision.multFT0A())) > sigma * cfgFuncParas.fT0AV0ASigma->Eval(collision.multFT0A()))) + return 0; + + return 1; + } + + Produces multPtQn; // void process(aod::Collision const& coll, aod::Tracks const& inputTracks) - void process(aodCollisions::iterator const& coll, aod::BCsWithTimestamps const&, aodTracks const& inputTracks) + void process(AodCollisions::iterator const& coll, aod::BCsWithTimestamps const&, AodTracks const& inputTracks) { if (!coll.sel8()) { return; @@ -202,36 +327,56 @@ struct MeanptFluctuations_QA_QnTable { return; } - const auto CentralityFT0C = coll.centFT0C(); - if (cfgUse22sEventCut && !eventSelected(coll, inputTracks.size(), CentralityFT0C)) + histos.fill(HIST("His2D_globalTracks_PVTracks_beforeSel"), coll.multNTracksPV(), inputTracks.size()); + histos.fill(HIST("His2D_globalTracks_centFT0C_beforeSel"), coll.centFT0C(), inputTracks.size()); + histos.fill(HIST("His2D_PVTracks_centFT0C_beforeSel"), coll.centFT0C(), coll.multNTracksPV()); + histos.fill(HIST("His2D_globalTracks_V0ATracks_beforeSel"), coll.multFV0A(), inputTracks.size()); + histos.fill(HIST("His2D_globalTracks_T0ATracks_beforeSel"), coll.multFT0A(), inputTracks.size()); + histos.fill(HIST("His2D_V0ATracks_T0CTracks_beforeSel"), coll.multFT0C(), coll.multFV0A()); + + const auto centralityFT0C = coll.centFT0C(); + if (cfgUse22sEventCut && !eventSelected(coll, inputTracks.size(), centralityFT0C)) + return; + if (cfgUseSmallIonAdditionalEventCut && !eventSelectedSmallion(coll, inputTracks.size(), centralityFT0C)) return; + histos.fill(HIST("His2D_globalTracks_PVTracks_afterSel"), coll.multNTracksPV(), inputTracks.size()); + histos.fill(HIST("His2D_globalTracks_centFT0C_afterSel"), coll.centFT0C(), inputTracks.size()); + histos.fill(HIST("His2D_PVTracks_centFT0C_afterSel"), coll.centFT0C(), coll.multNTracksPV()); + histos.fill(HIST("His2D_globalTracks_V0ATracks_afterSel"), coll.multFV0A(), inputTracks.size()); + histos.fill(HIST("His2D_globalTracks_T0ATracks_afterSel"), coll.multFT0A(), inputTracks.size()); + histos.fill(HIST("His2D_V0ATracks_T0CTracks_afterSel"), coll.multFT0C(), coll.multFV0A()); + histos.fill(HIST("hZvtx_after_sel"), coll.posZ()); double cent = 0.0; - if (cfgCentralityEstimator == 1) + int centChoiceFT0C = 1; + int centChoiceFT0A = 2; + int centChoiceFT0M = 3; + int centChoiceFV0A = 4; + if (cfgCentralityEstimator == centChoiceFT0C) cent = coll.centFT0C(); - else if (cfgCentralityEstimator == 2) + else if (cfgCentralityEstimator == centChoiceFT0A) cent = coll.centFT0A(); - else if (cfgCentralityEstimator == 3) + else if (cfgCentralityEstimator == centChoiceFT0M) cent = coll.centFT0M(); - else if (cfgCentralityEstimator == 4) + else if (cfgCentralityEstimator == centChoiceFV0A) cent = coll.centFV0A(); histos.fill(HIST("hCentrality"), cent); histos.fill(HIST("Hist2D_globalTracks_PVTracks"), coll.multNTracksPV(), inputTracks.size()); - histos.fill(HIST("Hist2D_cent_nch"), inputTracks.size(), CentralityFT0C); + histos.fill(HIST("Hist2D_cent_nch"), inputTracks.size(), centralityFT0C); // variables - double pT_sum = 0.0; - double N = 0.0; + double pTsum = 0.0; + double nN = 0.0; float q1 = 0.0; float q2 = 0.0; float q3 = 0.0; float q4 = 0.0; - float n_ch = 0.0; + float nCh = 0.0; for (const auto& track : inputTracks) { // Loop over tracks @@ -254,44 +399,45 @@ struct MeanptFluctuations_QA_QnTable { histos.fill(HIST("hDcaXY"), track.dcaXY()); histos.fill(HIST("hDcaZ"), track.dcaZ()); - pT_sum += track.pt(); - N += 1.0; + pTsum += track.pt(); + nN += 1.0; float pT = track.pt(); - // calculating Q1, Q2, Q3, Q4. N_ch + // calculating Q1, Q2, Q3, Q4. Nch if (track.pt() > cfgCutPtLower && track.pt() < cfgCutPtUpper && track.sign() != 0) { q1 = q1 + std::pow(pT, 1.0); q2 = q2 + std::pow(pT, 2.0); q3 = q3 + std::pow(pT, 3.0); q4 = q4 + std::pow(pT, 4.0); - n_ch = n_ch + 1; + nCh = nCh + 1; } } - mult_ptQn(q1, q2, q3, q4, n_ch, cent); + multPtQn(q1, q2, q3, q4, nCh, cent); // MeanPt - if (N > 0.0f) - histos.fill(HIST("hMeanPt"), cent, pT_sum / N); + if (nN > 0.0f) + histos.fill(HIST("hMeanPt"), cent, pTsum / nN); } }; -struct MeanptFluctuations_analysis { +struct MeanptFluctuationsAnalysis { - Configurable cfgNSubsample{"cfgNSubsample", 10, "Number of subsamples"}; + Configurable cfgNsubSample{"cfgNsubSample", 10, "Number of subsamples"}; ConfigurableAxis centAxis{"centAxis", {90, 0, 90}, ""}; ConfigurableAxis multAxis{"multAxis", {5000, 0.5, 5000.5}, ""}; ConfigurableAxis meanpTAxis{"meanpTAxis", {500, 0, 5.0}, ""}; - expressions::Filter Nch_filter = aod::ptQn::n_ch > 3.0f; + float minNch = 3.0f; + expressions::Filter nchFilter = aod::pt_qn::nch > minNch; using FilteredMultPtQn = soa::Filtered; // Connect to ccdb Service ccdb; - Configurable nolaterthan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; - Configurable url{"ccdb-url", "http://ccdb-test.cern.ch:8080", "url of the ccdb repository"}; + Configurable ccdbnolaterthan{"ccdbnolaterthan", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; + Configurable ccdburl{"ccdburl", "http://ccdb-test.cern.ch:8080", "url of the ccdb repository"}; // Define output HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject}; - std::vector>> Subsample; + std::vector>> subSample; TRandom3* fRndm = new TRandom3(0); void init(o2::framework::InitContext&) @@ -307,49 +453,49 @@ struct MeanptFluctuations_analysis { registry.add("Hist2D_meanpt_centrality", "", {HistType::kTH2D, {centAxis, meanpTAxis}}); // initial array - Subsample.resize(cfgNSubsample); - for (int i = 0; i < cfgNSubsample; i++) { - Subsample[i].resize(4); + subSample.resize(cfgNsubSample); + for (int i = 0; i < cfgNsubSample; i++) { + subSample[i].resize(4); } - for (int i = 0; i < cfgNSubsample; i++) { - Subsample[i][0] = std::get>(registry.add(Form("Subsample_%d/Prof_mean_t1", i), "", {HistType::kTProfile2D, {centAxis, multAxis}})); - Subsample[i][1] = std::get>(registry.add(Form("Subsample_%d/Prof_var_t1", i), "", {HistType::kTProfile2D, {centAxis, multAxis}})); - Subsample[i][2] = std::get>(registry.add(Form("Subsample_%d/Prof_skew_t1", i), "", {HistType::kTProfile2D, {centAxis, multAxis}})); - Subsample[i][3] = std::get>(registry.add(Form("Subsample_%d/Prof_kurt_t1", i), "", {HistType::kTProfile2D, {centAxis, multAxis}})); + for (int i = 0; i < cfgNsubSample; i++) { + subSample[i][0] = std::get>(registry.add(Form("subSample_%d/Prof_mean_t1", i), "", {HistType::kTProfile2D, {centAxis, multAxis}})); + subSample[i][1] = std::get>(registry.add(Form("subSample_%d/Prof_var_t1", i), "", {HistType::kTProfile2D, {centAxis, multAxis}})); + subSample[i][2] = std::get>(registry.add(Form("subSample_%d/Prof_skew_t1", i), "", {HistType::kTProfile2D, {centAxis, multAxis}})); + subSample[i][3] = std::get>(registry.add(Form("subSample_%d/Prof_kurt_t1", i), "", {HistType::kTProfile2D, {centAxis, multAxis}})); } } - float mean_term1; - float variance_term1; - float skewness_term1; - float kurtosis_term1; + float meanTerm1; + float varianceTerm1; + float skewnessTerm1; + float kurtosisTerm1; // void process(aod::MultPtQn::iterator const& event_ptqn) void process(FilteredMultPtQn::iterator const& event_ptqn) { - // LOGF(info, "Centrality= %f Nch= %f Q1= %f Q2= %f", event_ptqn.centrality(), event_ptqn.n_ch(), event_ptqn.q1(), event_ptqn.q2()); + // LOGF(info, "Centrality= %f Nch= %f Q1= %f Q2= %f", event_ptqn.centrality(), event_ptqn.nch(), event_ptqn.q1(), event_ptqn.q2()); // calculating observables - mean_term1 = event_ptqn.q1() / event_ptqn.n_ch(); - variance_term1 = (std::pow(event_ptqn.q1(), 2.0f) - event_ptqn.q2()) / (event_ptqn.n_ch() * (event_ptqn.n_ch() - 1.0f)); - skewness_term1 = (std::pow(event_ptqn.q1(), 3.0f) - 3.0f * event_ptqn.q2() * event_ptqn.q1() + 2.0f * event_ptqn.q3()) / (event_ptqn.n_ch() * (event_ptqn.n_ch() - 1.0f) * (event_ptqn.n_ch() - 2.0f)); - kurtosis_term1 = (std::pow(event_ptqn.q1(), 4.0f) - (6.0f * event_ptqn.q4()) + (8.0f * event_ptqn.q1() * event_ptqn.q3()) - (6.0f * std::pow(event_ptqn.q1(), 2.0f) * event_ptqn.q2()) + (3.0f * std::pow(event_ptqn.q2(), 2.0f))) / (event_ptqn.n_ch() * (event_ptqn.n_ch() - 1.0f) * (event_ptqn.n_ch() - 2.0f) * (event_ptqn.n_ch() - 3.0f)); + meanTerm1 = event_ptqn.q1() / event_ptqn.nch(); + varianceTerm1 = (std::pow(event_ptqn.q1(), 2.0f) - event_ptqn.q2()) / (event_ptqn.nch() * (event_ptqn.nch() - 1.0f)); + skewnessTerm1 = (std::pow(event_ptqn.q1(), 3.0f) - 3.0f * event_ptqn.q2() * event_ptqn.q1() + 2.0f * event_ptqn.q3()) / (event_ptqn.nch() * (event_ptqn.nch() - 1.0f) * (event_ptqn.nch() - 2.0f)); + kurtosisTerm1 = (std::pow(event_ptqn.q1(), 4.0f) - (6.0f * event_ptqn.q4()) + (8.0f * event_ptqn.q1() * event_ptqn.q3()) - (6.0f * std::pow(event_ptqn.q1(), 2.0f) * event_ptqn.q2()) + (3.0f * std::pow(event_ptqn.q2(), 2.0f))) / (event_ptqn.nch() * (event_ptqn.nch() - 1.0f) * (event_ptqn.nch() - 2.0f) * (event_ptqn.nch() - 3.0f)); // filling profiles and histograms for central values - registry.get(HIST("Prof_mean_t1"))->Fill(event_ptqn.centrality(), event_ptqn.n_ch(), mean_term1); - registry.get(HIST("Prof_var_t1"))->Fill(event_ptqn.centrality(), event_ptqn.n_ch(), variance_term1); - registry.get(HIST("Prof_skew_t1"))->Fill(event_ptqn.centrality(), event_ptqn.n_ch(), skewness_term1); - registry.get(HIST("Prof_kurt_t1"))->Fill(event_ptqn.centrality(), event_ptqn.n_ch(), kurtosis_term1); - registry.fill(HIST("Hist2D_Nch_centrality"), event_ptqn.centrality(), event_ptqn.n_ch()); - registry.fill(HIST("Hist2D_meanpt_centrality"), event_ptqn.centrality(), mean_term1); + registry.get(HIST("Prof_mean_t1"))->Fill(event_ptqn.centrality(), event_ptqn.nch(), meanTerm1); + registry.get(HIST("Prof_var_t1"))->Fill(event_ptqn.centrality(), event_ptqn.nch(), varianceTerm1); + registry.get(HIST("Prof_skew_t1"))->Fill(event_ptqn.centrality(), event_ptqn.nch(), skewnessTerm1); + registry.get(HIST("Prof_kurt_t1"))->Fill(event_ptqn.centrality(), event_ptqn.nch(), kurtosisTerm1); + registry.fill(HIST("Hist2D_Nch_centrality"), event_ptqn.centrality(), event_ptqn.nch()); + registry.fill(HIST("Hist2D_meanpt_centrality"), event_ptqn.centrality(), meanTerm1); // selecting subsample and filling profiles - float l_Random = fRndm->Rndm(); - int SampleIndex = static_cast(cfgNSubsample * l_Random); - Subsample[SampleIndex][0]->Fill(event_ptqn.centrality(), event_ptqn.n_ch(), mean_term1); - Subsample[SampleIndex][1]->Fill(event_ptqn.centrality(), event_ptqn.n_ch(), variance_term1); - Subsample[SampleIndex][2]->Fill(event_ptqn.centrality(), event_ptqn.n_ch(), skewness_term1); - Subsample[SampleIndex][3]->Fill(event_ptqn.centrality(), event_ptqn.n_ch(), kurtosis_term1); + float lRandom = fRndm->Rndm(); + int sampleIndex = static_cast(cfgNsubSample * lRandom); + subSample[sampleIndex][0]->Fill(event_ptqn.centrality(), event_ptqn.nch(), meanTerm1); + subSample[sampleIndex][1]->Fill(event_ptqn.centrality(), event_ptqn.nch(), varianceTerm1); + subSample[sampleIndex][2]->Fill(event_ptqn.centrality(), event_ptqn.nch(), skewnessTerm1); + subSample[sampleIndex][3]->Fill(event_ptqn.centrality(), event_ptqn.nch(), kurtosisTerm1); } }; @@ -357,7 +503,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { // Equivalent to the AddTask in AliPhysics return WorkflowSpec{ - adaptAnalysisTask(cfgc), - adaptAnalysisTask(cfgc), + adaptAnalysisTask(cfgc), + adaptAnalysisTask(cfgc), }; } From 12056a78013fc30139d52cc66454d952f9e1e8c3 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Mon, 4 Aug 2025 21:17:37 +0200 Subject: [PATCH 225/345] [PWGEM/Dilepton] update eventQC.cxx for HM (#12424) --- PWGEM/Dilepton/Tasks/eventQC.cxx | 137 ++++++++++++++++++++----------- 1 file changed, 89 insertions(+), 48 deletions(-) diff --git a/PWGEM/Dilepton/Tasks/eventQC.cxx b/PWGEM/Dilepton/Tasks/eventQC.cxx index 60ff83b2da1..02a388397c0 100644 --- a/PWGEM/Dilepton/Tasks/eventQC.cxx +++ b/PWGEM/Dilepton/Tasks/eventQC.cxx @@ -69,7 +69,7 @@ struct eventQC { Configurable> cfgnMods{"cfgnMods", {2, 3}, "Modulation of interest. Please keep increasing order"}; Configurable cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2"}; Configurable cfgQvecEstimator{"cfgQvecEstimator", 0, "FT0M:0, FT0A:1, FT0C:2, BTot:3, BPos:4, BNeg:5"}; - Configurable cfgCentMin{"cfgCentMin", 0, "min. centrality"}; + Configurable cfgCentMin{"cfgCentMin", -1.f, "min. centrality"}; Configurable cfgCentMax{"cfgCentMax", 999.f, "max. centrality"}; Configurable cfgNtracksPV08Min{"cfgNtracksPV08Min", -1, "min. multNTracksPV"}; Configurable cfgNtracksPV08Max{"cfgNtracksPV08Max", 1000000000, "max. multNTracksPV"}; @@ -77,6 +77,12 @@ struct eventQC { Configurable cfgNbinsEta{"cfgNbinsEta", 20, "number of eta bins for output histograms"}; Configurable cfgNbinsPhi{"cfgNbinsPhi", 36, "number of phi bins for output histograms"}; + ConfigurableAxis ConfFT0AMultBins{"ConfFT0AMultBins", {200, 0, 200e+3}, "FT0A multiplicity bins for output histograms"}; + ConfigurableAxis ConfFT0CMultBins{"ConfFT0CMultBins", {600, 0, 60e+3}, "FT0C multiplicity bins for output histograms"}; + ConfigurableAxis ConfFV0AMultBins{"ConfFV0AMultBins", {200, 0, 200e+3}, "FV0A multiplicity bins for output histograms"}; + ConfigurableAxis ConfTrackMultBins{"ConfTrackMultBins", {6001, -0.5, 6e+3 + 0.5}, "Track multiplicity bins for output histograms"}; + ConfigurableAxis ConfCentBins{"ConfCentBins", {110, 0, 110}, "centrality bins for output histograms"}; + struct : ConfigurableGroup { std::string prefix = "eventcut_group"; Configurable cfgZvtxMin{"cfgZvtxMin", -10.f, "min. Zvtx"}; @@ -181,8 +187,30 @@ struct eventQC { void addhistograms() { - // event info + const AxisSpec axis_cent_ft0m{ConfCentBins, "centrality FT0M (%)"}; + const AxisSpec axis_cent_ft0a{ConfCentBins, "centrality FT0A (%)"}; + const AxisSpec axis_cent_ft0c{ConfCentBins, "centrality FT0C (%)"}; + + const AxisSpec axis_mult_ft0a{ConfFT0AMultBins, "FT0A multiplicity"}; + const AxisSpec axis_mult_ft0c{ConfFT0CMultBins, "FT0C multiplicity"}; + const AxisSpec axis_mult_fv0a{ConfFV0AMultBins, "FV0A multiplicity"}; + const AxisSpec axis_mult_ncontrib{ConfTrackMultBins, "N_{track} to PV"}; + const AxisSpec axis_mult_ncontrib08{ConfTrackMultBins, "N_{track} to PV in |#eta| < 0.8"}; + const AxisSpec axis_mult_global_ncontrib08{ConfTrackMultBins, "N_{track}^{global} to PV in |#eta| < 0.8"}; + const AxisSpec axis_mult_globalTrack{ConfTrackMultBins, "N_{track}^{global} in |#eta| < 0.8"}; + + if (doprocessEventQC_SWT) { + fRegistry.add("BC/hNcoll", "Number of collisions per triggered BC;N_{collision} per triggered BC", kTH1F, {{11, -0.5, +10.5}}, false); + fRegistry.add("BC/hDeltaT", "diff. in collision time per BC;#DeltaT_{coll} (ns)", kTH1F, {{200, -100, +100}}, false); + fRegistry.add("BC/hDeltaZ", "diff. in collision Z_{vtx} per BC;#DeltaZ_{vtx} (cm)", kTH1F, {{200, -10, +10}}, false); + fRegistry.add("BC/hCorrNcontrib", "hMultNTracksPV;", kTH2F, {{axis_mult_ncontrib}, {axis_mult_ncontrib}}, false); + fRegistry.add("BC/Collision/hMultNTracksPV", "hMultNTracksPV;N_{track} to PV in |#eta| < 0.8", kTH1F, {{axis_mult_ncontrib08}}, false); + fRegistry.add("BC/Collision/hMultFT0AFT0C", "hMultFT0AFT0C;mult. FT0A;mult. FT0C", kTH2F, {{axis_mult_ft0a}, {axis_mult_ft0c}}, false); + fRegistry.add("BC/Collision/hMultFT0AFV0A", "hMultFT0AFV0A;mult. FT0A;mult. FV0A", kTH2F, {{axis_mult_ft0a}, {axis_mult_fv0a}}, false); + fRegistry.add("BC/Collision/hMultFT0CFV0A", "hMultFT0CFV0A;mult. FT0C;mult. FV0A", kTH2F, {{axis_mult_ft0c}, {axis_mult_fv0a}}, false); + } + // event info const int nbin_ev = 20; auto hCollisionCounter = fRegistry.add("Event/before/hCollisionCounter", "collision counter;;Number of events", kTH1F, {{nbin_ev, 0.5, nbin_ev + 0.5}}, false); hCollisionCounter->GetXaxis()->SetBinLabel(1, "all"); @@ -208,52 +236,33 @@ struct eventQC { fRegistry.add("hNInspectedTVX", "N inspected TVX;run number;N_{TVX}", kTProfile, {{80000, 520000.5, 600000.5}}, true); - const AxisSpec axis_cent_ft0m{{0, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110}, - "centrality FT0M (%)"}; - - const AxisSpec axis_cent_ft0a{{0, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110}, - "centrality FT0A (%)"}; - - const AxisSpec axis_cent_ft0c{{0, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110}, - "centrality FT0C (%)"}; - if (cfgFillEvent) { fRegistry.add("Event/before/hZvtx", "vertex z; Z_{vtx} (cm)", kTH1F, {{100, -50, +50}}, false); - fRegistry.add("Event/before/hMultNTracksPV", "hMultNTracksPV; N_{track} to PV", kTH1F, {{6001, -0.5, 6000.5}}, false); - fRegistry.add("Event/before/hMultNTracksPVeta1", "hMultNTracksPVeta1; N_{track} to PV", kTH1F, {{6001, -0.5, 6000.5}}, false); - fRegistry.add("Event/before/hMultFT0", "hMultFT0;mult. FT0A;mult. FT0C", kTH2F, {{200, 0, 200000}, {60, 0, 60000}}, false); + fRegistry.add("Event/before/hMultNTracksPV", "hMultNTracksPV; N_{track} to PV in |#eta| < 0.8", kTH1F, {{axis_mult_ncontrib08}}, false); + fRegistry.add("Event/before/hMultFT0AFT0C", "hMultFT0AFT0C;mult. FT0A;mult. FT0C", kTH2F, {{axis_mult_ft0a}, {axis_mult_ft0c}}, false); + fRegistry.add("Event/before/hMultFT0AFV0A", "hMultFT0AFV0A;mult. FT0A;mult. FV0A", kTH2F, {{axis_mult_ft0a}, {axis_mult_fv0a}}, false); + fRegistry.add("Event/before/hMultFT0CFV0A", "hMultFT0CFV0A;mult. FT0C;mult. FV0A", kTH2F, {{axis_mult_ft0c}, {axis_mult_fv0a}}, false); fRegistry.add("Event/before/hCentFT0A", "hCentFT0A;centrality FT0A (%)", kTH1F, {{axis_cent_ft0a}}, false); fRegistry.add("Event/before/hCentFT0C", "hCentFT0C;centrality FT0C (%)", kTH1F, {{axis_cent_ft0c}}, false); fRegistry.add("Event/before/hCentFT0M", "hCentFT0M;centrality FT0M (%)", kTH1F, {{axis_cent_ft0m}}, false); - fRegistry.add("Event/before/hCentFT0CvsMultNTracksPV", "hCentFT0CvsMultNTracksPV;centrality FT0C (%);N_{track} to PV", kTH2F, {{100, 0, 100}, {600, 0, 6000}}, false); - fRegistry.add("Event/before/hMultFT0CvsMultNTracksPV", "hMultFT0CvsMultNTracksPV;mult. FT0C;N_{track} to PV", kTH2F, {{60, 0, 60000}, {600, 0, 6000}}, false); - fRegistry.add("Event/before/hMultFT0CvsOccupancy", "hMultFT0CvsOccupancy;mult. FT0C;N_{track} in time range", kTH2F, {{60, 0, 60000}, {200, 0, 20000}}, false); - fRegistry.add("Event/before/hNTracksPVvsOccupancy", "hNTracksPVvsOccupancy;N_{track} to PV;N_{track} in time range", kTH2F, {{600, 0, 6000}, {200, 0, 20000}}, false); - fRegistry.add("Event/before/hNGlobalTracksvsOccupancy", "hNGlobalTracksvsOccupancy;N_{track}^{global};N_{track} in time range", kTH2F, {{600, 0, 6000}, {200, 0, 20000}}, false); - fRegistry.add("Event/before/hNGlobalTracksPVvsOccupancy", "hNGlobalTracksPVvsOccupancy;N_{track}^{global} to PV;N_{track} in time range", kTH2F, {{600, 0, 6000}, {200, 0, 20000}}, false); + fRegistry.add("Event/before/hCentFT0CvsMultNTracksPV", "hCentFT0CvsMultNTracksPV;centrality FT0C (%);N_{track} to PV in |#eta| < 0.8", kTH2F, {{axis_cent_ft0c}, {axis_mult_ncontrib08}}, false); + fRegistry.add("Event/before/hMultFT0CvsMultNTracksPV", "hMultFT0CvsMultNTracksPV;mult. FT0C;N_{track} to PV in |#eta| < 0.8", kTH2F, {{axis_mult_ft0c}, {axis_mult_ncontrib08}}, false); + fRegistry.add("Event/before/hMultFT0CvsTrackOccupancy", "hMultFT0CvsTrackOccupancy;mult. FT0C;N_{track} in time range", kTH2F, {{axis_mult_ft0c}, {200, 0, 20000}}, false); + fRegistry.add("Event/before/hMultFV0AvsMultNTracksPV", "hMultFV0AvsMultNTracksPV;mult. FV0A;N_{track} to PV in |#eta| < 0.8", kTH2F, {{axis_mult_fv0a}, {axis_mult_ncontrib08}}, false); + fRegistry.add("Event/before/hNTracksPVvsTrackOccupancy", "hNTracksPVvsTrackOccupancy;N_{track} to PV in |#eta| < 0.8;N_{track} in time range", kTH2F, {{axis_mult_ncontrib08}, {200, 0, 20000}}, false); + fRegistry.add("Event/before/hNGlobalTracksvsTrackOccupancy", "hNGlobalTracksvsTrackOccupancy;N_{track}^{global} in |#eta| < 0.8;N_{track} in time range", kTH2F, {{axis_mult_globalTrack}, {200, 0, 20000}}, false); + fRegistry.add("Event/before/hNGlobalTracksPVvsTrackOccupancy", "hNGlobalTracksPVvsTrackOccupancy;N_{track}^{global} to PV in |#eta| < 0.8;N_{track} in time range", kTH2F, {{axis_mult_global_ncontrib08}, {200, 0, 20000}}, false); fRegistry.add("Event/before/hCorrOccupancy", "occupancy correlation;FT0C occupancy;track-based occupancy", kTH2F, {{200, 0, 200000}, {200, 0, 20000}}, false); } fRegistry.addClone("Event/before/", "Event/after/"); if (cfgFillEvent) { - fRegistry.add("Event/after/hMultNGlobalTracks", "hMultNGlobalTracks; N_{track}^{global}", kTH1F, {{6001, -0.5, 6000.5}}, false); - fRegistry.add("Event/after/hCentFT0CvsMultNGlobalTracks", "hCentFT0CvsMultNGlobalTracks;centrality FT0C (%);N_{track}^{global}", kTH2F, {{100, 0, 100}, {600, 0, 6000}}, false); - fRegistry.add("Event/after/hMultFT0CvsMultNGlobalTracks", "hMultFT0CvsMultNGlobalTracks;mult. FT0C;N_{track}^{global}", kTH2F, {{60, 0, 60000}, {600, 0, 6000}}, false); - fRegistry.add("Event/after/hMultNGlobalTracksPV", "hMultNGlobalTracksPV; N_{track}^{global} to PV", kTH1F, {{6001, -0.5, 6000.5}}, false); - fRegistry.add("Event/after/hCentFT0CvsMultNGlobalTracksPV", "hCentFT0CvsMultNGlobalTracksPV;centrality FT0C (%);N_{track}^{global} to PV", kTH2F, {{100, 0, 100}, {600, 0, 6000}}, false); - fRegistry.add("Event/after/hMultFT0CvsMultNGlobalTracksPV", "hMultFT0CvsMultNGlobalTracksPV;mult. FT0C;N_{track}^{global} to PV", kTH2F, {{60, 0, 60000}, {600, 0, 6000}}, false); + fRegistry.add("Event/after/hMultNGlobalTracks", "hMultNGlobalTracks; N_{track}^{global} in |#eta| < 0.8", kTH1F, {{axis_mult_globalTrack}}, false); + fRegistry.add("Event/after/hCentFT0CvsMultNGlobalTracks", "hCentFT0CvsMultNGlobalTracks;centrality FT0C (%);N_{track}^{global} in |#eta| < 0.8", kTH2F, {{axis_cent_ft0c}, {axis_mult_globalTrack}}, false); + fRegistry.add("Event/after/hMultFT0CvsMultNGlobalTracks", "hMultFT0CvsMultNGlobalTracks;mult. FT0C;N_{track}^{global} in |#eta| < 0.8", kTH2F, {{axis_mult_ft0c}, {axis_mult_globalTrack}}, false); + fRegistry.add("Event/after/hMultNGlobalTracksPV", "hMultNGlobalTracksPV; N_{track}^{global} to PV in |#eta| < 0.8", kTH1F, {{axis_mult_global_ncontrib08}}, false); + fRegistry.add("Event/after/hCentFT0CvsMultNGlobalTracksPV", "hCentFT0CvsMultNGlobalTracksPV;centrality FT0C (%);N_{track}^{global} to PV in |#eta| < 0.8", kTH2F, {{axis_cent_ft0c}, {axis_mult_global_ncontrib08}}, false); + fRegistry.add("Event/after/hMultFT0CvsMultNGlobalTracksPV", "hMultFT0CvsMultNGlobalTracksPV;mult. FT0C;N_{track}^{global} to PV in |#eta| < 0.8", kTH2F, {{axis_mult_ft0c}, {axis_mult_global_ncontrib08}}, false); } std::vector tmp_ptbins; @@ -471,11 +480,13 @@ struct eventQC { fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hZvtx"), collision.posZ()); fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hMultNTracksPV"), collision.multNTracksPV()); - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hMultNTracksPVeta1"), collision.multNTracksPVeta1()); - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hMultFT0"), collision.multFT0A(), collision.multFT0C()); + fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hMultFT0AFT0C"), collision.multFT0A(), collision.multFT0C()); + fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hMultFT0AFV0A"), collision.multFT0A(), collision.multFV0A()); + fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hMultFT0CFV0A"), collision.multFT0C(), collision.multFV0A()); fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hMultFT0CvsMultNTracksPV"), collision.multFT0C(), collision.multNTracksPV()); - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hMultFT0CvsOccupancy"), collision.multFT0C(), collision.trackOccupancyInTimeRange()); - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hNTracksPVvsOccupancy"), collision.multNTracksPV(), collision.trackOccupancyInTimeRange()); + fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hMultFV0AvsMultNTracksPV"), collision.multFV0A(), collision.multNTracksPV()); + fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hMultFT0CvsTrackOccupancy"), collision.multFT0C(), collision.trackOccupancyInTimeRange()); + fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hNTracksPVvsTrackOccupancy"), collision.multNTracksPV(), collision.trackOccupancyInTimeRange()); fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCorrOccupancy"), collision.ft0cOccupancyInTimeRange(), collision.trackOccupancyInTimeRange()); fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hCentFT0A"), collision.centFT0A()); @@ -810,7 +821,8 @@ struct eventQC { return true; } - Filter collisionFilter_evsel = o2::aod::evsel::sel8 == true && (eventcuts.cfgZvtxMin < o2::aod::collision::posZ && o2::aod::collision::posZ < eventcuts.cfgZvtxMax); + Filter collisionFilter_evsel = ifnode(eventcuts.cfgRequireSel8.node(), o2::aod::evsel::sel8 == true, true); + Filter collisionFilter_zvtx = eventcuts.cfgZvtxMin < o2::aod::collision::posZ && o2::aod::collision::posZ < eventcuts.cfgZvtxMax; Filter collisionFilter_centrality = (cfgCentMin < o2::aod::cent::centFT0M && o2::aod::cent::centFT0M < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0A && o2::aod::cent::centFT0A < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0C && o2::aod::cent::centFT0C < cfgCentMax); Filter collisionFilter_multiplicity = cfgNtracksPV08Min <= o2::aod::mult::multNTracksPV && o2::aod::mult::multNTracksPV < cfgNtracksPV08Max; Filter collisionFilter_track_occupancy = eventcuts.cfgTrackOccupancyMin <= o2::aod::evsel::trackOccupancyInTimeRange && o2::aod::evsel::trackOccupancyInTimeRange < eventcuts.cfgTrackOccupancyMax; @@ -826,11 +838,40 @@ struct eventQC { SliceCache cache; Preslice perCol = o2::aod::track::collisionId; + Preslice perBC = o2::aod::collision::bcId; template - void runQC(TBCs const&, TCollisions const& collisions, TTracks const& tracks) + void runQC(TBCs const& bcs, TCollisions const& collisions, TTracks const& tracks) { - for (auto& collision : collisions) { + if constexpr (isTriggerAnalysis) { + for (const auto& bc : bcs) { + initCCDB(bc); + if (!zorro.isSelected(bc.globalBC())) { // triggered BC + continue; + } + + // if (!bc.selection_bit(o2::aod::evsel::kIsTriggerTVX)) { + // continue; + // } + + const auto& collisions_per_bc = collisions.sliceBy(perBC, bc.globalIndex()); + fRegistry.fill(HIST("BC/hNcoll"), collisions_per_bc.size()); + for (const auto& collision : collisions_per_bc) { + fRegistry.fill(HIST("BC/Collision/hMultNTracksPV"), collision.multNTracksPV()); + fRegistry.fill(HIST("BC/Collision/hMultFT0AFT0C"), collision.multFT0A(), collision.multFT0C()); + fRegistry.fill(HIST("BC/Collision/hMultFT0AFV0A"), collision.multFT0A(), collision.multFV0A()); + fRegistry.fill(HIST("BC/Collision/hMultFT0CFV0A"), collision.multFT0C(), collision.multFV0A()); + } + + for (const auto& [col1, col2] : combinations(CombinationsStrictlyUpperIndexPolicy(collisions_per_bc, collisions_per_bc))) { + fRegistry.fill(HIST("BC/hDeltaZ"), col1.posZ() - col2.posZ()); + fRegistry.fill(HIST("BC/hDeltaT"), col1.collisionTime() - col2.collisionTime()); + fRegistry.fill(HIST("BC/hCorrNcontrib"), col1.numContrib(), col2.numContrib()); + } // end of pairing + } // end of bc loop + } + + for (const auto& collision : collisions) { if constexpr (isTriggerAnalysis) { const auto& bc = collision.template bc_as(); // don't use foundBC for CEFP. initCCDB(bc); @@ -862,7 +903,7 @@ struct eventQC { int nGlobalTracks = 0, nGlobalTracksPV = 0; auto tracks_per_coll = tracks.sliceBy(perCol, collision.globalIndex()); - for (auto& track : tracks_per_coll) { + for (const auto& track : tracks_per_coll) { if (!isSelectedTrack(track)) { continue; } @@ -893,8 +934,8 @@ struct eventQC { fRegistry.fill(HIST("Event/after/hMultNGlobalTracksPV"), nGlobalTracksPV); fRegistry.fill(HIST("Event/after/hMultFT0CvsMultNGlobalTracks"), collision.multFT0C(), nGlobalTracks); fRegistry.fill(HIST("Event/after/hMultFT0CvsMultNGlobalTracksPV"), collision.multFT0C(), nGlobalTracksPV); - fRegistry.fill(HIST("Event/after/hNGlobalTracksvsOccupancy"), nGlobalTracks, collision.trackOccupancyInTimeRange()); - fRegistry.fill(HIST("Event/after/hNGlobalTracksPVvsOccupancy"), nGlobalTracksPV, collision.trackOccupancyInTimeRange()); + fRegistry.fill(HIST("Event/after/hNGlobalTracksvsTrackOccupancy"), nGlobalTracks, collision.trackOccupancyInTimeRange()); + fRegistry.fill(HIST("Event/after/hNGlobalTracksPVvsTrackOccupancy"), nGlobalTracksPV, collision.trackOccupancyInTimeRange()); fRegistry.fill(HIST("Event/after/hCentFT0CvsMultNGlobalTracks"), collision.centFT0C(), nGlobalTracks); fRegistry.fill(HIST("Event/after/hCentFT0CvsMultNGlobalTracksPV"), collision.centFT0C(), nGlobalTracksPV); } From e0ae066462307c91861dc7a65dfe9fe3cf42a384 Mon Sep 17 00:00:00 2001 From: basiach <74355517+basiach@users.noreply.github.com> Date: Mon, 4 Aug 2025 22:14:27 +0200 Subject: [PATCH 226/345] [PWGCF] FemtoUniverse - Adding PDG mass for same and mixed event container in cascade task. (#12416) Co-authored-by: Barbara Chytla --- .../Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx index 63decd49fbe..570acd6f7be 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx @@ -65,6 +65,7 @@ struct femtoUniversePairTaskTrackCascadeExtended { // configurations for correlation part Configurable confTrackChoicePartOne{"confTrackChoicePartOne", 0, "0:Proton, 1:Pion, 2:Kaon"}; Configurable confTrkPDGCodePartOne{"confTrkPDGCodePartOne", 2212, "Particle 1 (Track) - PDG code"}; + Configurable confCascPDGCodePartTwo{"confCascPDGCodePartTwo", 3312, "Particle 2 (Cascade) - PDG code"}; Configurable confCascType1{"confCascType1", 0, "select one of the Cascades (Omega = 0, Xi = 1, anti-Omega = 2, anti-Xi = 3) for track-cascade combination"}; Configurable confCascType2{"confCascType2", 0, "select one of the Cascades (Omega = 0, Xi = 1, anti-Omega = 2, anti-Xi = 3) for cascade-cascade combination"}; Configurable confIsCPR{"confIsCPR", false, "Close Pair Rejection"}; @@ -291,6 +292,9 @@ struct femtoUniversePairTaskTrackCascadeExtended { sameEventCont.init(&resultRegistry, confkstarBins, confMultBins, confkTBins, confmTBins, confMultBins3D, confmTBins3D, confEtaBins, confPhiBins, confIsMC, confUse3D); mixedEventCont.init(&resultRegistry, confkstarBins, confMultBins, confkTBins, confmTBins, confMultBins3D, confmTBins3D, confEtaBins, confPhiBins, confIsMC, confUse3D); + sameEventCont.setPDGCodes(confTrkPDGCodePartOne, confCascPDGCodePartTwo); + mixedEventCont.setPDGCodes(confTrkPDGCodePartOne, confCascPDGCodePartTwo); + pairCleaner.init(&qaRegistry); pairCleanerCasc.init(&qaRegistry); if (confIsCPR.value) { From 88f8b1bac3948254709ee90ab94908dfc3c57cba Mon Sep 17 00:00:00 2001 From: Pritam Chakraborty <47203359+prchakra@users.noreply.github.com> Date: Tue, 5 Aug 2025 00:39:43 +0200 Subject: [PATCH 227/345] [PWGCF] FemtoUniverse: Checking closed-pair at vertex (#12411) Co-authored-by: ALICE Action Bot --- .../Core/FemtoUniverseDetaDphiStar.h | 41 +++++++++++++++++++ ...irTaskTrackTrackSpherHarMultKtExtended.cxx | 31 +++++++++++--- 2 files changed, 66 insertions(+), 6 deletions(-) diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h b/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h index 65344e45bba..2fa14b2098a 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h @@ -413,6 +413,47 @@ class FemtoUniverseDetaDphiStar } } + /// Check if pair is close or not + template + bool isClosePairAtITS(Part const& part1, Part const& part2, float lmagfield, uint8_t ChosenEventType) + { + magfield = lmagfield; + + if constexpr (kPartOneType == o2::aod::femtouniverseparticle::ParticleType::kTrack && kPartTwoType == o2::aod::femtouniverseparticle::ParticleType::kTrack) { + /// Track-Track combination + // check if provided particles are in agreement with the class instantiation + if (part1.partType() != o2::aod::femtouniverseparticle::ParticleType::kTrack || part2.partType() != o2::aod::femtouniverseparticle::ParticleType::kTrack) { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar instantiation! Please provide kTrack,kTrack candidates."; + return false; + } + auto deta = part1.eta() - part2.eta(); + auto dphiAvg = part1.phi() - part2.phi(); + if (ChosenEventType == femto_universe_container::EventType::same) { + histdetadpisame[0][0]->Fill(deta, dphiAvg); + } else if (ChosenEventType == femto_universe_container::EventType::mixed) { + histdetadpimixed[0][0]->Fill(deta, dphiAvg); + } else { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; + } + + if (std::pow(dphiAvg, 2) / std::pow(cutDeltaPhiStarMax, 2) + std::pow(deta, 2) / std::pow(cutDeltaEtaMax, 2) < 1.) { + return true; + } else { + if (ChosenEventType == femto_universe_container::EventType::same) { + histdetadpisame[0][1]->Fill(deta, dphiAvg); + } else if (ChosenEventType == femto_universe_container::EventType::mixed) { + histdetadpimixed[0][1]->Fill(deta, dphiAvg); + } else { + LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; + } + return false; + } + } else { + LOG(fatal) << "FemtoUniversePairCleaner: Combination of objects not defined - quitting!"; + return false; + } + } + /// Check if pair is close or not template bool isClosePairFrac(Part const& part1, Part const& part2, float lmagfield, uint8_t ChosenEventType, bool IsDphiAvgOrDist, float DistMax, float FracMax) diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx index 05c910b0b24..3899030612f 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx @@ -185,6 +185,7 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { Configurable ConfIsFillAngqLCMS{"ConfIsFillAngqLCMS", true, "Fill qLCMS vs dEta vs dPhi"}; Configurable confCPRDistMax{"confCPRDistMax", 0.0, "Max. radial seperation between two closed-pairs"}; Configurable confCPRFracMax{"confCPRFracMax", 0.0, "Max. allowed fraction bad to all TPC points of radial seperation between two closed-pairs"}; + Configurable confCPRIsAtITS{"confCPRIsAtITS", false, "Close Pair Rejection at ITS or TPC"}; Configurable confCPRDphiAvgOrDist{"confCPRDphiAvgOrDist", true, "Close Pair Rejection by radial or angular seperation"}; FemtoUniverseSHContainer sameEventCont; @@ -485,8 +486,14 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { } if (ConfIsCPR.value) { - if (pairCloseRejection.isClosePairFrac(p1, p2, magFieldTesla, femto_universe_container::EventType::same, confCPRDphiAvgOrDist, confCPRDistMax, confCPRFracMax)) { - continue; + if (confCPRIsAtITS.value) { + if (pairCloseRejection.isClosePairAtITS(p1, p2, magFieldTesla, femto_universe_container::EventType::same)) { + continue; + } + } else { + if (pairCloseRejection.isClosePairFrac(p1, p2, magFieldTesla, femto_universe_container::EventType::same, confCPRDphiAvgOrDist, confCPRDistMax, confCPRFracMax)) { + continue; + } } } @@ -509,8 +516,14 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { } if (ConfIsCPR.value) { - if (pairCloseRejection.isClosePairFrac(p1, p2, magFieldTesla, femto_universe_container::EventType::same, confCPRDphiAvgOrDist, confCPRDistMax, confCPRFracMax)) { - continue; + if (confCPRIsAtITS.value) { + if (pairCloseRejection.isClosePairAtITS(p1, p2, magFieldTesla, femto_universe_container::EventType::same)) { + continue; + } + } else { + if (pairCloseRejection.isClosePairFrac(p1, p2, magFieldTesla, femto_universe_container::EventType::same, confCPRDphiAvgOrDist, confCPRDistMax, confCPRFracMax)) { + continue; + } } } @@ -667,8 +680,14 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { } if (ConfIsCPR.value) { - if (pairCloseRejection.isClosePairFrac(p1, p2, magFieldTesla, femto_universe_container::EventType::mixed, confCPRDphiAvgOrDist, confCPRDistMax, confCPRFracMax)) { - continue; + if (confCPRIsAtITS.value) { + if (pairCloseRejection.isClosePairAtITS(p1, p2, magFieldTesla, femto_universe_container::EventType::same)) { + continue; + } + } else { + if (pairCloseRejection.isClosePairFrac(p1, p2, magFieldTesla, femto_universe_container::EventType::same, confCPRDphiAvgOrDist, confCPRDistMax, confCPRFracMax)) { + continue; + } } } From e14d26cceec85443686aa990bcb6993f323ec688 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Tue, 5 Aug 2025 02:40:08 +0200 Subject: [PATCH 228/345] [PWGEM/Dilepton] keep float as float (#12417) Co-authored-by: ALICE Action Bot --- PWGEM/Dilepton/Core/SingleTrackQC.h | 18 +- PWGEM/Dilepton/Core/SingleTrackQCMC.h | 18 +- PWGEM/Dilepton/DataModel/dileptonTables.h | 78 +------- .../TableProducer/skimmerPrimaryElectron.cxx | 80 ++------- .../TableProducer/treeCreatorElectronML.cxx | 41 +++-- .../Tasks/Converters/electronConverter4.cxx | 93 ++++------ PWGEM/Dilepton/Tasks/vpPairQC.cxx | 18 +- PWGEM/Dilepton/Utils/MlResponseO2Track.h | 18 +- PWGEM/PhotonMeson/DataModel/gammaTables.h | 168 ++++-------------- .../TableProducer/photonconversionbuilder.cxx | 27 +-- .../TableProducer/skimmerGammaConversion.cxx | 2 +- .../skimmerPrimaryElectronFromDalitzEE.cxx | 26 +-- .../electronFromDalitzConverter1.cxx | 32 +--- .../Tasks/Converters/pcmConverter1.cxx | 50 +++--- PWGEM/PhotonMeson/Tasks/dalitzEEQC.cxx | 2 - PWGEM/PhotonMeson/Tasks/dalitzEEQCMC.cxx | 2 - 16 files changed, 196 insertions(+), 477 deletions(-) diff --git a/PWGEM/Dilepton/Core/SingleTrackQC.h b/PWGEM/Dilepton/Core/SingleTrackQC.h index 9810d1eb63e..ae41d2dd210 100644 --- a/PWGEM/Dilepton/Core/SingleTrackQC.h +++ b/PWGEM/Dilepton/Core/SingleTrackQC.h @@ -265,9 +265,9 @@ struct SingleTrackQC { fRegistry.add("Track/positive/hTOFbeta", "TOF #beta;p_{pv} (GeV/c);#beta", kTH2F, {{1000, 0, 10}, {240, 0, 1.2}}, false); fRegistry.add("Track/positive/hTOFNsigmaEl", "TOF n sigma el;p_{pv} (GeV/c);n #sigma_{e}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); // fRegistry.add("Track/positive/hTOFNsigmaMu", "TOF n sigma mu;p_{pv} (GeV/c);n #sigma_{#mu}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/positive/hTOFNsigmaPi", "TOF n sigma pi;p_{pv} (GeV/c);n #sigma_{#pi}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/positive/hTOFNsigmaKa", "TOF n sigma ka;p_{pv} (GeV/c);n #sigma_{K}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/positive/hTOFNsigmaPr", "TOF n sigma pr;p_{pv} (GeV/c);n #sigma_{p}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); + // fRegistry.add("Track/positive/hTOFNsigmaPi", "TOF n sigma pi;p_{pv} (GeV/c);n #sigma_{#pi}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); + // fRegistry.add("Track/positive/hTOFNsigmaKa", "TOF n sigma ka;p_{pv} (GeV/c);n #sigma_{K}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); + // fRegistry.add("Track/positive/hTOFNsigmaPr", "TOF n sigma pr;p_{pv} (GeV/c);n #sigma_{p}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); fRegistry.add("Track/positive/hMeanClusterSizeITS", "mean cluster size ITS;p_{pv} (GeV/c); on ITS #times cos(#lambda);", kTH2F, {{1000, 0.f, 10.f}, {150, 0, 15}}, false); fRegistry.add("Track/positive/hMeanClusterSizeITSib", "mean cluster size ITS inner barrel;p_{pv} (GeV/c); on ITS #times cos(#lambda);", kTH2F, {{1000, 0.f, 10.f}, {150, 0, 15}}, false); @@ -509,9 +509,9 @@ struct SingleTrackQC { fRegistry.fill(HIST("Track/positive/hTPCNsigmaPr"), track.tpcInnerParam(), track.tpcNSigmaPr()); fRegistry.fill(HIST("Track/positive/hTOFNsigmaEl"), track.p(), track.tofNSigmaEl()); // fRegistry.fill(HIST("Track/positive/hTOFNsigmaMu"), track.p(), track.tofNSigmaMu()); - fRegistry.fill(HIST("Track/positive/hTOFNsigmaPi"), track.p(), track.tofNSigmaPi()); - fRegistry.fill(HIST("Track/positive/hTOFNsigmaKa"), track.p(), track.tofNSigmaKa()); - fRegistry.fill(HIST("Track/positive/hTOFNsigmaPr"), track.p(), track.tofNSigmaPr()); + // fRegistry.fill(HIST("Track/positive/hTOFNsigmaPi"), track.p(), track.tofNSigmaPi()); + // fRegistry.fill(HIST("Track/positive/hTOFNsigmaKa"), track.p(), track.tofNSigmaKa()); + // fRegistry.fill(HIST("Track/positive/hTOFNsigmaPr"), track.p(), track.tofNSigmaPr()); // fRegistry.fill(HIST("Track/positive/hITSNsigmaEl"), track.p(), track.itsNSigmaEl()); // fRegistry.fill(HIST("Track/positive/hITSNsigmaMu"), track.p(), track.itsNSigmaMu()); // fRegistry.fill(HIST("Track/positive/hITSNsigmaPi"), track.p(), track.itsNSigmaPi()); @@ -549,9 +549,9 @@ struct SingleTrackQC { fRegistry.fill(HIST("Track/negative/hTPCNsigmaPr"), track.tpcInnerParam(), track.tpcNSigmaPr()); fRegistry.fill(HIST("Track/negative/hTOFNsigmaEl"), track.p(), track.tofNSigmaEl()); // fRegistry.fill(HIST("Track/negative/hTOFNsigmaMu"), track.p(), track.tofNSigmaMu()); - fRegistry.fill(HIST("Track/negative/hTOFNsigmaPi"), track.p(), track.tofNSigmaPi()); - fRegistry.fill(HIST("Track/negative/hTOFNsigmaKa"), track.p(), track.tofNSigmaKa()); - fRegistry.fill(HIST("Track/negative/hTOFNsigmaPr"), track.p(), track.tofNSigmaPr()); + // fRegistry.fill(HIST("Track/negative/hTOFNsigmaPi"), track.p(), track.tofNSigmaPi()); + // fRegistry.fill(HIST("Track/negative/hTOFNsigmaKa"), track.p(), track.tofNSigmaKa()); + // fRegistry.fill(HIST("Track/negative/hTOFNsigmaPr"), track.p(), track.tofNSigmaPr()); // fRegistry.fill(HIST("Track/negative/hITSNsigmaEl"), track.p(), track.itsNSigmaEl()); // fRegistry.fill(HIST("Track/negative/hITSNsigmaMu"), track.p(), track.itsNSigmaMu()); // fRegistry.fill(HIST("Track/negative/hITSNsigmaPi"), track.p(), track.itsNSigmaPi()); diff --git a/PWGEM/Dilepton/Core/SingleTrackQCMC.h b/PWGEM/Dilepton/Core/SingleTrackQCMC.h index c6b4ad94bb9..6410f8e4134 100644 --- a/PWGEM/Dilepton/Core/SingleTrackQCMC.h +++ b/PWGEM/Dilepton/Core/SingleTrackQCMC.h @@ -314,9 +314,9 @@ struct SingleTrackQCMC { fRegistry.add("Track/PID/positive/hTOFbeta", "TOF #beta;p_{pv} (GeV/c);#beta", kTH2F, {{1000, 0, 10}, {240, 0, 1.2}}, false); fRegistry.add("Track/PID/positive/hTOFNsigmaEl", "TOF n sigma el;p_{pv} (GeV/c);n #sigma_{e}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); // fRegistry.add("Track/PID/positive/hTOFNsigmaMu", "TOF n sigma mu;p_{pv} (GeV/c);n #sigma_{#mu}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/PID/positive/hTOFNsigmaPi", "TOF n sigma pi;p_{pv} (GeV/c);n #sigma_{#pi}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/PID/positive/hTOFNsigmaKa", "TOF n sigma ka;p_{pv} (GeV/c);n #sigma_{K}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/PID/positive/hTOFNsigmaPr", "TOF n sigma pr;p_{pv} (GeV/c);n #sigma_{p}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); + // fRegistry.add("Track/PID/positive/hTOFNsigmaPi", "TOF n sigma pi;p_{pv} (GeV/c);n #sigma_{#pi}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); + // fRegistry.add("Track/PID/positive/hTOFNsigmaKa", "TOF n sigma ka;p_{pv} (GeV/c);n #sigma_{K}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); + // fRegistry.add("Track/PID/positive/hTOFNsigmaPr", "TOF n sigma pr;p_{pv} (GeV/c);n #sigma_{p}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); fRegistry.add("Track/PID/positive/hMeanClusterSizeITS", "mean cluster size ITS;p_{pv} (GeV/c); on ITS #times cos(#lambda)", kTH2F, {{1000, 0.f, 10.f}, {150, 0, 15}}, false); fRegistry.add("Track/PID/positive/hMeanClusterSizeITSib", "mean cluster size ITS inner barrel;p_{pv} (GeV/c); on ITS #times cos(#lambda)", kTH2F, {{1000, 0.f, 10.f}, {150, 0, 15}}, false); fRegistry.add("Track/PID/positive/hMeanClusterSizeITSob", "mean cluster size ITS outer barrel;p_{pv} (GeV/c); on ITS #times cos(#lambda)", kTH2F, {{1000, 0.f, 10.f}, {150, 0, 15}}, false); @@ -630,9 +630,9 @@ struct SingleTrackQCMC { fRegistry.fill(HIST("Track/PID/positive/hTPCNsigmaPr"), track.tpcInnerParam(), track.tpcNSigmaPr()); fRegistry.fill(HIST("Track/PID/positive/hTOFNsigmaEl"), track.p(), track.tofNSigmaEl()); // fRegistry.fill(HIST("Track/PID/positive/hTOFNsigmaMu"), track.p(), track.tofNSigmaMu()); - fRegistry.fill(HIST("Track/PID/positive/hTOFNsigmaPi"), track.p(), track.tofNSigmaPi()); - fRegistry.fill(HIST("Track/PID/positive/hTOFNsigmaKa"), track.p(), track.tofNSigmaKa()); - fRegistry.fill(HIST("Track/PID/positive/hTOFNsigmaPr"), track.p(), track.tofNSigmaPr()); + // fRegistry.fill(HIST("Track/PID/positive/hTOFNsigmaPi"), track.p(), track.tofNSigmaPi()); + // fRegistry.fill(HIST("Track/PID/positive/hTOFNsigmaKa"), track.p(), track.tofNSigmaKa()); + // fRegistry.fill(HIST("Track/PID/positive/hTOFNsigmaPr"), track.p(), track.tofNSigmaPr()); // fRegistry.fill(HIST("Track/PID/positive/hITSNsigmaEl"), track.p(), track.itsNSigmaEl()); // fRegistry.fill(HIST("Track/PID/positive/hITSNsigmaMu"), track.p(), track.itsNSigmaMu()); // fRegistry.fill(HIST("Track/PID/positive/hITSNsigmaPi"), track.p(), track.itsNSigmaPi()); @@ -678,9 +678,9 @@ struct SingleTrackQCMC { fRegistry.fill(HIST("Track/PID/negative/hTPCNsigmaPr"), track.tpcInnerParam(), track.tpcNSigmaPr()); fRegistry.fill(HIST("Track/PID/negative/hTOFNsigmaEl"), track.p(), track.tofNSigmaEl()); // fRegistry.fill(HIST("Track/PID/negative/hTOFNsigmaMu"), track.p(), track.tofNSigmaMu()); - fRegistry.fill(HIST("Track/PID/negative/hTOFNsigmaPi"), track.p(), track.tofNSigmaPi()); - fRegistry.fill(HIST("Track/PID/negative/hTOFNsigmaKa"), track.p(), track.tofNSigmaKa()); - fRegistry.fill(HIST("Track/PID/negative/hTOFNsigmaPr"), track.p(), track.tofNSigmaPr()); + // fRegistry.fill(HIST("Track/PID/negative/hTOFNsigmaPi"), track.p(), track.tofNSigmaPi()); + // fRegistry.fill(HIST("Track/PID/negative/hTOFNsigmaKa"), track.p(), track.tofNSigmaKa()); + // fRegistry.fill(HIST("Track/PID/negative/hTOFNsigmaPr"), track.p(), track.tofNSigmaPr()); // fRegistry.fill(HIST("Track/PID/negative/hITSNsigmaEl"), track.p(), track.itsNSigmaEl()); // fRegistry.fill(HIST("Track/PID/negative/hITSNsigmaMu"), track.p(), track.itsNSigmaMu()); // fRegistry.fill(HIST("Track/PID/negative/hITSNsigmaPi"), track.p(), track.itsNSigmaPi()); diff --git a/PWGEM/Dilepton/DataModel/dileptonTables.h b/PWGEM/Dilepton/DataModel/dileptonTables.h index e528e15c2ef..45206422dc4 100644 --- a/PWGEM/Dilepton/DataModel/dileptonTables.h +++ b/PWGEM/Dilepton/DataModel/dileptonTables.h @@ -412,6 +412,7 @@ DECLARE_SOA_COLUMN(IsAmbiguous, isAmbiguous, bool); //! is ambiguous DECLARE_SOA_COLUMN(Sign, sign, int8_t); //! DECLARE_SOA_COLUMN(PrefilterBit, pfb, uint8_t); //! DECLARE_SOA_COLUMN(PrefilterBitDerived, pfbderived, uint16_t); //! +DECLARE_SOA_COLUMN(ProbElBDT, probElBDT, float); //! DECLARE_SOA_COLUMN(ITSNSigmaEl, itsNSigmaEl, float); //! DECLARE_SOA_COLUMN(ITSNSigmaMu, itsNSigmaMu, float); //! @@ -419,55 +420,13 @@ DECLARE_SOA_COLUMN(ITSNSigmaPi, itsNSigmaPi, float); //! DECLARE_SOA_COLUMN(ITSNSigmaKa, itsNSigmaKa, float); //! DECLARE_SOA_COLUMN(ITSNSigmaPr, itsNSigmaPr, float); //! -DECLARE_SOA_COLUMN(TPCSignalUINT16, tpcSignalUINT16, uint16_t); //! 0 - +65535 -DECLARE_SOA_COLUMN(DeDxTunedMcUINT16, mcTunedTPCSignalUINT16, uint16_t); //! 0 - +65535 -DECLARE_SOA_COLUMN(ProbElBDT, probElBDT, float); //! -// DECLARE_SOA_COLUMN(ProbEbdtUINT16, probEbdtUINT16, uint16_t); //! 0 - +65535 - -DECLARE_SOA_COLUMN(TPCChi2NClINT16, tpcChi2NClINT16, int16_t); //! -32768 - +32767 -DECLARE_SOA_COLUMN(ITSChi2NClINT16, itsChi2NClINT16, int16_t); //! -32768 - +32767 - -DECLARE_SOA_COLUMN(BetaINT16, betaINT16, int16_t); //! -32768 - +32767 -DECLARE_SOA_COLUMN(TOFChi2INT16, tofChi2INT16, int16_t); //! -32768 - +32767 - -DECLARE_SOA_COLUMN(TPCNSigmaElINT16, tpcNSigmaElINT16, int16_t); //! -32768 - +32767 -DECLARE_SOA_COLUMN(TPCNSigmaMuINT16, tpcNSigmaMuINT16, int16_t); //! -32768 - +32767 -DECLARE_SOA_COLUMN(TPCNSigmaPiINT16, tpcNSigmaPiINT16, int16_t); //! -32768 - +32767 -DECLARE_SOA_COLUMN(TPCNSigmaKaINT16, tpcNSigmaKaINT16, int16_t); //! -32768 - +32767 -DECLARE_SOA_COLUMN(TPCNSigmaPrINT16, tpcNSigmaPrINT16, int16_t); //! -32768 - +32767 - -DECLARE_SOA_COLUMN(TOFNSigmaElINT16, tofNSigmaElINT16, int16_t); //! -32768 - +32767 -DECLARE_SOA_COLUMN(TOFNSigmaMuINT16, tofNSigmaMuINT16, int16_t); //! -32768 - +32767 -DECLARE_SOA_COLUMN(TOFNSigmaPiINT16, tofNSigmaPiINT16, int16_t); //! -32768 - +32767 -DECLARE_SOA_COLUMN(TOFNSigmaKaINT16, tofNSigmaKaINT16, int16_t); //! -32768 - +32767 -DECLARE_SOA_COLUMN(TOFNSigmaPrINT16, tofNSigmaPrINT16, int16_t); //! -32768 - +32767 - -DECLARE_SOA_DYNAMIC_COLUMN(TPCSignal, tpcSignal, [](uint16_t x) -> float { return static_cast(x) * 1e-2; }); -DECLARE_SOA_DYNAMIC_COLUMN(DeDxTunedMc, mcTunedTPCSignal, [](uint16_t x) -> float { return static_cast(x) * 1e-2; }); -// DECLARE_SOA_DYNAMIC_COLUMN(ProbEbdt, probEbdt, [](uint16_t x) -> float { return static_cast(x) * 1e-4; }); -DECLARE_SOA_DYNAMIC_COLUMN(TPCChi2NCl, tpcChi2NCl, [](int16_t x) -> float { return static_cast(x) * 1e-2; }); -DECLARE_SOA_DYNAMIC_COLUMN(ITSChi2NCl, itsChi2NCl, [](int16_t x) -> float { return static_cast(x) * 1e-2; }); -DECLARE_SOA_DYNAMIC_COLUMN(Beta, beta, [](int16_t x) -> float { return static_cast(x) * 1e-3; }); -DECLARE_SOA_DYNAMIC_COLUMN(TOFChi2, tofChi2, [](int16_t x) -> float { return static_cast(x) * 1e-2; }); - -DECLARE_SOA_DYNAMIC_COLUMN(TPCNSigmaEl, tpcNSigmaEl, [](int16_t x) -> float { return static_cast(x) * 1e-2; }); -DECLARE_SOA_DYNAMIC_COLUMN(TPCNSigmaMu, tpcNSigmaMu, [](int16_t x) -> float { return static_cast(x) * 1e-2; }); -DECLARE_SOA_DYNAMIC_COLUMN(TPCNSigmaPi, tpcNSigmaPi, [](int16_t x) -> float { return static_cast(x) * 1e-2; }); -DECLARE_SOA_DYNAMIC_COLUMN(TPCNSigmaKa, tpcNSigmaKa, [](int16_t x) -> float { return static_cast(x) * 1e-2; }); -DECLARE_SOA_DYNAMIC_COLUMN(TPCNSigmaPr, tpcNSigmaPr, [](int16_t x) -> float { return static_cast(x) * 1e-2; }); - -DECLARE_SOA_DYNAMIC_COLUMN(TOFNSigmaEl, tofNSigmaEl, [](int16_t x) -> float { return static_cast(x) * 1e-2; }); -DECLARE_SOA_DYNAMIC_COLUMN(TOFNSigmaMu, tofNSigmaMu, [](int16_t x) -> float { return static_cast(x) * 1e-2; }); -DECLARE_SOA_DYNAMIC_COLUMN(TOFNSigmaPi, tofNSigmaPi, [](int16_t x) -> float { return static_cast(x) * 1e-2; }); -DECLARE_SOA_DYNAMIC_COLUMN(TOFNSigmaKa, tofNSigmaKa, [](int16_t x) -> float { return static_cast(x) * 1e-2; }); -DECLARE_SOA_DYNAMIC_COLUMN(TOFNSigmaPr, tofNSigmaPr, [](int16_t x) -> float { return static_cast(x) * 1e-2; }); - DECLARE_SOA_DYNAMIC_COLUMN(Signed1Pt, signed1Pt, [](float pt, int8_t sign) -> float { return sign * 1. / pt; }); DECLARE_SOA_DYNAMIC_COLUMN(P, p, [](float pt, float eta) -> float { return pt * std::cosh(eta); }); DECLARE_SOA_DYNAMIC_COLUMN(Px, px, [](float pt, float phi) -> float { return pt * std::cos(phi); }); DECLARE_SOA_DYNAMIC_COLUMN(Py, py, [](float pt, float phi) -> float { return pt * std::sin(phi); }); DECLARE_SOA_DYNAMIC_COLUMN(Pz, pz, [](float pt, float eta) -> float { return pt * std::sinh(eta); }); DECLARE_SOA_DYNAMIC_COLUMN(Theta, theta, [](float tgl) -> float { return M_PI_2 - std::atan(tgl); }); +DECLARE_SOA_DYNAMIC_COLUMN(Tgl, tgl, [](float eta) -> float { return std::tan(M_PI_2 - 2 * std::atan(std::exp(-eta))); }); DECLARE_SOA_DYNAMIC_COLUMN(MeanClusterSizeITS, meanClusterSizeITS, [](uint32_t itsClusterSizes) -> float { int total_cluster_size = 0, nl = 0; for (unsigned int layer = 0; layer < 7; layer++) { @@ -612,14 +571,12 @@ DECLARE_SOA_TABLE_VERSIONED(EMPrimaryElectrons_004, "AOD", "EMPRIMARYEL", 4, //! track::Pt, track::Eta, track::Phi, track::DcaXY, track::DcaZ, aod::track::CYY, aod::track::CZY, aod::track::CZZ, track::TPCNClsFindable, track::TPCNClsFindableMinusFound, track::TPCNClsFindableMinusCrossedRows, track::TPCNClsShared, - emprimaryelectron::TPCChi2NClINT16, track::TPCInnerParam, - emprimaryelectron::TPCSignalUINT16, emprimaryelectron::TPCNSigmaElINT16, emprimaryelectron::TPCNSigmaPiINT16, emprimaryelectron::TPCNSigmaKaINT16, emprimaryelectron::TPCNSigmaPrINT16, - emprimaryelectron::BetaINT16, emprimaryelectron::TOFNSigmaElINT16, emprimaryelectron::TOFNSigmaPiINT16, emprimaryelectron::TOFNSigmaKaINT16, emprimaryelectron::TOFNSigmaPrINT16, - track::ITSClusterSizes, - emprimaryelectron::ITSChi2NClINT16, emprimaryelectron::TOFChi2INT16, track::DetectorMap, - track::Tgl, + track::TPCChi2NCl, track::TPCInnerParam, + track::TPCSignal, pidtpc::TPCNSigmaEl, pidtpc::TPCNSigmaPi, pidtpc::TPCNSigmaKa, pidtpc::TPCNSigmaPr, + pidtofbeta::Beta, pidtof::TOFNSigmaEl, /*pidtof::TOFNSigmaPi, pidtof::TOFNSigmaKa, pidtof::TOFNSigmaPr,*/ + track::ITSClusterSizes, track::ITSChi2NCl, track::TOFChi2, track::DetectorMap, /*track::Tgl,*/ emprimaryelectron::IsAssociatedToMPC, emprimaryelectron::IsAmbiguous, emprimaryelectron::ProbElBDT, - emprimaryelectron::DeDxTunedMcUINT16, + mcpidtpc::DeDxTunedMc, // dynamic column track::TPCNClsFound, @@ -630,31 +587,12 @@ DECLARE_SOA_TABLE_VERSIONED(EMPrimaryElectrons_004, "AOD", "EMPRIMARYEL", 4, //! track::v001::ITSClusterMap, track::v001::ITSNCls, track::v001::ITSNClsInnerBarrel, track::HasITS, track::HasTPC, track::HasTRD, track::HasTOF, - emprimaryelectron::TPCSignal, - emprimaryelectron::TPCChi2NCl, - emprimaryelectron::ITSChi2NCl, - emprimaryelectron::DeDxTunedMc, - // emprimaryelectron::ProbEbdt, - emprimaryelectron::Beta, - emprimaryelectron::TOFChi2, - - emprimaryelectron::TPCNSigmaEl, - emprimaryelectron::TPCNSigmaMu, - emprimaryelectron::TPCNSigmaPi, - emprimaryelectron::TPCNSigmaKa, - emprimaryelectron::TPCNSigmaPr, - emprimaryelectron::TOFNSigmaEl, - emprimaryelectron::TOFNSigmaMu, - emprimaryelectron::TOFNSigmaPi, - emprimaryelectron::TOFNSigmaKa, - emprimaryelectron::TOFNSigmaPr, - emprimaryelectron::Signed1Pt, emprimaryelectron::P, emprimaryelectron::Px, emprimaryelectron::Py, emprimaryelectron::Pz, - emprimaryelectron::Theta, + emprimaryelectron::Tgl, emprimaryelectron::MeanClusterSizeITS, emprimaryelectron::MeanClusterSizeITSib, emprimaryelectron::MeanClusterSizeITSob); diff --git a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx index 8d19b297dcf..b40a5e11e7d 100644 --- a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx +++ b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx @@ -51,8 +51,8 @@ using MyCollisions = soa::Join; using MyCollisionsWithSWT = soa::Join; using MyTracks = soa::Join; + aod::pidTPCFullEl, /*aod::pidTPCFullMu,*/ aod::pidTPCFullPi, aod::pidTPCFullKa, aod::pidTPCFullPr, + aod::pidTOFFullEl, /*aod::pidTOFFullMu,*/ aod::pidTOFFullPi, aod::pidTOFFullKa, aod::pidTOFFullPr, aod::pidTOFbeta>; using MyTrack = MyTracks::iterator; using MyTracksMC = soa::Join; using MyTrackMC = MyTracksMC::iterator; @@ -161,13 +161,13 @@ struct skimmerPrimaryElectron { fRegistry.add("Track/hTPCdEdx", "TPC dE/dx;p_{in} (GeV/c);TPC dE/dx (a.u.)", kTH2F, {{1000, 0, 10}, {200, 0, 200}}, false); fRegistry.add("Track/hTPCdEdxMC", "TPC dE/dx;p_{in} (GeV/c);TPC dE/dx (a.u.)", kTH2F, {{1000, 0, 10}, {200, 0, 200}}, false); fRegistry.add("Track/hTPCNsigmaEl", "TPC n sigma el;p_{in} (GeV/c);n #sigma_{e}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/hTPCNsigmaMu", "TPC n sigma mu;p_{in} (GeV/c);n #sigma_{#mu}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); + // fRegistry.add("Track/hTPCNsigmaMu", "TPC n sigma mu;p_{in} (GeV/c);n #sigma_{#mu}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); fRegistry.add("Track/hTPCNsigmaPi", "TPC n sigma pi;p_{in} (GeV/c);n #sigma_{#pi}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); fRegistry.add("Track/hTPCNsigmaKa", "TPC n sigma ka;p_{in} (GeV/c);n #sigma_{K}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); fRegistry.add("Track/hTPCNsigmaPr", "TPC n sigma pr;p_{in} (GeV/c);n #sigma_{p}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); fRegistry.add("Track/hTOFbeta", "TOF beta;p_{pv} (GeV/c);#beta", kTH2F, {{1000, 0, 10}, {240, 0, 1.2}}, false); fRegistry.add("Track/hTOFNsigmaEl", "TOF n sigma el;p_{in} (GeV/c);n #sigma_{e}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/hTOFNsigmaMu", "TOF n sigma mu;p_{in} (GeV/c);n #sigma_{#mu}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); + // fRegistry.add("Track/hTOFNsigmaMu", "TOF n sigma mu;p_{in} (GeV/c);n #sigma_{#mu}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); fRegistry.add("Track/hTOFNsigmaPi", "TOF n sigma pi;p_{in} (GeV/c);n #sigma_{#pi}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); fRegistry.add("Track/hTOFNsigmaKa", "TOF n sigma ka;p_{in} (GeV/c);n #sigma_{K}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); fRegistry.add("Track/hTOFNsigmaPr", "TOF n sigma pr;p_{in} (GeV/c);n #sigma_{p}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); @@ -367,43 +367,6 @@ struct skimmerPrimaryElectron { } } - // these are necessary cuts for converting float into int16_t. - if (track.hasTPC()) { - if (std::fabs(track.tpcNSigmaEl()) > 300.f) { - return false; - } - if (std::fabs(track.tpcNSigmaPi()) > 300.f) { - return false; - } - if (std::fabs(track.tpcNSigmaKa()) > 300.f) { - return false; - } - if (std::fabs(track.tpcNSigmaPr()) > 300.f) { - return false; - } - if (track.tpcSignal() > 600.f) { - return false; - } - if constexpr (isMC) { - if (track.mcTunedTPCSignal() > 600.f) { - return false; - } - } - } - if (track.hasTOF()) { - if (std::fabs(track.tofNSigmaEl()) > 300.f) { - return false; - } - if (std::fabs(track.tofNSigmaPi()) > 300.f) { - return false; - } - if (std::fabs(track.tofNSigmaKa()) > 300.f) { - return false; - } - if (std::fabs(track.tofNSigmaPr()) > 300.f) { - return false; - } - } return true; } @@ -491,37 +454,20 @@ struct skimmerPrimaryElectron { bool isAssociatedToMPC = collision.globalIndex() == track.collisionId(); float mcTunedTPCSignal = 0.f; if constexpr (isMC) { - if (track.hasTPC()) { - mcTunedTPCSignal = track.mcTunedTPCSignal(); - } + mcTunedTPCSignal = track.mcTunedTPCSignal(); } - float itsChi2NCl = (track.hasITS() && track.itsChi2NCl() > 0.f) ? track.itsChi2NCl() : -299.f; - float tpcChi2NCl = (track.hasTPC() && track.tpcChi2NCl() > 0.f) ? track.tpcChi2NCl() : -299.f; - float beta = track.hasTOF() ? track.beta() : -29.f; - float tofNSigmaEl = track.hasTOF() ? track.tofNSigmaEl() : -299.f; - float tofNSigmaPi = track.hasTOF() ? track.tofNSigmaPi() : -299.f; - float tofNSigmaKa = track.hasTOF() ? track.tofNSigmaKa() : -299.f; - float tofNSigmaPr = track.hasTOF() ? track.tofNSigmaPr() : -299.f; - float tofChi2 = track.hasTOF() ? track.tofChi2() : -299.f; - - float tpcSignal = track.hasTPC() ? track.tpcSignal() : 0.f; - float tpcNSigmaEl = track.hasTPC() ? track.tpcNSigmaEl() : -299.f; - float tpcNSigmaPi = track.hasTPC() ? track.tpcNSigmaPi() : -299.f; - float tpcNSigmaKa = track.hasTPC() ? track.tpcNSigmaKa() : -299.f; - float tpcNSigmaPr = track.hasTPC() ? track.tpcNSigmaPr() : -299.f; - emprimaryelectrons(collision.globalIndex(), track.globalIndex(), track.sign(), pt_recalc, eta_recalc, phi_recalc, dcaXY, dcaZ, trackParCov.getSigmaY2(), trackParCov.getSigmaZY(), trackParCov.getSigmaZ2(), track.tpcNClsFindable(), track.tpcNClsFindableMinusFound(), track.tpcNClsFindableMinusCrossedRows(), track.tpcNClsShared(), - static_cast(tpcChi2NCl * 1e+2), track.tpcInnerParam(), - static_cast(tpcSignal * 1e+2), static_cast(tpcNSigmaEl * 1e+2), static_cast(tpcNSigmaPi * 1e+2), static_cast(tpcNSigmaKa * 1e+2), static_cast(tpcNSigmaPr * 1e+2), - static_cast(beta * 1e+3), static_cast(tofNSigmaEl * 1e+2), static_cast(tofNSigmaPi * 1e+2), static_cast(tofNSigmaKa * 1e+2), static_cast(tofNSigmaPr * 1e+2), + track.tpcChi2NCl(), track.tpcInnerParam(), + track.tpcSignal(), track.tpcNSigmaEl(), track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr(), + track.beta(), track.tofNSigmaEl(), /*track.tofNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPr(),*/ track.itsClusterSizes(), - static_cast(itsChi2NCl * 1e+2), static_cast(tofChi2 * 1e+2), track.detectorMap(), - trackParCov.getTgl(), - isAssociatedToMPC, false, 1.f, static_cast(mcTunedTPCSignal * 1e+2)); + track.itsChi2NCl(), track.tofChi2(), track.detectorMap(), + // trackParCov.getTgl(), + isAssociatedToMPC, false, 1.f, mcTunedTPCSignal); emprimaryelectronscov( trackParCov.getX(), @@ -597,13 +543,13 @@ struct skimmerPrimaryElectron { fRegistry.fill(HIST("Track/hTPCdEdx"), track.tpcInnerParam(), track.tpcSignal()); fRegistry.fill(HIST("Track/hTPCdEdxMC"), track.tpcInnerParam(), mcTunedTPCSignal); fRegistry.fill(HIST("Track/hTPCNsigmaEl"), track.tpcInnerParam(), track.tpcNSigmaEl()); - fRegistry.fill(HIST("Track/hTPCNsigmaMu"), track.tpcInnerParam(), track.tpcNSigmaMu()); + // fRegistry.fill(HIST("Track/hTPCNsigmaMu"), track.tpcInnerParam(), track.tpcNSigmaMu()); fRegistry.fill(HIST("Track/hTPCNsigmaPi"), track.tpcInnerParam(), track.tpcNSigmaPi()); fRegistry.fill(HIST("Track/hTPCNsigmaKa"), track.tpcInnerParam(), track.tpcNSigmaKa()); fRegistry.fill(HIST("Track/hTPCNsigmaPr"), track.tpcInnerParam(), track.tpcNSigmaPr()); fRegistry.fill(HIST("Track/hTOFbeta"), trackParCov.getP(), track.beta()); fRegistry.fill(HIST("Track/hTOFNsigmaEl"), track.tpcInnerParam(), track.tofNSigmaEl()); - fRegistry.fill(HIST("Track/hTOFNsigmaMu"), track.tpcInnerParam(), track.tofNSigmaMu()); + // fRegistry.fill(HIST("Track/hTOFNsigmaMu"), track.tpcInnerParam(), track.tofNSigmaMu()); fRegistry.fill(HIST("Track/hTOFNsigmaPi"), track.tpcInnerParam(), track.tofNSigmaPi()); fRegistry.fill(HIST("Track/hTOFNsigmaKa"), track.tpcInnerParam(), track.tofNSigmaKa()); fRegistry.fill(HIST("Track/hTOFNsigmaPr"), track.tpcInnerParam(), track.tofNSigmaPr()); diff --git a/PWGEM/Dilepton/TableProducer/treeCreatorElectronML.cxx b/PWGEM/Dilepton/TableProducer/treeCreatorElectronML.cxx index 79d21b1e059..51b21a6439c 100644 --- a/PWGEM/Dilepton/TableProducer/treeCreatorElectronML.cxx +++ b/PWGEM/Dilepton/TableProducer/treeCreatorElectronML.cxx @@ -551,7 +551,7 @@ struct TreeCreatorElectronML { } } - template + template void doSingleTrack(TTrack& track, TMCParticle& mctrack, TMCParticles& mctracks, uint64_t collisionId, std::vector& collisions_old_labels, int& collisions_counter, bool use_downsample = true) { if (!IsSelected(track)) { @@ -584,15 +584,28 @@ struct TreeCreatorElectronML { collisions_counter++; collisions_old_labels.push_back(collisionId); } - mytrack(collisions_counter, - track.sign(), track.pt(), track.eta(), track.phi(), track.tgl(), track.dcaXY(), track.dcaZ(), sqrt(track.cYY()), sqrt(track.cZZ()), track.cZY(), - track.tpcNClsFindable(), track.tpcNClsFound(), track.tpcNClsCrossedRows(), - track.tpcChi2NCl(), track.tpcInnerParam(), - track.tpcSignal(), track.tpcNSigmaEl(), /*track.tpcNSigmaMu(),*/ track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr(), - track.beta(), track.tofNSigmaEl(), /*track.tofNSigmaMu(),*/ track.tofNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPr(), - track.tofChi2(), track.itsChi2NCl(), track.itsClusterSizes(), - mctrack.vx(), mctrack.vy(), mctrack.vz(), - mctrack.pdgCode(), mctrack.isPhysicalPrimary(), mothers_id, mothers_pdg); + + if constexpr (isDerived) { + mytrack(collisions_counter, + track.sign(), track.pt(), track.eta(), track.phi(), track.tgl(), track.dcaXY(), track.dcaZ(), sqrt(track.cYY()), sqrt(track.cZZ()), track.cZY(), + track.tpcNClsFindable(), track.tpcNClsFound(), track.tpcNClsCrossedRows(), + track.tpcChi2NCl(), track.tpcInnerParam(), + track.tpcSignal(), track.tpcNSigmaEl(), /*track.tpcNSigmaMu(),*/ track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr(), + track.beta(), track.tofNSigmaEl(), /*track.tofNSigmaMu(),*/ 0, 0, 0, + track.tofChi2(), track.itsChi2NCl(), track.itsClusterSizes(), + mctrack.vx(), mctrack.vy(), mctrack.vz(), + mctrack.pdgCode(), mctrack.isPhysicalPrimary(), mothers_id, mothers_pdg); + } else { + mytrack(collisions_counter, + track.sign(), track.pt(), track.eta(), track.phi(), track.tgl(), track.dcaXY(), track.dcaZ(), sqrt(track.cYY()), sqrt(track.cZZ()), track.cZY(), + track.tpcNClsFindable(), track.tpcNClsFound(), track.tpcNClsCrossedRows(), + track.tpcChi2NCl(), track.tpcInnerParam(), + track.tpcSignal(), track.tpcNSigmaEl(), /*track.tpcNSigmaMu(),*/ track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr(), + track.beta(), track.tofNSigmaEl(), /*track.tofNSigmaMu(),*/ track.tofNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPr(), + track.tofChi2(), track.itsChi2NCl(), track.itsClusterSizes(), + mctrack.vx(), mctrack.vy(), mctrack.vz(), + mctrack.pdgCode(), mctrack.isPhysicalPrimary(), mothers_id, mothers_pdg); + } mothers_id.shrink_to_fit(); mothers_pdg.shrink_to_fit(); @@ -638,7 +651,7 @@ struct TreeCreatorElectronML { continue; } auto mctrack = track.mcParticle_as(); - doSingleTrack(track, mctrack, mctracks, collision.globalIndex(), collisions_old_labels, collisions_counter); + doSingleTrack(track, mctrack, mctracks, collision.globalIndex(), collisions_old_labels, collisions_counter); } } @@ -672,7 +685,7 @@ struct TreeCreatorElectronML { continue; } auto mctrack = track.emmcparticle_as(); - doSingleTrack(track, mctrack, mctracks, collision.globalIndex(), collisions_old_labels, collisions_counter); + doSingleTrack(track, mctrack, mctracks, collision.globalIndex(), collisions_old_labels, collisions_counter); } } @@ -736,7 +749,7 @@ struct TreeCreatorElectronML { auto track = tracks.rawIteratorAt(track_label); auto mctrack = track.mcParticle_as(); - doSingleTrack(track, mctrack, mctracks, collision.globalIndex(), collisions_old_labels, collisions_counter, false); + doSingleTrack(track, mctrack, mctracks, collision.globalIndex(), collisions_old_labels, collisions_counter, false); } // end of track loop @@ -808,7 +821,7 @@ struct TreeCreatorElectronML { auto track = tracks.rawIteratorAt(track_label); auto mctrack = track.emmcparticle_as(); - doSingleTrack(track, mctrack, mctracks, collision.globalIndex(), collisions_old_labels_track, collisions_counter_track, false); + doSingleTrack(track, mctrack, mctracks, collision.globalIndex(), collisions_old_labels_track, collisions_counter_track, false); } // end of track loop diff --git a/PWGEM/Dilepton/Tasks/Converters/electronConverter4.cxx b/PWGEM/Dilepton/Tasks/Converters/electronConverter4.cxx index 37186075fe9..dcca6b5edc1 100644 --- a/PWGEM/Dilepton/Tasks/Converters/electronConverter4.cxx +++ b/PWGEM/Dilepton/Tasks/Converters/electronConverter4.cxx @@ -33,21 +33,6 @@ struct electronConverter4 { void process002to004(MyElectrons002 const& tracks) { for (const auto& track : tracks) { - float itsChi2NCl = (track.hasITS() && track.itsChi2NCl() > 0.f) ? track.itsChi2NCl() : -299.f; - float tpcChi2NCl = (track.hasTPC() && track.tpcChi2NCl() > 0.f) ? track.tpcChi2NCl() : -299.f; - float beta = track.hasTOF() ? track.beta() : -29.f; - float tofNSigmaEl = track.hasTOF() ? track.tofNSigmaEl() : -299.f; - float tofNSigmaPi = track.hasTOF() ? track.tofNSigmaPi() : -299.f; - float tofNSigmaKa = track.hasTOF() ? track.tofNSigmaKa() : -299.f; - float tofNSigmaPr = track.hasTOF() ? track.tofNSigmaPr() : -299.f; - float tofChi2 = track.hasTOF() ? track.tofChi2() : -299.f; - - float tpcSignal = track.hasTPC() ? track.tpcSignal() : -299.f; - float tpcNSigmaEl = track.hasTPC() ? track.tpcNSigmaEl() : -299.f; - float tpcNSigmaPi = track.hasTPC() ? track.tpcNSigmaPi() : -299.f; - float tpcNSigmaKa = track.hasTPC() ? track.tpcNSigmaKa() : -299.f; - float tpcNSigmaPr = track.hasTPC() ? track.tpcNSigmaPr() : -299.f; - track_004(track.collisionId(), track.trackId(), track.sign(), @@ -63,28 +48,27 @@ struct electronConverter4 { track.tpcNClsFindableMinusFound(), track.tpcNClsFindableMinusCrossedRows(), track.tpcNClsShared(), - - static_cast(tpcChi2NCl * 1e+2), + track.tpcChi2NCl(), track.tpcInnerParam(), - static_cast(tpcSignal * 1e+2), - static_cast(tpcNSigmaEl * 1e+2), - static_cast(tpcNSigmaPi * 1e+2), - static_cast(tpcNSigmaKa * 1e+2), - static_cast(tpcNSigmaPr * 1e+2), - static_cast(beta * 1e+3), - static_cast(tofNSigmaEl * 1e+2), - static_cast(tofNSigmaPi * 1e+2), - static_cast(tofNSigmaKa * 1e+2), - static_cast(tofNSigmaPr * 1e+2), + track.tpcSignal(), + track.tpcNSigmaEl(), + track.tpcNSigmaPi(), + track.tpcNSigmaKa(), + track.tpcNSigmaPr(), + track.beta(), + track.tofNSigmaEl(), + // track.tofNSigmaPi(), + // track.tofNSigmaKa(), + // track.tofNSigmaPr(), track.itsClusterSizes(), - static_cast(itsChi2NCl * 1e+2), - static_cast(tofChi2 * 1e+2), + track.itsChi2NCl(), + track.tofChi2(), track.detectorMap(), - track.tgl(), + // track.tgl(), track.isAssociatedToMPC(), false, 0.f, - static_cast(0)); + 0.f); } // end of track loop } PROCESS_SWITCH(electronConverter4, process002to004, "convert from 002 into 004", false); @@ -93,22 +77,6 @@ struct electronConverter4 { void process003to004(MyElectrons003 const& tracks) { for (const auto& track : tracks) { - float itsChi2NCl = track.itsChi2NCl() > 0.f ? track.itsChi2NCl() : -299.f; - float tpcChi2NCl = track.tpcChi2NCl() > 0.f ? track.tpcChi2NCl() : -299.f; - float beta = track.hasTOF() ? track.beta() : -29.f; - float tofNSigmaEl = track.hasTOF() ? track.tofNSigmaEl() : -299.f; - float tofNSigmaPi = track.hasTOF() ? track.tofNSigmaPi() : -299.f; - float tofNSigmaKa = track.hasTOF() ? track.tofNSigmaKa() : -299.f; - float tofNSigmaPr = track.hasTOF() ? track.tofNSigmaPr() : -299.f; - float tofChi2 = track.hasTOF() ? track.tofChi2() : -299.f; - - float tpcSignal = track.hasTPC() ? track.tpcSignal() : 0.f; - float mcTunedTPCSignal = track.hasTPC() ? track.mcTunedTPCSignal() : 0.f; - float tpcNSigmaEl = track.hasTPC() ? track.tpcNSigmaEl() : -299.f; - float tpcNSigmaPi = track.hasTPC() ? track.tpcNSigmaPi() : -299.f; - float tpcNSigmaKa = track.hasTPC() ? track.tpcNSigmaKa() : -299.f; - float tpcNSigmaPr = track.hasTPC() ? track.tpcNSigmaPr() : -299.f; - track_004(track.collisionId(), track.trackId(), track.sign(), @@ -124,28 +92,27 @@ struct electronConverter4 { track.tpcNClsFindableMinusFound(), track.tpcNClsFindableMinusCrossedRows(), track.tpcNClsShared(), - - static_cast(tpcChi2NCl * 1e+2), + track.tpcChi2NCl(), track.tpcInnerParam(), - static_cast(tpcSignal * 1e+2), - static_cast(tpcNSigmaEl * 1e+2), - static_cast(tpcNSigmaPi * 1e+2), - static_cast(tpcNSigmaKa * 1e+2), - static_cast(tpcNSigmaPr * 1e+2), - static_cast(beta * 1e+3), - static_cast(tofNSigmaEl * 1e+2), - static_cast(tofNSigmaPi * 1e+2), - static_cast(tofNSigmaKa * 1e+2), - static_cast(tofNSigmaPr * 1e+2), + track.tpcSignal(), + track.tpcNSigmaEl(), + track.tpcNSigmaPi(), + track.tpcNSigmaKa(), + track.tpcNSigmaPr(), + track.beta(), + track.tofNSigmaEl(), + // track.tofNSigmaPi(), + // track.tofNSigmaKa(), + // track.tofNSigmaPr(), track.itsClusterSizes(), - static_cast(itsChi2NCl * 1e+2), - static_cast(tofChi2 * 1e+2), + track.itsChi2NCl(), + track.tofChi2(), track.detectorMap(), - track.tgl(), + // track.tgl(), track.isAssociatedToMPC(), false, 0.f, - static_cast(mcTunedTPCSignal)); + track.mcTunedTPCSignal()); } // end of track loop } PROCESS_SWITCH(electronConverter4, process003to004, "convert from 003 into 004", false); diff --git a/PWGEM/Dilepton/Tasks/vpPairQC.cxx b/PWGEM/Dilepton/Tasks/vpPairQC.cxx index 891fa7e333b..ffa82e3c3e5 100644 --- a/PWGEM/Dilepton/Tasks/vpPairQC.cxx +++ b/PWGEM/Dilepton/Tasks/vpPairQC.cxx @@ -264,9 +264,9 @@ struct vpPairQC { fRegistry.add("Track/positive/hTPCNsigmaPr", "TPC n sigma pr;p_{in} (GeV/c);n #sigma_{p}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); fRegistry.add("Track/positive/hTOFNsigmaEl", "TOF n sigma el;p_{pv} (GeV/c);n #sigma_{e}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); // fRegistry.add("Track/positive/hTOFNsigmaMu", "TOF n sigma mu;p_{pv} (GeV/c);n #sigma_{#mu}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/positive/hTOFNsigmaPi", "TOF n sigma pi;p_{pv} (GeV/c);n #sigma_{#pi}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/positive/hTOFNsigmaKa", "TOF n sigma ka;p_{pv} (GeV/c);n #sigma_{K}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/positive/hTOFNsigmaPr", "TOF n sigma pr;p_{pv} (GeV/c);n #sigma_{p}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); + // fRegistry.add("Track/positive/hTOFNsigmaPi", "TOF n sigma pi;p_{pv} (GeV/c);n #sigma_{#pi}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); + // fRegistry.add("Track/positive/hTOFNsigmaKa", "TOF n sigma ka;p_{pv} (GeV/c);n #sigma_{K}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); + // fRegistry.add("Track/positive/hTOFNsigmaPr", "TOF n sigma pr;p_{pv} (GeV/c);n #sigma_{p}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); fRegistry.addClone("Track/positive/", "Track/negative/"); const AxisSpec axis_mass{50, 0, 0.05, "m_{ee} (GeV/c^{2})"}; @@ -447,9 +447,9 @@ struct vpPairQC { fRegistry.fill(HIST("Track/positive/hTPCNsigmaPr"), track.tpcInnerParam(), track.tpcNSigmaPr()); fRegistry.fill(HIST("Track/positive/hTOFNsigmaEl"), track.p(), track.tofNSigmaEl()); // fRegistry.fill(HIST("Track/positive/hTOFNsigmaMu"), track.p(), track.tofNSigmaMu()); - fRegistry.fill(HIST("Track/positive/hTOFNsigmaPi"), track.p(), track.tofNSigmaPi()); - fRegistry.fill(HIST("Track/positive/hTOFNsigmaKa"), track.p(), track.tofNSigmaKa()); - fRegistry.fill(HIST("Track/positive/hTOFNsigmaPr"), track.p(), track.tofNSigmaPr()); + // fRegistry.fill(HIST("Track/positive/hTOFNsigmaPi"), track.p(), track.tofNSigmaPi()); + // fRegistry.fill(HIST("Track/positive/hTOFNsigmaKa"), track.p(), track.tofNSigmaKa()); + // fRegistry.fill(HIST("Track/positive/hTOFNsigmaPr"), track.p(), track.tofNSigmaPr()); } else { fRegistry.fill(HIST("Track/negative/hs"), track.pt(), track.eta(), track.phi(), dca_3d, weight); fRegistry.fill(HIST("Track/negative/hQoverPt"), track.sign() / track.pt()); @@ -479,9 +479,9 @@ struct vpPairQC { fRegistry.fill(HIST("Track/negative/hTPCNsigmaPr"), track.tpcInnerParam(), track.tpcNSigmaPr()); fRegistry.fill(HIST("Track/negative/hTOFNsigmaEl"), track.p(), track.tofNSigmaEl()); // fRegistry.fill(HIST("Track/negative/hTOFNsigmaMu"), track.p(), track.tofNSigmaMu()); - fRegistry.fill(HIST("Track/negative/hTOFNsigmaPi"), track.p(), track.tofNSigmaPi()); - fRegistry.fill(HIST("Track/negative/hTOFNsigmaKa"), track.p(), track.tofNSigmaKa()); - fRegistry.fill(HIST("Track/negative/hTOFNsigmaPr"), track.p(), track.tofNSigmaPr()); + // fRegistry.fill(HIST("Track/negative/hTOFNsigmaPi"), track.p(), track.tofNSigmaPi()); + // fRegistry.fill(HIST("Track/negative/hTOFNsigmaKa"), track.p(), track.tofNSigmaKa()); + // fRegistry.fill(HIST("Track/negative/hTOFNsigmaPr"), track.p(), track.tofNSigmaPr()); } } diff --git a/PWGEM/Dilepton/Utils/MlResponseO2Track.h b/PWGEM/Dilepton/Utils/MlResponseO2Track.h index cd9be049af6..ae0c17096fb 100644 --- a/PWGEM/Dilepton/Utils/MlResponseO2Track.h +++ b/PWGEM/Dilepton/Utils/MlResponseO2Track.h @@ -144,18 +144,18 @@ enum class InputFeaturesO2Track : uint8_t { reldiffp, tpcSignal, tpcNSigmaEl, - tpcNSigmaMu, + // tpcNSigmaMu, tpcNSigmaPi, tpcNSigmaKa, tpcNSigmaPr, beta, tofNSigmaEl, - tofNSigmaMu, + // tofNSigmaMu, tofNSigmaPi, tofNSigmaKa, tofNSigmaPr, tpctofNSigmaEl, - tpctofNSigmaMu, + // tpctofNSigmaMu, tpctofNSigmaPi, tpctofNSigmaKa, tpctofNSigmaPr, @@ -198,18 +198,18 @@ class MlResponseO2Track : public MlResponse CHECK_AND_FILL_O2_TRACK_RELDIFF(reldiffp, getP, tpcInnerParam); CHECK_AND_FILL_O2_TRACK(tpcSignal); CHECK_AND_FILL_O2_TRACK(tpcNSigmaEl); - CHECK_AND_FILL_O2_TRACK(tpcNSigmaMu); + // CHECK_AND_FILL_O2_TRACK(tpcNSigmaMu); CHECK_AND_FILL_O2_TRACK(tpcNSigmaPi); CHECK_AND_FILL_O2_TRACK(tpcNSigmaKa); CHECK_AND_FILL_O2_TRACK(tpcNSigmaPr); CHECK_AND_FILL_O2_TRACK(beta); CHECK_AND_FILL_O2_TRACK(tofNSigmaEl); - CHECK_AND_FILL_O2_TRACK(tofNSigmaMu); + // CHECK_AND_FILL_O2_TRACK(tofNSigmaMu); CHECK_AND_FILL_O2_TRACK(tofNSigmaPi); CHECK_AND_FILL_O2_TRACK(tofNSigmaKa); CHECK_AND_FILL_O2_TRACK(tofNSigmaPr); CHECK_AND_FILL_O2_TRACK_TPCTOF(tpctofNSigmaEl, tpcNSigmaEl, tofNSigmaEl, hasTOF); - CHECK_AND_FILL_O2_TRACK_TPCTOF(tpctofNSigmaMu, tpcNSigmaMu, tofNSigmaMu, hasTOF); + // CHECK_AND_FILL_O2_TRACK_TPCTOF(tpctofNSigmaMu, tpcNSigmaMu, tofNSigmaMu, hasTOF); CHECK_AND_FILL_O2_TRACK_TPCTOF(tpctofNSigmaPi, tpcNSigmaPi, tofNSigmaPi, hasTOF); CHECK_AND_FILL_O2_TRACK_TPCTOF(tpctofNSigmaKa, tpcNSigmaKa, tofNSigmaKa, hasTOF); CHECK_AND_FILL_O2_TRACK_TPCTOF(tpctofNSigmaPr, tpcNSigmaPr, tofNSigmaPr, hasTOF); @@ -278,18 +278,18 @@ class MlResponseO2Track : public MlResponse FILL_MAP_O2_TRACK(reldiffp), FILL_MAP_O2_TRACK(tpcSignal), FILL_MAP_O2_TRACK(tpcNSigmaEl), - FILL_MAP_O2_TRACK(tpcNSigmaMu), + // FILL_MAP_O2_TRACK(tpcNSigmaMu), FILL_MAP_O2_TRACK(tpcNSigmaPi), FILL_MAP_O2_TRACK(tpcNSigmaKa), FILL_MAP_O2_TRACK(tpcNSigmaPr), FILL_MAP_O2_TRACK(beta), FILL_MAP_O2_TRACK(tofNSigmaEl), - FILL_MAP_O2_TRACK(tofNSigmaMu), + // FILL_MAP_O2_TRACK(tofNSigmaMu), FILL_MAP_O2_TRACK(tofNSigmaPi), FILL_MAP_O2_TRACK(tofNSigmaKa), FILL_MAP_O2_TRACK(tofNSigmaPr), FILL_MAP_O2_TRACK(tpctofNSigmaEl), - FILL_MAP_O2_TRACK(tpctofNSigmaMu), + // FILL_MAP_O2_TRACK(tpctofNSigmaMu), FILL_MAP_O2_TRACK(tpctofNSigmaPi), FILL_MAP_O2_TRACK(tpctofNSigmaKa), FILL_MAP_O2_TRACK(tpctofNSigmaPr), diff --git a/PWGEM/PhotonMeson/DataModel/gammaTables.h b/PWGEM/PhotonMeson/DataModel/gammaTables.h index 308e27acd10..7528737e118 100644 --- a/PWGEM/PhotonMeson/DataModel/gammaTables.h +++ b/PWGEM/PhotonMeson/DataModel/gammaTables.h @@ -124,37 +124,11 @@ DECLARE_SOA_COLUMN(Px, px, float); //! Px at SV DECLARE_SOA_COLUMN(Py, py, float); //! Py at SV DECLARE_SOA_COLUMN(Pz, pz, float); //! Pz at SV -DECLARE_SOA_COLUMN(DcaXYINT16, dcaXYINT16, int16_t); //! -32768 - +32767 -DECLARE_SOA_COLUMN(DcaZINT16, dcaZINT16, int16_t); //! -32768 - +32767 - -DECLARE_SOA_COLUMN(XUINT16, xUINT16, uint16_t); //! 0 - +65535 -DECLARE_SOA_COLUMN(YINT16, yINT16, int16_t); //! 0 - +65535 -DECLARE_SOA_COLUMN(ZINT16, zINT16, int16_t); //! -32768 - +32767 - -DECLARE_SOA_COLUMN(TPCSignalUINT16, tpcSignalUINT16, uint16_t); //! 0 - +65535 -DECLARE_SOA_COLUMN(DeDxTunedMcUINT16, mcTunedTPCSignalUINT16, uint16_t); //! 0 - +65535 -DECLARE_SOA_COLUMN(TPCChi2NClINT16, tpcChi2NClINT16, int16_t); //! -32768 - +32767 -DECLARE_SOA_COLUMN(ITSChi2NClINT16, itsChi2NClINT16, int16_t); //! -32768 - +32767 -DECLARE_SOA_COLUMN(TPCNSigmaElINT16, tpcNSigmaElINT16, int16_t); //! -32768 - +32767 -DECLARE_SOA_COLUMN(TPCNSigmaPiINT16, tpcNSigmaPiINT16, int16_t); //! -32768 - +32767 -DECLARE_SOA_DYNAMIC_COLUMN(TPCSignal, tpcSignal, [](uint16_t x) -> float { return static_cast(x) * 1e-2; }); -DECLARE_SOA_DYNAMIC_COLUMN(DeDxTunedMc, mcTunedTPCSignal, [](uint16_t x) -> float { return static_cast(x) * 1e-2; }); -DECLARE_SOA_DYNAMIC_COLUMN(TPCChi2NCl, tpcChi2NCl, [](int16_t x) -> float { return static_cast(x) * 1e-2; }); -DECLARE_SOA_DYNAMIC_COLUMN(ITSChi2NCl, itsChi2NCl, [](int16_t x) -> float { return static_cast(x) * 1e-2; }); -DECLARE_SOA_DYNAMIC_COLUMN(TPCNSigmaEl, tpcNSigmaEl, [](int16_t x) -> float { return static_cast(x) * 1e-2; }); -DECLARE_SOA_DYNAMIC_COLUMN(TPCNSigmaPi, tpcNSigmaPi, [](int16_t x) -> float { return static_cast(x) * 1e-2; }); - -DECLARE_SOA_DYNAMIC_COLUMN(X, x, [](uint16_t x) -> float { return static_cast(x) * 1e-2; }); -DECLARE_SOA_DYNAMIC_COLUMN(Y, y, [](int16_t x) -> float { return static_cast(x) * 1e-2; }); -DECLARE_SOA_DYNAMIC_COLUMN(Z, z, [](int16_t x) -> float { return static_cast(x) * 1e-2; }); - -DECLARE_SOA_DYNAMIC_COLUMN(DcaXY, dcaXY, [](int16_t x) -> float { return static_cast(x) * 1e-2; }); -DECLARE_SOA_DYNAMIC_COLUMN(DcaZ, dcaZ, [](int16_t x) -> float { return static_cast(x) * 1e-2; }); - DECLARE_SOA_DYNAMIC_COLUMN(P, p, [](float px, float py, float pz) -> float { return RecoDecay::sqrtSumOfSquares(px, py, pz); }); DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt, [](float px, float py) -> float { return RecoDecay::sqrtSumOfSquares(px, py); }); DECLARE_SOA_DYNAMIC_COLUMN(Eta, eta, [](float px, float py, float pz) -> float { return RecoDecay::eta(std::array{px, py, pz}); }); DECLARE_SOA_DYNAMIC_COLUMN(Phi, phi, [](float px, float py) -> float { return RecoDecay::phi(px, py); }); +DECLARE_SOA_DYNAMIC_COLUMN(Tgl, tgl, [](float px, float py, float pz) -> float { return std::tan(M_PI_2 - 2 * std::atan(std::exp(-RecoDecay::eta(std::array{px, py, pz})))); }); DECLARE_SOA_DYNAMIC_COLUMN(MeanClusterSizeITS, meanClusterSizeITS, [](uint32_t itsClusterSizes) -> float { int total_cluster_size = 0, nl = 0; for (unsigned int layer = 0; layer < 7; layer++) { @@ -230,20 +204,20 @@ DECLARE_SOA_TABLE(V0Legs_000, "AOD", "V0LEG", //! DECLARE_SOA_TABLE_VERSIONED(V0Legs_001, "AOD", "V0LEG", 1, //! o2::soa::Index<>, v0leg::CollisionId, v0leg::TrackId, v0leg::Sign, v0leg::Px, v0leg::Py, v0leg::Pz, - v0leg::DcaXYINT16, v0leg::DcaZINT16, + track::DcaXY, track::DcaZ, track::TPCNClsFindable, track::TPCNClsFindableMinusFound, track::TPCNClsFindableMinusCrossedRows, track::TPCNClsShared, - v0leg::TPCChi2NClINT16, track::TPCInnerParam, - v0leg::TPCSignalUINT16, v0leg::TPCNSigmaElINT16, v0leg::TPCNSigmaPiINT16, - track::ITSClusterSizes, v0leg::ITSChi2NClINT16, track::DetectorMap, v0leg::DeDxTunedMcUINT16, - v0leg::XUINT16, v0leg::YINT16, v0leg::ZINT16, track::Tgl, + track::TPCChi2NCl, track::TPCInnerParam, + track::TPCSignal, pidtpc::TPCNSigmaEl, pidtpc::TPCNSigmaPi, + track::ITSClusterSizes, track::ITSChi2NCl, track::DetectorMap, + mcpidtpc::DeDxTunedMc, + track::X, track::Y, track::Z, // dynamic column v0leg::P, v0leg::Pt, v0leg::Eta, v0leg::Phi, - v0leg::DcaXY, - v0leg::DcaZ, + v0leg::Tgl, track::TPCNClsFound, track::TPCNClsCrossedRows, @@ -254,16 +228,7 @@ DECLARE_SOA_TABLE_VERSIONED(V0Legs_001, "AOD", "V0LEG", 1, //! track::HasITS, track::HasTPC, track::HasTRD, track::HasTOF, v0leg::MeanClusterSizeITS, v0leg::MeanClusterSizeITSib, - v0leg::MeanClusterSizeITSob, - v0leg::TPCSignal, - v0leg::DeDxTunedMc, - v0leg::TPCChi2NCl, - v0leg::ITSChi2NCl, - v0leg::TPCNSigmaEl, - v0leg::TPCNSigmaPi, - v0leg::X, - v0leg::Y, - v0leg::Z); + v0leg::MeanClusterSizeITSob); using V0Legs = V0Legs_001; @@ -283,20 +248,6 @@ DECLARE_SOA_TABLE(EMEventsWeight, "AOD", "EMEVENTWEIGHT", //! table contanint th emevent::Weight); using EMEventWeight = EMEventsWeight::iterator; -namespace oldv0photonkf -{ -DECLARE_SOA_COLUMN(MGamma, mGamma, float); //! invariant mass of dielectron at SV -DECLARE_SOA_COLUMN(DCAxyToPV, dcaXYtopv, float); //! DCAxy of V0 to PV -DECLARE_SOA_COLUMN(DCAzToPV, dcaZtopv, float); //! DCAz of V0 to PV -DECLARE_SOA_COLUMN(CosPA, cospa, float); //! -DECLARE_SOA_COLUMN(CosPAXY, cospaXY, float); //! -DECLARE_SOA_COLUMN(CosPARZ, cospaRZ, float); //! -DECLARE_SOA_COLUMN(PCA, pca, float); //! -DECLARE_SOA_COLUMN(Alpha, alpha, float); //! -DECLARE_SOA_COLUMN(QtArm, qtarm, float); //! -DECLARE_SOA_COLUMN(ChiSquareNDF, chiSquareNDF, float); //! Chi2 / NDF of the reconstructed V0 -} // namespace oldv0photonkf - namespace v0photonkf { DECLARE_SOA_INDEX_COLUMN(EMEvent, emevent); //! @@ -310,17 +261,17 @@ DECLARE_SOA_COLUMN(Vz, vz, float); //! seco DECLARE_SOA_COLUMN(Px, px, float); //! px for photon kf DECLARE_SOA_COLUMN(Py, py, float); //! py for photon kf DECLARE_SOA_COLUMN(Pz, pz, float); //! pz for photon kf -DECLARE_SOA_COLUMN(MGammaUINT16, mGammaUINT16, uint16_t); //! invariant mass of dielectron at SV - -DECLARE_SOA_COLUMN(DCAxyToPVINT16, dcaXYtopvINT16, int16_t); //! DCAxy of V0 to PV -DECLARE_SOA_COLUMN(DCAzToPVINT16, dcaZtopvINT16, int16_t); //! DCAz of V0 to PV -DECLARE_SOA_COLUMN(CosPAUINT16, cospaUINT16, uint16_t); //! cosine of pointing angle in 3D -DECLARE_SOA_COLUMN(CosPAXYUINT16, cospaXYUINT16, uint16_t); //! cosine of pointing angle in XY -DECLARE_SOA_COLUMN(CosPARZUINT16, cospaRZUINT16, uint16_t); //! cosine of pointing angle in RZ -DECLARE_SOA_COLUMN(PCAUINT16, pcaUINT16, uint16_t); //! distance between 2 legs at point of closest approach -DECLARE_SOA_COLUMN(AlphaINT16, alphaINT16, int16_t); //! longitudinal momentum asymmetry -DECLARE_SOA_COLUMN(QtArmUINT16, qtarmUINT16, uint16_t); //! qT -DECLARE_SOA_COLUMN(ChiSquareNDFUINT16, chiSquareNDFUINT16, uint16_t); //! Chi2 / NDF of the reconstructed V0 + +DECLARE_SOA_COLUMN(MGamma, mGamma, float); //! invariant mass of dielectron at SV +DECLARE_SOA_COLUMN(DCAxyToPV, dcaXYtopv, float); //! DCAxy of V0 to PV +DECLARE_SOA_COLUMN(DCAzToPV, dcaZtopv, float); //! DCAz of V0 to PV +DECLARE_SOA_COLUMN(CosPA, cospa, float); //! +DECLARE_SOA_COLUMN(CosPAXY, cospaXY, float); //! +DECLARE_SOA_COLUMN(CosPARZ, cospaRZ, float); //! +DECLARE_SOA_COLUMN(PCA, pca, float); //! +DECLARE_SOA_COLUMN(Alpha, alpha, float); //! +DECLARE_SOA_COLUMN(QtArm, qtarm, float); //! +DECLARE_SOA_COLUMN(ChiSquareNDF, chiSquareNDF, float); //! Chi2 / NDF of the reconstructed V0 DECLARE_SOA_COLUMN(SigmaPx2, sigmaPx2, float); //! error^2 of px in covariant matrix DECLARE_SOA_COLUMN(SigmaPy2, sigmaPy2, float); //! error^2 of py in covariant matrix @@ -330,18 +281,6 @@ DECLARE_SOA_COLUMN(SigmaPyPz, sigmaPyPz, float); //! error of py x DECLARE_SOA_COLUMN(SigmaPzPx, sigmaPzPx, float); //! error of pz x px in covariant matrix DECLARE_SOA_COLUMN(PrefilterBitDerived, pfbderived, uint16_t); //! -DECLARE_SOA_DYNAMIC_COLUMN(DCAxyToPV, dcaXYtopv, [](int16_t x) -> float { return static_cast(x) * 1e-2; }); -DECLARE_SOA_DYNAMIC_COLUMN(DCAzToPV, dcaZtopv, [](int16_t x) -> float { return static_cast(x) * 1e-2; }); - -DECLARE_SOA_DYNAMIC_COLUMN(MGamma, mGamma, [](uint16_t x) -> float { return static_cast(x) * 1e-5; }); -DECLARE_SOA_DYNAMIC_COLUMN(CosPA, cospa, [](uint16_t x) -> float { return static_cast(x) * 2e-5; }); -DECLARE_SOA_DYNAMIC_COLUMN(CosPAXY, cospaXY, [](uint16_t x) -> float { return static_cast(x) * 2e-5; }); -DECLARE_SOA_DYNAMIC_COLUMN(CosPARZ, cospaRZ, [](uint16_t x) -> float { return static_cast(x) * 2e-5; }); -DECLARE_SOA_DYNAMIC_COLUMN(PCA, pca, [](uint16_t x) -> float { return static_cast(x) * 1e-4; }); -DECLARE_SOA_DYNAMIC_COLUMN(Alpha, alpha, [](int16_t x) -> float { return static_cast(x) * 1e-4; }); -DECLARE_SOA_DYNAMIC_COLUMN(QtArm, qtarm, [](uint16_t x) -> float { return static_cast(x) * 1e-5; }); -DECLARE_SOA_DYNAMIC_COLUMN(ChiSquareNDF, chiSquareNDF, [](uint16_t x) -> float { return static_cast(x) * 1e-1; }); - DECLARE_SOA_DYNAMIC_COLUMN(E, e, [](float px, float py, float pz, float m = 0) -> float { return RecoDecay::sqrtSumOfSquares(px, py, pz, m); }); //! energy of v0 photn, mass to be given as argument when getter is called! DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt, [](float px, float py) -> float { return RecoDecay::sqrtSumOfSquares(px, py); }); DECLARE_SOA_DYNAMIC_COLUMN(Eta, eta, [](float px, float py, float pz) -> float { return RecoDecay::eta(std::array{px, py, pz}); }); @@ -353,11 +292,11 @@ DECLARE_SOA_TABLE(V0PhotonsKF_000, "AOD", "V0PHOTONKF", //! o2::soa::Index<>, v0photonkf::CollisionId, v0photonkf::V0Id, v0photonkf::PosTrackId, v0photonkf::NegTrackId, v0photonkf::Vx, v0photonkf::Vy, v0photonkf::Vz, v0photonkf::Px, v0photonkf::Py, v0photonkf::Pz, - oldv0photonkf::MGamma, - oldv0photonkf::DCAxyToPV, oldv0photonkf::DCAzToPV, - oldv0photonkf::CosPA, oldv0photonkf::CosPAXY, oldv0photonkf::CosPARZ, oldv0photonkf::PCA, - oldv0photonkf::Alpha, oldv0photonkf::QtArm, - oldv0photonkf::ChiSquareNDF, + v0photonkf::MGamma, + v0photonkf::DCAxyToPV, v0photonkf::DCAzToPV, + v0photonkf::CosPA, v0photonkf::CosPAXY, v0photonkf::CosPARZ, v0photonkf::PCA, + v0photonkf::Alpha, v0photonkf::QtArm, + v0photonkf::ChiSquareNDF, // dynamic column v0photonkf::E, @@ -371,11 +310,11 @@ DECLARE_SOA_TABLE_VERSIONED(V0PhotonsKF_001, "AOD", "V0PHOTONKF", 1, //! o2::soa::Index<>, v0photonkf::CollisionId, v0photonkf::V0Id, v0photonkf::PosTrackId, v0photonkf::NegTrackId, v0photonkf::Vx, v0photonkf::Vy, v0photonkf::Vz, v0photonkf::Px, v0photonkf::Py, v0photonkf::Pz, - v0photonkf::MGammaUINT16, - v0photonkf::DCAxyToPVINT16, v0photonkf::DCAzToPVINT16, - v0photonkf::CosPAUINT16, v0photonkf::CosPAXYUINT16, v0photonkf::CosPARZUINT16, v0photonkf::PCAUINT16, - v0photonkf::AlphaINT16, v0photonkf::QtArmUINT16, - v0photonkf::ChiSquareNDFUINT16, + v0photonkf::MGamma, + v0photonkf::DCAxyToPV, v0photonkf::DCAzToPV, + v0photonkf::CosPA, v0photonkf::CosPAXY, v0photonkf::CosPARZ, v0photonkf::PCA, + v0photonkf::Alpha, v0photonkf::QtArm, + v0photonkf::ChiSquareNDF, // dynamic column v0photonkf::E, @@ -383,18 +322,7 @@ DECLARE_SOA_TABLE_VERSIONED(V0PhotonsKF_001, "AOD", "V0PHOTONKF", 1, //! v0photonkf::Eta, v0photonkf::Phi, v0photonkf::P, - v0photonkf::V0Radius, - - v0photonkf::MGamma, - v0photonkf::DCAxyToPV, - v0photonkf::DCAzToPV, - v0photonkf::CosPA, - v0photonkf::CosPAXY, - v0photonkf::CosPARZ, - v0photonkf::PCA, - v0photonkf::Alpha, - v0photonkf::QtArm, - v0photonkf::ChiSquareNDF); + v0photonkf::V0Radius); using V0PhotonsKF = V0PhotonsKF_001; @@ -446,20 +374,12 @@ DECLARE_SOA_TABLE_VERSIONED(EMPrimaryElectronsFromDalitz_001, "AOD", "EMPRIMARYE o2::soa::Index<>, emprimaryelectron::CollisionId, emprimaryelectron::TrackId, emprimaryelectron::Sign, track::Pt, track::Eta, track::Phi, track::DcaXY, track::DcaZ, track::CYY, track::CZY, track::CZZ, - - // track::TPCNClsFindable, track::TPCNClsFindableMinusFound, track::TPCNClsFindableMinusCrossedRows, track::TPCNClsShared, - // track::TPCChi2NCl, track::TPCInnerParam, - // track::TPCSignal, pidtpc::TPCNSigmaEl, pidtpc::TPCNSigmaPi, - // pidtofbeta::Beta, pidtof::TOFNSigmaEl, pidtof::TOFNSigmaPi, - // track::ITSClusterSizes, track::ITSChi2NCl, track::TOFChi2, track::DetectorMap, track::Tgl, - track::TPCNClsFindable, track::TPCNClsFindableMinusFound, track::TPCNClsFindableMinusCrossedRows, track::TPCNClsShared, - emprimaryelectron::TPCChi2NClINT16, track::TPCInnerParam, - emprimaryelectron::TPCSignalUINT16, emprimaryelectron::TPCNSigmaElINT16, emprimaryelectron::TPCNSigmaPiINT16, - emprimaryelectron::BetaINT16, emprimaryelectron::TOFNSigmaElINT16, emprimaryelectron::TOFNSigmaPiINT16, - track::ITSClusterSizes, - emprimaryelectron::ITSChi2NClINT16, emprimaryelectron::TOFChi2INT16, track::DetectorMap, track::Tgl, - emprimaryelectron::DeDxTunedMcUINT16, + track::TPCChi2NCl, track::TPCInnerParam, + track::TPCSignal, pidtpc::TPCNSigmaEl, pidtpc::TPCNSigmaPi, + pidtofbeta::Beta, pidtof::TOFNSigmaEl, + track::ITSClusterSizes, track::ITSChi2NCl, track::TOFChi2, track::DetectorMap, + mcpidtpc::DeDxTunedMc, // dynamic column track::TPCNClsFound, @@ -468,26 +388,14 @@ DECLARE_SOA_TABLE_VERSIONED(EMPrimaryElectronsFromDalitz_001, "AOD", "EMPRIMARYE track::TPCFoundOverFindableCls, track::v001::ITSClusterMap, track::v001::ITSNCls, track::v001::ITSNClsInnerBarrel, track::TPCFractionSharedCls, - track::HasITS, track::HasTPC, - track::HasTRD, track::HasTOF, - - emprimaryelectron::TPCSignal, - emprimaryelectron::TPCChi2NCl, - emprimaryelectron::ITSChi2NCl, - emprimaryelectron::DeDxTunedMc, - emprimaryelectron::Beta, - emprimaryelectron::TOFChi2, - - emprimaryelectron::TPCNSigmaEl, - emprimaryelectron::TPCNSigmaPi, - emprimaryelectron::TOFNSigmaEl, - emprimaryelectron::TOFNSigmaPi, + track::HasITS, track::HasTPC, track::HasTRD, track::HasTOF, emprimaryelectron::Signed1Pt, emprimaryelectron::P, emprimaryelectron::Px, emprimaryelectron::Py, emprimaryelectron::Pz, + emprimaryelectron::Tgl, emprimaryelectron::MeanClusterSizeITS, emprimaryelectron::MeanClusterSizeITSib, emprimaryelectron::MeanClusterSizeITSob); diff --git a/PWGEM/PhotonMeson/TableProducer/photonconversionbuilder.cxx b/PWGEM/PhotonMeson/TableProducer/photonconversionbuilder.cxx index 0a62a60af1b..d39766cc968 100644 --- a/PWGEM/PhotonMeson/TableProducer/photonconversionbuilder.cxx +++ b/PWGEM/PhotonMeson/TableProducer/photonconversionbuilder.cxx @@ -65,7 +65,7 @@ using MyCollisions = soa::Join; using MyCollisionsWithSWT = soa::Join; using MyCollisionsMC = soa::Join; -using MyTracksIU = soa::Join; +using MyTracksIU = soa::Join; using MyTracksIUMC = soa::Join; struct PhotonConversionBuilder { @@ -367,27 +367,18 @@ struct PhotonConversionBuilder { template void fillTrackTable(TTrack const& track, TShiftedTrack const& shiftedtrack, TKFParticle const& kfp, const float dcaXY, const float dcaZ) { - float itsChi2NCl = (track.hasITS() && track.itsChi2NCl() > 0.f) ? track.itsChi2NCl() : -299.f; - float tpcChi2NCl = (track.hasTPC() && track.tpcChi2NCl() > 0.f) ? track.tpcChi2NCl() : -299.f; - float tpcSignal = track.hasTPC() ? track.tpcSignal() : 0.f; - float tpcNSigmaEl = track.hasTPC() ? track.tpcNSigmaEl() : -299.f; - float tpcNSigmaPi = track.hasTPC() ? track.tpcNSigmaPi() : -299.f; - float mcTunedTPCSignal = 0.f; if constexpr (isMC) { mcTunedTPCSignal = track.mcTunedTPCSignal(); - if (track.hasTPC()) { - mcTunedTPCSignal = track.mcTunedTPCSignal(); - } } v0legs(track.collisionId(), track.globalIndex(), track.sign(), - kfp.GetPx(), kfp.GetPy(), kfp.GetPz(), static_cast(dcaXY * 1e+2), static_cast(dcaZ * 1e+2), + kfp.GetPx(), kfp.GetPy(), kfp.GetPz(), dcaXY, dcaZ, track.tpcNClsFindable(), track.tpcNClsFindableMinusFound(), track.tpcNClsFindableMinusCrossedRows(), track.tpcNClsShared(), - static_cast(tpcChi2NCl * 1e+2), track.tpcInnerParam(), static_cast(tpcSignal * 1e+2), - static_cast(tpcNSigmaEl * 1e+2), static_cast(tpcNSigmaPi * 1e+2), - track.itsClusterSizes(), static_cast(itsChi2NCl * 1e+2), track.detectorMap(), static_cast(mcTunedTPCSignal * 1e+2), - static_cast(shiftedtrack.getX() * 1e+2), static_cast(shiftedtrack.getY() * 1e+2), static_cast(shiftedtrack.getZ() * 1e+2), shiftedtrack.getTgl()); + track.tpcChi2NCl(), track.tpcInnerParam(), track.tpcSignal(), + track.tpcNSigmaEl(), track.tpcNSigmaPi(), + track.itsClusterSizes(), track.itsChi2NCl(), track.detectorMap(), mcTunedTPCSignal, + shiftedtrack.getX(), shiftedtrack.getY(), shiftedtrack.getZ()); } template @@ -684,9 +675,9 @@ struct PhotonConversionBuilder { v0photonskf(collision.globalIndex(), v0.globalIndex(), v0legs.lastIndex() + 1, v0legs.lastIndex() + 2, gammaKF_DecayVtx.GetX(), gammaKF_DecayVtx.GetY(), gammaKF_DecayVtx.GetZ(), gammaKF_PV.GetPx(), gammaKF_PV.GetPy(), gammaKF_PV.GetPz(), - static_cast(v0_sv.M() * 1e+5), static_cast(dca_xy_v0_to_pv * 1e+2), static_cast(dca_z_v0_to_pv * 1e+2), - static_cast(cospa_kf * 5e+4), static_cast(cospaXY_kf * 5e+4), static_cast(cospaRZ_kf * 5e+4), - static_cast(pca_kf * 1e+4), static_cast(alpha * 1e+4), static_cast(qt * 1e+5), static_cast(chi2kf * 1e+1)); + v0_sv.M(), dca_xy_v0_to_pv, dca_z_v0_to_pv, + cospa_kf, cospaXY_kf, cospaRZ_kf, + pca_kf, alpha, qt, chi2kf); // v0photonskfcov(gammaKF_PV.GetCovariance(9), gammaKF_PV.GetCovariance(14), gammaKF_PV.GetCovariance(20), gammaKF_PV.GetCovariance(13), gammaKF_PV.GetCovariance(19), gammaKF_PV.GetCovariance(18)); diff --git a/PWGEM/PhotonMeson/TableProducer/skimmerGammaConversion.cxx b/PWGEM/PhotonMeson/TableProducer/skimmerGammaConversion.cxx index 90726fb34de..fadc7a27b48 100644 --- a/PWGEM/PhotonMeson/TableProducer/skimmerGammaConversion.cxx +++ b/PWGEM/PhotonMeson/TableProducer/skimmerGammaConversion.cxx @@ -189,7 +189,7 @@ struct skimmerGammaConversion { theTrack.tpcChi2NCl(), theTrack.tpcInnerParam(), theTrack.tpcSignal(), theTrack.tpcNSigmaEl(), theTrack.tpcNSigmaPi(), theTrack.itsClusterSizes(), theTrack.itsChi2NCl(), theTrack.detectorMap(), 0, - theTrack.x(), theTrack.y(), theTrack.z(), theTrack.tgl()); + theTrack.x(), theTrack.y(), theTrack.z()); } template diff --git a/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryElectronFromDalitzEE.cxx b/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryElectronFromDalitzEE.cxx index 5f814376546..f9aae623469 100644 --- a/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryElectronFromDalitzEE.cxx +++ b/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryElectronFromDalitzEE.cxx @@ -316,30 +316,15 @@ struct skimmerPrimaryElectronFromDalitzEE { float mcTunedTPCSignal = 0.f; if constexpr (isMC) { mcTunedTPCSignal = track.mcTunedTPCSignal(); - if (track.hasTPC()) { - mcTunedTPCSignal = track.mcTunedTPCSignal(); - } } - float itsChi2NCl = (track.hasITS() && track.itsChi2NCl() > 0.f) ? track.itsChi2NCl() : -299.f; - float tpcChi2NCl = (track.hasTPC() && track.tpcChi2NCl() > 0.f) ? track.tpcChi2NCl() : -299.f; - float beta = track.hasTOF() ? track.beta() : -29.f; - float tofNSigmaEl = track.hasTOF() ? track.tofNSigmaEl() : -299.f; - float tofNSigmaPi = track.hasTOF() ? track.tofNSigmaPi() : -299.f; - float tofChi2 = track.hasTOF() ? track.tofChi2() : -299.f; - - float tpcSignal = track.hasTPC() ? track.tpcSignal() : 0.f; - float tpcNSigmaEl = track.hasTPC() ? track.tpcNSigmaEl() : -299.f; - float tpcNSigmaPi = track.hasTPC() ? track.tpcNSigmaPi() : -299.f; - emprimaryelectrons(collision.globalIndex(), track.globalIndex(), track.sign(), track.pt(), track.eta(), track.phi(), track.dcaXY(), track.dcaZ(), track.cYY(), track.cZY(), track.cZZ(), track.tpcNClsFindable(), track.tpcNClsFindableMinusFound(), track.tpcNClsFindableMinusCrossedRows(), track.tpcNClsShared(), - - static_cast(tpcChi2NCl * 1e+2), track.tpcInnerParam(), - static_cast(tpcSignal * 1e+2), static_cast(tpcNSigmaEl * 1e+2), static_cast(tpcNSigmaPi * 1e+2), - static_cast(beta * 1e+3), static_cast(tofNSigmaEl * 1e+2), static_cast(tofNSigmaPi * 1e+2), - track.itsClusterSizes(), static_cast(itsChi2NCl * 1e+2), static_cast(tofChi2 * 1e+2), track.detectorMap(), track.tgl(), static_cast(mcTunedTPCSignal * 1e+2)); + track.tpcChi2NCl(), track.tpcInnerParam(), + track.tpcSignal(), track.tpcNSigmaEl(), track.tpcNSigmaPi(), + track.beta(), track.tofNSigmaEl(), + track.itsClusterSizes(), track.itsChi2NCl(), track.tofChi2(), track.detectorMap(), mcTunedTPCSignal); } template @@ -348,9 +333,6 @@ struct skimmerPrimaryElectronFromDalitzEE { float mcTunedTPCSignal = 0.f; if constexpr (isMC) { mcTunedTPCSignal = track.mcTunedTPCSignal(); - if (track.hasTPC()) { - mcTunedTPCSignal = track.mcTunedTPCSignal(); - } } fRegistry.fill(HIST("Track/hPt"), track.pt()); diff --git a/PWGEM/PhotonMeson/Tasks/Converters/electronFromDalitzConverter1.cxx b/PWGEM/PhotonMeson/Tasks/Converters/electronFromDalitzConverter1.cxx index 629fab67530..41fa06d1e94 100644 --- a/PWGEM/PhotonMeson/Tasks/Converters/electronFromDalitzConverter1.cxx +++ b/PWGEM/PhotonMeson/Tasks/Converters/electronFromDalitzConverter1.cxx @@ -32,17 +32,6 @@ struct electronFromDalitzConverter1 { void process(aod::EMPrimaryElectronsFromDalitz_000 const& tracks) { for (const auto& track : tracks) { - float itsChi2NCl = track.itsChi2NCl() > 0.f ? track.itsChi2NCl() : -299.f; - float tpcChi2NCl = track.tpcChi2NCl() > 0.f ? track.tpcChi2NCl() : -299.f; - float beta = track.hasTOF() ? track.beta() : -29.f; - float tofNSigmaEl = track.hasTOF() ? track.tofNSigmaEl() : -299.f; - float tofNSigmaPi = track.hasTOF() ? track.tofNSigmaPi() : -299.f; - float tofChi2 = track.hasTOF() ? track.tofChi2() : -299.f; - - float tpcSignal = track.hasTPC() ? track.tpcSignal() : 0.f; - float tpcNSigmaEl = track.hasTPC() ? track.tpcNSigmaEl() : -299.f; - float tpcNSigmaPi = track.hasTPC() ? track.tpcNSigmaPi() : -299.f; - electron_001(track.collisionId(), track.trackId(), track.sign(), @@ -58,21 +47,18 @@ struct electronFromDalitzConverter1 { track.tpcNClsFindableMinusFound(), track.tpcNClsFindableMinusCrossedRows(), track.tpcNClsShared(), - - static_cast(tpcChi2NCl * 1e+2), + track.tpcChi2NCl(), track.tpcInnerParam(), - static_cast(tpcSignal * 1e+2), - static_cast(tpcNSigmaEl * 1e+2), - static_cast(tpcNSigmaPi * 1e+2), - static_cast(beta * 1e+3), - static_cast(tofNSigmaEl * 1e+2), - static_cast(tofNSigmaPi * 1e+2), + track.tpcSignal(), + track.tpcNSigmaEl(), + track.tpcNSigmaPi(), + track.beta(), + track.tofNSigmaEl(), track.itsClusterSizes(), - static_cast(itsChi2NCl * 1e+2), - static_cast(tofChi2 * 1e+2), + track.itsChi2NCl(), + track.tofChi2(), track.detectorMap(), - track.tgl(), - 0); + 0.f); } // end of track loop } // end of process diff --git a/PWGEM/PhotonMeson/Tasks/Converters/pcmConverter1.cxx b/PWGEM/PhotonMeson/Tasks/Converters/pcmConverter1.cxx index e9d7af43acd..313f53be195 100644 --- a/PWGEM/PhotonMeson/Tasks/Converters/pcmConverter1.cxx +++ b/PWGEM/PhotonMeson/Tasks/Converters/pcmConverter1.cxx @@ -44,26 +44,19 @@ struct pcmConverter1 { v0.px(), v0.py(), v0.pz(), - static_cast(v0.mGamma() * 1e+5), - static_cast(v0.dcaXYtopv() * 1e+2), - static_cast(v0.dcaZtopv() * 1e+2), - static_cast(v0.cospa() * 1e+4), - static_cast(v0.cospaXY() * 1e+4), - static_cast(v0.cospaRZ() * 1e+4), - static_cast(v0.pca() * 1e+4), - static_cast(v0.alpha() * 1e+4), - static_cast(v0.qtarm() * 1e+5), - static_cast(v0.chiSquareNDF() * 1e+2)); + v0.mGamma(), + v0.dcaXYtopv(), + v0.dcaZtopv(), + v0.cospa(), + v0.cospaXY(), + v0.cospaRZ(), + v0.pca(), + v0.alpha(), + v0.qtarm(), + v0.chiSquareNDF()); } // end of v0 loop for (auto& v0leg : v0legs) { - - float itsChi2NCl = (v0leg.hasITS() && v0leg.itsChi2NCl() > 0.f) ? v0leg.itsChi2NCl() : -299.f; - float tpcChi2NCl = (v0leg.hasTPC() && v0leg.tpcChi2NCl() > 0.f) ? v0leg.tpcChi2NCl() : -299.f; - float tpcSignal = v0leg.hasTPC() ? v0leg.tpcSignal() : 0.f; - float tpcNSigmaEl = v0leg.hasTPC() ? v0leg.tpcNSigmaEl() : -299.f; - float tpcNSigmaPi = v0leg.hasTPC() ? v0leg.tpcNSigmaPi() : -299.f; - v0leg_001( v0leg.collisionId(), v0leg.trackId(), @@ -71,25 +64,24 @@ struct pcmConverter1 { v0leg.px(), v0leg.py(), v0leg.pz(), - static_cast(v0leg.dcaXY() * 1e+2), - static_cast(v0leg.dcaZ() * 1e+2), + v0leg.dcaXY(), + v0leg.dcaZ(), v0leg.tpcNClsFindable(), v0leg.tpcNClsFindableMinusFound(), v0leg.tpcNClsFindableMinusCrossedRows(), v0leg.tpcNClsShared(), - static_cast(tpcChi2NCl * 1e+2), + v0leg.tpcChi2NCl(), v0leg.tpcInnerParam(), - static_cast(tpcSignal * 1e+2), - static_cast(tpcNSigmaEl * 1e+2), - static_cast(tpcNSigmaPi * 1e+2), + v0leg.tpcSignal(), + v0leg.tpcNSigmaEl(), + v0leg.tpcNSigmaPi(), v0leg.itsClusterSizes(), - static_cast(itsChi2NCl * 1e+2), + v0leg.itsChi2NCl(), v0leg.detectorMap(), - static_cast(0), - static_cast(v0leg.x() * 1e+2), - static_cast(v0leg.y() * 1e+2), - static_cast(v0leg.z() * 1e+2), - v0leg.tgl()); + 0.f, + v0leg.x(), + v0leg.y(), + v0leg.z()); } // end of v0leg loop } // end of process }; diff --git a/PWGEM/PhotonMeson/Tasks/dalitzEEQC.cxx b/PWGEM/PhotonMeson/Tasks/dalitzEEQC.cxx index 552d5b711d4..376d4ca043a 100644 --- a/PWGEM/PhotonMeson/Tasks/dalitzEEQC.cxx +++ b/PWGEM/PhotonMeson/Tasks/dalitzEEQC.cxx @@ -213,7 +213,6 @@ struct DalitzEEQC { fRegistry.add("Track/hChi2TOF", "chi2 of TOF", kTH1F, {{100, 0, 10}}, false); fRegistry.add("Track/hTOFbeta", "TOF beta;p_{pv} (GeV/c);#beta", kTH2F, {{1000, 0, 10}, {240, 0, 1.2}}, false); fRegistry.add("Track/hTOFNsigmaEl", "TOF n sigma el;p_{pv} (GeV/c);n #sigma_{e}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/hTOFNsigmaPi", "TOF n sigma pi;p_{pv} (GeV/c);n #sigma_{#pi}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); } void DefineEMEventCut() @@ -325,7 +324,6 @@ struct DalitzEEQC { fRegistry.fill(HIST("Track/hTPCNsigmaEl"), track.tpcInnerParam(), track.tpcNSigmaEl()); fRegistry.fill(HIST("Track/hTPCNsigmaPi"), track.tpcInnerParam(), track.tpcNSigmaPi()); fRegistry.fill(HIST("Track/hTOFNsigmaEl"), track.p(), track.tofNSigmaEl()); - fRegistry.fill(HIST("Track/hTOFNsigmaPi"), track.p(), track.tofNSigmaPi()); fRegistry.fill(HIST("Track/hTOFbeta"), track.p(), track.beta()); fRegistry.fill(HIST("Track/hMeanClusterSizeITS"), track.p(), track.meanClusterSizeITS() * std::cos(std::atan(track.tgl()))); } diff --git a/PWGEM/PhotonMeson/Tasks/dalitzEEQCMC.cxx b/PWGEM/PhotonMeson/Tasks/dalitzEEQCMC.cxx index adc556bf78d..3b84310b761 100644 --- a/PWGEM/PhotonMeson/Tasks/dalitzEEQCMC.cxx +++ b/PWGEM/PhotonMeson/Tasks/dalitzEEQCMC.cxx @@ -187,7 +187,6 @@ struct DalitzEEQCMC { fRegistry.add("Track/primary/hChi2TOF", "chi2 of TOF", kTH1F, {{100, 0, 10}}, false); fRegistry.add("Track/primary/hTOFbeta", "TOF beta;p_{pv} (GeV/c);#beta", kTH2F, {{1000, 0, 10}, {240, 0, 1.2}}, false); fRegistry.add("Track/primary/hTOFNsigmaEl", "TOF n sigma el;p_{pv} (GeV/c);n #sigma_{e}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/primary/hTOFNsigmaPi", "TOF n sigma pi;p_{pv} (GeV/c);n #sigma_{#pi}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); fRegistry.add("Track/primary/hPtGen_DeltaPtOverPtGen", "electron p_{T} resolution;p_{T}^{gen} (GeV/c);(p_{T}^{rec} - p_{T}^{gen})/p_{T}^{gen}", kTH2F, {{1000, 0, 10}, {200, -1.0f, 1.0f}}, true); fRegistry.add("Track/primary/hPtGen_DeltaEta", "electron #eta resolution;p_{T}^{gen} (GeV/c);#eta^{rec} - #eta^{gen}", kTH2F, {{1000, 0, 10}, {100, -0.5f, 0.5f}}, true); fRegistry.add("Track/primary/hPtGen_DeltaPhi", "electron #varphi resolution;p_{T}^{gen} (GeV/c);#varphi^{rec} - #varphi^{gen} (rad.)", kTH2F, {{1000, 0, 10}, {100, -0.5f, 0.5f}}, true); @@ -480,7 +479,6 @@ struct DalitzEEQCMC { fRegistry.fill(HIST("Track/") + HIST(track_types[tracktype]) + HIST("hTPCNsigmaEl"), track.tpcInnerParam(), track.tpcNSigmaEl()); fRegistry.fill(HIST("Track/") + HIST(track_types[tracktype]) + HIST("hTPCNsigmaPi"), track.tpcInnerParam(), track.tpcNSigmaPi()); fRegistry.fill(HIST("Track/") + HIST(track_types[tracktype]) + HIST("hTOFNsigmaEl"), track.p(), track.tofNSigmaEl()); - fRegistry.fill(HIST("Track/") + HIST(track_types[tracktype]) + HIST("hTOFNsigmaPi"), track.p(), track.tofNSigmaPi()); fRegistry.fill(HIST("Track/") + HIST(track_types[tracktype]) + HIST("hTOFbeta"), track.p(), track.beta()); fRegistry.fill(HIST("Track/") + HIST(track_types[tracktype]) + HIST("hPtGen_DeltaPtOverPtGen"), mctrack.pt(), (track.pt() - mctrack.pt()) / mctrack.pt()); fRegistry.fill(HIST("Track/") + HIST(track_types[tracktype]) + HIST("hPtGen_DeltaEta"), mctrack.pt(), track.eta() - mctrack.eta()); From afe613cd92835886e37ce2ec87546303b9dce5dd Mon Sep 17 00:00:00 2001 From: Marvin Hemmer <53471402+mhemmer-cern@users.noreply.github.com> Date: Tue, 5 Aug 2025 07:17:19 +0200 Subject: [PATCH 229/345] =?UTF-8?q?[PWGJE,EMCAL-670]=20Core/emcalCrossTalE?= =?UTF-8?q?mulation:=20fix=20cell=20ID=20outside=20li=E2=80=A6=20(#12419)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PWGJE/Core/emcalCrossTalkEmulation.cxx | 2 +- PWGJE/Core/emcalCrossTalkEmulation.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/PWGJE/Core/emcalCrossTalkEmulation.cxx b/PWGJE/Core/emcalCrossTalkEmulation.cxx index 9fe9b679461..32b08cd13dc 100644 --- a/PWGJE/Core/emcalCrossTalkEmulation.cxx +++ b/PWGJE/Core/emcalCrossTalkEmulation.cxx @@ -527,7 +527,7 @@ void EMCCrossTalk::addInducedEnergiesToNewCells() } // Avoid cells out of SM - if (ietai < 0 || ietai >= emcal::EMCAL_COLS || iphii < 0 || iphii >= emcal::EMCAL_ROWS) { + if (ietai < 0 || ietai >= NColumns[iSM] || iphii < 0 || iphii >= NRows[iSM]) { continue; } diff --git a/PWGJE/Core/emcalCrossTalkEmulation.h b/PWGJE/Core/emcalCrossTalkEmulation.h index 7d83b95d19e..fb84ec7c1ad 100644 --- a/PWGJE/Core/emcalCrossTalkEmulation.h +++ b/PWGJE/Core/emcalCrossTalkEmulation.h @@ -127,6 +127,9 @@ static constexpr int FirstDCal23SM = 12; // index of the first 2/3 DCal SM static constexpr int LastDCal23SM = 17; // index of the last 2/3 DCal SM static constexpr float MinCellEnergy = 0.01f; // Minimum energy a new cell needs to be added +static constexpr int NColumns[NSM] = {48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 32, 32, 32, 32, 32, 32, 48, 48}; +static constexpr int NRows[NSM] = {24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 8, 8, 24, 24, 24, 24, 24, 24, 8, 8}; + // these labels are for later once labeledArrays work on hyperloop. Currently they sadly only allow fixed size not variable size. // static const std::vector labelsSM{"SM0/all", "SM1", "SM2", "SM3", "SM4", "SM5", "SM6", "SM7", "SM8", "SM9", "SM10", "SM11", "SM12", "SM13", "SM14", "SM15", "SM16", "SM17", "SM18", "SM19"}; // static const std::vector labelsCells = {"Up&Down", "Up&Down x Left|Right", "Left|Right", "2Up&Down + 2Up&Down xLeft|Right"}; From a85c610bb45d1b7475386c6f15be0360980f01e0 Mon Sep 17 00:00:00 2001 From: Shirajum Monira <38348689+Eloviyo@users.noreply.github.com> Date: Tue, 5 Aug 2025 08:10:43 +0200 Subject: [PATCH 230/345] [PWGCF] FemtoUniverse cascade task -- fixed cascadeQAHistos relocation problem & added QA plots (#12429) Co-authored-by: Shirajum Monira --- ...toUniversePairTaskTrackCascadeExtended.cxx | 41 ++++++++++++++----- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx index 570acd6f7be..6d6e22c5bb2 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx @@ -193,18 +193,20 @@ struct femtoUniversePairTaskTrackCascadeExtended { } template - bool isParticleTPC(const T& part, int id) + bool isParticleTPC(const T& part, int id, float* partSigma = 0) { const float tpcNSigmas[3] = {unPackInTable(part.tpcNSigmaStorePr()), unPackInTable(part.tpcNSigmaStorePi()), unPackInTable(part.tpcNSigmaStoreKa())}; - + if (partSigma) + *partSigma = tpcNSigmas[id]; return isNSigmaTPC(tpcNSigmas[id]); } template - bool isParticleTOF(const T& part, int id) + bool isParticleTOF(const T& part, int id, float* partSigma = 0) { const float tofNSigmas[3] = {unPackInTable(part.tofNSigmaStorePr()), unPackInTable(part.tofNSigmaStorePi()), unPackInTable(part.tofNSigmaStoreKa())}; - + if (partSigma) + *partSigma = tofNSigmas[id]; return isNSigmaTOF(part.p(), tofNSigmas[id], part.tempFitVar()); } @@ -251,12 +253,20 @@ struct femtoUniversePairTaskTrackCascadeExtended { rXiQA.add("hInvMpTmult", "hInvMpTmult", kTH3F, {{ptAxis}, {aXiMassAxis}, {multAxis}}); eventHisto.init(&qaRegistry); + /// nSigma debug histograms for the selected particle species only i.e. not sigmas of all particles mixed together qaRegistry.add("Tracks_pos/nSigmaTPC", "; #it{p} (GeV/#it{c}); n#sigma_{TPC}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); qaRegistry.add("Tracks_pos/nSigmaTOF", "; #it{p} (GeV/#it{c}); n#sigma_{TOF}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); qaRegistry.add("Tracks_neg/nSigmaTPC", "; #it{p} (GeV/#it{c}); n#sigma_{TPC}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); qaRegistry.add("Tracks_neg/nSigmaTOF", "; #it{p} (GeV/#it{c}); n#sigma_{TOF}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); qaRegistry.add("MixingQA/hMECollisionBins", ";bin;Entries", kTH1F, {{120, -0.5, 119.5}}); + qaRegistry.add("V0Child_pos/nSigmaTPC", "; #it{p} (GeV/#it{c}); n#sigma_{TPC}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); + qaRegistry.add("V0Child_neg/nSigmaTPC", "; #it{p} (GeV/#it{c}); n#sigma_{TPC}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); + qaRegistry.add("hBachelor/nSigmaTPC", "; #it{p} (GeV/#it{c}); n#sigma_{TPC}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); + qaRegistry.add("V0Child_pos/nSigmaTOF", "; #it{p} (GeV/#it{c}); n#sigma_{TOF}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); + qaRegistry.add("V0Child_neg/nSigmaTOF", "; #it{p} (GeV/#it{c}); n#sigma_{TOF}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); + qaRegistry.add("hBachelor/nSigmaTOF", "; #it{p} (GeV/#it{c}); n#sigma_{TOF}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); + // MC gen registryMCgen.add("plus/MCgenCasc", "MC gen cascades;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); registryMCgen.add("minus/MCgenCasc", "MC gen cascades;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); @@ -375,15 +385,28 @@ struct femtoUniversePairTaskTrackCascadeExtended { const auto& bachelor = parts.iteratorAt(part.globalIndex() - 1 - parts.begin().globalIndex()); /// Child particles must pass this condition to be selected if constexpr (std::experimental::is_detected::value) { - if (!isParticleTPC(posChild, CascChildTable[confCascType1][0]) || !isParticleTPC(negChild, CascChildTable[confCascType1][1]) || !isParticleTPC(bachelor, CascChildTable[confCascType1][2])) + float posChildTPC, negChildTPC, bachelorTPC, posChildTOF, negChildTOF, bachelorTOF; + if (!isParticleTPC(posChild, CascChildTable[confCascType1][0], &posChildTPC) || !isParticleTPC(negChild, CascChildTable[confCascType1][1], &negChildTPC) || !isParticleTPC(bachelor, CascChildTable[confCascType1][2], &bachelorTPC)) continue; - if ((!confCheckTOFBachelorOnly && (!isParticleTOF(posChild, CascChildTable[confCascType1][0]) || !isParticleTOF(negChild, CascChildTable[confCascType1][1]))) || !isParticleTOF(bachelor, CascChildTable[confCascType1][2])) + if ((!confCheckTOFBachelorOnly && (!isParticleTOF(posChild, CascChildTable[confCascType1][0], &posChildTOF) || !isParticleTOF(negChild, CascChildTable[confCascType1][1], &negChildTOF))) || !isParticleTOF(bachelor, CascChildTable[confCascType1][2], &bachelorTOF)) continue; posChildHistos.fillQA(posChild); negChildHistos.fillQA(negChild); bachHistos.fillQABase(bachelor, HIST("hBachelor")); + + qaRegistry.fill(HIST("V0Child_pos/nSigmaTPC"), posChild.p(), posChildTPC); + qaRegistry.fill(HIST("V0Child_neg/nSigmaTPC"), negChild.p(), negChildTPC); + qaRegistry.fill(HIST("hBachelor/nSigmaTPC"), bachelor.p(), bachelorTPC); + if (!confCheckTOFBachelorOnly) { + qaRegistry.fill(HIST("V0Child_pos/nSigmaTOF"), posChild.p(), posChildTOF); + qaRegistry.fill(HIST("V0Child_neg/nSigmaTOF"), negChild.p(), negChildTOF); + } + qaRegistry.fill(HIST("hBachelor/nSigmaTOF"), bachelor.p(), bachelorTOF); + + cascQAHistos.fillQA(part); + } else { if ((posChild.pidCut() & (1u << CascChildTable[confCascType1][0])) == 0 || (negChild.pidCut() & (1u << CascChildTable[confCascType1][1])) == 0 || (bachelor.pidCut() & (1u << CascChildTable[confCascType1][2])) == 0) continue; @@ -391,14 +414,10 @@ struct femtoUniversePairTaskTrackCascadeExtended { if ((!confCheckTOFBachelorOnly && ((posChild.pidCut() & (8u << CascChildTable[confCascType1][0])) == 0 || (negChild.pidCut() & (8u << CascChildTable[confCascType1][1])) == 0)) || (bachelor.pidCut() & (8u << CascChildTable[confCascType1][2])) == 0) continue; - if constexpr (std::experimental::is_detected::value) - cascQAHistos.fillQA(part); - else - cascQAHistos.fillQA(part); - posChildHistos.fillQA(posChild); negChildHistos.fillQA(negChild); bachHistos.fillQABase(bachelor, HIST("hBachelor")); + cascQAHistos.fillQA(part); } rXiQA.fill(HIST("hInvMpTmult"), part.pt(), part.mLambda(), multCol); } From bd7b544c4dd7dfe01a1a22da06074c1bf051e25c Mon Sep 17 00:00:00 2001 From: jaelpark Date: Tue, 5 Aug 2025 11:13:49 +0200 Subject: [PATCH 231/345] [PWGCF] Use THnF efficiency, allow efficiency correction without NUA (#12428) --- PWGCF/JCorran/Tasks/jflucWeightsLoader.cxx | 38 ++++++++++------------ 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/PWGCF/JCorran/Tasks/jflucWeightsLoader.cxx b/PWGCF/JCorran/Tasks/jflucWeightsLoader.cxx index 244035fd310..7d15d9b2a6d 100644 --- a/PWGCF/JCorran/Tasks/jflucWeightsLoader.cxx +++ b/PWGCF/JCorran/Tasks/jflucWeightsLoader.cxx @@ -12,27 +12,27 @@ /// \since May 2024 // o2-linter: disable='doc/file' -#include -#include -#include -#include - -#include "Framework/AnalysisTask.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/RunningWorkflowInfo.h" -#include "Framework/HistogramRegistry.h" +#include "PWGCF/DataModel/CorrelationsDerived.h" +#include "PWGCF/JCorran/DataModel/JCatalyst.h" -#include "Common/DataModel/EventSelection.h" #include "Common/Core/TrackSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" #include "Common/DataModel/Centrality.h" -#include "ReconstructionDataFormats/V0.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/TrackSelectionTables.h" #include "CCDB/BasicCCDBManager.h" - -#include "PWGCF/JCorran/DataModel/JCatalyst.h" -#include "PWGCF/DataModel/CorrelationsDerived.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/RunningWorkflowInfo.h" #include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/V0.h" + +#include +#include + +#include +#include using namespace o2; using namespace o2::framework; @@ -50,7 +50,7 @@ struct JflucWeightsLoader { THnF* ph = 0; TFile* pf = 0; - THnD* pheff = 0; + THnF* pheff = 0; TFile* pfeff = 0; int runNumber = 0; int timestamp = 0; @@ -108,7 +108,6 @@ struct JflucWeightsLoader { useCCDB = false; } else { LOGF(info, "Didn't find \"local://\" or \"ccdb\" for non-uniform acceptance corrections."); - return; } if (cfgPathEffWeights.value.substr(0, 8) == "local://") { @@ -118,16 +117,13 @@ struct JflucWeightsLoader { delete pfeff; pfeff = 0; LOGF(fatal, "Efficiency correction weights file not found: %s", cfgPathEffWeights.value.substr(8).c_str()); - } - // - if (!(pheff = pfeff->Get("ccdb_object"))) { + } else if (!(pheff = pfeff->Get("ccdb_object"))) { LOGF(warning, "Efficiency correction histogram not found."); } else { LOGF(info, "Loaded efficiency correction histogram locally."); } } else { LOGF(info, "Didn't find \"local://\" or \"ccdb\" for efficiency corrections."); - return; } } From 3c063b57e2193e8daf57564b43c1935491b409e1 Mon Sep 17 00:00:00 2001 From: abmodak <67369858+abmodak@users.noreply.github.com> Date: Tue, 5 Aug 2025 11:17:14 +0200 Subject: [PATCH 232/345] [PWGCF] Fix bug in FV0 eta calculation (#12423) --- .../Tasks/longrangeCorrelation.cxx | 168 ++++++++---------- 1 file changed, 78 insertions(+), 90 deletions(-) diff --git a/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx b/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx index c2cf7781b53..f9839d9e502 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/longrangeCorrelation.cxx @@ -75,6 +75,9 @@ static constexpr TrackSelectionFlags::flagtype TrackSelectionDca = static constexpr TrackSelectionFlags::flagtype TrackSelectionDcaxyOnly = TrackSelectionFlags::kDCAxy; +static constexpr std::string_view kCorrType[] = {"Ft0aGlobal/", "Ft0cGlobal/", "Fv0Global/", "MftGlobal/", "Fv0Mft/"}; +static constexpr std::string_view kEvntType[] = {"SE/", "ME/"}; + AxisSpec axisEvent{10, 0.5, 9.5, "#Event", "EventAxis"}; struct LongrangeCorrelation { @@ -128,6 +131,9 @@ struct LongrangeCorrelation { Preslice perColGlobal = aod::track::collisionId; Preslice perColMft = aod::fwdtrack::collisionId; + o2::ft0::Geometry ft0Det; + o2::fv0::Geometry* fv0Det; + OutputObj sameFt0aGlobal{Form("sameEventFt0aGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; OutputObj mixedFt0aGlobal{Form("mixedEventFt0aGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; OutputObj sameFt0cGlobal{Form("sameEventFt0cGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; @@ -139,6 +145,23 @@ struct LongrangeCorrelation { OutputObj sameFv0Mft{Form("sameEventFv0Mft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; OutputObj mixedFv0Mft{Form("mixedEventFv0Mft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult))}; + template + void addHistos() + { + histos.add(Form("%s%shMult", kCorrType[corrType].data(), kEvntType[evntType].data()), "", kTH1D, {axisMultiplicity}); + histos.add(Form("%s%sTrig_etavsphi", kCorrType[corrType].data(), kEvntType[evntType].data()), "", kTH2D, {axisPhi, axisEtaTrig}); + histos.add(Form("%s%sTrig_eta", kCorrType[corrType].data(), kEvntType[evntType].data()), "", kTH1D, {axisEtaTrig}); + histos.add(Form("%s%sTrig_phi", kCorrType[corrType].data(), kEvntType[evntType].data()), "", kTH1D, {axisPhi}); + histos.add(Form("%s%sTrig_pt", kCorrType[corrType].data(), kEvntType[evntType].data()), "", kTH1D, {axisPtTrigger}); + histos.add(Form("%s%shMult_used", kCorrType[corrType].data(), kEvntType[evntType].data()), "", kTH1F, {axisMultiplicity}); + histos.add(Form("%s%sTrig_hist", kCorrType[corrType].data(), kEvntType[evntType].data()), "", kTHnSparseF, {axisSample, axisVtxZ, axisPtTrigger}); + histos.add(Form("%s%sAssoc_amp", kCorrType[corrType].data(), kEvntType[evntType].data()), "", kTH2D, {channelFt0aAxis, amplitudeFt0a}); + histos.add(Form("%s%sAssoc_eta", kCorrType[corrType].data(), kEvntType[evntType].data()), "", kTH1D, {axisEtaAssoc}); + histos.add(Form("%s%sAssoc_phi", kCorrType[corrType].data(), kEvntType[evntType].data()), "", kTH1D, {axisPhi}); + histos.add(Form("%s%sAssoc_etavsphi", kCorrType[corrType].data(), kEvntType[evntType].data()), "", kTH2D, {axisPhi, axisEtaAssoc}); + histos.add(Form("%s%sdeltaEta_deltaPhi", kCorrType[corrType].data(), kEvntType[evntType].data()), "", kTH2D, {axisDeltaPhi, axisDeltaEta}); + } + void init(InitContext const&) { ccdb->setURL(cfgCcdbParam.cfgURL); @@ -151,8 +174,8 @@ struct LongrangeCorrelation { offsetFV0 = ccdb->getForTimeStamp>("FV0/Calib/Align", cfgCcdbParam.noLaterThan.value); LOGF(info, "Offset for FT0A: x = %.3f y = %.3f z = %.3f\n", (*offsetFT0)[0].getX(), (*offsetFT0)[0].getY(), (*offsetFT0)[0].getZ()); LOGF(info, "Offset for FT0C: x = %.3f y = %.3f z = %.3f\n", (*offsetFT0)[1].getX(), (*offsetFT0)[1].getY(), (*offsetFT0)[1].getZ()); - LOGF(info, "Offset for FV0-left: x = %.3f y = %.3f\n", (*offsetFV0)[0].getX(), (*offsetFV0)[0].getY()); - LOGF(info, "Offset for FV0-right: x = %.3f y = %.3f\n", (*offsetFV0)[1].getX(), (*offsetFV0)[1].getY()); + LOGF(info, "Offset for FV0-left: x = %.3f y = %.3f z = %.3f\n", (*offsetFV0)[0].getX(), (*offsetFV0)[0].getY(), (*offsetFV0)[0].getZ()); + LOGF(info, "Offset for FV0-right: x = %.3f y = %.3f z = %.3f\n", (*offsetFV0)[1].getX(), (*offsetFV0)[1].getY(), (*offsetFV0)[1].getZ()); std::vector corrAxis = {{axisSample, "Sample"}, {axisVtxZ, "z-vtx (cm)"}, @@ -166,6 +189,8 @@ struct LongrangeCorrelation { std::vector userAxis; + fv0Det = o2::fv0::Geometry::instance(o2::fv0::Geometry::eUninitialized); + if (doprocessEventStat) { histos.add("QA/EventHist", "events", kTH1F, {axisEvent}, false); histos.add("QA/VtxZHist", "v_{z} (cm)", kTH1F, {axisVtxZ}, false); @@ -178,59 +203,37 @@ struct LongrangeCorrelation { x->SetBinLabel(4, "|vz|<10"); } - histos.add("Ft0aGlobal/SE/hMult", "", kTH1D, {axisMultiplicity}); - histos.add("Ft0aGlobal/SE/Trig_etavsphi", "", kTH2D, {axisPhi, axisEtaTrig}); - histos.add("Ft0aGlobal/SE/Trig_eta", "", kTH1D, {axisEtaTrig}); - histos.add("Ft0aGlobal/SE/Trig_phi", "", kTH1D, {axisPhi}); - histos.add("Ft0aGlobal/SE/Trig_pt", "", kTH1D, {axisPtTrigger}); - histos.add("Ft0aGlobal/SE/hMult_used", "", kTH1F, {axisMultiplicity}); - histos.add("Ft0aGlobal/SE/Trig_hist", "", kTHnSparseF, {axisSample, axisVtxZ, axisPtTrigger}); - histos.add("Ft0aGlobal/SE/Assoc_amp", "", kTH2D, {channelFt0aAxis, amplitudeFt0a}); - histos.add("Ft0aGlobal/SE/Assoc_eta", "", kTH1D, {axisEtaAssoc}); - histos.add("Ft0aGlobal/SE/Assoc_phi", "", kTH1D, {axisPhi}); - histos.add("Ft0aGlobal/SE/Assoc_etavsphi", "", kTH2D, {axisPhi, axisEtaAssoc}); - histos.add("Ft0aGlobal/SE/deltaEta_deltaPhi", "", kTH2D, {axisDeltaPhi, axisDeltaEta}); - - histos.add("Ft0aGlobal/ME/hMult", "", kTH1D, {axisMultiplicity}); - histos.add("Ft0aGlobal/ME/Trig_etavsphi", "", kTH2D, {axisPhi, axisEtaTrig}); - histos.add("Ft0aGlobal/ME/Trig_eta", "", kTH1D, {axisEtaTrig}); - histos.add("Ft0aGlobal/ME/Trig_phi", "", kTH1D, {axisPhi}); - histos.add("Ft0aGlobal/ME/Trig_pt", "", kTH1D, {axisPtTrigger}); - histos.add("Ft0aGlobal/ME/Assoc_amp", "", kTH2D, {channelFt0aAxis, amplitudeFt0a}); - histos.add("Ft0aGlobal/ME/Assoc_eta", "", kTH1D, {axisEtaAssoc}); - histos.add("Ft0aGlobal/ME/Assoc_phi", "", kTH1D, {axisPhi}); - histos.add("Ft0aGlobal/ME/Assoc_etavsphi", "", kTH2D, {axisPhi, axisEtaAssoc}); - histos.add("Ft0aGlobal/ME/deltaEta_deltaPhi", "", kTH2D, {axisDeltaPhi, axisDeltaEta}); - if (doprocessFt0aGlobalSE || doprocessFt0aGlobalME) { + addHistos<0, 0>(); + addHistos<0, 1>(); sameFt0aGlobal.setObject(new CorrelationContainer(Form("sameEventFt0aGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("sameEventFt0aGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); mixedFt0aGlobal.setObject(new CorrelationContainer(Form("mixedEventFt0aGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("mixedEventFt0aGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); } if (doprocessFt0cGlobalSE || doprocessFt0cGlobalME) { - histos.addClone("Ft0aGlobal/SE/", "Ft0cGlobal/SE/"); - histos.addClone("Ft0aGlobal/ME/", "Ft0cGlobal/ME/"); + addHistos<1, 0>(); + addHistos<1, 1>(); sameFt0cGlobal.setObject(new CorrelationContainer(Form("sameEventFt0cGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("sameEventFt0cGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); mixedFt0cGlobal.setObject(new CorrelationContainer(Form("mixedEventFt0cGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("mixedEventFt0cGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); } - if (doprocessMftGlobalSE || doprocessMftGlobalME) { - histos.addClone("Ft0aGlobal/SE/", "MftGlobal/SE/"); - histos.addClone("Ft0aGlobal/ME/", "MftGlobal/ME/"); - sameMftGlobal.setObject(new CorrelationContainer(Form("sameEventMftGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("sameEventMftGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); - mixedMftGlobal.setObject(new CorrelationContainer(Form("mixedEventMftGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("mixedEventMftGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); - } - if (doprocessFv0GlobalSE || doprocessFv0GlobalME) { - histos.addClone("Ft0aGlobal/SE/", "Fv0Global/SE/"); - histos.addClone("Ft0aGlobal/ME/", "Fv0Global/ME/"); + addHistos<2, 0>(); + addHistos<2, 1>(); sameFv0Global.setObject(new CorrelationContainer(Form("sameEventFv0Global_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("sameEventFv0Global_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); mixedFv0Global.setObject(new CorrelationContainer(Form("mixedEventFv0Global_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("mixedEventFv0Global_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); } + if (doprocessMftGlobalSE || doprocessMftGlobalME) { + addHistos<3, 0>(); + addHistos<3, 1>(); + sameMftGlobal.setObject(new CorrelationContainer(Form("sameEventMftGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("sameEventMftGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); + mixedMftGlobal.setObject(new CorrelationContainer(Form("mixedEventMftGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("mixedEventMftGlobal_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); + } + if (doprocessFv0MftSE || doprocessFv0MftME) { - histos.addClone("Ft0aGlobal/SE/", "Fv0Mft/SE/"); - histos.addClone("Ft0aGlobal/ME/", "Fv0Mft/ME/"); + addHistos<4, 0>(); + addHistos<4, 1>(); sameFv0Mft.setObject(new CorrelationContainer(Form("sameEventFv0Mft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("sameEventFv0Mft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); mixedFv0Mft.setObject(new CorrelationContainer(Form("mixedEventFv0Mft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), Form("mixedEventFv0Mft_%i_%i", static_cast(cfgMinMult), static_cast(cfgMaxMult)), corrAxis, effAxis, userAxis)); } @@ -249,17 +252,15 @@ struct LongrangeCorrelation { Filter fMftTrackColID = (aod::fwdtrack::bestCollisionId >= 0); Filter fMftTrackDca = (nabs(aod::fwdtrack::bestDCAXY) < cfigMftDcaxy); - double getPhiFT0(int chno, double offsetX, double offsetY) + double getPhiFT0(int chno, int i) { - o2::ft0::Geometry ft0Det; ft0Det.calculateChannelCenter(); auto chPos = ft0Det.getChannelCenter(chno); - return RecoDecay::phi(chPos.X() + offsetX, chPos.Y() + offsetY); + return RecoDecay::phi(chPos.X() + (*offsetFT0)[i].getX(), chPos.Y() + (*offsetFT0)[i].getY()); } double getPhiFV0(int chno) { - o2::fv0::Geometry fv0Det; int cellsInLeft[] = {0, 1, 2, 3, 8, 9, 10, 11, 16, 17, 18, 19, 24, 25, 26, 27, 32, 40, 33, 41, 34, 42, 35, 43}; bool isChnoInLeft = std::find(std::begin(cellsInLeft), std::end(cellsInLeft), chno) != std::end(cellsInLeft); float offsetX, offsetY; @@ -271,18 +272,17 @@ struct LongrangeCorrelation { offsetY = (*offsetFV0)[1].getY(); } - auto chPos = fv0Det.getReadoutCenter(chno); + auto chPos = fv0Det->getReadoutCenter(chno); return RecoDecay::phi(chPos.x + offsetX, chPos.y + offsetY); } - double getEtaFT0(int chno, double offsetX, double offsetY, double offsetZ) + double getEtaFT0(int chno, int i) { - o2::ft0::Geometry ft0Det; ft0Det.calculateChannelCenter(); auto chPos = ft0Det.getChannelCenter(chno); - auto x = chPos.X() + offsetX; - auto y = chPos.Y() + offsetY; - auto z = chPos.Z() + offsetZ; + auto x = chPos.X() + (*offsetFT0)[i].getX(); + auto y = chPos.Y() + (*offsetFT0)[i].getY(); + auto z = chPos.Z() + (*offsetFT0)[i].getZ(); auto r = std::sqrt(x * x + y * y); auto theta = std::atan2(r, z); return -std::log(std::tan(0.5 * theta)); @@ -290,7 +290,6 @@ struct LongrangeCorrelation { double getEtaFV0(int chno) { - o2::fv0::Geometry fv0Det; int cellsInLeft[] = {0, 1, 2, 3, 8, 9, 10, 11, 16, 17, 18, 19, 24, 25, 26, 27, 32, 40, 33, 41, 34, 42, 35, 43}; bool isChnoInLeft = std::find(std::begin(cellsInLeft), std::end(cellsInLeft), chno) != std::end(cellsInLeft); float offsetX, offsetY, offsetZ; @@ -304,7 +303,7 @@ struct LongrangeCorrelation { offsetZ = (*offsetFV0)[1].getZ(); } - auto chPos = fv0Det.getReadoutCenter(chno); + auto chPos = fv0Det->getReadoutCenter(chno); auto x = chPos.x + offsetX; auto y = chPos.y + offsetY; auto z = chPos.z + offsetZ; @@ -337,29 +336,24 @@ struct LongrangeCorrelation { return true; } - template - void fillYield(TTracks tracks, bool mixing) + template + void fillYield(TTracks tracks) { - static constexpr std::string_view SubDirSE[] = {"Ft0aGlobal/SE/", "Ft0cGlobal/SE/", "Fv0Global/SE/", - "MftGlobal/SE/", "Fv0Mft/SE/"}; - static constexpr std::string_view SubDirME[] = {"Ft0aGlobal/ME/", "Ft0cGlobal/ME/", "Fv0Global/ME/", - "MftGlobal/ME/", "Fv0Mft/ME/"}; - - if (mixing) { - histos.fill(HIST(SubDirME[mode]) + HIST("hMult"), tracks.size()); - for (auto const& triggerTrack : tracks) { - histos.fill(HIST(SubDirME[mode]) + HIST("Trig_etavsphi"), triggerTrack.phi(), triggerTrack.eta()); - histos.fill(HIST(SubDirME[mode]) + HIST("Trig_eta"), triggerTrack.eta()); - histos.fill(HIST(SubDirME[mode]) + HIST("Trig_phi"), triggerTrack.phi()); - histos.fill(HIST(SubDirME[mode]) + HIST("Trig_pt"), triggerTrack.pt()); + if (evntType == 1) { + histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("hMult"), tracks.size()); + for (auto const& iTrk : tracks) { + histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("Trig_etavsphi"), iTrk.phi(), iTrk.eta()); + histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("Trig_eta"), iTrk.eta()); + histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("Trig_phi"), iTrk.phi()); + histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("Trig_pt"), iTrk.pt()); } } else { - histos.fill(HIST(SubDirSE[mode]) + HIST("hMult"), tracks.size()); - for (auto const& triggerTrack : tracks) { - histos.fill(HIST(SubDirSE[mode]) + HIST("Trig_etavsphi"), triggerTrack.phi(), triggerTrack.eta()); - histos.fill(HIST(SubDirSE[mode]) + HIST("Trig_eta"), triggerTrack.eta()); - histos.fill(HIST(SubDirSE[mode]) + HIST("Trig_phi"), triggerTrack.phi()); - histos.fill(HIST(SubDirSE[mode]) + HIST("Trig_pt"), triggerTrack.pt()); + histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("hMult"), tracks.size()); + for (auto const& iTrk : tracks) { + histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("Trig_etavsphi"), iTrk.phi(), iTrk.eta()); + histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("Trig_eta"), iTrk.eta()); + histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("Trig_phi"), iTrk.phi()); + histos.fill(HIST(kCorrType[corrType]) + HIST(kEvntType[evntType]) + HIST("Trig_pt"), iTrk.pt()); } } } @@ -374,9 +368,6 @@ struct LongrangeCorrelation { if (!mixing) histos.fill(HIST("Ft0aGlobal/SE/Trig_hist"), fSampleIndex, vz, triggerTrack.pt()); - auto offsetX = (*offsetFT0)[0].getX(); - auto offsetY = (*offsetFT0)[0].getY(); - auto offsetZ = (*offsetFT0)[0].getZ(); for (std::size_t iCh = 0; iCh < ft0.channelA().size(); iCh++) { auto chanelid = ft0.channelA()[iCh]; float ampl = ft0.amplitudeA()[iCh]; @@ -387,8 +378,8 @@ struct LongrangeCorrelation { else histos.fill(HIST("Ft0aGlobal/SE/Assoc_amp"), chanelid, ampl); - auto phi = getPhiFT0(chanelid, offsetX, offsetY); - auto eta = getEtaFT0(chanelid, offsetX, offsetY, offsetZ); + auto phi = getPhiFT0(chanelid, 0); + auto eta = getEtaFT0(chanelid, 0); if (mixing) { histos.fill(HIST("Ft0aGlobal/ME/Assoc_eta"), eta); @@ -420,9 +411,6 @@ struct LongrangeCorrelation { if (!mixing) histos.fill(HIST("Ft0cGlobal/SE/Trig_hist"), fSampleIndex, vz, triggerTrack.pt()); - auto offsetX = (*offsetFT0)[1].getX(); - auto offsetY = (*offsetFT0)[1].getY(); - auto offsetZ = (*offsetFT0)[1].getZ(); for (std::size_t iCh = 0; iCh < ft0.channelC().size(); iCh++) { auto chanelid = ft0.channelC()[iCh]; float ampl = ft0.amplitudeC()[iCh]; @@ -433,8 +421,8 @@ struct LongrangeCorrelation { else histos.fill(HIST("Ft0cGlobal/SE/Assoc_amp"), chanelid, ampl); - auto phi = getPhiFT0(chanelid, offsetX, offsetY); - auto eta = getEtaFT0(chanelid, offsetX, offsetY, offsetZ); + auto phi = getPhiFT0(chanelid, 1); + auto eta = getEtaFT0(chanelid, 1); if (mixing) { histos.fill(HIST("Ft0cGlobal/ME/Assoc_eta"), eta); @@ -609,7 +597,7 @@ struct LongrangeCorrelation { return; } if (col.has_foundFT0()) { - fillYield<0>(tracks, false); + fillYield<0, 0>(tracks); const auto& ft0 = col.foundFT0(); if (tracks.size() < cfgMinMult || tracks.size() >= cfgMaxMult) { return; @@ -624,7 +612,7 @@ struct LongrangeCorrelation { return; } if (col.has_foundFT0()) { - fillYield<1>(tracks, false); + fillYield<1, 0>(tracks); const auto& ft0 = col.foundFT0(); if (tracks.size() < cfgMinMult || tracks.size() >= cfgMaxMult) { return; @@ -638,7 +626,7 @@ struct LongrangeCorrelation { if (!isEventSelected(col)) { return; } - fillYield<3>(tracks, false); + fillYield<3, 0>(tracks); if (tracks.size() < cfgMinMult || tracks.size() >= cfgMaxMult) { return; } @@ -651,7 +639,7 @@ struct LongrangeCorrelation { return; } if (col.has_foundFV0()) { - fillYield<2>(tracks, false); + fillYield<2, 0>(tracks); const auto& fv0 = col.foundFV0(); if (tracks.size() < cfgMinMult || tracks.size() >= cfgMaxMult) { return; @@ -666,7 +654,7 @@ struct LongrangeCorrelation { return; } if (col.has_foundFV0()) { - fillYield<4>(mfttracks, false); + fillYield<4, 0>(mfttracks); const auto& fv0 = col.foundFV0(); if (tracks.size() < cfgMinMult || tracks.size() >= cfgMaxMult) { return; @@ -693,7 +681,7 @@ struct LongrangeCorrelation { } if (col1.has_foundFT0() && col2.has_foundFT0()) { auto slicedTriggerTracks = tracks.sliceBy(perColGlobal, col1.globalIndex()); - fillYield<0>(slicedTriggerTracks, true); + fillYield<0, 1>(slicedTriggerTracks); const auto& ft0 = col2.foundFT0(); if (slicedTriggerTracks.size() < cfgMinMult || slicedTriggerTracks.size() >= cfgMaxMult) { continue; @@ -721,7 +709,7 @@ struct LongrangeCorrelation { } if (col1.has_foundFT0() && col2.has_foundFT0()) { auto slicedTriggerTracks = tracks.sliceBy(perColGlobal, col1.globalIndex()); - fillYield<1>(slicedTriggerTracks, true); + fillYield<1, 1>(slicedTriggerTracks); const auto& ft0 = col2.foundFT0(); if (slicedTriggerTracks.size() < cfgMinMult || slicedTriggerTracks.size() >= cfgMaxMult) { continue; @@ -771,7 +759,7 @@ struct LongrangeCorrelation { } if (col1.has_foundFV0() && col2.has_foundFV0()) { auto slicedTriggerTracks = tracks.sliceBy(perColGlobal, col1.globalIndex()); - fillYield<2>(slicedTriggerTracks, true); + fillYield<2, 1>(slicedTriggerTracks); const auto& fv0 = col2.foundFV0(); if (slicedTriggerTracks.size() < cfgMinMult || slicedTriggerTracks.size() >= cfgMaxMult) { continue; @@ -800,7 +788,7 @@ struct LongrangeCorrelation { if (col1.has_foundFV0() && col2.has_foundFV0()) { auto slicedGlobalTracks = tracks.sliceBy(perColGlobal, col1.globalIndex()); auto slicedTriggerMftTracks = mfttracks.sliceBy(perColMft, col1.globalIndex()); - fillYield<4>(slicedTriggerMftTracks, true); + fillYield<4, 1>(slicedTriggerMftTracks); const auto& fv0 = col2.foundFV0(); if (slicedGlobalTracks.size() < cfgMinMult || slicedGlobalTracks.size() >= cfgMaxMult) { continue; From 9e105e2150ec3e9eab5227dad8ddd7a5d12917d7 Mon Sep 17 00:00:00 2001 From: dajones2 <140733426+dajones2@users.noreply.github.com> Date: Tue, 5 Aug 2025 10:31:10 +0100 Subject: [PATCH 233/345] [PWGJE] Fixing histogram names (#12421) --- PWGJE/Tasks/jetHadronRecoil.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/PWGJE/Tasks/jetHadronRecoil.cxx b/PWGJE/Tasks/jetHadronRecoil.cxx index 73128a513d8..731e8a7c78b 100644 --- a/PWGJE/Tasks/jetHadronRecoil.cxx +++ b/PWGJE/Tasks/jetHadronRecoil.cxx @@ -129,8 +129,7 @@ struct JetHadronRecoil { {"hEtaTrack", "Track #eta;#eta;entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}}, {"hPhiTrack", "Track #phi;#phi;entries", {HistType::kTH1F, {{100, 0.0, o2::constants::math::TwoPI}}}}, {"hTrack3D", "3D tracks histogram;p_{T};#eta;#phi", {HistType::kTH3F, {{200, 0, 200}, {100, -1.0, 1.0}, {100, 0.0, o2::constants::math::TwoPI}}}}, - {"hTrackPtHard", "Tracks vs pThard;#frac{p_{T}}{#hat{p}};p_{T}", {HistType::kTH2F, {{20, 0, 5}, {200, 0, 200}}}}, - {"hPartPtHard", "Part vs pThard;#frac{p_{T}}{#hat{p}};p_{T}", {HistType::kTH2F, {{20, 0, 5}, {200, 0, 200}}}}, + {"hPtTrackPtHard", "Tracks vs pThard;#frac{p_{T}}{#hat{p}};p_{T}", {HistType::kTH2F, {{20, 0, 5}, {200, 0, 200}}}}, {"hConstituents3D", "3D constituents histogram;p_{T};#eta;#phi", {HistType::kTH3F, {{200, 0, 200}, {100, -1.0, 1.0}, {100, 0.0, o2::constants::math::TwoPI}}}}, {"hReferencePtDPhi", "jet p_{T} vs DPhi;#Delta#phi;p_{T,jet}", {HistType::kTH2F, {{100, 0, o2::constants::math::TwoPI}, {500, -100, 400}}}}, {"hReferencePtDPhiShifts", "rho shifts;#Delta#phi;p_{T,jet};shifts", {HistType::kTH3F, {{100, 0, o2::constants::math::TwoPI}, {500, -100, 400}, {20, 0.0, 2.0}}}}, From 3aeb12fb6f41828335b1008dd94fd2a5efa8f004 Mon Sep 17 00:00:00 2001 From: Zhengqing Wang Date: Tue, 5 Aug 2025 17:31:55 +0800 Subject: [PATCH 234/345] [PWGLF] add ITSChi2 information for daughter tracks (#12432) --- PWGLF/DataModel/LFHypernucleiTables.h | 8 +++++--- PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx | 12 ++++++++---- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/PWGLF/DataModel/LFHypernucleiTables.h b/PWGLF/DataModel/LFHypernucleiTables.h index f144daccba6..f0f37bf4d86 100644 --- a/PWGLF/DataModel/LFHypernucleiTables.h +++ b/PWGLF/DataModel/LFHypernucleiTables.h @@ -60,6 +60,8 @@ DECLARE_SOA_COLUMN(NTPCpidClusPi, nTPCpidClusPi, uint8_t); // Number DECLARE_SOA_COLUMN(TPCsignalHe, tpcSignalHe, uint16_t); // TPC signal of the He daughter DECLARE_SOA_COLUMN(TPCsignalPi, tpcSignalPi, uint16_t); // TPC signal of the Pi daughter DECLARE_SOA_COLUMN(TPCChi2He, tpcChi2He, float); // TPC chi2 of the He daughter +DECLARE_SOA_COLUMN(ITSChi2He, itsChi2He, float); // ITS chi2 of the He daughter +DECLARE_SOA_COLUMN(ITSChi2Pi, itsChi2Pi, float); // ITS chi2 of the Pi daughter DECLARE_SOA_COLUMN(TrackedClSize, trackedClSize, int); // int: zero for non-tracked candidates DECLARE_SOA_COLUMN(Flags, flags, uint8_t); // Flags for PID in tracking (bits [0, 3] for negative daughter, [4,7] for positive daughter) DECLARE_SOA_COLUMN(TPCmomHe, tpcMomHe, float); // TPC momentum of the He daughter @@ -94,7 +96,7 @@ DECLARE_SOA_TABLE(DataHypCands, "AOD", "HYPCANDS", hyperrec::XDecVtx, hyperrec::YDecVtx, hyperrec::ZDecVtx, hyperrec::DcaV0Daug, hyperrec::DcaHe, hyperrec::DcaPi, hyperrec::NSigmaHe, hyperrec::NTPCclusHe, hyperrec::NTPCclusPi, hyperrec::NTPCpidClusHe, hyperrec::NTPCpidClusPi, - hyperrec::TPCmomHe, hyperrec::TPCmomPi, hyperrec::TPCsignalHe, hyperrec::TPCsignalPi, hyperrec::TPCChi2He, + hyperrec::TPCmomHe, hyperrec::TPCmomPi, hyperrec::TPCsignalHe, hyperrec::TPCsignalPi, hyperrec::TPCChi2He, hyperrec::ITSChi2He, hyperrec::ITSChi2Pi, hyperrec::TOFMass, hyperrec::ITSclusterSizesHe, hyperrec::ITSclusterSizesPi, hyperrec::Flags, hyperrec::TrackedClSize); @@ -113,7 +115,7 @@ DECLARE_SOA_TABLE(DataHypCandsFlow, "AOD", "HYPCANDSFLOW", hyperrec::XDecVtx, hyperrec::YDecVtx, hyperrec::ZDecVtx, hyperrec::DcaV0Daug, hyperrec::DcaHe, hyperrec::DcaPi, hyperrec::NSigmaHe, hyperrec::NTPCclusHe, hyperrec::NTPCclusPi, hyperrec::NTPCpidClusHe, hyperrec::NTPCpidClusPi, - hyperrec::TPCmomHe, hyperrec::TPCmomPi, hyperrec::TPCsignalHe, hyperrec::TPCsignalPi, hyperrec::TPCChi2He, + hyperrec::TPCmomHe, hyperrec::TPCmomPi, hyperrec::TPCsignalHe, hyperrec::TPCsignalPi, hyperrec::TPCChi2He, hyperrec::ITSChi2He, hyperrec::ITSChi2Pi, hyperrec::TOFMass, hyperrec::ITSclusterSizesHe, hyperrec::ITSclusterSizesPi, hyperrec::Flags, hyperrec::TrackedClSize); @@ -129,7 +131,7 @@ DECLARE_SOA_TABLE(MCHypCands, "AOD", "MCHYPCANDS", hyperrec::XDecVtx, hyperrec::YDecVtx, hyperrec::ZDecVtx, hyperrec::DcaV0Daug, hyperrec::DcaHe, hyperrec::DcaPi, hyperrec::NSigmaHe, hyperrec::NTPCclusHe, hyperrec::NTPCclusPi, hyperrec::NTPCpidClusHe, hyperrec::NTPCpidClusPi, - hyperrec::TPCmomHe, hyperrec::TPCmomPi, hyperrec::TPCsignalHe, hyperrec::TPCsignalPi, hyperrec::TPCChi2He, + hyperrec::TPCmomHe, hyperrec::TPCmomPi, hyperrec::TPCsignalHe, hyperrec::TPCsignalPi, hyperrec::TPCChi2He, hyperrec::ITSChi2He, hyperrec::ITSChi2Pi, hyperrec::TOFMass, hyperrec::ITSclusterSizesHe, hyperrec::ITSclusterSizesPi, hyperrec::Flags, hyperrec::TrackedClSize, diff --git a/PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx b/PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx index ebf9943064d..e93828980b1 100644 --- a/PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx +++ b/PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx @@ -110,6 +110,8 @@ struct hyperCandidate { uint16_t tpcSignalHe3 = 0u; uint16_t tpcSignalPi = 0u; float tpcChi2He3 = 0.f; + float itsChi2He3 = 0.f; + float itsChi2Pi = 0.f; float massTOFHe3 = 0.f; uint8_t nTPCClustersHe3 = 0u; uint8_t nTPCClustersPi = 0u; @@ -413,6 +415,8 @@ struct hyperRecoTask { hypCand.nTPCpidClusPi = (int16_t)piTrack.tpcNClsFindable() - piTrack.tpcNClsFindableMinusPID(); hypCand.tpcSignalPi = piTrack.tpcSignal(); hypCand.tpcChi2He3 = heTrack.tpcChi2NCl(); + hypCand.itsChi2He3 = heTrack.itsChi2NCl(); + hypCand.itsChi2Pi = piTrack.itsChi2NCl(); hypCand.clusterSizeITSPi = piTrack.itsClusterSizes(); bool heliumPID = heTrack.pidForTracking() == o2::track::PID::Helium3 || heTrack.pidForTracking() == o2::track::PID::Alpha; hypCand.momHe3TPC = (heliumPID && cfgCompensatePIDinTracking) ? heTrack.tpcInnerParam() / 2 : heTrack.tpcInnerParam(); @@ -687,7 +691,7 @@ struct hyperRecoTask { hypCand.dcaV0dau, hypCand.he3DCAXY, hypCand.piDCAXY, hypCand.nSigmaHe3, hypCand.nTPCClustersHe3, hypCand.nTPCClustersPi, hypCand.nTPCpidClusHe3, hypCand.nTPCpidClusPi, - hypCand.momHe3TPC, hypCand.momPiTPC, hypCand.tpcSignalHe3, hypCand.tpcSignalPi, hypCand.tpcChi2He3, + hypCand.momHe3TPC, hypCand.momPiTPC, hypCand.tpcSignalHe3, hypCand.tpcSignalPi, hypCand.tpcChi2He3, hypCand.itsChi2He3, hypCand.itsChi2Pi, hypCand.massTOFHe3, hypCand.clusterSizeITSHe3, hypCand.clusterSizeITSPi, hypCand.flags, trackedHypClSize); } @@ -722,7 +726,7 @@ struct hyperRecoTask { hypCand.dcaV0dau, hypCand.he3DCAXY, hypCand.piDCAXY, hypCand.nSigmaHe3, hypCand.nTPCClustersHe3, hypCand.nTPCClustersPi, hypCand.nTPCpidClusHe3, hypCand.nTPCpidClusPi, - hypCand.momHe3TPC, hypCand.momPiTPC, hypCand.tpcSignalHe3, hypCand.tpcSignalPi, hypCand.tpcChi2He3, + hypCand.momHe3TPC, hypCand.momPiTPC, hypCand.tpcSignalHe3, hypCand.tpcSignalPi, hypCand.tpcChi2He3, hypCand.itsChi2He3, hypCand.itsChi2Pi, hypCand.massTOFHe3, hypCand.clusterSizeITSHe3, hypCand.clusterSizeITSPi, hypCand.flags, trackedHypClSize); } @@ -757,7 +761,7 @@ struct hyperRecoTask { hypCand.decVtx[0], hypCand.decVtx[1], hypCand.decVtx[2], hypCand.dcaV0dau, hypCand.he3DCAXY, hypCand.piDCAXY, hypCand.nSigmaHe3, hypCand.nTPCClustersHe3, hypCand.nTPCClustersPi, hypCand.nTPCpidClusHe3, hypCand.nTPCpidClusPi, - hypCand.momHe3TPC, hypCand.momPiTPC, hypCand.tpcSignalHe3, hypCand.tpcSignalPi, hypCand.tpcChi2He3, + hypCand.momHe3TPC, hypCand.momPiTPC, hypCand.tpcSignalHe3, hypCand.tpcSignalPi, hypCand.tpcChi2He3, hypCand.itsChi2He3, hypCand.itsChi2Pi, hypCand.massTOFHe3, hypCand.clusterSizeITSHe3, hypCand.clusterSizeITSPi, hypCand.flags, trackedHypClSize, chargeFactor * hypCand.genPt(), hypCand.genPhi(), hypCand.genEta(), hypCand.genPtHe3(), @@ -831,7 +835,7 @@ struct hyperRecoTask { -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 0, 0, + -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, false, chargeFactor * hypCand.genPt(), hypCand.genPhi(), hypCand.genEta(), hypCand.genPtHe3(), hypCand.gDecVtx[0], hypCand.gDecVtx[1], hypCand.gDecVtx[2], From ecaaf1cd3772738000035995810bdc9b94fe474f Mon Sep 17 00:00:00 2001 From: yuanzhe <90246048+wang-yuanzhe@users.noreply.github.com> Date: Tue, 5 Aug 2025 13:17:04 +0200 Subject: [PATCH 235/345] [PWGLF] Fix signal check for hypertriton kink and add column for datamodel (#12422) --- PWGLF/DataModel/LFHyperNucleiKinkTables.h | 4 +- .../Nuspex/hyperkinkRecoTask.cxx | 60 ++++++++++++++----- 2 files changed, 47 insertions(+), 17 deletions(-) diff --git a/PWGLF/DataModel/LFHyperNucleiKinkTables.h b/PWGLF/DataModel/LFHyperNucleiKinkTables.h index 3f064f5225f..a661e4dec32 100644 --- a/PWGLF/DataModel/LFHyperNucleiKinkTables.h +++ b/PWGLF/DataModel/LFHyperNucleiKinkTables.h @@ -95,7 +95,9 @@ DECLARE_SOA_TABLE(HypKinkCand, "AOD", "HYPKINKCANDS", hyperkink::PxDaugSV, hyperkink::PyDaugSV, hyperkink::PzDaugSV, hyperkink::DcaMothPv, hyperkink::DcaDaugPv, hyperkink::DcaKinkTopo, hyperkink::ItsChi2Moth, hyperkink::ItsClusterSizesMoth, hyperkink::ItsClusterSizesDaug, - hyperkink::NSigmaTPCDaug, hyperkink::NSigmaITSDaug, hyperkink::NSigmaTOFDaug); + hyperkink::NSigmaTPCDaug, hyperkink::NSigmaITSDaug, hyperkink::NSigmaTOFDaug, + hyperkink::PxMothPV, hyperkink::PyMothPV, hyperkink::PzMothPV, + hyperkink::UpdatePxMothPV, hyperkink::UpdatePyMothPV, hyperkink::UpdatePzMothPV); DECLARE_SOA_TABLE(MCHypKinkCand, "AOD", "MCHYPKINKCANDS", o2::soa::Index<>, diff --git a/PWGLF/TableProducer/Nuspex/hyperkinkRecoTask.cxx b/PWGLF/TableProducer/Nuspex/hyperkinkRecoTask.cxx index 7d2d3fe82e6..9614d561dc0 100644 --- a/PWGLF/TableProducer/Nuspex/hyperkinkRecoTask.cxx +++ b/PWGLF/TableProducer/Nuspex/hyperkinkRecoTask.cxx @@ -458,19 +458,22 @@ struct HyperkinkRecoTask { const AxisSpec vertexZAxis{100, -15., 15., "vtx_{Z} [cm]"}; const AxisSpec ptAxis{50, -10, 10, "#it{p}_{T} (GeV/#it{c})"}; const AxisSpec nSigmaAxis{120, -6.f, 6.f, "n#sigma"}; - const AxisSpec massAxis{100, 3.85, 4.25, "m (GeV/#it{c}^{2})"}; + AxisSpec massAxis(100, 2.94, 3.2, "m (GeV/#it{c}^{2})"); + if (hypoMoth == kHyperhelium4sigma) { + massAxis = AxisSpec{100, 3.85, 4.25, "m (GeV/#it{c}^{2})"}; + } const AxisSpec diffPtAxis{200, -10.f, 10.f, "#Delta #it{p}_{T} (GeV/#it{c})"}; const AxisSpec diffPzAxis{200, -10.f, 10.f, "#Delta #it{p}_{z} (GeV/#it{c})"}; const AxisSpec radiusAxis{40, 0.f, 40.f, "R (cm)"}; registry.add("hEventCounter", "hEventCounter", HistType::kTH1F, {{2, 0, 2}}); registry.add("hVertexZCollision", "hVertexZCollision", HistType::kTH1F, {vertexZAxis}); - registry.add("hCandidateCounter", "hCandidateCounter", HistType::kTH1F, {{3, 0, 3}}); + registry.add("hCandidateCounter", "hCandidateCounter", HistType::kTH1F, {{4, 0, 4}}); if (doprocessMC == true) { itsResponse.setMCDefaultParameters(); - registry.add("hTrueCandidateCounter", "hTrueCandidateCounter", HistType::kTH1F, {{3, 0, 3}}); + registry.add("hTrueCandidateCounter", "hTrueCandidateCounter", HistType::kTH1F, {{4, 0, 4}}); registry.add("hDiffSVx", ";#Delta x (cm);", HistType::kTH1F, {{200, -10, 10}}); registry.add("hDiffSVy", ";#Delta y (cm);", HistType::kTH1F, {{200, -10, 10}}); registry.add("hDiffSVz", ";#Delta z (cm);", HistType::kTH1F, {{200, -10, 10}}); @@ -663,8 +666,6 @@ struct HyperkinkRecoTask { auto bc = collision.bc_as(); initCCDB(bc); auto motherTrack = kinkCand.trackMoth_as(); - HypKinkCandidate hypkinkCand; - fillCandidate(hypkinkCand, collision, kinkCand, motherTrack, daugTrack); float nSigmaTOF = -999.f; if (daugTrack.hasTOF() && daugTrack.has_collision()) { auto originalDaugCol = daugTrack.collision_as(); @@ -673,6 +674,10 @@ struct HyperkinkRecoTask { if (std::abs(nSigmaTOF) > cutTOFNSigmaDaug) { continue; } + + registry.fill(HIST("hCandidateCounter"), 2); + HypKinkCandidate hypkinkCand; + fillCandidate(hypkinkCand, collision, kinkCand, motherTrack, daugTrack); hypkinkCand.nSigmaTOFDaug = nSigmaTOF; o2::dataformats::VertexBase primaryVtx = {{collision.posX(), collision.posY(), collision.posZ()}, {collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()}}; @@ -698,7 +703,9 @@ struct HyperkinkRecoTask { hypkinkCand.momDaugSV[0], hypkinkCand.momDaugSV[1], hypkinkCand.momDaugSV[2], hypkinkCand.dcaXYMothPv, hypkinkCand.dcaXYDaugPv, hypkinkCand.dcaKinkTopo, hypkinkCand.chi2ITSMoth, hypkinkCand.itsClusterSizeMoth, hypkinkCand.itsClusterSizeDaug, - hypkinkCand.nSigmaTPCDaug, hypkinkCand.nSigmaITSDaug, hypkinkCand.nSigmaTOFDaug); + hypkinkCand.nSigmaTPCDaug, hypkinkCand.nSigmaITSDaug, hypkinkCand.nSigmaTOFDaug, + hypkinkCand.momMothPV[0], hypkinkCand.momMothPV[1], hypkinkCand.momMothPV[2], + hypkinkCand.updateMomMothPV[0], hypkinkCand.updateMomMothPV[1], hypkinkCand.updateMomMothPV[2]); } } PROCESS_SWITCH(HyperkinkRecoTask, processData, "process data", true); @@ -773,8 +780,6 @@ struct HyperkinkRecoTask { auto bc = collision.bc_as(); initCCDB(bc); - HypKinkCandidate hypkinkCand; - fillCandidate(hypkinkCand, collision, kinkCand, motherTrack, daugTrack); float nSigmaTOF = -999.f; if (daugTrack.hasTOF() && daugTrack.has_collision()) { auto originalDaugCol = daugTrack.collision_as(); @@ -791,6 +796,13 @@ struct HyperkinkRecoTask { if (std::abs(nSigmaTOF) > cutTOFNSigmaDaug) { continue; } + registry.fill(HIST("hCandidateCounter"), 3); + if (isKinkSignal) { + registry.fill(HIST("hTrueCandidateCounter"), 3); + } + + HypKinkCandidate hypkinkCand; + fillCandidate(hypkinkCand, collision, kinkCand, motherTrack, daugTrack); hypkinkCand.nSigmaTOFDaug = nSigmaTOF; std::array posDecVtx = {kinkCand.xDecVtx() + collision.posX(), kinkCand.yDecVtx() + collision.posY(), kinkCand.zDecVtx() + collision.posZ()}; @@ -826,8 +838,6 @@ struct HyperkinkRecoTask { hypkinkCand.isSignal = true; hypkinkCand.isSignalReco = true; - hypkinkCand.isCollReco = true; - hypkinkCand.isSurvEvSelection = true; fillCandidateMCInfo(hypkinkCand, mcMothTrack, mcDaugTrack, mcNeutTrack); mcPartIndices.push_back(mcMothTrack.globalIndex()); @@ -838,6 +848,9 @@ struct HyperkinkRecoTask { registry.fill(HIST("hDCAZMothToRecSV"), dcaInfo[1]); } + hypkinkCand.isCollReco = true; + hypkinkCand.isSurvEvSelection = true; + outputMCTable( mBz > 0 ? 1 : -1, hypkinkCand.posPV[0], hypkinkCand.posPV[1], hypkinkCand.posPV[2], @@ -862,10 +875,22 @@ struct HyperkinkRecoTask { // fill kink signals which are not reconstructed for (auto const& mcparticle : particlesMC) { - auto dChannel = He4SDecay::getDecayChannel(mcparticle, dauIDList); - if (dChannel != He4SDecay::k2body) { + bool isKinkSignal = false; + if (hypoMoth == kHypertriton) { + auto dChannel = H3LDecay::getDecayChannel(mcparticle, dauIDList); + if (dChannel == H3LDecay::k2bodyNeutral) { + isKinkSignal = true; + } + } else if (hypoMoth == kHyperhelium4sigma) { + auto dChannel = He4SDecay::getDecayChannel(mcparticle, dauIDList); + if (dChannel == He4SDecay::k2body) { + isKinkSignal = true; + } + } + if (!isKinkSignal) { continue; } + if (std::find(mcPartIndices.begin(), mcPartIndices.end(), mcparticle.globalIndex()) != mcPartIndices.end()) { continue; } @@ -928,6 +953,7 @@ struct HyperkinkQa { o2::aod::ITSResponse itsResponse; + int charge = 1; float massMoth = 999.f; float massChargedDaug = 999.f; float massNeutralDaug = 999.f; @@ -941,6 +967,7 @@ struct HyperkinkQa { itsResponse.setMCDefaultParameters(); if (hypoMoth == kHypertriton) { + charge = 1; massMoth = o2::constants::physics::MassHyperTriton; massChargedDaug = o2::constants::physics::MassTriton; massNeutralDaug = o2::constants::physics::MassPi0; @@ -949,6 +976,7 @@ struct HyperkinkQa { pdgDaug[kDaugNeutral] = PDG_t::kPi0; pidTypeDaug = o2::track::PID::Triton; } else if (hypoMoth == kHyperhelium4sigma) { + charge = 2; massMoth = o2::constants::physics::MassHyperHelium4Sigma; massChargedDaug = o2::constants::physics::MassAlpha; massNeutralDaug = o2::constants::physics::MassPi0; @@ -986,8 +1014,8 @@ struct HyperkinkQa { hGenHyperMothCounter->GetXaxis()->SetBinLabel(3, "AntiMatter"); hGenHyperMothCounter->GetXaxis()->SetBinLabel(4, "t + #pi^{0}"); hGenHyperMothCounter->GetXaxis()->SetBinLabel(5, "#bar{t} + #pi^{0}"); - hGenHyperMothCounter->GetXaxis()->SetBinLabel(6, "he3 + #pi^{-}"); - hGenHyperMothCounter->GetXaxis()->SetBinLabel(7, "#bar{he3} + #pi^{+}"); + hGenHyperMothCounter->GetXaxis()->SetBinLabel(6, "{}^{3}He + #pi^{-}"); + hGenHyperMothCounter->GetXaxis()->SetBinLabel(7, "{}^{3}#bar{He} + #pi^{+}"); hGenHyperMothCounter->GetXaxis()->SetBinLabel(8, "d + p + #pi^{-}"); hGenHyperMothCounter->GetXaxis()->SetBinLabel(9, "#bar{d} + #bar{p} + #pi^{+}"); hGenHyperMothCounter->GetXaxis()->SetBinLabel(10, "Others"); @@ -1043,7 +1071,7 @@ struct HyperkinkQa { hist->GetXaxis()->SetBinLabel(6, "TPC Ncls"); hist->GetXaxis()->SetBinLabel(7, "TPC n#sigma"); hist->GetXaxis()->SetBinLabel(8, "ITS hits"); - hist->GetXaxis()->SetBinLabel(9, "has TOF)"); + hist->GetXaxis()->SetBinLabel(9, "has TOF"); } recoQAHist.add("hMothIsPVContributer", "", HistType::kTH1F, {{2, 0.f, 2.f}}); @@ -1279,7 +1307,7 @@ struct HyperkinkQa { auto motherTrack = tracks.rawIteratorAt(mcPartIndices[mcparticle.globalIndex()]); bool isGoodMother = motherTrackCheck(motherTrack, hMothCounter); float svR = RecoDecay::sqrtSumOfSquares(svPos[0], svPos[1]); - float diffpt = mcparticle.pt() - 2 * motherTrack.pt(); + float diffpt = mcparticle.pt() - charge * motherTrack.pt(); recoQAHist.fill(HIST("h2TrueMotherDiffPtVsTrueSVR"), svR, diffpt); recoQAHist.fill(HIST("h2TrueMotherDiffEtaVsTrueSVR"), svR, mcparticle.eta() - motherTrack.eta()); From 9e18130b6ab39f881c9e226916a30f7e5d4c96f0 Mon Sep 17 00:00:00 2001 From: a-m-andrushko <96832230+a-m-andrushko@users.noreply.github.com> Date: Tue, 5 Aug 2025 13:50:20 +0200 Subject: [PATCH 236/345] [PWGCF] FemtoUniverse -- Add a new task for helicity angle analysis. (#12396) --- .../Core/FemtoUniverseContainer.h | 2 +- PWGCF/FemtoUniverse/Tasks/CMakeLists.txt | 5 + .../femtoUniversePairTaskTrackV0Helicity.cxx | 952 ++++++++++++++++++ 3 files changed, 958 insertions(+), 1 deletion(-) create mode 100644 PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackV0Helicity.cxx diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniverseContainer.h b/PWGCF/FemtoUniverse/Core/FemtoUniverseContainer.h index fb2af0a02df..8b5df274887 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniverseContainer.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniverseContainer.h @@ -57,7 +57,7 @@ enum EventType { same, ///< Pair from same event /// \brief Container for all histogramming related to the correlation function. The two /// particles of the pair are passed here, and the correlation function and QA histograms /// are filled according to the specified observable -/// \tparam eventType Type of the event (same/mixed) +/// \tparam eventType Type of the event (same or mixed) /// \tparam obs Observable to be computed (k*/Q_inv/...) template class FemtoUniverseContainer diff --git a/PWGCF/FemtoUniverse/Tasks/CMakeLists.txt b/PWGCF/FemtoUniverse/Tasks/CMakeLists.txt index cae7a17fc56..346188d08fd 100644 --- a/PWGCF/FemtoUniverse/Tasks/CMakeLists.txt +++ b/PWGCF/FemtoUniverse/Tasks/CMakeLists.txt @@ -34,6 +34,11 @@ o2physics_add_dpl_workflow(femtouniverse-pair-track-nucleus PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(femtouniverse-pair-track-v0-helicity + SOURCES femtoUniversePairTaskTrackV0Helicity.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(femtouniverse-pair-track-track-threedrelmom-mult-kt-extended SOURCES femtoUniversePairTaskTrackTrack3DMultKtExtended.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackV0Helicity.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackV0Helicity.cxx new file mode 100644 index 00000000000..46def7bba0e --- /dev/null +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackV0Helicity.cxx @@ -0,0 +1,952 @@ +// Copyright 2019-2022 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file femtoUniversePairTaskTrackV0Helicity.cxx +/// \brief Tasks that build pairs of track particles and v0s +/// \author Andi Mathis, TU München, andreas.mathis@ph.tum.de +/// \author Zuzanna Chochulska, WUT Warsaw & CTU Prague, zchochul@cern.ch +/// \author Shirajum Monira, WUT Warsaw, shirajum.monira.dokt@pw.edu.pl + +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseContainer.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseEventHisto.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseMath.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniversePairCleaner.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseParticleHisto.h" +#include "PWGCF/FemtoUniverse/Core/femtoUtils.h" +#include "PWGCF/FemtoUniverse/DataModel/FemtoDerived.h" + +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/O2DatabasePDGPlugin.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/StepTHn.h" +#include "Framework/runDataProcessing.h" + +#include +#include + +#include +#include +#include + +using namespace o2; +using namespace o2::soa; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::analysis::femto_universe; +using namespace o2::aod::pidutils; +using namespace o2::track; + +struct FemtoUniversePairTaskTrackV0Helicity { + + Service pdg; + Service pdgMC; + + SliceCache cache; + using FemtoFullParticles = soa::Join; + Preslice perCol = aod::femtouniverseparticle::fdCollisionId; + + using FemtoRecoParticles = soa::Join; + Preslice perColMC = aod::femtouniverseparticle::fdCollisionId; + + /// To apply narrow cut + Configurable confZVertexCut{"confZVertexCut", 10.f, "Event sel: Maximum z-Vertex (cm)"}; + Configurable confEta{"confEta", 0.8, "Eta cut for the global track"}; + + /// Particle 1 (track) + Configurable confTrkPDGCodePartOne{"confTrkPDGCodePartOne", 211, "Particle 1 (Track) - PDG code"}; + Configurable confTrackChoicePartOne{"confTrackChoicePartOne", 1, "0:Proton, 1:Pion, 2:Kaon"}; + ConfigurableAxis confTrkTempFitVarBins{"confTrkTempFitVarBins", {300, -0.15, 0.15}, "binning of the TempFitVar in the pT vs. TempFitVar plot"}; + ConfigurableAxis confTrkTempFitVarpTBins{"confTrkTempFitVarpTBins", {20, 0.5, 4.05}, "pT binning of the pT vs. TempFitVar plot"}; + Configurable confChargePart1{"confChargePart1", 0, "sign of particle 1"}; + Configurable confHPtPart1{"confHPtPart1", 4.0f, "higher limit for pt of particle 1"}; + Configurable confLPtPart1{"confLPtPart1", 0.3f, "lower limit for pt of particle 1"}; + Configurable confmom{"confmom", 0.5, "momentum threshold for particle identification using TOF"}; + Configurable confNsigmaTPCParticle{"confNsigmaTPCParticle", 3.0, "TPC Sigma for particle momentum < confmom"}; + Configurable confNsigmaCombinedParticle{"confNsigmaCombinedParticle", 3.0, "TPC and TOF Sigma (combined) for particle momentum > confmom"}; + + Filter collisionFilter = (nabs(aod::collision::posZ) < confZVertexCut); + using FilteredFDCollisions = soa::Filtered; + using FilteredFDCollision = FilteredFDCollisions::iterator; + + /// Partition for particle 1 + Partition partsOne = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && (aod::femtouniverseparticle::sign == confChargePart1) && (nabs(aod::femtouniverseparticle::eta) < confEta) && (aod::femtouniverseparticle::pt < confHPtPart1) && (aod::femtouniverseparticle::pt > confLPtPart1); + Partition partsOneMC = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kMCTruthTrack)) && (nabs(aod::femtouniverseparticle::eta) < confEta) && (aod::femtouniverseparticle::pt < confHPtPart1) && (aod::femtouniverseparticle::pt > confLPtPart1); + Partition partsOneMCReco = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && (aod::femtouniverseparticle::sign == confChargePart1) && (nabs(aod::femtouniverseparticle::eta) < confEta) && (aod::femtouniverseparticle::pt < confHPtPart1) && (aod::femtouniverseparticle::pt > confLPtPart1); + + /// Histogramming for particle 1 + FemtoUniverseParticleHisto trackHistoPartOnePos; + FemtoUniverseParticleHisto trackHistoPartOneNeg; + + /// Particle 2 (V0) + Configurable confV0PDGCodePartTwo{"confV0PDGCodePartTwo", 3122, "Particle 2 (V0) - PDG code"}; + ConfigurableAxis confV0TempFitVarBins{"confV0TempFitVarBins", {300, 0.95, 1.}, "V0: binning of the TempFitVar in the pT vs. TempFitVar plot"}; + ConfigurableAxis confV0TempFitVarpTBins{"confV0TempFitVarpTBins", {20, 0.5, 4.05}, "V0: pT binning of the pT vs. TempFitVar plot"}; + Configurable confV0Type1{"confV0Type1", 0, "select one of the V0s (lambda = 0, anti-lambda = 1, k0 = 2) for v0-v0 and Track-v0 combination"}; + Configurable confV0Type2{"confV0Type2", 0, "select one of the V0s (lambda = 0, anti-lambda = 1, k0 = 2) for v0-v0 combination"}; + Configurable confV0InvMassLowLimit{"confV0InvMassLowLimit", 1.10, "Lower limit of the V0 invariant mass"}; + Configurable confV0InvMassUpLimit{"confV0InvMassUpLimit", 1.13, "Upper limit of the V0 invariant mass"}; + ConfigurableAxis confChildTempFitVarBins{"confChildTempFitVarBins", {300, -0.15, 0.15}, "V0 child: binning of the TempFitVar in the pT vs. TempFitVar plot"}; + ConfigurableAxis confChildTempFitVarpTBins{"confChildTempFitVarpTBins", {20, 0.5, 4.05}, "V0 child: pT binning of the pT vs. TempFitVar plot"}; + Configurable confHPtPart2{"confHPtPart2", 4.0f, "higher limit for pt of particle 2"}; + Configurable confLPtPart2{"confLPtPart2", 0.3f, "lower limit for pt of particle 2"}; + Configurable confPDGCodeV0{"confPDGCodeV0", 3122, "V0 -- PDG code"}; + Configurable confPDGCodePosChild{"confPDGCodePosChild", 2212, "Positive Child -- PDG code"}; + Configurable confPDGCodeNegChild{"confPDGCodeNegChild", 211, "Negative Child -- PDG code"}; + + /// Partition for particle 2 + Partition partsTwo = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kV0)) && (aod::femtouniverseparticle::pt < confHPtPart2) && (aod::femtouniverseparticle::pt > confLPtPart2); + Partition partsTwoMC = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kMCTruthTrack)) && (aod::femtouniverseparticle::pt < confHPtPart2) && (aod::femtouniverseparticle::pt > confLPtPart2); + Partition partsTwoMCReco = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kV0)) && (aod::femtouniverseparticle::pt < confHPtPart2) && (aod::femtouniverseparticle::pt > confLPtPart2); + + /// Histogramming for particle 2 + FemtoUniverseParticleHisto trackHistoPartTwo; + FemtoUniverseParticleHisto posChildHistos; + FemtoUniverseParticleHisto negChildHistos; + + FemtoUniverseParticleHisto trackHistoV0Type1; + FemtoUniverseParticleHisto posChildV0Type1; + FemtoUniverseParticleHisto negChildV0Type1; + FemtoUniverseParticleHisto trackHistoV0Type2; + FemtoUniverseParticleHisto posChildV0Type2; + FemtoUniverseParticleHisto negChildV0Type2; + + /// Histogramming for Event + FemtoUniverseEventHisto eventHisto; + + /// Correlation part + // Configurable confTrackChoicePartTwo{"confTrackChoicePartTwo", 1, "0:Proton, 1:Pion, 2:Kaon"}; //not used + Configurable confIsMC{"confIsMC", false, "Enable additional Histograms in the case of a MonteCarlo Run"}; + Configurable confUse3D{"confUse3D", false, "Enable three dimensional histogramms (to be used only for analysis with high statistics): k* vs mT vs multiplicity"}; + Configurable confUseCent{"confUseCent", false, "Use centrality in place of multiplicity"}; + ConfigurableAxis confMultBins{"confMultBins", {VARIABLE_WIDTH, 0.0f, 20.0f, 40.0f, 60.0f, 80.0f, 100.0f, 200.0f, 99999.f}, "Mixing bins - multiplicity"}; + ConfigurableAxis confVtxBins{"confVtxBins", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"}; + Configurable confNEventsMix{"confNEventsMix", 5, "Number of events for mixing"}; + ConfigurableAxis confkstarBins{"confkstarBins", {1500, 0., 6.}, "binning kstar"}; + ConfigurableAxis confkTBins{"confkTBins", {150, 0., 9.}, "binning kT"}; + ConfigurableAxis confmTBins{"confmTBins", {225, 0., 7.5}, "binning mT"}; + Configurable confIsCPR{"confIsCPR", true, "Close Pair Rejection"}; + Configurable confCPRPlotPerRadii{"confCPRPlotPerRadii", false, "Plot CPR per radii"}; + Configurable confCPRdeltaPhiCutMax{"confCPRdeltaPhiCutMax", 0.0, "Delta Phi max cut for Close Pair Rejection"}; + Configurable confCPRdeltaPhiCutMin{"confCPRdeltaPhiCutMin", 0.0, "Delta Phi min cut for Close Pair Rejection"}; + Configurable confCPRdeltaEtaCutMax{"confCPRdeltaEtaCutMax", 0.0, "Delta Eta max cut for Close Pair Rejection"}; + Configurable confCPRdeltaEtaCutMin{"confCPRdeltaEtaCutMin", 0.0, "Delta Eta min cut for Close Pair Rejection"}; + Configurable confCPRChosenRadii{"confCPRChosenRadii", 0.80, "Delta Eta cut for Close Pair Rejection"}; + Configurable confPhiBins{"confPhiBins", 29, "Number of phi bins in deta dphi"}; + Configurable confEtaBins{"confEtaBins", 29, "Number of eta bins in deta dphi"}; + ConfigurableAxis confmTBins3D{"confmTBins3D", {VARIABLE_WIDTH, 1.02f, 1.14f, 1.20f, 1.26f, 1.38f, 1.56f, 1.86f, 4.50f}, "mT Binning for the 3Dimensional plot: k* vs multiplicity vs mT (set <> to true in order to use)"}; + ConfigurableAxis confMultBins3D{"confMultBins3D", {VARIABLE_WIDTH, 0.0f, 20.0f, 30.0f, 40.0f, 99999.0f}, "multiplicity Binning for the 3Dimensional plot: k* vs multiplicity vs mT (set <> to true in order to use)"}; + + // Efficiency + Configurable confLocalEfficiency{"confLocalEfficiency", "", "Local path to efficiency .root file"}; + + static constexpr unsigned int V0ChildTable[][2] = {{0, 1}, {1, 0}, {1, 1}}; // Table to select the V0 children + + FemtoUniverseContainer sameEventCont; + FemtoUniverseContainer mixedEventCont; + FemtoUniversePairCleaner pairCleaner; + FemtoUniversePairCleaner pairCleanerV0; + FemtoUniverseDetaDphiStar pairCloseRejection; + FemtoUniverseDetaDphiStar pairCloseRejectionV0; + + /// Histogram output + HistogramRegistry qaRegistry{"TrackQA", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry resultRegistry{"Correlations", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry registryMCtruth{"MCtruthHistos", {}, OutputObjHandlingPolicy::AnalysisObject, false, true}; + HistogramRegistry registryMCreco{"MCrecoHistos", {}, OutputObjHandlingPolicy::AnalysisObject, false, true}; + HistogramRegistry mixQaRegistry{"mixQaRegistry", {}, OutputObjHandlingPolicy::AnalysisObject}; + + HistogramRegistry thetaRegistry{"ThetaQA", {}, OutputObjHandlingPolicy::AnalysisObject}; + + std::unique_ptr plocalEffFile; + std::unique_ptr plocalEffp1; + std::unique_ptr plocalEffp2; + + bool isNSigmaCombined(float mom, float nsigmaTPCParticle, float nsigmaTOFParticle) + { + if (mom <= confmom) { + return (std::abs(nsigmaTPCParticle) < confNsigmaTPCParticle); + } else { + return (std::hypot(nsigmaTOFParticle, nsigmaTPCParticle) < confNsigmaCombinedParticle); + } + } + + bool invMLambda(float invMassLambda, float invMassAntiLambda) + { + if ((invMassLambda < confV0InvMassLowLimit || invMassLambda > confV0InvMassUpLimit) && (invMassAntiLambda < confV0InvMassLowLimit || invMassAntiLambda > confV0InvMassUpLimit)) { + return false; + } + return true; + } + + bool isNSigmaTPC(float nsigmaTPCParticle) + { + if (std::abs(nsigmaTPCParticle) < confNsigmaTPCParticle) { + return true; + } else { + return false; + } + } + + template + bool isParticleCombined(const T& part, int id) + { + const float tpcNSigmas[3] = {unPackInTable(part.tpcNSigmaStorePr()), unPackInTable(part.tpcNSigmaStorePi()), unPackInTable(part.tpcNSigmaStoreKa())}; + // const float tofNSigmas[3] = {part.tofNSigmaPr(), part.tofNSigmaPi(), part.tofNSigmaKa()}; + const float tofNSigmas[3] = {unPackInTable(part.tofNSigmaStorePr()), unPackInTable(part.tofNSigmaStorePi()), unPackInTable(part.tofNSigmaStoreKa())}; + + return isNSigmaCombined(part.p(), tpcNSigmas[id], tofNSigmas[id]); + } + + template + bool isParticleTPC(const T& part, int id) + { + const float tpcNSigmas[3] = {unPackInTable(part.tpcNSigmaStorePr()), unPackInTable(part.tpcNSigmaStorePi()), unPackInTable(part.tpcNSigmaStoreKa())}; + + return isNSigmaTPC(tpcNSigmas[id]); + } + + void init(InitContext&) + { + eventHisto.init(&qaRegistry); + qaRegistry.add("Tracks_pos/nSigmaTPC", "; #it{p} (GeV/#it{c}); n#sigma_{TPC}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); + qaRegistry.add("Tracks_pos/nSigmaTOF", "; #it{p} (GeV/#it{c}); n#sigma_{TOF}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); + qaRegistry.add("Tracks_neg/nSigmaTPC", "; #it{p} (GeV/#it{c}); n#sigma_{TPC}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); + qaRegistry.add("Tracks_neg/nSigmaTOF", "; #it{p} (GeV/#it{c}); n#sigma_{TOF}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); + trackHistoPartOnePos.init(&qaRegistry, confTrkTempFitVarpTBins, confTrkTempFitVarBins, confIsMC, confTrkPDGCodePartOne); + trackHistoPartOneNeg.init(&qaRegistry, confTrkTempFitVarpTBins, confTrkTempFitVarBins, confIsMC, confTrkPDGCodePartOne); + trackHistoPartTwo.init(&qaRegistry, confV0TempFitVarpTBins, confV0TempFitVarBins, confIsMC, confV0PDGCodePartTwo, true); + posChildHistos.init(&qaRegistry, confChildTempFitVarpTBins, confChildTempFitVarBins, false, 0, true); + negChildHistos.init(&qaRegistry, confChildTempFitVarpTBins, confChildTempFitVarBins, false, 0, true); + + trackHistoV0Type1.init(&qaRegistry, confV0TempFitVarpTBins, confV0TempFitVarBins, confIsMC, confV0PDGCodePartTwo, true, "V0Type1"); + posChildV0Type1.init(&qaRegistry, confChildTempFitVarpTBins, confChildTempFitVarBins, false, 0, true, "posChildV0Type1"); + negChildV0Type1.init(&qaRegistry, confChildTempFitVarpTBins, confChildTempFitVarBins, false, 0, true, "negChildV0Type1"); + trackHistoV0Type2.init(&qaRegistry, confV0TempFitVarpTBins, confV0TempFitVarBins, confIsMC, confV0PDGCodePartTwo, true, "V0Type2"); + posChildV0Type2.init(&qaRegistry, confChildTempFitVarpTBins, confChildTempFitVarBins, false, 0, true, "posChildV0Type2"); + negChildV0Type2.init(&qaRegistry, confChildTempFitVarpTBins, confChildTempFitVarBins, false, 0, true, "negChildV0Type2"); + + mixQaRegistry.add("MixingQA/hMECollisionBins", ";bin;Entries", kTH1F, {{120, -0.5, 119.5}}); + + // MC truth + registryMCtruth.add("plus/MCtruthLambda", "MC truth Lambdas;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + registryMCtruth.add("minus/MCtruthLambda", "MC truth Lambdas;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + + registryMCtruth.add("plus/MCtruthAllPt", "MC truth all;#it{p}_{T} (GeV/c); #eta", {HistType::kTH1F, {{500, 0, 5}}}); + registryMCtruth.add("minus/MCtruthAllPt", "MC truth all;#it{p}_{T} (GeV/c); #eta", {HistType::kTH1F, {{500, 0, 5}}}); + + registryMCtruth.add("plus/MCtruthPi", "MC truth pions;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + registryMCtruth.add("plus/MCtruthPr", "MC truth protons;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + + registryMCtruth.add("minus/MCtruthPi", "MC truth pions;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + registryMCtruth.add("minus/MCtruthPr", "MC truth protons;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + + registryMCtruth.add("plus/MCtruthPiPt", "MC truth pions;#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); + registryMCtruth.add("plus/MCtruthPrPt", "MC truth protons;#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); + registryMCtruth.add("minus/MCtruthPiPt", "MC truth pions;#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); + registryMCtruth.add("minus/MCtruthPrPt", "MC truth protons;#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); + + // MC reco + registryMCreco.add("plus/MCrecoLambda", "MC reco Lambdas;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + registryMCreco.add("plus/MCrecoLambdaChildPr", "MC reco Lambdas;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + registryMCreco.add("plus/MCrecoLambdaChildPi", "MC reco Lambdas;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + registryMCreco.add("minus/MCrecoLambda", "MC reco Lambdas;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + registryMCreco.add("minus/MCrecoLambdaChildPr", "MC reco Lambdas;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + registryMCreco.add("minus/MCrecoLambdaChildPi", "MC reco Lambdas;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + + registryMCreco.add("plus/MCrecoAllPt", "MC reco all;#it{p}_{T} (GeV/c); #eta", {HistType::kTH1F, {{500, 0, 5}}}); + registryMCreco.add("minus/MCrecoAllPt", "MC reco all;#it{p}_{T} (GeV/c); #eta", {HistType::kTH1F, {{500, 0, 5}}}); + + registryMCreco.add("plus/MCrecoPi", "MC reco pions;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + registryMCreco.add("plus/MCrecoPr", "MC reco protons;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + + registryMCreco.add("minus/MCrecoPi", "MC reco pions;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + registryMCreco.add("minus/MCrecoPr", "MC reco protons;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + + registryMCreco.add("plus/MCrecoPiPt", "MC reco pions;#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); + registryMCreco.add("plus/MCrecoPrPt", "MC reco protons;#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); + registryMCreco.add("minus/MCrecoPiPt", "MC reco pions;#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); + registryMCreco.add("minus/MCrecoPrPt", "MC reco protons;#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); + + // Helicity angle + thetaRegistry.add("Theta/hTheta", " ; p (GeV/#it{c}); cos(#theta)", kTH2F, {{100, 0, 10}, {110, -1.1, 1.1}}); + thetaRegistry.add("Theta/PositiveChild/hThetaPt", " ; p_{T} (GeV/#it{c}); cos(#theta)", kTH2F, {{100, 0, 10}, {110, -1.1, 1.1}}); + thetaRegistry.add("Theta/PositiveChild/hThetaEta", " ; #eta; cos(#theta)", kTH2F, {{100, -1, 1}, {110, -1.1, 1.1}}); + thetaRegistry.add("Theta/PositiveChild/hThetaPhi", " ; #phi; cos(#theta)", kTH2F, {{100, -1, 7}, {110, -1.1, 1.1}}); + thetaRegistry.add("Theta/NegativeChild/hThetaPt", " ; p_{T} (GeV/#it{c}); cos(#theta)", kTH2F, {{100, 0, 10}, {110, -1.1, 1.1}}); + thetaRegistry.add("Theta/NegativeChild/hThetaEta", " ; #eta; cos(#theta)", kTH2F, {{100, -1, 1}, {110, -1.1, 1.1}}); + thetaRegistry.add("Theta/NegativeChild/hThetaPhi", " ; #phi; cos(#theta)", kTH2F, {{100, -1, 7}, {110, -1.1, 1.1}}); + + sameEventCont.init(&resultRegistry, confkstarBins, confMultBins, confkTBins, confmTBins, confMultBins3D, confmTBins3D, confEtaBins, confPhiBins, confIsMC, confUse3D); + sameEventCont.setPDGCodes(confTrkPDGCodePartOne, confV0PDGCodePartTwo); + mixedEventCont.init(&resultRegistry, confkstarBins, confMultBins, confkTBins, confmTBins, confMultBins3D, confmTBins3D, confEtaBins, confPhiBins, confIsMC, confUse3D); + mixedEventCont.setPDGCodes(confTrkPDGCodePartOne, confV0PDGCodePartTwo); + + pairCleaner.init(&qaRegistry); + pairCleanerV0.init(&qaRegistry); + if (confIsCPR.value) { + pairCloseRejection.init(&resultRegistry, &qaRegistry, confCPRdeltaPhiCutMin.value, confCPRdeltaPhiCutMax.value, confCPRdeltaEtaCutMin.value, confCPRdeltaEtaCutMax.value, confCPRChosenRadii.value, confCPRPlotPerRadii.value); + pairCloseRejectionV0.init(&resultRegistry, &qaRegistry, confCPRdeltaPhiCutMin.value, confCPRdeltaPhiCutMax.value, confCPRdeltaEtaCutMin.value, confCPRdeltaEtaCutMax.value, confCPRChosenRadii.value, confCPRPlotPerRadii.value); + } + + if (!confLocalEfficiency.value.empty()) { + plocalEffFile = std::unique_ptr(TFile::Open(confLocalEfficiency.value.c_str(), "read")); + if (!plocalEffFile || plocalEffFile.get()->IsZombie()) + LOGF(fatal, "Could not load efficiency histogram from %s", confLocalEfficiency.value.c_str()); + if (doprocessSameEvent || doprocessMixedEvent) { + plocalEffp1 = (confChargePart1 > 0) ? std::unique_ptr(plocalEffFile.get()->Get("PrPlus")) : std::unique_ptr(plocalEffFile.get()->Get("PrMinus")); // note: works only for protons for now + plocalEffp2 = (confV0Type1 == 0) ? std::unique_ptr(plocalEffFile.get()->Get("Lambda")) : std::unique_ptr(plocalEffFile.get()->Get("AntiLambda")); + LOGF(info, "Loaded efficiency histograms for track-V0."); + } else if (doprocessSameEventV0 || doprocessMixedEventV0) { + plocalEffp1 = (confV0Type1 == 0) ? std::unique_ptr(plocalEffFile.get()->Get("Lambda")) : std::unique_ptr(plocalEffFile.get()->Get("AntiLambda")); + plocalEffp2 = (confV0Type2 == 0) ? std::unique_ptr(plocalEffFile.get()->Get("Lambda")) : std::unique_ptr(plocalEffFile.get()->Get("AntiLambda")); + LOGF(info, "Loaded efficiency histograms for V0-V0."); + } + } + } + /// This function processes the same event for track - V0 + template + void doSameEvent(FilteredFDCollision const& col, PartType const& parts, PartitionType& groupPartsOne, PartitionType& groupPartsTwo, [[maybe_unused]] MCParticles mcParts = nullptr) + { + const auto& magFieldTesla = col.magField(); + + const int multCol = confUseCent ? col.multV0M() : col.multNtr(); + + eventHisto.fillQA(col); + + /// Histogramming same event + for (const auto& part : groupPartsTwo) { + if (!invMLambda(part.mLambda(), part.mAntiLambda())) + continue; + const auto& posChild = parts.iteratorAt(part.index() - 2); + const auto& negChild = parts.iteratorAt(part.index() - 1); + /// Daughters that do not pass this condition are not selected + if (!isParticleTPC(posChild, V0ChildTable[confV0Type1][0]) || !isParticleTPC(negChild, V0ChildTable[confV0Type1][1])) + continue; + + auto posChildMass = pdg->Mass(confPDGCodePosChild); + auto negChildMass = pdg->Mass(confPDGCodeNegChild); + auto posChildBoosted = FemtoUniverseMath::boostPRF(posChild, posChildMass, negChild, negChildMass); + auto cosineTheta = (posChildBoosted.Px() * part.px() + posChildBoosted.Py() * part.py() + posChildBoosted.Pz() * part.pz()) / (posChildBoosted.P() * part.p()); + + trackHistoPartTwo.fillQA(part); + posChildHistos.fillQA(posChild); + negChildHistos.fillQA(negChild); + + thetaRegistry.fill(HIST("Theta/hTheta"), part.p(), cosineTheta); + thetaRegistry.fill(HIST("Theta/PositiveChild/hThetaPt"), posChild.pt(), cosineTheta); + thetaRegistry.fill(HIST("Theta/PositiveChild/hThetaEta"), posChild.eta(), cosineTheta); + thetaRegistry.fill(HIST("Theta/PositiveChild/hThetaPhi"), posChild.phi(), cosineTheta); + thetaRegistry.fill(HIST("Theta/NegativeChild/hThetaPt"), negChild.pt(), cosineTheta); + thetaRegistry.fill(HIST("Theta/NegativeChild/hThetaEta"), negChild.eta(), cosineTheta); + thetaRegistry.fill(HIST("Theta/NegativeChild/hThetaPhi"), negChild.phi(), cosineTheta); + } + + for (const auto& part : groupPartsOne) { + /// PID plot for particle 1 + const float tpcNSigmas[3] = {unPackInTable(part.tpcNSigmaStorePr()), unPackInTable(part.tpcNSigmaStorePi()), unPackInTable(part.tpcNSigmaStoreKa())}; + const float tofNSigmas[3] = {unPackInTable(part.tofNSigmaStorePr()), unPackInTable(part.tofNSigmaStorePi()), unPackInTable(part.tofNSigmaStoreKa())}; + + if (!isNSigmaCombined(part.p(), tpcNSigmas[confTrackChoicePartOne], tofNSigmas[confTrackChoicePartOne])) + continue; + if (part.sign() > 0) { + qaRegistry.fill(HIST("Tracks_pos/nSigmaTPC"), part.p(), tpcNSigmas[confTrackChoicePartOne]); + qaRegistry.fill(HIST("Tracks_pos/nSigmaTOF"), part.p(), tofNSigmas[confTrackChoicePartOne]); + trackHistoPartOnePos.fillQA(part); + } else if (part.sign() < 0) { + qaRegistry.fill(HIST("Tracks_neg/nSigmaTPC"), part.p(), tpcNSigmas[confTrackChoicePartOne]); + qaRegistry.fill(HIST("Tracks_neg/nSigmaTOF"), part.p(), tofNSigmas[confTrackChoicePartOne]); + trackHistoPartOneNeg.fillQA(part); + } + } + + /// Now build the combinations + for (const auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) { + // Lambda invariant mass cut + if (!invMLambda(p2.mLambda(), p2.mAntiLambda())) + continue; + /// PID using stored binned nsigma + if (!isParticleCombined(p1, confTrackChoicePartOne)) + continue; + // track cleaning + if (!pairCleaner.isCleanPair(p1, p2, parts)) { + continue; + } + if (confIsCPR.value) { + if (pairCloseRejection.isClosePair(p1, p2, parts, magFieldTesla, femto_universe_container::EventType::same)) { + continue; + } + } + const auto& posChild = parts.iteratorAt(p2.index() - 2); + const auto& negChild = parts.iteratorAt(p2.index() - 1); + + /// Daughters that do not pass this condition are not selected + if (!isParticleTPC(posChild, V0ChildTable[confV0Type1][0]) || !isParticleTPC(negChild, V0ChildTable[confV0Type1][1])) + continue; + + float weight = 1.0f; + if (plocalEffp1) + weight = plocalEffp1.get()->GetBinContent(plocalEffp1->FindBin(p1.pt(), p1.eta())) * plocalEffp2.get()->GetBinContent(plocalEffp2->FindBin(p2.pt(), p2.eta())); + if constexpr (std::is_same::value) + sameEventCont.setPair(p1, p2, multCol, confUse3D, weight); + else + sameEventCont.setPair(p1, p2, multCol, confUse3D, weight); + } + } + + void processSameEvent(FilteredFDCollision const& col, FemtoFullParticles const& parts) + { + auto groupPartsOne = partsOne->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); + auto groupPartsTwo = partsTwo->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); + doSameEvent(col, parts, groupPartsOne, groupPartsTwo); + } + PROCESS_SWITCH(FemtoUniversePairTaskTrackV0Helicity, processSameEvent, "Enable processing same event for track - V0", false); + + void processSameEventMCReco(FilteredFDCollision const& col, FemtoRecoParticles const& parts, aod::FdMCParticles const& mcparts) + { + auto groupPartsOne = partsOneMCReco->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); + auto groupPartsTwo = partsTwoMCReco->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); + doSameEvent(col, parts, groupPartsOne, groupPartsTwo, mcparts); + } + PROCESS_SWITCH(FemtoUniversePairTaskTrackV0Helicity, processSameEventMCReco, "Enable processing same event for track - V0 MC Reco", false); + + /// This function processes the same event for V0 - V0 + void processSameEventV0(FilteredFDCollision const& col, FemtoFullParticles const& parts) + { + const auto& magFieldTesla = col.magField(); + + auto groupPartsTwo = partsTwo->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); + const int multCol = confUseCent ? col.multV0M() : col.multNtr(); + + eventHisto.fillQA(col); + + /// Histogramming same event + for (const auto& part : groupPartsTwo) { + if (!invMLambda(part.mLambda(), part.mAntiLambda())) + continue; + const auto& posChild = parts.iteratorAt(part.index() - 2); + const auto& negChild = parts.iteratorAt(part.index() - 1); + + /// Check daughters of first V0 particle + if (isParticleTPC(posChild, V0ChildTable[confV0Type1][0]) && isParticleTPC(negChild, V0ChildTable[confV0Type1][1])) { + trackHistoV0Type1.fillQABase(part, HIST("V0Type1")); + posChildV0Type1.fillQABase(posChild, HIST("posChildV0Type1")); + negChildV0Type1.fillQABase(negChild, HIST("negChildV0Type1")); + } + /// Check daughters of second V0 particle + if (isParticleTPC(posChild, V0ChildTable[confV0Type2][0]) && isParticleTPC(negChild, V0ChildTable[confV0Type2][1])) { + trackHistoV0Type2.fillQABase(part, HIST("V0Type2")); + posChildV0Type2.fillQABase(posChild, HIST("posChildV0Type2")); + negChildV0Type2.fillQABase(negChild, HIST("negChildV0Type2")); + } + } + + auto pairProcessFunc = [&](auto& p1, auto& p2) -> void { + // Lambda invariant mass cut for p1 + if (!invMLambda(p1.mLambda(), p1.mAntiLambda())) + return; + // Lambda invariant mass cut for p2 + if (!invMLambda(p2.mLambda(), p2.mAntiLambda())) + return; + // track cleaning + if (!pairCleanerV0.isCleanPair(p1, p2, parts)) { + return; + } + if (confIsCPR.value) { + if (pairCloseRejectionV0.isClosePair(p1, p2, parts, magFieldTesla, femto_universe_container::EventType::same)) { + return; + } + } + const auto& posChild1 = parts.iteratorAt(p1.index() - 2); + const auto& negChild1 = parts.iteratorAt(p1.index() - 1); + /// Daughters that do not pass this condition are not selected + if (!isParticleTPC(posChild1, V0ChildTable[confV0Type1][0]) || !isParticleTPC(negChild1, V0ChildTable[confV0Type1][1])) + return; + + const auto& posChild2 = parts.iteratorAt(p2.index() - 2); + const auto& negChild2 = parts.iteratorAt(p2.index() - 1); + /// Daughters that do not pass this condition are not selected + if (!isParticleTPC(posChild2, V0ChildTable[confV0Type2][0]) || !isParticleTPC(negChild2, V0ChildTable[confV0Type2][1])) + return; + + sameEventCont.setPair(p1, p2, multCol, confUse3D); + }; + if (confV0Type1 == confV0Type2) { + /// Now build the combinations for identical V0s + for (const auto& [p1, p2] : combinations(CombinationsStrictlyUpperIndexPolicy(groupPartsTwo, groupPartsTwo))) { + pairProcessFunc(p1, p2); + } + } else { + /// Now build the combinations for not identical identical V0s + for (const auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsTwo, groupPartsTwo))) { + pairProcessFunc(p1, p2); + } + } + } + + PROCESS_SWITCH(FemtoUniversePairTaskTrackV0Helicity, processSameEventV0, "Enable processing same event for V0 - V0", false); + + /// This function processes MC same events for Track - V0 + void processMCSameEvent(FilteredFDCollision const& col, FemtoFullParticles const& parts) + { + const auto& magFieldTesla = col.magField(); + + auto groupPartsOne = partsOneMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); + auto groupPartsTwo = partsTwoMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); + const int multCol = confUseCent ? col.multV0M() : col.multNtr(); + + eventHisto.fillQA(col); + + /// Histogramming same event + for (const auto& part : groupPartsTwo) { + int pdgCode = static_cast(part.pidCut()); + if ((confV0Type1 == 0 && pdgCode != confPDGCodeV0) || (confV0Type1 == 1 && pdgCode != -confPDGCodeV0)) + continue; + trackHistoPartTwo.fillQA(part); + } + + for (const auto& part : groupPartsOne) { + int pdgCode = static_cast(part.pidCut()); + if (pdgCode != confTrkPDGCodePartOne) + continue; + const auto& pdgParticle = pdgMC->GetParticle(pdgCode); + if (!pdgParticle) { + continue; + } + /// PID plot for particle 1 + if (pdgParticle->Charge() > 0.0) { + trackHistoPartOnePos.fillQA(part); + } else if (pdgParticle->Charge() < 0.0) { + trackHistoPartOneNeg.fillQA(part); + } + } + + /// Now build the combinations + for (const auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) { + if (static_cast(p1.pidCut()) != confTrkPDGCodePartOne) + continue; + int pdgCode2 = static_cast(p2.pidCut()); + if ((confV0Type1 == 0 && pdgCode2 != confPDGCodeV0) || (confV0Type1 == 1 && pdgCode2 != -confPDGCodeV0)) + continue; + // track cleaning + if (confIsCPR.value) { + if (pairCloseRejection.isClosePair(p1, p2, parts, magFieldTesla, femto_universe_container::EventType::same)) { + continue; + } + } + sameEventCont.setPair(p1, p2, multCol, confUse3D); + } + } + + PROCESS_SWITCH(FemtoUniversePairTaskTrackV0Helicity, processMCSameEvent, "Enable processing same event for MC truth track - V0", false); + + /// This function processes MC same events for V0 - V0 + void processMCSameEventV0(FilteredFDCollision const& col, FemtoFullParticles const& /*parts*/) + { + auto groupPartsTwo = partsTwoMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); + const int multCol = confUseCent ? col.multV0M() : col.multNtr(); + + eventHisto.fillQA(col); + + /// Histogramming same event + for (const auto& part : groupPartsTwo) { + int pdgCode = static_cast(part.pidCut()); + if ((confV0Type1 == 0 && pdgCode != confPDGCodeV0) || (confV0Type1 == 1 && pdgCode != -confPDGCodeV0)) + continue; + trackHistoPartTwo.fillQA(part); + } + + auto pairProcessFunc = [&](auto& p1, auto& p2) -> void { + int pdgCode1 = static_cast(p1.pidCut()); + if ((confV0Type1 == 0 && pdgCode1 != confPDGCodeV0) || (confV0Type1 == 1 && pdgCode1 != -confPDGCodeV0)) + return; + int pdgCode2 = static_cast(p2.pidCut()); + if ((confV0Type2 == 0 && pdgCode2 != confPDGCodeV0) || (confV0Type2 == 1 && pdgCode2 != -confPDGCodeV0)) + return; + sameEventCont.setPair(p1, p2, multCol, confUse3D); + }; + /// Now build the combinations + if (confV0Type1 == confV0Type2) { + /// Now build the combinations for identical V0s + for (const auto& [p1, p2] : combinations(CombinationsStrictlyUpperIndexPolicy(groupPartsTwo, groupPartsTwo))) { + pairProcessFunc(p1, p2); + } + } else { + /// Now build the combinations for not identical identical V0s + for (const auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsTwo, groupPartsTwo))) { + pairProcessFunc(p1, p2); + } + } + } + + PROCESS_SWITCH(FemtoUniversePairTaskTrackV0Helicity, processMCSameEventV0, "Enable processing same event for MC truth V0 - V0", false); + + /// This function processes the mixed event for track - V0 + template + void doMixedEvent(FilteredFDCollisions const& cols, PartType const& parts, PartitionType& partitionOne, PartitionType& partitionTwo, [[maybe_unused]] MCParticles mcParts = nullptr) + { + ColumnBinningPolicy colBinningMult{{confVtxBins, confMultBins}, true}; + ColumnBinningPolicy colBinningCent{{confVtxBins, confMultBins}, true}; + + auto mixedCollProcessFunc = [&](auto& collision1, auto& collision2) -> void { + const int multCol = confUseCent ? collision1.multV0M() : collision1.multNtr(); + + auto groupPartsOne = partitionOne->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); + auto groupPartsTwo = partitionTwo->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache); + + const auto& magFieldTesla1 = collision1.magField(); + const auto& magFieldTesla2 = collision2.magField(); + + if (magFieldTesla1 != magFieldTesla2) { + return; + } + + for (const auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) { + // Lambda invariant mass cut + if (!invMLambda(p2.mLambda(), p2.mAntiLambda())) + continue; + /// PID using stored binned nsigma + if (!isParticleCombined(p1, confTrackChoicePartOne)) + continue; + + const auto& posChild = parts.iteratorAt(p2.globalIndex() - 2); + const auto& negChild = parts.iteratorAt(p2.globalIndex() - 1); + /// Daughters that do not pass this condition are not selected + if (!isParticleTPC(posChild, V0ChildTable[confV0Type1][0]) || !isParticleTPC(negChild, V0ChildTable[confV0Type1][1])) + continue; + + // track cleaning + if (!pairCleaner.isCleanPair(p1, p2, parts)) { + continue; + } + if (confIsCPR.value) { + if (pairCloseRejection.isClosePair(p1, p2, parts, magFieldTesla1, femto_universe_container::EventType::mixed)) { + continue; + } + } + float weight = 1.0f; + if (plocalEffp1) + weight = plocalEffp1.get()->GetBinContent(plocalEffp1->FindBin(p1.pt(), p1.eta())) * plocalEffp2.get()->GetBinContent(plocalEffp2->FindBin(p2.pt(), p2.eta())); + + if constexpr (std::is_same::value) + mixedEventCont.setPair(p1, p2, multCol, confUse3D, weight); + else + mixedEventCont.setPair(p1, p2, multCol, confUse3D, weight); + } + }; + + if (confUseCent) { + for (const auto& [collision1, collision2] : soa::selfCombinations(colBinningCent, confNEventsMix, -1, cols, cols)) { + mixedCollProcessFunc(collision1, collision2); + mixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinningCent.getBin({collision1.posZ(), collision1.multV0M()})); + } + } else { + for (const auto& [collision1, collision2] : soa::selfCombinations(colBinningMult, confNEventsMix, -1, cols, cols)) { + mixedCollProcessFunc(collision1, collision2); + mixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinningMult.getBin({collision1.posZ(), collision1.multNtr()})); + } + } + } + + void processMixedEvent(FilteredFDCollisions const& cols, FemtoFullParticles const& parts) + { + doMixedEvent(cols, parts, partsOne, partsTwo); + } + PROCESS_SWITCH(FemtoUniversePairTaskTrackV0Helicity, processMixedEvent, "Enable processing mixed event for track - V0", false); + + void processMixedEventMCReco(FilteredFDCollisions const& cols, FemtoRecoParticles const& parts, aod::FdMCParticles const& mcparts) + { + doMixedEvent(cols, parts, partsOneMCReco, partsTwoMCReco, mcparts); + } + PROCESS_SWITCH(FemtoUniversePairTaskTrackV0Helicity, processMixedEventMCReco, "Enable processing mixed event for track - V0 for MC Reco", false); + + /// This function processes the mixed event for V0 - V0 + void processMixedEventV0(FilteredFDCollisions const& cols, FemtoFullParticles const& parts) + { + ColumnBinningPolicy colBinningMult{{confVtxBins, confMultBins}, true}; + ColumnBinningPolicy colBinningCent{{confVtxBins, confMultBins}, true}; + + auto mixedCollProcessFunc = [&](auto& collision1, auto& collision2) -> void { + const int multCol = confUseCent ? collision1.multV0M() : collision1.multNtr(); + + auto groupPartsOne = partsTwo->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); + auto groupPartsTwo = partsTwo->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache); + + const auto& magFieldTesla1 = collision1.magField(); + const auto& magFieldTesla2 = collision2.magField(); + + if (magFieldTesla1 != magFieldTesla2) { + return; + } + + for (const auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) { + // Lambda invariant mass cut for p1 + if (!invMLambda(p1.mLambda(), p1.mAntiLambda())) { + continue; + } + // Lambda invariant mass cut for p2 + if (!invMLambda(p2.mLambda(), p2.mAntiLambda())) { + continue; + } + + const auto& posChild1 = parts.iteratorAt(p1.globalIndex() - 2); + const auto& negChild1 = parts.iteratorAt(p1.globalIndex() - 1); + /// Daughters that do not pass this condition are not selected + if (!isParticleTPC(posChild1, V0ChildTable[confV0Type1][0]) || !isParticleTPC(negChild1, V0ChildTable[confV0Type1][1])) + continue; + + const auto& posChild2 = parts.iteratorAt(p2.globalIndex() - 2); + const auto& negChild2 = parts.iteratorAt(p2.globalIndex() - 1); + /// Daughters that do not pass this condition are not selected + if (!isParticleTPC(posChild2, V0ChildTable[confV0Type2][0]) || !isParticleTPC(negChild2, V0ChildTable[confV0Type2][1])) + continue; + + // track cleaning + if (!pairCleanerV0.isCleanPair(p1, p2, parts)) { + continue; + } + if (confIsCPR.value) { + if (pairCloseRejectionV0.isClosePair(p1, p2, parts, magFieldTesla1, femto_universe_container::EventType::mixed)) { + continue; + } + } + mixedEventCont.setPair(p1, p2, multCol, confUse3D); + } + }; + + if (confUseCent) { + for (const auto& [collision1, collision2] : soa::selfCombinations(colBinningCent, confNEventsMix, -1, cols, cols)) { + mixedCollProcessFunc(collision1, collision2); + mixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinningCent.getBin({collision1.posZ(), collision1.multV0M()})); + } + } else { + for (const auto& [collision1, collision2] : soa::selfCombinations(colBinningMult, confNEventsMix, -1, cols, cols)) { + mixedCollProcessFunc(collision1, collision2); + mixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinningMult.getBin({collision1.posZ(), collision1.multNtr()})); + } + } + } + PROCESS_SWITCH(FemtoUniversePairTaskTrackV0Helicity, processMixedEventV0, "Enable processing mixed events for V0 - V0", false); + + /// This function processes MC mixed events for Track - V0 + void processMCMixedEvent(FilteredFDCollisions const& cols, FemtoFullParticles const& parts) + { + ColumnBinningPolicy colBinningMult{{confVtxBins, confMultBins}, true}; + ColumnBinningPolicy colBinningCent{{confVtxBins, confMultBins}, true}; + + auto mixedCollProcessFunc = [&](auto& collision1, auto& collision2) -> void { + const int multCol = confUseCent ? collision1.multV0M() : collision1.multNtr(); + + auto groupPartsOne = partsOneMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); + auto groupPartsTwo = partsTwoMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache); + + const auto& magFieldTesla1 = collision1.magField(); + const auto& magFieldTesla2 = collision2.magField(); + + if (magFieldTesla1 != magFieldTesla2) { + return; + } + for (const auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) { + if (static_cast(p1.pidCut()) != confTrkPDGCodePartOne) + continue; + int pdgCode2 = static_cast(p2.pidCut()); + if ((confV0Type1 == 0 && pdgCode2 != confPDGCodeV0) || (confV0Type1 == 1 && pdgCode2 != -confPDGCodeV0)) + continue; + if (confIsCPR.value) { + if (pairCloseRejection.isClosePair(p1, p2, parts, magFieldTesla1, femto_universe_container::EventType::mixed)) { + continue; + } + } + mixedEventCont.setPair(p1, p2, multCol, confUse3D); + } + }; + + if (confUseCent) { + for (const auto& [collision1, collision2] : soa::selfCombinations(colBinningCent, confNEventsMix, -1, cols, cols)) { + mixedCollProcessFunc(collision1, collision2); + mixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinningCent.getBin({collision1.posZ(), collision1.multV0M()})); + } + } else { + for (const auto& [collision1, collision2] : soa::selfCombinations(colBinningMult, confNEventsMix, -1, cols, cols)) { + mixedCollProcessFunc(collision1, collision2); + mixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinningMult.getBin({collision1.posZ(), collision1.multNtr()})); + } + } + } + + PROCESS_SWITCH(FemtoUniversePairTaskTrackV0Helicity, processMCMixedEvent, "Enable processing mixed events for MC truth track - V0", false); + + /// This function processes MC mixed events for V0 - V0 + void processMCMixedEventV0(FilteredFDCollisions const& cols, FemtoFullParticles const& /*parts*/) + { + ColumnBinningPolicy colBinningMult{{confVtxBins, confMultBins}, true}; + ColumnBinningPolicy colBinningCent{{confVtxBins, confMultBins}, true}; + + auto mixedCollProcessFunc = [&](auto& collision1, auto& collision2) -> void { + const int multCol = confUseCent ? collision1.multV0M() : collision1.multNtr(); + + auto groupPartsOne = partsTwoMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); + auto groupPartsTwo = partsTwoMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache); + + for (const auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) { + int pdgCode1 = static_cast(p1.pidCut()); + if ((confV0Type1 == 0 && pdgCode1 != confPDGCodeV0) || (confV0Type1 == 1 && pdgCode1 != -confPDGCodeV0)) + continue; + int pdgCode2 = static_cast(p2.pidCut()); + if ((confV0Type2 == 0 && pdgCode2 != confPDGCodeV0) || (confV0Type2 == 1 && pdgCode2 != -confPDGCodeV0)) + continue; + mixedEventCont.setPair(p1, p2, multCol, confUse3D); + } + }; + + if (confUseCent) { + for (const auto& [collision1, collision2] : soa::selfCombinations(colBinningCent, confNEventsMix, -1, cols, cols)) { + mixedCollProcessFunc(collision1, collision2); + mixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinningCent.getBin({collision1.posZ(), collision1.multV0M()})); + } + } else { + for (const auto& [collision1, collision2] : soa::selfCombinations(colBinningMult, confNEventsMix, -1, cols, cols)) { + mixedCollProcessFunc(collision1, collision2); + mixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinningMult.getBin({collision1.posZ(), collision1.multNtr()})); + } + } + } + + PROCESS_SWITCH(FemtoUniversePairTaskTrackV0Helicity, processMCMixedEventV0, "Enable processing mixed events for MC truth V0 - V0", false); + ///--------------------------------------------MC-------------------------------------------------/// + + /// This function fills MC truth particles from derived MC table + void processMCTruth(aod::FDParticles const& parts) + { + for (const auto& part : parts) { + if (part.partType() != uint8_t(aod::femtouniverseparticle::ParticleType::kMCTruthTrack)) + continue; + + int pdgCode = static_cast(part.pidCut()); + const auto& pdgParticle = pdgMC->GetParticle(pdgCode); + if (!pdgParticle) { + continue; + } + + if (pdgCode == 3122) { + registryMCtruth.fill(HIST("plus/MCtruthLambda"), part.pt(), part.eta()); + continue; + } else if (pdgCode == -3122) { + registryMCtruth.fill(HIST("minus/MCtruthLambda"), part.pt(), part.eta()); + continue; + } + + if (pdgParticle->Charge() > 0.0) { + registryMCtruth.fill(HIST("plus/MCtruthAllPt"), part.pt()); + } + if (pdgCode == 211) { + registryMCtruth.fill(HIST("plus/MCtruthPi"), part.pt(), part.eta()); + registryMCtruth.fill(HIST("plus/MCtruthPiPt"), part.pt()); + } + if (pdgCode == 2212) { + registryMCtruth.fill(HIST("plus/MCtruthPr"), part.pt(), part.eta()); + registryMCtruth.fill(HIST("plus/MCtruthPrPt"), part.pt()); + } + + if (pdgParticle->Charge() < 0.0) { + registryMCtruth.fill(HIST("minus/MCtruthAllPt"), part.pt()); + } + if (pdgCode == -211) { + registryMCtruth.fill(HIST("minus/MCtruthPi"), part.pt(), part.eta()); + registryMCtruth.fill(HIST("minus/MCtruthPiPt"), part.pt()); + } + if (pdgCode == -2212) { + registryMCtruth.fill(HIST("minus/MCtruthPr"), part.pt(), part.eta()); + registryMCtruth.fill(HIST("minus/MCtruthPrPt"), part.pt()); + } + } + } + + PROCESS_SWITCH(FemtoUniversePairTaskTrackV0Helicity, processMCTruth, "Process MC truth data", false); + + void processMCReco(FemtoRecoParticles const& parts, aod::FdMCParticles const& mcparts) + { + for (const auto& part : parts) { + auto mcPartId = part.fdMCParticleId(); + if (mcPartId == -1) + continue; // no MC particle + const auto& mcpart = mcparts.iteratorAt(mcPartId); + // + if (part.partType() == aod::femtouniverseparticle::ParticleType::kV0) { + if (mcpart.pdgMCTruth() == 3122) { + const auto& posChild = parts.iteratorAt(part.globalIndex() - 2); + const auto& negChild = parts.iteratorAt(part.globalIndex() - 1); + /// Daughters that do not pass this condition are not selected + if (isParticleTPC(posChild, 0) && isParticleTPC(negChild, 1)) { + registryMCreco.fill(HIST("plus/MCrecoLambda"), mcpart.pt(), mcpart.eta()); // lambda + if (auto mcpartIdChild = posChild.fdMCParticleId(); mcpartIdChild != -1) { + const auto& mcpartChild = mcparts.iteratorAt(mcpartIdChild); + registryMCreco.fill(HIST("plus/MCrecoLambdaChildPr"), mcpartChild.pt(), mcpartChild.eta()); // lambda proton child + } + if (auto mcpartIdChild = negChild.fdMCParticleId(); mcpartIdChild != -1) { + const auto& mcpartChild = mcparts.iteratorAt(mcpartIdChild); + registryMCreco.fill(HIST("plus/MCrecoLambdaChildPi"), mcpartChild.pt(), mcpartChild.eta()); // lambda pion child + } + } + } else if (mcpart.pdgMCTruth() == -3122) { + const auto& posChild = parts.iteratorAt(part.globalIndex() - 2); + const auto& negChild = parts.iteratorAt(part.globalIndex() - 1); + /// Daughters that do not pass this condition are not selected + if (isParticleTPC(posChild, 1) && isParticleTPC(negChild, 0)) { + registryMCreco.fill(HIST("minus/MCrecoLambda"), mcpart.pt(), mcpart.eta()); // anti-lambda + if (auto mcpartIdChild = posChild.fdMCParticleId(); mcpartIdChild != -1) { + const auto& mcpartChild = mcparts.iteratorAt(mcpartIdChild); + registryMCreco.fill(HIST("minus/MCrecoLambdaChildPi"), mcpartChild.pt(), mcpartChild.eta()); // anti-lambda pion child + } + if (auto mcpartIdChild = negChild.fdMCParticleId(); mcpartIdChild != -1) { + const auto& mcpartChild = mcparts.iteratorAt(mcpartIdChild); + registryMCreco.fill(HIST("minus/MCrecoLambdaChildPr"), mcpartChild.pt(), mcpartChild.eta()); // anti-lambda proton child + } + } + } + } else if (part.partType() == aod::femtouniverseparticle::ParticleType::kTrack) { + if (part.sign() > 0) { + registryMCreco.fill(HIST("plus/MCrecoAllPt"), mcpart.pt()); + if (mcpart.pdgMCTruth() == 211 && isNSigmaCombined(part.p(), unPackInTable(part.tpcNSigmaStorePi()), unPackInTable(part.tofNSigmaStorePi()))) { + registryMCreco.fill(HIST("plus/MCrecoPi"), mcpart.pt(), mcpart.eta()); + registryMCreco.fill(HIST("plus/MCrecoPiPt"), mcpart.pt()); + } else if (mcpart.pdgMCTruth() == 2212 && isNSigmaCombined(part.p(), unPackInTable(part.tpcNSigmaStorePr()), unPackInTable(part.tofNSigmaStorePr()))) { + registryMCreco.fill(HIST("plus/MCrecoPr"), mcpart.pt(), mcpart.eta()); + registryMCreco.fill(HIST("plus/MCrecoPrPt"), mcpart.pt()); + } + } + + if (part.sign() < 0) { + registryMCreco.fill(HIST("minus/MCrecoAllPt"), mcpart.pt()); + if (mcpart.pdgMCTruth() == -211 && isNSigmaCombined(part.p(), unPackInTable(part.tpcNSigmaStorePi()), unPackInTable(part.tofNSigmaStorePi()))) { + registryMCreco.fill(HIST("minus/MCrecoPi"), mcpart.pt(), mcpart.eta()); + registryMCreco.fill(HIST("minus/MCrecoPiPt"), mcpart.pt()); + } else if (mcpart.pdgMCTruth() == -2212 && isNSigmaCombined(part.p(), unPackInTable(part.tpcNSigmaStorePr()), unPackInTable(part.tofNSigmaStorePr()))) { + registryMCreco.fill(HIST("minus/MCrecoPr"), mcpart.pt(), mcpart.eta()); + registryMCreco.fill(HIST("minus/MCrecoPrPt"), mcpart.pt()); + } + } + } // partType + } + } + + PROCESS_SWITCH(FemtoUniversePairTaskTrackV0Helicity, processMCReco, "Process MC reco data", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + WorkflowSpec workflow{ + adaptAnalysisTask(cfgc), + }; + return workflow; +} From d7466fb722f45c8259f7fbe4c8d7f8ac21e2b1f2 Mon Sep 17 00:00:00 2001 From: lauraser <45659867+lauraser@users.noreply.github.com> Date: Tue, 5 Aug 2025 15:45:21 +0200 Subject: [PATCH 237/345] [PWGCF] RCT flags in femto producer (#12438) Co-authored-by: Laura Serksnyte --- .../TableProducer/femtoDreamProducerTask.cxx | 48 +++++++++++++------ 1 file changed, 34 insertions(+), 14 deletions(-) diff --git a/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx b/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx index 7272382f357..0e788e4a97b 100644 --- a/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx +++ b/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx @@ -13,39 +13,45 @@ /// \brief Tasks that produces the track tables used for the pairing /// \author Laura Serksnyte, TU München, laura.serksnyte@tum.de -#include -#include -#include -#include +#include "PWGCF/DataModel/FemtoDerived.h" +#include "PWGCF/FemtoDream/Core/femtoDreamCascadeSelection.h" +#include "PWGCF/FemtoDream/Core/femtoDreamCollisionSelection.h" +#include "PWGCF/FemtoDream/Core/femtoDreamTrackSelection.h" +#include "PWGCF/FemtoDream/Core/femtoDreamUtils.h" +#include "PWGCF/FemtoDream/Core/femtoDreamV0Selection.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" + #include "Common/Core/trackUtilities.h" +#include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/Centrality.h" #include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/PIDResponseITS.h" #include "Common/DataModel/TrackSelectionTables.h" +#include "EventFiltering/Zorro.h" + #include "DataFormatsParameters/GRPMagField.h" #include "DataFormatsParameters/GRPObject.h" -#include "PWGCF/FemtoDream/Core/femtoDreamCollisionSelection.h" -#include "PWGCF/FemtoDream/Core/femtoDreamTrackSelection.h" -#include "PWGCF/FemtoDream/Core/femtoDreamV0Selection.h" -#include "PWGCF/FemtoDream/Core/femtoDreamCascadeSelection.h" -#include "PWGCF/FemtoDream/Core/femtoDreamUtils.h" #include "Framework/ASoAHelpers.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" #include "Framework/runDataProcessing.h" -#include "EventFiltering/Zorro.h" -#include "PWGCF/DataModel/FemtoDerived.h" -#include "PWGLF/DataModel/LFStrangenessTables.h" #include "ReconstructionDataFormats/Track.h" -#include "TMath.h" +#include + #include "Math/Vector4D.h" +#include "TMath.h" + +#include + +#include +#include using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; +using namespace o2::aod::rctsel; using namespace o2::analysis::femtoDream; namespace o2::aod @@ -205,6 +211,12 @@ struct femtoDreamProducerTask { } OptionTrackSpecialSelections; + struct : o2::framework::ConfigurableGroup { + Configurable requireRCTFlagChecker{"requireRCTFlagChecker", true, "Check event quality in run condition table"}; + Configurable cfgEvtRCTFlagCheckerLabel{"cfgEvtRCTFlagCheckerLabel", "CBT_hadronPID", "Evt sel: RCT flag checker label"}; + Configurable cfgEvtRCTFlagCheckerLimitAcceptAsBad{"cfgEvtRCTFlagCheckerLimitAcceptAsBad", true, "Evt sel: RCT flag checker treat Limited Acceptance As Bad"}; + } rctCut; + HistogramRegistry qaRegistry{"QAHistos", {}, OutputObjHandlingPolicy::AnalysisObject}; HistogramRegistry TrackRegistry{"Tracks", {}, OutputObjHandlingPolicy::AnalysisObject}; HistogramRegistry V0Registry{"V0", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -214,6 +226,7 @@ struct femtoDreamProducerTask { float mMagField; std::string zorroTriggerNames = ""; Service ccdb; /// Accessing the CCDB + RCTFlagsChecker rctChecker; void init(InitContext&) { @@ -255,6 +268,8 @@ struct femtoDreamProducerTask { zorroTriggerNames.pop_back(); } + rctChecker.init(rctCut.cfgEvtRCTFlagCheckerLabel, false, rctCut.cfgEvtRCTFlagCheckerLimitAcceptAsBad); + colCuts.setCuts(ConfEvtZvtx.value, ConfEvtTriggerCheck.value, ConfEvtTriggerSel.value, ConfEvtOfflineCheck.value, ConfEvtAddOfflineCheck.value, ConfIsRun3.value); colCuts.init(&qaRegistry); @@ -568,6 +583,7 @@ struct femtoDreamProducerTask { if (!colCuts.isSelectedCollision(col)) { return; } + if (ConfIsActivateV0.value) { if (colCuts.isEmptyCollision(col, tracks, trackCuts) && colCuts.isEmptyCollision(col, fullV0s, v0Cuts, tracks)) { return; @@ -578,6 +594,10 @@ struct femtoDreamProducerTask { } } + if (rctCut.requireRCTFlagChecker && !rctChecker(col)) { + return; + } + outputCollision(vtxZ, mult, multNtr, spher, mMagField); if constexpr (isMC) { fillMCCollision(col); From fe401bc409e0c58c08e31dc248a9246a13edebbe Mon Sep 17 00:00:00 2001 From: Magnus <57144728+ThePhDane@users.noreply.github.com> Date: Tue, 5 Aug 2025 15:56:07 +0200 Subject: [PATCH 238/345] [PWGDQ] Addition of process function and fillmaps for flow-analysis (#12179) Co-authored-by: ALICE Action Bot --- PWGDQ/Tasks/tableReader_withAssoc.cxx | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/PWGDQ/Tasks/tableReader_withAssoc.cxx b/PWGDQ/Tasks/tableReader_withAssoc.cxx index 139476d3b71..75c82025776 100644 --- a/PWGDQ/Tasks/tableReader_withAssoc.cxx +++ b/PWGDQ/Tasks/tableReader_withAssoc.cxx @@ -179,6 +179,7 @@ DECLARE_SOA_TABLE(JPsieeCandidates, "AOD", "DQPSEUDOPROPER", dqanalysisflags::Ma // Declarations of various short names using MyEvents = soa::Join; using MyEventsMultExtra = soa::Join; +using MyEventsMultExtraQVector = soa::Join; using MyEventsZdc = soa::Join; using MyEventsMultExtraZdc = soa::Join; using MyEventsSelected = soa::Join; @@ -187,7 +188,8 @@ using MyEventsVtxCovSelectedMultExtra = soa::Join; using MyEventsVtxCov = soa::Join; using MyEventsVtxCovSelected = soa::Join; -using MyEventsVtxCovSelectedQvector = soa::Join; +using MyEventsVtxCovSelectedQvector = soa::Join; +using MyEventsVtxCovSelectedQvectorWithHash = soa::Join; using MyEventsVtxCovZdcSelected = soa::Join; using MyEventsVtxCovZdcSelectedMultExtra = soa::Join; using MyEventsQvector = soa::Join; @@ -212,8 +214,11 @@ using MyMuonTracksSelectedWithColl = soa::Join("processAllSkimmed") || context.mOptions.get("processBarrelOnlySkimmed") || context.mOptions.get("processBarrelOnlyWithCollSkimmed") || context.mOptions.get("processBarrelOnlySkimmedNoCov") || context.mOptions.get("processBarrelOnlySkimmedNoCovWithMultExtra") || context.mOptions.get("processBarrelOnlyWithQvectorCentrSkimmedNoCov"); - fEnableBarrelMixingHistos = context.mOptions.get("processMixingAllSkimmed") || context.mOptions.get("processMixingBarrelSkimmed"); + fEnableBarrelMixingHistos = context.mOptions.get("processMixingAllSkimmed") || context.mOptions.get("processMixingBarrelSkimmed") || context.mOptions.get("processMixingBarrelSkimmedFlow"); fEnableMuonHistos = context.mOptions.get("processAllSkimmed") || context.mOptions.get("processMuonOnlySkimmed") || context.mOptions.get("processMuonOnlySkimmedMultExtra") || context.mOptions.get("processMixingMuonSkimmed"); fEnableMuonMixingHistos = context.mOptions.get("processMixingAllSkimmed") || context.mOptions.get("processMixingMuonSkimmed"); @@ -2124,6 +2129,13 @@ struct AnalysisSameEventPairing { runSameEventPairing(events, trackAssocsPerCollision, barrelAssocs, barrelTracks); } + void processBarrelOnlySkimmedFlow(MyEventsVtxCovSelectedQvector const& events, + soa::Join const& barrelAssocs, + MyBarrelTracksWithAmbiguities const& barrelTracks) + { + runSameEventPairing(events, trackAssocsPerCollision, barrelAssocs, barrelTracks); + } + void processBarrelOnlySkimmedNoCov(MyEventsSelected const& events, soa::Join const& barrelAssocs, MyBarrelTracksWithAmbiguities const& barrelTracks) @@ -2178,6 +2190,12 @@ struct AnalysisSameEventPairing { runSameSideMixing(events, trackAssocs, tracks, trackAssocsPerCollision); } + void processMixingBarrelSkimmedFlow(soa::Filtered& events, + soa::Join const& trackAssocs, aod::ReducedTracks const& tracks) + { + runSameSideMixing(events, trackAssocs, tracks, trackAssocsPerCollision); + } + void processMixingMuonSkimmed(soa::Filtered& events, soa::Join const& muonAssocs, MyMuonTracksWithCovWithAmbiguities const& muons) { @@ -2195,10 +2213,12 @@ struct AnalysisSameEventPairing { PROCESS_SWITCH(AnalysisSameEventPairing, processBarrelOnlySkimmedNoCov, "Run barrel only pairing (no covariances), with skimmed tracks and with collision information", false); PROCESS_SWITCH(AnalysisSameEventPairing, processBarrelOnlySkimmedNoCovWithMultExtra, "Run barrel only pairing (no covariances), with skimmed tracks, with collision information, with MultsExtra", false); PROCESS_SWITCH(AnalysisSameEventPairing, processBarrelOnlyWithQvectorCentrSkimmedNoCov, "Run barrel only pairing (no covariances), with skimmed tracks, with Qvector from central framework", false); + PROCESS_SWITCH(AnalysisSameEventPairing, processBarrelOnlySkimmedFlow, "Run barrel only pairing, with skimmed tracks and with flow", false); PROCESS_SWITCH(AnalysisSameEventPairing, processMuonOnlySkimmed, "Run muon only pairing, with skimmed tracks", false); PROCESS_SWITCH(AnalysisSameEventPairing, processMuonOnlySkimmedMultExtra, "Run muon only pairing, with skimmed tracks", false); PROCESS_SWITCH(AnalysisSameEventPairing, processMixingAllSkimmed, "Run all types of mixed pairing, with skimmed tracks/muons", false); PROCESS_SWITCH(AnalysisSameEventPairing, processMixingBarrelSkimmed, "Run barrel type mixing pairing, with skimmed tracks", false); + PROCESS_SWITCH(AnalysisSameEventPairing, processMixingBarrelSkimmedFlow, "Run barrel type mixing pairing, with flow, with skimmed tracks", false); PROCESS_SWITCH(AnalysisSameEventPairing, processMixingMuonSkimmed, "Run muon type mixing pairing, with skimmed muons", false); PROCESS_SWITCH(AnalysisSameEventPairing, processDummy, "Dummy function, enabled only if none of the others are enabled", false); }; From d10ee914a43303be8dc88f71283d7f75388a37c5 Mon Sep 17 00:00:00 2001 From: omvazque Date: Tue, 5 Aug 2025 13:12:34 -0500 Subject: [PATCH 239/345] [PWGLF] More histograms Nch vs T0M and V0A (Poisson samp) (#12430) --- PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx | 44 ++++++++++++-------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx b/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx index cc56b8fe550..23068352cf6 100644 --- a/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx @@ -69,8 +69,9 @@ using SimTracks = soa::Join, kSizeBootStrapEnsemble> hNch{}; std::array, kSizeBootStrapEnsemble> hPoisson{}; +std::array, kSizeBootStrapEnsemble> hNchVsT0M{}; +std::array, kSizeBootStrapEnsemble> hNchVsV0A{}; std::array, kSizeBootStrapEnsemble> pNchVsOneParCorrVsZN{}; std::array, kSizeBootStrapEnsemble> pNchVsTwoParCorrVsZN{}; std::array, kSizeBootStrapEnsemble> pNchVsThreeParCorrVsZN{}; @@ -89,6 +90,7 @@ std::array, kSizeBootStrapEnsemble> pThreeParCorrVsNch std::array, kSizeBootStrapEnsemble> hPoissonMC{}; std::array, kSizeBootStrapEnsemble> hNchGen{}; +std::array, kSizeBootStrapEnsemble> hNch{}; // std::array, kSizeBootStrapEnsemble> pOneParCorrVsT0MGen{}; // std::array, kSizeBootStrapEnsemble> pTwoParCorrVsT0MGen{}; @@ -293,7 +295,8 @@ struct UccZdc { registry.add("ThreeParCorrVsV0A", Form(";%s;%s;", tiV0A, tiThreeParCorr), kTProfile, {{nBinsAmpV0A, 0., maxAmpV0A}}); for (int i = 0; i < kSizeBootStrapEnsemble; i++) { - hNch[i] = registry.add(Form("Nch_Replica%d", i), Form(";%s;Entries", tiNch), kTH1F, {{nBinsNch, minNch, maxNch}}); + hNchVsV0A[i] = registry.add(Form("NchVsV0A_Replica%d", i), Form(";%s;%s", tiNch, tiV0A), kTH2F, {{{nBinsNch, minNch, maxNch}, {nBinsAmpV0A, 0., maxAmpV0A}}}); + hNchVsT0M[i] = registry.add(Form("NchVsT0M_Replica%d", i), Form(";%s;%s", tiNch, tiT0M), kTH2F, {{{nBinsNch, minNch, maxNch}, {nBinsAmpFT0, 0., maxAmpFT0}}}); hPoisson[i] = registry.add(Form("Poisson_Replica%d", i), ";#it{k};Entries", kTH1F, {{11, -0.5, 10.5}}); pNchVsOneParCorrVsZN[i] = registry.add(Form("NchVsOneParCorrVsZN_Replica%d", i), Form(";%s;%s;%s", tiNch, tiZNs, tiOneParCorr), kTProfile2D, {{{nBinsNch, minNch, maxNch}, {nBinsZN, minZN, maxZN}}}); pNchVsTwoParCorrVsZN[i] = registry.add(Form("NchVsTwoParCorrVsZN_Replica%d", i), Form(";%s;%s;%s", tiNch, tiZNs, tiTwoParCorr), kTProfile2D, {{{nBinsNch, minNch, maxNch}, {nBinsZN, minZN, maxZN}}}); @@ -359,7 +362,6 @@ struct UccZdc { hPoissonMC[i] = registry.add(Form("PoissonMC_Replica%d", i), ";#it{k};Entries", kTH1F, {{11, -0.5, 10.5}}); hNchGen[i] = registry.add(Form("NchGen_Replica%d", i), Form(";%s;Entries", tiNch), kTH1F, {{nBinsNch, minNch, maxNch}}); - pOneParCorrVsNchGen[i] = registry.add(Form("OneParCorrVsNchGen_Replica%d", i), Form(";%s;%s;", tiNch, tiOneParCorr), kTProfile, {{nBinsNch, minNch, maxNch}}); pTwoParCorrVsNchGen[i] = registry.add(Form("TwoParCorrVsNchGen_Replica%d", i), Form(";%s;%s;", tiNch, tiTwoParCorr), kTProfile, {{nBinsNch, minNch, maxNch}}); pThreeParCorrVsNchGen[i] = registry.add(Form("ThreeParCorrVsNchGen_Replica%d", i), Form(";%s;%s;", tiNch, tiThreeParCorr), kTProfile, {{nBinsNch, minNch, maxNch}}); @@ -778,7 +780,7 @@ struct UccZdc { } // Nch-based selection - int glbTracks{0}; + double glbTracks{0.0}; for (const auto& track : tracks) { // Track Selection if (!track.isGlobalTrack()) { @@ -790,11 +792,7 @@ struct UccZdc { if ((track.eta() < minEta) || (track.eta() > maxEta)) { continue; } - glbTracks++; - } - - if (glbTracks < minNchSel) { - return; + glbTracks += 1.0; } bool skipEvent{false}; @@ -831,10 +829,15 @@ struct UccZdc { return; } - double nchMult{static_cast(glbTracks)}; - std::vector pTs; - std::vector vecFD; - std::vector vecEff; + // Reject low-multiplcicity events + if (glbTracks < minNchSel) { + return; + } + + double nchMult{glbTracks}; + std::vector pTs; + std::vector vecFD; + std::vector vecEff; // apply corrections if (applyEff || applyFD) { @@ -871,8 +874,14 @@ struct UccZdc { } } - if (applyEff && !correctNch) - nchMult = static_cast(glbTracks); + if (applyEff && !correctNch) { + nchMult = glbTracks; + } + + // Reject low-multiplcicity events + if (nchMult < minNchSel) { + return; + } // Fill vectors for [pT] measurement for (const auto& track : tracks) { @@ -1432,7 +1441,6 @@ struct UccZdc { const double threeParCorr{numThreeParCorr / denThreeParCorr}; hNchGen[replica]->Fill(nchMult); - pOneParCorrVsNchGen[replica]->Fill(nchMult, oneParCorr, w1); pTwoParCorrVsNchGen[replica]->Fill(nchMult, twoParCorr, denTwoParCorr); pThreeParCorrVsNchGen[replica]->Fill(nchMult, threeParCorr, denThreeParCorr); @@ -1584,7 +1592,6 @@ struct UccZdc { const double threeParCorr{numThreeParCorr / denThreeParCorr}; hNch[replica]->Fill(nchMult); - pOneParCorrVsNch[replica]->Fill(nchMult, oneParCorr, w1); pTwoParCorrVsNch[replica]->Fill(nchMult, twoParCorr, denTwoParCorr); pThreeParCorrVsNch[replica]->Fill(nchMult, threeParCorr, denThreeParCorr); @@ -1740,7 +1747,8 @@ struct UccZdc { const double numThreeParCorr{std::pow(p1, 3.) - 3. * p2 * p1 + 2. * p3}; const double threeParCorr{numThreeParCorr / denThreeParCorr}; - hNch[replica]->Fill(nchMult); + hNchVsV0A[replica]->Fill(nchMult, normV0A); + hNchVsT0M[replica]->Fill(nchMult, normT0M); pNchVsOneParCorrVsZN[replica]->Fill(nchMult, sumZNs, oneParCorr, w1); pNchVsTwoParCorrVsZN[replica]->Fill(nchMult, sumZNs, twoParCorr, denTwoParCorr); pNchVsThreeParCorrVsZN[replica]->Fill(nchMult, sumZNs, threeParCorr, denThreeParCorr); From 110dd4235bdf1e6a741102a8ea92479fe7793d6f Mon Sep 17 00:00:00 2001 From: Jseo <47848181+JinjooSeo@users.noreply.github.com> Date: Tue, 5 Aug 2025 21:04:20 +0200 Subject: [PATCH 240/345] [PWGDQ] ML response for DQ-analysis selections (#12169) Co-authored-by: Jinjoo Seo --- PWGDQ/Core/CMakeLists.txt | 2 +- PWGDQ/Core/CutsLibrary.cxx | 242 +++++++++++++++++++++++++- PWGDQ/Core/CutsLibrary.h | 42 ++++- PWGDQ/Core/DQMlResponse.h | 239 +++++++++++++++++++++++++ PWGDQ/Core/VarManager.cxx | 9 + PWGDQ/Core/VarManager.h | 27 +++ PWGDQ/Macros/bdtCut.json | 89 ++++++++++ PWGDQ/Macros/bdtCutMulti.json | 129 ++++++++++++++ PWGDQ/Tasks/CMakeLists.txt | 6 +- PWGDQ/Tasks/tableReader.cxx | 101 +++++++++++ PWGDQ/Tasks/tableReader_withAssoc.cxx | 102 +++++++++++ 11 files changed, 976 insertions(+), 12 deletions(-) create mode 100644 PWGDQ/Core/DQMlResponse.h create mode 100644 PWGDQ/Macros/bdtCut.json create mode 100644 PWGDQ/Macros/bdtCutMulti.json diff --git a/PWGDQ/Core/CMakeLists.txt b/PWGDQ/Core/CMakeLists.txt index d19a66a68e6..41ceb661bf9 100644 --- a/PWGDQ/Core/CMakeLists.txt +++ b/PWGDQ/Core/CMakeLists.txt @@ -21,7 +21,7 @@ o2physics_add_library(PWGDQCore AnalysisCompositeCut.cxx MCProng.cxx MCSignal.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2::DCAFitter O2::GlobalTracking O2Physics::AnalysisCore KFParticle::KFParticle) + PUBLIC_LINK_LIBRARIES O2::Framework O2::DCAFitter O2::GlobalTracking O2Physics::AnalysisCore KFParticle::KFParticle O2Physics::MLCore) o2physics_target_root_dictionary(PWGDQCore HEADERS AnalysisCut.h diff --git a/PWGDQ/Core/CutsLibrary.cxx b/PWGDQ/Core/CutsLibrary.cxx index 5cf99d6f22f..14d8b6aa256 100644 --- a/PWGDQ/Core/CutsLibrary.cxx +++ b/PWGDQ/Core/CutsLibrary.cxx @@ -12,14 +12,19 @@ // Contact: iarsene@cern.ch, i.c.arsene@fys.uio.no // #include "PWGDQ/Core/CutsLibrary.h" -#include -#include -#include -#include -#include + #include "AnalysisCompositeCut.h" #include "VarManager.h" +#include + +#include + +#include +#include +#include +#include + using std::cout; using std::endl; @@ -7100,3 +7105,230 @@ AnalysisCompositeCut* o2::aod::dqcuts::ParseJSONAnalysisCompositeCut(T cut, cons return retCut; } + +//________________________________________________________________________________________________ +o2::aod::dqmlcuts::BdtScoreConfig o2::aod::dqmlcuts::GetBdtScoreCutsAndConfigFromJSON(const char* json) +{ + LOG(info) << "========================================== interpreting JSON for ML analysis cuts"; + if (!json) { + LOG(fatal) << "JSON config string is null!"; + return {}; + } + LOG(info) << "JSON string: " << json; + + rapidjson::Document document; + + // Check that the json is parsed correctly + rapidjson::ParseResult ok = document.Parse(json); + if (!ok) { + LOG(fatal) << "JSON parse error: " << rapidjson::GetParseErrorFunc(ok.Code()) << " (" << ok.Offset() << ")"; + return {}; + } + + for (auto it = document.MemberBegin(); it != document.MemberEnd(); ++it) { + const auto& obj = it->value; + + // Classification type + if (!obj.HasMember("type")) { + LOG(fatal) << "Missing type (Binary/MultiClass)"; + return {}; + } + TString typeStr = obj["type"].GetString(); + if (typeStr != "Binary" && typeStr != "MultiClass") { + LOG(fatal) << "Unsupported classification type: " << typeStr; + return {}; + } + + // Input features + if (!obj.HasMember("inputFeatures") || !obj["inputFeatures"].IsArray()) { + LOG(fatal) << "Missing inputFeatures member or array"; + return {}; + } + std::vector namesInputFeatures; + for (const auto& feature : obj["inputFeatures"].GetArray()) { + namesInputFeatures.emplace_back(feature.GetString()); + LOG(debug) << "Input features: " << feature.GetString(); + } + + // Model files + if (!obj.HasMember("modelFiles") || !obj["modelFiles"].IsArray()) { + LOG(fatal) << "Missing modelFiles member or array"; + return {}; + } + std::vector onnxFileNames; + for (const auto& model : obj["modelFiles"].GetArray()) { + onnxFileNames.emplace_back(model.GetString()); + LOG(debug) << "Model Files: " << model.GetString() << " "; + } + + // Centrality estimation type + if (!obj.HasMember("cent") || !obj["cent"].IsString()) { + LOG(fatal) << "Missing cent member"; + return {}; + } + std::string cent = obj["cent"].GetString(); + LOG(debug) << "Centrality type: " << cent; + if (cent != "kCentFT0C" && cent != "kCentFT0A" && cent != "kCentFT0M") { + LOG(fatal) << "Unsupported centrality type: " << cent; + return {}; + } + + // Cut storage + std::vector> centBins; + std::vector> ptBins; + std::vector> cutsMl; + std::vector cutDirs; + std::vector labelsFlatBin; + bool cutDirsFilled = false; + + for (auto centMember = obj.MemberBegin(); centMember != obj.MemberEnd(); ++centMember) { + TString centKey = centMember->name.GetString(); + if (!centKey.Contains("AddCentCut")) + continue; + + const auto& centCut = centMember->value; + + // Centrality info + if (!centCut.HasMember("centMin") || !centCut.HasMember("centMax")) { + LOG(fatal) << "Missing centMin/centMax in " << centKey; + return {}; + } + double centMin = centCut["centMin"].GetDouble(); + double centMax = centCut["centMax"].GetDouble(); + + for (auto ptMember = centCut.MemberBegin(); ptMember != centCut.MemberEnd(); ++ptMember) { + TString ptKey = ptMember->name.GetString(); + if (!ptKey.Contains("AddPtCut")) + continue; + + const auto& ptCut = ptMember->value; + + // Pt info + if (!ptCut.HasMember("pTMin") || !ptCut.HasMember("pTMax")) { + LOG(fatal) << "Missing pTMin/pTMax in " << ptKey; + return {}; + } + + double ptMin = ptCut["pTMin"].GetDouble(); + double ptMax = ptCut["pTMax"].GetDouble(); + + std::vector binCuts; + bool exclude = false; + + for (auto mlMember = ptCut.MemberBegin(); mlMember != ptCut.MemberEnd(); ++mlMember) { + TString mlKey = mlMember->name.GetString(); + if (!mlKey.Contains("AddMLCut")) + continue; + + const auto& mlcut = mlMember->value; + + if (!mlcut.HasMember("cut")) { + LOG(fatal) << "Missing cut (score) in " << mlKey; + return {}; + } + + double cutVal = mlcut["cut"].GetDouble(); + exclude = mlcut.HasMember("exclude") ? mlcut["exclude"].GetBool() : false; + + binCuts.push_back(cutVal); + + if (!cutDirsFilled) { + cutDirs.push_back(exclude ? 0 : 1); + } + } + + if (!cutDirsFilled) { + cutDirsFilled = true; + } + + centBins.emplace_back(centMin, centMax); + ptBins.emplace_back(ptMin, ptMax); + cutsMl.push_back(binCuts); + labelsFlatBin.push_back(Form("%s_cent%.0f_%.0f_pt%.1f_%.1f", cent.c_str(), centMin, centMax, ptMin, ptMax)); + LOG(info) << "Added cut for " << Form("%s_cent%.0f_%.0f_pt%.1f_%.1f", cent.c_str(), centMin, centMax, ptMin, ptMax) << " with cuts: ["; + for (size_t i = 0; i < binCuts.size(); ++i) { + std::cout << binCuts[i]; + if (i != binCuts.size() - 1) + std::cout << ", "; + } + std::cout << "] and direction: " << (exclude ? "CutGreater" : "CutSmaller") << std::endl; + } + } + + if (cutDirs.size() != cutsMl[0].size()) { + LOG(fatal) << "Mismatch the cut size and direction size: cutsMl[0].size() = " << cutsMl[0].size() + << ", cutsMl[0].size() = " << cutDirs.size(); + return {}; + } + + std::vector labelsClass; + for (size_t j = 0; j < cutsMl[0].size(); ++j) { + labelsClass.push_back(Form("score class %d", static_cast(j))); + } + + size_t nFlatBins = cutsMl.size(); + std::vector binsMl(nFlatBins + 1); + std::iota(binsMl.begin(), binsMl.end(), 0); + + // Binary + if (typeStr == "Binary") { + dqmlcuts::BinaryBdtScoreConfig binaryCfg; + binaryCfg.inputFeatures = namesInputFeatures; + binaryCfg.onnxFiles = onnxFileNames; + binaryCfg.binsCent = centBins; + binaryCfg.binsPt = ptBins; + binaryCfg.binsMl = binsMl; + binaryCfg.cutDirs = cutDirs; + binaryCfg.centType = cent; + binaryCfg.cutsMl = makeLabeledCutsMl(cutsMl, labelsFlatBin, labelsClass); + + return binaryCfg; + + // MultiClass + } else if (typeStr == "MultiClass") { + dqmlcuts::MultiClassBdtScoreConfig multiCfg; + multiCfg.inputFeatures = namesInputFeatures; + multiCfg.onnxFiles = onnxFileNames; + multiCfg.binsCent = centBins; + multiCfg.binsPt = ptBins; + multiCfg.binsMl = binsMl; + multiCfg.cutDirs = cutDirs; + multiCfg.centType = cent; + multiCfg.cutsMl = makeLabeledCutsMl(cutsMl, labelsFlatBin, labelsClass); + + return multiCfg; + } + } + + return {}; +} + +o2::framework::LabeledArray o2::aod::dqmlcuts::makeLabeledCutsMl(const std::vector>& cuts, + const std::vector& labelsflatBin, + const std::vector& labelsClass) +{ + const size_t nRows = cuts.size(); + const size_t nCols = cuts.empty() ? 0 : cuts[0].size(); + std::vector flat; + + for (const auto& row : cuts) { + flat.insert(flat.end(), row.begin(), row.end()); + } + + o2::framework::Array2D arr(flat.data(), nRows, nCols); + return o2::framework::LabeledArray(arr, labelsflatBin, labelsClass); +} + +int o2::aod::dqmlcuts::getMlBinIndex(double cent, double pt, + const std::vector>& binsCent, + const std::vector>& binsPt) +{ + LOG(debug) << "Searching for Ml bin index for cent: " << cent << ", pt: " << pt; + for (size_t i = 0; i < binsCent.size(); ++i) { + if (cent >= binsCent[i].first && cent < binsCent[i].second && pt >= binsPt[i].first && pt < binsPt[i].second) { + LOG(debug) << " - Found at index: " << i; + return static_cast(i); + } + } + return -1; // not found +} diff --git a/PWGDQ/Core/CutsLibrary.h b/PWGDQ/Core/CutsLibrary.h index c6ad4caded2..b38577f3c2b 100644 --- a/PWGDQ/Core/CutsLibrary.h +++ b/PWGDQ/Core/CutsLibrary.h @@ -15,12 +15,13 @@ #ifndef PWGDQ_CORE_CUTSLIBRARY_H_ #define PWGDQ_CORE_CUTSLIBRARY_H_ -#include -#include -#include "PWGDQ/Core/AnalysisCut.h" #include "PWGDQ/Core/AnalysisCompositeCut.h" +#include "PWGDQ/Core/AnalysisCut.h" #include "PWGDQ/Core/VarManager.h" +#include +#include + // /////////////////////////////////////////////// // These are the Cuts used in the CEFP Task // // to select tracks in the event selection // @@ -119,6 +120,41 @@ bool ValidateJSONAnalysisCompositeCut(T cut); template AnalysisCompositeCut* ParseJSONAnalysisCompositeCut(T key, const char* cutName); } // namespace dqcuts +namespace dqmlcuts +{ +struct BinaryBdtScoreConfig { + std::vector inputFeatures; + std::vector onnxFiles; + std::vector> binsCent; // bins for centrality + std::vector> binsPt; // bins for pT + std::vector binsMl; // bins for flattened binning + std::string centType; + o2::framework::LabeledArray cutsMl; // BDT score cuts for each bin + std::vector cutDirs; // direction of the cuts on the BDT score +}; + +struct MultiClassBdtScoreConfig { + std::vector inputFeatures; + std::vector onnxFiles; + std::vector> binsCent; + std::vector> binsPt; + std::vector binsMl; + std::string centType; + o2::framework::LabeledArray cutsMl; + std::vector cutDirs; +}; + +using BdtScoreConfig = std::variant; + +BdtScoreConfig GetBdtScoreCutsAndConfigFromJSON(const char* json); + +o2::framework::LabeledArray makeLabeledCutsMl(const std::vector>& cuts, + const std::vector& labelsPt, + const std::vector& labelsClass); +int getMlBinIndex(double cent, double pt, + const std::vector>& binsCent, + const std::vector>& binsPt); +} // namespace dqmlcuts } // namespace o2::aod AnalysisCompositeCut* o2::aod::dqcuts::GetCompositeCut(const char* cutName); diff --git a/PWGDQ/Core/DQMlResponse.h b/PWGDQ/Core/DQMlResponse.h new file mode 100644 index 00000000000..64bfe233cc7 --- /dev/null +++ b/PWGDQ/Core/DQMlResponse.h @@ -0,0 +1,239 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// +// Contact: jseo@cern.ch +// +// Class to compute the ML response for DQ-analysis selections +// + +#ifndef PWGDQ_CORE_DQMLRESPONSE_H_ +#define PWGDQ_CORE_DQMLRESPONSE_H_ + +#include "Tools/ML/MlResponse.h" + +#include +#include +#include +#include + +namespace o2::analysis +{ + +enum class InputFeatures : uint8_t { // refer to DielectronsAll, TODO: add more features if needed + kMass = 0, + kPt, + kEta, + kPhi, + kPt1, + kITSChi2NCl1, + kTPCNClsCR1, + kTPCNClsFound1, + kTPCChi2NCl1, + kDcaXY1, + kDcaZ1, + kTPCNSigmaEl1, + kTPCNSigmaPi1, + kTPCNSigmaPr1, + kTOFNSigmaEl1, + kTOFNSigmaPi1, + kTOFNSigmaPr1, + kPt2, + kITSChi2NCl2, + kTPCNClsCR2, + kTPCNClsFound2, + kTPCChi2NCl2, + kDcaXY2, + kDcaZ2, + kTPCNSigmaEl2, + kTPCNSigmaPi2, + kTPCNSigmaPr2, + kTOFNSigmaEl2, + kTOFNSigmaPi2, + kTOFNSigmaPr2 +}; + +static const std::map gFeatureNameMap = { + {InputFeatures::kMass, "kMass"}, + {InputFeatures::kPt, "kPt"}, + {InputFeatures::kEta, "kEta"}, + {InputFeatures::kPhi, "kPhi"}, + {InputFeatures::kPt1, "kPt1"}, + {InputFeatures::kITSChi2NCl1, "kITSChi2NCl1"}, + {InputFeatures::kTPCNClsCR1, "kTPCNClsCR1"}, + {InputFeatures::kTPCNClsFound1, "kTPCNClsFound1"}, + {InputFeatures::kTPCChi2NCl1, "kTPCChi2NCl1"}, + {InputFeatures::kDcaXY1, "kDcaXY1"}, + {InputFeatures::kDcaZ1, "kDcaZ1"}, + {InputFeatures::kTPCNSigmaEl1, "kTPCNSigmaEl1"}, + {InputFeatures::kTPCNSigmaPi1, "kTPCNSigmaPi1"}, + {InputFeatures::kTPCNSigmaPr1, "kTPCNSigmaPr1"}, + {InputFeatures::kTOFNSigmaEl1, "kTOFNSigmaEl1"}, + {InputFeatures::kTOFNSigmaPi1, "kTOFNSigmaPi1"}, + {InputFeatures::kTOFNSigmaPr1, "kTOFNSigmaPr1"}, + {InputFeatures::kPt2, "kPt2"}, + {InputFeatures::kITSChi2NCl2, "kITSChi2NCl2"}, + {InputFeatures::kTPCNClsCR2, "kTPCNClsCR2"}, + {InputFeatures::kTPCNClsFound2, "kTPCNClsFound2"}, + {InputFeatures::kTPCChi2NCl2, "kTPCChi2NCl2"}, + {InputFeatures::kDcaXY2, "kDcaXY2"}, + {InputFeatures::kDcaZ2, "kDcaZ2"}, + {InputFeatures::kTPCNSigmaEl2, "kTPCNSigmaEl2"}, + {InputFeatures::kTPCNSigmaPi2, "kTPCNSigmaPi2"}, + {InputFeatures::kTPCNSigmaPr2, "kTPCNSigmaPr2"}, + {InputFeatures::kTOFNSigmaEl2, "kTOFNSigmaEl2"}, + {InputFeatures::kTOFNSigmaPi2, "kTOFNSigmaPi2"}, + {InputFeatures::kTOFNSigmaPr2, "kTOFNSigmaPr2"}}; + +template +class DQMlResponse : public MlResponse +{ + public: + DQMlResponse() = default; + virtual ~DQMlResponse() = default; + + void setBinsCent(const std::vector>& bins) { binsCent = bins; } + void setBinsPt(const std::vector>& bins) { binsPt = bins; } + void setCentType(std::string& type) { centType = type; } + + const std::vector>& getBinsCent() const { return binsCent; } + const std::vector>& getBinsPt() const { return binsPt; } + const std::string& getCentType() const { return centType; } + + /// Method to get the input features vector needed for ML inference + /// \return inputFeatures vector + template + std::vector getInputFeatures(const T1& t1, + const T2& t2, + const TValues& fg) const + { + std::vector dqInputFeatures; + dqInputFeatures.reserve(MlResponse::mCachedIndices.size()); + + for (auto idx : MlResponse::mCachedIndices) { + auto enumIdx = static_cast(idx); + auto mapIdx = gFeatureNameMap.find(enumIdx); + if (mapIdx == gFeatureNameMap.end()) { + LOG(fatal) << "Unknown InputFeatures index: " << static_cast(enumIdx); + } + + const auto& name = mapIdx->second; + if (name == "kMass") { + dqInputFeatures.push_back(fg[VarManager::fgVarNamesMap["kMass"]]); + } else if (name == "kPt") { + dqInputFeatures.push_back(fg[VarManager::fgVarNamesMap["kPt"]]); + } else if (name == "kEta") { + dqInputFeatures.push_back(fg[VarManager::fgVarNamesMap["kEta"]]); + } else if (name == "kPhi") { + dqInputFeatures.push_back(fg[VarManager::fgVarNamesMap["kPhi"]]); + } else if (name == "kPt1") { + dqInputFeatures.push_back(t1.pt()); + } else if (name == "kITSChi2NCl1") { + dqInputFeatures.push_back(t1.itsChi2NCl()); + } else if (name == "kTPCNClsCR1") { + dqInputFeatures.push_back(t1.tpcNClsCrossedRows()); + } else if (name == "kTPCNClsFound1") { + dqInputFeatures.push_back(t1.tpcNClsFound()); + } else if (name == "kTPCChi2NCl1") { + dqInputFeatures.push_back(t1.tpcChi2NCl()); + } else if (name == "kDcaXY1") { + dqInputFeatures.push_back(t1.dcaXY()); + } else if (name == "kDcaZ1") { + dqInputFeatures.push_back(t1.dcaZ()); + } else if (name == "kTPCNSigmaEl1") { + dqInputFeatures.push_back(t1.tpcNSigmaEl()); + } else if (name == "kTPCNSigmaPi1") { + dqInputFeatures.push_back(t1.tpcNSigmaPi()); + } else if (name == "kTPCNSigmaPr1") { + dqInputFeatures.push_back(t1.tpcNSigmaPr()); + } else if (name == "kTOFNSigmaEl1") { + dqInputFeatures.push_back(t1.tofNSigmaEl()); + } else if (name == "kTOFNSigmaPi1") { + dqInputFeatures.push_back(t1.tofNSigmaPi()); + } else if (name == "kTOFNSigmaPr1") { + dqInputFeatures.push_back(t1.tofNSigmaPr()); + } else if (name == "kPt2") { + dqInputFeatures.push_back(t2.pt()); + } else if (name == "kITSChi2NCl2") { + dqInputFeatures.push_back(t2.itsChi2NCl()); + } else if (name == "kTPCNClsCR2") { + dqInputFeatures.push_back(t2.tpcNClsCrossedRows()); + } else if (name == "kTPCNClsFound2") { + dqInputFeatures.push_back(t2.tpcNClsFound()); + } else if (name == "kTPCChi2NCl2") { + dqInputFeatures.push_back(t2.tpcChi2NCl()); + } else if (name == "kDcaXY2") { + dqInputFeatures.push_back(t2.dcaXY()); + } else if (name == "kDcaZ2") { + dqInputFeatures.push_back(t2.dcaZ()); + } else if (name == "kTPCNSigmaEl2") { + dqInputFeatures.push_back(t2.tpcNSigmaEl()); + } else if (name == "kTPCNSigmaPi2") { + dqInputFeatures.push_back(t2.tpcNSigmaPi()); + } else if (name == "kTPCNSigmaPr2") { + dqInputFeatures.push_back(t2.tpcNSigmaPr()); + } else if (name == "kTOFNSigmaEl2") { + dqInputFeatures.push_back(t2.tofNSigmaEl()); + } else if (name == "kTOFNSigmaPi2") { + dqInputFeatures.push_back(t2.tofNSigmaPi()); + } else if (name == "kTOFNSigmaPr2") { + dqInputFeatures.push_back(t2.tofNSigmaPr()); + } else { + LOG(fatal) << "Missing accessor for feature: " << name; + } + } + LOG(debug) << "Total features collected: " << dqInputFeatures.size(); + return dqInputFeatures; + } + + protected: + std::vector> binsCent; + std::vector> binsPt; + std::string centType; + + void setAvailableInputFeatures() + { + MlResponse::mAvailableInputFeatures = { + {"kMass", static_cast(InputFeatures::kMass)}, + {"kPt", static_cast(InputFeatures::kPt)}, + {"kEta", static_cast(InputFeatures::kEta)}, + {"kPhi", static_cast(InputFeatures::kPhi)}, + {"kPt1", static_cast(InputFeatures::kPt1)}, + {"kITSChi2NCl1", static_cast(InputFeatures::kITSChi2NCl1)}, + {"kTPCNClsCR1", static_cast(InputFeatures::kTPCNClsCR1)}, + {"kTPCNClsFound1", static_cast(InputFeatures::kTPCNClsFound1)}, + {"kTPCChi2NCl1", static_cast(InputFeatures::kTPCChi2NCl1)}, + {"kDcaXY1", static_cast(InputFeatures::kDcaXY1)}, + {"kDcaZ1", static_cast(InputFeatures::kDcaZ1)}, + {"kTPCNSigmaEl1", static_cast(InputFeatures::kTPCNSigmaEl1)}, + {"kTPCNSigmaPi1", static_cast(InputFeatures::kTPCNSigmaPi1)}, + {"kTPCNSigmaPr1", static_cast(InputFeatures::kTPCNSigmaPr1)}, + {"kTOFNSigmaEl1", static_cast(InputFeatures::kTOFNSigmaEl1)}, + {"kTOFNSigmaPi1", static_cast(InputFeatures::kTOFNSigmaPi1)}, + {"kTOFNSigmaPr1", static_cast(InputFeatures::kTOFNSigmaPr1)}, + {"kPt2", static_cast(InputFeatures::kPt2)}, + {"kITSChi2NCl2", static_cast(InputFeatures::kITSChi2NCl2)}, + {"kTPCNClsCR2", static_cast(InputFeatures::kTPCNClsCR2)}, + {"kTPCNClsFound2", static_cast(InputFeatures::kTPCNClsFound2)}, + {"kTPCChi2NCl2", static_cast(InputFeatures::kTPCChi2NCl2)}, + {"kDcaXY2", static_cast(InputFeatures::kDcaXY2)}, + {"kDcaZ2", static_cast(InputFeatures::kDcaZ2)}, + {"kTPCNSigmaEl2", static_cast(InputFeatures::kTPCNSigmaEl2)}, + {"kTPCNSigmaPi2", static_cast(InputFeatures::kTPCNSigmaPi2)}, + {"kTPCNSigmaPr2", static_cast(InputFeatures::kTPCNSigmaPr2)}, + {"kTOFNSigmaEl2", static_cast(InputFeatures::kTOFNSigmaEl2)}, + {"kTOFNSigmaPi2", static_cast(InputFeatures::kTOFNSigmaPi2)}, + {"kTOFNSigmaPr2", static_cast(InputFeatures::kTOFNSigmaPr2)}}; + } +}; + +} // namespace o2::analysis + +#endif // PWGDQ_CORE_DQMLRESPONSE_H_ diff --git a/PWGDQ/Core/VarManager.cxx b/PWGDQ/Core/VarManager.cxx index 912dc06740a..4bb8c419ad7 100644 --- a/PWGDQ/Core/VarManager.cxx +++ b/PWGDQ/Core/VarManager.cxx @@ -1131,6 +1131,12 @@ void VarManager::SetDefaultVarNames() fgVariableUnits[kS13] = "GeV^{2}/c^{4}"; fgVariableNames[kS23] = "m_{23}^{2}"; fgVariableUnits[kS23] = "GeV^{2}/c^{4}"; + fgVariableNames[kBdtBackground] = "kBdtBackground"; + fgVariableUnits[kBdtBackground] = " "; + fgVariableNames[kBdtPrompt] = "kBdtPrompt"; + fgVariableUnits[kBdtPrompt] = " "; + fgVariableNames[kBdtNonprompt] = "kBdtNonprompt"; + fgVariableUnits[kBdtNonprompt] = " "; // Set the variables short names map. This is needed for dynamic configuration via JSON files fgVarNamesMap["kNothing"] = kNothing; @@ -1770,4 +1776,7 @@ void VarManager::SetDefaultVarNames() fgVarNamesMap["kV24ME"] = kV24ME; fgVarNamesMap["kWV22ME"] = kWV22ME; fgVarNamesMap["kWV24ME"] = kWV24ME; + fgVarNamesMap["kBdtBackground"] = kBdtBackground; + fgVarNamesMap["kBdtPrompt"] = kBdtPrompt; + fgVarNamesMap["kBdtNonprompt"] = kBdtNonprompt; } diff --git a/PWGDQ/Core/VarManager.h b/PWGDQ/Core/VarManager.h index ec2ec55b83b..d49e71677da 100644 --- a/PWGDQ/Core/VarManager.h +++ b/PWGDQ/Core/VarManager.h @@ -855,6 +855,11 @@ class VarManager : public TObject // deltaMass_jpsi = kPairMass - kPairMassDau +3.096900 kDeltaMass_jpsi, + // BDT score + kBdtBackground, + kBdtPrompt, + kBdtNonprompt, + kNVars }; // end of Variables enumeration @@ -1127,6 +1132,8 @@ class VarManager : public TObject static void FillDileptonTrackTrackVertexing(C const& collision, T1 const& lepton1, T1 const& lepton2, T1 const& track1, T1 const& track2, float* values); template static void FillZDC(const T& zdc, float* values = nullptr); + template + static void FillBdtScore(const T& bdtScore, float* values = nullptr); static void SetCalibrationObject(CalibObjects calib, TObject* obj) { @@ -5524,4 +5531,24 @@ float VarManager::calculatePhiV(T1 const& t1, T2 const& t2) return pairPhiV; } +/// Fill BDT score values. +/// Supports binary (1 output) and multiclass (3 outputs) models. +template +void VarManager::FillBdtScore(T1 const& bdtScore, float* values) +{ + if (!values) { + values = fgValues; + } + + if (bdtScore.size() == 1) { + values[kBdtBackground] = bdtScore[0]; + } else if (bdtScore.size() == 3) { + values[kBdtBackground] = bdtScore[0]; + values[kBdtPrompt] = bdtScore[1]; + values[kBdtNonprompt] = bdtScore[2]; + } else { + LOG(warning) << "Unexpected number of BDT outputs: " << bdtScore.size(); + } +} + #endif // PWGDQ_CORE_VARMANAGER_H_ diff --git a/PWGDQ/Macros/bdtCut.json b/PWGDQ/Macros/bdtCut.json new file mode 100644 index 00000000000..2e015fa8618 --- /dev/null +++ b/PWGDQ/Macros/bdtCut.json @@ -0,0 +1,89 @@ +{ + "TestCut": { + "type": "Binary", + "title": "MyBDTModel", + "inputFeatures": [ + "kMass", + "kPt", + "kEta", + "kPhi", + "kPt1", + "kITSChi2NCl1", + "kTPCNClsCR1", + "kTPCNClsFound1", + "kTPCChi2NCl1", + "kDcaXY1", + "kDcaZ1", + "kTPCNSigmaEl1", + "kTPCNSigmaPi1", + "kTPCNSigmaPr1", + "kTOFNSigmaEl1", + "kTOFNSigmaPi1", + "kTOFNSigmaPr1", + "kPt2", + "kITSChi2NCl2", + "kTPCNClsCR2", + "kTPCNClsFound2", + "kTPCChi2NCl2", + "kDcaXY2", + "kDcaZ2", + "kTPCNSigmaEl2", + "kTPCNSigmaPi2", + "kTPCNSigmaPr2", + "kTOFNSigmaEl2", + "kTOFNSigmaPi2", + "kTOFNSigmaPr2" + ], + "modelFiles": [ + "cent_10_30_pt0_2_onnx.onnx", + "cent_10_30_pt2_20_onnx.onnx", + "cent_30_50_pt0_2_onnx.onnx", + "cent_30_50_pt2_20_onnx.onnx" + ], + "cent": "kCentFT0C", + "AddCentCut-Cent1030": { + "centMin": 10, + "centMax": 30, + "AddPtCut-pTBin1": { + "pTMin": 0, + "pTMax": 2, + "AddMLCut-background": { + "var": "kBdtBackground", + "cut": 0.5, + "exclude": false + } + }, + "AddPtCut-pTBin2": { + "pTMin": 2, + "pTMax": 20, + "AddMLCut-background": { + "var": "kBdtBackground", + "cut": 0.5, + "exclude": false + } + } + }, + "AddCentCut-Cent3050": { + "centMin": 30, + "centMax": 50, + "AddPtCut-pTBin1": { + "pTMin": 0, + "pTMax": 2, + "AddMLCut-background": { + "var": "kBdtBackground", + "cut": 0.5, + "exclude": false + } + }, + "AddPtCut-pTBin2": { + "pTMin": 2, + "pTMax": 20, + "AddMLCut-background": { + "var": "kBdtBackground", + "cut": 0.5, + "exclude": false + } + } + } + } +} diff --git a/PWGDQ/Macros/bdtCutMulti.json b/PWGDQ/Macros/bdtCutMulti.json new file mode 100644 index 00000000000..ba687e36200 --- /dev/null +++ b/PWGDQ/Macros/bdtCutMulti.json @@ -0,0 +1,129 @@ +{ + "TestCut": { + "type": "MultiClass", + "title": "MyBDTModel", + "inputFeatures": [ + "kMass", + "kPt", + "kEta", + "kPhi", + "kPt1", + "kITSChi2NCl1", + "kTPCNClsCR1", + "kTPCNClsFound1", + "kTPCChi2NCl1", + "kDcaXY1", + "kDcaZ1", + "kTPCNSigmaEl1", + "kTPCNSigmaPi1", + "kTPCNSigmaPr1", + "kTOFNSigmaEl1", + "kTOFNSigmaPi1", + "kTOFNSigmaPr1", + "kPt2", + "kITSChi2NCl2", + "kTPCNClsCR2", + "kTPCNClsFound2", + "kTPCChi2NCl2", + "kDcaXY2", + "kDcaZ2", + "kTPCNSigmaEl2", + "kTPCNSigmaPi2", + "kTPCNSigmaPr2", + "kTOFNSigmaEl2", + "kTOFNSigmaPi2", + "kTOFNSigmaPr2" + ], + "modelFiles": [ + "cent_10_30_pt_1_2_onnx.onnx", + "cent_10_30_pt_2_20_onnx.onnx", + "cent_30_50_pt_1_2_onnx.onnx", + "cent_30_50_pt_2_20_onnx.onnx" + ], + "cent": "kCentFT0C", + "AddCentCut-Cent1030": { + "centMin": 10, + "centMax": 30, + "AddPtCut-pTBin1": { + "pTMin": 1, + "pTMax": 2, + "AddMLCut-background": { + "var": "kBdtBackground", + "cut": 0.1, + "exclude": true + }, + "AddMLCut-prompt": { + "var": "kBdtPrompt", + "cut": 0.1, + "exclude": true + }, + "AddMLCut-nonprompt": { + "var": "kBdtNonprompt", + "cut": 0.5, + "exclude": false + } + }, + "AddPtCut-pTBin2": { + "pTMin": 2, + "pTMax": 20, + "AddMLCut-background": { + "var": "kBdtBackground", + "cut": 0.1, + "exclude": true + }, + "AddMLCut-prompt": { + "var": "kBdtPrompt", + "cut": 0.1, + "exclude": true + }, + "AddMLCut-nonprompt": { + "var": "kBdtNonprompt", + "cut": 0.5, + "exclude": false + } + } + }, + "AddCentCut-Cent3050": { + "centMin": 30, + "centMax": 50, + "AddPtCut-pTBin1": { + "pTMin": 1, + "pTMax": 2, + "AddMLCut-background": { + "var": "kBdtBackground", + "cut": 0.1, + "exclude": true + }, + "AddMLCut-prompt": { + "var": "kBdtPrompt", + "cut": 0.1, + "exclude": true + }, + "AddMLCut-nonprompt": { + "var": "kBdtNonprompt", + "cut": 0.5, + "exclude": false + } + }, + "AddPtCut-pTBin2": { + "pTMin": 2, + "pTMax": 20, + "AddMLCut-background": { + "var": "kBdtBackground", + "cut": 0.1, + "exclude": true + }, + "AddMLCut-prompt": { + "var": "kBdtPrompt", + "cut": 0.1, + "exclude": true + }, + "AddMLCut-nonprompt": { + "var": "kBdtNonprompt", + "cut": 0.5, + "exclude": false + } + } + } + } +} diff --git a/PWGDQ/Tasks/CMakeLists.txt b/PWGDQ/Tasks/CMakeLists.txt index 5095140a2b8..c3bb38bf955 100644 --- a/PWGDQ/Tasks/CMakeLists.txt +++ b/PWGDQ/Tasks/CMakeLists.txt @@ -11,12 +11,12 @@ o2physics_add_dpl_workflow(table-reader SOURCES tableReader.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGDQCore + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGDQCore O2Physics::MLCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(table-reader-with-assoc SOURCES tableReader_withAssoc.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2Physics::AnalysisCore O2Physics::AnalysisCCDB O2Physics::PWGDQCore + PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2Physics::AnalysisCore O2Physics::AnalysisCCDB O2Physics::PWGDQCore O2Physics::MLCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(efficiency @@ -127,4 +127,4 @@ o2physics_add_dpl_workflow(model-converter-event-extended o2physics_add_dpl_workflow(tag-and-probe SOURCES TagAndProbe.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2Physics::AnalysisCore O2Physics::AnalysisCCDB O2Physics::PWGDQCore - COMPONENT_NAME Analysis) \ No newline at end of file + COMPONENT_NAME Analysis) diff --git a/PWGDQ/Tasks/tableReader.cxx b/PWGDQ/Tasks/tableReader.cxx index 888be5a6d67..102eb26100f 100644 --- a/PWGDQ/Tasks/tableReader.cxx +++ b/PWGDQ/Tasks/tableReader.cxx @@ -14,6 +14,7 @@ #include "PWGDQ/Core/AnalysisCompositeCut.h" #include "PWGDQ/Core/AnalysisCut.h" #include "PWGDQ/Core/CutsLibrary.h" +#include "PWGDQ/Core/DQMlResponse.h" #include "PWGDQ/Core/HistogramManager.h" #include "PWGDQ/Core/HistogramsLibrary.h" #include "PWGDQ/Core/MixingHandler.h" @@ -1054,6 +1055,12 @@ struct AnalysisSameEventPairing { Configurable fCenterMassEnergy{"energy", 13600, "Center of mass energy in GeV"}; Configurable fConfigCumulants{"cfgCumulants", false, "If true, fill Cumulants with Weights different than 0"}; Configurable fConfigAddJSONHistograms{"cfgAddJSONHistograms", "", "Histograms in JSON format"}; + // ML inference + Configurable applyBDT{"applyBDT", false, "Flag to apply ML selections"}; + Configurable fConfigBdtCutsJSON{"fConfigBdtCutsJSON", "", "Additional list of BDT cuts in JSON format"}; + Configurable> modelPathsCCDB{"modelPathsCCDB", std::vector{"Users/j/jseo/ML/PbPbPsi/default/"}, "Paths of models on CCDB"}; + Configurable timestampCCDB{"timestampCCDB", -1, "timestamp of the ONNX file for ML model used to query in CCDB"}; + Configurable loadModelsFromCCDB{"loadModelsFromCCDB", false, "Flag to enable or disable the loading of models from CCDB"}; // Configurables to create output tree (flat tables or minitree) struct : ConfigurableGroup { @@ -1071,6 +1078,10 @@ struct AnalysisSameEventPairing { HistogramManager* fHistMan; + o2::analysis::DQMlResponse fDQMlResponse; + std::vector fOutputMlPsi2ee = {}; // TODO: check this is needed or not + o2::ccdb::CcdbApi ccdbApi; + // NOTE: The track filter produced by the barrel track selection contain a number of electron cut decisions and one last cut for hadrons used in the // dilepton - hadron task downstream. So the bit mask is required to select pairs just based on the electron cuts // TODO: provide as Configurable the list and names of the cuts which should be used in pairing @@ -1121,6 +1132,54 @@ struct AnalysisSameEventPairing { } } + if (applyBDT) { + // BDT cuts via JSON + std::vector binsMl; + o2::framework::LabeledArray cutsMl; + std::vector cutDirMl; + int nClassesMl = 1; + std::vector namesInputFeatures; + std::vector onnxFileNames; + + auto config = o2::aod::dqmlcuts::GetBdtScoreCutsAndConfigFromJSON(fConfigBdtCutsJSON.value.c_str()); + + if (std::holds_alternative(config)) { + auto& cfg = std::get(config); + binsMl = cfg.binsMl; + nClassesMl = 1; + cutsMl = cfg.cutsMl; + cutDirMl = cfg.cutDirs; + namesInputFeatures = cfg.inputFeatures; + onnxFileNames = cfg.onnxFiles; + fDQMlResponse.setBinsCent(cfg.binsCent); + fDQMlResponse.setBinsPt(cfg.binsPt); + fDQMlResponse.setCentType(cfg.centType); + LOG(info) << "Using BDT cuts for binary classification"; + } else { + auto& cfg = std::get(config); + binsMl = cfg.binsMl; + nClassesMl = 3; + cutsMl = cfg.cutsMl; + cutDirMl = cfg.cutDirs; + namesInputFeatures = cfg.inputFeatures; + onnxFileNames = cfg.onnxFiles; + fDQMlResponse.setBinsCent(cfg.binsCent); + fDQMlResponse.setBinsPt(cfg.binsPt); + fDQMlResponse.setCentType(cfg.centType); + LOG(info) << "Using BDT cuts for multiclass classification"; + } + + fDQMlResponse.configure(binsMl, cutsMl, cutDirMl, nClassesMl); + if (loadModelsFromCCDB) { + ccdbApi.init(ccdburl); + fDQMlResponse.setModelPathsCCDB(onnxFileNames, ccdbApi, modelPathsCCDB, timestampCCDB); + } else { + fDQMlResponse.setModelPathsLocal(onnxFileNames); + } + fDQMlResponse.cacheInputFeaturesIndices(namesInputFeatures); + fDQMlResponse.init(); + } + if (context.mOptions.get("processDecayToEESkimmed") || context.mOptions.get("processDecayToEESkimmedNoTwoProngFitter") || context.mOptions.get("processDecayToEESkimmedWithCov") || context.mOptions.get("processDecayToEESkimmedWithCovNoTwoProngFitter") || context.mOptions.get("processDecayToEEVertexingSkimmed") || context.mOptions.get("processVnDecayToEESkimmed") || context.mOptions.get("processDecayToEEPrefilterSkimmed") || context.mOptions.get("processDecayToEEPrefilterSkimmedNoTwoProngFitter") || context.mOptions.get("processDecayToEESkimmedWithColl") || context.mOptions.get("processDecayToEESkimmedWithCollNoTwoProngFitter") || context.mOptions.get("processDecayToPiPiSkimmed") || context.mOptions.get("processAllSkimmed")) { TString cutNames = fConfigTrackCuts.value; if (!cutNames.IsNull()) { // if track cuts @@ -1317,6 +1376,8 @@ struct AnalysisSameEventPairing { dileptonMiniTree.reserve(1); } + bool isSelectedBDT = false; + if (fConfigMultDimuons.value) { uint32_t mult_dimuons = 0; @@ -1395,6 +1456,43 @@ struct AnalysisSameEventPairing { } } if constexpr ((TPairType == pairTypeEE) && (TTrackFillMap & VarManager::ObjTypes::ReducedTrackBarrelPID) > 0) { + if (applyBDT) { + std::vector dqInputFeatures = fDQMlResponse.getInputFeatures(t1, t2, VarManager::fgValues); + + if (dqInputFeatures.empty()) { + LOG(fatal) << "Input features for ML selection are empty! Please check your configuration."; + return; + } + + int modelIndex = -1; + const auto& binsCent = fDQMlResponse.getBinsCent(); + const auto& binsPt = fDQMlResponse.getBinsPt(); + const std::string& centType = fDQMlResponse.getCentType(); + + if ("kCentFT0C" == centType) { + modelIndex = o2::aod::dqmlcuts::getMlBinIndex(VarManager::fgValues[VarManager::kCentFT0C], VarManager::fgValues[VarManager::kPt], binsCent, binsPt); + } else if ("kCentFT0A" == centType) { + modelIndex = o2::aod::dqmlcuts::getMlBinIndex(VarManager::fgValues[VarManager::kCentFT0A], VarManager::fgValues[VarManager::kPt], binsCent, binsPt); + } else if ("kCentFT0M" == centType) { + modelIndex = o2::aod::dqmlcuts::getMlBinIndex(VarManager::fgValues[VarManager::kCentFT0M], VarManager::fgValues[VarManager::kPt], binsCent, binsPt); + } else { + LOG(fatal) << "Unknown centrality estimation type: " << centType; + return; + } + + if (modelIndex < 0) { + LOG(debug) << "Ml index is negative! This means that the centrality/pt is not in the range of the model bins."; + continue; + } + + LOG(debug) << "Model index: " << modelIndex << ", pT: " << VarManager::fgValues[VarManager::kPt] << ", centrality (kCentFT0C): " << VarManager::fgValues[VarManager::kCentFT0C]; + isSelectedBDT = fDQMlResponse.isSelectedMl(dqInputFeatures, modelIndex, fOutputMlPsi2ee); + VarManager::FillBdtScore(fOutputMlPsi2ee); // TODO: check if this is needed or not + } + + if (applyBDT && !isSelectedBDT) + continue; + if (fConfigFlatTables.value) { dielectronAllList(VarManager::fgValues[VarManager::kMass], VarManager::fgValues[VarManager::kPt], VarManager::fgValues[VarManager::kEta], VarManager::fgValues[VarManager::kPhi], t1.sign() + t2.sign(), dileptonFilterMap, dileptonMcDecision, t1.pt(), t1.eta(), t1.phi(), t1.itsClusterMap(), t1.itsChi2NCl(), t1.tpcNClsCrossedRows(), t1.tpcNClsFound(), t1.tpcChi2NCl(), t1.dcaXY(), t1.dcaZ(), t1.tpcSignal(), t1.tpcNSigmaEl(), t1.tpcNSigmaPi(), t1.tpcNSigmaPr(), t1.beta(), t1.tofNSigmaEl(), t1.tofNSigmaPi(), t1.tofNSigmaPr(), @@ -1468,6 +1566,9 @@ struct AnalysisSameEventPairing { } } + if (applyBDT && !isSelectedBDT) + continue; + int iCut = 0; for (int icut = 0; icut < ncuts; icut++) { if (twoTrackFilter & (static_cast(1) << icut)) { diff --git a/PWGDQ/Tasks/tableReader_withAssoc.cxx b/PWGDQ/Tasks/tableReader_withAssoc.cxx index 75c82025776..baa153f1dfb 100644 --- a/PWGDQ/Tasks/tableReader_withAssoc.cxx +++ b/PWGDQ/Tasks/tableReader_withAssoc.cxx @@ -15,6 +15,7 @@ #include "PWGDQ/Core/AnalysisCompositeCut.h" #include "PWGDQ/Core/AnalysisCut.h" #include "PWGDQ/Core/CutsLibrary.h" +#include "PWGDQ/Core/DQMlResponse.h" #include "PWGDQ/Core/HistogramManager.h" #include "PWGDQ/Core/HistogramsLibrary.h" #include "PWGDQ/Core/MixingHandler.h" @@ -1251,6 +1252,14 @@ struct AnalysisSameEventPairing { Configurable propTrack{"cfgPropTrack", true, "Propgate tracks to associated collision to recalculate DCA and momentum vector"}; Configurable useRemoteCollisionInfo{"cfgUseRemoteCollisionInfo", false, "Use remote collision information from CCDB"}; } fConfigOptions; + struct : ConfigurableGroup { + Configurable applyBDT{"applyBDT", false, "Flag to apply ML selections"}; + Configurable fConfigBdtCutsJSON{"fConfigBdtCutsJSON", "", "Additional list of BDT cuts in JSON format"}; + + Configurable> modelPathsCCDB{"modelPathsCCDB", std::vector{"Users/j/jseo/ML/PbPbPsi/default/"}, "Paths of models on CCDB"}; + Configurable timestampCCDB{"timestampCCDB", -1, "timestamp of the ONNX file for ML model used to query in CCDB"}; + Configurable loadModelsFromCCDB{"loadModelsFromCCDB", false, "Flag to enable or disable the loading of models from CCDB"}; + } fConfigML; Service fCCDB; o2::ccdb::CcdbApi fCCDBApi; @@ -1259,6 +1268,9 @@ struct AnalysisSameEventPairing { HistogramManager* fHistMan; + o2::analysis::DQMlResponse fDQMlResponse; + std::vector fOutputMlPsi2ee = {}; // TODO: check this is needed or not + // keep histogram class names in maps, so we don't have to buld their names in the pair loops std::map> fTrackHistNames; std::map> fMuonHistNames; @@ -1326,6 +1338,54 @@ struct AnalysisSameEventPairing { objArrayMuonCuts = muonCutsStr.Tokenize(","); } + if (fConfigML.applyBDT) { + // BDT cuts via JSON + std::vector binsMl; + o2::framework::LabeledArray cutsMl; + std::vector cutDirMl; + int nClassesMl = 1; + std::vector namesInputFeatures; + std::vector onnxFileNames; + + auto config = o2::aod::dqmlcuts::GetBdtScoreCutsAndConfigFromJSON(fConfigML.fConfigBdtCutsJSON.value.c_str()); + + if (std::holds_alternative(config)) { + auto& cfg = std::get(config); + binsMl = cfg.binsMl; + nClassesMl = 1; + cutsMl = cfg.cutsMl; + cutDirMl = cfg.cutDirs; + namesInputFeatures = cfg.inputFeatures; + onnxFileNames = cfg.onnxFiles; + fDQMlResponse.setBinsCent(cfg.binsCent); + fDQMlResponse.setBinsPt(cfg.binsPt); + fDQMlResponse.setCentType(cfg.centType); + LOG(info) << "Using BDT cuts for binary classification"; + } else { + auto& cfg = std::get(config); + binsMl = cfg.binsMl; + nClassesMl = 3; + cutsMl = cfg.cutsMl; + cutDirMl = cfg.cutDirs; + namesInputFeatures = cfg.inputFeatures; + onnxFileNames = cfg.onnxFiles; + fDQMlResponse.setBinsCent(cfg.binsCent); + fDQMlResponse.setBinsPt(cfg.binsPt); + fDQMlResponse.setCentType(cfg.centType); + LOG(info) << "Using BDT cuts for multiclass classification"; + } + + fDQMlResponse.configure(binsMl, cutsMl, cutDirMl, nClassesMl); + if (fConfigML.loadModelsFromCCDB) { + fCCDBApi.init(fConfigCCDB.url); + fDQMlResponse.setModelPathsCCDB(onnxFileNames, fCCDBApi, fConfigML.modelPathsCCDB, fConfigML.timestampCCDB); + } else { + fDQMlResponse.setModelPathsLocal(onnxFileNames); + } + fDQMlResponse.cacheInputFeaturesIndices(namesInputFeatures); + fDQMlResponse.init(); + } + // get the barrel track selection cuts string tempCuts; getTaskOptionValue(context, "analysis-track-selection", "cfgTrackCuts", tempCuts, false); @@ -1632,6 +1692,7 @@ struct AnalysisSameEventPairing { constexpr bool eventHasQvector = ((TEventFillMap & VarManager::ObjTypes::ReducedEventQvector) > 0); constexpr bool eventHasQvectorCentr = ((TEventFillMap & VarManager::ObjTypes::CollisionQvect) > 0); constexpr bool trackHasCov = ((TTrackFillMap & VarManager::ObjTypes::TrackCov) > 0 || (TTrackFillMap & VarManager::ObjTypes::ReducedTrackBarrelCov) > 0); + bool isSelectedBDT = false; for (auto& event : events) { if (!event.isEventSelected_bit(0)) { @@ -1712,6 +1773,43 @@ struct AnalysisSameEventPairing { if constexpr (trackHasCov && TTwoProngFitter) { dielectronsExtraList(t1.globalIndex(), t2.globalIndex(), VarManager::fgValues[VarManager::kVertexingTauzProjected], VarManager::fgValues[VarManager::kVertexingLzProjected], VarManager::fgValues[VarManager::kVertexingLxyProjected]); if constexpr ((TTrackFillMap & VarManager::ObjTypes::ReducedTrackBarrelPID) > 0) { + if (fConfigML.applyBDT) { + std::vector dqInputFeatures = fDQMlResponse.getInputFeatures(t1, t2, VarManager::fgValues); + + if (dqInputFeatures.empty()) { + LOG(fatal) << "Input features for ML selection are empty! Please check your configuration."; + return; + } + + int modelIndex = -1; + const auto& binsCent = fDQMlResponse.getBinsCent(); + const auto& binsPt = fDQMlResponse.getBinsPt(); + const std::string& centType = fDQMlResponse.getCentType(); + + if ("kCentFT0C" == centType) { + modelIndex = o2::aod::dqmlcuts::getMlBinIndex(VarManager::fgValues[VarManager::kCentFT0C], VarManager::fgValues[VarManager::kPt], binsCent, binsPt); + } else if ("kCentFT0A" == centType) { + modelIndex = o2::aod::dqmlcuts::getMlBinIndex(VarManager::fgValues[VarManager::kCentFT0A], VarManager::fgValues[VarManager::kPt], binsCent, binsPt); + } else if ("kCentFT0M" == centType) { + modelIndex = o2::aod::dqmlcuts::getMlBinIndex(VarManager::fgValues[VarManager::kCentFT0M], VarManager::fgValues[VarManager::kPt], binsCent, binsPt); + } else { + LOG(fatal) << "Unknown centrality estimation type: " << centType; + return; + } + + if (modelIndex < 0) { + LOG(info) << "Ml index is negative! This means that the centrality/pt is not in the range of the model bins."; + continue; + } + + LOG(debug) << "Model index: " << modelIndex << ", pT: " << VarManager::fgValues[VarManager::kPt] << ", centrality (kCentFT0C): " << VarManager::fgValues[VarManager::kCentFT0C]; + isSelectedBDT = fDQMlResponse.isSelectedMl(dqInputFeatures, modelIndex, fOutputMlPsi2ee); + VarManager::FillBdtScore(fOutputMlPsi2ee); // TODO: check if this is needed or not + } + + if (fConfigML.applyBDT && !isSelectedBDT) + continue; + if (fConfigOptions.flatTables.value) { dielectronAllList(VarManager::fgValues[VarManager::kMass], VarManager::fgValues[VarManager::kPt], VarManager::fgValues[VarManager::kEta], VarManager::fgValues[VarManager::kPhi], t1.sign() + t2.sign(), twoTrackFilter, dileptonMcDecision, t1.pt(), t1.eta(), t1.phi(), t1.itsClusterMap(), t1.itsChi2NCl(), t1.tpcNClsCrossedRows(), t1.tpcNClsFound(), t1.tpcChi2NCl(), t1.dcaXY(), t1.dcaZ(), t1.tpcSignal(), t1.tpcNSigmaEl(), t1.tpcNSigmaPi(), t1.tpcNSigmaPr(), t1.beta(), t1.tofNSigmaEl(), t1.tofNSigmaPi(), t1.tofNSigmaPr(), @@ -1836,6 +1934,10 @@ struct AnalysisSameEventPairing { bool isLeg1Ambi = false; bool isLeg2Ambi = false; bool isAmbiExtra = false; + + if (fConfigML.applyBDT && !isSelectedBDT) + continue; + for (int icut = 0; icut < ncuts; icut++) { if (twoTrackFilter & (static_cast(1) << icut)) { isAmbiInBunch = (twoTrackFilter & (static_cast(1) << 28)) || (twoTrackFilter & (static_cast(1) << 29)); From e7c112de40e21be73dc52036df8dd78c3b5c5278 Mon Sep 17 00:00:00 2001 From: Zhiyong <71517277+Luzhiyongg@users.noreply.github.com> Date: Tue, 5 Aug 2025 22:05:03 +0200 Subject: [PATCH 241/345] [PWGCF] fix bug of fetching centrality (#12446) --- PWGCF/TwoParticleCorrelations/Tasks/diHadronCor.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/PWGCF/TwoParticleCorrelations/Tasks/diHadronCor.cxx b/PWGCF/TwoParticleCorrelations/Tasks/diHadronCor.cxx index 03d38b71db4..7ccd59ed178 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/diHadronCor.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/diHadronCor.cxx @@ -692,13 +692,13 @@ struct DiHadronCor { auto multNTracksPV = collision.multNTracksPV(); if (cfgEvSelMultCorrelation) { - if (cfgFuncParas.cfgMultPVT0CCutEnabled) { + if (cfgFuncParas.cfgMultPVT0CCutEnabled && !cfgCentTableUnavailable) { if (multNTracksPV < cfgFuncParas.fMultPVT0CCutLow->Eval(centrality)) return 0; if (multNTracksPV > cfgFuncParas.fMultPVT0CCutHigh->Eval(centrality)) return 0; } - if (cfgFuncParas.cfgMultT0CCutEnabled) { + if (cfgFuncParas.cfgMultT0CCutEnabled && !cfgCentTableUnavailable) { if (multTrk < cfgFuncParas.fMultT0CCutLow->Eval(centrality)) return 0; if (multTrk > cfgFuncParas.fMultT0CCutHigh->Eval(centrality)) @@ -737,11 +737,13 @@ struct DiHadronCor { auto bc = collision.bc_as(); float cent = -1.; float weightCent = 1.0f; + if (!cfgCentTableUnavailable) { + cent = getCentrality(collision); + } if (cfgUseAdditionalEventCut && !eventSelected(collision, tracks.size(), cent, true)) return; loadCorrection(bc.timestamp()); if (!cfgCentTableUnavailable) { - cent = getCentrality(collision); getCentralityWeight(weightCent, cent); registry.fill(HIST("Centrality"), cent); registry.fill(HIST("CentralityWeighted"), cent, weightCent); From 4af89da5ee6d0473dee91e879b0ad60cbc26dbed Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Tue, 5 Aug 2025 22:09:00 +0200 Subject: [PATCH 242/345] [PWGLF,PWGHF] Add photon safety layer to strangeness getters (#12271) Co-authored-by: ALICE Builder Co-authored-by: David Dobrigkeit Chinellato --- .../DataModel/CandidateReconstructionTables.h | 6 +- PWGLF/DataModel/LFStrangenessTables.h | 75 +++++++++++++++---- 2 files changed, 65 insertions(+), 16 deletions(-) diff --git a/PWGHF/DataModel/CandidateReconstructionTables.h b/PWGHF/DataModel/CandidateReconstructionTables.h index 8af9f18162d..3ee949eadc8 100644 --- a/PWGHF/DataModel/CandidateReconstructionTables.h +++ b/PWGHF/DataModel/CandidateReconstructionTables.h @@ -842,9 +842,9 @@ DECLARE_SOA_TABLE(HfCandCascBase, "AOD", "HFCANDCASCBASE", //! hf_cand_casc::PtV0Pos, // pT of positive V0 daughter hf_cand_casc::PtV0Neg, // pT of negative V0 daughter v0data::V0Radius, - v0data::MLambda, - v0data::MAntiLambda, - v0data::MK0Short, + v0data::legacy::MLambda, + v0data::legacy::MAntiLambda, + v0data::legacy::MK0Short, v0data::MGamma, hf_cand_casc::CtV0); // , diff --git a/PWGLF/DataModel/LFStrangenessTables.h b/PWGLF/DataModel/LFStrangenessTables.h index 3ee36c7c54a..ca58973dff8 100644 --- a/PWGLF/DataModel/LFStrangenessTables.h +++ b/PWGLF/DataModel/LFStrangenessTables.h @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -709,11 +710,38 @@ DECLARE_SOA_DYNAMIC_COLUMN(PFracNeg, pfracneg, // Calculated on the fly with mass assumption + dynamic tables DECLARE_SOA_DYNAMIC_COLUMN(MLambda, mLambda, //! mass under lambda hypothesis - [](float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) -> float { return RecoDecay::m(std::array{std::array{pxpos, pypos, pzpos}, std::array{pxneg, pyneg, pzneg}}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged}); }); + [](int v0type, float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) -> float { + if ((v0type & (0x1 << o2::dataformats::V0Index::kPhotonOnly)) != 0) { + return 0.0f; // provide mass only if NOT a photon with TPC-only tracks (special handling) + }; + return RecoDecay::m(std::array{std::array{pxpos, pypos, pzpos}, std::array{pxneg, pyneg, pzneg}}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged}); + }); DECLARE_SOA_DYNAMIC_COLUMN(MAntiLambda, mAntiLambda, //! mass under antilambda hypothesis - [](float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) -> float { return RecoDecay::m(std::array{std::array{pxpos, pypos, pzpos}, std::array{pxneg, pyneg, pzneg}}, std::array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassProton}); }); + [](int v0type, float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) -> float { + if ((v0type & (0x1 << o2::dataformats::V0Index::kPhotonOnly)) != 0) { + return 0.0f; // provide mass only if NOT a photon with TPC-only tracks (special handling) + }; + return RecoDecay::m(std::array{std::array{pxpos, pypos, pzpos}, std::array{pxneg, pyneg, pzneg}}, std::array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassProton}); + }); DECLARE_SOA_DYNAMIC_COLUMN(MK0Short, mK0Short, //! mass under K0short hypothesis - [](float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) -> float { return RecoDecay::m(std::array{std::array{pxpos, pypos, pzpos}, std::array{pxneg, pyneg, pzneg}}, std::array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassPionCharged}); }); + [](int v0type, float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) -> float { + if ((v0type & (0x1 << o2::dataformats::V0Index::kPhotonOnly)) != 0) { + return 0.0f; // provide mass only if NOT a photon with TPC-only tracks (special handling) + }; + return RecoDecay::m(std::array{std::array{pxpos, pypos, pzpos}, std::array{pxneg, pyneg, pzneg}}, std::array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassPionCharged}); + }); +DECLARE_SOA_DYNAMIC_COLUMN(MLambda_unchecked, mLambda_unchecked, //! mass under lambda hypothesis without v0 type check (will include TPC only and potentially duplicates! use with care) + [](float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) -> float { + return RecoDecay::m(std::array{std::array{pxpos, pypos, pzpos}, std::array{pxneg, pyneg, pzneg}}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged}); + }); +DECLARE_SOA_DYNAMIC_COLUMN(MAntiLambda_unchecked, mAntiLambda_unchecked, //! mass under antilambda hypothesis without v0 type check (will include TPC only and potentially duplicates! use with care) + [](float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) -> float { + return RecoDecay::m(std::array{std::array{pxpos, pypos, pzpos}, std::array{pxneg, pyneg, pzneg}}, std::array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassProton}); + }); +DECLARE_SOA_DYNAMIC_COLUMN(MK0Short_unchecked, mK0Short_unchecked, //! mass under K0short hypothesis without v0 type check (will include TPC only and potentially duplicates! use with care) + [](float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) -> float { + return RecoDecay::m(std::array{std::array{pxpos, pypos, pzpos}, std::array{pxneg, pyneg, pzneg}}, std::array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassPionCharged}); + }); DECLARE_SOA_DYNAMIC_COLUMN(MGamma, mGamma, //! mass under gamma hypothesis [](float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) -> float { return RecoDecay::m(std::array{std::array{pxpos, pypos, pzpos}, std::array{pxneg, pyneg, pzneg}}, std::array{o2::constants::physics::MassElectron, o2::constants::physics::MassElectron}); }); // Account for rigidity in case of hypertriton @@ -772,12 +800,12 @@ DECLARE_SOA_DYNAMIC_COLUMN(PositiveEta, positiveeta, //! positive daughter eta DECLARE_SOA_DYNAMIC_COLUMN(PositivePhi, positivephi, //! positive daughter phi [](float PxPos, float PyPos) -> float { return RecoDecay::phi(PxPos, PyPos); }); -DECLARE_SOA_DYNAMIC_COLUMN(IsStandardV0, isStandardV0, //! is standard V0 - [](uint8_t V0Type) -> bool { return V0Type == 1; }); +DECLARE_SOA_DYNAMIC_COLUMN(IsStandardV0, isStandardV0, //! is standard V0 - note: photons excluded via '==' + [](uint8_t V0Type) -> bool { return V0Type == o2::dataformats::V0Index::kStandaloneV0; }); DECLARE_SOA_DYNAMIC_COLUMN(IsPhotonTPConly, isPhotonTPConly, //! is tpc-only photon V0 - [](uint8_t V0Type) -> bool { return V0Type & (1 << 1); }); + [](uint8_t V0Type) -> bool { return V0Type & (1 << o2::dataformats::V0Index::kPhotonOnly); }); DECLARE_SOA_DYNAMIC_COLUMN(IsCollinear, isCollinear, //! is collinear V0 - [](uint8_t V0Type) -> bool { return V0Type & (1 << 2); }); + [](uint8_t V0Type) -> bool { return V0Type & (1 << o2::dataformats::V0Index::kCollinear); }); DECLARE_SOA_DYNAMIC_COLUMN(RapidityMC, rapidityMC, //! rapidity (0:K0, 1:L, 2:Lbar) [](float PxMC, float PyMC, float PzMC, int value) -> float { @@ -794,6 +822,24 @@ DECLARE_SOA_DYNAMIC_COLUMN(PositivePtMC, positiveptMC, //! positive daughter pT [](float pxposMC, float pyposMC) -> float { return RecoDecay::sqrtSumOfSquares(pxposMC, pyposMC); }); DECLARE_SOA_DYNAMIC_COLUMN(PtMC, ptMC, //! V0 pT [](float pxMC, float pyMC) -> float { return RecoDecay::sqrtSumOfSquares(pxMC, pyMC); }); + +// declare legacy mass getters in v0data legacy name space +// caution: these do not have intrinsic protection against photon candidates +namespace legacy +{ +DECLARE_SOA_DYNAMIC_COLUMN(MLambda, mLambda, //! mass under lambda hypothesis without v0 type check (will include TPC only and potentially duplicates! use with care) + [](float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) -> float { + return RecoDecay::m(std::array{std::array{pxpos, pypos, pzpos}, std::array{pxneg, pyneg, pzneg}}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged}); + }); +DECLARE_SOA_DYNAMIC_COLUMN(MAntiLambda, mAntiLambda, //! mass under antilambda hypothesis without v0 type check (will include TPC only and potentially duplicates! use with care) + [](float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) -> float { + return RecoDecay::m(std::array{std::array{pxpos, pypos, pzpos}, std::array{pxneg, pyneg, pzneg}}, std::array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassProton}); + }); +DECLARE_SOA_DYNAMIC_COLUMN(MK0Short, mK0Short, //! mass under K0short hypothesis without v0 type check (will include TPC only and potentially duplicates! use with care) + [](float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) -> float { + return RecoDecay::m(std::array{std::array{pxpos, pypos, pzpos}, std::array{pxneg, pyneg, pzneg}}, std::array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassPionCharged}); + }); +} // namespace legacy } // namespace v0data DECLARE_SOA_TABLE(V0Indices, "AOD", "V0INDEX", //! index table when using AO2Ds @@ -835,9 +881,12 @@ DECLARE_SOA_TABLE_STAGED(V0CoresBase, "V0CORE", //! core information about decay v0data::PFracNeg, // 24 // Invariant masses - v0data::MLambda, - v0data::MAntiLambda, - v0data::MK0Short, + v0data::MLambda, + v0data::MAntiLambda, + v0data::MK0Short, + v0data::MLambda_unchecked, + v0data::MAntiLambda_unchecked, + v0data::MK0Short_unchecked, v0data::MGamma, v0data::MHypertriton, v0data::MAntiHypertriton, @@ -916,9 +965,9 @@ DECLARE_SOA_TABLE_FULL(StoredV0fCCores, "V0fCCores", "AOD", "V0FCCORE", //! core v0data::PFracNeg, // 24 // Invariant masses - v0data::MLambda, - v0data::MAntiLambda, - v0data::MK0Short, + v0data::MLambda, + v0data::MAntiLambda, + v0data::MK0Short, v0data::MGamma, v0data::MHypertriton, v0data::MAntiHypertriton, From 33e3e8839b46e3f64589390d56939f09c10e9494 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Tue, 5 Aug 2025 22:13:54 +0200 Subject: [PATCH 243/345] [PWGEM/Dilepton] fix in trackcut (#12433) --- PWGEM/Dilepton/Core/EMTrackCut.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/PWGEM/Dilepton/Core/EMTrackCut.h b/PWGEM/Dilepton/Core/EMTrackCut.h index 58503b8a82e..d70a009aaac 100644 --- a/PWGEM/Dilepton/Core/EMTrackCut.h +++ b/PWGEM/Dilepton/Core/EMTrackCut.h @@ -45,8 +45,8 @@ class EMTrackCut : public TNamed kTrackPtRange, kTrackEtaRange, kTrackPhiRange, - kDCAxy, - kDCAz, + // kDCAxy, + // kDCAz, // kTPCNCls, // kTPCCrossedRows, // kTPCCrossedRowsOverNCls, @@ -75,12 +75,13 @@ class EMTrackCut : public TNamed return false; } - if (!IsSelectedTrack(track, EMTrackCuts::kDCAxy)) { - return false; - } - if (!IsSelectedTrack(track, EMTrackCuts::kDCAz)) { - return false; - } + // if (!IsSelectedTrack(track, EMTrackCuts::kDCAxy)) { + // return false; + // } + // if (!IsSelectedTrack(track, EMTrackCuts::kDCAz)) { + // return false; + // } + if (!IsSelectedTrack(track, EMTrackCuts::kTrackBit)) { return false; } From 310dffcf23589a8c08f8f3d6a4f9c0109687d6b2 Mon Sep 17 00:00:00 2001 From: alcaliva <32872606+alcaliva@users.noreply.github.com> Date: Tue, 5 Aug 2025 22:14:09 +0200 Subject: [PATCH 244/345] =?UTF-8?q?[PWGLF]=20refactoring=20+=20syst=20on?= =?UTF-8?q?=20full=20event=20+=20added=20configurable=20to=20run=20?= =?UTF-8?q?=E2=80=A6=20(#12443)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PWGLF/Tasks/Nuspex/CMakeLists.txt | 2 +- PWGLF/Tasks/Nuspex/antinucleiInJets.cxx | 1704 +++++++++++++---------- 2 files changed, 983 insertions(+), 723 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/CMakeLists.txt b/PWGLF/Tasks/Nuspex/CMakeLists.txt index 8e86feab651..0fbbf7d68c6 100644 --- a/PWGLF/Tasks/Nuspex/CMakeLists.txt +++ b/PWGLF/Tasks/Nuspex/CMakeLists.txt @@ -137,7 +137,7 @@ o2physics_add_dpl_workflow(angular-correlations-in-jets o2physics_add_dpl_workflow(antinuclei-in-jets SOURCES antinucleiInJets.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::PWGJECore FastJet::FastJet FastJet::Contrib + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils O2Physics::PWGJECore FastJet::FastJet FastJet::Contrib COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(kink-pika diff --git a/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx b/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx index b4509b40f28..39d31d4d7d0 100644 --- a/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx +++ b/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx @@ -22,11 +22,13 @@ #include "Common/Core/TrackSelection.h" #include "Common/Core/trackUtilities.h" -#include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/PIDResponseITS.h" #include "Common/DataModel/TrackSelectionTables.h" +#include "EventFiltering/Zorro.h" +#include "EventFiltering/ZorroSummary.h" #include "CCDB/BasicCCDBManager.h" #include "CCDB/CcdbApi.h" @@ -75,34 +77,48 @@ using namespace o2::constants::physics; using namespace o2::constants::math; using std::array; +// Define convenient aliases for commonly used table joins using SelectedCollisions = soa::Join; -using SimCollisions = soa::Join; -using GenCollisions = aod::McCollisions; - -using FullNucleiTracks = soa::Join; - -using MCTracks = soa::Join; +using RecCollisionsMc = soa::Join; +using GenCollisionsMc = aod::McCollisions; +using AntiNucleiTracks = soa::Join; +using AntiNucleiTracksMc = soa::Join; struct AntinucleiInJets { - // histogram registries + // Histogram registries for data, MC, quality control and multiplicity HistogramRegistry registryData{"registryData", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry registryMC{"registryMC", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry registryQC{"registryQC", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry registryMult{"registryMult", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - // global parameters - Configurable minJetPt{"minJetPt", 10.0, "Minimum pt of the jet"}; + // Event selection criteria + Configurable rejectITSROFBorder{"rejectITSROFBorder", true, "Reject events near the ITS ROF border"}; + Configurable rejectTFBorder{"rejectTFBorder", true, "Reject events near the TF border"}; + Configurable requireVtxITSTPC{"requireVtxITSTPC", true, "Require at least one ITS-TPC matched track"}; + Configurable rejectSameBunchPileup{"rejectSameBunchPileup", true, "Reject events with same-bunch pileup collisions"}; + Configurable requireIsGoodZvtxFT0VsPV{"requireIsGoodZvtxFT0VsPV", true, "Require consistent FT0 vs PV z-vertex"}; + Configurable requireIsVertexTOFmatched{"requireIsVertexTOFmatched", false, "Require at least one vertex track matched to TOF"}; + + // Skimmed data flag and list of active triggers for processing + Configurable cfgSkimmedProcessing{"cfgSkimmedProcessing", false, "Skimmed dataset processing"}; + Configurable triggerList{"triggerList", "fHe", "Trigger list"}; + + // Jet selection and event filtering parameters + Configurable minJetPt{"minJetPt", 10.0, "Minimum pt of the jet after bkg subtraction"}; Configurable ptLeadingMin{"ptLeadingMin", 5.0, "pt Leading Min"}; Configurable rJet{"rJet", 0.3, "Jet resolution parameter R"}; Configurable zVtx{"zVtx", 10.0, "Maximum zVertex"}; + Configurable applyAreaCut{"applyAreaCut", false, "apply area cut"}; + Configurable maxNormalizedJetArea{"maxNormalizedJetArea", 0.6, "area cut"}; Configurable deltaEtaEdge{"deltaEtaEdge", 0.05, "eta gap from the edge"}; + Configurable applyRandomEventRejection{"applyRandomEventRejection", false, "reject some events for syst"}; + Configurable rejectionPercentage{"rejectionPercentage", 3.0, "percentage of events to reject"}; + Configurable nSyst{"nSyst", 50, "number of systematic variations"}; - // track parameters + // Track quality, kinematic, and PID selection parameters Configurable requirePvContributor{"requirePvContributor", false, "require that the track is a PV contributor"}; Configurable applyItsPid{"applyItsPid", true, "apply ITS PID"}; - Configurable rejectEvents{"rejectEvents", false, "reject some events"}; - Configurable rejectionPercentage{"rejectionPercentage", 3, "percentage of events to reject"}; Configurable minItsNclusters{"minItsNclusters", 5, "minimum number of ITS clusters"}; Configurable minTpcNcrossedRows{"minTpcNcrossedRows", 80, "minimum number of TPC crossed pad rows"}; Configurable maxChiSquareTpc{"maxChiSquareTpc", 4.0, "maximum TPC chi^2/Ncls"}; @@ -119,51 +135,44 @@ struct AntinucleiInJets { Configurable ptMaxItsPidProt{"ptMaxItsPidProt", 1.0, "maximum pt for ITS PID for protons"}; Configurable ptMaxItsPidDeut{"ptMaxItsPidDeut", 1.0, "maximum pt for ITS PID for deuterons"}; Configurable ptMaxItsPidHel{"ptMaxItsPidHel", 1.0, "maximum pt for ITS PID for helium"}; - Configurable nSigmaItsMin{"nSigmaItsMin", -2.0, "nSigmaITS min"}; - Configurable nSigmaItsMax{"nSigmaItsMax", +2.0, "nSigmaITS max"}; - - // reweighting - Configurable urlToCcdb{"urlToCcdb", "http://alice-ccdb.cern.ch", "url of the personal ccdb"}; - Configurable pathToFile{"pathToFile", "", "path to file with reweighting"}; - Configurable histoNameWeightAntipJet{"histoNameWeightAntipJet", "", "reweighting histogram: antip in jet"}; - Configurable histoNameWeightAntipUe{"histoNameWeightAntipUe", "", "reweighting histogram: antip in ue"}; - TH2F* twoDweightsAntipJet; - TH2F* twoDweightsAntipUe; - - // jet pt unfolding - Configurable applyPtUnfolding{"applyPtUnfolding", true, "apply jet pt unfolding"}; - Configurable urlToCcdbPtUnfolding{"urlToCcdbPtUnfolding", "http://alice-ccdb.cern.ch", "url of the personal ccdb"}; - Configurable pathToFilePtUnfolding{"pathToFilePtUnfolding", "Users/c/chpinto/My/Object/ResponseMatrix", "path to file with pt unfolding"}; - Configurable histoNamePtUnfolding{"histoNamePtUnfolding", "detectorResponseMatrix", "pt unfolding histogram"}; - TH2F* responseMatrix; + Configurable nSigmaItsMin{"nSigmaItsMin", -3.0, "nSigmaITS min"}; + Configurable nSigmaItsMax{"nSigmaItsMax", +3.0, "nSigmaITS max"}; + // CCDB manager service for accessing condition data Service ccdb; + + // Direct interface to the CCDB API for manual data access o2::ccdb::CcdbApi ccdbApi; + // Instantiate the main Zorro processing object and define an output to store summary information + Zorro zorro; + OutputObj zorroSummary{"zorroSummary"}; + + // Utility object for jet background subtraction methods JetBkgSubUtils backgroundSub; + // Initialize CCDB access and histogram registry for Zorro processing + void initCCDB(aod::BCsWithTimestamps::iterator const& bc) + { + if (cfgSkimmedProcessing) { + zorro.initCCDB(ccdb.service, bc.runNumber(), bc.timestamp(), triggerList); + zorro.populateHistRegistry(registryData, bc.runNumber()); + } + } + void init(InitContext const&) { - ccdb->setURL(urlToCcdb.value); - ccdb->setCaching(true); - ccdb->setLocalObjectValidityChecking(); - ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); - ccdb->setFatalWhenNull(false); - - getReweightingHistograms(ccdb, TString(pathToFile), TString(histoNameWeightAntipJet), TString(histoNameWeightAntipUe)); - - if (applyPtUnfolding) { - getPtUnfoldingHistogram(ccdb, TString(pathToFilePtUnfolding), TString(histoNamePtUnfolding)); - } else { - responseMatrix = nullptr; + // Set summary object if processing skimmed data + if (cfgSkimmedProcessing) { + zorroSummary.setObject(zorro.getZorroSummary()); } - // binning + // Binning double min = 0.0; double max = 6.0; int nbins = 120; - // QC histograms + // Quality control histograms for jet/UE topology and multiplicity if (doprocessQC) { registryQC.add("deltaEta_deltaPhi_jet", "deltaEta_deltaPhi_jet", HistType::kTH2F, {{200, -0.5, 0.5, "#Delta#eta"}, {200, 0, PIHalf, "#Delta#phi"}}); registryQC.add("deltaEta_deltaPhi_ue", "deltaEta_deltaPhi_ue", HistType::kTH2F, {{200, -0.5, 0.5, "#Delta#eta"}, {200, 0, PIHalf, "#Delta#phi"}}); @@ -179,151 +188,169 @@ struct AntinucleiInJets { registryQC.add("nJetsInAcceptance", "nJetsInAcceptance", HistType::kTH1F, {{50, 0, 50, "#it{n}_{Jet}"}}); registryQC.add("nJetsSelectedHighPt", "nJetsSelectedHighPt", HistType::kTH1F, {{50, 0, 50, "#it{n}_{Jet}"}}); registryQC.add("jetPtDifference", "jetPtDifference", HistType::kTH1F, {{200, -1, 1, "#Deltap_{T}^{jet}"}}); + registryQC.add("ptDistributionJetCone", "ptDistributionJetCone", HistType::kTH1F, {{2000, 0, 200, "#it{p}_{T} (GeV/#it{c})"}}); + registryQC.add("ptDistributionJet", "ptDistributionJet", HistType::kTH1F, {{2000, 0, 200, "#it{p}_{T} (GeV/#it{c})"}}); } + // Multiplicity histograms: check charged-particle multiplicity in events with selected jets (Run 3) or ptTrigger > threshold (Run 2-like) if (doprocessMultEvents) { registryMult.add("multiplicityEvtsPtLeading", "multiplicityEvtsPtLeading", HistType::kTH1F, {{1000, 0, 1000, "#it{N}_{ch}"}}); registryMult.add("multiplicityEvtsWithJet", "multiplicityEvtsWithJet", HistType::kTH1F, {{1000, 0, 1000, "#it{N}_{ch}"}}); } - // data histograms + // Histograms for real data if (doprocessData) { - // event counter data - registryData.add("number_of_events_data", "number of events in data", HistType::kTH1F, {{10, 0, 10, "counter"}}); + // Event counters + registryData.add("number_of_events_data", "number of events in data", HistType::kTH1F, {{20, 0, 20, "counter"}}); registryData.add("number_of_rejected_events", "check on number of events rejected", HistType::kTH1F, {{10, 0, 10, "counter"}}); - // Jet Area - registryData.add("jetEffectiveArea", "jetEffectiveArea", HistType::kTH1F, {{2000, 0, 2, "Area/#piR^{2}"}}); - registryData.add("ptDistributionJet", "ptDistributionJet", HistType::kTH1F, {{2000, 0, 200, "#it{p}_{T} (GeV/#it{c})"}}); + // Jet effective area over piR^2 + registryData.add("jetEffectiveAreaOverPiR2", "jet effective area / piR^2", HistType::kTH1F, {{2000, 0, 2, "Area/#piR^{2}"}}); - // antiprotons + // Antiprotons registryData.add("antiproton_jet_tpc", "antiproton_jet_tpc", HistType::kTH2F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TPC}"}}); registryData.add("antiproton_jet_tof", "antiproton_jet_tof", HistType::kTH2F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TOF}"}}); registryData.add("antiproton_ue_tpc", "antiproton_ue_tpc", HistType::kTH2F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TPC}"}}); registryData.add("antiproton_ue_tof", "antiproton_ue_tof", HistType::kTH2F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TOF}"}}); - registryData.add("antiproton_dca_jet", "antiproton_dca_jet", HistType::kTH2F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}, {200, -1, 1, "DCA_{xy} (cm)"}}); - registryData.add("antiproton_dca_ue", "antiproton_dca_ue", HistType::kTH2F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}, {200, -1, 1, "DCA_{xy} (cm)"}}); - - // antideuterons - registryData.add("antideuteron_jet_tpc", "antideuteron_jet_tpc", HistType::kTH2F, {{nbins, min * 2, max * 2, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TPC}"}}); - registryData.add("antideuteron_jet_tof", "antideuteron_jet_tof", HistType::kTH2F, {{nbins, min * 2, max * 2, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TOF}"}}); - registryData.add("antideuteron_ue_tpc", "antideuteron_ue_tpc", HistType::kTH2F, {{nbins, min * 2, max * 2, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TPC}"}}); - registryData.add("antideuteron_ue_tof", "antideuteron_ue_tof", HistType::kTH2F, {{nbins, min * 2, max * 2, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TOF}"}}); - - // deuterons - registryData.add("deuteron_jet_tof", "deuteron_jet_tof", HistType::kTH2F, {{nbins, min * 2, max * 2, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TOF}"}}); - registryData.add("deuteron_ue_tof", "deuteron_ue_tof", HistType::kTH2F, {{nbins, min * 2, max * 2, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TOF}"}}); - - // antihelium-3 - registryData.add("antihelium3_jet_tpc", "antihelium3_jet_tpc", HistType::kTH2F, {{nbins, min * 3, max * 3, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TPC}"}}); - registryData.add("antihelium3_ue_tpc", "antihelium3_ue_tpc", HistType::kTH2F, {{nbins, min * 3, max * 3, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TPC}"}}); - - // helium-3 - registryData.add("helium3_jet_tpc", "helium3_jet_tpc", HistType::kTH2F, {{nbins, min * 3, max * 3, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TPC}"}}); - registryData.add("helium3_ue_tpc", "helium3_ue_tpc", HistType::kTH2F, {{nbins, min * 3, max * 3, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TPC}"}}); + registryData.add("antiproton_dca_jet", "antiproton_dca_jet", HistType::kTH2F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}, {200, -1.0, 1.0, "DCA_{xy} (cm)"}}); + registryData.add("antiproton_dca_ue", "antiproton_dca_ue", HistType::kTH2F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}, {200, -1.0, 1.0, "DCA_{xy} (cm)"}}); + + // Antideuterons + registryData.add("antideuteron_jet_tpc", "antideuteron_jet_tpc", HistType::kTH2F, {{nbins, 2 * min, 2 * max, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TPC}"}}); + registryData.add("antideuteron_jet_tof", "antideuteron_jet_tof", HistType::kTH2F, {{nbins, 2 * min, 2 * max, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TOF}"}}); + registryData.add("antideuteron_ue_tpc", "antideuteron_ue_tpc", HistType::kTH2F, {{nbins, 2 * min, 2 * max, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TPC}"}}); + registryData.add("antideuteron_ue_tof", "antideuteron_ue_tof", HistType::kTH2F, {{nbins, 2 * min, 2 * max, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TOF}"}}); + + // Deuterons + registryData.add("deuteron_jet_tpc", "deuteron_jet_tpc", HistType::kTH2F, {{nbins, 2 * min, 2 * max, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TPC}"}}); + registryData.add("deuteron_jet_tof", "deuteron_jet_tof", HistType::kTH2F, {{nbins, 2 * min, 2 * max, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TOF}"}}); + registryData.add("deuteron_ue_tpc", "deuteron_ue_tpc", HistType::kTH2F, {{nbins, 2 * min, 2 * max, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TPC}"}}); + registryData.add("deuteron_ue_tof", "deuteron_ue_tof", HistType::kTH2F, {{nbins, 2 * min, 2 * max, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TOF}"}}); + + // Antihelium-3 + registryData.add("antihelium3_jet_tpc", "antihelium3_jet_tpc", HistType::kTH2F, {{nbins, 3 * min, 3 * max, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TPC}"}}); + registryData.add("antihelium3_ue_tpc", "antihelium3_ue_tpc", HistType::kTH2F, {{nbins, 3 * min, 3 * max, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TPC}"}}); + + // Helium-3 + registryData.add("helium3_jet_tpc", "helium3_jet_tpc", HistType::kTH2F, {{nbins, 3 * min, 3 * max, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TPC}"}}); + registryData.add("helium3_ue_tpc", "helium3_ue_tpc", HistType::kTH2F, {{nbins, 3 * min, 3 * max, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TPC}"}}); + } + + // Generated antiproton spectra in jets and UE from MC truth + if (doprocessJetsMCgen) { + + // Event counter + registryMC.add("genEvents", "number of generated events in mc", HistType::kTH1F, {{10, 0, 10, "counter"}}); + + // Generated spectra of antiprotons + registryMC.add("antiproton_gen_jet", "antiproton_gen_jet", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); + registryMC.add("antiproton_gen_ue", "antiproton_gen_ue", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); } - // monte carlo histograms - if (doprocessEfficiency) { - - // event counter MC - registryMC.add("number_of_events_mc", "number of events in mc", HistType::kTH1F, {{10, 0, 10, "counter"}}); - - // generated spectra (antiprotons) - registryMC.add("antiproton_gen_jet_unweighted", "antiproton_gen_jet_unweighted", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); - registryMC.add("antiproton_gen_ue_unweighted", "antiproton_gen_ue_unweighted", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); - registryMC.add("antiproton_gen_jet_weighted2d", "antiproton_gen_jet_weighted2d", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); - registryMC.add("antiproton_gen_ue_weighted2d", "antiproton_gen_ue_weighted2d", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); - registryMC.add("antiproton_gen_jet_weightedFinal", "antiproton_gen_jet_weightedFinal", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); - registryMC.add("antiproton_gen_ue_weightedFinal", "antiproton_gen_ue_weightedFinal", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); - registryMC.add("antiproton_gen_jet_antikt", "antiproton_gen_jet_antikt", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); - registryMC.add("antiproton_gen_ue_antikt", "antiproton_gen_ue_antikt", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); - - // generated spectra (antinuclei) - registryMC.add("deuteron_incl_gen", "deuteron_incl_gen", HistType::kTH1F, {{nbins, 2 * min, 2 * max, "#it{p}_{T} (GeV/#it{c})"}}); - registryMC.add("antideuteron_incl_gen", "antideuteron_incl_gen", HistType::kTH1F, {{nbins, 2 * min, 2 * max, "#it{p}_{T} (GeV/#it{c})"}}); - registryMC.add("helium3_incl_gen", "helium3_incl_gen", HistType::kTH1F, {{nbins, 3 * min, 3 * max, "#it{p}_{T} (GeV/#it{c})"}}); - registryMC.add("antihelium3_incl_gen", "antihelium3_incl_gen", HistType::kTH1F, {{nbins, 3 * min, 3 * max, "#it{p}_{T} (GeV/#it{c})"}}); - - // reconstructed TPC (antiprotons) - registryMC.add("antiproton_recTpc_jet_unweighted", "antiproton_recTpc_jet_unweighted", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); - registryMC.add("antiproton_recTpc_ue_unweighted", "antiproton_recTpc_ue_unweighted", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); - registryMC.add("antiproton_recTpc_jet_weighted2d", "antiproton_recTpc_jet_weighted2d", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); - registryMC.add("antiproton_recTpc_ue_weighted2d", "antiproton_recTpc_ue_weighted2d", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); - registryMC.add("antiproton_recTpc_jet_weightedFinal", "antiproton_recTpc_jet_weightedFinal", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); - registryMC.add("antiproton_recTpc_ue_weightedFinal", "antiproton_recTpc_ue_weightedFinal", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); - registryMC.add("antiproton_recTpc_jet_antikt", "antiproton_recTpc_jet_antikt", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); - registryMC.add("antiproton_recTpc_ue_antikt", "antiproton_recTpc_ue_antikt", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); - - // reconstructed TPC (antinuclei) - registryMC.add("antideuteron_incl_rec_tpc", "antideuteron_incl_rec_tpc", HistType::kTH1F, {{nbins, 2 * min, 2 * max, "#it{p}_{T} (GeV/#it{c})"}}); - registryMC.add("deuteron_incl_rec_tpc", "deuteron_incl_rec_tpc", HistType::kTH1F, {{nbins, 2 * min, 2 * max, "#it{p}_{T} (GeV/#it{c})"}}); - registryMC.add("antihelium3_incl_rec_tpc", "antihelium3_incl_rec_tpc", HistType::kTH1F, {{nbins, 3 * min, 3 * max, "#it{p}_{T} (GeV/#it{c})"}}); - registryMC.add("helium3_incl_rec_tpc", "helium3_incl_rec_tpc", HistType::kTH1F, {{nbins, 3 * min, 3 * max, "#it{p}_{T} (GeV/#it{c})"}}); - - // reconstructed TOF (antiprotons) - registryMC.add("antiproton_recTof_jet_unweighted", "antiproton_recTof_jet_unweighted", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); - registryMC.add("antiproton_recTof_ue_unweighted", "antiproton_recTof_ue_unweighted", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); - registryMC.add("antiproton_recTof_jet_weighted2d", "antiproton_recTof_jet_weighted2d", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); - registryMC.add("antiproton_recTof_ue_weighted2d", "antiproton_recTof_ue_weighted2d", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); - registryMC.add("antiproton_recTof_jet_weightedFinal", "antiproton_recTof_jet_weightedFinal", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); - registryMC.add("antiproton_recTof_ue_weightedFinal", "antiproton_recTof_ue_weightedFinal", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); - registryMC.add("antiproton_recTof_jet_antikt", "antiproton_recTof_jet_antikt", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); - registryMC.add("antiproton_recTof_ue_antikt", "antiproton_recTof_ue_antikt", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); - - // reconstructed TOF (antinuclei) - registryMC.add("antideuteron_incl_rec_tof", "antideuteron_incl_rec_tof", HistType::kTH1F, {{nbins, 2 * min, 2 * max, "#it{p}_{T} (GeV/#it{c})"}}); - registryMC.add("deuteron_incl_rec_tof", "deuteron_incl_rec_tof", HistType::kTH1F, {{nbins, 2 * min, 2 * max, "#it{p}_{T} (GeV/#it{c})"}}); - - // fraction of primary antiprotons from MC (all unweighted for now) + // Reconstructed antiproton spectra in jets and UE (MC-matched) with TPC/TOF PID + if (doprocessJetsMCrec) { + + // Event counter + registryMC.add("recEvents", "number of reconstructed events in mc", HistType::kTH1F, {{20, 0, 20, "counter"}}); + + // Reconstructed spectra of antiprotons + registryMC.add("antiproton_rec_tpc_jet", "antiproton_rec_tpc_jet", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); + registryMC.add("antiproton_rec_tof_jet", "antiproton_rec_tof_jet", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); + registryMC.add("antiproton_rec_tpc_ue", "antiproton_rec_tpc_ue", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); + registryMC.add("antiproton_rec_tof_ue", "antiproton_rec_tof_ue", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); + + // Fraction of primary antiprotons registryMC.add("antiproton_prim_jet", "antiproton_prim_jet", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); registryMC.add("antiproton_incl_jet", "antiproton_incl_jet", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); registryMC.add("antiproton_prim_ue", "antiproton_prim_ue", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); registryMC.add("antiproton_incl_ue", "antiproton_incl_ue", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); - // DCA Templates + // DCA templates registryMC.add("antiproton_prim_dca_jet", "antiproton_prim_dca_jet", HistType::kTH2F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}, {200, -1, 1, "DCA_{xy} (cm)"}}); registryMC.add("antiproton_prim_dca_ue", "antiproton_prim_dca_ue", HistType::kTH2F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}, {200, -1, 1, "DCA_{xy} (cm)"}}); registryMC.add("antiproton_all_dca_jet", "antiproton_all_dca_jet", HistType::kTH2F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}, {200, -1, 1, "DCA_{xy} (cm)"}}); registryMC.add("antiproton_all_dca_ue", "antiproton_all_dca_ue", HistType::kTH2F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}, {200, -1, 1, "DCA_{xy} (cm)"}}); - - // antiproton reweighting - registryMC.add("antiproton_eta_pt_pythia", "antiproton_eta_pt_pythia", HistType::kTH2F, {{200, 0.0, 10.0, "#it{p}_{T} (GeV/#it{c})"}, {20, -1.0, 1.0, "#it{#eta}"}}); - registryMC.add("antiproton_eta_pt_jet", "antiproton_eta_pt_jet", HistType::kTH2F, {{200, 0.0, 10.0, "#it{p}_{T} (GeV/#it{c})"}, {20, -1.0, 1.0, "#it{#eta}"}}); - registryMC.add("antiproton_eta_pt_ue", "antiproton_eta_pt_ue", HistType::kTH2F, {{200, 0.0, 10.0, "#it{p}_{T} (GeV/#it{c})"}, {20, -1.0, 1.0, "#it{#eta}"}}); - registryMC.add("antiproton_forReweighting_jet_weighted2d", "antiproton_forReweighting_jet_weighted2d", HistType::kTH1F, {{5000, 0.0, 5.0, "#it{p}_{T} (GeV/#it{c})"}}); - registryMC.add("antiproton_forReweighting_ue_weighted2d", "antiproton_forReweighting_ue_weighted2d", HistType::kTH1F, {{5000, 0.0, 5.0, "#it{p}_{T} (GeV/#it{c})"}}); - registryMC.add("antiproton_forReweighting_jet_weightedFinal", "antiproton_forReweighting_jet_weightedFinal", HistType::kTH1F, {{5000, 0.0, 5.0, "#it{p}_{T} (GeV/#it{c})"}}); - registryMC.add("antiproton_forReweighting_ue_weightedFinal", "antiproton_forReweighting_ue_weightedFinal", HistType::kTH1F, {{5000, 0.0, 5.0, "#it{p}_{T} (GeV/#it{c})"}}); } - if (doprocessJetsMCrec) { - // detector response matrix - registryMC.add("detectorResponseMatrix", "detectorResponseMatrix", HistType::kTH2F, {{1000, 0.0, 100.0, "#it{p}_{T}^{rec} (GeV/#it{c})"}, {2000, -20.0, 20.0, "#it{p}_{T}^{gen} - #it{p}_{T}^{rec} (GeV/#it{c})"}}); - registryMC.add("generatedVsReconstructedPt", "generatedVsReconstructedPt", HistType::kTH2F, {{1000, 0.0, 100.0, "#it{p}_{T}^{rec} (GeV/#it{c})"}, {1000, 0.0, 100.0, "#it{p}_{T}^{gen} (GeV/#it{c})"}}); + // Efficiency of antinuclei + if (doprocessAntinucleiEfficiency) { + + // Event counter MC + registryMC.add("number_of_events_mc_nuclei_efficiency", "number of events in mc", HistType::kTH1F, {{20, 0, 20, "counter"}}); + + // Generated spectra of (anti)protons + registryMC.add("antip_gen_jet", "antip_gen_jet", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); + registryMC.add("antip_gen_ue", "antip_gen_ue", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); + + // Generated spectra of (anti)deuterons + registryMC.add("deuteron_gen_jet", "deuteron_gen_jet", HistType::kTH1F, {{nbins, 2 * min, 2 * max, "#it{p}_{T} (GeV/#it{c})"}}); + registryMC.add("deuteron_gen_ue", "deuteron_gen_ue", HistType::kTH1F, {{nbins, 2 * min, 2 * max, "#it{p}_{T} (GeV/#it{c})"}}); + registryMC.add("antideuteron_gen_jet", "antideuteron_gen_jet", HistType::kTH1F, {{nbins, 2 * min, 2 * max, "#it{p}_{T} (GeV/#it{c})"}}); + registryMC.add("antideuteron_gen_ue", "antideuteron_gen_ue", HistType::kTH1F, {{nbins, 2 * min, 2 * max, "#it{p}_{T} (GeV/#it{c})"}}); + + // Generated spectra of (anti)helium3 + registryMC.add("helium3_gen_jet", "helium3_gen_jet", HistType::kTH1F, {{nbins, 3 * min, 3 * max, "#it{p}_{T} (GeV/#it{c})"}}); + registryMC.add("helium3_gen_ue", "helium3_gen_ue", HistType::kTH1F, {{nbins, 3 * min, 3 * max, "#it{p}_{T} (GeV/#it{c})"}}); + registryMC.add("antihelium3_gen_jet", "antihelium3_gen_jet", HistType::kTH1F, {{nbins, 3 * min, 3 * max, "#it{p}_{T} (GeV/#it{c})"}}); + registryMC.add("antihelium3_gen_ue", "antihelium3_gen_ue", HistType::kTH1F, {{nbins, 3 * min, 3 * max, "#it{p}_{T} (GeV/#it{c})"}}); + + // Reconstructed spectra of antiprotons + registryMC.add("antip_rec_tpc_jet", "antip_rec_tpc_jet", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); + registryMC.add("antip_rec_tof_jet", "antip_rec_tof_jet", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); + registryMC.add("antip_rec_tpc_ue", "antip_rec_tpc_ue", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); + registryMC.add("antip_rec_tof_ue", "antip_rec_tof_ue", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); + + // Reconstructed spectra of (anti)deuterons + registryMC.add("deuteron_rec_tpc_jet", "deuteron_rec_tpc_jet", HistType::kTH1F, {{nbins, 2 * min, 2 * max, "#it{p}_{T} (GeV/#it{c})"}}); + registryMC.add("deuteron_rec_tof_jet", "deuteron_rec_tof_jet", HistType::kTH1F, {{nbins, 2 * min, 2 * max, "#it{p}_{T} (GeV/#it{c})"}}); + registryMC.add("deuteron_rec_tpc_ue", "deuteron_rec_tpc_ue", HistType::kTH1F, {{nbins, 2 * min, 2 * max, "#it{p}_{T} (GeV/#it{c})"}}); + registryMC.add("deuteron_rec_tof_ue", "deuteron_rec_tof_ue", HistType::kTH1F, {{nbins, 2 * min, 2 * max, "#it{p}_{T} (GeV/#it{c})"}}); + registryMC.add("antideuteron_rec_tpc_jet", "antideuteron_rec_tpc_jet", HistType::kTH1F, {{nbins, 2 * min, 2 * max, "#it{p}_{T} (GeV/#it{c})"}}); + registryMC.add("antideuteron_rec_tof_jet", "antideuteron_rec_tof_jet", HistType::kTH1F, {{nbins, 2 * min, 2 * max, "#it{p}_{T} (GeV/#it{c})"}}); + registryMC.add("antideuteron_rec_tpc_ue", "antideuteron_rec_tpc_ue", HistType::kTH1F, {{nbins, 2 * min, 2 * max, "#it{p}_{T} (GeV/#it{c})"}}); + registryMC.add("antideuteron_rec_tof_ue", "antideuteron_rec_tof_ue", HistType::kTH1F, {{nbins, 2 * min, 2 * max, "#it{p}_{T} (GeV/#it{c})"}}); + + // Reconstructed spectra of (anti)helium3 + registryMC.add("helium3_rec_tpc_jet", "helium3_rec_tpc_jet", HistType::kTH1F, {{nbins, 3 * min, 3 * max, "#it{p}_{T} (GeV/#it{c})"}}); + registryMC.add("helium3_rec_tpc_ue", "helium3_rec_tpc_ue", HistType::kTH1F, {{nbins, 3 * min, 3 * max, "#it{p}_{T} (GeV/#it{c})"}}); + registryMC.add("antihelium3_rec_tpc_jet", "antihelium3_rec_tpc_jet", HistType::kTH1F, {{nbins, 3 * min, 3 * max, "#it{p}_{T} (GeV/#it{c})"}}); + registryMC.add("antihelium3_rec_tpc_ue", "antihelium3_rec_tpc_ue", HistType::kTH1F, {{nbins, 3 * min, 3 * max, "#it{p}_{T} (GeV/#it{c})"}}); } - // systematic uncertainties - if (doprocessSystematicsData) { - registryData.add("number_of_rejected_events_syst", "check on number of events rejected", HistType::kTH1F, {{10, 0, 10, "counter"}}); - registryData.add("antiproton_tpc_syst", "antiproton_tpc_syst", HistType::kTHnSparseF, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TPC}"}, {10, 0, 10, "systematic uncertainty"}}); - registryData.add("antiproton_tof_syst", "antiproton_tof_syst", HistType::kTHnSparseF, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TOF}"}, {10, 0, 10, "systematic uncertainty"}}); - registryData.add("antideuteron_tpc_syst", "antideuteron_tpc_syst", HistType::kTHnSparseF, {{nbins, min * 2, max * 2, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TPC}"}, {10, 0, 10, "systematic uncertainty"}}); - registryData.add("antideuteron_tof_syst", "antideuteron_tof_syst", HistType::kTHnSparseF, {{nbins, min * 2, max * 2, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TOF}"}, {10, 0, 10, "systematic uncertainty"}}); + // Systematic uncertainties (Data) + if (doprocessSystData) { + registryData.add("number_of_events_data_syst", "event counter", HistType::kTH1F, {{20, 0, 20, "counter"}}); + + registryData.add("antiproton_tpc_syst", "antiproton_tpc_syst", HistType::kTH3F, {{50, 0, 50, "systematic uncertainty"}, {nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TPC}"}}); + registryData.add("antiproton_tof_syst", "antiproton_tof_syst", HistType::kTH3F, {{50, 0, 50, "systematic uncertainty"}, {nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TOF}"}}); + registryData.add("antideuteron_tpc_syst", "antideuteron_tpc_syst", HistType::kTH3F, {{50, 0, 50, "systematic uncertainty"}, {nbins, 2 * min, 2 * max, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TPC}"}}); + registryData.add("antideuteron_tof_syst", "antideuteron_tof_syst", HistType::kTH3F, {{50, 0, 50, "systematic uncertainty"}, {nbins, 2 * min, 2 * max, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TOF}"}}); + registryData.add("antihelium3_tpc_syst", "antihelium3_tpc_syst", HistType::kTH3F, {{50, 0, 50, "systematic uncertainty"}, {nbins, 3 * min, 3 * max, "#it{p}_{T} (GeV/#it{c})"}, {400, -20.0, 20.0, "n#sigma_{TPC}"}}); } - if (doprocessSystematicsEfficiency) { - registryMC.add("antiproton_incl_gen_syst", "antiproton_incl_gen_syst", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); - registryMC.add("antideuteron_incl_gen_syst", "antideuteron_incl_gen_syst", HistType::kTH1F, {{nbins, min * 2, max * 2, "#it{p}_{T} (GeV/#it{c})"}}); - registryMC.add("antiproton_incl_prim_syst", "antiproton_incl_prim_syst", HistType::kTHnSparseF, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}, {10, 0, 10, "systematic uncertainty"}}); - registryMC.add("antiproton_incl_rec_tpc_syst", "antiproton_incl_rec_tpc_syst", HistType::kTHnSparseF, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}, {10, 0, 10, "systematic uncertainty"}}); - registryMC.add("antiproton_incl_rec_tof_syst", "antiproton_incl_rec_tof_syst", HistType::kTHnSparseF, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}, {10, 0, 10, "systematic uncertainty"}}); - registryMC.add("antideuteron_incl_rec_tpc_syst", "antideuteron_incl_rec_tpc_syst", HistType::kTHnSparseF, {{nbins, 2 * min, 2 * max, "#it{p}_{T} (GeV/#it{c})"}, {10, 0, 10, "systematic uncertainty"}}); - registryMC.add("antideuteron_incl_rec_tof_syst", "antideuteron_incl_rec_tof_syst", HistType::kTHnSparseF, {{nbins, 2 * min, 2 * max, "#it{p}_{T} (GeV/#it{c})"}, {10, 0, 10, "systematic uncertainty"}}); + // Systematic uncertainties (MC) + if (doprocessSystEff) { + + // Histograms for generated antiparticles + registryMC.add("antiproton_gen_syst", "antiproton_gen_syst", HistType::kTH1F, {{nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); + registryMC.add("antideuteron_gen_syst", "antideuteron_gen_syst", HistType::kTH1F, {{nbins, 2 * min, 2 * max, "#it{p}_{T} (GeV/#it{c})"}}); + registryMC.add("antihelium3_gen_syst", "antihelium3_gen_syst", HistType::kTH1F, {{nbins, 3 * min, 3 * max, "#it{p}_{T} (GeV/#it{c})"}}); + + // Histograms for reconstructed antiparticles + registryMC.add("antiproton_rec_tpc_syst", "antiproton_rec_tpc_syst", HistType::kTH2F, {{50, 0, 50, "systematic uncertainty"}, {nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); + registryMC.add("antiproton_rec_tof_syst", "antiproton_rec_tof_syst", HistType::kTH2F, {{50, 0, 50, "systematic uncertainty"}, {nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); + registryMC.add("antideuteron_rec_tpc_syst", "antideuteron_rec_tpc_syst", HistType::kTH2F, {{50, 0, 50, "systematic uncertainty"}, {nbins, 2 * min, 2 * max, "#it{p}_{T} (GeV/#it{c})"}}); + registryMC.add("antideuteron_rec_tof_syst", "antideuteron_rec_tof_syst", HistType::kTH2F, {{50, 0, 50, "systematic uncertainty"}, {nbins, 2 * min, 2 * max, "#it{p}_{T} (GeV/#it{c})"}}); + registryMC.add("antihelium3_rec_tpc_syst", "antihelium3_rec_tpc_syst", HistType::kTH2F, {{50, 0, 50, "systematic uncertainty"}, {nbins, 3 * min, 3 * max, "#it{p}_{T} (GeV/#it{c})"}}); + + // Histograms for primary antiprotons + registryMC.add("antiproton_incl_syst", "antiproton_incl_syst", HistType::kTH2F, {{50, 0, 50, "systematic uncertainty"}, {nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); + registryMC.add("antiproton_prim_syst", "antiproton_prim_syst", HistType::kTH2F, {{50, 0, 50, "systematic uncertainty"}, {nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); } } + // Compute two unit vectors perpendicular to p void getPerpendicularAxis(const TVector3& p, TVector3& u, double sign) { double px = p.X(); @@ -375,6 +402,7 @@ struct AntinucleiInJets { u.SetXYZ(ux, uy, pz); } + // Compute delta phi double getDeltaPhi(double a1, double a2) { double deltaPhi(0); @@ -398,20 +426,18 @@ struct AntinucleiInJets { return (track.itsClusterMap() & (1 << ibit)); } - // single-track selection for particles inside jets + // Single-track selection for particles inside jets template bool passedTrackSelectionForJetReconstruction(const JetTrack& track) { - - const int minTpcCr = 70; - const double maxChi2Tpc = 4.0; - const double maxChi2Its = 36.0; - const double maxPseudorapidity = 0.8; - const double minPtTrack = 0.1; - const double dcaxyMaxTrackPar0 = 0.0105; - const double dcaxyMaxTrackPar1 = 0.035; - const double dcaxyMaxTrackPar2 = 1.1; - const double dcazMaxTrack = 2.0; + static constexpr int MinTpcCr = 70; + static constexpr double MaxChi2Tpc = 4.0; + static constexpr double MaxChi2Its = 36.0; + static constexpr double MinPtTrack = 0.1; + static constexpr double DcaxyMaxTrackPar0 = 0.0105; + static constexpr double DcaxyMaxTrackPar1 = 0.035; + static constexpr double DcaxyMaxTrackPar2 = 1.1; + static constexpr double DcazMaxTrack = 2.0; if (!track.hasITS()) return false; @@ -419,24 +445,24 @@ struct AntinucleiInJets { return false; if (!track.hasTPC()) return false; - if (track.tpcNClsCrossedRows() < minTpcCr) + if (track.tpcNClsCrossedRows() < MinTpcCr) return false; - if (track.tpcChi2NCl() > maxChi2Tpc) + if (track.tpcChi2NCl() > MaxChi2Tpc) return false; - if (track.itsChi2NCl() > maxChi2Its) + if (track.itsChi2NCl() > MaxChi2Its) return false; - if (track.eta() < -maxPseudorapidity || track.eta() > maxPseudorapidity) + if (std::fabs(track.eta()) > maxEta) return false; - if (track.pt() < minPtTrack) + if (track.pt() < MinPtTrack) return false; - if (std::fabs(track.dcaXY()) > (dcaxyMaxTrackPar0 + dcaxyMaxTrackPar1 / std::pow(track.pt(), dcaxyMaxTrackPar2))) + if (std::fabs(track.dcaXY()) > (DcaxyMaxTrackPar0 + DcaxyMaxTrackPar1 / std::pow(track.pt(), DcaxyMaxTrackPar2))) return false; - if (std::fabs(track.dcaZ()) > dcazMaxTrack) + if (std::fabs(track.dcaZ()) > DcazMaxTrack) return false; return true; } - // single-track selection + // Single-track selection for antinuclei template bool passedTrackSelection(const AntinucleusTrack& track) { @@ -462,6 +488,72 @@ struct AntinucleiInJets { return true; } + // Single-track selection for antinuclei candidates with systematic variations + template + bool passedTrackSelectionSyst(const AntinucleusTrack& track, int isyst) + { + // Define cut settings + static std::vector minItsNclustersSyst = { + 3, 7, 6, 6, 6, 4, 5, 6, 7, 4, + 4, 3, 6, 3, 7, 5, 4, 6, 5, 7, + 6, 5, 3, 5, 4, 3, 6, 6, 4, 7, + 3, 4, 3, 5, 7, 6, 6, 4, 3, 5, + 4, 7, 3, 6, 4, 5, 6, 3, 7, 5}; + static std::vector minTpcNcrossedRowsSyst = { + 72, 99, 87, 66, 83, 71, 78, 74, 84, 94, + 89, 85, 66, 80, 95, 74, 76, 77, 67, 88, + 61, 100, 97, 78, 81, 91, 64, 63, 93, 69, + 87, 99, 65, 62, 96, 60, 75, 92, 82, 89, + 98, 70, 90, 85, 73, 79, 68, 86, 97, 61}; + static std::vector maxChiSquareTpcSyst = { + 4.28, 4.81, 4.43, 4.02, 3.38, 3.58, 3.11, 4.17, 3.51, 4.53, + 4.90, 3.07, 3.20, 4.86, 4.62, 3.91, 3.98, 4.38, 3.66, 3.84, + 3.03, 3.14, 4.96, 4.07, 4.75, 4.32, 3.31, 3.78, 4.11, 3.23, + 3.87, 3.70, 4.99, 4.48, 4.69, 4.25, 3.93, 3.45, 4.58, 3.35, + 3.18, 3.60, 4.21, 3.75, 4.64, 4.35, 3.26, 3.42, 4.15, 3.09}; + static std::vector maxChiSquareItsSyst = { + 42.84, 48.66, 39.27, 34.09, 43.73, 36.98, 30.23, 49.11, 37.67, 35.10, + 44.55, 46.79, 38.92, 40.66, 47.14, 33.46, 30.88, 41.32, 45.90, 39.68, + 31.42, 32.71, 43.17, 36.04, 49.80, 33.95, 31.89, 38.37, 48.08, 35.87, + 47.61, 44.02, 32.15, 46.21, 34.75, 40.17, 37.14, 30.55, 45.42, 42.30, + 41.79, 33.21, 39.12, 47.98, 36.52, 31.58, 49.44, 38.02, 35.56, 43.49}; + static std::vector minEtaSyst = { + -0.804, -0.844, -0.751, -0.784, -0.819, -0.823, -0.768, -0.781, -0.845, -0.787, + -0.758, -0.828, -0.776, -0.842, -0.808, -0.763, -0.849, -0.770, -0.799, -0.754, + -0.825, -0.847, -0.806, -0.783, -0.796, -0.835, -0.777, -0.752, -0.838, -0.813, + -0.785, -0.802, -0.795, -0.846, -0.780, -0.829, -0.817, -0.773, -0.765, -0.789, + -0.800, -0.839, -0.758, -0.820, -0.833, -0.762, -0.792, -0.809, -0.827, -0.751}; + static std::vector maxEtaSyst = { + 0.804, 0.844, 0.751, 0.784, 0.819, 0.823, 0.768, 0.781, 0.845, 0.787, + 0.758, 0.828, 0.776, 0.842, 0.808, 0.763, 0.849, 0.770, 0.799, 0.754, + 0.825, 0.847, 0.806, 0.783, 0.796, 0.835, 0.777, 0.752, 0.838, 0.813, + 0.785, 0.802, 0.795, 0.846, 0.780, 0.829, 0.817, 0.773, 0.765, 0.789, + 0.800, 0.839, 0.758, 0.820, 0.833, 0.762, 0.792, 0.809, 0.827, 0.751}; + + // Track Selection + if (requirePvContributor && !(track.isPVContributor())) + return false; + if (!track.hasITS()) + return false; + if (track.itsNCls() < minItsNclustersSyst[isyst]) + return false; + if (!track.hasTPC()) + return false; + if (track.tpcNClsCrossedRows() < minTpcNcrossedRowsSyst[isyst]) + return false; + if (track.tpcChi2NCl() > maxChiSquareTpcSyst[isyst]) + return false; + if (track.itsChi2NCl() > maxChiSquareItsSyst[isyst]) + return false; + if (track.eta() < minEtaSyst[isyst] || track.eta() > maxEtaSyst[isyst]) + return false; + if (track.pt() < minPt) + return false; + + return true; + } + + // Selection of high-purity antiproton sample template bool isHighPurityAntiproton(const AntiprotonTrack& track) { @@ -469,115 +561,80 @@ struct AntinucleiInJets { double nsigmaTPCPr = track.tpcNSigmaPr(); double nsigmaTOFPr = track.tofNSigmaPr(); double pt = track.pt(); - double ptThreshold = 0.5; - double nsigmaMaxPr = 2.0; + static constexpr double PtThreshold = 0.5; + static constexpr double NsigmaMaxPr = 2.0; - if (pt < ptThreshold && std::fabs(nsigmaTPCPr) < nsigmaMaxPr) + if (pt < PtThreshold && std::fabs(nsigmaTPCPr) < NsigmaMaxPr) return true; - if (pt >= ptThreshold && std::fabs(nsigmaTPCPr) < nsigmaMaxPr && track.hasTOF() && std::fabs(nsigmaTOFPr) < nsigmaMaxPr) + if (pt >= PtThreshold && std::fabs(nsigmaTPCPr) < NsigmaMaxPr && track.hasTOF() && std::fabs(nsigmaTOFPr) < NsigmaMaxPr) return true; return false; } - double getCorrectedPt(double ptRec, TH2* responseMatrix) + // Event rejection + bool rejectEvent() { - if (!responseMatrix) { - LOGP(error, "Response matrix is null. Returning uncorrected pt."); - return ptRec; - } - - int binX = responseMatrix->GetXaxis()->FindBin(ptRec); - if (binX < 1 || binX > responseMatrix->GetNbinsX()) { - LOGP(error, "Bin index out of range: binX = {}", binX); - return ptRec; // Return uncorrected pt if bin index is invalid - } - std::unique_ptr proj(responseMatrix->ProjectionY("proj", binX, binX)); - - // add a protection in case the projection is empty - if (proj->GetEntries() == 0) { - return ptRec; - } - - double deltaPt = proj->GetRandom(); - double ptGen = ptRec + deltaPt; + static std::random_device rd; + static std::mt19937 gen(rd()); + static std::uniform_real_distribution dis(0.0, 100.0); - return ptGen; + return dis(gen) < rejectionPercentage; } - void getPtUnfoldingHistogram(o2::framework::Service const& ccdbObj, TString filepath, TString histoNamePtUnfolding) + // Process Data + void processData(SelectedCollisions::iterator const& collision, AntiNucleiTracks const& tracks, aod::BCsWithTimestamps const&) { - TList* l = ccdbObj->get(filepath.Data()); - if (!l) { - LOGP(error, "Could not open the file {}", Form("%s", filepath.Data())); - return; - } - TObject* obj = l->FindObject(Form("%s", histoNamePtUnfolding.Data())); - if (!obj || !obj->InheritsFrom(TH2F::Class())) { - LOGP(error, "Could not find a valid TH2F histogram {}", Form("%s", histoNamePtUnfolding.Data())); - return; - } - responseMatrix = static_cast(obj); - LOGP(info, "Opened histogram {}", Form("%s", histoNamePtUnfolding.Data())); - } + // Event counter: before event selection + registryData.fill(HIST("number_of_events_data"), 0.5); - void getReweightingHistograms(o2::framework::Service const& ccdbObj, TString filepath, TString histname_antip_jet, TString histname_antip_ue) - { - TList* l = ccdbObj->get(filepath.Data()); - if (!l) { - LOGP(error, "Could not open the file {}", Form("%s", filepath.Data())); - return; - } - twoDweightsAntipJet = static_cast(l->FindObject(Form("%s_antiproton", histname_antip_jet.Data()))); - if (!twoDweightsAntipJet) { - LOGP(error, "Could not open histogram {}", Form("%s_antiproton", histname_antip_jet.Data())); + // Retrieve the bunch crossing information with timestamps from the collision + auto bc = collision.template bc_as(); + initCCDB(bc); + + // If skimmed processing is enabled, apply Zorro trigger selection + if (cfgSkimmedProcessing && !zorro.isSelected(collision.template bc_as().globalBC())) { return; } - twoDweightsAntipUe = static_cast(l->FindObject(Form("%s_antiproton", histname_antip_ue.Data()))); - if (!twoDweightsAntipUe) { - LOGP(error, "Could not open histogram {}", Form("%s_antiproton", histname_antip_ue.Data())); + registryData.fill(HIST("number_of_events_data"), 1.5); + + // Apply standard event selection + if (!collision.sel8() || std::fabs(collision.posZ()) > zVtx) return; - } - LOGP(info, "Opened histogram {}", Form("%s_antiproton", histname_antip_jet.Data())); - LOGP(info, "Opened histogram {}", Form("%s_antiproton", histname_antip_ue.Data())); - } - bool shouldRejectEvent() - { - static std::random_device rd; - static std::mt19937 gen(rd()); - static std::uniform_int_distribution<> dis(0, 99); - int randomNumber = dis(gen); - if (randomNumber > rejectionPercentage) { - return false; // accept event - } - return true; // reject event - } + // Event counter: after event selection + registryData.fill(HIST("number_of_events_data"), 2.5); - // Process Data - void processData(SelectedCollisions::iterator const& collision, FullNucleiTracks const& tracks) - { - if (rejectEvents) { - // event counter: before event rejection - registryData.fill(HIST("number_of_rejected_events"), 0.5); + // Reject events near the ITS Read-Out Frame border + if (rejectITSROFBorder && !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) + return; + registryData.fill(HIST("number_of_events_data"), 3.5); - if (shouldRejectEvent()) - return; + // Reject events at the Time Frame border + if (rejectTFBorder && !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) + return; + registryData.fill(HIST("number_of_events_data"), 4.5); - // event counter: after event rejection - registryData.fill(HIST("number_of_rejected_events"), 1.5); - } + // Require at least one ITS-TPC matched track + if (requireVtxITSTPC && !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) + return; + registryData.fill(HIST("number_of_events_data"), 5.5); - // event counter: before event selection - registryData.fill(HIST("number_of_events_data"), 0.5); + // Reject events with same-bunch pileup + if (rejectSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) + return; + registryData.fill(HIST("number_of_events_data"), 6.5); - // event selection - if (!collision.sel8() || std::fabs(collision.posZ()) > zVtx) + // Require consistent FT0 vs PV z-vertex + if (requireIsGoodZvtxFT0VsPV && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) return; + registryData.fill(HIST("number_of_events_data"), 7.5); - // event counter: after event selection - registryData.fill(HIST("number_of_events_data"), 1.5); + // Require TOF match for at least one vertex track + if (requireIsVertexTOFmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTOFmatched)) + return; + registryData.fill(HIST("number_of_events_data"), 8.5); - // loop over reconstructed tracks + // Loop over reconstructed tracks int id(-1); std::vector fjParticles; for (auto const& track : tracks) { @@ -591,60 +648,64 @@ struct AntinucleiInJets { fjParticles.emplace_back(fourMomentum); } - // reject empty events - if (fjParticles.size() < 1) + // Reject empty events + if (fjParticles.empty()) return; - registryData.fill(HIST("number_of_events_data"), 2.5); + registryData.fill(HIST("number_of_events_data"), 9.5); - // cluster particles using the anti-kt algorithm + // Cluster particles using the anti-kt algorithm fastjet::JetDefinition jetDef(fastjet::antikt_algorithm, rJet); - fastjet::AreaDefinition areaDef(fastjet::active_area, fastjet::GhostedAreaSpec(1.0)); // active_area_explicit_ghosts + fastjet::AreaDefinition areaDef(fastjet::active_area, fastjet::GhostedAreaSpec(1.0)); fastjet::ClusterSequenceArea cs(fjParticles, jetDef, areaDef); std::vector jets = fastjet::sorted_by_pt(cs.inclusive_jets()); auto [rhoPerp, rhoMPerp] = backgroundSub.estimateRhoPerpCone(fjParticles, jets); - // loop over reconstructed jets + // Loop over reconstructed jets bool isAtLeastOneJetSelected = false; for (const auto& jet : jets) { - // jet must be fully contained in the acceptance + // Jet must be fully contained in the acceptance if ((std::fabs(jet.eta()) + rJet) > (maxEta - deltaEtaEdge)) continue; - // jet pt must be larger than threshold + // Jet pt must be larger than threshold auto jetForSub = jet; fastjet::PseudoJet jetMinusBkg = backgroundSub.doRhoAreaSub(jetForSub, rhoPerp, rhoMPerp); - // if (getCorrectedPt(jetMinusBkg.pt(), responseMatrix) < minJetPt) - registryData.fill(HIST("ptDistributionJet"), jet.pt()); - if (jetMinusBkg.pt() < minJetPt) continue; + + // Apply area cut if required + double normalizedJetArea = jet.area() / (PI * rJet * rJet); + if (applyAreaCut && normalizedJetArea > maxNormalizedJetArea) + continue; isAtLeastOneJetSelected = true; - // perpendicular cone + // Perpendicular cones double coneRadius = std::sqrt(jet.area() / PI); - TVector3 jetAxis(jet.px(), jet.py(), jet.pz()); // before or after subtraction of perpendicular cone? + TVector3 jetAxis(jet.px(), jet.py(), jet.pz()); TVector3 ueAxis1(0, 0, 0); TVector3 ueAxis2(0, 0, 0); getPerpendicularAxis(jetAxis, ueAxis1, +1); getPerpendicularAxis(jetAxis, ueAxis2, -1); - // Jet Area - registryData.fill(HIST("jetEffectiveArea"), jet.area() / (PI * rJet * rJet)); + // Fill histogram with jet effective area / piR^2 + registryData.fill(HIST("jetEffectiveAreaOverPiR2"), jet.area() / (PI * rJet * rJet)); - // get jet constituents + // Get jet constituents std::vector jetConstituents = jet.constituents(); + + // Initialize ITS PID Response object o2::aod::ITSResponse itsResponse; - // loop over jet constituents + // Loop over jet constituents for (const auto& particle : jetConstituents) { - // get corresponding track and apply track selection criteria + // Get corresponding track and apply track selection criteria auto const& track = tracks.iteratorAt(particle.user_index()); if (!passedTrackSelection(track)) continue; - // variables + // Define variables double nsigmaTPCPr = track.tpcNSigmaPr(); double nsigmaTOFPr = track.tofNSigmaPr(); double nsigmaTPCDe = track.tpcNSigmaDe(); @@ -654,12 +715,12 @@ struct AntinucleiInJets { double dcaxy = track.dcaXY(); double dcaz = track.dcaZ(); - // fill DCA distribution for antiprotons + // Fill DCA distribution for antiprotons if (track.sign() < 0 && isHighPurityAntiproton(track) && std::fabs(dcaz) < maxDcaz) { registryData.fill(HIST("antiproton_dca_jet"), pt, dcaxy); } - // DCA selections + // Apply DCA selections if (std::fabs(dcaxy) > maxDcaxy || std::fabs(dcaz) > maxDcaz) continue; @@ -679,7 +740,7 @@ struct AntinucleiInJets { passedItsPidHel = false; } - // antimatter + // Fill histograms for antimatter if (track.sign() < 0) { if (passedItsPidProt) { registryData.fill(HIST("antiproton_jet_tpc"), pt, nsigmaTPCPr); @@ -696,33 +757,45 @@ struct AntinucleiInJets { } } - // matter + // Fill histograms for matter if (track.sign() > 0) { - if (passedItsPidDeut && nsigmaTPCDe > minNsigmaTpc && nsigmaTPCDe < maxNsigmaTpc && track.hasTOF()) - registryData.fill(HIST("deuteron_jet_tof"), pt, nsigmaTOFDe); + if (passedItsPidDeut) { + registryData.fill(HIST("deuteron_jet_tpc"), pt, nsigmaTPCDe); + if (nsigmaTPCDe > minNsigmaTpc && nsigmaTPCDe < maxNsigmaTpc && track.hasTOF()) + registryData.fill(HIST("deuteron_jet_tof"), pt, nsigmaTOFDe); + } if (passedItsPidHel) { registryData.fill(HIST("helium3_jet_tpc"), 2.0 * pt, nsigmaTPCHe); } } } - // underlying event + // Loop over tracks in the underlying event for (auto const& track : tracks) { - // get corresponding track and apply track selection criteria + // Get corresponding track and apply track selection criteria if (!passedTrackSelection(track)) continue; + // Calculate the angular distance between the track and underlying event axes in eta-phi space double deltaEtaUe1 = track.eta() - ueAxis1.Eta(); double deltaPhiUe1 = getDeltaPhi(track.phi(), ueAxis1.Phi()); double deltaRUe1 = std::sqrt(deltaEtaUe1 * deltaEtaUe1 + deltaPhiUe1 * deltaPhiUe1); double deltaEtaUe2 = track.eta() - ueAxis2.Eta(); double deltaPhiUe2 = getDeltaPhi(track.phi(), ueAxis2.Phi()); double deltaRUe2 = std::sqrt(deltaEtaUe2 * deltaEtaUe2 + deltaPhiUe2 * deltaPhiUe2); - if (deltaRUe1 > coneRadius && deltaRUe2 > coneRadius) + + // Determine the maximum allowed distance from UE axes for particle selection + double maxConeRadius = coneRadius; + if (applyAreaCut) { + maxConeRadius = std::sqrt(maxNormalizedJetArea) * rJet; + } + + // Reject tracks that lie outside the maxConeRadius from both UE axes + if (deltaRUe1 > maxConeRadius && deltaRUe2 > maxConeRadius) continue; - // variables + // Define variables double nsigmaTPCPr = track.tpcNSigmaPr(); double nsigmaTOFPr = track.tofNSigmaPr(); double nsigmaTPCDe = track.tpcNSigmaDe(); @@ -732,12 +805,12 @@ struct AntinucleiInJets { double dcaxy = track.dcaXY(); double dcaz = track.dcaZ(); - // fill DCA distribution for antiprotons + // Fill DCA distribution for antiprotons if (track.sign() < 0 && isHighPurityAntiproton(track) && std::fabs(dcaz) < maxDcaz) { registryData.fill(HIST("antiproton_dca_ue"), pt, dcaxy); } - // DCA selections + // Apply DCA selections if (std::fabs(dcaxy) > maxDcaxy || std::fabs(dcaz) > maxDcaz) continue; @@ -757,7 +830,7 @@ struct AntinucleiInJets { passedItsPidHel = false; } - // antimatter + // Fill histograms for antimatter if (track.sign() < 0) { if (passedItsPidProt) { registryData.fill(HIST("antiproton_ue_tpc"), pt, nsigmaTPCPr); @@ -774,33 +847,49 @@ struct AntinucleiInJets { } } - // matter + // Fill histograms for matter if (track.sign() > 0) { - if (passedItsPidDeut && nsigmaTPCDe > minNsigmaTpc && nsigmaTPCDe < maxNsigmaTpc && track.hasTOF()) - registryData.fill(HIST("deuteron_ue_tof"), pt, nsigmaTOFDe); - // helium3 + if (passedItsPidDeut) { + registryData.fill(HIST("deuteron_ue_tpc"), pt, nsigmaTPCDe); + if (nsigmaTPCDe > minNsigmaTpc && nsigmaTPCDe < maxNsigmaTpc && track.hasTOF()) + registryData.fill(HIST("deuteron_ue_tof"), pt, nsigmaTOFDe); + } if (passedItsPidHel) { registryData.fill(HIST("helium3_ue_tpc"), 2.0 * pt, nsigmaTPCHe); } } } } + // Event counter: events with at least one jet selected if (isAtLeastOneJetSelected) { - registryData.fill(HIST("number_of_events_data"), 3.5); + registryData.fill(HIST("number_of_events_data"), 10.5); } } PROCESS_SWITCH(AntinucleiInJets, processData, "Process Data", true); - void processMultEvents(SelectedCollisions::iterator const& collision, FullNucleiTracks const& tracks) + // Charged-particle multiplicity in events with selected jets (Run 3) or ptTrigger > threshold (Run 2-like) + void processMultEvents(SelectedCollisions::iterator const& collision, AntiNucleiTracks const& tracks) { - // event selection + // Apply event selection if (!collision.sel8() || std::fabs(collision.posZ()) > zVtx) return; + if (rejectITSROFBorder && !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) + return; + if (rejectTFBorder && !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) + return; + if (requireVtxITSTPC && !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) + return; + if (rejectSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) + return; + if (requireIsGoodZvtxFT0VsPV && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) + return; + if (requireIsVertexTOFmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTOFmatched)) + return; - // Leading Track + // Initialize variable to store the maximum pt in the event double ptMax(0.0); - // loop over reconstructed tracks + // Loop over reconstructed tracks int id(-1); std::vector fjParticles; for (auto const& track : tracks) { @@ -816,51 +905,72 @@ struct AntinucleiInJets { fourMomentum.set_user_index(id); fjParticles.emplace_back(fourMomentum); } - // reject empty events + + // Reject empty events if (fjParticles.empty()) { return; } + // Fill charged-particle multiplicity for events with leading track having pt>threshold if (ptMax > ptLeadingMin) { registryMult.fill(HIST("multiplicityEvtsPtLeading"), fjParticles.size()); } - // cluster particles using the anti-kt algorithm + // Cluster particles using the anti-kt algorithm fastjet::JetDefinition jetDef(fastjet::antikt_algorithm, rJet); fastjet::AreaDefinition areaDef(fastjet::active_area, fastjet::GhostedAreaSpec(1.0)); fastjet::ClusterSequenceArea cs(fjParticles, jetDef, areaDef); std::vector jets = fastjet::sorted_by_pt(cs.inclusive_jets()); auto [rhoPerp, rhoMPerp] = backgroundSub.estimateRhoPerpCone(fjParticles, jets); - // loop over reconstructed jets + // Loop over reconstructed jets bool isAtLeastOneJetSelected = false; for (const auto& jet : jets) { - // jet must be fully contained in the acceptance + // Jet must be fully contained in the acceptance if ((std::fabs(jet.eta()) + rJet) > (maxEta - deltaEtaEdge)) continue; - // jet pt must be larger than threshold + // Jet pt must be larger than threshold auto jetForSub = jet; fastjet::PseudoJet jetMinusBkg = backgroundSub.doRhoAreaSub(jetForSub, rhoPerp, rhoMPerp); if (jetMinusBkg.pt() < minJetPt) continue; + + // Apply area cut if required + double normalizedJetArea = jet.area() / (PI * rJet * rJet); + if (applyAreaCut && normalizedJetArea > maxNormalizedJetArea) + continue; isAtLeastOneJetSelected = true; } + + // Fill histogram of charged-particle multiplicity for events containing at least one selected jet if (isAtLeastOneJetSelected) { registryMult.fill(HIST("multiplicityEvtsWithJet"), fjParticles.size()); } } - PROCESS_SWITCH(AntinucleiInJets, processMultEvents, "Process Mult Events", true); + PROCESS_SWITCH(AntinucleiInJets, processMultEvents, "Process Mult Events", false); // Process QC - void processQC(SelectedCollisions::iterator const& collision, FullNucleiTracks const& tracks) + void processQC(SelectedCollisions::iterator const& collision, AntiNucleiTracks const& tracks) { - // event selection + // Apply event selection if (!collision.sel8() || std::fabs(collision.posZ()) > zVtx) return; + if (rejectITSROFBorder && !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) + return; + if (rejectTFBorder && !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) + return; + if (requireVtxITSTPC && !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) + return; + if (rejectSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) + return; + if (requireIsGoodZvtxFT0VsPV && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) + return; + if (requireIsVertexTOFmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTOFmatched)) + return; - // loop over reconstructed tracks + // Loop over reconstructed tracks std::vector fjParticles; for (auto const& track : tracks) { if (!passedTrackSelectionForJetReconstruction(track)) @@ -871,41 +981,43 @@ struct AntinucleiInJets { fjParticles.emplace_back(fourMomentum); } - // reject empty events - if (fjParticles.size() < 1) + // Reject empty events + if (fjParticles.empty()) return; - // cluster particles using the anti-kt algorithm + // Cluster particles using the anti-kt algorithm fastjet::JetDefinition jetDef(fastjet::antikt_algorithm, rJet); - fastjet::AreaDefinition areaDef(fastjet::active_area, fastjet::GhostedAreaSpec(1.0)); // active_area_explicit_ghosts + fastjet::AreaDefinition areaDef(fastjet::active_area, fastjet::GhostedAreaSpec(1.0)); fastjet::ClusterSequenceArea cs(fjParticles, jetDef, areaDef); std::vector jets = fastjet::sorted_by_pt(cs.inclusive_jets()); auto [rhoPerp, rhoMPerp] = backgroundSub.estimateRhoPerpCone(fjParticles, jets); - // loop over reconstructed jets + // Loop over reconstructed jets int njetsInAcc(0); int njetsHighPt(0); for (const auto& jet : jets) { - // jet must be fully contained in the acceptance + // Jet must be fully contained in the acceptance if ((std::fabs(jet.eta()) + rJet) > (maxEta - deltaEtaEdge)) continue; njetsInAcc++; registryQC.fill(HIST("sumPtJetCone"), jet.pt()); double ptJetBeforeSub = jet.pt(); - // jet pt must be larger than threshold + // Jet pt must be larger than threshold auto jetForSub = jet; fastjet::PseudoJet jetMinusBkg = backgroundSub.doRhoAreaSub(jetForSub, rhoPerp, rhoMPerp); double ptJetAfterSub = jetForSub.pt(); registryQC.fill(HIST("jetPtDifference"), ptJetAfterSub - ptJetBeforeSub); + registryQC.fill(HIST("ptDistributionJetCone"), ptJetBeforeSub); + registryQC.fill(HIST("ptDistributionJet"), ptJetAfterSub); - if (getCorrectedPt(jetMinusBkg.pt(), responseMatrix) < minJetPt) + if (jetMinusBkg.pt() < minJetPt) continue; njetsHighPt++; registryQC.fill(HIST("sumPtJet"), jet.pt()); - // jet properties and perpendicular cone + // Jet properties and perpendicular cone std::vector jetConstituents = jet.constituents(); TVector3 jetAxis(jet.px(), jet.py(), jet.pz()); double coneRadius = std::sqrt(jet.area() / PI); @@ -916,7 +1028,7 @@ struct AntinucleiInJets { registryQC.fill(HIST("NchJetCone"), static_cast(jetConstituents.size())); - // loop over jet constituents + // Loop over jet constituents for (const auto& particle : jetConstituents) { double deltaEta = particle.eta() - jetAxis.Eta(); @@ -925,7 +1037,7 @@ struct AntinucleiInJets { registryQC.fill(HIST("eta_phi_jet"), particle.eta(), particle.phi()); } - // loop over particles in perpendicular cones + // Loop over particles in perpendicular cones double nParticlesPerp(0); double ptPerp(0); for (auto const& track : tracks) { @@ -958,89 +1070,84 @@ struct AntinucleiInJets { } PROCESS_SWITCH(AntinucleiInJets, processQC, "Process QC", false); - void processEfficiency(SimCollisions const& collisions, MCTracks const& mcTracks, aod::McParticles const& mcParticles) + // Antinuclei reconstruction efficiency + void processAntinucleiEfficiency(RecCollisionsMc const& collisions, AntiNucleiTracksMc const& mcTracks, aod::McParticles const& mcParticles) { // Loop over all simulated collision events for (const auto& collision : collisions) { // Count all generated events before applying any event selection criteria - registryMC.fill(HIST("number_of_events_mc"), 0.5); + registryMC.fill(HIST("number_of_events_mc_nuclei_efficiency"), 0.5); // Apply event selection: require sel8 and vertex position within the allowed z range if (!collision.sel8() || std::fabs(collision.posZ()) > zVtx) continue; // Count events that pass the selection criteria - registryMC.fill(HIST("number_of_events_mc"), 1.5); + registryMC.fill(HIST("number_of_events_mc_nuclei_efficiency"), 1.5); + + // Reject events near the ITS Read-Out Frame border + if (rejectITSROFBorder && !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) + continue; + registryMC.fill(HIST("number_of_events_mc_nuclei_efficiency"), 2.5); + + // Reject events at the Time Frame border + if (rejectTFBorder && !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) + continue; + registryMC.fill(HIST("number_of_events_mc_nuclei_efficiency"), 3.5); + + // Require at least one ITS-TPC matched track + if (requireVtxITSTPC && !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) + continue; + registryMC.fill(HIST("number_of_events_mc_nuclei_efficiency"), 4.5); + + // Reject events with same-bunch pileup + if (rejectSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) + continue; + registryMC.fill(HIST("number_of_events_mc_nuclei_efficiency"), 5.5); + + // Require consistent FT0 vs PV z-vertex + if (requireIsGoodZvtxFT0VsPV && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) + continue; + registryMC.fill(HIST("number_of_events_mc_nuclei_efficiency"), 6.5); + + // Require TOF match for at least one vertex track + if (requireIsVertexTOFmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTOFmatched)) + continue; + registryMC.fill(HIST("number_of_events_mc_nuclei_efficiency"), 7.5); // Loop over all generated Monte Carlo particles for the selected event for (const auto& particle : mcParticles) { - // primary particles + // Select primary particles if (!particle.isPhysicalPrimary()) continue; - // Fill (eta, pT) distribution of generated antiprotons - if (particle.pdgCode() == kProtonBar) { - registryMC.fill(HIST("antiproton_eta_pt_pythia"), particle.pt(), particle.eta()); - } - // Select particles within the specified pseudorapidity interval if (particle.eta() < minEta || particle.eta() > maxEta) continue; - // Initialize weights for antiproton reweighting in Jet and UE cones - double wAntipJet2d(1.0), wAntipUe2d(1.0); - int ix = twoDweightsAntipJet->GetXaxis()->FindBin(particle.pt()); - int iy = twoDweightsAntipJet->GetYaxis()->FindBin(particle.eta()); - - // Retrieve 2D weights from histograms based on particle's (pT, eta) - wAntipJet2d = twoDweightsAntipJet->GetBinContent(ix, iy); - wAntipUe2d = twoDweightsAntipUe->GetBinContent(ix, iy); - - // Sanity checks: if (pT, eta) is out of histogram bounds, set default weight to 1.0 - if (ix == 0 || ix > twoDweightsAntipJet->GetNbinsX()) { - wAntipJet2d = 1.0; - wAntipUe2d = 1.0; - } - if (iy == 0 || iy > twoDweightsAntipJet->GetNbinsY()) { - wAntipJet2d = 1.0; - wAntipUe2d = 1.0; - } - - // Placeholder for 1D weight factors (e.g., for further corrections, still to be implemented) - double wAntipJetFinal(1.0), wAntipUeFinal(1.0); - // Process different particle species based on PDG code switch (particle.pdgCode()) { - case kProtonBar: - // Fill histograms with unweighted and weighted (2D and final) pT spectra for antiprotons - registryMC.fill(HIST("antiproton_gen_jet_unweighted"), particle.pt()); - registryMC.fill(HIST("antiproton_gen_ue_unweighted"), particle.pt()); - registryMC.fill(HIST("antiproton_gen_jet_weighted2d"), particle.pt(), wAntipJet2d); - registryMC.fill(HIST("antiproton_gen_ue_weighted2d"), particle.pt(), wAntipUe2d); - registryMC.fill(HIST("antiproton_gen_jet_weightedFinal"), particle.pt(), wAntipJetFinal); - registryMC.fill(HIST("antiproton_gen_ue_weightedFinal"), particle.pt(), wAntipUeFinal); - - // Fill additional histograms used for deriving or validating reweighting corrections - registryMC.fill(HIST("antiproton_forReweighting_jet_weighted2d"), particle.pt(), wAntipJet2d); - registryMC.fill(HIST("antiproton_forReweighting_ue_weighted2d"), particle.pt(), wAntipUe2d); - registryMC.fill(HIST("antiproton_forReweighting_jet_weightedFinal"), particle.pt(), wAntipJetFinal); - registryMC.fill(HIST("antiproton_forReweighting_ue_weightedFinal"), particle.pt(), wAntipUeFinal); + case PDG_t::kProtonBar: + registryMC.fill(HIST("antip_gen_jet"), particle.pt()); + registryMC.fill(HIST("antip_gen_ue"), particle.pt()); break; - - // Generated spectra for other light nuclei case o2::constants::physics::Pdg::kDeuteron: - registryMC.fill(HIST("deuteron_incl_gen"), particle.pt()); + registryMC.fill(HIST("deuteron_gen_jet"), particle.pt()); + registryMC.fill(HIST("deuteron_gen_ue"), particle.pt()); break; case -o2::constants::physics::Pdg::kDeuteron: - registryMC.fill(HIST("antideuteron_incl_gen"), particle.pt()); + registryMC.fill(HIST("antideuteron_gen_jet"), particle.pt()); + registryMC.fill(HIST("antideuteron_gen_ue"), particle.pt()); break; case o2::constants::physics::Pdg::kHelium3: - registryMC.fill(HIST("helium3_incl_gen"), particle.pt()); + registryMC.fill(HIST("helium3_gen_jet"), particle.pt()); + registryMC.fill(HIST("helium3_gen_ue"), particle.pt()); break; case -o2::constants::physics::Pdg::kHelium3: - registryMC.fill(HIST("antihelium3_incl_gen"), particle.pt()); + registryMC.fill(HIST("antihelium3_gen_jet"), particle.pt()); + registryMC.fill(HIST("antihelium3_gen_ue"), particle.pt()); break; } } @@ -1056,9 +1163,7 @@ struct AntinucleiInJets { continue; // Cut on transverse and longitudinal distance of closest approach - if (std::fabs(track.dcaXY()) > maxDcaxy) - continue; - if (std::fabs(track.dcaZ()) > maxDcaz) + if (std::fabs(track.dcaXY()) > maxDcaxy || std::fabs(track.dcaZ()) > maxDcaz) continue; // Skip tracks that are not associated with a true MC particle @@ -1066,7 +1171,7 @@ struct AntinucleiInJets { continue; const auto particle = track.mcParticle(); - // select only physical primary particles + // Select only physical primary particles if (!particle.isPhysicalPrimary()) continue; @@ -1094,143 +1199,141 @@ struct AntinucleiInJets { passedItsPidHel = false; } - // Get correction weights as a function of (pt, eta) from external histograms - double wAntipJet2d(1.0), wAntipUe2d(1.0); - int ix = twoDweightsAntipJet->GetXaxis()->FindBin(particle.pt()); - int iy = twoDweightsAntipJet->GetYaxis()->FindBin(particle.eta()); - wAntipJet2d = twoDweightsAntipJet->GetBinContent(ix, iy); - wAntipUe2d = twoDweightsAntipUe->GetBinContent(ix, iy); - - // Edge protection: reset weights to 1 if out of histogram range - if (ix == 0 || ix > twoDweightsAntipJet->GetNbinsX()) { - wAntipJet2d = 1.0; - wAntipUe2d = 1.0; - } - if (iy == 0 || iy > twoDweightsAntipJet->GetNbinsY()) { - wAntipJet2d = 1.0; - wAntipUe2d = 1.0; - } - - // 1d weights (to be implemented) - double wAntipJetFinal(1.0), wAntipUeFinal(1.0); - - // antiprotons - if (particle.pdgCode() == kProtonBar) { - if (passedItsPidProt && nsigmaTPCPr > minNsigmaTpc && nsigmaTPCPr < maxNsigmaTpc) { - registryMC.fill(HIST("antiproton_recTpc_jet_unweighted"), track.pt()); - registryMC.fill(HIST("antiproton_recTpc_ue_unweighted"), track.pt()); - registryMC.fill(HIST("antiproton_recTpc_jet_weighted2d"), track.pt(), wAntipJet2d); - registryMC.fill(HIST("antiproton_recTpc_ue_weighted2d"), track.pt(), wAntipUe2d); - registryMC.fill(HIST("antiproton_recTpc_jet_weightedFinal"), track.pt(), wAntipJetFinal); - registryMC.fill(HIST("antiproton_recTpc_ue_weightedFinal"), track.pt(), wAntipUeFinal); + // Fill histograms of antiprotons + if (track.sign() < 0 && particle.pdgCode() == PDG_t::kProtonBar && passedItsPidProt) { + if (nsigmaTPCPr > minNsigmaTpc && nsigmaTPCPr < maxNsigmaTpc) { + registryMC.fill(HIST("antip_rec_tpc_jet"), track.pt()); + registryMC.fill(HIST("antip_rec_tpc_ue"), track.pt()); if (track.hasTOF() && nsigmaTOFPr > minNsigmaTof && nsigmaTOFPr < maxNsigmaTof) { - registryMC.fill(HIST("antiproton_recTof_jet_unweighted"), track.pt()); - registryMC.fill(HIST("antiproton_recTof_ue_unweighted"), track.pt()); - registryMC.fill(HIST("antiproton_recTof_jet_weighted2d"), track.pt(), wAntipJet2d); - registryMC.fill(HIST("antiproton_recTof_ue_weighted2d"), track.pt(), wAntipUe2d); - registryMC.fill(HIST("antiproton_recTof_jet_weightedFinal"), track.pt(), wAntipJetFinal); - registryMC.fill(HIST("antiproton_recTof_ue_weightedFinal"), track.pt(), wAntipUeFinal); + registryMC.fill(HIST("antip_rec_tof_jet"), track.pt()); + registryMC.fill(HIST("antip_rec_tof_ue"), track.pt()); } } } - // antideuterons - if (particle.pdgCode() == -o2::constants::physics::Pdg::kDeuteron && passedItsPidDeut) { + // Fill histograms of antideuterons + if (track.sign() < 0 && particle.pdgCode() == -o2::constants::physics::Pdg::kDeuteron && passedItsPidDeut) { if (nsigmaTPCDe > minNsigmaTpc && nsigmaTPCDe < maxNsigmaTpc) { - registryMC.fill(HIST("antideuteron_incl_rec_tpc"), track.pt()); - if (track.hasTOF() && nsigmaTOFDe > minNsigmaTof && nsigmaTOFDe < maxNsigmaTof) - registryMC.fill(HIST("antideuteron_incl_rec_tof"), track.pt()); + registryMC.fill(HIST("antideuteron_rec_tpc_jet"), track.pt()); + registryMC.fill(HIST("antideuteron_rec_tpc_ue"), track.pt()); + + if (track.hasTOF() && nsigmaTOFDe > minNsigmaTof && nsigmaTOFDe < maxNsigmaTof) { + registryMC.fill(HIST("antideuteron_rec_tof_jet"), track.pt()); + registryMC.fill(HIST("antideuteron_rec_tof_ue"), track.pt()); + } } } - // deuterons - if (particle.pdgCode() == o2::constants::physics::Pdg::kDeuteron && passedItsPidDeut) { + // Fill histograms of deuterons + if (track.sign() > 0 && particle.pdgCode() == o2::constants::physics::Pdg::kDeuteron && passedItsPidDeut) { if (nsigmaTPCDe > minNsigmaTpc && nsigmaTPCDe < maxNsigmaTpc) { - registryMC.fill(HIST("deuteron_incl_rec_tpc"), track.pt()); - if (track.hasTOF() && nsigmaTOFDe > minNsigmaTof && nsigmaTOFDe < maxNsigmaTof) - registryMC.fill(HIST("deuteron_incl_rec_tof"), track.pt()); + registryMC.fill(HIST("deuteron_rec_tpc_jet"), track.pt()); + registryMC.fill(HIST("deuteron_rec_tpc_ue"), track.pt()); + if (track.hasTOF() && nsigmaTOFDe > minNsigmaTof && nsigmaTOFDe < maxNsigmaTof) { + registryMC.fill(HIST("deuteron_rec_tof_jet"), track.pt()); + registryMC.fill(HIST("deuteron_rec_tof_ue"), track.pt()); + } } } - // antihelium3 - if (particle.pdgCode() == -o2::constants::physics::Pdg::kHelium3 && passedItsPidHel) { + // Fill histograms of antihelium3 + if (track.sign() < 0 && particle.pdgCode() == -o2::constants::physics::Pdg::kHelium3 && passedItsPidHel) { if (nsigmaTPCHe > minNsigmaTpc && nsigmaTPCHe < maxNsigmaTpc) { - registryMC.fill(HIST("antihelium3_incl_rec_tpc"), 2.0 * track.pt()); + registryMC.fill(HIST("antihelium3_rec_tpc_jet"), 2.0 * track.pt()); + registryMC.fill(HIST("antihelium3_rec_tpc_ue"), 2.0 * track.pt()); } } - // helium3 - if (particle.pdgCode() == o2::constants::physics::Pdg::kHelium3 && passedItsPidHel) { + // Fill histograms of helium3 + if (track.sign() > 0 && particle.pdgCode() == o2::constants::physics::Pdg::kHelium3 && passedItsPidHel) { if (nsigmaTPCHe > minNsigmaTpc && nsigmaTPCHe < maxNsigmaTpc) { - registryMC.fill(HIST("helium3_incl_rec_tpc"), 2.0 * track.pt()); + registryMC.fill(HIST("helium3_rec_tpc_jet"), 2.0 * track.pt()); + registryMC.fill(HIST("helium3_rec_tpc_ue"), 2.0 * track.pt()); } } } } } - PROCESS_SWITCH(AntinucleiInJets, processEfficiency, "process efficiency", false); + PROCESS_SWITCH(AntinucleiInJets, processAntinucleiEfficiency, "process antinuclei efficiency", false); - void processJetsMCgen(GenCollisions const& collisions, aod::McParticles const& mcParticles) + // Generated events + void processJetsMCgen(GenCollisionsMc const& collisions, aod::McParticles const& mcParticles) { - // Loop over all simulated collision events + // Loop over all simulated collisions for (const auto& collision : collisions) { - // Apply event selection: require vertex position within the allowed z range + // Event counter: before event selection + registryMC.fill(HIST("genEvents"), 0.5); + + // Apply event selection: require vertex position to be within the allowed z range if (std::fabs(collision.posZ()) > zVtx) continue; - // Loop over all MC particles and select physical primaries within acceptance + // Event counter: after event selection + registryMC.fill(HIST("genEvents"), 1.5); + + // Loop over all MC particles std::vector fjParticles; for (const auto& particle : mcParticles) { + + // Select physical primaries within acceptance if (!particle.isPhysicalPrimary()) continue; - double minPtParticle = 0.1; - if (particle.eta() < minEta || particle.eta() > maxEta || particle.pt() < minPtParticle) + static constexpr double MinPtParticle = 0.1; + if (particle.eta() < minEta || particle.eta() > maxEta || particle.pt() < MinPtParticle) continue; - // Build 4-momentum assuming charged pion mass + // 4-momentum representation of a particle double energy = std::sqrt(particle.p() * particle.p() + MassPionCharged * MassPionCharged); fastjet::PseudoJet fourMomentum(particle.px(), particle.py(), particle.pz(), energy); fourMomentum.set_user_index(particle.pdgCode()); fjParticles.emplace_back(fourMomentum); } - // Skip events with no particles - if (fjParticles.size() < 1) + // Reject empty events + if (fjParticles.empty()) continue; + registryMC.fill(HIST("genEvents"), 2.5); // Cluster MC particles into jets using anti-kt algorithm fastjet::JetDefinition jetDef(fastjet::antikt_algorithm, rJet); fastjet::AreaDefinition areaDef(fastjet::active_area, fastjet::GhostedAreaSpec(1.0)); fastjet::ClusterSequenceArea cs(fjParticles, jetDef, areaDef); std::vector jets = fastjet::sorted_by_pt(cs.inclusive_jets()); - - // Estimate background energy density (rho) in perpendicular cone auto [rhoPerp, rhoMPerp] = backgroundSub.estimateRhoPerpCone(fjParticles, jets); // Loop over clustered jets + bool isAtLeastOneJetSelected = false; for (const auto& jet : jets) { - // Jet must be fully contained in acceptance + // Jet must be fully contained in the acceptance if ((std::fabs(jet.eta()) + rJet) > (maxEta - deltaEtaEdge)) continue; - // Subtract background energy from jet + // Jet pt must be larger than threshold auto jetForSub = jet; fastjet::PseudoJet jetMinusBkg = backgroundSub.doRhoAreaSub(jetForSub, rhoPerp, rhoMPerp); - - // Apply jet pT threshold if (jetMinusBkg.pt() < minJetPt) continue; - // Analyze jet constituents and search for antiprotons + // Apply area cut if required + double normalizedJetArea = jet.area() / (PI * rJet * rJet); + if (applyAreaCut && normalizedJetArea > maxNormalizedJetArea) + continue; + isAtLeastOneJetSelected = true; + + // Analyze jet constituents std::vector jetConstituents = jet.constituents(); for (const auto& particle : jetConstituents) { - if (particle.user_index() != kProtonBar) + if (particle.user_index() != PDG_t::kProtonBar) + continue; + + if (particle.eta() < minEta || particle.eta() > maxEta) continue; - registryMC.fill(HIST("antiproton_eta_pt_jet"), particle.pt(), particle.eta()); - registryMC.fill(HIST("antiproton_gen_jet_antikt"), particle.pt()); + + // Fill histogram for generated antiprotons + registryMC.fill(HIST("antiproton_gen_jet"), particle.pt()); } // Set up two perpendicular cone axes for underlying event estimation @@ -1242,10 +1345,10 @@ struct AntinucleiInJets { // Loop over MC particles to analyze underlying event region for (const auto& particle : mcParticles) { - if (!particle.isPhysicalPrimary()) - continue; - double minPtParticle = 0.1; - if (particle.eta() < minEta || particle.eta() > maxEta || particle.pt() < minPtParticle) + + // Select physical primaries within the acceptance + static constexpr double MinPtParticle = 0.1; + if (particle.eta() < minEta || particle.eta() > maxEta || particle.pt() < MinPtParticle) continue; // Compute distance of particle from both perpendicular cone axes @@ -1256,35 +1359,78 @@ struct AntinucleiInJets { double deltaPhiUe2 = getDeltaPhi(particle.phi(), ueAxis2.Phi()); double deltaRUe2 = std::sqrt(deltaEtaUe2 * deltaEtaUe2 + deltaPhiUe2 * deltaPhiUe2); - // Select particles inside one of the perpendicular cones - if (deltaRUe1 > coneRadius && deltaRUe2 > coneRadius) + // Determine the maximum allowed distance from UE axes for particle selection + double maxConeRadius = coneRadius; + if (applyAreaCut) { + maxConeRadius = std::sqrt(maxNormalizedJetArea) * rJet; + } + + // Reject tracks that lie outside the maxConeRadius from both UE axes + if (deltaRUe1 > maxConeRadius && deltaRUe2 > maxConeRadius) continue; // Select antiprotons based on PDG - if (particle.pdgCode() != kProtonBar) + if (particle.pdgCode() != PDG_t::kProtonBar) continue; - registryMC.fill(HIST("antiproton_eta_pt_ue"), particle.pt(), particle.eta()); - registryMC.fill(HIST("antiproton_gen_ue_antikt"), particle.pt()); + // Fill histogram for antiprotons in the UE + registryMC.fill(HIST("antiproton_gen_ue"), particle.pt()); } } + if (isAtLeastOneJetSelected) { + registryMC.fill(HIST("genEvents"), 3.5); + } } } PROCESS_SWITCH(AntinucleiInJets, processJetsMCgen, "process jets mc gen", false); - void processJetsMCrec(SimCollisions const& collisions, MCTracks const& mcTracks, McParticles const&) + // Reconstructed events + void processJetsMCrec(RecCollisionsMc const& collisions, AntiNucleiTracksMc const& mcTracks, McParticles const&) { - // Initialize ITS PID response tool - o2::aod::ITSResponse itsResponse; - - // Loop over all simulated collision events + // Loop over all reconstructed collisions for (const auto& collision : collisions) { - // Apply event selection: require sel8 and vertex position within the allowed z range + // Event counter: before event selection + registryMC.fill(HIST("recEvents"), 0.5); + + // Apply event selection: require sel8 and vertex position to be within the allowed z range if (!collision.sel8() || std::fabs(collision.posZ()) > zVtx) continue; - // Prepare particle list for jet clustering + // Event counter: after event selection + registryMC.fill(HIST("recEvents"), 1.5); + + // Reject events near the ITS Read-Out Frame border + if (rejectITSROFBorder && !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) + continue; + registryMC.fill(HIST("recEvents"), 2.5); + + // Reject events at the Time Frame border + if (rejectTFBorder && !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) + continue; + registryMC.fill(HIST("recEvents"), 3.5); + + // Require at least one ITS-TPC matched track + if (requireVtxITSTPC && !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) + continue; + registryMC.fill(HIST("recEvents"), 4.5); + + // Reject events with same-bunch pileup + if (rejectSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) + continue; + registryMC.fill(HIST("recEvents"), 5.5); + + // Require consistent FT0 vs PV z-vertex + if (requireIsGoodZvtxFT0VsPV && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) + continue; + registryMC.fill(HIST("recEvents"), 6.5); + + // Require TOF match for at least one vertex track + if (requireIsVertexTOFmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTOFmatched)) + continue; + registryMC.fill(HIST("recEvents"), 7.5); + + // Loop over reconstructed tracks int id(-1); std::vector fjParticles; for (auto const& track : mcTracks) { @@ -1292,58 +1438,44 @@ struct AntinucleiInJets { if (!passedTrackSelectionForJetReconstruction(track)) continue; - // Build 4-momentum assuming charged pion mass + // 4-momentum representation of a particle fastjet::PseudoJet fourMomentum(track.px(), track.py(), track.pz(), track.energy(MassPionCharged)); fourMomentum.set_user_index(id); fjParticles.emplace_back(fourMomentum); } - // Skip events with no particles - if (fjParticles.size() < 1) + // Reject empty events + if (fjParticles.empty()) continue; + registryMC.fill(HIST("recEvents"), 8.5); - // Perform jet clustering using anti-kT algorithm with active area correction + // Cluster particles using the anti-kt algorithm fastjet::JetDefinition jetDef(fastjet::antikt_algorithm, rJet); fastjet::AreaDefinition areaDef(fastjet::active_area, fastjet::GhostedAreaSpec(1.0)); fastjet::ClusterSequenceArea cs(fjParticles, jetDef, areaDef); std::vector jets = fastjet::sorted_by_pt(cs.inclusive_jets()); - - // Estimate background energy density (rho) in perpendicular cone auto [rhoPerp, rhoMPerp] = backgroundSub.estimateRhoPerpCone(fjParticles, jets); // Loop over reconstructed jets + bool isAtLeastOneJetSelected = false; for (const auto& jet : jets) { - // Retrieve constituents of the current jet - std::vector jetConstituents = jet.constituents(); - - // Estimate generator-level jet pT by summing pT of matched MC particles - double jetPtGen(0); - for (const auto& particle : jetConstituents) { - auto const& track = mcTracks.iteratorAt(particle.user_index()); - if (!track.has_mcParticle()) - continue; - const auto mcparticle = track.mcParticle(); - jetPtGen += mcparticle.pt(); - } - - // Jet must be fully contained in acceptance + // Jet must be fully contained in the acceptance if ((std::fabs(jet.eta()) + rJet) > (maxEta - deltaEtaEdge)) continue; - // Fill detector response matrix - registryMC.fill(HIST("detectorResponseMatrix"), jet.pt(), jetPtGen - jet.pt()); - registryMC.fill(HIST("generatedVsReconstructedPt"), jet.pt(), jetPtGen); - - // Subtract estimated background contribution from jet 4-momentum + // Jet pt must be larger than threshold auto jetForSub = jet; fastjet::PseudoJet jetMinusBkg = backgroundSub.doRhoAreaSub(jetForSub, rhoPerp, rhoMPerp); - - // Apply jet pT threshold - // if (getCorrectedPt(jetMinusBkg.pt(), responseMatrix) < minJetPt) if (jetMinusBkg.pt() < minJetPt) continue; + // Apply area cut if required + double normalizedJetArea = jet.area() / (PI * rJet * rJet); + if (applyAreaCut && normalizedJetArea > maxNormalizedJetArea) + continue; + isAtLeastOneJetSelected = true; + // Set up two perpendicular cone axes for underlying event estimation double coneRadius = std::sqrt(jet.area() / PI); TVector3 jetAxis(jet.px(), jet.py(), jet.pz()); @@ -1351,80 +1483,112 @@ struct AntinucleiInJets { getPerpendicularAxis(jetAxis, ueAxis1, +1); getPerpendicularAxis(jetAxis, ueAxis2, -1); - // Analyze antiproton candidates among jet constituents + // Get jet constituents + std::vector jetConstituents = jet.constituents(); + + // Initialize ITS PID Response object + o2::aod::ITSResponse itsResponse; + + // Loop over jet constituents for (const auto& particle : jetConstituents) { + + // Get corresponding track and apply track selection criteria auto const& track = mcTracks.iteratorAt(particle.user_index()); + if (!passedTrackSelection(track)) + continue; + + // Get corresponding MC particle if (!track.has_mcParticle()) continue; const auto mcparticle = track.mcParticle(); + // Define variables + double nsigmaTPCPr = track.tpcNSigmaPr(); + double nsigmaTOFPr = track.tofNSigmaPr(); + double pt = track.pt(); + double dcaxy = track.dcaXY(); + double dcaz = track.dcaZ(); + // Fill DCA templates - if (mcparticle.pdgCode() == kProtonBar && passedTrackSelection(track) && std::fabs(track.dcaZ()) < maxDcaz) { + if (mcparticle.pdgCode() == PDG_t::kProtonBar && std::fabs(dcaz) < maxDcaz) { if (mcparticle.isPhysicalPrimary()) { - registryMC.fill(HIST("antiproton_prim_dca_jet"), track.pt(), track.dcaXY()); + registryMC.fill(HIST("antiproton_prim_dca_jet"), pt, dcaxy); } else { - registryMC.fill(HIST("antiproton_all_dca_jet"), track.pt(), track.dcaXY()); + registryMC.fill(HIST("antiproton_all_dca_jet"), pt, dcaxy); } } - // Apply standard track quality and PID selection - if (!passedTrackSelection(track) || std::fabs(track.dcaXY()) > maxDcaxy || std::fabs(track.dcaZ()) > maxDcaz) - continue; - if (track.sign() > 0 || mcparticle.pdgCode() != kProtonBar) + // Apply DCA selections + if (std::fabs(dcaxy) > maxDcaxy || std::fabs(dcaz) > maxDcaz) continue; - // PID variables - double nsigmaTPCPr = track.tpcNSigmaPr(); - double nsigmaTOFPr = track.tofNSigmaPr(); + // Antiproton selection + if (track.sign() > 0 || mcparticle.pdgCode() != PDG_t::kProtonBar) + continue; - // particle identification using the ITS cluster size - double pt = track.pt(); + // Particle identification using the ITS cluster size bool passedItsPidProt(true); double nSigmaITSprot = static_cast(itsResponse.nSigmaITS(track)); if (applyItsPid && pt < ptMaxItsPidProt && (nSigmaITSprot < nSigmaItsMin || nSigmaITSprot > nSigmaItsMax)) { passedItsPidProt = false; } - // Inclusive antiproton spectrum - registryMC.fill(HIST("antiproton_incl_jet"), track.pt()); + // Fill inclusive antiproton spectrum + registryMC.fill(HIST("antiproton_incl_jet"), pt); // Select physical primary antiprotons if (!mcparticle.isPhysicalPrimary()) continue; - registryMC.fill(HIST("antiproton_prim_jet"), track.pt()); + + // Fill antiproton spectrum for physical primaries + registryMC.fill(HIST("antiproton_prim_jet"), pt); // Fill histograms (TPC and TOF) only for selected candidates if (passedItsPidProt && nsigmaTPCPr > minNsigmaTpc && nsigmaTPCPr < maxNsigmaTpc) { - registryMC.fill(HIST("antiproton_recTpc_jet_antikt"), track.pt()); + registryMC.fill(HIST("antiproton_rec_tpc_jet"), pt); if (track.hasTOF() && nsigmaTOFPr > minNsigmaTof && nsigmaTOFPr < maxNsigmaTof) { - registryMC.fill(HIST("antiproton_recTof_jet_antikt"), track.pt()); + registryMC.fill(HIST("antiproton_rec_tof_jet"), pt); } } } - // Analyze antiprotons in the Underlying Event (UE) using perpendicular cones + // Loop over tracks in the underlying event for (auto const& track : mcTracks) { + // Apply track selection + if (!passedTrackSelection(track)) + continue; + + // Get corresponding MC particle if (!track.has_mcParticle()) continue; const auto mcparticle = track.mcParticle(); - if (track.sign() > 0 || mcparticle.pdgCode() != kProtonBar) + + // Antiproton selection + if (track.sign() > 0 || mcparticle.pdgCode() != PDG_t::kProtonBar) continue; + // Define variables + double nsigmaTPCPr = track.tpcNSigmaPr(); + double nsigmaTOFPr = track.tofNSigmaPr(); + double pt = track.pt(); + double dcaxy = track.dcaXY(); + double dcaz = track.dcaZ(); + // Fill DCA templates - if (mcparticle.pdgCode() == kProtonBar && passedTrackSelection(track) && std::fabs(track.dcaZ()) < maxDcaz) { + if (mcparticle.pdgCode() == PDG_t::kProtonBar && std::fabs(dcaz) < maxDcaz) { if (mcparticle.isPhysicalPrimary()) { - registryMC.fill(HIST("antiproton_prim_dca_ue"), track.pt(), track.dcaXY()); + registryMC.fill(HIST("antiproton_prim_dca_ue"), pt, dcaxy); } else { - registryMC.fill(HIST("antiproton_all_dca_ue"), track.pt(), track.dcaXY()); + registryMC.fill(HIST("antiproton_all_dca_ue"), pt, dcaxy); } } - // Track Selection - if (!passedTrackSelection(track) || std::fabs(track.dcaXY()) > maxDcaxy || std::fabs(track.dcaZ()) > maxDcaz) + // Apply DCA selection + if (std::fabs(dcaxy) > maxDcaxy || std::fabs(dcaz) > maxDcaz) continue; - // Compute distance from UE cones + // Calculate the angular distance between the track and underlying event axes in eta-phi space double deltaEtaUe1 = track.eta() - ueAxis1.Eta(); double deltaPhiUe1 = getDeltaPhi(track.phi(), ueAxis1.Phi()); double deltaRUe1 = std::sqrt(deltaEtaUe1 * deltaEtaUe1 + deltaPhiUe1 * deltaPhiUe1); @@ -1432,300 +1596,396 @@ struct AntinucleiInJets { double deltaPhiUe2 = getDeltaPhi(track.phi(), ueAxis2.Phi()); double deltaRUe2 = std::sqrt(deltaEtaUe2 * deltaEtaUe2 + deltaPhiUe2 * deltaPhiUe2); - // Require particle to be within at least one UE cone - if (deltaRUe1 > coneRadius && deltaRUe2 > coneRadius) - continue; + // Determine the maximum allowed distance from UE axes for particle selection + double maxConeRadius = coneRadius; + if (applyAreaCut) { + maxConeRadius = std::sqrt(maxNormalizedJetArea) * rJet; + } - // PID variables - double nsigmaTPCPr = track.tpcNSigmaPr(); - double nsigmaTOFPr = track.tofNSigmaPr(); + // Reject tracks that lie outside the maxConeRadius from both UE axes + if (deltaRUe1 > maxConeRadius && deltaRUe2 > maxConeRadius) + continue; - // particle identification using the ITS cluster size - double pt = track.pt(); + // Particle identification using the ITS cluster size bool passedItsPidProt(true); double nSigmaITSprot = static_cast(itsResponse.nSigmaITS(track)); if (applyItsPid && pt < ptMaxItsPidProt && (nSigmaITSprot < nSigmaItsMin || nSigmaITSprot > nSigmaItsMax)) { passedItsPidProt = false; } - registryMC.fill(HIST("antiproton_incl_ue"), track.pt()); + // Fill inclusive antiproton spectrum + registryMC.fill(HIST("antiproton_incl_ue"), pt); + + // Select physical primary antiprotons if (!mcparticle.isPhysicalPrimary()) continue; - registryMC.fill(HIST("antiproton_prim_ue"), track.pt()); - // Fill histograms in UE + // Fill antiproton spectrum for physical primaries + registryMC.fill(HIST("antiproton_prim_ue"), pt); + + // Fill histograms (TPC and TOF) only for selected candidates if (passedItsPidProt && nsigmaTPCPr > minNsigmaTpc && nsigmaTPCPr < maxNsigmaTpc) { - registryMC.fill(HIST("antiproton_recTpc_ue_antikt"), track.pt()); + registryMC.fill(HIST("antiproton_rec_tpc_ue"), pt); if (track.hasTOF() && nsigmaTOFPr > minNsigmaTof && nsigmaTOFPr < maxNsigmaTof) { - registryMC.fill(HIST("antiproton_recTof_ue_antikt"), track.pt()); + registryMC.fill(HIST("antiproton_rec_tof_ue"), pt); } } } } + if (isAtLeastOneJetSelected) { + registryMC.fill(HIST("recEvents"), 9.5); + } } } PROCESS_SWITCH(AntinucleiInJets, processJetsMCrec, "process jets MC rec", false); - // Process Systematics - void processSystematicsData(SelectedCollisions::iterator const& collision, FullNucleiTracks const& tracks) + // Process real data with systematic variations of analysis parameters + void processSystData(SelectedCollisions::iterator const& collision, AntiNucleiTracks const& tracks) { - if (rejectEvents) { - // event counter: before event rejection - registryData.fill(HIST("number_of_rejected_events_syst"), 0.5); + // Event counter: before event selection + registryData.fill(HIST("number_of_events_data_syst"), 0.5); - if (shouldRejectEvent()) - return; + // Apply standard event selection + if (!collision.sel8() || std::fabs(collision.posZ()) > zVtx) + return; - // event counter: after event rejection - registryData.fill(HIST("number_of_rejected_events_syst"), 1.5); - } + // Event counter: after event selection + registryData.fill(HIST("number_of_events_data_syst"), 1.5); - const int nSystematics = 10; - int itsNclustersSyst[nSystematics] = {5, 6, 5, 4, 5, 3, 5, 6, 3, 4}; - float tpcNcrossedRowsSyst[nSystematics] = {100, 85, 80, 110, 95, 90, 105, 95, 100, 105}; - float dcaxySyst[nSystematics] = {0.05, 0.07, 0.10, 0.03, 0.06, 0.15, 0.08, 0.04, 0.09, 0.10}; - float dcazSyst[nSystematics] = {0.1, 0.15, 0.3, 0.075, 0.12, 0.18, 0.2, 0.1, 0.15, 0.2}; + // Reject events near the ITS Read-Out Frame border + if (rejectITSROFBorder && !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) + return; + registryData.fill(HIST("number_of_events_data_syst"), 2.5); - // event selection - if (!collision.sel8() || std::fabs(collision.posZ()) > zVtx) + // Reject events at the Time Frame border + if (rejectTFBorder && !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) return; + registryData.fill(HIST("number_of_events_data_syst"), 3.5); - // loop over reconstructed tracks - int id(-1); - std::vector fjParticles; - for (auto const& track : tracks) { - id++; - if (!passedTrackSelectionForJetReconstruction(track)) - continue; + // Require at least one ITS-TPC matched track + if (requireVtxITSTPC && !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) + return; + registryData.fill(HIST("number_of_events_data_syst"), 4.5); - // 4-momentum representation of a particle - fastjet::PseudoJet fourMomentum(track.px(), track.py(), track.pz(), track.energy(MassPionCharged)); - fourMomentum.set_user_index(id); - fjParticles.emplace_back(fourMomentum); - } + // Reject events with same-bunch pileup + if (rejectSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) + return; + registryData.fill(HIST("number_of_events_data_syst"), 5.5); - // reject empty events - if (fjParticles.size() < 1) + // Require consistent FT0 vs PV z-vertex + if (requireIsGoodZvtxFT0VsPV && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) return; + registryData.fill(HIST("number_of_events_data_syst"), 6.5); - // cluster particles using the anti-kt algorithm - fastjet::JetDefinition jetDef(fastjet::antikt_algorithm, rJet); - fastjet::AreaDefinition areaDef(fastjet::active_area, fastjet::GhostedAreaSpec(1.0)); // active_area_explicit_ghosts - fastjet::ClusterSequenceArea cs(fjParticles, jetDef, areaDef); - std::vector jets = fastjet::sorted_by_pt(cs.inclusive_jets()); - auto [rhoPerp, rhoMPerp] = backgroundSub.estimateRhoPerpCone(fjParticles, jets); + // Require TOF match for at least one vertex track + if (requireIsVertexTOFmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTOFmatched)) + return; + registryData.fill(HIST("number_of_events_data_syst"), 7.5); + + // Cut settings + static std::vector maxDcaxySyst = { + 0.071, 0.060, 0.066, 0.031, 0.052, 0.078, 0.045, 0.064, 0.036, 0.074, + 0.079, 0.043, 0.067, 0.059, 0.032, 0.070, 0.048, 0.077, 0.062, 0.034, + 0.057, 0.055, 0.073, 0.038, 0.050, 0.075, 0.041, 0.061, 0.033, 0.069, + 0.035, 0.044, 0.076, 0.049, 0.037, 0.054, 0.072, 0.046, 0.058, 0.040, + 0.068, 0.042, 0.056, 0.039, 0.047, 0.065, 0.051, 0.053, 0.063, 0.030}; + static std::vector maxDcazSyst = { + 0.064, 0.047, 0.032, 0.076, 0.039, 0.058, 0.043, 0.069, 0.050, 0.035, + 0.074, 0.061, 0.045, 0.033, 0.068, 0.055, 0.037, 0.071, 0.042, 0.053, + 0.077, 0.038, 0.065, 0.049, 0.036, 0.059, 0.044, 0.067, 0.041, 0.034, + 0.073, 0.052, 0.040, 0.063, 0.046, 0.031, 0.070, 0.054, 0.037, 0.062, + 0.048, 0.035, 0.075, 0.051, 0.039, 0.066, 0.043, 0.060, 0.032, 0.056}; + static std::vector nSigmaItsMinSyst = { + -2.91, -2.77, -3.03, -3.40, -2.69, -3.28, -2.96, -3.11, -3.36, -3.14, + -2.99, -2.75, -3.17, -2.64, -2.72, -3.44, -2.87, -2.95, -3.00, -2.66, + -2.93, -3.31, -3.05, -3.12, -3.21, -3.01, -2.89, -2.73, -3.26, -2.97, + -2.81, -3.33, -2.68, -3.30, -2.78, -3.39, -2.84, -3.45, -2.92, -3.15, + -3.22, -2.58, -3.07, -2.86, -3.10, -2.76, -2.94, -3.25, -3.04, -2.82}; + static std::vector nSigmaItsMaxSyst = { + 2.91, 2.77, 3.03, 3.40, 2.69, 3.28, 2.96, 3.11, 3.36, 3.14, + 2.99, 2.75, 3.17, 2.64, 2.72, 3.44, 2.87, 2.95, 3.00, 2.66, + 2.93, 3.31, 3.05, 3.12, 3.21, 3.01, 2.89, 2.73, 3.26, 2.97, + 2.81, 3.33, 2.68, 3.30, 2.78, 3.39, 2.84, 3.45, 2.92, 3.15, + 3.22, 2.58, 3.07, 2.86, 3.10, 2.76, 2.94, 3.25, 3.04, 2.82}; + static std::vector minNsigmaTpcSyst = { + -3.18, -2.86, -3.12, -2.91, -3.49, -2.57, -3.33, -2.98, -3.46, -2.70, + -3.01, -2.65, -3.27, -3.40, -2.81, -3.10, -2.55, -3.22, -3.07, -2.77, + -3.35, -2.68, -3.43, -2.88, -3.04, -2.53, -3.30, -2.79, -3.15, -2.66, + -3.41, -2.75, -3.26, -2.61, -3.09, -2.54, -3.36, -2.95, -3.20, -2.58, + -3.44, -2.83, -3.11, -2.62, -3.28, -2.69, -3.23, -2.73, -3.39, -2.90}; + static std::vector maxNsigmaTpcSyst = { + 3.18, 2.86, 3.12, 2.91, 3.49, 2.57, 3.33, 2.98, 3.46, 2.70, + 3.01, 2.65, 3.27, 3.40, 2.81, 3.10, 2.55, 3.22, 3.07, 2.77, + 3.35, 2.68, 3.43, 2.88, 3.04, 2.53, 3.30, 2.79, 3.15, 2.66, + 3.41, 2.75, 3.26, 2.61, 3.09, 2.54, 3.36, 2.95, 3.20, 2.58, + 3.44, 2.83, 3.11, 2.62, 3.28, 2.69, 3.23, 2.73, 3.39, 2.90}; + + // Initialize ITS PID Response object + o2::aod::ITSResponse itsResponse; - // loop over reconstructed jets - for (const auto& jet : jets) { + // Loop over reconstructed tracks + for (auto const& track : tracks) { - // jet must be fully contained in the acceptance - if ((std::fabs(jet.eta()) + rJet) > (maxEta - deltaEtaEdge)) + // Select only antimatter + if (track.sign() > 0) continue; - // jet pt must be larger than threshold - auto jetForSub = jet; - fastjet::PseudoJet jetMinusBkg = backgroundSub.doRhoAreaSub(jetForSub, rhoPerp, rhoMPerp); - if (getCorrectedPt(jetMinusBkg.pt(), responseMatrix) < minJetPt) - continue; + // Loop over different cut settings + for (int isyst = 0; isyst < nSyst; isyst++) { - // get jet constituents - std::vector jetConstituents = jet.constituents(); - o2::aod::ITSResponse itsResponse; + // Apply track selection + if (!passedTrackSelectionSyst(track, isyst)) + continue; - // loop over jet constituents - for (const auto& particle : jetConstituents) { - for (int i = 0; i < nSystematics; i++) { - // get corresponding track and apply track selection criteria - auto const& track = tracks.iteratorAt(particle.user_index()); + // Define variables + double nsigmaTPCPr = track.tpcNSigmaPr(); + double nsigmaTOFPr = track.tofNSigmaPr(); + double nsigmaTPCDe = track.tpcNSigmaDe(); + double nsigmaTOFDe = track.tofNSigmaDe(); + double nsigmaTPCHe = track.tpcNSigmaHe(); + double pt = track.pt(); + double dcaxy = track.dcaXY(); + double dcaz = track.dcaZ(); - // variables - double nsigmaTPCPr = track.tpcNSigmaPr(); - double nsigmaTOFPr = track.tofNSigmaPr(); - double nsigmaTPCDe = track.tpcNSigmaDe(); - double nsigmaTOFDe = track.tofNSigmaDe(); - double pt = track.pt(); - double dcaxy = track.dcaXY(); - double dcaz = track.dcaZ(); + // Apply DCA selections + if (std::fabs(dcaxy) > maxDcaxySyst[isyst] || std::fabs(dcaz) > maxDcazSyst[isyst]) + continue; - if (requirePvContributor && !(track.isPVContributor())) - continue; - if (!track.hasITS()) - continue; - if (track.itsNCls() < itsNclustersSyst[i]) - continue; - if (!track.hasTPC()) - continue; - if (track.tpcNClsCrossedRows() < tpcNcrossedRowsSyst[i]) - continue; - if (track.tpcChi2NCl() > maxChiSquareTpc) - continue; - if (track.itsChi2NCl() > maxChiSquareIts) - continue; - if (track.eta() < minEta || track.eta() > maxEta) - continue; - if (track.pt() < minPt) - continue; - if (std::fabs(dcaxy) > dcaxySyst[i]) - continue; - if (std::fabs(dcaz) > dcazSyst[i]) - continue; + // Particle identification using the ITS cluster size (vary also PID ITS) + bool passedItsPidProt(true), passedItsPidDeut(true), passedItsPidHel(true); + double nSigmaITSprot = static_cast(itsResponse.nSigmaITS(track)); + double nSigmaITSdeut = static_cast(itsResponse.nSigmaITS(track)); + double nSigmaITShel3 = static_cast(itsResponse.nSigmaITS(track)); - bool passedItsPidProt(false), passedItsPidDeut(false); - if (itsResponse.nSigmaITS(track) > nSigmaItsMin && itsResponse.nSigmaITS(track) < nSigmaItsMax) { - passedItsPidProt = true; - } - if (itsResponse.nSigmaITS(track) > nSigmaItsMin && itsResponse.nSigmaITS(track) < nSigmaItsMax) { - passedItsPidDeut = true; - } - if (!applyItsPid) { - passedItsPidProt = true; - passedItsPidDeut = true; - } - if (pt > ptMaxItsPidProt) - passedItsPidProt = true; - if (pt > ptMaxItsPidDeut) - passedItsPidDeut = true; - - // antimatter - if (track.sign() < 0) { - if (passedItsPidProt) { - registryData.fill(HIST("antiproton_tpc_syst"), pt, nsigmaTPCPr, i); - if (nsigmaTPCPr > minNsigmaTpc && nsigmaTPCPr < maxNsigmaTpc && track.hasTOF()) - registryData.fill(HIST("antiproton_tof_syst"), pt, nsigmaTOFPr, i); - } - if (passedItsPidDeut) { - registryData.fill(HIST("antideuteron_tpc_syst"), pt, nsigmaTPCDe, i); - if (nsigmaTPCDe > minNsigmaTpc && nsigmaTPCDe < maxNsigmaTpc && track.hasTOF()) - registryData.fill(HIST("antideuteron_tof_syst"), pt, nsigmaTOFDe, i); - } - } + if (applyItsPid && pt < ptMaxItsPidProt && (nSigmaITSprot < nSigmaItsMinSyst[isyst] || nSigmaITSprot > nSigmaItsMaxSyst[isyst])) { + passedItsPidProt = false; + } + if (applyItsPid && pt < ptMaxItsPidDeut && (nSigmaITSdeut < nSigmaItsMinSyst[isyst] || nSigmaITSdeut > nSigmaItsMaxSyst[isyst])) { + passedItsPidDeut = false; + } + if (applyItsPid && (2.0 * pt) < ptMaxItsPidHel && (nSigmaITShel3 < nSigmaItsMinSyst[isyst] || nSigmaITShel3 > nSigmaItsMaxSyst[isyst])) { + passedItsPidHel = false; + } + + // Fill histograms + if (passedItsPidProt) { + registryData.fill(HIST("antiproton_tpc_syst"), isyst, pt, nsigmaTPCPr); + if (nsigmaTPCPr > minNsigmaTpcSyst[isyst] && nsigmaTPCPr < maxNsigmaTpcSyst[isyst] && track.hasTOF()) + registryData.fill(HIST("antiproton_tof_syst"), isyst, pt, nsigmaTOFPr); + } + if (passedItsPidDeut) { + registryData.fill(HIST("antideuteron_tpc_syst"), isyst, pt, nsigmaTPCDe); + if (nsigmaTPCDe > minNsigmaTpcSyst[isyst] && nsigmaTPCDe < maxNsigmaTpcSyst[isyst] && track.hasTOF()) + registryData.fill(HIST("antideuteron_tof_syst"), isyst, pt, nsigmaTOFDe); + } + if (passedItsPidHel) { + registryData.fill(HIST("antihelium3_tpc_syst"), isyst, 2.0 * pt, nsigmaTPCHe); } } } } - PROCESS_SWITCH(AntinucleiInJets, processSystematicsData, "Process Systematics", false); + PROCESS_SWITCH(AntinucleiInJets, processSystData, "Process syst data", true); - void processSystematicsEfficiency(SimCollisions const& collisions, MCTracks const& mcTracks, aod::McParticles const& mcParticles) + // Process MC with systematic variations of analysis parameters + void processSystEff(GenCollisionsMc const& genCollisions, RecCollisionsMc const& recCollisions, AntiNucleiTracksMc const& mcTracks, aod::McParticles const& mcParticles) { - const int nSystematics = 10; - int itsNclustersSyst[nSystematics] = {5, 6, 5, 4, 5, 3, 5, 6, 3, 4}; - float tpcNcrossedRowsSyst[nSystematics] = {100, 85, 80, 110, 95, 90, 105, 95, 100, 105}; - float dcaxySyst[nSystematics] = {0.05, 0.07, 0.10, 0.03, 0.06, 0.15, 0.08, 0.04, 0.09, 0.10}; - float dcazSyst[nSystematics] = {0.1, 0.15, 0.3, 0.075, 0.12, 0.18, 0.2, 0.1, 0.15, 0.2}; - - for (const auto& collision : collisions) { - - if (!collision.sel8() || std::fabs(collision.posZ()) > zVtx) + // Cut settings + static std::vector maxDcaxySyst = { + 0.071, 0.060, 0.066, 0.031, 0.052, 0.078, 0.045, 0.064, 0.036, 0.074, + 0.079, 0.043, 0.067, 0.059, 0.032, 0.070, 0.048, 0.077, 0.062, 0.034, + 0.057, 0.055, 0.073, 0.038, 0.050, 0.075, 0.041, 0.061, 0.033, 0.069, + 0.035, 0.044, 0.076, 0.049, 0.037, 0.054, 0.072, 0.046, 0.058, 0.040, + 0.068, 0.042, 0.056, 0.039, 0.047, 0.065, 0.051, 0.053, 0.063, 0.030}; + static std::vector maxDcazSyst = { + 0.064, 0.047, 0.032, 0.076, 0.039, 0.058, 0.043, 0.069, 0.050, 0.035, + 0.074, 0.061, 0.045, 0.033, 0.068, 0.055, 0.037, 0.071, 0.042, 0.053, + 0.077, 0.038, 0.065, 0.049, 0.036, 0.059, 0.044, 0.067, 0.041, 0.034, + 0.073, 0.052, 0.040, 0.063, 0.046, 0.031, 0.070, 0.054, 0.037, 0.062, + 0.048, 0.035, 0.075, 0.051, 0.039, 0.066, 0.043, 0.060, 0.032, 0.056}; + static std::vector nSigmaItsMinSyst = { + -2.91, -2.77, -3.03, -3.40, -2.69, -3.28, -2.96, -3.11, -3.36, -3.14, + -2.99, -2.75, -3.17, -2.64, -2.72, -3.44, -2.87, -2.95, -3.00, -2.66, + -2.93, -3.31, -3.05, -3.12, -3.21, -3.01, -2.89, -2.73, -3.26, -2.97, + -2.81, -3.33, -2.68, -3.30, -2.78, -3.39, -2.84, -3.45, -2.92, -3.15, + -3.22, -2.58, -3.07, -2.86, -3.10, -2.76, -2.94, -3.25, -3.04, -2.82}; + static std::vector nSigmaItsMaxSyst = { + 2.91, 2.77, 3.03, 3.40, 2.69, 3.28, 2.96, 3.11, 3.36, 3.14, + 2.99, 2.75, 3.17, 2.64, 2.72, 3.44, 2.87, 2.95, 3.00, 2.66, + 2.93, 3.31, 3.05, 3.12, 3.21, 3.01, 2.89, 2.73, 3.26, 2.97, + 2.81, 3.33, 2.68, 3.30, 2.78, 3.39, 2.84, 3.45, 2.92, 3.15, + 3.22, 2.58, 3.07, 2.86, 3.10, 2.76, 2.94, 3.25, 3.04, 2.82}; + static std::vector minNsigmaTpcSyst = { + -3.18, -2.86, -3.12, -2.91, -3.49, -2.57, -3.33, -2.98, -3.46, -2.70, + -3.01, -2.65, -3.27, -3.40, -2.81, -3.10, -2.55, -3.22, -3.07, -2.77, + -3.35, -2.68, -3.43, -2.88, -3.04, -2.53, -3.30, -2.79, -3.15, -2.66, + -3.41, -2.75, -3.26, -2.61, -3.09, -2.54, -3.36, -2.95, -3.20, -2.58, + -3.44, -2.83, -3.11, -2.62, -3.28, -2.69, -3.23, -2.73, -3.39, -2.90}; + static std::vector maxNsigmaTpcSyst = { + 3.18, 2.86, 3.12, 2.91, 3.49, 2.57, 3.33, 2.98, 3.46, 2.70, + 3.01, 2.65, 3.27, 3.40, 2.81, 3.10, 2.55, 3.22, 3.07, 2.77, + 3.35, 2.68, 3.43, 2.88, 3.04, 2.53, 3.30, 2.79, 3.15, 2.66, + 3.41, 2.75, 3.26, 2.61, 3.09, 2.54, 3.36, 2.95, 3.20, 2.58, + 3.44, 2.83, 3.11, 2.62, 3.28, 2.69, 3.23, 2.73, 3.39, 2.90}; + static std::vector minNsigmaTofSyst = { + -3.18, -2.86, -3.12, -2.91, -3.49, -2.57, -3.33, -2.98, -3.46, -2.70, + -3.01, -2.65, -3.27, -3.40, -2.81, -3.10, -2.55, -3.22, -3.07, -2.77, + -3.35, -2.68, -3.43, -2.88, -3.04, -2.53, -3.30, -2.79, -3.15, -2.66, + -3.41, -2.75, -3.26, -2.61, -3.09, -2.54, -3.36, -2.95, -3.20, -2.58, + -3.44, -2.83, -3.11, -2.62, -3.28, -2.69, -3.23, -2.73, -3.39, -2.90}; + static std::vector maxNsigmaTofSyst = { + 3.94, 3.62, 3.83, 3.15, 3.23, 3.49, 3.10, 3.78, 3.54, 3.36, + 3.91, 3.84, 3.72, 3.00, 3.63, 3.13, 3.68, 3.40, 3.97, 3.01, + 3.74, 3.25, 3.89, 3.08, 3.30, 3.48, 3.59, 3.16, 3.47, 3.31, + 3.92, 3.03, 3.43, 3.24, 3.11, 3.86, 3.60, 3.07, 3.21, 3.98, + 3.14, 3.69, 3.56, 3.12, 3.28, 3.46, 3.34, 3.39, 3.05, 3.76}; + + // Loop over generated collisions + for (const auto& collision : genCollisions) { + + // Apply event selection: require vertex position to be within the allowed z range + if (std::fabs(collision.posZ()) > zVtx) continue; - // generated + // Loop over all generated Monte Carlo particles for the selected event for (const auto& particle : mcParticles) { + // Select primary particles if (!particle.isPhysicalPrimary()) continue; + // Select particles within the specified pseudorapidity interval if (particle.eta() < minEta || particle.eta() > maxEta) continue; + // Process different particle species based on PDG code switch (particle.pdgCode()) { - case kProtonBar: - registryMC.fill(HIST("antiproton_incl_gen_syst"), particle.pt()); + case PDG_t::kProtonBar: + registryMC.fill(HIST("antiproton_gen_syst"), particle.pt()); break; case -o2::constants::physics::Pdg::kDeuteron: - registryMC.fill(HIST("antideuteron_incl_gen_syst"), particle.pt()); + registryMC.fill(HIST("antideuteron_gen_syst"), particle.pt()); + break; + case -o2::constants::physics::Pdg::kHelium3: + registryMC.fill(HIST("antihelium3_gen_syst"), particle.pt()); break; } } + } + + // Loop over reconstructed collisions + for (const auto& collision : recCollisions) { + + // Apply standard event selection + if (!collision.sel8() || std::fabs(collision.posZ()) > zVtx) + continue; + + // Reject events near the ITS Read-Out Frame border + if (rejectITSROFBorder && !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) + continue; + + // Reject events at the Time Frame border + if (rejectTFBorder && !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) + continue; + + // Require at least one ITS-TPC matched track + if (requireVtxITSTPC && !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) + continue; + + // Reject events with same-bunch pileup + if (rejectSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) + continue; + + // Require consistent FT0 vs PV z-vertex + if (requireIsGoodZvtxFT0VsPV && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) + continue; + + // Require TOF match for at least one vertex track + if (requireIsVertexTOFmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTOFmatched)) + continue; - // ITS pid using cluster size + // Initialize ITS PID Response object o2::aod::ITSResponse itsResponse; - // Reconstructed Tracks + // Loop over reconstructed tracks for (auto const& track : mcTracks) { - // Get MC Particle - if (!track.has_mcParticle()) + // Select only antimatter + if (track.sign() > 0) continue; - const auto particle = track.mcParticle(); - // Variables - double nsigmaTPCPr = track.tpcNSigmaPr(); - double nsigmaTOFPr = track.tofNSigmaPr(); - double nsigmaTPCDe = track.tpcNSigmaDe(); - double nsigmaTOFDe = track.tofNSigmaDe(); - double dcaxy = track.dcaXY(); - double dcaz = track.dcaZ(); + // Get corresponding MC particle + if (!track.has_mcParticle()) + continue; + const auto mcparticle = track.mcParticle(); - for (int i = 0; i < nSystematics; i++) { + // Loop over different cut settings + for (int isyst = 0; isyst < nSyst; isyst++) { - // Track Selection - if (requirePvContributor && !(track.isPVContributor())) - continue; - if (!track.hasITS()) - continue; - if (track.itsNCls() < itsNclustersSyst[i]) - continue; - if (!track.hasTPC()) - continue; - if (track.tpcNClsCrossedRows() < tpcNcrossedRowsSyst[i]) - continue; - if (track.tpcChi2NCl() > maxChiSquareTpc) - continue; - if (track.itsChi2NCl() > maxChiSquareIts) - continue; - if (track.eta() < minEta || track.eta() > maxEta) + // Apply track selection + if (!passedTrackSelectionSyst(track, isyst)) continue; - if (track.pt() < minPt) - continue; - if (std::fabs(dcaxy) > dcaxySyst[i]) + + // Define variables + double nsigmaTPCPr = track.tpcNSigmaPr(); + double nsigmaTOFPr = track.tofNSigmaPr(); + double nsigmaTPCDe = track.tpcNSigmaDe(); + double nsigmaTOFDe = track.tofNSigmaDe(); + double nsigmaTPCHe = track.tpcNSigmaHe(); + double pt = track.pt(); + double dcaxy = track.dcaXY(); + double dcaz = track.dcaZ(); + + // Apply DCA selections + if (std::fabs(dcaxy) > maxDcaxySyst[isyst] || std::fabs(dcaz) > maxDcazSyst[isyst]) continue; - if (std::fabs(dcaz) > dcazSyst[i]) + + // Fill inclusive antiproton spectrum + registryMC.fill(HIST("antiproton_incl_syst"), isyst, pt); + + // Select physical primary antiprotons + if (!mcparticle.isPhysicalPrimary()) continue; - // particle identification using the ITS cluster size - bool passedItsPidProt(false), passedItsPidDeut(false); - if (itsResponse.nSigmaITS(track) > nSigmaItsMin && itsResponse.nSigmaITS(track) < nSigmaItsMax) { - passedItsPidProt = true; + // Fill antiproton spectrum for physical primaries + registryMC.fill(HIST("antiproton_prim_syst"), isyst, pt); + + // Particle identification using the ITS cluster size (vary also PID ITS) + bool passedItsPidProt(true), passedItsPidDeut(true), passedItsPidHel(true); + double nSigmaITSprot = static_cast(itsResponse.nSigmaITS(track)); + double nSigmaITSdeut = static_cast(itsResponse.nSigmaITS(track)); + double nSigmaITShel3 = static_cast(itsResponse.nSigmaITS(track)); + + if (applyItsPid && pt < ptMaxItsPidProt && (nSigmaITSprot < nSigmaItsMinSyst[isyst] || nSigmaITSprot > nSigmaItsMaxSyst[isyst])) { + passedItsPidProt = false; } - if (itsResponse.nSigmaITS(track) > nSigmaItsMin && itsResponse.nSigmaITS(track) < nSigmaItsMax) { - passedItsPidDeut = true; + if (applyItsPid && pt < ptMaxItsPidDeut && (nSigmaITSdeut < nSigmaItsMinSyst[isyst] || nSigmaITSdeut > nSigmaItsMaxSyst[isyst])) { + passedItsPidDeut = false; } - if (!applyItsPid) { - passedItsPidProt = true; - passedItsPidDeut = true; + if (applyItsPid && (2.0 * pt) < ptMaxItsPidHel && (nSigmaITShel3 < nSigmaItsMinSyst[isyst] || nSigmaITShel3 > nSigmaItsMaxSyst[isyst])) { + passedItsPidHel = false; } - if (track.pt() > ptMaxItsPidProt) - passedItsPidProt = true; - if (track.pt() > ptMaxItsPidDeut) - passedItsPidDeut = true; - if (!particle.isPhysicalPrimary()) - continue; - - if (particle.pdgCode() == kProtonBar) - registryMC.fill(HIST("antiproton_incl_prim_syst"), track.pt(), i); - // antiprotons - if (particle.pdgCode() == kProtonBar && passedItsPidProt) { - if (nsigmaTPCPr > minNsigmaTpc && nsigmaTPCPr < maxNsigmaTpc) { - registryMC.fill(HIST("antiproton_incl_rec_tpc_syst"), track.pt(), i); - if (track.hasTOF() && nsigmaTOFPr > minNsigmaTof && nsigmaTOFPr < maxNsigmaTof) - registryMC.fill(HIST("antiproton_incl_rec_tof_syst"), track.pt(), i); - } + // Fill histograms for antiprotons + if (passedItsPidProt && mcparticle.pdgCode() == PDG_t::kProtonBar && nsigmaTPCPr > minNsigmaTpcSyst[isyst] && nsigmaTPCPr < maxNsigmaTpcSyst[isyst]) { + registryData.fill(HIST("antiproton_rec_tpc_syst"), isyst, pt); + if (track.hasTOF() && nsigmaTOFPr > minNsigmaTofSyst[isyst] && nsigmaTOFPr < maxNsigmaTofSyst[isyst]) + registryData.fill(HIST("antiproton_rec_tof_syst"), isyst, pt); } - - // antideuterons - if (particle.pdgCode() == -o2::constants::physics::Pdg::kDeuteron && passedItsPidDeut) { - if (nsigmaTPCDe > minNsigmaTpc && nsigmaTPCDe < maxNsigmaTpc) { - registryMC.fill(HIST("antideuteron_incl_rec_tpc_syst"), track.pt(), i); - if (track.hasTOF() && nsigmaTOFDe > minNsigmaTof && nsigmaTOFDe < maxNsigmaTof) - registryMC.fill(HIST("antideuteron_incl_rec_tof_syst"), track.pt(), i); - } + // Fill histograms for antideuterons + if (passedItsPidDeut && mcparticle.pdgCode() == -o2::constants::physics::Pdg::kDeuteron && nsigmaTPCDe > minNsigmaTpcSyst[isyst] && nsigmaTPCDe < maxNsigmaTpcSyst[isyst]) { + registryData.fill(HIST("antideuteron_rec_tpc_syst"), isyst, pt); + if (track.hasTOF() && nsigmaTOFDe > minNsigmaTofSyst[isyst] && nsigmaTOFDe < maxNsigmaTofSyst[isyst]) + registryData.fill(HIST("antideuteron_rec_tof_syst"), isyst, pt); + } + // Fill histograms for antihelium3 + if (passedItsPidHel && mcparticle.pdgCode() == -o2::constants::physics::Pdg::kHelium3 && nsigmaTPCHe > minNsigmaTpcSyst[isyst] && nsigmaTPCHe < maxNsigmaTpcSyst[isyst]) { + registryData.fill(HIST("antihelium3_rec_tpc_syst"), isyst, 2.0 * pt); } } } } } - PROCESS_SWITCH(AntinucleiInJets, processSystematicsEfficiency, "process efficiency for systematics", false); + PROCESS_SWITCH(AntinucleiInJets, processSystEff, "process syst mc", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 0156aa01bebe681eafc5ff4c123d0440f0dfda6f Mon Sep 17 00:00:00 2001 From: Fabrizio Date: Wed, 6 Aug 2025 00:05:45 +0200 Subject: [PATCH 245/345] [PWGDQ] Fix DeltaPhi definition (#12448) --- PWGDQ/Tasks/taskJpsiHf.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/PWGDQ/Tasks/taskJpsiHf.cxx b/PWGDQ/Tasks/taskJpsiHf.cxx index 79d9348940a..ef415259a02 100644 --- a/PWGDQ/Tasks/taskJpsiHf.cxx +++ b/PWGDQ/Tasks/taskJpsiHf.cxx @@ -97,15 +97,16 @@ struct taskJPsiHf { float deltaRap = -999; float deltaPhi = -999; - for (auto& dilepton : dileptons) { + for (auto const& dilepton : dileptons) { ptDilepton = RecoDecay::pt(dilepton.px(), dilepton.py()); rapDilepton = RecoDecay::y(std::array{dilepton.px(), dilepton.py(), dilepton.pz()}, constants::physics::MassJPsi); phiDilepton = RecoDecay::phi(dilepton.px(), dilepton.py()); - for (auto& dmeson : dmesons) { + for (auto const& dmeson : dmesons) { ptDmeson = RecoDecay::pt(dmeson.px(), dmeson.py()); phiDmeson = RecoDecay::phi(dmeson.px(), dmeson.py()); - deltaPhi = RecoDecay::constrainAngle(phiDilepton - phiDmeson, -o2::constants::math::PIHalf); + float absDeltaPhiRaw = std::abs(phiDilepton - phiDmeson); + deltaPhi = (absDeltaPhiRaw < o2::constants::math::PI) ? absDeltaPhiRaw : o2::constants::math::TwoPI - absDeltaPhiRaw; auto ptBinDmesForBdt = findBin(binsPtDmesForBdt, ptDmeson); if (ptBinDmesForBdt == -1) { From b0b4c8c7f2f55b6281f064e73fbca20f13c33278 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Wed, 6 Aug 2025 00:14:02 +0200 Subject: [PATCH 246/345] [Common] Latest changes to centrality study task (#12434) Co-authored-by: ALICE Builder --- Common/Tasks/centralityStudy.cxx | 55 ++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 20 deletions(-) diff --git a/Common/Tasks/centralityStudy.cxx b/Common/Tasks/centralityStudy.cxx index be975b9cecb..a8cdea5ac09 100644 --- a/Common/Tasks/centralityStudy.cxx +++ b/Common/Tasks/centralityStudy.cxx @@ -210,9 +210,9 @@ struct centralityStudy { histos.add("hFV0A_BCs", "hFV0A_BCs", kTH1D, {axisMultUltraFineFV0A}); histos.add("hFT0CvsPVz_BCs_All", "hFT0CvsPVz_BCs_All", kTProfile, {axisPVz}); histos.add("hFT0CvsPVz_BCs", "hFT0CvsPVz_BCs", kTProfile, {axisPVz}); - histos.add("hVertexZ_BCvsCO", "hVertexZ_BCvsCO", kTH2D, {axisPVz, axisPVz}); - histos.add("hZNAvsFT0C_BCs", "hZNAvsFT0C_BCs", kTH2D, {axisMultFT0C, axisZN}); - histos.add("hZNCvsFT0C_BCs", "hZNCvsFT0C_BCs", kTH2D, {axisMultFT0C, axisZN}); + histos.add("hVertexZ_BCvsCO", "hVertexZ_BCvsCO", kTH2F, {axisPVz, axisPVz}); + histos.add("hZNAvsFT0C_BCs", "hZNAvsFT0C_BCs", kTH2F, {axisMultFT0C, axisZN}); + histos.add("hZNCvsFT0C_BCs", "hZNCvsFT0C_BCs", kTH2F, {axisMultFT0C, axisZN}); } if (do2DPlots) { @@ -237,6 +237,7 @@ struct centralityStudy { histos.add("hNGlobalTracksVsZNA", "hNGlobalTracksVsZNA", kTH2F, {axisZN, axisMultGlobalTracks}); histos.add("hNGlobalTracksVsZNC", "hNGlobalTracksVsZNC", kTH2F, {axisZN, axisMultGlobalTracks}); histos.add("hNGlobalTracksVsNMFTTracks", "hNGlobalTracksVsNMFTTracks", kTH2F, {axisMultMFTTracks, axisMultGlobalTracks}); + histos.add("hNGlobalTracksVsNTPV", "hNGlobalTracksVsNTPV", kTH2F, {axisMultPVContributors, axisMultGlobalTracks}); } if (doOccupancyStudyVsRawValues2d) { @@ -391,15 +392,24 @@ struct centralityStudy { histPointers.insert({histPath + "hDeltaTimeVsCentrality", histos.add((histPath + "hDeltaTimeVsCentrality").c_str(), "hDeltaTimeVsCentrality", {kTH2F, {{axisCentrality, axisDeltaTime}}})}); } + if (doNGlobalTracksVsRawSignals) { + histPointers.insert({histPath + "hNGlobalTracksVsFT0A", histos.add((histPath + "hNGlobalTracksVsFT0A").c_str(), "hNGlobalTracksVsFT0A", {kTH2F, {{axisMultFT0A, axisMultGlobalTracks}}})}); + histPointers.insert({histPath + "hNGlobalTracksVsFT0C", histos.add((histPath + "hNGlobalTracksVsFT0C").c_str(), "hNGlobalTracksVsFT0C", {kTH2F, {{axisMultFT0C, axisMultGlobalTracks}}})}); + histPointers.insert({histPath + "hNGlobalTracksVsFT0M", histos.add((histPath + "hNGlobalTracksVsFT0M").c_str(), "hNGlobalTracksVsFT0M", {kTH2F, {{axisMultFT0M, axisMultGlobalTracks}}})}); + histPointers.insert({histPath + "hNGlobalTracksVsFV0A", histos.add((histPath + "hNGlobalTracksVsFV0A").c_str(), "hNGlobalTracksVsFV0A", {kTH2F, {{axisMultFV0A, axisMultGlobalTracks}}})}); + histPointers.insert({histPath + "hNGlobalTracksVsNMFTTracks", histos.add((histPath + "hNGlobalTracksVsNMFTTracks").c_str(), "hNGlobalTracksVsNMFTTracks", {kTH2F, {{axisMultMFTTracks, axisMultGlobalTracks}}})}); + histPointers.insert({histPath + "hNGlobalTracksVsNTPV", histos.add((histPath + "hNGlobalTracksVsNTPV").c_str(), "hNGlobalTracksVsNTPV", {kTH2F, {{axisMultPVContributors, axisMultGlobalTracks}}})}); + } + if (doTimeStudies) { - histPointers.insert({histPath + "hFT0AVsTime", histos.add((histPath + "hFT0AVsTime").c_str(), "hFT0AVsTime", {kTH2D, {{axisDeltaTimestamp, axisMultFT0A}}})}); - histPointers.insert({histPath + "hFT0CVsTime", histos.add((histPath + "hFT0CVsTime").c_str(), "hFT0CVsTime", {kTH2D, {{axisDeltaTimestamp, axisMultFT0C}}})}); - histPointers.insert({histPath + "hFT0MVsTime", histos.add((histPath + "hFT0MVsTime").c_str(), "hFT0MVsTime", {kTH2D, {{axisDeltaTimestamp, axisMultFT0M}}})}); - histPointers.insert({histPath + "hFV0AVsTime", histos.add((histPath + "hFV0AVsTime").c_str(), "hFV0AVsTime", {kTH2D, {{axisDeltaTimestamp, axisMultFV0A}}})}); - histPointers.insert({histPath + "hFV0AOuterVsTime", histos.add((histPath + "hFV0AOuterVsTime").c_str(), "hFV0AOuterVsTime", {kTH2D, {{axisDeltaTimestamp, axisMultFV0A}}})}); - histPointers.insert({histPath + "hMFTTracksVsTime", histos.add((histPath + "hMFTTracksVsTime").c_str(), "hMFTTracksVsTime", {kTH2D, {{axisDeltaTimestamp, axisMultMFTTracks}}})}); - histPointers.insert({histPath + "hNGlobalVsTime", histos.add((histPath + "hNGlobalVsTime").c_str(), "hNGlobalVsTime", {kTH2D, {{axisDeltaTimestamp, axisMultGlobalTracks}}})}); - histPointers.insert({histPath + "hNTPVContributorsVsTime", histos.add((histPath + "hNTPVContributorsVsTime").c_str(), "hNTPVContributorsVsTime", {kTH2D, {{axisDeltaTimestamp, axisMultPVContributors}}})}); + histPointers.insert({histPath + "hFT0AVsTime", histos.add((histPath + "hFT0AVsTime").c_str(), "hFT0AVsTime", {kTH2F, {{axisDeltaTimestamp, axisMultFT0A}}})}); + histPointers.insert({histPath + "hFT0CVsTime", histos.add((histPath + "hFT0CVsTime").c_str(), "hFT0CVsTime", {kTH2F, {{axisDeltaTimestamp, axisMultFT0C}}})}); + histPointers.insert({histPath + "hFT0MVsTime", histos.add((histPath + "hFT0MVsTime").c_str(), "hFT0MVsTime", {kTH2F, {{axisDeltaTimestamp, axisMultFT0M}}})}); + histPointers.insert({histPath + "hFV0AVsTime", histos.add((histPath + "hFV0AVsTime").c_str(), "hFV0AVsTime", {kTH2F, {{axisDeltaTimestamp, axisMultFV0A}}})}); + histPointers.insert({histPath + "hFV0AOuterVsTime", histos.add((histPath + "hFV0AOuterVsTime").c_str(), "hFV0AOuterVsTime", {kTH2F, {{axisDeltaTimestamp, axisMultFV0A}}})}); + histPointers.insert({histPath + "hMFTTracksVsTime", histos.add((histPath + "hMFTTracksVsTime").c_str(), "hMFTTracksVsTime", {kTH2F, {{axisDeltaTimestamp, axisMultMFTTracks}}})}); + histPointers.insert({histPath + "hNGlobalVsTime", histos.add((histPath + "hNGlobalVsTime").c_str(), "hNGlobalVsTime", {kTH2F, {{axisDeltaTimestamp, axisMultGlobalTracks}}})}); + histPointers.insert({histPath + "hNTPVContributorsVsTime", histos.add((histPath + "hNTPVContributorsVsTime").c_str(), "hNTPVContributorsVsTime", {kTH2F, {{axisDeltaTimestamp, axisMultPVContributors}}})}); histPointers.insert({histPath + "hPVzProfileCoVsTime", histos.add((histPath + "hPVzProfileCoVsTime").c_str(), "hPVzProfileCoVsTime", {kTProfile, {{axisDeltaTimestamp}}})}); histPointers.insert({histPath + "hPVzProfileBcVsTime", histos.add((histPath + "hPVzProfileBcVsTime").c_str(), "hPVzProfileBcVsTime", {kTProfile, {{axisDeltaTimestamp}}})}); if (irDoRateVsTime) { @@ -650,15 +660,20 @@ struct centralityStudy { } if (doNGlobalTracksVsRawSignals) { - histos.fill(HIST("hNGlobalTracksVsFT0A"), collision.multFT0A(), collision.multNTracksGlobal()); - histos.fill(HIST("hNGlobalTracksVsFT0C"), collision.multFT0C(), collision.multNTracksGlobal()); - histos.fill(HIST("hNGlobalTracksVsFT0M"), collision.multFT0A() + collision.multFT0C(), collision.multNTracksGlobal()); - histos.fill(HIST("hNGlobalTracksVsFV0A"), collision.multFV0A(), collision.multNTracksGlobal()); - histos.fill(HIST("hNGlobalTracksVsFDDA"), collision.multFDDA(), collision.multNTracksGlobal()); - histos.fill(HIST("hNGlobalTracksVsFDDC"), collision.multFDDC(), collision.multNTracksGlobal()); - histos.fill(HIST("hNGlobalTracksVsZNA"), collision.multZNA(), collision.multNTracksGlobal()); - histos.fill(HIST("hNGlobalTracksVsZNC"), collision.multZNC(), collision.multNTracksGlobal()); - histos.fill(HIST("hNGlobalTracksVsNMFTTracks"), collision.mftNtracks(), collision.multNTracksGlobal()); + histos.fill(HIST("hNGlobalTracksVsFT0A"), multFT0A, multNTracksGlobal); + histos.fill(HIST("hNGlobalTracksVsFT0C"), multFT0C, multNTracksGlobal); + histos.fill(HIST("hNGlobalTracksVsFT0M"), (multFT0A + multFT0C), multNTracksGlobal); + histos.fill(HIST("hNGlobalTracksVsFV0A"), multFV0A, multNTracksGlobal); + histos.fill(HIST("hNGlobalTracksVsNMFTTracks"), mftNtracks, multNTracksGlobal); + histos.fill(HIST("hNGlobalTracksVsNTPV"), multNTracksPV, multNTracksGlobal); + + // per run + getHist(TH2, histPath + "hNGlobalTracksVsFT0A")->Fill(multFT0A, multNTracksGlobal); + getHist(TH2, histPath + "hNGlobalTracksVsFT0C")->Fill(multFT0C, multNTracksGlobal); + getHist(TH2, histPath + "hNGlobalTracksVsFT0M")->Fill(multFT0A + multFT0C, multNTracksGlobal); + getHist(TH2, histPath + "hNGlobalTracksVsFV0A")->Fill(multFV0A, multNTracksGlobal); + getHist(TH2, histPath + "hNGlobalTracksVsNMFTTracks")->Fill(mftNtracks, multNTracksGlobal); + getHist(TH2, histPath + "hNGlobalTracksVsNTPV")->Fill(multNTracksPV, multNTracksGlobal); } // if the table has centrality information From c2e5e0f6b9f21fb1e017e6f0ffe1894110e69ddf Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Wed, 6 Aug 2025 02:14:10 +0200 Subject: [PATCH 247/345] [Common] mult/cent: add Zeq to MFT, NGlobals too (#12435) Co-authored-by: ALICE Builder --- Common/DataModel/Multiplicity.h | 18 ++++--- Common/Tools/MultModule.h | 84 +++++++++++++++++++++++++++------ 2 files changed, 81 insertions(+), 21 deletions(-) diff --git a/Common/DataModel/Multiplicity.h b/Common/DataModel/Multiplicity.h index d2db60732f2..8d1e9b10ab3 100644 --- a/Common/DataModel/Multiplicity.h +++ b/Common/DataModel/Multiplicity.h @@ -211,12 +211,14 @@ using MultHepMCHI = MultHepMCHIs::iterator; namespace multZeq { -DECLARE_SOA_COLUMN(MultZeqFV0A, multZeqFV0A, float); //! Multiplicity equalized for the vertex position with the FV0A detector -DECLARE_SOA_COLUMN(MultZeqFT0A, multZeqFT0A, float); //! Multiplicity equalized for the vertex position with the FT0A detector -DECLARE_SOA_COLUMN(MultZeqFT0C, multZeqFT0C, float); //! Multiplicity equalized for the vertex position with the FT0C detector -DECLARE_SOA_COLUMN(MultZeqFDDA, multZeqFDDA, float); //! Multiplicity equalized for the vertex position with the FDDA detector -DECLARE_SOA_COLUMN(MultZeqFDDC, multZeqFDDC, float); //! Multiplicity equalized for the vertex position with the FDDC detector -DECLARE_SOA_COLUMN(MultZeqNTracksPV, multZeqNTracksPV, float); //! Multiplicity equalized for the vertex position from the PV contributors +DECLARE_SOA_COLUMN(MultZeqFV0A, multZeqFV0A, float); //! Multiplicity equalized for the vertex position with the FV0A detector +DECLARE_SOA_COLUMN(MultZeqFT0A, multZeqFT0A, float); //! Multiplicity equalized for the vertex position with the FT0A detector +DECLARE_SOA_COLUMN(MultZeqFT0C, multZeqFT0C, float); //! Multiplicity equalized for the vertex position with the FT0C detector +DECLARE_SOA_COLUMN(MultZeqFDDA, multZeqFDDA, float); //! Multiplicity equalized for the vertex position with the FDDA detector +DECLARE_SOA_COLUMN(MultZeqFDDC, multZeqFDDC, float); //! Multiplicity equalized for the vertex position with the FDDC detector +DECLARE_SOA_COLUMN(MultZeqNTracksPV, multZeqNTracksPV, float); //! Multiplicity equalized for the vertex position from the PV contributors +DECLARE_SOA_COLUMN(MultZeqNTracksGlobal, multZeqNTracksGlobal, float); //! Multiplicity equalized for the vertex position, global tracks +DECLARE_SOA_COLUMN(MultZeqMFTNtracks, multZeqMFTNtracks, float); //! Multiplicity equalized for the vertex position, MFT tracks } // namespace multZeq DECLARE_SOA_TABLE(FV0MultZeqs, "AOD", "FV0MULTZEQ", //! Multiplicity equalized for the vertex position with the FV0 detector multZeq::MultZeqFV0A); @@ -226,6 +228,10 @@ DECLARE_SOA_TABLE(FDDMultZeqs, "AOD", "FDDMULTZEQ", //! Multiplicity equalized f multZeq::MultZeqFDDA, multZeq::MultZeqFDDC); DECLARE_SOA_TABLE(PVMultZeqs, "AOD", "PVMULTZEQ", //! Multiplicity equalized for the vertex position from the PV contributors multZeq::MultZeqNTracksPV); +DECLARE_SOA_TABLE(GlobalMultZeqs, "AOD", "GLOBALMULTZEQ", //! Multiplicity equalized for the vertex position, global tracks + multZeq::MultZeqNTracksGlobal); +DECLARE_SOA_TABLE(MFTMultZeqs, "AOD", "MFTMULTZEQS", //! Multiplicity equalized for the vertex position, MFT tracks + multZeq::MultZeqMFTNtracks); using MultZeqs = soa::Join; using MultZeq = MultZeqs::iterator; diff --git a/Common/Tools/MultModule.h b/Common/Tools/MultModule.h index f722643fc2e..017c1d70de3 100644 --- a/Common/Tools/MultModule.h +++ b/Common/Tools/MultModule.h @@ -61,6 +61,8 @@ static const std::vector tableNames{ "FT0MultZeqs", "FDDMultZeqs", "PVMultZeqs", + "GlobalMultZeqs", + "MFTMultZeqs", "MultMCExtras", "Mult2MCExtras", "MFTMults", @@ -86,7 +88,7 @@ static const std::vector tableNames{ "BCCentFT0As", "BCCentFT0Cs"}; -static constexpr int nTablesConst = 36; +static constexpr int nTablesConst = 38; static const std::vector parameterNames{"enable"}; static const int defaultParameters[nTablesConst][nParameters]{ @@ -125,6 +127,8 @@ static const int defaultParameters[nTablesConst][nParameters]{ {-1}, {-1}, {-1}, + {-1}, + {-1}, {-1}}; // table index : match order above @@ -142,6 +146,8 @@ enum tableIndex { kFV0Mults, // standard kFT0MultZeqs, // zeq calib, standard kFDDMultZeqs, // zeq calib, standard kPVMultZeqs, // zeq calib, standard + kGlobalMultZeqs, // zeq calib, extra + kMFTMultZeqs, // zeq calib, extra kMultMCExtras, // MC exclusive kMult2MCExtras, // MC exclusive kMFTMults, // requires MFT task @@ -185,6 +191,8 @@ struct products : o2::framework::ProducesGroup { o2::framework::Produces tableFT0Zeqs; o2::framework::Produces tableFDDZeqs; o2::framework::Produces tablePVZeqs; + o2::framework::Produces tableNGlobalZeqs; + o2::framework::Produces tableNMFTZeqs; o2::framework::Produces tableExtraMc; o2::framework::Produces tableExtraMult2MCExtras; o2::framework::Produces mftMults; @@ -256,6 +264,8 @@ struct multEntry { float multFDDAZeq = -999.0f; float multFDDCZeq = -999.0f; float multNContribsZeq = 0; + float multMFTTracksZeq = 0; + float multGlobalTracksZeq = 0; int multGlobalTracks = 0; // multsGlobal int multNbrContribsEta05GlobalTrackWoDCA = 0; // multsGlobal @@ -317,6 +327,8 @@ class MultModule hVtxZFDDA = nullptr; hVtxZFDDC = nullptr; hVtxZNTracks = nullptr; + hVtxZNMFTTracks = nullptr; + hVtxZNGlobalTracks = nullptr; } // internal: calib related, vtx-z profiles @@ -330,6 +342,8 @@ class MultModule TProfile* hVtxZFDDA; TProfile* hVtxZFDDC; TProfile* hVtxZNTracks; + TProfile* hVtxZNMFTTracks; // non-legacy, added August/2025 + TProfile* hVtxZNGlobalTracks; // non-legacy, added August/2025 // declaration of structs here // (N.B.: will be invisible to the outside, create your own copies) @@ -469,15 +483,28 @@ class MultModule internalOpts.mEnabledTables[kMFTMults] = 1; listOfRequestors[kMFTMults].Append(Form("%s ", "dependency check")); } + if (internalOpts.mEnabledTables[kCentMFTs] && !internalOpts.mEnabledTables[kMFTMultZeqs]) { + internalOpts.mEnabledTables[kMFTMultZeqs] = 1; + listOfRequestors[kMFTMultZeqs].Append(Form("%s ", "dependency check")); + } if (internalOpts.mEnabledTables[kCentNGlobals] && !internalOpts.mEnabledTables[kMultsGlobal]) { internalOpts.mEnabledTables[kMultsGlobal] = 1; listOfRequestors[kMultsGlobal].Append(Form("%s ", "dependency check")); } + if (internalOpts.mEnabledTables[kCentNGlobals] && !internalOpts.mEnabledTables[kGlobalMultZeqs]) { + internalOpts.mEnabledTables[kGlobalMultZeqs] = 1; + listOfRequestors[kGlobalMultZeqs].Append(Form("%s ", "dependency check")); + } if (internalOpts.embedINELgtZEROselection.value > 0 && !internalOpts.mEnabledTables[kPVMults]) { internalOpts.mEnabledTables[kPVMults] = 1; listOfRequestors[kPVMults].Append(Form("%s ", "dependency check")); } + // capture the need for PYTHIA calibration in Pb-Pb runs + if (metadataInfo.isMC() && mRunNumber >= 544013 && mRunNumber <= 545367) { + internalOpts.generatorName.value = "PYTHIA"; + } + // list enabled tables for (int i = 0; i < nTablesConst; i++) { // printout to be improved in the future @@ -486,11 +513,6 @@ class MultModule } } - // capture the need for PYTHIA calibration in Pb-Pb runs - if (metadataInfo.isMC() && mRunNumber >= 544013 && mRunNumber <= 545367) { - internalOpts.generatorName.value = "PYTHIA"; - } - mRunNumber = 0; mRunNumberCentrality = 0; lCalibLoaded = false; @@ -500,8 +522,9 @@ class MultModule hVtxZFDDA = nullptr; hVtxZFDDC = nullptr; hVtxZNTracks = nullptr; + hVtxZNMFTTracks = nullptr; + hVtxZNGlobalTracks = nullptr; - // pass to the outside opts = internalOpts; } @@ -632,12 +655,20 @@ class MultModule hVtxZFDDA = static_cast(lCalibObjects->FindObject("hVtxZFDDA")); hVtxZFDDC = static_cast(lCalibObjects->FindObject("hVtxZFDDC")); hVtxZNTracks = static_cast(lCalibObjects->FindObject("hVtxZNTracksPV")); + hVtxZNMFTTracks = static_cast(lCalibObjects->FindObject("hVtxZMFT")); + hVtxZNGlobalTracks = static_cast(lCalibObjects->FindObject("hVtxZNGlobals")); lCalibLoaded = true; // Capture error if (!hVtxZFV0A || !hVtxZFT0A || !hVtxZFT0C || !hVtxZFDDA || !hVtxZFDDC || !hVtxZNTracks) { LOGF(error, "Problem loading CCDB objects! Please check"); lCalibLoaded = false; } + if (!hVtxZNMFTTracks) { + LOGF(info, "MFT track counter: vertex-Z calibration not loaded, will run without."); + } + if (!hVtxZNGlobalTracks) { + LOGF(info, "Global track counter: vertex-Z calibration not loaded, will run without."); + } } else { LOGF(error, "Problem loading CCDB object! Please check"); lCalibLoaded = false; @@ -722,9 +753,9 @@ class MultModule } //_______________________________________________________________________ - // forward detector signals, vertex-Z equalized + // vertex-Z equalized signals if (internalOpts.mEnabledTables[kFV0MultZeqs]) { - if (std::fabs(collision.posZ() && lCalibLoaded)) { + if (std::fabs(collision.posZ()) < 15.0f && lCalibLoaded) { mults.multFV0AZeq = hVtxZFV0A->Interpolate(0.0) * mults.multFV0A / hVtxZFV0A->Interpolate(collision.posZ()); } else { mults.multFV0AZeq = 0.0f; @@ -732,7 +763,7 @@ class MultModule cursors.tableFV0Zeqs(mults.multFV0AZeq); } if (internalOpts.mEnabledTables[kFT0MultZeqs]) { - if (std::fabs(collision.posZ() && lCalibLoaded)) { + if (std::fabs(collision.posZ()) < 15.0f && lCalibLoaded) { mults.multFT0AZeq = hVtxZFT0A->Interpolate(0.0) * mults.multFT0A / hVtxZFT0A->Interpolate(collision.posZ()); mults.multFT0CZeq = hVtxZFT0C->Interpolate(0.0) * mults.multFT0C / hVtxZFT0C->Interpolate(collision.posZ()); } else { @@ -742,7 +773,7 @@ class MultModule cursors.tableFT0Zeqs(mults.multFT0AZeq, mults.multFT0CZeq); } if (internalOpts.mEnabledTables[kFDDMultZeqs]) { - if (std::fabs(collision.posZ() && lCalibLoaded)) { + if (std::fabs(collision.posZ()) < 15.0f && lCalibLoaded) { mults.multFDDAZeq = hVtxZFDDA->Interpolate(0.0) * mults.multFDDA / hVtxZFDDA->Interpolate(collision.posZ()); mults.multFDDCZeq = hVtxZFDDC->Interpolate(0.0) * mults.multFDDC / hVtxZFDDC->Interpolate(collision.posZ()); } else { @@ -754,7 +785,7 @@ class MultModule //_______________________________________________________________________ // determine if barrel track loop is required, do it (once!) if so but save CPU if not - if (internalOpts.mEnabledTables[kTPCMults] || internalOpts.mEnabledTables[kPVMults] || internalOpts.mEnabledTables[kMultsExtra] || internalOpts.mEnabledTables[kPVMultZeqs] || internalOpts.mEnabledTables[kMultsGlobal]) { + if (internalOpts.mEnabledTables[kTPCMults] || internalOpts.mEnabledTables[kPVMults] || internalOpts.mEnabledTables[kMultsExtra] || internalOpts.mEnabledTables[kPVMultZeqs] || internalOpts.mEnabledTables[kMultsGlobal] || internalOpts.mEnabledTables[kGlobalMultZeqs]) { // single loop to calculate all for (const auto& track : tracks) { if (track.hasTPC()) { @@ -822,6 +853,17 @@ class MultModule } cursors.multsGlobal(mults.multGlobalTracks, mults.multNbrContribsEta08GlobalTrackWoDCA, mults.multNbrContribsEta10GlobalTrackWoDCA, mults.multNbrContribsEta05GlobalTrackWoDCA); + + if (!hVtxZNGlobalTracks || std::fabs(collision.posZ()) > 15.0f) { + mults.multGlobalTracksZeq = mults.multGlobalTracks; // if no equalization available, don't do it + } else { + mults.multGlobalTracksZeq = hVtxZNGlobalTracks->Interpolate(0.0) * mults.multFT0C / hVtxZNGlobalTracks->Interpolate(collision.posZ()); + } + + // provide vertex-Z equalized Nglobals (or non-equalized if missing or beyond range) + if (internalOpts.mEnabledTables[kGlobalMultZeqs]) { + cursors.tableNGlobalZeqs(mults.multGlobalTracksZeq); + } } // fill track counters at this stage if requested @@ -842,7 +884,7 @@ class MultModule collision.flags()); } if (internalOpts.mEnabledTables[kPVMultZeqs]) { - if (std::fabs(collision.posZ()) && lCalibLoaded) { + if (std::fabs(collision.posZ()) < 15.0f && lCalibLoaded) { mults.multNContribsZeq = hVtxZNTracks->Interpolate(0.0) * mults.multNContribs / hVtxZNTracks->Interpolate(collision.posZ()); } else { mults.multNContribsZeq = 0.0f; @@ -934,6 +976,18 @@ class MultModule cursors.mftMults(nAllTracks, nTracks); mults[collision.globalIndex()].multMFTAllTracks = nAllTracks; mults[collision.globalIndex()].multMFTTracks = nTracks; + + // vertex-Z equalized MFT + if (!hVtxZNMFTTracks || std::fabs(collision.posZ()) > 15.0f) { + mults[collision.globalIndex()].multMFTTracksZeq = mults[collision.globalIndex()].multMFTTracks; // if no equalization available, don't do it + } else { + mults[collision.globalIndex()].multMFTTracksZeq = hVtxZNMFTTracks->Interpolate(0.0) * mults[collision.globalIndex()].multMFTTracks / hVtxZNMFTTracks->Interpolate(collision.posZ()); + } + + // provide vertex-Z equalized Nglobals (or non-equalized if missing or beyond range) + if (internalOpts.mEnabledTables[kMFTMultZeqs]) { + cursors.tableNMFTZeqs(mults[collision.globalIndex()].multMFTTracksZeq); + } } //__________________________________________________ @@ -1225,9 +1279,9 @@ class MultModule if (internalOpts.mEnabledTables[kCentNTPVs]) populateTable(cursors.centNTPV, ntpvInfo, mults[iEv].multNContribs, isInelGt0); if (internalOpts.mEnabledTables[kCentNGlobals]) - populateTable(cursors.centNGlobals, nGlobalInfo, mults[iEv].multGlobalTracks, isInelGt0); + populateTable(cursors.centNGlobals, nGlobalInfo, mults[iEv].multGlobalTracksZeq, isInelGt0); if (internalOpts.mEnabledTables[kCentMFTs]) - populateTable(cursors.centMFTs, mftInfo, mults[iEv].multMFTTracks, isInelGt0); + populateTable(cursors.centMFTs, mftInfo, mults[iEv].multMFTTracksZeq, isInelGt0); } // populate centralities per BC From bf767386b0e4cab9cac13b84de355117beedbebe Mon Sep 17 00:00:00 2001 From: Jesper Karlsson Gumprecht <113693781+jesgum@users.noreply.github.com> Date: Wed, 6 Aug 2025 04:01:16 +0200 Subject: [PATCH 248/345] [ALICE3] Add more qa of ml use to otf multi-charm task (#12452) --- ALICE3/TableProducer/alice3-multicharmTable.cxx | 6 ++++++ ALICE3/Tasks/alice3-multicharm.cxx | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ALICE3/TableProducer/alice3-multicharmTable.cxx b/ALICE3/TableProducer/alice3-multicharmTable.cxx index f667b5dcd0a..164e5f83f9b 100644 --- a/ALICE3/TableProducer/alice3-multicharmTable.cxx +++ b/ALICE3/TableProducer/alice3-multicharmTable.cxx @@ -124,6 +124,7 @@ struct alice3multicharmTable { Configurable xiccMaxEta{"xiccMaxEta", 1.5, "Max eta"}; Configurable massWindowXi{"massWindowXi", 0.015, "Mass window around Xi peak (GeV/c)"}; Configurable massWindowXiC{"massWindowXiC", 0.015, "Mass window around XiC peak (GeV/c)"}; + Configurable massWindowXiCC{"massWindowXiCC", 0.4, "Mass window around XiCC peak (GeV/c). Make sure that bkg region is included in this window"}; ConfigurableAxis axisEta{"axisEta", {80, -4.0f, +4.0f}, "#eta"}; ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "pt axis for QA histograms"}; @@ -251,6 +252,11 @@ struct alice3multicharmTable { } thisXiCCcandidate.mass = RecoDecay::m(array{array{thisXiCCcandidate.prong0mom[0], thisXiCCcandidate.prong0mom[1], thisXiCCcandidate.prong0mom[2]}, array{thisXiCCcandidate.prong1mom[0], thisXiCCcandidate.prong1mom[1], thisXiCCcandidate.prong1mom[2]}}, array{mass0, mass1}); + + if (std::fabs(thisXiCCcandidate.mass - o2::constants::physics::MassXiCCPlusPlus) > massWindowXiCC) { + return false; + } + thisXiCCcandidate.pt = std::hypot(thisXiCCcandidate.prong0mom[0] + thisXiCCcandidate.prong1mom[0], thisXiCCcandidate.prong0mom[1] + thisXiCCcandidate.prong1mom[1]); thisXiCCcandidate.eta = RecoDecay::eta(array{thisXiCCcandidate.prong0mom[0] + thisXiCCcandidate.prong1mom[0], thisXiCCcandidate.prong0mom[1] + thisXiCCcandidate.prong1mom[1], thisXiCCcandidate.prong0mom[2] + thisXiCCcandidate.prong1mom[2]}); return true; diff --git a/ALICE3/Tasks/alice3-multicharm.cxx b/ALICE3/Tasks/alice3-multicharm.cxx index 088a3b5c1f6..15989109919 100644 --- a/ALICE3/Tasks/alice3-multicharm.cxx +++ b/ALICE3/Tasks/alice3-multicharm.cxx @@ -252,7 +252,8 @@ struct alice3multicharm { histos.add("hBDTScore", "hBDTScore", kTH1D, {axisBDTScore}); histos.add("hBDTScoreVsXiccMass", "hBDTScoreVsXiccMass", kTH2D, {axisXiccMass, axisBDTScore}); - histos.add("hBDTScoreVsXiccPt", "hBDTScoreVsXiccPt", kTH2D, {axisXiccMass, axisPt}); + histos.add("hBDTScoreVsXiccPt", "hBDTScoreVsXiccPt", kTH2D, {axisPt, axisBDTScore}); + histos.add("h3dBDTScore", "h3dBDTScore", kTH3D, {axisPt, axisXiccMass, axisBDTScore}); for (const auto& score : bdt.requiredScores.value) { histPath = std::format("MLQA/RequiredBDTScore_{}/", static_cast(score * 100)); histPointers.insert({histPath + "hDCAXicDaughters", histos.add((histPath + "hDCAXicDaughters").c_str(), "hDCAXicDaughters", {kTH1D, {{axisDcaDaughters}}})}); @@ -293,7 +294,7 @@ struct alice3multicharm { } template - void genericProcessXicc(TMCharmCands xiccCands) + void genericProcessXicc(TMCharmCands const& xiccCands) { for (const auto& xiccCand : xiccCands) { if (bdt.enableML) { @@ -324,6 +325,7 @@ struct alice3multicharm { histos.fill(HIST("hBDTScore"), bdtScore); histos.fill(HIST("hBDTScoreVsXiccMass"), xiccCand.xiccMass(), bdtScore); histos.fill(HIST("hBDTScoreVsXiccPt"), xiccCand.xiccPt(), bdtScore); + histos.fill(HIST("h3dBDTScore"), xiccCand.xiccPt(), xiccCand.xiccMass(), bdtScore); for (const auto& requiredScore : bdt.requiredScores.value) { if (bdtScore > requiredScore) { From d0932c958f2fd8694836ee416e7818d480c0858e Mon Sep 17 00:00:00 2001 From: Pritam Chakraborty <47203359+prchakra@users.noreply.github.com> Date: Wed, 6 Aug 2025 07:34:03 +0200 Subject: [PATCH 249/345] [PWGCF] FemtoUniverse: Fixing bug in CPR calc. in mixed events (#12437) --- .../femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx index 3899030612f..2a813550b22 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx @@ -681,11 +681,11 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { if (ConfIsCPR.value) { if (confCPRIsAtITS.value) { - if (pairCloseRejection.isClosePairAtITS(p1, p2, magFieldTesla, femto_universe_container::EventType::same)) { + if (pairCloseRejection.isClosePairAtITS(p1, p2, magFieldTesla, femto_universe_container::EventType::mixed)) { continue; } } else { - if (pairCloseRejection.isClosePairFrac(p1, p2, magFieldTesla, femto_universe_container::EventType::same, confCPRDphiAvgOrDist, confCPRDistMax, confCPRFracMax)) { + if (pairCloseRejection.isClosePairFrac(p1, p2, magFieldTesla, femto_universe_container::EventType::mixed, confCPRDphiAvgOrDist, confCPRDistMax, confCPRFracMax)) { continue; } } From f96ff87430e8f979be416381cd75c25bba23630d Mon Sep 17 00:00:00 2001 From: sawan <124118453+sawankumawat@users.noreply.github.com> Date: Wed, 6 Aug 2025 11:25:48 +0530 Subject: [PATCH 250/345] [PWGLF] Added MC closure (#12444) Co-authored-by: Sawan Sawan --- PWGLF/Tasks/Resonances/kstarqa.cxx | 228 +++++++++++++++++++++++++++-- 1 file changed, 218 insertions(+), 10 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarqa.cxx b/PWGLF/Tasks/Resonances/kstarqa.cxx index 45e63edae2e..23bce2e9fdb 100644 --- a/PWGLF/Tasks/Resonances/kstarqa.cxx +++ b/PWGLF/Tasks/Resonances/kstarqa.cxx @@ -16,6 +16,8 @@ // #include #include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGLF/DataModel/mcCentrality.h" +#include "PWGLF/Utils/inelGt.h" #include "Common/Core/TrackSelection.h" #include "Common/Core/trackUtilities.h" @@ -105,6 +107,7 @@ struct Kstarqa { Configurable cfgUseITSTPCRefit{"cfgUseITSTPCRefit", false, "Require ITS Refit"}; Configurable isNoCollInTimeRangeStandard{"isNoCollInTimeRangeStandard", false, "No collision in time range standard"}; Configurable isApplyPtDepDCAxyCut{"isApplyPtDepDCAxyCut", false, "Apply pT dependent DCAxy cut"}; + Configurable isGoldenChi2{"isGoldenChi2", false, "Apply golden chi2 cut"}; // cuts on mother Configurable isApplyCutsOnMother{"isApplyCutsOnMother", false, "Enable additional cuts on Kstar mother"}; @@ -427,6 +430,8 @@ struct Kstarqa { if (std::abs(candidate.dcaXY()) > (0.0105 + 0.035 / std::pow(candidate.pt(), 1.1))) return false; } + if (selectionConfig.isGoldenChi2 && candidate.passedGoldenChi2()) + return false; if (std::abs(candidate.dcaZ()) > selectionConfig.cfgCutDCAz) return false; if (candidate.tpcCrossedRowsOverFindableCls() < selectionConfig.cfgRCRFC) @@ -660,12 +665,13 @@ struct Kstarqa { Filter acceptanceFilter = (nabs(aod::track::eta) < selectionConfig.cfgCutEta && nabs(aod::track::pt) > selectionConfig.cfgCutPT); Filter fDCAcutFilter = (nabs(aod::track::dcaXY) < selectionConfig.cfgCutDCAxy) && (nabs(aod::track::dcaZ) < selectionConfig.cfgCutDCAz); - using EventCandidates = soa::Join; // aod::CentNGlobals, aod::CentNTPVs, aod::CentMFTs - using EventCandidatesMix = soa::Filtered>; // aod::CentNGlobals, aod::CentNTPVs, aod::CentMFTs - using TrackCandidates = soa::Filtered>; - using EventCandidatesMC = soa::Join; + using EventCandidates = soa::Filtered>; // aod::CentNGlobals, aod::CentNTPVs, aod::CentMFTs + using EventCandidatesMix = soa::Filtered>; // aod::CentNGlobals, aod::CentNTPVs, aod::CentMFTs + using TrackCandidates = soa::Filtered>; + using EventCandidatesMC = soa::Join; + // using EventCandidatesMC = soa::Filtered>; - using TrackCandidatesMC = soa::Filtered>; + using TrackCandidatesMC = soa::Filtered>; using EventMCGenerated = soa::Join; // aod::CentNGlobals, aod::CentNTPVs, aod::CentMFTs //*********Varibles declaration*************** @@ -1005,17 +1011,21 @@ struct Kstarqa { using BinningTypeVertexContributor = ColumnBinningPolicy; using BinningTypeFT0A = ColumnBinningPolicy; using BinningTypeFV0A = ColumnBinningPolicy; + using BinningTypeMC = ColumnBinningPolicy; BinningTypeVertexContributor binningOnPositions{{axisVertex, axisMultiplicity}, true}; BinningTypeCentralityM binningOnCentrality{{axisVertex, axisMultiplicity}, true}; BinningTypeFT0A binningOnFT0A{{axisVertex, axisMultiplicity}, true}; BinningTypeFV0A binningOnFV0A{{axisVertex, axisMultiplicity}, true}; + BinningTypeMC binningOnMC{{axisVertex, axisMultiplicity}, true}; SameKindPair pair1{binningOnPositions, selectionConfig.cfgNoMixedEvents, -1, &cache}; SameKindPair pair2{binningOnCentrality, selectionConfig.cfgNoMixedEvents, -1, &cache}; SameKindPair pair3{binningOnFT0A, selectionConfig.cfgNoMixedEvents, -1, &cache}; SameKindPair pair4{binningOnFV0A, selectionConfig.cfgNoMixedEvents, -1, &cache}; + SameKindPair pairmc{binningOnMC, selectionConfig.cfgNoMixedEvents, -1, &cache}; + void processME(EventCandidatesMix const&, TrackCandidates const&) { // Map estimator to pair and multiplicity accessor @@ -1061,9 +1071,193 @@ struct Kstarqa { runMixing(pair4, [](const auto& c) { return c.centFV0A(); }); } } - PROCESS_SWITCH(Kstarqa, processME, "Process Mixed event", true); + void processSEMC(EventCandidatesMC::iterator const& collision, TrackCandidatesMC const& tracks, aod::McParticles const&, aod::McCollisions const& /*mcCollisions*/) + { + int occupancy = collision.trackOccupancyInTimeRange(); + rEventSelection.fill(HIST("hOccupancy"), occupancy); + + if (!selectionEvent(collision, true)) { + return; + } + + multiplicity = -1; + + if (cSelectMultEstimator == kFT0M) { + multiplicity = collision.centFT0M(); + } else if (cSelectMultEstimator == kFT0A) { + multiplicity = collision.centFT0A(); + } else if (cSelectMultEstimator == kFT0C) { + multiplicity = collision.centFT0C(); + } else if (cSelectMultEstimator == kFV0A) { + multiplicity = collision.centFV0A(); + } else { + multiplicity = collision.centFT0M(); // default + } + + // Fill the event counter + if (cQAevents) { + rEventSelection.fill(HIST("hVertexZRec"), collision.posZ()); + rEventSelection.fill(HIST("hMultiplicity"), multiplicity); + rEventSelection.fill(HIST("multdist_FT0M"), collision.multFT0M()); + // rEventSelection.fill(HIST("multdist_FT0A"), collision.multFT0A()); + // rEventSelection.fill(HIST("multdist_FT0C"), collision.multFT0C()); + // rEventSelection.fill(HIST("hNcontributor"), collision.numContrib()); + } + + for (const auto& [track1, track2] : combinations(CombinationsFullIndexPolicy(tracks, tracks))) { + rEventSelection.fill(HIST("tracksCheckData"), 0.5); + if (!selectionTrack(track1)) { + continue; + } + if (!selectionTrack(track2)) { + continue; + } + rEventSelection.fill(HIST("tracksCheckData"), 1.5); + + if (cQAplots) { + hPID.fill(HIST("Before/hNsigmaTPC_Ka_before"), track1.pt(), track1.tpcNSigmaKa()); + hPID.fill(HIST("Before/hNsigmaTOF_Ka_before"), track1.pt(), track1.tofNSigmaKa()); + hPID.fill(HIST("Before/hNsigmaTPC_Pi_before"), track2.pt(), track2.tpcNSigmaPi()); + hPID.fill(HIST("Before/hNsigmaTOF_Pi_before"), track2.pt(), track2.tofNSigmaPi()); + hPID.fill(HIST("Before/hNsigma_TPC_TOF_Ka_before"), track1.tpcNSigmaKa(), track1.tofNSigmaKa()); + hPID.fill(HIST("Before/hNsigma_TPC_TOF_Pi_before"), track2.tpcNSigmaPi(), track2.tofNSigmaPi()); + + hPID.fill(HIST("Before/hTPCnsigKa_mult_pt"), track1.tpcNSigmaKa(), multiplicity, track1.pt()); + hPID.fill(HIST("Before/hTPCnsigPi_mult_pt"), track2.tpcNSigmaPi(), multiplicity, track2.pt()); + hPID.fill(HIST("Before/hTOFnsigKa_mult_pt"), track1.tofNSigmaKa(), multiplicity, track1.pt()); + hPID.fill(HIST("Before/hTOFnsigPi_mult_pt"), track2.tofNSigmaKa(), multiplicity, track2.pt()); + + hOthers.fill(HIST("hCRFC_before"), track1.tpcCrossedRowsOverFindableCls()); + hOthers.fill(HIST("dE_by_dx_TPC"), track1.p(), track1.tpcSignal()); + hOthers.fill(HIST("hphi"), track1.phi()); + + if (track1.sign() < 0) { + hPID.fill(HIST("Before/h1PID_TPC_neg_kaon"), track1.tpcNSigmaKa()); + hPID.fill(HIST("Before/h1PID_TPC_neg_pion"), track2.tpcNSigmaPi()); + hPID.fill(HIST("Before/h1PID_TOF_neg_kaon"), track1.tofNSigmaKa()); + hPID.fill(HIST("Before/h1PID_TOF_neg_pion"), track2.tofNSigmaPi()); + } else { + hPID.fill(HIST("Before/h1PID_TPC_pos_kaon"), track1.tpcNSigmaKa()); + hPID.fill(HIST("Before/h1PID_TPC_pos_pion"), track2.tpcNSigmaPi()); + hPID.fill(HIST("Before/h1PID_TOF_pos_kaon"), track1.tofNSigmaKa()); + hPID.fill(HIST("Before/h1PID_TOF_pos_pion"), track2.tofNSigmaPi()); + } + } + + if (cQAevents) { + rEventSelection.fill(HIST("hDcaxy"), track1.dcaXY()); + rEventSelection.fill(HIST("hDcaz"), track1.dcaZ()); + } + + // since we are using combinations full index policy, so repeated pairs are allowed, so we can check one with Kaon and other with pion + if (!applypTdepPID && !selectionPID(track1, 1)) // Track 1 is checked with Kaon + continue; + if (!applypTdepPID && !selectionPID(track2, 0)) // Track 2 is checked with Pion + continue; + + if (applypTdepPID && !selectionPIDNew(track1, 1)) // Track 1 is checked with Kaon + continue; + if (applypTdepPID && !selectionPIDNew(track2, 0)) // Track 2 is checked with Pion + continue; + + rEventSelection.fill(HIST("tracksCheckData"), 2.5); + + if (cFakeTrack && isFakeTrack(track1, 1)) // Kaon + continue; + if (cFakeTrack && isFakeTrack(track2, 0)) // Pion + continue; + + // if (cMID) { + // if (cMIDselectionPID(track1, 0)) // Kaon misidentified as pion + // continue; + // if (cMIDselectionPID(track1, 2)) // Kaon misidentified as proton + // continue; + // if (cMIDselectionPID(track2, 1)) // Pion misidentified as kaon + // continue; + // } + + rEventSelection.fill(HIST("tracksCheckData"), 3.5); + + if (cQAplots) { + hPID.fill(HIST("After/hDcaxyPi"), track2.dcaXY()); + hPID.fill(HIST("After/hDcaxyKa"), track1.dcaXY()); + hPID.fill(HIST("After/hDcazPi"), track2.dcaZ()); + hPID.fill(HIST("After/hDcazKa"), track1.dcaZ()); + + hPID.fill(HIST("After/hTPCnsigKa_mult_pt"), track1.tpcNSigmaKa(), multiplicity, track1.pt()); + hPID.fill(HIST("After/hTPCnsigPi_mult_pt"), track2.tpcNSigmaPi(), multiplicity, track2.pt()); + hPID.fill(HIST("After/hTOFnsigKa_mult_pt"), track1.tofNSigmaKa(), multiplicity, track1.pt()); + hPID.fill(HIST("After/hTOFnsigPi_mult_pt"), track2.tofNSigmaKa(), multiplicity, track2.pt()); + hOthers.fill(HIST("hEta_after"), track1.eta()); + hOthers.fill(HIST("hCRFC_after"), track1.tpcCrossedRowsOverFindableCls()); + hPID.fill(HIST("After/hNsigmaKaonTPC_after"), track1.pt(), track1.tpcNSigmaKa()); + hPID.fill(HIST("After/hNsigmaKaonTOF_after"), track1.pt(), track1.tofNSigmaKa()); + hPID.fill(HIST("After/hNsigmaPionTPC_after"), track2.pt(), track2.tpcNSigmaPi()); + hPID.fill(HIST("After/hNsigmaPionTOF_after"), track2.pt(), track2.tofNSigmaPi()); + hPID.fill(HIST("After/hNsigma_TPC_TOF_Ka_after"), track1.tpcNSigmaKa(), track1.tofNSigmaKa()); + hPID.fill(HIST("After/hNsigma_TPC_TOF_Pi_after"), track2.tpcNSigmaPi(), track2.tofNSigmaPi()); + } + + if (track1.globalIndex() == track2.globalIndex()) + continue; + + rEventSelection.fill(HIST("tracksCheckData"), 4.5); + + daughter1 = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa); + daughter2 = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massPi); + mother = daughter1 + daughter2; // Kstar meson + + if (selectionConfig.isApplyCutsOnMother) { + if (mother.Pt() >= selectionConfig.cMaxPtMotherCut) // excluding candidates in overflow + continue; + if (mother.M() >= selectionConfig.cMaxMinvMotherCut) // excluding candidates in overflow + continue; + } + + hOthers.fill(HIST("hKstar_Rap"), mother.Rapidity()); + hOthers.fill(HIST("hKstar_Eta"), mother.Eta()); + + isMix = false; + fillInvMass(daughter1, daughter2, mother, multiplicity, isMix, track1, track2); + } + } + PROCESS_SWITCH(Kstarqa, processSEMC, "Process same event in MC", true); + + void processMEMC(EventCandidatesMC const&, TrackCandidatesMC const&, aod::McParticles const&, aod::McCollisions const&) + { + for (const auto& [c1, tracks1, c2, tracks2] : pairmc) { + + if (!selectionEvent(c1, false) || !selectionEvent(c2, false)) { + continue; + } + + // multiplicity = multiplicityGetter(c1); + multiplicity = c1.centFT0M(); // default, can be changed later + + for (const auto& [t1, t2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { + if (!selectionTrack(t1) || !selectionTrack(t2)) + continue; + if (!selectionPID(t1, 1) || !selectionPID(t2, 0)) + continue; + + daughter1 = ROOT::Math::PxPyPzMVector(t1.px(), t1.py(), t1.pz(), massKa); + daughter2 = ROOT::Math::PxPyPzMVector(t2.px(), t2.py(), t2.pz(), massPi); + mother = daughter1 + daughter2; + + isMix = true; + + if (std::abs(mother.Rapidity()) < selectionConfig.rapidityMotherData) { + fillInvMass(daughter1, daughter2, mother, multiplicity, isMix, t1, t2); + } + } + } + } + PROCESS_SWITCH(Kstarqa, processMEMC, "Process mixed-event in MC", true); + + Service pdgDB; + // void processGen(EventMCGenerated::iterator const& mcCollision, aod::McParticles const& mcParticles, const soa::SmallGroups& collisions) void processGen(aod::McCollision const& mcCollision, aod::McParticles const& mcParticles, const soa::SmallGroups& collisions) { @@ -1086,6 +1280,15 @@ struct Kstarqa { multiplicity = -1.0; // float impactParameter = mcCollision.impactParameter(); + bool isINELgt0true = false; + + if (pwglf::isINELgtNmc(mcParticles, 0, pdgDB)) { + isINELgt0true = true; + } + if (selectionConfig.isINELgt0 && !isINELgt0true) { + return; + } + // if (selectionConfig.isINELgt0 && !mcCollision.isInelGt0()) { // return; // } @@ -1129,16 +1332,12 @@ struct Kstarqa { for (const auto& mcParticle : mcParticles) { if (std::abs(mcParticle.y()) < selectionConfig.rapidityMotherData && std::abs(mcParticle.pdgCode()) == o2::constants::physics::kK0Star892) { - // if (inelgt0MCgen) { hInvMass.fill(HIST("hAllKstarGenCollisisons"), multiplicity, mcParticle.pt()); - // } } } const auto evtReconstructedAndSelected = std::find(selectedEvents.begin(), selectedEvents.end(), mcCollision.globalIndex()) != selectedEvents.end(); - // if (inelgt0MCgen) { hInvMass.fill(HIST("hAllGenCollisions"), multiplicity); - // } if (!cAllGenCollisions && !evtReconstructedAndSelected) { // Check that the event is reconstructed and that the reconstructed events pass the selection return; } @@ -1201,6 +1400,15 @@ struct Kstarqa { // return; // } + bool isINELgt0true = false; + + if (pwglf::isINELgtNmc(mcParticles, 0, pdgDB)) { + isINELgt0true = true; + } + if (selectionConfig.isINELgt0 && !isINELgt0true) { + return; + } + auto impactPar = mcCollision.impactParameter(); hInvMass.fill(HIST("MCcorrections/hImpactParameterGen"), impactPar); From f33a9da204f12d1b6234c5c403936c59f13d5f68 Mon Sep 17 00:00:00 2001 From: Luca Aglietta <75362880+Luca610@users.noreply.github.com> Date: Wed, 6 Aug 2025 08:42:19 +0200 Subject: [PATCH 251/345] [PWGHF] Charm resonances: Matching of D*->D0pi (#12445) Co-authored-by: ALICE Action Bot --- PWGHF/Core/DecayChannels.h | 5 ++- .../dataCreatorCharmResoReduced.cxx | 42 ++++++++++--------- PWGHF/Utils/utilsMcMatching.h | 3 +- 3 files changed, 29 insertions(+), 21 deletions(-) diff --git a/PWGHF/Core/DecayChannels.h b/PWGHF/Core/DecayChannels.h index abc8ac291a6..0398afed1c2 100644 --- a/PWGHF/Core/DecayChannels.h +++ b/PWGHF/Core/DecayChannels.h @@ -250,7 +250,10 @@ enum DecayChannelMain : int8_t { // Xic(3080)0 Xic3080zeroToD0Lambda = 14, // D0 Λ // Xic(3080)+ - Xic3080plusToDplusLambda = 15 // D+ Λ + Xic3080plusToDplusLambda = 15, // D+ Λ + // D*+ + DstarToD0Pi = 16, // D0 π+ + NChannelsMain = DstarToD0Pi // last channel }; } // namespace hf_cand_reso } // namespace o2::hf_decay diff --git a/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx index 85dcc0d8b82..fb1964d0ef9 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx @@ -350,7 +350,8 @@ struct HfDataCreatorCharmResoReduced { doprocessDstarV0MC || doprocessDstarTrackMC || doprocessDstarV0AndTrackMC || doprocessDstarV0MCWithMl || doprocessDstarTrackMCWithMl || doprocessDstarV0AndTrackMCWithMl || doprocessDplusV0MC || doprocessDplusTrackMC || doprocessDplusV0AndTrackMC || doprocessDplusV0MCWithMl || doprocessDplusTrackMCWithMl || doprocessDplusV0AndTrackMCWithMl) { // MC Rec - registry.add("hMCRecCounter", "Number of Reconstructed MC Matched candidates per channel", {HistType::kTH1D, {{31, -15.5, 15.5}}}); + int nChannels = hf_decay::hf_cand_reso::DecayChannelMain::NChannelsMain; + registry.add("hMCRecCounter", "Number of Reconstructed MC Matched candidates per channel", {HistType::kTH1D, {{2 * nChannels + 1, -(nChannels + 0.5), nChannels + 0.5}}}); registry.add("hMCRecDebug", "Debug of MC Reco", {HistType::kTH1D, {{551, -0.5, 550.5}}}); registry.add("hMCRecOrigin", "Origin of Matched particles", {HistType::kTH1D, {{3, -0.5, 2.5}}}); registry.add("hMCRecMassGen", "Generated inv. mass of resoncances", {HistType::kTH1D, {{2000, 1.8, 3.8}}}); @@ -645,24 +646,24 @@ struct HfDataCreatorCharmResoReduced { vecDaughtersReso.push_back(tracks.rawIteratorAt(candCharmBach.prongPiId())); // Check if D* is matched flagCharmBach = candCharmBach.flagMcMatchRec(); - if (std::abs(flagCharmBach) > 0) { + if (flagCharmBach != 0) { SETBIT(debugMcRec, hf_decay::hf_cand_reso::PartialMatchMc::DstarMatched); origin = candCharmBach.originMcRec(); } // Check if D0 is matched flagCharmBachInterm = candCharmBach.flagMcMatchRecD0(); - if (std::abs(flagCharmBachInterm) > 0) { + if (flagCharmBachInterm != 0) { SETBIT(debugMcRec, hf_decay::hf_cand_reso::PartialMatchMc::D0Matched); } // Check if V0 is matched vecDaughtersReso.push_back(tracks.rawIteratorAt(bachelorV0.posTrackId())); vecDaughtersReso.push_back(tracks.rawIteratorAt(bachelorV0.negTrackId())); flagV0 = getMatchingFlagV0(particlesMc, std::array{vecDaughtersReso[3], vecDaughtersReso[4]}); - if (std::abs(flagV0) > 0) { + if (flagV0 != 0) { SETBIT(debugMcRec, std::abs(flagV0)); } // If both D* and K0s are matched, try to match resonance - if (std::abs(flagCharmBach) > 0 && flagV0 == hf_decay::hf_cand_reso::PartialMatchMc::K0Matched) { + if (flagCharmBach != 0 && flagV0 == hf_decay::hf_cand_reso::PartialMatchMc::K0Matched) { std::array pdgCodesDaughters = {+kPiPlus, -kKPlus, +kPiPlus, +kPiPlus, -kPiPlus}; auto arrDaughtersReso = std::array{vecDaughtersReso[0], vecDaughtersReso[1], vecDaughtersReso[2], vecDaughtersReso[3], vecDaughtersReso[4]}; for (const auto& [decayChannelFlag, pdgCodeReso] : hf_decay::hf_cand_reso::particlesToDstarK0s) { @@ -672,7 +673,7 @@ struct HfDataCreatorCharmResoReduced { break; } } - } else if (std::abs(flagCharmBachInterm) > 0 && flagV0 == hf_decay::hf_cand_reso::PartialMatchMc::K0Matched) { + } else if (flagCharmBachInterm != 0 && flagV0 == hf_decay::hf_cand_reso::PartialMatchMc::K0Matched) { std::array pdgCodesDaughters = {+kPiPlus, -kKPlus, +kPiPlus, -kPiPlus}; auto arrDaughtersReso = std::array{vecDaughtersReso[0], vecDaughtersReso[1], vecDaughtersReso[3], vecDaughtersReso[4]}; // Peaking background of D0K0s <- Ds* with spurious soft pion @@ -703,7 +704,7 @@ struct HfDataCreatorCharmResoReduced { // Check if D+ is matched flagCharmBach = candCharmBach.flagMcMatchRec(); flagCharmBachInterm = candCharmBach.flagMcDecayChanRec(); - if (std::abs(flagCharmBach) > 0) { + if (flagCharmBach != 0) { SETBIT(debugMcRec, hf_decay::hf_cand_reso::PartialMatchMc::DplusMatched); origin = candCharmBach.originMcRec(); } @@ -711,7 +712,7 @@ struct HfDataCreatorCharmResoReduced { vecDaughtersReso.push_back(tracks.rawIteratorAt(bachelorV0.posTrackId())); vecDaughtersReso.push_back(tracks.rawIteratorAt(bachelorV0.negTrackId())); flagV0 = getMatchingFlagV0(particlesMc, std::array{vecDaughtersReso[3], vecDaughtersReso[4]}); - if (std::abs(flagV0) > 0) { + if (flagV0 != 0) { SETBIT(debugMcRec, std::abs(flagV0)); } // If both D+ and K0s are matched, try to match resonance @@ -755,7 +756,7 @@ struct HfDataCreatorCharmResoReduced { // Check if D0 is matched flagCharmBach = candCharmBach.flagMcMatchRec(); flagCharmBachInterm = candCharmBach.flagMcDecayChanRec(); - if (std::abs(flagCharmBach) > 0) { + if (flagCharmBach != 0) { SETBIT(debugMcRec, hf_decay::hf_cand_reso::PartialMatchMc::D0Matched); origin = candCharmBach.originMcRec(); } @@ -763,7 +764,7 @@ struct HfDataCreatorCharmResoReduced { vecDaughtersReso.push_back(tracks.rawIteratorAt(bachelorV0.posTrackId())); vecDaughtersReso.push_back(tracks.rawIteratorAt(bachelorV0.negTrackId())); flagV0 = getMatchingFlagV0(particlesMc, std::array{vecDaughtersReso[2], vecDaughtersReso[3]}); - if (std::abs(flagV0) > 0) { + if (flagV0 != 0) { SETBIT(debugMcRec, std::abs(flagV0)); } // No physical channel expected in D0 K0s @@ -797,7 +798,7 @@ struct HfDataCreatorCharmResoReduced { registry.fill(HIST("hMCRecOrigin"), origin); registry.fill(HIST("hMCRecMassGen"), invMassGen); } - if (std::abs(flagCharmBach) > 0) { + if (flagCharmBach != 0) { registry.fill(HIST("hMCRecCharmDau"), flagCharmBach); } } @@ -843,22 +844,22 @@ struct HfDataCreatorCharmResoReduced { vecDaughtersReso.push_back(tracks.rawIteratorAt(candCharmBach.prongPiId())); // Check if D* is matched flagCharmBach = candCharmBach.flagMcMatchRec(); - if (std::abs(flagCharmBach) > 0) { + if (flagCharmBach != 0) { SETBIT(debugMcRec, hf_decay::hf_cand_reso::PartialMatchMc::DstarMatched); origin = candCharmBach.originMcRec(); } // Check if D0 is matched flagCharmBachInterm = candCharmBach.flagMcMatchRecD0(); - if (std::abs(flagCharmBachInterm) > 0) { + if (flagCharmBachInterm != 0) { SETBIT(debugMcRec, hf_decay::hf_cand_reso::PartialMatchMc::D0Matched); } // Check if Track is matched flagTrack = getMatchingFlagTrack(bachelorTrack); - if (std::abs(flagTrack) > 0) { + if (flagTrack != 0) { SETBIT(debugMcRec, flagTrack); } // If both D* and Track are matched, try to match resonance - if (std::abs(flagCharmBach) > 0 && flagTrack == hf_decay::hf_cand_reso::PartialMatchMc::PionMatched) { + if (flagCharmBach != 0 && flagTrack == hf_decay::hf_cand_reso::PartialMatchMc::PionMatched) { auto arrDaughtersReso = std::array{vecDaughtersReso[0], vecDaughtersReso[1], vecDaughtersReso[2], bachelorTrack}; auto pdgCodesDaughters = std::array{+kPiPlus, -kKPlus, +kPiPlus, -kPiPlus}; for (const auto& [decayChannelFlag, pdgCodeReso] : hf_decay::hf_cand_reso::particlesToDstarPi) { @@ -887,13 +888,13 @@ struct HfDataCreatorCharmResoReduced { // Check if D+ is matched flagCharmBach = candCharmBach.flagMcMatchRec(); flagCharmBachInterm = candCharmBach.flagMcDecayChanRec(); - if (std::abs(flagCharmBach) > 0) { + if (flagCharmBach != 0) { SETBIT(debugMcRec, hf_decay::hf_cand_reso::PartialMatchMc::DplusMatched); origin = candCharmBach.originMcRec(); } // Check if Track is matched flagTrack = getMatchingFlagTrack(bachelorTrack); - if (std::abs(flagTrack) > 0) { + if (flagTrack != 0) { SETBIT(debugMcRec, flagTrack); } // If both D+ and Track are matched, try to match resonance @@ -926,11 +927,14 @@ struct HfDataCreatorCharmResoReduced { // Check if D0 is matched flagCharmBach = candCharmBach.flagMcMatchRec(); flagCharmBachInterm = candCharmBach.flagMcDecayChanRec(); - if (std::abs(flagCharmBach) > 0) { + if (flagCharmBach != 0) { SETBIT(debugMcRec, hf_decay::hf_cand_reso::PartialMatchMc::D0Matched); origin = candCharmBach.originMcRec(); } flagTrack = getMatchingFlagTrack(bachelorTrack); + if (flagTrack != 0) { + SETBIT(debugMcRec, flagTrack); + } if (hf_decay::hf_cand_2prong::daughtersD0Main.contains(static_cast(std::abs(flagCharmBach))) && flagTrack == hf_decay::hf_cand_reso::PartialMatchMc::PionMatched) { auto arrDaughtersReso = std::array{vecDaughtersReso[0], vecDaughtersReso[1], bachelorTrack}; auto pdgCodesDzeroDaughters = hf_decay::hf_cand_2prong::daughtersD0Main.at(static_cast(std::abs(flagCharmBach))); @@ -971,7 +975,7 @@ struct HfDataCreatorCharmResoReduced { registry.fill(HIST("hMCRecOrigin"), origin); registry.fill(HIST("hMCRecMassGen"), invMassGen); } - if (std::abs(flagCharmBach) > 0) { + if (flagCharmBach != 0) { registry.fill(HIST("hMCRecCharmDau"), flagCharmBach); } } // fillMcRecoInfoDTrack diff --git a/PWGHF/Utils/utilsMcMatching.h b/PWGHF/Utils/utilsMcMatching.h index bac650d36d4..55480879e1a 100644 --- a/PWGHF/Utils/utilsMcMatching.h +++ b/PWGHF/Utils/utilsMcMatching.h @@ -198,7 +198,8 @@ const std::unordered_map particlesToDstarPi = { const std::unordered_map particlesToDplusPi = { {DecayChannelMain::D2starzeroToDplusPi, constants::physics::Pdg::kD2Star0}}; const std::unordered_map particlesToD0Pi = { - {DecayChannelMain::D2starplusToD0Pi, constants::physics::Pdg::kD2StarPlus}}; + {DecayChannelMain::D2starplusToD0Pi, constants::physics::Pdg::kD2StarPlus}, + {DecayChannelMain::DstarToD0Pi, constants::physics::Pdg::kDStar}}; const std::unordered_map particlesToD0Kplus = { {DecayChannelMain::Ds2starToD0Kplus, constants::physics::Pdg::kDS2Star}}; From 25b360c9b4b7f20dacd38ee889d16e26dca030d7 Mon Sep 17 00:00:00 2001 From: a-m-andrushko <96832230+a-m-andrushko@users.noreply.github.com> Date: Wed, 6 Aug 2025 09:34:35 +0200 Subject: [PATCH 252/345] [PWGCF] FemtoUniverse -- Add MC Truth to helicity angle analysis. (#12439) --- .../femtoUniversePairTaskTrackV0Helicity.cxx | 46 ++++++++++++++----- 1 file changed, 35 insertions(+), 11 deletions(-) diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackV0Helicity.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackV0Helicity.cxx index 46def7bba0e..b5fe5fbdc5a 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackV0Helicity.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackV0Helicity.cxx @@ -161,13 +161,12 @@ struct FemtoUniversePairTaskTrackV0Helicity { /// Histogram output HistogramRegistry qaRegistry{"TrackQA", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry thetaRegistry{"ThetaQA", {}, OutputObjHandlingPolicy::AnalysisObject}; HistogramRegistry resultRegistry{"Correlations", {}, OutputObjHandlingPolicy::AnalysisObject}; HistogramRegistry registryMCtruth{"MCtruthHistos", {}, OutputObjHandlingPolicy::AnalysisObject, false, true}; HistogramRegistry registryMCreco{"MCrecoHistos", {}, OutputObjHandlingPolicy::AnalysisObject, false, true}; HistogramRegistry mixQaRegistry{"mixQaRegistry", {}, OutputObjHandlingPolicy::AnalysisObject}; - HistogramRegistry thetaRegistry{"ThetaQA", {}, OutputObjHandlingPolicy::AnalysisObject}; - std::unique_ptr plocalEffFile; std::unique_ptr plocalEffp1; std::unique_ptr plocalEffp2; @@ -236,6 +235,15 @@ struct FemtoUniversePairTaskTrackV0Helicity { posChildV0Type2.init(&qaRegistry, confChildTempFitVarpTBins, confChildTempFitVarBins, false, 0, true, "posChildV0Type2"); negChildV0Type2.init(&qaRegistry, confChildTempFitVarpTBins, confChildTempFitVarBins, false, 0, true, "negChildV0Type2"); + // Helicity angle + thetaRegistry.add("Theta/hTheta", " ; p (GeV/#it{c}); cos(#theta)", kTH2F, {{100, 0, 10}, {110, -1.1, 1.1}}); + thetaRegistry.add("Theta/PositiveChild/hThetaPt", " ; p_{T} (GeV/#it{c}); cos(#theta)", kTH2F, {{100, 0, 10}, {110, -1.1, 1.1}}); + thetaRegistry.add("Theta/PositiveChild/hThetaEta", " ; #eta; cos(#theta)", kTH2F, {{100, -1, 1}, {110, -1.1, 1.1}}); + thetaRegistry.add("Theta/PositiveChild/hThetaPhi", " ; #phi; cos(#theta)", kTH2F, {{100, -1, 7}, {110, -1.1, 1.1}}); + thetaRegistry.add("Theta/NegativeChild/hThetaPt", " ; p_{T} (GeV/#it{c}); cos(#theta)", kTH2F, {{100, 0, 10}, {110, -1.1, 1.1}}); + thetaRegistry.add("Theta/NegativeChild/hThetaEta", " ; #eta; cos(#theta)", kTH2F, {{100, -1, 1}, {110, -1.1, 1.1}}); + thetaRegistry.add("Theta/NegativeChild/hThetaPhi", " ; #phi; cos(#theta)", kTH2F, {{100, -1, 7}, {110, -1.1, 1.1}}); + mixQaRegistry.add("MixingQA/hMECollisionBins", ";bin;Entries", kTH1F, {{120, -0.5, 119.5}}); // MC truth @@ -256,6 +264,14 @@ struct FemtoUniversePairTaskTrackV0Helicity { registryMCtruth.add("minus/MCtruthPiPt", "MC truth pions;#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); registryMCtruth.add("minus/MCtruthPrPt", "MC truth protons;#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); + registryMCtruth.add("ThetaMCTruth/hTheta", " ; p (GeV/#it{c}); cos(#theta)", kTH2F, {{100, 0, 10}, {110, -1.1, 1.1}}); + registryMCtruth.add("ThetaMCTruth/PositiveChild/hThetaPt", " ; p_{T} (GeV/#it{c}); cos(#theta)", kTH2F, {{100, 0, 10}, {110, -1.1, 1.1}}); + registryMCtruth.add("ThetaMCTruth/PositiveChild/hThetaEta", " ; #eta; cos(#theta)", kTH2F, {{100, -1, 1}, {110, -1.1, 1.1}}); + registryMCtruth.add("ThetaMCTruth/PositiveChild/hThetaPhi", " ; #phi; cos(#theta)", kTH2F, {{100, -1, 7}, {110, -1.1, 1.1}}); + registryMCtruth.add("ThetaMCTruth/NegativeChild/hThetaPt", " ; p_{T} (GeV/#it{c}); cos(#theta)", kTH2F, {{100, 0, 10}, {110, -1.1, 1.1}}); + registryMCtruth.add("ThetaMCTruth/NegativeChild/hThetaEta", " ; #eta; cos(#theta)", kTH2F, {{100, -1, 1}, {110, -1.1, 1.1}}); + registryMCtruth.add("ThetaMCTruth/NegativeChild/hThetaPhi", " ; #phi; cos(#theta)", kTH2F, {{100, -1, 7}, {110, -1.1, 1.1}}); + // MC reco registryMCreco.add("plus/MCrecoLambda", "MC reco Lambdas;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); registryMCreco.add("plus/MCrecoLambdaChildPr", "MC reco Lambdas;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); @@ -278,15 +294,6 @@ struct FemtoUniversePairTaskTrackV0Helicity { registryMCreco.add("minus/MCrecoPiPt", "MC reco pions;#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); registryMCreco.add("minus/MCrecoPrPt", "MC reco protons;#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); - // Helicity angle - thetaRegistry.add("Theta/hTheta", " ; p (GeV/#it{c}); cos(#theta)", kTH2F, {{100, 0, 10}, {110, -1.1, 1.1}}); - thetaRegistry.add("Theta/PositiveChild/hThetaPt", " ; p_{T} (GeV/#it{c}); cos(#theta)", kTH2F, {{100, 0, 10}, {110, -1.1, 1.1}}); - thetaRegistry.add("Theta/PositiveChild/hThetaEta", " ; #eta; cos(#theta)", kTH2F, {{100, -1, 1}, {110, -1.1, 1.1}}); - thetaRegistry.add("Theta/PositiveChild/hThetaPhi", " ; #phi; cos(#theta)", kTH2F, {{100, -1, 7}, {110, -1.1, 1.1}}); - thetaRegistry.add("Theta/NegativeChild/hThetaPt", " ; p_{T} (GeV/#it{c}); cos(#theta)", kTH2F, {{100, 0, 10}, {110, -1.1, 1.1}}); - thetaRegistry.add("Theta/NegativeChild/hThetaEta", " ; #eta; cos(#theta)", kTH2F, {{100, -1, 1}, {110, -1.1, 1.1}}); - thetaRegistry.add("Theta/NegativeChild/hThetaPhi", " ; #phi; cos(#theta)", kTH2F, {{100, -1, 7}, {110, -1.1, 1.1}}); - sameEventCont.init(&resultRegistry, confkstarBins, confMultBins, confkTBins, confmTBins, confMultBins3D, confmTBins3D, confEtaBins, confPhiBins, confIsMC, confUse3D); sameEventCont.setPDGCodes(confTrkPDGCodePartOne, confV0PDGCodePartTwo); mixedEventCont.init(&resultRegistry, confkstarBins, confMultBins, confkTBins, confmTBins, confMultBins3D, confmTBins3D, confEtaBins, confPhiBins, confIsMC, confUse3D); @@ -869,6 +876,23 @@ struct FemtoUniversePairTaskTrackV0Helicity { registryMCtruth.fill(HIST("minus/MCtruthPr"), part.pt(), part.eta()); registryMCtruth.fill(HIST("minus/MCtruthPrPt"), part.pt()); } + + // Helicity angle + const auto& posChild = parts.iteratorAt(part.index() - 2); + const auto& negChild = parts.iteratorAt(part.index() - 1); + + auto posChildMass = pdg->Mass(confPDGCodePosChild); + auto negChildMass = pdg->Mass(confPDGCodeNegChild); + auto posChildBoosted = FemtoUniverseMath::boostPRF(posChild, posChildMass, negChild, negChildMass); + auto cosineTheta = (posChildBoosted.Px() * part.px() + posChildBoosted.Py() * part.py() + posChildBoosted.Pz() * part.pz()) / (posChildBoosted.P() * part.p()); + + registryMCtruth.fill(HIST("ThetaMCTruth/hTheta"), part.p(), cosineTheta); + registryMCtruth.fill(HIST("ThetaMCTruth/PositiveChild/hThetaPt"), posChild.pt(), cosineTheta); + registryMCtruth.fill(HIST("ThetaMCTruth/PositiveChild/hThetaEta"), posChild.eta(), cosineTheta); + registryMCtruth.fill(HIST("ThetaMCTruth/PositiveChild/hThetaPhi"), posChild.phi(), cosineTheta); + registryMCtruth.fill(HIST("ThetaMCTruth/NegativeChild/hThetaPt"), negChild.pt(), cosineTheta); + registryMCtruth.fill(HIST("ThetaMCTruth/NegativeChild/hThetaEta"), negChild.eta(), cosineTheta); + registryMCtruth.fill(HIST("ThetaMCTruth/NegativeChild/hThetaPhi"), negChild.phi(), cosineTheta); } } From cfbbf160eec8745e33faeee9916d314cbbe13e62 Mon Sep 17 00:00:00 2001 From: Lucia Anna Tarasovicova Date: Wed, 6 Aug 2025 11:30:38 +0200 Subject: [PATCH 253/345] [PWGLF] Change in Derivedcascadeanalysis (#12450) Co-authored-by: Lucia Anna Tarasovicova --- .../Strangeness/derivedcascadeanalysis.cxx | 59 ++++++++++++++----- 1 file changed, 45 insertions(+), 14 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/derivedcascadeanalysis.cxx b/PWGLF/Tasks/Strangeness/derivedcascadeanalysis.cxx index 95a25f589e3..5cab36540c3 100644 --- a/PWGLF/Tasks/Strangeness/derivedcascadeanalysis.cxx +++ b/PWGLF/Tasks/Strangeness/derivedcascadeanalysis.cxx @@ -76,6 +76,7 @@ struct Derivedcascadeanalysis { ConfigurableAxis axisIR{"axisIR", {510, -1, 50}, "Binning for the interaction rate (kHz)"}; Configurable isXi{"isXi", 1, "Apply cuts for Xi identification"}; + Configurable ispO{"ispO", 0, "Analyse p--O collisions"}; Configurable useCentralityFT0M{"useCentralityFT0M", 0, "If true, use centFT0M"}; Configurable useCentralityFT0A{"useCentralityFT0A", 0, "If true, use centFT0A"}; Configurable useCentralityFT0Cvar1{"useCentralityFT0Cvar1", 0, "If true, use centFT0FT0Cvar1"}; @@ -119,6 +120,18 @@ struct Derivedcascadeanalysis { Configurable maxOccupancy{"maxOccupancy", -1, "Maximal occupancy"}; Configurable minOccupancyFT0{"minOccupancyFT0", -1, "Minimal occupancy"}; Configurable maxOccupancyFT0{"maxOccupancyFT0", -1, "Maximal occupancy"}; + Configurable globalTracksCorrelpar0Low{"globalTracksCorrelpar0Low", 81, "[0]*exp([1]*centrality)+[2], mean minus 3*sigma"}; + Configurable globalTracksCorrelpar1Low{"globalTracksCorrelpar1Low", -0.0431016, "[0]*exp([1]*centrality)+[2], mean minus 3*sigma"}; + Configurable globalTracksCorrelpar2Low{"globalTracksCorrelpar2Low", -6, "[0]*exp([1]*centrality)+[2], mean minus 3*sigma"}; + Configurable globalTracksCorrelpar0High{"globalTracksCorrelpar0High", 226, "[0]*exp([1]*centrality)+[2], mean minus 3*sigma"}; + Configurable globalTracksCorrelpar1High{"globalTracksCorrelpar1High", -0.0181686, "[0]*exp([1]*centrality)+[2], mean plus 3*sigma"}; + Configurable globalTracksCorrelpar2High{"globalTracksCorrelpar2High", -22, "[0]*exp([1]*centrality)+[2], mean plus 3*sigma"}; + Configurable pvContribCorrelpar0Low{"pvContribCorrelpar0Low", 152, "[0]*exp([1]*centrality)+[2], mean minus 3*sigma"}; + Configurable pvContribCorrelpar1Low{"pvContribCorrelpar1Low", -0.0431016, "[0]*exp([1]*centrality)+[2], mean minus 3*sigma"}; + Configurable pvContribCorrelpar2Low{"pvContribCorrelpar2Low", -15.3776, "[0]*exp([1]*centrality)+[2], mean minus 3*sigma"}; + Configurable pvContribCorrelpar0High{"pvContribCorrelpar0High", 384.861, "[0]*exp([1]*centrality)+[2], mean minus 3*sigma"}; + Configurable pvContribCorrelpar1High{"pvContribCorrelpar1High", -0.0181686, "[0]*exp([1]*centrality)+[2], mean plus 3*sigma"}; + Configurable pvContribCorrelpar2High{"pvContribCorrelpar2High", -39, "[0]*exp([1]*centrality)+[2], mean plus 3*sigma"}; } eventSelectionRun3Flags; struct : ConfigurableGroup { @@ -219,6 +232,8 @@ struct Derivedcascadeanalysis { Configurable rejcomp{"rejcomp", 0.008, "Competing Cascade rejection"}; Configurable masswin{"masswin", 0.05, "Mass window limit"}; Configurable rapCut{"rapCut", 0.5, "Rapidity acceptance"}; + Configurable minRapCut{"minRapCut", -0.845, "minimal rapidity acceptance in case of p--o"}; + Configurable maxRapCut{"maxRapCut", 0.155, "maximal rapidity acceptance in case of p--o"}; Configurable etaDauCut{"etaDauCut", 0.8, "Pseudorapidity acceptance of the cascade daughters"}; Configurable minITSclusters{"minITSclusters", 3, "minimal number of ITS hits for the daughter tracks"}; } candidateSelectionValues; @@ -302,6 +317,10 @@ struct Derivedcascadeanalysis { histos.add("hNCrossedRowsPositive", "", kTH1F, {{400, -200, 200}}); histos.add("hNCrossedRowsBachelor", "", kTH1F, {{400, -200, 200}}); + histos.add("hPseudorapPosDaughter", "", kTH1F, {{50, -1, 1}}); + histos.add("hPseudorapNegDaughter", "", kTH1F, {{50, -1, 1}}); + histos.add("hPseudorapBachelor", "", kTH1F, {{50, -1, 1}}); + histos.add("hEventNchCorrelationAfCuts", "hEventNchCorrelationAfCuts", kTH2F, {{5000, 0, 5000}, {5000, 0, 2500}}); histos.add("hEventPVcontributorsVsCentrality", "hEventPVcontributorsVsCentrality", kTH2F, {{100, 0, 100}, {5000, 0, 5000}}); histos.add("hEventGlobalTracksVsCentrality", "hEventGlobalTracksVsCentrality", kTH2F, {{100, 0, 100}, {2500, 0, 2500}}); @@ -660,9 +679,9 @@ struct Derivedcascadeanalysis { histos.fill(HIST("hEventSelection"), 11.5 /* Not at TF border */); if (eventSelectionRun3Flags.doMultiplicityCorrCut) { - if (coll.multNTracksGlobal() < (1343.3 * std::exp(-0.0443259 * centrality) - 50) || coll.multNTracksGlobal() > (2098.9 * std::exp(-0.0332444 * centrality))) + if (coll.multNTracksGlobal() < (eventSelectionRun3Flags.globalTracksCorrelpar0Low * std::exp(eventSelectionRun3Flags.globalTracksCorrelpar1Low * centrality) + eventSelectionRun3Flags.globalTracksCorrelpar2Low) || coll.multNTracksGlobal() > (eventSelectionRun3Flags.globalTracksCorrelpar0High * std::exp(eventSelectionRun3Flags.globalTracksCorrelpar1High * centrality) + eventSelectionRun3Flags.globalTracksCorrelpar2High)) return false; - if (coll.multNTracksPVeta1() < (3703 * std::exp(-0.0455483 * centrality) - 150) || coll.multNTracksPVeta1() > (4937.33 * std::exp(-0.0372668 * centrality) + 20)) + if (coll.multNTracksPVeta1() < (eventSelectionRun3Flags.pvContribCorrelpar0Low * std::exp(eventSelectionRun3Flags.pvContribCorrelpar1Low * centrality) + eventSelectionRun3Flags.pvContribCorrelpar2Low) || coll.multNTracksPVeta1() > (eventSelectionRun3Flags.pvContribCorrelpar0High * std::exp(eventSelectionRun3Flags.pvContribCorrelpar1High * centrality) + eventSelectionRun3Flags.pvContribCorrelpar2High)) return false; } if (fillHists) @@ -826,13 +845,17 @@ struct Derivedcascadeanalysis { float cut = candidateSelectionValues.masswin; histos.fill(HIST("hCutValue"), 1, cut); cut = candidateSelectionValues.rapCut; + if (ispO) + cut = candidateSelectionValues.maxRapCut; histos.fill(HIST("hCutValue"), 2, cut); if (isXi) { if (std::abs(casc.mXi() - o2::constants::physics::MassXiMinus) > candidateSelectionValues.masswin) { return false; } histos.fill(HIST("hCandidate"), ++counter); - if (std::abs(casc.yXi()) > candidateSelectionValues.rapCut) + if (ispO && (casc.yXi() < candidateSelectionValues.minRapCut || casc.yXi() > candidateSelectionValues.maxRapCut)) + return false; + else if (std::abs(casc.yXi()) > candidateSelectionValues.rapCut) return false; histos.fill(HIST("hCandidate"), ++counter); } else { @@ -840,7 +863,9 @@ struct Derivedcascadeanalysis { return false; } histos.fill(HIST("hCandidate"), ++counter); - if (std::abs(casc.yOmega()) > candidateSelectionValues.rapCut) + if (ispO && (casc.yOmega() < candidateSelectionValues.minRapCut || casc.yOmega() > candidateSelectionValues.maxRapCut)) + return false; + else if (std::abs(casc.yOmega()) > candidateSelectionValues.rapCut) return false; histos.fill(HIST("hCandidate"), ++counter); } @@ -1120,11 +1145,11 @@ struct Derivedcascadeanalysis { auto cascMC = casc.template cascMCCore_as>(); ptmc = RecoDecay::sqrtSumOfSquares(cascMC.pxMC(), cascMC.pyMC()); - if (cascMC.isPhysicalPrimary() && ((isXi && std::abs(cascMC.pdgCode()) == 3312) || (!isXi && std::abs(cascMC.pdgCode()) == 3334))) + if (cascMC.isPhysicalPrimary() && ((isXi && std::abs(cascMC.pdgCode()) == PDG_t::kXiMinus) || (!isXi && std::abs(cascMC.pdgCode()) == PDG_t::kOmegaMinus))) isTrueMCCascade = true; - if (isTrueMCCascade && ((isPositive && cascMC.pdgCodePositive() == 211 && cascMC.pdgCodeNegative() == -2212) || (isNegative && cascMC.pdgCodePositive() == 2212 && cascMC.pdgCodeNegative() == -211))) + if (isTrueMCCascade && ((isPositive && cascMC.pdgCodePositive() == PDG_t::kPiPlus && cascMC.pdgCodeNegative() == PDG_t::kProtonBar) || (isNegative && cascMC.pdgCodePositive() == PDG_t::kProton && cascMC.pdgCodeNegative() == PDG_t::kPiMinus))) isCorrectLambdaDecay = true; - if (isTrueMCCascade && isCorrectLambdaDecay && ((isXi && std::abs(cascMC.pdgCodeBachelor()) == 211) || (!isXi && std::abs(cascMC.pdgCodeBachelor()) == 321))) + if (isTrueMCCascade && isCorrectLambdaDecay && ((isXi && std::abs(cascMC.pdgCodeBachelor()) == PDG_t::kPiPlus) || (!isXi && std::abs(cascMC.pdgCodeBachelor()) == PDG_t::kKPlus))) isTrueMCCascadeDecay = true; if (qaFlags.doBefSelCheck && isTrueMCCascade) { @@ -1161,6 +1186,10 @@ struct Derivedcascadeanalysis { continue; histos.fill(HIST("hCandidate"), ++counter); + histos.fill(HIST("hPseudorapPosDaughter"), poseta); + histos.fill(HIST("hPseudorapNegDaughter"), negeta); + histos.fill(HIST("hPseudorapBachelor"), bacheta); + if (candidateSelectionFlags.doCascadeCosPaCut) { if (!isCosPAAccepted(casc, coll.posX(), coll.posY(), coll.posZ(), candidateSelectionFlags.doPtDepCosPaCut, true)) continue; @@ -1429,12 +1458,14 @@ struct Derivedcascadeanalysis { float ptmc = RecoDecay::sqrtSumOfSquares(cascMC.pxMC(), cascMC.pyMC()); float ymc = 1e3; - if (std::abs(cascMC.pdgCode()) == 3312) + if (std::abs(cascMC.pdgCode()) == PDG_t::kXiMinus) ymc = RecoDecay::y(std::array{cascMC.pxMC(), cascMC.pyMC(), cascMC.pzMC()}, o2::constants::physics::MassXiMinus); - else if (std::abs(cascMC.pdgCode()) == 3334) + else if (std::abs(cascMC.pdgCode()) == PDG_t::kOmegaMinus) ymc = RecoDecay::y(std::array{cascMC.pxMC(), cascMC.pyMC(), cascMC.pzMC()}, o2::constants::physics::MassOmegaMinus); - if (std::abs(ymc) > candidateSelectionValues.rapCut) + if (ispO && (ymc > candidateSelectionValues.maxRapCut || ymc < candidateSelectionValues.minRapCut)) + continue; + else if (std::abs(ymc) > candidateSelectionValues.rapCut) continue; auto mcCollision = cascMC.template straMCCollision_as>(); @@ -1471,7 +1502,7 @@ struct Derivedcascadeanalysis { nChEta1 = collision.multNTracksPVeta1(); } - if (cascMC.pdgCode() == 3312 && isXi) { + if (cascMC.pdgCode() == PDG_t::kXiMinus && isXi) { histos.fill(HIST("h2dGenXiMinus"), centrality, ptmc); histos.fill(HIST("h2dGenXiMinusVsNch"), nChEta1, ptmc); histos.fill(HIST("h2dGenXiMinusEta"), RecoDecay::eta(std::array{cascMC.pxMC(), cascMC.pyMC(), cascMC.pzMC()})); @@ -1484,7 +1515,7 @@ struct Derivedcascadeanalysis { histos.fill(HIST("h2dGenXiMinusVsCentIR"), ptmc, centrality, intRate); histos.fill(HIST("h2dGenXiMinusVsNchVsOccupancy"), ptmc, nChEta1, occupancy); } - if (cascMC.pdgCode() == -3312 && isXi) { + if (cascMC.pdgCode() == PDG_t::kXiPlusBar && isXi) { histos.fill(HIST("h2dGenXiPlus"), centrality, ptmc); histos.fill(HIST("h2dGenXiPlusVsNch"), nChEta1, ptmc); histos.fill(HIST("h2dGenXiPlusVsMultMCVsCentrality"), mcCollision.multMCNParticlesEta05(), centrality, ptmc); @@ -1493,7 +1524,7 @@ struct Derivedcascadeanalysis { histos.fill(HIST("h2dGenXiPlusVsNchVsOccupancy"), ptmc, nChEta1, occupancy); histos.fill(HIST("h2dGenXiPlusVsCentIR"), ptmc, centrality, intRate); } - if (cascMC.pdgCode() == 3334 && !isXi) { + if (cascMC.pdgCode() == PDG_t::kOmegaMinus && !isXi) { histos.fill(HIST("h2dGenOmegaMinus"), centrality, ptmc); histos.fill(HIST("h2dGenOmegaMinusVsNch"), nChEta1, ptmc); histos.fill(HIST("h2dGenOmegaMinusEta"), RecoDecay::eta(std::array{cascMC.pxMC(), cascMC.pyMC(), cascMC.pzMC()})); @@ -1506,7 +1537,7 @@ struct Derivedcascadeanalysis { histos.fill(HIST("h2dGenOmegaMinusVsNchVsOccupancy"), ptmc, nChEta1, occupancy); histos.fill(HIST("h2dGenOmegaMinusVsCentIR"), ptmc, centrality, intRate); } - if (cascMC.pdgCode() == -3334 && !isXi) { + if (cascMC.pdgCode() == PDG_t::kOmegaPlusBar && !isXi) { histos.fill(HIST("h2dGenOmegaPlus"), centrality, ptmc); histos.fill(HIST("h2dGenOmegaPlusVsNch"), nChEta1, ptmc); histos.fill(HIST("h2dGenOmegaPlusVsMultMCVsCentrality"), mcCollision.multMCNParticlesEta05(), centrality, ptmc); From a1cff8a4ba0f6deafbeb6ad06b50ca07f34313fa Mon Sep 17 00:00:00 2001 From: JimunLee Date: Wed, 6 Aug 2025 18:50:45 +0900 Subject: [PATCH 254/345] [PWGLF] Added TOF condition (#12431) Co-authored-by: jimun_lee --- PWGLF/Tasks/Resonances/CMakeLists.txt | 4 +- PWGLF/Tasks/Resonances/kstarInOO.cxx | 290 ++++++++++++++------------ 2 files changed, 162 insertions(+), 132 deletions(-) diff --git a/PWGLF/Tasks/Resonances/CMakeLists.txt b/PWGLF/Tasks/Resonances/CMakeLists.txt index a1fea7646a2..b2f78d88669 100644 --- a/PWGLF/Tasks/Resonances/CMakeLists.txt +++ b/PWGLF/Tasks/Resonances/CMakeLists.txt @@ -229,7 +229,7 @@ o2physics_add_dpl_workflow(double-resonance-scan PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(kstar-in-oo +o2physics_add_dpl_workflow(kstarinoo SOURCES kstarInOO.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) @@ -237,4 +237,4 @@ o2physics_add_dpl_workflow(kstar-in-oo o2physics_add_dpl_workflow(phioo SOURCES phiOO.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore - COMPONENT_NAME Analysis) \ No newline at end of file + COMPONENT_NAME Analysis) diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index dc70ae02010..47259ec84ed 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -60,7 +60,7 @@ using namespace o2::framework::expressions; struct kstarInOO { SliceCache cache; Preslice perCollision = aod::track::collisionId; - HistogramRegistry OOhistos{"OOhistos", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; //================================== //|| @@ -69,50 +69,48 @@ struct kstarInOO { //================================== // Event Selection - Configurable cfg_Event_Selections{"cfg_Event_Selections", "sel8", "choose event selection"}; - Configurable cfg_Event_VtxCut{"cfg_Event_VtxCut", 10.0, "V_z cut selection"}; + Configurable cfgEventVtxCut{"cfgEventVtxCut", 10.0, "V_z cut selection"}; - ConfigurableAxis cfg_CentAxis{"cfg_CentAxis", {VARIABLE_WIDTH, 0.0, 1.0, 5.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 110.0}, "Binning of the centrality axis"}; + ConfigurableAxis cfgCentAxis{"cfgCentAxis", {VARIABLE_WIDTH, 0.0, 1.0, 5.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 110.0}, "Binning of the centrality axis"}; // Track Selection // General - Configurable cfg_Track_Selections{"cfg_Track_Selections", "globalTracks", "set track selections"}; - Configurable cfg_Track_MinPt{"cfg_Track_MinPt", 0.15, "set track min pT"}; - Configurable cfg_Track_MaxEta{"cfg_Track_MaxEta", 0.9, "set track max Eta"}; - Configurable cfg_Track_MaxDCArToPVcut{"cfg_Track_MaxDCArToPVcut", 0.5, "Track DCAr cut to PV Maximum"}; - Configurable cfg_Track_MaxDCAzToPVcut{"cfg_Track_MaxDCAzToPVcut", 2.0, "Track DCAz cut to PV Maximum"}; - Configurable cfg_Track_PrimaryTrack{"cfg_Track_PrimaryTrack", true, "Primary track selection"}; // kGoldenChi2 | kDCAxy | kDCAz - Configurable cfg_Track_ConnectedToPV{"cfg_Track_ConnectedToPV", true, "PV contributor track selection"}; // PV Contriuibutor - Configurable cfg_Track_GlobalWoDCATrack{"cfg_Track_GlobalWoDCATrack", true, "Global track selection without DCA"}; // kQualityTracks (kTrackType | kTPCNCls | kTPCCrossedRows | kTPCCrossedRowsOverNCls | kTPCChi2NDF | kTPCRefit | kITSNCls | kITSChi2NDF | kITSRefit | kITSHits) | kInAcceptanceTracks (kPtRange | kEtaRange) + Configurable cfgTrackMinPt{"cfgTrackMinPt", 0.15, "set track min pT"}; + Configurable cfgTrackMaxEta{"cfgTrackMaxEta", 0.9, "set track max Eta"}; + Configurable cfgTrackMaxDCArToPVcut{"cfgTrackMaxDCArToPVcut", 0.5, "Track DCAr cut to PV Maximum"}; + Configurable cfgTrackMaxDCAzToPVcut{"cfgTrackMaxDCAzToPVcut", 2.0, "Track DCAz cut to PV Maximum"}; + Configurable cfgTrackPrimaryTrack{"cfgTrackPrimaryTrack", true, "Primary track selection"}; // kGoldenChi2 | kDCAxy | kDCAz + Configurable cfgTrackConnectedToPV{"cfgTrackConnectedToPV", true, "PV contributor track selection"}; // PV Contriuibutor + Configurable cfgTrackGlobalWoDCATrack{"cfgTrackGlobalWoDCATrack", true, "Global track selection without DCA"}; // kQualityTracks (kTrackType | kTPCNCls | kTPCCrossedRows | kTPCCrossedRowsOverNCls | kTPCChi2NDF | kTPCRefit | kITSNCls | kITSChi2NDF | kITSRefit | kITSHits) | kInAcceptanceTracks (kPtRange | kEtaRange) // TPC - Configurable cfg_Track_nFindableTPCClusters{"cfg_Track_FindableTPCClusters", 50, "nFindable TPC Clusters"}; - Configurable cfg_Track_nTPCCrossedRows{"cfg_Track_TPCCrossedRows", 70, "nCrossed TPC Rows"}; - Configurable cfg_Track_nRowsOverFindable{"cfg_Track_RowsOverFindable", 1.2, "nRowsOverFindable TPC CLusters"}; - Configurable cfg_Track_nTPCChi2{"cfg_Track_TPCChi2", 4.0, "nTPC Chi2 per Cluster"}; + Configurable cfgTracknFindableTPCClusters{"cfgTrackFindableTPCClusters", 50, "nFindable TPC Clusters"}; + Configurable cfgTracknTPCCrossedRows{"cfgTrackTPCCrossedRows", 70, "nCrossed TPC Rows"}; + Configurable cfgTracknRowsOverFindable{"cfgTrackRowsOverFindable", 1.2, "nRowsOverFindable TPC CLusters"}; + Configurable cfgTracknTPCChi2{"cfgTrackTPCChi2", 4.0, "nTPC Chi2 per Cluster"}; - // ITS - Configurable cfg_Track_nITSChi2{"cfg_Track_ITSChi2", 36.0, "nITS Chi2 per Cluster"}; + // IT + Configurable cfgTracknITSChi2{"cfgTrackITSChi2", 36.0, "nITS Chi2 per Cluster"}; // PID - Configurable cfg_Track_TPCPID{"cfg_Track_TPCPID", true, "Enables TPC PID"}; - Configurable cfg_Track_TOFPID{"cfg_Track_TOFPID", true, "Enables TOF PID"}; - Configurable cfg_Track_TPCPID_nSig{"cfg_Track_TPCPID_nSig", 4.0, "nTPC PID sigma"}; - Configurable cfg_Track_TOFPID_nSig{"cfg_Track_TOFPID_nSig", 4.0, "nTOF PID sigma"}; + Configurable cfgTrackTPCPID{"cfgTrackTPCPID", true, "Enables TPC PID"}; + Configurable cfgTrackTOFPID{"cfgTrackTOFPID", true, "Enables TOF PID"}; + Configurable cfgTrackTPCPIDnSig{"cfgTrackTPCPIDnSig", 4.0, "nTPC PID sigma"}; + Configurable cfgTrackTOFPIDnSig{"cfgTrackTOFPIDnSig", 4.0, "nTOF PID sigma"}; Configurable cDebugLevel{"cDebugLevel", 0, "Resolution of Debug"}; // Mixing - ConfigurableAxis cfg_bins_MixMult{"cfg_bins_Cent", {VARIABLE_WIDTH, 0.0, 1.0, 5.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 110.0}, "Binning of the centrality axis"}; - ConfigurableAxis cfg_bins_MixVtx{"cfg_bins_MixVtx", {VARIABLE_WIDTH, -10.0f, -5.f, 0.f, 5.f, 10.f}, "Mixing bins - z-vertex"}; - Configurable cfg_Mix_NMixedEvents{"cfg_Mix_NMixedEvents", 10, "Number of mixed events per event"}; + ConfigurableAxis cfgBinsMixMult{"cfgBinsCent", {VARIABLE_WIDTH, 0.0, 1.0, 5.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 110.0}, "Binning of the centrality axis"}; + ConfigurableAxis cfgBinsMixVtx{"cfgBinsMixVtx", {VARIABLE_WIDTH, -10.0f, -5.f, 0.f, 5.f, 10.f}, "Mixing bins - z-vertex"}; + Configurable cfgMixNMixedEvents{"cfgMixNMixedEvents", 10, "Number of mixed events per event"}; // Pair - Configurable cfg_MinvNBins{"cfg_MinvNBins", 300, "Number of bins for Minv axis"}; - Configurable cfg_MinvMin{"cfg_MinvMin", 0.60, "Minimum Minv value"}; - Configurable cfg_MinvMax{"cfg_MinvMax", 1.20, "Maximum Minv value"}; + Configurable cfgMinvNBins{"cfgMinvNBins", 300, "Number of bins for Minv axis"}; + Configurable cfgMinvMin{"cfgMinvMin", 0.60, "Minimum Minv value"}; + Configurable cfgMinvMax{"cfgMinvMax", 1.20, "Maximum Minv value"}; // Histogram - Configurable cfg_Event_CutQA{"cfg_Event_CutsQA", false, "Enable Event QA Hists"}; - Configurable cfg_Track_CutQA{"cfg_Track_CutQA", false, "Enable Track QA Hists"}; + Configurable cfgEventCutQA{"cfgEventCutsQA", false, "Enable Event QA Hists"}; + Configurable cfgTrackCutQA{"cfgTrackCutQA", false, "Enable Track QA Hists"}; // std::vector eventSelectionBits; @@ -121,57 +119,66 @@ struct kstarInOO { // HISTOGRAMS const AxisSpec axisEta{30, -1.5, +1.5, "#eta"}; const AxisSpec axisPhi{200, -1, +7, "#phi"}; - const AxisSpec PtAxis = {200, 0, 20.0}; - const AxisSpec PIDAxis = {120, -6, 6}; - const AxisSpec MinvAxis = {cfg_MinvNBins, cfg_MinvMin, cfg_MinvMax}; + const AxisSpec ptAxis = {200, 0, 20.0}; + const AxisSpec pidAxis = {120, -6, 6}; + const AxisSpec minvAxis = {cfgMinvNBins, cfgMinvMin, cfgMinvMax}; - if (cfg_Event_CutQA) { - OOhistos.add("hPosZ_BC", "PosZ_Bc", kTH1F, {{100, 0.0, 15.0}}); - OOhistos.add("hPosZ_AC", "PosZ_AC", kTH1F, {{100, 0.0, 15.0}}); + if (cfgEventCutQA) { + histos.add("hPosZ_BC", "hPosZ_Bc", kTH1F, {{100, 0.0, 15.0}}); + histos.add("hPosZ_AC", "hPosZ_AC", kTH1F, {{100, 0.0, 15.0}}); } - if (cfg_Track_CutQA) { - OOhistos.add("h_rawpT", "h_rawpT", kTH1F, {{1000, 0.0, 10.0}}); - OOhistos.add("h_rawpT_Kaon", "h_rawpT_Kaon", kTH1F, {{1000, 0.0, 10.0}}); - OOhistos.add("h_rawpT_Pion", "h_rawpT_Pion", kTH1F, {{1000, 0.0, 10.0}}); - OOhistos.add("h_eta", "h_eta", kTH1F, {axisEta}); - OOhistos.add("h_phi", "h_phi", kTH1F, {axisPhi}); - - OOhistos.add("QA_nSigma_pion_TPC", "QA_nSigma_pion_TPC", {HistType::kTH2F, {PtAxis, PIDAxis}}); - OOhistos.add("QA_nSigma_pion_TOF", "QA_nSigma_pion_TOF", {HistType::kTH2F, {PtAxis, PIDAxis}}); - OOhistos.add("QA_pion_TPC_TOF", "QA_pion_TPC_TOF", {HistType::kTH2F, {PIDAxis, PIDAxis}}); - OOhistos.add("QA_nSigma_kaon_TPC", "QA_nSigma_kaon_TPC", {HistType::kTH2F, {PtAxis, PIDAxis}}); - OOhistos.add("QA_nSigma_kaon_TOF", "QA_nSigma_kaon_TOF", {HistType::kTH2F, {PtAxis, PIDAxis}}); - OOhistos.add("QA_kaon_TPC_TOF", "QA_kaon_TPC_TOF", {HistType::kTH2F, {PIDAxis, PIDAxis}}); + if (cfgTrackCutQA) { + // histos.add("h_rawpT", "h_rawpT", kTH1F, {{1000, 0.0, 10.0}}); + // histos.add("h_rawpT_Kaon", "h_rawpT_Kaon", kTH1F, {{1000, 0.0, 10.0}}); + // histos.add("h_rawpT_Pion", "h_rawpT_Pion", kTH1F, {{1000, 0.0, 10.0}}); + // histos.add("h_eta", "h_eta", kTH1F, {axisEta}); + // histos.add("h_phi", "h_phi", kTH1F, {axisPhi}); + + histos.add("QA_nSigma_pion_TPC_BC", "QA_nSigma_pion_TPC_BC", {HistType::kTH2F, {ptAxis, pidAxis}}); + histos.add("QA_nSigma_pion_TOF_BC", "QA_nSigma_pion_TOF_BC", {HistType::kTH2F, {ptAxis, pidAxis}}); + histos.add("QA_pion_TPC_TOF_BC", "QA_pion_TPC_TOF_BC", {HistType::kTH2F, {pidAxis, pidAxis}}); + + histos.add("QA_nSigma_pion_TPC_AC", "QA_nSigma_pion_TPC_AC", {HistType::kTH2F, {ptAxis, pidAxis}}); + histos.add("QA_nSigma_pion_TOF_AC", "QA_nSigma_pion_TOF_AC", {HistType::kTH2F, {ptAxis, pidAxis}}); + histos.add("QA_pion_TPC_TOF_AC", "QA_pion_TPC_TOF_AC", {HistType::kTH2F, {pidAxis, pidAxis}}); + + histos.add("QA_nSigma_kaon_TPC_BC", "QA_nSigma_kaon_TPC_BC", {HistType::kTH2F, {ptAxis, pidAxis}}); + histos.add("QA_nSigma_kaon_TOF_BC", "QA_nSigma_kaon_TOF_BC", {HistType::kTH2F, {ptAxis, pidAxis}}); + histos.add("QA_kaon_TPC_TOF_BC", "QA_kaon_TPC_TOF_BC", {HistType::kTH2F, {pidAxis, pidAxis}}); + + histos.add("QA_nSigma_kaon_TPC_AC", "QA_nSigma_kaon_TPC_AC", {HistType::kTH2F, {ptAxis, pidAxis}}); + histos.add("QA_nSigma_kaon_TOF_AC", "QA_nSigma_kaon_TOF_AC", {HistType::kTH2F, {ptAxis, pidAxis}}); + histos.add("QA_kaon_TPC_TOF_AC", "QA_kaon_TPC_TOF_AC", {HistType::kTH2F, {pidAxis, pidAxis}}); } // MC histos - OOhistos.add("hMC_USS", "hMC_USS", kTHnSparseF, {cfg_CentAxis, PtAxis, MinvAxis}); - OOhistos.add("hMC_LSS", "hMC_LSS", kTHnSparseF, {cfg_CentAxis, PtAxis, MinvAxis}); - OOhistos.add("hMC_USS_Mix", "hMC_USS_Mix", kTHnSparseF, {cfg_CentAxis, PtAxis, MinvAxis}); - OOhistos.add("hMC_LSS_Mix", "hMC_LSS_Mix", kTHnSparseF, {cfg_CentAxis, PtAxis, MinvAxis}); + histos.add("hMC_USS", "hMC_USS", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hMC_LSS", "hMC_LSS", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hMC_USS_Mix", "hMC_USS_Mix", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hMC_LSS_Mix", "hMC_LSS_Mix", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - // OOhistos.add("hMC_pt_Pion", "hMC_pt_Pion", kTH1F, {PtAxis}); - // OOhistos.add("hMC_pt_Kaon", "hMC_pt_Kaon", kTH1F, {PtAxis}); - // OOhistos.add("hMC_pt_Proton", "hMC_pt_Proton", kTH1F, {PtAxis}); + // histos.add("hMC_pt_Pion", "hMC_pt_Pion", kTH1F, {ptAxis}); + // histos.add("hMC_pt_Kaon", "hMC_pt_Kaon", kTH1F, {ptAxis}); + // histos.add("hMC_pt_Proton", "hMC_pt_Proton", kTH1F, {ptAxis}); // Event Histograms - OOhistos.add("nEvents_MC", "nEvents_MC", kTH1F, {{4, 0.0, 4.0}}); - OOhistos.add("nEvents_MC_Mix", "nEvents_MC_Mix", kTH1F, {{4, 0.0, 4.0}}); + histos.add("nEvents_MC", "nEvents_MC", kTH1F, {{4, 0.0, 4.0}}); + histos.add("nEvents_MC_Mix", "nEvents_MC_Mix", kTH1F, {{4, 0.0, 4.0}}); } // end of init using EventCandidates = soa::Join; //, aod::CentFT0Ms, aod::CentFT0As using TrackCandidates = soa::Join; - using TrackCandidates_MC = soa::Join; + using TrackCandidatesMC = soa::Join; // For Mixed Event using BinningType = ColumnBinningPolicy; - Partition Kaon_MC = nabs(aod::pidtpc::tpcNSigmaKa) <= cfg_Track_TPCPID_nSig; - Partition Pion_MC = nabs(aod::pidtpc::tpcNSigmaPi) <= cfg_Track_TPCPID_nSig; + Partition kaonMC = !cfgTrackTPCPID || (nabs(aod::pidtpc::tpcNSigmaKa) <= cfgTrackTPCPIDnSig); + Partition pionMC = !cfgTrackTPCPID || (nabs(aod::pidtpc::tpcNSigmaPi) <= cfgTrackTPCPIDnSig); double massKa = o2::constants::physics::MassKPlus; double massPi = o2::constants::physics::MassPiMinus; @@ -184,9 +191,12 @@ struct kstarInOO { template bool eventSelection(const EventType event) { + if (cfgEventCutQA) + histos.fill(HIST("hPosZ_BC"), event.posZ()); + if (!event.sel8()) return false; - if (std::abs(event.posZ()) > cfg_Event_VtxCut) + if (std::abs(event.posZ()) > cfgEventVtxCut) return false; if (!event.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) return false; @@ -199,46 +209,49 @@ struct kstarInOO { if (!event.selection_bit(aod::evsel::kNoCollInTimeRangeStandard)) return false; + if (cfgEventCutQA) + histos.fill(HIST("hPosZ_AC"), event.posZ()); + return true; }; template bool trackSelection(const TracksType track) { - if (track.pt() < cfg_Track_MinPt) + if (track.pt() < cfgTrackMinPt) return false; - if (std::abs(track.eta()) > cfg_Track_MaxEta) + if (std::abs(track.eta()) > cfgTrackMaxEta) return false; - if (std::abs(track.dcaXY()) > cfg_Track_MaxDCArToPVcut) + if (std::abs(track.dcaXY()) > cfgTrackMaxDCArToPVcut) return false; - if (std::abs(track.dcaZ()) > cfg_Track_MaxDCAzToPVcut) + if (std::abs(track.dcaZ()) > cfgTrackMaxDCAzToPVcut) return false; - if (cfg_Track_PrimaryTrack && !track.isPrimaryTrack()) + if (cfgTrackPrimaryTrack && !track.isPrimaryTrack()) return false; - if (cfg_Track_GlobalWoDCATrack && !track.isGlobalTrackWoDCA()) + if (cfgTrackGlobalWoDCATrack && !track.isGlobalTrackWoDCA()) return false; - if (track.tpcNClsFindable() < cfg_Track_nFindableTPCClusters) + if (track.tpcNClsFindable() < cfgTracknFindableTPCClusters) return false; - if (track.tpcNClsCrossedRows() < cfg_Track_nTPCCrossedRows) + if (track.tpcNClsCrossedRows() < cfgTracknTPCCrossedRows) return false; - if (track.tpcCrossedRowsOverFindableCls() > cfg_Track_nRowsOverFindable) + if (track.tpcCrossedRowsOverFindableCls() > cfgTracknRowsOverFindable) return false; - if (track.tpcChi2NCl() > cfg_Track_nTPCChi2) + if (track.tpcChi2NCl() > cfgTracknTPCChi2) return false; - if (track.itsChi2NCl() > cfg_Track_nITSChi2) + if (track.itsChi2NCl() > cfgTracknITSChi2) return false; - if (cfg_Track_ConnectedToPV && !track.isPVContributor()) + if (cfgTrackConnectedToPV && !track.isPVContributor()) return false; return true; @@ -249,26 +262,32 @@ struct kstarInOO { { bool tpcPIDPassed{false}, tofPIDPassed{false}; // TPC - if (cfg_Track_CutQA) { - OOhistos.fill(HIST("QA_nSigma_kaon_TPC"), candidate.pt(), candidate.tpcNSigmaKa()); - OOhistos.fill(HIST("QA_nSigma_kaon_TOF"), candidate.pt(), candidate.tofNSigmaKa()); - OOhistos.fill(HIST("QA_kaon_TPC_TOF"), candidate.tpcNSigmaKa(), candidate.tofNSigmaKa()); + if (cfgTrackCutQA) { + histos.fill(HIST("QA_nSigma_kaon_TPC_BC"), candidate.pt(), candidate.tpcNSigmaKa()); + histos.fill(HIST("QA_nSigma_kaon_TOF_BC"), candidate.pt(), candidate.tofNSigmaKa()); + histos.fill(HIST("QA_kaon_TPC_TOF_BC"), candidate.tpcNSigmaKa(), candidate.tofNSigmaKa()); } - if (std::abs(candidate.tpcNSigmaKa()) < cfg_Track_TPCPID_nSig) + if (std::abs(candidate.tpcNSigmaKa()) < cfgTrackTPCPIDnSig) tpcPIDPassed = true; // TOF if (candidate.hasTOF()) { - if (std::abs(candidate.tofNSigmaKa()) < cfg_Track_TOFPID_nSig) - tofPIDPassed = true; - else + if (std::abs(candidate.tofNSigmaKa()) < cfgTrackTOFPIDnSig) { tofPIDPassed = true; + } + } else { + tofPIDPassed = true; } // TPC & TOF - if (tpcPIDPassed && tofPIDPassed) + if (tpcPIDPassed && tofPIDPassed) { + if (cfgTrackCutQA) { + histos.fill(HIST("QA_nSigma_kaon_TPC_AC"), candidate.pt(), candidate.tpcNSigmaKa()); + histos.fill(HIST("QA_nSigma_kaon_TOF_AC"), candidate.pt(), candidate.tofNSigmaKa()); + histos.fill(HIST("QA_kaon_TPC_TOF_AC"), candidate.tpcNSigmaKa(), candidate.tofNSigmaKa()); + } return true; - + } return false; } @@ -277,37 +296,48 @@ struct kstarInOO { { bool tpcPIDPassed{false}, tofPIDPassed{false}; // TPC - if (cfg_Track_CutQA) { - OOhistos.fill(HIST("QA_nSigma_pion_TPC"), candidate.pt(), candidate.tpcNSigmaPi()); - OOhistos.fill(HIST("QA_nSigma_pion_TOF"), candidate.pt(), candidate.tofNSigmaPi()); - OOhistos.fill(HIST("QA_pion_TPC_TOF"), candidate.tpcNSigmaPi(), candidate.tofNSigmaPi()); + if (cfgTrackCutQA) { + histos.fill(HIST("QA_nSigma_pion_TPC_BC"), candidate.pt(), candidate.tpcNSigmaPi()); + histos.fill(HIST("QA_nSigma_pion_TOF_BC"), candidate.pt(), candidate.tofNSigmaPi()); + histos.fill(HIST("QA_pion_TPC_TOF_BC"), candidate.tpcNSigmaPi(), candidate.tofNSigmaPi()); } - - if (std::abs(candidate.tpcNSigmaPi()) < cfg_Track_TPCPID_nSig) + if (std::abs(candidate.tpcNSigmaPi()) < cfgTrackTPCPIDnSig) tpcPIDPassed = true; if (candidate.hasTOF()) { - if (std::abs(candidate.tofNSigmaPi()) < cfg_Track_TOFPID_nSig) - tofPIDPassed = true; - else + if (std::abs(candidate.tofNSigmaPi()) < cfgTrackTOFPIDnSig) { tofPIDPassed = true; + } + } else { + tofPIDPassed = true; } // TPC & TOF - if (tpcPIDPassed && tofPIDPassed) + if (tpcPIDPassed && tofPIDPassed) { + if (cfgTrackCutQA) { + histos.fill(HIST("QA_nSigma_pion_TPC_AC"), candidate.pt(), candidate.tpcNSigmaPi()); + histos.fill(HIST("QA_nSigma_pion_TOF_AC"), candidate.pt(), candidate.tofNSigmaPi()); + histos.fill(HIST("QA_pion_TPC_TOF_AC"), candidate.tpcNSigmaPi(), candidate.tofNSigmaPi()); + } return true; - + } return false; } template - void TrackSlicing_MC(const CollisionType& collision1, const TracksType&, const CollisionType& collision2, const TracksType&, const bool IsMix) + void TrackSlicingMC(const CollisionType& collision1, const TracksType&, const CollisionType& collision2, const TracksType&, const bool IsMix) { - auto tracks1 = Kaon_MC->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); - auto tracks2 = Pion_MC->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); + auto tracks1 = kaonMC->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); + auto tracks2 = pionMC->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); auto centrality = collision1.centFT0C(); - for (auto& [trk1, trk2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { + for (const auto& [trk1, trk2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { + + if (!trackSelection(trk1) || !trackSelection(trk2)) + continue; + if (!trackPIDKaon(trk1) || !trackPIDPion(trk2)) + continue; + auto [KstarPt, Minv] = minvReconstruction(trk1, trk2); if (Minv < 0) continue; @@ -315,15 +345,15 @@ struct kstarInOO { double conjugate = trk1.sign() * trk2.sign(); if (!IsMix) { if (conjugate < 0) { - OOhistos.fill(HIST("hMC_USS"), centrality, KstarPt, Minv); + histos.fill(HIST("hMC_USS"), centrality, KstarPt, Minv); } else if (conjugate > 0) { - OOhistos.fill(HIST("hMC_LSS"), centrality, KstarPt, Minv); + histos.fill(HIST("hMC_LSS"), centrality, KstarPt, Minv); } } else { if (conjugate < 0) { - OOhistos.fill(HIST("hMC_USS_Mix"), centrality, KstarPt, Minv); + histos.fill(HIST("hMC_USS_Mix"), centrality, KstarPt, Minv); } else if (conjugate > 0) { - OOhistos.fill(HIST("hMC_LSS_Mix"), centrality, KstarPt, Minv); + histos.fill(HIST("hMC_LSS_Mix"), centrality, KstarPt, Minv); } } } @@ -336,19 +366,19 @@ struct kstarInOO { if (!trackSelection(trk1) || !trackSelection(trk2)) return {-1.0, -1.0}; + if (!trackPIDKaon(trk1) || !trackPIDPion(trk2)) return {-1.0, -1.0}; if (trk1.globalIndex() == trk2.globalIndex()) { - // std::cout<<"This happens"< cfg_Track_MaxEta) + if (std::abs(lResonance.Eta()) > cfgTrackMaxEta) return {-1.0, -1.0}; return {lResonance.Pt(), lResonance.M()}; @@ -360,26 +390,26 @@ struct kstarInOO { //| //======================================================= - int nEvents_MC = 0; - void processSameEvent_MC(EventCandidates::iterator const& collision, TrackCandidates_MC const& tracks, aod::McParticles const&) + int nEventsMC = 0; + void processSameEventMC(EventCandidates::iterator const& collision, TrackCandidatesMC const& tracks, aod::McParticles const&) { if (cDebugLevel > 0) { - nEvents_MC++; - if ((nEvents_MC + 1) % 10000 == 0) { - double histmem = OOhistos.getSize(); + nEventsMC++; + if ((nEventsMC + 1) % 10000 == 0) { + double histmem = histos.getSize(); std::cout << histmem << std::endl; - std::cout << "process_SameEvent_MC: " << nEvents_MC << std::endl; + std::cout << "process_SameEvent_MC: " << nEventsMC << std::endl; } } auto goodEv = eventSelection(collision); - OOhistos.fill(HIST("nEvents_MC"), 0.5); + histos.fill(HIST("nEvents_MC"), 0.5); if (!goodEv) return; bool INELgt0 = false; for (const auto& track : tracks) { - if (std::fabs(track.eta()) < cfg_Track_MaxEta) { + if (std::fabs(track.eta()) < cfgTrackMaxEta) { INELgt0 = true; break; } @@ -387,11 +417,11 @@ struct kstarInOO { if (!INELgt0) return; - OOhistos.fill(HIST("nEvents_MC"), 1.5); - TrackSlicing_MC(collision, tracks, collision, tracks, false); + histos.fill(HIST("nEvents_MC"), 1.5); + TrackSlicingMC(collision, tracks, collision, tracks, false); } // processSameEvents_MC - PROCESS_SWITCH(kstarInOO, processSameEvent_MC, "process Same Event MC", true); + PROCESS_SWITCH(kstarInOO, processSameEventMC, "process Same Event MC", true); //======================================================= //| @@ -399,32 +429,32 @@ struct kstarInOO { //| //======================================================= - int nEvents_MC_Mix = 0; - void processMixedEvent_MC(EventCandidates const& collisions, TrackCandidates_MC const& tracks, aod::McParticles const&) + int nEventsMCMix = 0; + void processMixedEventMC(EventCandidates const& collisions, TrackCandidatesMC const& tracks, aod::McParticles const&) { auto tracksTuple = std::make_tuple(tracks); - BinningType colBinning{{cfg_bins_MixVtx, cfg_bins_MixMult}, true}; // true is for 'ignore overflows' (true by default) - SameKindPair pairs{colBinning, cfg_Mix_NMixedEvents, -1, collisions, tracksTuple, &cache}; + BinningType colBinning{{cfgBinsMixVtx, cfgBinsMixMult}, true}; // true is for 'ignore overflows' (true by default) + SameKindPair pairs{colBinning, cfgMixNMixedEvents, -1, collisions, tracksTuple, &cache}; for (const auto& [collision1, tracks1, collision2, tracks2] : pairs) { if (cDebugLevel > 0) { - nEvents_MC_Mix++; - if ((nEvents_MC_Mix + 1) % 10000 == 0) { - std::cout << "Processed Mixed Events: " << nEvents_MC_Mix << std::endl; + nEventsMCMix++; + if ((nEventsMCMix + 1) % 10000 == 0) { + std::cout << "Processed Mixed Events: " << nEventsMCMix << std::endl; } } auto goodEv1 = eventSelection(collision1); auto goodEv2 = eventSelection(collision2); - OOhistos.fill(HIST("nEvents_MC_Mix"), 0.5); + histos.fill(HIST("nEvents_MC_Mix"), 0.5); if (!goodEv1 || !goodEv2) continue; - OOhistos.fill(HIST("nEvents_MC_Mix"), 1.5); + histos.fill(HIST("nEvents_MC_Mix"), 1.5); - TrackSlicing_MC(collision1, tracks1, collision2, tracks2, true); + TrackSlicingMC(collision1, tracks1, collision2, tracks2, true); } // mixing } // processMixedEvent_MC - PROCESS_SWITCH(kstarInOO, processMixedEvent_MC, "process Mixed Event MC", false); + PROCESS_SWITCH(kstarInOO, processMixedEventMC, "process Mixed Event MC", false); void processEventsDummy(EventCandidates::iterator const&, TrackCandidates const&) { From 7822fe1d0c55c150280450b0c16182a4718538d9 Mon Sep 17 00:00:00 2001 From: Yunfan Liu Date: Wed, 6 Aug 2025 18:14:17 +0800 Subject: [PATCH 255/345] [PWGCF,PWGHF] Add a task for p-Dplus correlations in femtodream (#12102) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: ALICE Action Bot Co-authored-by: BiaoZhang (张彪) <52267892+zhangbiao-phy@users.noreply.github.com> --- PWGCF/DataModel/FemtoDerived.h | 5 +- PWGCF/FemtoDream/Core/femtoDreamContainer.h | 8 +- PWGCF/FemtoDream/Core/femtoDreamUtils.h | 3 + .../HFC/TableProducer/femtoDreamProducer.cxx | 244 +++++++++++++----- .../HFC/Tasks/taskCharmHadronsFemtoDream.cxx | 211 ++++++++------- 5 files changed, 310 insertions(+), 161 deletions(-) diff --git a/PWGCF/DataModel/FemtoDerived.h b/PWGCF/DataModel/FemtoDerived.h index 4caf0166303..7475a70a5a5 100644 --- a/PWGCF/DataModel/FemtoDerived.h +++ b/PWGCF/DataModel/FemtoDerived.h @@ -208,7 +208,8 @@ namespace fdhf enum CharmHadronMassHypo { wrongParticle = 0, lcToPKPi = 1, - lcToPiKP = 2 + lcToPiKP = 2, + dplusToPiKPi = 4 }; DECLARE_SOA_COLUMN(GIndexCol, gIndexCol, int); //! Global index for the collision DECLARE_SOA_COLUMN(TimeStamp, timeStamp, int64_t); //! Timestamp for the collision @@ -227,7 +228,7 @@ DECLARE_SOA_COLUMN(Prong2Eta, prong2Eta, float); //! Track et DECLARE_SOA_COLUMN(Prong0Phi, prong0Phi, float); //! Track phi of charm hadron prong0 DECLARE_SOA_COLUMN(Prong1Phi, prong1Phi, float); //! Track phi of charm hadron prong1 DECLARE_SOA_COLUMN(Prong2Phi, prong2Phi, float); //! Track phi of charm hadron prong2 -DECLARE_SOA_COLUMN(CandidateSelFlag, candidateSelFlag, int8_t); //! Selection of mass hypothesis for charm hadron (1 for Lc -> pkpi, 2 for Lc -> pikp) +DECLARE_SOA_COLUMN(CandidateSelFlag, candidateSelFlag, int8_t); //! Selection of mass hypothesis for charm hadron (1 for Lc -> pkpi, 2 for Lc -> pikp, 4 for D+ -> pikpi) DECLARE_SOA_COLUMN(BDTBkg, bdtBkg, float); //! Background score using Boosted Decision Tree for charm hadron DECLARE_SOA_COLUMN(BDTPrompt, bdtPrompt, float); //! Prompt signal score using Boosted Decision Tree for charm hadron DECLARE_SOA_COLUMN(BDTFD, bdtFD, float); //! Feed-down score using Boosted Decision Tree for charm hadron diff --git a/PWGCF/FemtoDream/Core/femtoDreamContainer.h b/PWGCF/FemtoDream/Core/femtoDreamContainer.h index 5e0222a4f07..3d95fc08311 100644 --- a/PWGCF/FemtoDream/Core/femtoDreamContainer.h +++ b/PWGCF/FemtoDream/Core/femtoDreamContainer.h @@ -202,10 +202,12 @@ class FemtoDreamContainer { const float kT = FemtoDreamMath::getkT(part1, mMassOne, part2, mMassTwo); if constexpr (isHF) { - float mP2; - if (part2.candidateSelFlag() == o2::aod::fdhf::lcToPKPi) { + float mP2 = 0.0; + if (part2.candidateSelFlag() == o2::aod::fdhf::dplusToPiKPi) { + mP2 = part2.m(std::array{o2::constants::physics::MassPiPlus, o2::constants::physics::MassKPlus, o2::constants::physics::MassPiPlus}); + } else if (part2.candidateSelFlag() == o2::aod::fdhf::lcToPKPi) { mP2 = part2.m(std::array{o2::constants::physics::MassProton, o2::constants::physics::MassKPlus, o2::constants::physics::MassPiPlus}); - } else { + } else if (part2.candidateSelFlag() == o2::aod::fdhf::lcToPiKP) { mP2 = part2.m(std::array{o2::constants::physics::MassPiPlus, o2::constants::physics::MassKPlus, o2::constants::physics::MassProton}); } mHistogramRegistry->fill(HIST(mFolderSuffix[mEventType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST("/relPairkstarmP2"), femtoObs, mP2); diff --git a/PWGCF/FemtoDream/Core/femtoDreamUtils.h b/PWGCF/FemtoDream/Core/femtoDreamUtils.h index c5db8dcc70e..f9bb60633f3 100644 --- a/PWGCF/FemtoDream/Core/femtoDreamUtils.h +++ b/PWGCF/FemtoDream/Core/femtoDreamUtils.h @@ -52,6 +52,9 @@ inline float getMass(int pdgCode) case o2::constants::physics::Pdg::kPhi: mass = o2::constants::physics::MassPhi; break; + case o2::constants::physics::Pdg::kDPlus: + mass = o2::constants::physics::MassDPlus; + break; case o2::constants::physics::Pdg::kLambdaCPlus: mass = o2::constants::physics::MassLambdaCPlus; break; diff --git a/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx b/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx index a605bc74f6c..5502b7e302f 100644 --- a/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx +++ b/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx @@ -13,6 +13,7 @@ /// \brief Tasks that produces the track tables used for the pairing /// \author Ravindra Singh, GSI, ravindra.singh@cern.ch /// \author Biao Zhang, Heidelberg University, biao.zhang@cern.ch +/// \author Yunfan Liu, Central China Normal University, yunfan.l@cern.ch #include "PWGCF/DataModel/FemtoDerived.h" #include "PWGCF/FemtoDream/Core/femtoDreamSelection.h" @@ -21,6 +22,7 @@ #include "PWGHF/Core/CentralityEstimation.h" #include "PWGHF/Core/DecayChannels.h" #include "PWGHF/Core/HfHelper.h" +#include "PWGHF/Core/HfMlResponseDplusToPiKPi.h" #include "PWGHF/Core/HfMlResponseLcToPKPi.h" #include "PWGHF/Core/SelectorCuts.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" @@ -87,6 +89,11 @@ enum MlMode : uint8_t { FillMlFromNewBDT }; +// decay channels +enum DecayChannel { DplusToPiKPi = 0, + LcToPKPi +}; + struct HfFemtoDreamProducer { Produces outputCollision; @@ -119,9 +126,9 @@ struct HfFemtoDreamProducer { Configurable isDebug{"isDebug", true, "Enable Debug tables"}; Configurable isRun3{"isRun3", true, "Running on Run3 or pilot"}; - /// Lc table - Configurable selectionFlagLc{"selectionFlagLc", 1, "Selection Flag for Lc"}; - Configurable useCent{"useCent", false, "Enable centrality for lc"}; + /// Charm hadron table + Configurable selectionFlagHadron{"selectionFlagHadron", 1, "Selection Flag for Charm Hadron: 1 for Lc, 7 for Dplus (Topologic and PID cuts)"}; + Configurable useCent{"useCent", false, "Enable centrality for Charm Hadron"}; Configurable trkPDGCode{"trkPDGCode", 2212, "PDG code of the selected track for Monte Carlo truth"}; Configurable> trkCharge{FemtoDreamTrackSelection::getSelectionName(femtoDreamTrackSelection::kSign, "trk"), std::vector{-1, 1}, FemtoDreamTrackSelection::getSelectionHelper(femtoDreamTrackSelection::kSign, "Track selection: ")}; @@ -141,7 +148,7 @@ struct HfFemtoDreamProducer { Configurable> trkITSnclsIbMin{FemtoDreamTrackSelection::getSelectionName(femtoDreamTrackSelection::kITSnClsIbMin, "trk"), std::vector{-1.f, 1.f}, FemtoDreamTrackSelection::getSelectionHelper(femtoDreamTrackSelection::kITSnClsIbMin, "Track selection: ")}; Configurable> trkITSnclsMin{FemtoDreamTrackSelection::getSelectionName(femtoDreamTrackSelection::kITSnClsMin, "trk"), std::vector{-1.f, 2.f, 4.f}, FemtoDreamTrackSelection::getSelectionHelper(femtoDreamTrackSelection::kITSnClsMin, "Track selection: ")}; // ML inference - Configurable applyMlMode{"applyMlMode", 1, "None: 0, BDT model from Lc selector: 1, New BDT model on Top of Lc selector: 2"}; + Configurable applyMlMode{"applyMlMode", 1, "None: 0, BDT model from candidate selector: 1, New BDT model on Top of candidate selector: 2"}; Configurable> binsPtMl{"binsPtMl", std::vector{hf_cuts_ml::vecBinsPt}, "pT bin limits for ML application"}; Configurable> cutDirMl{"cutDirMl", std::vector{hf_cuts_ml::vecCutDir}, "Whether to reject score values greater or smaller than the threshold"}; Configurable> cutsMl{"cutsMl", {hf_cuts_ml::Cuts[0], hf_cuts_ml::NBinsPt, hf_cuts_ml::NCutScores, hf_cuts_ml::labelsPt, hf_cuts_ml::labelsCutScore}, "ML selections per pT bin"}; @@ -152,6 +159,8 @@ struct HfFemtoDreamProducer { HfHelper hfHelper; o2::analysis::HfMlResponseLcToPKPi hfMlResponse; + o2::analysis::HfMlResponseDplusToPiKPi hfMlResponseDplus; + std::vector outputMlDplus = {}; std::vector outputMlPKPi = {}; std::vector outputMlPiKP = {}; o2::ccdb::CcdbApi ccdbApi; @@ -162,6 +171,8 @@ struct HfFemtoDreamProducer { float magField; int runNumber; + using CandidateDplus = soa::Join; + using CandidateDplusMc = soa::Join; using CandidateLc = soa::Join; using CandidateLcMc = soa::Join; @@ -176,14 +187,16 @@ struct HfFemtoDreamProducer { using GeneratedMc = soa::Filtered>; - Filter filterSelectCandidateLc = (aod::hf_sel_candidate_lc::isSelLcToPKPi >= selectionFlagLc || aod::hf_sel_candidate_lc::isSelLcToPiKP >= selectionFlagLc); + Filter filterSelectCandidateDplus = (aod::hf_sel_candidate_dplus::isSelDplusToPiKPi >= selectionFlagHadron || aod::hf_sel_candidate_dplus::isSelDplusToPiKPi >= selectionFlagHadron); + Filter filterSelectCandidateLc = (aod::hf_sel_candidate_lc::isSelLcToPKPi >= selectionFlagHadron || aod::hf_sel_candidate_lc::isSelLcToPiKP >= selectionFlagHadron); HistogramRegistry qaRegistry{"QAHistos", {}, OutputObjHandlingPolicy::AnalysisObject}; HistogramRegistry trackRegistry{"Tracks", {}, OutputObjHandlingPolicy::AnalysisObject}; void init(InitContext&) { - std::array processes = {doprocessDataCharmHad, doprocessMcCharmHad, doprocessDataCharmHadWithML, doprocessMcCharmHadWithML, doprocessMcCharmHadGen}; + std::array processes = {doprocessDataDplusToPiKPi, doprocessMcDplusToPiKPi, doprocessDataDplusToPiKPiWithML, doprocessMcDplusToPiKPiWithML, doprocessMcDplusToPiKPiGen, + doprocessDataLcToPKPi, doprocessMcLcToPKPi, doprocessDataLcToPKPiWithML, doprocessMcLcToPKPiWithML, doprocessMcLcToPKPiGen}; if (std::accumulate(processes.begin(), processes.end(), 0) != 1) { LOGP(fatal, "One and only one process function must be enabled at a time."); } @@ -404,7 +417,7 @@ struct HfFemtoDreamProducer { return fIsTrackFilled; } - template + template void fillCharmHadronTable(CollisionType const& col, TrackType const& tracks, CandType const& candidates) { const auto vtxZ = col.posZ(); @@ -451,44 +464,15 @@ struct HfFemtoDreamProducer { bool isTrackFilled = false; bool isSelectedMlLcToPKPi = true; bool isSelectedMlLcToPiKP = true; + bool isSelectedMlDplusToPiKPi = true; for (const auto& candidate : candidates) { + outputMlDplus = {-1.0f, -1.0f, -1.0f}; outputMlPKPi = {-1.0f, -1.0f, -1.0f}; outputMlPiKP = {-1.0f, -1.0f, -1.0f}; auto trackPos1 = candidate.template prong0_as(); // positive daughter (negative for the antiparticles) auto trackNeg = candidate.template prong1_as(); // negative daughter (positive for the antiparticles) auto trackPos2 = candidate.template prong2_as(); // positive daughter (negative for the antiparticles) - if constexpr (useCharmMl) { - /// fill with ML information - /// BDT index 0: bkg score; BDT index 1: prompt score; BDT index 2: non-prompt score - if (applyMlMode == FillMlFromSelector) { - if (candidate.mlProbLcToPKPi().size() > 0) { - outputMlPKPi.at(0) = candidate.mlProbLcToPKPi()[0]; /// bkg score - outputMlPKPi.at(1) = candidate.mlProbLcToPKPi()[1]; /// prompt score - outputMlPKPi.at(2) = candidate.mlProbLcToPKPi()[2]; /// non-prompt score - } - if (candidate.mlProbLcToPiKP().size() > 0) { - outputMlPiKP.at(0) = candidate.mlProbLcToPiKP()[0]; /// bkg score - outputMlPiKP.at(1) = candidate.mlProbLcToPiKP()[1]; /// prompt score - outputMlPiKP.at(2) = candidate.mlProbLcToPiKP()[2]; /// non-prompt score - } - } else if (applyMlMode == FillMlFromNewBDT) { - isSelectedMlLcToPKPi = false; - isSelectedMlLcToPiKP = false; - if (candidate.mlProbLcToPKPi().size() > 0) { - std::vector inputFeaturesLcToPKPi = hfMlResponse.getInputFeatures(candidate, true); - isSelectedMlLcToPKPi = hfMlResponse.isSelectedMl(inputFeaturesLcToPKPi, candidate.pt(), outputMlPKPi); - } - if (candidate.mlProbLcToPiKP().size() > 0) { - std::vector inputFeaturesLcToPiKP = hfMlResponse.getInputFeatures(candidate, false); - isSelectedMlLcToPiKP = hfMlResponse.isSelectedMl(inputFeaturesLcToPiKP, candidate.pt(), outputMlPKPi); - } - if (!isSelectedMlLcToPKPi && !isSelectedMlLcToPiKP) - continue; - } else { - LOGF(fatal, "Please check your Ml configuration!!"); - } - } auto bc = col.template bc_as(); int64_t timeStamp = bc.timestamp(); auto fillTable = [&](int CandFlag, @@ -526,8 +510,65 @@ struct HfFemtoDreamProducer { } } }; - fillTable(0, candidate.isSelLcToPKPi(), outputMlPKPi.at(0), outputMlPKPi.at(1), outputMlPKPi.at(2)); - fillTable(1, candidate.isSelLcToPiKP(), outputMlPiKP.at(0), outputMlPiKP.at(1), outputMlPiKP.at(2)); + if constexpr (channel == DecayChannel::DplusToPiKPi) { + if constexpr (useCharmMl) { + /// fill with ML information + /// BDT index 0: bkg score; BDT index 1: prompt score; BDT index 2: non-prompt score + if (applyMlMode == FillMlFromSelector) { + if (candidate.mlProbDplusToPiKPi().size() > 0) { + outputMlDplus.at(0) = candidate.mlProbDplusToPiKPi()[0]; /// bkg score + outputMlDplus.at(1) = candidate.mlProbDplusToPiKPi()[1]; /// prompt score + outputMlDplus.at(2) = candidate.mlProbDplusToPiKPi()[2]; /// non-prompt score + } + } else if (applyMlMode == FillMlFromNewBDT) { + isSelectedMlDplusToPiKPi = false; + if (candidate.mlProbDplusToPiKPi().size() > 0) { + std::vector inputFeaturesDplusToPiKPi = hfMlResponseDplus.getInputFeatures(candidate); + isSelectedMlDplusToPiKPi = hfMlResponseDplus.isSelectedMl(inputFeaturesDplusToPiKPi, candidate.pt(), outputMlDplus); + } + if (!isSelectedMlDplusToPiKPi) + continue; + } else { + LOGF(fatal, "Please check your Ml configuration!!"); + } + } + fillTable(2, candidate.isSelDplusToPiKPi(), outputMlDplus.at(0), outputMlDplus.at(1), outputMlDplus.at(2)); + + } else if constexpr (channel == DecayChannel::LcToPKPi) { + if constexpr (useCharmMl) { + /// fill with ML information + /// BDT index 0: bkg score; BDT index 1: prompt score; BDT index 2: non-prompt score + if (applyMlMode == FillMlFromSelector) { + if (candidate.mlProbLcToPKPi().size() > 0) { + outputMlPKPi.at(0) = candidate.mlProbLcToPKPi()[0]; /// bkg score + outputMlPKPi.at(1) = candidate.mlProbLcToPKPi()[1]; /// prompt score + outputMlPKPi.at(2) = candidate.mlProbLcToPKPi()[2]; /// non-prompt score + } + if (candidate.mlProbLcToPiKP().size() > 0) { + outputMlPiKP.at(0) = candidate.mlProbLcToPiKP()[0]; /// bkg score + outputMlPiKP.at(1) = candidate.mlProbLcToPiKP()[1]; /// prompt score + outputMlPiKP.at(2) = candidate.mlProbLcToPiKP()[2]; /// non-prompt score + } + } else if (applyMlMode == FillMlFromNewBDT) { + isSelectedMlLcToPKPi = false; + isSelectedMlLcToPiKP = false; + if (candidate.mlProbLcToPKPi().size() > 0) { + std::vector inputFeaturesLcToPKPi = hfMlResponse.getInputFeatures(candidate, true); + isSelectedMlLcToPKPi = hfMlResponse.isSelectedMl(inputFeaturesLcToPKPi, candidate.pt(), outputMlPKPi); + } + if (candidate.mlProbLcToPiKP().size() > 0) { + std::vector inputFeaturesLcToPiKP = hfMlResponse.getInputFeatures(candidate, false); + isSelectedMlLcToPiKP = hfMlResponse.isSelectedMl(inputFeaturesLcToPiKP, candidate.pt(), outputMlPKPi); + } + if (!isSelectedMlLcToPKPi && !isSelectedMlLcToPiKP) + continue; + } else { + LOGF(fatal, "Please check your Ml configuration!!"); + } + } + fillTable(0, candidate.isSelLcToPKPi(), outputMlPKPi.at(0), outputMlPKPi.at(1), outputMlPKPi.at(2)); + fillTable(1, candidate.isSelLcToPiKP(), outputMlPiKP.at(0), outputMlPiKP.at(1), outputMlPiKP.at(2)); + } } if (!isTrackFilled) { @@ -571,22 +612,97 @@ struct HfFemtoDreamProducer { return true; } - template + template void fillCharmHadMcGen(ParticleType particles) { // Filling particle properties rowCandCharmHadGen.reserve(particles.size()); - for (const auto& particle : particles) { - if (std::abs(particle.flagMcMatchGen()) == hf_decay::hf_cand_3prong::DecayChannelMain::LcToPKPi) { - rowCandCharmHadGen( - particle.mcCollisionId(), - particle.flagMcMatchGen(), - particle.originMcGen()); + if constexpr (channel == DecayChannel::DplusToPiKPi) { + for (const auto& particle : particles) { + if (std::abs(particle.flagMcMatchGen()) == hf_decay::hf_cand_3prong::DecayChannelMain::DplusToPiKPi) { + rowCandCharmHadGen( + particle.mcCollisionId(), + particle.flagMcMatchGen(), + particle.originMcGen()); + } + } + } else if constexpr (channel == DecayChannel::LcToPKPi) { + for (const auto& particle : particles) { + if (std::abs(particle.flagMcMatchGen()) == hf_decay::hf_cand_3prong::DecayChannelMain::LcToPKPi) { + rowCandCharmHadGen( + particle.mcCollisionId(), + particle.flagMcMatchGen(), + particle.originMcGen()); + } } } } - void processDataCharmHad(FemtoFullCollision const& col, + /// DplusToPiKPi + void processDataDplusToPiKPi(FemtoFullCollision const& col, + aod::BCsWithTimestamps const&, + FemtoHFTracks const& tracks, + soa::Filtered const& candidates) + { + // get magnetic field for run + getMagneticFieldTesla(col.bc_as()); + + fillCharmHadronTable(col, tracks, candidates); + } + PROCESS_SWITCH(HfFemtoDreamProducer, processDataDplusToPiKPi, + "Provide experimental data for DplusToPiKPi femto", false); + + void processDataDplusToPiKPiWithML(FemtoFullCollision const& col, + aod::BCsWithTimestamps const&, + FemtoHFTracks const& tracks, + soa::Filtered> const& candidates) + { + + // get magnetic field for run + getMagneticFieldTesla(col.bc_as()); + + fillCharmHadronTable(col, tracks, candidates); + } + PROCESS_SWITCH(HfFemtoDreamProducer, processDataDplusToPiKPiWithML, + "Provide experimental data for DplusToPiKPi with ml", false); + + void processMcDplusToPiKPi(FemtoFullCollisionMc const& col, + aod::BCsWithTimestamps const&, + FemtoHFMcTracks const& tracks, + aod::McParticles const&, + CandidateDplusMc const& candidates) + { + // get magnetic field for run + getMagneticFieldTesla(col.bc_as()); + + fillCharmHadronTable(col, tracks, candidates); + } + PROCESS_SWITCH(HfFemtoDreamProducer, processMcDplusToPiKPi, "Provide Mc for DplusToPiKPi", false); + + void processMcDplusToPiKPiWithML(FemtoFullCollisionMc const& col, + aod::BCsWithTimestamps const&, + FemtoHFMcTracks const& tracks, + aod::McParticles const&, + soa::Join const& candidates) + { + // get magnetic field for run + getMagneticFieldTesla(col.bc_as()); + + fillCharmHadronTable(col, tracks, candidates); + } + PROCESS_SWITCH(HfFemtoDreamProducer, processMcDplusToPiKPiWithML, "Provide Mc for DplusToPiKPi with ml", false); + + void processMcDplusToPiKPiGen(GeneratedMc const& particles) + { + + fillCharmHadMcGen(particles); + } + PROCESS_SWITCH(HfFemtoDreamProducer, processMcDplusToPiKPiGen, "Provide Mc Generated DplusToPiKPi", false); + + /// LcToPKPi + void processDataLcToPKPi(FemtoFullCollision const& col, aod::BCsWithTimestamps const&, FemtoHFTracks const& tracks, soa::Filtered const& candidates) @@ -594,12 +710,12 @@ struct HfFemtoDreamProducer { // get magnetic field for run getMagneticFieldTesla(col.bc_as()); - fillCharmHadronTable(col, tracks, candidates); + fillCharmHadronTable(col, tracks, candidates); } - PROCESS_SWITCH(HfFemtoDreamProducer, processDataCharmHad, - "Provide experimental data for charm hadron femto", false); + PROCESS_SWITCH(HfFemtoDreamProducer, processDataLcToPKPi, + "Provide experimental data for Lc(PKPi)-proton femto", false); - void processDataCharmHadWithML(FemtoFullCollision const& col, + void processDataLcToPKPiWithML(FemtoFullCollision const& col, aod::BCsWithTimestamps const&, FemtoHFTracks const& tracks, soa::Filtered()); - fillCharmHadronTable(col, tracks, candidates); + fillCharmHadronTable(col, tracks, candidates); } - PROCESS_SWITCH(HfFemtoDreamProducer, processDataCharmHadWithML, - "Provide experimental data for charm hadron femto with ml", false); + PROCESS_SWITCH(HfFemtoDreamProducer, processDataLcToPKPiWithML, + "Provide experimental data for Lc(PKPi)-proton femto with ml", false); - void processMcCharmHad(FemtoFullCollisionMc const& col, + void processMcLcToPKPi(FemtoFullCollisionMc const& col, aod::BCsWithTimestamps const&, FemtoHFMcTracks const& tracks, aod::McParticles const&, @@ -623,11 +739,11 @@ struct HfFemtoDreamProducer { // get magnetic field for run getMagneticFieldTesla(col.bc_as()); - fillCharmHadronTable(col, tracks, candidates); + fillCharmHadronTable(col, tracks, candidates); } - PROCESS_SWITCH(HfFemtoDreamProducer, processMcCharmHad, "Provide Mc for charm hadron", false); + PROCESS_SWITCH(HfFemtoDreamProducer, processMcLcToPKPi, "Provide Mc for lctopkpi", false); - void processMcCharmHadWithML(FemtoFullCollisionMc const& col, + void processMcLcToPKPiWithML(FemtoFullCollisionMc const& col, aod::BCsWithTimestamps const&, FemtoHFMcTracks const& tracks, aod::McParticles const&, @@ -637,16 +753,16 @@ struct HfFemtoDreamProducer { // get magnetic field for run getMagneticFieldTesla(col.bc_as()); - fillCharmHadronTable(col, tracks, candidates); + fillCharmHadronTable(col, tracks, candidates); } - PROCESS_SWITCH(HfFemtoDreamProducer, processMcCharmHadWithML, "Provide Mc for charm hadron with ml", false); + PROCESS_SWITCH(HfFemtoDreamProducer, processMcLcToPKPiWithML, "Provide Mc for lctopkpi with ml", false); - void processMcCharmHadGen(GeneratedMc const& particles) + void processMcLcToPKPiGen(GeneratedMc const& particles) { - fillCharmHadMcGen(particles); + fillCharmHadMcGen(particles); } - PROCESS_SWITCH(HfFemtoDreamProducer, processMcCharmHadGen, "Provide Mc Generated charm hadron", false); + PROCESS_SWITCH(HfFemtoDreamProducer, processMcLcToPKPiGen, "Provide Mc Generated lctopkpi", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGHF/HFC/Tasks/taskCharmHadronsFemtoDream.cxx b/PWGHF/HFC/Tasks/taskCharmHadronsFemtoDream.cxx index bd9c2679ff5..3644cd3ed3c 100644 --- a/PWGHF/HFC/Tasks/taskCharmHadronsFemtoDream.cxx +++ b/PWGHF/HFC/Tasks/taskCharmHadronsFemtoDream.cxx @@ -9,10 +9,11 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// \file taskCharmHadronsFemtoDream.cxx.cxx +/// \file taskCharmHadronsFemtoDream.cxx /// \brief Tasks that reads the track tables used for the pairing and builds pairs of two tracks /// \author Ravindra SIngh, GSI, ravindra.singh@cern.ch /// \author Biao Zhang, Heidelberg University, biao.zhang@cern.ch +/// \author Yunfan Liu, Central China Normal University, yunfan.l@cern.ch #include "PWGCF/DataModel/FemtoDerived.h" #include "PWGCF/FemtoDream/Core/femtoDreamContainer.h" @@ -43,6 +44,7 @@ #include #include #include +#include using namespace o2; using namespace o2::aod; @@ -51,6 +53,11 @@ using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::analysis::femtoDream; +inline o2::framework::expressions::Node coshEta(o2::framework::expressions::Node&& eta) +{ + return (nexp(std::move(eta)) + nexp(0.0f - std::move(eta))) * 0.5f; +} + struct HfTaskCharmHadronsFemtoDream { enum TrackCharge { @@ -58,27 +65,14 @@ struct HfTaskCharmHadronsFemtoDream { NegativeCharge = -1 }; - /// Binning configurables - ConfigurableAxis bin4Dkstar{"bin4Dkstar", {1500, 0., 6.}, "binning kstar for the 4Dimensional plot: k* vs multiplicity vs multiplicity percentile vs mT (set <> to true in order to use)"}; - ConfigurableAxis bin4DMult{"bin4Dmult", {VARIABLE_WIDTH, 0.0f, 4.0f, 8.0f, 12.0f, 16.0f, 20.0f, 24.0f, 28.0f, 32.0f, 36.0f, 40.0f, 44.0f, 48.0f, 52.0f, 56.0f, 60.0f, 64.0f, 68.0f, 72.0f, 76.0f, 80.0f, 84.0f, 88.0f, 92.0f, 96.0f, 100.0f, 200.0f}, "multiplicity Binning for the 4Dimensional plot: k* vs multiplicity vs multiplicity percentile vs mT (set <> to true in order to use)"}; - ConfigurableAxis bin4DmT{"bin4DmT", {VARIABLE_WIDTH, 1.02f, 1.14f, 1.20f, 1.26f, 1.38f, 1.56f, 1.86f, 4.50f}, "mT Binning for the 4Dimensional plot: k* vs multiplicity vs multiplicity percentile vs mT (set <> to true in order to use)"}; - ConfigurableAxis bin4DmultPercentile{"bin4DmultPercentile", {10, 0.0f, 100.0f}, "multiplicity percentile Binning for the 4Dimensional plot: k* vs multiplicity vs multiplicity percentile vs mT (set <> to true in order to use)"}; - ConfigurableAxis binInvMass{"binInvMass", {400, 2.10, 2.50}, "InvMass binning"}; - ConfigurableAxis binpTCharm{"binpTCharm", {360, 0, 36}, "pT binning of charm hadron"}; - ConfigurableAxis binTempFitVarTrack{"binTempFitVarTrack", {300, -0.15, 0.15}, "binning of the TempFitVar in the pT vs. TempFitVar plot (Track)"}; - ConfigurableAxis binmT{"binmT", {225, 0., 7.5}, "binning mT"}; - ConfigurableAxis binmultTempFit{"binmultTempFit", {1, 0, 1}, "multiplicity Binning for the TempFitVar plot"}; - ConfigurableAxis binMulPercentile{"binMulPercentile", {10, 0.0f, 100.0f}, "multiplicity percentile Binning"}; - ConfigurableAxis binpTTrack{"binpTTrack", {50, 0.5, 10.05}, "pT binning of the pT vs. TempFitVar plot (Track)"}; - ConfigurableAxis binEta{"binEta", {{200, -1.5, 1.5}}, "eta binning"}; - ConfigurableAxis binPhi{"binPhi", {{200, 0, TMath::TwoPi()}}, "phi binning"}; - ConfigurableAxis binkT{"binkT", {150, 0., 9.}, "binning kT"}; - ConfigurableAxis binkstar{"binkstar", {1500, 0., 6.}, "binning kstar"}; - ConfigurableAxis binNSigmaTPC{"binNSigmaTPC", {1600, -8, 8}, "Binning of Nsigma TPC plot"}; - ConfigurableAxis binNSigmaTOF{"binNSigmaTOF", {3000, -15, 15}, "Binning of the Nsigma TOF plot"}; - ConfigurableAxis binNSigmaTPCTOF{"binNSigmaTPCTOF", {3000, -15, 15}, "Binning of the Nsigma TPC+TOF plot"}; - ConfigurableAxis binTPCClusters{"binTPCClusters", {163, -0.5, 162.5}, "Binning of TPC found clusters plot"}; - Configurable ConfTempFitVarMomentum{"ConfTempFitVarMomentum", 0, "Momentum used for binning: 0 -> pt; 1 -> preco; 2 -> ptpc"}; + constexpr static int OriginRecPrompt = 1; + constexpr static int OriginRecFD = 2; + + Produces rowFemtoResultCharm; + Produces rowFemtoResultTrk; + Produces rowFemtoResultColl; + + Configurable confTempFitVarMomentum{"confTempFitVarMomentum", 0, "Momentum used for binning: 0 -> pt; 1 -> preco; 2 -> ptpc"}; /// Particle 2 (Charm Hadrons) Configurable charmHadBkgBDTmax{"charmHadBkgBDTmax", 1., "Maximum background bdt score for Charm Hadron (particle 2)"}; @@ -104,14 +98,10 @@ struct HfTaskCharmHadronsFemtoDream { Configurable smearingByOrigin{"smearingByOrigin", false, "Obtain the smearing matrix differential in the MC origin of particle 1 and particle 2. High memory consumption. Use with care!"}; Configurable use4D{"use4D", false, "Enable four dimensional histogramms (to be used only for analysis with high statistics): k* vs multiplicity vs multiplicity percentil vs mT"}; Configurable useCPR{"useCPR", false, "Close Pair Rejection"}; - ConfigurableAxis dummy{"dummy", {1, 0, 1}, "dummy axis"}; // Mixing configurables - ConfigurableAxis mixingBinMult{"mixingBinMult", {VARIABLE_WIDTH, 0.0f, 20.0f, 60.0f, 200.0f}, "Mixing bins - multiplicity"}; - ConfigurableAxis mixingBinMultPercentile{"mixingBinMultPercentile", {VARIABLE_WIDTH, 0.0f, 100.f}, "Mixing bins - multiplicity percentile"}; - ConfigurableAxis mixingBinVztx{"mixingBinVztx", {VARIABLE_WIDTH, -10.0f, -4.f, 0.f, 4.f, 10.f}, "Mixing bins - z-vertex"}; - Configurable mixingDepth{"mixingDepth", 5, "Number of events for mixing"}; Configurable mixingBinPolicy{"mixingBinPolicy", 0, "Binning policy for mixing - 0: multiplicity, 1: multipliciy percentile, 2: both"}; + Configurable mixingDepth{"mixingDepth", 5, "Number of events for mixing"}; /// Event selection struct : ConfigurableGroup { @@ -133,23 +123,7 @@ struct HfTaskCharmHadronsFemtoDream { Configurable etaTrack1Min{"etaTrack1Min", -10., "Minimum eta of partricle 1 (Track)"}; Configurable ptTrack1Min{"ptTrack1Min", 0., "Minimum pT of partricle 1 (Track)"}; - ColumnBinningPolicy colBinningMult{{mixingBinVztx, mixingBinMult}, true}; - ColumnBinningPolicy colBinningMultPercentile{{mixingBinVztx, mixingBinMultPercentile}, true}; - ColumnBinningPolicy colBinningMultMultPercentile{{mixingBinVztx, mixingBinMult, mixingBinMultPercentile}, true}; - - FemtoDreamContainer sameEventCont; - FemtoDreamContainer mixedEventCont; - FemtoDreamPairCleaner pairCleaner; - FemtoDreamDetaDphiStar pairCloseRejectionSE; - FemtoDreamDetaDphiStar pairCloseRejectionME; - Filter eventMultiplicity = aod::femtodreamcollision::multNtr >= eventSel.multMin && aod::femtodreamcollision::multNtr <= eventSel.multMax; - Filter eventMultiplicityPercentile = aod::femtodreamcollision::multV0M >= eventSel.multPercentileMin && aod::femtodreamcollision::multV0M <= eventSel.multPercentileMax; - Filter hfCandSelFilter = aod::fdhf::candidateSelFlag >= static_cast(charmHadCandSel.value); - Filter hfMcSelFilter = nabs(aod::fdhf::flagMc) == static_cast(charmHadMcSel.value); - Filter trackEtaFilterLow = ifnode(aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kTrack), aod::femtodreamparticle::eta < etaTrack1Max, true); - Filter trackEtaFilterUp = ifnode(aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kTrack), aod::femtodreamparticle::eta > etaTrack1Min, true); - Filter trackPtFilterLow = ifnode(aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kTrack), aod::femtodreamparticle::pt < ptTrack1Max, true); - Filter trackPtFilterUp = ifnode(aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kTrack), aod::femtodreamparticle::pt > ptTrack1Min, true); + SliceCache cache; using FilteredCharmCands = soa::Filtered; using FilteredCharmCand = FilteredCharmCands::iterator; @@ -169,7 +143,66 @@ struct HfTaskCharmHadronsFemtoDream { using FilteredFDParticles = soa::Filtered>; using FilteredFDParticle = FilteredFDParticles::iterator; - femtodreamcollision::BitMaskType BitMask = 1 << 0; + Filter eventMultiplicity = aod::femtodreamcollision::multNtr >= eventSel.multMin && aod::femtodreamcollision::multNtr <= eventSel.multMax; + Filter eventMultiplicityPercentile = aod::femtodreamcollision::multV0M >= eventSel.multPercentileMin && aod::femtodreamcollision::multV0M <= eventSel.multPercentileMax; + Filter hfCandSelFilter = aod::fdhf::candidateSelFlag >= static_cast(charmHadCandSel.value); + Filter hfMcSelFilter = nabs(aod::fdhf::flagMc) == static_cast(charmHadMcSel.value); + Filter trackEtaFilterLow = ifnode(aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kTrack), aod::femtodreamparticle::eta < etaTrack1Max, true); + Filter trackEtaFilterUp = ifnode(aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kTrack), aod::femtodreamparticle::eta > etaTrack1Min, true); + Filter trackPtFilterLow = ifnode(aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kTrack), aod::femtodreamparticle::pt < ptTrack1Max, true); + Filter trackPtFilterUp = ifnode(aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kTrack), aod::femtodreamparticle::pt > ptTrack1Min, true); + + Preslice perCol = aod::femtodreamparticle::fdCollisionId; + + /// Partition for particle 1 + Partition partitionTrk1 = (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kTrack)) && (ncheckbit(aod::femtodreamparticle::cut, cutBitTrack1)) && ifnode(aod::femtodreamparticle::pt * coshEta(aod::femtodreamparticle::eta) <= pidThresTrack1, ncheckbit(aod::femtodreamparticle::pidcut, tpcBitTrack1), ncheckbit(aod::femtodreamparticle::pidcut, tpcTofBitTrack1)); + + Partition partitionMcTrk1 = (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kTrack)) && + (ncheckbit(aod::femtodreamparticle::cut, cutBitTrack1)) && + ifnode(aod::femtodreamparticle::pt * coshEta(aod::femtodreamparticle::eta) <= pidThresTrack1, ncheckbit(aod::femtodreamparticle::pidcut, tpcBitTrack1), ncheckbit(aod::femtodreamparticle::pidcut, tpcTofBitTrack1)); + + /// Partition for particle 2 + Partition partitionCharmHadron = aod::fdhf::bdtBkg < charmHadBkgBDTmax && aod::fdhf::bdtFD < charmHadFdBDTmax && aod::fdhf::bdtFD > charmHadFdBDTmin&& aod::fdhf::bdtPrompt charmHadPromptBDTmin; + Partition partitionMcCharmHadron = aod::fdhf::originMcRec == OriginRecPrompt || aod::fdhf::originMcRec == OriginRecFD; + + /// Axis configurables + ConfigurableAxis dummy{"dummy", {1, 0, 1}, "dummy axis"}; + /// Binning configurables + ConfigurableAxis bin4Dkstar{"bin4Dkstar", {1500, 0., 6.}, "binning kstar for the 4Dimensional plot: k* vs multiplicity vs multiplicity percentile vs mT (set <> to true in order to use)"}; + ConfigurableAxis bin4DMult{"bin4DMult", {VARIABLE_WIDTH, 0.0f, 4.0f, 8.0f, 12.0f, 16.0f, 20.0f, 24.0f, 28.0f, 32.0f, 36.0f, 40.0f, 44.0f, 48.0f, 52.0f, 56.0f, 60.0f, 64.0f, 68.0f, 72.0f, 76.0f, 80.0f, 84.0f, 88.0f, 92.0f, 96.0f, 100.0f, 200.0f}, "multiplicity Binning for the 4Dimensional plot: k* vs multiplicity vs multiplicity percentile vs mT (set <> to true in order to use)"}; + ConfigurableAxis bin4DmT{"bin4DmT", {VARIABLE_WIDTH, 1.02f, 1.14f, 1.20f, 1.26f, 1.38f, 1.56f, 1.86f, 4.50f}, "mT Binning for the 4Dimensional plot: k* vs multiplicity vs multiplicity percentile vs mT (set <> to true in order to use)"}; + ConfigurableAxis bin4DmultPercentile{"bin4DmultPercentile", {10, 0.0f, 100.0f}, "multiplicity percentile Binning for the 4Dimensional plot: k* vs multiplicity vs multiplicity percentile vs mT (set <> to true in order to use)"}; + ConfigurableAxis binInvMass{"binInvMass", {400, 2.10, 2.50}, "InvMass binning"}; + ConfigurableAxis binpTCharm{"binpTCharm", {360, 0, 36}, "pT binning of charm hadron"}; + ConfigurableAxis binTempFitVarTrack{"binTempFitVarTrack", {300, -0.15, 0.15}, "binning of the TempFitVar in the pT vs. TempFitVar plot (Track)"}; + ConfigurableAxis binmT{"binmT", {225, 0., 7.5}, "binning mT"}; + ConfigurableAxis binmultTempFit{"binmultTempFit", {1, 0, 1}, "multiplicity Binning for the TempFitVar plot"}; + ConfigurableAxis binMulPercentile{"binMulPercentile", {10, 0.0f, 100.0f}, "multiplicity percentile Binning"}; + ConfigurableAxis binpTTrack{"binpTTrack", {50, 0.5, 10.05}, "pT binning of the pT vs. TempFitVar plot (Track)"}; + ConfigurableAxis binEta{"binEta", {{200, -1.5, 1.5}}, "eta binning"}; + ConfigurableAxis binPhi{"binPhi", {{200, 0, 2.f * 3.14159274101257324e+00f}}, "phi binning"}; + ConfigurableAxis binkT{"binkT", {150, 0., 9.}, "binning kT"}; + ConfigurableAxis binkstar{"binkstar", {1500, 0., 6.}, "binning kstar"}; + ConfigurableAxis binNSigmaTPC{"binNSigmaTPC", {1600, -8, 8}, "Binning of Nsigma TPC plot"}; + ConfigurableAxis binNSigmaTOF{"binNSigmaTOF", {3000, -15, 15}, "Binning of the Nsigma TOF plot"}; + ConfigurableAxis binNSigmaTPCTOF{"binNSigmaTPCTOF", {3000, -15, 15}, "Binning of the Nsigma TPC+TOF plot"}; + ConfigurableAxis binTPCClusters{"binTPCClusters", {163, -0.5, 162.5}, "Binning of TPC found clusters plot"}; + // Mixing axis configurables + ConfigurableAxis mixingBinMult{"mixingBinMult", {VARIABLE_WIDTH, 0.0f, 20.0f, 60.0f, 200.0f}, "Mixing bins - multiplicity"}; + ConfigurableAxis mixingBinMultPercentile{"mixingBinMultPercentile", {VARIABLE_WIDTH, 0.0f, 100.f}, "Mixing bins - multiplicity percentile"}; + ConfigurableAxis mixingBinVztx{"mixingBinVztx", {VARIABLE_WIDTH, -10.0f, -4.f, 0.f, 4.f, 10.f}, "Mixing bins - z-vertex"}; + + ColumnBinningPolicy colBinningMult{{mixingBinVztx, mixingBinMult}, true}; + ColumnBinningPolicy colBinningMultPercentile{{mixingBinVztx, mixingBinMultPercentile}, true}; + ColumnBinningPolicy colBinningMultMultPercentile{{mixingBinVztx, mixingBinMult, mixingBinMultPercentile}, true}; + + FemtoDreamContainer sameEventCont; + FemtoDreamContainer mixedEventCont; + FemtoDreamPairCleaner pairCleaner; + FemtoDreamDetaDphiStar pairCloseRejectionSE; + FemtoDreamDetaDphiStar pairCloseRejectionME; + + femtodreamcollision::BitMaskType bitMask = 1 << 0; /// Histogramming for particle 1 FemtoDreamParticleHisto allTrackHisto; @@ -181,29 +214,12 @@ struct HfTaskCharmHadronsFemtoDream { HistogramRegistry registry{"CorrelationsAndQA", {}, OutputObjHandlingPolicy::AnalysisObject}; HistogramRegistry registryMixQa{"registryMixQa"}; HistogramRegistry registryCharmHadronQa{"registryCharmHadronQa"}; - /// Partition for particle 1 - - Partition partitionTrk1 = (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kTrack)) && (ncheckbit(aod::femtodreamparticle::cut, cutBitTrack1)) && ifnode(aod::femtodreamparticle::pt * (nexp(aod::femtodreamparticle::eta) + nexp(-1.f * aod::femtodreamparticle::eta)) / 2.f <= pidThresTrack1, ncheckbit(aod::femtodreamparticle::pidcut, tpcBitTrack1), ncheckbit(aod::femtodreamparticle::pidcut, tpcTofBitTrack1)); - - Partition partitionMcTrk1 = (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kTrack)) && - (ncheckbit(aod::femtodreamparticle::cut, cutBitTrack1)) && - ifnode(aod::femtodreamparticle::pt * (nexp(aod::femtodreamparticle::eta) + nexp(-1.f * aod::femtodreamparticle::eta)) / 2.f <= pidThresTrack1, ncheckbit(aod::femtodreamparticle::pidcut, tpcBitTrack1), ncheckbit(aod::femtodreamparticle::pidcut, tpcTofBitTrack1)); - - /// Partition for particle 2 - Partition partitionCharmHadron = aod::fdhf::bdtBkg < charmHadBkgBDTmax && aod::fdhf::bdtFD < charmHadFdBDTmax && aod::fdhf::bdtFD > charmHadFdBDTmin&& aod::fdhf::bdtPrompt charmHadPromptBDTmin; - Partition partitionMcCharmHadron = aod::fdhf::originMcRec == 1 || aod::fdhf::originMcRec == 2; float massOne = o2::analysis::femtoDream::getMass(pdgCodeTrack1); float massTwo = o2::analysis::femtoDream::getMass(charmHadPDGCode); int8_t partSign = 0; int64_t processType = 0; - SliceCache cache; - Preslice perCol = aod::femtodreamparticle::fdCollisionId; - Produces rowFemtoResultCharm; - Produces rowFemtoResultTrk; - Produces rowFemtoResultColl; - void init(InitContext& /*context*/) { // setup columnpolicy for binning @@ -249,6 +265,30 @@ struct HfTaskCharmHadronsFemtoDream { registryMixQa.fill(HIST("MixingQA/hSECollisionPool"), col.posZ(), col.multNtr()); } + /// Compute the charm hadron candidates mass with the daughter masses + /// assumes the candidate is either a D+ or Λc+ + template + float getCharmHadronMass(const Candidate& cand) + { + float invMass = 0.0f; + if (charmHadPDGCode == o2::constants::physics::Pdg::kLambdaCPlus) { + if (cand.candidateSelFlag() == 1) { + invMass = cand.m(std::array{o2::constants::physics::MassProton, o2::constants::physics::MassKPlus, o2::constants::physics::MassPiPlus}); + return invMass; + } else { + invMass = cand.m(std::array{o2::constants::physics::MassPiPlus, o2::constants::physics::MassKPlus, o2::constants::physics::MassProton}); + return invMass; + } + } + // D+ → π K π (PDG: 411) + if (charmHadPDGCode == o2::constants::physics::Pdg::kDPlus) { + invMass = cand.m(std::array{o2::constants::physics::MassPiPlus, o2::constants::physics::MassKPlus, o2::constants::physics::MassPiPlus}); + return invMass; + } + // Add more channels as needed + return invMass; + } + /// This function processes the same event and takes care of all the histogramming template void doSameEvent(PartitionType& sliceTrk1, CandType& sliceCharmHad, TableTracks const& parts, Collision const& col) @@ -270,9 +310,10 @@ struct HfTaskCharmHadronsFemtoDream { continue; } + constexpr int CutBitChargePositive = 2; // proton track charge float chargeTrack = 0.; - if ((p1.cut() & 2) == 2) { + if ((p1.cut() & CutBitChargePositive) == CutBitChargePositive) { chargeTrack = PositiveCharge; } else { chargeTrack = NegativeCharge; @@ -283,12 +324,7 @@ struct HfTaskCharmHadronsFemtoDream { continue; } - float invMass; - if (p2.candidateSelFlag() == 1) { - invMass = p2.m(std::array{o2::constants::physics::MassProton, o2::constants::physics::MassKPlus, o2::constants::physics::MassPiPlus}); - } else { - invMass = p2.m(std::array{o2::constants::physics::MassPiPlus, o2::constants::physics::MassKPlus, o2::constants::physics::MassProton}); - } + float invMass = getCharmHadronMass(p2); if (invMass < charmHadMinInvMass || invMass > charmHadMaxInvMass) { continue; @@ -298,7 +334,7 @@ struct HfTaskCharmHadronsFemtoDream { continue; } /// Filling QA histograms of the selected tracks - selectedTrackHisto.fillQA(p1, static_cast(ConfTempFitVarMomentum.value), col.multNtr(), col.multV0M()); + selectedTrackHisto.fillQA(p1, static_cast(confTempFitVarMomentum.value), col.multNtr(), col.multV0M()); int charmHadMc = 0; int originType = 0; @@ -349,13 +385,13 @@ struct HfTaskCharmHadronsFemtoDream { { // Mixed events that contain the pair of interest - Partition PartitionMaskedCol1 = (aod::femtodreamcollision::bitmaskTrackOne & BitMask) == BitMask; - PartitionMaskedCol1.bindTable(cols); + Partition partitionMaskedCol1 = (aod::femtodreamcollision::bitmaskTrackOne & bitMask) == bitMask; + partitionMaskedCol1.bindTable(cols); - Partition PartitionMaskedCol2 = (aod::femtodreamcollision::bitmaskTrackTwo & BitMask) == BitMask; - PartitionMaskedCol2.bindTable(cols); + Partition partitionMaskedCol2 = (aod::femtodreamcollision::bitmaskTrackTwo & bitMask) == bitMask; + partitionMaskedCol2.bindTable(cols); - for (auto const& [collision1, collision2] : combinations(soa::CombinationsBlockFullIndexPolicy(policy, mixingDepth.value, -1, *PartitionMaskedCol1.mFiltered, *PartitionMaskedCol2.mFiltered))) { + for (auto const& [collision1, collision2] : combinations(soa::CombinationsBlockFullIndexPolicy(policy, mixingDepth.value, -1, *partitionMaskedCol1.mFiltered, *partitionMaskedCol2.mFiltered))) { // make sure that tracks in the same events are not mixed if (collision1.globalIndex() == collision2.globalIndex()) { continue; @@ -366,7 +402,7 @@ struct HfTaskCharmHadronsFemtoDream { auto sliceTrk1 = part1->sliceByCached(aod::femtodreamparticle::fdCollisionId, collision1.globalIndex(), cache); auto sliceCharmHad = part2->sliceByCached(aod::femtodreamparticle::fdCollisionId, collision2.globalIndex(), cache); - for (auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(sliceTrk1, sliceCharmHad))) { + for (const auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(sliceTrk1, sliceCharmHad))) { if (useCPR.value) { if (pairCloseRejectionME.isClosePair(p1, p2, parts, collision1.magField())) { @@ -381,12 +417,8 @@ struct HfTaskCharmHadronsFemtoDream { if (kstar > highkstarCut) { continue; } - float invMass; - if (p2.candidateSelFlag() == 1) { - invMass = p2.m(std::array{o2::constants::physics::MassProton, o2::constants::physics::MassKPlus, o2::constants::physics::MassPiPlus}); - } else { - invMass = p2.m(std::array{o2::constants::physics::MassPiPlus, o2::constants::physics::MassKPlus, o2::constants::physics::MassProton}); - } + + float invMass = getCharmHadronMass(p2); if (invMass < charmHadMinInvMass || invMass > charmHadMaxInvMass) { continue; @@ -411,19 +443,14 @@ struct HfTaskCharmHadronsFemtoDream { auto sliceCharmHad = partitionCharmHadron->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); /// Filling QA histograms of the all tracks and all charm hadrons before pairing for (auto const& part : sliceTrk1) { - allTrackHisto.fillQA(part, static_cast(ConfTempFitVarMomentum.value), col.multNtr(), col.multV0M()); + allTrackHisto.fillQA(part, static_cast(confTempFitVarMomentum.value), col.multNtr(), col.multV0M()); } for (auto const& part : sliceCharmHad) { - float invMass; - if (part.candidateSelFlag() == 1) { - invMass = part.m(std::array{o2::constants::physics::MassProton, o2::constants::physics::MassKPlus, o2::constants::physics::MassPiPlus}); - } else { - invMass = part.m(std::array{o2::constants::physics::MassPiPlus, o2::constants::physics::MassKPlus, o2::constants::physics::MassProton}); - } + float invMass = getCharmHadronMass(part); registryCharmHadronQa.fill(HIST("CharmHadronQA/hPtVsMass"), part.pt(), invMass); } - if ((col.bitmaskTrackOne() & BitMask) != BitMask || (col.bitmaskTrackTwo() & BitMask) != BitMask) { + if ((col.bitmaskTrackOne() & bitMask) != bitMask || (col.bitmaskTrackTwo() & bitMask) != bitMask) { return; } doSameEvent(sliceTrk1, sliceCharmHad, parts, col); @@ -470,10 +497,10 @@ struct HfTaskCharmHadronsFemtoDream { } /// Filling QA histograms of the all mc tracks before pairing for (auto const& part : sliceMcTrk1) { - allTrackHisto.fillQA(part, static_cast(ConfTempFitVarMomentum.value), col.multNtr(), col.multV0M()); + allTrackHisto.fillQA(part, static_cast(confTempFitVarMomentum.value), col.multNtr(), col.multV0M()); } - if ((col.bitmaskTrackOne() & BitMask) != BitMask || (col.bitmaskTrackTwo() & BitMask) != BitMask) { + if ((col.bitmaskTrackOne() & bitMask) != bitMask || (col.bitmaskTrackTwo() & bitMask) != bitMask) { return; } doSameEvent(sliceMcTrk1, sliceMcCharmHad, parts, col); From 9e6e57eee3de3dcd7e568cb0c9737f9beee18f1d Mon Sep 17 00:00:00 2001 From: Sergio Garcia <47090312+singiamtel@users.noreply.github.com> Date: Wed, 6 Aug 2025 13:00:50 +0200 Subject: [PATCH 256/345] Remove unused file (#11800) --- git | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 git diff --git a/git b/git deleted file mode 100644 index e69de29bb2d..00000000000 From 24248363763fb53a91463bb6c4c5d0fac8266ae9 Mon Sep 17 00:00:00 2001 From: Maxim Virta <84773378+MaximVirta@users.noreply.github.com> Date: Wed, 6 Aug 2025 15:58:02 +0300 Subject: [PATCH 257/345] [Common] Event selection flags added (#12418) Co-authored-by: ALICE Action Bot --- Common/Tasks/qVectorsCorrection.cxx | 38 ++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/Common/Tasks/qVectorsCorrection.cxx b/Common/Tasks/qVectorsCorrection.cxx index 10e37a4c210..2d3c5c78804 100644 --- a/Common/Tasks/qVectorsCorrection.cxx +++ b/Common/Tasks/qVectorsCorrection.cxx @@ -68,6 +68,8 @@ struct qVectorsCorrection { Configurable cfgRefBName{"cfgRefBName", "TPCneg", "The name of detector for reference B"}; Configurable cfgAddEvtSel{"cfgAddEvtSel", true, "event selection"}; + Configurable cfgEvtSel{"cfgEvtSel", 0, "Event selection flags\n0: Sel8\n1: Sel8+kIsGoodZvtxFT0vsPV+kNoSameBunchPileup\n2: Sel8+kIsGoodZvtxFT0vsPV+kNoSameBunchPileup+kNoCollInTimeRangeStandard\n3: Sel8+kNoSameBunchPileup"}; + Configurable cfgnTotalSystem{"cfgnTotalSystem", 7, "total qvector number"}; Configurable cfgNbinsEP{"cfgNbinsEP", 360, "nbins for EP histograms"}; @@ -75,7 +77,6 @@ struct qVectorsCorrection { Configurable cfgQAFinal{"cfgQAFinal", false, "draw final q-vector steps"}; Configurable cfgQAFlowStudy{"cfgQAFlowStudy", false, "configurable for flow study"}; Configurable cfgQAOccupancyStudy{"cfgQAOccupancyStudy", false, "configurable for occupancy study"}; - Configurable cfgAddEvtSelPileup{"cfgAddEvtSelPileup", false, "configurable for pileup selection"}; Configurable cfgMinPt{"cfgMinPt", 0.15, "Minimum transverse momentum for charged track"}; Configurable cfgMaxEta{"cfgMaxEta", 0.8, "Maximum pseudorapidiy for charged track"}; @@ -541,16 +542,31 @@ struct qVectorsCorrection { void process(MyCollisions::iterator const& qVec, MyTracks const& tracks) { histosQA.fill(HIST("histCentFull"), qVec.cent()); - if (cfgAddEvtSel && (!qVec.sel8() || - !qVec.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) || - !qVec.selection_bit(aod::evsel::kNoSameBunchPileup))) { - return; - } - if (cfgAddEvtSel && (qVec.trackOccupancyInTimeRange() > cfgMaxOccupancy || qVec.trackOccupancyInTimeRange() < cfgMinOccupancy)) { - return; - } - if (cfgAddEvtSelPileup && !qVec.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { - return; + if (cfgAddEvtSel) { + switch (cfgEvtSel) { + case 0: // Sel8 + if (!qVec.sel8()) + return; + break; + case 1: // PbPb standard + if (!qVec.sel8() || !qVec.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) || !qVec.selection_bit(aod::evsel::kNoSameBunchPileup)) + return; + break; + case 2: // PbPb with pileup + if (!qVec.sel8() || !qVec.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard) || + !qVec.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) || !qVec.selection_bit(aod::evsel::kNoSameBunchPileup)) + return; + break; + case 3: // Small systems (OO, NeNe, pp) + if (!qVec.sel8() || !qVec.selection_bit(aod::evsel::kNoSameBunchPileup)) + return; + break; + default: + LOGF(warning, "Event selection flag was not found, continuing without basic event selections!\n"); + } + // Check occupancy + if (qVec.trackOccupancyInTimeRange() > cfgMaxOccupancy || qVec.trackOccupancyInTimeRange() < cfgMinOccupancy) + return; } for (uint i = 0; i < cfgnMods->size(); i++) { From 40a82d06ce1a31b455616d8296db7b33ac1ad7bd Mon Sep 17 00:00:00 2001 From: SuJeong Ji <120470463+SuJeong-Ji@users.noreply.github.com> Date: Wed, 6 Aug 2025 22:28:52 +0900 Subject: [PATCH 258/345] [PWGLF] Added background histogram (#12401) Co-authored-by: ALICE Action Bot --- PWGLF/Tasks/Resonances/chk892pp.cxx | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/PWGLF/Tasks/Resonances/chk892pp.cxx b/PWGLF/Tasks/Resonances/chk892pp.cxx index 410643d6c6b..72ecdce733e 100644 --- a/PWGLF/Tasks/Resonances/chk892pp.cxx +++ b/PWGLF/Tasks/Resonances/chk892pp.cxx @@ -24,7 +24,7 @@ #include #include #include -#include // FIXME +// #include // FIXME #include // FIXME #include @@ -289,6 +289,10 @@ struct Chk892pp { histos.add("QA/before/VtxZ", "Centrality distribution", {HistType::kTH1D, {vtxzAxis}}); histos.add("QA/before/hEvent", "Number of Events", HistType::kTH1F, {{1, 0.5, 1.5}}); + if (BkgEstimationConfig.cfgFillRotBkg) { + histos.add("QA/RotBkg/hRotBkg", "Rotated angle of rotated background", HistType::kTH1F, {{360, 0.0, o2::constants::math::TwoPI}}); + } + // Bachelor pion histos.add("QA/before/trkbpionDCAxy", "DCAxy distribution of bachelor pion candidates", HistType::kTH1D, {dcaxyAxis}); histos.add("QA/before/trkbpionDCAz", "DCAz distribution of bachelor pion candidates", HistType::kTH1D, {dcazAxis}); @@ -666,16 +670,16 @@ struct Chk892pp { if (std::abs(motherbTrack.pdgCode()) != kKstarPlus) // Are you charged Kstar's daughter? return false; // Apply first since it's more restrictive - if (std::abs(motherkV0.pdgCode()) != 310) // Is it K0s? + if (std::abs(motherkV0.pdgCode()) != kPDGK0s) // Is it K0s? return false; // Check if K0s's mother is K0 (311) auto motherK0 = motherkV0.template mothers_as(); - if (std::abs(motherK0.pdgCode()) != 311) + if (std::abs(motherK0.pdgCode()) != kPDGK0) return false; // Check if K0's mother is Kstar (323) auto motherKstar = motherK0.template mothers_as(); - if (std::abs(motherKstar.pdgCode()) != 323) + if (std::abs(motherKstar.pdgCode()) != kKstarPlus) return false; // Check if bTrack and K0 have the same mother (global index) @@ -696,7 +700,7 @@ struct Chk892pp { std::vector trackIndicies = {}; std::vector k0sIndicies = {}; - for (auto& bTrack : dTracks1) { + for (const auto& bTrack : dTracks1) { auto trkbpt = bTrack.pt(); auto istrkbhasTOF = bTrack.hasTOF(); auto trkbNSigmaPiTPC = bTrack.tpcNSigmaPi(); @@ -733,7 +737,7 @@ struct Chk892pp { trackIndicies.push_back(bTrack.index()); } - for (auto& k0sCand : dTracks2) { + for (const auto& k0sCand : dTracks2) { auto posDauTrack = k0sCand.template posTrack_as(); auto negDauTrack = k0sCand.template negTrack_as(); @@ -838,8 +842,8 @@ struct Chk892pp { k0sIndicies.push_back(k0sCand.index()); } - for (auto& trackIndex : trackIndicies) { - for (auto& k0sIndex : k0sIndicies) { + for (const auto& trackIndex : trackIndicies) { + for (const auto& k0sIndex : k0sIndicies) { auto bTrack = dTracks1.rawIteratorAt(trackIndex); auto k0sCand = dTracks2.rawIteratorAt(k0sIndex); auto trkkMass = k0sCand.mK0Short(); From f9eb4fcbf258fd91066f1a652820b0b51862f9ba Mon Sep 17 00:00:00 2001 From: Artem Kotliarov <71133985+KotliarovAr@users.noreply.github.com> Date: Wed, 6 Aug 2025 15:32:05 +0200 Subject: [PATCH 259/345] [PWGJE] add scaled multiplicity (#12442) Co-authored-by: ALICE Action Bot --- PWGJE/Tasks/recoilJets.cxx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/PWGJE/Tasks/recoilJets.cxx b/PWGJE/Tasks/recoilJets.cxx index 8b6d2b952ea..3038b3ce37a 100644 --- a/PWGJE/Tasks/recoilJets.cxx +++ b/PWGJE/Tasks/recoilJets.cxx @@ -104,6 +104,12 @@ struct RecoilJets { "applied at the jet finder level, here rejection is applied for " "collision and track process functions"}; + Configurable meanFT0A{"meanFT0A", -1.0, "Mean value of FT0A"}; + + Configurable meanFT0C{"meanFT0C", -1.0, "Mean value of FT0C"}; + + Configurable meanFT0M{"meanFT0M", -1.0, "Mean value of FT0M"}; + // List of configurable parameters for MC Configurable pTHatExponent{"pTHatExponent", 4.0, "Exponent of the event weight for the calculation of pTHat"}; @@ -405,6 +411,13 @@ struct RecoilJets { spectra.add("hMultFT0M", "Total mult. signal from FT0A & FTOC", kTH1F, {{3000, 0.0, 60000.}}); + spectra.add("hScaleMultFT0A", "Scaled mult. signal from FTOA", kTH1F, + {{200, 0.0, 20.}}); + spectra.add("hScaleMultFT0C", "Scaled mult. signal from FTOC", kTH1F, + {{200, 0.0, 20.}}); + spectra.add("hScaleMultFT0M", "Scaled total mult. signal from FT0A & FTOC", kTH1F, + {{200, 0.0, 20.}}); + spectra.add("hMultZNA", "Mult. signal from ZDC A-side", kTH1F, {{500, 0.0, 10000.}}); spectra.add("hMultZNC", "Mult. signal from ZDC C-side", kTH1F, @@ -664,6 +677,10 @@ struct RecoilJets { spectra.fill(HIST("hMultFT0C"), collision.multFT0C(), weight); spectra.fill(HIST("hMultFT0M"), collision.multFT0M(), weight); + spectra.fill(HIST("hScaleMultFT0A"), collision.multFT0A() / meanFT0A, weight); + spectra.fill(HIST("hScaleMultFT0C"), collision.multFT0C() / meanFT0C, weight); + spectra.fill(HIST("hScaleMultFT0M"), collision.multFT0M() / meanFT0M, weight); + spectra.fill(HIST("hMultZNA"), collision.multZNA(), weight); spectra.fill(HIST("hMultZNC"), collision.multZNC(), weight); spectra.fill(HIST("hMultZNM"), collision.multZNA() + collision.multZNC(), From d75755e85b8aa53bfd4c555823291f14f465145e Mon Sep 17 00:00:00 2001 From: jaelpark Date: Wed, 6 Aug 2025 15:58:27 +0200 Subject: [PATCH 260/345] [PWGCF] Add CFMultiplicitySet to support multiple auxilary multiplicities/centralities (#12425) --- PWGCF/DataModel/CorrelationsDerived.h | 9 ++++++ PWGCF/TableProducer/filterCorrelations.cxx | 33 ++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/PWGCF/DataModel/CorrelationsDerived.h b/PWGCF/DataModel/CorrelationsDerived.h index 62bcf8716bc..df44dde6d33 100644 --- a/PWGCF/DataModel/CorrelationsDerived.h +++ b/PWGCF/DataModel/CorrelationsDerived.h @@ -86,6 +86,15 @@ using CFTrackWithLabel = CFTracksWithLabel::iterator; //------transient CF-filter to CF-2prong-filter DECLARE_SOA_TABLE(CFCollRefs, "AOD", "CFCOLLREF", o2::soa::Index<>, track::CollisionId); //! Transient cf collision index table +//------multiplicity set +namespace cfmultiplicityset +{ +DECLARE_SOA_COLUMN(Multiplicities, multiplicities, std::vector); //! List of auxiliary multiplicities +} +DECLARE_SOA_TABLE(CFMultiplicitySets, "AOD", "CFMULTIPLICITYSET", cfmultiplicityset::Multiplicities); //! Auxilary multiplicity set table + +using CFMultiplicitySet = CFMultiplicitySets::iterator; + // Reco using CFCollRef = CFCollRefs::iterator; diff --git a/PWGCF/TableProducer/filterCorrelations.cxx b/PWGCF/TableProducer/filterCorrelations.cxx index 95fd3ae951f..ff499bc4178 100644 --- a/PWGCF/TableProducer/filterCorrelations.cxx +++ b/PWGCF/TableProducer/filterCorrelations.cxx @@ -64,6 +64,13 @@ struct FilterCF { kPIDProton = BIT(1) }; + enum MultiplicityEstimators : uint8_t { + kCentFT0C = BIT(0), + kMultFV0A = BIT(1), + kMultNTracksPV = BIT(2), + kMultNTracksGlobal = BIT(3), + }; + // Configuration O2_DEFINE_CONFIGURABLE(cfgCutVertex, float, 7.0f, "Accepted z-vertex range") O2_DEFINE_CONFIGURABLE(cfgCutPt, float, 0.5f, "Minimal pT for tracks") @@ -90,6 +97,7 @@ struct FilterCF { O2_DEFINE_CONFIGURABLE(tpcnclusters, int, 50, "minimum number of TPC clusters found") O2_DEFINE_CONFIGURABLE(chi2pertpccluster, float, 2.5, "maximum Chi2 / cluster for the TPC track segment") O2_DEFINE_CONFIGURABLE(chi2peritscluster, float, 36, "maximum Chi2 / cluster for the ITS track segment") + O2_DEFINE_CONFIGURABLE(cfgEstimatorBitMask, uint16_t, 0, "BitMask for multiplicity estimators to be included in the CFMultiplicitySet tables."); // Filters and input definitions Filter collisionZVtxFilter = nabs(aod::collision::posZ) < cfgCutVertex; @@ -117,6 +125,9 @@ struct FilterCF { Produces outputTrackRefs; Produces outputMcParticleRefs; + Produces outputMultSets; + std::vector multiplicities{}; + // persistent caches std::vector mcReconstructedCache; std::vector mcParticleLabelsCache; @@ -238,6 +249,9 @@ struct FilterCF { return 0; } + template + using HasMultTables = decltype(std::declval().multNTracksPV()); + /// \brief Templetized process data for a given collision and its associated tracks /// \param collision The collision object containing information about the collision /// \param tracks The collection of tracks associated with the collision @@ -255,6 +269,19 @@ struct FilterCF { auto bc = collision.template bc_as(); outputCollisions(bc.runNumber(), collision.posZ(), collision.multiplicity(), bc.timestamp()); + if constexpr (std::experimental::is_detected::value) { + multiplicities.clear(); + if (cfgEstimatorBitMask & kCentFT0C) + multiplicities.push_back(collision.centFT0C()); + if (cfgEstimatorBitMask & kMultFV0A) + multiplicities.push_back(collision.multFV0A()); + if (cfgEstimatorBitMask & kMultNTracksPV) + multiplicities.push_back(collision.multNTracksPV()); + if (cfgEstimatorBitMask & kMultNTracksGlobal) + multiplicities.push_back(collision.multNTracksGlobal()); + outputMultSets(multiplicities); + } + if (cfgTransientTables) outputCollRefs(collision.globalIndex()); for (auto& track : tracks) { @@ -283,6 +310,12 @@ struct FilterCF { } PROCESS_SWITCH(FilterCF, processDataPid, "Process data with PID", false); + void processDataMults(soa::Filtered>::iterator const& collision, aod::BCsWithTimestamps const&, soa::Filtered> const& tracks) + { + processDataT(collision, tracks); + } + PROCESS_SWITCH(FilterCF, processDataMults, "Process data with multiplicity sets", false); + /// \brief Process MC data for a given set of MC collisions and associated particles and tracks /// \param mcCollisions The collection of MC collisions /// \param allParticles The collection of all MC particles From 48f021fb9da36193b64c8f800438475aa918d42f Mon Sep 17 00:00:00 2001 From: amatyja Date: Wed, 6 Aug 2025 17:32:09 +0200 Subject: [PATCH 261/345] [PWGUD] New 2D histos and vars (tracks, rct) in tau tree (#11997) --- PWGUD/Tasks/upcTauTau13topo.cxx | 524 ++++++++++++++++++++++---------- 1 file changed, 360 insertions(+), 164 deletions(-) diff --git a/PWGUD/Tasks/upcTauTau13topo.cxx b/PWGUD/Tasks/upcTauTau13topo.cxx index 0d18b316b8b..b3ff71675cc 100644 --- a/PWGUD/Tasks/upcTauTau13topo.cxx +++ b/PWGUD/Tasks/upcTauTau13topo.cxx @@ -17,24 +17,25 @@ // copts="--configuration json://tautauConfig.json -b" // o2-analysis-ud-tautau13topo $copts > output.log -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" #include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" // #include "TDatabasePDG.h" // not recommended in o2 #include "Framework/O2DatabasePDGPlugin.h" -#include "TLorentzVector.h" +// #include "TLorentzVector.h" +#include "Math/Vector4D.h" // #include "Common/DataModel/EventSelection.h" // #include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/PIDResponse.h" -#include "PWGUD/DataModel/UDTables.h" -#include "PWGUD/Core/UDHelpers.h" #include "PWGUD/Core/DGPIDSelector.h" #include "PWGUD/Core/SGSelector.h" +#include "PWGUD/Core/UDHelpers.h" +#include "PWGUD/DataModel/UDTables.h" #include "Common/Core/RecoDecay.h" +#include "Common/DataModel/PIDResponse.h" // #include #include "TPDGCode.h" @@ -52,7 +53,8 @@ namespace tau_tree DECLARE_SOA_COLUMN(RunNumber, runNumber, int32_t); DECLARE_SOA_COLUMN(Bc, bc, int); DECLARE_SOA_COLUMN(TotalTracks, totalTracks, int); -DECLARE_SOA_COLUMN(NumContrib, numContrib, int); +DECLARE_SOA_COLUMN(NumContrib, numContrib, int8_t); +DECLARE_SOA_COLUMN(RctOk, rctOk, int); // DECLARE_SOA_COLUMN(GlobalNonPVtracks, globalNonPVtracks, int); // DECLARE_SOA_COLUMN(PosX, posX, float); // DECLARE_SOA_COLUMN(PosY, posY, float); @@ -63,14 +65,14 @@ DECLARE_SOA_COLUMN(HadronicRate, hadronicRate, double); DECLARE_SOA_COLUMN(Trs, trs, bool); DECLARE_SOA_COLUMN(Trofs, trofs, bool); DECLARE_SOA_COLUMN(Hmpr, hmpr, bool); -// DECLARE_SOA_COLUMN(Tfb, tfb, int); -// DECLARE_SOA_COLUMN(ItsRofb, itsRofb, int); -// DECLARE_SOA_COLUMN(Sbp, sbp, int); -// DECLARE_SOA_COLUMN(ZvtxFT0vsPv, zvtxFT0vsPv, int); -// DECLARE_SOA_COLUMN(VtxITSTPC, vtxITSTPC, int); +DECLARE_SOA_COLUMN(Tfb, tfb, bool); +DECLARE_SOA_COLUMN(ItsRofb, itsRofb, bool); +DECLARE_SOA_COLUMN(Sbp, sbp, bool); +DECLARE_SOA_COLUMN(ZvtxFT0vsPv, zvtxFT0vsPv, bool); +DECLARE_SOA_COLUMN(VtxITSTPC, vtxITSTPC, bool); DECLARE_SOA_COLUMN(ZdcAenergy, zdcAenergy, float); DECLARE_SOA_COLUMN(ZdcCenergy, zdcCenergy, float); -DECLARE_SOA_COLUMN(Qtot, qtot, int16_t); +DECLARE_SOA_COLUMN(Qtot, qtot, int8_t); // FIT info DECLARE_SOA_COLUMN(TotalFT0AmplitudeA, totalFT0AmplitudeA, float); DECLARE_SOA_COLUMN(TotalFT0AmplitudeC, totalFT0AmplitudeC, float); @@ -83,9 +85,14 @@ DECLARE_SOA_COLUMN(TrkPx, trkPx, float[4]); DECLARE_SOA_COLUMN(TrkPy, trkPy, float[4]); DECLARE_SOA_COLUMN(TrkPz, trkPz, float[4]); // DECLARE_SOA_COLUMN(TrkSign, trkSign, int[4]); -// DECLARE_SOA_COLUMN(TrkDCAxy, trkDCAxy, float[4]); -// DECLARE_SOA_COLUMN(TrkDCAz, trkDCAz, float[4]); +DECLARE_SOA_COLUMN(TrkDCAxy, trkDCAxy, float[4]); +DECLARE_SOA_COLUMN(TrkDCAz, trkDCAz, float[4]); DECLARE_SOA_COLUMN(TrkTPCcr, trkTPCcr, int[4]); +DECLARE_SOA_COLUMN(TrkTPCfind, trkTPCfind, int[4]); +DECLARE_SOA_COLUMN(TrkTPCchi2, trkTPCchi2, float[4]); +DECLARE_SOA_COLUMN(TrkITSchi2, trkITSchi2, float[4]); +DECLARE_SOA_COLUMN(TrkITScl, trkITScl, int[4]); + DECLARE_SOA_COLUMN(TrkTPCsignal, trkTPCsignal, float[4]); DECLARE_SOA_COLUMN(TrkTPCnSigmaEl, trkTPCnSigmaEl, float[4]); // DECLARE_SOA_COLUMN(TrkTPCnSigmaMu, trkTPCnSigmaMu, float[4]); @@ -105,19 +112,21 @@ DECLARE_SOA_COLUMN(TrkTOFchi2, trkTOFchi2, float[4]); } // end of namespace tau_tree DECLARE_SOA_TABLE(TauFourTracks, "AOD", "TAUFOURTRACK", tau_tree::RunNumber, tau_tree::Bc, tau_tree::TotalTracks, tau_tree::NumContrib, + tau_tree::RctOk, // tau_tree::GlobalNonPVtracks, // tau_tree::PosX, tau_tree::PosY, tau_tree::PosZ, tau_tree::FlagUPC, tau_tree::OccupancyInTime, tau_tree::HadronicRate, tau_tree::ZdcAenergy, tau_tree::ZdcCenergy, tau_tree::Qtot, tau_tree::Trs, tau_tree::Trofs, tau_tree::Hmpr, - // tau_tree::Tfb, tau_tree::ItsRofb, tau_tree::Sbp, tau_tree::ZvtxFT0vsPv, tau_tree::VtxITSTPC, + tau_tree::Tfb, tau_tree::ItsRofb, tau_tree::Sbp, tau_tree::ZvtxFT0vsPv, tau_tree::VtxITSTPC, tau_tree::TotalFT0AmplitudeA, tau_tree::TotalFT0AmplitudeC, tau_tree::TotalFV0AmplitudeA, // tau_tree::TimeFT0A, tau_tree::TimeFT0C, tau_tree::TimeFV0A, tau_tree::TrkPx, tau_tree::TrkPy, tau_tree::TrkPz, // tau_tree::TrkSign, - // tau_tree::TrkDCAxy, tau_tree::TrkDCAz, + tau_tree::TrkDCAxy, tau_tree::TrkDCAz, tau_tree::TrkTPCcr, + tau_tree::TrkTPCfind, tau_tree::TrkTPCchi2, tau_tree::TrkITSchi2, tau_tree::TrkITScl, tau_tree::TrkTPCsignal, tau_tree::TrkTPCnSigmaEl, tau_tree::TrkTPCnSigmaPi, tau_tree::TrkTPCnSigmaKa, tau_tree::TrkTPCnSigmaPr, tau_tree::TrkTPCnSigmaMu, tau_tree::TrkTOFbeta, tau_tree::TrkTOFnSigmaEl, tau_tree::TrkTOFnSigmaPi, tau_tree::TrkTOFnSigmaKa, tau_tree::TrkTOFnSigmaPr, tau_tree::TrkTOFnSigmaMu, tau_tree::TrkTOFchi2); @@ -138,7 +147,7 @@ struct TauTau13topo { ConfigurableAxis ptAxis{"ptAxis", {120, 0., 4.}, "#it{p} (GeV/#it{c})"}; // ConfigurableAxis etaAxis{"etaAxis", {100, -2., 2.}, "#eta"}; ConfigurableAxis dedxAxis{"dedxAxis", {100, 20., 160.}, "dE/dx"}; - ConfigurableAxis minvAxis{"minvAxis", {100, 0.4, 3.5}, "M_{inv} (GeV/#it{c}^{2})"}; + ConfigurableAxis minvAxis{"minvAxis", {100, 0.5, 5.0}, "M_{inv} (GeV/#it{c}^{2})"}; ConfigurableAxis phiAxis{"phiAxis", {120, 0., 3.2}, "#phi"}; // ConfigurableAxis vectorAxis{"vectorAxis", {100, 0., 2.}, "A_{V}"}; // ConfigurableAxis scalarAxis{"scalarAxis", {100, -1., 1.}, "A_{S}"}; @@ -215,6 +224,7 @@ struct TauTau13topo { const AxisSpec scalarAxis{100, -1., 1., "A_{S}"}; const AxisSpec axisZDC{50, -1., 14., "#it{E} (TeV)"}; const AxisSpec axisInvMass4trk{160, 0.5, 8.5, "#it{M}^{4trk}_{inv} (GeV/#it{c}^{2})"}; + const AxisSpec acoAxis{100, 0., 1., "A^{1+3}"}; if (doprocessDataSG) { registry.add("global/RunNumber", "Run number; Run; Collisions", {HistType::kTH1F, {{150, 544013, 545367}}}); @@ -805,22 +815,78 @@ struct TauTau13topo { registry.add("pidTOF/h3piTOFchi2Cut23", "tof chi2;chi2 TOF;events", {HistType::kTH1F, {{100, 0., 10.}}}); // registry.add("pidTOF/h3piTOFchi2Cut36", "tof chi2;chi2 TOF;events", {HistType::kTH1F, {{100, 0., 10.}}}); // registry.add("pidTOF/h3piTOFchi2Cut37", "tof chi2;chi2 TOF;events", {HistType::kTH1F, {{100, 0., 10.}}}); + + // histograms mass3pi vs acoponarity + registry.add("control/cut0/h3piMassVsAco", "3#pi mass vs acoplanarity, up to 4 entries per event ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry.add("control/cut20/h3piMassVsAco", "3#pi mass vs acoplanarity, up to 4 entries per event ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry.add("control/cut33/h3piMassVsAco", "3#pi mass vs acoplanarity, up to 4 entries per event ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry.add("control/cut21/h3piMassVsAco", "3#pi mass vs acoplanarity, up to 4 entries per event ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry.add("control/cut24/h3piMassVsAco", "3#pi mass vs acoplanarity, up to 4 entries per event ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry.add("control/cut25/h3piMassVsAco", "3#pi mass vs acoplanarity, up to 4 entries per event ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry.add("control/cut28/h3piMassVsAco", "3#pi mass vs acoplanarity, up to 4 entries per event ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry.add("control/cut22/h3piMassVsAco", "3#pi mass vs acoplanarity, up to 4 entries per event ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry.add("control/cut29/h3piMassVsAco", "3#pi mass vs acoplanarity, up to 4 entries per event ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry.add("control/cut26/h3piMassVsAco", "3#pi mass vs acoplanarity, up to 4 entries per event ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry.add("control/cut34/h3piMassVsAco", "3#pi mass vs acoplanarity, up to 4 entries per event ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry.add("control/cut30/h3piMassVsAco", "3#pi mass vs acoplanarity, up to 4 entries per event ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry.add("control/cut27/h3piMassVsAco", "3#pi mass vs acoplanarity, up to 4 entries per event ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry.add("control/cut35/h3piMassVsAco", "3#pi mass vs acoplanarity, up to 4 entries per event ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry.add("control/cut23/h3piMassVsAco", "3#pi mass vs acoplanarity, up to 4 entries per event ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + } // end of data histograms // MC part // histograms filled by processSimpleMCSG // CollisionMC histograms - if (doprocessEfficiencyMCSG) { - registry1MC.add("globalMC/hGeneratorID", ";Generator ID;events", {HistType::kTH1F, {{100, 0., 1000.}}}); + if (doprocessEfficiencyMCSG || doprocessSimpleMCSG) { registryMC.add("globalMC/hMCZvertex", ";V_{Z}^{MC} (cm);events", {HistType::kTH1F, {{100, -25., 25.}}}); registryMC.add("globalMC/hMCefficiency", ";Cut Number;events", {HistType::kTH1F, {{20, 0., 20.}}}); + + // efficiency el + registryMC.add("efficiencyMCEl/effiEl", ";Efficiency e3#pi;events", {HistType::kTH1F, {{70, 0., 70.}}}); + // efficiency pi + registryMC.add("efficiencyMCPi/effiPi", ";Efficiency #pi3#pi;events", {HistType::kTH1F, {{20, 0., 20.}}}); + // efficiency mu + registryMC.add("efficiencyMCMu/effiMu", ";Efficiency #mu3#pi;events", {HistType::kTH1F, {{20, 0., 20.}}}); + } + + if (doprocessSimpleMCSG) { registryMC.add("globalMC/hMCnPart", ";N_{part};Type;events", {HistType::kTH2F, {{25, 0., 25.}, {10, 0, 10}}}); + registryMC.add("globalMC/hMCetaGen", ";#eta^{gen};N^{MC particles}", {HistType::kTH1F, {{100, -5., 5.}}}); registryMC.add("globalMC/hMCphiGen", ";#phi^{gen};N^{MC particles}", {HistType::kTH1F, {{100, 0., 6.4}}}); registryMC.add("globalMC/hMCyGen", ";y^{gen};N^{MC particles}", {HistType::kTH1F, {{100, -5., 5.}}}); registryMC.add("globalMC/hMCptGen", ";p_{T}^{gen};N^{MC particles}", {HistType::kTH1F, {{100, 0., 4.}}}); + // tau + registryMC.add("tauMC/hMCeta", ";#eta^{#tau};N^{#tau} ", {HistType::kTH1F, {{100, -5., 5.}}}); + registryMC.add("tauMC/hMCy", ";y^{#tau};N^{#tau}", {HistType::kTH1F, {{100, -5., 5.}}}); + registryMC.add("tauMC/hMCphi", ";#phi^{#tau};N^{#tau}", {HistType::kTH1F, {{100, 0., 6.4}}}); + registryMC.add("tauMC/hMCpt", ";#it{p}_{T}^{#tau};N^{#tau}", {HistType::kTH1F, {{100, 0., 10.}}}); + + registryMC.add("tauMC/hMCdeltaeta", ";#Delta#eta^{#tau};events ", {HistType::kTH1F, {{100, -5., 5.}}}); + registryMC.add("tauMC/hMCdeltaphi", ";#Delta#phi^{#tau}(deg.);events", {HistType::kTH1F, {{100, 131., 181}}}); + + // electron + registryMC.add("electronMC/hMCeta", ";#eta^{e};N^{e}", {HistType::kTH1F, {{100, -5., 5.}}}); + registryMC.add("electronMC/hMCy", ";y^{e};N^{e}", {HistType::kTH1F, {{100, -5., 5.}}}); + registryMC.add("electronMC/hMCphi", ";#phi^{e};N^{e}", {HistType::kTH1F, {{100, 0., 6.4}}}); + registryMC.add("electronMC/hMCpt", ";#it{p}_{T}^{e};N^{e}", {HistType::kTH1F, {{400, 0., 10.}}}); + + // efficiency mu + registryMC.add("efficiencyMCMu/hpTmuon", ";p_{T}^{#mu, gen} (GeV/c);events", {HistType::kTH1F, {{200, 0., 5.}}}); + + // efficiency pi + registryMC.add("efficiencyMCPi/hpTpi", ";p_{T}^{#pi, gen} (GeV/c);events", {HistType::kTH1F, {{200, 0., 5.}}}); + + // efficiency el + registryMC.add("efficiencyMCEl/hpTelec", ";p_{T}^{e, gen} (GeV/c);events", {HistType::kTH1F, {axispt}}); + } + + if (doprocessEfficiencyMCSG) { // MC reconstructed with information from MC true + registry1MC.add("globalMC/hGeneratorID", ";Generator ID;events", {HistType::kTH1F, {{100, 0., 1000.}}}); + registryMC.add("globalMCrec/hMCetaGenCol", ";#eta^{genCol};events", {HistType::kTH1F, {{100, -5., 5.}}}); registryMC.add("globalMCrec/hMCphiGenCol", ";#phi^{genCol};events", {HistType::kTH1F, {{100, 0., 6.4}}}); registryMC.add("globalMCrec/hMCyGenCol", ";y^{genCol};events", {HistType::kTH1F, {{100, -5., 5.}}}); @@ -1461,33 +1527,6 @@ struct TauTau13topo { registryMC.add("controlMCcomb/cut35/hPtSpectrumEl", ";p_{T}^{comb} (GeV/c);entries", {HistType::kTH1F, {axispt}}); // zrobic hpTspectrumEl dla cut 0,20-35: registry.get(HIST("global/hFinalPtSpectrumEl"))->Fill(tmpPt[i]); - // tau - registryMC.add("tauMC/hMCeta", ";#eta^{#tau};N^{#tau} ", {HistType::kTH1F, {{100, -5., 5.}}}); - registryMC.add("tauMC/hMCy", ";y^{#tau};N^{#tau}", {HistType::kTH1F, {{100, -5., 5.}}}); - registryMC.add("tauMC/hMCphi", ";#phi^{#tau};N^{#tau}", {HistType::kTH1F, {{100, 0., 6.4}}}); - registryMC.add("tauMC/hMCpt", ";#it{p}_{T}^{#tau};N^{#tau}", {HistType::kTH1F, {{100, 0., 10.}}}); - - registryMC.add("tauMC/hMCdeltaeta", ";#Delta#eta^{#tau};events ", {HistType::kTH1F, {{100, -5., 5.}}}); - registryMC.add("tauMC/hMCdeltaphi", ";#Delta#phi^{#tau}(deg.);events", {HistType::kTH1F, {{100, 131., 181}}}); - - // electron - registryMC.add("electronMC/hMCeta", ";#eta^{e};N^{e}", {HistType::kTH1F, {{100, -5., 5.}}}); - registryMC.add("electronMC/hMCy", ";y^{e};N^{e}", {HistType::kTH1F, {{100, -5., 5.}}}); - registryMC.add("electronMC/hMCphi", ";#phi^{e};N^{e}", {HistType::kTH1F, {{100, 0., 6.4}}}); - registryMC.add("electronMC/hMCpt", ";#it{p}_{T}^{e};N^{e}", {HistType::kTH1F, {{400, 0., 10.}}}); - - // efficiency mu - registryMC.add("efficiencyMCMu/effiMu", ";Efficiency #mu3#pi;events", {HistType::kTH1F, {{20, 0., 20.}}}); - registryMC.add("efficiencyMCMu/hpTmuon", ";p_{T}^{#mu, gen} (GeV/c);events", {HistType::kTH1F, {{200, 0., 5.}}}); - - // efficiency pi - registryMC.add("efficiencyMCPi/effiPi", ";Efficiency #pi3#pi;events", {HistType::kTH1F, {{20, 0., 20.}}}); - registryMC.add("efficiencyMCPi/hpTpi", ";p_{T}^{#pi, gen} (GeV/c);events", {HistType::kTH1F, {{200, 0., 5.}}}); - - // efficiency el - registryMC.add("efficiencyMCEl/effiEl", ";Efficiency e3#pi;events", {HistType::kTH1F, {{70, 0., 70.}}}); - registryMC.add("efficiencyMCEl/hpTelec", ";p_{T}^{e, gen} (GeV/c);events", {HistType::kTH1F, {axispt}}); - // efficiency el registryMC.add("efficiencyMCEl/hMCdeltaAlphaEpi", ";#Delta#alpha^{e-#pi(3x), gen} (rad);events", {HistType::kTH1F, {{100, -0.1, 3.2}}}); registryMC.add("efficiencyMCEl/hMCdeltaAlphaPiPi", ";#Delta#alpha^{#pi-#pi(3x), gen} (rad);events", {HistType::kTH1F, {{100, -0.1, 3.2}}}); @@ -1506,6 +1545,40 @@ struct TauTau13topo { registryMC.add("efficiencyMCEl/hMCinvmass3pi", ";M_{inv}^{3#pi true} (GeV/c^{2}) ;events", {HistType::kTH1F, {{100, 0.4, 2.4}}}); registryMC.add("efficiencyMCEl/hMCdeltaphi13", ";#Delta#phi^{1-3 true} ;events", {HistType::kTH1F, {{100, 0., 3.2}}}); + // histograms mass3pi vs acoponarity MC true + registry1MC.add("controlMCtrue/cut0/h3piMassVsAco", "3#pi mass vs acoplanarity MC sig ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCtrue/cut20/h3piMassVsAco", "3#pi mass vs acoplanarity MC sig ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCtrue/cut33/h3piMassVsAco", "3#pi mass vs acoplanarity MC sig ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCtrue/cut21/h3piMassVsAco", "3#pi mass vs acoplanarity MC sig ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCtrue/cut24/h3piMassVsAco", "3#pi mass vs acoplanarity MC sig ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCtrue/cut25/h3piMassVsAco", "3#pi mass vs acoplanarity MC sig ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCtrue/cut28/h3piMassVsAco", "3#pi mass vs acoplanarity MC sig ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCtrue/cut22/h3piMassVsAco", "3#pi mass vs acoplanarity MC sig ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCtrue/cut29/h3piMassVsAco", "3#pi mass vs acoplanarity MC sig ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCtrue/cut26/h3piMassVsAco", "3#pi mass vs acoplanarity MC sig ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCtrue/cut34/h3piMassVsAco", "3#pi mass vs acoplanarity MC sig ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCtrue/cut30/h3piMassVsAco", "3#pi mass vs acoplanarity MC sig ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCtrue/cut27/h3piMassVsAco", "3#pi mass vs acoplanarity MC sig ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCtrue/cut35/h3piMassVsAco", "3#pi mass vs acoplanarity MC sig ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCtrue/cut23/h3piMassVsAco", "3#pi mass vs acoplanarity MC sig ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + + // histograms mass3pi vs acoponarity MC comb + registry1MC.add("controlMCcomb/cut0/h3piMassVsAco", "3#pi mass vs acoplanarity MC comb ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCcomb/cut20/h3piMassVsAco", "3#pi mass vs acoplanarity MC comb ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCcomb/cut33/h3piMassVsAco", "3#pi mass vs acoplanarity MC comb ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCcomb/cut21/h3piMassVsAco", "3#pi mass vs acoplanarity MC comb ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCcomb/cut24/h3piMassVsAco", "3#pi mass vs acoplanarity MC comb ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCcomb/cut25/h3piMassVsAco", "3#pi mass vs acoplanarity MC comb ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCcomb/cut28/h3piMassVsAco", "3#pi mass vs acoplanarity MC comb ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCcomb/cut22/h3piMassVsAco", "3#pi mass vs acoplanarity MC comb ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCcomb/cut29/h3piMassVsAco", "3#pi mass vs acoplanarity MC comb ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCcomb/cut26/h3piMassVsAco", "3#pi mass vs acoplanarity MC comb ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCcomb/cut34/h3piMassVsAco", "3#pi mass vs acoplanarity MC comb ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCcomb/cut30/h3piMassVsAco", "3#pi mass vs acoplanarity MC comb ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCcomb/cut27/h3piMassVsAco", "3#pi mass vs acoplanarity MC comb ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCcomb/cut35/h3piMassVsAco", "3#pi mass vs acoplanarity MC comb ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + registry1MC.add("controlMCcomb/cut23/h3piMassVsAco", "3#pi mass vs acoplanarity MC comb ;M_{inv}^{3#pi} (GeV/c^{2});A^{1+3};entries", {HistType::kTH2F, {minvAxis, acoAxis}}); + } // end of MC histograms processEfficiencyMCSG if (doprocessDoSkim) { @@ -1514,31 +1587,31 @@ struct TauTau13topo { } // end of init method - float eta(float px, float py, float pz) - // Just a simple function to return pseudorapidity - { - float arg = -2.; // outside valid range for std::atanh - float mom = std::sqrt(px * px + py * py + pz * pz); - if (mom != 0) - arg = pz / mom; - if (-1. < arg && arg < 1.) - return std::atanh(arg); // definition of eta - return -999.; - } + // float eta(float px, float py, float pz) + // // Just a simple function to return pseudorapidity + // { + // float arg = -2.; // outside valid range for std::atanh + // float mom = std::sqrt(px * px + py * py + pz * pz); + // if (mom != 0) + // arg = pz / mom; + // if (-1. < arg && arg < 1.) + // return std::atanh(arg); // definition of eta + // return -999.; + // } - float phi(float px, float py) - // Just a simple function to return azimuthal angle from 0 to 2pi - { - if (px != 0) - return (std::atan2(py, px) + o2::constants::math::PI); - return -999.; - } + // float phi(float px, float py) + // // Just a simple function to return azimuthal angle from 0 to 2pi + // { + // if (px != 0) + // return (std::atan2(py, px) + o2::constants::math::PI); + // return -999.; + // } - float pt(float px, float py) - // Just a simple function to return pt - { - return std::sqrt(px * px + py * py); - } + // float pt(float px, float py) + // // Just a simple function to return pt + // { + // return std::sqrt(px * px + py * py); + // } float rapidity(float energy, float pz) // Just a simple function to return track rapidity @@ -1557,13 +1630,14 @@ struct TauTau13topo { return angle; } - float invariantMass(float E, float px, float py, float pz) - // Just a simple function to return invariant mass - { - return std::sqrt(E * E - px * px - py * py - pz * pz); - } + // float invariantMass(float E, float px, float py, float pz) + // // Just a simple function to return invariant mass + // { + // return std::sqrt(E * E - px * px - py * py - pz * pz); + // } - float calculateDeltaPhi(TLorentzVector p, TLorentzVector p1) + // float calculateDeltaPhi(TLorentzVector p, TLorentzVector p1) + float calculateDeltaPhi(ROOT::Math::LorentzVector> p, ROOT::Math::LorentzVector> p1) { // float delta = p.Phi(); float delta = RecoDecay::constrainAngle(p.Phi()); @@ -1616,8 +1690,10 @@ struct TauTau13topo { // helper function to calculate scalar asymmetry float scalarAsymMC(auto particle1, auto particle2) { - auto pt1 = pt(particle1.px(), particle1.py()); - auto pt2 = pt(particle2.px(), particle2.py()); + // auto pt1 = pt(particle1.px(), particle1.py()); + auto pt1 = RecoDecay::pt(particle1.px(), particle1.py()); + // auto pt2 = pt(particle2.px(), particle2.py()); + auto pt2 = RecoDecay::pt(particle2.px(), particle2.py()); auto delta = pt1 - pt2; return std::abs(delta) / (pt1 + pt2); } @@ -1651,6 +1727,8 @@ struct TauTau13topo { registry.get(HIST("control/cut") + HIST(kHistoname[mode]) + HIST("/hTPCnCrossedRows"))->Fill(nCRtpc); registry.get(HIST("control/cut") + HIST(kHistoname[mode]) + HIST("/hPtSpectrumEl"))->Fill(ptelec); registry.get(HIST("control/cut") + HIST(kHistoname[mode]) + HIST("/hTofChi2El"))->Fill(tofchi2); + float aco = 1. - pi3deltaPhi / o2::constants::math::PI; + registry.get(HIST("control/cut") + HIST(kHistoname[mode]) + HIST("/h3piMassVsAco"))->Fill(pi3invMass, aco); } // fill control histograms per track in MC true @@ -1671,6 +1749,8 @@ struct TauTau13topo { registryMC.get(HIST("controlMCtrue/cut") + HIST(kHistoname[mode]) + HIST("/hPtSpectrumEl"))->Fill(ptelec); // registryMC.get(HIST("controlMCtrue/cut") + HIST(kHistoname[mode]) + HIST("/h13EtaSum"))->Fill(pi3etasum); registry1MC.get(HIST("controlMCtrue/cut") + HIST(kHistoname[mode]) + HIST("/hTofChi2El"))->Fill(tofchi2); + float aco = 1. - pi3deltaPhi / o2::constants::math::PI; + registry1MC.get(HIST("controlMCtrue/cut") + HIST(kHistoname[mode]) + HIST("/h3piMassVsAco"))->Fill(pi3invMass, aco); } // fill control histograms per track in MC true @@ -1691,6 +1771,8 @@ struct TauTau13topo { registryMC.get(HIST("controlMCcomb/cut") + HIST(kHistoname[mode]) + HIST("/hPtSpectrumEl"))->Fill(ptelec); // registryMC.get(HIST("controlMCtrue/cut") + HIST(kHistoname[mode]) + HIST("/h13EtaSum"))->Fill(pi3etasum); registry1MC.get(HIST("controlMCcomb/cut") + HIST(kHistoname[mode]) + HIST("/hTofChi2El"))->Fill(tofchi2); + float aco = 1. - pi3deltaPhi / o2::constants::math::PI; + registry1MC.get(HIST("controlMCcomb/cut") + HIST(kHistoname[mode]) + HIST("/h3piMassVsAco"))->Fill(pi3invMass, aco); } template @@ -1778,7 +1860,7 @@ struct TauTau13topo { } else { isGlobalTrack = false; } - if (std::abs(eta(track.px(), track.py(), track.pz())) < 0.8) { + if (std::abs(RecoDecay::eta(std::array{track.px(), track.py(), track.pz()})) < 0.8) { registry.get(HIST("global/hTrackEfficiencyPVGlobal"))->Fill(8., 1.); } else { isGlobalTrack = false; @@ -1919,6 +2001,45 @@ struct TauTau13topo { return true; } + // check ITS clusters, how many -1,0,1,7 + 10 if 0,1,2 layers were fired + // analysis track quality check + template + int numberOfItsClustersCheck(T track) + { + if (!track.hasITS()) + return -1; + int nITSbits = 0; + int firstThreeLayers = 0; + uint32_t clusterSizes = track.itsClusterSizes(); + for (int layer = 0; layer < 7; layer++) { + if ((clusterSizes >> (layer * 4)) & 0xf) { + nITSbits++; + if (layer < 3) + firstThreeLayers++; + } + } // end of loop over ITS bits + if (firstThreeLayers == 3) + nITSbits += 10; + + return nITSbits; + } + + // RCT check + template + int isGoodRCTflag(C const& coll) + { + if (sgSelector.isCBTHadronZdcOk(coll)) + return 4; + else if (sgSelector.isCBTHadronOk(coll)) + return 3; + else if (sgSelector.isCBTZdcOk(coll)) + return 2; + else if (sgSelector.isCBTOk(coll)) + return 1; + else + return 0; + } + // using UDCollisionsFull = soa::Join; // using UDCollisionFull = UDCollisionsFull::iterator; using UDTracksFull = soa::Join; @@ -1930,9 +2051,6 @@ struct TauTau13topo { Filter pVContributorFilter = aod::udtrack::isPVContributor == true; using PVTracks = soa::Filtered; - // using LabeledTracks = soa::Join; - using LabeledTracks = soa::Join; - Preslice perCollision = aod::udtrack::udCollisionId; // PVContributors in MC handling // Filter pVContributorFilterMC = aod::udtrack::isPVContributor == true; // using PVTracksMC = soa::Filtered; @@ -2010,7 +2128,8 @@ struct TauTau13topo { int nEtaIn15 = 0; int nITSbits = -1; int npT100 = 0; - TLorentzVector p; + // TLorentzVector p; + ROOT::Math::LorentzVector> p; // auto const pionMass = MassPiPlus; // auto const electronMass = MassElectron; bool flagGlobalCheck = true; @@ -2019,7 +2138,8 @@ struct TauTau13topo { // loop over PV contributors for (const auto& trk : PVContributors) { qtot += trk.sign(); - p.SetXYZM(trk.px(), trk.py(), trk.pz(), MassPiPlus); + // p.SetXYZM(trk.px(), trk.py(), trk.pz(), MassPiPlus); + p.SetXYZT(trk.px(), trk.py(), trk.pz(), RecoDecay::e(trk.px(), trk.py(), trk.pz(), MassPiPlus)); registry.get(HIST("global/hTrackPtPV"))->Fill(p.Pt()); if (std::abs(p.Eta()) < trkEtacut) nEtaIn15++; // 1.5 is a default @@ -2093,7 +2213,9 @@ struct TauTau13topo { registry.get(HIST("global1/hNTracks"))->Fill(dgtracks.size()); registry.get(HIST("global1/hNTracksPV"))->Fill(PVContributors.size()); for (const auto& trk : PVContributors) { - p.SetXYZM(trk.px(), trk.py(), trk.pz(), MassPiPlus); + // p.SetXYZM(trk.px(), trk.py(), trk.pz(), MassPiPlus); + // p.SetXYZT(trk.px(), trk.py(), trk.pz(), energy(trk.px(), trk.py(), trk.pz(), MassPiPlus)); + p.SetXYZT(trk.px(), trk.py(), trk.pz(), RecoDecay::e(trk.px(), trk.py(), trk.pz(), MassPiPlus)); registry.get(HIST("global1/hTrackPtPV"))->Fill(p.Pt()); registry.get(HIST("global1/hTrackEtaPhiPV"))->Fill(p.Eta(), p.Phi()); } @@ -2253,23 +2375,27 @@ struct TauTau13topo { // 12 34 | 01 23 |//1 //6 | 0 5 |counter<3?counter:5-counter counter<3?0:1 // 13 24 | 02 13 |//2 //5 | 1 4 | // 14 23 | 03 12 |//3 //4 | 2 3 | - TLorentzVector p1, p2; - TLorentzVector gammaPair[3][2]; - float invMass2El[3][2]; + // TLorentzVector p1, p2; + ROOT::Math::LorentzVector> p1, p2; + // TLorentzVector gammaPair[3][2]; + ROOT::Math::LorentzVector> gammaPair[3][2]; + float invMass2El[3][2]; // inv. mass squared int counterTmp = 0; bool flagIMGam2ePV[4] = {true, true, true, true}; for (const auto& trk : PVContributors) { - p.SetXYZM(trk.px(), trk.py(), trk.pz(), MassElectron); + // p.SetXYZM(trk.px(), trk.py(), trk.pz(), MassElectron); + p.SetXYZT(trk.px(), trk.py(), trk.pz(), RecoDecay::e(trk.px(), trk.py(), trk.pz(), MassElectron)); for (const auto& trk1 : PVContributors) { if (trk.index() >= trk1.index()) continue; if (trk1.hasTPC()) nPiHasTPC[trk.index()]++; - p1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), MassElectron); - invMass2El[(counterTmp < 3 ? counterTmp : 5 - counterTmp)][(counterTmp < 3 ? 0 : 1)] = (p + p1).Mag2(); + // p1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), MassElectron); + p1.SetXYZT(trk1.px(), trk1.py(), trk1.pz(), RecoDecay::e(trk1.px(), trk1.py(), trk1.pz(), MassElectron)); + invMass2El[(counterTmp < 3 ? counterTmp : 5 - counterTmp)][(counterTmp < 3 ? 0 : 1)] = (p + p1).mag2(); gammaPair[(counterTmp < 3 ? counterTmp : 5 - counterTmp)][(counterTmp < 3 ? 0 : 1)] = (p + p1); - registry.get(HIST("control/cut0/hInvMass2ElAll"))->Fill((p + p1).Mag2()); + registry.get(HIST("control/cut0/hInvMass2ElAll"))->Fill((p + p1).mag2()); counterTmp++; if ((p + p1).M() < 0.015) { flagIMGam2ePV[trk.index()] = false; @@ -2279,15 +2405,17 @@ struct TauTau13topo { } // end of loop over PVContributors // first loop to add all the tracks together - p = TLorentzVector(0., 0., 0., 0.); + // p = TLorentzVector(0., 0., 0., 0.); + p.SetXYZT(0., 0., 0., 0.); for (const auto& trk : PVContributors) { - p1.SetXYZM(trk.px(), trk.py(), trk.pz(), MassPiPlus); + // p1.SetXYZM(trk.px(), trk.py(), trk.pz(), MassPiPlus); + p1.SetXYZT(trk.px(), trk.py(), trk.pz(), RecoDecay::e(trk.px(), trk.py(), trk.pz(), MassPiPlus)); p += p1; scalarPtsum += trk.pt(); } // end of loop over PVContributors float pttot = p.Pt(); - float mass4pi = p.Mag(); + float mass4pi = p.mag(); TVector3 v1(0, 0, 0); TVector3 vtmp(0, 0, 0); @@ -2309,9 +2437,11 @@ struct TauTau13topo { registry.get(HIST("global/hTrkCheck"))->Fill(tmpTrkCheck); // inv mass of 3pi + 1e - p1.SetXYZM(trk.px(), trk.py(), trk.pz(), MassPiPlus); - p2.SetXYZM(trk.px(), trk.py(), trk.pz(), MassElectron); - mass3pi1e[counterTmp] = (p - p1 + p2).Mag(); + // p1.SetXYZM(trk.px(), trk.py(), trk.pz(), MassPiPlus); + p1.SetXYZT(trk.px(), trk.py(), trk.pz(), RecoDecay::e(trk.px(), trk.py(), trk.pz(), MassPiPlus)); + // p2.SetXYZM(trk.px(), trk.py(), trk.pz(), MassElectron); + p2.SetXYZT(trk.px(), trk.py(), trk.pz(), RecoDecay::e(trk.px(), trk.py(), trk.pz(), MassElectron)); + mass3pi1e[counterTmp] = (p - p1 + p2).mag(); v1.SetXYZ(trk.px(), trk.py(), trk.pz()); for (const auto& trk1 : PVContributors) { @@ -2358,14 +2488,15 @@ struct TauTau13topo { trkTime[counterTmp] = trk.trackTime(); trkTimeRes[counterTmp] = trk.trackTimeRes(); - p1.SetXYZM(trk.px(), trk.py(), trk.pz(), MassPiPlus); + // p1.SetXYZM(trk.px(), trk.py(), trk.pz(), MassPiPlus); + p1.SetXYZT(trk.px(), trk.py(), trk.pz(), RecoDecay::e(trk.px(), trk.py(), trk.pz(), MassPiPlus)); tmpMomentum[counterTmp] = p1.P(); tmpPt[counterTmp] = p1.Pt(); tmpDedx[counterTmp] = trk.tpcSignal(); tmpTofNsigmaEl[counterTmp] = trk.tofNSigmaEl(); deltaPhiTmp = calculateDeltaPhi(p - p1, p1); - pi3invMass[counterTmp] = (p - p1).Mag(); + pi3invMass[counterTmp] = (p - p1).mag(); pi3pt[counterTmp] = (p - p1).Pt(); pi3deltaPhi[counterTmp] = deltaPhiTmp; pi3assymav[counterTmp] = (p1.Pt() - (scalarPtsum - p1.Pt()) / 3.) / (p1.Pt() + (scalarPtsum - p1.Pt()) / 3.); @@ -3216,6 +3347,7 @@ struct TauTau13topo { // loop over MC particles for (const auto& mcParticle : mcParticles) { + // LOGF(info, " mcParticle pdg %d", mcParticle.pdgCode()); // primaries // if (mcParticle.isPhysicalPrimary()) { // countPrim++; @@ -3227,7 +3359,8 @@ struct TauTau13topo { countGen++; if (mcParticle.isPhysicalPrimary()) { countBoth++; - if (mcParticle.pdgCode() != 22 && std::abs(mcParticle.pdgCode()) != 12 && std::abs(mcParticle.pdgCode()) != 14 && std::abs(mcParticle.pdgCode()) != 16 && mcParticle.pdgCode() != 130 && mcParticle.pdgCode() != 111) { + // if (mcParticle.pdgCode() != 22 && std::abs(mcParticle.pdgCode()) != 12 && std::abs(mcParticle.pdgCode()) != 14 && std::abs(mcParticle.pdgCode()) != 16 && mcParticle.pdgCode() != 130 && mcParticle.pdgCode() != 111) { + if (mcParticle.pdgCode() != kGamma && std::abs(mcParticle.pdgCode()) != kNuE && std::abs(mcParticle.pdgCode()) != kNuMu && std::abs(mcParticle.pdgCode()) != kNuTau && mcParticle.pdgCode() != kK0Long && mcParticle.pdgCode() != kPi0) { countCharged++; registryMC.get(HIST("globalMC/hMCetaGen"))->Fill(mcParticle.eta()); @@ -3237,7 +3370,8 @@ struct TauTau13topo { if (mcParticle.has_mothers()) { auto const& mother = mcParticle.mothers_first_as(); - if (std::abs(mother.pdgCode()) == 15) { + // if (std::abs(mother.pdgCode()) == 15) { + if (std::abs(mother.pdgCode()) == kTauMinus) { countChargedFromTau++; } // mother is tau } // mc particle has mother @@ -3248,7 +3382,8 @@ struct TauTau13topo { // // tau+/- // - if (std::abs(mcParticle.pdgCode()) == 15) { // tau+/- + // if (std::abs(mcParticle.pdgCode()) == 15) { // tau+/- + if (std::abs(mcParticle.pdgCode()) == kTauMinus) { // 15 = tau+/- countTau++; if (countTau <= 2) { etaTau[countTau - 1] = mcParticle.eta(); @@ -3265,15 +3400,15 @@ struct TauTau13topo { if (mcParticle.has_daughters()) { for (const auto& daughter : mcParticle.daughters_as()) { // pions from tau - if (std::abs(daughter.pdgCode()) == 211) { // 211 = pi+ + if (std::abs(daughter.pdgCode()) == kPiPlus) { // 211 = pi+ pionCounter++; tmpPionIndex = daughter.index(); // returns index of daughter of tau, not in the event, not in the MC particles if (std::abs(daughter.eta()) > 0.9) partFromTauInEta = false; } // end of pion check // electron from tau - if (std::abs(daughter.pdgCode()) == 11) { // 11 = electron - if (daughter.pdgCode() == 11) + if (std::abs(daughter.pdgCode()) == kElectron) { // 11 = electron + if (daughter.pdgCode() == kElectron) flagElPlusElMinus = true; registryMC.get(HIST("electronMC/hMCeta"))->Fill(daughter.eta()); registryMC.get(HIST("electronMC/hMCphi"))->Fill(daughter.phi()); @@ -3288,8 +3423,8 @@ struct TauTau13topo { partFromTauInEta = false; } // end of electron check // muon from tau - if (std::abs(daughter.pdgCode()) == 13) { - if (daughter.pdgCode() == 13) + if (std::abs(daughter.pdgCode()) == kMuonMinus) { // 13 + if (daughter.pdgCode() == kMuonMinus) // 13 flagMuPlusMuMinus = true; muonFound = !muonFound; partPt = static_cast(daughter.pt()); @@ -3305,7 +3440,7 @@ struct TauTau13topo { singlePionFound = true; singlePionIndex = tmpPionIndex; auto mcPartTmp = mcParticle.daughters_as().begin() + singlePionIndex; - if (mcPartTmp.pdgCode() == -211) + if (mcPartTmp.pdgCode() == kPiMinus) // -211 flagPiPlusPiMinus = true; partPt = static_cast(mcPartTmp.pt()); // motherOfSinglePionIndex = mcParticle.index(); @@ -3393,20 +3528,42 @@ struct TauTau13topo { } // end of processSimpleMCSG + // using LabeledTracks = soa::Join; + using LabeledTracks = soa::Join; + Preslice perCollision = aod::udtrack::udCollisionId; + // ZDC is not reproduced in MC, it is for a consistency + using FullMcUdCollisions = soa::Join; + // using FullMcUdCollisions = soa::Join; + // PresliceUnsorted colPerMcCollision = aod::udcollision::udMcCollisionId; + // PresliceUnsorted partPerMcCollision = aod::udmcparticle::udMcCollisionId; + void processEfficiencyMCSG(aod::UDMcCollision const& mcCollision, + // void processEfficiencyMCSG(aod::UDMcCollisions const& mcCollisions, // soa::SmallGroups> const& collisions, - soa::SmallGroups> const& collisions, + // soa::SmallGroups> const& collisions, + soa::SmallGroups const& collisions, + // FullMcUdCollisions const& collisionsFull, LabeledTracks const& tracks, aod::UDMcParticles const& mcParticles) + // aod::UDMcParticles const& mcParts) { + // LOGF(info, " Per DF: UDMcParticles size %d, UDMcCollisions size %d, FullMcUdCollisions size %d", mcParts.size(), mcCollisions.size(), collisionsFull.size()); + // LOGF(info, " Per DF: UDMcParticles size %d, UDMcCollisions size %d, FullMcUdCollisions size %d", mcParts.size(), mcCollisions.size(), collisions.size()); + + // loop over generated collisions + // for (const auto &mcCollision : mcCollisions) { + // LOGF(info, " Per mcCollision not sliced: UDMcParticles size %d, FullMcUdCollisions size %d", mcParts.size(), collisionsFull.size()); + if (verbose) { LOGF(info, " GeneratorIDtot %d", mcCollision.generatorsID()); // below is not implemented in UDMcCollisions // LOGF(info," GeneratorIDtot %d, GenID %d, subGenID %d, source %d", mcCollision.generatorsID(), mcCollision.getGeneratorId(), mcCollision.getSubGeneratorId(), mcCollision.getSourceId()); } + // registry1MC.get(HIST("globalMC/hGeneratorID"))->Fill(mcCollision.getGeneratorID()); registry1MC.get(HIST("globalMC/hGeneratorID"))->Fill(mcCollision.generatorsID()); registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(10., 1.); if (!(generatorIDMC < 0)) { // do not check generatorsID process if generatorIDMC < 0 + // if (mcCollision.getGeneratorID() != generatorIDMC) if (mcCollision.generatorsID() != generatorIDMC) return; } @@ -3424,26 +3581,38 @@ struct TauTau13topo { bool tauInRapidity = true; bool partFromTauInEta = true; - TLorentzVector tmp(0., 0., 0., 0.); + // TLorentzVector tmp(0., 0., 0., 0.); + ROOT::Math::LorentzVector> tmp(0., 0., 0., 0.); + + // get reconstructed collisions associated to generated collision + // auto const& collisions = collisionsFull.sliceBy(colPerMcCollision, mcCollision.globalIndex()); + // LOGF(info, " per mcCollisions sliced collisions.size %d", collisions.size()); + + // get MC particles associated to generated collision + // auto const& mcParticles = mcParts.sliceBy(partPerMcCollision, mcCollision.globalIndex()); + // LOGF(info, " per mcCollisions sliced mcParticles.size %d", mcParticles.size()); for (const auto& mcParticle : mcParticles) { + // LOGF(info, " mcParticle pdg %d", mcParticle.pdgCode()); if (mcParticle.isPhysicalPrimary()) { - if (mcParticle.pdgCode() != 22 && std::abs(mcParticle.pdgCode()) != 12 && std::abs(mcParticle.pdgCode()) != 14 && std::abs(mcParticle.pdgCode()) != 16 && mcParticle.pdgCode() != 130 && mcParticle.pdgCode() != 111) { + // if (mcParticle.pdgCode() != 22 && std::abs(mcParticle.pdgCode()) != 12 && std::abs(mcParticle.pdgCode()) != 14 && std::abs(mcParticle.pdgCode()) != 16 && mcParticle.pdgCode() != 130 && mcParticle.pdgCode() != 111) { + if (mcParticle.pdgCode() != kGamma && std::abs(mcParticle.pdgCode()) != kNuE && std::abs(mcParticle.pdgCode()) != kNuMu && std::abs(mcParticle.pdgCode()) != kNuTau && mcParticle.pdgCode() != kK0Long && mcParticle.pdgCode() != kPi0) { if (mcParticle.has_mothers()) { auto const& mother = mcParticle.mothers_first_as(); + // LOGF(info, " mcParticle has mother %d",mother.pdgCode()); tmp.SetPxPyPzE(mother.px(), mother.py(), mother.pz(), mother.e()); - if (std::abs(mother.pdgCode()) == 15) { + if (std::abs(mother.pdgCode()) == kTauMinus) { // 15 if (std::abs(rapidity(mother.e(), mother.pz())) > 0.9) // if (std::abs(tmp.Rapidity()) > 0.9) tauInRapidity = false; - if (std::abs(eta(mcParticle.px(), mcParticle.py(), mcParticle.pz())) > 0.9) + if (std::abs(RecoDecay::eta(std::array{mcParticle.px(), mcParticle.py(), mcParticle.pz()})) > 0.9) // if (std::abs(tmp.Eta()) > 0.9) partFromTauInEta = false; - if (std::abs(mcParticle.pdgCode()) == 11) { + if (std::abs(mcParticle.pdgCode()) == kElectron) { // 11 index1ProngMC = mcParticle.index(); is1ProngElectronMC = true; - } else if (std::abs(mcParticle.pdgCode()) == 13) { + } else if (std::abs(mcParticle.pdgCode()) == kMuonMinus) { // 13 index1ProngMC = mcParticle.index(); // is1ProngMuonMC = true; } @@ -3457,16 +3626,15 @@ struct TauTau13topo { } count++; if (collisions.size() > 0) { - registryMC.get(HIST("globalMCrec/hMCetaGenCol"))->Fill(eta(mcParticle.px(), mcParticle.py(), mcParticle.pz())); - registryMC.get(HIST("globalMCrec/hMCphiGenCol"))->Fill(phi(mcParticle.px(), mcParticle.py())); + registryMC.get(HIST("globalMCrec/hMCetaGenCol"))->Fill(RecoDecay::eta(std::array{mcParticle.px(), mcParticle.py(), mcParticle.pz()})); + registryMC.get(HIST("globalMCrec/hMCphiGenCol"))->Fill(RecoDecay::phi(mcParticle.px(), mcParticle.py())); registryMC.get(HIST("globalMCrec/hMCyGenCol"))->Fill(rapidity(mcParticle.e(), mcParticle.pz())); - registryMC.get(HIST("globalMCrec/hMCptGenCol"))->Fill(pt(mcParticle.px(), mcParticle.py())); + registryMC.get(HIST("globalMCrec/hMCptGenCol"))->Fill(RecoDecay::pt(mcParticle.px(), mcParticle.py())); } } // mother is tau } // has mothers } // charged particles } // end if isPhysicalPrimary - } // end loop over mcParticle registryMC.get(HIST("globalMC/hMCefficiency"))->Fill(11., 1.); @@ -3492,10 +3660,10 @@ struct TauTau13topo { // // motherIndex[i] = (tmpMC.mothers_first_as()).globalIndex(); // } int motherIndex1Pi = motherIndex[0]; - int motherIndexNew = -1; + int motherIndexNew = 3; // was -1 int nDifferences = 0; for (int i = 1; i < 4; i++) { - if (motherIndex1Pi != motherIndex[i]) { // the same mother index + if (motherIndex1Pi != motherIndex[i]) { // the same mother (tau) index nDifferences++; motherIndexNew = i; } @@ -3508,8 +3676,8 @@ struct TauTau13topo { // if (!onlyPi) LOGF(info, "ERROR: should be 4 pions, but they are not!"); } // end of special check for pi + 3pi - int index3ProngMC[3]; - if (index1ProngMC > 0) { // electron or muon case + 3pi + int index3ProngMC[3] = {0, 0, 0}; // initialised of request + if (index1ProngMC > 0) { // electron or muon case + 3pi int index3pi = 0; for (int i = 0; i < 4; i++) { if (index1ProngMC == indexProngMC[i]) @@ -3527,7 +3695,8 @@ struct TauTau13topo { auto const& tmpPion2MC = mcParticles.begin() + index3ProngMC[1]; auto const& tmpPion3MC = mcParticles.begin() + index3ProngMC[2]; - if (std::abs(tmpPion1MC.pdgCode()) == 211 && std::abs(tmpPion2MC.pdgCode()) == 211 && std::abs(tmpPion3MC.pdgCode()) == 211) + // if (std::abs(tmpPion1MC.pdgCode()) == 211 && std::abs(tmpPion2MC.pdgCode()) == 211 && std::abs(tmpPion3MC.pdgCode()) == 211) + if (std::abs(tmpPion1MC.pdgCode()) == kPiPlus && std::abs(tmpPion2MC.pdgCode()) == kPiPlus && std::abs(tmpPion3MC.pdgCode()) == kPiPlus) // 211 211 211 is3prong3PiMC = true; // @@ -3547,13 +3716,13 @@ struct TauTau13topo { registryMC.get(HIST("efficiencyMCEl/hMCdeltaAlphaEpi"))->Fill(deltaAlpha2); registryMC.get(HIST("efficiencyMCEl/hMCdeltaAlphaEpi"))->Fill(deltaAlpha3); // - registryMC.get(HIST("efficiencyMCEl/hMCdeltaPhiEpi"))->Fill(calculateDeltaPhi(phi(tmp1ProngMC.px(), tmp1ProngMC.py()), phi(tmpPion1MC.px(), tmpPion1MC.py()))); - registryMC.get(HIST("efficiencyMCEl/hMCdeltaPhiEpi"))->Fill(calculateDeltaPhi(phi(tmp1ProngMC.px(), tmp1ProngMC.py()), phi(tmpPion2MC.px(), tmpPion2MC.py()))); - registryMC.get(HIST("efficiencyMCEl/hMCdeltaPhiEpi"))->Fill(calculateDeltaPhi(phi(tmp1ProngMC.px(), tmp1ProngMC.py()), phi(tmpPion3MC.px(), tmpPion3MC.py()))); + registryMC.get(HIST("efficiencyMCEl/hMCdeltaPhiEpi"))->Fill(calculateDeltaPhi(RecoDecay::phi(tmp1ProngMC.px(), tmp1ProngMC.py()), RecoDecay::phi(tmpPion1MC.px(), tmpPion1MC.py()))); + registryMC.get(HIST("efficiencyMCEl/hMCdeltaPhiEpi"))->Fill(calculateDeltaPhi(RecoDecay::phi(tmp1ProngMC.px(), tmp1ProngMC.py()), RecoDecay::phi(tmpPion2MC.px(), tmpPion2MC.py()))); + registryMC.get(HIST("efficiencyMCEl/hMCdeltaPhiEpi"))->Fill(calculateDeltaPhi(RecoDecay::phi(tmp1ProngMC.px(), tmp1ProngMC.py()), RecoDecay::phi(tmpPion3MC.px(), tmpPion3MC.py()))); // - registryMC.get(HIST("efficiencyMCEl/hMCdeltaPhiPipi"))->Fill(calculateDeltaPhi(phi(tmpPion1MC.px(), tmpPion1MC.py()), phi(tmpPion2MC.px(), tmpPion2MC.py()))); - registryMC.get(HIST("efficiencyMCEl/hMCdeltaPhiPipi"))->Fill(calculateDeltaPhi(phi(tmpPion1MC.px(), tmpPion1MC.py()), phi(tmpPion3MC.px(), tmpPion3MC.py()))); - registryMC.get(HIST("efficiencyMCEl/hMCdeltaPhiPipi"))->Fill(calculateDeltaPhi(phi(tmpPion2MC.px(), tmpPion2MC.py()), phi(tmpPion3MC.px(), tmpPion3MC.py()))); + registryMC.get(HIST("efficiencyMCEl/hMCdeltaPhiPipi"))->Fill(calculateDeltaPhi(RecoDecay::phi(tmpPion1MC.px(), tmpPion1MC.py()), RecoDecay::phi(tmpPion2MC.px(), tmpPion2MC.py()))); + registryMC.get(HIST("efficiencyMCEl/hMCdeltaPhiPipi"))->Fill(calculateDeltaPhi(RecoDecay::phi(tmpPion1MC.px(), tmpPion1MC.py()), RecoDecay::phi(tmpPion3MC.px(), tmpPion3MC.py()))); + registryMC.get(HIST("efficiencyMCEl/hMCdeltaPhiPipi"))->Fill(calculateDeltaPhi(RecoDecay::phi(tmpPion2MC.px(), tmpPion2MC.py()), RecoDecay::phi(tmpPion3MC.px(), tmpPion3MC.py()))); // auto deltaAlphaPi1 = deltaAlpha(tmpPion1MC, tmpPion2MC); @@ -3566,13 +3735,13 @@ struct TauTau13topo { float energyInCone = 0; float angleLimit = 0.5; if (deltaAlpha1 < angleLimit) { - energyInCone += pt(tmpPion1MC.px(), tmpPion1MC.py()); + energyInCone += RecoDecay::pt(tmpPion1MC.px(), tmpPion1MC.py()); } if (deltaAlpha2 < angleLimit) { - energyInCone += pt(tmpPion2MC.px(), tmpPion2MC.py()); + energyInCone += RecoDecay::pt(tmpPion2MC.px(), tmpPion2MC.py()); } if (deltaAlpha3 < angleLimit) { - energyInCone += pt(tmpPion3MC.px(), tmpPion3MC.py()); + energyInCone += RecoDecay::pt(tmpPion3MC.px(), tmpPion3MC.py()); } registryMC.get(HIST("efficiencyMCEl/hMCvirtCal"))->Fill(energyInCone); // @@ -3585,17 +3754,19 @@ struct TauTau13topo { registryMC.get(HIST("efficiencyMCEl/hMCVector"))->Fill(vectorAsym(tmp1ProngMC, tmpPion3MC)); // add eta phi - registryMC.get(HIST("efficiencyMCEl/hMCptEl"))->Fill(pt(tmp1ProngMC.px(), tmp1ProngMC.py())); + registryMC.get(HIST("efficiencyMCEl/hMCptEl"))->Fill(RecoDecay::pt(tmp1ProngMC.px(), tmp1ProngMC.py())); float px3pi = tmpPion1MC.px() + tmpPion2MC.px() + tmpPion3MC.px(); float py3pi = tmpPion1MC.py() + tmpPion2MC.py() + tmpPion3MC.py(); float pz3pi = tmpPion1MC.pz() + tmpPion2MC.pz() + tmpPion3MC.pz(); float en3pi = tmpPion1MC.e() + tmpPion2MC.e() + tmpPion3MC.e(); - registryMC.get(HIST("efficiencyMCEl/hMCpt4trk"))->Fill(pt(tmp1ProngMC.px() + px3pi, tmp1ProngMC.py() + py3pi)); - registryMC.get(HIST("efficiencyMCEl/hMCinvmass4pi"))->Fill(invariantMass(tmp1ProngMC.e() + en3pi, tmp1ProngMC.px() + px3pi, tmp1ProngMC.py() + py3pi, tmp1ProngMC.pz() + pz3pi)); - registryMC.get(HIST("efficiencyMCEl/hMCinvmass3pi"))->Fill(invariantMass(en3pi, px3pi, py3pi, pz3pi)); - registryMC.get(HIST("efficiencyMCEl/hMCdeltaphi13"))->Fill(calculateDeltaPhi(phi(tmp1ProngMC.px(), tmp1ProngMC.py()), phi(px3pi, py3pi))); + registryMC.get(HIST("efficiencyMCEl/hMCpt4trk"))->Fill(RecoDecay::pt(tmp1ProngMC.px() + px3pi, tmp1ProngMC.py() + py3pi)); + // registryMC.get(HIST("efficiencyMCEl/hMCinvmass4pi"))->Fill(invariantMass(tmp1ProngMC.e() + en3pi, tmp1ProngMC.px() + px3pi, tmp1ProngMC.py() + py3pi, tmp1ProngMC.pz() + pz3pi)); + registryMC.get(HIST("efficiencyMCEl/hMCinvmass4pi"))->Fill(RecoDecay::m(std::array{(tmp1ProngMC.px() + px3pi), (tmp1ProngMC.py() + py3pi), (tmp1ProngMC.pz() + pz3pi)}, (tmp1ProngMC.e() + en3pi))); + // registryMC.get(HIST("efficiencyMCEl/hMCinvmass3pi"))->Fill(invariantMass(en3pi, px3pi, py3pi, pz3pi)); + registryMC.get(HIST("efficiencyMCEl/hMCinvmass3pi"))->Fill(RecoDecay::m(std::array{px3pi, py3pi, pz3pi}, en3pi)); + registryMC.get(HIST("efficiencyMCEl/hMCdeltaphi13"))->Fill(calculateDeltaPhi(RecoDecay::phi(tmp1ProngMC.px(), tmp1ProngMC.py()), RecoDecay::phi(px3pi, py3pi))); // reconstructed event if (collisions.size() < 1) @@ -3724,7 +3895,7 @@ struct TauTau13topo { nPVTracks++; trackCharge += track.sign(); // if (std::abs(eta(track.px(),track.py(),track.pz())) >= trkEtacut) allInEtaAcceptance = false; - if (std::abs(eta(track.px(), track.py(), track.pz())) < trkEtacut) + if (std::abs(RecoDecay::eta(std::array{track.px(), track.py(), track.pz()})) < trkEtacut) nTrkInEtaRange++; if (track.pt() > 0.1) nTrkAbovePtThreshold++; @@ -3857,8 +4028,10 @@ struct TauTau13topo { registryMC.get(HIST("global1MCrec/hNTracks"))->Fill(groupedTracks.size()); registryMC.get(HIST("global1MCrec/hNTracksPV"))->Fill(nPVTracks); - TLorentzVector p, p1; - p.SetXYZM(0., 0., 0., 0.); + // TLorentzVector p, p1; + ROOT::Math::LorentzVector> p, p1; + // p.SetXYZM(0., 0., 0., 0.); + p.SetXYZT(0., 0., 0., 0.); TVector3 v1(0, 0, 0); TVector3 v2(0, 0, 0); float scalarPtsum = 0; @@ -3888,17 +4061,20 @@ struct TauTau13topo { flagVcalPV[i] = true; } } // end of second loop - float tmpEtaData = eta(tmptrack.px(), tmptrack.py(), tmptrack.pz()); - float tmpPhiData = phi(tmptrack.px(), tmptrack.py()); + float tmpEtaData = RecoDecay::eta(std::array{tmptrack.px(), tmptrack.py(), tmptrack.pz()}); + float tmpPhiData = RecoDecay::phi(tmptrack.px(), tmptrack.py()); registryMC.get(HIST("global1MCrec/hTrackEtaPhiPV"))->Fill(tmpEtaData, tmpPhiData); registryMC.get(HIST("global1MCrec/hTrackPtPV"))->Fill(tmptrack.pt()); - p1.SetXYZM(v1.X(), v1.Y(), v1.Z(), MassPiPlus); // in case of ghost + // p1.SetXYZM(v1.X(), v1.Y(), v1.Z(), MassPiPlus); // in case of ghost + p1.SetXYZT(v1.X(), v1.Y(), v1.Z(), RecoDecay::e(v1.X(), v1.Y(), v1.Z(), MassPiPlus)); // in case of ghost if (trackMCId[i] >= 0) { - p1.SetXYZM(v1.X(), v1.Y(), v1.Z(), (std::abs(tmptrack.udMcParticle().pdgCode()) == 211 ? MassPiPlus : MassElectron)); - float tmpPt = pt(tmptrack.udMcParticle().px(), tmptrack.udMcParticle().py()); - float tmpEta = eta(tmptrack.udMcParticle().px(), tmptrack.udMcParticle().py(), tmptrack.udMcParticle().pz()); - float tmpPhi = phi(tmptrack.udMcParticle().px(), tmptrack.udMcParticle().py()); + // p1.SetXYZM(v1.X(), v1.Y(), v1.Z(), (std::abs(tmptrack.udMcParticle().pdgCode()) == 211 ? MassPiPlus : MassElectron)); + // p1.SetXYZT(v1.X(), v1.Y(), v1.Z(), energy(v1.X(), v1.Y(), v1.Z(), (std::abs(tmptrack.udMcParticle().pdgCode()) == 211 ? MassPiPlus : MassElectron))); + p1.SetXYZT(v1.X(), v1.Y(), v1.Z(), RecoDecay::e(v1.X(), v1.Y(), v1.Z(), (std::abs(tmptrack.udMcParticle().pdgCode()) == kPiPlus ? MassPiPlus : MassElectron))); // 211 + float tmpPt = RecoDecay::pt(tmptrack.udMcParticle().px(), tmptrack.udMcParticle().py()); + float tmpEta = RecoDecay::eta(std::array{tmptrack.udMcParticle().px(), tmptrack.udMcParticle().py(), tmptrack.udMcParticle().pz()}); + float tmpPhi = RecoDecay::phi(tmptrack.udMcParticle().px(), tmptrack.udMcParticle().py()); registryMC.get(HIST("global1MCrec/hpTGenRecTracksPV"))->Fill(tmptrack.pt(), tmpPt); registryMC.get(HIST("global1MCrec/hDeltapTGenRecVsRecpTTracksPV"))->Fill(tmptrack.pt() - tmpPt, tmptrack.pt()); registryMC.get(HIST("global1MCrec/hEtaGenRecTracksPV"))->Fill(tmpEtaData, tmpEta); @@ -4010,7 +4186,7 @@ struct TauTau13topo { // // temporary control variables per event with combinatorics float pttot = p.Pt(); - float mass4pi = p.Mag(); + float mass4pi = p.mag(); int counterTmp = 0; float nSigmaEl[4]; @@ -4053,9 +4229,11 @@ struct TauTau13topo { auto const tmptrack = groupedTracks.begin() + trackId[i]; // if (tmptrack.hasTOF()) trkHasTof[i] = true; v1.SetXYZ(tmptrack.px(), tmptrack.py(), tmptrack.pz()); - p1.SetXYZM(v1.X(), v1.Y(), v1.Z(), MassPiPlus); // in case of ghost + // p1.SetXYZM(v1.X(), v1.Y(), v1.Z(), MassPiPlus); // in case of ghost + p1.SetXYZT(v1.X(), v1.Y(), v1.Z(), RecoDecay::e(v1.X(), v1.Y(), v1.Z(), MassPiPlus)); // in case of ghost if (trackMCId[i] >= 0) { - p1.SetXYZM(v1.X(), v1.Y(), v1.Z(), (i == matchedElIndexToData ? MassElectron : MassPiPlus)); + // p1.SetXYZM(v1.X(), v1.Y(), v1.Z(), (i == matchedElIndexToData ? MassElectron : MassPiPlus)); + p1.SetXYZT(v1.X(), v1.Y(), v1.Z(), RecoDecay::e(v1.X(), v1.Y(), v1.Z(), (i == matchedElIndexToData ? MassElectron : MassPiPlus))); } nSigmaEl[counterTmp] = tmptrack.tpcNSigmaEl(); @@ -4097,7 +4275,7 @@ struct TauTau13topo { tmpTofNsigmaEl[counterTmp] = tmptrack.tofNSigmaEl(); deltaPhiTmp = calculateDeltaPhi(p - p1, p1); - pi3invMass[counterTmp] = (p - p1).Mag(); + pi3invMass[counterTmp] = (p - p1).mag(); pi3pt[counterTmp] = (p - p1).Pt(); pi3deltaPhi[counterTmp] = deltaPhiTmp; pi3assymav[counterTmp] = (p1.Pt() - (scalarPtsum - p1.Pt()) / 3.) / (p1.Pt() + (scalarPtsum - p1.Pt()) / 3.); @@ -4816,6 +4994,8 @@ struct TauTau13topo { } // end of loop over collisions } // end of electron + 3pi + // } // end of loop over mcCollisions + } // end of processEfficiencyMCSG // skimming: only 4 tracks selection @@ -4845,11 +5025,13 @@ struct TauTau13topo { int nEtaIn15 = 0; int npT100 = 0; // int qtot = 0; - int16_t qtot = 0; - TLorentzVector p; + int8_t qtot = 0; + // TLorentzVector p; + ROOT::Math::LorentzVector> p; for (const auto& trk : PVContributors) { qtot += trk.sign(); - p.SetXYZM(trk.px(), trk.py(), trk.pz(), MassPiPlus); + // p.SetXYZM(trk.px(), trk.py(), trk.pz(), MassPiPlus); + p.SetXYZT(trk.px(), trk.py(), trk.pz(), RecoDecay::e(trk.px(), trk.py(), trk.pz(), MassPiPlus)); if (std::abs(p.Eta()) < trkEtacut) nEtaIn15++; // 0.9 is a default if (trk.pt() > 0.1) @@ -4898,14 +5080,18 @@ struct TauTau13topo { return; registrySkim.get(HIST("skim/efficiency"))->Fill(7., 1.); + // RCT variable + int rct = 0; + rct = isGoodRCTflag(dgcand); + // // variables per track // int counterTmp = 0; float px[4], py[4], pz[4]; // int sign[4]; - // float dcaZ[4]; - // float dcaXY[4]; + float dcaZ[4]; + float dcaXY[4]; float tmpDedx[4]; float tmpTofNsigmaEl[4]; @@ -4922,8 +5108,12 @@ struct TauTau13topo { // float chi2TPC[4]; // float chi2ITS[4]; float chi2TOF[4] = {-1., -1., -1., -1.}; - // float nclTPCfind[4]; int nclTPCcrossedRows[4]; + int nclTPCfind[4]; + float nclTPCchi2[4]; + float trkITSchi2[4]; + int trkITScl[4]; + // double trkTime[4]; // float trkTimeRes[4]; float trkTofSignal[4]; @@ -4934,8 +5124,8 @@ struct TauTau13topo { py[counterTmp] = trk.py(); pz[counterTmp] = trk.pz(); // sign[counterTmp] = trk.sign(); - // dcaZ[counterTmp] = trk.dcaZ(); - // dcaXY[counterTmp] = trk.dcaXY(); + dcaZ[counterTmp] = trk.dcaZ(); + dcaXY[counterTmp] = trk.dcaXY(); tmpDedx[counterTmp] = trk.tpcSignal(); nSigmaEl[counterTmp] = trk.tpcNSigmaEl(); @@ -4958,6 +5148,11 @@ struct TauTau13topo { // nclTPCfind[counterTmp] = trk.tpcNClsFindable(); nclTPCcrossedRows[counterTmp] = trk.tpcNClsCrossedRows(); + nclTPCfind[counterTmp] = trk.tpcNClsFindable(); + nclTPCchi2[counterTmp] = trk.tpcChi2NCl(); + trkITSchi2[counterTmp] = trk.itsChi2NCl(); + trkITScl[counterTmp] = numberOfItsClustersCheck(trk); + // trkTime[counterTmp] = trk.trackTime(); // trkTimeRes[counterTmp] = trk.trackTimeRes(); counterTmp++; @@ -4967,6 +5162,7 @@ struct TauTau13topo { dgcand.globalBC(), // is it necessary dgtracks.size(), dgcand.numContrib(), + rct, // dgcand.posX(), dgcand.posY(), dgcand.posZ(), dgcand.flags(), @@ -4975,12 +5171,12 @@ struct TauTau13topo { energyZNA, energyZNC, qtot, dgcand.trs(), dgcand.trofs(), dgcand.hmpr(), // to test it - // dgcand.tfb(), dgcand.itsROFb(), dgcand.sbp(), dgcand.zVtxFT0vPV(), dgcand.vtxITSTPC(), + dgcand.tfb(), dgcand.itsROFb(), dgcand.sbp(), dgcand.zVtxFT0vPV(), dgcand.vtxITSTPC(), dgcand.totalFT0AmplitudeA(), dgcand.totalFT0AmplitudeC(), dgcand.totalFV0AmplitudeA(), // dgcand.timeFT0A(), dgcand.timeFT0C(), dgcand.timeFV0A(), px, py, pz, // sign, - // dcaXY, dcaZ, - nclTPCcrossedRows, + dcaXY, dcaZ, + nclTPCcrossedRows, nclTPCfind, nclTPCchi2, trkITSchi2, trkITScl, tmpDedx, nSigmaEl, nSigmaPi, nSigmaKa, nSigmaPr, nSigmaMu, trkTofSignal, tmpTofNsigmaEl, tmpTofNsigmaPi, tmpTofNsigmaKa, tmpTofNsigmaPr, tmpTofNsigmaMu, chi2TOF); From 908c7a91f17b52cbd0d5df5546f9e44a12b21a87 Mon Sep 17 00:00:00 2001 From: Marvin Hemmer <53471402+mhemmer-cern@users.noreply.github.com> Date: Wed, 6 Aug 2025 17:32:53 +0200 Subject: [PATCH 262/345] [PWGJE,EMCAL-670] Fix MCParticle check in taskEmcExtensiveMcQa.cxx (#12441) --- PWGJE/Tasks/taskEmcExtensiveMcQa.cxx | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/PWGJE/Tasks/taskEmcExtensiveMcQa.cxx b/PWGJE/Tasks/taskEmcExtensiveMcQa.cxx index 002e2f3c711..bd32d591775 100644 --- a/PWGJE/Tasks/taskEmcExtensiveMcQa.cxx +++ b/PWGJE/Tasks/taskEmcExtensiveMcQa.cxx @@ -140,18 +140,13 @@ struct TaskEmcExtensiveMcQa { /// \param mcparticle is the mcparticle we want to find the PoI type /// \param mcparticles table containing the mcparticles /// \return PoI type of the given mcparticle - template - int findPoIType(T const& mcparticle, TMCs const& mcparticles) + template + int findPoIType(T const& mcparticle) { - if (!mcparticle.has_mothers()) { - return -1; - } - - int motherid = mcparticle.mothersIds()[0]; - auto mother = mcparticles.iteratorAt(motherid); - auto it = std::find(arrPoIPDG.begin(), arrPoIPDG.end(), std::abs(mother.pdgCode())); + auto it = std::find(arrPoIPDG.begin(), arrPoIPDG.end(), std::abs(mcparticle.pdgCode())); if (it != arrPoIPDG.end()) { - return *it; + int index = std::distance(arrPoIPDG.begin(), it); + return index; } else { return PoI::kHadron; } @@ -160,7 +155,7 @@ struct TaskEmcExtensiveMcQa { Filter clusterDefinitionSelection = (o2::aod::emcalcluster::definition == clusterDefinition); /// \brief Process EMCAL clusters that are matched to a collisions - void processCollisions(CollisionEvSels const& collisions, SelectedClusters const& clusters, McParticles const& mcparticles) + void processCollisions(CollisionEvSels const& collisions, SelectedClusters const& clusters, McParticles const& /*mcparticles*/) { for (const auto& collision : collisions) { @@ -179,8 +174,8 @@ struct TaskEmcExtensiveMcQa { continue; } auto mainMcParticle = cluster.mcParticle_as()[0]; - float radius = std::hypot(mainMcParticle.px(), mainMcParticle.py()); - mHistManager.fill(HIST("hSparseClusterQA"), cluster.energy(), cluster.time(), cluster.m02(), cluster.nCells(), radius, findPoIType(mainMcParticle, mcparticles)); + float radius = std::hypot(mainMcParticle.vx(), mainMcParticle.vy()); + mHistManager.fill(HIST("hSparseClusterQA"), cluster.energy(), cluster.time(), cluster.m02(), cluster.nCells(), radius, findPoIType(mainMcParticle)); } } } From 5eeced0ff32eee238d2d19bb27ff6f195b9c5a76 Mon Sep 17 00:00:00 2001 From: Artem Kotliarov <71133985+KotliarovAr@users.noreply.github.com> Date: Wed, 6 Aug 2025 19:06:02 +0200 Subject: [PATCH 263/345] [PWGJE] scaling of FT0M signal (#12460) Co-authored-by: ALICE Action Bot --- PWGJE/Tasks/recoilJets.cxx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/PWGJE/Tasks/recoilJets.cxx b/PWGJE/Tasks/recoilJets.cxx index 3038b3ce37a..acd00af069c 100644 --- a/PWGJE/Tasks/recoilJets.cxx +++ b/PWGJE/Tasks/recoilJets.cxx @@ -418,6 +418,9 @@ struct RecoilJets { spectra.add("hScaleMultFT0M", "Scaled total mult. signal from FT0A & FTOC", kTH1F, {{200, 0.0, 20.}}); + spectra.add("hScaleMultFT0M_v2", "Scaled total mult. signal from FT0A & FTOC", kTH1F, + {{200, 0.0, 20.}}); + spectra.add("hMultZNA", "Mult. signal from ZDC A-side", kTH1F, {{500, 0.0, 10000.}}); spectra.add("hMultZNC", "Mult. signal from ZDC C-side", kTH1F, @@ -680,6 +683,8 @@ struct RecoilJets { spectra.fill(HIST("hScaleMultFT0A"), collision.multFT0A() / meanFT0A, weight); spectra.fill(HIST("hScaleMultFT0C"), collision.multFT0C() / meanFT0C, weight); spectra.fill(HIST("hScaleMultFT0M"), collision.multFT0M() / meanFT0M, weight); + spectra.fill(HIST("hScaleMultFT0M_v2"), collision.multFT0A() / meanFT0A + collision.multFT0C() / meanFT0C, + weight); spectra.fill(HIST("hMultZNA"), collision.multZNA(), weight); spectra.fill(HIST("hMultZNC"), collision.multZNC(), weight); From 9e74314d342933fb685acf754a65b68b75f6418e Mon Sep 17 00:00:00 2001 From: JStaa <39123272+JStaa@users.noreply.github.com> Date: Wed, 6 Aug 2025 19:27:00 +0200 Subject: [PATCH 264/345] [PWGCF] Changed the binning for the TPC & TOF histograms (#12454) Co-authored-by: ALICE Action Bot --- .../Tasks/threeParticleCorrelations.cxx | 36 +++++++++++-------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/PWGCF/MultiparticleCorrelations/Tasks/threeParticleCorrelations.cxx b/PWGCF/MultiparticleCorrelations/Tasks/threeParticleCorrelations.cxx index 5f856d409ca..1a50269aa9b 100644 --- a/PWGCF/MultiparticleCorrelations/Tasks/threeParticleCorrelations.cxx +++ b/PWGCF/MultiparticleCorrelations/Tasks/threeParticleCorrelations.cxx @@ -179,10 +179,14 @@ struct ThreeParticleCorrelations { rQARegistry.add("hTrackPhi", "hTrackPhi", {HistType::kTH1D, {{100, (-1. / 2) * constants::math::PI, (5. / 2) * constants::math::PI}}}); rQARegistry.add("hTrackNSharedClusters", "hTrackNSharedClusters", {HistType::kTH1D, {{200, 0, 200}}}); - rQARegistry.add("hPtPion", "hPtPion", {HistType::kTH3D, {{trackPtAxis}, {centralityAxis}, {2, -2, 2}}}); - rQARegistry.add("hPtKaon", "hPtKaon", {HistType::kTH3D, {{trackPtAxis}, {centralityAxis}, {2, -2, 2}}}); - rQARegistry.add("hPtProton", "hPtProton", {HistType::kTH3D, {{trackPtAxis}, {centralityAxis}, {2, -2, 2}}}); - rQARegistry.add("hPtV0", "hPtV0", {HistType::kTH3D, {{v0PtAxis}, {centralityAxis}, {2, -2, 2}}}); + rQARegistry.add("hPtPion_Uncorrected", "hPtPion_Uncorrected", {HistType::kTH3D, {{trackPtAxis}, {centralityAxis}, {2, -2, 2}}}); + rQARegistry.add("hPtKaon_Uncorrected", "hPtKaon_Uncorrected", {HistType::kTH3D, {{trackPtAxis}, {centralityAxis}, {2, -2, 2}}}); + rQARegistry.add("hPtProton_Uncorrected", "hPtProton_Uncorrected", {HistType::kTH3D, {{trackPtAxis}, {centralityAxis}, {2, -2, 2}}}); + rQARegistry.add("hPtV0_Uncorrected", "hPtV0_Uncorrected", {HistType::kTH3D, {{v0PtAxis}, {centralityAxis}, {2, -2, 2}}}); + rQARegistry.add("hPtPion_Corrected", "hPtPion_Corrected", {HistType::kTH3D, {{trackPtAxis}, {centralityAxis}, {2, -2, 2}}}); + rQARegistry.add("hPtKaon_Corrected", "hPtKaon_Corrected", {HistType::kTH3D, {{trackPtAxis}, {centralityAxis}, {2, -2, 2}}}); + rQARegistry.add("hPtProton_Corrected", "hPtProton_Corrected", {HistType::kTH3D, {{trackPtAxis}, {centralityAxis}, {2, -2, 2}}}); + rQARegistry.add("hPtV0_Corrected", "hPtV0_Corrected", {HistType::kTH3D, {{v0PtAxis}, {centralityAxis}, {2, -2, 2}}}); rQARegistry.add("hPtPion_MC", "hPtPion_MC", {HistType::kTH3D, {{trackPtAxis}, {centralityAxis}, {2, -2, 2}}}); rQARegistry.add("hPtKaon_MC", "hPtKaon_MC", {HistType::kTH3D, {{trackPtAxis}, {centralityAxis}, {2, -2, 2}}}); rQARegistry.add("hPtProton_MC", "hPtProton_MC", {HistType::kTH3D, {{trackPtAxis}, {centralityAxis}, {2, -2, 2}}}); @@ -197,12 +201,12 @@ struct ThreeParticleCorrelations { rQARegistry.add("hBetaKaon", "hBetaKaon", {HistType::kTH2D, {{56, 0.2, 3.0}, {70, 0.4, 1.1}}}); rQARegistry.add("hBetaProton", "hBetaProton", {HistType::kTH2D, {{56, 0.2, 3.0}, {70, 0.4, 1.1}}}); - rQARegistry.add("hTPCPion", "hTPCPion", {HistType::kTH2D, {{trackPtAxis}, {241, -6, 6}}}); - rQARegistry.add("hTPCKaon", "hTPCKaon", {HistType::kTH2D, {{trackPtAxis}, {241, -6, 6}}}); - rQARegistry.add("hTPCProton", "hTPCProton", {HistType::kTH2D, {{trackPtAxis}, {241, -6, 6}}}); - rQARegistry.add("hTOFPion", "hTOFPion", {HistType::kTH2D, {{trackPtAxis}, {1000, -50, 50}}}); - rQARegistry.add("hTOFKaon", "hTOFKaon", {HistType::kTH2D, {{trackPtAxis}, {1000, -50, 50}}}); - rQARegistry.add("hTOFProton", "hTOFProton", {HistType::kTH2D, {{trackPtAxis}, {1000, -50, 50}}}); + rQARegistry.add("hTPCPion", "hTPCPion", {HistType::kTH2D, {{trackPtAxis}, {1001, -50.05, 50.05}}}); + rQARegistry.add("hTPCKaon", "hTPCKaon", {HistType::kTH2D, {{trackPtAxis}, {1001, -50.05, 50.05}}}); + rQARegistry.add("hTPCProton", "hTPCProton", {HistType::kTH2D, {{trackPtAxis}, {1001, -50.05, 50.05}}}); + rQARegistry.add("hTOFPion", "hTOFPion", {HistType::kTH2D, {{trackPtAxis}, {1001, -50.05, 50.05}}}); + rQARegistry.add("hTOFKaon", "hTOFKaon", {HistType::kTH2D, {{trackPtAxis}, {1001, -50.05, 50.05}}}); + rQARegistry.add("hTOFProton", "hTOFProton", {HistType::kTH2D, {{trackPtAxis}, {1001, -50.05, 50.05}}}); rQARegistry.add("hInvMassLambda", "hInvMassLambda", {HistType::kTH3D, {{lambdaInvMassAxis}, {v0PtAxis}, {centralityAxis}}}); rQARegistry.add("hInvMassAntiLambda", "hInvMassAntiLambda", {HistType::kTH3D, {{lambdaInvMassAxis}, {v0PtAxis}, {centralityAxis}}}); @@ -353,15 +357,18 @@ struct ThreeParticleCorrelations { rQARegistry.fill(HIST("hdEdx"), track.pt(), track.tpcSignal()); rQARegistry.fill(HIST("hBeta"), track.pt(), track.beta()); if (assocPID[0] == pionID) { // Pions - rQARegistry.fill(HIST("hPtPion"), track.pt(), collision.centFT0C(), track.sign(), 1. / trackEff(hEffPions, track, collision.centFT0C())); + rQARegistry.fill(HIST("hPtPion_Uncorrected"), track.pt(), collision.centFT0C(), track.sign()); + rQARegistry.fill(HIST("hPtPion_Corrected"), track.pt(), collision.centFT0C(), track.sign(), 1. / trackEff(hEffPions, track, collision.centFT0C())); rQARegistry.fill(HIST("hdEdxPion"), track.pt(), track.tpcSignal()); rQARegistry.fill(HIST("hBetaPion"), track.pt(), track.beta()); } else if (assocPID[0] == kaonID) { // Kaons - rQARegistry.fill(HIST("hPtKaon"), track.pt(), collision.centFT0C(), track.sign(), 1. / trackEff(hEffKaons, track, collision.centFT0C())); + rQARegistry.fill(HIST("hPtKaon_Uncorrected"), track.pt(), collision.centFT0C(), track.sign()); + rQARegistry.fill(HIST("hPtKaon_Corrected"), track.pt(), collision.centFT0C(), track.sign(), 1. / trackEff(hEffKaons, track, collision.centFT0C())); rQARegistry.fill(HIST("hdEdxKaon"), track.pt(), track.tpcSignal()); rQARegistry.fill(HIST("hBetaKaon"), track.pt(), track.beta()); } else if (assocPID[0] == protonID) { // Protons - rQARegistry.fill(HIST("hPtProton"), track.pt(), collision.centFT0C(), track.sign(), 1. / trackEff(hEffProtons, track, collision.centFT0C())); + rQARegistry.fill(HIST("hPtProton_Uncorrected"), track.pt(), collision.centFT0C(), track.sign()); + rQARegistry.fill(HIST("hPtProton_Corrected"), track.pt(), collision.centFT0C(), track.sign(), 1. / trackEff(hEffProtons, track, collision.centFT0C())); rQARegistry.fill(HIST("hdEdxProton"), track.pt(), track.tpcSignal()); rQARegistry.fill(HIST("hBetaProton"), track.pt(), track.beta()); } @@ -376,7 +383,8 @@ struct ThreeParticleCorrelations { triggSign = v0Sign(trigger); v0Efficiency = v0Eff(hEffLambdas, trigger, collision.centFT0C()); - rQARegistry.fill(HIST("hPtV0"), trigger.pt(), collision.centFT0C(), triggSign, 1. / v0Efficiency); + rQARegistry.fill(HIST("hPtV0_Uncorrected"), trigger.pt(), collision.centFT0C(), triggSign); + rQARegistry.fill(HIST("hPtV0_Corrected"), trigger.pt(), collision.centFT0C(), triggSign, 1. / v0Efficiency); if (triggSign == 1) { candMass = trigger.mLambda(); rQARegistry.fill(HIST("hInvMassLambda"), trigger.mLambda(), trigger.pt(), collision.centFT0C(), 1. / v0Efficiency); From f9f543d1e85d20569405cffdec0eb13f456ce865 Mon Sep 17 00:00:00 2001 From: Archita-Dash <91664849+Archita-Dash@users.noreply.github.com> Date: Wed, 6 Aug 2025 20:15:26 +0200 Subject: [PATCH 265/345] [PWGJE] bugs fixed: added missing histogram in Hist Registry + fixed bin labels (#12461) --- PWGJE/Tasks/fullJetSpectra.cxx | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/PWGJE/Tasks/fullJetSpectra.cxx b/PWGJE/Tasks/fullJetSpectra.cxx index 99570de96bc..cdb14a1aa1c 100644 --- a/PWGJE/Tasks/fullJetSpectra.cxx +++ b/PWGJE/Tasks/fullJetSpectra.cxx @@ -419,6 +419,7 @@ struct FullJetSpectra { } if (doprocessJetsMCP || doprocessJetsMCPWeighted) { registry.add("hPartcollisionCounter", "event status;event status;entries", {HistType::kTH1F, {{10, 0.0, 10.0}}}); + registry.add("hRecoMatchesPerMcCollision", "split vertices QA;;entries", {HistType::kTH1F, {{5, 0.0, 5.0}}}); registry.add("h_full_mcpjet_tablesize", "", {HistType::kTH1F, {{4, 0., 5.}}}); registry.add("h_full_mcpjet_ntracks", "", {HistType::kTH1F, {{200, -0.5, 200.}}}); @@ -524,7 +525,7 @@ struct FullJetSpectra { if (doprocessMBMCPCollisionsWithMultiplicity || doprocessMBMCPCollisionsWeightedWithMultiplicity) { registry.add("hPartEventmultiplicityCounter", "event status;event status;entries", {HistType::kTH1F, {{11, 0.0, 11.0}}}); - registry.add("hRecoMatchesPerMcCollision", "split vertices QA;;entries", {HistType::kTH1F, {{5, 0.0, 5.0}}}); + registry.add("hRecoMatchesPerMcCollisionMult", "split vertices QA;;entries", {HistType::kTH1F, {{5, 0.0, 5.0}}}); registry.add("hMCCollMatchedFT0Mult", "", {HistType::kTH1F, {{3500, 0., 3500.}}}); registry.add("hMCCollMatchedFT0Cent", "", {HistType::kTH1F, {{105, 0., 105.}}}); @@ -900,19 +901,19 @@ struct FullJetSpectra { registry.fill(HIST("hDetcollisionCounter"), 1.5); // DetCollWithVertexZ if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits, doMBGapTrigger)) { - registry.fill(HIST("hDetcollisionCounter"), 2.5); // EventsNotSatisfyingEventSelection + registry.fill(HIST("hDetcollisionCounter"), 4.5); // EventsNotSatisfyingEventSelection return; } if (doEMCALEventWorkaround) { if (collision.isEmcalReadout() && !collision.isAmbiguous()) { // i.e. EMCAL has a cell content eventAccepted = true; if (collision.alias_bit(kTVXinEMC)) { - registry.fill(HIST("hDetcollisionCounter"), 3.5); // EMCreadoutDetEventsWithkTVXinEMC + registry.fill(HIST("hDetcollisionCounter"), 5.5); // EMCreadoutDetEventsWithkTVXinEMC } } } else { if (!collision.isAmbiguous() && jetderiveddatautilities::eventEMCAL(collision) && collision.alias_bit(kTVXinEMC)) { - registry.fill(HIST("hDetcollisionCounter"), 3.5); // EMCreadoutDetEventsWithkTVXinEMC + registry.fill(HIST("hDetcollisionCounter"), 5.5); // EMCreadoutDetEventsWithkTVXinEMC eventAccepted = true; } } @@ -923,10 +924,10 @@ struct FullJetSpectra { fillRejectedJetHistograms(jet, 1.0); } } - registry.fill(HIST("hDetcollisionCounter"), 4.5); // AllRejectedDetEventsAfterEMCEventSelection + registry.fill(HIST("hDetcollisionCounter"), 6.5); // AllRejectedDetEventsAfterEMCEventSelection return; } - registry.fill(HIST("hDetcollisionCounter"), 5.5); // EMCAcceptedDetColl + registry.fill(HIST("hDetcollisionCounter"), 7.5); // EMCAcceptedDetColl for (auto const& jet : jets) { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { @@ -2390,7 +2391,7 @@ struct FullJetSpectra { // Perform MC Collision matching, i.e. match the current MC collision to its associated reco (MCD) collision // to get the corresponding FT0M component at the particle level auto collisionspermcpjet = collisions.sliceBy(CollisionsPerMCPCollision, mccollision.globalIndex()); - registry.fill(HIST("hRecoMatchesPerMcCollision"), collisionspermcpjet.size()); // for split vertices QA + registry.fill(HIST("hRecoMatchesPerMcCollisionMult"), collisionspermcpjet.size()); // for split vertices QA if (collisionspermcpjet.size() == 0 || collisionspermcpjet.size() < 1) { registry.fill(HIST("hPartEventmultiplicityCounter"), 4.5); // RejectedPartCollForDetCollWithSize0or<1 @@ -2555,7 +2556,7 @@ struct FullJetSpectra { // Perform MC Collision matching, i.e. match the current MC collision to its associated reco (MCD) collision // to get the corresponding FT0M component at the particle level auto collisionspermcpjet = collisions.sliceBy(CollisionsPerMCPCollision, mccollision.globalIndex()); - registry.fill(HIST("hRecoMatchesPerMcCollision"), collisionspermcpjet.size(), mccollision.weight()); // for split vertices QA + registry.fill(HIST("hRecoMatchesPerMcCollisionMult"), collisionspermcpjet.size(), mccollision.weight()); // for split vertices QA if (collisionspermcpjet.size() == 0 || collisionspermcpjet.size() < 1) { registry.fill(HIST("hPartEventmultiplicityCounter"), 4.5, mccollision.weight()); // RejectedWeightedPartCollForDetCollWithSize0or<1 From 0cb0d9fe8d49f7982401c83229d9feda957ba773 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Kr=C3=BCger?= <26876110+mario-krueger@users.noreply.github.com> Date: Wed, 6 Aug 2025 21:34:33 +0200 Subject: [PATCH 266/345] [PWGLF] rename task and implement systematic cut variations (#12447) --- PWGLF/Tasks/Nuspex/CMakeLists.txt | 4 +- ...pectraCharged.cxx => chargedParticles.cxx} | 197 ++++++++++++------ 2 files changed, 137 insertions(+), 64 deletions(-) rename PWGLF/Tasks/Nuspex/{spectraCharged.cxx => chargedParticles.cxx} (70%) diff --git a/PWGLF/Tasks/Nuspex/CMakeLists.txt b/PWGLF/Tasks/Nuspex/CMakeLists.txt index 0fbbf7d68c6..cc23b8d0544 100644 --- a/PWGLF/Tasks/Nuspex/CMakeLists.txt +++ b/PWGLF/Tasks/Nuspex/CMakeLists.txt @@ -79,8 +79,8 @@ o2physics_add_dpl_workflow(spectra-tpc-tiny-pikapr PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(spectra-charged - SOURCES spectraCharged.cxx +o2physics_add_dpl_workflow(charged-particles + SOURCES chargedParticles.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) diff --git a/PWGLF/Tasks/Nuspex/spectraCharged.cxx b/PWGLF/Tasks/Nuspex/chargedParticles.cxx similarity index 70% rename from PWGLF/Tasks/Nuspex/spectraCharged.cxx rename to PWGLF/Tasks/Nuspex/chargedParticles.cxx index 94e3b30dc4a..42bbb437a89 100644 --- a/PWGLF/Tasks/Nuspex/spectraCharged.cxx +++ b/PWGLF/Tasks/Nuspex/chargedParticles.cxx @@ -9,44 +9,71 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -// task for charged particle pt spectra vs multiplicity analysis with 2d unfolding for run3+ -// mimics https://github.com/alisw/AliPhysics/blob/master/PWGLF/SPECTRA/ChargedHadrons/MultDepSpec/AliMultDepSpecAnalysisTask.cxx - -#include "Framework/HistogramRegistry.h" -#include "ReconstructionDataFormats/Track.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "Framework/O2DatabasePDGPlugin.h" -#include "Common/DataModel/EventSelection.h" +/// \file chargedParticles.cxx +/// \brief Task for analysis of charged particle pt spectra vs multiplicity with 2d unfolding. +/// \author Mario Krüger + +#include "Common/Core/TrackSelection.h" +#include "Common/Core/TrackSelectionDefaults.h" #include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "TDatabasePDG.h" + +#include +#include +#include +#include +#include + +#include +#include using namespace o2; using namespace o2::framework; +using aod::track::TrackSelectionFlags; //-------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------- // Task declaration //-------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------- -struct chargedSpectra { +struct ChargedParticles { HistogramRegistry histos; Service pdg; - // task settings that can be steered via hyperloop Configurable isRun3{"isRun3", true, "is Run3 dataset"}; Configurable maxMultMeas{"maxMultMeas", 100, "max measured multiplicity"}; Configurable maxMultTrue{"maxMultTrue", 100, "max true multiplicity"}; Configurable etaCut{"etaCut", 0.8f, "eta cut"}; Configurable ptMinCut{"ptMinCut", 0.15f, "pt min cut"}; Configurable ptMaxCut{"ptMaxCut", 10.f, "pt max cut"}; - Configurable normINELGT0{"normINELGT0", false, "normalize INEL>0 according to MC"}; + enum : uint32_t { + kSystNominal = 100, + kSystDownChi2PerClusterITS, + kSystUpChi2PerClusterITS, + kSystDownChi2PerClusterTPC, + kSystUpChi2PerClusterTPC, + kSystDownTPCCrossedRowsOverNCls, + kSystUpTPCCrossedRowsOverNCls, + kSystDownDCAxy = 111, + kSystUpDCAxy, + kSystDownDCAz, + kSystUpDCAz, + kSystITSHits, + kSystDownTPCCrossedRows, + kSystUpTPCCrossedRows + }; + Configurable systMode{"systMode", kSystNominal, "variation for systematic uncertainties"}; + uint16_t trackSelMask{TrackSelectionFlags::kGlobalTrackWoPtEta}; // track selection bitmask (without cut that is being varied) + uint16_t cutVarFlag{0}; + TrackSelection trackSel; + TrackSelection::TrackCuts trackSelFlag; + // helper struct to store transient properties - struct varContainer { + struct VarContainer { uint32_t multMeas{0u}; uint32_t multTrue{0u}; bool isAcceptedEvent{false}; @@ -54,7 +81,8 @@ struct chargedSpectra { bool isINELGT0EventMC{false}; bool isChargedPrimary{false}; }; - varContainer vars; + VarContainer vars; + static constexpr float kMaxVtxZ = 10.f; void init(InitContext const&); @@ -70,43 +98,29 @@ struct chargedSpectra { template void initEventMC(const C& collision, const P& particles); - template - void processMeas(const C& collision, const T& tracks); + template + void processMeas(const T& tracks); - template - void processTrue(const C& collision, const P& particles); + template + void processTrue(const P& particles); using CollisionTableData = soa::Join; - using TrackTableData = soa::Join; + using TrackTableData = soa::Join; void processData(CollisionTableData::iterator const& collision, TrackTableData const& tracks); - PROCESS_SWITCH(chargedSpectra, processData, "process data", false); + PROCESS_SWITCH(ChargedParticles, processData, "process data", false); using CollisionTableMCTrue = aod::McCollisions; using CollisionTableMC = soa::SmallGroups>; - using TrackTableMC = soa::Join; + using TrackTableMC = soa::Join; using ParticleTableMC = aod::McParticles; Preslice perCollision = aod::track::collisionId; void processMC(CollisionTableMCTrue::iterator const& mcCollision, CollisionTableMC const& collisions, TrackTableMC const& tracks, ParticleTableMC const& particles); - PROCESS_SWITCH(chargedSpectra, processMC, "process mc", true); - - // TODO: - Milestone - express most of the selections on events and tracks in a declarative way to improve performance - /* - add - Filter xy; - soa::Filtered - - For the collision and track tables (data and MC): - - collision z pos < 10cm - - trigger condition + event selection - - track selection + is in kine range - - For the MC tables we need to keep everything that EITHER fulfils the conditions in data OR in MC to get correct efficiencies and contamination! - */ + PROCESS_SWITCH(ChargedParticles, processMC, "process mc", true); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { - return WorkflowSpec{adaptAnalysisTask(cfgc)}; + return WorkflowSpec{adaptAnalysisTask(cfgc)}; } //-------------------------------------------------------------------------------------------------- @@ -120,7 +134,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) * Initialise the task and add histograms. */ //************************************************************************************************** -void chargedSpectra::init(InitContext const&) +void ChargedParticles::init(InitContext const&) { std::vector ptBinEdges = {0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, @@ -162,6 +176,62 @@ void chargedSpectra::init(InitContext const&) histos.add("multPtSpec_trk_meas_evtcont", "", kTH2D, {multMeasAxis, ptMeasAxis}); // tracks from events that are measured, but do not belong to the desired class of events histos.add("multPtSpec_trk_inter", "", kTH2D, {multTrueAxis, ptMeasAxis}); } + + trackSel = getGlobalTrackSelection(); + if (systMode == kSystDownChi2PerClusterITS) { + trackSel.SetMaxChi2PerClusterITS(25.); + cutVarFlag = TrackSelectionFlags::kITSChi2NDF; + trackSelFlag = TrackSelection::TrackCuts::kITSChi2NDF; + } else if (systMode == kSystUpChi2PerClusterITS) { + trackSel.SetMaxChi2PerClusterITS(49.); + cutVarFlag = TrackSelectionFlags::kITSChi2NDF; + trackSelFlag = TrackSelection::TrackCuts::kITSChi2NDF; + } else if (systMode == kSystDownChi2PerClusterTPC) { + trackSel.SetMaxChi2PerClusterTPC(3.0); + cutVarFlag = TrackSelectionFlags::kTPCChi2NDF; + trackSelFlag = TrackSelection::TrackCuts::kTPCChi2NDF; + } else if (systMode == kSystUpChi2PerClusterTPC) { + trackSel.SetMaxChi2PerClusterTPC(5.0); + cutVarFlag = TrackSelectionFlags::kTPCChi2NDF; + trackSelFlag = TrackSelection::TrackCuts::kTPCChi2NDF; + } else if (systMode == kSystDownTPCCrossedRowsOverNCls) { + trackSel.SetMinNCrossedRowsOverFindableClustersTPC(0.7); + cutVarFlag = TrackSelectionFlags::kTPCCrossedRowsOverNCls; + trackSelFlag = TrackSelection::TrackCuts::kTPCCrossedRowsOverNCls; + } else if (systMode == kSystUpTPCCrossedRowsOverNCls) { + trackSel.SetMinNCrossedRowsOverFindableClustersTPC(0.9); + cutVarFlag = TrackSelectionFlags::kTPCCrossedRowsOverNCls; + trackSelFlag = TrackSelection::TrackCuts::kTPCCrossedRowsOverNCls; + } else if (systMode == kSystDownDCAxy) { + trackSel.SetMaxDcaXYPtDep([](float pt) { return 4. / 7. * (0.0105f + 0.0350f / std::pow(pt, 1.1f)); }); + cutVarFlag = TrackSelectionFlags::kDCAxy; + trackSelFlag = TrackSelection::TrackCuts::kDCAxy; + } else if (systMode == kSystUpDCAxy) { + trackSel.SetMaxDcaXYPtDep([](float pt) { return 10. / 7. * (0.0105f + 0.0350f / std::pow(pt, 1.1f)); }); + cutVarFlag = TrackSelectionFlags::kDCAxy; + trackSelFlag = TrackSelection::TrackCuts::kDCAxy; + } else if (systMode == kSystDownDCAz) { + trackSel.SetMaxDcaZ(1.0); + cutVarFlag = TrackSelectionFlags::kDCAz; + trackSelFlag = TrackSelection::TrackCuts::kDCAz; + } else if (systMode == kSystUpDCAz) { + trackSel.SetMaxDcaZ(5.0); + cutVarFlag = TrackSelectionFlags::kDCAz; + trackSelFlag = TrackSelection::TrackCuts::kDCAz; + } else if (systMode == kSystITSHits) { + trackSel.ResetITSRequirements(); + cutVarFlag = TrackSelectionFlags::kITSHits; + trackSelFlag = TrackSelection::TrackCuts::kITSHits; + } else if (systMode == kSystDownTPCCrossedRows) { + trackSel.SetMinNCrossedRowsTPC(60); + cutVarFlag = TrackSelectionFlags::kTPCCrossedRows; + trackSelFlag = TrackSelection::TrackCuts::kTPCCrossedRows; + } else if (systMode == kSystUpTPCCrossedRows) { + trackSel.SetMinNCrossedRowsTPC(80); + cutVarFlag = TrackSelectionFlags::kTPCCrossedRows; + trackSelFlag = TrackSelection::TrackCuts::kTPCCrossedRows; + } + trackSelMask &= (~cutVarFlag); } //************************************************************************************************** @@ -169,10 +239,10 @@ void chargedSpectra::init(InitContext const&) * Entrypoint to processes data. */ //************************************************************************************************** -void chargedSpectra::processData(CollisionTableData::iterator const& collision, TrackTableData const& tracks) +void ChargedParticles::processData(CollisionTableData::iterator const& collision, TrackTableData const& tracks) { initEvent(collision, tracks); - processMeas(collision, tracks); + processMeas(tracks); } //************************************************************************************************** @@ -180,7 +250,7 @@ void chargedSpectra::processData(CollisionTableData::iterator const& collision, * Entrypoint to processes mc. */ //************************************************************************************************** -void chargedSpectra::processMC(CollisionTableMCTrue::iterator const& mcCollision, CollisionTableMC const& collisions, TrackTableMC const& tracks, ParticleTableMC const& particles) +void ChargedParticles::processMC(CollisionTableMCTrue::iterator const& mcCollision, CollisionTableMC const& collisions, TrackTableMC const& tracks, ParticleTableMC const& particles) { histos.fill(HIST("collision_ambiguity"), collisions.size()); @@ -198,14 +268,14 @@ void chargedSpectra::processMC(CollisionTableMCTrue::iterator const& mcCollision if (collisions.size() == 0) { vars.isAcceptedEvent = false; } else { - for (auto& collision : collisions) { + for (const auto& collision : collisions) { auto curTracks = tracks.sliceBy(perCollision, collision.globalIndex()); initEvent(collision, curTracks); - processMeas(collision, curTracks); + processMeas(curTracks); break; // for now look only at first collision... } } - processTrue(mcCollision, particles); + processTrue(particles); } //************************************************************************************************** @@ -214,7 +284,7 @@ void chargedSpectra::processMC(CollisionTableMCTrue::iterator const& mcCollision */ //************************************************************************************************** template -bool chargedSpectra::initParticle(const P& particle) +bool ChargedParticles::initParticle(const P& particle) { vars.isChargedPrimary = false; auto pdgParticle = pdg->GetParticle(particle.pdgCode()); @@ -241,7 +311,7 @@ bool chargedSpectra::initParticle(const P& particle) */ //************************************************************************************************** template -bool chargedSpectra::initTrack(const T& track) +bool ChargedParticles::initTrack(const T& track) { if (std::abs(track.eta()) >= etaCut) { return false; @@ -249,7 +319,11 @@ bool chargedSpectra::initTrack(const T& track) if (track.pt() <= ptMinCut || track.pt() >= ptMaxCut) { return false; } - if (!track.isGlobalTrackWoPtEta()) { + if (!TrackSelectionFlags::checkFlag(track.trackCutFlag(), trackSelMask)) { + return false; + } + // for systematic variation of standard selections, check if the varied cut is passed + if (cutVarFlag && !trackSel.IsSelected(track, trackSelFlag)) { return false; } return true; @@ -261,17 +335,17 @@ bool chargedSpectra::initTrack(const T& track) */ //************************************************************************************************** template -void chargedSpectra::initEvent(const C& collision, const T& tracks) +void ChargedParticles::initEvent(const C& collision, const T& tracks) { vars.multMeas = 0; - for (auto& track : tracks) { + for (const auto& track : tracks) { if (initTrack(track)) { ++vars.multMeas; } } vars.isAcceptedEvent = false; - if (std::abs(collision.posZ()) < 10.f) { + if (std::abs(collision.posZ()) < kMaxVtxZ) { if (isRun3 ? collision.sel8() : collision.sel7()) { if ((isRun3 || doprocessMC) ? true : collision.alias_bit(kINT7)) { vars.isAcceptedEvent = true; @@ -286,18 +360,18 @@ void chargedSpectra::initEvent(const C& collision, const T& tracks) */ //************************************************************************************************** template -void chargedSpectra::initEventMC(const C& collision, const P& particles) +void ChargedParticles::initEventMC(const C& collision, const P& particles) { vars.isINELGT0EventMC = false; // will be set to true in case a charged particle within eta +-1 is found vars.multTrue = 0; - for (auto& particle : particles) { + for (const auto& particle : particles) { if (!initParticle(particle) || !vars.isChargedPrimary) { continue; } ++vars.multTrue; } bool isGoodEventClass = (normINELGT0) ? vars.isINELGT0EventMC : (vars.multTrue > 0); - vars.isAcceptedEventMC = isGoodEventClass && (std::abs(collision.posZ()) < 10.f); + vars.isAcceptedEventMC = isGoodEventClass && (std::abs(collision.posZ()) < kMaxVtxZ); } //************************************************************************************************** @@ -305,8 +379,8 @@ void chargedSpectra::initEventMC(const C& collision, const P& particles) * Function to processes MC truth info. Assumes initEvent and initEventMC have been called previously. */ //************************************************************************************************** -template -void chargedSpectra::processTrue(const C& /*collision*/, const P& particles) +template +void ChargedParticles::processTrue(const P& particles) { if (!vars.isAcceptedEventMC) { return; @@ -314,7 +388,7 @@ void chargedSpectra::processTrue(const C& /*collision*/, const P& particles) histos.fill(HIST("multDist_evt_gen"), vars.multTrue); - for (auto& particle : particles) { + for (const auto& particle : particles) { if (initParticle(particle) && vars.isChargedPrimary) { histos.fill(HIST("multPtSpec_prim_gen"), vars.multTrue, particle.pt()); if (!vars.isAcceptedEvent) { @@ -329,8 +403,8 @@ void chargedSpectra::processTrue(const C& /*collision*/, const P& particles) * Function to process reconstructed data and MC. Assumes initEvent (and initEventMC in case of MC) have been called previously. */ //************************************************************************************************** -template -void chargedSpectra::processMeas(const C& /*collision*/, const T& tracks) +template +void ChargedParticles::processMeas(const T& tracks) { if (!vars.isAcceptedEvent) { return; @@ -345,8 +419,7 @@ void chargedSpectra::processMeas(const C& /*collision*/, const T& tracks) } std::vector foundParticles; - for (auto& track : tracks) { - + for (const auto& track : tracks) { if (!initTrack(track)) { continue; } @@ -390,7 +463,7 @@ void chargedSpectra::processMeas(const C& /*collision*/, const T& tracks) } std::unordered_set uniqueIndices(foundParticles.begin(), foundParticles.end()); - for (auto mcParticleID : uniqueIndices) { + for (const auto& mcParticleID : uniqueIndices) { histos.fill(HIST("track_ambiguity"), std::count(foundParticles.begin(), foundParticles.end(), mcParticleID)); } } From 8253687796c7d322e03627d6c060cf663c7d4585 Mon Sep 17 00:00:00 2001 From: Bong-Hwi Lim Date: Thu, 7 Aug 2025 04:53:21 +0900 Subject: [PATCH 267/345] [PWGCF] jFlucEfficiencyTask - Add high pT tracks study functionalities (#12453) Co-authored-by: ALICE Action Bot --- PWGCF/JCorran/Tasks/jFlucEfficiencyTask.cxx | 118 +++++++++++++++++++- 1 file changed, 117 insertions(+), 1 deletion(-) diff --git a/PWGCF/JCorran/Tasks/jFlucEfficiencyTask.cxx b/PWGCF/JCorran/Tasks/jFlucEfficiencyTask.cxx index 59ca8b18903..4ca33837d1e 100644 --- a/PWGCF/JCorran/Tasks/jFlucEfficiencyTask.cxx +++ b/PWGCF/JCorran/Tasks/jFlucEfficiencyTask.cxx @@ -49,6 +49,8 @@ struct JFlucEfficiencyTask { 170.0, 180.0, 190.0, 200.0, 210.0, 220.0, 230.0, 240.0, 250.0, 260.0, 270.0, 280.0, 290.0, 300.0}; + static constexpr double kChargeThreshold = 3.0; // PDG charge units: 3 = |e| + // Update the axisPt configuration with proper vector initialization ConfigurableAxis axisPt{"axisPt", std::vector(PttJacek.begin(), PttJacek.end()), "pT axis"}; @@ -105,6 +107,8 @@ struct JFlucEfficiencyTask { Configurable cfgMaxbDCAzToPVcut{"cfgMaxbDCAzToPVcut", 1.0, "Track DCAz cut to PV Maximum"}; } TrackCuts; + Configurable applyMCStudy{"applyMCStudy", false, "Apply MC study"}; + // Configurable for track selection Configurable trackSelection{"trackSelection", 0, "Track selection: 0 -> No Cut, 1 -> kGlobalTrack, 2 -> kGlobalTrackWoPtEta, 3 -> kGlobalTrackWoDCA, 4 -> kQualityTracks, 5 -> kInAcceptanceTracks"}; @@ -175,8 +179,16 @@ struct JFlucEfficiencyTask { o2::framework::HistType::kTH2F, {AxisSpec(100, -1, 1), AxisSpec(axisMultiplicity)}); registry.add("hPtGenPos", "Generated p_{T} (positive);p_{T} (GeV/c);Centrality (%);Counts", o2::framework::HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}); + registry.add("hPtGenPos_Pos", "Generated p_{T} (positive) in TPC positive side;p_{T} (GeV/c);Centrality (%);Counts", + o2::framework::HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}); + registry.add("hPtGenPos_Neg", "Generated p_{T} (positive) in TPC negative side;p_{T} (GeV/c);Centrality (%);Counts", + o2::framework::HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}); registry.add("hPtGenNeg", "Generated p_{T} (negative);p_{T} (GeV/c);Centrality (%);Counts", o2::framework::HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}); + registry.add("hPtGenNeg_Pos", "Generated p_{T} (negative) in TPC positive side;p_{T} (GeV/c);Centrality (%);Counts", + o2::framework::HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}); + registry.add("hPtGenNeg_Neg", "Generated p_{T} (negative) in TPC negative side;p_{T} (GeV/c);Centrality (%);Counts", + o2::framework::HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}); } registry.add("hPtRec", "Reconstructed p_{T} (all);p_{T} (GeV/c);Centrality (%);Counts", o2::framework::HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}); @@ -184,8 +196,33 @@ struct JFlucEfficiencyTask { o2::framework::HistType::kTH2F, {AxisSpec(100, -1, 1), AxisSpec(axisMultiplicity)}); registry.add("hPtRecPos", "Reconstructed p_{T} (positive);p_{T} (GeV/c);Centrality (%);Counts", o2::framework::HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}); + registry.add("hPtRecPos_Pos", "Reconstructed p_{T} (positive) in TPC positive side;p_{T} (GeV/c);Centrality (%);Counts", + o2::framework::HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}); + registry.add("hPtRecPos_Neg", "Reconstructed p_{T} (positive) in TPC negative side;p_{T} (GeV/c);Centrality (%);Counts", + o2::framework::HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}); registry.add("hPtRecNeg", "Reconstructed p_{T} (negative);p_{T} (GeV/c);Centrality (%);Counts", o2::framework::HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}); + registry.add("hPtRecNeg_Pos", "Reconstructed p_{T} (negative) in TPC positive side;p_{T} (GeV/c);Centrality (%);Counts", + o2::framework::HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}); + registry.add("hPtRecNeg_Neg", "Reconstructed p_{T} (negative) in TPC negative side;p_{T} (GeV/c);Centrality (%);Counts", + o2::framework::HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}); + if (applyMCStudy) { + registry.add("hChargeSignMismatch", "Charge-Sign mismatch cases", {HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}}); + registry.add("hChargeSignMismatchPos", "MC charge + but track sign -", {HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}}); + registry.add("hChargeSignMismatchNeg", "MC charge - but track sign +", {HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}}); + registry.add("hChargeSignMatch", "Charge-Sign match cases", {HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}}); + registry.add("hChargeSignMatchPos", "MC charge + and track sign +", {HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}}); + registry.add("hChargeSignMatchNeg", "MC charge - and track sign -", {HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}}); + registry.add("hChargeSignRatio", "Ratio of mismatch to total", {HistType::kTH2F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity)}}); + + // pT resolution + registry.add("hPtResolution", "p_{T} resolution;p_{T} (GeV/c);Centrality (%);Counts", + o2::framework::HistType::kTH3F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity), AxisSpec(60, -3, 3)}); + registry.add("hPtResolutionPos", "p_{T} resolution (positive);p_{T} (GeV/c);Centrality (%);Counts", + o2::framework::HistType::kTH3F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity), AxisSpec(60, -3, 3)}); + registry.add("hPtResolutionNeg", "p_{T} resolution (negative);p_{T} (GeV/c);Centrality (%);Counts", + o2::framework::HistType::kTH3F, {AxisSpec(axisPt), AxisSpec(axisMultiplicity), AxisSpec(60, -3, 3)}); + } if (doprocessEfficiency) { registry.add("hPtGenData", "Generated p_{T} from data events (all);p_{T} (GeV/c);Centrality (%);Counts", @@ -239,7 +276,7 @@ struct JFlucEfficiencyTask { if (p != nullptr) { charge = p->Charge(); } - return std::abs(charge) >= 3.; + return std::abs(charge) >= kChargeThreshold; } // Track selection template @@ -380,10 +417,25 @@ struct JFlucEfficiencyTask { } registry.fill(HIST("hPtGen"), particle.pt(), centrality); registry.fill(HIST("hEtaGen"), particle.eta(), centrality); + if (particle.eta() > 0) { + registry.fill(HIST("hPtGenPos_Pos"), particle.pt(), centrality); + } else if (particle.eta() < 0) { + registry.fill(HIST("hPtGenNeg_Neg"), particle.pt(), centrality); + } if (charge > 0) { // Positive particles registry.fill(HIST("hPtGenPos"), particle.pt(), centrality); + if (particle.eta() > 0) { + registry.fill(HIST("hPtGenPos_Pos"), particle.pt(), centrality); + } else if (particle.eta() < 0) { + registry.fill(HIST("hPtGenPos_Neg"), particle.pt(), centrality); + } } else if (charge < 0) { // Negative particles registry.fill(HIST("hPtGenNeg"), particle.pt(), centrality); + if (particle.eta() > 0) { + registry.fill(HIST("hPtGenNeg_Pos"), particle.pt(), centrality); + } else if (particle.eta() < 0) { + registry.fill(HIST("hPtGenNeg_Neg"), particle.pt(), centrality); + } } } // Reconstruct tracks from MC particles @@ -402,12 +454,56 @@ struct JFlucEfficiencyTask { if (!mcPart.isPhysicalPrimary() || !isChargedParticle(mcPart.pdgCode())) { continue; } + if (applyMCStudy) { + // Check charge-sign consistency + auto mcCharge = getCharge(mcPart); + auto trackSign = track.sign(); + + if (mcCharge > 0 && trackSign > 0) { + // MC charge + and track sign + + registry.fill(HIST("hChargeSignMatchPos"), track.pt(), centrality); + registry.fill(HIST("hChargeSignMatch"), track.pt(), centrality); + } else if (mcCharge < 0 && trackSign < 0) { + // MC charge - and track sign - + registry.fill(HIST("hChargeSignMatchNeg"), track.pt(), centrality); + registry.fill(HIST("hChargeSignMatch"), track.pt(), centrality); + } else if (mcCharge > 0 && trackSign < 0) { + // MC charge + but track sign - + registry.fill(HIST("hChargeSignMismatchPos"), track.pt(), centrality); + registry.fill(HIST("hChargeSignMismatch"), track.pt(), centrality); + } else if (mcCharge < 0 && trackSign > 0) { + // MC charge - but track sign + + registry.fill(HIST("hChargeSignMismatchNeg"), track.pt(), centrality); + registry.fill(HIST("hChargeSignMismatch"), track.pt(), centrality); + } + + // pT resolution + auto ptRec = track.pt(); + auto ptGen = mcPart.pt(); + auto ptResolution = (ptRec - ptGen); + registry.fill(HIST("hPtResolution"), ptRec, centrality, ptResolution); + if (track.sign() > 0) { + registry.fill(HIST("hPtResolutionPos"), ptRec, centrality, ptResolution); + } else if (track.sign() < 0) { + registry.fill(HIST("hPtResolutionNeg"), ptRec, centrality, ptResolution); + } + } registry.fill(HIST("hPtRec"), track.pt(), centrality); registry.fill(HIST("hEtaRec"), track.eta(), centrality); if (track.sign() > 0) { // Positive tracks registry.fill(HIST("hPtRecPos"), track.pt(), centrality); + if (track.eta() > 0) { + registry.fill(HIST("hPtRecPos_Pos"), track.pt(), centrality); + } else if (track.eta() < 0) { + registry.fill(HIST("hPtRecPos_Neg"), track.pt(), centrality); + } } else if (track.sign() < 0) { // Negative tracks registry.fill(HIST("hPtRecNeg"), track.pt(), centrality); + if (track.eta() > 0) { + registry.fill(HIST("hPtRecNeg_Pos"), track.pt(), centrality); + } else if (track.eta() < 0) { + registry.fill(HIST("hPtRecNeg_Neg"), track.pt(), centrality); + } } } } @@ -481,6 +577,11 @@ struct JFlucEfficiencyTask { registry.fill(HIST("hPtRecPos"), track.pt(), centrality); } else if (track.sign() < 0) { // Negative tracks registry.fill(HIST("hPtRecNeg"), track.pt(), centrality); + if (track.eta() > 0) { + registry.fill(HIST("hPtRecNeg_Pos"), track.pt(), centrality); + } else if (track.eta() < 0) { + registry.fill(HIST("hPtRecNeg_Neg"), track.pt(), centrality); + } } } } @@ -508,8 +609,18 @@ struct JFlucEfficiencyTask { registry.fill(HIST("hEtaRec"), track.eta(), centrality); if (track.sign() > 0) { // Positive tracks registry.fill(HIST("hPtRecPos"), track.pt(), centrality); + if (track.eta() > 0) { + registry.fill(HIST("hPtRecPos_Pos"), track.pt(), centrality); + } else if (track.eta() < 0) { + registry.fill(HIST("hPtRecPos_Neg"), track.pt(), centrality); + } } else if (track.sign() < 0) { // Negative tracks registry.fill(HIST("hPtRecNeg"), track.pt(), centrality); + if (track.eta() > 0) { + registry.fill(HIST("hPtRecPos_Pos"), track.pt(), centrality); + } else if (track.eta() < 0) { + registry.fill(HIST("hPtRecPos_Neg"), track.pt(), centrality); + } } } } @@ -535,6 +646,11 @@ struct JFlucEfficiencyTask { registry.fill(HIST("hPtRecPos"), track.pt(), centrality); } else if (track.sign() < 0) { // Negative tracks registry.fill(HIST("hPtRecNeg"), track.pt(), centrality); + if (track.eta() > 0) { + registry.fill(HIST("hPtRecNeg_Pos"), track.pt(), centrality); + } else if (track.eta() < 0) { + registry.fill(HIST("hPtRecNeg_Neg"), track.pt(), centrality); + } } } } From fa9e9e6ea1688a23128ad9692eef31eeb4124ff3 Mon Sep 17 00:00:00 2001 From: Swati <69241911+SwatiSaha-1997@users.noreply.github.com> Date: Thu, 7 Aug 2025 01:26:16 +0530 Subject: [PATCH 268/345] [PWGCF] Fixed large-size list error (#12449) --- .../Tasks/MeanptFluctuations.cxx | 59 ++++++++++--------- 1 file changed, 32 insertions(+), 27 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/MeanptFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/MeanptFluctuations.cxx index 89c00f981a7..dd212faf22d 100644 --- a/PWGCF/EbyEFluctuations/Tasks/MeanptFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/MeanptFluctuations.cxx @@ -77,7 +77,10 @@ struct MeanptFluctuationsQAQnTable { Configurable cfgITScluster{"cfgITScluster", 1, "Minimum Number of ITS cluster"}; Configurable cfgTPCcluster{"cfgTPCcluster", 80, "Minimum Number of TPC cluster"}; Configurable cfgTPCnCrossedRows{"cfgTPCnCrossedRows", 70, "Minimum Number of TPC crossed-rows"}; - ConfigurableAxis nchAxis{"nchAxis", {5000, 0.5, 5000.5}, ""}; + ConfigurableAxis nchAxis{"nchAxis", {500, 0.5, 500.5}, "Axis for multiplicity of GlobalTracks/PVTracks"}; + ConfigurableAxis nchAxis2{"nchAxis2", {1000, 0.5, 30000.5}, "Axis for multiplicity of FT0A/FT0C/FV0A"}; + ConfigurableAxis nchAxis3{"nchAxis3", {1000, 0.5, 100000.5}, "Axis for multiplicity of FT0A/FT0C/FV0A"}; + ConfigurableAxis centAxis{"centAxis", {90, 0., 90.0}, ""}; Configurable cfgEvSelkNoSameBunchPileup{"cfgEvSelkNoSameBunchPileup", true, "Pileup removal"}; Configurable cfgUseGoodITSLayerAllCut{"cfgUseGoodITSLayerAllCut", true, "Remove time interval with dead ITS zone"}; Configurable cfgEvSelkNoITSROFrameBorder{"cfgEvSelkNoITSROFrameBorder", true, "ITSROFrame border event selection cut"}; @@ -156,8 +159,6 @@ struct MeanptFluctuationsQAQnTable { // Variable bin width axis std::vector ptBinning = {0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.8, 2.0, 2.2, 2.4, 2.8, 3.2, 3.6, 4.}; AxisSpec ptAxis = {ptBinning, "#it{p}_{T} (GeV/#it{c})"}; - std::vector centBining = {0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90}; - AxisSpec centAxis = {centBining, "centrality (%)"}; // Add histograms to histogram manager (as in the output object of in AliPhysics) histos.add("hZvtx_after_sel", ";Z (cm)", kTH1F, {vtxZAxis}); @@ -172,19 +173,21 @@ struct MeanptFluctuationsQAQnTable { histos.add("Hist2D_globalTracks_PVTracks", "", {HistType::kTH2D, {nchAxis, nchAxis}}); histos.add("Hist2D_cent_nch", "", {HistType::kTH2D, {nchAxis, centAxis}}); // before selection - histos.add("His2D_globalTracks_PVTracks_beforeSel", "", {HistType::kTH2D, {nchAxis, nchAxis}}); - histos.add("His2D_globalTracks_centFT0C_beforeSel", "", {HistType::kTH2D, {centAxis, nchAxis}}); - histos.add("His2D_PVTracks_centFT0C_beforeSel", "", {HistType::kTH2D, {centAxis, nchAxis}}); - histos.add("His2D_globalTracks_V0ATracks_beforeSel", "", {HistType::kTH2D, {nchAxis, nchAxis}}); - histos.add("His2D_globalTracks_T0ATracks_beforeSel", "", {HistType::kTH2D, {nchAxis, nchAxis}}); - histos.add("His2D_V0ATracks_T0CTracks_beforeSel", "", {HistType::kTH2D, {nchAxis, nchAxis}}); + histos.add("MultCorrelationPlots/BeforeSelection/His2D_globalTracks_PVTracks_beforeSel", "", {HistType::kTH2D, {nchAxis, nchAxis}}); + histos.add("MultCorrelationPlots/BeforeSelection/His2D_globalTracks_centFT0C_beforeSel", "", {HistType::kTH2D, {centAxis, nchAxis}}); + histos.add("MultCorrelationPlots/BeforeSelection/His2D_PVTracks_centFT0C_beforeSel", "", {HistType::kTH2D, {centAxis, nchAxis}}); + histos.add("MultCorrelationPlots/BeforeSelection/His2D_globalTracks_V0ATracks_beforeSel", "", {HistType::kTH2D, {nchAxis3, nchAxis}}); + histos.add("MultCorrelationPlots/BeforeSelection/His2D_globalTracks_T0ATracks_beforeSel", "", {HistType::kTH2D, {nchAxis2, nchAxis}}); + histos.add("MultCorrelationPlots/BeforeSelection/His2D_V0ATracks_T0CTracks_beforeSel", "", {HistType::kTH2D, {nchAxis2, nchAxis3}}); // after selection - histos.add("His2D_globalTracks_PVTracks_afterSel", "", {HistType::kTH2D, {nchAxis, nchAxis}}); - histos.add("His2D_globalTracks_centFT0C_afterSel", "", {HistType::kTH2D, {centAxis, nchAxis}}); - histos.add("His2D_PVTracks_centFT0C_afterSel", "", {HistType::kTH2D, {centAxis, nchAxis}}); - histos.add("His2D_globalTracks_V0ATracks_afterSel", "", {HistType::kTH2D, {nchAxis, nchAxis}}); - histos.add("His2D_globalTracks_T0ATracks_afterSel", "", {HistType::kTH2D, {nchAxis, nchAxis}}); - histos.add("His2D_V0ATracks_T0CTracks_afterSel", "", {HistType::kTH2D, {nchAxis, nchAxis}}); + if (cfgUseSmallIonAdditionalEventCut) { + histos.add("MultCorrelationPlots/AfterSelection/His2D_globalTracks_PVTracks_afterSel", "", {HistType::kTH2D, {nchAxis, nchAxis}}); + histos.add("MultCorrelationPlots/AfterSelection/His2D_globalTracks_centFT0C_afterSel", "", {HistType::kTH2D, {centAxis, nchAxis}}); + histos.add("MultCorrelationPlots/AfterSelection/His2D_PVTracks_centFT0C_afterSel", "", {HistType::kTH2D, {centAxis, nchAxis}}); + histos.add("MultCorrelationPlots/AfterSelection/His2D_globalTracks_V0ATracks_afterSel", "", {HistType::kTH2D, {nchAxis3, nchAxis}}); + histos.add("MultCorrelationPlots/AfterSelection/His2D_globalTracks_T0ATracks_afterSel", "", {HistType::kTH2D, {nchAxis2, nchAxis}}); + histos.add("MultCorrelationPlots/AfterSelection/His2D_V0ATracks_T0CTracks_afterSel", "", {HistType::kTH2D, {nchAxis2, nchAxis3}}); + } // Event selection - Alex if (cfgUse22sEventCut) { @@ -327,12 +330,12 @@ struct MeanptFluctuationsQAQnTable { return; } - histos.fill(HIST("His2D_globalTracks_PVTracks_beforeSel"), coll.multNTracksPV(), inputTracks.size()); - histos.fill(HIST("His2D_globalTracks_centFT0C_beforeSel"), coll.centFT0C(), inputTracks.size()); - histos.fill(HIST("His2D_PVTracks_centFT0C_beforeSel"), coll.centFT0C(), coll.multNTracksPV()); - histos.fill(HIST("His2D_globalTracks_V0ATracks_beforeSel"), coll.multFV0A(), inputTracks.size()); - histos.fill(HIST("His2D_globalTracks_T0ATracks_beforeSel"), coll.multFT0A(), inputTracks.size()); - histos.fill(HIST("His2D_V0ATracks_T0CTracks_beforeSel"), coll.multFT0C(), coll.multFV0A()); + histos.fill(HIST("MultCorrelationPlots/BeforeSelection/His2D_globalTracks_PVTracks_beforeSel"), coll.multNTracksPV(), inputTracks.size()); + histos.fill(HIST("MultCorrelationPlots/BeforeSelection/His2D_globalTracks_centFT0C_beforeSel"), coll.centFT0C(), inputTracks.size()); + histos.fill(HIST("MultCorrelationPlots/BeforeSelection/His2D_PVTracks_centFT0C_beforeSel"), coll.centFT0C(), coll.multNTracksPV()); + histos.fill(HIST("MultCorrelationPlots/BeforeSelection/His2D_globalTracks_V0ATracks_beforeSel"), coll.multFV0A(), inputTracks.size()); + histos.fill(HIST("MultCorrelationPlots/BeforeSelection/His2D_globalTracks_T0ATracks_beforeSel"), coll.multFT0A(), inputTracks.size()); + histos.fill(HIST("MultCorrelationPlots/BeforeSelection/His2D_V0ATracks_T0CTracks_beforeSel"), coll.multFT0C(), coll.multFV0A()); const auto centralityFT0C = coll.centFT0C(); if (cfgUse22sEventCut && !eventSelected(coll, inputTracks.size(), centralityFT0C)) @@ -340,12 +343,14 @@ struct MeanptFluctuationsQAQnTable { if (cfgUseSmallIonAdditionalEventCut && !eventSelectedSmallion(coll, inputTracks.size(), centralityFT0C)) return; - histos.fill(HIST("His2D_globalTracks_PVTracks_afterSel"), coll.multNTracksPV(), inputTracks.size()); - histos.fill(HIST("His2D_globalTracks_centFT0C_afterSel"), coll.centFT0C(), inputTracks.size()); - histos.fill(HIST("His2D_PVTracks_centFT0C_afterSel"), coll.centFT0C(), coll.multNTracksPV()); - histos.fill(HIST("His2D_globalTracks_V0ATracks_afterSel"), coll.multFV0A(), inputTracks.size()); - histos.fill(HIST("His2D_globalTracks_T0ATracks_afterSel"), coll.multFT0A(), inputTracks.size()); - histos.fill(HIST("His2D_V0ATracks_T0CTracks_afterSel"), coll.multFT0C(), coll.multFV0A()); + if (cfgUseSmallIonAdditionalEventCut) { + histos.fill(HIST("MultCorrelationPlots/AfterSelection/His2D_globalTracks_PVTracks_afterSel"), coll.multNTracksPV(), inputTracks.size()); + histos.fill(HIST("MultCorrelationPlots/AfterSelection/His2D_globalTracks_centFT0C_afterSel"), coll.centFT0C(), inputTracks.size()); + histos.fill(HIST("MultCorrelationPlots/AfterSelection/His2D_PVTracks_centFT0C_afterSel"), coll.centFT0C(), coll.multNTracksPV()); + histos.fill(HIST("MultCorrelationPlots/AfterSelection/His2D_globalTracks_V0ATracks_afterSel"), coll.multFV0A(), inputTracks.size()); + histos.fill(HIST("MultCorrelationPlots/AfterSelection/His2D_globalTracks_T0ATracks_afterSel"), coll.multFT0A(), inputTracks.size()); + histos.fill(HIST("MultCorrelationPlots/AfterSelection/His2D_V0ATracks_T0CTracks_afterSel"), coll.multFT0C(), coll.multFV0A()); + } histos.fill(HIST("hZvtx_after_sel"), coll.posZ()); From d1bbddf813e3a826fc1d06dd0130e6506953c21e Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Wed, 6 Aug 2025 23:34:53 +0200 Subject: [PATCH 269/345] [PWGEM/Dilepton] update eventQC.cxx (#12456) --- PWGEM/Dilepton/Tasks/eventQC.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGEM/Dilepton/Tasks/eventQC.cxx b/PWGEM/Dilepton/Tasks/eventQC.cxx index 02a388397c0..eb46e057ace 100644 --- a/PWGEM/Dilepton/Tasks/eventQC.cxx +++ b/PWGEM/Dilepton/Tasks/eventQC.cxx @@ -201,8 +201,8 @@ struct eventQC { if (doprocessEventQC_SWT) { fRegistry.add("BC/hNcoll", "Number of collisions per triggered BC;N_{collision} per triggered BC", kTH1F, {{11, -0.5, +10.5}}, false); - fRegistry.add("BC/hDeltaT", "diff. in collision time per BC;#DeltaT_{coll} (ns)", kTH1F, {{200, -100, +100}}, false); - fRegistry.add("BC/hDeltaZ", "diff. in collision Z_{vtx} per BC;#DeltaZ_{vtx} (cm)", kTH1F, {{200, -10, +10}}, false); + fRegistry.add("BC/hDeltaT", "diff. in collision time per BC;#DeltaT_{coll} (ns)", kTH1F, {{500, -25, +25}}, false); + fRegistry.add("BC/hDeltaZ", "diff. in collision Z_{vtx} per BC;#DeltaZ_{vtx} (cm)", kTH1F, {{1000, -5, +5}}, false); fRegistry.add("BC/hCorrNcontrib", "hMultNTracksPV;", kTH2F, {{axis_mult_ncontrib}, {axis_mult_ncontrib}}, false); fRegistry.add("BC/Collision/hMultNTracksPV", "hMultNTracksPV;N_{track} to PV in |#eta| < 0.8", kTH1F, {{axis_mult_ncontrib08}}, false); fRegistry.add("BC/Collision/hMultFT0AFT0C", "hMultFT0AFT0C;mult. FT0A;mult. FT0C", kTH2F, {{axis_mult_ft0a}, {axis_mult_ft0c}}, false); From c6de87c3953323cea7109357c80d46967bf239da Mon Sep 17 00:00:00 2001 From: Stefanie Mrozinski <63045530+Steffimro@users.noreply.github.com> Date: Thu, 7 Aug 2025 02:15:17 +0200 Subject: [PATCH 270/345] [PWGEM] Deleted histograms that migrated into the compconvbuildertask (#12457) --- PWGEM/PhotonMeson/Tasks/pcmQCMC.cxx | 54 ----------------------------- 1 file changed, 54 deletions(-) diff --git a/PWGEM/PhotonMeson/Tasks/pcmQCMC.cxx b/PWGEM/PhotonMeson/Tasks/pcmQCMC.cxx index d2ea5619072..808498f3ab0 100644 --- a/PWGEM/PhotonMeson/Tasks/pcmQCMC.cxx +++ b/PWGEM/PhotonMeson/Tasks/pcmQCMC.cxx @@ -59,7 +59,6 @@ struct PCMQCMC { Configurable maxRgen{"maxRgen", 90.f, "maximum radius for generated particles"}; Configurable margin_z_mc{"margin_z_mc", 7.0, "margin for z cut in cm for MC"}; Configurable cfgRequireTrueAssociation{"cfgRequireTrueAssociation", false, "flag to require true mc collision association"}; - Configurable cfg_fill_resolution{"cfg_fill_resoltion", false, "flag to fill resolution histogram"}; EMPhotonEventCut fEMEventCut; struct : ConfigurableGroup { @@ -204,22 +203,9 @@ struct PCMQCMC { fRegistry.add("V0/primary/hPtGen_DeltaEta", "photon #eta resolution;p_{T}^{gen} (GeV/c);#eta^{rec} - #eta^{gen}", kTH2F, {{1000, 0, 10}, {100, -0.5f, 0.5f}}, true); fRegistry.add("V0/primary/hPtGen_DeltaPhi", "photon #varphi resolution;p_{T}^{gen} (GeV/c);#varphi^{rec} - #varphi^{gen} (rad.)", kTH2F, {{1000, 0, 10}, {100, -0.5f, 0.5f}}, true); fRegistry.add("V0/primary/hRxyGen_DeltaPtOverPtGen", "photon p_{T} resolution; R_{xy}^{gen} (cm);(p_{T}^{rec} - p_{T}^{gen})/p_{T}^{gen}", kTH2F, {{100, 0, 100}, {200, -1.0f, 1.0f}}, true); - fRegistry.add("V0/primary/hsPhotonResolution", - "Photon resolution;p_{T};#eta;R_{xy};Z_{conv};Z_{vtx};#Deltap_{T}/p_{T};#Delta#eta;#Delta#phi", - kTHnSparseF, - {{100, 0, 10}, - {80, -1.6, 1.6}, - {100, 0, 100}, - {100, -50, 50}, - {100, -50, 50}, - {200, -1, 1}, - {100, -0.5, 0.5}, - {100, -0.5, 0.5}}, - false); fRegistry.add("V0/primary/hRxyGen_DeltaEta", "photon #eta resolution;R_{xy}^{gen} (cm);#eta^{rec} - #eta^{gen}", kTH2F, {{100, 0, 100}, {100, -0.5f, 0.5f}}, true); fRegistry.add("V0/primary/hRxyGen_DeltaPhi", "photon #varphi resolution;R_{xy}^{gen} (cm);#varphi^{rec} - #varphi^{gen} (rad.)", kTH2F, {{100, 0, 100}, {100, -0.5f, 0.5f}}, true); fRegistry.add("V0/primary/hRxyGen_DeltaR", "photon #varphi resolution;R_{xy}^{gen} (cm);#varphi^{rec} - #varphi^{gen} (rad.)", kTH2F, {{100, 0, 100}, {100, 0, 100}}, true); - fRegistry.add("V0/primary/hsConvVtxZPtR", "z_{vtx} vs p_{T} vs R_{xy};z_{vtx} (cm);p_{T} (GeV/c);R_{xy} (cm)", kTHnSparseF, {{100, -20.0f, +20.0f}, {100, 0.0f, 10.0f}, {100, 0, 100}}, false); fRegistry.add("V0/primary/hXY_MC", "X vs. Y of true photon conversion point.;X (cm);Y (cm)", kTH2F, {{400, -100.0f, +100}, {400, -100, +100}}, true); fRegistry.add("V0/primary/hRZ_MC", "R vs. Z of true photon conversion point;Z (cm);R_{xy} (cm)", kTH2F, {{200, -100.0f, +100}, {200, 0, 100}}, true); fRegistry.add("V0/primary/hsConvPoint", "photon conversion point;r_{xy} (cm);#varphi (rad.);#eta;", kTHnSparseF, {{100, 0.0f, 100}, {90, 0, 2 * M_PI}, {80, -2, +2}}, false); @@ -253,21 +239,6 @@ struct PCMQCMC { fRegistry.add("V0Leg/primary/hZY", "Z vs. Y;Z (cm);Y (cm)", kTH2F, {{200, -100, 100}, {40, -20, 20}}, false); fRegistry.add("V0Leg/primary/hPtGen_DeltaPtOverPtGen", "electron p_{T} resolution;p_{T}^{gen} (GeV/c);(p_{T}^{rec} - p_{T}^{gen})/p_{T}^{gen}", kTH2F, {{1000, 0, 10}, {200, -1.0f, 1.0f}}, true); fRegistry.add("V0Leg/primary/hPtGen_DeltaEta", "electron #eta resolution;p_{T}^{gen} (GeV/c);#eta^{rec} - #eta^{gen}", kTH2F, {{1000, 0, 10}, {100, -0.5f, 0.5f}}, true); - if (cfg_fill_resolution) { - fRegistry.add("V0Leg/primary/hsPhotonResolution", - "Photon resolution;p_{T};#eta;R_{xy};Z_{conv};Z_{vtx};#Deltap_{T}/p_{T};#Delta#eta;#Delta#phi", - kTHnSparseF, - {{100, 0, 10}, - {80, -1.6, 1.6}, - {100, 0, 100}, - {100, -50, 50}, - {100, -50, 50}, - {200, -1, 1}, - {100, -0.5, 0.5}, - {100, -0.5, 0.5}}, - false); - } - fRegistry.add("V0Leg/primary/hPtGen_DeltaPhi", "electron #varphi resolution;p_{T}^{gen} (GeV/c);#varphi^{rec} - #varphi^{gen} (rad.)", kTH2F, {{1000, 0, 10}, {100, -0.5f, 0.5f}}, true); fRegistry.add("V0Leg/primary/hRxyGen_DeltaPtOverPtGen", "photon p_{T} resolution; R_{xy}^{gen} (cm);(p_{T}^{rec} - p_{T}^{gen})/p_{T}^{gen}", kTH2F, {{100, 0, 100}, {200, -1.0f, 1.0f}}, true); fRegistry.add("V0Leg/primary/hRxyGen_DeltaEta", "photon #eta resolution;R_{xy}^{gen} (cm);#eta^{rec} - #eta^{gen}", kTH2F, {{100, 0, 100}, {100, -0.5f, 0.5f}}, true); @@ -391,9 +362,6 @@ struct PCMQCMC { fRegistry.fill(HIST("V0/") + HIST(mcphoton_types[mctype]) + HIST("hMassGamma"), v0.v0radius(), v0.mGamma()); fRegistry.fill(HIST("V0/") + HIST(mcphoton_types[mctype]) + HIST("hKFChi2vsM"), v0.mGamma(), v0.chiSquareNDF()); fRegistry.fill(HIST("V0/") + HIST(mcphoton_types[mctype]) + HIST("hKFChi2vsR"), v0.v0radius(), v0.chiSquareNDF()); - fRegistry.fill(HIST("V0/") + HIST(mcphoton_types[mctype]) + HIST("hsConvVtxZPtR"), - v0.vz(), v0.pt(), v0.v0radius()); - fRegistry.fill(HIST("V0/") + HIST(mcphoton_types[mctype]) + HIST("hKFChi2vsX"), v0.vx(), v0.chiSquareNDF()); fRegistry.fill(HIST("V0/") + HIST(mcphoton_types[mctype]) + HIST("hKFChi2vsY"), v0.vy(), v0.chiSquareNDF()); fRegistry.fill(HIST("V0/") + HIST(mcphoton_types[mctype]) + HIST("hKFChi2vsZ"), v0.vz(), v0.chiSquareNDF()); @@ -402,17 +370,6 @@ struct PCMQCMC { fRegistry.fill(HIST("V0/") + HIST(mcphoton_types[mctype]) + HIST("hPtGen_DeltaPhi"), mcphoton.pt(), v0.phi() - mcphoton.phi()); fRegistry.fill(HIST("V0/") + HIST(mcphoton_types[mctype]) + HIST("hRxyGen_DeltaPtOverPtGen"), std::sqrt(std::pow(mcleg.vx(), 2) + std::pow(mcleg.vy(), 2)), (v0.pt() - mcphoton.pt()) / mcphoton.pt()); fRegistry.fill(HIST("V0/") + HIST(mcphoton_types[mctype]) + HIST("hRxyGen_DeltaEta"), std::sqrt(std::pow(mcleg.vx(), 2) + std::pow(mcleg.vy(), 2)), v0.eta() - mcphoton.eta()); - if (cfg_fill_resolution) { - fRegistry.fill(HIST("V0/") + HIST(mcphoton_types[mctype]) + HIST("hsPhotonResolution"), - mcphoton.pt(), - mcphoton.eta(), - std::sqrt(mcleg.vx() * mcleg.vx() + mcleg.vy() * mcleg.vy()), - mcleg.vz(), - v0.vz(), - (v0.pt() - mcphoton.pt()) / mcphoton.pt(), - v0.eta() - mcphoton.eta(), - TVector2::Phi_mpi_pi(v0.phi() - mcphoton.phi())); - } fRegistry.fill(HIST("V0/") + HIST(mcphoton_types[mctype]) + HIST("hRxyGen_DeltaPhi"), std::sqrt(std::pow(mcleg.vx(), 2) + std::pow(mcleg.vy(), 2)), v0.phi() - mcphoton.phi()); fRegistry.fill(HIST("V0/") + HIST(mcphoton_types[mctype]) + HIST("hRxyGen_DeltaR"), std::sqrt(std::pow(mcleg.vx(), 2) + std::pow(mcleg.vy(), 2)), v0.v0radius() - std::sqrt(std::pow(mcleg.vx(), 2) + std::pow(mcleg.vy(), 2))); fRegistry.fill(HIST("V0/") + HIST(mcphoton_types[mctype]) + HIST("hConvPoint_diffX"), mcleg.vx(), v0.vx() - mcleg.vx()); @@ -457,17 +414,6 @@ struct PCMQCMC { fRegistry.fill(HIST("V0Leg/") + HIST(mcphoton_types[mctype]) + HIST("hPtGen_DeltaEta"), mcleg.pt(), leg.eta() - mcleg.eta()); fRegistry.fill(HIST("V0Leg/") + HIST(mcphoton_types[mctype]) + HIST("hPtGen_DeltaPhi"), mcleg.pt(), leg.phi() - mcleg.phi()); fRegistry.fill(HIST("V0Leg/") + HIST(mcphoton_types[mctype]) + HIST("hRxyGen_DeltaPtOverPtGen"), std::sqrt(std::pow(mcleg.vx(), 2) + std::pow(mcleg.vy(), 2)), (leg.pt() - mcleg.pt()) / mcleg.pt()); - if (cfg_fill_resolution) { - fRegistry.fill(HIST("V0Leg/") + HIST(mcphoton_types[mctype]) + HIST("hsPhotonResolution"), - mcleg.pt(), - mcleg.eta(), - std::sqrt(mcleg.vx() * mcleg.vx() + mcleg.vy() * mcleg.vy()), - mcleg.vz(), - leg.z(), - (leg.pt() - mcleg.pt()) / mcleg.pt(), - leg.eta() - mcleg.eta(), - TVector2::Phi_mpi_pi(leg.phi() - mcleg.phi())); - } fRegistry.fill(HIST("V0Leg/") + HIST(mcphoton_types[mctype]) + HIST("hRxyGen_DeltaEta"), std::sqrt(std::pow(mcleg.vx(), 2) + std::pow(mcleg.vy(), 2)), leg.eta() - mcleg.eta()); fRegistry.fill(HIST("V0Leg/") + HIST(mcphoton_types[mctype]) + HIST("hRxyGen_DeltaPhi"), std::sqrt(std::pow(mcleg.vx(), 2) + std::pow(mcleg.vy(), 2)), leg.phi() - mcleg.phi()); } From bff473d2a691d2f2b7b589679d2814a484995ba0 Mon Sep 17 00:00:00 2001 From: Gyula Bencedi Date: Thu, 7 Aug 2025 02:21:58 +0200 Subject: [PATCH 271/345] [PWGLF] Added QA histos for track selection (#12464) --- PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx | 91 ++++++++++++++++++++---------- 1 file changed, 61 insertions(+), 30 deletions(-) diff --git a/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx b/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx index f8e01e36a7e..ed386e6a6fd 100644 --- a/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx +++ b/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx @@ -66,6 +66,17 @@ AxisSpec phiAxis = {629, 0, TwoPI, "Rad", "#phi"}; AxisSpec etaAxis = {20, -4., -2.}; AxisSpec centAxis{100, 0, 100, "centrality"}; AxisSpec chiSqAxis = {100, 0., 1000.}; +AxisSpec nclsAxis{10, 0.5, 10.5, "# clusters"}; + +enum TrkSel { + trkSelNCls, + trkSelChi2Ncl, + trkSelEta, + trkSelPhiCut, + trkSelPt, + trkSelCA, + nTrkSel +}; struct DndetaMFTPbPb { SliceCache cache; @@ -101,6 +112,7 @@ struct DndetaMFTPbPb { "minimum number of MFT clusters"}; Configurable useChi2Cut{"useChi2Cut", false, "use track chi2 cut"}; Configurable maxChi2NCl{"maxChi2NCl", 1000.f, "maximum chi2 per MFT clusters"}; + Configurable usePtCut{"usePtCut", false, "use track pT cut"}; Configurable minPt{"minPt", 0., "minimum pT of the MFT tracks"}; Configurable requireCA{ "requireCA", false, "Use Cellular Automaton track-finding algorithm"}; @@ -108,7 +120,8 @@ struct DndetaMFTPbPb { } trackCuts; struct : ConfigurableGroup { - Configurable maxZvtx{"maxZvtx", 10.0f, "Cut on z-vtx"}; + Configurable maxZvtx{"maxZvtx", 10.0f, "maximum cut on z-vtx (cm)"}; + Configurable minZvtx{"minZvtx", -10.0f, "minimum cut on z-vtx (cm)"}; Configurable useZDiffCut{"useZDiffCut", false, "use Zvtx reco-mc diff. cut"}; Configurable maxZvtxDiff{ @@ -116,12 +129,12 @@ struct DndetaMFTPbPb { "max allowed Z vtx difference for reconstruced collisions (cm)"}; Configurable requireIsGoodZvtxFT0VsPV{"requireIsGoodZvtxFT0VsPV", true, "require events with PV position along z consistent (within 1 cm) between PV reconstructed using tracks and PV using FT0 A-C time difference"}; Configurable requireRejectSameBunchPileup{"requireRejectSameBunchPileup", true, "reject collisions in case of pileup with another collision in the same foundBC"}; - Configurable requireNoCollInTimeRangeStrict{"requireNoCollInTimeRangeStrict", true, " requireNoCollInTimeRangeStrict"}; - Configurable requireNoCollInRofStrict{"requireNoCollInRofStrict", true, "requireNoCollInRofStrict"}; + Configurable requireNoCollInTimeRangeStrict{"requireNoCollInTimeRangeStrict", false, " requireNoCollInTimeRangeStrict"}; + Configurable requireNoCollInRofStrict{"requireNoCollInRofStrict", false, "requireNoCollInRofStrict"}; Configurable requireNoCollInRofStandard{"requireNoCollInRofStandard", false, "requireNoCollInRofStandard"}; - Configurable requireNoHighMultCollInPrevRof{"requireNoHighMultCollInPrevRof", true, "requireNoHighMultCollInPrevRof"}; + Configurable requireNoHighMultCollInPrevRof{"requireNoHighMultCollInPrevRof", false, "requireNoHighMultCollInPrevRof"}; Configurable requireNoCollInTimeRangeStd{ - "requireNoCollInTimeRangeStd", false, + "requireNoCollInTimeRangeStd", true, "reject collisions corrupted by the cannibalism, with other collisions " "within +/- 10 microseconds"}; Configurable requireNoCollInTimeRangeNarrow{ @@ -234,7 +247,7 @@ struct DndetaMFTPbPb { "be enabled!"); } - auto hev = registry.add("hEvtSel", "hEvtSel", HistType::kTH1F, + auto hev = registry.add("Events/hEvtSel", "hEvtSel", HistType::kTH1F, {{14, -0.5f, +13.5f}}); hev->GetXaxis()->SetBinLabel(1, "All collisions"); hev->GetXaxis()->SetBinLabel(2, "Ev. sel."); @@ -250,6 +263,14 @@ struct DndetaMFTPbPb { hev->GetXaxis()->SetBinLabel(12, "Below min occup."); hev->GetXaxis()->SetBinLabel(13, "Above max occup."); + registry.add("Tracks/hTrkSel", "Number of tracks; Cut; #Tracks Passed Cut", {HistType::kTH1D, {{nTrkSel, 0, nTrkSel}}}); + registry.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelNCls + 1, "Ncl cut"); + registry.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelChi2Ncl + 1, "#chi^{2}/Ncl cut"); + registry.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelEta + 1, "#eta cut"); + registry.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelPhiCut + 1, "#varphi cut"); + registry.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelPt + 1, "#it{p}_{T} cut"); + registry.get(HIST("Tracks/hTrkSel"))->GetXaxis()->SetBinLabel(trkSelCA + 1, "Tracking algorithm (CA)"); + auto hBcSel = registry.add("hBcSel", "hBcSel", HistType::kTH1F, {{3, -0.5f, +2.5f}}); hBcSel->GetXaxis()->SetBinLabel(1, "Good BCs"); @@ -290,7 +311,7 @@ struct DndetaMFTPbPb { qaregistry.add( {"Tracks/NclustersEta", "; nClusters; #eta; occupancy", - {HistType::kTHnSparseF, {{7, 4, 10}, etaAxis, occupancyAxis}}}); + {HistType::kTHnSparseF, {nclsAxis, etaAxis, occupancyAxis}}}); qaregistry.add({"Tracks/NchSel", "; N_{ch}; occupancy", {HistType::kTH2F, {multAxis, occupancyAxis}}}); @@ -311,7 +332,7 @@ struct DndetaMFTPbPb { qaregistry.add( {"Tracks/NclustersEtaBest", "; nClusters; #eta; occupancy", - {HistType::kTHnSparseF, {{7, 4, 10}, etaAxis, occupancyAxis}}}); + {HistType::kTHnSparseF, {nclsAxis, etaAxis, occupancyAxis}}}); qaregistry.add( {"Tracks/DCAXYPt", "; p_{T} (GeV/c) ; DCA_{XY} (cm); occupancy", @@ -389,7 +410,7 @@ struct DndetaMFTPbPb { qaregistry.add({"Tracks/Centrality/NclustersEta", "; nClusters; #eta; centrality; occupancy", {HistType::kTHnSparseF, - {{7, 4, 10}, etaAxis, centralityAxis, occupancyAxis}}}); + {nclsAxis, etaAxis, centralityAxis, occupancyAxis}}}); if (doprocessDatawBestTracksCentFT0C || doprocessDatawBestTracksCentFT0CVariant1 || @@ -412,7 +433,7 @@ struct DndetaMFTPbPb { {"Tracks/Centrality/NclustersEtaBest", "; nClusters; #eta; centrality; occupancy", {HistType::kTHnSparseF, - {{7, 4, 10}, etaAxis, centralityAxis, occupancyAxis}}}); + {nclsAxis, etaAxis, centralityAxis, occupancyAxis}}}); qaregistry.add({"Tracks/Centrality/TrackAmbDegree", "; N_{coll}^{comp}; centrality; occupancy", {HistType::kTHnSparseF, @@ -744,20 +765,21 @@ struct DndetaMFTPbPb { template bool isTrackSelected(const T& track) { - if (track.eta() < trackCuts.minEta || track.eta() > trackCuts.maxEta) + if (track.nClusters() < trackCuts.minNclusterMft) { return false; + } + registry.fill(HIST("Tracks/hTrkSel"), trkSelNCls); if (trackCuts.useChi2Cut) { float nclMft = std::max(2.0f * track.nClusters() - 5.0f, 1.0f); float mftChi2NCl = track.chi2() / nclMft; if (mftChi2NCl > trackCuts.maxChi2NCl) return false; } - if (trackCuts.requireCA && !track.isCA()) - return false; - if (track.nClusters() < trackCuts.minNclusterMft) - return false; - if (track.pt() < trackCuts.minPt) + registry.fill(HIST("Tracks/hTrkSel"), trkSelChi2Ncl); + if (track.eta() < trackCuts.minEta || track.eta() > trackCuts.maxEta) { return false; + } + registry.fill(HIST("Tracks/hTrkSel"), trkSelEta); if (trackCuts.usephiCut) { float phi = track.phi(); o2::math_utils::bringTo02Pi(phi); @@ -771,6 +793,15 @@ struct DndetaMFTPbPb { (phi < ((PIHalf - 0.1) * PI) + trackCuts.phiCut))) return false; } + registry.fill(HIST("Tracks/hTrkSel"), trkSelPhiCut); + if (trackCuts.usePtCut && track.pt() < trackCuts.minPt) { + return false; + } + registry.fill(HIST("Tracks/hTrkSel"), trkSelPt); + if (trackCuts.requireCA && !track.isCA()) { + return false; + } + registry.fill(HIST("Tracks/hTrkSel"), trkSelCA); return true; } @@ -938,69 +969,69 @@ struct DndetaMFTPbPb { bool isGoodEvent(C const& collision) { if constexpr (fillHis) { - registry.fill(HIST("hEvtSel"), 0); + registry.fill(HIST("Events/hEvtSel"), 0); } if (!collision.sel8()) { return false; } if constexpr (fillHis) { - registry.fill(HIST("hEvtSel"), 1); + registry.fill(HIST("Events/hEvtSel"), 1); } if (eventCuts.requireIsGoodZvtxFT0VsPV && !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { return false; } if constexpr (fillHis) { - registry.fill(HIST("hEvtSel"), 2); + registry.fill(HIST("Events/hEvtSel"), 2); } if (eventCuts.requireRejectSameBunchPileup && !collision.selection_bit(aod::evsel::kNoSameBunchPileup)) { return false; } if constexpr (fillHis) { - registry.fill(HIST("hEvtSel"), 3); + registry.fill(HIST("Events/hEvtSel"), 3); } - if (std::abs(collision.posZ()) >= eventCuts.maxZvtx) { + if (collision.posZ() <= eventCuts.minZvtx || collision.posZ() >= eventCuts.maxZvtx) { return false; } if constexpr (fillHis) { - registry.fill(HIST("hEvtSel"), 4); + registry.fill(HIST("Events/hEvtSel"), 4); } if (eventCuts.requireNoCollInTimeRangeStd && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { return false; } if constexpr (fillHis) { - registry.fill(HIST("hEvtSel"), 5); + registry.fill(HIST("Events/hEvtSel"), 5); } if (eventCuts.requireNoCollInTimeRangeNarrow && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeNarrow)) { return false; } if constexpr (fillHis) { - registry.fill(HIST("hEvtSel"), 6); + registry.fill(HIST("Events/hEvtSel"), 6); } if (eventCuts.requireNoCollInTimeRangeStrict && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStrict)) { return false; } if constexpr (fillHis) { - registry.fill(HIST("hEvtSel"), 7); + registry.fill(HIST("Events/hEvtSel"), 7); } if (eventCuts.requireNoCollInRofStrict && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStrict)) { return false; } if constexpr (fillHis) { - registry.fill(HIST("hEvtSel"), 8); + registry.fill(HIST("Events/hEvtSel"), 8); } if (eventCuts.requireNoCollInRofStandard && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStandard)) { return false; } if constexpr (fillHis) { - registry.fill(HIST("hEvtSel"), 9); + registry.fill(HIST("Events/hEvtSel"), 9); } if (eventCuts.requireNoHighMultCollInPrevRof && !collision.selection_bit(o2::aod::evsel::kNoHighMultCollInPrevRof)) { return false; } if constexpr (fillHis) { - registry.fill(HIST("hEvtSel"), 10); + registry.fill(HIST("Events/hEvtSel"), 10); } if (eventCuts.minOccupancy >= 0 && getOccupancy(collision, eventCuts.occupancyEstimator) < @@ -1008,7 +1039,7 @@ struct DndetaMFTPbPb { return false; } if constexpr (fillHis) { - registry.fill(HIST("hEvtSel"), 11); + registry.fill(HIST("Events/hEvtSel"), 11); } if (eventCuts.maxOccupancy >= 0 && getOccupancy(collision, eventCuts.occupancyEstimator) > @@ -1016,7 +1047,7 @@ struct DndetaMFTPbPb { return false; } if constexpr (fillHis) { - registry.fill(HIST("hEvtSel"), 12); + registry.fill(HIST("Events/hEvtSel"), 12); } return true; } From 22fec6f164b32a0d4d4a4d8f6cf1ba2442caeeec Mon Sep 17 00:00:00 2001 From: prottayCMT <61418725+prottayCMT@users.noreply.github.com> Date: Thu, 7 Aug 2025 04:53:11 +0200 Subject: [PATCH 272/345] [PWGLF] updated datamodel and added initial analysis task for spin alignment (#12427) Co-authored-by: Prottay Das --- PWGLF/DataModel/LFCKSSpinalignmentTables.h | 21 +- .../Resonances/cksspinalignment.cxx | 84 +++--- PWGLF/Tasks/Resonances/CMakeLists.txt | 5 + PWGLF/Tasks/Resonances/cksspinalignder.cxx | 279 ++++++++++++++++++ 4 files changed, 344 insertions(+), 45 deletions(-) create mode 100644 PWGLF/Tasks/Resonances/cksspinalignder.cxx diff --git a/PWGLF/DataModel/LFCKSSpinalignmentTables.h b/PWGLF/DataModel/LFCKSSpinalignmentTables.h index 7e6447459cc..6593d22fe6b 100644 --- a/PWGLF/DataModel/LFCKSSpinalignmentTables.h +++ b/PWGLF/DataModel/LFCKSSpinalignmentTables.h @@ -33,6 +33,7 @@ namespace o2::aod namespace kshortpionevent { DECLARE_SOA_COLUMN(Cent, cent, float); +DECLARE_SOA_COLUMN(Posz, posz, float); DECLARE_SOA_COLUMN(CollIndex, collIndex, float); DECLARE_SOA_COLUMN(PsiFT0C, psiFT0C, float); DECLARE_SOA_COLUMN(PsiFT0A, psiFT0A, float); @@ -41,6 +42,7 @@ DECLARE_SOA_COLUMN(PsiTPC, psiTPC, float); DECLARE_SOA_TABLE(KShortpionEvents, "AOD", "KSHORTPIONEVENT", o2::soa::Index<>, kshortpionevent::Cent, + kshortpionevent::Posz, kshortpionevent::CollIndex, kshortpionevent::PsiFT0C, kshortpionevent::PsiFT0A, @@ -63,7 +65,6 @@ DECLARE_SOA_COLUMN(KShortMass, kShortMass, float); //! KShort Ma DECLARE_SOA_COLUMN(PionBachPx, pionBachPx, float); //! Bachelor Pion Px DECLARE_SOA_COLUMN(PionBachPy, pionBachPy, float); //! Bachelor Pion Py DECLARE_SOA_COLUMN(PionBachPz, pionBachPz, float); //! Bachelor Pion Pz -DECLARE_SOA_COLUMN(PionBachSign, pionBachSign, int); //! Bachelor Pion Sign DECLARE_SOA_COLUMN(PionBachTPC, pionBachTPC, float); //! Bachelor Pion nsigmatpc DECLARE_SOA_COLUMN(PionBachTOFHit, pionBachTOFHit, int); //! Bachelor Pion tof hit availability DECLARE_SOA_COLUMN(PionBachTOF, pionBachTOF, float); //! Bachelor Pion nsigmatof @@ -71,7 +72,7 @@ DECLARE_SOA_COLUMN(PionBachIndex, pionBachIndex, int); //! Bachelor DECLARE_SOA_COLUMN(PionIndex1, pionIndex1, int); //! Daughter Pion index1 DECLARE_SOA_COLUMN(PionIndex2, pionIndex2, int); //! Daughter Pion index2 } // namespace kshortpionpair -DECLARE_SOA_TABLE(KShortpionPairs, "AOD", "KSHORTPIONPAIR", +DECLARE_SOA_TABLE(KShortTracks, "AOD", "KSHORTTRACK", o2::soa::Index<>, kshortpionpair::KShortpionEventId, kshortpionpair::V0Cospa, @@ -85,17 +86,23 @@ DECLARE_SOA_TABLE(KShortpionPairs, "AOD", "KSHORTPIONPAIR", kshortpionpair::KShortPy, kshortpionpair::KShortPz, kshortpionpair::KShortMass, + kshortpionpair::PionIndex1, + kshortpionpair::PionIndex2); + +using KShortTrack = KShortTracks::iterator; + +DECLARE_SOA_TABLE(PionTracks, "AOD", "PIONTRACK", + o2::soa::Index<>, + kshortpionpair::KShortpionEventId, kshortpionpair::PionBachPx, kshortpionpair::PionBachPy, kshortpionpair::PionBachPz, - kshortpionpair::PionBachSign, + // kshortpionpair::PionBachSign, kshortpionpair::PionBachTPC, kshortpionpair::PionBachTOFHit, kshortpionpair::PionBachTOF, - kshortpionpair::PionBachIndex, - kshortpionpair::PionIndex1, - kshortpionpair::PionIndex2); + kshortpionpair::PionBachIndex); -using KShortpionPair = KShortpionPairs::iterator; +using PionTrack = PionTracks::iterator; } // namespace o2::aod #endif // PWGLF_DATAMODEL_LFCKSSPINALIGNMENTTABLES_H_ diff --git a/PWGLF/TableProducer/Resonances/cksspinalignment.cxx b/PWGLF/TableProducer/Resonances/cksspinalignment.cxx index 91bb6662dbc..56fc938f43b 100644 --- a/PWGLF/TableProducer/Resonances/cksspinalignment.cxx +++ b/PWGLF/TableProducer/Resonances/cksspinalignment.cxx @@ -60,7 +60,8 @@ using namespace o2::aod::rctsel; struct cksspinalignment { Produces kshortpionEvent; - Produces kshortpionPair; + Produces kshortTrack; + Produces pionTrack; Service ccdb; @@ -279,14 +280,14 @@ struct cksspinalignment { std::vector v0Lifetime = {}; // std::vector armenteros = {}; std::vector pionBachelorIndex = {}; - std::vector pionBachelorSign = {}; + // std::vector pionBachelorSign = {}; std::vector pionBachelorTPC = {}; std::vector pionBachelorTOF = {}; std::vector pionBachelorTOFHit = {}; int numbV0 = 0; auto centrality = collision.centFT0C(); - // auto vz = collision.posZ(); + auto vz = collision.posZ(); int occupancy = collision.trackOccupancyInTimeRange(); auto psiFT0C = collision.psiFT0C(); auto psiFT0A = collision.psiFT0A(); @@ -318,6 +319,8 @@ struct cksspinalignment { auto track1ID = track1.globalIndex(); auto track1sign = track1.sign(); + if (track1sign == 0) + continue; auto track1nsigTPC = track1.tpcNSigmaPi(); auto track1nsigTOF = -999.9; auto track1TOFHit = -1; @@ -327,52 +330,57 @@ struct cksspinalignment { histos.fill(HIST("hTrkSelInfo"), 4.5); } pionbach = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), o2::constants::physics::MassPionCharged); - for (const auto& v0 : V0s) { - histos.fill(HIST("hV0Info"), 0.5); - auto [kshortTag, isValid] = getK0sTags(v0, collision); - if (kshortTag && isValid) { - histos.fill(HIST("hV0Info"), 1.5); - auto postrack1 = v0.template posTrack_as(); - auto negtrack1 = v0.template negTrack_as(); - positiveIndex.push_back(postrack1.globalIndex()); - negativeIndex.push_back(negtrack1.globalIndex()); - v0Cospa.push_back(v0.v0cosPA()); - v0Radius.push_back(v0.v0radius()); - dcaPositive.push_back(std::abs(v0.dcapostopv())); - dcaNegative.push_back(std::abs(v0.dcanegtopv())); - dcaBetweenDaughter.push_back(std::abs(v0.dcaV0daughters())); - v0Lifetime.push_back(v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * (o2::constants::physics::MassK0)); - // armenteros.push_back((v0.qtarm() / std::abs(v0.alpha()))); - - pion = ROOT::Math::PxPyPzMVector(v0.pxpos(), v0.pypos(), v0.pzpos(), o2::constants::physics::MassPionCharged); - antiPion = ROOT::Math::PxPyPzMVector(v0.pxneg(), v0.pyneg(), v0.pzneg(), o2::constants::physics::MassPionCharged); - kshort = pion + antiPion; - // chargedkstar = kshort + pionbach; - kshortMother.push_back(kshort); - // chargedkstarMother.push_back(chargedkstar); - pionBachelor.push_back(pionbach); - pionBachelorIndex.push_back(track1ID); - pionBachelorSign.push_back(track1sign); - pionBachelorTPC.push_back(track1nsigTPC); - pionBachelorTOF.push_back(track1nsigTOF); - pionBachelorTOFHit.push_back(track1TOFHit); - histos.fill(HIST("hKShortMass"), kshort.M()); - } - numbV0 = numbV0 + 1; + pionBachelor.push_back(pionbach); + pionBachelorIndex.push_back(track1ID); + // pionBachelorSign.push_back(track1sign); + pionBachelorTPC.push_back(track1nsigTPC); + pionBachelorTOF.push_back(track1nsigTOF); + pionBachelorTOFHit.push_back(track1TOFHit); + } + for (const auto& v0 : V0s) { + histos.fill(HIST("hV0Info"), 0.5); + auto [kshortTag, isValid] = getK0sTags(v0, collision); + if (kshortTag && isValid) { + histos.fill(HIST("hV0Info"), 1.5); + auto postrack1 = v0.template posTrack_as(); + auto negtrack1 = v0.template negTrack_as(); + positiveIndex.push_back(postrack1.globalIndex()); + negativeIndex.push_back(negtrack1.globalIndex()); + v0Cospa.push_back(v0.v0cosPA()); + v0Radius.push_back(v0.v0radius()); + dcaPositive.push_back(std::abs(v0.dcapostopv())); + dcaNegative.push_back(std::abs(v0.dcanegtopv())); + dcaBetweenDaughter.push_back(std::abs(v0.dcaV0daughters())); + v0Lifetime.push_back(v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * (o2::constants::physics::MassK0)); + // armenteros.push_back((v0.qtarm() / std::abs(v0.alpha()))); + + pion = ROOT::Math::PxPyPzMVector(v0.pxpos(), v0.pypos(), v0.pzpos(), o2::constants::physics::MassPionCharged); + antiPion = ROOT::Math::PxPyPzMVector(v0.pxneg(), v0.pyneg(), v0.pzneg(), o2::constants::physics::MassPionCharged); + kshort = pion + antiPion; + // chargedkstar = kshort + pionbach; + kshortMother.push_back(kshort); + // chargedkstarMother.push_back(chargedkstar); + histos.fill(HIST("hKShortMass"), kshort.M()); } + numbV0 = numbV0 + 1; } if (numbV0 > 1 && v0Cospa.size() > 1) { histos.fill(HIST("hEvtSelInfo"), 3.5); - kshortpionEvent(centrality, collision.index(), psiFT0C, psiFT0A, psiTPC); + kshortpionEvent(centrality, vz, collision.index(), psiFT0C, psiFT0A, psiTPC); auto indexEvent = kshortpionEvent.lastIndex(); //// Fill track table for Charged KStar////////////////// for (auto icks = kshortMother.begin(); icks != kshortMother.end(); ++icks) { auto iter = std::distance(kshortMother.begin(), icks); kshortDummy = kshortMother.at(iter); // chargedkstarDummy = chargedkstarMother.at(iter); - pionDummy = pionBachelor.at(iter); - kshortpionPair(indexEvent, v0Cospa.at(iter), v0Radius.at(iter), dcaPositive.at(iter), dcaNegative.at(iter), dcaBetweenDaughter.at(iter), v0Lifetime.at(iter), kshortDummy.Px(), kshortDummy.Py(), kshortDummy.Pz(), kshortDummy.M(), pionDummy.Px(), pionDummy.Py(), pionDummy.Pz(), pionBachelorSign.at(iter), pionBachelorTPC.at(iter), pionBachelorTOFHit.at(iter), pionBachelorTOF.at(iter), pionBachelorIndex.at(iter), positiveIndex.at(iter), negativeIndex.at(iter)); + kshortTrack(indexEvent, v0Cospa.at(iter), v0Radius.at(iter), dcaPositive.at(iter), dcaNegative.at(iter), dcaBetweenDaughter.at(iter), v0Lifetime.at(iter), kshortDummy.Px(), kshortDummy.Py(), kshortDummy.Pz(), kshortDummy.M(), positiveIndex.at(iter), negativeIndex.at(iter)); + } + for (auto ipi = pionBachelor.begin(); ipi != pionBachelor.end(); ++ipi) { + auto iterpi = std::distance(pionBachelor.begin(), ipi); + pionDummy = pionBachelor.at(iterpi); + + pionTrack(indexEvent, pionDummy.Px(), pionDummy.Py(), pionDummy.Pz(), pionBachelorTPC.at(iterpi), pionBachelorTOFHit.at(iterpi), pionBachelorTOF.at(iterpi), pionBachelorIndex.at(iterpi)); } } } diff --git a/PWGLF/Tasks/Resonances/CMakeLists.txt b/PWGLF/Tasks/Resonances/CMakeLists.txt index b2f78d88669..709643f75f4 100644 --- a/PWGLF/Tasks/Resonances/CMakeLists.txt +++ b/PWGLF/Tasks/Resonances/CMakeLists.txt @@ -19,6 +19,11 @@ o2physics_add_dpl_workflow(phianalysis PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(cksspinalignder + SOURCES cksspinalignder.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(k892analysis SOURCES k892analysis.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore diff --git a/PWGLF/Tasks/Resonances/cksspinalignder.cxx b/PWGLF/Tasks/Resonances/cksspinalignder.cxx new file mode 100644 index 00000000000..ae29ab6a6fc --- /dev/null +++ b/PWGLF/Tasks/Resonances/cksspinalignder.cxx @@ -0,0 +1,279 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file cksspinalignder.cxx +/// \brief Analysis task for ChargedKStar spin alignment +/// +/// \author prottay.das@cern.ch + +#include "PWGLF/DataModel/LFCKSSpinalignmentTables.h" + +#include "Common/Core/RecoDecay.h" +#include "Common/Core/trackUtilities.h" + +#include "CommonConstants/PhysicsConstants.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/BinningPolicy.h" +#include "Framework/StepTHn.h" +#include "Framework/runDataProcessing.h" +#include + +#include +#include +#include +#include + +#include + +#include // for std::fabs +#include +// #include +#include +#include // <<< CHANGED: for dedup sets +#include +#include +#include +#include // <<< CHANGED: for seenMap +#include +#include + +// o2 includes. +#include "CCDB/BasicCCDBManager.h" +#include "CCDB/CcdbApi.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::soa; + +struct cksspinalignder { + + struct : ConfigurableGroup { + Configurable cfgURL{"cfgURL", "http://alice-ccdb.cern.ch", "Address of the CCDB to browse"}; + Configurable ccdbNoLaterThan{"ccdbNoLaterThan", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "Latest acceptable timestamp of creation for the object"}; + } cfgCcdbParam; + + // event sel///////// + Configurable centMin{"centMin", 0, "Minimum Centrality"}; + Configurable centMax{"centMax", 80, "Maximum Centrality"}; + // V0 selection //////////// + Configurable cosPA{"cosPA", 0.995, "Cosine Pointing Angle"}; + Configurable radiusMin{"radiusMin", 1.2, "Minimum V0 radius"}; + Configurable radiusMax{"radiusMax", 100, "Maximum V0 radius"}; + Configurable dcaPion{"dcaPion", 0.1, "DCA Pion"}; + Configurable dcaDaughters{"dcaDaughters", 1.0, "DCA between daughters"}; + Configurable lifetimeMax{"lifetimeMax", 20, "Maximum V0 lifetime"}; + Configurable ptMin{"ptMin", 0.5, "V0 Pt minimum"}; + Configurable ptMax{"ptMax", 10.0, "V0 Pt maximum"}; + Configurable v0eta{"v0eta", 0.8, "Eta cut on lambda"}; + // pion sel///////// + Configurable nsigmaCutTPC{"nsigmaCutTPC", 3.0, "N sigma TPC cut for bachelor pions"}; + Configurable nsigmaCutTOF{"nsigmaCutTOF", 3.0, "N sigma TOF cut for bachelor pions"}; + Configurable usePID{"usePID", false, "Flag for using PID selection"}; + + // Event Mixing + Configurable nEvtMixing{"nEvtMixing", 5, "Number of events to mix"}; + ConfigurableAxis cfgVtxBins{"cfgVtxBins", {10, -10, 10}, "Mixing bins - z-vertex"}; + ConfigurableAxis cfgMultBins{"cfgMultBins", {8, 0.0, 80}, "Mixing bins - centrality"}; + + // THnsparse bining + ConfigurableAxis configThnAxisInvMass{"configThnAxisInvMass", {50, 1.09, 1.14}, "#it{M} (GeV/#it{c}^{2})"}; + ConfigurableAxis configThnAxisPt{"configThnAxisPt", {100, 0.0, 10.0}, "#it{p}_{T}"}; + ConfigurableAxis configThnAxisSA{"configThnAxisSA", {20, -1.0, 1.0}, "cos#it{#theta *}"}; + ConfigurableAxis configThnAxisCentrality{"configThnAxisCentrality", {8, 0.0, 80.0}, "Centrality"}; + + // Enable access to the CCDB for the offset and correction constants and save them in dedicated variables. + Service ccdb; + o2::ccdb::CcdbApi ccdbApi; + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + void init(o2::framework::InitContext&) + { + + histos.add("hCentrality", "Centrality distribution", kTH1F, {{80, 0, 80}}); + histos.add("hKShortMass", "hKShortMass", kTH1F, {{100, 0.45, 0.55}}); + + histos.add("hSparsesame", "hSparsesame", kTHnSparseF, {configThnAxisInvMass, configThnAxisPt, configThnAxisSA, configThnAxisCentrality}); + histos.add("hSparsemix", "hSparsemix", kTHnSparseF, {configThnAxisInvMass, configThnAxisPt, configThnAxisSA, configThnAxisCentrality}); + + ccdb->setURL(cfgCcdbParam.cfgURL); + ccdbApi.init("http://alice-ccdb.cern.ch"); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); + } + + template + bool selectionV0(T const& candidate) + { + auto kshortPt = std::sqrt(candidate.kShortPx() * candidate.kShortPx() + candidate.kShortPy() * candidate.kShortPy()); + auto px = candidate.kShortPx(); + auto py = candidate.kShortPy(); + auto pz = candidate.kShortPz(); + auto p = std::sqrt(px * px + py * py + pz * pz); + auto kshortEta = 0.5 * std::log((p + pz) / (p - pz)); + + if (std::abs(kshortEta) > v0eta) { + return false; + } + if (candidate.v0Cospa() < cosPA) { + return false; + } + if (candidate.v0Radius() > radiusMax) { + return false; + } + if (candidate.v0Radius() < radiusMin) { + return false; + } + if (candidate.dcaBetweenDaughter() > dcaDaughters) { + return false; + } + if (std::abs(candidate.dcaPositive()) < dcaPion && std::abs(candidate.dcaNegative()) < dcaPion) { + return false; + } + if (candidate.v0Lifetime() > lifetimeMax) { + return false; + } + if (kshortPt < ptMin) { + return false; + } + if (kshortPt > ptMax) { + return false; + } + return true; + } + + template + bool selectionPID(const T& candidate) + { + auto px = candidate.pionBachPx(); + auto py = candidate.pionBachPy(); + auto pz = candidate.pionBachPz(); + auto p = std::sqrt(px * px + py * py + pz * pz); + float lowmom = 0.5; + if (p < lowmom) { + if (!candidate.pionBachTOFHit() && std::abs(candidate.pionBachTPC()) < nsigmaCutTPC) { + return true; + } else if (candidate.pionBachTOFHit() && std::sqrt(candidate.pionBachTPC() * candidate.pionBachTPC() + candidate.pionBachTOF() * candidate.pionBachTOF()) < nsigmaCutTOF) { + return true; + } + } else if (candidate.pionBachTOFHit() && std::sqrt(candidate.pionBachTPC() * candidate.pionBachTPC() + candidate.pionBachTOF() * candidate.pionBachTOF()) < nsigmaCutTOF) { + return true; + } + return false; + } + + std::tuple computePtEtaPhi(float px, float py, float pz) + { + float pt = std::sqrt(px * px + py * py); + float p = std::sqrt(px * px + py * py + pz * pz); + float eta = (p != std::abs(pz)) ? 0.5 * std::log((p + pz) / (p - pz)) : 0.0f; // avoid division by zero + float phi = RecoDecay::constrainAngle(std::atan2(py, px)); + return {pt, eta, phi}; + } + + ROOT::Math::PtEtaPhiMVector kshort, pion, chkstar; + ROOT::Math::PtEtaPhiMVector kshortmix, pionmix, chkstarmix; + ROOT::Math::PxPyPzMVector fourVecDauCM, fourVecDauCMmix; + ROOT::Math::XYZVector threeVecDauCM, eventplaneVecNorm, threeVecDauCMmix, eventplaneVecNormmix; + + Filter centralityFilter = (nabs(aod::kshortpionevent::cent) < centMax && nabs(aod::kshortpionevent::cent) > centMin); + + using EventCandidates = soa::Filtered; + + void processSameData(EventCandidates::iterator const& collision, aod::KShortTracks const& V0s, aod::PionTracks const& piontracks) + { + auto centrality = collision.cent(); + histos.fill(HIST("hCentrality"), centrality); + + auto psiFT0C = collision.psiFT0C(); + + for (const auto& v0 : V0s) { + if (!selectionV0(v0)) { + continue; + } + auto [kshortPt, kshortEta, kshortPhi] = computePtEtaPhi(v0.kShortPx(), v0.kShortPy(), v0.kShortPz()); + kshort = ROOT::Math::PtEtaPhiMVector(kshortPt, kshortEta, kshortPhi, v0.kShortMass()); + histos.fill(HIST("hKShortMass"), kshort.M()); + + for (const auto& piontrack : piontracks) { + auto [pionPt, pionEta, pionPhi] = computePtEtaPhi(piontrack.pionBachPx(), piontrack.pionBachPy(), piontrack.pionBachPz()); + pion = ROOT::Math::PtEtaPhiMVector(pionPt, pionEta, pionPhi, o2::constants::physics::MassPionCharged); + + if (piontrack.pionBachIndex() == v0.pionIndex1() || piontrack.pionBachIndex() == v0.pionIndex2()) + continue; // checking if bachelor pion is khort daughter or not -> skip further processing if such is the case + + if (usePID && !selectionPID(piontrack)) + continue; // checking PID + + chkstar = kshort + pion; + + ROOT::Math::Boost boost{chkstar.BoostToCM()}; + fourVecDauCM = boost(kshort); + threeVecDauCM = fourVecDauCM.Vect(); + eventplaneVecNorm = ROOT::Math::XYZVector(std::sin(2.0 * psiFT0C), -std::cos(2.0 * psiFT0C), 0); + auto cosThetaStar = eventplaneVecNorm.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(eventplaneVecNorm.Mag2()); + + histos.fill(HIST("hSparsesame"), chkstar.M(), chkstar.Pt(), cosThetaStar, centrality); + } + } + } + PROCESS_SWITCH(cksspinalignder, processSameData, "Process same data", true); + + // Processing Event Mixing + SliceCache cache; + using BinningType = ColumnBinningPolicy; + BinningType colBinning{{cfgVtxBins, cfgMultBins}, true}; + Preslice tracksPerCollisionV0 = aod::kshortpionpair::kshortpioneventId; + Preslice tracksPerCollisionBach = aod::kshortpionpair::kshortpioneventId; + + void processMixedData(EventCandidates const& collisions, aod::KShortTracks const& V0s, aod::PionTracks const& piontracks) + { + for (const auto& [collision1, collision2] : selfCombinations(colBinning, nEvtMixing, -1, collisions, collisions)) { + if (collision1.index() == collision2.index()) { + continue; + } + auto centrality = collision1.cent(); + auto psiFT0Cmix = collision1.psiFT0C(); + + auto groupV0 = V0s.sliceBy(tracksPerCollisionV0, collision1.index()); + auto groupPion = piontracks.sliceBy(tracksPerCollisionBach, collision2.index()); + for (const auto& [t1, t2] : soa::combinations(o2::soa::CombinationsFullIndexPolicy(groupV0, groupPion))) { + if (!selectionV0(t1)) + continue; + auto [kshortPtmix, kshortEtamix, kshortPhimix] = computePtEtaPhi(t1.kShortPx(), t1.kShortPy(), t1.kShortPz()); + kshortmix = ROOT::Math::PtEtaPhiMVector(kshortPtmix, kshortEtamix, kshortPhimix, t1.kShortMass()); + + auto [pionPtmix, pionEtamix, pionPhimix] = computePtEtaPhi(t2.pionBachPx(), t2.pionBachPy(), t2.pionBachPz()); + if (usePID && !selectionPID(t2)) + continue; // checking PID + pionmix = ROOT::Math::PtEtaPhiMVector(pionPtmix, pionEtamix, pionPhimix, o2::constants::physics::MassPionCharged); + + chkstarmix = kshortmix + pionmix; + + ROOT::Math::Boost boost{chkstarmix.BoostToCM()}; + fourVecDauCMmix = boost(kshortmix); + threeVecDauCMmix = fourVecDauCMmix.Vect(); + eventplaneVecNormmix = ROOT::Math::XYZVector(std::sin(2.0 * psiFT0Cmix), -std::cos(2.0 * psiFT0Cmix), 0); + auto cosThetaStarmix = eventplaneVecNormmix.Dot(threeVecDauCMmix) / std::sqrt(threeVecDauCMmix.Mag2()) / std::sqrt(eventplaneVecNormmix.Mag2()); + + histos.fill(HIST("hSparsemix"), chkstarmix.M(), chkstarmix.Pt(), cosThetaStarmix, centrality); + } + } + } + PROCESS_SWITCH(cksspinalignder, processMixedData, "Process mixed data", true); +}; +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} From 59de47076d1673bc505a9516ee54e5cf100f1e57 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Thu, 7 Aug 2025 07:30:33 +0200 Subject: [PATCH 273/345] [Common] Autodetect MC for centrality in light ions (#12458) --- Common/Tools/MultModule.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Common/Tools/MultModule.h b/Common/Tools/MultModule.h index 017c1d70de3..479c777b5e6 100644 --- a/Common/Tools/MultModule.h +++ b/Common/Tools/MultModule.h @@ -505,6 +505,11 @@ class MultModule internalOpts.generatorName.value = "PYTHIA"; } + // capture the need for PYTHIA calibration in light ion runs automatically + if (metadataInfo.isMC() && mRunNumber >= 564250 && mRunNumber <= 564472) { + internalOpts.generatorName.value = "PYTHIA"; + } + // list enabled tables for (int i = 0; i < nTablesConst; i++) { // printout to be improved in the future From 979b2c362de5a90bea85135d8b975314e1f5fcc8 Mon Sep 17 00:00:00 2001 From: Rashi gupta <167059733+rashigupt@users.noreply.github.com> Date: Thu, 7 Aug 2025 12:19:30 +0530 Subject: [PATCH 274/345] [PWGHF] Used DeltaEta and DeltaPhi from EMCalMatchedTracks Table for Track-Cluster Matching (#12369) --- PWGHF/HFC/TableProducer/correlatorHfeHadrons.cxx | 14 ++++++++------ .../electronSelectionWithTpcEmcal.cxx | 4 ++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/PWGHF/HFC/TableProducer/correlatorHfeHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorHfeHadrons.cxx index 30989581962..3469c1fad69 100644 --- a/PWGHF/HFC/TableProducer/correlatorHfeHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorHfeHadrons.cxx @@ -152,12 +152,17 @@ struct HfCorrelatorHfeHadrons { int gCollisionId = collision.globalIndex(); int64_t timeStamp = bc.timestamp(); + // Add hadron Table For Mix Event Electron Hadron correlation + for (const auto& hTrack : tracks) { + registry.fill(HIST("hTracksBin"), poolBin); + entryHadron(hTrack.phi(), hTrack.eta(), hTrack.pt(), poolBin, gCollisionId, timeStamp); + } + // Construct Deta Phi between electrons and hadrons double ptElectron = -999; double phiElectron = -999; double etaElectron = -999; - int nElectron = 0; for (const auto& eTrack : electron) { ptElectron = eTrack.ptTrack(); @@ -209,10 +214,7 @@ struct HfCorrelatorHfeHadrons { if (ptCondition && (ptElectron < ptHadron)) { continue; } - if (nElectron == 0) { - registry.fill(HIST("hTracksBin"), poolBin); - entryHadron(phiHadron, etaHadron, ptHadron, poolBin, gCollisionId, timeStamp); - } + deltaPhi = RecoDecay::constrainAngle(phiElectron - phiHadron, -o2::constants::math::PIHalf); deltaEta = etaElectron - etaHadron; registry.fill(HIST("hInclusiveEHCorrel"), ptElectron, ptHadron, deltaPhi, deltaEta); @@ -236,7 +238,7 @@ struct HfCorrelatorHfeHadrons { entryElectronHadronPair(deltaPhi, deltaEta, ptElectron, ptHadron, poolBin, nElHadLSCorr, nElHadUSCorr); } // end Hadron Track loop - nElectron++; + } // end Electron loop } diff --git a/PWGHF/HFL/TableProducer/electronSelectionWithTpcEmcal.cxx b/PWGHF/HFL/TableProducer/electronSelectionWithTpcEmcal.cxx index 94bad334ce4..7dac8c0a83d 100644 --- a/PWGHF/HFL/TableProducer/electronSelectionWithTpcEmcal.cxx +++ b/PWGHF/HFL/TableProducer/electronSelectionWithTpcEmcal.cxx @@ -468,8 +468,8 @@ struct HfElectronSelectionWithTpcEmcal { timeEmcCluster = emcCluster.time(); cellEmcCluster = emcCluster.nCells(); - deltaPhiMatch = matchTrack.trackPhiEmcal() - phiMatchEmcCluster; - deltaEtaMatch = matchTrack.trackEtaEmcal() - etaMatchEmcCluster; + deltaPhiMatch = ematchTrack.deltaPhi(); + deltaEtaMatch = ematchTrack.deltaEta(); // Track and EMCal cluster Matching if (std::abs(timeEmcCluster) > timeEmcClusterMax) { From 3caa3c59d6f7e11d654f3c263f6b2eec69820434 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?BiaoZhang=20=28=E5=BC=A0=E5=BD=AA=29?= <52267892+zhangbiao-phy@users.noreply.github.com> Date: Thu, 7 Aug 2025 11:18:25 +0200 Subject: [PATCH 275/345] [PWGHF,PWGCF] Filling the candidate and track table before pairing and add option for deuteron (#12459) Co-authored-by: ALICE Action Bot --- PWGCF/DataModel/FemtoDerived.h | 26 ++- .../HFC/TableProducer/femtoDreamProducer.cxx | 2 +- .../HFC/Tasks/taskCharmHadronsFemtoDream.cxx | 157 +++++++++++++----- 3 files changed, 143 insertions(+), 42 deletions(-) diff --git a/PWGCF/DataModel/FemtoDerived.h b/PWGCF/DataModel/FemtoDerived.h index 7475a70a5a5..855b7d30bf2 100644 --- a/PWGCF/DataModel/FemtoDerived.h +++ b/PWGCF/DataModel/FemtoDerived.h @@ -313,6 +313,24 @@ DECLARE_SOA_TABLE(FDHfCand, "AOD", "FDHFCAND", //! Table to store the derived da fdhf::Phi, fdhf::Pt); +DECLARE_SOA_TABLE(FDHfPairs, "AOD", "FDHFPAIRS", //! table to store results for HF femtoscopy + fdhf::CharmM, + fdhf::CharmPt, + fdhf::TrkPt, + fdhf::BDTBkg, + fdhf::BDTPrompt, + fdhf::BDTFD, + fdhf::Kstar, + fdhf::KT, + fdhf::MT, + fdhf::Mult, + fdhf::MultPercentile, + fdhf::Charge, + fdhf::PairSign, + fdhf::ProcessType, + fdhf::FlagMc, + fdhf::OriginMcRec); + DECLARE_SOA_TABLE(FDHfCharm, "AOD", "FDHFCHARM", //! table to store results for HF femtoscopy fdhf::GIndexCol, fdhf::TimeStamp, @@ -320,12 +338,13 @@ DECLARE_SOA_TABLE(FDHfCharm, "AOD", "FDHFCHARM", //! table to store results for fdhf::CharmPt, fdhf::CharmEta, fdhf::CharmPhi, + fdhf::Prong0Id, + fdhf::Prong1Id, + fdhf::Prong2Id, fdhf::Charge, fdhf::BDTBkg, fdhf::BDTPrompt, - fdhf::BDTFD, - fdhf::FlagMc, - fdhf::OriginMcRec); + fdhf::BDTFD); DECLARE_SOA_TABLE(FDHfTrk, "AOD", "FDHFTRK", //! table to store results for HF femtoscopy fdhf::GIndexCol, @@ -333,6 +352,7 @@ DECLARE_SOA_TABLE(FDHfTrk, "AOD", "FDHFTRK", //! table to store results for HF f fdhf::TrkPt, fdhf::TrkEta, fdhf::TrkPhi, + fdhf::TrackId, femtodreamparticle::Sign, femtodreamparticle::TPCNClsFound, track::TPCNClsFindable, diff --git a/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx b/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx index 5502b7e302f..2a6fad8c841 100644 --- a/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx +++ b/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx @@ -135,7 +135,7 @@ struct HfFemtoDreamProducer { Configurable> trkDCAxyMax{FemtoDreamTrackSelection::getSelectionName(femtoDreamTrackSelection::kDCAxyMax, "trk"), std::vector{0.1f, 3.5f}, FemtoDreamTrackSelection::getSelectionHelper(femtoDreamTrackSelection::kDCAxyMax, "Track selection: ")}; Configurable> trkDCAzMax{FemtoDreamTrackSelection::getSelectionName(femtoDreamTrackSelection::kDCAzMax, "trk"), std::vector{0.2f, 3.5f}, FemtoDreamTrackSelection::getSelectionHelper(femtoDreamTrackSelection::kDCAzMax, "Track selection: ")}; Configurable> trkEta{FemtoDreamTrackSelection::getSelectionName(femtoDreamTrackSelection::kEtaMax, "trk"), std::vector{0.8f, 0.7f, 0.9f}, FemtoDreamTrackSelection::getSelectionHelper(femtoDreamTrackSelection::kEtaMax, "Track selection: ")}; - Configurable> trkPIDspecies{"trkPIDspecies", std::vector{o2::track::PID::Pion, o2::track::PID::Kaon, o2::track::PID::Proton}, "Trk sel: Particles species for PID"}; + Configurable> trkPIDspecies{"trkPIDspecies", std::vector{o2::track::PID::Pion, o2::track::PID::Kaon, o2::track::PID::Proton, o2::track::PID::Deuteron}, "Trk sel: Particles species for PID"}; Configurable> trkPIDnSigmaMax{FemtoDreamTrackSelection::getSelectionName(femtoDreamTrackSelection::kPIDnSigmaMax, "trk"), std::vector{3.5f, 3.f, 2.5f}, FemtoDreamTrackSelection::getSelectionHelper(femtoDreamTrackSelection::kPIDnSigmaMax, "Track selection: ")}; Configurable trkPIDnSigmaOffsetTPC{"trkPIDnSigmaOffsetTPC", 0., "Offset for TPC nSigma because of bad calibration"}; Configurable trkPIDnSigmaOffsetTOF{"trkPIDnSigmaOffsetTOF", 0., "Offset for TOF nSigma because of bad calibration"}; diff --git a/PWGHF/HFC/Tasks/taskCharmHadronsFemtoDream.cxx b/PWGHF/HFC/Tasks/taskCharmHadronsFemtoDream.cxx index 3644cd3ed3c..f024e276a9a 100644 --- a/PWGHF/HFC/Tasks/taskCharmHadronsFemtoDream.cxx +++ b/PWGHF/HFC/Tasks/taskCharmHadronsFemtoDream.cxx @@ -65,9 +65,17 @@ struct HfTaskCharmHadronsFemtoDream { NegativeCharge = -1 }; + enum PairSign { + PairNotDefined = 0, + LikeSignPair = 1, + UnLikeSignPair = 2 + }; + constexpr static int OriginRecPrompt = 1; constexpr static int OriginRecFD = 2; + constexpr static int CutBitChargePositive = 2; + Produces rowFemtoResultPairs; Produces rowFemtoResultCharm; Produces rowFemtoResultTrk; Produces rowFemtoResultColl; @@ -131,7 +139,7 @@ struct HfTaskCharmHadronsFemtoDream { using FilteredCharmMcCands = soa::Filtered>; using FilteredCharmMcCand = FilteredCharmMcCands::iterator; - using FilteredColisions = soa::Filtered>; + using FilteredColisions = soa::Filtered>; using FilteredColision = FilteredColisions::iterator; using FilteredMcColisions = soa::Filtered>; @@ -294,7 +302,7 @@ struct HfTaskCharmHadronsFemtoDream { void doSameEvent(PartitionType& sliceTrk1, CandType& sliceCharmHad, TableTracks const& parts, Collision const& col) { fillCollision(col); - + processType = 1; // for same event for (auto const& [p1, p2] : combinations(CombinationsFullIndexPolicy(sliceTrk1, sliceCharmHad))) { if (p1.trackId() == p2.prong0Id() || p1.trackId() == p2.prong1Id() || p1.trackId() == p2.prong2Id()) @@ -310,15 +318,6 @@ struct HfTaskCharmHadronsFemtoDream { continue; } - constexpr int CutBitChargePositive = 2; - // proton track charge - float chargeTrack = 0.; - if ((p1.cut() & CutBitChargePositive) == CutBitChargePositive) { - chargeTrack = PositiveCharge; - } else { - chargeTrack = NegativeCharge; - } - float kstar = FemtoDreamMath::getkstar(p1, massOne, p2, massTwo); if (kstar > highkstarCut) { continue; @@ -333,6 +332,21 @@ struct HfTaskCharmHadronsFemtoDream { if (p2.pt() < charmHadMinPt || p2.pt() > charmHadMaxPt) { continue; } + + // proton track charge + float chargeTrack = 0.; + if ((p1.cut() & CutBitChargePositive) == CutBitChargePositive) { + chargeTrack = PositiveCharge; + } else { + chargeTrack = NegativeCharge; + } + int pairSign = 0; + if (chargeTrack == p2.charge()) { + pairSign = LikeSignPair; + } else { + pairSign = UnLikeSignPair; + } + /// Filling QA histograms of the selected tracks selectedTrackHisto.fillQA(p1, static_cast(confTempFitVarMomentum.value), col.multNtr(), col.multV0M()); @@ -343,39 +357,24 @@ struct HfTaskCharmHadronsFemtoDream { originType = p2.originMcRec(); } - rowFemtoResultCharm( - col.globalIndex(), - p2.timeStamp(), + rowFemtoResultPairs( invMass, p2.pt(), - p2.eta(), - p2.phi(), - p2.charge(), + p1.pt(), p2.bdtBkg(), p2.bdtPrompt(), p2.bdtFD(), + kstar, + FemtoDreamMath::getkT(p1, massOne, p2, massTwo), + FemtoDreamMath::getmT(p1, massOne, p2, massTwo), + col.multNtr(), + col.multV0M(), + p2.charge(), + pairSign, + processType, charmHadMc, originType); - rowFemtoResultTrk( - col.globalIndex(), - p2.timeStamp(), - p1.pt(), - p1.eta(), - p1.phi(), - chargeTrack, - p1.tpcNClsFound(), - p1.tpcNClsFindable(), - p1.tpcNClsCrossedRows(), - p1.tpcNSigmaPr(), - p1.tofNSigmaPr()); - - rowFemtoResultColl( - col.globalIndex(), - p2.timeStamp(), - col.posZ(), - col.multNtr()); - sameEventCont.setPair(p1, p2, col.multNtr(), col.multV0M(), use4D, extendedPlots, smearingByOrigin); } } @@ -383,7 +382,7 @@ struct HfTaskCharmHadronsFemtoDream { template void doMixedEvent(CollisionType const& cols, PartType const& parts, PartitionType1& part1, PartitionType2& part2, BinningType policy) { - + processType = 2; // for mixed event // Mixed events that contain the pair of interest Partition partitionMaskedCol1 = (aod::femtodreamcollision::bitmaskTrackOne & bitMask) == bitMask; partitionMaskedCol1.bindTable(cols); @@ -427,8 +426,45 @@ struct HfTaskCharmHadronsFemtoDream { if (p2.pt() < charmHadMinPt || p2.pt() > charmHadMaxPt) { continue; } + // proton track charge + float chargeTrack = 0.; + if ((p1.cut() & CutBitChargePositive) == CutBitChargePositive) { + chargeTrack = PositiveCharge; + } else { + chargeTrack = NegativeCharge; + } + int pairSign = 0; + if (chargeTrack == p2.charge()) { + pairSign = LikeSignPair; + } else { + pairSign = UnLikeSignPair; + } + + int charmHadMc = 0; + int originType = 0; + if constexpr (isMc) { + charmHadMc = p2.flagMc(); + originType = p2.originMcRec(); + } + + rowFemtoResultPairs( + invMass, + p2.pt(), + p1.pt(), + p2.bdtBkg(), + p2.bdtPrompt(), + p2.bdtFD(), + kstar, + FemtoDreamMath::getkT(p1, massOne, p2, massTwo), + FemtoDreamMath::getmT(p1, massOne, p2, massTwo), + collision1.multNtr(), + collision1.multV0M(), + p2.charge(), + pairSign, + processType, + charmHadMc, + originType); - // if constexpr (!isMc) mixedEventCont.setPair(p1, p2, collision1.multNtr(), collision1.multV0M(), use4D, extendedPlots, smearingByOrigin); mixedEventCont.setPair(p1, p2, collision1.multNtr(), collision1.multV0M(), use4D, extendedPlots, smearingByOrigin); } } @@ -441,15 +477,60 @@ struct HfTaskCharmHadronsFemtoDream { eventHisto.fillQA(col); auto sliceTrk1 = partitionTrk1->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); auto sliceCharmHad = partitionCharmHadron->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); + auto bc = col.template bc_as(); + int64_t timeStamp = bc.timestamp(); + /// Filling QA histograms of the all tracks and all charm hadrons before pairing for (auto const& part : sliceTrk1) { allTrackHisto.fillQA(part, static_cast(confTempFitVarMomentum.value), col.multNtr(), col.multV0M()); + + // proton track charge + float chargeTrack = 0.; + if ((part.cut() & CutBitChargePositive) == CutBitChargePositive) { + chargeTrack = PositiveCharge; + } else { + chargeTrack = NegativeCharge; + } + + rowFemtoResultTrk( + col.globalIndex(), + timeStamp, + part.pt(), + part.eta(), + part.phi(), + part.trackId(), + chargeTrack, + part.tpcNClsFound(), + part.tpcNClsFindable(), + part.tpcNClsCrossedRows(), + part.tpcNSigmaPr(), + part.tofNSigmaPr()); } for (auto const& part : sliceCharmHad) { float invMass = getCharmHadronMass(part); registryCharmHadronQa.fill(HIST("CharmHadronQA/hPtVsMass"), part.pt(), invMass); + rowFemtoResultCharm( + col.globalIndex(), + timeStamp, + invMass, + part.pt(), + part.eta(), + part.phi(), + part.prong0Id(), + part.prong1Id(), + part.prong2Id(), + part.charge(), + part.bdtBkg(), + part.bdtPrompt(), + part.bdtFD()); } + rowFemtoResultColl( + col.globalIndex(), + timeStamp, + col.posZ(), + col.multNtr()); + if ((col.bitmaskTrackOne() & bitMask) != bitMask || (col.bitmaskTrackTwo() & bitMask) != bitMask) { return; } From ea02f76ad20ab59fbf6e41211ade11740c9da1f1 Mon Sep 17 00:00:00 2001 From: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Date: Thu, 7 Aug 2025 12:52:19 +0200 Subject: [PATCH 276/345] [PWGLF] Fix histogram axis names + add different encoding options (#12409) Co-authored-by: ALICE Action Bot --- .../strangenessderivedbinnedinfo.cxx | 56 +++++++++++++++++-- 1 file changed, 50 insertions(+), 6 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/strangenessderivedbinnedinfo.cxx b/PWGLF/Tasks/Strangeness/strangenessderivedbinnedinfo.cxx index a170b942d59..728d8c6675b 100644 --- a/PWGLF/Tasks/Strangeness/strangenessderivedbinnedinfo.cxx +++ b/PWGLF/Tasks/Strangeness/strangenessderivedbinnedinfo.cxx @@ -124,6 +124,17 @@ struct strangenessderivedbinnedinfo { Configurable maxIR{"maxIR", -1, "maximum IR collisions"}; } eventSelections; + static constexpr float defaultSqrtScalingParameters[1][4] = {{0.1, 0.1, 0, 128}}; + + // preselection options + struct : ConfigurableGroup { + std::string prefix = "encodingOpts"; + Configurable useSqrtEncodingForOccupancy{"useSqrtEncodingForOccupancy", false, "Store sqrt(occupancy) instead of occupancy"}; + Configurable useSqrtEncodingForRadius{"useSqrtEncodingForRadius", false, "Store sqrt(radius) instead of radius"}; + Configurable useSqrtScalingForEncodingPt{"useSqrtScalingForEncodingPt", false, "Store sqrt scaling(pT) instead of pT"}; + Configurable> sqrtScalingParameters{"sqrtScalingParameters", {defaultSqrtScalingParameters[0], 4, {"sigma0", "sigma1", "clampMin", "clampMax"}}, "Sqrt scaling parameters"}; + } encodingOpts; + struct : ConfigurableGroup { Configurable v0TypeSelection{"v0Selections.v0TypeSelection", 1, "select on a certain V0 type (leave negative if no selection desired)"}; @@ -246,6 +257,22 @@ struct strangenessderivedbinnedinfo { // PDG database Service pdgDB; + // Sqrt scaling function + // Author: Marian Ivanov + int codeSqrtScaling(float val, float sigma0, float sigma1, int clampMin, int clampMax) + { + float code_f = std::asinh((sigma1 * val) / sigma0) / sigma0; + return std::clamp(static_cast(std::round(code_f)), clampMin, clampMax); + } + + // Function to decode the sqrt scaling + // Author: Marian Ivanov + float decodeSqrtScaling(int code, float sigma0, float sigma1) + { + float code_f = static_cast(code); + return (sigma0 / sigma1) * std::sinh(sigma0 * code_f); + } + void init(InitContext const&) { if (analyseK0Short + analyseLambda + analyseAntiLambda + analyseXi + analyseOmega > 1) { @@ -287,7 +314,16 @@ struct strangenessderivedbinnedinfo { histos.add("hEventCentrality", "hEventCentrality", kTH1F, {{100, 0.0f, +100.0f}}); histos.add("hEventOccupancy", "hEventOccupancy", kTH1F, {axisOccupancy}); - histos.add("h9dCentOccQoverPtMassRadiusPhiEtaPtArmV0AlphaV0", "h9dCentOccQoverPtMassRadiusPhiEtaPtArmV0AlphaV0", kTHnSparseF, {axisCentrality, axisOccupancy, axisPt, axisMass, axisRadius, axisPhi, axisEta, axisPtArmV0, axisAlphaV0}); + histos.add("h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc", "h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc", kTHnSparseF, {axisMass, axisPt, axisPhi, axisEta, axisPtArmV0, axisAlphaV0, axisRadius, axisCentrality, axisOccupancy}); + histos.get(HIST("h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc"))->GetAxis(0)->SetName("Mass"); + histos.get(HIST("h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc"))->GetAxis(1)->SetName("Pt"); + histos.get(HIST("h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc"))->GetAxis(2)->SetName("Phi"); + histos.get(HIST("h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc"))->GetAxis(3)->SetName("Eta"); + histos.get(HIST("h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc"))->GetAxis(4)->SetName("V0PtArm"); + histos.get(HIST("h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc"))->GetAxis(5)->SetName("V0Alpha"); + histos.get(HIST("h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc"))->GetAxis(6)->SetName("Radius"); + histos.get(HIST("h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc"))->GetAxis(7)->SetName("Centrality"); + histos.get(HIST("h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc"))->GetAxis(8)->SetName("Occupancy"); if (cfgSkimmedProcessing) { zorroSummary.setObject(zorro.getZorroSummary()); @@ -472,6 +508,8 @@ struct strangenessderivedbinnedinfo { } else { centrality = collision.centFT0C(); occupancy = eventSelections.useFT0CbasedOccupancy ? collision.ft0cOccupancyInTimeRange() : collision.trackOccupancyInTimeRange(); + if (encodingOpts.useSqrtEncodingForOccupancy) + occupancy = std::sqrt(occupancy); } histos.fill(HIST("hEventCentrality"), centrality); histos.fill(HIST("hEventOccupancy"), occupancy); @@ -763,14 +801,17 @@ struct strangenessderivedbinnedinfo { if (v0.v0Type() != v0Selections.v0TypeSelection && v0Selections.v0TypeSelection > -1) continue; // skip V0s that are not standard + float pT = encodingOpts.useSqrtScalingForEncodingPt ? codeSqrtScaling(v0.pt(), encodingOpts.sqrtScalingParameters->get("sigma0"), encodingOpts.sqrtScalingParameters->get("sigma1"), encodingOpts.sqrtScalingParameters->get("clampMin"), encodingOpts.sqrtScalingParameters->get("clampMax")) : v0.pt(); + float decayRadius = encodingOpts.useSqrtEncodingForRadius ? std::sqrt(v0.v0radius()) : v0.v0radius(); + if (analyseK0Short && isV0Selected(v0, collision, v0.yK0Short())) { - histos.fill(HIST("h9dCentOccQoverPtMassRadiusPhiEtaPtArmV0AlphaV0"), centrality, occupancy, v0.pt(), v0.mK0Short(), v0.v0radius(), v0.phi(), v0.eta(), v0.qtarm(), v0.alpha()); + histos.fill(HIST("h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc"), v0.mK0Short(), pT, v0.phi(), v0.eta(), v0.qtarm(), v0.alpha(), decayRadius, centrality, occupancy); } if (analyseLambda && isV0Selected(v0, collision, v0.yLambda())) { - histos.fill(HIST("h9dCentOccQoverPtMassRadiusPhiEtaPtArmV0AlphaV0"), centrality, occupancy, v0.pt(), v0.mLambda(), v0.v0radius(), v0.phi(), v0.eta(), v0.qtarm(), v0.alpha()); + histos.fill(HIST("h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc"), v0.mLambda(), pT, v0.phi(), v0.eta(), v0.qtarm(), v0.alpha(), decayRadius, centrality, occupancy); } if (analyseAntiLambda && isV0Selected(v0, collision, v0.yLambda())) { - histos.fill(HIST("h9dCentOccQoverPtMassRadiusPhiEtaPtArmV0AlphaV0"), centrality, occupancy, v0.pt(), v0.mAntiLambda(), v0.v0radius(), v0.phi(), v0.eta(), v0.qtarm(), v0.alpha()); + histos.fill(HIST("h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc"), v0.mAntiLambda(), pT, v0.phi(), v0.eta(), v0.qtarm(), v0.alpha(), decayRadius, centrality, occupancy); } } // end v0 loop } @@ -782,11 +823,14 @@ struct strangenessderivedbinnedinfo { std::abs(cascade.bacheloreta()) > cascSelections.daughterEtaCut) continue; // remove acceptance that's badly reproduced by MC / superfluous in future + float pT = encodingOpts.useSqrtScalingForEncodingPt ? codeSqrtScaling(cascade.pt(), encodingOpts.sqrtScalingParameters->get("sigma0"), encodingOpts.sqrtScalingParameters->get("sigma1"), encodingOpts.sqrtScalingParameters->get("clampMin"), encodingOpts.sqrtScalingParameters->get("clampMax")) : cascade.pt(); + float decayRadius = encodingOpts.useSqrtEncodingForRadius ? std::sqrt(cascade.cascradius()) : cascade.cascradius(); + if (analyseXi && isCascadeSelected(cascade, collision, cascade.yXi())) { - histos.fill(HIST("h9dCentOccQoverPtMassRadiusPhiEtaPtArmV0AlphaV0"), centrality, occupancy, cascade.pt(), cascade.m(1), cascade.cascradius(), cascade.phi(), cascade.eta(), 0., 0.); + histos.fill(HIST("h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc"), cascade.m(1), pT, cascade.phi(), cascade.eta(), 0., 0., decayRadius, centrality, occupancy); } if (analyseOmega && isCascadeSelected(cascade, collision, cascade.yOmega())) { - histos.fill(HIST("h9dCentOccQoverPtMassRadiusPhiEtaPtArmV0AlphaV0"), centrality, occupancy, cascade.pt(), cascade.m(2), cascade.cascradius(), cascade.phi(), cascade.eta(), 0., 0.); + histos.fill(HIST("h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc"), cascade.m(2), pT, cascade.phi(), cascade.eta(), 0., 0., decayRadius, centrality, occupancy); } } // end cascade loop } From c18c10ccbadc8f055271cb2e6411e65e5fe6db77 Mon Sep 17 00:00:00 2001 From: Deependra Sharma <38365215+deependra170598@users.noreply.github.com> Date: Thu, 7 Aug 2025 16:31:35 +0530 Subject: [PATCH 277/345] [PWGHF/D2H] Add weight method to achieve centrality at generator level (#12107) --- PWGHF/D2H/Tasks/taskDstarToD0Pi.cxx | 547 +++++++++++++++++++--------- 1 file changed, 369 insertions(+), 178 deletions(-) diff --git a/PWGHF/D2H/Tasks/taskDstarToD0Pi.cxx b/PWGHF/D2H/Tasks/taskDstarToD0Pi.cxx index 3175b472a0c..801e25e3460 100644 --- a/PWGHF/D2H/Tasks/taskDstarToD0Pi.cxx +++ b/PWGHF/D2H/Tasks/taskDstarToD0Pi.cxx @@ -25,6 +25,7 @@ #include "Common/Core/RecoDecay.h" #include "Common/DataModel/Centrality.h" +#include #include #include #include @@ -40,6 +41,8 @@ #include #include +#include +#include #include #include @@ -52,12 +55,31 @@ using namespace o2::soa; /// Dstar analysis task struct HfTaskDstarToD0Pi { Configurable selectionFlagDstarToD0Pi{"selectionFlagDstarToD0Pi", true, "Selection Flag for D* decay to D0 & Pi"}; + Configurable isCentStudy{"isCentStudy", true, "Flag to select centrality study"}; + Configurable qaEnabled{"qaEnabled", true, "Flag to enable QA histograms"}; + + // CCDB configuration + Configurable useWeight{"useWeight", true, "Flag to use weights from CCDB"}; + Configurable nWeights{"nWeights", 6, "Number of weights to be used from CCDB"}; + Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable ccdbPathForWeight{"ccdbPathForWeight", "Users/d/desharma/weights", "CCDB path for PVContrib weights"}; + Configurable timestampCCDB{"timestampCCDB", -1, "CCDB timestamp for the weights"}; + Configurable weightFileName{"weightFileName", "Weights.root", "Name of the weight file to be used for PVContrib"}; + Configurable> centRangesForWeights{"centRangesForWeights", {0.0, 5.0, 10.0, 30.0, 50.0, 70.0, 100.0}, "Centrality ranges for weights. Size of ranges should be equal to nWeights + 1"}; + Configurable yCandDstarRecoMax{"yCandDstarRecoMax", 0.8, "max. candidate Dstar rapidity"}; Configurable yCandDstarGenMax{"yCandDstarGenMax", 0.5, "max. rapidity of Generator level Particle"}; Configurable selectionFlagHfD0ToPiK{"selectionFlagHfD0ToPiK", true, "Selection Flag for HF flagged candidates"}; Configurable> ptBins{"ptBins", std::vector{hf_cuts_dstar_to_d0_pi::vecBinsPt}, "pT bin limits for Dstar"}; + Configurable deltaMassMin{"deltaMassMin", 0.142, "Lower bound of the signal region for Delta Invariant MassDstar"}; + Configurable deltaMassMax{"deltaMassMax", 0.15, "Upper bound of the signal region for Delta Invariant MassDstar"}; + o2::ccdb::CcdbApi ccdbApi; SliceCache cache; + std::vector hWeights; + std::vector axesPtVsCentVsBDTVsPvContrib; + std::vector axesPtVsCentVsPvContrib; + std::vector axesPtVsBDT; using CandDstarWSelFlag = soa::Join; using CandDstarWSelFlagWMl = soa::Join; @@ -86,17 +108,9 @@ struct HfTaskDstarToD0Pi { ConfigurableAxis binningDeltaInvMass{"binningDeltaInvMass", {100, 0.13, 0.16}, "Bins of Delta InvMass of Dstar"}; ConfigurableAxis binningBkgBDTScore{"binningBkgBDTScore", {100, 0.0f, 1.0f}, "Bins for background BDT Score"}; ConfigurableAxis binningSigBDTScore{"binningSigBDTScore", {100, 0.0f, 1.0f}, "Bins for Signal (Prompts + Non Prompt) BDT Score"}; + ConfigurableAxis binningPvContrib{"binningPvContrib", {100, 0.0f, 300.0f}, "Bins for PVContrib"}; - HistogramRegistry registry{ - "registry", - {{"QA/hPtDstar", "Dstar Candidates; Dstar candidate #it{p}_{T} (GeV/#it{c}); entries", {HistType::kTH1F, {{360, 0., 36.}}}}, - {"QA/hPtD0", "D0 Candiades; D0 Candidate #it{p}_{T} (GeV/#it{c}); entries", {HistType::kTH1F, {{360, 0., 36.}}}}, - {"QA/hPtProng0D0", "Prong0 of D0 Candidates; Prong0 #it{p}_{T} (GeV/#it{c}); entries", {HistType::kTH1F, {{360, 0., 36.}}}}, - {"QA/hPtProng1D0", "Prong1 of D0 Candidates; Prong1 #it{p}_{T} (GeV/#it{c}); entries", {HistType::kTH1F, {{360, 0., 36.}}}}, - {"QA/hPtProng0D0Bar", "Prong0 of D0Bar Candidates; Prong0 #it{p}_{T} (GeV/#it{c}); entries", {HistType::kTH1F, {{360, 0., 36.}}}}, - {"QA/hPtProng1D0Bar", "Prong1 of D0Bar Candidates; Prong1 #it{p}_{T} (GeV/#it{c}); entries", {HistType::kTH1F, {{360, 0., 36.}}}}, - {"QA/hPtSoftPi", "Soft Pi ; Soft Pi #it{p}_{T} (GeV/#it{c}); entries", {HistType::kTH1F, {{100, 0., 1.}}}}, - {"QA/hDeltaCentGen", "#{Delta}Cent % distribution of Collisions having same MC Collision;FT0M #{Delta}Cent %; Counts", {HistType::kTH1F, {{100, 0.0, 100.0}}}}}}; + HistogramRegistry registry{"registry", {}}; void init(InitContext&) { @@ -113,84 +127,173 @@ struct HfTaskDstarToD0Pi { AxisSpec axisBDTScorePrompt = {binningSigBDTScore, "BDT Score for Prompt Cand"}; AxisSpec axisBDTScoreNonPrompt = {binningSigBDTScore, "BDT Score for Non-Prompt Cand"}; AxisSpec axisBDTScoreBackground = {binningBkgBDTScore, "BDT Score for Background Cand"}; + AxisSpec axisPvContrib = {binningPvContrib, "PV Contribution"}; + AxisSpec axisPt = {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}; + + axesPtVsCentVsBDTVsPvContrib = {axisPt, axisCentrality, axisBDTScoreBackground, axisBDTScorePrompt, axisBDTScoreNonPrompt, axisPvContrib}; + axesPtVsCentVsPvContrib = {axisPt, axisCentrality, axisPvContrib}; + axesPtVsBDT = {axisPt, axisBDTScoreBackground, axisBDTScorePrompt, axisBDTScoreNonPrompt}; + + if (qaEnabled) { + // only QA + registry.add("QA/hPtDstar", "Dstar Candidates; Dstar candidate #it{p}_{T} (GeV/#it{c}); entries", {HistType::kTH1F, {{360, 0., 36.}}}); + registry.add("QA/hPtD0", "D0 Candiades; D0 Candidate #it{p}_{T} (GeV/#it{c}); entries", {HistType::kTH1F, {{360, 0., 36.}}}); + registry.add("QA/hPtProng0D0", "Prong0 of D0 Candidates; Prong0 #it{p}_{T} (GeV/#it{c}); entries", {HistType::kTH1F, {{360, 0., 36.}}}); + registry.add("QA/hPtProng1D0", "Prong1 of D0 Candidates; Prong1 #it{p}_{T} (GeV/#it{c}); entries", {HistType::kTH1F, {{360, 0., 36.}}}); + registry.add("QA/hPtProng0D0Bar", "Prong0 of D0Bar Candidates; Prong0 #it{p}_{T} (GeV/#it{c}); entries", {HistType::kTH1F, {{360, 0., 36.}}}); + registry.add("QA/hPtProng1D0Bar", "Prong1 of D0Bar Candidates; Prong1 #it{p}_{T} (GeV/#it{c}); entries", {HistType::kTH1F, {{360, 0., 36.}}}); + registry.add("QA/hPtSoftPi", "Soft Pi ; Soft Pi #it{p}_{T} (GeV/#it{c}); entries", {HistType::kTH1F, {{100, 0., 1.}}}); + registry.add("QA/hDeltaCentGen", "#{Delta}Cent % distribution of Collisions having same MC Collision;FT0M #{Delta}Cent %; Counts", {HistType::kTH1F, {{100, 0.0, 100.0}}}); + + registry.add("QA/hEtaDstar", "D* Candidate; D* Candidate #it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("QA/hCtD0", "D0 Candidate; D0 Candidate's proper life time #it{c}#tau (cm) ; entries ", {HistType::kTH2F, {{1000, -0.1, 14.}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("QA/hDecayLengthD0", "D0 Candidate; D0 Candidate's decay length (cm); entries", {HistType::kTH2F, {axisDecayLength, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("QA/hDecayLengthXYD0", "D0 Candidate; D0 Candidate's decay length xy (cm); entries", {HistType::kTH2F, {axisDecayLength, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("QA/hDecayLengthNormalisedD0", "D0 Candidates;Do Candidate's normalised decay length (cm); entries", {HistType::kTH2F, {axisNormDecayLength, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("QA/hDecayLengthXYNormalisedD0", "D0 candidate; D0 Candidate's normalised decay length xy (cm); entries", {HistType::kTH2F, {axisNormDecayLength, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("QA/hCPAD0", "D0 Candidates; D0 Candidate's cosine pointing angle; entries", {HistType::kTH2F, {{110, -1., 1.}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("QA/hCPAxyD0", "D0 candidates; D0 Candidate's cosine of pointing angle xy; entries", {HistType::kTH2F, {{110, -1., 1.}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("QA/hImpactParameterXYD0", "D0 Candidates; D0 Candidate's reconstructed impact parameter xy (cm); entries", {HistType::kTH2F, {axisImpactParam, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("QA/hDeltaIPMaxNormalisedD0", "D0 Candidate; D0 Candidate's Norm. Delta IP; entries", {HistType::kTH2F, {{1000, -20., 20.}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("QA/hSqSumProngsImpactParameterD0", "D0 Candidates; Sqr Sum of Impact params of D0 Prongs; entries ", {HistType::kTH2F, {{1000, 0., 0.25}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("QA/hDecayLengthErrorD0", "D0 Candidates; D0 Candidate's Decay Length Error (cm); entries", {HistType::kTH2F, {axisDecayLength, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("QA/hDecayLengthXYErrorD0", "D0 Candidates; D0 Candidate's Decay Length Error XY (cm); entries", {HistType::kTH2F, {axisDecayLength, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("QA/hImpactParameterError", "D0 Prongs; Impact param error of different D0 Prongs (cm); entries", {HistType::kTH2F, {axisImpactParam, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("QA/hd0Prong0", "Prong0; DCAxy of Prong0 (cm); entries", {HistType::kTH2F, {axisImpactParam, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("QA/hd0Prong1", "Prong1; DCAxy of Prong1 (cm); entries", {HistType::kTH2F, {axisImpactParam, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("QA/hd0ProngSoftPi", "ProngSoftPi; DCAxy of Prong Soft Pi (cm); entries", {HistType::kTH2F, {axisImpactParam, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); + + // MC Matching at Reconstruction Level Successful + registry.add("QA/hCPASkimD0RecSig", "MC Matched Skimed D* Candidates at Reconstruction Level; cosine of pointing angle", {HistType::kTH1F, {{110, -1.1, 1.1}}}); + registry.add("QA/hEtaSkimD0RecSig", "MC Matched Skimed D* Candidates at Reconstruction Level; #it{#eta} of D0 Prong", {HistType::kTH1F, {{100, -2., 2.}}}); + registry.add("QA/hEtaSkimDstarRecSig", "MC Matched Skimed D* Candidates at Reconstruction Level; #it{#eta} of D* Candidate", {HistType::kTH1F, {{100, -2., 2.}}}); + + // pt vs y + registry.add("QA/hPtSkimDstarGenSig", "MC Matched Skimed D* Reconstructed Candidates at Generator Level; #it{p}_{T} of D* at Generator Level (GeV/#it{c})", {HistType::kTH1F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}, true); + registry.add("QA/hPtVsCentSkimDstarGenSig", "MC Matched Skimed D* Reconstructed Candidates at Generator Level; #it{p}_{T} of D* at Generator Level (GeV/#it{c}); Centrality (%)", {HistType::kTH2F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {axisCentrality}}}, true); + registry.add("QA/hPtVsYSkimDstarRecSig", "MC Matched Skimed D* Candidates at Reconstruction Level; #it{p}_{T} of D* at Reconstruction Level (GeV/#it{c}); #it{y}", {HistType::kTH2F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {100, -5., 5.}}}); + registry.add("QA/hPtVsYRecoTopolDstarRecSig", "MC Matched RecoTopol D* Candidates at Reconstruction Level; #it{p}_{T} of D* at Reconstruction Level (GeV/#it{c}); #it{y}", {HistType::kTH2F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {100, -5., 5.}}}); + registry.add("QA/hPtVsYRecoPidDstarRecSig", "MC Matched RecoPid D* Candidates at Reconstruction Level; #it{p}_{T} of D* at Reconstruction Level (GeV/#it{c}); #it{y}", {HistType::kTH2F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {100, -5., 5.}}}); + registry.add("QA/hPtFullRecoDstarRecSig", "MC Matched FullReco D* Candidates at Reconstruction Level; #it{p}_{T} of D* at Reconstruction Level (GeV/#it{c})", {HistType::kTH1F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); + + // Only Prompt RecSig + registry.add("QA/hPtVsYSkimPromptDstarRecSig", "MC Matched Skimed Prompt D* Candidates at Reconstruction Level; #it{p}_{T} of D* at Reconstruction Level (GeV/#it{c}; #it{y})", {HistType::kTH2F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {100, -5., 5.}}}); + registry.add("QA/hPtVsYRecoTopolPromptDstarRecSig", "MC Matched RecoTopol Prompt D* Candidates at Reconstruction Level; #it{p}_{T} of D* at Reconstruction Level (GeV/#it{c}); #it{y}", {HistType::kTH2F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {100, -5., 5.}}}); + registry.add("QA/hPtVsYRecoPidPromptDstarRecSig", "MC Matched RecoPid Prompt D* Candidates at Reconstruction Level; #it{p}_{T} of D* at Reconstruction Level (GeV/#it{c}); #it{y}", {HistType::kTH2F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {100, -5., 5.}}}); + registry.add("QA/hPtFullRecoPromptDstarRecSig", "MC Matched FullReco Prompt D* Candidates at Reconstruction Level; #it{p}_{T} of D* at Reconstruction Level (GeV/#it{c})", {HistType::kTH1F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); + // Only Non-Prompt RecSig + registry.add("QA/hPtVsYSkimNonPromptDstarRecSig", "MC Matched Skimed Non-Prompt D* Candidates at Reconstruction Level; #it{p}_{T} of D* at Reconstruction Level (GeV/#it{c}); #it{y}", {HistType::kTH2F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {100, -5., 5.}}}); + registry.add("QA/hPtVsYRecoTopolNonPromptDstarRecSig", "MC Matched RecoTopol Non-Prompt D* Candidates at Reconstruction Level; #it{p}_{T} of D* at Reconstruction Level (GeV/#it{c}); #it{y}", {HistType::kTH2F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {100, -5., 5.}}}); + registry.add("QA/hPtVsYRecoPidNonPromptDstarRecSig", "MC Matched RecoPid Non-Prompt D* Candidates at Reconstruction Level; #it{p}_{T} of D* at Reconstruction Level (GeV/#it{c}); #it{y}", {HistType::kTH2F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {100, -5., 5.}}}); + registry.add("QA/hPtFullRecoNonPromptDstarRecSig", "MC Matched FullReco Non-Prompt D* Candidates at Reconstruction Level; #it{p}_{T} of D* at Reconstruction Level (GeV/#it{c})", {HistType::kTH1F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); + // MC Matching UnSuccessful + registry.add("QA/hCPASkimD0RecBg", "MC UnMatched Skimmed D0 Candidates at Reconstruction Level; cosine of pointing angle", {HistType::kTH1F, {{110, -1., 1.}}}); + registry.add("QA/hEtaSkimD0RecBg", "MC UnMatched Skimmed D0 Candidates at Reconstruction Level; #it{#eta} of D0 Prong", {HistType::kTH1F, {{100, -2., 2.}}}); + registry.add("QA/hEtaSkimDstarRecBg", "MC UnMatched Skimmed D* Candidates at Reconstruction Level; #it{#eta} of D* Candidate", {HistType::kTH1F, {{100, -2., 2.}}}); + // registry.add("QA/hPtSkimD0RecBg", "MC UnMatched Skimmed D0 Candidates at Reconstruction Level; #it{p}_{T} of D0", {HistType::kTH1F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("QA/hPtSkimDstarRecBg", "MC UnMatched Skimmed D* Candidates at Reconstruction Level; #it{p}_{T} of D*", {HistType::kTH1F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); + + // MC Matching at Generator level Successful + registry.add("QA/hEtaDstarGen", "MC Matched D* Candidates at Generator Level; #it{#eta}", {HistType::kTH1F, {{100, -2., 2.}}}); + registry.add("QA/hPtDstarGen", "MC Matched D* Candidates at Generator Level; #it{p}_{T} of D*", {HistType::kTH1F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); + } - registry.add("Yield/hDeltaInvMassDstar3D", "#Delta #it{M}_{inv} D* Candidate; inv. mass ((#pi #pi k) - (#pi k)) (GeV/#it{c}^{2});#it{p}_{T} (GeV/#it{c}); FT0M centrality", {HistType::kTH3F, {{axisDeltaInvMass}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {axisCentrality}}}, true); - registry.add("Yield/hDeltaInvMassDstar2D", "#Delta #it{M}_{inv} D* Candidate; inv. mass ((#pi #pi k) - (#pi k)) (GeV/#it{c}^{2});#it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {{axisDeltaInvMass}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}, true); registry.add("Yield/hDeltaInvMassDstar1D", "#Delta #it{M}_{inv} D* Candidate; inv. mass ((#pi #pi k) - (#pi k)) (GeV/#it{c}^{2}); entries", {HistType::kTH1F, {{axisDeltaInvMass}}}, true); registry.add("Yield/hInvMassDstar", "#Delta #it{M}_{inv} D* Candidate; inv. mass (#pi #pi k) (GeV/#it{c}^{2}); entries", {HistType::kTH1F, {{500, 0., 5.0}}}, true); registry.add("Yield/hInvMassD0", "#it{M}_{inv}D^{0} candidate;#it{M}_{inv} D^{0} (GeV/#it{c});#it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {{500, 0., 5.0}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}, true); - // only QA - registry.add("QA/hEtaDstar", "D* Candidate; D* Candidate #it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("QA/hCtD0", "D0 Candidate; D0 Candidate's proper life time #it{c}#tau (cm) ; entries ", {HistType::kTH2F, {{1000, -0.1, 14.}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("QA/hDecayLengthD0", "D0 Candidate; D0 Candidate's decay length (cm); entries", {HistType::kTH2F, {axisDecayLength, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("QA/hDecayLengthXYD0", "D0 Candidate; D0 Candidate's decay length xy (cm); entries", {HistType::kTH2F, {axisDecayLength, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("QA/hDecayLengthNormalisedD0", "D0 Candidates;Do Candidate's normalised decay length (cm); entries", {HistType::kTH2F, {axisNormDecayLength, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("QA/hDecayLengthXYNormalisedD0", "D0 candidate; D0 Candidate's normalised decay length xy (cm); entries", {HistType::kTH2F, {axisNormDecayLength, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("QA/hCPAD0", "D0 Candidates; D0 Candidate's cosine pointing angle; entries", {HistType::kTH2F, {{110, -1., 1.}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("QA/hCPAxyD0", "D0 candidates; D0 Candidate's cosine of pointing angle xy; entries", {HistType::kTH2F, {{110, -1., 1.}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("QA/hImpactParameterXYD0", "D0 Candidates; D0 Candidate's reconstructed impact parameter xy (cm); entries", {HistType::kTH2F, {axisImpactParam, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("QA/hDeltaIPMaxNormalisedD0", "D0 Candidate; D0 Candidate's Norm. Delta IP; entries", {HistType::kTH2F, {{1000, -20., 20.}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("QA/hSqSumProngsImpactParameterD0", "D0 Candidates; Sqr Sum of Impact params of D0 Prongs; entries ", {HistType::kTH2F, {{1000, 0., 0.25}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("QA/hDecayLengthErrorD0", "D0 Candidates; D0 Candidate's Decay Length Error (cm); entries", {HistType::kTH2F, {axisDecayLength, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("QA/hDecayLengthXYErrorD0", "D0 Candidates; D0 Candidate's Decay Length Error XY (cm); entries", {HistType::kTH2F, {axisDecayLength, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("QA/hImpactParameterError", "D0 Prongs; Impact param error of different D0 Prongs (cm); entries", {HistType::kTH2F, {axisImpactParam, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("QA/hd0Prong0", "Prong0; DCAxy of Prong0 (cm); entries", {HistType::kTH2F, {axisImpactParam, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("QA/hd0Prong1", "Prong1; DCAxy of Prong1 (cm); entries", {HistType::kTH2F, {axisImpactParam, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("QA/hd0ProngSoftPi", "ProngSoftPi; DCAxy of Prong Soft Pi (cm); entries", {HistType::kTH2F, {axisImpactParam, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); - // MC Matching at Reconstruction Level Successful - registry.add("QA/hCPASkimD0RecSig", "MC Matched Skimed D* Candidates at Reconstruction Level; cosine of pointing angle", {HistType::kTH1F, {{110, -1.1, 1.1}}}); - registry.add("QA/hEtaSkimD0RecSig", "MC Matched Skimed D* Candidates at Reconstruction Level; #it{#eta} of D0 Prong", {HistType::kTH1F, {{100, -2., 2.}}}); - registry.add("QA/hEtaSkimDstarRecSig", "MC Matched Skimed D* Candidates at Reconstruction Level; #it{#eta} of D* Candidate", {HistType::kTH1F, {{100, -2., 2.}}}); + + // BDT Score (axisBDTScoreBackground, axisBDTScorePrompt, axisBDTScoreNonPrompt) + if (doprocessDataWML) { + registry.add("Yield/hDeltaInvMassVsPtVsCentVsBDTScore", "#Delta #it{M}_{inv} Vs Pt Vs Cent Vs BDTScore", {HistType::kTHnSparseF, {{axisDeltaInvMass}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {axisCentrality}, {axisBDTScoreBackground}, {axisBDTScorePrompt}, {axisBDTScoreNonPrompt}}}, true); + } else if (doprocessDataWoML) { + registry.add("Yield/hDeltaInvMassDstar2D", "#Delta #it{M}_{inv} D* Candidate; inv. mass ((#pi #pi k) - (#pi k)) (GeV/#it{c}^{2});#it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {{axisDeltaInvMass}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}, true); + registry.add("Yield/hDeltaInvMassDstar3D", "#Delta #it{M}_{inv} D* Candidate; inv. mass ((#pi #pi k) - (#pi k)) (GeV/#it{c}^{2});#it{p}_{T} (GeV/#it{c}); FT0M centrality", {HistType::kTH3F, {{axisDeltaInvMass}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {axisCentrality}}}, true); + } + // pt vs y - registry.add("QA/hPtSkimDstarGenSig", "MC Matched Skimed D* Reconstructed Candidates at Generator Level; #it{p}_{T} of D* at Generator Level (GeV/#it{c})", {HistType::kTH1F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}, true); - registry.add("Efficiency/hPtVsCentSkimDstarGenSig", "MC Matched Skimed D* Reconstructed Candidates at Generator Level; #it{p}_{T} of D* at Generator Level (GeV/#it{c}); Centrality (%)", {HistType::kTH2F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {axisCentrality}}}, true); - registry.add("QA/hPtVsYSkimDstarRecSig", "MC Matched Skimed D* Candidates at Reconstruction Level; #it{p}_{T} of D* at Reconstruction Level (GeV/#it{c}); #it{y}", {HistType::kTH2F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {100, -5., 5.}}}); - registry.add("QA/hPtVsYRecoTopolDstarRecSig", "MC Matched RecoTopol D* Candidates at Reconstruction Level; #it{p}_{T} of D* at Reconstruction Level (GeV/#it{c}); #it{y}", {HistType::kTH2F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {100, -5., 5.}}}); - registry.add("QA/hPtVsYRecoPidDstarRecSig", "MC Matched RecoPid D* Candidates at Reconstruction Level; #it{p}_{T} of D* at Reconstruction Level (GeV/#it{c}); #it{y}", {HistType::kTH2F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {100, -5., 5.}}}); - registry.add("QA/hPtFullRecoDstarRecSig", "MC Matched FullReco D* Candidates at Reconstruction Level; #it{p}_{T} of D* at Reconstruction Level (GeV/#it{c})", {HistType::kTH1F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("Efficiency/hPtVsCentFullRecoDstarRecSig", "MC Matched FullReco D* Candidates at Reconstruction Level; #it{p}_{T} of D* at Reconstruction Level (GeV/#it{c}); Centrality (%)", {HistType::kTH2F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {axisCentrality}}}, true); - // Only Prompt RecSig - registry.add("QA/hPtVsYSkimPromptDstarRecSig", "MC Matched Skimed Prompt D* Candidates at Reconstruction Level; #it{p}_{T} of D* at Reconstruction Level (GeV/#it{c}; #it{y})", {HistType::kTH2F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {100, -5., 5.}}}); - registry.add("QA/hPtVsYRecoTopolPromptDstarRecSig", "MC Matched RecoTopol Prompt D* Candidates at Reconstruction Level; #it{p}_{T} of D* at Reconstruction Level (GeV/#it{c}); #it{y}", {HistType::kTH2F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {100, -5., 5.}}}); - registry.add("QA/hPtVsYRecoPidPromptDstarRecSig", "MC Matched RecoPid Prompt D* Candidates at Reconstruction Level; #it{p}_{T} of D* at Reconstruction Level (GeV/#it{c}); #it{y}", {HistType::kTH2F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {100, -5., 5.}}}); - registry.add("QA/hPtFullRecoPromptDstarRecSig", "MC Matched FullReco Prompt D* Candidates at Reconstruction Level; #it{p}_{T} of D* at Reconstruction Level (GeV/#it{c})", {HistType::kTH1F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); - // Only Non-Prompt RecSig - registry.add("QA/hPtVsYSkimNonPromptDstarRecSig", "MC Matched Skimed Non-Prompt D* Candidates at Reconstruction Level; #it{p}_{T} of D* at Reconstruction Level (GeV/#it{c}); #it{y}", {HistType::kTH2F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {100, -5., 5.}}}); - registry.add("QA/hPtVsYRecoTopolNonPromptDstarRecSig", "MC Matched RecoTopol Non-Prompt D* Candidates at Reconstruction Level; #it{p}_{T} of D* at Reconstruction Level (GeV/#it{c}); #it{y}", {HistType::kTH2F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {100, -5., 5.}}}); - registry.add("QA/hPtVsYRecoPidNonPromptDstarRecSig", "MC Matched RecoPid Non-Prompt D* Candidates at Reconstruction Level; #it{p}_{T} of D* at Reconstruction Level (GeV/#it{c}); #it{y}", {HistType::kTH2F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {100, -5., 5.}}}); - registry.add("QA/hPtFullRecoNonPromptDstarRecSig", "MC Matched FullReco Non-Prompt D* Candidates at Reconstruction Level; #it{p}_{T} of D* at Reconstruction Level (GeV/#it{c})", {HistType::kTH1F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); - // MC Matching UnSuccessful - registry.add("QA/hCPASkimD0RecBg", "MC UnMatched Skimmed D0 Candidates at Reconstruction Level; cosine of pointing angle", {HistType::kTH1F, {{110, -1., 1.}}}); - registry.add("QA/hEtaSkimD0RecBg", "MC UnMatched Skimmed D0 Candidates at Reconstruction Level; #it{#eta} of D0 Prong", {HistType::kTH1F, {{100, -2., 2.}}}); - registry.add("QA/hEtaSkimDstarRecBg", "MC UnMatched Skimmed D* Candidates at Reconstruction Level; #it{#eta} of D* Candidate", {HistType::kTH1F, {{100, -2., 2.}}}); - registry.add("QA/hPtSkimD0RecBg", "MC UnMatched Skimmed D0 Candidates at Reconstruction Level; #it{p}_{T} of D0", {HistType::kTH1F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("QA/hPtSkimDstarRecBg", "MC UnMatched Skimmed D* Candidates at Reconstruction Level; #it{p}_{T} of D*", {HistType::kTH1F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); - // MC Matching at Generator level Successful - registry.add("QA/hEtaDstarGen", "MC Matched D* Candidates at Generator Level; #it{#eta}", {HistType::kTH1F, {{100, -2., 2.}}}); - registry.add("QA/hPtDstarGen", "MC Matched D* Candidates at Generator Level; #it{p}_{T} of D*", {HistType::kTH1F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("Efficiency/hPtVsCentDstarGen", "MC Matched D* Candidates at Generator Level; #it{p}_{T} of D*;Centrality (%) ", {HistType::kTH2F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {axisCentrality}}}, true); - registry.add("QA/hPtVsYDstarGen", "MC Matched D* Candidates at Generator Level; #it{p}_{T} of D*; #it{y}", {HistType::kTH2F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {100, -5., 5.}}}); + registry.add("Efficiency/hPtVsYDstarGen", "MC Matched D* Candidates at Generator Level; #it{p}_{T} of D*; #it{y}", {HistType::kTH2F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {100, -5., 5.}}}, true); // Prompt Gen - registry.add("QA/hPtPromptDstarGen", "MC Matched Prompt D* Candidates at Generator Level; #it{p}_{T} of D*", {HistType::kTH1F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("QA/hPtVsYPromptDstarGen", "MC Matched Prompt D* Candidates at Generator Level; #it{p}_{T} of D*; #it{y}", {HistType::kTH2F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {100, -5., 5.}}}); + registry.add("Efficiency/hPtVsYPromptDstarGen", "MC Matched Prompt D* Candidates at Generator Level; #it{p}_{T} of D*; #it{y}", {HistType::kTH2F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {100, -5., 5.}}}, true); // Non Prmpt Gen - registry.add("QA/hPtNonPromptDstarGen", "MC Matched Non-Prompt D* Candidates at Generator Level; #it{p}_{T} of D*", {HistType::kTH1F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("QA/hPtVsYNonPromptDstarGen", "MC Matched Non-Prompt D* Candidates at Generator Level; #it{p}_{T} of D*; #it{y}", {HistType::kTH2F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {100, -5., 5.}}}); + registry.add("Efficiency/hPtVsYNonPromptDstarGen", "MC Matched Non-Prompt D* Candidates at Generator Level; #it{p}_{T} of D*; #it{y}", {HistType::kTH2F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {100, -5., 5.}}}, true); - // Checking PV contributors from Data as well MC rec - registry.add("Efficiency/hNumPvContributorsAll", "PV Contributors; PV Contributor; FT0M Centrality", {HistType::kTH2F, {{100, 0, 300}, {axisCentrality}}}, true); - registry.add("Efficiency/hNumPvContributorsCand", "PV Contributors; PV Contributor; FT0M Centrality", {HistType::kTH2F, {{100, 0, 300}, {axisCentrality}}}, true); - registry.add("Efficiency/hNumPvContributorsCandInMass", "PV Contributors; PV Contributor; FT0M Centrality", {HistType::kTH2F, {{100, 0, 300}, {axisCentrality}}}, true); + // Checking PV contributors from Data as well MC rec for calculation weights offline + if (isCentStudy) { + registry.add("Efficiency/hNumPvContributorsAll", "PV Contributors; PV Contributor; FT0M Centrality", {HistType::kTH2F, {{axisPvContrib}, {axisCentrality}}}, true); + registry.add("Efficiency/hNumPvContributorsCand", "PV Contributors; PV Contributor; FT0M Centrality", {HistType::kTH2F, {{axisPvContrib}, {axisCentrality}}}, true); + registry.add("Efficiency/hNumPvContributorsCandInMass", "PV Contributors; PV Contributor; FT0M Centrality", {HistType::kTH2F, {{axisPvContrib}, {axisCentrality}}}, true); + } - // BDT Score (axisBDTScoreBackground, axisBDTScorePrompt, axisBDTScoreNonPrompt) - if (doprocessDataWML) { - registry.add("Yield/hDeltaInvMassVsPtVsCentVsBDTScore", "#Delta #it{M}_{inv} Vs Pt Vs Cent Vs BDTScore", {HistType::kTHnSparseF, {{axisDeltaInvMass}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {axisCentrality}, {axisBDTScoreBackground}, {axisBDTScorePrompt}, {axisBDTScoreNonPrompt}}}); + // Hists at Reco level W/O ML usefull for efficiency calculation + if (doprocessMcWoMl && isCentStudy) { + registry.add("Efficiency/hPtVsCentVsPvContribRecSig", "Pt Vs Cent Vs PvContrib", {HistType::kTHnSparseF, axesPtVsCentVsPvContrib}, true); + registry.add("Efficiency/hPtPromptVsCentVsPvContribRecSig", "Pt Vs Cent Vs PvContrib", {HistType::kTHnSparseF, axesPtVsCentVsPvContrib}, true); + registry.add("Efficiency/hPtNonPromptVsCentVsPvContribRecSig", "Pt Vs Cent Vs PvContrib", {HistType::kTHnSparseF, axesPtVsCentVsPvContrib}, true); + } else if (doprocessMcWoMl && !isCentStudy) { + registry.add("Efficiency/hPtVsPvContribRecSig", "Pt Vs PvContrib", {HistType::kTHnSparseF, axesPtVsBDT}, true); + registry.add("Efficiency/hPtPromptVsPvContribRecSig", "Pt Vs PvContrib", {HistType::kTHnSparseF, axesPtVsBDT}, true); + registry.add("Efficiency/hPtNonPromptVsPvContribRecSig", "Pt Vs PvContrib", {HistType::kTHnSparseF, axesPtVsBDT}, true); } - if (doprocessMcWML) { - registry.add("Efficiency/hPtVsCentVsBDTScore", "Pt Vs Cent Vs BDTScore", {HistType::kTHnSparseF, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {axisCentrality}, {axisBDTScoreBackground}, {axisBDTScorePrompt}, {axisBDTScoreNonPrompt}}}); - registry.add("Efficiency/hPtPromptVsCentVsBDTScore", "Pt Vs Cent Vs BDTScore", {HistType::kTHnSparseF, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {axisCentrality}, {axisBDTScoreBackground}, {axisBDTScorePrompt}, {axisBDTScoreNonPrompt}}}); - registry.add("Efficiency/hPtNonPromptVsCentVsBDTScore", "Pt Vs Cent Vs BDTScore", {HistType::kTHnSparseF, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {axisCentrality}, {axisBDTScoreBackground}, {axisBDTScorePrompt}, {axisBDTScoreNonPrompt}}}); + + // Hists at Reco level W/ ML usefull for efficiency calculation + if (doprocessMcWML && isCentStudy) { + registry.add("Efficiency/hPtVsCentVsBDTScoreVsPvContribRecSig", "Pt Vs Cent Vs BDTScore Vs PvContrib", {HistType::kTHnSparseF, axesPtVsCentVsBDTVsPvContrib}, true); + registry.add("Efficiency/hPtPromptVsCentVsBDTScorePvContribRecSig", "Pt Vs Cent Vs BDTScore Vs PvContrib", {HistType::kTHnSparseF, axesPtVsCentVsBDTVsPvContrib}, true); + registry.add("Efficiency/hPtNonPrompRectVsCentVsBDTScorePvContribRecSig", "Pt Vs Cent Vs BDTScore", {HistType::kTHnSparseF, axesPtVsCentVsBDTVsPvContrib}, true); // registry.add("Efficiency/hPtBkgVsCentVsBDTScore", "Pt Vs Cent Vs BDTScore", {HistType::kTHnSparseF, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {axisCentrality}, {axisBDTScoreBackground}, {axisBDTScorePrompt}, {axisBDTScoreNonPrompt}}}); + } else if (doprocessMcWML && !isCentStudy) { + registry.add("Efficiency/hPtVsBDTScoreRecSig", "Pt Vs BDTScore", {HistType::kTHnSparseF, axesPtVsBDT}, true); + registry.add("Efficiency/hPtPromptVsBDTScoreRecSig", "Pt Vs BDTScore", {HistType::kTHnSparseF, axesPtVsBDT}, true); + registry.add("Efficiency/hPtNonPromptVsBDTScoreRecSig", "Pt Vs BDTScore", {HistType::kTHnSparseF, axesPtVsBDT}, true); + } + + // Hists at Gen level usefull for efficiency calculation + if (doprocessMcWoMl || doprocessMcWML) { + if (isCentStudy) { + registry.add("Efficiency/hPtVsCentVsPvContribGen", "Pt Vs Cent Vs PvContrib", {HistType::kTHnSparseF, axesPtVsCentVsPvContrib}, true); + registry.add("Efficiency/hPtPromptVsCentVsPvContribGen", "Pt Vs Cent Vs PvContrib", {HistType::kTHnSparseF, axesPtVsCentVsPvContrib}, true); + registry.add("Efficiency/hPtNonPromptVsCentVsPvContribGen", "Pt Vs Cent Vs PvContrib", {HistType::kTHnSparseF, axesPtVsCentVsPvContrib}, true); + } else { + registry.add("Efficiency/hPtGen", "MC Matched D* Candidates at Generator Level", {HistType::kTH1F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}, true); + registry.add("Efficiency/hPtPromptVsGen", "MC Matched Prompt D* Candidates at Generator Level", {HistType::kTH1F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}, true); + registry.add("Efficiency/hPtNonPromptVsGen", "MC Matched Non-Prompt D* Candidates at Generator Level", {HistType::kTH1F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}, true); + } + } + + // if weights to be applied + if (useWeight) { + ccdbApi.init(ccdbUrl); + std::map metadata; + // Retrieve the file from CCDB + bool isFileAvailable = ccdbApi.retrieveBlob(ccdbPathForWeight, ".", metadata, timestampCCDB, false, weightFileName); + if (!isFileAvailable) { + LOGF(fatal, "Failed to retrieve weight file from CCDB: %s", ccdbPathForWeight.value.c_str()); + return; + } + + if (isCentStudy) { + // Open the ROOT file + TFile* weightFile = TFile::Open(weightFileName.value.c_str(), "READ"); + if (weightFile && !weightFile->IsZombie()) { + // Ensure hWeights is properly sized + hWeights.resize(nWeights); + for (int ithWeight = 0; ithWeight < nWeights; ++ithWeight) { + std::string histName = "hMult" + std::to_string(ithWeight + 1) + "_Weight"; + hWeights[ithWeight] = reinterpret_cast(weightFile->Get(histName.c_str())); + if (!hWeights[ithWeight]) { + LOGF(fatal, "Histogram %s not found in weight file!", histName.c_str()); + return; + } + hWeights[ithWeight]->SetDirectory(0); + hWeights[ithWeight]->SetName(("hWeight" + std::to_string(ithWeight + 1)).c_str()); + } + weightFile->Close(); + delete weightFile; + } else { + LOGF(fatal, "Failed to open weight file from CCDB: %s", weightFileName.value.c_str()); + return; + } + } } } @@ -220,7 +323,6 @@ struct HfTaskDstarToD0Pi { auto nCandsCurrentCol = selectedCandsCurrentCol.size(); if (nCandsCurrentCol > 0) { - // LOGF(debug, "size of selectedCandsCurrentCol: %d", nCandsCurrentCol); registry.fill(HIST("Efficiency/hNumPvContributorsCand"), nPVContributors, centrality); } @@ -231,28 +333,30 @@ struct HfTaskDstarToD0Pi { continue; } - registry.fill(HIST("QA/hPtDstar"), candDstar.pt()); - registry.fill(HIST("QA/hPtD0"), candDstar.ptD0()); - registry.fill(HIST("QA/hPtSoftPi"), candDstar.ptSoftPi()); - registry.fill(HIST("QA/hEtaDstar"), candDstar.eta(), candDstar.pt()); - registry.fill(HIST("QA/hCtD0"), candDstar.ctD0(), candDstar.pt()); - registry.fill(HIST("QA/hDecayLengthD0"), candDstar.decayLengthD0(), candDstar.pt()); - registry.fill(HIST("QA/hDecayLengthXYD0"), candDstar.decayLengthXYD0(), candDstar.pt()); - registry.fill(HIST("QA/hDecayLengthNormalisedD0"), candDstar.decayLengthNormalisedD0(), candDstar.pt()); - registry.fill(HIST("QA/hDecayLengthXYNormalisedD0"), candDstar.decayLengthXYNormalisedD0(), candDstar.pt()); - registry.fill(HIST("QA/hCPAD0"), candDstar.cpaD0(), candDstar.pt()); - registry.fill(HIST("QA/hCPAxyD0"), candDstar.cpaXYD0(), candDstar.pt()); - registry.fill(HIST("QA/hImpactParameterXYD0"), candDstar.impactParameterXYD0(), candDstar.pt()); - registry.fill(HIST("QA/hDeltaIPMaxNormalisedD0"), candDstar.deltaIPNormalisedMaxD0(), candDstar.pt()); - registry.fill(HIST("QA/hSqSumProngsImpactParameterD0"), candDstar.impactParameterProngSqSumD0(), candDstar.pt()); - registry.fill(HIST("QA/hDecayLengthErrorD0"), candDstar.errorDecayLengthD0(), candDstar.pt()); - registry.fill(HIST("QA/hDecayLengthXYErrorD0"), candDstar.errorDecayLengthXYD0(), candDstar.pt()); - registry.fill(HIST("QA/hImpactParameterError"), candDstar.errorImpactParameter0(), candDstar.pt()); - registry.fill(HIST("QA/hImpactParameterError"), candDstar.errorImpactParameter1(), candDstar.pt()); - registry.fill(HIST("QA/hImpactParameterError"), candDstar.errorImpParamSoftPi(), candDstar.pt()); - registry.fill(HIST("QA/hd0Prong0"), candDstar.impactParameter0(), candDstar.pt()); - registry.fill(HIST("QA/hd0Prong1"), candDstar.impactParameter1(), candDstar.pt()); - registry.fill(HIST("QA/hd0ProngSoftPi"), candDstar.impParamSoftPi(), candDstar.pt()); + if (qaEnabled) { + registry.fill(HIST("QA/hPtDstar"), candDstar.pt()); + registry.fill(HIST("QA/hPtD0"), candDstar.ptD0()); + registry.fill(HIST("QA/hPtSoftPi"), candDstar.ptSoftPi()); + registry.fill(HIST("QA/hEtaDstar"), candDstar.eta(), candDstar.pt()); + registry.fill(HIST("QA/hCtD0"), candDstar.ctD0(), candDstar.pt()); + registry.fill(HIST("QA/hDecayLengthD0"), candDstar.decayLengthD0(), candDstar.pt()); + registry.fill(HIST("QA/hDecayLengthXYD0"), candDstar.decayLengthXYD0(), candDstar.pt()); + registry.fill(HIST("QA/hDecayLengthNormalisedD0"), candDstar.decayLengthNormalisedD0(), candDstar.pt()); + registry.fill(HIST("QA/hDecayLengthXYNormalisedD0"), candDstar.decayLengthXYNormalisedD0(), candDstar.pt()); + registry.fill(HIST("QA/hCPAD0"), candDstar.cpaD0(), candDstar.pt()); + registry.fill(HIST("QA/hCPAxyD0"), candDstar.cpaXYD0(), candDstar.pt()); + registry.fill(HIST("QA/hImpactParameterXYD0"), candDstar.impactParameterXYD0(), candDstar.pt()); + registry.fill(HIST("QA/hDeltaIPMaxNormalisedD0"), candDstar.deltaIPNormalisedMaxD0(), candDstar.pt()); + registry.fill(HIST("QA/hSqSumProngsImpactParameterD0"), candDstar.impactParameterProngSqSumD0(), candDstar.pt()); + registry.fill(HIST("QA/hDecayLengthErrorD0"), candDstar.errorDecayLengthD0(), candDstar.pt()); + registry.fill(HIST("QA/hDecayLengthXYErrorD0"), candDstar.errorDecayLengthXYD0(), candDstar.pt()); + registry.fill(HIST("QA/hImpactParameterError"), candDstar.errorImpactParameter0(), candDstar.pt()); + registry.fill(HIST("QA/hImpactParameterError"), candDstar.errorImpactParameter1(), candDstar.pt()); + registry.fill(HIST("QA/hImpactParameterError"), candDstar.errorImpParamSoftPi(), candDstar.pt()); + registry.fill(HIST("QA/hd0Prong0"), candDstar.impactParameter0(), candDstar.pt()); + registry.fill(HIST("QA/hd0Prong1"), candDstar.impactParameter1(), candDstar.pt()); + registry.fill(HIST("QA/hd0ProngSoftPi"), candDstar.impParamSoftPi(), candDstar.pt()); + } auto invDstar = candDstar.invMassDstar(); auto invAntiDstar = candDstar.invMassAntiDstar(); @@ -262,7 +366,7 @@ struct HfTaskDstarToD0Pi { auto signDstar = candDstar.signSoftPi(); if (signDstar > 0) { auto deltaMDstar = std::abs(invDstar - invD0); - if (0.142f < deltaMDstar && deltaMDstar < 0.15f) { + if (deltaMassMin < deltaMDstar && deltaMDstar < deltaMassMax) { nCandsSignalRegion++; } @@ -271,17 +375,21 @@ struct HfTaskDstarToD0Pi { registry.fill(HIST("Yield/hDeltaInvMassVsPtVsCentVsBDTScore"), deltaMDstar, candDstar.pt(), centrality, mlBdtScore[0], mlBdtScore[1], mlBdtScore[2]); } - registry.fill(HIST("Yield/hDeltaInvMassDstar3D"), deltaMDstar, candDstar.pt(), centrality); - registry.fill(HIST("Yield/hDeltaInvMassDstar2D"), deltaMDstar, candDstar.pt()); + if (doprocessDataWoML) { + registry.fill(HIST("Yield/hDeltaInvMassDstar3D"), deltaMDstar, candDstar.pt(), centrality); + registry.fill(HIST("Yield/hDeltaInvMassDstar2D"), deltaMDstar, candDstar.pt()); + } registry.fill(HIST("Yield/hInvMassD0"), invD0, candDstar.ptD0()); registry.fill(HIST("Yield/hDeltaInvMassDstar1D"), deltaMDstar); registry.fill(HIST("Yield/hInvMassDstar"), invDstar); // filling pt of two pronges of D0 - registry.fill(HIST("QA/hPtProng0D0"), candDstar.ptProng0()); - registry.fill(HIST("QA/hPtProng1D0"), candDstar.ptProng1()); + if (qaEnabled) { + registry.fill(HIST("QA/hPtProng0D0"), candDstar.ptProng0()); + registry.fill(HIST("QA/hPtProng1D0"), candDstar.ptProng1()); + } } else if (signDstar < 0) { auto deltaMAntiDstar = std::abs(invAntiDstar - invD0Bar); - if (0.142f < deltaMAntiDstar && deltaMAntiDstar < 0.15f) { + if (deltaMassMin < deltaMAntiDstar && deltaMAntiDstar < deltaMassMax) { nCandsSignalRegion++; } @@ -290,14 +398,19 @@ struct HfTaskDstarToD0Pi { registry.fill(HIST("Yield/hDeltaInvMassVsPtVsCentVsBDTScore"), deltaMAntiDstar, candDstar.pt(), centrality, mlBdtScore[0], mlBdtScore[1], mlBdtScore[2]); } - registry.fill(HIST("Yield/hDeltaInvMassDstar3D"), deltaMAntiDstar, candDstar.pt(), centrality); - registry.fill(HIST("Yield/hDeltaInvMassDstar2D"), deltaMAntiDstar, candDstar.pt()); + if (doprocessDataWoML) { + registry.fill(HIST("Yield/hDeltaInvMassDstar3D"), deltaMAntiDstar, candDstar.pt(), centrality); + registry.fill(HIST("Yield/hDeltaInvMassDstar2D"), deltaMAntiDstar, candDstar.pt()); + } + registry.fill(HIST("Yield/hInvMassD0"), invD0Bar, candDstar.ptD0()); registry.fill(HIST("Yield/hDeltaInvMassDstar1D"), deltaMAntiDstar); registry.fill(HIST("Yield/hInvMassDstar"), invAntiDstar); // filling pt of two pronges of D0Bar - registry.fill(HIST("QA/hPtProng0D0Bar"), candDstar.ptProng0()); - registry.fill(HIST("QA/hPtProng1D0Bar"), candDstar.ptProng1()); + if (qaEnabled) { + registry.fill(HIST("QA/hPtProng0D0Bar"), candDstar.ptProng0()); + registry.fill(HIST("QA/hPtProng1D0Bar"), candDstar.ptProng1()); + } } } // candidate loop for current collision ends @@ -315,11 +428,9 @@ struct HfTaskDstarToD0Pi { template void runMcRecTaskDstar(T1 const& candsMcRecSel, CandDstarMcGen const& rowsMcPartilces) { - // LOGF(info, "Running MC Rec Task Dstar"); int8_t signDstar = 0; // MC at Reconstruction level for (const auto& candDstarMcRec : candsMcRecSel) { - // LOGF(info, "MC Rec Dstar loop"); auto ptDstarRecSig = candDstarMcRec.pt(); auto yDstarRecSig = candDstarMcRec.y(constants::physics::MassDStar); if (yCandDstarRecoMax >= 0. && std::abs(yDstarRecSig) > yCandDstarRecoMax) { @@ -327,72 +438,115 @@ struct HfTaskDstarToD0Pi { } auto collision = candDstarMcRec.template collision_as(); auto centrality = collision.centFT0M(); // 0-100% + auto nPVContributors = collision.numContrib(); // number of PV contributors if (std::abs(candDstarMcRec.flagMcMatchRec()) == hf_decay::hf_cand_dstar::DecayChannelMain::DstarToPiKPi) { // if MC matching is successful at Reconstruction Level - // LOGF(info, "MC Rec Dstar loop MC Matched"); // get MC Mother particle auto prong0 = candDstarMcRec.template prong0_as(); auto indexMother = RecoDecay::getMother(rowsMcPartilces, prong0.template mcParticle_as(), o2::constants::physics::Pdg::kDStar, true, &signDstar, 2); - auto particleMother = rowsMcPartilces.rawIteratorAt(indexMother); // What is difference between rawIterator() or iteratorAt() methods? - registry.fill(HIST("QA/hPtSkimDstarGenSig"), particleMother.pt()); // generator level pt - registry.fill(HIST("Efficiency/hPtVsCentSkimDstarGenSig"), particleMother.pt(), centrality); - - registry.fill(HIST("QA/hPtVsYSkimDstarRecSig"), ptDstarRecSig, yDstarRecSig); // Skimed at level of trackIndexSkimCreator - if (candDstarMcRec.isRecoTopol()) { // if Topological selection are passed - registry.fill(HIST("QA/hPtVsYRecoTopolDstarRecSig"), ptDstarRecSig, yDstarRecSig); - } - if (candDstarMcRec.isRecoPid()) { // if PID selection is passed - registry.fill(HIST("QA/hPtVsYRecoPidDstarRecSig"), ptDstarRecSig, yDstarRecSig); - } - if (candDstarMcRec.isSelDstarToD0Pi()) { // if all selection passed - registry.fill(HIST("QA/hPtFullRecoDstarRecSig"), ptDstarRecSig); - registry.fill(HIST("Efficiency/hPtVsCentFullRecoDstarRecSig"), ptDstarRecSig, centrality); - if constexpr (applyMl) { - auto bdtScore = candDstarMcRec.mlProbDstarToD0Pi(); - registry.fill(HIST("Efficiency/hPtVsCentVsBDTScore"), ptDstarRecSig, centrality, bdtScore[0], bdtScore[1], bdtScore[2]); - } - } - registry.fill(HIST("QA/hCPASkimD0RecSig"), candDstarMcRec.cpaD0()); - registry.fill(HIST("QA/hEtaSkimD0RecSig"), candDstarMcRec.etaD0()); - registry.fill(HIST("QA/hEtaSkimDstarRecSig"), candDstarMcRec.eta()); - - // only prompt signal at reconstruction level - if (candDstarMcRec.originMcRec() == RecoDecay::OriginType::Prompt) { - registry.fill(HIST("QA/hPtVsYSkimPromptDstarRecSig"), ptDstarRecSig, yDstarRecSig); // Skimed at level of trackIndexSkimCreator - if (candDstarMcRec.isRecoTopol()) { // if Topological selection are passed - registry.fill(HIST("QA/hPtVsYRecoTopolPromptDstarRecSig"), ptDstarRecSig, yDstarRecSig); + auto particleMother = rowsMcPartilces.rawIteratorAt(indexMother); // What is difference between rawIterator() or iteratorAt() methods? + if (qaEnabled) { + registry.fill(HIST("QA/hPtSkimDstarGenSig"), particleMother.pt()); // generator level pt + registry.fill(HIST("QA/hPtVsCentSkimDstarGenSig"), particleMother.pt(), centrality); + registry.fill(HIST("QA/hPtVsYSkimDstarRecSig"), ptDstarRecSig, yDstarRecSig); // Skimed at level of trackIndexSkimCreator + if (candDstarMcRec.isRecoTopol()) { // if Topological selection are passed + registry.fill(HIST("QA/hPtVsYRecoTopolDstarRecSig"), ptDstarRecSig, yDstarRecSig); } if (candDstarMcRec.isRecoPid()) { // if PID selection is passed - registry.fill(HIST("QA/hPtVsYRecoPidPromptDstarRecSig"), ptDstarRecSig, yDstarRecSig); + registry.fill(HIST("QA/hPtVsYRecoPidDstarRecSig"), ptDstarRecSig, yDstarRecSig); } - if (candDstarMcRec.isSelDstarToD0Pi()) { // if all selection passed - registry.fill(HIST("QA/hPtFullRecoPromptDstarRecSig"), ptDstarRecSig); - if constexpr (applyMl) { - auto bdtScore = candDstarMcRec.mlProbDstarToD0Pi(); - registry.fill(HIST("Efficiency/hPtPromptVsCentVsBDTScore"), ptDstarRecSig, centrality, bdtScore[0], bdtScore[1], bdtScore[2]); + } + + if (candDstarMcRec.isSelDstarToD0Pi()) { // if all selection passed + float weightValue = 1.0; + if (useWeight && (hWeights.size() < 1 || hWeights[0] == nullptr)) { + LOGF(fatal, "Weight histograms are not initialized or empty. Check CCDB path or weight file."); + return; + } else if (useWeight && isCentStudy) { + for (int ithWeight = 0; ithWeight < nWeights; ++ithWeight) { + if (centrality > centRangesForWeights.value[ithWeight] && centrality <= centRangesForWeights.value[ithWeight + 1]) { + weightValue = hWeights[ithWeight]->GetBinContent(hWeights[ithWeight]->FindBin(nPVContributors)); + break; + } } } - } else if (candDstarMcRec.originMcRec() == RecoDecay::OriginType::NonPrompt) { // only non-prompt signal at reconstruction level - registry.fill(HIST("QA/hPtVsYSkimNonPromptDstarRecSig"), ptDstarRecSig, yDstarRecSig); - if (candDstarMcRec.isRecoTopol()) { // if Topological selection are passed - registry.fill(HIST("QA/hPtVsYRecoTopolNonPromptDstarRecSig"), ptDstarRecSig, yDstarRecSig); - } - if (candDstarMcRec.isRecoPid()) { // if PID selection is passed - registry.fill(HIST("QA/hPtVsYRecoPidNonPromptDstarRecSig"), ptDstarRecSig, yDstarRecSig); + if (qaEnabled) { + registry.fill(HIST("QA/hPtFullRecoDstarRecSig"), ptDstarRecSig); } - if (candDstarMcRec.isSelDstarToD0Pi()) { // if all selection passed - registry.fill(HIST("QA/hPtFullRecoNonPromptDstarRecSig"), ptDstarRecSig); - if constexpr (applyMl) { + + if constexpr (applyMl) { // All efficiency histograms at reconstruction level w/ ml + if (isCentStudy) { auto bdtScore = candDstarMcRec.mlProbDstarToD0Pi(); - registry.fill(HIST("Efficiency/hPtNonPromptVsCentVsBDTScore"), ptDstarRecSig, centrality, bdtScore[0], bdtScore[1], bdtScore[2]); + registry.fill(HIST("Efficiency/hPtVsCentVsBDTScoreVsPvContribRecSig"), ptDstarRecSig, centrality, bdtScore[0], bdtScore[1], bdtScore[2], nPVContributors, weightValue); + if (candDstarMcRec.originMcRec() == RecoDecay::OriginType::Prompt) { + registry.fill(HIST("Efficiency/hPtPromptVsCentVsBDTScorePvContribRecSig"), ptDstarRecSig, centrality, bdtScore[0], bdtScore[1], bdtScore[2], nPVContributors, weightValue); + } else if (candDstarMcRec.originMcRec() == RecoDecay::OriginType::NonPrompt) { + registry.fill(HIST("Efficiency/hPtNonPrompRectVsCentVsBDTScorePvContribRecSig"), ptDstarRecSig, centrality, bdtScore[0], bdtScore[1], bdtScore[2], nPVContributors, weightValue); + } + } else { + auto bdtScore = candDstarMcRec.mlProbDstarToD0Pi(); + registry.fill(HIST("Efficiency/hPtVsBDTScoreRecSig"), ptDstarRecSig, bdtScore[0], bdtScore[1], bdtScore[2], weightValue); + if (candDstarMcRec.originMcRec() == RecoDecay::OriginType::Prompt) { + registry.fill(HIST("Efficiency/hPtPromptVsBDTScoreRecSig"), ptDstarRecSig, bdtScore[0], bdtScore[1], bdtScore[2], weightValue); + } else if (candDstarMcRec.originMcRec() == RecoDecay::OriginType::NonPrompt) { + registry.fill(HIST("Efficiency/hPtNonPromptVsBDTScoreRecSig"), ptDstarRecSig, bdtScore[0], bdtScore[1], bdtScore[2], weightValue); + } + } + } else { // All efficiency histograms at reconstruction level w/o ml + if (isCentStudy) { + registry.fill(HIST("Efficiency/hPtVsCentVsPvContribRecSig"), ptDstarRecSig, centrality, nPVContributors, weightValue); + if (candDstarMcRec.originMcRec() == RecoDecay::OriginType::Prompt) { + registry.fill(HIST("Efficiency/hPtPromptVsCentVsPvContribRecSig"), ptDstarRecSig, centrality, nPVContributors, weightValue); + } else if (candDstarMcRec.originMcRec() == RecoDecay::OriginType::NonPrompt) { + registry.fill(HIST("Efficiency/hPtNonPromptVsCentVsPvContribRecSig"), ptDstarRecSig, centrality, nPVContributors, weightValue); + } + } else { + registry.fill(HIST("Efficiency/hPtVsPvContribRecSig"), ptDstarRecSig, nPVContributors, weightValue); + if (candDstarMcRec.originMcRec() == RecoDecay::OriginType::Prompt) { + registry.fill(HIST("Efficiency/hPtPromptVsPvContribRecSig"), ptDstarRecSig, nPVContributors, weightValue); + } else if (candDstarMcRec.originMcRec() == RecoDecay::OriginType::NonPrompt) { + registry.fill(HIST("Efficiency/hPtNonPromptVsPvContribRecSig"), ptDstarRecSig, nPVContributors, weightValue); + } + } + } + } + if (qaEnabled) { + registry.fill(HIST("QA/hCPASkimD0RecSig"), candDstarMcRec.cpaD0()); + registry.fill(HIST("QA/hEtaSkimD0RecSig"), candDstarMcRec.etaD0()); + registry.fill(HIST("QA/hEtaSkimDstarRecSig"), candDstarMcRec.eta()); + + // only prompt signal at reconstruction level + if (candDstarMcRec.originMcRec() == RecoDecay::OriginType::Prompt) { + registry.fill(HIST("QA/hPtVsYSkimPromptDstarRecSig"), ptDstarRecSig, yDstarRecSig); // Skimed at level of trackIndexSkimCreator + if (candDstarMcRec.isRecoTopol()) { // if Topological selection are passed + registry.fill(HIST("QA/hPtVsYRecoTopolPromptDstarRecSig"), ptDstarRecSig, yDstarRecSig); + } + if (candDstarMcRec.isRecoPid()) { // if PID selection is passed + registry.fill(HIST("QA/hPtVsYRecoPidPromptDstarRecSig"), ptDstarRecSig, yDstarRecSig); + } + if (candDstarMcRec.isSelDstarToD0Pi()) { // if all selection passed + registry.fill(HIST("QA/hPtFullRecoPromptDstarRecSig"), ptDstarRecSig); + } + } else if (candDstarMcRec.originMcRec() == RecoDecay::OriginType::NonPrompt) { // only non-prompt signal at reconstruction level + registry.fill(HIST("QA/hPtVsYSkimNonPromptDstarRecSig"), ptDstarRecSig, yDstarRecSig); + if (candDstarMcRec.isRecoTopol()) { // if Topological selection are passed + registry.fill(HIST("QA/hPtVsYRecoTopolNonPromptDstarRecSig"), ptDstarRecSig, yDstarRecSig); + } + if (candDstarMcRec.isRecoPid()) { // if PID selection is passed + registry.fill(HIST("QA/hPtVsYRecoPidNonPromptDstarRecSig"), ptDstarRecSig, yDstarRecSig); + } + if (candDstarMcRec.isSelDstarToD0Pi()) { // if all selection passed + registry.fill(HIST("QA/hPtFullRecoNonPromptDstarRecSig"), ptDstarRecSig); } } } } else { // MC Unmatched (Baground at Reconstruction Level) - registry.fill(HIST("QA/hCPASkimD0RecBg"), candDstarMcRec.cpaD0()); - registry.fill(HIST("QA/hEtaSkimD0RecBg"), candDstarMcRec.etaD0()); - registry.fill(HIST("QA/hEtaSkimDstarRecBg"), candDstarMcRec.eta()); - if (candDstarMcRec.isSelDstarToD0Pi()) { - registry.fill(HIST("QA/hPtSkimDstarRecBg"), candDstarMcRec.pt()); + if (qaEnabled) { + registry.fill(HIST("QA/hCPASkimD0RecBg"), candDstarMcRec.cpaD0()); + registry.fill(HIST("QA/hEtaSkimD0RecBg"), candDstarMcRec.etaD0()); + registry.fill(HIST("QA/hEtaSkimDstarRecBg"), candDstarMcRec.eta()); + if (candDstarMcRec.isSelDstarToD0Pi()) { + registry.fill(HIST("QA/hPtSkimDstarRecBg"), candDstarMcRec.pt()); + } } } } // candidate loop ends @@ -411,16 +565,24 @@ struct HfTaskDstarToD0Pi { if (yCandDstarGenMax >= 0. && std::abs(yGen) > yCandDstarGenMax) { continue; } + auto mcCollision = mcParticle.template mcCollision_as(); auto recCollisions = collisions.sliceBy(colsPerMcCollision, mcCollision.globalIndex()); - // looking if a generated collision reconstructed more than a times. - if (recCollisions.size() > 1) { - for (const auto& [c1, c2] : combinations(CombinationsStrictlyUpperIndexPolicy(recCollisions, recCollisions))) { - auto deltaCent = std::abs(c1.centFT0M() - c2.centFT0M()); - registry.fill(HIST("QA/hDeltaCentGen"), deltaCent); + if (qaEnabled) { + registry.fill(HIST("QA/hEtaDstarGen"), mcParticle.eta()); + registry.fill(HIST("QA/hPtDstarGen"), ptGen); + + // looking if a generated collision reconstructed more than a times. + if (recCollisions.size() > 1) { + for (const auto& [c1, c2] : combinations(CombinationsStrictlyUpperIndexPolicy(recCollisions, recCollisions))) { + auto deltaCent = std::abs(c1.centFT0M() - c2.centFT0M()); + registry.fill(HIST("QA/hDeltaCentGen"), deltaCent); + } } } + float centFT0MGen; + float pvContributors; // assigning centrality to MC Collision using max FT0M amplitute from Reconstructed collisions if (recCollisions.size()) { std::vector::iterator, int>> tempRecCols; @@ -429,20 +591,49 @@ struct HfTaskDstarToD0Pi { } std::sort(tempRecCols.begin(), tempRecCols.end(), compare); centFT0MGen = tempRecCols.at(0).first.centFT0M(); + pvContributors = tempRecCols.at(0).second; } else { centFT0MGen = -999.; + pvContributors = -999.; + } + + float weightValue = 1.0; + if (useWeight && (hWeights.size() < 1 || hWeights[0] == nullptr)) { + LOGF(fatal, "Weight histograms are not initialized or empty. Check CCDB path or weight file."); + return; + } else if (useWeight && isCentStudy) { + for (int ithWeight = 0; ithWeight < nWeights; ++ithWeight) { + if (centFT0MGen > centRangesForWeights.value[ithWeight] && centFT0MGen <= centRangesForWeights.value[ithWeight + 1]) { + weightValue = hWeights[ithWeight]->GetBinContent(hWeights[ithWeight]->FindBin(centFT0MGen, pvContributors)); + break; + } + } + } + + registry.fill(HIST("Efficiency/hPtVsYDstarGen"), ptGen, yGen, weightValue); + if (isCentStudy) { + registry.fill(HIST("Efficiency/hPtVsCentVsPvContribGen"), ptGen, centFT0MGen, pvContributors, weightValue); + } else { + registry.fill(HIST("Efficiency/hPtGen"), ptGen, weightValue); } - registry.fill(HIST("QA/hEtaDstarGen"), mcParticle.eta()); - registry.fill(HIST("QA/hPtDstarGen"), ptGen); - registry.fill(HIST("QA/hPtVsYDstarGen"), ptGen, yGen); - registry.fill(HIST("Efficiency/hPtVsCentDstarGen"), ptGen, centFT0MGen); - // only promt Dstar candidate at Generator level + + // Prompt if (mcParticle.originMcGen() == RecoDecay::OriginType::Prompt) { - registry.fill(HIST("QA/hPtPromptDstarGen"), ptGen); - registry.fill(HIST("QA/hPtVsYPromptDstarGen"), ptGen, yGen); - } else if (mcParticle.originMcGen() == RecoDecay::OriginType::NonPrompt) { // only non-prompt Dstar candidate at Generator level - registry.fill(HIST("QA/hPtNonPromptDstarGen"), ptGen); - registry.fill(HIST("QA/hPtVsYNonPromptDstarGen"), ptGen, yGen); + registry.fill(HIST("Efficiency/hPtVsYPromptDstarGen"), ptGen, yGen, weightValue); + if (isCentStudy) { + registry.fill(HIST("Efficiency/hPtPromptVsCentVsPvContribGen"), ptGen, centFT0MGen, pvContributors, weightValue); + } else { + registry.fill(HIST("Efficiency/hPtPromptVsGen"), ptGen, weightValue); + } + // Non-Prompt + } else if (mcParticle.originMcGen() == RecoDecay::OriginType::NonPrompt) { + registry.fill(HIST("Efficiency/hPtVsYNonPromptDstarGen"), ptGen, yGen, weightValue); + if (isCentStudy) { + registry.fill(HIST("Efficiency/hPtNonPromptVsCentVsPvContribGen"), ptGen, centFT0MGen, pvContributors, weightValue); + + } else { + registry.fill(HIST("Efficiency/hPtNonPromptVsGen"), ptGen, weightValue); + } } } } // MC Particle loop ends From 7c3aad15253a528db663f6f88f4c3e9c855b45cf Mon Sep 17 00:00:00 2001 From: AlexianL <123153896+AlexianL@users.noreply.github.com> Date: Thu, 7 Aug 2025 13:03:10 +0200 Subject: [PATCH 278/345] [PWGHF] taskFlow.cxx: Add the use of reassociated MFT tracks for same event (#12327) --- PWGHF/HFC/Tasks/taskFlow.cxx | 680 +++++++++++++++++++++++++++++------ 1 file changed, 575 insertions(+), 105 deletions(-) diff --git a/PWGHF/HFC/Tasks/taskFlow.cxx b/PWGHF/HFC/Tasks/taskFlow.cxx index 6f6870c49fc..b3813942454 100644 --- a/PWGHF/HFC/Tasks/taskFlow.cxx +++ b/PWGHF/HFC/Tasks/taskFlow.cxx @@ -63,6 +63,29 @@ using namespace o2::constants::math; using namespace o2::framework; using namespace o2::framework::expressions; +enum MftTrackSelectionStep { + NoSelection = 0, + Eta, + Cluster, + NMftTrackSelectionSteps +}; + +enum MftTrackAmbiguityStep { + AllMftTracks = 0, + AfterTrackSelection, + NumberOfAmbiguousTracks, + NumberOfNonAmbiguousTracks, + NMftAmbiguitySteps +}; + +enum EventSelectionStep { + AllEvents = 0, + AfterEventSelection, + NEventSelectionSteps +}; + +// static constexpr float kPairCutDefaults[1][5] = {{-1, -1, -1, -1, -1}}; + struct HfTaskFlow { // configurables for processing options @@ -70,11 +93,13 @@ struct HfTaskFlow { Configurable centralityBinsForMc{"centralityBinsForMc", false, "false = OFF, true = ON for data like multiplicity/centrality bins for MC steps"}; Configurable mftMaxDCAxy{"mftMaxDCAxy", 2.0f, "Cut on dcaXY for MFT tracks"}; Configurable doReferenceFlow{"doReferenceFlow", false, "Flag to know if reference flow should be done"}; + // Configurable doTwoTrackCut{"doTwoTrackCut", -1, "Two track cut: -1 = off; >0 otherwise distance value (suggested: 0.02)"}; Configurable processRun2{"processRun2", false, "Flag to run on Run 2 data"}; Configurable processRun3{"processRun3", true, "Flag to run on Run 3 data"}; Configurable processMc{"processMc", false, "Flag to run on MC"}; Configurable nMixedEvents{"nMixedEvents", 5, "Number of mixed events per event"}; - // configurables for collisions + // Configurable twoTrackCutMinRadius{"twoTrackCutMinRadius", 0.8f, "Two track cut : radius in m from which two tracks cuts are applied"}; + // configurables for collisions Configurable zVertexMax{"zVertexMax", 7.0f, "Accepted z-vertex range"}; // configurables for TPC tracks Configurable etaTpcTrackMax{"etaTpcTrackMax", 0.8f, "max. eta of TPC tracks"}; @@ -97,6 +122,7 @@ struct HfTaskFlow { HfHelper hfHelper; SliceCache cache; Service pdg; + // Service ccdb; std::vector hfIndexCache; // ========================= @@ -106,8 +132,11 @@ struct HfTaskFlow { using FilteredCollisionsWSelMult = soa::Filtered>; using HfCandidatesSelD0 = soa::Filtered>; using HfCandidatesSelLc = soa::Filtered>; - // using FilteredMftTracksWColls = soa::Filtered>; - using FilteredMftTracksWColls = soa::Filtered; + + // using FilteredMftTracks = soa::Filtered; + // using FilteredMftTracksWColls = soa::Filtered>; + // using FilteredAndReassociatedMftTracks = soa::Filtered>; + using FilteredTracksWDcaSel = soa::Filtered>; // ========================= @@ -126,7 +155,7 @@ struct HfTaskFlow { using McParticles2ProngMatched = soa::Join; using McParticles3ProngMatched = soa::Join; // using FilteredMftTracksWCollsMcLabels = soa::Filtered>; - using FilteredMftTracksWCollsMcLabels = soa::Filtered>; + using MftTracksMcLabels = soa::Join; using FilteredTracksWDcaSelMC = soa::Filtered>; // ========================= @@ -149,12 +178,12 @@ struct HfTaskFlow { (aod::track::pt > ptTpcTrackMin) && requireGlobalTrackWoPtEtaInFilter(); - Filter mftTrackEtaFilter = (aod::fwdtrack::eta < etaMftTrackMax) && - (aod::fwdtrack::eta > etaMftTrackMin); + // Filter mftTrackEtaFilter = (aod::fwdtrack::eta < etaMftTrackMax) && + // (aod::fwdtrack::eta > etaMftTrackMin); - Filter mftTrackCollisionIdFilter = (aod::fwdtrack::bestCollisionId >= 0); - - Filter mftTrackDcaFilter = (nabs(aod::fwdtrack::bestDCAXY) < mftMaxDCAxy); + // Filters below will be used for uncertainties + // Filter mftTrackCollisionIdFilter = (aod::fwdtrack::bestCollisionId >= 0); + // Filter mftTrackDcaFilter = (nabs(aod::fwdtrack::bestDCAXY) < mftMaxDCAxy); // ========================= // Filters & partitions : MC @@ -185,13 +214,13 @@ struct HfTaskFlow { // Preslice : DATA // ========================= - // Preslice dataPerCol = aod::track::collisionId; + Preslice perCol = o2::aod::fwdtrack::collisionId; // ========================= // Preslice : MC // ========================= - Preslice mftTracksPerCollision = aod::fwdtrack::collisionId; + Preslice mftTracksPerCollision = aod::fwdtrack::collisionId; // Preslice d0CandidatesPerCollision = aod::hf_cand::collisionId; // Preslice mcPerCol = aod::mcparticle::mcCollisionId; // PresliceUnsorted collisionsMcLabelPerMcCollision = aod::mccollisionlabel::mcCollisionId; @@ -234,23 +263,46 @@ struct HfTaskFlow { // ========================= void init(InitContext&) { + const int nBinsMix = axisMultiplicity->size() * axisVertex->size(); + // ========================= // Event histograms // TO-DO : do i have to separate event histograms between DATA and MC ? // ========================= - constexpr int kNBinsEvents = 2; - registry.add("Data/hEventCounter", "hEventCounter", {HistType::kTH1F, {{kNBinsEvents, 0.5, 0.5 + kNBinsEvents}}}); - // set axes of the event counter histogram - std::string labels[kNBinsEvents]; - labels[0] = "all"; - labels[1] = "after Physics selection"; - const int nBinsMix = axisMultiplicity->size() * 14; // 14 bins for z-vertex + registry.add("Data/hEventCounter", "hEventCounter", {HistType::kTH1D, {{EventSelectionStep::NEventSelectionSteps, -0.5, +EventSelectionStep::NEventSelectionSteps - 0.5}}}); + std::string labels[EventSelectionStep::NEventSelectionSteps]; + labels[EventSelectionStep::AllEvents] = "all"; + labels[EventSelectionStep::AfterEventSelection] = "after Physics selection"; + registry.get(HIST("Data/hEventCounter"))->SetMinimum(0); - for (int iBin = 0; iBin < kNBinsEvents; iBin++) { + for (int iBin = 0; iBin < EventSelectionStep::NEventSelectionSteps; iBin++) { registry.get(HIST("Data/hEventCounter"))->GetXaxis()->SetBinLabel(iBin + 1, labels[iBin].data()); } + registry.add("Data/TpcMft/hAmbiguityOfMftTracks", "hAmbiguityOfMftTracks", {HistType::kTH1D, {{MftTrackAmbiguityStep::NMftAmbiguitySteps, -0.5, +MftTrackAmbiguityStep::NMftAmbiguitySteps - 0.5}}}); + std::string labelsAmbiguityOfMftTracks[MftTrackAmbiguityStep::NMftAmbiguitySteps]; + labelsAmbiguityOfMftTracks[MftTrackAmbiguityStep::AllMftTracks] = "all MFT tracks"; + labelsAmbiguityOfMftTracks[MftTrackAmbiguityStep::AfterTrackSelection] = "MFT tracks after selection"; + labelsAmbiguityOfMftTracks[MftTrackAmbiguityStep::NumberOfAmbiguousTracks] = "how much tracks are ambigous"; + labelsAmbiguityOfMftTracks[MftTrackAmbiguityStep::NumberOfNonAmbiguousTracks] = "how much tracks are non-ambiguous"; + registry.get(HIST("Data/TpcMft/hAmbiguityOfMftTracks"))->SetMinimum(0); + + for (int iBin = 0; iBin < NMftAmbiguitySteps; iBin++) { + registry.get(HIST("Data/TpcMft/hAmbiguityOfMftTracks"))->GetXaxis()->SetBinLabel(iBin + 1, labelsAmbiguityOfMftTracks[iBin].data()); + } + + registry.add("Data/TpcMft/hMftTracksSelection", "hMftTracksSelection", {HistType::kTH1D, {{MftTrackSelectionStep::NMftTrackSelectionSteps, -0.5, +MftTrackSelectionStep::NMftTrackSelectionSteps - 0.5}}}); + std::string labelsMftTracksSelection[MftTrackSelectionStep::NMftTrackSelectionSteps]; + labelsMftTracksSelection[MftTrackSelectionStep::NoSelection] = "all MFT tracks"; + labelsMftTracksSelection[MftTrackSelectionStep::Eta] = "MFT tracks after eta selection"; + labelsMftTracksSelection[MftTrackSelectionStep::Cluster] = "MFT tracks after clusters selection"; + registry.get(HIST("Data/TpcMft/hMftTracksSelection"))->SetMinimum(0); + + for (int iBin = 0; iBin < MftTrackSelectionStep::NMftTrackSelectionSteps; iBin++) { + registry.get(HIST("Data/TpcMft/hMftTracksSelection"))->GetXaxis()->SetBinLabel(iBin + 1, labelsMftTracksSelection[iBin].data()); + } + // ========================= // DATA : histograms for TPC-TPC h-h case // ========================= @@ -258,12 +310,12 @@ struct HfTaskFlow { // DATA : event histograms for TPC-TPC h-h same event registry.add("Data/TpcTpc/HadronHadron/SameEvent/hMultiplicity", "hMultiplicity", {HistType::kTH1F, {axisMultiplicity}}); registry.add("Data/TpcTpc/HadronHadron/SameEvent/hVtxZ", "hVtxZ", {HistType::kTH1F, {axisVertex}}); - registry.add("Data/TpcTpc/HadronHadron/SameEvent/hEventCountSame", "bin", {HistType::kTH1F, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); + registry.add("Data/TpcTpc/HadronHadron/SameEvent/hEventCountSame", "bin", {HistType::kTH1D, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); // DATA : associated particles histograms for TPC-TPC h-h same event registry.add("Data/TpcTpc/HadronHadron/SameEvent/hPt", "pT", {HistType::kTH1F, {axisPt}}); - registry.add("Data/TpcTpc/HadronHadron/SameEvent/hEta", "eta", {HistType::kTH1F, {axisEtaTpc}}); - registry.add("Data/TpcTpc/HadronHadron/SameEvent/hPhi", "phi", {HistType::kTH1F, {axisPhi}}); + registry.add("Data/TpcTpc/HadronHadron/SameEvent/hEta", "eta", {HistType::kTH1D, {axisEtaTpc}}); + registry.add("Data/TpcTpc/HadronHadron/SameEvent/hPhi", "phi", {HistType::kTH1D, {axisPhi}}); registry.add("Data/TpcTpc/HadronHadron/SameEvent/hYields", "multiplicity vs pT vs eta", {HistType::kTH3F, {axisMultiplicity, axisPt, axisEtaTpc}}); registry.add("Data/TpcTpc/HadronHadron/SameEvent/hEtaPhi", "multiplicity vs eta vs phi", {HistType::kTH3F, {axisMultiplicity, axisEtaTpc, axisPhi}}); @@ -271,7 +323,7 @@ struct HfTaskFlow { registry.add("Data/TpcTpc/HadronHadron/SameEvent/hVzEta", "eta vs. Vz", {HistType::kTH2F, {axisEtaTpc, axisVertex}}); // DATA : event mixing histograms for TPC-TPC h-h mixed event - registry.add("Data/TpcTpc/HadronHadron/MixedEvent/hEventCountMixing", "bin", {HistType::kTH1F, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); + registry.add("Data/TpcTpc/HadronHadron/MixedEvent/hEventCountMixing", "bin", {HistType::kTH1D, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); // ========================= // DATA : histograms for TPC-TPC HF-h case for 2PRONG @@ -279,16 +331,16 @@ struct HfTaskFlow { // DATA : event histograms for TPC-TPC HF-h same event registry.add("Data/TpcTpc/HfHadron/SameEvent/hPt", "pT", {HistType::kTH1F, {axisPt}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/hEta", "eta", {HistType::kTH1F, {axisEtaTpc}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/hPhi", "phi", {HistType::kTH1F, {axisPhi}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/hEta", "eta", {HistType::kTH1D, {axisEtaTpc}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/hPhi", "phi", {HistType::kTH1D, {axisPhi}}); registry.add("Data/TpcTpc/HfHadron/SameEvent/hYields", "multiplicity vs pT vs eta", {HistType::kTH3F, {axisMultiplicity, axisPt, axisEtaTpc}}); registry.add("Data/TpcTpc/HfHadron/SameEvent/hEtaPhi", "multiplicity vs eta vs phi", {HistType::kTH3F, {axisMultiplicity, axisEtaTpc, axisPhi}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hEventCountSame", "bin", {HistType::kTH1F, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hEta", "eta", {HistType::kTH1F, {axisEtaTpc}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hPhi", "phi", {HistType::kTH1F, {axisPhi}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hEventCountSame", "bin", {HistType::kTH1D, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hEta", "eta", {HistType::kTH1D, {axisEtaTpc}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hPhi", "phi", {HistType::kTH1D, {axisPhi}}); registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hMultiplicity", "multiplicity;multiplicity;entries", {HistType::kTH1F, {axisMultiplicity}}); - registry.add("Data/TpcTpc/HfHadron/MixedEvent/hEventCountHFMixing", "bin", {HistType::kTH1F, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); + registry.add("Data/TpcTpc/HfHadron/MixedEvent/hEventCountHFMixing", "bin", {HistType::kTH1D, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); // DATA : trigger particles (candidates) histograms for TPC-TPC D0-h same event registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hPtCandidate", "2-prong candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPt}}); @@ -296,7 +348,7 @@ struct HfTaskFlow { registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hPtProng1", "2-prong candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPt}}); registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hMassVsPt", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {axisMass, axisPt}}); registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hMassVsPtVsMult", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2}); p_{T}; multiplicity", {HistType::kTH3F, {axisMass, axisPt, axisMultiplicity}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hMass", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {axisMass}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hMass", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH1D, {axisMass}}); registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hEtaCandVsPt", "2-prong candidates;candidate #it{#eta};entries", {HistType::kTH2F, {axisEtaTpc, axisPt}}); registry.add("Data/TpcTpc/HfHadron/SameEvent/2Prong/hSelectionStatus", "2-prong candidates;selection status;entries", {HistType::kTH2F, {{5, -0.5, 4.5}, axisPt}}); @@ -304,17 +356,17 @@ struct HfTaskFlow { // DATA : histograms for TPC-TPC HF-h case for 3PRONG // =================== - registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hEventCountSame", "bin", {HistType::kTH1F, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hEventCountSame", "bin", {HistType::kTH1D, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hMassVsPt", "3-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {axisMass, axisPt}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hMass", "3-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {axisMass}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hMass", "3-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH1D, {axisMass}}); registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hMassVsPtVsMult", "3-prong candidates;inv. mass (p K #pi) (GeV/#it{c}^{2}); p_{T}; multiplicity", {HistType::kTH3F, {axisMass, axisPt, axisMultiplicity}}); registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hMultiplicity", "multiplicity;multiplicity;entries", {HistType::kTH1F, {axisMultiplicity}}); registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hPt", "3-prong candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPt}}); registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hPtProng0", "3-prong candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPt}}); registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hPtProng1", "3-prong candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPt}}); registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hPtProng2", "3-prong candidates;prong 2 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPt}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hEta", "3-prong candidates;#it{#eta};entries", {HistType::kTH1F, {axisEtaTpc}}); - registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hPhi", "3-prong candidates;#it{#Phi};entries", {HistType::kTH1F, {axisPhi}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hEta", "3-prong candidates;#it{#eta};entries", {HistType::kTH1D, {axisEtaTpc}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hPhi", "3-prong candidates;#it{#Phi};entries", {HistType::kTH1D, {axisPhi}}); registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hEtaVsPt", "3-prong candidates;candidate #it{#eta};entries", {HistType::kTH2F, {axisEtaTpc, axisPt}}); registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hPhiVsPt", "3-prong candidates;candidate #it{#Phi};entries", {HistType::kTH2F, {axisPhi, axisPt}}); registry.add("Data/TpcTpc/HfHadron/SameEvent/3Prong/hSelectionStatus", "3-prong candidates;selection status;entries", {HistType::kTH2F, {{5, -0.5, 4.5}, axisPt}}); @@ -324,34 +376,34 @@ struct HfTaskFlow { // ========================= // DATA : trigger particles (TPC tracks) histograms for TPC-MFT h-h same event - registry.add("Data/TpcMft/HadronHadron/SameEvent/hEventCountSame", "bin", {HistType::kTH1F, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); + registry.add("Data/TpcMft/HadronHadron/SameEvent/hEventCountSame", "bin", {HistType::kTH1D, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); registry.add("Data/TpcMft/HadronHadron/SameEvent/hEtaPhiTPC", "multiplicity vs eta vs phi in TPC", {HistType::kTH3F, {axisMultiplicity, axisEtaTpc, axisPhi}}); - registry.add("Data/TpcMft/HadronHadron/SameEvent/hEtaTPC", "etaTPC", {HistType::kTH1F, {axisEtaTpc}}); - registry.add("Data/TpcMft/HadronHadron/SameEvent/hPhiTPC", "phiTPC", {HistType::kTH1F, {axisPhi}}); + registry.add("Data/TpcMft/HadronHadron/SameEvent/hEtaTPC", "etaTPC", {HistType::kTH1D, {axisEtaTpc}}); + registry.add("Data/TpcMft/HadronHadron/SameEvent/hPhiTPC", "phiTPC", {HistType::kTH1D, {axisPhi}}); registry.add("Data/TpcMft/HadronHadron/SameEvent/hPtTPC", "pT", {HistType::kTH1F, {axisPt}}); registry.add("Data/TpcMft/HadronHadron/SameEvent/hYieldsTPC", "multiplicity vs pT vs eta", {HistType::kTH3F, {axisMultiplicity, axisPt, axisEtaTpc}}); registry.add("Data/TpcMft/HadronHadron/SameEvent/hMultiplicityTPC", "multiplicity;multiplicity;entries", {HistType::kTH1F, {axisMultiplicity}}); // DATA : associated particles (MFT tracks) histograms for TPC-MFT h-h same event registry.add("Data/TpcMft/HadronHadron/SameEvent/hEtaPhiMFT", "multiplicity vs eta vs phi in MFT", {HistType::kTH3F, {axisMultiplicity, axisEtaMft, axisPhi}}); - registry.add("Data/TpcMft/HadronHadron/SameEvent/hEtaMFT", "etaMFT", {HistType::kTH1F, {axisEtaMft}}); - registry.add("Data/TpcMft/HadronHadron/SameEvent/hPhiMFT", "phiMFT", {HistType::kTH1F, {axisPhi}}); + registry.add("Data/TpcMft/HadronHadron/SameEvent/hEtaMFT", "etaMFT", {HistType::kTH1D, {axisEtaMft}}); + registry.add("Data/TpcMft/HadronHadron/SameEvent/hPhiMFT", "phiMFT", {HistType::kTH1D, {axisPhi}}); registry.add("Data/TpcMft/HadronHadron/SameEvent/hPtMFT", "pT", {HistType::kTH1F, {axisPt}}); registry.add("Data/TpcMft/HadronHadron/SameEvent/hYieldsMFT", "multiplicity vs pT vs eta", {HistType::kTH3F, {axisMultiplicity, axisPt, axisEtaMft}}); // DATA : histograms for TPC-MFT h-h event mixing for events QA - registry.add("Data/TpcMft/HadronHadron/MixedEvent/hEventCountMixing", "bin", {HistType::kTH1F, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); + registry.add("Data/TpcMft/HadronHadron/MixedEvent/hEventCountMixing", "bin", {HistType::kTH1D, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); // ========================= // DATA : histograms for TPC-MFT HF-h case FOR 2PRONG // ========================= // DATA : trigger particles (candidates) histograms for TPC-MFT HF-h same event - registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hEventCountSame", "bin", {HistType::kTH1F, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hEventCountSame", "bin", {HistType::kTH1D, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hEtaPhiCandidate", "multiplicity vs eta vs phi in TPC", {HistType::kTH3F, {axisMultiplicity, axisEtaMft, axisPhi}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hEtaCandidate", "etaTPC", {HistType::kTH1F, {axisEtaMft}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hPhiCandidate", "phiTPC", {HistType::kTH1F, {axisPhi}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hYieldsCandidate", "multiplicity vs pT vs eta", {HistType::kTH3F, {axisMultiplicity, axisPt, axisEtaMft}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hEtaCandidate", "etaTPC", {HistType::kTH1D, {axisEtaTpc}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hPhiCandidate", "phiTPC", {HistType::kTH1D, {axisPhi}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hYieldsCandidate", "multiplicity vs pT vs eta", {HistType::kTH3F, {axisMultiplicity, axisPt, axisEtaTpc}}); registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hMultiplicityCandidate", "multiplicity;multiplicity;entries", {HistType::kTH1F, {axisMultiplicity}}); // DATA : trigger particles (candidates) histograms for TPC-MFT HF-h same event @@ -359,42 +411,55 @@ struct HfTaskFlow { registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hPtProng0", "2-prong candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPt}}); registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hPtProng1", "2-prong candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPt}}); registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hMassVsPt", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {axisMass, axisPt}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hMass", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {axisMass}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hMass", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH1D, {axisMass}}); registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hMassVsPtVsMult", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2}); p_{T}; multiplicity", {HistType::kTH3F, {axisMass, axisPt, axisMultiplicity}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hEtaCandVsPt", "2-prong candidates;candidate #it{#eta};entries", {HistType::kTH2F, {axisEtaMft, axisPt}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hEtaCandVsPt", "2-prong candidates;candidate #it{#eta};entries", {HistType::kTH2F, {axisEtaTpc, axisPt}}); registry.add("Data/TpcMft/HfHadron/SameEvent/2Prong/hSelectionStatus", "2-prong candidates;selection status;entries", {HistType::kTH2F, {{5, -0.5, 4.5}, axisPt}}); // DATA : associated particles (MFT tracks) histograms for TPC-MFT h-h same event registry.add("Data/TpcMft/HfHadron/SameEvent/hEtaPhiMFT", "multiplicity vs eta vs phi in MFT", {HistType::kTH3F, {axisMultiplicity, axisEtaMft, axisPhi}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/hEtaMFT", "etaMFT", {HistType::kTH1F, {axisEtaMft}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/hPhiMFT", "phiMFT", {HistType::kTH1F, {axisPhi}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/hEtaMFT", "etaMFT", {HistType::kTH1D, {axisEtaMft}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/hPhiMFT", "phiMFT", {HistType::kTH1D, {axisPhi}}); registry.add("Data/TpcMft/HfHadron/SameEvent/hPtMFT", "pT", {HistType::kTH1F, {axisPt}}); registry.add("Data/TpcMft/HfHadron/SameEvent/hYieldsMFT", "multiplicity vs pT vs eta", {HistType::kTH3F, {axisMultiplicity, axisPt, axisEtaMft}}); // DATA : histograms for TPC-MFT h-h event mixing for events QA - registry.add("Data/TpcMft/HfHadron/MixedEvent/hEventCountMixing", "bin", {HistType::kTH1F, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); + registry.add("Data/TpcMft/HfHadron/MixedEvent/hEventCountMixing", "bin", {HistType::kTH1D, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); // ========================= // DATA : histograms for TPC-MFT HF-h case FOR 3PRONG // ========================= - registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hEventCountSame", "bin", {HistType::kTH1F, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hYieldsCandidate", "multiplicity vs pT vs eta", {HistType::kTH3F, {axisMultiplicity, axisPt, axisEtaMft}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hEventCountSame", "bin", {HistType::kTH1D, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hYieldsCandidate", "multiplicity vs pT vs eta", {HistType::kTH3F, {axisMultiplicity, axisPt, axisEtaTpc}}); registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hMultiplicityCandidate", "multiplicity;multiplicity;entries", {HistType::kTH1F, {axisMultiplicity}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hEtaPhiCandidate", "multiplicity vs eta vs phi in TPC", {HistType::kTH3F, {axisMultiplicity, axisEtaMft, axisPhi}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hEtaPhiCandidate", "multiplicity vs eta vs phi in TPC", {HistType::kTH3F, {axisMultiplicity, axisEtaTpc, axisPhi}}); registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hMassVsPt", "3-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {axisMass, axisPt}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hMass", "3-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {axisMass}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hMass", "3-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH1D, {axisMass}}); registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hMassVsPtVsMult", "3-prong candidates;inv. mass (p K #pi) (GeV/#it{c}^{2}); p_{T}; multiplicity", {HistType::kTH3F, {axisMass, axisPt, axisMultiplicity}}); registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hPt", "3-prong candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPt}}); registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hPtProng0", "3-prong candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPt}}); registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hPtProng1", "3-prong candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPt}}); registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hPtProng2", "3-prong candidates;prong 2 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {axisPt}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hEta", "3-prong candidates;#it{#eta};entries", {HistType::kTH1F, {axisEtaMft}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hPhi", "3-prong candidates;#it{#Phi};entries", {HistType::kTH1F, {axisPhi}}); - registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hEtaVsPt", "3-prong candidates;candidate #it{#eta};entries", {HistType::kTH2F, {axisEtaMft, axisPt}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hEta", "3-prong candidates;#it{#eta};entries", {HistType::kTH1D, {axisEtaTpc}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hPhi", "3-prong candidates;#it{#Phi};entries", {HistType::kTH1D, {axisPhi}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hEtaVsPt", "3-prong candidates;candidate #it{#eta};entries", {HistType::kTH2F, {axisEtaTpc, axisPt}}); registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hPhiVsPt", "3-prong candidates;candidate #it{#Phi};entries", {HistType::kTH2F, {axisPhi, axisPt}}); registry.add("Data/TpcMft/HfHadron/SameEvent/3Prong/hSelectionStatus", "3-prong candidates;selection status;entries", {HistType::kTH2F, {{5, -0.5, 4.5}, axisPt}}); + // ========================= + // DATA : histograms for MFT reassociated distributions (to plot all MFT tracks, and only non-ambiguous MFT trakcs) + // ressociated tracks distribution can be found in the normal eta and phi distributions of each individual cases + // ========================= + + // All MFT tracks + registry.add("Data/TpcMft/kCFStepAll/hEta", "eta", {HistType::kTH1D, {axisEtaMft}}); + registry.add("Data/TpcMft/kCFStepAll/hPhi", "phi", {HistType::kTH1D, {axisPhi}}); + + // Only non-ambiguous MFT tracks + registry.add("Data/TpcMft/kCFStepTracked/hEta", "eta", {HistType::kTH1D, {axisEtaMft}}); + registry.add("Data/TpcMft/kCFStepTracked/hPhi", "phi", {HistType::kTH1D, {axisPhi}}); + // ========================= // MC : histograms for TPC-TPC h-h case // ========================= @@ -723,7 +788,7 @@ struct HfTaskFlow { bool isAcceptedCollision(TCollision const& collision, bool fillHistograms = false) { if (fillHistograms) { - registry.fill(HIST("Data/hEventCounter"), 1); + registry.fill(HIST("Data/hEventCounter"), EventSelectionStep::AllEvents); } if (processMc == false) { @@ -733,7 +798,7 @@ struct HfTaskFlow { } if (fillHistograms) { - registry.fill(HIST("Data/hEventCounter"), 2); + registry.fill(HIST("Data/hEventCounter"), EventSelectionStep::AfterEventSelection); } return true; @@ -775,23 +840,48 @@ struct HfTaskFlow { // I tried to put it as a filter, but filters for normal TPC tracks also apply to MFT tracks I think // and it seems that they are not compatible template - bool isAcceptedMftTrack(TTrack const& mftTrack) + bool isAcceptedMftTrack(TTrack const& mftTrack, bool fillHistograms) { // cut on the eta of MFT tracks - // if (mftTrack.eta() > etaMftTrackMax || mftTrack.eta() < etaMftTrackMin) { - // return false; - // } + if (mftTrack.eta() > etaMftTrackMax || mftTrack.eta() < etaMftTrackMin) { + return false; + } + + if (fillHistograms) { + registry.fill(HIST("Data/TpcMft/hMftTracksSelection"), MftTrackSelectionStep::Eta); + } // cut on the number of clusters of the reconstructed MFT track if (mftTrack.nClusters() < nClustersMftTrack) { return false; } + if (fillHistograms) { + registry.fill(HIST("Data/TpcMft/hMftTracksSelection"), MftTrackSelectionStep::Cluster); + } + return true; } + // Cut on ambiguous MFT tracks + template + bool isAmbiguousMftTrack(TTrack const& mftTrack, bool fillHistograms) + { + if (mftTrack.ambDegree() > 1) { + if (fillHistograms) { + registry.fill(HIST("Data/TpcMft/hAmbiguityOfMftTracks"), MftTrackAmbiguityStep::NumberOfAmbiguousTracks); + } + return true; + } + + if (fillHistograms) { + registry.fill(HIST("Data/TpcMft/hAmbiguityOfMftTracks"), MftTrackAmbiguityStep::NumberOfNonAmbiguousTracks); + } + return false; + } + // I am not sure if to template McParticles is useful, I'll address this when doing the MC Gen case of HF-h correlations - template + template bool isAcceptedMcCandidate(TMcTrack& mcCandidate) { auto etaCandidate = mcCandidate.eta(); @@ -870,8 +960,8 @@ struct HfTaskFlow { // fillCorrelations // =============================================================================================================================================================================== - template - void fillCorrelations(TTarget target, + template + void fillCorrelations(TTarget target, CorrelationContainer::CFStep step, TTracksTrig const& tracks1, TTracksAssoc const& tracks2, float multiplicity, float posZ, bool sameEvent) { @@ -919,7 +1009,7 @@ struct HfTaskFlow { // Selections for MC GENERATED if constexpr (std::is_same_v || std::is_same_v) { // TODO: Check how to put this into a Filter -> Pretty sure it cannot be a filter - if (!isAcceptedMcCandidate(track1)) { + if (!isAcceptedMcCandidate(track1)) { continue; } fillingHFcontainer = true; @@ -940,10 +1030,10 @@ struct HfTaskFlow { } // FILL QA PLOTS for trigger particle - if (sameEvent) { - if (processMc == false) { // If DATA - if constexpr (!std::is_same_v) { // IF TPC-TPC case - if constexpr (std::is_same_v) { // IF D0 CASE -> TPC-TPC D0-h + if (sameEvent && (step == CorrelationContainer::kCFStepReconstructed)) { + if (processMc == false) { // If DATA + if constexpr (!std::is_same_v) { // IF TPC-TPC case + if constexpr (std::is_same_v) { // IF D0 CASE -> TPC-TPC D0-h fillTpcTpcD0CandidateQa(multiplicity, track1); } else if constexpr (std::is_same_v) { // IF LC CASE -> TPC-TPC Lc-h fillTpcTpcLcCandidateQa(multiplicity, track1); @@ -960,8 +1050,8 @@ struct HfTaskFlow { } // end of if condition for TPC-TPC or TPC-MFT case } // Maybe I won't need it for MC (first files are way lighter in MC, but also I need to loop over all tracks in MC GEN) - } else { // If MC (add cases later) - if constexpr (!std::is_same_v) { // IF TPC-TPC case + } else { // If MC (add cases later) + if constexpr (!std::is_same_v) { // IF TPC-TPC case fillTpcTpcChChSameEventQaMc(multiplicity, track1); } } @@ -973,8 +1063,10 @@ struct HfTaskFlow { for (const auto& track2 : tracks2) { // apply cuts for MFT tracks - if constexpr (std::is_same_v) { - if (!isAcceptedMftTrack(track2)) { + if constexpr (std::is_same_v) { + registry.fill(HIST("Data/TpcMft/hMftTracksSelection"), MftTrackSelectionStep::NoSelection); + + if (!isAcceptedMftTrack(track2, true)) { continue; } } @@ -989,8 +1081,8 @@ struct HfTaskFlow { // in case of HF-h correlations, remove candidate daughters from the pool of associated hadrons // with which the candidate is being correlated (will not have to do it for TPC-MFT case) - if constexpr (!std::is_same_v) { // if NOT TPC-MFT case -> TPC-TPC case - if constexpr (std::is_same_v) { // Remove the 2 prong daughters + if constexpr (!std::is_same_v) { // if NOT TPC-MFT case -> TPC-TPC case + if constexpr (std::is_same_v) { // Remove the 2 prong daughters if ((track1.prong0Id() == track2.globalIndex()) || (track1.prong1Id() == track2.globalIndex())) { continue; } @@ -1010,6 +1102,10 @@ struct HfTaskFlow { } } + // if constexpr (std::is_same_v) { + // registry.fill(HIST("MC/Gen/TpcMft/HfHadron/SameEvent/hEtaMFT"), track2.eta()); + // } + float eta2 = track2.eta(); float pt2 = track2.pt(); float phi2 = track2.phi(); @@ -1023,6 +1119,7 @@ struct HfTaskFlow { // set range of delta phi in (-pi/2 , 3/2*pi) deltaPhi = RecoDecay::constrainAngle(deltaPhi, -PIHalf); + // IF EVERYTHING WORKS WITH THE REASSOCIATED MFT TRACKS, I WILL HAVE TO CHANGE HOW THOSE FUNCTIONS ARE FILLED TOO if (!fillingHFcontainer) { // fill pair correlations target->getPairHist()->Fill(step, eta1 - eta2, pt2, pt1, multiplicity, deltaPhi, posZ, @@ -1033,10 +1130,10 @@ struct HfTaskFlow { } // FILL QA PLOTS for associated particle - if (sameEvent && (loopCounter == 1)) { + if (sameEvent && (loopCounter == 1) && (step == CorrelationContainer::kCFStepReconstructed)) { // if constexpr (std::is_same_v) { // If DATA - if constexpr (!std::is_same_v) { // IF TPC-TPC case - if constexpr (std::is_same_v) { // IF D0 CASE -> TPC-TPC D0-h + if constexpr (!std::is_same_v) { // IF TPC-TPC case + if constexpr (std::is_same_v) { // IF D0 CASE -> TPC-TPC D0-h fillTpcTpcHfChSameEventQa(multiplicity, track2); } else if constexpr (std::is_same_v) { // IF LC CASE -> TPC-TPC Lc-h fillTpcTpcHfChSameEventQa(multiplicity, track2); @@ -1056,6 +1153,207 @@ struct HfTaskFlow { //} } + if (sameEvent && (loopCounter == 1)) { + // FILL USUAL MFT DISTRIBUTIONS + registry.fill(HIST("Data/TpcMft/kCFStepAll/hEta"), eta2); + registry.fill(HIST("Data/TpcMft/kCFStepAll/hPhi"), phi2); + } + + } // end of loop over tracks2 + } // end of loop over tracks 1 + } + + template + void fillCorrelationsReassociatedMftTracks(TTarget target, CorrelationContainer::CFStep step, + TTracksTrig const& tracks1, TTracksAssoc const& tracks2, + float multiplicity, float posZ, bool sameEvent, bool cutAmbiguousTracks) + { + auto triggerWeight = 1; + auto associatedWeight = 1; + + // To avoid filling associated tracks QA many times + // I fill it only for the first trigger track of the collision + auto loopCounter = 0; + + // + // TRIGGER PARTICLE + // + for (const auto& track1 : tracks1) { + + loopCounter++; + + float eta1 = track1.eta(); + float pt1 = track1.pt(); + float phi1 = track1.phi(); + o2::math_utils::bringTo02Pi(phi1); + + // TODO: add getter for NUE trigger efficiency here + + // calculating inv. mass to be filled into the container below + // Note: this is needed only in case of HF-hadron correlations + // TO DO ? Add one more if condition if its MC ? + bool fillingHFcontainer = false; + double invmass = 0; + if constexpr (std::is_same_v || std::is_same_v) { + // TODO: Check how to put this into a Filter -> Pretty sure it cannot be a filter + if (!isAcceptedCandidate(track1)) { + continue; + } + fillingHFcontainer = true; + if constexpr (std::is_same_v) { // If D0 + invmass = hfHelper.invMassD0ToPiK(track1); + // Should add D0 bar ? + } else { // If Lc + invmass = hfHelper.invMassLcToPKPi(track1); + // Should add Lc bar ? (maybe not its the same mass right ?) + } + } + + //// Selections for MC GENERATED + // if constexpr (std::is_same_v || std::is_same_v) { + // // TODO: Check how to put this into a Filter -> Pretty sure it cannot be a filter + // if (!isAcceptedMcCandidate(track1)) { + // continue; + // } + // fillingHFcontainer = true; + // if constexpr (std::is_same_v) { // If D0 + // invmass = o2::constants::physics::MassD0; + // // Should add D0 bar ? + // } else { // If Lc + // invmass = o2::constants::physics::MassLambdaCPlus; + // // Should add Lc bar ? (maybe not its the same mass right ?) + // } + // } + + // fill single-track distributions + if (!fillingHFcontainer) { // if not HF-h case + target->getTriggerHist()->Fill(step, pt1, multiplicity, posZ, triggerWeight); + } else { + target->getTriggerHist()->Fill(step, pt1, multiplicity, posZ, invmass, triggerWeight); + } + + // FILL QA PLOTS for trigger particle + if (sameEvent && (cutAmbiguousTracks == false)) { + if constexpr (std::is_same_v) { + fillTpcMftD0CandidateQa(multiplicity, track1); + } else if constexpr (std::is_same_v) { + fillTpcTpcLcCandidateQa(multiplicity, track1); + } else { + fillTpcMftChChSameEventQa(multiplicity, track1, true); + } + } + + // + // ASSOCIATED PARTICLE + // + for (const auto& track2 : tracks2) { + + // Fill QA plot for all MFT tracks () (only if cutAmbiguousTracks is false to avoid double counting) + if (!cutAmbiguousTracks) { + registry.fill(HIST("Data/TpcMft/hAmbiguityOfMftTracks"), MftTrackAmbiguityStep::AllMftTracks); + } + + // const auto& reassociatedMftTrack = track2.mfttrack(); + // No one uses const and auto& here, so I will follow + auto reassociatedMftTrack = track2.template mfttrack_as(); + + if (!isAcceptedMftTrack(reassociatedMftTrack, false)) { + continue; + } + + // Fill QA plot for MFT tracks after physical selection (eta + clusters) + if (!cutAmbiguousTracks) { + registry.fill(HIST("Data/TpcMft/hAmbiguityOfMftTracks"), MftTrackAmbiguityStep::AfterTrackSelection); + } + + // We check if the track is ambiguous or non-ambiguous (QA plots are filled in isAmbiguousMftTrack) + // Fill plots only if cutAmbiguousTracks is false (to avoid double counting) + if (isAmbiguousMftTrack(track2, !cutAmbiguousTracks)) { + // If the MFT track is ambiguous we may cut or not on the ambiguous track + if (cutAmbiguousTracks) { + continue; + } + } + + if (reassociatedMftTrack.collisionId() != track2.bestCollisionId()) { + // track.collision_as().posZ() + continue; + } + + // case of h-h correlations where the two types of tracks are the same + // this avoids autocorrelations and double counting of particle pairs + // if constexpr (std::is_same_v) { + // if (track1.index() <= reassociatedMftTrack.index()) { + // continue; + // } + //} + + // in case of HF-h correlations, remove candidate daughters from the pool of associated hadrons + // with which the candidate is being correlated (will not have to do it for TPC-MFT case) + if constexpr (std::is_same_v) { // Remove the 2 prong daughters + if ((track1.prong0Id() == reassociatedMftTrack.globalIndex()) || (track1.prong1Id() == reassociatedMftTrack.globalIndex())) { + continue; + } + } + if constexpr (std::is_same_v) { // Remove the 3 prong daughters + if ((track1.prong0Id() == reassociatedMftTrack.globalIndex()) || (track1.prong1Id() == reassociatedMftTrack.globalIndex()) || (track1.prong2Id() == reassociatedMftTrack.globalIndex())) { + continue; + } + } + + // in case of MC-generated, do additional selection on MCparticles : charge and isPhysicalPrimary + // if (processMc) { + if constexpr (std::is_same_v || std::is_same_v) { + if (!isAcceptedMftMcParticle(reassociatedMftTrack)) { + continue; + } + } + + // if constexpr (std::is_same_v) { + // registry.fill(HIST("MC/Gen/TpcMft/HfHadron/SameEvent/hEtaMFT"), reassociatedMftTrack.eta()); + // } + + float eta2 = reassociatedMftTrack.eta(); + float pt2 = reassociatedMftTrack.pt(); + float phi2 = reassociatedMftTrack.phi(); + o2::math_utils::bringTo02Pi(phi2); + + // TODO: add getter for NUE associated efficiency here + + // TODO: add pair cuts on phi* + + float deltaPhi = phi1 - phi2; + // set range of delta phi in (-pi/2 , 3/2*pi) + deltaPhi = RecoDecay::constrainAngle(deltaPhi, -PIHalf); + + // IF EVERYTHING WORKS WITH THE REASSOCIATED MFT TRACKS, I WILL HAVE TO CHANGE HOW THOSE FUNCTIONS ARE FILLED TOO + if (!fillingHFcontainer) { + // fill pair correlations + target->getPairHist()->Fill(step, eta1 - eta2, pt2, pt1, multiplicity, deltaPhi, posZ, + triggerWeight * associatedWeight); + } else { + target->getPairHist()->Fill(step, eta1 - eta2, pt2, pt1, multiplicity, deltaPhi, posZ, invmass, + triggerWeight * associatedWeight); + } + + // FILL QA PLOTS for associated particle + if (sameEvent && (loopCounter == 1) && (cutAmbiguousTracks == false)) { + if constexpr (std::is_same_v) { + fillTpcMftHfChSameEventQa(multiplicity, reassociatedMftTrack); + } else if constexpr (std::is_same_v) { + fillTpcMftHfChSameEventQa(multiplicity, reassociatedMftTrack); + } else { + fillTpcMftChChSameEventQa(multiplicity, reassociatedMftTrack, false); + } + } + + // QA plots for basic MFT distributions for non-ambiguous tracks only (kCFStepTracked) + if (cutAmbiguousTracks && sameEvent && (loopCounter == 1)) { + // FILL USUAL MFT DISTRIBUTIONS + registry.fill(HIST("Data/TpcMft/kCFStepTracked/hEta"), eta2); + registry.fill(HIST("Data/TpcMft/kCFStepTracked/hPhi"), phi2); + } + } // end of loop over tracks2 } // end of loop over tracks 1 } @@ -1065,7 +1363,7 @@ struct HfTaskFlow { // =============================================================================================================================================================================== template - void mixCollisions(TCollisions const& collisions, + void mixCollisions(TCollisions const& collisions, CorrelationContainer::CFStep step, TTracksTrig const& tracks1, TTracksAssoc const& tracks2, TLambda getPartsSize, OutputObj& corrContainer) @@ -1096,7 +1394,7 @@ struct HfTaskFlow { if constexpr (std::is_same_v) { // If MC registry.fill(HIST("MC/Rec/TpcTpc/HadronHadron/MixedEvent/hEventCountMixing"), bin); } else { // If not MC - if constexpr (std::is_same_v) { // IF TPC-MFT case + if constexpr (std::is_same_v) { // IF TPC-MFT case if constexpr (std::is_same_v || std::is_same_v) { // IF HF-h case -> TPC-MFT HF-h registry.fill(HIST("Data/TpcMft/HfHadron/MixedEvent/hEventCountMixing"), bin); } else { // IF h-h case -> TPC-MFT h-h case @@ -1111,11 +1409,70 @@ struct HfTaskFlow { } // end of if condition for TPC-TPC or TPC-MFT case } - corrContainer->fillEvent(multiplicityTracks1, CorrelationContainer::kCFStepReconstructed); - fillCorrelations(corrContainer, tracks1, tracks2, multiplicityTracks1, collision1.posZ(), false); + corrContainer->fillEvent(multiplicityTracks1, step); + fillCorrelations(corrContainer, step, tracks1, tracks2, multiplicityTracks1, collision1.posZ(), false); } } + /* + template + void mixCollisionsReassociatedMftTracks(TCollisions const& collisions, int step, + TTracksTrig const& tracks1, TTracksAssoc const& tracks2, + TLambda getPartsSize, + OutputObj& corrContainer, + bool cutAmbiguousTracks) + { + + // The first one that I call "Data" should work for data and mc rec + using BinningTypeData = FlexibleBinningPolicy, aod::collision::PosZ, decltype(getPartsSize)>; + + BinningTypeData binningWithTracksSize{{getPartsSize}, {binsMixingVertex, binsMixingMultiplicity}, true}; + auto tracksTuple = std::make_tuple(tracks1, tracks2); + Pair pair{binningWithTracksSize, nMixedEvents, -1, collisions, tracksTuple, &cache}; + + for (const auto& [collision1, tracks1, collision2, tracks2] : pair) { + + if constexpr (!std::is_same_v) { // if NOT MC -> do collision cut + if (!(isAcceptedCollision(collision1, false))) { + continue; + } + if (!(isAcceptedCollision(collision2, false))) { + continue; + } + } + + auto binningValues = binningWithTracksSize.getBinningValues(collision1, collisions); + int bin = binningWithTracksSize.getBin(binningValues); + + const auto multiplicityTracks1 = getPartsSize(collision1); + + + + if constexpr (std::is_same_v) { // If MC + registry.fill(HIST("MC/Rec/TpcTpc/HadronHadron/MixedEvent/hEventCountMixing"), bin); + } else { // If not MC + if constexpr (std::is_same_v) { // IF TPC-MFT case + if constexpr (std::is_same_v || std::is_same_v) { // IF HF-h case -> TPC-MFT HF-h + registry.fill(HIST("Data/TpcMft/HfHadron/MixedEvent/hEventCountMixing"), bin); + } else { // IF h-h case -> TPC-MFT h-h case + registry.fill(HIST("Data/TpcMft/HadronHadron/MixedEvent/hEventCountMixing"), bin); + } + } else { // IF TPC-TPC case + if constexpr (std::is_same_v || std::is_same_v) { // IF HF-h case -> TPC-TPC HF-h + registry.fill(HIST("Data/TpcTpc/HfHadron/MixedEvent/hEventCountHFMixing"), bin); + } else { // IF h-h case -> TPC-TPC h-h case + registry.fill(HIST("Data/TpcTpc/HadronHadron/MixedEvent/hEventCountMixing"), bin); + } + } // end of if condition for TPC-TPC or TPC-MFT case + } + + + corrContainer->fillEvent(multiplicityTracks1, step); + fillCorrelationsReassociatedMftTracks(corrContainer, step, tracks1, tracks2, multiplicityTracks1, collision1.posZ(), false, cutAmbiguousTracks, field ); + } + } + */ + // =============================================================================================================================================================================== // mixCollisions for GENERATED events // =============================================================================================================================================================================== @@ -1143,7 +1500,7 @@ struct HfTaskFlow { registry.fill(HIST("MC/Gen/TpcTpc/HadronHadron/MixedEvent/hEventCountMixing"), bin); corrContainer->fillEvent(multiplicity, CorrelationContainer::kCFStepAll); - fillCorrelations(corrContainer, tracks1, tracks2, multiplicity, collision1.posZ(), false); + fillCorrelations(corrContainer, CorrelationContainer::CFStep::kCFStepAll, tracks1, tracks2, multiplicity, collision1.posZ(), false); } } @@ -1184,7 +1541,7 @@ struct HfTaskFlow { sameEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); // TO-DO : add if condition for when we will implant corrected correlations (kCFStepReconstructed -> kCFStepCorrected) - fillCorrelations(sameEvent, tracks, tracks, multiplicity, collision.posZ(), true); + fillCorrelations(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, tracks, tracks, multiplicity, collision.posZ(), true); } PROCESS_SWITCH(HfTaskFlow, processSameTpcTpcChCh, "DATA : Process same-event correlations for TPC-TPC h-h case", false); @@ -1213,7 +1570,7 @@ struct HfTaskFlow { sameEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillCorrelations(sameEventHf, candidates, tracks, multiplicity, collision.posZ(), true); + fillCorrelations(sameEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, candidates, tracks, multiplicity, collision.posZ(), true); } PROCESS_SWITCH(HfTaskFlow, processSameTpcTpcD0Ch, "DATA : Process same-event correlations for TPC-TPC D0-h case", false); @@ -1242,7 +1599,7 @@ struct HfTaskFlow { sameEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillCorrelations(sameEventHf, candidates, tracks, multiplicity, collision.posZ(), true); + fillCorrelations(sameEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, candidates, tracks, multiplicity, collision.posZ(), true); } PROCESS_SWITCH(HfTaskFlow, processSameTpcTpcLcCh, "DATA : Process same-event correlations for TPC-TPC Lc-h case", false); @@ -1252,7 +1609,7 @@ struct HfTaskFlow { void processSameTpcMftChCh(FilteredCollisionsWSelMult::iterator const& collision, FilteredTracksWDcaSel const& tracks, - FilteredMftTracksWColls const& mftTracks) + aod::MFTTracks const& mftTracks) { if (!(isAcceptedCollision(collision, true))) { return; @@ -1263,12 +1620,54 @@ struct HfTaskFlow { int bin = baseBinning.getBin(std::make_tuple(collision.posZ(), multiplicity)); registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hEventCountSame"), bin); + // I use kCFStepAll for running my code with all MFTTracks were the reassociation process was not applied + // We don't fill "normal" QA plots with these tracks, only specific plots to compare with other type of MFTTracks sameEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); + fillCorrelations(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, tracks, mftTracks, multiplicity, collision.posZ(), true); - fillCorrelations(sameEvent, tracks, mftTracks, multiplicity, collision.posZ(), true); + // I use the step kCFStepReconstructed for reassociatedMftTracks (most likely the ones we will use in the end) + // sameEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); + // fillCorrelationsReassociatedMftTracks(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, tracks, reassociatedMftTracks, multiplicity, collision.posZ(), true, false); + + // I use kCFStepTracked for running my code with only non-ambiguous MFTTracks + // This is the same as running with reassociatedMftTracks, but applying one more cut in the fillCorrelations function + // We don't fill "normal" QA plots with these tracks, only specific plots to compare with other type of MFTTracks + // sameEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepTracked); + // fillCorrelationsReassociatedMftTracks(sameEvent, CorrelationContainer::CFStep::kCFStepTracked, tracks, reassociatedMftTracks, multiplicity, collision.posZ(), false, true); } PROCESS_SWITCH(HfTaskFlow, processSameTpcMftChCh, "DATA : Process same-event correlations for TPC-MFT h-h case", false); + void processSameTpcMftChChReassociated(FilteredCollisionsWSelMult::iterator const& collision, + soa::SmallGroups const& reassociatedMftTracks, + FilteredTracksWDcaSel const& tracks, + aod::MFTTracks const& mftTracks) + { + if (!(isAcceptedCollision(collision, true))) { + return; // when process function has iterator + } + + const auto multiplicity = collision.multNTracksPV(); + BinningPolicyBase<2> baseBinning{{axisVertex, axisMultiplicity}, true}; + int bin = baseBinning.getBin(std::make_tuple(collision.posZ(), multiplicity)); + registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hEventCountSame"), bin); + + // I use kCFStepAll for running my code with all MFTTracks were the reassociation process was not applied + // We don't fill "normal" QA plots with these tracks, only specific plots to compare with other type of MFTTracks + sameEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepAll); + fillCorrelations(sameEvent, CorrelationContainer::CFStep::kCFStepAll, tracks, mftTracks, multiplicity, collision.posZ(), true); + + // I use the step kCFStepReconstructed for reassociatedMftTracks (most likely the ones we will use in the end) + sameEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); + fillCorrelationsReassociatedMftTracks(sameEvent, CorrelationContainer::CFStep::kCFStepReconstructed, tracks, reassociatedMftTracks, multiplicity, collision.posZ(), true, false); + + // I use kCFStepTracked for running my code with only non-ambiguous MFTTracks + // This is the same as running with reassociatedMftTracks, but applying one more cut in the fillCorrelations function + // We don't fill "normal" QA plots with these tracks, only specific plots to compare with other type of MFTTracks + sameEvent->fillEvent(multiplicity, CorrelationContainer::kCFStepTracked); + fillCorrelationsReassociatedMftTracks(sameEvent, CorrelationContainer::CFStep::kCFStepTracked, tracks, reassociatedMftTracks, multiplicity, collision.posZ(), true, true); + } + PROCESS_SWITCH(HfTaskFlow, processSameTpcMftChChReassociated, "DATA : Process same-event correlations for TPC-MFT h-h case reassociated", false); + // ===================================== // DATA : process same event correlations: TPC-MFT HF-h case for D0 // ===================================== @@ -1276,7 +1675,7 @@ struct HfTaskFlow { void processSameTpcMftD0Ch(FilteredCollisionsWSelMult::iterator const& collision, HfCandidatesSelD0 const& candidates, FilteredTracksWDcaSel const& /*tracks*/, - FilteredMftTracksWColls const& mftTracks) + aod::MFTTracks const& mftTracks) { auto fillEventSelectionPlots = true; @@ -1295,10 +1694,41 @@ struct HfTaskFlow { sameEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillCorrelations(sameEventHf, candidates, mftTracks, multiplicity, collision.posZ(), true); + fillCorrelations(sameEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, candidates, mftTracks, multiplicity, collision.posZ(), true); } PROCESS_SWITCH(HfTaskFlow, processSameTpcMftD0Ch, "DATA : Process same-event correlations for TPC-MFT D0-h case", false); + void processSameTpcMftD0ChReassociated(FilteredCollisionsWSelMult::iterator const& collision, + HfCandidatesSelD0 const& candidates, + soa::SmallGroups const& reassociatedMftTracks, + aod::MFTTracks const& mftTracks) + { + if (!(isAcceptedCollision(collision, true))) { + return; // when process function has iterator + } + + const auto multiplicity = collision.multNTracksPV(); + BinningPolicyBase<2> baseBinning{{axisVertex, axisMultiplicity}, true}; + // int bin = baseBinning.getBin(std::make_tuple(collision.posZ(), multiplicity)); + // registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hEventCountSame"), bin); + + // I use kCFStepAll for running my code with all MFTTracks were the reassociation process was not applied + // We don't fill "normal" QA plots with these tracks, only specific plots to compare with other type of MFTTracks + sameEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepAll); + fillCorrelations(sameEventHf, CorrelationContainer::CFStep::kCFStepAll, candidates, mftTracks, multiplicity, collision.posZ(), true); + + // I use the step kCFStepReconstructed for reassociatedMftTracks (most likely the ones we will use in the end) + sameEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); + fillCorrelationsReassociatedMftTracks(sameEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, candidates, reassociatedMftTracks, multiplicity, collision.posZ(), true, false); + + // I use kCFStepTracked for running my code with only non-ambiguous MFTTracks + // This is the same as running with reassociatedMftTracks, but applying one more cut in the fillCorrelations function + // We don't fill "normal" QA plots with these tracks, only specific plots to compare with other type of MFTTracks + sameEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepTracked); + fillCorrelationsReassociatedMftTracks(sameEventHf, CorrelationContainer::CFStep::kCFStepTracked, candidates, reassociatedMftTracks, multiplicity, collision.posZ(), true, true); + } + PROCESS_SWITCH(HfTaskFlow, processSameTpcMftD0ChReassociated, "DATA : Process same-event correlations for TPC-MFT D0-h case reassociated", false); + // ===================================== // DATA : process same event correlations: TPC-MFT HF-h case for Lc // ===================================== @@ -1306,7 +1736,7 @@ struct HfTaskFlow { void processSameTpcMftLcCh(FilteredCollisionsWSelMult::iterator const& collision, HfCandidatesSelLc const& candidates, FilteredTracksWDcaSel const& /*tracks*/, - FilteredMftTracksWColls const& mftTracks) + aod::MFTTracks const& mftTracks) { auto fillEventSelectionPlots = true; @@ -1325,10 +1755,41 @@ struct HfTaskFlow { sameEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillCorrelations(sameEventHf, candidates, mftTracks, multiplicity, collision.posZ(), true); + fillCorrelations(sameEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, candidates, mftTracks, multiplicity, collision.posZ(), true); } PROCESS_SWITCH(HfTaskFlow, processSameTpcMftLcCh, "DATA : Process same-event correlations for TPC-MFT Lc-h case", false); + void processSameTpcMftLcChReassociated(FilteredCollisionsWSelMult::iterator const& collision, + HfCandidatesSelLc const& candidates, + soa::SmallGroups const& reassociatedMftTracks, + aod::MFTTracks const& mftTracks) + { + if (!(isAcceptedCollision(collision, true))) { + return; // when process function has iterator + } + + const auto multiplicity = collision.multNTracksPV(); + BinningPolicyBase<2> baseBinning{{axisVertex, axisMultiplicity}, true}; + // int bin = baseBinning.getBin(std::make_tuple(collision.posZ(), multiplicity)); + // registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hEventCountSame"), bin); + + // I use kCFStepAll for running my code with all MFTTracks were the reassociation process was not applied + // We don't fill "normal" QA plots with these tracks, only specific plots to compare with other type of MFTTracks + sameEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepAll); + fillCorrelations(sameEventHf, CorrelationContainer::CFStep::kCFStepAll, candidates, mftTracks, multiplicity, collision.posZ(), true); + + // I use the step kCFStepReconstructed for reassociatedMftTracks (most likely the ones we will use in the end) + sameEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); + fillCorrelationsReassociatedMftTracks(sameEventHf, CorrelationContainer::CFStep::kCFStepReconstructed, candidates, reassociatedMftTracks, multiplicity, collision.posZ(), true, false); + + // I use kCFStepTracked for running my code with only non-ambiguous MFTTracks + // This is the same as running with reassociatedMftTracks, but applying one more cut in the fillCorrelations function + // We don't fill "normal" QA plots with these tracks, only specific plots to compare with other type of MFTTracks + sameEventHf->fillEvent(multiplicity, CorrelationContainer::kCFStepTracked); + fillCorrelationsReassociatedMftTracks(sameEventHf, CorrelationContainer::CFStep::kCFStepTracked, candidates, reassociatedMftTracks, multiplicity, collision.posZ(), true, true); + } + PROCESS_SWITCH(HfTaskFlow, processSameTpcMftLcChReassociated, "DATA : Process same-event correlations for TPC-MFT Lc-h case reassociated", false); + // =================================================================================================================================================================================================================================================================== // MONTE-CARLO // =================================================================================================================================================================================================================================================================== @@ -1348,7 +1809,7 @@ struct HfTaskFlow { // registry.fill(HIST("MC/Gen/TpcMft/HfHadron/SameEvent/2Prong/hEventCountSame"), bin); sameEventHfMc->fillEvent(multiplicity, CorrelationContainer::kCFStepAll); - fillCorrelations(sameEventHfMc, mcParticles2Prong, mcParticles, multiplicity, mcCollision.posZ(), true); + fillCorrelations(sameEventHfMc, CorrelationContainer::CFStep::kCFStepAll, mcParticles2Prong, mcParticles, multiplicity, mcCollision.posZ(), true); } PROCESS_SWITCH(HfTaskFlow, processSameTpcMftD0ChMcGen, "MONTE-CARLO : Process same-event correlations for TPC-MFT D0-h case", false); @@ -1367,7 +1828,7 @@ struct HfTaskFlow { // registry.fill(HIST("MC/Gen/TpcMft/HfHadron/SameEvent/2Prong/hEventCountSame"), bin); sameEventHfMc->fillEvent(multiplicity, CorrelationContainer::kCFStepAll); - fillCorrelations(sameEventHfMc, mcParticles3Prong, mcParticles, multiplicity, mcCollision.posZ(), true); + fillCorrelations(sameEventHfMc, CorrelationContainer::CFStep::kCFStepAll, mcParticles3Prong, mcParticles, multiplicity, mcCollision.posZ(), true); } PROCESS_SWITCH(HfTaskFlow, processSameTpcMftLcChMcGen, "MONTE-CARLO : Process same-event correlations for TPC-MFT Lc-h case", false); @@ -1401,7 +1862,7 @@ struct HfTaskFlow { }; // mixCollisions(collisions, tracks, tracks, getTracksSize, mixedEvent); - mixCollisions(collisions, tracks, tracks, getMultiplicity, mixedEvent); + mixCollisions(collisions, CorrelationContainer::CFStep::kCFStepReconstructed, tracks, tracks, getMultiplicity, mixedEvent); } PROCESS_SWITCH(HfTaskFlow, processMixedTpcTpcChCh, "DATA : Process mixed-event correlations for TPC-TPC h-h case", false); @@ -1418,7 +1879,7 @@ struct HfTaskFlow { return multiplicity; }; - mixCollisions(collisions, candidates, tracks, getMultiplicity, mixedEventHf); + mixCollisions(collisions, CorrelationContainer::kCFStepReconstructed, candidates, tracks, getMultiplicity, mixedEventHf); } PROCESS_SWITCH(HfTaskFlow, processMixedTpcTpcD0Ch, "DATA : Process mixed-event correlations for TPC-TPC D0-h case", false); @@ -1435,7 +1896,7 @@ struct HfTaskFlow { return multiplicity; }; - mixCollisions(collisions, candidates, tracks, getMultiplicity, mixedEventHf); + mixCollisions(collisions, CorrelationContainer::kCFStepReconstructed, candidates, tracks, getMultiplicity, mixedEventHf); } PROCESS_SWITCH(HfTaskFlow, processMixedTpcTpcLcCh, "DATA : Process mixed-event correlations for TPC-TPC Lc-h case", false); @@ -1445,14 +1906,23 @@ struct HfTaskFlow { void processMixedTpcMftChCh(FilteredCollisionsWSelMult const& collisions, FilteredTracksWDcaSel const& tracks, - FilteredMftTracksWColls const& mftTracks) + aod::MFTTracks const& mftTracks) { auto getMultiplicity = [](FilteredCollisionsWSelMult::iterator const& collision) { auto multiplicity = collision.numContrib(); return multiplicity; }; - mixCollisions(collisions, tracks, mftTracks, getMultiplicity, mixedEvent); + mixCollisions(collisions, CorrelationContainer::kCFStepReconstructed, tracks, mftTracks, getMultiplicity, mixedEvent); + // mixCollisions(collisions, CorrelationContainer::kCFStepAll, tracks, mftTracks, getMultiplicity, mixedEvent); + + // The next following two lines were supposed to be used to do mixed event with the reassociated MFT tracks + // However it seems the O2physics framework cannot handle how these combinations requests grouping according to Anton Alkin + // So I leave them commented for now until it is solved, and put the "normal" mixCollisions back with kCFStepReconstructed + + // mixCollisionsReassociatedMftTracks(collisions, CorrelationContainer::kCFStepReconstructed, tracks, reassociatedMftTracks, getMultiplicity, mixedEvent, false); + + // mixCollisionsReassociatedMftTracks(collisions, CorrelationContainer::kCFStepTracked, tracks, reassociatedMftTracks, getMultiplicity, mixedEvent, true); } PROCESS_SWITCH(HfTaskFlow, processMixedTpcMftChCh, "DATA : Process mixed-event correlations for TPC-MFT h-h case", false); @@ -1462,7 +1932,7 @@ struct HfTaskFlow { void processMixedTpcMftD0Ch(FilteredCollisionsWSelMult const& collisions, HfCandidatesSelD0 const& candidates, - FilteredMftTracksWColls const& mftTracks, + aod::MFTTracks const& mftTracks, FilteredTracksWDcaSel const& /*tracks*/) { auto getMultiplicity = [](FilteredCollisionsWSelMult::iterator const& collision) { @@ -1470,7 +1940,7 @@ struct HfTaskFlow { return multiplicity; }; - mixCollisions(collisions, candidates, mftTracks, getMultiplicity, mixedEventHf); + mixCollisions(collisions, CorrelationContainer::kCFStepReconstructed, candidates, mftTracks, getMultiplicity, mixedEventHf); } PROCESS_SWITCH(HfTaskFlow, processMixedTpcMftD0Ch, "DATA : Process mixed-event correlations for TPC-MFT D0-h case", false); @@ -1480,14 +1950,14 @@ struct HfTaskFlow { void processMixedTpcMftLcCh(FilteredCollisionsWSelMult const& collisions, HfCandidatesSelLc const& candidates, - FilteredMftTracksWColls const& mftTracks) + aod::MFTTracks const& mftTracks) { auto getMultiplicity = [](FilteredCollisionsWSelMult::iterator const& collision) { auto multiplicity = collision.numContrib(); return multiplicity; }; - mixCollisions(collisions, candidates, mftTracks, getMultiplicity, mixedEventHf); + mixCollisions(collisions, CorrelationContainer::kCFStepReconstructed, candidates, mftTracks, getMultiplicity, mixedEventHf); } PROCESS_SWITCH(HfTaskFlow, processMixedTpcMftLcCh, "DATA : Process mixed-event correlations for TPC-MFT Lc-h case", false); @@ -1539,7 +2009,7 @@ struct HfTaskFlow { void processMcEfficiencyMft(FilteredMcCollisions::iterator const& mcCollision, McParticles const& mcParticles, soa::SmallGroups> const& collisionsMcLabels, - FilteredMftTracksWCollsMcLabels const& mftTTracksMcLabels) + MftTracksMcLabels const& mftTTracksMcLabels) { LOGF(info, "MC collision at vtx-z = %f with %d mc particles and %d reconstructed collisions", mcCollision.posZ(), mcParticles.size(), collisionsMcLabels.size()); From 536b2fe4f518b69bb474a93e47c5304fb97e636f Mon Sep 17 00:00:00 2001 From: Martin <43970264+mrtineide@users.noreply.github.com> Date: Thu, 7 Aug 2025 13:53:19 +0200 Subject: [PATCH 279/345] [Common,PWGCF,PWGDQ,PWGEM,PWGLF,PWGUD,DPG,Trigger] [Cleanup] Add fully qualified names for std::string and std::map (#12378) --- Common/CCDB/ctpRateFetcher.cxx | 2 +- Common/TableProducer/eventSelection.cxx | 2 +- Common/TableProducer/qVectorsTable.cxx | 2 +- Common/Tools/PID/handleParamTPCResponse.cxx | 2 +- DPG/Tasks/AOTEvent/detectorOccupancyQa.cxx | 2 +- EventFiltering/PWGCF/CFFilterQA.cxx | 4 ++-- EventFiltering/PWGLF/filterf1proton.cxx | 2 +- PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx | 2 +- PWGDQ/TableProducer/tableMaker_withAssoc.cxx | 2 +- PWGDQ/Tasks/tableReader_withAssoc.cxx | 4 ++-- PWGEM/Dilepton/TableProducer/skimmerPrimaryMuon.cxx | 2 +- PWGEM/Dilepton/Tasks/matchingMFT.cxx | 2 +- PWGLF/TableProducer/Resonances/f1protonreducedtable.cxx | 2 +- PWGLF/TableProducer/Resonances/filterf1proton.cxx | 2 +- PWGUD/TableProducer/fwdTrackPropagation.cxx | 2 +- 15 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Common/CCDB/ctpRateFetcher.cxx b/Common/CCDB/ctpRateFetcher.cxx index 09c50d854f5..6940fd1e921 100644 --- a/Common/CCDB/ctpRateFetcher.cxx +++ b/Common/CCDB/ctpRateFetcher.cxx @@ -109,7 +109,7 @@ void ctpRateFetcher::setupRun(int runNumber, o2::ccdb::BasicCCDBManager* ccdb, u delete mScalers; delete mLHCIFdata; } - std::map metadata; + std::map metadata; mLHCIFdata = ccdb->getSpecific("GLO/Config/GRPLHCIF", timeStamp, metadata); if (mLHCIFdata == nullptr) { LOG(fatal) << "GRPLHCIFData not in database, timestamp:" << timeStamp; diff --git a/Common/TableProducer/eventSelection.cxx b/Common/TableProducer/eventSelection.cxx index b517bb90010..f32c4723a47 100644 --- a/Common/TableProducer/eventSelection.cxx +++ b/Common/TableProducer/eventSelection.cxx @@ -1286,7 +1286,7 @@ struct LumiTask { LOGP(warn, "Cross section for z={} + z={} @ {} GeV is not defined", beamZ1, beamZ2, sqrts); } // getting CTP config to extract lumi class indices (used for rate fetching and pileup correction) - std::map metadata; + std::map metadata; metadata["runNumber"] = std::to_string(run); auto config = ccdb->getSpecific("CTP/Config/Config", ts, metadata); auto classes = config->getCTPClasses(); diff --git a/Common/TableProducer/qVectorsTable.cxx b/Common/TableProducer/qVectorsTable.cxx index e27fecb3c8c..bfdb319db75 100644 --- a/Common/TableProducer/qVectorsTable.cxx +++ b/Common/TableProducer/qVectorsTable.cxx @@ -154,7 +154,7 @@ struct qVectorsTable { Produces qVectorBTotVec; ///////////////////////////////////////////////////////////////// - std::unordered_map useDetector = { + std::unordered_map useDetector = { {"QvectorBTots", cfgUseBTot}, {"QvectorBNegs", cfgUseBNeg}, {"QvectorBPoss", cfgUseBPos}, diff --git a/Common/Tools/PID/handleParamTPCResponse.cxx b/Common/Tools/PID/handleParamTPCResponse.cxx index 64741503fae..242503f16e1 100644 --- a/Common/Tools/PID/handleParamTPCResponse.cxx +++ b/Common/Tools/PID/handleParamTPCResponse.cxx @@ -48,7 +48,7 @@ bool initOptionsAndParse(bpo::options_description& options, int argc, char* argv "paramMultNormalization", bpo::value()->default_value(11000.), "Multiplicity Normalization")( "paramnClNormalization", bpo::value()->default_value(152.), "Maximum nClusters for normalisation (159 for run 2, 152 for run 3)")( "useDefaultParam", bpo::value()->default_value(true), "Use default sigma parametrisation")( - "mode", bpo::value()->default_value(""), "Running mode ('read' from file, 'write' to file, 'pull' from CCDB, 'push' to CCDB)")( + "mode", bpo::value()->default_value(""), "Running mode ('read' from file, 'write' to file, 'pull' from CCDB, 'push' to CCDB)")( "help,h", "Produce help message."); setStandardOpt(options); try { diff --git a/DPG/Tasks/AOTEvent/detectorOccupancyQa.cxx b/DPG/Tasks/AOTEvent/detectorOccupancyQa.cxx index 4575146c592..037fb6db839 100644 --- a/DPG/Tasks/AOTEvent/detectorOccupancyQa.cxx +++ b/DPG/Tasks/AOTEvent/detectorOccupancyQa.cxx @@ -736,7 +736,7 @@ struct DetectorOccupancyQaTask { int nCollInTimeWindowSelIfTOF = 0; double multFT0CmainCollision = 0.f; double multFT0CInTimeWindow = 0.f; - map mUniqueBC; + std::map mUniqueBC; bool sel = col.selection_bit(kIsTriggerTVX); diff --git a/EventFiltering/PWGCF/CFFilterQA.cxx b/EventFiltering/PWGCF/CFFilterQA.cxx index 372b3387dc1..fe084669b8a 100644 --- a/EventFiltering/PWGCF/CFFilterQA.cxx +++ b/EventFiltering/PWGCF/CFFilterQA.cxx @@ -1033,7 +1033,7 @@ struct CFFilterQA { std::vector setValuesBB(aod::BCsWithTimestamps::iterator const& bunchCrossing, const std::string ccdbPath) { - map metadata; + std::map metadata; auto h = ccdbApi.retrieveFromTFileAny(ccdbPath, metadata, bunchCrossing.timestamp()); // auto h = ccdb->getForTimeStamp(ccdbPath, bunchCrossing.timestamp()); //check if possible to use this without getting fatal if (!h) { @@ -1055,7 +1055,7 @@ struct CFFilterQA { std::vector setValuesAvg(aod::BCsWithTimestamps::iterator const& bunchCrossing, const std::string ccdbPath) { - map metadata; + std::map metadata; auto h = ccdbApi.retrieveFromTFileAny(ccdbPath, metadata, bunchCrossing.timestamp()); // auto h = ccdb->getForTimeStamp(ccdbPath, bunchCrossing.timestamp()); //check if possible to use this without getting fatal if (!h) { diff --git a/EventFiltering/PWGLF/filterf1proton.cxx b/EventFiltering/PWGLF/filterf1proton.cxx index abdfe9c272a..8919d851580 100644 --- a/EventFiltering/PWGLF/filterf1proton.cxx +++ b/EventFiltering/PWGLF/filterf1proton.cxx @@ -436,7 +436,7 @@ struct filterf1proton { std::vector setValuesBB(o2::ccdb::CcdbApi& ccdbApi, aod::BCsWithTimestamps::iterator const& bunchCrossing, const std::string ccdbPath) { - map metadata; + std::map metadata; auto h = ccdbApi.retrieveFromTFileAny(ccdbPath, metadata, bunchCrossing.timestamp()); // auto h = ccdb->getForTimeStamp(ccdbPath, bunchCrossing.timestamp()); // check if possible to use this without getting fatal if (!h) { diff --git a/PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx b/PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx index 7dc49516e8a..ad48874301e 100644 --- a/PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx +++ b/PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx @@ -1112,7 +1112,7 @@ struct TableMakerMC { VarManager::SetupMuonMagField(); } } - std::map metadataRCT, header; + std::map metadataRCT, header; header = fCCDBApi.retrieveHeaders(Form("RCT/Info/RunInformation/%i", bcs.begin().runNumber()), metadataRCT, -1); uint64_t sor = std::atol(header["SOR"].c_str()); uint64_t eor = std::atol(header["EOR"].c_str()); diff --git a/PWGDQ/TableProducer/tableMaker_withAssoc.cxx b/PWGDQ/TableProducer/tableMaker_withAssoc.cxx index 00587ffce7f..60670abfac6 100644 --- a/PWGDQ/TableProducer/tableMaker_withAssoc.cxx +++ b/PWGDQ/TableProducer/tableMaker_withAssoc.cxx @@ -1320,7 +1320,7 @@ struct TableMaker { VarManager::SetupMuonMagField(); } } - std::map metadataRCT, header; + std::map metadataRCT, header; header = fCCDBApi.retrieveHeaders(Form("RCT/Info/RunInformation/%i", bcs.begin().runNumber()), metadataRCT, -1); uint64_t sor = std::atol(header["SOR"].c_str()); uint64_t eor = std::atol(header["EOR"].c_str()); diff --git a/PWGDQ/Tasks/tableReader_withAssoc.cxx b/PWGDQ/Tasks/tableReader_withAssoc.cxx index baa153f1dfb..ae6c450ac3e 100644 --- a/PWGDQ/Tasks/tableReader_withAssoc.cxx +++ b/PWGDQ/Tasks/tableReader_withAssoc.cxx @@ -360,7 +360,7 @@ struct AnalysisEventSelection { void runEventSelection(TEvents const& events) { if (events.size() > 0 && events.begin().runNumber() != fCurrentRun) { - std::map metadataRCT, header; + std::map metadataRCT, header; header = fCCDBApi.retrieveHeaders(Form("RCT/Info/RunInformation/%i", events.begin().runNumber()), metadataRCT, -1); uint64_t sor = std::atol(header["SOR"].c_str()); uint64_t eor = std::atol(header["EOR"].c_str()); @@ -657,7 +657,7 @@ struct AnalysisTrackSelection { LOGF(fatal, "GRP object is not available in CCDB at timestamp=%llu", events.begin().timestamp()); } - std::map metadataRCT, header; + std::map metadataRCT, header; header = fCCDBApi.retrieveHeaders(Form("RCT/Info/RunInformation/%i", events.begin().runNumber()), metadataRCT, -1); uint64_t sor = std::atol(header["SOR"].c_str()); uint64_t eor = std::atol(header["EOR"].c_str()); diff --git a/PWGEM/Dilepton/TableProducer/skimmerPrimaryMuon.cxx b/PWGEM/Dilepton/TableProducer/skimmerPrimaryMuon.cxx index 457e2787771..1f9456e9c96 100644 --- a/PWGEM/Dilepton/TableProducer/skimmerPrimaryMuon.cxx +++ b/PWGEM/Dilepton/TableProducer/skimmerPrimaryMuon.cxx @@ -117,7 +117,7 @@ struct skimmerPrimaryMuon { } mRunNumber = bc.runNumber(); - std::map metadata; + std::map metadata; auto soreor = o2::ccdb::BasicCCDBManager::getRunDuration(ccdbApi, mRunNumber); auto ts = soreor.first; auto grpmag = ccdbApi.retrieveFromTFileAny(grpmagPath, metadata, ts); diff --git a/PWGEM/Dilepton/Tasks/matchingMFT.cxx b/PWGEM/Dilepton/Tasks/matchingMFT.cxx index c1deb69e52a..99a0db783e2 100644 --- a/PWGEM/Dilepton/Tasks/matchingMFT.cxx +++ b/PWGEM/Dilepton/Tasks/matchingMFT.cxx @@ -126,7 +126,7 @@ struct matchingMFT { } mRunNumber = bc.runNumber(); LOGF(info, "mRunNumber = %d", mRunNumber); - std::map metadata; + std::map metadata; auto soreor = o2::ccdb::BasicCCDBManager::getRunDuration(ccdbApi, mRunNumber); auto ts = soreor.first; auto grpmag = ccdbApi.retrieveFromTFileAny(grpmagPath, metadata, ts); diff --git a/PWGLF/TableProducer/Resonances/f1protonreducedtable.cxx b/PWGLF/TableProducer/Resonances/f1protonreducedtable.cxx index ce0cdcf3af5..842c0e46c82 100644 --- a/PWGLF/TableProducer/Resonances/f1protonreducedtable.cxx +++ b/PWGLF/TableProducer/Resonances/f1protonreducedtable.cxx @@ -400,7 +400,7 @@ struct f1protonreducedtable { std::vector setValuesBB(o2::ccdb::CcdbApi& ccdbApi, aod::BCsWithTimestamps::iterator const& bunchCrossing, const std::string ccdbPath) { - map metadata; + std::map metadata; auto h = ccdbApi.retrieveFromTFileAny(ccdbPath, metadata, bunchCrossing.timestamp()); // auto h = ccdb->getForTimeStamp(ccdbPath, bunchCrossing.timestamp()); // check if possible to use this without getting fatal if (!h) { diff --git a/PWGLF/TableProducer/Resonances/filterf1proton.cxx b/PWGLF/TableProducer/Resonances/filterf1proton.cxx index 831209b0905..99d02c744cb 100644 --- a/PWGLF/TableProducer/Resonances/filterf1proton.cxx +++ b/PWGLF/TableProducer/Resonances/filterf1proton.cxx @@ -368,7 +368,7 @@ struct filterf1proton { std::vector setValuesBB(o2::ccdb::CcdbApi& ccdbApi, aod::BCsWithTimestamps::iterator const& bunchCrossing, const std::string ccdbPath) { - map metadata; + std::map metadata; auto h = ccdbApi.retrieveFromTFileAny(ccdbPath, metadata, bunchCrossing.timestamp()); // auto h = ccdb->getForTimeStamp(ccdbPath, bunchCrossing.timestamp()); // check if possible to use this without getting fatal if (!h) { diff --git a/PWGUD/TableProducer/fwdTrackPropagation.cxx b/PWGUD/TableProducer/fwdTrackPropagation.cxx index cc6ba621690..52fa510b176 100644 --- a/PWGUD/TableProducer/fwdTrackPropagation.cxx +++ b/PWGUD/TableProducer/fwdTrackPropagation.cxx @@ -99,7 +99,7 @@ struct FwdTrackPropagation { if (run != fRun) { fRun = run; - std::map metadata; + std::map metadata; auto soreor = o2::ccdb::BasicCCDBManager::getRunDuration(fCCDBApi, run); auto ts = soreor.first; auto grpmag = fCCDBApi.retrieveFromTFileAny("GLO/Config/GRPMagField", metadata, ts); From 87d05d53068b46a8a29380c3357e0bcc8c2377e0 Mon Sep 17 00:00:00 2001 From: lauraser <45659867+lauraser@users.noreply.github.com> Date: Thu, 7 Aug 2025 14:40:54 +0200 Subject: [PATCH 280/345] [PWGCF] Change default to false so other analyses are not changed (#12466) Co-authored-by: Laura Serksnyte --- PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx b/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx index 0e788e4a97b..0e190295508 100644 --- a/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx +++ b/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx @@ -212,7 +212,7 @@ struct femtoDreamProducerTask { } OptionTrackSpecialSelections; struct : o2::framework::ConfigurableGroup { - Configurable requireRCTFlagChecker{"requireRCTFlagChecker", true, "Check event quality in run condition table"}; + Configurable requireRCTFlagChecker{"requireRCTFlagChecker", false, "Check event quality in run condition table"}; Configurable cfgEvtRCTFlagCheckerLabel{"cfgEvtRCTFlagCheckerLabel", "CBT_hadronPID", "Evt sel: RCT flag checker label"}; Configurable cfgEvtRCTFlagCheckerLimitAcceptAsBad{"cfgEvtRCTFlagCheckerLimitAcceptAsBad", true, "Evt sel: RCT flag checker treat Limited Acceptance As Bad"}; } rctCut; From c6c81425f177ba8d2bbc08389839a661eb51f178 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Thu, 7 Aug 2025 19:01:21 +0200 Subject: [PATCH 281/345] [PWGEM/Dilepton] update 2pc (#12476) --- PWGEM/Dilepton/Core/DileptonHadronMPC.h | 61 ++++++++-------------- PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h | 56 ++++++-------------- 2 files changed, 36 insertions(+), 81 deletions(-) diff --git a/PWGEM/Dilepton/Core/DileptonHadronMPC.h b/PWGEM/Dilepton/Core/DileptonHadronMPC.h index 2e1d94ab6bd..c3e23080ffa 100644 --- a/PWGEM/Dilepton/Core/DileptonHadronMPC.h +++ b/PWGEM/Dilepton/Core/DileptonHadronMPC.h @@ -285,19 +285,11 @@ struct DileptonHadronMPC { Configurable cfg_max_pt_track{"cfg_max_pt_track", 3.0, "max pT for ref. track"}; Configurable cfg_min_eta_track{"cfg_min_eta_track", -0.8, "min eta for ref. track"}; Configurable cfg_max_eta_track{"cfg_max_eta_track", +0.8, "max eta for ref. track"}; - Configurable cfg_min_phi_track{"cfg_min_phi_track", 0.0, "min phi for ref. track"}; - Configurable cfg_max_phi_track{"cfg_max_phi_track", 6.3, "max phi for ref. track"}; - Configurable cfg_max_dcaxy{"cfg_max_dcaxy", 0.5, "max dca XY for single track in cm"}; - Configurable cfg_max_dcaz{"cfg_max_dcaz", 0.5, "max dca Z for single track in cm"}; + // Configurable cfg_min_phi_track{"cfg_min_phi_track", 0.0, "min phi for ref. track"}; + // Configurable cfg_max_phi_track{"cfg_max_phi_track", 6.3, "max phi for ref. track"}; + // Configurable cfg_max_dcaxy{"cfg_max_dcaxy", 0.5, "max dca XY for single track in cm"}; + // Configurable cfg_max_dcaz{"cfg_max_dcaz", 0.5, "max dca Z for single track in cm"}; Configurable cfg_track_bits{"cfg_track_bits", 645, "required track bits"}; // default:645, loose:0, tight:778 - // Configurable cfg_min_ncluster_its{"cfg_min_ncluster_its", 5, "min ncluster its"}; - // Configurable cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 0, "min ncluster tpc"}; - // Configurable cfg_min_ncrossedrows{"cfg_min_ncrossedrows", 70, "min ncrossed rows"}; - // Configurable cfg_max_frac_shared_clusters_tpc{"cfg_max_frac_shared_clusters_tpc", 0.7, "max fraction of shared clusters in TPC"}; - // Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; - // Configurable cfg_max_chi2its{"cfg_max_chi2its", 36.0, "max chi2/NclsITS"}; - // Configurable cfg_require_itsib_any{"cfg_require_itsib_any", true, "flag to require ITS ib any hits"}; - // Configurable cfg_require_itsib_1st{"cfg_require_itsib_1st", false, "flag to require ITS ib 1st hit"}; } trackcuts; o2::aod::rctsel::RCTFlagsChecker rctChecker; @@ -511,11 +503,10 @@ struct DileptonHadronMPC { const AxisSpec axis_y{ConfRapidityBins, pair_rapidity_axis_title}; // dilepton-hadron info - const AxisSpec axis_pt_ref{ConfPtHadronBins, "p_{T,h}^{ref} (GeV/c)"}; const AxisSpec axis_deta{ConfDEtaBins, deta_axis_title}; // hadron-hadron info - const AxisSpec axis_deta_hh{60, -3, +3, "#Delta#eta = #eta_{h}^{trg} - #eta_{h}^{ref}"}; + const AxisSpec axis_deta_hh{60, -3, +3, "#Delta#eta = #eta_{h}^{ref1} - #eta_{h}^{ref2}"}; const AxisSpec axis_pt_trg{ConfPtHadronBins, "p_{T,h} (GeV/c)"}; const AxisSpec axis_eta_trg{40, -2, +2, "#eta_{h}"}; @@ -528,30 +519,29 @@ struct DileptonHadronMPC { if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonHadronAnalysisType::kAzimuthalCorrelation)) { const AxisSpec axis_dphi{cfgNbinsDPhi, -M_PI / 2, 3 * M_PI / 2, dphi_axis_title}; - const AxisSpec axis_dphi_hh{cfgNbinsDPhi, -M_PI / 2, 3 * M_PI / 2, "#Delta#varphi = #varphi_{h}^{trg} - #varphi_{h}^{ref} (rad.)"}; // dilepton-hadron - fRegistry.add("DileptonHadron/same/uls/hs", "dilepton-hadron 2PC", kTHnSparseD, {axis_mass, axis_pt, axis_dca, axis_y, axis_pt_ref, axis_deta, axis_dphi}, true); + fRegistry.add("DileptonHadron/same/uls/hs", "dilepton-hadron 2PC", kTHnSparseD, {axis_mass, axis_pt, axis_dca, axis_y, axis_deta, axis_dphi}, true); fRegistry.addClone("DileptonHadron/same/uls/", "DileptonHadron/same/lspp/"); fRegistry.addClone("DileptonHadron/same/uls/", "DileptonHadron/same/lsmm/"); // fRegistry.addClone("DileptonHadron/same/", "DileptonHadron/mix/"); // hadron-hadron - const AxisSpec axis_cosndphi_hh{cfgNbinsCosNDPhi, -1, +1, std::format("cos({0:d}(#varphi_{{h}}^{{trg}} - #varphi_{{h}}^{{ref}}))", cfgNmod.value)}; - fRegistry.add("HadronHadron/same/hs", "hadron-hadron 2PC", kTHnSparseD, {axis_pt_trg, axis_pt_ref, axis_deta_hh, axis_dphi_hh}, true); + const AxisSpec axis_dphi_hh{cfgNbinsDPhi, -M_PI / 2, 3 * M_PI / 2, "#Delta#varphi = #varphi_{h}^{ref1} - #varphi_{h}^{ref2} (rad.)"}; + fRegistry.add("HadronHadron/same/hDEtaDPhi", "hadron-hadron 2PC", kTH2D, {axis_deta_hh, axis_dphi_hh}, true); fRegistry.addClone("HadronHadron/same/", "HadronHadron/mix/"); fRegistry.add("HadronHadron/mix/hDiffBC", "diff. global BC in mixed event;|BC_{current} - BC_{mixed}|", kTH1D, {{10001, -0.5, 10000.5}}, true); } else if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonHadronAnalysisType::kCumulant)) { const AxisSpec axis_cos_ndphi{cfgNbinsCosNDPhi, -1, +1, cosndphi_axis_title}; // dilepton-hadron - fRegistry.add("DileptonHadron/same/uls/hs", "dilepton-hadron 2PC", kTHnSparseD, {axis_mass, axis_pt, axis_dca, axis_y, axis_pt_ref, axis_deta, axis_cos_ndphi}, true); + fRegistry.add("DileptonHadron/same/uls/hs", "dilepton-hadron 2PC", kTHnSparseD, {axis_mass, axis_pt, axis_dca, axis_y, axis_deta, axis_cos_ndphi}, true); fRegistry.addClone("DileptonHadron/same/uls/", "DileptonHadron/same/lspp/"); fRegistry.addClone("DileptonHadron/same/uls/", "DileptonHadron/same/lsmm/"); fRegistry.addClone("DileptonHadron/same/", "DileptonHadron/mix/"); // hadron-hadron const AxisSpec axis_cosndphi_hh{cfgNbinsCosNDPhi, -1, +1, std::format("cos({0:d}(#varphi_{{h}}^{{trg}} - #varphi_{{h}}^{{ref}}))", cfgNmod.value)}; - fRegistry.add("HadronHadron/same/hs", "hadron-hadron 2PC", kTHnSparseD, {axis_pt_trg, axis_pt_ref, axis_deta_hh, axis_cosndphi_hh}, true); + fRegistry.add("HadronHadron/same/hDEtaCosNDPhi", "hadron-hadron 2PC", kTH2D, {axis_deta_hh, axis_cosndphi_hh}, true); } fRegistry.add("Dilepton/mix/hDiffBC", "diff. global BC in mixed event;|BC_{current} - BC_{mixed}|", kTH1D, {{10001, -0.5, 10000.5}}, true); } @@ -684,19 +674,10 @@ struct DileptonHadronMPC { fEMTrackCut = EMTrackCut("fEMTrackCut", "fEMTrackCut"); fEMTrackCut.SetTrackPtRange(trackcuts.cfg_min_pt_track, trackcuts.cfg_max_pt_track); fEMTrackCut.SetTrackEtaRange(trackcuts.cfg_min_eta_track, trackcuts.cfg_max_eta_track); - fEMTrackCut.SetTrackPhiRange(trackcuts.cfg_min_phi_track, trackcuts.cfg_max_phi_track); - fEMTrackCut.SetTrackMaxDcaXY(trackcuts.cfg_max_dcaxy); - fEMTrackCut.SetTrackMaxDcaZ(trackcuts.cfg_max_dcaz); + // fEMTrackCut.SetTrackPhiRange(trackcuts.cfg_min_phi_track, trackcuts.cfg_max_phi_track); + // fEMTrackCut.SetTrackMaxDcaXY(trackcuts.cfg_max_dcaxy); + // fEMTrackCut.SetTrackMaxDcaZ(trackcuts.cfg_max_dcaz); fEMTrackCut.SetTrackBit(trackcuts.cfg_track_bits); - // fEMTrackCut.SetMinNClustersTPC(trackcuts.cfg_min_ncluster_tpc); - // fEMTrackCut.SetMinNCrossedRowsTPC(trackcuts.cfg_min_ncrossedrows); - // fEMTrackCut.SetMinNCrossedRowsOverFindableClustersTPC(0.8); - // fEMTrackCut.SetMaxFracSharedClustersTPC(trackcuts.cfg_max_frac_shared_clusters_tpc); - // fEMTrackCut.SetChi2PerClusterTPC(0.0, trackcuts.cfg_max_chi2tpc); - // fEMTrackCut.SetChi2PerClusterITS(0.0, trackcuts.cfg_max_chi2its); - // fEMTrackCut.SetNClustersITS(trackcuts.cfg_min_ncluster_its, 7); - // fEMTrackCut.RequireITSibAny(trackcuts.cfg_require_itsib_any); - // fEMTrackCut.RequireITSib1st(trackcuts.cfg_require_itsib_1st); } template @@ -957,21 +938,21 @@ struct DileptonHadronMPC { if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonHadronAnalysisType::kAzimuthalCorrelation)) { dphi = RecoDecay::constrainAngle(dphi, -M_PI / 2, 1U); if (t1.sign() * t2.sign() < 0) { // ULS - fRegistry.fill(HIST("DileptonHadron/") + HIST(event_pair_types[ev_id]) + HIST("uls/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), v3.Pt(), deta, dphi, weight); + fRegistry.fill(HIST("DileptonHadron/") + HIST(event_pair_types[ev_id]) + HIST("uls/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), deta, dphi, weight); } else if (t1.sign() > 0 && t2.sign() > 0) { // LS++ - fRegistry.fill(HIST("DileptonHadron/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), v3.Pt(), deta, dphi, weight); + fRegistry.fill(HIST("DileptonHadron/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), deta, dphi, weight); } else if (t1.sign() < 0 && t2.sign() < 0) { // LS-- - fRegistry.fill(HIST("DileptonHadron/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), v3.Pt(), deta, dphi, weight); + fRegistry.fill(HIST("DileptonHadron/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), deta, dphi, weight); } } else if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonHadronAnalysisType::kCumulant)) { o2::math_utils::bringTo02Pi(dphi); float cosndphi = std::cos(cfgNmod * dphi); if (t1.sign() * t2.sign() < 0) { // ULS - fRegistry.fill(HIST("DileptonHadron/") + HIST(event_pair_types[ev_id]) + HIST("uls/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), v3.Pt(), deta, cosndphi, weight); + fRegistry.fill(HIST("DileptonHadron/") + HIST(event_pair_types[ev_id]) + HIST("uls/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), deta, cosndphi, weight); } else if (t1.sign() > 0 && t2.sign() > 0) { // LS++ - fRegistry.fill(HIST("DileptonHadron/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), v3.Pt(), deta, cosndphi, weight); + fRegistry.fill(HIST("DileptonHadron/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), deta, cosndphi, weight); } else if (t1.sign() < 0 && t2.sign() < 0) { // LS-- - fRegistry.fill(HIST("DileptonHadron/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), v3.Pt(), deta, cosndphi, weight); + fRegistry.fill(HIST("DileptonHadron/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hs"), v12.M(), v12.Pt(), pair_dca, v12.Rapidity(), deta, cosndphi, weight); } } @@ -1013,11 +994,11 @@ struct DileptonHadronMPC { if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonHadronAnalysisType::kAzimuthalCorrelation)) { dphi = RecoDecay::constrainAngle(dphi, -M_PI / 2, 1U); - fRegistry.fill(HIST("HadronHadron/") + HIST(event_pair_types[ev_id]) + HIST("hs"), t1.pt(), t2.pt(), deta, dphi, weight); + fRegistry.fill(HIST("HadronHadron/") + HIST(event_pair_types[ev_id]) + HIST("hDEtaDPhi"), deta, dphi, weight); } else if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonHadronAnalysisType::kCumulant)) { o2::math_utils::bringTo02Pi(dphi); float cosndphi = std::cos(cfgNmod * dphi); - fRegistry.fill(HIST("HadronHadron/") + HIST(event_pair_types[ev_id]) + HIST("hs"), t1.pt(), t2.pt(), deta, cosndphi, weight); + fRegistry.fill(HIST("HadronHadron/") + HIST(event_pair_types[ev_id]) + HIST("hDEtaCosNDPhi"), deta, cosndphi, weight); } // store ref tracks for mixed event in case of kAzimuthalCorrelation diff --git a/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h b/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h index a0811629c32..6e3b4f0c8e4 100644 --- a/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h +++ b/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h @@ -207,19 +207,11 @@ struct DiphotonHadronMPC { Configurable cfg_max_pt_track{"cfg_max_pt_track", 3.0, "max pT for ref. track"}; Configurable cfg_min_eta_track{"cfg_min_eta_track", -0.8, "min eta for ref. track"}; Configurable cfg_max_eta_track{"cfg_max_eta_track", +0.8, "max eta for ref. track"}; - Configurable cfg_min_phi_track{"cfg_min_phi_track", 0.0, "min phi for ref. track"}; - Configurable cfg_max_phi_track{"cfg_max_phi_track", 6.3, "max phi for ref. track"}; - Configurable cfg_max_dcaxy{"cfg_max_dcaxy", 0.5, "max dca XY for single track in cm"}; - Configurable cfg_max_dcaz{"cfg_max_dcaz", 0.5, "max dca Z for single track in cm"}; + // Configurable cfg_min_phi_track{"cfg_min_phi_track", 0.0, "min phi for ref. track"}; + // Configurable cfg_max_phi_track{"cfg_max_phi_track", 6.3, "max phi for ref. track"}; + // Configurable cfg_max_dcaxy{"cfg_max_dcaxy", 0.5, "max dca XY for single track in cm"}; + // Configurable cfg_max_dcaz{"cfg_max_dcaz", 0.5, "max dca Z for single track in cm"}; Configurable cfg_track_bits{"cfg_track_bits", 645, "required track bits"}; // default:645, loose:0, tight:778 - // Configurable cfg_min_ncluster_its{"cfg_min_ncluster_its", 5, "min ncluster its"}; - // Configurable cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 0, "min ncluster tpc"}; - // Configurable cfg_min_ncrossedrows{"cfg_min_ncrossedrows", 70, "min ncrossed rows"}; - // Configurable cfg_max_frac_shared_clusters_tpc{"cfg_max_frac_shared_clusters_tpc", 0.7, "max fraction of shared clusters in TPC"}; - // Configurable cfg_max_chi2tpc{"cfg_max_chi2tpc", 4.0, "max chi2/NclsTPC"}; - // Configurable cfg_max_chi2its{"cfg_max_chi2its", 36.0, "max chi2/NclsITS"}; - // Configurable cfg_require_itsib_any{"cfg_require_itsib_any", true, "flag to require ITS ib any hits"}; - // Configurable cfg_require_itsib_1st{"cfg_require_itsib_1st", false, "flag to require ITS ib 1st hit"}; } trackcuts; o2::aod::rctsel::RCTFlagsChecker rctChecker; @@ -359,20 +351,11 @@ struct DiphotonHadronMPC { // cosndphi_axis_title = std::format("cos({0:d}(#varphi_{{ee#gamma}} - #varphi_{{h}}))", cfgNmod.value); } - // photon info - const AxisSpec axis_pt_single{ConfPtggBins, "p_{T,#gamma} (GeV/c)"}; - const AxisSpec axis_eta_single{20, -1, +1, "#eta_{#gamma}"}; - const AxisSpec axis_phi_single{36, 0, 2 * M_PI, "#varphi_{#gamma} (rad.)"}; - const AxisSpec axis_deta_single{ConfDEtaBins, "#Delta#eta = #eta_{#gamma} - #eta_{h}"}; - const AxisSpec axis_dphi_single{cfgNbinsDPhi, -M_PI / 2, +3 * M_PI / 2, "#Delta#varphi = #varphi_{#gamma} - #varphi_{h} (rad.)"}; - // const AxisSpec axis_cos_ndphi_single{cfgNbinsCosNDPhi, -1, +1, std::format("cos({0:d}(#varphi_{{#gamma}} - #varphi_{{h}}))", cfgNmod.value)}; - // diphoton info const AxisSpec axis_mass{ConfMggBins, mass_axis_title}; const AxisSpec axis_pt{ConfPtggBins, pair_pt_axis_title}; // diphoton-hadron info - const AxisSpec axis_pt_ref{ConfPtHadronBins, "p_{T,h}^{ref} (GeV/c)"}; const AxisSpec axis_deta{ConfDEtaBins, deta_axis_title}; const AxisSpec axis_dphi{cfgNbinsDPhi, -M_PI / 2, +3 * M_PI / 2, dphi_axis_title}; @@ -385,14 +368,14 @@ struct DiphotonHadronMPC { fRegistry.add("Diphoton/same/hs", "diphoton", kTHnSparseD, {axis_mass, axis_pt}, true); fRegistry.addClone("Diphoton/same/", "Diphoton/mix/"); - fRegistry.add("DiphotonHadron/same/hs", "diphoton-hadron 2PC", kTHnSparseD, {axis_mass, axis_pt, axis_pt_ref, axis_deta, axis_dphi}, true); + fRegistry.add("DiphotonHadron/same/hs", "diphoton-hadron 2PC", kTHnSparseD, {axis_mass, axis_pt, axis_deta, axis_dphi}, true); fRegistry.addClone("DiphotonHadron/same/", "DiphotonHadron/mix/"); // hadron-hadron const AxisSpec axis_deta_hh{ConfDEtaBins, "#Delta#eta = #eta_{h}^{ref1} - #eta_{h}^{ref2}"}; const AxisSpec axis_dphi_hh{cfgNbinsDPhi, -M_PI / 2, +3 * M_PI / 2, "#Delta#varphi = #varphi_{h}^{ref1} - #varphi_{h}^{ref2} (rad.)"}; // const AxisSpec axis_cosndphi_hh{cfgNbinsCosNDPhi, -1, +1, std::format("cos({0:d}(#varphi_{{h}}^{{ref1}} - #varphi_{{h}}^{{ref2}}))", cfgNmod.value)}; - fRegistry.add("HadronHadron/same/hs", "hadron-hadron 2PC", kTHnSparseD, {axis_pt_hadron, axis_pt_ref, axis_deta_hh, axis_dphi_hh}, true); + fRegistry.add("HadronHadron/same/hDEtaDPhi", "hadron-hadron 2PC", kTH2D, {axis_deta_hh, axis_dphi_hh}, true); fRegistry.addClone("HadronHadron/same/", "HadronHadron/mix/"); } @@ -478,19 +461,10 @@ struct DiphotonHadronMPC { fEMTrackCut = EMTrackCut("fEMTrackCut", "fEMTrackCut"); fEMTrackCut.SetTrackPtRange(trackcuts.cfg_min_pt_track, trackcuts.cfg_max_pt_track); fEMTrackCut.SetTrackEtaRange(trackcuts.cfg_min_eta_track, trackcuts.cfg_max_eta_track); - fEMTrackCut.SetTrackPhiRange(trackcuts.cfg_min_phi_track, trackcuts.cfg_max_phi_track); - fEMTrackCut.SetTrackMaxDcaXY(trackcuts.cfg_max_dcaxy); - fEMTrackCut.SetTrackMaxDcaZ(trackcuts.cfg_max_dcaz); + // fEMTrackCut.SetTrackPhiRange(trackcuts.cfg_min_phi_track, trackcuts.cfg_max_phi_track); + // fEMTrackCut.SetTrackMaxDcaXY(trackcuts.cfg_max_dcaxy); + // fEMTrackCut.SetTrackMaxDcaZ(trackcuts.cfg_max_dcaz); fEMTrackCut.SetTrackBit(trackcuts.cfg_track_bits); - // fEMTrackCut.SetMinNClustersTPC(trackcuts.cfg_min_ncluster_tpc); - // fEMTrackCut.SetMinNCrossedRowsTPC(trackcuts.cfg_min_ncrossedrows); - // fEMTrackCut.SetMinNCrossedRowsOverFindableClustersTPC(0.8); - // fEMTrackCut.SetMaxFracSharedClustersTPC(trackcuts.cfg_max_frac_shared_clusters_tpc); - // fEMTrackCut.SetChi2PerClusterTPC(0.0, trackcuts.cfg_max_chi2tpc); - // fEMTrackCut.SetChi2PerClusterITS(0.0, trackcuts.cfg_max_chi2its); - // fEMTrackCut.SetNClustersITS(trackcuts.cfg_min_ncluster_its, 7); - // fEMTrackCut.RequireITSibAny(trackcuts.cfg_require_itsib_any); - // fEMTrackCut.RequireITSib1st(trackcuts.cfg_require_itsib_1st); } SliceCache cache; @@ -625,7 +599,7 @@ struct DiphotonHadronMPC { float dphi = v12.Phi() - v3.Phi(); // o2::math_utils::bringTo02Pi(dphi); dphi = RecoDecay::constrainAngle(dphi, -M_PI / 2, 1U); - fRegistry.fill(HIST("DiphotonHadron/same/hs"), v12.M(), v12.Pt(), v3.Pt(), deta, dphi); + fRegistry.fill(HIST("DiphotonHadron/same/hs"), v12.M(), v12.Pt(), deta, dphi); npair++; std::pair pair_tmp_ref = std::make_pair(ndf, track.globalIndex()); if (std::find(used_refTrackIds.begin(), used_refTrackIds.end(), pair_tmp_ref) == used_refTrackIds.end()) { // add a ref track in mixing pool @@ -708,7 +682,7 @@ struct DiphotonHadronMPC { float dphi = veeg.Phi() - v3.Phi(); // o2::math_utils::bringTo02Pi(dphi); dphi = RecoDecay::constrainAngle(dphi, -M_PI / 2, 1U); - fRegistry.fill(HIST("DiphotonHadron/same/hs"), veeg.M(), veeg.Pt(), v3.Pt(), deta, dphi); + fRegistry.fill(HIST("DiphotonHadron/same/hs"), veeg.M(), veeg.Pt(), deta, dphi); npair++; std::pair pair_tmp_ref = std::make_pair(ndf, track.globalIndex()); @@ -748,7 +722,7 @@ struct DiphotonHadronMPC { float dphi = ref1.phi() - ref2.phi(); // o2::math_utils::bringTo02Pi(dphi); dphi = RecoDecay::constrainAngle(dphi, -M_PI / 2, 1U); - fRegistry.fill(HIST("HadronHadron/same/hs"), ref1.pt(), ref2.pt(), deta, dphi); + fRegistry.fill(HIST("HadronHadron/same/hDEtaDPhi"), deta, dphi); } } } @@ -822,7 +796,7 @@ struct DiphotonHadronMPC { float dphi = trg.phi() - ref.phi(); // o2::math_utils::bringTo02Pi(dphi); dphi = RecoDecay::constrainAngle(dphi, -M_PI / 2, 1U); - fRegistry.fill(HIST("DiphotonHadron/mix/hs"), trg.mass(), trg.pt(), ref.pt(), deta, dphi); + fRegistry.fill(HIST("DiphotonHadron/mix/hs"), trg.mass(), trg.pt(), deta, dphi); } } } // end of loop over mixed event pool between diphoton-hadron @@ -917,7 +891,7 @@ struct DiphotonHadronMPC { float dphi = trg.phi() - ref.phi(); // o2::math_utils::bringTo02Pi(dphi); dphi = RecoDecay::constrainAngle(dphi, -M_PI / 2, 1U); - fRegistry.fill(HIST("DiphotonHadron/mix/hs"), trg.mass(), trg.pt(), ref.pt(), deta, dphi); + fRegistry.fill(HIST("DiphotonHadron/mix/hs"), trg.mass(), trg.pt(), deta, dphi); } } } // end of loop over mixed event pool between diphoton-hadron @@ -945,7 +919,7 @@ struct DiphotonHadronMPC { float dphi = ref1.phi() - ref2.phi(); // o2::math_utils::bringTo02Pi(dphi); dphi = RecoDecay::constrainAngle(dphi, -M_PI / 2, 1U); - fRegistry.fill(HIST("HadronHadron/mix/hs"), ref1.pt(), ref2.pt(), deta, dphi); + fRegistry.fill(HIST("HadronHadron/mix/hDEtaDPhi"), deta, dphi); } } } // end of loop over mixed event pool between hadron-hadron From 09b73ed203cfe2d9437185923b5ebc7b73fe0aa9 Mon Sep 17 00:00:00 2001 From: Nida Malik Date: Thu, 7 Aug 2025 22:53:47 +0530 Subject: [PATCH 282/345] [PWGCF] Added some histogram to calculate nudyn for different delta eta values (#12415) --- .../Tasks/netchargeFluctuations.cxx | 514 ++++++++++++------ 1 file changed, 334 insertions(+), 180 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx index bced27ce135..c33bdd9cb22 100644 --- a/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/netchargeFluctuations.cxx @@ -93,7 +93,7 @@ struct NetchargeFluctuations { Configurable cfgLoadEff{"cfgLoadEff", true, "Load efficiency"}; Configurable vertexZcut{"vertexZcut", 10.f, "Vertex Z"}; - Configurable etaCut{"etaCut", 0.8, "Eta cut"}; + Configurable etaCut{"etaCut", 0.8f, "Eta cut"}; Configurable ptMinCut{"ptMinCut", 0.2, "Pt min cut"}; Configurable ptMaxCut{"ptMaxCut", 5.0, "Pt max cut"}; Configurable dcaXYCut{"dcaXYCut", 0.12, "DCA XY cut"}; @@ -106,6 +106,7 @@ struct NetchargeFluctuations { Configurable cfgNSubsample{"cfgNSubsample", 30, "Number of subsamples for Error"}; Configurable deltaEta{"deltaEta", 8, "Delta eta bin count"}; Configurable threshold{"threshold", 1e-6, "Delta eta bin count"}; + // Event selections Configurable cSel8Trig{"cSel8Trig", true, "Sel8 (T0A + T0C) Selection Run3"}; // sel8 Configurable cInt7Trig{"cInt7Trig", true, "kINT7 MB Trigger"}; // kINT7 @@ -152,83 +153,95 @@ struct NetchargeFluctuations { float maxSubsample = 1.0 * noSubsample; AxisSpec subsampleAxis = {noSubsample, 0.0, maxSubsample, "subsample no."}; - histogramRegistry.add("data/hVtxZ_before", "", kTH1F, {vtxzAxis}); - histogramRegistry.add("data/hDcaXY_before", "", kTH1F, {dcaAxis}); - histogramRegistry.add("data/hDcaZ_before", "", kTH1F, {dcazAxis}); - histogramRegistry.add("data/hTPCchi2perCluster_before", "", kTH1D, {tpcChiAxis}); - histogramRegistry.add("data/hITSchi2perCluster_before", "", kTH1D, {itsChiAxis}); - histogramRegistry.add("data/hTPCCrossedrows_before", "", kTH1D, {crossedRowAxis}); - histogramRegistry.add("data/hPtDcaXY_before", "", kTH2D, {ptAxis, dcaAxis}); - histogramRegistry.add("data/hPtDcaZ_before", "", kTH2D, {ptAxis, dcazAxis}); - histogramRegistry.add("data/hVtxZ_after", "", kTH1F, {vtxzAxis}); - histogramRegistry.add("data/hDcaXY_after", "", kTH1F, {dcaAxis}); - histogramRegistry.add("data/hDcaZ_after", "", kTH1F, {dcazAxis}); - histogramRegistry.add("data/hTPCchi2perCluster_after", "", kTH1D, {tpcChiAxis}); - histogramRegistry.add("data/hITSchi2perCluster_after", "", kTH1D, {itsChiAxis}); - histogramRegistry.add("data/hTPCCrossedrows_after", "", kTH1D, {crossedRowAxis}); - histogramRegistry.add("data/hPtDcaXY_after", "", kTH2D, {ptAxis, dcaAxis}); - histogramRegistry.add("data/hPtDcaZ_after", "", kTH2D, {ptAxis, dcazAxis}); - histogramRegistry.add("data/hEta", "", kTH1F, {etaAxis}); - histogramRegistry.add("data/hEta_cent", "", kTH2F, {cent1Axis, etaAxis}); - histogramRegistry.add("data/hPt", "", kTH1F, {ptAxis}); - histogramRegistry.add("data/hPt_cent", "", kTH2F, {cent1Axis, ptAxis}); - histogramRegistry.add("data/hPt_eta", "", kTH2F, {ptAxis, etaAxis}); - histogramRegistry.add("data/hCentrality", "", kTH1F, {centAxis}); - histogramRegistry.add("data/hMultiplicity", "", kTH1F, {multAxis}); + histogramRegistry.add("QA/hVtxZ_before", "", kTH1F, {vtxzAxis}); + histogramRegistry.add("QA/hDcaXY_before", "", kTH1F, {dcaAxis}); + histogramRegistry.add("QA/hDcaZ_before", "", kTH1F, {dcazAxis}); + histogramRegistry.add("QA/hTPCchi2perCluster_before", "", kTH1D, {tpcChiAxis}); + histogramRegistry.add("QA/hITSchi2perCluster_before", "", kTH1D, {itsChiAxis}); + histogramRegistry.add("QA/hTPCCrossedrows_before", "", kTH1D, {crossedRowAxis}); + histogramRegistry.add("QA/hPtDcaXY_before", "", kTH2D, {ptAxis, dcaAxis}); + histogramRegistry.add("QA/hPtDcaZ_before", "", kTH2D, {ptAxis, dcazAxis}); + histogramRegistry.add("QA/hVtxZ_after", "", kTH1F, {vtxzAxis}); + histogramRegistry.add("QA/hDcaXY_after", "", kTH1F, {dcaAxis}); + histogramRegistry.add("QA/hDcaZ_after", "", kTH1F, {dcazAxis}); + histogramRegistry.add("QA/hTPCchi2perCluster_after", "", kTH1D, {tpcChiAxis}); + histogramRegistry.add("QA/hITSchi2perCluster_after", "", kTH1D, {itsChiAxis}); + histogramRegistry.add("QA/hTPCCrossedrows_after", "", kTH1D, {crossedRowAxis}); + histogramRegistry.add("QA/hPtDcaXY_after", "", kTH2D, {ptAxis, dcaAxis}); + histogramRegistry.add("QA/hPtDcaZ_after", "", kTH2D, {ptAxis, dcazAxis}); + histogramRegistry.add("QA/hEta", "", kTH1F, {etaAxis}); + histogramRegistry.add("QA/cent_hEta", "", kTH2F, {cent1Axis, etaAxis}); + histogramRegistry.add("QA/hPt", "", kTH1F, {ptAxis}); + histogramRegistry.add("QA/cent_hPt", "", kTH2F, {cent1Axis, ptAxis}); + histogramRegistry.add("QA/hPt_eta", "", kTH2F, {ptAxis, etaAxis}); + histogramRegistry.add("QA/hCentrality", "", kTH1F, {centAxis}); + histogramRegistry.add("QA/hMultiplicity", "", kTH1F, {multAxis}); - histogramRegistry.add("gen/hPt_eta", "", kTH2F, {ptAxis, etaAxis}); histogramRegistry.add("gen/hVtxZ_before", "", kTH1F, {vtxzAxis}); histogramRegistry.add("gen/hVtxZ_after", "", kTH1F, {vtxzAxis}); + histogramRegistry.add("gen/hPt", "", kTH1F, {ptAxis}); + histogramRegistry.add("gen/cent_hPt", "", kTH2F, {centAxis, ptAxis}); histogramRegistry.add("gen/hEta", "", kTH1F, {etaAxis}); - histogramRegistry.add("gen/hEta_cent", "", kTH2F, {centAxis, etaAxis}); + histogramRegistry.add("gen/cent_hEta", "", kTH2F, {centAxis, etaAxis}); histogramRegistry.add("gen/hSign", "", kTH1F, {signAxis}); - histogramRegistry.add("gen/hPt", "", kTH1F, {ptAxis}); - histogramRegistry.add("gen/hPt_cent", "", kTH2F, {centAxis, ptAxis}); + histogramRegistry.add("gen/hPt_eta", "", kTH2F, {ptAxis, etaAxis}); + histogramRegistry.add("gen/cent_pos", "cent vs fpos", kTProfile, {cent1Axis}); + histogramRegistry.add("gen/cent_neg", "cent vs fneg", kTProfile, {cent1Axis}); + histogramRegistry.add("gen/cent_termp", "cent vs termp", kTProfile, {cent1Axis}); + histogramRegistry.add("gen/cent_termn", "cent vs termn", kTProfile, {cent1Axis}); + histogramRegistry.add("gen/cent_pos_sq", "cent vs sqfpos", kTProfile, {cent1Axis}); + histogramRegistry.add("gen/cent_neg_sq", "cent vs sqfneg", kTProfile, {cent1Axis}); + histogramRegistry.add("gen/cent_posneg", "cent vs fpos*fneg", kTProfile, {cent1Axis}); + histogramRegistry.add("gen/cent_nch", "cent vs nch", kTProfile, {cent1Axis}); histogramRegistry.add("gen/nch", "", kTH1F, {nchAxis}); - - histogramRegistry.add("mult_dist/nch", "", kTH1D, {nchAxis}); - histogramRegistry.add("mult_dist/nch_pos", "", kTH1D, {nchAxis}); - histogramRegistry.add("mult_dist/nch_neg", "", kTH1D, {nchAxis}); - histogramRegistry.add("mult_dist/nch_negpos", "", kTH1D, {nchpAxis}); - histogramRegistry.add("mult_dist/nch_cent", "", kTH2D, {centAxis, nchAxis}); - histogramRegistry.add("mult_dist/nch_pos_cent", "", kTH2D, {centAxis, nchAxis}); - histogramRegistry.add("mult_dist/nch_neg_cent", "", kTH2D, {centAxis, nchAxis}); - histogramRegistry.add("mult_dist/nch_negpos_cent", "", kTH2D, {centAxis, nchpAxis}); - - histogramRegistry.add("delta_eta/cent", "Centrality", kTH1F, {cent1Axis}); - histogramRegistry.add("delta_eta/track_eta", "eta", kTH1F, {etaAxis}); - histogramRegistry.add("delta_eta/pos", "delta_eta vs fpos", kTProfile, {deltaEtaAxis}); - histogramRegistry.add("delta_eta/neg", "delta_eta vs fneg", kTProfile, {deltaEtaAxis}); - histogramRegistry.add("delta_eta/termp", "delta_eta vs termp", kTProfile, {deltaEtaAxis}); - histogramRegistry.add("delta_eta/termn", "delta_eta vs termn", kTProfile, {deltaEtaAxis}); - histogramRegistry.add("delta_eta/pos_sq", "delta_eta vs sqfpos", kTProfile, {deltaEtaAxis}); - histogramRegistry.add("delta_eta/neg_sq", "delta_eta vs sqfneg", kTProfile, {deltaEtaAxis}); - histogramRegistry.add("delta_eta/posneg", "delta_eta vs fpos*fneg", kTProfile, {deltaEtaAxis}); - - histogramRegistry.add("cent/pos", "cent vs fpos", kTProfile, {cent1Axis}); - histogramRegistry.add("cent/neg", "cent vs fneg", kTProfile, {cent1Axis}); - histogramRegistry.add("cent/termp", "cent vs termp", kTProfile, {cent1Axis}); - histogramRegistry.add("cent/termn", "cent vs termn", kTProfile, {cent1Axis}); - histogramRegistry.add("cent/pos_sq", "cent vs sqfpos", kTProfile, {cent1Axis}); - histogramRegistry.add("cent/neg_sq", "cent vs sqfneg", kTProfile, {cent1Axis}); - histogramRegistry.add("cent/posneg", "cent vs fpos*fneg", kTProfile, {cent1Axis}); - - histogramRegistry.add("cent/gen_pos", "cent vs fpos", kTProfile, {cent1Axis}); - histogramRegistry.add("cent/gen_neg", "cent vs fneg", kTProfile, {cent1Axis}); - histogramRegistry.add("cent/gen_termp", "cent vs termp", kTProfile, {cent1Axis}); - histogramRegistry.add("cent/gen_termn", "cent vs termn", kTProfile, {cent1Axis}); - histogramRegistry.add("cent/gen_pos_sq", "cent vs sqfpos", kTProfile, {cent1Axis}); - histogramRegistry.add("cent/gen_neg_sq", "cent vs sqfneg", kTProfile, {cent1Axis}); - histogramRegistry.add("cent/gen_posneg", "cent vs fpos*fneg", kTProfile, {cent1Axis}); - histogramRegistry.add("cent/gen_nch", "cent vs nch", kTProfile, {centAxis}); - - histogramRegistry.add("cor/hPt_cor", "", kTH1F, {ptAxis}); - histogramRegistry.add("cor/hEta_cor", "", kTH1F, {etaAxis}); - histogramRegistry.add("cor/nch_vs_nchCor", "", kTProfile, {nchAxis}); - histogramRegistry.add("cor/nchCor", "", kTH1F, {nchAxis}); - histogramRegistry.add("cor/cent_nchCor", "", kTH2F, {centAxis, nchAxis}); - histogramRegistry.add("cor/fpos_cent", "", kTProfile, {centAxis}); - histogramRegistry.add("cor/fneg_cent", "", kTProfile, {centAxis}); + histogramRegistry.add("gen/delta_eta_eta", "delta_eta ", kTH1F, {etaAxis}); + histogramRegistry.add("gen/delta_eta_pos", "delta_eta vs fpos ", kTProfile, {deltaEtaAxis}); + histogramRegistry.add("gen/delta_eta_neg", "delta_eta vs fneg ", kTProfile, {deltaEtaAxis}); + histogramRegistry.add("gen/delta_eta_termp", "delta_eta vs termp ", kTProfile, {deltaEtaAxis}); + histogramRegistry.add("gen/delta_eta_termn", "delta_eta vs termn ", kTProfile, {deltaEtaAxis}); + histogramRegistry.add("gen/delta_eta_pos_sq", "delta_eta vs pos_sq ", kTProfile, {deltaEtaAxis}); + histogramRegistry.add("gen/delta_eta_neg_sq", "delta_eta vs neg_sq ", kTProfile, {deltaEtaAxis}); + histogramRegistry.add("gen/delta_eta_posneg", "delta_eta vs posneg ", kTProfile, {deltaEtaAxis}); + histogramRegistry.add("gen/delta_eta_nch", "delta_eta vs nchGen ", kTProfile, {deltaEtaAxis}); + + histogramRegistry.add("data/nch", "", kTH1D, {nchAxis}); + histogramRegistry.add("data/cent_nch", "", kTProfile, {cent1Axis}); + histogramRegistry.add("data/nch_pos", "", kTH1D, {nchAxis}); + histogramRegistry.add("data/cent_nch_pos", "", kTH2D, {centAxis, nchAxis}); + histogramRegistry.add("data/nch_neg", "", kTH1D, {nchAxis}); + histogramRegistry.add("data/cent_nch_neg", "", kTH2D, {centAxis, nchAxis}); + histogramRegistry.add("data/nch_negpos", "", kTH1D, {nchpAxis}); + histogramRegistry.add("data/cent_nch_negpos", "", kTH2D, {centAxis, nchpAxis}); + histogramRegistry.add("data/cent_pos", "cent vs fpos", kTProfile, {cent1Axis}); + histogramRegistry.add("data/cent_neg", "cent vs fneg", kTProfile, {cent1Axis}); + histogramRegistry.add("data/cent_termp", "cent vs termp", kTProfile, {cent1Axis}); + histogramRegistry.add("data/cent_termn", "cent vs termn", kTProfile, {cent1Axis}); + histogramRegistry.add("data/cent_pos_sq", "cent vs sqfpos", kTProfile, {cent1Axis}); + histogramRegistry.add("data/cent_neg_sq", "cent vs sqfneg", kTProfile, {cent1Axis}); + histogramRegistry.add("data/cent_posneg", "cent vs fpos*fneg", kTProfile, {cent1Axis}); + histogramRegistry.add("data/hPt_cor", "", kTH1F, {ptAxis}); + histogramRegistry.add("data/hEta_cor", "", kTH1F, {etaAxis}); + histogramRegistry.add("data/cent_nchTotal", "cent vs nchTotal", kTProfile, {cent1Axis}); + histogramRegistry.add("data/cent_nchTotalCor", "cent vs nchTotalCor", kTProfile, {cent1Axis}); + histogramRegistry.add("data/nch_nchCor", "", kTProfile, {nchAxis}); + histogramRegistry.add("data/nchCor", "", kTH1F, {nchAxis}); + histogramRegistry.add("data/cent_nchCor", "", kTProfile, {cent1Axis}); + histogramRegistry.add("data/cent_pos_cor", "", kTProfile, {cent1Axis}); + histogramRegistry.add("data/cent_neg_cor", "", kTProfile, {cent1Axis}); + histogramRegistry.add("data/delta_eta_cent", "Centrality", kTH1F, {cent1Axis}); + histogramRegistry.add("data/delta_eta_eta", "eta", kTH1F, {etaAxis}); + histogramRegistry.add("data/delta_eta_nchTotal", "delta_eta vs nchTotal", kTProfile, {deltaEtaAxis}); + histogramRegistry.add("data/delta_eta_nch", "delta_eta vs nch", kTProfile, {deltaEtaAxis}); + histogramRegistry.add("data/delta_eta_nchCor", "delta_eta vs nchCor", kTProfile, {deltaEtaAxis}); + histogramRegistry.add("data/delta_eta_pos", "delta_eta vs fpos", kTProfile, {deltaEtaAxis}); + histogramRegistry.add("data/delta_eta_neg", "delta_eta vs fneg", kTProfile, {deltaEtaAxis}); + histogramRegistry.add("data/delta_eta_termp", "delta_eta vs termp", kTProfile, {deltaEtaAxis}); + histogramRegistry.add("data/delta_eta_termn", "delta_eta vs termn", kTProfile, {deltaEtaAxis}); + histogramRegistry.add("data/delta_eta_pos_sq", "delta_eta vs sqfpos", kTProfile, {deltaEtaAxis}); + histogramRegistry.add("data/delta_eta_neg_sq", "delta_eta vs sqfneg", kTProfile, {deltaEtaAxis}); + histogramRegistry.add("data/delta_eta_posneg", "delta_eta vs fpos*fneg", kTProfile, {deltaEtaAxis}); + histogramRegistry.add("data/delta_eta_pos_cor", "delta_eta vs fpos_cor", kTProfile, {deltaEtaAxis}); + histogramRegistry.add("data/delta_eta_neg_cor", "delta_eta vs fneg_cor", kTProfile, {deltaEtaAxis}); histogramRegistry.add("subsample/pos", "", kTProfile2D, {cent1Axis, subsampleAxis}); histogramRegistry.add("subsample/neg", "", kTProfile2D, {cent1Axis, subsampleAxis}); @@ -260,7 +273,6 @@ struct NetchargeFluctuations { if (std::abs(coll.posZ()) > vertexZcut) return false; - if constexpr (run == kRun3) { if (cSel8Trig && !coll.sel8()) { return false; @@ -297,28 +309,28 @@ struct NetchargeFluctuations { template void fillBeforeQA(T const& track) { - histogramRegistry.fill(HIST("data/hTPCchi2perCluster_before"), track.tpcChi2NCl()); - histogramRegistry.fill(HIST("data/hITSchi2perCluster_before"), track.itsChi2NCl()); - histogramRegistry.fill(HIST("data/hTPCCrossedrows_before"), track.tpcNClsCrossedRows()); - histogramRegistry.fill(HIST("data/hDcaXY_before"), track.dcaXY()); - histogramRegistry.fill(HIST("data/hDcaZ_before"), track.dcaZ()); - histogramRegistry.fill(HIST("data/hPtDcaXY_before"), track.pt(), track.dcaXY()); - histogramRegistry.fill(HIST("data/hPtDcaZ_before"), track.pt(), track.dcaZ()); + histogramRegistry.fill(HIST("QA/hTPCchi2perCluster_before"), track.tpcChi2NCl()); + histogramRegistry.fill(HIST("QA/hITSchi2perCluster_before"), track.itsChi2NCl()); + histogramRegistry.fill(HIST("QA/hTPCCrossedrows_before"), track.tpcNClsCrossedRows()); + histogramRegistry.fill(HIST("QA/hDcaXY_before"), track.dcaXY()); + histogramRegistry.fill(HIST("QA/hDcaZ_before"), track.dcaZ()); + histogramRegistry.fill(HIST("QA/hPtDcaXY_before"), track.pt(), track.dcaXY()); + histogramRegistry.fill(HIST("QA/hPtDcaZ_before"), track.pt(), track.dcaZ()); } template void fillAfterQA(T const& track) { - histogramRegistry.fill(HIST("data/hDcaXY_after"), track.dcaXY()); - histogramRegistry.fill(HIST("data/hDcaZ_after"), track.dcaZ()); - histogramRegistry.fill(HIST("data/hPt"), track.pt()); - histogramRegistry.fill(HIST("data/hEta"), track.eta()); - histogramRegistry.fill(HIST("data/hPt_eta"), track.pt(), track.eta()); - histogramRegistry.fill(HIST("data/hPtDcaXY_after"), track.pt(), track.dcaXY()); - histogramRegistry.fill(HIST("data/hPtDcaZ_after"), track.pt(), track.dcaZ()); - histogramRegistry.fill(HIST("data/hTPCCrossedrows_after"), track.tpcNClsCrossedRows()); - histogramRegistry.fill(HIST("data/hTPCchi2perCluster_after"), track.tpcChi2NCl()); - histogramRegistry.fill(HIST("data/hITSchi2perCluster_after"), track.itsChi2NCl()); + histogramRegistry.fill(HIST("QA/hDcaXY_after"), track.dcaXY()); + histogramRegistry.fill(HIST("QA/hDcaZ_after"), track.dcaZ()); + histogramRegistry.fill(HIST("QA/hPt"), track.pt()); + histogramRegistry.fill(HIST("QA/hEta"), track.eta()); + histogramRegistry.fill(HIST("QA/hPt_eta"), track.pt(), track.eta()); + histogramRegistry.fill(HIST("QA/hPtDcaXY_after"), track.pt(), track.dcaXY()); + histogramRegistry.fill(HIST("QA/hPtDcaZ_after"), track.pt(), track.dcaZ()); + histogramRegistry.fill(HIST("QA/hTPCCrossedrows_after"), track.tpcNClsCrossedRows()); + histogramRegistry.fill(HIST("QA/hTPCchi2perCluster_after"), track.tpcChi2NCl()); + histogramRegistry.fill(HIST("QA/hITSchi2perCluster_after"), track.itsChi2NCl()); } template @@ -346,16 +358,14 @@ struct NetchargeFluctuations { return true; } - double getEfficiency(double pt, double eta, TH2D* hEff) + double getEfficiency(float pt, float eta, TH2D* hEff) { if (!hEff) { - LOGF(error, "Efficiency histogram is null — check CCDB loading."); return 1e-6; } int binX = hEff->GetXaxis()->FindBin(pt); int binY = hEff->GetYaxis()->FindBin(eta); if (binX < 1 || binX > hEff->GetNbinsX() || binY < 1 || binY > hEff->GetNbinsY()) { - LOGF(warn, "pt or eta out of histogram bounds: pt = %f, eta = %f", pt, eta); return 1e-6; } double eff = hEff->GetBinContent(binX, binY); @@ -364,22 +374,22 @@ struct NetchargeFluctuations { void fillHistograms(float nch, float cent, float fpos, float fneg, float posneg, float termp, float termn) { - histogramRegistry.fill(HIST("mult_dist/nch"), nch); - histogramRegistry.fill(HIST("mult_dist/nch_cent"), cent, nch); - histogramRegistry.fill(HIST("mult_dist/nch_pos"), fpos); - histogramRegistry.fill(HIST("mult_dist/nch_pos_cent"), cent, fpos); - histogramRegistry.fill(HIST("mult_dist/nch_neg"), fneg); - histogramRegistry.fill(HIST("mult_dist/nch_neg_cent"), cent, fneg); - histogramRegistry.fill(HIST("mult_dist/nch_negpos"), posneg); - histogramRegistry.fill(HIST("mult_dist/nch_negpos_cent"), cent, posneg); - - histogramRegistry.fill(HIST("cent/pos"), cent, fpos); - histogramRegistry.fill(HIST("cent/neg"), cent, fneg); - histogramRegistry.fill(HIST("cent/termp"), cent, termp); - histogramRegistry.fill(HIST("cent/termn"), cent, termn); - histogramRegistry.fill(HIST("cent/pos_sq"), cent, fpos * fpos); - histogramRegistry.fill(HIST("cent/neg_sq"), cent, fneg * fneg); - histogramRegistry.fill(HIST("cent/posneg"), cent, posneg); + histogramRegistry.fill(HIST("data/nch"), nch); + histogramRegistry.fill(HIST("data/cent_nch"), cent, nch); + histogramRegistry.fill(HIST("data/nch_pos"), fpos); + histogramRegistry.fill(HIST("data/cent_nch_pos"), cent, fpos); + histogramRegistry.fill(HIST("data/nch_neg"), fneg); + histogramRegistry.fill(HIST("data/cent_nch_neg"), cent, fneg); + histogramRegistry.fill(HIST("data/nch_negpos"), posneg); + histogramRegistry.fill(HIST("data/cent_nch_negpos"), cent, posneg); + + histogramRegistry.fill(HIST("data/cent_pos"), cent, fpos); + histogramRegistry.fill(HIST("data/cent_neg"), cent, fneg); + histogramRegistry.fill(HIST("data/cent_termp"), cent, termp); + histogramRegistry.fill(HIST("data/cent_termn"), cent, termn); + histogramRegistry.fill(HIST("data/cent_pos_sq"), cent, fpos * fpos); + histogramRegistry.fill(HIST("data/cent_neg_sq"), cent, fneg * fneg); + histogramRegistry.fill(HIST("data/cent_posneg"), cent, posneg); float lRandom = fRndm->Rndm(); int sampleIndex = static_cast(cfgNSubsample * lRandom); @@ -397,33 +407,35 @@ struct NetchargeFluctuations { void calculationData(C const& coll, T const& tracks) { float cent = -1, mult = -1; - histogramRegistry.fill(HIST("data/hVtxZ_before"), coll.posZ()); + histogramRegistry.fill(HIST("QA/hVtxZ_before"), coll.posZ()); if (!selCollision(coll, cent, mult)) { return; } - histogramRegistry.fill(HIST("data/hVtxZ_after"), coll.posZ()); - histogramRegistry.fill(HIST("data/hCentrality"), cent); - histogramRegistry.fill(HIST("data/hMultiplicity"), mult); + histogramRegistry.fill(HIST("QA/hVtxZ_after"), coll.posZ()); + histogramRegistry.fill(HIST("QA/hCentrality"), cent); + histogramRegistry.fill(HIST("QA/hMultiplicity"), mult); int fpos = 0, fneg = 0, posneg = 0, termn = 0, termp = 0; - int nch = 0, nchCor = 0; - double posWeight = 0, negWeight = 0; + int nch = 0, nchTotal = 0; + double posWeight = 0, negWeight = 0, nchCor = 0, nchTotalCor = 0; for (const auto& track : tracks) { - fillBeforeQA(track); - if (!selTrack(track)) - continue; - nch += 1; - fillAfterQA(track); - histogramRegistry.fill(HIST("data/hEta_cent"), cent, track.eta()); - histogramRegistry.fill(HIST("data/hPt_cent"), cent, track.pt()); double eff = getEfficiency(track.pt(), track.eta(), efficiency); if (eff < threshold) continue; double weight = 1.0 / eff; - histogramRegistry.fill(HIST("cor/hPt_cor"), track.pt(), weight); - histogramRegistry.fill(HIST("cor/hEta_cor"), track.eta(), weight); + fillBeforeQA(track); + nchTotal += 1; + nchTotalCor += weight; + if (!selTrack(track)) + continue; + nch += 1; + fillAfterQA(track); + histogramRegistry.fill(HIST("QA/cent_hEta"), cent, track.eta()); + histogramRegistry.fill(HIST("QA/cent_hPt"), cent, track.pt()); + histogramRegistry.fill(HIST("data/hPt_cor"), track.pt(), weight); + histogramRegistry.fill(HIST("data/hEta_cor"), track.eta(), weight); nchCor += weight; if (track.sign() == 1) { @@ -438,11 +450,13 @@ struct NetchargeFluctuations { termp = fpos * (fpos - 1); termn = fneg * (fneg - 1); posneg = fpos * fneg; - histogramRegistry.fill(HIST("cor/nch_vs_nchCor"), nch, nchCor); - histogramRegistry.fill(HIST("cor/nchCor"), nchCor); - histogramRegistry.fill(HIST("cor/cent_nchCor"), cent, nchCor); - histogramRegistry.fill(HIST("cor/fpos_cent"), cent, posWeight); - histogramRegistry.fill(HIST("cor/fneg_cent"), cent, negWeight); + histogramRegistry.fill(HIST("data/cent_nchTotal"), cent, nchTotal); + histogramRegistry.fill(HIST("data/cent_nchTotalCor"), cent, nchTotalCor); + histogramRegistry.fill(HIST("data/nch_nchCor"), nch, nchCor); + histogramRegistry.fill(HIST("data/nchCor"), nchCor); + histogramRegistry.fill(HIST("data/cent_nchCor"), cent, nchCor); + histogramRegistry.fill(HIST("data/cent_pos_cor"), cent, posWeight); + histogramRegistry.fill(HIST("data/cent_neg_cor"), cent, negWeight); fillHistograms(nch, cent, fpos, fneg, posneg, termp, termn); } @@ -455,13 +469,13 @@ struct NetchargeFluctuations { } histogramRegistry.fill(HIST("gen/hVtxZ_before"), coll.mcCollision().posZ()); float cent = -1, mult = -1; - histogramRegistry.fill(HIST("data/hVtxZ_before"), coll.posZ()); + histogramRegistry.fill(HIST("QA/hVtxZ_before"), coll.posZ()); if (!selCollision(coll, cent, mult)) { return; } - histogramRegistry.fill(HIST("data/hVtxZ_after"), coll.posZ()); - histogramRegistry.fill(HIST("data/hCentrality"), cent); - histogramRegistry.fill(HIST("data/hMultiplicity"), mult); + histogramRegistry.fill(HIST("QA/hVtxZ_after"), coll.posZ()); + histogramRegistry.fill(HIST("QA/hCentrality"), cent); + histogramRegistry.fill(HIST("QA/hMultiplicity"), mult); int fpos = 0, fneg = 0, posneg = 0, termn = 0, termp = 0; int nch = 0, nchCor = 0; @@ -473,16 +487,15 @@ struct NetchargeFluctuations { continue; nch += 1; fillAfterQA(track); - histogramRegistry.fill(HIST("data/hEta_cent"), cent, track.eta()); - histogramRegistry.fill(HIST("data/hPt_cent"), cent, track.pt()); + histogramRegistry.fill(HIST("QA/cent_hEta"), cent, track.eta()); + histogramRegistry.fill(HIST("QA/cent_hPt"), cent, track.pt()); double eff = getEfficiency(track.pt(), track.eta(), efficiency); if (eff < threshold) continue; double weight = 1.0 / eff; - histogramRegistry.fill(HIST("cor/hPt_cor"), track.pt(), weight); - histogramRegistry.fill(HIST("cor/hEta_cor"), track.eta(), weight); - nchCor += weight; + histogramRegistry.fill(HIST("data/hPt_cor"), track.pt(), weight); + histogramRegistry.fill(HIST("data/hEta_cor"), track.eta(), weight); if (track.sign() == 1) { fpos += 1; @@ -491,17 +504,16 @@ struct NetchargeFluctuations { fneg += 1; negRecWeight += weight; } + nchCor = posRecWeight + negRecWeight; } // track termp = fpos * (fpos - 1); - termn = fneg * (fneg - 1); - posneg = fpos * fneg; - histogramRegistry.fill(HIST("cor/nch_vs_nchCor"), nch, nchCor); - histogramRegistry.fill(HIST("cor/nchCor"), nchCor); - histogramRegistry.fill(HIST("cor/cent_nchCor"), cent, nchCor); - histogramRegistry.fill(HIST("cor/fpos_cent"), cent, posRecWeight); - histogramRegistry.fill(HIST("cor/fneg_cent"), cent, negRecWeight); + histogramRegistry.fill(HIST("data/nch_nchCor"), nch, nchCor); + histogramRegistry.fill(HIST("data/nchCor"), nchCor); + histogramRegistry.fill(HIST("data/cent_nchCor"), cent, nchCor); + histogramRegistry.fill(HIST("data/cent_pos_cor"), cent, posRecWeight); + histogramRegistry.fill(HIST("data/cent_neg_cor"), cent, negRecWeight); fillHistograms(nch, cent, fpos, fneg, posneg, termp, termn); @@ -513,6 +525,8 @@ struct NetchargeFluctuations { const auto& mcpartgen = mcParticles.sliceByCached(aod::mcparticle::mcCollisionId, mccolgen.globalIndex(), cache); histogramRegistry.fill(HIST("gen/hVtxZ_after"), mccolgen.posZ()); for (const auto& mcpart : mcpartgen) { + if (std::fabs(mcpart.eta()) >= etaCut) + continue; if (!mcpart.isPhysicalPrimary()) continue; int pid = mcpart.pdgCode(); @@ -523,16 +537,20 @@ struct NetchargeFluctuations { } if (sign == 0) continue; - if (std::abs(pid) != kElectron && std::abs(pid) != kMuonMinus && std::abs(pid) != kPiPlus && std::abs(pid) != kKPlus && std::abs(pid) != kProton) + if (std::abs(pid) != kElectron && + std::abs(pid) != kMuonMinus && + std::abs(pid) != kPiPlus && + std::abs(pid) != kKPlus && + std::abs(pid) != kProton) continue; - if (std::fabs(mcpart.eta()) > etaCut) + if (std::fabs(mcpart.eta()) >= etaCut) continue; if ((mcpart.pt() <= ptMinCut) || (mcpart.pt() >= ptMaxCut)) continue; histogramRegistry.fill(HIST("gen/hPt"), mcpart.pt()); - histogramRegistry.fill(HIST("gen/hPt_cent"), cent, mcpart.pt()); + histogramRegistry.fill(HIST("gen/cent_hPt"), cent, mcpart.pt()); histogramRegistry.fill(HIST("gen/hEta"), mcpart.eta()); - histogramRegistry.fill(HIST("gen/hEta_cent"), cent, mcpart.eta()); + histogramRegistry.fill(HIST("gen/cent_hEta"), cent, mcpart.eta()); histogramRegistry.fill(HIST("gen/hSign"), sign); histogramRegistry.fill(HIST("gen/hPt_eta"), mcpart.pt(), mcpart.eta()); nchGen += 1; @@ -542,18 +560,18 @@ struct NetchargeFluctuations { if (sign == -1) { negGen += 1; } - } // particle + } termPGen = posGen * (posGen - 1); termNGen = negGen * (negGen - 1); posNegGen = posGen * negGen; - histogramRegistry.fill(HIST("cent/gen_pos"), cent, posGen); - histogramRegistry.fill(HIST("cent/gen_neg"), cent, negGen); - histogramRegistry.fill(HIST("cent/gen_termp"), cent, termPGen); - histogramRegistry.fill(HIST("cent/gen_termn"), cent, termNGen); - histogramRegistry.fill(HIST("cent/gen_pos_sq"), cent, posGen * posGen); - histogramRegistry.fill(HIST("cent/gen_neg_sq"), cent, negGen * negGen); - histogramRegistry.fill(HIST("cent/gen_posneg"), cent, posNegGen); - histogramRegistry.fill(HIST("cent/gen_nch"), cent, nchGen); + histogramRegistry.fill(HIST("gen/cent_pos"), cent, posGen); + histogramRegistry.fill(HIST("gen/cent_neg"), cent, negGen); + histogramRegistry.fill(HIST("gen/cent_termp"), cent, termPGen); + histogramRegistry.fill(HIST("gen/cent_termn"), cent, termNGen); + histogramRegistry.fill(HIST("gen/cent_pos_sq"), cent, posGen * posGen); + histogramRegistry.fill(HIST("gen/cent_neg_sq"), cent, negGen * negGen); + histogramRegistry.fill(HIST("gen/cent_posneg"), cent, posNegGen); + histogramRegistry.fill(HIST("gen/cent_nch"), cent, nchGen); histogramRegistry.fill(HIST("gen/nch"), nchGen); } // void @@ -566,22 +584,33 @@ struct NetchargeFluctuations { return; if (!(cent >= centMin && cent < centMax)) return; - histogramRegistry.fill(HIST("delta_eta/cent"), cent); + histogramRegistry.fill(HIST("data/delta_eta_cent"), cent); - int fpos = 0, fneg = 0, posneg = 0, termn = 0, termp = 0; + int fpos = 0, fneg = 0, posneg = 0, termn = 0, termp = 0, nch = 0, nchTotal = 0; + double nchCor = 0, posWeight = 0, negWeight = 0; for (const auto& track : tracks) { + nchTotal += 1; if (!selTrack(track)) continue; + nch += 1; + double eff = getEfficiency(track.pt(), track.eta(), efficiency); + if (eff < threshold) + continue; + double weight = 1.0 / eff; + nchCor += weight; double eta = track.eta(); if (eta < deta1 || eta > deta2) continue; - histogramRegistry.fill(HIST("delta_eta/track_eta"), eta); + histogramRegistry.fill(HIST("data/delta_eta_eta"), eta); - if (track.sign() == 1) + if (track.sign() == 1) { fpos++; - else if (track.sign() == -1) + posWeight += weight; + } else if (track.sign() == -1) { fneg++; + negWeight += weight; + } } termp = fpos * (fpos - 1); termn = fneg * (fneg - 1); @@ -589,15 +618,144 @@ struct NetchargeFluctuations { float deltaEtaWidth = deta2 - deta1 + 1e-5f; - histogramRegistry.fill(HIST("delta_eta/pos"), deltaEtaWidth, fpos); - histogramRegistry.fill(HIST("delta_eta/neg"), deltaEtaWidth, fneg); - histogramRegistry.fill(HIST("delta_eta/termp"), deltaEtaWidth, termp); - histogramRegistry.fill(HIST("delta_eta/termn"), deltaEtaWidth, termn); - histogramRegistry.fill(HIST("delta_eta/pos_sq"), deltaEtaWidth, fpos * fpos); - histogramRegistry.fill(HIST("delta_eta/neg_sq"), deltaEtaWidth, fneg * fneg); - histogramRegistry.fill(HIST("delta_eta/posneg"), deltaEtaWidth, posneg); + histogramRegistry.fill(HIST("data/delta_eta_nchTotal"), deltaEtaWidth, nchTotal); + histogramRegistry.fill(HIST("data/delta_eta_nch"), deltaEtaWidth, nch); + histogramRegistry.fill(HIST("data/delta_eta_nchCor"), deltaEtaWidth, nchCor); + histogramRegistry.fill(HIST("data/delta_eta_pos"), deltaEtaWidth, fpos); + histogramRegistry.fill(HIST("data/delta_eta_pos_cor"), deltaEtaWidth, posWeight); + histogramRegistry.fill(HIST("data/delta_eta_neg"), deltaEtaWidth, fneg); + histogramRegistry.fill(HIST("data/delta_eta_neg_cor"), deltaEtaWidth, negWeight); + histogramRegistry.fill(HIST("data/delta_eta_termp"), deltaEtaWidth, termp); + histogramRegistry.fill(HIST("data/delta_eta_termn"), deltaEtaWidth, termn); + histogramRegistry.fill(HIST("data/delta_eta_pos_sq"), deltaEtaWidth, fpos * fpos); + histogramRegistry.fill(HIST("data/delta_eta_neg_sq"), deltaEtaWidth, fneg * fneg); + histogramRegistry.fill(HIST("data/delta_eta_posneg"), deltaEtaWidth, posneg); } + template + void calculationMcDeltaEta(C const& coll, T const& inputTracks, M const& mcCollisions, P const& mcParticles, float deta1, float deta2) + { + (void)mcCollisions; + + if (!coll.has_mcCollision()) + return; + + float cent = -1, mult = -1; + if (!selCollision(coll, cent, mult)) + return; + if (!(cent >= centMin && cent < centMax)) + return; + histogramRegistry.fill(HIST("data/delta_eta_cent"), cent); + + float deltaEtaWidth = deta2 - deta1 + 1e-5f; + + int fpos = 0, fneg = 0, posneg = 0, termn = 0, termp = 0; + int nch = 0, nchTotal = 0; + double nchCor = 0, posRecWeight = 0, negRecWeight = 0; + + for (const auto& track : inputTracks) { + nchTotal += 1; + if (!selTrack(track)) + continue; + double eta = track.eta(); + if (eta < deta1 || eta > deta2) + continue; + + histogramRegistry.fill(HIST("data/delta_eta_eta"), eta); + double eff = getEfficiency(track.pt(), eta, efficiency); + if (eff < threshold) + continue; + double weight = 1.0 / eff; + nch += 1; + nchCor += weight; + if (track.sign() == 1) { + fpos += 1; + posRecWeight += weight; + } else if (track.sign() == -1) { + fneg += 1; + negRecWeight += weight; + } + } // tracks + + termp = fpos * (fpos - 1); + termn = fneg * (fneg - 1); + posneg = fpos * fneg; + + histogramRegistry.fill(HIST("data/delta_eta_nchTotal"), deltaEtaWidth, nchTotal); + histogramRegistry.fill(HIST("data/delta_eta_nch"), deltaEtaWidth, nch); + histogramRegistry.fill(HIST("data/delta_eta_nchCor"), deltaEtaWidth, nchCor); + histogramRegistry.fill(HIST("data/delta_eta_pos"), deltaEtaWidth, fpos); + histogramRegistry.fill(HIST("data/delta_eta_pos_cor"), deltaEtaWidth, posRecWeight); + histogramRegistry.fill(HIST("data/delta_eta_neg"), deltaEtaWidth, fneg); + histogramRegistry.fill(HIST("data/delta_eta_neg_cor"), deltaEtaWidth, negRecWeight); + histogramRegistry.fill(HIST("data/delta_eta_termp"), deltaEtaWidth, termp); + histogramRegistry.fill(HIST("data/delta_eta_termn"), deltaEtaWidth, termn); + histogramRegistry.fill(HIST("data/delta_eta_pos_sq"), deltaEtaWidth, fpos * fpos); + histogramRegistry.fill(HIST("data/delta_eta_neg_sq"), deltaEtaWidth, fneg * fneg); + histogramRegistry.fill(HIST("data/delta_eta_posneg"), deltaEtaWidth, posneg); + + const auto& mccolgen = coll.template mcCollision_as(); + + if (std::abs(mccolgen.posZ()) > vertexZcut) + return; + + const auto& mcpartgen = mcParticles.sliceByCached(aod::mcparticle::mcCollisionId, mccolgen.globalIndex(), cache); + + int posGen = 0, negGen = 0, posNegGen = 0, termNGen = 0, termPGen = 0, nchGen = 0; + for (const auto& mcpart : mcpartgen) { + if (!mcpart.isPhysicalPrimary()) + continue; + + int pid = mcpart.pdgCode(); + auto sign = 0; + auto* pd = pdgService->GetParticle(pid); + if (pd != nullptr) { + sign = pd->Charge() / 3.; + } + if (sign == 0) + continue; + if (std::abs(pid) != kElectron && + std::abs(pid) != kMuonMinus && + std::abs(pid) != kPiPlus && + std::abs(pid) != kKPlus && + std::abs(pid) != kProton) + continue; + + if (std::fabs(mcpart.eta()) >= etaCut) + continue; + if ((mcpart.pt() <= ptMinCut) || (mcpart.pt() >= ptMaxCut)) + continue; + + double mcEta = mcpart.eta(); + if (mcEta < deta1 || mcEta > deta2) + continue; + + histogramRegistry.fill(HIST("gen/delta_eta_eta"), mcpart.eta()); + + nchGen += 1; + if (sign == 1) { + posGen += 1; + } + if (sign == -1) { + negGen += 1; + } + } + + termPGen = posGen * (posGen - 1); + termNGen = negGen * (negGen - 1); + posNegGen = posGen * negGen; + + histogramRegistry.fill(HIST("gen/delta_eta_pos"), deltaEtaWidth, posGen); + histogramRegistry.fill(HIST("gen/delta_eta_neg"), deltaEtaWidth, negGen); + histogramRegistry.fill(HIST("gen/delta_eta_termp"), deltaEtaWidth, termPGen); + histogramRegistry.fill(HIST("gen/delta_eta_termn"), deltaEtaWidth, termNGen); + histogramRegistry.fill(HIST("gen/delta_eta_pos_sq"), deltaEtaWidth, posGen * posGen); + histogramRegistry.fill(HIST("gen/delta_eta_neg_sq"), deltaEtaWidth, negGen * negGen); + histogramRegistry.fill(HIST("gen/delta_eta_posneg"), deltaEtaWidth, posNegGen); + histogramRegistry.fill(HIST("gen/delta_eta_nch"), deltaEtaWidth, nchGen); + + } // void + SliceCache cache; Preslice mcTrack = o2::aod::mcparticle::mcCollisionId; @@ -613,7 +771,7 @@ struct NetchargeFluctuations { } } - PROCESS_SWITCH(NetchargeFluctuations, processDataRun3, "Process for Run3 DATA", false); + PROCESS_SWITCH(NetchargeFluctuations, processDataRun3, "Process for Run3 DATA", true); // process function for Data Run2 void processDataRun2(aod::MyCollisionRun2 const& coll, aod::MyTracks const& tracks) @@ -635,15 +793,12 @@ struct NetchargeFluctuations { aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) { calculationMc(coll, inputTracks, mcCollisions, mcParticles); - for (int ii = 0; ii < deltaEta; ii++) { float etaMin = -0.1f * (ii + 1); float etaMax = 0.1f * (ii + 1); - - calculationDeltaEta(coll, inputTracks, etaMin, etaMax); + calculationMcDeltaEta(coll, inputTracks, mcCollisions, mcParticles, etaMin, etaMax); } } - PROCESS_SWITCH(NetchargeFluctuations, processMcRun3, "Process reconstructed", false); // process function for MC Run2 @@ -653,14 +808,13 @@ struct NetchargeFluctuations { { calculationMc(coll, inputTracks, mcCollisions, mcParticles); for (int ii = 0; ii < deltaEta; ii++) { - float etaMin = -0.1f * (ii + 1); // -0.1, -0.2, ..., -0.8 - float etaMax = 0.1f * (ii + 1); // +0.1, +0.2, ..., +0.8 - - calculationDeltaEta(coll, inputTracks, etaMin, etaMax); + float etaMin = -0.1f * (ii + 1); + float etaMax = 0.1f * (ii + 1); + calculationMcDeltaEta(coll, inputTracks, mcCollisions, mcParticles, etaMin, etaMax); } } - PROCESS_SWITCH(NetchargeFluctuations, processMcRun2, "Process reconstructed", true); + PROCESS_SWITCH(NetchargeFluctuations, processMcRun2, "Process reconstructed", false); }; // struct From 2c13a55b7f223674eba36de613686a8c361a97ce Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Thu, 7 Aug 2025 20:16:50 +0200 Subject: [PATCH 283/345] [PWGEM/PhotonMeson] remove track::x,y,z from derived data (#12474) --- PWGEM/Dilepton/Core/PhotonHBT.h | 2 -- PWGEM/Dilepton/DataModel/dileptonTables.h | 5 +++ PWGEM/PhotonMeson/Core/CutsLibrary.cxx | 12 +++---- PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h | 2 -- PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h | 2 -- PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h | 2 -- PWGEM/PhotonMeson/Core/TaggingPi0.h | 2 -- PWGEM/PhotonMeson/Core/TaggingPi0MC.h | 2 -- PWGEM/PhotonMeson/Core/V0PhotonCut.cxx | 6 ---- PWGEM/PhotonMeson/Core/V0PhotonCut.h | 32 ------------------- PWGEM/PhotonMeson/DataModel/gammaTables.h | 14 +++++--- .../TableProducer/photonconversionbuilder.cxx | 16 ++++++---- .../TableProducer/skimmerGammaConversion.cxx | 3 +- .../skimmerPrimaryElectronFromDalitzEE.cxx | 12 +++---- .../electronFromDalitzConverter1.cxx | 3 +- .../Tasks/Converters/pcmConverter1.cxx | 6 +--- PWGEM/PhotonMeson/Tasks/pcmQC.cxx | 14 ++++---- PWGEM/PhotonMeson/Tasks/pcmQCMC.cxx | 14 ++++---- PWGEM/PhotonMeson/Tasks/prefilterPhoton.cxx | 2 -- 19 files changed, 51 insertions(+), 100 deletions(-) diff --git a/PWGEM/Dilepton/Core/PhotonHBT.h b/PWGEM/Dilepton/Core/PhotonHBT.h index 6dde60789ea..678c3e800f3 100644 --- a/PWGEM/Dilepton/Core/PhotonHBT.h +++ b/PWGEM/Dilepton/Core/PhotonHBT.h @@ -161,7 +161,6 @@ struct PhotonHBT { Configurable cfg_min_cospa{"cfg_min_cospa", 0.997, "min V0 CosPA"}; Configurable cfg_max_pca{"cfg_max_pca", 3.0, "max distance btween 2 legs"}; Configurable cfg_max_chi2kf{"cfg_max_chi2kf", 1e+10, "max chi2/ndf with KF"}; - Configurable cfg_require_v0_with_correct_xz{"cfg_require_v0_with_correct_xz", true, "flag to select V0s with correct xz"}; Configurable cfg_reject_v0_on_itsib{"cfg_reject_v0_on_itsib", true, "flag to reject V0s on ITSib"}; Configurable cfg_disable_itsonly_track{"cfg_disable_itsonly_track", false, "flag to disable ITSonly tracks"}; @@ -536,7 +535,6 @@ struct PhotonHBT { fV0PhotonCut.SetDisableTPConly(pcmcuts.cfg_disable_tpconly_track); fV0PhotonCut.SetNClustersITS(0, 7); fV0PhotonCut.SetMeanClusterSizeITSob(0.0, 16.0); - fV0PhotonCut.SetIsWithinBeamPipe(pcmcuts.cfg_require_v0_with_correct_xz); fV0PhotonCut.SetRequireITSTPC(pcmcuts.cfg_require_v0_with_itstpc); fV0PhotonCut.SetRequireITSonly(pcmcuts.cfg_require_v0_with_itsonly); fV0PhotonCut.SetRequireTPConly(pcmcuts.cfg_require_v0_with_tpconly); diff --git a/PWGEM/Dilepton/DataModel/dileptonTables.h b/PWGEM/Dilepton/DataModel/dileptonTables.h index 45206422dc4..afd7dfc4dd9 100644 --- a/PWGEM/Dilepton/DataModel/dileptonTables.h +++ b/PWGEM/Dilepton/DataModel/dileptonTables.h @@ -641,6 +641,11 @@ using EMPrimaryElectronsCov = EMPrimaryElectronsCov_001; // iterators using EMPrimaryElectronCov = EMPrimaryElectronsCov::iterator; +DECLARE_SOA_TABLE_VERSIONED(EMPrimaryElectronsDeDxMC_000, "AOD", "EMPRMELDEDXMC", 0, mcpidtpc::DeDxTunedMc, o2::soa::Marker<1>); +using EMPrimaryElectronsDeDxMC = EMPrimaryElectronsDeDxMC_000; +// iterators +using EMPrimaryElectronDeDxMC = EMPrimaryElectronsDeDxMC::iterator; + DECLARE_SOA_TABLE(EMPrimaryElectronEMEventIds, "AOD", "PRMELMEVENTID", emprimaryelectron::EMEventId); // To be joined with EMPrimaryElectrons table at analysis level. // iterators using EMPrimaryElectronEMEventId = EMPrimaryElectronEMEventIds::iterator; diff --git a/PWGEM/PhotonMeson/Core/CutsLibrary.cxx b/PWGEM/PhotonMeson/Core/CutsLibrary.cxx index c2f313e6e62..d8475e550e9 100644 --- a/PWGEM/PhotonMeson/Core/CutsLibrary.cxx +++ b/PWGEM/PhotonMeson/Core/CutsLibrary.cxx @@ -132,7 +132,7 @@ V0PhotonCut* o2::aod::pwgem::photon::pcmcuts::GetCut(const char* cutName) cut->SetChi2PerClusterITS(-1e+10, 5.0); cut->SetNClustersITS(2, 4); cut->SetMeanClusterSizeITSob(0.0, 16.0); - cut->SetIsWithinBeamPipe(true); + // cut->SetIsWithinBeamPipe(true); // for v0 cut->SetMinCosPA(0.99); cut->SetMaxPCA(3.0); @@ -201,7 +201,7 @@ V0PhotonCut* o2::aod::pwgem::photon::pcmcuts::GetCut(const char* cutName) cut->SetChi2PerClusterITS(-1e+10, 5.0); cut->SetNClustersITS(2, 4); cut->SetMeanClusterSizeITSob(0.0, 16.0); - cut->SetIsWithinBeamPipe(true); + // cut->SetIsWithinBeamPipe(true); // for v0 cut->SetMinCosPA(0.995); cut->SetMaxPCA(0.5); @@ -216,7 +216,7 @@ V0PhotonCut* o2::aod::pwgem::photon::pcmcuts::GetCut(const char* cutName) cut->SetChi2PerClusterITS(-1e+10, 5.0); cut->SetNClustersITS(2, 4); cut->SetMeanClusterSizeITSob(0.0, 16.0); - cut->SetIsWithinBeamPipe(true); + // cut->SetIsWithinBeamPipe(true); cut->SetRequireITSTPC(true); // for v0 cut->SetMinCosPA(0.99); @@ -232,7 +232,7 @@ V0PhotonCut* o2::aod::pwgem::photon::pcmcuts::GetCut(const char* cutName) cut->SetChi2PerClusterITS(-1e+10, 5.0); cut->SetNClustersITS(2, 4); cut->SetMeanClusterSizeITSob(0.0, 16.0); - cut->SetIsWithinBeamPipe(true); + // cut->SetIsWithinBeamPipe(true); // for v0 cut->SetMinCosPA(0.99); cut->SetMaxPCA(3.0); @@ -249,7 +249,7 @@ V0PhotonCut* o2::aod::pwgem::photon::pcmcuts::GetCut(const char* cutName) cut->SetChi2PerClusterITS(-1e+10, 5.0); cut->SetNClustersITS(2, 4); cut->SetMeanClusterSizeITSob(0.0, 16.0); - cut->SetIsWithinBeamPipe(false); + // cut->SetIsWithinBeamPipe(false); // for v0 cut->SetMinCosPA(0.95); cut->SetMaxPCA(3.0); @@ -265,7 +265,7 @@ V0PhotonCut* o2::aod::pwgem::photon::pcmcuts::GetCut(const char* cutName) cut->SetChi2PerClusterITS(-1e+10, 5.0); cut->SetNClustersITS(2, 4); cut->SetMeanClusterSizeITSob(0.0, 16.0); - cut->SetIsWithinBeamPipe(false); + // cut->SetIsWithinBeamPipe(false); // for v0 cut->SetMinCosPA(0.95); cut->SetMaxPCA(3.0); diff --git a/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h b/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h index 6e3b4f0c8e4..07a35ca0da6 100644 --- a/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h +++ b/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h @@ -152,7 +152,6 @@ struct DiphotonHadronMPC { Configurable cfg_min_cospa{"cfg_min_cospa", 0.997, "min V0 CosPA"}; Configurable cfg_max_pca{"cfg_max_pca", 3.0, "max distance btween 2 legs"}; Configurable cfg_max_chi2kf{"cfg_max_chi2kf", 1e+10, "max chi2/ndf with KF"}; - Configurable cfg_require_v0_with_correct_xz{"cfg_require_v0_with_correct_xz", false, "flag to select V0s with correct xz"}; Configurable cfg_reject_v0_on_itsib{"cfg_reject_v0_on_itsib", true, "flag to reject V0s on ITSib"}; Configurable cfg_apply_cuts_from_prefilter_derived{"cfg_apply_cuts_from_prefilter_derived", false, "flag to apply prefilter to V0"}; @@ -415,7 +414,6 @@ struct DiphotonHadronMPC { fV0PhotonCut.SetChi2PerClusterITS(-1e+10, pcmcuts.cfg_max_chi2its); fV0PhotonCut.SetNClustersITS(0, 7); fV0PhotonCut.SetMeanClusterSizeITSob(0.0, 16.0); - fV0PhotonCut.SetIsWithinBeamPipe(pcmcuts.cfg_require_v0_with_correct_xz); fV0PhotonCut.SetDisableITSonly(pcmcuts.cfg_disable_itsonly_track); fV0PhotonCut.SetDisableTPConly(pcmcuts.cfg_disable_tpconly_track); fV0PhotonCut.SetRequireITSTPC(pcmcuts.cfg_require_v0_with_itstpc); diff --git a/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h b/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h index 3a1b99b4ed8..cf859a59fc4 100644 --- a/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h +++ b/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h @@ -148,7 +148,6 @@ struct Pi0EtaToGammaGamma { Configurable cfg_min_cospa{"cfg_min_cospa", 0.999, "min V0 CosPA"}; Configurable cfg_max_pca{"cfg_max_pca", 1.5, "max distance btween 2 legs"}; Configurable cfg_max_chi2kf{"cfg_max_chi2kf", 1e+10, "max chi2/ndf with KF"}; - Configurable cfg_require_v0_with_correct_xz{"cfg_require_v0_with_correct_xz", false, "flag to select V0s with correct xz"}; Configurable cfg_reject_v0_on_itsib{"cfg_reject_v0_on_itsib", true, "flag to reject V0s on ITSib"}; Configurable cfg_apply_cuts_from_prefilter_derived{"cfg_apply_cuts_from_prefilter_derived", false, "flag to apply prefilter to V0"}; @@ -374,7 +373,6 @@ struct Pi0EtaToGammaGamma { fV0PhotonCut.SetChi2PerClusterITS(-1e+10, pcmcuts.cfg_max_chi2its); fV0PhotonCut.SetNClustersITS(0, 7); fV0PhotonCut.SetMeanClusterSizeITSob(0.0, 16.0); - fV0PhotonCut.SetIsWithinBeamPipe(pcmcuts.cfg_require_v0_with_correct_xz); fV0PhotonCut.SetDisableITSonly(pcmcuts.cfg_disable_itsonly_track); fV0PhotonCut.SetDisableTPConly(pcmcuts.cfg_disable_tpconly_track); fV0PhotonCut.SetRequireITSTPC(pcmcuts.cfg_require_v0_with_itstpc); diff --git a/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h b/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h index 2a0abf941f2..b329e9a52a3 100644 --- a/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h +++ b/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h @@ -134,7 +134,6 @@ struct Pi0EtaToGammaGammaMC { Configurable cfg_min_cospa{"cfg_min_cospa", 0.999, "min V0 CosPA"}; Configurable cfg_max_pca{"cfg_max_pca", 1.5, "max distance btween 2 legs"}; Configurable cfg_max_chi2kf{"cfg_max_chi2kf", 1e+10, "max chi2/ndf with KF"}; - Configurable cfg_require_v0_with_correct_xz{"cfg_require_v0_with_correct_xz", false, "flag to select V0s with correct xz"}; Configurable cfg_reject_v0_on_itsib{"cfg_reject_v0_on_itsib", true, "flag to reject V0s on ITSib"}; Configurable cfg_apply_cuts_from_prefilter_derived{"cfg_apply_cuts_from_prefilter_derived", false, "flag to apply prefilter to V0"}; @@ -333,7 +332,6 @@ struct Pi0EtaToGammaGammaMC { fV0PhotonCut.SetChi2PerClusterITS(-1e+10, pcmcuts.cfg_max_chi2its); fV0PhotonCut.SetNClustersITS(0, 7); fV0PhotonCut.SetMeanClusterSizeITSob(0.0, 16.0); - fV0PhotonCut.SetIsWithinBeamPipe(pcmcuts.cfg_require_v0_with_correct_xz); fV0PhotonCut.SetDisableITSonly(pcmcuts.cfg_disable_itsonly_track); fV0PhotonCut.SetDisableTPConly(pcmcuts.cfg_disable_tpconly_track); fV0PhotonCut.SetRequireITSTPC(pcmcuts.cfg_require_v0_with_itstpc); diff --git a/PWGEM/PhotonMeson/Core/TaggingPi0.h b/PWGEM/PhotonMeson/Core/TaggingPi0.h index d74af2ceb0c..5f37d60d277 100644 --- a/PWGEM/PhotonMeson/Core/TaggingPi0.h +++ b/PWGEM/PhotonMeson/Core/TaggingPi0.h @@ -138,7 +138,6 @@ struct TaggingPi0 { Configurable cfg_min_cospa{"cfg_min_cospa", 0.997, "min V0 CosPA"}; Configurable cfg_max_pca{"cfg_max_pca", 3.0, "max distance btween 2 legs"}; Configurable cfg_max_chi2kf{"cfg_max_chi2kf", 1e+10, "max chi2/ndf with KF"}; - Configurable cfg_require_v0_with_correct_xz{"cfg_require_v0_with_correct_xz", true, "flag to select V0s with correct xz"}; Configurable cfg_reject_v0_on_itsib{"cfg_reject_v0_on_itsib", true, "flag to reject V0s on ITSib"}; Configurable cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 10, "min ncluster tpc"}; @@ -369,7 +368,6 @@ struct TaggingPi0 { fV0PhotonCut.SetChi2PerClusterITS(-1e+10, pcmcuts.cfg_max_chi2its); fV0PhotonCut.SetNClustersITS(0, 7); fV0PhotonCut.SetMeanClusterSizeITSob(0.0, 16.0); - fV0PhotonCut.SetIsWithinBeamPipe(pcmcuts.cfg_require_v0_with_correct_xz); fV0PhotonCut.SetDisableITSonly(pcmcuts.cfg_disable_itsonly_track); fV0PhotonCut.SetDisableTPConly(pcmcuts.cfg_disable_tpconly_track); fV0PhotonCut.SetRequireITSTPC(pcmcuts.cfg_require_v0_with_itstpc); diff --git a/PWGEM/PhotonMeson/Core/TaggingPi0MC.h b/PWGEM/PhotonMeson/Core/TaggingPi0MC.h index 56c6274a141..ac3b51be4f2 100644 --- a/PWGEM/PhotonMeson/Core/TaggingPi0MC.h +++ b/PWGEM/PhotonMeson/Core/TaggingPi0MC.h @@ -130,7 +130,6 @@ struct TaggingPi0MC { Configurable cfg_min_cospa{"cfg_min_cospa", 0.997, "min V0 CosPA"}; Configurable cfg_max_pca{"cfg_max_pca", 3.0, "max distance btween 2 legs"}; Configurable cfg_max_chi2kf{"cfg_max_chi2kf", 1e+10, "max chi2/ndf with KF"}; - Configurable cfg_require_v0_with_correct_xz{"cfg_require_v0_with_correct_xz", true, "flag to select V0s with correct xz"}; Configurable cfg_reject_v0_on_itsib{"cfg_reject_v0_on_itsib", true, "flag to reject V0s on ITSib"}; Configurable cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 10, "min ncluster tpc"}; @@ -339,7 +338,6 @@ struct TaggingPi0MC { fV0PhotonCut.SetChi2PerClusterITS(-1e+10, pcmcuts.cfg_max_chi2its); fV0PhotonCut.SetNClustersITS(0, 7); fV0PhotonCut.SetMeanClusterSizeITSob(0.0, 16.0); - fV0PhotonCut.SetIsWithinBeamPipe(pcmcuts.cfg_require_v0_with_correct_xz); fV0PhotonCut.SetDisableITSonly(pcmcuts.cfg_disable_itsonly_track); fV0PhotonCut.SetDisableTPConly(pcmcuts.cfg_disable_tpconly_track); fV0PhotonCut.SetRequireITSTPC(pcmcuts.cfg_require_v0_with_itstpc); diff --git a/PWGEM/PhotonMeson/Core/V0PhotonCut.cxx b/PWGEM/PhotonMeson/Core/V0PhotonCut.cxx index 07d805fa291..4c149b7fd20 100644 --- a/PWGEM/PhotonMeson/Core/V0PhotonCut.cxx +++ b/PWGEM/PhotonMeson/Core/V0PhotonCut.cxx @@ -193,12 +193,6 @@ void V0PhotonCut::SetMeanClusterSizeITSob(float min, float max) LOG(info) << "V0 Photon Cut, set mean cluster size ITS range: " << mMinMeanClusterSizeITS << " - " << mMaxMeanClusterSizeITS; } -void V0PhotonCut::SetIsWithinBeamPipe(bool flag) -{ - mIsWithinBP = flag; - LOG(info) << "V0 Photon Cut, propagated to within beam pipe: " << mIsWithinBP; -} - void V0PhotonCut::SetRequireITSTPC(bool flag) { mRequireITSTPC = flag; diff --git a/PWGEM/PhotonMeson/Core/V0PhotonCut.h b/PWGEM/PhotonMeson/Core/V0PhotonCut.h index ac4ff278e4a..dcd9cd2c5ce 100644 --- a/PWGEM/PhotonMeson/Core/V0PhotonCut.h +++ b/PWGEM/PhotonMeson/Core/V0PhotonCut.h @@ -66,7 +66,6 @@ class V0PhotonCut : public TNamed kITSNCls, kITSChi2NDF, kITSClusterSize, - kIsWithinBeamPipe, kRequireITSTPC, kRequireITSonly, kRequireTPConly, @@ -142,9 +141,6 @@ class V0PhotonCut : public TNamed if (!IsSelectedTrack(track, V0PhotonCuts::kDCAz)) { return false; } - if (mIsWithinBP && !IsSelectedTrack(track, V0PhotonCuts::kIsWithinBeamPipe)) { - return false; - } if (!track.hasITS() && !track.hasTPC()) { // track has to be ITSonly or TPConly or ITS-TPC return false; } @@ -271,11 +267,6 @@ class V0PhotonCut : public TNamed if (v0.v0radius() < mMinRxy || mMaxRxy < v0.v0radius()) { return false; } - if (mRejectITSib) { - if (v0.v0radius() < 4.f || v0.pca() < -0.05 * v0.v0radius() + 0.3) { - return false; - } - } return true; } @@ -390,28 +381,6 @@ class V0PhotonCut : public TNamed return mMinMeanClusterSizeITS < track.meanClusterSizeITSob() * std::cos(std::atan(track.tgl())) && track.meanClusterSizeITSob() * std::cos(std::atan(track.tgl())) < mMaxMeanClusterSizeITS; } - case V0PhotonCuts::kIsWithinBeamPipe: { - if (!isTPConlyTrack(track)) { // TPC-TRD, TPC-TOF, TPC-TRD-TOF are constrained. - return true; - } - - // if (abs(track.y()) > abs(track.x() * TMath::Tan(10.f * TMath::DegToRad())) + 15.f) { - // return false; - // } - if (track.x() < 0.1 && std::fabs(track.y()) > 15.f) { - return false; - } - if (track.x() > 82.9 && std::fabs(track.y()) > std::fabs(track.x() * std::tan(10.f * TMath::DegToRad())) + 5.f) { - return false; - } - if (track.x() > 82.9 && std::fabs(track.y()) < 15.0 && abs(abs(track.z()) - 44.5) < 2.5) { - return false; - } - return true; - // const float slope = TMath::Tan(2 * TMath::ATan(TMath::Exp(-0.5))); - // return !(track.x() > 82.9 && abs(track.y()) < 15.f && abs(abs(track.z()) - track.x() / slope) < 3.f && 15.f < abs(track.dcaXY())); - //// return !(track.x() > 82.9 && abs(track.y()) < 40.f && abs(abs(track.z()) - 47.f) < 3.f && 15.f < abs(track.dcaXY())); - } case V0PhotonCuts::kRequireITSTPC: return isITSTPCTrack(track); @@ -517,7 +486,6 @@ class V0PhotonCut : public TNamed float mMaxDcaXY{1e10f}; // max dca in xy plane float mMaxDcaZ{1e10f}; // max dca in z direction std::function mMaxDcaXYPtDep{}; // max dca in xy plane as function of pT - bool mIsWithinBP{false}; bool mRequireITSTPC{false}; bool mRequireITSonly{false}; bool mRequireTPConly{false}; diff --git a/PWGEM/PhotonMeson/DataModel/gammaTables.h b/PWGEM/PhotonMeson/DataModel/gammaTables.h index 7528737e118..a6b7017f550 100644 --- a/PWGEM/PhotonMeson/DataModel/gammaTables.h +++ b/PWGEM/PhotonMeson/DataModel/gammaTables.h @@ -209,8 +209,6 @@ DECLARE_SOA_TABLE_VERSIONED(V0Legs_001, "AOD", "V0LEG", 1, //! track::TPCChi2NCl, track::TPCInnerParam, track::TPCSignal, pidtpc::TPCNSigmaEl, pidtpc::TPCNSigmaPi, track::ITSClusterSizes, track::ITSChi2NCl, track::DetectorMap, - mcpidtpc::DeDxTunedMc, - track::X, track::Y, track::Z, // dynamic column v0leg::P, @@ -231,10 +229,19 @@ DECLARE_SOA_TABLE_VERSIONED(V0Legs_001, "AOD", "V0LEG", 1, //! v0leg::MeanClusterSizeITSob); using V0Legs = V0Legs_001; - // iterators using V0Leg = V0Legs::iterator; +DECLARE_SOA_TABLE_VERSIONED(V0LegsXYZ_000, "AOD", "V0LEGXYZ", 0, track::X, track::Y, track::Z); +using V0LegsXYZ = V0LegsXYZ_000; +// iterators +using V0LegXYZ = V0LegsXYZ::iterator; + +DECLARE_SOA_TABLE_VERSIONED(V0LegsDeDxMC_000, "AOD", "V0LEGDEDXMC", 0, mcpidtpc::DeDxTunedMc, o2::soa::Marker<2>); +using V0LegsDeDxMC = V0LegsDeDxMC_000; +// iterators +using V0LegDeDxMC = V0LegsDeDxMC::iterator; + namespace emevent { DECLARE_SOA_COLUMN(NgPCM, ngpcm, int); @@ -379,7 +386,6 @@ DECLARE_SOA_TABLE_VERSIONED(EMPrimaryElectronsFromDalitz_001, "AOD", "EMPRIMARYE track::TPCSignal, pidtpc::TPCNSigmaEl, pidtpc::TPCNSigmaPi, pidtofbeta::Beta, pidtof::TOFNSigmaEl, track::ITSClusterSizes, track::ITSChi2NCl, track::TOFChi2, track::DetectorMap, - mcpidtpc::DeDxTunedMc, // dynamic column track::TPCNClsFound, diff --git a/PWGEM/PhotonMeson/TableProducer/photonconversionbuilder.cxx b/PWGEM/PhotonMeson/TableProducer/photonconversionbuilder.cxx index d39766cc968..c0eeeba224f 100644 --- a/PWGEM/PhotonMeson/TableProducer/photonconversionbuilder.cxx +++ b/PWGEM/PhotonMeson/TableProducer/photonconversionbuilder.cxx @@ -71,6 +71,8 @@ using MyTracksIUMC = soa::Join v0photonskf; Produces v0legs; + Produces v0legsXYZ; + Produces v0legsDeDxMC; // Produces v0photonskfcov; // Produces events_ngpcm; @@ -367,18 +369,18 @@ struct PhotonConversionBuilder { template void fillTrackTable(TTrack const& track, TShiftedTrack const& shiftedtrack, TKFParticle const& kfp, const float dcaXY, const float dcaZ) { - float mcTunedTPCSignal = 0.f; - if constexpr (isMC) { - mcTunedTPCSignal = track.mcTunedTPCSignal(); - } - v0legs(track.collisionId(), track.globalIndex(), track.sign(), kfp.GetPx(), kfp.GetPy(), kfp.GetPz(), dcaXY, dcaZ, track.tpcNClsFindable(), track.tpcNClsFindableMinusFound(), track.tpcNClsFindableMinusCrossedRows(), track.tpcNClsShared(), track.tpcChi2NCl(), track.tpcInnerParam(), track.tpcSignal(), track.tpcNSigmaEl(), track.tpcNSigmaPi(), - track.itsClusterSizes(), track.itsChi2NCl(), track.detectorMap(), mcTunedTPCSignal, - shiftedtrack.getX(), shiftedtrack.getY(), shiftedtrack.getZ()); + track.itsClusterSizes(), track.itsChi2NCl(), track.detectorMap()); + + v0legsXYZ(shiftedtrack.getX(), shiftedtrack.getY(), shiftedtrack.getZ()); + + if constexpr (isMC) { + v0legsDeDxMC(track.mcTunedTPCSignal()); + } } template diff --git a/PWGEM/PhotonMeson/TableProducer/skimmerGammaConversion.cxx b/PWGEM/PhotonMeson/TableProducer/skimmerGammaConversion.cxx index fadc7a27b48..fa843d22f54 100644 --- a/PWGEM/PhotonMeson/TableProducer/skimmerGammaConversion.cxx +++ b/PWGEM/PhotonMeson/TableProducer/skimmerGammaConversion.cxx @@ -188,8 +188,7 @@ struct skimmerGammaConversion { theTrack.tpcNClsFindable(), theTrack.tpcNClsFindableMinusFound(), theTrack.tpcNClsFindableMinusCrossedRows(), theTrack.tpcNClsShared(), theTrack.tpcChi2NCl(), theTrack.tpcInnerParam(), theTrack.tpcSignal(), theTrack.tpcNSigmaEl(), theTrack.tpcNSigmaPi(), - theTrack.itsClusterSizes(), theTrack.itsChi2NCl(), theTrack.detectorMap(), 0, - theTrack.x(), theTrack.y(), theTrack.z()); + theTrack.itsClusterSizes(), theTrack.itsChi2NCl(), theTrack.detectorMap()); } template diff --git a/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryElectronFromDalitzEE.cxx b/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryElectronFromDalitzEE.cxx index f9aae623469..435e9451a83 100644 --- a/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryElectronFromDalitzEE.cxx +++ b/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryElectronFromDalitzEE.cxx @@ -56,6 +56,7 @@ struct skimmerPrimaryElectronFromDalitzEE { Preslice perCol = o2::aod::track::collisionId; Preslice perCol_pcm = o2::aod::v0photonkf::collisionId; Produces emprimaryelectrons; + Produces emprimaryelectronsDeDxMC; // Configurables Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; @@ -313,18 +314,17 @@ struct skimmerPrimaryElectronFromDalitzEE { template void fillTrackTable(TCollision const& collision, TTrack const& track) { - float mcTunedTPCSignal = 0.f; - if constexpr (isMC) { - mcTunedTPCSignal = track.mcTunedTPCSignal(); - } - emprimaryelectrons(collision.globalIndex(), track.globalIndex(), track.sign(), track.pt(), track.eta(), track.phi(), track.dcaXY(), track.dcaZ(), track.cYY(), track.cZY(), track.cZZ(), track.tpcNClsFindable(), track.tpcNClsFindableMinusFound(), track.tpcNClsFindableMinusCrossedRows(), track.tpcNClsShared(), track.tpcChi2NCl(), track.tpcInnerParam(), track.tpcSignal(), track.tpcNSigmaEl(), track.tpcNSigmaPi(), track.beta(), track.tofNSigmaEl(), - track.itsClusterSizes(), track.itsChi2NCl(), track.tofChi2(), track.detectorMap(), mcTunedTPCSignal); + track.itsClusterSizes(), track.itsChi2NCl(), track.tofChi2(), track.detectorMap()); + + if constexpr (isMC) { + emprimaryelectronsDeDxMC(track.mcTunedTPCSignal()); + } } template diff --git a/PWGEM/PhotonMeson/Tasks/Converters/electronFromDalitzConverter1.cxx b/PWGEM/PhotonMeson/Tasks/Converters/electronFromDalitzConverter1.cxx index 41fa06d1e94..961f8b0dfe7 100644 --- a/PWGEM/PhotonMeson/Tasks/Converters/electronFromDalitzConverter1.cxx +++ b/PWGEM/PhotonMeson/Tasks/Converters/electronFromDalitzConverter1.cxx @@ -57,8 +57,7 @@ struct electronFromDalitzConverter1 { track.itsClusterSizes(), track.itsChi2NCl(), track.tofChi2(), - track.detectorMap(), - 0.f); + track.detectorMap()); } // end of track loop } // end of process diff --git a/PWGEM/PhotonMeson/Tasks/Converters/pcmConverter1.cxx b/PWGEM/PhotonMeson/Tasks/Converters/pcmConverter1.cxx index 313f53be195..1607c30b94a 100644 --- a/PWGEM/PhotonMeson/Tasks/Converters/pcmConverter1.cxx +++ b/PWGEM/PhotonMeson/Tasks/Converters/pcmConverter1.cxx @@ -77,11 +77,7 @@ struct pcmConverter1 { v0leg.tpcNSigmaPi(), v0leg.itsClusterSizes(), v0leg.itsChi2NCl(), - v0leg.detectorMap(), - 0.f, - v0leg.x(), - v0leg.y(), - v0leg.z()); + v0leg.detectorMap()); } // end of v0leg loop } // end of process }; diff --git a/PWGEM/PhotonMeson/Tasks/pcmQC.cxx b/PWGEM/PhotonMeson/Tasks/pcmQC.cxx index eaba34cec81..1b784b5cb18 100644 --- a/PWGEM/PhotonMeson/Tasks/pcmQC.cxx +++ b/PWGEM/PhotonMeson/Tasks/pcmQC.cxx @@ -84,7 +84,6 @@ struct PCMQC { Configurable cfg_min_cospa{"cfg_min_cospa", 0.999, "min V0 CosPA"}; Configurable cfg_max_pca{"cfg_max_pca", 1.5, "max distance btween 2 legs"}; Configurable cfg_max_chi2kf{"cfg_max_chi2kf", 1e+10, "max chi2/ndf with KF"}; - Configurable cfg_require_v0_with_correct_xz{"cfg_require_v0_with_correct_xz", false, "flag to select V0s with correct xz"}; Configurable cfg_reject_v0_on_itsib{"cfg_reject_v0_on_itsib", true, "flag to reject V0s on ITSib"}; Configurable cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 0, "min ncluster tpc"}; Configurable cfg_min_ncrossedrows{"cfg_min_ncrossedrows", 40, "min ncrossed rows"}; @@ -172,9 +171,9 @@ struct PCMQC { fRegistry.add("V0Leg/hChi2ITS", "chi2/number of ITS clusters", kTH1F, {{100, 0, 10}}, false); fRegistry.add("V0Leg/hITSClusterMap", "ITS cluster map", kTH1F, {{128, -0.5, 127.5}}, false); fRegistry.add("V0Leg/hMeanClusterSizeITS", "mean cluster size ITS; on ITS #times cos(#lambda)", kTH2F, {{1000, 0, 10}, {160, 0, 16}}, false); - fRegistry.add("V0Leg/hXY", "X vs. Y;X (cm);Y (cm)", kTH2F, {{100, 0, 100}, {80, -20, 20}}, false); - fRegistry.add("V0Leg/hZX", "Z vs. X;Z (cm);X (cm)", kTH2F, {{200, -100, 100}, {100, 0, 100}}, false); - fRegistry.add("V0Leg/hZY", "Z vs. Y;Z (cm);Y (cm)", kTH2F, {{200, -100, 100}, {80, -20, 20}}, false); + // fRegistry.add("V0Leg/hXY", "X vs. Y;X (cm);Y (cm)", kTH2F, {{100, 0, 100}, {80, -20, 20}}, false); + // fRegistry.add("V0Leg/hZX", "Z vs. X;Z (cm);X (cm)", kTH2F, {{200, -100, 100}, {100, 0, 100}}, false); + // fRegistry.add("V0Leg/hZY", "Z vs. Y;Z (cm);Y (cm)", kTH2F, {{200, -100, 100}, {80, -20, 20}}, false); } void DefineEMEventCut() @@ -219,7 +218,6 @@ struct PCMQC { fV0PhotonCut.SetChi2PerClusterITS(-1e+10, pcmcuts.cfg_max_chi2its); fV0PhotonCut.SetNClustersITS(0, 7); fV0PhotonCut.SetMeanClusterSizeITSob(0.0, 16.0); - fV0PhotonCut.SetIsWithinBeamPipe(pcmcuts.cfg_require_v0_with_correct_xz); fV0PhotonCut.SetDisableITSonly(pcmcuts.cfg_disable_itsonly_track); fV0PhotonCut.SetDisableTPConly(pcmcuts.cfg_disable_tpconly_track); fV0PhotonCut.SetRequireITSTPC(pcmcuts.cfg_require_v0_with_itstpc); @@ -316,9 +314,9 @@ struct PCMQC { fRegistry.fill(HIST("V0Leg/hTPCdEdx"), leg.tpcInnerParam(), leg.tpcSignal()); fRegistry.fill(HIST("V0Leg/hTPCNsigmaEl"), leg.tpcInnerParam(), leg.tpcNSigmaEl()); fRegistry.fill(HIST("V0Leg/hTPCNsigmaPi"), leg.tpcInnerParam(), leg.tpcNSigmaPi()); - fRegistry.fill(HIST("V0Leg/hXY"), leg.x(), leg.y()); - fRegistry.fill(HIST("V0Leg/hZX"), leg.z(), leg.x()); - fRegistry.fill(HIST("V0Leg/hZY"), leg.z(), leg.y()); + // fRegistry.fill(HIST("V0Leg/hXY"), leg.x(), leg.y()); + // fRegistry.fill(HIST("V0Leg/hZX"), leg.z(), leg.x()); + // fRegistry.fill(HIST("V0Leg/hZY"), leg.z(), leg.y()); } Preslice perCollision = aod::v0photonkf::emeventId; diff --git a/PWGEM/PhotonMeson/Tasks/pcmQCMC.cxx b/PWGEM/PhotonMeson/Tasks/pcmQCMC.cxx index 808498f3ab0..1b2590a33cd 100644 --- a/PWGEM/PhotonMeson/Tasks/pcmQCMC.cxx +++ b/PWGEM/PhotonMeson/Tasks/pcmQCMC.cxx @@ -99,7 +99,6 @@ struct PCMQCMC { Configurable cfg_min_cospa{"cfg_min_cospa", 0.999, "min V0 CosPA"}; Configurable cfg_max_pca{"cfg_max_pca", 3.0, "max distance btween 2 legs"}; Configurable cfg_max_chi2kf{"cfg_max_chi2kf", 1e+10, "max chi2/ndf with KF"}; - Configurable cfg_require_v0_with_correct_xz{"cfg_require_v0_with_correct_xz", false, "flag to select V0s with correct xz"}; Configurable cfg_reject_v0_on_itsib{"cfg_reject_v0_on_itsib", true, "flag to reject V0s on ITSib"}; Configurable cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 0, "min ncluster tpc"}; Configurable cfg_min_ncrossedrows{"cfg_min_ncrossedrows", 40, "min ncrossed rows"}; @@ -234,9 +233,9 @@ struct PCMQCMC { fRegistry.add("V0Leg/primary/hChi2ITS", "chi2/number of ITS clusters", kTH1F, {{100, 0, 10}}, false); fRegistry.add("V0Leg/primary/hITSClusterMap", "ITS cluster map", kTH1F, {{128, -0.5, 127.5}}, false); fRegistry.add("V0Leg/primary/hMeanClusterSizeITS", "mean cluster size ITS; on ITS #times cos(#lambda)", kTH2F, {{1000, 0, 10}, {160, 0, 16}}, false); - fRegistry.add("V0Leg/primary/hXY", "X vs. Y;X (cm);Y (cm)", kTH2F, {{100, 0, 100}, {40, -20, 20}}, false); - fRegistry.add("V0Leg/primary/hZX", "Z vs. X;Z (cm);X (cm)", kTH2F, {{200, -100, 100}, {100, 0, 100}}, false); - fRegistry.add("V0Leg/primary/hZY", "Z vs. Y;Z (cm);Y (cm)", kTH2F, {{200, -100, 100}, {40, -20, 20}}, false); + // fRegistry.add("V0Leg/primary/hXY", "X vs. Y;X (cm);Y (cm)", kTH2F, {{100, 0, 100}, {40, -20, 20}}, false); + // fRegistry.add("V0Leg/primary/hZX", "Z vs. X;Z (cm);X (cm)", kTH2F, {{200, -100, 100}, {100, 0, 100}}, false); + // fRegistry.add("V0Leg/primary/hZY", "Z vs. Y;Z (cm);Y (cm)", kTH2F, {{200, -100, 100}, {40, -20, 20}}, false); fRegistry.add("V0Leg/primary/hPtGen_DeltaPtOverPtGen", "electron p_{T} resolution;p_{T}^{gen} (GeV/c);(p_{T}^{rec} - p_{T}^{gen})/p_{T}^{gen}", kTH2F, {{1000, 0, 10}, {200, -1.0f, 1.0f}}, true); fRegistry.add("V0Leg/primary/hPtGen_DeltaEta", "electron #eta resolution;p_{T}^{gen} (GeV/c);#eta^{rec} - #eta^{gen}", kTH2F, {{1000, 0, 10}, {100, -0.5f, 0.5f}}, true); fRegistry.add("V0Leg/primary/hPtGen_DeltaPhi", "electron #varphi resolution;p_{T}^{gen} (GeV/c);#varphi^{rec} - #varphi^{gen} (rad.)", kTH2F, {{1000, 0, 10}, {100, -0.5f, 0.5f}}, true); @@ -296,7 +295,6 @@ struct PCMQCMC { fV0PhotonCut.SetChi2PerClusterITS(-1e+10, pcmcuts.cfg_max_chi2its); fV0PhotonCut.SetNClustersITS(0, 7); fV0PhotonCut.SetMeanClusterSizeITSob(0.0, 16.0); - fV0PhotonCut.SetIsWithinBeamPipe(pcmcuts.cfg_require_v0_with_correct_xz); fV0PhotonCut.SetDisableITSonly(pcmcuts.cfg_disable_itsonly_track); fV0PhotonCut.SetDisableTPConly(pcmcuts.cfg_disable_tpconly_track); fV0PhotonCut.SetRequireITSTPC(pcmcuts.cfg_require_v0_with_itstpc); @@ -406,9 +404,9 @@ struct PCMQCMC { fRegistry.fill(HIST("V0Leg/") + HIST(mcphoton_types[mctype]) + HIST("hTPCdEdx"), leg.tpcInnerParam(), leg.tpcSignal()); fRegistry.fill(HIST("V0Leg/") + HIST(mcphoton_types[mctype]) + HIST("hTPCNsigmaEl"), leg.tpcInnerParam(), leg.tpcNSigmaEl()); fRegistry.fill(HIST("V0Leg/") + HIST(mcphoton_types[mctype]) + HIST("hTPCNsigmaPi"), leg.tpcInnerParam(), leg.tpcNSigmaPi()); - fRegistry.fill(HIST("V0Leg/") + HIST(mcphoton_types[mctype]) + HIST("hXY"), leg.x(), leg.y()); - fRegistry.fill(HIST("V0Leg/") + HIST(mcphoton_types[mctype]) + HIST("hZX"), leg.z(), leg.x()); - fRegistry.fill(HIST("V0Leg/") + HIST(mcphoton_types[mctype]) + HIST("hZY"), leg.z(), leg.y()); + // fRegistry.fill(HIST("V0Leg/") + HIST(mcphoton_types[mctype]) + HIST("hXY"), leg.x(), leg.y()); + // fRegistry.fill(HIST("V0Leg/") + HIST(mcphoton_types[mctype]) + HIST("hZX"), leg.z(), leg.x()); + // fRegistry.fill(HIST("V0Leg/") + HIST(mcphoton_types[mctype]) + HIST("hZY"), leg.z(), leg.y()); auto mcleg = leg.template emmcparticle_as(); fRegistry.fill(HIST("V0Leg/") + HIST(mcphoton_types[mctype]) + HIST("hPtGen_DeltaPtOverPtGen"), mcleg.pt(), (leg.pt() - mcleg.pt()) / mcleg.pt()); fRegistry.fill(HIST("V0Leg/") + HIST(mcphoton_types[mctype]) + HIST("hPtGen_DeltaEta"), mcleg.pt(), leg.eta() - mcleg.eta()); diff --git a/PWGEM/PhotonMeson/Tasks/prefilterPhoton.cxx b/PWGEM/PhotonMeson/Tasks/prefilterPhoton.cxx index ecc1eb34329..ea3dfd23dc1 100644 --- a/PWGEM/PhotonMeson/Tasks/prefilterPhoton.cxx +++ b/PWGEM/PhotonMeson/Tasks/prefilterPhoton.cxx @@ -104,7 +104,6 @@ struct prefilterPhoton { Configurable cfg_min_cospa{"cfg_min_cospa", 0.99, "min V0 CosPA"}; Configurable cfg_max_pca{"cfg_max_pca", 1.5, "max distance btween 2 legs"}; Configurable cfg_max_chi2kf{"cfg_max_chi2kf", 1e+10, "max chi2/ndf with KF"}; - Configurable cfg_require_v0_with_correct_xz{"cfg_require_v0_with_correct_xz", false, "flag to select V0s with correct xz"}; Configurable cfg_reject_v0_on_itsib{"cfg_reject_v0_on_itsib", true, "flag to reject V0s on ITSib"}; Configurable cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 0, "min ncluster tpc"}; Configurable cfg_min_ncrossedrows{"cfg_min_ncrossedrows", 40, "min ncrossed rows"}; @@ -281,7 +280,6 @@ struct prefilterPhoton { fV0PhotonCut.SetNClustersITS(0, 7); fV0PhotonCut.SetMeanClusterSizeITSob(0.0, 16.0); - fV0PhotonCut.SetIsWithinBeamPipe(pcmcuts.cfg_require_v0_with_correct_xz); } void DefineDileptonCut() From e22ee0c757dc8dc9822b378c4fab378c72797e04 Mon Sep 17 00:00:00 2001 From: GijsvWeelden <55794847+GijsvWeelden@users.noreply.github.com> Date: Thu, 7 Aug 2025 22:19:16 +0200 Subject: [PATCH 284/345] [PWGJE] V0 QA: (#12479) --- PWGJE/Tasks/v0QA.cxx | 238 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 193 insertions(+), 45 deletions(-) diff --git a/PWGJE/Tasks/v0QA.cxx b/PWGJE/Tasks/v0QA.cxx index 26adc61d820..3fb2215b51f 100644 --- a/PWGJE/Tasks/v0QA.cxx +++ b/PWGJE/Tasks/v0QA.cxx @@ -57,12 +57,15 @@ using MCPV0JetsWithConstituents = soa::Join; using MatchedMCPV0JetsWithConstituents = soa::Join; +using JetMcCollisionsWithPIs = soa::Join; + struct V0QA { HistogramRegistry registry{"registry"}; Configurable evSel{"evSel", "sel8WithoutTimeFrameBorderCut", "choose event selection"}; Configurable yPartMax{"yPartMax", 0.5, "Maximum rapidity of particles"}; Configurable vertexZCut{"vertexZCut", 10.0, "Vertex Z cut"}; + Configurable v0Fraction{"v0Fraction", 1.0, "Fraction of V0s to be kept inside jets"}; Filter jetCollisionFilter = nabs(aod::jcollision::posZ) < vertexZCut; @@ -126,18 +129,55 @@ struct V0QA { } if (doprocessMcD) { registry.add("inclusive/hEvents", "Events", {HistType::kTH1D, {{2, 0.0f, 2.0f}}}); + registry.add("inclusive/K0SPtEtaMass", "K0S Pt, Eta, Mass", HistType::kTH3D, {axisV0Pt, axisEta, axisK0SM}); registry.add("inclusive/InvMassK0STrue", "Invariant mass of K0S", HistType::kTH3D, {axisV0Pt, axisV0Radius, axisK0SM}); - registry.add("inclusive/InvMassLambdaTrue", "Invariant mass of Lambda", HistType::kTH3D, {axisV0Pt, axisV0Radius, axisLambdaM}); + registry.add("inclusive/K0SPtEtaMassWrongCollision", "K0S Pt, Eta, Mass (Wrong Collision)", HistType::kTH3D, {axisV0Pt, axisEta, axisK0SM}); registry.add("inclusive/LambdaPtEtaMass", "Lambda Pt, Eta, Mass", HistType::kTH3D, {axisV0Pt, axisEta, axisLambdaM}); - registry.add("inclusive/InvMassAntiLambdaTrue", "Invariant mass of AntiLambda", HistType::kTH3D, {axisV0Pt, axisV0Radius, axisAntiLambdaM}); + registry.add("inclusive/InvMassLambdaTrue", "Invariant mass of Lambda", HistType::kTH3D, {axisV0Pt, axisV0Radius, axisLambdaM}); + registry.add("inclusive/LambdaPtEtaMassWrongCollision", "Lambda Pt, Eta, Mass (Wrong Collision)", HistType::kTH3D, {axisV0Pt, axisEta, axisLambdaM}); registry.add("inclusive/AntiLambdaPtEtaMass", "AntiLambda Pt, Eta, Mass", HistType::kTH3D, {axisV0Pt, axisEta, axisAntiLambdaM}); + registry.add("inclusive/InvMassAntiLambdaTrue", "Invariant mass of AntiLambda", HistType::kTH3D, {axisV0Pt, axisV0Radius, axisAntiLambdaM}); + registry.add("inclusive/AntiLambdaPtEtaMassWrongCollision", "AntiLambda Pt, Eta, Mass (Wrong Collision)", HistType::kTH3D, {axisV0Pt, axisEta, axisAntiLambdaM}); + + registry.add("jets/JetPtEtaK0SPt", "Jet Pt, Eta, K0S Pt", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); + registry.add("jets/JetPtEtaK0SZ", "Jet Pt, Eta, K0S Z", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}); + registry.add("jets/JetPtEtaK0SPtWrongCollision", "Jet Pt, Eta, K0S Pt (Wrong Collision)", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); + registry.add("jets/JetPtEtaK0SZWrongCollision", "Jet Pt, Eta, K0S Z (Wrong Collision)", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}); + registry.add("jets/JetPtEtaLambdaPt", "Jet Pt, Eta, Lambda Pt", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); + registry.add("jets/JetPtEtaLambdaZ", "Jet Pt, Eta, Lambda Z", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}); + registry.add("jets/JetPtEtaLambdaPtWrongCollision", "Jet Pt, Eta, Lambda Pt (Wrong Collision)", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); + registry.add("jets/JetPtEtaLambdaZWrongCollision", "Jet Pt, Eta, Lambda Z (Wrong Collision)", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}); + registry.add("jets/JetPtEtaAntiLambdaPt", "Jet Pt, Eta, AntiLambda Pt", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); + registry.add("jets/JetPtEtaAntiLambdaZ", "Jet Pt, Eta, AntiLambda Z", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}); + registry.add("jets/JetPtEtaAntiLambdaPtWrongCollision", "Jet Pt, Eta, AntiLambda Pt (Wrong Collision)", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); + registry.add("jets/JetPtEtaAntiLambdaZWrongCollision", "Jet Pt, Eta, AntiLambda Z (Wrong Collision)", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}); + + registry.add("jets/JetsPtEtaK0SPt", "Matched Jet Pt, Eta, K0S Pt", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Pt}); + registry.add("jets/JetsPtEtaK0SZ", "Matched Jet Pt, Eta, K0S Z", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Z}); + registry.add("jets/JetsPtEtaK0SPtWrongCollision", "Matched Jet Pt, Eta, K0S Pt (Wrong Collision)", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Pt}); + registry.add("jets/JetsPtEtaK0SZWrongCollision", "Matched Jet Pt, Eta, K0S Z (Wrong Collision)", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Z}); + registry.add("jets/JetsPtEtaLambdaPt", "Matched Jet Pt, Eta, Lambda Pt", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Pt}); + registry.add("jets/JetsPtEtaLambdaZ", "Matched Jet Pt, Eta, Lambda Z", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Z}); + registry.add("jets/JetsPtEtaLambdaPtWrongCollision", "Matched Jet Pt, Eta, Lambda Pt (Wrong Collision)", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Pt}); + registry.add("jets/JetsPtEtaLambdaZWrongCollision", "Matched Jet Pt, Eta, Lambda Z (Wrong Collision)", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Z}); + registry.add("jets/JetsPtEtaAntiLambdaPt", "Matched Jet Pt, Eta, AntiLambda Pt", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Pt}); + registry.add("jets/JetsPtEtaAntiLambdaZ", "Matched Jet Pt, Eta, AntiLambda Z", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Z}); + registry.add("jets/JetsPtEtaAntiLambdaPtWrongCollision", "Matched Jet Pt, Eta, AntiLambda Pt (Wrong Collision)", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Pt}); + registry.add("jets/JetsPtEtaAntiLambdaZWrongCollision", "Matched Jet Pt, Eta, AntiLambda Z (Wrong Collision)", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Z}); } if (doprocessMcP) { registry.add("inclusive/hMcEvents", "MC Events", {HistType::kTH1D, {{2, 0.0f, 2.0f}}}); registry.add("inclusive/GeneratedK0S", "Generated K0S", HistType::kTH3D, {axisV0Pt, axisEta, axisV0Radius}); registry.add("inclusive/GeneratedLambda", "Generated Lambda", HistType::kTH3D, {axisV0Pt, axisEta, axisV0Radius}); registry.add("inclusive/GeneratedAntiLambda", "Generated AntiLambda", HistType::kTH3D, {axisV0Pt, axisEta, axisV0Radius}); + + registry.add("jets/GeneratedJetK0S", "Generated Jet K0S", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); + registry.add("jets/GeneratedJetK0SFrag", "Generated Jet K0S", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}); + registry.add("jets/GeneratedJetLambda", "Generated Jet Lambda", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); + registry.add("jets/GeneratedJetLambdaFrag", "Generated Jet Lambda", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}); + registry.add("jets/GeneratedJetAntiLambda", "Generated Jet AntiLambda", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); + registry.add("jets/GeneratedJetAntiLambdaFrag", "Generated Jet AntiLambda", HistType::kTH3D, {axisJetPt, axisEta, axisV0Z}); } if (doprocessMcDJets) { registry.add("jets/hJetEvents", "Jet Events", {HistType::kTH1D, {{2, 0.0f, 2.0f}}}); @@ -168,18 +208,18 @@ struct V0QA { } if (doprocessCollisionAssociation) { registry.add("collisions/V0PtEta", "V0 Pt, Eta", HistType::kTH2D, {axisV0Pt, axisEta}); - registry.add("collisions/V0PtEtaWrongColl", "V0 Pt, Eta, wrong collision", HistType::kTH2D, {axisV0Pt, axisEta}); + registry.add("collisions/V0PtEtaWrongColl", "V0 Pt, Eta, (Wrong Collision)", HistType::kTH2D, {axisV0Pt, axisEta}); registry.add("collisions/K0SPtEtaMass", "K0S Pt, Eta, Mass", HistType::kTH3D, {axisV0Pt, axisEta, axisK0SM}); - registry.add("collisions/K0SPtEtaMassWrongColl", "K0S Pt, Eta, Mass, wrong collision", HistType::kTH3D, {axisV0Pt, axisEta, axisK0SM}); + registry.add("collisions/K0SPtEtaMassWrongColl", "K0S Pt, Eta, Mass, (Wrong Collision)", HistType::kTH3D, {axisV0Pt, axisEta, axisK0SM}); registry.add("collisions/LambdaPtEtaMass", "Lambda Pt, Eta, Mass", HistType::kTH3D, {axisV0Pt, axisEta, axisLambdaM}); - registry.add("collisions/LambdaPtEtaMassWrongColl", "Lambda Pt, Eta, Mass, wrong collision", HistType::kTH3D, {axisV0Pt, axisEta, axisLambdaM}); + registry.add("collisions/LambdaPtEtaMassWrongColl", "Lambda Pt, Eta, Mass, (Wrong Collision)", HistType::kTH3D, {axisV0Pt, axisEta, axisLambdaM}); registry.add("collisions/AntiLambdaPtEtaMass", "AntiLambda Pt, Eta, Mass", HistType::kTH3D, {axisV0Pt, axisEta, axisAntiLambdaM}); - registry.add("collisions/AntiLambdaPtEtaMassWrongColl", "AntiLambda Pt, Eta, Mass, wrong collision", HistType::kTH3D, {axisV0Pt, axisEta, axisAntiLambdaM}); + registry.add("collisions/AntiLambdaPtEtaMassWrongColl", "AntiLambda Pt, Eta, Mass, (Wrong Collision)", HistType::kTH3D, {axisV0Pt, axisEta, axisAntiLambdaM}); registry.add("collisions/XiMinusPtYLambdaPt", "#Xi^{-} Pt, Y, #Lambda Pt", HistType::kTH3D, {axisV0Pt, axisEta, axisV0Pt}); - registry.add("collisions/XiMinusPtYLambdaPtWrongColl", "#Xi^{-} Pt, Y, #Lambda Pt, wrong collision", HistType::kTH3D, {axisV0Pt, axisEta, axisV0Pt}); + registry.add("collisions/XiMinusPtYLambdaPtWrongColl", "#Xi^{-} Pt, Y, #Lambda Pt, (Wrong Collision)", HistType::kTH3D, {axisV0Pt, axisEta, axisV0Pt}); registry.add("collisions/XiPlusPtYAntiLambdaPt", "#Xi^{+} Pt, Y, #bar{#Lambda} Pt", HistType::kTH3D, {axisV0Pt, axisEta, axisV0Pt}); - registry.add("collisions/XiPlusPtYAntiLambdaPtWrongColl", "#Xi^{+} Pt, Y, #bar{#Lambda} Pt, wrong collision", HistType::kTH3D, {axisV0Pt, axisEta, axisV0Pt}); + registry.add("collisions/XiPlusPtYAntiLambdaPtWrongColl", "#Xi^{+} Pt, Y, #bar{#Lambda} Pt, (Wrong Collision)", HistType::kTH3D, {axisV0Pt, axisEta, axisV0Pt}); } if (doprocessCollisionAssociationJets) { registry.add("collisions/JetPtEtaV0Pt", "Jet Pt, Eta, V0 Pt", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); @@ -469,6 +509,86 @@ struct V0QA { return (track.itsClusterMap() & (1 << ibit)); } + template + void fillMcDV0(T const& v0, bool correctCollision, double weight) + { + int pdg = v0.mcParticle().pdgCode(); + if (std::abs(pdg) == PDG_t::kK0Short) { + registry.fill(HIST("inclusive/K0SPtEtaMass"), v0.pt(), v0.eta(), v0.mK0Short(), weight); + registry.fill(HIST("inclusive/InvMassK0STrue"), v0.pt(), v0.v0radius(), v0.mK0Short(), weight); + if (!correctCollision) + registry.fill(HIST("inclusive/K0SPtEtaMassWrongCollision"), v0.pt(), v0.eta(), v0.mK0Short(), weight); + } else if (pdg == PDG_t::kLambda0) { + registry.fill(HIST("inclusive/LambdaPtEtaMass"), v0.pt(), v0.eta(), v0.mLambda(), weight); + registry.fill(HIST("inclusive/InvMassLambdaTrue"), v0.pt(), v0.v0radius(), v0.mLambda(), weight); + if (!correctCollision) + registry.fill(HIST("inclusive/LambdaPtEtaMassWrongCollision"), v0.pt(), v0.eta(), v0.mLambda(), weight); + } else if (pdg == PDG_t::kLambda0Bar) { + registry.fill(HIST("inclusive/AntiLambdaPtEtaMass"), v0.pt(), v0.eta(), v0.mAntiLambda(), weight); + registry.fill(HIST("inclusive/InvMassAntiLambdaTrue"), v0.pt(), v0.v0radius(), v0.mAntiLambda(), weight); + if (!correctCollision) + registry.fill(HIST("inclusive/AntiLambdaPtEtaMassWrongCollision"), v0.pt(), v0.eta(), v0.mAntiLambda(), weight); + } + } + + template + void fillMcDV0InJets(T const& mcdjet, U const& v0, bool correctCollision, double weight) + { + int pdg = v0.mcParticle().pdgCode(); + double z = v0.pt() / mcdjet.pt(); + if (std::abs(pdg) == PDG_t::kK0Short) { + registry.fill(HIST("jets/JetPtEtaK0SPt"), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); + registry.fill(HIST("jets/JetPtEtaK0SZ"), mcdjet.pt(), mcdjet.eta(), z, weight); + if (!correctCollision) { + registry.fill(HIST("jets/JetPtEtaK0SPtWrongCollision"), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); + registry.fill(HIST("jets/JetPtEtaK0SZWrongCollision"), mcdjet.pt(), mcdjet.eta(), z, weight); + } + } else if (pdg == PDG_t::kLambda0) { + registry.fill(HIST("jets/JetPtEtaLambdaPt"), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); + registry.fill(HIST("jets/JetPtEtaLambdaZ"), mcdjet.pt(), mcdjet.eta(), z, weight); + if (!correctCollision) { + registry.fill(HIST("jets/JetPtEtaLambdaPtWrongCollision"), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); + registry.fill(HIST("jets/JetPtEtaLambdaZWrongCollision"), mcdjet.pt(), mcdjet.eta(), z, weight); + } + } else if (pdg == PDG_t::kLambda0Bar) { + registry.fill(HIST("jets/JetPtEtaAntiLambdaPt"), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); + registry.fill(HIST("jets/JetPtEtaAntiLambdaZ"), mcdjet.pt(), mcdjet.eta(), z, weight); + if (!correctCollision) { + registry.fill(HIST("jets/JetPtEtaAntiLambdaPtWrongCollision"), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); + registry.fill(HIST("jets/JetPtEtaAntiLambdaZWrongCollision"), mcdjet.pt(), mcdjet.eta(), z, weight); + } + } + } + + template + void fillMcDV0InMatchedJets(T const& mcpjet, U const& mcdjet, V const& v0, bool correctCollision, double weight) + { + int pdg = v0.mcParticle().pdgCode(); + double z = v0.pt() / mcdjet.pt(); + if (std::abs(pdg) == PDG_t::kK0Short) { + registry.fill(HIST("jets/JetsPtEtaK0SPt"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); + registry.fill(HIST("jets/JetsPtEtaK0SZ"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), z, weight); + if (!correctCollision) { + registry.fill(HIST("jets/JetsPtEtaK0SPtWrongCollision"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); + registry.fill(HIST("jets/JetsPtEtaK0SZWrongCollision"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), z, weight); + } + } else if (pdg == PDG_t::kLambda0) { + registry.fill(HIST("jets/JetsPtEtaLambdaPt"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); + registry.fill(HIST("jets/JetsPtEtaLambdaZ"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), z, weight); + if (!correctCollision) { + registry.fill(HIST("jets/JetsPtEtaLambdaPtWrongCollision"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); + registry.fill(HIST("jets/JetsPtEtaLambdaZWrongCollision"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), z, weight); + } + } else if (pdg == PDG_t::kLambda0Bar) { + registry.fill(HIST("jets/JetsPtEtaAntiLambdaPt"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); + registry.fill(HIST("jets/JetsPtEtaAntiLambdaZ"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), z, weight); + if (!correctCollision) { + registry.fill(HIST("jets/JetsPtEtaAntiLambdaPtWrongCollision"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); + registry.fill(HIST("jets/JetsPtEtaAntiLambdaZWrongCollision"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), z, weight); + } + } + } + template void fillTrackQa(V const& v0) { @@ -726,41 +846,46 @@ struct V0QA { } PROCESS_SWITCH(V0QA, processFlags, "V0 flags", false); - void processMcD(soa::Filtered::iterator const& jcoll, aod::JetMcCollisions const&, CandidatesV0MCDWithFlags const& v0s, aod::McParticles const&) + void processMcD(soa::Filtered::iterator const& jcoll, CandidatesV0MCDWithFlags const& v0s, aod::McParticles const&, MatchedMCDV0JetsWithConstituents const& mcdjets, MatchedMCPV0JetsWithConstituents const&, aod::CandidatesV0MCP const&, aod::JetTracksMCD const& jTracks, JetMcCollisionsWithPIs const&, aod::McCollisions const&) { registry.fill(HIST("inclusive/hEvents"), 0.5); if (!isCollisionReconstructed(jcoll, eventSelectionBits)) { return; } registry.fill(HIST("inclusive/hEvents"), 1.5); - double weight = jcoll.mcCollision().weight(); + auto mcColl = jcoll.template mcCollision_as(); + double weight = mcColl.weight(); for (const auto& v0 : v0s) { - if (!v0.has_mcParticle()) + if (!v0.has_mcParticle() || v0.isRejectedCandidate()) continue; - if (v0.isRejectedCandidate()) - continue; + bool correctCollision = (mcColl.mcCollisionId() == v0.mcParticle().mcCollisionId()); + fillMcDV0(v0, correctCollision, weight); + } // v0 loop - int pdg = v0.mcParticle().pdgCode(); - if (std::abs(pdg) == PDG_t::kK0Short) { - registry.fill(HIST("inclusive/K0SPtEtaMass"), v0.pt(), v0.eta(), v0.mK0Short(), weight); - registry.fill(HIST("inclusive/InvMassK0STrue"), v0.pt(), v0.v0radius(), v0.mK0Short(), weight); - } - // Lambda - if (pdg == PDG_t::kLambda0) { - registry.fill(HIST("inclusive/LambdaPtEtaMass"), v0.pt(), v0.eta(), v0.mLambda(), weight); - registry.fill(HIST("inclusive/InvMassLambdaTrue"), v0.pt(), v0.v0radius(), v0.mLambda(), weight); - } - if (pdg == PDG_t::kLambda0Bar) { - registry.fill(HIST("inclusive/AntiLambdaPtEtaMass"), v0.pt(), v0.eta(), v0.mAntiLambda(), weight); - registry.fill(HIST("inclusive/InvMassAntiLambdaTrue"), v0.pt(), v0.v0radius(), v0.mAntiLambda(), weight); - } - } + for (const auto& mcdjet : mcdjets) { + for (const auto& v0 : mcdjet.template candidates_as()) { + if (!v0.has_mcParticle() || v0.isRejectedCandidate()) + continue; + + bool correctCollision = (mcColl.mcCollisionId() == v0.mcParticle().mcCollisionId()); + fillMcDV0InJets(mcdjet, v0, correctCollision, weight); + + for (const auto& mcpjet : mcdjet.template matchedJetGeo_as()) { + for (const auto& pv0 : mcpjet.template candidates_as()) { + if (!v0sAreMatched(v0, pv0, jTracks)) + continue; + + fillMcDV0InMatchedJets(mcpjet, mcdjet, v0, correctCollision, weight); + } // v0 particle loop + } // mcpjet loop + } // v0 loop + } // mcd jet loop } PROCESS_SWITCH(V0QA, processMcD, "Reconstructed true V0s", false); - void processMcP(aod::JetMcCollision const& mccoll, aod::CandidatesV0MCP const& pv0s, soa::SmallGroups const& collisions) + void processMcP(aod::JetMcCollision const& mccoll, soa::SmallGroups const& collisions, MCPV0JetsWithConstituents const& jets, aod::CandidatesV0MCP const& pv0s) { registry.fill(HIST("inclusive/hMcEvents"), 0.5); bool isReconstructed = false; @@ -782,9 +907,7 @@ struct V0QA { double weight = mccoll.weight(); for (const auto& pv0 : pv0s) { - if (!pv0.has_daughters()) - continue; - if (!pv0.isPhysicalPrimary()) + if (!pv0.has_daughters() || !pv0.isPhysicalPrimary()) continue; if (std::abs(pv0.y()) > yPartMax) continue; @@ -802,6 +925,31 @@ struct V0QA { registry.fill(HIST("inclusive/GeneratedAntiLambda"), pv0.pt(), pv0.eta(), rDecay, weight); } } + + for (const auto& jet : jets) { + if (!jetfindingutilities::isInEtaAcceptance(jet, -99., -99., -1. * yPartMax, yPartMax)) + continue; + + for (const auto& pv0 : jet.template candidates_as()) { + if (!pv0.has_daughters() || !pv0.isPhysicalPrimary()) + continue; + + double z = pv0.pt() / jet.pt(); + + if (pv0.pdgCode() == PDG_t::kK0Short) { + registry.fill(HIST("jets/GeneratedJetK0S"), jet.pt(), jet.eta(), pv0.pt(), weight); + registry.fill(HIST("jets/GeneratedJetK0SFrag"), jet.pt(), jet.eta(), z, weight); + } + if (pv0.pdgCode() == PDG_t::kLambda0) { + registry.fill(HIST("jets/GeneratedJetLambda"), jet.pt(), jet.eta(), pv0.pt(), weight); + registry.fill(HIST("jets/GeneratedJetLambdaFrag"), jet.pt(), jet.eta(), z, weight); + } + if (pv0.pdgCode() == PDG_t::kLambda0Bar) { + registry.fill(HIST("jets/GeneratedJetAntiLambda"), jet.pt(), jet.eta(), pv0.pt(), weight); + registry.fill(HIST("jets/GeneratedJetAntiLambdaFrag"), jet.pt(), jet.eta(), z, weight); + } + } + } } PROCESS_SWITCH(V0QA, processMcP, "Particle level V0s", false); @@ -939,13 +1087,13 @@ struct V0QA { } PROCESS_SWITCH(V0QA, processMcPJets, "Particle level V0s in jets", false); - void processCollisionAssociation(soa::Filtered::iterator const& jcoll, CandidatesV0MCDWithFlags const& v0s, soa::Join const&, aod::McCollisions const&, aod::McParticles const&) + void processCollisionAssociation(soa::Filtered::iterator const& jcoll, CandidatesV0MCDWithFlags const& v0s, JetMcCollisionsWithPIs const&, aod::McCollisions const&, aod::McParticles const&) { // Based on PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx if (!jcoll.has_mcCollision()) return; - auto mcColl = jcoll.template mcCollision_as>(); + auto mcColl = jcoll.template mcCollision_as(); double weight = mcColl.weight(); for (const auto& v0 : v0s) { @@ -1006,12 +1154,12 @@ struct V0QA { } PROCESS_SWITCH(V0QA, processCollisionAssociation, "V0 collision association", false); - void processCollisionAssociationJets(soa::Filtered::iterator const& jcoll, MCDV0JetsWithConstituents const& mcdjets, CandidatesV0MCDWithFlags const&, soa::Join const&, aod::McCollisions const&, aod::McParticles const&) + void processCollisionAssociationJets(soa::Filtered::iterator const& jcoll, MCDV0JetsWithConstituents const& mcdjets, CandidatesV0MCDWithFlags const&, JetMcCollisionsWithPIs const&, aod::McCollisions const&, aod::McParticles const&) { if (!isCollisionReconstructed(jcoll, eventSelectionBits)) return; - auto mcColl = jcoll.template mcCollision_as>(); + auto mcColl = jcoll.template mcCollision_as(); double weight = mcColl.weight(); for (const auto& mcdjet : mcdjets) { @@ -1081,12 +1229,12 @@ struct V0QA { } PROCESS_SWITCH(V0QA, processCollisionAssociationJets, "V0 in jets collision association", false); - void processCollisionAssociationMatchedJets(soa::Filtered::iterator const& jcoll, MatchedMCDV0JetsWithConstituents const& mcdjets, MatchedMCPV0JetsWithConstituents const&, CandidatesV0MCDWithFlags const&, aod::CandidatesV0MCP const&, soa::Join const&, aod::McCollisions const&, aod::McParticles const&, aod::JetTracksMCD const& jTracks) + void processCollisionAssociationMatchedJets(soa::Filtered::iterator const& jcoll, MatchedMCDV0JetsWithConstituents const& mcdjets, MatchedMCPV0JetsWithConstituents const&, CandidatesV0MCDWithFlags const&, aod::CandidatesV0MCP const&, JetMcCollisionsWithPIs const&, aod::McCollisions const&, aod::McParticles const&, aod::JetTracksMCD const& jTracks) { if (!jcoll.has_mcCollision()) return; - auto mcColl = jcoll.template mcCollision_as>(); + auto mcColl = jcoll.template mcCollision_as(); double weight = mcColl.weight(); for (const auto& mcdjet : mcdjets) { @@ -1161,13 +1309,13 @@ struct V0QA { } PROCESS_SWITCH(V0QA, processCollisionAssociationMatchedJets, "V0 in matched jets collision association", false); - void processFeeddown(soa::Filtered::iterator const& jcoll, CandidatesV0MCDWithFlags const& v0s, aod::CandidatesV0MCP const&, soa::Join const&, aod::McCollisions const&, aod::McParticles const&) + void processFeeddown(soa::Filtered::iterator const& jcoll, CandidatesV0MCDWithFlags const& v0s, aod::CandidatesV0MCP const&, JetMcCollisionsWithPIs const&, aod::McCollisions const&, aod::McParticles const&) { // Based on PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx if (!jcoll.has_mcCollision()) return; - auto mcColl = jcoll.template mcCollision_as>(); + auto mcColl = jcoll.template mcCollision_as(); double weight = mcColl.weight(); for (const auto& v0 : v0s) { @@ -1197,13 +1345,13 @@ struct V0QA { } PROCESS_SWITCH(V0QA, processFeeddown, "Inclusive feeddown", false); - void processFeeddownJets(soa::Filtered::iterator const& jcoll, MCDV0JetsWithConstituents const& mcdjets, CandidatesV0MCDWithFlags const&, aod::CandidatesV0MCP const&, soa::Join const&, aod::McCollisions const&, aod::McParticles const&) + void processFeeddownJets(soa::Filtered::iterator const& jcoll, MCDV0JetsWithConstituents const& mcdjets, CandidatesV0MCDWithFlags const&, aod::CandidatesV0MCP const&, JetMcCollisionsWithPIs const&, aod::McCollisions const&, aod::McParticles const&) { // Based on PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx if (!jcoll.has_mcCollision()) return; - auto mcColl = jcoll.template mcCollision_as>(); + auto mcColl = jcoll.template mcCollision_as(); double weight = mcColl.weight(); for (const auto& mcdjet : mcdjets) { @@ -1235,13 +1383,13 @@ struct V0QA { } PROCESS_SWITCH(V0QA, processFeeddownJets, "Jets feeddown", false); - void processFeeddownMatchedJets(soa::Filtered::iterator const& jcoll, MatchedMCDV0JetsWithConstituents const& mcdjets, aod::JetTracksMCD const& jTracks, MatchedMCPV0JetsWithConstituents const&, CandidatesV0MCDWithFlags const&, aod::CandidatesV0MCP const&, soa::Join const&, aod::McCollisions const&, aod::McParticles const&) + void processFeeddownMatchedJets(soa::Filtered::iterator const& jcoll, MatchedMCDV0JetsWithConstituents const& mcdjets, aod::JetTracksMCD const& jTracks, MatchedMCPV0JetsWithConstituents const&, CandidatesV0MCDWithFlags const&, aod::CandidatesV0MCP const&, JetMcCollisionsWithPIs const&, aod::McCollisions const&, aod::McParticles const&) { // Based on PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx if (!jcoll.has_mcCollision()) return; - auto mcColl = jcoll.template mcCollision_as>(); + auto mcColl = jcoll.template mcCollision_as(); double weight = mcColl.weight(); for (const auto& mcdjet : mcdjets) { @@ -1343,7 +1491,7 @@ struct V0QA { registry.fill(HIST("tests/nosub/JetPtEtaAntiLambdaZ"), jet.pt(), jet.eta(), z); } - if (v0.isRejectedCandidate()) { + if (gRandom->Uniform() > v0Fraction) { // Rejected V0 ptjetsub -= v0.pt(); } else { // Accepted V0 v0Pt.push_back(v0.pt()); From 54852717300d32a67562c230aeb896b7b332e28b Mon Sep 17 00:00:00 2001 From: alcaliva <32872606+alcaliva@users.noreply.github.com> Date: Thu, 7 Aug 2025 23:07:48 +0200 Subject: [PATCH 285/345] [PWGLF] added function to study pd correlation (#12470) --- PWGLF/Tasks/Nuspex/antinucleiInJets.cxx | 631 ++++++++++++++++++++++-- 1 file changed, 578 insertions(+), 53 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx b/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx index 39d31d4d7d0..4ec0538917d 100644 --- a/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx +++ b/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx @@ -78,19 +78,20 @@ using namespace o2::constants::math; using std::array; // Define convenient aliases for commonly used table joins -using SelectedCollisions = soa::Join; -using RecCollisionsMc = soa::Join; +using SelectedCollisions = soa::Join; +using RecCollisionsMc = soa::Join; using GenCollisionsMc = aod::McCollisions; using AntiNucleiTracks = soa::Join; using AntiNucleiTracksMc = soa::Join; struct AntinucleiInJets { - // Histogram registries for data, MC, quality control and multiplicity + // Histogram registries for data, MC, quality control, multiplicity and correlations HistogramRegistry registryData{"registryData", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry registryMC{"registryMC", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry registryQC{"registryQC", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry registryMult{"registryMult", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry registryCorr{"registryCorr", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; // Event selection criteria Configurable rejectITSROFBorder{"rejectITSROFBorder", true, "Reject events near the ITS ROF border"}; @@ -120,7 +121,7 @@ struct AntinucleiInJets { Configurable requirePvContributor{"requirePvContributor", false, "require that the track is a PV contributor"}; Configurable applyItsPid{"applyItsPid", true, "apply ITS PID"}; Configurable minItsNclusters{"minItsNclusters", 5, "minimum number of ITS clusters"}; - Configurable minTpcNcrossedRows{"minTpcNcrossedRows", 80, "minimum number of TPC crossed pad rows"}; + Configurable minTpcNcrossedRows{"minTpcNcrossedRows", 100, "minimum number of TPC crossed pad rows"}; Configurable maxChiSquareTpc{"maxChiSquareTpc", 4.0, "maximum TPC chi^2/Ncls"}; Configurable maxChiSquareIts{"maxChiSquareIts", 36.0, "maximum ITS chi^2/Ncls"}; Configurable minPt{"minPt", 0.3, "minimum pt of the tracks"}; @@ -348,6 +349,53 @@ struct AntinucleiInJets { registryMC.add("antiproton_incl_syst", "antiproton_incl_syst", HistType::kTH2F, {{50, 0, 50, "systematic uncertainty"}, {nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); registryMC.add("antiproton_prim_syst", "antiproton_prim_syst", HistType::kTH2F, {{50, 0, 50, "systematic uncertainty"}, {nbins, min, max, "#it{p}_{T} (GeV/#it{c})"}}); } + + // Correlation analysis + if (doprocessCorr) { + + // Axes definitions for multidimensional histogram binning + const AxisSpec multiplicityAxis{100, 0.0, 100.0, "multiplicity percentile"}; + const AxisSpec ptPerNucleonAxis{5, 0.4, 0.9, "{p}_{T}/A (GeV/#it{c})"}; + const AxisSpec nAntideuteronsAxis{10, 0.0, 10.0, "N_{#bar{d}}"}; + const AxisSpec nAntiprotonsAxis{10, 0.0, 10.0, "N_{#bar{p}}"}; + const AxisSpec nBarD2Axis{100, 0.0, 100.0, "N_{#bar{d}}^{i} #times N_{#bar{d}}^{j}"}; + const AxisSpec nBarP2Axis{100, 0.0, 100.0, "N_{#bar{p}}^{i} #times N_{#bar{p}}^{j}"}; + const AxisSpec nBarDnBarPAxis{100, 0.0, 100.0, "N_{#bar{d}}^{i} #times N_{#bar{p}}^{j}"}; + + // Event counter + registryCorr.add("eventCounter", "number of events", HistType::kTH1F, {{20, 0, 20, "counter"}}); + + // Correlation histograms: antiproton vs. antideuteron number vs. event multiplicity + registryCorr.add("rho_jet", "rho_jet", HistType::kTH3F, {nAntideuteronsAxis, nAntiprotonsAxis, multiplicityAxis}); + registryCorr.add("rho_ue", "rho_ue", HistType::kTH3F, {nAntideuteronsAxis, nAntiprotonsAxis, multiplicityAxis}); + registryCorr.add("rho_fullEvent", "rho_fullEvent", HistType::kTH3F, {nAntideuteronsAxis, nAntiprotonsAxis, multiplicityAxis}); + + // Correlation histograms: net antiproton vs. net antideuteron numbers + registryCorr.add("rho_netP_netD_jet", "rho_netP_netD_jet", HistType::kTH2F, {nAntideuteronsAxis, nAntiprotonsAxis}); + registryCorr.add("rho_netP_netD_ue", "rho_netP_netD_ue", HistType::kTH2F, {nAntideuteronsAxis, nAntiprotonsAxis}); + registryCorr.add("rho_netP_netD_fullEvent", "rho_netP_netD_fullEvent", HistType::kTH2F, {nAntideuteronsAxis, nAntiprotonsAxis}); + + // Efficiency histograms jet + registryCorr.add("q1d_jet", "q1d_jet", HistType::kTH2F, {nAntideuteronsAxis, ptPerNucleonAxis}); + registryCorr.add("q1p_jet", "q1p_jet", HistType::kTH2F, {nAntiprotonsAxis, ptPerNucleonAxis}); + registryCorr.add("q1d_square_jet", "q1d_square_jet", HistType::kTH3F, {ptPerNucleonAxis, ptPerNucleonAxis, nBarD2Axis}); + registryCorr.add("q1p_square_jet", "q1p_square_jet", HistType::kTH3F, {ptPerNucleonAxis, ptPerNucleonAxis, nBarP2Axis}); + registryCorr.add("q1d_q1p_jet", "q1d_q1p_jet", HistType::kTH3F, {ptPerNucleonAxis, ptPerNucleonAxis, nBarDnBarPAxis}); + + // Efficiency histograms UE + registryCorr.add("q1d_ue", "q1d_ue", HistType::kTH2F, {nAntideuteronsAxis, ptPerNucleonAxis}); + registryCorr.add("q1p_ue", "q1p_ue", HistType::kTH2F, {nAntiprotonsAxis, ptPerNucleonAxis}); + registryCorr.add("q1d_square_ue", "q1d_square_ue", HistType::kTH3F, {ptPerNucleonAxis, ptPerNucleonAxis, nBarD2Axis}); + registryCorr.add("q1p_square_ue", "q1p_square_ue", HistType::kTH3F, {ptPerNucleonAxis, ptPerNucleonAxis, nBarP2Axis}); + registryCorr.add("q1d_q1p_ue", "q1d_q1p_ue", HistType::kTH3F, {ptPerNucleonAxis, ptPerNucleonAxis, nBarDnBarPAxis}); + + // Efficiency histograms full event + registryCorr.add("q1d_fullEvent", "q1d_fullEvent", HistType::kTH2F, {nAntideuteronsAxis, ptPerNucleonAxis}); + registryCorr.add("q1p_fullEvent", "q1p_fullEvent", HistType::kTH2F, {nAntiprotonsAxis, ptPerNucleonAxis}); + registryCorr.add("q1d_square_fullEvent", "q1d_square_fullEvent", HistType::kTH3F, {ptPerNucleonAxis, ptPerNucleonAxis, nBarD2Axis}); + registryCorr.add("q1p_square_fullEvent", "q1p_square_fullEvent", HistType::kTH3F, {ptPerNucleonAxis, ptPerNucleonAxis, nBarP2Axis}); + registryCorr.add("q1d_q1p_fullEvent", "q1d_q1p_fullEvent", HistType::kTH3F, {ptPerNucleonAxis, ptPerNucleonAxis, nBarDnBarPAxis}); + } } // Compute two unit vectors perpendicular to p @@ -418,6 +466,17 @@ struct AntinucleiInJets { return deltaPhi; } + // Find bin + int findBin(const std::vector& edges, double value) + { + auto it = std::upper_bound(edges.begin(), edges.end(), value); + int index = static_cast(it - edges.begin()) - 1; + if (index < 0 || index >= static_cast(edges.size()) - 1) { + return -1; // value is out of bounds + } + return index; + } + // ITS hit template bool hasITSHit(const TrackIts& track, int layer) @@ -500,11 +559,11 @@ struct AntinucleiInJets { 3, 4, 3, 5, 7, 6, 6, 4, 3, 5, 4, 7, 3, 6, 4, 5, 6, 3, 7, 5}; static std::vector minTpcNcrossedRowsSyst = { - 72, 99, 87, 66, 83, 71, 78, 74, 84, 94, - 89, 85, 66, 80, 95, 74, 76, 77, 67, 88, - 61, 100, 97, 78, 81, 91, 64, 63, 93, 69, - 87, 99, 65, 62, 96, 60, 75, 92, 82, 89, - 98, 70, 90, 85, 73, 79, 68, 86, 97, 61}; + 90, 108, 112, 119, 92, 111, 98, 105, 86, 117, + 118, 101, 87, 116, 82, 109, 80, 115, 89, 97, + 107, 120, 104, 94, 100, 93, 103, 84, 102, 85, + 108, 96, 113, 117, 91, 88, 99, 110, 106, 83, + 118, 95, 112, 114, 109, 89, 116, 92, 98, 120}; static std::vector maxChiSquareTpcSyst = { 4.28, 4.81, 4.43, 4.02, 3.38, 3.58, 3.11, 4.17, 3.51, 4.53, 4.90, 3.07, 3.20, 4.86, 4.62, 3.91, 3.98, 4.38, 3.66, 3.84, @@ -571,6 +630,56 @@ struct AntinucleiInJets { return false; } + // Selection of (anti)protons + template + bool isProton(const ProtonTrack& track) + { + // Constants + static constexpr double kPtThreshold = 0.6; + static constexpr double kNsigmaMax = 3.0; + + // PID variables and transverse momentum of the track + const double nsigmaTPC = track.tpcNSigmaPr(); + const double nsigmaTOF = track.tofNSigmaPr(); + const double pt = track.pt(); + + // Apply TPC PID cut + if (std::abs(nsigmaTPC) > kNsigmaMax) + return false; + + // Low-pt: TPC PID is sufficient + if (pt < kPtThreshold) + return true; + + // High-pt: require valid TOF match and pass TOF PID + return (track.hasTOF() && std::abs(nsigmaTOF) < kNsigmaMax); + } + + // Selection of (anti)deuterons + template + bool isDeuteron(const DeuteronTrack& track) + { + // Constants + static constexpr double kPtThreshold = 1.0; + static constexpr double kNsigmaMax = 3.0; + + // PID variables and transverse momentum of the track + const double nsigmaTPC = track.tpcNSigmaDe(); + const double nsigmaTOF = track.tofNSigmaDe(); + const double pt = track.pt(); + + // Apply TPC PID cut + if (std::abs(nsigmaTPC) > kNsigmaMax) + return false; + + // Low-pt: TPC PID is sufficient + if (pt < kPtThreshold) + return true; + + // High-pt: require valid TOF match and pass TOF PID + return (track.hasTOF() && std::abs(nsigmaTOF) < kNsigmaMax); + } + // Event rejection bool rejectEvent() { @@ -634,6 +743,9 @@ struct AntinucleiInJets { return; registryData.fill(HIST("number_of_events_data"), 8.5); + // Initialize ITS PID Response object + o2::aod::ITSResponse itsResponse; + // Loop over reconstructed tracks int id(-1); std::vector fjParticles; @@ -694,9 +806,6 @@ struct AntinucleiInJets { // Get jet constituents std::vector jetConstituents = jet.constituents(); - // Initialize ITS PID Response object - o2::aod::ITSResponse itsResponse; - // Loop over jet constituents for (const auto& particle : jetConstituents) { @@ -1073,6 +1182,11 @@ struct AntinucleiInJets { // Antinuclei reconstruction efficiency void processAntinucleiEfficiency(RecCollisionsMc const& collisions, AntiNucleiTracksMc const& mcTracks, aod::McParticles const& mcParticles) { + + // Initialize ITS PID Response object + o2::aod::ITSResponse itsResponse; + itsResponse.setMCDefaultParameters(); + // Loop over all simulated collision events for (const auto& collision : collisions) { @@ -1152,9 +1266,6 @@ struct AntinucleiInJets { } } - // ITS PID response utility - o2::aod::ITSResponse itsResponse; - // Loop over all reconstructed MC tracks for (auto const& track : mcTracks) { @@ -1275,6 +1386,7 @@ struct AntinucleiInJets { // Loop over all MC particles std::vector fjParticles; + std::vector protonMomentum; for (const auto& particle : mcParticles) { // Select physical primaries within acceptance @@ -1284,6 +1396,12 @@ struct AntinucleiInJets { if (particle.eta() < minEta || particle.eta() > maxEta || particle.pt() < MinPtParticle) continue; + // Store 3-momentum vectors of antiprotons for further analysis + if (particle.pdgCode() == PDG_t::kProtonBar) { + TVector3 pVec(particle.px(), particle.py(), particle.pz()); + protonMomentum.push_back(pVec); + } + // 4-momentum representation of a particle double energy = std::sqrt(particle.p() * particle.p() + MassPionCharged * MassPionCharged); fastjet::PseudoJet fourMomentum(particle.px(), particle.py(), particle.pz(), energy); @@ -1344,19 +1462,14 @@ struct AntinucleiInJets { getPerpendicularAxis(jetAxis, ueAxis2, -1); // Loop over MC particles to analyze underlying event region - for (const auto& particle : mcParticles) { - - // Select physical primaries within the acceptance - static constexpr double MinPtParticle = 0.1; - if (particle.eta() < minEta || particle.eta() > maxEta || particle.pt() < MinPtParticle) - continue; + for (const auto& protonVec : protonMomentum) { // Compute distance of particle from both perpendicular cone axes - double deltaEtaUe1 = particle.eta() - ueAxis1.Eta(); - double deltaPhiUe1 = getDeltaPhi(particle.phi(), ueAxis1.Phi()); + double deltaEtaUe1 = protonVec.Eta() - ueAxis1.Eta(); + double deltaPhiUe1 = getDeltaPhi(protonVec.Phi(), ueAxis1.Phi()); double deltaRUe1 = std::sqrt(deltaEtaUe1 * deltaEtaUe1 + deltaPhiUe1 * deltaPhiUe1); - double deltaEtaUe2 = particle.eta() - ueAxis2.Eta(); - double deltaPhiUe2 = getDeltaPhi(particle.phi(), ueAxis2.Phi()); + double deltaEtaUe2 = protonVec.Eta() - ueAxis2.Eta(); + double deltaPhiUe2 = getDeltaPhi(protonVec.Phi(), ueAxis2.Phi()); double deltaRUe2 = std::sqrt(deltaEtaUe2 * deltaEtaUe2 + deltaPhiUe2 * deltaPhiUe2); // Determine the maximum allowed distance from UE axes for particle selection @@ -1369,12 +1482,8 @@ struct AntinucleiInJets { if (deltaRUe1 > maxConeRadius && deltaRUe2 > maxConeRadius) continue; - // Select antiprotons based on PDG - if (particle.pdgCode() != PDG_t::kProtonBar) - continue; - // Fill histogram for antiprotons in the UE - registryMC.fill(HIST("antiproton_gen_ue"), particle.pt()); + registryMC.fill(HIST("antiproton_gen_ue"), protonVec.Pt()); } } if (isAtLeastOneJetSelected) { @@ -1387,6 +1496,10 @@ struct AntinucleiInJets { // Reconstructed events void processJetsMCrec(RecCollisionsMc const& collisions, AntiNucleiTracksMc const& mcTracks, McParticles const&) { + // Initialize ITS PID Response object + o2::aod::ITSResponse itsResponse; + itsResponse.setMCDefaultParameters(); + // Loop over all reconstructed collisions for (const auto& collision : collisions) { @@ -1486,9 +1599,6 @@ struct AntinucleiInJets { // Get jet constituents std::vector jetConstituents = jet.constituents(); - // Initialize ITS PID Response object - o2::aod::ITSResponse itsResponse; - // Loop over jet constituents for (const auto& particle : jetConstituents) { @@ -1497,11 +1607,19 @@ struct AntinucleiInJets { if (!passedTrackSelection(track)) continue; + // Antimatter selection + if (track.sign() > 0) + continue; + // Get corresponding MC particle if (!track.has_mcParticle()) continue; const auto mcparticle = track.mcParticle(); + // Antiproton selection based on the PDG + if (mcparticle.pdgCode() != PDG_t::kProtonBar) + continue; + // Define variables double nsigmaTPCPr = track.tpcNSigmaPr(); double nsigmaTOFPr = track.tofNSigmaPr(); @@ -1510,7 +1628,7 @@ struct AntinucleiInJets { double dcaz = track.dcaZ(); // Fill DCA templates - if (mcparticle.pdgCode() == PDG_t::kProtonBar && std::fabs(dcaz) < maxDcaz) { + if (std::fabs(dcaz) < maxDcaz) { if (mcparticle.isPhysicalPrimary()) { registryMC.fill(HIST("antiproton_prim_dca_jet"), pt, dcaxy); } else { @@ -1522,10 +1640,6 @@ struct AntinucleiInJets { if (std::fabs(dcaxy) > maxDcaxy || std::fabs(dcaz) > maxDcaz) continue; - // Antiproton selection - if (track.sign() > 0 || mcparticle.pdgCode() != PDG_t::kProtonBar) - continue; - // Particle identification using the ITS cluster size bool passedItsPidProt(true); double nSigmaITSprot = static_cast(itsResponse.nSigmaITS(track)); @@ -1559,13 +1673,17 @@ struct AntinucleiInJets { if (!passedTrackSelection(track)) continue; + // Antiproton selection + if (track.sign() > 0) + continue; + // Get corresponding MC particle if (!track.has_mcParticle()) continue; const auto mcparticle = track.mcParticle(); - // Antiproton selection - if (track.sign() > 0 || mcparticle.pdgCode() != PDG_t::kProtonBar) + // Antiproton selection based on the PDG + if (mcparticle.pdgCode() != PDG_t::kProtonBar) continue; // Define variables @@ -1576,7 +1694,7 @@ struct AntinucleiInJets { double dcaz = track.dcaZ(); // Fill DCA templates - if (mcparticle.pdgCode() == PDG_t::kProtonBar && std::fabs(dcaz) < maxDcaz) { + if (std::fabs(dcaz) < maxDcaz) { if (mcparticle.isPhysicalPrimary()) { registryMC.fill(HIST("antiproton_prim_dca_ue"), pt, dcaxy); } else { @@ -1682,6 +1800,9 @@ struct AntinucleiInJets { return; registryData.fill(HIST("number_of_events_data_syst"), 7.5); + // Initialize ITS PID Response object + o2::aod::ITSResponse itsResponse; + // Cut settings static std::vector maxDcaxySyst = { 0.071, 0.060, 0.066, 0.031, 0.052, 0.078, 0.045, 0.064, 0.036, 0.074, @@ -1720,9 +1841,6 @@ struct AntinucleiInJets { 3.41, 2.75, 3.26, 2.61, 3.09, 2.54, 3.36, 2.95, 3.20, 2.58, 3.44, 2.83, 3.11, 2.62, 3.28, 2.69, 3.23, 2.73, 3.39, 2.90}; - // Initialize ITS PID Response object - o2::aod::ITSResponse itsResponse; - // Loop over reconstructed tracks for (auto const& track : tracks) { @@ -1784,11 +1902,15 @@ struct AntinucleiInJets { } } } - PROCESS_SWITCH(AntinucleiInJets, processSystData, "Process syst data", true); + PROCESS_SWITCH(AntinucleiInJets, processSystData, "Process syst data", false); // Process MC with systematic variations of analysis parameters void processSystEff(GenCollisionsMc const& genCollisions, RecCollisionsMc const& recCollisions, AntiNucleiTracksMc const& mcTracks, aod::McParticles const& mcParticles) { + // Initialize ITS PID Response object + o2::aod::ITSResponse itsResponse; + itsResponse.setMCDefaultParameters(); + // Cut settings static std::vector maxDcaxySyst = { 0.071, 0.060, 0.066, 0.031, 0.052, 0.078, 0.045, 0.064, 0.036, 0.074, @@ -1903,9 +2025,6 @@ struct AntinucleiInJets { if (requireIsVertexTOFmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTOFmatched)) continue; - // Initialize ITS PID Response object - o2::aod::ITSResponse itsResponse; - // Loop over reconstructed tracks for (auto const& track : mcTracks) { @@ -1967,25 +2086,431 @@ struct AntinucleiInJets { // Fill histograms for antiprotons if (passedItsPidProt && mcparticle.pdgCode() == PDG_t::kProtonBar && nsigmaTPCPr > minNsigmaTpcSyst[isyst] && nsigmaTPCPr < maxNsigmaTpcSyst[isyst]) { - registryData.fill(HIST("antiproton_rec_tpc_syst"), isyst, pt); + registryMC.fill(HIST("antiproton_rec_tpc_syst"), isyst, pt); if (track.hasTOF() && nsigmaTOFPr > minNsigmaTofSyst[isyst] && nsigmaTOFPr < maxNsigmaTofSyst[isyst]) - registryData.fill(HIST("antiproton_rec_tof_syst"), isyst, pt); + registryMC.fill(HIST("antiproton_rec_tof_syst"), isyst, pt); } // Fill histograms for antideuterons if (passedItsPidDeut && mcparticle.pdgCode() == -o2::constants::physics::Pdg::kDeuteron && nsigmaTPCDe > minNsigmaTpcSyst[isyst] && nsigmaTPCDe < maxNsigmaTpcSyst[isyst]) { - registryData.fill(HIST("antideuteron_rec_tpc_syst"), isyst, pt); + registryMC.fill(HIST("antideuteron_rec_tpc_syst"), isyst, pt); if (track.hasTOF() && nsigmaTOFDe > minNsigmaTofSyst[isyst] && nsigmaTOFDe < maxNsigmaTofSyst[isyst]) - registryData.fill(HIST("antideuteron_rec_tof_syst"), isyst, pt); + registryMC.fill(HIST("antideuteron_rec_tof_syst"), isyst, pt); } // Fill histograms for antihelium3 if (passedItsPidHel && mcparticle.pdgCode() == -o2::constants::physics::Pdg::kHelium3 && nsigmaTPCHe > minNsigmaTpcSyst[isyst] && nsigmaTPCHe < maxNsigmaTpcSyst[isyst]) { - registryData.fill(HIST("antihelium3_rec_tpc_syst"), isyst, 2.0 * pt); + registryMC.fill(HIST("antihelium3_rec_tpc_syst"), isyst, 2.0 * pt); } } } } } PROCESS_SWITCH(AntinucleiInJets, processSystEff, "process syst mc", false); + + // Process correlation + void processCorr(SelectedCollisions::iterator const& collision, AntiNucleiTracks const& tracks) + { + // Event counter: before event selection + registryCorr.fill(HIST("eventCounter"), 0.5); + + // Apply standard event selection + if (!collision.sel8() || std::fabs(collision.posZ()) > zVtx) + return; + + // Event counter: after event selection + registryCorr.fill(HIST("eventCounter"), 1.5); + + // Reject events near the ITS Read-Out Frame border + if (rejectITSROFBorder && !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) + return; + registryCorr.fill(HIST("eventCounter"), 2.5); + + // Reject events at the Time Frame border + if (rejectTFBorder && !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) + return; + registryCorr.fill(HIST("eventCounter"), 3.5); + + // Require at least one ITS-TPC matched track + if (requireVtxITSTPC && !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) + return; + registryCorr.fill(HIST("eventCounter"), 4.5); + + // Reject events with same-bunch pileup + if (rejectSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) + return; + registryCorr.fill(HIST("eventCounter"), 5.5); + + // Require consistent FT0 vs PV z-vertex + if (requireIsGoodZvtxFT0VsPV && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) + return; + registryCorr.fill(HIST("eventCounter"), 6.5); + + // Require TOF match for at least one vertex track + if (requireIsVertexTOFmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTOFmatched)) + return; + registryCorr.fill(HIST("eventCounter"), 7.5); + + // Initialize ITS PID Response object + o2::aod::ITSResponse itsResponse; + + // Multiplicity percentile + const float multiplicity = collision.centFT0M(); + + // pt/A bins + std::vector ptOverAbins = {0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0}; + const int nBins = ptOverAbins.size() - 1; + + // Particle counters + std::vector nAntiprotonFullEvent(nBins, 0); + std::vector nAntideuteronFullEvent(nBins, 0); + int nTotProtonFullEvent(0); + int nTotDeuteronFullEvent(0); + int nTotAntiprotonFullEvent(0); + int nTotAntideuteronFullEvent(0); + + // Loop over reconstructed tracks + for (auto const& track : tracks) { + + // Apply track selection + if (!passedTrackSelection(track)) + continue; + + // Apply DCA selections + if (std::fabs(track.dcaXY()) > maxDcaxy || std::fabs(track.dcaZ()) > maxDcaz) + continue; + + // Particle identification using the ITS cluster size + bool passedItsPidProt(true), passedItsPidDeut(true); + double nSigmaITSprot = static_cast(itsResponse.nSigmaITS(track)); + double nSigmaITSdeut = static_cast(itsResponse.nSigmaITS(track)); + + if (applyItsPid && track.pt() < ptMaxItsPidProt && (nSigmaITSprot < nSigmaItsMin || nSigmaITSprot > nSigmaItsMax)) { + passedItsPidProt = false; + } + if (applyItsPid && track.pt() < ptMaxItsPidDeut && (nSigmaITSdeut < nSigmaItsMin || nSigmaITSdeut > nSigmaItsMax)) { + passedItsPidDeut = false; + } + + // Kinematic range selection + if (isProton(track) && passedItsPidProt) { + if (track.pt() < ptOverAbins[0] || track.pt() >= ptOverAbins[nBins]) { + continue; + } + } else if (isDeuteron(track) && passedItsPidDeut) { + double ptPerNucleon = 0.5 * track.pt(); + if (ptPerNucleon < ptOverAbins[0] || ptPerNucleon >= ptOverAbins[nBins]) { + continue; + } + } else { + continue; + } + + // (Anti)protons + if (isProton(track) && passedItsPidProt) { + if (track.sign() > 0) { + nTotProtonFullEvent++; + } else if (track.sign() < 0) { + nTotAntiprotonFullEvent++; + int ibin = findBin(ptOverAbins, track.pt()); + nAntiprotonFullEvent[ibin]++; + } + } + + // (Anti)deuterons + if (isDeuteron(track) && passedItsPidDeut) { + const double ptPerNucleon = 0.5 * track.pt(); + + if (track.sign() > 0) { + nTotDeuteronFullEvent++; + } else if (track.sign() < 0) { + nTotAntideuteronFullEvent++; + int ibin = findBin(ptOverAbins, ptPerNucleon); + nAntideuteronFullEvent[ibin]++; + } + } + } + + // Fill correlation histograms + int netProtonFullEvent = nTotProtonFullEvent - nTotAntiprotonFullEvent; + int netDeuteronFullEvent = nTotDeuteronFullEvent - nTotAntideuteronFullEvent; + registryCorr.fill(HIST("rho_fullEvent"), nTotAntideuteronFullEvent, nTotAntiprotonFullEvent, multiplicity); + registryCorr.fill(HIST("rho_netP_netD_fullEvent"), netDeuteronFullEvent, netProtonFullEvent); + + // Fill efficiency histograms + for (int i = 0; i < nBins; i++) { + double ptAcenteri = 0.5 * (ptOverAbins[i] + ptOverAbins[i + 1]); + + registryCorr.fill(HIST("q1d_fullEvent"), nAntideuteronFullEvent[i], ptAcenteri); + registryCorr.fill(HIST("q1p_fullEvent"), nAntiprotonFullEvent[i], ptAcenteri); + for (int j = 0; j < nBins; j++) { + double ptAcenterj = 0.5 * (ptOverAbins[j] + ptOverAbins[j + 1]); + registryCorr.fill(HIST("q1d_square_fullEvent"), ptAcenteri, ptAcenterj, nAntideuteronFullEvent[i] * nAntideuteronFullEvent[j]); + registryCorr.fill(HIST("q1p_square_fullEvent"), ptAcenteri, ptAcenterj, nAntiprotonFullEvent[i] * nAntiprotonFullEvent[j]); + registryCorr.fill(HIST("q1d_q1p_fullEvent"), ptAcenteri, ptAcenterj, nAntideuteronFullEvent[i] * nAntiprotonFullEvent[j]); + } + } + + // Loop over reconstructed tracks (refactoring: this part can be incorporated above) + int id(-1); + std::vector fjParticles; + for (auto const& track : tracks) { + id++; + if (!passedTrackSelectionForJetReconstruction(track)) + continue; + + // 4-momentum representation of a particle + fastjet::PseudoJet fourMomentum(track.px(), track.py(), track.pz(), track.energy(MassPionCharged)); + fourMomentum.set_user_index(id); + fjParticles.emplace_back(fourMomentum); + } + + // Reject empty events + if (fjParticles.empty()) + return; + registryCorr.fill(HIST("eventCounter"), 8.5); + + // Cluster particles using the anti-kt algorithm + fastjet::JetDefinition jetDef(fastjet::antikt_algorithm, rJet); + fastjet::AreaDefinition areaDef(fastjet::active_area, fastjet::GhostedAreaSpec(1.0)); + fastjet::ClusterSequenceArea cs(fjParticles, jetDef, areaDef); + std::vector jets = fastjet::sorted_by_pt(cs.inclusive_jets()); + auto [rhoPerp, rhoMPerp] = backgroundSub.estimateRhoPerpCone(fjParticles, jets); + + // Loop over reconstructed jets + bool isAtLeastOneJetSelected = false; + for (const auto& jet : jets) { + + // Jet must be fully contained in the acceptance + if ((std::fabs(jet.eta()) + rJet) > (maxEta - deltaEtaEdge)) + continue; + + // Jet pt must be larger than threshold + auto jetForSub = jet; + fastjet::PseudoJet jetMinusBkg = backgroundSub.doRhoAreaSub(jetForSub, rhoPerp, rhoMPerp); + if (jetMinusBkg.pt() < minJetPt) + continue; + + // Apply area cut if required + double normalizedJetArea = jet.area() / (PI * rJet * rJet); + if (applyAreaCut && normalizedJetArea > maxNormalizedJetArea) + continue; + isAtLeastOneJetSelected = true; + + // Perpendicular cones + double coneRadius = std::sqrt(jet.area() / PI); + TVector3 jetAxis(jet.px(), jet.py(), jet.pz()); + TVector3 ueAxis1(0, 0, 0); + TVector3 ueAxis2(0, 0, 0); + getPerpendicularAxis(jetAxis, ueAxis1, +1); + getPerpendicularAxis(jetAxis, ueAxis2, -1); + + // Get jet constituents + std::vector jetConstituents = jet.constituents(); + + // Particle counters + std::vector nAntiprotonJet(nBins, 0); + std::vector nAntideuteronJet(nBins, 0); + int nTotProtonJet(0); + int nTotDeuteronJet(0); + int nTotAntiprotonJet(0); + int nTotAntideuteronJet(0); + + // Loop over jet constituents + for (const auto& particle : jetConstituents) { + + // Get corresponding track and apply track selection criteria + auto const& track = tracks.iteratorAt(particle.user_index()); + if (!passedTrackSelection(track)) + continue; + + // Apply DCA selections + if (std::fabs(track.dcaXY()) > maxDcaxy || std::fabs(track.dcaZ()) > maxDcaz) + continue; + + // Particle identification using the ITS cluster size + bool passedItsPidProt(true), passedItsPidDeut(true); + double nSigmaITSprot = static_cast(itsResponse.nSigmaITS(track)); + double nSigmaITSdeut = static_cast(itsResponse.nSigmaITS(track)); + + if (applyItsPid && track.pt() < ptMaxItsPidProt && (nSigmaITSprot < nSigmaItsMin || nSigmaITSprot > nSigmaItsMax)) { + passedItsPidProt = false; + } + if (applyItsPid && track.pt() < ptMaxItsPidDeut && (nSigmaITSdeut < nSigmaItsMin || nSigmaITSdeut > nSigmaItsMax)) { + passedItsPidDeut = false; + } + + // Kinematic range selection + if (isProton(track) && passedItsPidProt) { + if (track.pt() < ptOverAbins[0] || track.pt() >= ptOverAbins[nBins]) { + continue; + } + } else if (isDeuteron(track) && passedItsPidDeut) { + double ptPerNucleon = 0.5 * track.pt(); + if (ptPerNucleon < ptOverAbins[0] || ptPerNucleon >= ptOverAbins[nBins]) { + continue; + } + } else { + continue; + } + + // (Anti)protons + if (isProton(track) && passedItsPidProt) { + if (track.sign() > 0) { + nTotProtonJet++; + } else if (track.sign() < 0) { + nTotAntiprotonJet++; + int ibin = findBin(ptOverAbins, track.pt()); + nAntiprotonJet[ibin]++; + } + } + + // (Anti)deuterons + if (isDeuteron(track) && passedItsPidDeut) { + const double ptPerNucleon = 0.5 * track.pt(); + + if (track.sign() > 0) { + nTotDeuteronJet++; + } else if (track.sign() < 0) { + nTotAntideuteronJet++; + int ibin = findBin(ptOverAbins, ptPerNucleon); + nAntideuteronJet[ibin]++; + } + } + } // end of loop over constituents + + // Fill correlation histograms + int netProtonJet = nTotProtonJet - nTotAntiprotonJet; + int netDeuteronJet = nTotDeuteronJet - nTotAntideuteronJet; + registryCorr.fill(HIST("rho_jet"), nTotAntideuteronJet, nTotAntiprotonJet, multiplicity); + registryCorr.fill(HIST("rho_netP_netD_jet"), netDeuteronJet, netProtonJet); + + // Fill efficiency histograms + for (int i = 0; i < nBins; i++) { + double ptAcenteri = 0.5 * (ptOverAbins[i] + ptOverAbins[i + 1]); + + registryCorr.fill(HIST("q1d_jet"), nAntideuteronJet[i], ptAcenteri); + registryCorr.fill(HIST("q1p_jet"), nAntiprotonJet[i], ptAcenteri); + for (int j = 0; j < nBins; j++) { + double ptAcenterj = 0.5 * (ptOverAbins[j] + ptOverAbins[j + 1]); + registryCorr.fill(HIST("q1d_square_jet"), ptAcenteri, ptAcenterj, nAntideuteronJet[i] * nAntideuteronJet[j]); + registryCorr.fill(HIST("q1p_square_jet"), ptAcenteri, ptAcenterj, nAntiprotonJet[i] * nAntiprotonJet[j]); + registryCorr.fill(HIST("q1d_q1p_jet"), ptAcenteri, ptAcenterj, nAntideuteronJet[i] * nAntiprotonJet[j]); + } + } + + // Particle counters + std::vector nAntiprotonUE(nBins, 0); + std::vector nAntideuteronUE(nBins, 0); + int nTotProtonUE(0); + int nTotDeuteronUE(0); + int nTotAntiprotonUE(0); + int nTotAntideuteronUE(0); + + // Loop over tracks in the underlying event + for (auto const& track : tracks) { + + // Get corresponding track and apply track selection criteria + if (!passedTrackSelection(track)) + continue; + + // Apply DCA selections + if (std::fabs(track.dcaXY()) > maxDcaxy || std::fabs(track.dcaZ()) > maxDcaz) + continue; + + // Calculate the angular distance between the track and underlying event axes in eta-phi space + double deltaEtaUe1 = track.eta() - ueAxis1.Eta(); + double deltaPhiUe1 = getDeltaPhi(track.phi(), ueAxis1.Phi()); + double deltaRUe1 = std::sqrt(deltaEtaUe1 * deltaEtaUe1 + deltaPhiUe1 * deltaPhiUe1); + double deltaEtaUe2 = track.eta() - ueAxis2.Eta(); + double deltaPhiUe2 = getDeltaPhi(track.phi(), ueAxis2.Phi()); + double deltaRUe2 = std::sqrt(deltaEtaUe2 * deltaEtaUe2 + deltaPhiUe2 * deltaPhiUe2); + + // Determine the maximum allowed distance from UE axes for particle selection + double maxConeRadius = coneRadius; + if (applyAreaCut) { + maxConeRadius = std::sqrt(maxNormalizedJetArea) * rJet; + } + + // Reject tracks that lie outside the maxConeRadius from both UE axes + if (deltaRUe1 > maxConeRadius && deltaRUe2 > maxConeRadius) + continue; + + // Particle identification using the ITS cluster size + bool passedItsPidProt(true), passedItsPidDeut(true); + double nSigmaITSprot = static_cast(itsResponse.nSigmaITS(track)); + double nSigmaITSdeut = static_cast(itsResponse.nSigmaITS(track)); + + if (applyItsPid && track.pt() < ptMaxItsPidProt && (nSigmaITSprot < nSigmaItsMin || nSigmaITSprot > nSigmaItsMax)) { + passedItsPidProt = false; + } + if (applyItsPid && track.pt() < ptMaxItsPidDeut && (nSigmaITSdeut < nSigmaItsMin || nSigmaITSdeut > nSigmaItsMax)) { + passedItsPidDeut = false; + } + + // Kinematic range selection + if (isProton(track) && passedItsPidProt) { + if (track.pt() < ptOverAbins[0] || track.pt() >= ptOverAbins[nBins]) { + continue; + } + } else if (isDeuteron(track) && passedItsPidDeut) { + double ptPerNucleon = 0.5 * track.pt(); + if (ptPerNucleon < ptOverAbins[0] || ptPerNucleon >= ptOverAbins[nBins]) { + continue; + } + } else { + continue; + } + + // (Anti)protons + if (isProton(track) && passedItsPidProt) { + if (track.sign() > 0) { + nTotProtonUE++; + } else if (track.sign() < 0) { + nTotAntiprotonUE++; + int ibin = findBin(ptOverAbins, track.pt()); + nAntiprotonUE[ibin]++; + } + } + + // (Anti)deuterons + if (isDeuteron(track) && passedItsPidDeut) { + const double ptPerNucleon = 0.5 * track.pt(); + + if (track.sign() > 0) { + nTotDeuteronUE++; + } else if (track.sign() < 0) { + nTotAntideuteronUE++; + int ibin = findBin(ptOverAbins, ptPerNucleon); + nAntideuteronUE[ibin]++; + } + } + } + + // Fill correlation histograms + int netProtonUE = nTotProtonUE - nTotAntiprotonUE; + int netDeuteronUE = nTotDeuteronUE - nTotAntideuteronUE; + registryCorr.fill(HIST("rho_ue"), nTotAntideuteronUE, nTotAntiprotonUE, multiplicity); + registryCorr.fill(HIST("rho_netP_netD_ue"), netDeuteronUE, netProtonUE); + + // Fill efficiency histograms + for (int i = 0; i < nBins; i++) { + double ptAcenteri = 0.5 * (ptOverAbins[i] + ptOverAbins[i + 1]); + + registryCorr.fill(HIST("q1d_ue"), nAntideuteronUE[i], ptAcenteri); + registryCorr.fill(HIST("q1p_ue"), nAntiprotonUE[i], ptAcenteri); + for (int j = 0; j < nBins; j++) { + double ptAcenterj = 0.5 * (ptOverAbins[j] + ptOverAbins[j + 1]); + registryCorr.fill(HIST("q1d_square_ue"), ptAcenteri, ptAcenterj, nAntideuteronUE[i] * nAntideuteronUE[j]); + registryCorr.fill(HIST("q1p_square_ue"), ptAcenteri, ptAcenterj, nAntiprotonUE[i] * nAntiprotonUE[j]); + registryCorr.fill(HIST("q1d_q1p_ue"), ptAcenteri, ptAcenterj, nAntideuteronUE[i] * nAntiprotonUE[j]); + } + } + } + // Event counter: events with at least one jet selected + if (isAtLeastOneJetSelected) { + registryCorr.fill(HIST("eventCounter"), 9.5); + } + } + PROCESS_SWITCH(AntinucleiInJets, processCorr, "Process Correlation analysis", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 7be40d7b74a80d67fcec0a6fab4e71e40e6c95f3 Mon Sep 17 00:00:00 2001 From: Gyula Bencedi Date: Fri, 8 Aug 2025 00:18:14 +0200 Subject: [PATCH 286/345] [PWGLF] Fix minor linter issues (#12481) --- PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx | 120 +++++++++++------------------ 1 file changed, 46 insertions(+), 74 deletions(-) diff --git a/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx b/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx index ed386e6a6fd..7a8c4cfb23e 100644 --- a/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx +++ b/PWGMM/Mult/Tasks/dndetaMFTPbPb.cxx @@ -57,6 +57,8 @@ using namespace o2::constants::physics; using namespace o2::constants::math; using namespace pwgmm::mult; +auto static constexpr kMinCharge = 3.f; + AxisSpec ptAxis = {1001, -0.005, 10.005}; AxisSpec multAxis = {701, -0.5, 700.5, "N_{trk}"}; AxisSpec zAxis = {60, -30., 30.}; @@ -102,79 +104,49 @@ struct DndetaMFTPbPb { struct : ConfigurableGroup { Configurable usephiCut{"usephiCut", false, "use azimuthal angle cut"}; - Configurable phiCut{"phiCut", 0.1f, - "Cut on azimuthal angle of MFT tracks"}; + Configurable phiCut{"phiCut", 0.1f, "Cut on azimuthal angle of MFT tracks"}; Configurable minPhi{"minPhi", 0.f, ""}; Configurable maxPhi{"maxPhi", 6.2832, ""}; Configurable minEta{"minEta", -3.6f, ""}; Configurable maxEta{"maxEta", -2.5f, ""}; - Configurable minNclusterMft{"minNclusterMft", 5, - "minimum number of MFT clusters"}; + Configurable minNclusterMft{"minNclusterMft", 5, "minimum number of MFT clusters"}; Configurable useChi2Cut{"useChi2Cut", false, "use track chi2 cut"}; Configurable maxChi2NCl{"maxChi2NCl", 1000.f, "maximum chi2 per MFT clusters"}; Configurable usePtCut{"usePtCut", false, "use track pT cut"}; Configurable minPt{"minPt", 0., "minimum pT of the MFT tracks"}; - Configurable requireCA{ - "requireCA", false, "Use Cellular Automaton track-finding algorithm"}; + Configurable requireCA{"requireCA", false, "Use Cellular Automaton track-finding algorithm"}; Configurable maxDCAxy{"maxDCAxy", 2.0f, "Cut on dcaXY"}; } trackCuts; struct : ConfigurableGroup { Configurable maxZvtx{"maxZvtx", 10.0f, "maximum cut on z-vtx (cm)"}; Configurable minZvtx{"minZvtx", -10.0f, "minimum cut on z-vtx (cm)"}; - Configurable useZDiffCut{"useZDiffCut", false, - "use Zvtx reco-mc diff. cut"}; - Configurable maxZvtxDiff{ - "maxZvtxDiff", 1.0f, - "max allowed Z vtx difference for reconstruced collisions (cm)"}; + Configurable useZDiffCut{"useZDiffCut", false, "use Zvtx reco-mc diff. cut"}; + Configurable maxZvtxDiff{"maxZvtxDiff", 1.0f, "max allowed Z vtx difference for reconstruced collisions (cm)"}; Configurable requireIsGoodZvtxFT0VsPV{"requireIsGoodZvtxFT0VsPV", true, "require events with PV position along z consistent (within 1 cm) between PV reconstructed using tracks and PV using FT0 A-C time difference"}; Configurable requireRejectSameBunchPileup{"requireRejectSameBunchPileup", true, "reject collisions in case of pileup with another collision in the same foundBC"}; Configurable requireNoCollInTimeRangeStrict{"requireNoCollInTimeRangeStrict", false, " requireNoCollInTimeRangeStrict"}; Configurable requireNoCollInRofStrict{"requireNoCollInRofStrict", false, "requireNoCollInRofStrict"}; Configurable requireNoCollInRofStandard{"requireNoCollInRofStandard", false, "requireNoCollInRofStandard"}; Configurable requireNoHighMultCollInPrevRof{"requireNoHighMultCollInPrevRof", false, "requireNoHighMultCollInPrevRof"}; - Configurable requireNoCollInTimeRangeStd{ - "requireNoCollInTimeRangeStd", true, - "reject collisions corrupted by the cannibalism, with other collisions " - "within +/- 10 microseconds"}; - Configurable requireNoCollInTimeRangeNarrow{ - "requireNoCollInTimeRangeNarrow", false, - "reject collisions corrupted by the cannibalism, with other collisions " - "within +/- 10 microseconds"}; - Configurable occupancyEstimator{ - "occupancyEstimator", 1, - "Occupancy estimator: 1 = trackOccupancyInTimeRange, 2 = " - "ft0cOccupancyInTimeRange"}; - Configurable minOccupancy{ - "minOccupancy", -1, "minimum occupancy from neighbouring collisions"}; - Configurable maxOccupancy{ - "maxOccupancy", -1, "maximum occupancy from neighbouring collisions"}; + Configurable requireNoCollInTimeRangeStd{"requireNoCollInTimeRangeStd", true, "reject collisions corrupted by the cannibalism, with other collisions within +/- 10 microseconds"}; + Configurable requireNoCollInTimeRangeNarrow{"requireNoCollInTimeRangeNarrow", false, "reject collisions corrupted by the cannibalism, with other collisions within +/- 10 microseconds"}; + Configurable occupancyEstimator{"occupancyEstimator", 1, "Occupancy estimator: 1 = trackOccupancyInTimeRange, 2 = ft0cOccupancyInTimeRange"}; + Configurable minOccupancy{"minOccupancy", -1, "minimum occupancy from neighbouring collisions"}; + Configurable maxOccupancy{"maxOccupancy", -1, "maximum occupancy from neighbouring collisions"}; Configurable minIR{"minIR", -1, "minimum IR (kHz) collisions"}; Configurable maxIR{"maxIR", -1, "maximum IR (kHz) collisions"}; } eventCuts; - ConfigurableAxis occupancyBins{"occupancyBins", - {VARIABLE_WIDTH, 0.0f, 250.0f, 500.0f, 750.0f, - 1000.0f, 1500.0f, 2000.0f, 3000.0f, 4500.0f, - 6000.0f, 8000.0f, 10000.0f, 50000.0f}, - "Occupancy"}; - ConfigurableAxis centralityBins{ - "centralityBins", - {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}, - "Centrality"}; + ConfigurableAxis occupancyBins{"occupancyBins", {VARIABLE_WIDTH, 0.0f, 250.0f, 500.0f, 750.0f, 1000.0f, 1500.0f, 2000.0f, 3000.0f, 4500.0f, 6000.0f, 8000.0f, 10000.0f, 50000.0f}, "Occupancy"}; + ConfigurableAxis centralityBins{"centralityBins", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}, "Centrality"}; ConfigurableAxis irBins{"irBins", {500, 0, 50}, "Interaction rate (kHz)"}; Service pdg; Service ccdb; - Configurable ccdbNoLaterThan{ - "ccdbNoLaterThan", - std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()) - .count(), - "latest acceptable timestamp of creation for the object"}; - Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", - "url of the ccdb repository"}; + Configurable ccdbNoLaterThan{"ccdbNoLaterThan", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; + Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; int mRunNumber{-1}; uint64_t mSOR{0}; @@ -1061,7 +1033,7 @@ struct DndetaMFTPbPb { if (p != nullptr) { charge = p->Charge(); } - return std::abs(charge) >= 3.; + return std::abs(charge) >= kMinCharge; } template @@ -1371,27 +1343,27 @@ struct DndetaMFTPbPb { bool gtZeroColl = false; int gtOneColl = 0; - float cgen = -1; + float cGen = -1; if constexpr (has_reco_cent) { - float crec_min = 105.f; + float crecMin = 105.f; for (const auto& collision : collisions) { if (isGoodEvent(collision)) { float c = getRecoCent(collision); - if (c < crec_min) { - crec_min = c; + if (c < crecMin) { + crecMin = c; } } } - if (cgen < 0) - cgen = crec_min; + if (cGen < 0) + cGen = crecMin; } - float occgen = -1.; + float occGen = -1.; for (const auto& collision : collisions) { if (isGoodEvent(collision)) { float o = getOccupancy(collision, eventCuts.occupancyEstimator); - if (o > occgen) { - occgen = o; + if (o > occGen) { + occGen = o; } } } @@ -1449,9 +1421,9 @@ struct DndetaMFTPbPb { } if constexpr (has_reco_cent) { - registry.fill(HIST("Events/Centrality/EvtEffGen"), 3., cgen, occgen); + registry.fill(HIST("Events/Centrality/EvtEffGen"), 3., cGen, occGen); } else { - registry.fill(HIST("Events/EvtEffGen"), 3., occgen); + registry.fill(HIST("Events/EvtEffGen"), 3., occGen); } auto perCollMCsample = mcSample->sliceByCached( @@ -1461,7 +1433,7 @@ struct DndetaMFTPbPb { if (gtOneColl > 1) { if constexpr (has_reco_cent) { - qaregistry.fill(HIST("Events/Centrality/SplitMult"), nchrg, zvtxMC, cgen); + qaregistry.fill(HIST("Events/Centrality/SplitMult"), nchrg, zvtxMC, cGen); } else { qaregistry.fill(HIST("Events/SplitMult"), nchrg, zvtxMC); } @@ -1470,17 +1442,17 @@ struct DndetaMFTPbPb { auto nCharged = countPart(particles); if constexpr (has_reco_cent) { registry.fill(HIST("Events/Centrality/NtrkZvtxGen_t"), nCharged, zvtxMC, - cgen); + cGen); } else { registry.fill(HIST("Events/NtrkZvtxGen_t"), nCharged, zvtxMC); } - fillHistMC>(particles, cgen, occgen, zvtxMC, gtZeroColl); + fillHistMC>(particles, cGen, occGen, zvtxMC, gtZeroColl); if (collisions.size() == 0) { if constexpr (has_reco_cent) { qaregistry.fill(HIST("Events/Centrality/NotFoundEventZvtx"), - mcCollision.posZ(), cgen); + mcCollision.posZ(), cGen); } else { qaregistry.fill(HIST("Events/NotFoundEventZvtx"), mcCollision.posZ()); } @@ -1574,27 +1546,27 @@ struct DndetaMFTPbPb { FiltBestTracks const& besttracks) { bool gtZeroColl = false; - float cgen = -1; + float cGen = -1; if constexpr (has_reco_cent) { - float crec_min = 105.f; + float crecMin = 105.f; for (const auto& collision : collisions) { if (isGoodEvent(collision)) { float c = getRecoCent(collision); - if (c < crec_min) { - crec_min = c; + if (c < crecMin) { + crecMin = c; } } } - if (cgen < 0) - cgen = crec_min; + if (cGen < 0) + cGen = crecMin; } - float occgen = -1.; + float occGen = -1.; for (const auto& collision : collisions) { if (isGoodEvent(collision)) { float o = getOccupancy(collision, eventCuts.occupancyEstimator); - if (o > occgen) { - occgen = o; + if (o > occGen) { + occGen = o; } } } @@ -1637,26 +1609,26 @@ struct DndetaMFTPbPb { } if constexpr (has_reco_cent) { - registry.fill(HIST("Events/Centrality/EvtEffGen"), 3., cgen, occgen); + registry.fill(HIST("Events/Centrality/EvtEffGen"), 3., cGen, occGen); } else { - registry.fill(HIST("Events/EvtEffGen"), 3., occgen); + registry.fill(HIST("Events/EvtEffGen"), 3., occGen); } auto zvtxMC = mcCollision.posZ(); auto nCharged = countPart(particles); if constexpr (has_reco_cent) { registry.fill(HIST("Events/Centrality/NtrkZvtxGen_t"), nCharged, zvtxMC, - cgen); + cGen); } else { registry.fill(HIST("Events/NtrkZvtxGen_t"), nCharged, zvtxMC); } - fillHistMC>(particles, cgen, occgen, zvtxMC, gtZeroColl); + fillHistMC>(particles, cGen, occGen, zvtxMC, gtZeroColl); if (collisions.size() == 0) { if constexpr (has_reco_cent) { qaregistry.fill(HIST("Events/Centrality/NotFoundEventZvtx"), - mcCollision.posZ(), cgen); + mcCollision.posZ(), cGen); } else { qaregistry.fill(HIST("Events/NotFoundEventZvtx"), mcCollision.posZ()); } From 5fc5f3bc711a610521bff60aa8dfd83c1f8c214d Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Fri, 8 Aug 2025 01:08:06 +0200 Subject: [PATCH 287/345] [PWGEM/Dilepton] update treeCreatorElectronMLDDA.cxx (#12480) --- .../treeCreatorElectronMLDDA.cxx | 40 ++++++++++--------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx index 08b3f7ad8f3..81e914de7bb 100644 --- a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx +++ b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx @@ -207,6 +207,7 @@ struct TreeCreatorElectronMLDDA { Configurable cfg_includeITSsa{"cfg_includeITSsa", false, "Flag to include ITSsa tracks"}; Configurable cfg_max_pt_itssa{"cfg_max_pt_itssa", 0.15, "mix pt for ITSsa track"}; Configurable cfg_min_qt_strangeness{"cfg_min_qt_strangeness", 0.015, "min qt for Lambda and K0S"}; + Configurable cfg_require_collinearV0{"cfg_require_collinearV0", false, "require collinear V0 for photon conversions"}; Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -5, "min n sigma e in TPC"}; Configurable cfg_max_TPCNsigmaEl{"cfg_max_TPCNsigmaEl", +5, "max n sigma e in TPC"}; @@ -748,7 +749,7 @@ struct TreeCreatorElectronMLDDA { Partition negTracks = o2::aod::track::signed1Pt < 0.f && ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::ITS) == true; std::vector stored_trackIds; - void processPID(filteredMyCollisions const& collisions, aod::BCsWithTimestamps const&, filteredV0s const& v0s, filteredCascades const& cascades, MyTracks const& tracks) + void processPID(filteredMyCollisions const& collisions, aod::BCsWithTimestamps const&, filteredV0s const& v0s, filteredCascades const& cascades, MyTracks const& tracks, aod::V0s const&) { stored_trackIds.reserve(tracks.size()); for (const auto& collision : collisions) { @@ -768,6 +769,7 @@ struct TreeCreatorElectronMLDDA { auto v0s_coll = v0s.sliceBy(perCollision_v0, collision.globalIndex()); for (const auto& v0 : v0s_coll) { + auto o2v0 = v0.template v0_as(); auto pos = v0.template posTrack_as(); auto neg = v0.template negTrack_as(); // LOGF(info, "v0.globalIndex() = %d, v0.collisionId() = %d, v0.posTrackId() = %d, v0.negTrackId() = %d", v0.globalIndex(), v0.collisionId(), v0.posTrackId(), v0.negTrackId()); @@ -831,25 +833,27 @@ struct TreeCreatorElectronMLDDA { } } // end of stangeness - if (isElectronTight(pos) && isElectron(neg)) { - registry.fill(HIST("V0/hMassGamma"), v0.mGamma()); - registry.fill(HIST("V0/hMassGamma_Rxy"), v0.v0radius(), v0.mGamma()); - if (v0cuts.cfg_min_mass_photon < v0.mGamma() && v0.mGamma() < v0cuts.cfg_max_mass_photon) { - registry.fill(HIST("V0/hXY_Gamma"), v0.x(), v0.y()); - fillTrackTable(collision, neg, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kElectron)); - registry.fill(HIST("V0/hTPCdEdx_P_El"), neg.tpcInnerParam(), neg.tpcSignal()); - registry.fill(HIST("V0/hTOFbeta_P_El"), neg.tpcInnerParam(), neg.beta()); + if (!v0cuts.cfg_require_collinearV0 || o2v0.isCollinearV0()) { + if (isElectronTight(pos) && isElectron(neg)) { + registry.fill(HIST("V0/hMassGamma"), v0.mGamma()); + registry.fill(HIST("V0/hMassGamma_Rxy"), v0.v0radius(), v0.mGamma()); + if (v0cuts.cfg_min_mass_photon < v0.mGamma() && v0.mGamma() < v0cuts.cfg_max_mass_photon) { + registry.fill(HIST("V0/hXY_Gamma"), v0.x(), v0.y()); + fillTrackTable(collision, neg, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kElectron)); + registry.fill(HIST("V0/hTPCdEdx_P_El"), neg.tpcInnerParam(), neg.tpcSignal()); + registry.fill(HIST("V0/hTOFbeta_P_El"), neg.tpcInnerParam(), neg.beta()); + } } - } - if (isElectron(pos) && isElectronTight(neg)) { - registry.fill(HIST("V0/hMassGamma"), v0.mGamma()); - registry.fill(HIST("V0/hMassGamma_Rxy"), v0.v0radius(), v0.mGamma()); - if (v0cuts.cfg_min_mass_photon < v0.mGamma() && v0.mGamma() < v0cuts.cfg_max_mass_photon) { - registry.fill(HIST("V0/hXY_Gamma"), v0.x(), v0.y()); - fillTrackTable(collision, pos, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kElectron)); - registry.fill(HIST("V0/hTPCdEdx_P_El"), pos.tpcInnerParam(), pos.tpcSignal()); - registry.fill(HIST("V0/hTOFbeta_P_El"), pos.tpcInnerParam(), pos.beta()); + if (isElectron(pos) && isElectronTight(neg)) { + registry.fill(HIST("V0/hMassGamma"), v0.mGamma()); + registry.fill(HIST("V0/hMassGamma_Rxy"), v0.v0radius(), v0.mGamma()); + if (v0cuts.cfg_min_mass_photon < v0.mGamma() && v0.mGamma() < v0cuts.cfg_max_mass_photon) { + registry.fill(HIST("V0/hXY_Gamma"), v0.x(), v0.y()); + fillTrackTable(collision, pos, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kElectron)); + registry.fill(HIST("V0/hTPCdEdx_P_El"), pos.tpcInnerParam(), pos.tpcSignal()); + registry.fill(HIST("V0/hTOFbeta_P_El"), pos.tpcInnerParam(), pos.beta()); + } } } From b7dfe70479ac6eace604130a4dc631173bc88075 Mon Sep 17 00:00:00 2001 From: omvazque Date: Thu, 7 Aug 2025 20:08:24 -0500 Subject: [PATCH 288/345] [PWGLF] Same analysis dist. for T0M, V0A and ZN Cent. Est (#12482) --- PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx | 171 ++++++++----------- 1 file changed, 75 insertions(+), 96 deletions(-) diff --git a/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx b/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx index 23068352cf6..f0e6012d4a4 100644 --- a/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx @@ -72,17 +72,19 @@ static constexpr int kSizeBootStrapEnsemble{8}; std::array, kSizeBootStrapEnsemble> hPoisson{}; std::array, kSizeBootStrapEnsemble> hNchVsT0M{}; std::array, kSizeBootStrapEnsemble> hNchVsV0A{}; +std::array, kSizeBootStrapEnsemble> hNchVsZN{}; + std::array, kSizeBootStrapEnsemble> pNchVsOneParCorrVsZN{}; std::array, kSizeBootStrapEnsemble> pNchVsTwoParCorrVsZN{}; std::array, kSizeBootStrapEnsemble> pNchVsThreeParCorrVsZN{}; -std::array, kSizeBootStrapEnsemble> pOneParCorrVsT0M{}; -std::array, kSizeBootStrapEnsemble> pTwoParCorrVsT0M{}; -std::array, kSizeBootStrapEnsemble> pThreeParCorrVsT0M{}; +std::array, kSizeBootStrapEnsemble> pNchVsOneParCorrVsT0M{}; +std::array, kSizeBootStrapEnsemble> pNchVsTwoParCorrVsT0M{}; +std::array, kSizeBootStrapEnsemble> pNchVsThreeParCorrVsT0M{}; -std::array, kSizeBootStrapEnsemble> pOneParCorrVsV0A{}; -std::array, kSizeBootStrapEnsemble> pTwoParCorrVsV0A{}; -std::array, kSizeBootStrapEnsemble> pThreeParCorrVsV0A{}; +std::array, kSizeBootStrapEnsemble> pNchVsOneParCorrVsV0A{}; +std::array, kSizeBootStrapEnsemble> pNchVsTwoParCorrVsV0A{}; +std::array, kSizeBootStrapEnsemble> pNchVsThreeParCorrVsV0A{}; std::array, kSizeBootStrapEnsemble> pOneParCorrVsNch{}; std::array, kSizeBootStrapEnsemble> pTwoParCorrVsNch{}; @@ -92,14 +94,6 @@ std::array, kSizeBootStrapEnsemble> hPoissonMC{}; std::array, kSizeBootStrapEnsemble> hNchGen{}; std::array, kSizeBootStrapEnsemble> hNch{}; -// std::array, kSizeBootStrapEnsemble> pOneParCorrVsT0MGen{}; -// std::array, kSizeBootStrapEnsemble> pTwoParCorrVsT0MGen{}; -// std::array, kSizeBootStrapEnsemble> pThreeParCorrVsT0MGen{}; -// -// std::array, kSizeBootStrapEnsemble> pOneParCorrVsV0AGen{}; -// std::array, kSizeBootStrapEnsemble> pTwoParCorrVsV0AGen{}; -// std::array, kSizeBootStrapEnsemble> pThreeParCorrVsV0AGen{}; - std::array, kSizeBootStrapEnsemble> pOneParCorrVsNchGen{}; std::array, kSizeBootStrapEnsemble> pTwoParCorrVsNchGen{}; std::array, kSizeBootStrapEnsemble> pThreeParCorrVsNchGen{}; @@ -128,6 +122,7 @@ struct UccZdc { Configurable correctNch{"correctNch", true, "Correct also Nch"}; Configurable skipRecoColGTOne{"skipRecoColGTOne", true, "Remove collisions if reconstructed more than once"}; Configurable detector4Calibration{"detector4Calibration", "T0M", "Detector for nSigma-Nch rejection"}; + Configurable detectorZDC{"detectorZDC", "ZN", "Detector for Cent. Selec. based on spectator neutrons"}; // Event selection Configurable posZcut{"posZcut", +10.0, "z-vertex position cut"}; @@ -279,36 +274,41 @@ struct UccZdc { x->SetBinLabel(17, "Within ZEM cut?"); if (doprocessZdcCollAss) { - registry.add("NchVsT0Mamp", Form(";%s;%s;", tiNch, tiT0M), kTH2F, {{{nBinsNch, minNch, maxNch}, {nBinsAmpFT0, 0., maxAmpFT0}}}); - registry.add("NchVsV0Aamp", Form(";%s;%s;", tiNch, tiV0A), kTH2F, {{{nBinsNch, minNch, maxNch}, {nBinsAmpV0A, 0., maxAmpV0A}}}); + registry.add("NchVsT0M", Form(";%s;%s;", tiNch, tiT0M), kTH2F, {{{nBinsNch, minNch, maxNch}, {nBinsAmpFT0, 0., maxAmpFT0}}}); + registry.add("NchVsV0A", Form(";%s;%s;", tiNch, tiV0A), kTH2F, {{{nBinsNch, minNch, maxNch}, {nBinsAmpV0A, 0., maxAmpV0A}}}); registry.add("NchVsZN", Form(";%s;%s;", tiNch, tiZNs), kTH2F, {{{nBinsNch, minNch, maxNch}, {nBinsZN, minZN, maxZN}}}); registry.add("NchVsZP", Form(";%s;%s;", tiNch, tiZPs), kTH2F, {{{nBinsNch, minNch, maxNch}, {nBinsZP, minZN, maxZP}}}); registry.add("NchVsZNVsPt", Form(";%s;%s;%s", tiNch, tiZNs, tiPt), kTH3F, {{{nBinsNch, minNch, maxNch}, {nBinsZN, minZN, maxZN}, {axisPt}}}); + registry.add("NchVsOneParCorrVsZN", Form(";%s;%s;%s", tiNch, tiZNs, tiOneParCorr), kTProfile2D, {{{nBinsNch, minNch, maxNch}, {nBinsZN, minZN, maxZN}}}); registry.add("NchVsTwoParCorrVsZN", Form(";%s;%s;%s", tiNch, tiZNs, tiTwoParCorr), kTProfile2D, {{{nBinsNch, minNch, maxNch}, {nBinsZN, minZN, maxZN}}}); registry.add("NchVsThreeParCorrVsZN", Form(";%s;%s;%s", tiNch, tiZNs, tiThreeParCorr), kTProfile2D, {{{nBinsNch, minNch, maxNch}, {nBinsZN, minZN, maxZN}}}); - registry.add("OneParCorrVsT0M", Form(";%s;%s;", tiT0M, tiOneParCorr), kTProfile, {{nBinsAmpFT0, 0., maxAmpFT0}}); - registry.add("TwoParCorrVsT0M", Form(";%s;%s;", tiT0M, tiTwoParCorr), kTProfile, {{nBinsAmpFT0, 0., maxAmpFT0}}); - registry.add("ThreeParCorrVsT0M", Form(";%s;%s;", tiT0M, tiThreeParCorr), kTProfile, {{nBinsAmpFT0, 0., maxAmpFT0}}); - registry.add("OneParCorrVsV0A", Form(";%s;%s;", tiV0A, tiOneParCorr), kTProfile, {{nBinsAmpV0A, 0., maxAmpV0A}}); - registry.add("TwoParCorrVsV0A", Form(";%s;%s;", tiV0A, tiTwoParCorr), kTProfile, {{nBinsAmpV0A, 0., maxAmpV0A}}); - registry.add("ThreeParCorrVsV0A", Form(";%s;%s;", tiV0A, tiThreeParCorr), kTProfile, {{nBinsAmpV0A, 0., maxAmpV0A}}); + + registry.add("NchVsOneParCorrVsT0M", Form(";%s;%s;%s", tiNch, tiT0M, tiOneParCorr), kTProfile2D, {{{nBinsNch, minNch, maxNch}, {nBinsAmpFT0, 0., maxAmpFT0}}}); + registry.add("NchVsTwoParCorrVsT0M", Form(";%s;%s;%s", tiNch, tiT0M, tiTwoParCorr), kTProfile2D, {{{nBinsNch, minNch, maxNch}, {nBinsAmpFT0, 0., maxAmpFT0}}}); + registry.add("NchVsThreeParCorrVsT0M", Form(";%s;%s;%s", tiNch, tiT0M, tiThreeParCorr), kTProfile2D, {{{nBinsNch, minNch, maxNch}, {nBinsAmpFT0, 0., maxAmpFT0}}}); + + registry.add("NchVsOneParCorrVsV0A", Form(";%s;%s;%s", tiNch, tiV0A, tiOneParCorr), kTProfile2D, {{{nBinsNch, minNch, maxNch}, {nBinsAmpV0A, 0., maxAmpV0A}}}); + registry.add("NchVsTwoParCorrVsV0A", Form(";%s;%s;%s", tiNch, tiV0A, tiTwoParCorr), kTProfile2D, {{{nBinsNch, minNch, maxNch}, {nBinsAmpV0A, 0., maxAmpV0A}}}); + registry.add("NchVsThreeParCorrVsV0A", Form(";%s;%s;%s", tiNch, tiV0A, tiThreeParCorr), kTProfile2D, {{{nBinsNch, minNch, maxNch}, {nBinsAmpV0A, 0., maxAmpV0A}}}); for (int i = 0; i < kSizeBootStrapEnsemble; i++) { - hNchVsV0A[i] = registry.add(Form("NchVsV0A_Replica%d", i), Form(";%s;%s", tiNch, tiV0A), kTH2F, {{{nBinsNch, minNch, maxNch}, {nBinsAmpV0A, 0., maxAmpV0A}}}); - hNchVsT0M[i] = registry.add(Form("NchVsT0M_Replica%d", i), Form(";%s;%s", tiNch, tiT0M), kTH2F, {{{nBinsNch, minNch, maxNch}, {nBinsAmpFT0, 0., maxAmpFT0}}}); - hPoisson[i] = registry.add(Form("Poisson_Replica%d", i), ";#it{k};Entries", kTH1F, {{11, -0.5, 10.5}}); - pNchVsOneParCorrVsZN[i] = registry.add(Form("NchVsOneParCorrVsZN_Replica%d", i), Form(";%s;%s;%s", tiNch, tiZNs, tiOneParCorr), kTProfile2D, {{{nBinsNch, minNch, maxNch}, {nBinsZN, minZN, maxZN}}}); - pNchVsTwoParCorrVsZN[i] = registry.add(Form("NchVsTwoParCorrVsZN_Replica%d", i), Form(";%s;%s;%s", tiNch, tiZNs, tiTwoParCorr), kTProfile2D, {{{nBinsNch, minNch, maxNch}, {nBinsZN, minZN, maxZN}}}); - pNchVsThreeParCorrVsZN[i] = registry.add(Form("NchVsThreeParCorrVsZN_Replica%d", i), Form(";%s;%s;%s", tiNch, tiZNs, tiThreeParCorr), kTProfile2D, {{{nBinsNch, minNch, maxNch}, {nBinsZN, minZN, maxZN}}}); - - pOneParCorrVsT0M[i] = registry.add(Form("OneParCorrVsT0M_Replica%d", i), Form(";%s;%s;", tiT0M, tiOneParCorr), kTProfile, {{nBinsAmpFT0, 0., maxAmpFT0}}); - pTwoParCorrVsT0M[i] = registry.add(Form("TwoParCorrVsT0M_Replica%d", i), Form(";%s;%s;", tiT0M, tiTwoParCorr), kTProfile, {{nBinsAmpFT0, 0., maxAmpFT0}}); - pThreeParCorrVsT0M[i] = registry.add(Form("ThreeParCorrVsT0M_Replica%d", i), Form(";%s;%s;", tiT0M, tiThreeParCorr), kTProfile, {{nBinsAmpFT0, 0., maxAmpFT0}}); - - pOneParCorrVsV0A[i] = registry.add(Form("OneParCorrVsV0A_Replica%d", i), Form(";%s;%s;", tiV0A, tiOneParCorr), kTProfile, {{nBinsAmpV0A, 0., maxAmpV0A}}); - pTwoParCorrVsV0A[i] = registry.add(Form("TwoParCorrVsV0A_Replica%d", i), Form(";%s;%s;", tiV0A, tiTwoParCorr), kTProfile, {{nBinsAmpV0A, 0., maxAmpV0A}}); - pThreeParCorrVsV0A[i] = registry.add(Form("ThreeParCorrVsV0A_Replica%d", i), Form(";%s;%s;", tiV0A, tiThreeParCorr), kTProfile, {{nBinsAmpV0A, 0., maxAmpV0A}}); + hNchVsZN[i] = registry.add(Form("NchVsZN_Rep%d", i), Form(";%s;%s", tiNch, tiZNs), kTH2F, {{{nBinsNch, minNch, maxNch}, {nBinsZN, minZN, maxZN}}}); + hNchVsV0A[i] = registry.add(Form("NchVsV0A_Rep%d", i), Form(";%s;%s", tiNch, tiV0A), kTH2F, {{{nBinsNch, minNch, maxNch}, {nBinsAmpV0A, 0., maxAmpV0A}}}); + hNchVsT0M[i] = registry.add(Form("NchVsT0M_Rep%d", i), Form(";%s;%s", tiNch, tiT0M), kTH2F, {{{nBinsNch, minNch, maxNch}, {nBinsAmpFT0, 0., maxAmpFT0}}}); + hPoisson[i] = registry.add(Form("Poisson_Rep%d", i), ";#it{k};Entries", kTH1F, {{11, -0.5, 10.5}}); + + pNchVsOneParCorrVsZN[i] = registry.add(Form("NchVsOneParCorrVsZN_Rep%d", i), Form(";%s;%s;%s", tiNch, tiZNs, tiOneParCorr), kTProfile2D, {{{nBinsNch, minNch, maxNch}, {nBinsZN, minZN, maxZN}}}); + pNchVsTwoParCorrVsZN[i] = registry.add(Form("NchVsTwoParCorrVsZN_Rep%d", i), Form(";%s;%s;%s", tiNch, tiZNs, tiTwoParCorr), kTProfile2D, {{{nBinsNch, minNch, maxNch}, {nBinsZN, minZN, maxZN}}}); + pNchVsThreeParCorrVsZN[i] = registry.add(Form("NchVsThreeParCorrVsZN_Rep%d", i), Form(";%s;%s;%s", tiNch, tiZNs, tiThreeParCorr), kTProfile2D, {{{nBinsNch, minNch, maxNch}, {nBinsZN, minZN, maxZN}}}); + + pNchVsOneParCorrVsT0M[i] = registry.add(Form("NchVsOneParCorrVsT0M_Rep%d", i), Form(";%s;%s;%s", tiNch, tiT0M, tiOneParCorr), kTProfile2D, {{{nBinsNch, minNch, maxNch}, {nBinsAmpFT0, 0., maxAmpFT0}}}); + pNchVsTwoParCorrVsT0M[i] = registry.add(Form("NchVsTwoParCorrVsT0M_Rep%d", i), Form(";%s;%s;%s", tiNch, tiT0M, tiTwoParCorr), kTProfile2D, {{{nBinsNch, minNch, maxNch}, {nBinsAmpFT0, 0., maxAmpFT0}}}); + pNchVsThreeParCorrVsT0M[i] = registry.add(Form("NchVsThreeParCorrVsT0M_Rep%d", i), Form(";%s;%s;%s", tiNch, tiT0M, tiThreeParCorr), kTProfile2D, {{{nBinsNch, minNch, maxNch}, {nBinsAmpFT0, 0., maxAmpFT0}}}); + + pNchVsOneParCorrVsV0A[i] = registry.add(Form("NchVsOneParCorrVsV0A_Rep%d", i), Form(";%s;%s;%s", tiNch, tiV0A, tiOneParCorr), kTProfile2D, {{{nBinsNch, minNch, maxNch}, {nBinsAmpV0A, 0., maxAmpV0A}}}); + pNchVsTwoParCorrVsV0A[i] = registry.add(Form("NchVsTwoParCorrVsV0A_Rep%d", i), Form(";%s;%s;%s", tiNch, tiV0A, tiTwoParCorr), kTProfile2D, {{{nBinsNch, minNch, maxNch}, {nBinsAmpV0A, 0., maxAmpV0A}}}); + pNchVsThreeParCorrVsV0A[i] = registry.add(Form("NchVsThreeParCorrVsV0A_Rep%d", i), Form(";%s;%s;%s", tiNch, tiV0A, tiThreeParCorr), kTProfile2D, {{{nBinsNch, minNch, maxNch}, {nBinsAmpV0A, 0., maxAmpV0A}}}); } } @@ -360,37 +360,20 @@ struct UccZdc { for (int i = 0; i < kSizeBootStrapEnsemble; i++) { - hPoissonMC[i] = registry.add(Form("PoissonMC_Replica%d", i), ";#it{k};Entries", kTH1F, {{11, -0.5, 10.5}}); - hNchGen[i] = registry.add(Form("NchGen_Replica%d", i), Form(";%s;Entries", tiNch), kTH1F, {{nBinsNch, minNch, maxNch}}); - pOneParCorrVsNchGen[i] = registry.add(Form("OneParCorrVsNchGen_Replica%d", i), Form(";%s;%s;", tiNch, tiOneParCorr), kTProfile, {{nBinsNch, minNch, maxNch}}); - pTwoParCorrVsNchGen[i] = registry.add(Form("TwoParCorrVsNchGen_Replica%d", i), Form(";%s;%s;", tiNch, tiTwoParCorr), kTProfile, {{nBinsNch, minNch, maxNch}}); - pThreeParCorrVsNchGen[i] = registry.add(Form("ThreeParCorrVsNchGen_Replica%d", i), Form(";%s;%s;", tiNch, tiThreeParCorr), kTProfile, {{nBinsNch, minNch, maxNch}}); - - // pOneParCorrVsT0MGen[i] = registry.add(Form("OneParCorrVsT0MGen_Replica%d",i),Form(";%s;%s;",tiT0M,tiOneParCorr), kTProfile,{{nBinsAmpFT0,0.,maxAmpFT0}}); - // pTwoParCorrVsT0MGen[i] = registry.add(Form("TwoParCorrVsT0MGen_Replica%d",i),Form(";%s;%s;",tiT0M,tiTwoParCorr), kTProfile,{{nBinsAmpFT0,0.,maxAmpFT0}}); - // pThreeParCorrVsT0MGen[i] = registry.add(Form("ThreeParCorrVsT0MGen_Replica%d",i),Form(";%s;%s;",tiT0M,tiThreeParCorr), kTProfile,{{nBinsAmpFT0,0.,maxAmpFT0}}); - - // pOneParCorrVsV0AGen[i] = registry.add(Form("OneParCorrVsV0AGen_Replica%d",i),Form(";%s;%s;",tiT0M,tiOneParCorr), kTProfile,{{nBinsAmpFT0,0.,maxAmpFT0}}); - // pTwoParCorrVsV0AGen[i] = registry.add(Form("TwoParCorrVsV0AGen_Replica%d",i),Form(";%s;%s;",tiT0M,tiTwoParCorr), kTProfile,{{nBinsAmpFT0,0.,maxAmpFT0}}); - // pThreeParCorrVsV0AGen[i] = registry.add(Form("ThreeParCorrVsV0AGen_Replica%d",i),Form(";%s;%s;",tiT0M,tiThreeParCorr), kTProfile,{{nBinsAmpFT0,0.,maxAmpFT0}}); - - hNch[i] = registry.add(Form("Nch_Replica%d", i), Form(";%s;Entries", tiNch), kTH1F, {{nBinsNch, minNch, maxNch}}); - hPoisson[i] = registry.add(Form("Poisson_Replica%d", i), ";#it{k};Entries", kTH1F, {{11, -0.5, 10.5}}); - - pOneParCorrVsNch[i] = registry.add(Form("OneParCorrVsNch_Replica%d", i), Form(";%s;%s;", tiNch, tiOneParCorr), kTProfile, {{nBinsNch, minNch, maxNch}}); - pTwoParCorrVsNch[i] = registry.add(Form("TwoParCorrVsNch_Replica%d", i), Form(";%s;%s;", tiNch, tiTwoParCorr), kTProfile, {{nBinsNch, minNch, maxNch}}); - pThreeParCorrVsNch[i] = registry.add(Form("ThreeParCorrVsNch_Replica%d", i), Form(";%s;%s;", tiNch, tiTwoParCorr), kTProfile, {{nBinsNch, minNch, maxNch}}); - - // pOneParCorrVsT0M[i] = registry.add(Form("OneParCorrVsT0M_Replica%d",i),Form(";%s;%s;",tiT0M,tiOneParCorr),kTProfile,{{nBinsAmpFT0,0.,maxAmpFT0}}); - // pTwoParCorrVsT0M[i] = registry.add(Form("TwoParCorrVsT0M_Replica%d",i),Form(";%s;%s;",tiT0M,tiTwoParCorr),kTProfile,{{nBinsAmpFT0,0.,maxAmpFT0}}); - // pThreeParCorrVsT0M[i] = registry.add(Form("ThreeParCorrVsT0M_Replica%d",i),Form(";%s;%s;",tiT0M,tiThreeParCorr),kTProfile,{{nBinsAmpFT0,0.,maxAmpFT0}}); - // - // pOneParCorrVsV0A[i] = registry.add(Form("OneParCorrVsV0A_Replica%d",i),Form(";%s;%s;",tiV0A,tiOneParCorr),kTProfile,{{nBinsAmpV0A,0.,maxAmpV0A}}); - // pTwoParCorrVsV0A[i] = registry.add(Form("TwoParCorrVsV0A_Replica%d",i),Form(";%s;%s;",tiV0A,tiTwoParCorr),kTProfile,{{nBinsAmpV0A,0.,maxAmpV0A}}); - // pThreeParCorrVsV0A[i] = registry.add(Form("ThreeParCorrVsV0A_Replica%d",i),Form(";%s;%s;",tiV0A,tiThreeParCorr),kTProfile,{{nBinsAmpV0A,0.,maxAmpV0A}}); + hPoissonMC[i] = registry.add(Form("PoissonMC_Rep%d", i), ";#it{k};Entries", kTH1F, {{11, -0.5, 10.5}}); + hNchGen[i] = registry.add(Form("NchGen_Rep%d", i), Form(";%s;Entries", tiNch), kTH1F, {{nBinsNch, minNch, maxNch}}); + pOneParCorrVsNchGen[i] = registry.add(Form("OneParCorrVsNchGen_Rep%d", i), Form(";%s;%s;", tiNch, tiOneParCorr), kTProfile, {{nBinsNch, minNch, maxNch}}); + pTwoParCorrVsNchGen[i] = registry.add(Form("TwoParCorrVsNchGen_Rep%d", i), Form(";%s;%s;", tiNch, tiTwoParCorr), kTProfile, {{nBinsNch, minNch, maxNch}}); + pThreeParCorrVsNchGen[i] = registry.add(Form("ThreeParCorrVsNchGen_Rep%d", i), Form(";%s;%s;", tiNch, tiThreeParCorr), kTProfile, {{nBinsNch, minNch, maxNch}}); + + hNch[i] = registry.add(Form("Nch_Rep%d", i), Form(";%s;Entries", tiNch), kTH1F, {{nBinsNch, minNch, maxNch}}); + hPoisson[i] = registry.add(Form("Poisson_Rep%d", i), ";#it{k};Entries", kTH1F, {{11, -0.5, 10.5}}); + + pOneParCorrVsNch[i] = registry.add(Form("OneParCorrVsNch_Rep%d", i), Form(";%s;%s;", tiNch, tiOneParCorr), kTProfile, {{nBinsNch, minNch, maxNch}}); + pTwoParCorrVsNch[i] = registry.add(Form("TwoParCorrVsNch_Rep%d", i), Form(";%s;%s;", tiNch, tiTwoParCorr), kTProfile, {{nBinsNch, minNch, maxNch}}); + pThreeParCorrVsNch[i] = registry.add(Form("ThreeParCorrVsNch_Rep%d", i), Form(";%s;%s;", tiNch, tiTwoParCorr), kTProfile, {{nBinsNch, minNch, maxNch}}); } } - if (doprocessQA) { registry.add("zPos", ";;Entries;", kTH1F, {axisZpos}); registry.add("T0Ccent", ";;Entries", kTH1F, {axisCent}); @@ -429,6 +412,7 @@ struct UccZdc { LOG(info) << "\tcorrectNch=" << correctNch.value; LOG(info) << "\tpaTHEff=" << paTHEff.value; LOG(info) << "\tpaTHFD=" << paTHFD.value; + LOG(info) << "\tdetectorZDC=" << detectorZDC.value; LOG(info) << "\tuseMidRapNchSel=" << useMidRapNchSel.value; LOG(info) << "\tdetector4Calibration=" << detector4Calibration.value; LOG(info) << "\tnSigmaNchCut=" << nSigmaNchCut.value; @@ -759,10 +743,19 @@ struct UccZdc { znC /= kCollEnergy; zpA /= kCollEnergy; zpC /= kCollEnergy; - const double sumZNs{znA + znC}; + double sumZNs{-999.}; const double sumZPs{zpA + zpC}; const double sumZEMs{aZEM1 + aZEM2}; + TString sZDC = TString(detectorZDC.value); + if (sZDC == "ZNA") { + sumZNs = znA; + } else if (sZDC == "ZNC") { + sumZNs = znC; + } else { + sumZNs = (znA + znC); + } + // TDC cut if (isTDCcut) { if (std::sqrt(std::pow(tZDCdif, 2.) + std::pow(tZDCsum, 2.)) > tdcCut) { @@ -960,8 +953,8 @@ struct UccZdc { registry.fill(HIST("Nch"), nchMult); registry.fill(HIST("NchUncorrected"), glbTracks); - registry.fill(HIST("NchVsV0Aamp"), nchMult, normV0A); - registry.fill(HIST("NchVsT0Mamp"), nchMult, normT0M); + registry.fill(HIST("NchVsV0A"), nchMult, normV0A); + registry.fill(HIST("NchVsT0M"), nchMult, normT0M); registry.fill(HIST("NchVsZN"), nchMult, sumZNs); registry.fill(HIST("NchVsZP"), nchMult, sumZPs); @@ -971,13 +964,13 @@ struct UccZdc { registry.fill(HIST("NchVsTwoParCorrVsZN"), nchMult, sumZNs, twoParCorr, denTwoParCorr); registry.fill(HIST("NchVsThreeParCorrVsZN"), nchMult, sumZNs, threeParCorr, denThreeParCorr); - registry.fill(HIST("OneParCorrVsT0M"), normT0M, oneParCorr, w1); - registry.fill(HIST("TwoParCorrVsT0M"), normT0M, twoParCorr, denTwoParCorr); - registry.fill(HIST("ThreeParCorrVsT0M"), normT0M, threeParCorr, denThreeParCorr); + registry.fill(HIST("NchVsOneParCorrVsT0M"), nchMult, normT0M, oneParCorr, w1); + registry.fill(HIST("NchVsTwoParCorrVsT0M"), nchMult, normT0M, twoParCorr, denTwoParCorr); + registry.fill(HIST("NchVsThreeParCorrVsT0M"), nchMult, normT0M, threeParCorr, denThreeParCorr); - registry.fill(HIST("OneParCorrVsV0A"), normV0A, oneParCorr, w1); - registry.fill(HIST("TwoParCorrVsV0A"), normV0A, twoParCorr, denTwoParCorr); - registry.fill(HIST("ThreeParCorrVsV0A"), normV0A, threeParCorr, denThreeParCorr); + registry.fill(HIST("NchVsOneParCorrVsV0A"), nchMult, normV0A, oneParCorr, w1); + registry.fill(HIST("NchVsTwoParCorrVsV0A"), nchMult, normV0A, twoParCorr, denTwoParCorr); + registry.fill(HIST("NchVsThreeParCorrVsV0A"), nchMult, normV0A, threeParCorr, denThreeParCorr); const uint64_t timeStamp{foundBC.timestamp()}; eventSampling(tracks, normV0A, normT0M, sumZNs, timeStamp); @@ -1444,14 +1437,6 @@ struct UccZdc { pOneParCorrVsNchGen[replica]->Fill(nchMult, oneParCorr, w1); pTwoParCorrVsNchGen[replica]->Fill(nchMult, twoParCorr, denTwoParCorr); pThreeParCorrVsNchGen[replica]->Fill(nchMult, threeParCorr, denThreeParCorr); - - // pOneParCorrVsV0AGen[replica]->Fill(normV0A, oneParCorr, w1); - // pTwoParCorrVsV0AGen[replica]->Fill(normV0A, twoParCorr, denTwoParCorr); - // pThreeParCorrVsV0AGen[replica]->Fill(normV0A, threeParCorr, denThreeParCorr); - - // pOneParCorrVsT0MGen[replica]->Fill(normT0M, oneParCorr, w1); - // pTwoParCorrVsT0MGen[replica]->Fill(normT0M, twoParCorr, denTwoParCorr); - // pThreeParCorrVsT0MGen[replica]->Fill(normT0M, threeParCorr, denThreeParCorr); } // event per replica } // replica's loop } @@ -1595,14 +1580,6 @@ struct UccZdc { pOneParCorrVsNch[replica]->Fill(nchMult, oneParCorr, w1); pTwoParCorrVsNch[replica]->Fill(nchMult, twoParCorr, denTwoParCorr); pThreeParCorrVsNch[replica]->Fill(nchMult, threeParCorr, denThreeParCorr); - - // pOneParCorrVsV0A[replica]->Fill(normV0A, oneParCorr, w1); - // pTwoParCorrVsV0A[replica]->Fill(normV0A, twoParCorr, denTwoParCorr); - // pThreeParCorrVsV0A[replica]->Fill(normV0A, threeParCorr, denThreeParCorr); - // - // pOneParCorrVsT0M[replica]->Fill(normT0M, oneParCorr, w1); - // pTwoParCorrVsT0M[replica]->Fill(normT0M, twoParCorr, denTwoParCorr); - // pThreeParCorrVsT0M[replica]->Fill(normT0M, threeParCorr, denThreeParCorr); } // event per replica } // replica's loop } @@ -1747,19 +1724,21 @@ struct UccZdc { const double numThreeParCorr{std::pow(p1, 3.) - 3. * p2 * p1 + 2. * p3}; const double threeParCorr{numThreeParCorr / denThreeParCorr}; + hNchVsZN[replica]->Fill(nchMult, sumZNs); hNchVsV0A[replica]->Fill(nchMult, normV0A); hNchVsT0M[replica]->Fill(nchMult, normT0M); + pNchVsOneParCorrVsZN[replica]->Fill(nchMult, sumZNs, oneParCorr, w1); pNchVsTwoParCorrVsZN[replica]->Fill(nchMult, sumZNs, twoParCorr, denTwoParCorr); pNchVsThreeParCorrVsZN[replica]->Fill(nchMult, sumZNs, threeParCorr, denThreeParCorr); - pOneParCorrVsV0A[replica]->Fill(normV0A, oneParCorr, w1); - pTwoParCorrVsV0A[replica]->Fill(normV0A, twoParCorr, denTwoParCorr); - pThreeParCorrVsV0A[replica]->Fill(normV0A, threeParCorr, denThreeParCorr); + pNchVsOneParCorrVsT0M[replica]->Fill(nchMult, normT0M, oneParCorr, w1); + pNchVsTwoParCorrVsT0M[replica]->Fill(nchMult, normT0M, twoParCorr, denTwoParCorr); + pNchVsThreeParCorrVsT0M[replica]->Fill(nchMult, normT0M, threeParCorr, denThreeParCorr); - pOneParCorrVsT0M[replica]->Fill(normT0M, oneParCorr, w1); - pTwoParCorrVsT0M[replica]->Fill(normT0M, twoParCorr, denTwoParCorr); - pThreeParCorrVsT0M[replica]->Fill(normT0M, threeParCorr, denThreeParCorr); + pNchVsOneParCorrVsV0A[replica]->Fill(nchMult, normV0A, oneParCorr, w1); + pNchVsTwoParCorrVsV0A[replica]->Fill(nchMult, normV0A, twoParCorr, denTwoParCorr); + pNchVsThreeParCorrVsV0A[replica]->Fill(nchMult, normV0A, threeParCorr, denThreeParCorr); } // event per replica } // replica's loop } From bd3f878b29ea7ae8ba14fca7bf8fdd5ac34f245f Mon Sep 17 00:00:00 2001 From: chengtt0406 <39661669+chengtt0406@users.noreply.github.com> Date: Fri, 8 Aug 2025 06:59:01 +0200 Subject: [PATCH 289/345] [PWGHF] Add fToiMask info in the tree creator (#12471) --- PWGHF/TableProducer/treeCreatorOmegacSt.cxx | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/PWGHF/TableProducer/treeCreatorOmegacSt.cxx b/PWGHF/TableProducer/treeCreatorOmegacSt.cxx index c291852c448..1bd4466893e 100644 --- a/PWGHF/TableProducer/treeCreatorOmegacSt.cxx +++ b/PWGHF/TableProducer/treeCreatorOmegacSt.cxx @@ -165,6 +165,7 @@ DECLARE_SOA_COLUMN(DecayLengthXYCasc, decayLengthXYCasc, float); DECLARE_SOA_INDEX_COLUMN_FULL(MotherCasc, motherCasc, int, HfStChBarGens, "_Casc"); DECLARE_SOA_INDEX_COLUMN_FULL(MotherPionOrKaon, motherPionOrKaon, int, HfStChBarGens, "_PionOrKaon"); DECLARE_SOA_COLUMN(OriginMcRec, originMcRec, int); +DECLARE_SOA_COLUMN(ToiMask, toiMask, uint32_t); } // namespace hf_st_charmed_baryon DECLARE_SOA_TABLE(HfStChBars, "AOD", "HFSTCHBAR", @@ -220,7 +221,8 @@ DECLARE_SOA_TABLE(HfStChBars, "AOD", "HFSTCHBAR", hf_st_charmed_baryon::DecayLengthXYCasc, hf_st_charmed_baryon::MotherCascId, hf_st_charmed_baryon::MotherPionOrKaonId, - hf_st_charmed_baryon::OriginMcRec); + hf_st_charmed_baryon::OriginMcRec, + hf_st_charmed_baryon::ToiMask); } // namespace o2::aod struct HfTreeCreatorOmegacSt { @@ -256,6 +258,7 @@ struct HfTreeCreatorOmegacSt { Configurable maxNSigmaPion{"maxNSigmaPion", 5., "Max Nsigma for pion to be paired with Omega"}; Configurable maxNSigmaKaon{"maxNSigmaKaon", 5., "Max Nsigma for kaon to be paired with Omega"}; Configurable bzOnly{"bzOnly", true, "Use B_z instead of full field map"}; + Configurable cfgTriggersOfInterest{"cfgTriggersOfInterest", "fTrackedOmega,fHfCharmBarToXiBach", "Triggers of interest, comma separated for Zorro"}; const int itsNClsMin = 4; const float tpcNclsFindableFraction = 0.8; @@ -446,7 +449,7 @@ struct HfTreeCreatorOmegacSt { if (runNumber == 0) { zorroSummary.setObject(zorro.getZorroSummary()); } - zorro.initCCDB(ccdb.service, bc.runNumber(), bc.timestamp(), "fTrackedOmega"); + zorro.initCCDB(ccdb.service, bc.runNumber(), bc.timestamp(), cfgTriggersOfInterest.value); zorro.populateHistRegistry(registry, bc.runNumber()); } runNumber = bc.runNumber(); @@ -463,8 +466,15 @@ struct HfTreeCreatorOmegacSt { } df2.setBz(bz); } + uint32_t toiMask = 0; if (skimmedProcessing) { - zorro.isSelected(collision.bc().globalBC()); + bool sel = zorro.isSelected(bc.globalBC()); + if (sel) { + std::vector toivect = zorro.getTriggerOfInterestResults(); + for (size_t i{0}; i < toivect.size(); i++) { + toiMask |= static_cast(toivect[i]) << i; + } + } } const auto primaryVertex = getPrimaryVertex(collision); @@ -770,7 +780,8 @@ struct HfTreeCreatorOmegacSt { decayLengthCascXY, trackCascMotherId, trackMotherId, - origin); + origin, + toiMask); } } else { continue; From d108a4fade96353957564667c0d7bae6f998d594 Mon Sep 17 00:00:00 2001 From: sawan <124118453+sawankumawat@users.noreply.github.com> Date: Fri, 8 Aug 2025 15:38:46 +0530 Subject: [PATCH 290/345] [PWGLF] Optimised the code (#12485) Co-authored-by: Sawan Sawan --- PWGLF/Tasks/Resonances/kstarqa.cxx | 540 ++++++++++++++++++----------- 1 file changed, 329 insertions(+), 211 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarqa.cxx b/PWGLF/Tasks/Resonances/kstarqa.cxx index 23bce2e9fdb..5071fa7c203 100644 --- a/PWGLF/Tasks/Resonances/kstarqa.cxx +++ b/PWGLF/Tasks/Resonances/kstarqa.cxx @@ -84,6 +84,7 @@ struct Kstarqa { Configurable isAllLayersGoodITS{"isAllLayersGoodITS", true, "Require all ITS layers to be good"}; Configurable isNoTimeFrameBorder{"isNoTimeFrameBorder", true, "kNoTimeFrameBorder"}; Configurable isNoITSROFrameBorder{"isNoITSROFrameBorder", true, "kNoITSROFrameBorder"}; + Configurable isApplyParticleMID{"isApplyParticleMID", true, "Apply particle misidentification"}; Configurable cutzvertex{"cutzvertex", 10.0f, "Accepted z-vertex range (cm)"}; Configurable configOccCut{"configOccCut", 1000., "Occupancy cut"}; @@ -95,16 +96,22 @@ struct Kstarqa { Configurable rotationalCut{"rotationalCut", 10, "Cut value (Rotation angle pi - pi/cut and pi + pi/cut)"}; Configurable cfgCutPT{"cfgCutPT", 0.2f, "PT cut on daughter track"}; - Configurable cfgCutEta{"cfgCutEta", 0.8f, "Eta cut on daughter track"}; - Configurable cfgCutDCAxy{"cfgCutDCAxy", 2.0f, "DCAxy range for tracks"}; + Configurable cfgCutEtaMax{"cfgCutEtaMax", 0.8f, "Eta cut on daughter track"}; + Configurable cfgCutEtaMin{"cfgCutEtaMin", 0.0f, "Eta cut on daughter track"}; + Configurable cfgCutDCAxyMax{"cfgCutDCAxyMax", 2.0f, "DCAxy range for tracks"}; + Configurable cfgCutDCAxyMin{"cfgCutDCAxyMin", 0.0f, "DCAxy range for tracks"}; Configurable cfgCutDCAz{"cfgCutDCAz", 2.0f, "DCAz range for tracks"}; + Configurable ctrackRapidity{"ctrackRapidity", 0.3f, "Cut on track rapidity"}; Configurable cfgNoMixedEvents{"cfgNoMixedEvents", 5, "Number of mixed events per event"}; Configurable cfgITScluster{"cfgITScluster", 0, "Number of ITS cluster"}; Configurable cfgTPCcluster{"cfgTPCcluster", 70, "Number of TPC cluster"}; Configurable cfgRCRFC{"cfgRCRFC", 0.8f, "Crossed Rows to Findable Clusters"}; Configurable cfgITSChi2NCl{"cfgITSChi2NCl", 36.0, "ITS Chi2/NCl"}; - Configurable cfgTPCChi2NCl{"cfgTPCChi2NCl", 4.0, "TPC Chi2/NCl"}; + Configurable cfgTPCChi2NClMax{"cfgTPCChi2NClMax", 4.0, "TPC Chi2/NCl"}; + Configurable cfgTPCChi2NClMin{"cfgTPCChi2NClMin", 0.0, "TPC Chi2/NCl"}; Configurable cfgUseITSTPCRefit{"cfgUseITSTPCRefit", false, "Require ITS Refit"}; + // Configurable isVertexITSTPC{"isVertexITSTPC", false, "Vertex ITS TPC"}; + Configurable isVertexTOFMatched{"isVertexTOFMatched", false, "Vertex TOF Matched"}; Configurable isNoCollInTimeRangeStandard{"isNoCollInTimeRangeStandard", false, "No collision in time range standard"}; Configurable isApplyPtDepDCAxyCut{"isApplyPtDepDCAxyCut", false, "Apply pT dependent DCAxy cut"}; Configurable isGoldenChi2{"isGoldenChi2", false, "Apply golden chi2 cut"}; @@ -113,6 +120,17 @@ struct Kstarqa { Configurable isApplyCutsOnMother{"isApplyCutsOnMother", false, "Enable additional cuts on Kstar mother"}; Configurable cMaxPtMotherCut{"cMaxPtMotherCut", 15.0, "Maximum pt of mother cut"}; Configurable cMaxMinvMotherCut{"cMaxMinvMotherCut", 1.5, "Maximum mass of mother cut"}; + Configurable isPDGCheckMC{"isPDGCheckMC", true, "Check PDG code in MC (false for MC closure test)"}; + + // PID selections + Configurable nsigmaCutTPCPi{"nsigmaCutTPCPi", 3.0, "TPC Nsigma cut for pions"}; + Configurable nsigmaCutTPCKa{"nsigmaCutTPCKa", 3.0, "TPC Nsigma cut for kaons"}; + Configurable nsigmaCutTOFPi{"nsigmaCutTOFPi", 3.0, "TOF Nsigma cut for pions"}; + Configurable nsigmaCutTOFKa{"nsigmaCutTOFKa", 3.0, "TOF Nsigma cut for kaons"}; + Configurable nsigmaCutTPCPr{"nsigmaCutTPCPr", 3.0, "TPC Nsigma cut for protons (for MID)"}; + Configurable nsigmaCutTOFPr{"nsigmaCutTOFPr", 3.0, "TOF Nsigma cut for protons (for MID)"}; + Configurable nsigmaCutCombinedKa{"nsigmaCutCombinedKa", 3.0, "Combined Nsigma cut for kaon"}; + Configurable nsigmaCutCombinedPi{"nsigmaCutCombinedPi", 3.0, "Combined Nsigma cut for pion"}; // Other fixed variables float lowPtCutPID = 0.5; @@ -131,6 +149,12 @@ struct Kstarqa { kNEstimators // useful if you want to iterate or size things }; + enum PIDParticle { + kPion, + kKaon, + kProton + }; + // Histograms are defined with HistogramRegistry HistogramRegistry rEventSelection{"eventSelection", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry hInvMass{"hInvMass", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; @@ -156,14 +180,6 @@ struct Kstarqa { Configurable cFakeTrackCutKa{"cFakeTrackCutKa", 0.5, "Cut based on momentum difference in global and TPC tracks for Kaons"}; Configurable cFakeTrackCutPi{"cFakeTrackCutPi", 0.5, "Cut based on momentum difference in global and TPC tracks for Pions"}; - // PID selections - Configurable nsigmaCutTPCPi{"nsigmaCutTPCPi", 3.0, "TPC Nsigma cut for pions"}; - Configurable nsigmaCutTPCKa{"nsigmaCutTPCKa", 3.0, "TPC Nsigma cut for kaons"}; - Configurable nsigmaCutTOFPi{"nsigmaCutTOFPi", 3.0, "TOF Nsigma cut for pions"}; - Configurable nsigmaCutTOFKa{"nsigmaCutTOFKa", 3.0, "TOF Nsigma cut for kaons"}; - Configurable nsigmaCutCombinedKa{"nsigmaCutCombinedKa", 3.0, "Combined Nsigma cut for kaon"}; - Configurable nsigmaCutCombinedPi{"nsigmaCutCombinedPi", 3.0, "Combined Nsigma cut for pion"}; - // Configurable for histograms Configurable avoidsplitrackMC{"avoidsplitrackMC", true, "avoid split track in MC"}; Configurable cAllGenCollisions{"cAllGenCollisions", false, "To fill all generated collisions for the signal loss calculations"}; @@ -216,6 +232,8 @@ struct Kstarqa { hCutFlow->GetXaxis()->SetBinLabel(10, "kIsTriggerTVX"); hCutFlow->GetXaxis()->SetBinLabel(11, "kIsGoodZvtxFT0vsPV"); hCutFlow->GetXaxis()->SetBinLabel(12, "IsINELgt0"); + hCutFlow->GetXaxis()->SetBinLabel(13, "isVertexITSTPC"); + hCutFlow->GetXaxis()->SetBinLabel(14, "isVertexTOFMatched"); // for primary tracksbinsMultPlot if (cQAplots) { @@ -303,7 +321,7 @@ struct Kstarqa { rEventSelection.add("recMCparticles", "No. of events in the reconstructed MC", kTH1I, {{20, 0, 20}}); rEventSelection.add("hOccupancy", "Occupancy distribution", kTH1F, {{1000, 0, 15000}}); - std::shared_ptr hrecLabel = rEventSelection.get(HIST("hEventCut")); + std::shared_ptr hrecLabel = rEventSelection.get(HIST("recMCparticles")); hrecLabel->GetXaxis()->SetBinLabel(1, "All tracks"); hrecLabel->GetXaxis()->SetBinLabel(2, "Track selection"); hrecLabel->GetXaxis()->SetBinLabel(3, "has_MC"); @@ -311,18 +329,21 @@ struct Kstarqa { hrecLabel->GetXaxis()->SetBinLabel(5, "Unlike Sign"); hrecLabel->GetXaxis()->SetBinLabel(6, "Physical Primary"); hrecLabel->GetXaxis()->SetBinLabel(7, "PID Cut"); - hrecLabel->GetXaxis()->SetBinLabel(8, "Same mother"); - hrecLabel->GetXaxis()->SetBinLabel(9, "Generator"); - hrecLabel->GetXaxis()->SetBinLabel(10, "Rapidity"); - hrecLabel->GetXaxis()->SetBinLabel(11, "MotherPID313"); - hrecLabel->GetXaxis()->SetBinLabel(12, "Split track"); + hrecLabel->GetXaxis()->SetBinLabel(8, "Rapidity Cut"); + hrecLabel->GetXaxis()->SetBinLabel(9, "Same mother"); + hrecLabel->GetXaxis()->SetBinLabel(10, "Generator"); + hrecLabel->GetXaxis()->SetBinLabel(11, "Rapidity"); + hrecLabel->GetXaxis()->SetBinLabel(12, "MotherPID313"); + hrecLabel->GetXaxis()->SetBinLabel(13, "Split track"); std::shared_ptr hDataTracks = rEventSelection.get(HIST("tracksCheckData")); hDataTracks->GetXaxis()->SetBinLabel(1, "All tracks"); hDataTracks->GetXaxis()->SetBinLabel(2, "Track selection"); hDataTracks->GetXaxis()->SetBinLabel(3, "PID Cut"); - hDataTracks->GetXaxis()->SetBinLabel(4, "RmFakeTracks"); - hDataTracks->GetXaxis()->SetBinLabel(5, "Global Index"); + hDataTracks->GetXaxis()->SetBinLabel(4, "Remove Fake Tracks"); + hDataTracks->GetXaxis()->SetBinLabel(5, "Rapidity Cut"); + hDataTracks->GetXaxis()->SetBinLabel(6, "MID"); + hDataTracks->GetXaxis()->SetBinLabel(7, "Global Index"); std::shared_ptr hGenTracks = rEventSelection.get(HIST("eventsCheckGen")); hGenTracks->GetXaxis()->SetBinLabel(1, "All events"); @@ -410,6 +431,18 @@ struct Kstarqa { if (fillHist) rEventSelection.fill(HIST("hEventCut"), 11); + // if (selectionConfig.isVertexITSTPC && !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { + // return false; + // } + if (fillHist) + rEventSelection.fill(HIST("hEventCut"), 12); + + if (selectionConfig.isVertexTOFMatched && !collision.selection_bit(aod::evsel::kIsVertexTOFmatched)) { + return false; + } + if (fillHist) + rEventSelection.fill(HIST("hEventCut"), 13); + return true; } @@ -421,10 +454,10 @@ struct Kstarqa { return false; if (std::abs(candidate.pt()) < selectionConfig.cfgCutPT) return false; - if (std::abs(candidate.eta()) > selectionConfig.cfgCutEta) + if (std::abs(candidate.eta()) > selectionConfig.cfgCutEtaMax || std::abs(candidate.eta()) < selectionConfig.cfgCutEtaMin) return false; if (!selectionConfig.isApplyPtDepDCAxyCut) { - if (std::abs(candidate.dcaXY()) > selectionConfig.cfgCutDCAxy) + if (std::abs(candidate.dcaXY()) > selectionConfig.cfgCutDCAxyMax || std::abs(candidate.dcaXY()) < selectionConfig.cfgCutDCAxyMin) return false; } else { if (std::abs(candidate.dcaXY()) > (0.0105 + 0.035 / std::pow(candidate.pt(), 1.1))) @@ -442,7 +475,7 @@ struct Kstarqa { return false; if (candidate.itsChi2NCl() >= selectionConfig.cfgITSChi2NCl) return false; - if (candidate.tpcChi2NCl() >= selectionConfig.cfgTPCChi2NCl) + if (candidate.tpcChi2NCl() >= selectionConfig.cfgTPCChi2NClMax || candidate.tpcChi2NCl() < selectionConfig.cfgTPCChi2NClMin) return false; if (selectionConfig.cfgPVContributor && !candidate.isPVContributor()) return false; @@ -451,9 +484,9 @@ struct Kstarqa { } else if (!selectionConfig.isGlobalTracks) { if (std::abs(candidate.pt()) < selectionConfig.cfgCutPT) return false; - if (std::abs(candidate.eta()) > selectionConfig.cfgCutEta) + if (std::abs(candidate.eta()) > selectionConfig.cfgCutEtaMax || std::abs(candidate.eta()) < selectionConfig.cfgCutEtaMin) return false; - if (std::abs(candidate.dcaXY()) > selectionConfig.cfgCutDCAxy) + if (std::abs(candidate.dcaXY()) > selectionConfig.cfgCutDCAxyMax || std::abs(candidate.dcaXY()) < selectionConfig.cfgCutDCAxyMin) return false; if (std::abs(candidate.dcaZ()) > selectionConfig.cfgCutDCAz) return false; @@ -465,7 +498,7 @@ struct Kstarqa { return false; if (candidate.itsChi2NCl() >= selectionConfig.cfgITSChi2NCl) return false; - if (candidate.tpcChi2NCl() >= selectionConfig.cfgTPCChi2NCl) + if (candidate.tpcChi2NCl() >= selectionConfig.cfgTPCChi2NClMax || candidate.tpcChi2NCl() < selectionConfig.cfgTPCChi2NClMin) return false; if (selectionConfig.cfgPVContributor && !candidate.isPVContributor()) return false; @@ -493,51 +526,75 @@ struct Kstarqa { template bool selectionPID(const T& candidate, int PID) { - if (PID == 0) { + if (PID == PIDParticle::kPion) { + if (onlyTOF) { + if (candidate.hasTOF() && std::abs(candidate.tofNSigmaPi()) < selectionConfig.nsigmaCutTOFPi && candidate.beta() > cBetaCutTOF) { + return true; + } + } else if (onlyTOFHIT) { + if (candidate.hasTOF() && std::abs(candidate.tofNSigmaPi()) < selectionConfig.nsigmaCutTOFPi && candidate.beta() > cBetaCutTOF) { + return true; + } + if (!candidate.hasTOF() && std::abs(candidate.tpcNSigmaPi()) < selectionConfig.nsigmaCutTPCPi) { + return true; + } + } else if (onlyTPC) { + if (std::abs(candidate.tpcNSigmaPi()) < selectionConfig.nsigmaCutTPCPi) { + return true; + } + } else { + if (candidate.hasTOF() && (candidate.tofNSigmaPi() * candidate.tofNSigmaPi() + candidate.tpcNSigmaPi() * candidate.tpcNSigmaPi()) < (selectionConfig.nsigmaCutCombinedPi * selectionConfig.nsigmaCutCombinedPi) && candidate.beta() > cBetaCutTOF) { + return true; + } + if (!candidate.hasTOF() && std::abs(candidate.tpcNSigmaPi()) < selectionConfig.nsigmaCutTPCPi) { + return true; + } + } + } else if (PID == PIDParticle::kKaon) { if (onlyTOF) { - if (candidate.hasTOF() && std::abs(candidate.tofNSigmaPi()) < nsigmaCutTOFPi && candidate.beta() > cBetaCutTOF) { + if (candidate.hasTOF() && std::abs(candidate.tofNSigmaKa()) < selectionConfig.nsigmaCutTOFKa && candidate.beta() > cBetaCutTOF) { return true; } } else if (onlyTOFHIT) { - if (candidate.hasTOF() && std::abs(candidate.tofNSigmaPi()) < nsigmaCutTOFPi && candidate.beta() > cBetaCutTOF) { + if (candidate.hasTOF() && std::abs(candidate.tofNSigmaKa()) < selectionConfig.nsigmaCutTOFKa && candidate.beta() > cBetaCutTOF) { return true; } - if (!candidate.hasTOF() && std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPCPi) { + if (!candidate.hasTOF() && std::abs(candidate.tpcNSigmaKa()) < selectionConfig.nsigmaCutTPCKa) { return true; } } else if (onlyTPC) { - if (std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPCPi) { + if (std::abs(candidate.tpcNSigmaKa()) < selectionConfig.nsigmaCutTPCKa) { return true; } } else { - if (candidate.hasTOF() && (candidate.tofNSigmaPi() * candidate.tofNSigmaPi() + candidate.tpcNSigmaPi() * candidate.tpcNSigmaPi()) < (nsigmaCutCombinedPi * nsigmaCutCombinedPi) && candidate.beta() > cBetaCutTOF) { + if (candidate.hasTOF() && (candidate.tofNSigmaKa() * candidate.tofNSigmaKa() + candidate.tpcNSigmaKa() * candidate.tpcNSigmaKa()) < (selectionConfig.nsigmaCutCombinedKa * selectionConfig.nsigmaCutCombinedKa) && candidate.beta() > cBetaCutTOF) { return true; } - if (!candidate.hasTOF() && std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPCPi) { + if (!candidate.hasTOF() && std::abs(candidate.tpcNSigmaKa()) < selectionConfig.nsigmaCutTPCKa) { return true; } } - } else if (PID == 1) { + } else if (PID == PIDParticle::kProton) { // for proton if (onlyTOF) { - if (candidate.hasTOF() && std::abs(candidate.tofNSigmaKa()) < nsigmaCutTOFKa && candidate.beta() > cBetaCutTOF) { + if (candidate.hasTOF() && std::abs(candidate.tofNSigmaPr()) < selectionConfig.nsigmaCutTOFPr && candidate.beta() > cBetaCutTOF) { return true; } } else if (onlyTOFHIT) { - if (candidate.hasTOF() && std::abs(candidate.tofNSigmaKa()) < nsigmaCutTOFKa && candidate.beta() > cBetaCutTOF) { + if (candidate.hasTOF() && std::abs(candidate.tofNSigmaPr()) < selectionConfig.nsigmaCutTOFPr && candidate.beta() > cBetaCutTOF) { return true; } - if (!candidate.hasTOF() && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPCKa) { + if (!candidate.hasTOF() && std::abs(candidate.tpcNSigmaPr()) < selectionConfig.nsigmaCutTPCPr) { return true; } } else if (onlyTPC) { - if (std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPCKa) { + if (std::abs(candidate.tpcNSigmaPr()) < selectionConfig.nsigmaCutTPCPr) { return true; } } else { - if (candidate.hasTOF() && (candidate.tofNSigmaKa() * candidate.tofNSigmaKa() + candidate.tpcNSigmaKa() * candidate.tpcNSigmaKa()) < (nsigmaCutCombinedKa * nsigmaCutCombinedKa) && candidate.beta() > cBetaCutTOF) { + if (candidate.hasTOF() && (candidate.tofNSigmaPr() * candidate.tofNSigmaPr() + candidate.tpcNSigmaPr() * candidate.tpcNSigmaPr()) < (selectionConfig.nsigmaCutTOFPr * selectionConfig.nsigmaCutTOFPr) && candidate.beta() > cBetaCutTOF) { return true; } - if (!candidate.hasTOF() && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPCKa) { + if (!candidate.hasTOF() && std::abs(candidate.tpcNSigmaPr()) < selectionConfig.nsigmaCutTPCPr) { return true; } } @@ -548,24 +605,34 @@ struct Kstarqa { template bool selectionPIDNew(const T& candidate, int PID) { - if (PID == 0) { - if (candidate.pt() < selectionConfig.lowPtCutPID && std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPCPi) { + if (PID == PIDParticle::kPion) { + if (candidate.pt() < selectionConfig.lowPtCutPID && std::abs(candidate.tpcNSigmaPi()) < selectionConfig.nsigmaCutTPCPi) { + return true; + } + if (candidate.pt() >= selectionConfig.lowPtCutPID && std::abs(candidate.tpcNSigmaPi()) < selectionConfig.nsigmaCutTPCPi && candidate.hasTOF() && std::abs(candidate.tofNSigmaPi()) < selectionConfig.nsigmaCutTOFPi) { return true; } - if (candidate.pt() >= selectionConfig.lowPtCutPID && std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPCPi && candidate.hasTOF() && std::abs(candidate.tofNSigmaPi()) < nsigmaCutTOFPi) { + if (candidate.pt() >= selectionConfig.lowPtCutPID && std::abs(candidate.tpcNSigmaPi()) < selectionConfig.nsigmaCutTPCPi && !candidate.hasTOF()) { return true; } - if (candidate.pt() >= selectionConfig.lowPtCutPID && std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPCPi && !candidate.hasTOF()) { + } else if (PID == PIDParticle::kKaon) { + if (candidate.pt() < selectionConfig.lowPtCutPID && std::abs(candidate.tpcNSigmaKa()) < selectionConfig.nsigmaCutTPCKa) { return true; } - } else if (PID == 1) { - if (candidate.pt() < selectionConfig.lowPtCutPID && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPCKa) { + if (candidate.pt() >= selectionConfig.lowPtCutPID && std::abs(candidate.tpcNSigmaKa()) < selectionConfig.nsigmaCutTPCKa && candidate.hasTOF() && std::abs(candidate.tofNSigmaKa()) < selectionConfig.nsigmaCutTOFKa) { return true; } - if (candidate.pt() >= selectionConfig.lowPtCutPID && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPCKa && candidate.hasTOF() && std::abs(candidate.tofNSigmaKa()) < nsigmaCutTOFKa) { + if (candidate.pt() >= selectionConfig.lowPtCutPID && std::abs(candidate.tpcNSigmaKa()) < selectionConfig.nsigmaCutTPCKa && !candidate.hasTOF()) { return true; } - if (candidate.pt() >= selectionConfig.lowPtCutPID && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPCKa && !candidate.hasTOF()) { + } else if (PID == PIDParticle::kProton) { // for proton + if (candidate.pt() < selectionConfig.lowPtCutPID && std::abs(candidate.tpcNSigmaPr()) < selectionConfig.nsigmaCutTPCPr) { + return true; + } + if (candidate.pt() >= selectionConfig.lowPtCutPID && std::abs(candidate.tpcNSigmaPr()) < selectionConfig.nsigmaCutTPCPr && candidate.hasTOF() && std::abs(candidate.tofNSigmaPr()) < selectionConfig.nsigmaCutTOFPr) { + return true; + } + if (candidate.pt() >= selectionConfig.lowPtCutPID && std::abs(candidate.tpcNSigmaPr()) < selectionConfig.nsigmaCutTPCPr && !candidate.hasTOF()) { return true; } } @@ -573,86 +640,6 @@ struct Kstarqa { return false; } - // template - // bool cMIDselectionPID(const T& candidate, int PID) - // { - // if (PID == 0) { - // if (onlyTOF) { - // if (candidate.hasTOF() && std::abs(candidate.tofNSigmaPi()) < 3.0) { - // return true; - // } - // } else if (onlyTOFHIT) { - // if (candidate.hasTOF() && std::abs(candidate.tofNSigmaPi()) < 3.0) { - // return true; - // } - // if (!candidate.hasTOF() && - // std::abs(candidate.tpcNSigmaPi()) < 3.0) { - // return true; - // } - // } else if (onlyTPC) { - // if (std::abs(candidate.tpcNSigmaPi()) < 3.0) { - // return true; - // } - // } else { - // if (candidate.hasTOF() && (candidate.tofNSigmaPi() * candidate.tofNSigmaPi() + candidate.tpcNSigmaPi() * candidate.tpcNSigmaPi()) < (3.0 * 3.0)) { - // return true; - // } - // if (!candidate.hasTOF() && std::abs(candidate.tpcNSigmaPi()) < 3.0) { - // return true; - // } - // } - // } else if (PID == 1) { - // if (onlyTOF) { - // if (candidate.hasTOF() && std::abs(candidate.tofNSigmaKa()) < 3.0) { - // return true; - // } - // } else if (onlyTOFHIT) { - // if (candidate.hasTOF() && std::abs(candidate.tofNSigmaKa()) < 3.0) { - // return true; - // } - // if (!candidate.hasTOF() && std::abs(candidate.tpcNSigmaKa()) < 3.0) { - // return true; - // } - // } else if (onlyTPC) { - // if (std::abs(candidate.tpcNSigmaKa()) < 3.0) { - // return true; - // } - // } else { - // if (candidate.hasTOF() && (candidate.tofNSigmaKa() * candidate.tofNSigmaKa() + candidate.tpcNSigmaKa() * candidate.tpcNSigmaKa()) < (3.0 * 3.0)) { - // return true; - // } - // if (!candidate.hasTOF() && std::abs(candidate.tpcNSigmaKa()) < 3.0) { - // return true; - // } - // } - // } else if (PID == 2) { - // if (onlyTOF) { - // if (candidate.hasTOF() && std::abs(candidate.tofNSigmaPr()) < 3.0) { - // return true; - // } - // } else if (onlyTOFHIT) { - // if (candidate.hasTOF() && std::abs(candidate.tofNSigmaPr()) < 3.0) { - // return true; - // } - // if (!candidate.hasTOF() && std::abs(candidate.tpcNSigmaPr()) < 3.0) { - // return true; - // } - // } else if (onlyTPC) { - // if (std::abs(candidate.tpcNSigmaPr()) < 3.0) { - // return true; - // } - // } else { - // if (candidate.hasTOF() && (candidate.tofNSigmaPr() * candidate.tofNSigmaPr() + candidate.tpcNSigmaPr() * candidate.tpcNSigmaPr()) < (3.0 * 3.0)) { - // return true; - // } - // if (!candidate.hasTOF() && std::abs(candidate.tpcNSigmaPr()) < 3.0) { - // return true; - // } - // } - // } - // return false; - // } - std::array pvec0; std::array pvec1; @@ -662,16 +649,16 @@ struct Kstarqa { // Filter eventFilter = (o2::aod::evsel::sel8 == true); Filter posZFilter = (nabs(o2::aod::collision::posZ) < selectionConfig.cutzvertex); - Filter acceptanceFilter = (nabs(aod::track::eta) < selectionConfig.cfgCutEta && nabs(aod::track::pt) > selectionConfig.cfgCutPT); - Filter fDCAcutFilter = (nabs(aod::track::dcaXY) < selectionConfig.cfgCutDCAxy) && (nabs(aod::track::dcaZ) < selectionConfig.cfgCutDCAz); + Filter acceptanceFilter = (nabs(aod::track::eta) < selectionConfig.cfgCutEtaMax && nabs(aod::track::pt) > selectionConfig.cfgCutPT) && (nabs(aod::track::eta) > selectionConfig.cfgCutEtaMin); + Filter fDCAcutFilter = (nabs(aod::track::dcaXY) < selectionConfig.cfgCutDCAxyMax) && (nabs(aod::track::dcaZ) < selectionConfig.cfgCutDCAz) && (nabs(aod::track::dcaXY) > selectionConfig.cfgCutDCAxyMin); using EventCandidates = soa::Filtered>; // aod::CentNGlobals, aod::CentNTPVs, aod::CentMFTs using EventCandidatesMix = soa::Filtered>; // aod::CentNGlobals, aod::CentNTPVs, aod::CentMFTs - using TrackCandidates = soa::Filtered>; + using TrackCandidates = soa::Filtered>; using EventCandidatesMC = soa::Join; // using EventCandidatesMC = soa::Filtered>; - using TrackCandidatesMC = soa::Filtered>; + using TrackCandidatesMC = soa::Filtered>; using EventMCGenerated = soa::Join; // aod::CentNGlobals, aod::CentNTPVs, aod::CentMFTs //*********Varibles declaration*************** @@ -892,6 +879,9 @@ struct Kstarqa { } rEventSelection.fill(HIST("tracksCheckData"), 1.5); + if (track1.globalIndex() == track2.globalIndex()) + continue; + if (cQAplots) { hPID.fill(HIST("Before/hNsigmaTPC_Ka_before"), track1.pt(), track1.tpcNSigmaKa()); hPID.fill(HIST("Before/hNsigmaTOF_Ka_before"), track1.pt(), track1.tofNSigmaKa()); @@ -944,17 +934,27 @@ struct Kstarqa { continue; if (cFakeTrack && isFakeTrack(track2, 0)) // Pion continue; + rEventSelection.fill(HIST("tracksCheckData"), 3.5); - // if (cMID) { - // if (cMIDselectionPID(track1, 0)) // Kaon misidentified as pion - // continue; - // if (cMIDselectionPID(track1, 2)) // Kaon misidentified as proton - // continue; - // if (cMIDselectionPID(track2, 1)) // Pion misidentified as kaon - // continue; - // } + if (std::abs(track1.rapidity(o2::track::PID::getMass(o2::track::PID::Kaon))) > selectionConfig.ctrackRapidity) + continue; - rEventSelection.fill(HIST("tracksCheckData"), 3.5); + if (std::abs(track2.rapidity(o2::track::PID::getMass(o2::track::PID::Pion))) > selectionConfig.ctrackRapidity) + continue; + rEventSelection.fill(HIST("tracksCheckData"), 4.5); + + if (selectionConfig.isApplyParticleMID) { + if (selectionPID(track1, 0)) // Kaon misidentified as pion + continue; + if (selectionPID(track1, 2)) // Kaon misidentified as proton + continue; + if (selectionPID(track2, 1)) // Pion misidentified as kaon + continue; + if (selectionPID(track2, 2)) // Pion misidentified as proton + continue; + } + + rEventSelection.fill(HIST("tracksCheckData"), 5.5); if (cQAplots) { hPID.fill(HIST("After/hDcaxyPi"), track2.dcaXY()); @@ -976,10 +976,7 @@ struct Kstarqa { hPID.fill(HIST("After/hNsigma_TPC_TOF_Pi_after"), track2.tpcNSigmaPi(), track2.tofNSigmaPi()); } - if (track1.globalIndex() == track2.globalIndex()) - continue; - - rEventSelection.fill(HIST("tracksCheckData"), 4.5); + rEventSelection.fill(HIST("tracksCheckData"), 6.5); daughter1 = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa); daughter2 = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massPi); @@ -1011,20 +1008,31 @@ struct Kstarqa { using BinningTypeVertexContributor = ColumnBinningPolicy; using BinningTypeFT0A = ColumnBinningPolicy; using BinningTypeFV0A = ColumnBinningPolicy; - using BinningTypeMC = ColumnBinningPolicy; + + using BinningTypeMCFT0M = ColumnBinningPolicy; + using BinningTypeMCFT0A = ColumnBinningPolicy; + using BinningTypeMCFT0C = ColumnBinningPolicy; + using BinningTypeMCFV0A = ColumnBinningPolicy; BinningTypeVertexContributor binningOnPositions{{axisVertex, axisMultiplicity}, true}; BinningTypeCentralityM binningOnCentrality{{axisVertex, axisMultiplicity}, true}; BinningTypeFT0A binningOnFT0A{{axisVertex, axisMultiplicity}, true}; BinningTypeFV0A binningOnFV0A{{axisVertex, axisMultiplicity}, true}; - BinningTypeMC binningOnMC{{axisVertex, axisMultiplicity}, true}; + + BinningTypeMCFT0M binningOnMCFT0M{{axisVertex, axisMultiplicity}, true}; + BinningTypeMCFT0A binningOnMCFT0A{{axisVertex, axisMultiplicity}, true}; + BinningTypeMCFT0C binningOnMCFT0C{{axisVertex, axisMultiplicity}, true}; + BinningTypeMCFV0A binningOnMCFV0A{{axisVertex, axisMultiplicity}, true}; SameKindPair pair1{binningOnPositions, selectionConfig.cfgNoMixedEvents, -1, &cache}; SameKindPair pair2{binningOnCentrality, selectionConfig.cfgNoMixedEvents, -1, &cache}; SameKindPair pair3{binningOnFT0A, selectionConfig.cfgNoMixedEvents, -1, &cache}; SameKindPair pair4{binningOnFV0A, selectionConfig.cfgNoMixedEvents, -1, &cache}; - SameKindPair pairmc{binningOnMC, selectionConfig.cfgNoMixedEvents, -1, &cache}; + SameKindPair pairmc1{binningOnMCFT0M, selectionConfig.cfgNoMixedEvents, -1, &cache}; + SameKindPair pairmc2{binningOnMCFT0C, selectionConfig.cfgNoMixedEvents, -1, &cache}; + SameKindPair pairmc3{binningOnMCFT0A, selectionConfig.cfgNoMixedEvents, -1, &cache}; + SameKindPair pairmc4{binningOnMCFV0A, selectionConfig.cfgNoMixedEvents, -1, &cache}; void processME(EventCandidatesMix const&, TrackCandidates const&) { @@ -1047,6 +1055,28 @@ struct Kstarqa { if (!selectionPID(t1, 1) || !selectionPID(t2, 0)) continue; + if (std::abs(t1.rapidity(o2::track::PID::getMass(o2::track::PID::Kaon))) > selectionConfig.ctrackRapidity) + continue; + + if (std::abs(t2.rapidity(o2::track::PID::getMass(o2::track::PID::Pion))) > selectionConfig.ctrackRapidity) + continue; + + if (cFakeTrack && isFakeTrack(t1, 1)) // Kaon + continue; + if (cFakeTrack && isFakeTrack(t2, 0)) // Pion + continue; + + if (selectionConfig.isApplyParticleMID) { + if (selectionPID(t1, 0)) // Kaon misidentified as pion + continue; + if (selectionPID(t1, 2)) // Kaon misidentified as proton + continue; + if (selectionPID(t2, 1)) // Pion misidentified as kaon + continue; + if (selectionPID(t2, 2)) // Pion misidentified as proton + continue; + } + daughter1 = ROOT::Math::PxPyPzMVector(t1.px(), t1.py(), t1.pz(), massKa); daughter2 = ROOT::Math::PxPyPzMVector(t2.px(), t2.py(), t2.pz(), massPi); mother = daughter1 + daughter2; @@ -1073,12 +1103,84 @@ struct Kstarqa { } PROCESS_SWITCH(Kstarqa, processME, "Process Mixed event", true); + void processMEMC(EventCandidatesMC const&, TrackCandidatesMC const&, aod::McParticles const&, aod::McCollisions const&) + { + auto runMixing = [&](auto& pair, auto multiplicityGetter) { + for (const auto& [c1, tracks1, c2, tracks2] : pair) { + + if (!selectionEvent(c1, false) || !selectionEvent(c2, false)) { + continue; + } + + if (!c1.has_mcCollision() || !c2.has_mcCollision()) { + continue; // skip if no MC collision associated + } + + multiplicity = multiplicityGetter(c1); + // multiplicity = c1.centFT0M(); // default, can be changed later + + for (const auto& [t1, t2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { + if (!selectionTrack(t1) || !selectionTrack(t2)) + continue; + if (!selectionPID(t1, 1) || !selectionPID(t2, 0)) + continue; + + if (!t1.has_mcParticle() || !t2.has_mcParticle()) { + continue; // skip if no MC particle associated + } + + if (std::abs(t1.rapidity(o2::track::PID::getMass(o2::track::PID::Kaon))) > selectionConfig.ctrackRapidity) + continue; + + if (std::abs(t2.rapidity(o2::track::PID::getMass(o2::track::PID::Pion))) > selectionConfig.ctrackRapidity) + continue; + + const auto mctrack1 = t1.mcParticle(); + const auto mctrack2 = t2.mcParticle(); + + if (!mctrack1.isPhysicalPrimary()) { + continue; + } + + if (!mctrack2.isPhysicalPrimary()) { + continue; + } + + daughter1 = ROOT::Math::PxPyPzMVector(t1.px(), t1.py(), t1.pz(), massKa); + daughter2 = ROOT::Math::PxPyPzMVector(t2.px(), t2.py(), t2.pz(), massPi); + mother = daughter1 + daughter2; + + isMix = true; + + if (std::abs(mother.Rapidity()) < selectionConfig.rapidityMotherData) { + fillInvMass(daughter1, daughter2, mother, multiplicity, isMix, t1, t2); + } + } + } + }; + // Call mixing based on selected estimator + if (cSelectMultEstimator == kFT0M) { + runMixing(pairmc1, [](const auto& c) { return c.centFT0M(); }); + } else if (cSelectMultEstimator == kFT0A) { + runMixing(pairmc2, [](const auto& c) { return c.centFT0A(); }); + } else if (cSelectMultEstimator == kFT0C) { + runMixing(pairmc3, [](const auto& c) { return c.centFT0C(); }); + } else if (cSelectMultEstimator == kFV0A) { + runMixing(pairmc4, [](const auto& c) { return c.centFV0A(); }); + } + } + PROCESS_SWITCH(Kstarqa, processMEMC, "Process mixed-event in MC", true); + void processSEMC(EventCandidatesMC::iterator const& collision, TrackCandidatesMC const& tracks, aod::McParticles const&, aod::McCollisions const& /*mcCollisions*/) { + auto oldindex = -999; + if (!collision.has_mcCollision()) { + return; + } int occupancy = collision.trackOccupancyInTimeRange(); rEventSelection.fill(HIST("hOccupancy"), occupancy); - if (!selectionEvent(collision, true)) { + if (!selectionEvent(collision, false)) { return; } @@ -1114,6 +1216,21 @@ struct Kstarqa { if (!selectionTrack(track2)) { continue; } + + const auto mctrack1 = track1.mcParticle(); + const auto mctrack2 = track2.mcParticle(); + + if (!track1.has_mcParticle() || !track2.has_mcParticle()) { + continue; // skip if no MC particle associated + } + + if (!mctrack1.isPhysicalPrimary()) { + continue; + } + + if (!mctrack2.isPhysicalPrimary()) { + continue; + } rEventSelection.fill(HIST("tracksCheckData"), 1.5); if (cQAplots) { @@ -1156,29 +1273,26 @@ struct Kstarqa { continue; if (!applypTdepPID && !selectionPID(track2, 0)) // Track 2 is checked with Pion continue; + rEventSelection.fill(HIST("tracksCheckData"), 2.5); if (applypTdepPID && !selectionPIDNew(track1, 1)) // Track 1 is checked with Kaon continue; if (applypTdepPID && !selectionPIDNew(track2, 0)) // Track 2 is checked with Pion continue; + rEventSelection.fill(HIST("tracksCheckData"), 3.5); - rEventSelection.fill(HIST("tracksCheckData"), 2.5); - - if (cFakeTrack && isFakeTrack(track1, 1)) // Kaon - continue; - if (cFakeTrack && isFakeTrack(track2, 0)) // Pion + if (std::abs(track1.rapidity(o2::track::PID::getMass(o2::track::PID::Kaon))) > selectionConfig.ctrackRapidity) continue; - // if (cMID) { - // if (cMIDselectionPID(track1, 0)) // Kaon misidentified as pion - // continue; - // if (cMIDselectionPID(track1, 2)) // Kaon misidentified as proton - // continue; - // if (cMIDselectionPID(track2, 1)) // Pion misidentified as kaon - // continue; - // } + if (std::abs(track2.rapidity(o2::track::PID::getMass(o2::track::PID::Pion))) > selectionConfig.ctrackRapidity) + continue; + rEventSelection.fill(HIST("tracksCheckData"), 4.5); - rEventSelection.fill(HIST("tracksCheckData"), 3.5); + // if (cFakeTrack && isFakeTrack(track1, 1)) // Kaon + // continue; + // if (cFakeTrack && isFakeTrack(track2, 0)) // Pion + // continue; + rEventSelection.fill(HIST("tracksCheckData"), 5.5); if (cQAplots) { hPID.fill(HIST("After/hDcaxyPi"), track2.dcaXY()); @@ -1203,58 +1317,54 @@ struct Kstarqa { if (track1.globalIndex() == track2.globalIndex()) continue; - rEventSelection.fill(HIST("tracksCheckData"), 4.5); - - daughter1 = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa); - daughter2 = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massPi); - mother = daughter1 + daughter2; // Kstar meson + rEventSelection.fill(HIST("tracksCheckData"), 6.5); - if (selectionConfig.isApplyCutsOnMother) { - if (mother.Pt() >= selectionConfig.cMaxPtMotherCut) // excluding candidates in overflow - continue; - if (mother.M() >= selectionConfig.cMaxMinvMotherCut) // excluding candidates in overflow - continue; - } + for (const auto& mothertrack1 : mctrack1.mothers_as()) { + for (const auto& mothertrack2 : mctrack2.mothers_as()) { - hOthers.fill(HIST("hKstar_Rap"), mother.Rapidity()); - hOthers.fill(HIST("hKstar_Eta"), mother.Eta()); + if (mothertrack1.globalIndex() != mothertrack2.globalIndex()) { + continue; + } - isMix = false; - fillInvMass(daughter1, daughter2, mother, multiplicity, isMix, track1, track2); - } - } - PROCESS_SWITCH(Kstarqa, processSEMC, "Process same event in MC", true); + if (!mothertrack1.producedByGenerator()) { + continue; + } - void processMEMC(EventCandidatesMC const&, TrackCandidatesMC const&, aod::McParticles const&, aod::McCollisions const&) - { - for (const auto& [c1, tracks1, c2, tracks2] : pairmc) { + if (selectionConfig.isApplyCutsOnMother) { + if (mothertrack1.pt() >= selectionConfig.cMaxPtMotherCut) // excluding candidates in overflow + continue; + if ((std::sqrt(mothertrack1.e() * mothertrack1.e() - mothertrack1.p() * mothertrack1.p())) >= selectionConfig.cMaxMinvMotherCut) // excluding candidates in overflow + continue; + } - if (!selectionEvent(c1, false) || !selectionEvent(c2, false)) { - continue; - } + if (avoidsplitrackMC && oldindex == mothertrack1.globalIndex()) { + continue; + } + rEventSelection.fill(HIST("recMCparticles"), 11.5); - // multiplicity = multiplicityGetter(c1); - multiplicity = c1.centFT0M(); // default, can be changed later + oldindex = mothertrack1.globalIndex(); - for (const auto& [t1, t2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { - if (!selectionTrack(t1) || !selectionTrack(t2)) - continue; - if (!selectionPID(t1, 1) || !selectionPID(t2, 0)) - continue; + daughter1 = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa); + daughter2 = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massPi); + mother = daughter1 + daughter2; // Kstar meson - daughter1 = ROOT::Math::PxPyPzMVector(t1.px(), t1.py(), t1.pz(), massKa); - daughter2 = ROOT::Math::PxPyPzMVector(t2.px(), t2.py(), t2.pz(), massPi); - mother = daughter1 + daughter2; + if (selectionConfig.isApplyCutsOnMother) { + if (mother.Pt() >= selectionConfig.cMaxPtMotherCut) // excluding candidates in overflow + continue; + if (mother.M() >= selectionConfig.cMaxMinvMotherCut) // excluding candidates in overflow + continue; + } - isMix = true; + hOthers.fill(HIST("hKstar_Rap"), mother.Rapidity()); + hOthers.fill(HIST("hKstar_Eta"), mother.Eta()); - if (std::abs(mother.Rapidity()) < selectionConfig.rapidityMotherData) { - fillInvMass(daughter1, daughter2, mother, multiplicity, isMix, t1, t2); + isMix = false; + fillInvMass(daughter1, daughter2, mother, multiplicity, isMix, track1, track2); } } } } - PROCESS_SWITCH(Kstarqa, processMEMC, "Process mixed-event in MC", true); + PROCESS_SWITCH(Kstarqa, processSEMC, "Process same event in MC", true); Service pdgDB; @@ -1565,47 +1675,55 @@ struct Kstarqa { // if (!(track1PDG == PDG_t::kKPlus && track2PDG == PDG_t::kPiPlus)) { // continue; // } - if ((track1PDG != PDG_t::kPiPlus) && (track1PDG != PDG_t::kKPlus)) { + if (selectionConfig.isPDGCheckMC && (track1PDG != PDG_t::kPiPlus) && (track1PDG != PDG_t::kKPlus)) { continue; } - if ((track2PDG != PDG_t::kPiPlus) && (track2PDG != PDG_t::kKPlus)) { + if (selectionConfig.isPDGCheckMC && (track2PDG != PDG_t::kPiPlus) && (track2PDG != PDG_t::kKPlus)) { continue; } rEventSelection.fill(HIST("recMCparticles"), 6.5); + if (std::abs(track1.rapidity(o2::track::PID::getMass(o2::track::PID::Kaon))) > selectionConfig.ctrackRapidity) + continue; + + if (std::abs(track2.rapidity(o2::track::PID::getMass(o2::track::PID::Pion))) > selectionConfig.ctrackRapidity) + continue; + + rEventSelection.fill(HIST("recMCparticles"), 7.5); + for (const auto& mothertrack1 : mctrack1.mothers_as()) { for (const auto& mothertrack2 : mctrack2.mothers_as()) { - if (mothertrack1.pdgCode() != mothertrack2.pdgCode()) { + if (selectionConfig.isPDGCheckMC && (mothertrack1.pdgCode() != mothertrack2.pdgCode())) { continue; } if (mothertrack1.globalIndex() != mothertrack2.globalIndex()) { continue; } - rEventSelection.fill(HIST("recMCparticles"), 7.5); + rEventSelection.fill(HIST("recMCparticles"), 8.5); if (!mothertrack1.producedByGenerator()) { continue; } - rEventSelection.fill(HIST("recMCparticles"), 8.5); + rEventSelection.fill(HIST("recMCparticles"), 9.5); if (std::abs(mothertrack1.y()) >= selectionConfig.rapidityMotherData) { continue; } - rEventSelection.fill(HIST("recMCparticles"), 9.5); + rEventSelection.fill(HIST("recMCparticles"), 10.5); - if (std::abs(mothertrack1.pdgCode()) != o2::constants::physics::kK0Star892) { + if (selectionConfig.isPDGCheckMC && (std::abs(mothertrack1.pdgCode()) != o2::constants::physics::kK0Star892)) { continue; } - rEventSelection.fill(HIST("recMCparticles"), 10.5); + rEventSelection.fill(HIST("recMCparticles"), 11.5); - if (track1PDG == PDG_t::kPiPlus) { + if (selectionConfig.isPDGCheckMC && (track1PDG == PDG_t::kPiPlus)) { if (!applypTdepPID && !(selectionPID(track1, 0) && selectionPID(track2, 1))) { // pion and kaon continue; } else if (applypTdepPID && !(selectionPIDNew(track1, 0) && selectionPIDNew(track2, 1))) { // pion and kaon continue; } - } else { + } else if (selectionConfig.isPDGCheckMC) { if (!applypTdepPID && !(selectionPID(track1, 1) && selectionPID(track2, 0))) { // kaon and pion continue; } else if (applypTdepPID && !(selectionPIDNew(track1, 1) && selectionPIDNew(track2, 0))) { // kaon and pion @@ -1624,7 +1742,7 @@ struct Kstarqa { hInvMass.fill(HIST("h1KSRecsplit"), mothertrack1.pt()); continue; } - rEventSelection.fill(HIST("recMCparticles"), 11.5); + rEventSelection.fill(HIST("recMCparticles"), 12.5); oldindex = mothertrack1.globalIndex(); if (track1.sign() * track2.sign() < 0) { From 363beec3f8c8d14d5e8aa764c8e3b14202a9dc6e Mon Sep 17 00:00:00 2001 From: omassen <55696099+omassen@users.noreply.github.com> Date: Fri, 8 Aug 2025 12:10:04 +0200 Subject: [PATCH 291/345] [PWGCF] Adding ZDC amplitude histograms (#12478) --- .../Tasks/neutronProtonCorrZdc.cxx | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/PWGCF/TwoParticleCorrelations/Tasks/neutronProtonCorrZdc.cxx b/PWGCF/TwoParticleCorrelations/Tasks/neutronProtonCorrZdc.cxx index 1870c66da80..772d7c9d288 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/neutronProtonCorrZdc.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/neutronProtonCorrZdc.cxx @@ -56,7 +56,10 @@ struct NeutronProtonCorrZdc { Configurable cfgZNmin{"cfgZNmin", -10, "Minimum value for ZN signal"}; Configurable cfgZNmax{"cfgZNmax", 350, "Maximum value for ZN signal"}; Configurable cfgZPmin{"cfgZPmin", -10, "Minimum value for ZP signal"}; - Configurable cfgZPmax{"cfgZPmax", 200, "Maximum value for ZP signal"}; + Configurable cfgZPmax{"cfgZPmax", 150, "Maximum value for ZP signal"}; + Configurable cfgAmplMin{"cfgAmplMin", -50, "Minimum value for sector amplitude"}; + Configurable cfgAmplMax{"cfgAmplMax", 300, "Maximum value for sector amplitude"}; + Configurable cfgNBinsAmpl{"cfgNBinsAmpl", 100, "Number of bins for sector amplitude histograms"}; Configurable cfgDiffZmin{"cfgDiffZmin", -30, "Minimum value for the diffZ signal"}; Configurable cfgDiffZmax{"cfgDiffZmax", 50, "Maximum value for the diffZ signal"}; Configurable cfgNBinsAlpha{"cfgNBinsAlpha", 100, "Number of bins for ZDC asymmetry"}; @@ -87,6 +90,9 @@ struct NeutronProtonCorrZdc { const AxisSpec axisZPCSignal{cfgNBinsZP, cfgZPmin, cfgZPmax, "ZPC (a.u.)"}; const AxisSpec axisZNSignal{2 * cfgNBinsZN, cfgZNmin, 1.5 * cfgZNmax, "ZN (a.u.)"}; const AxisSpec axisZPSignal{2 * cfgNBinsZP, cfgZPmin, 1.5 * cfgZPmax, "ZP (a.u.)"}; + const AxisSpec axisZNAmplitude{cfgNBinsAmpl, cfgAmplMin, cfgAmplMax, "Ampl (a.u.)"}; + const AxisSpec axisZPAmplitude{cfgNBinsAmpl, cfgAmplMin * 0.3, cfgAmplMax * 0.3, "Ampl (a.u.)"}; + const AxisSpec axisTotalAmplitude{cfgNBinsAmpl, 4.0 * cfgAmplMin, 4.0 * cfgAmplMax, "Ampl (a.u.)"}; const AxisSpec axisAlphaZ{cfgNBinsAlpha, cfgAlphaZmin, cfgAlphaZmax, "#alpha_{spec}"}; const AxisSpec axisZDiffSignal{cfgNBinsZN, cfgDiffZmin, cfgDiffZmax, "#Delta E"}; const AxisSpec axisMultiplicityF0A{cfgNBinsMultiplicity, 0, 200000, "F0A"}; @@ -99,6 +105,10 @@ struct NeutronProtonCorrZdc { HistogramConfigSpec defaultTimingHistogram({HistType::kTH2F, {cfgAxisCent, axisZDCTiming}}); HistogramConfigSpec defaultZNSectorHist({HistType::kTH2F, {cfgAxisCent, axisZNSectorSignal}}); HistogramConfigSpec defaultZPSectorHist({HistType::kTH2F, {cfgAxisCent, axisZPSectorSignal}}); + HistogramConfigSpec defaultZNAmplSectorHist({HistType::kTH2F, {cfgAxisCent, axisZNAmplitude}}); + HistogramConfigSpec defaultZPAmplSectorHist({HistType::kTH2F, {cfgAxisCent, axisZPAmplitude}}); + HistogramConfigSpec defaultEnergyZNAmplSectorHist({HistType::kTH2F, {axisZNSignal, axisZNAmplitude}}); + HistogramConfigSpec defaultEnergyZPAmplSectorHist({HistType::kTH2F, {axisZPSignal, axisZPAmplitude}}); HistogramConfigSpec defaultZDCDiffHist({HistType::kTH2F, {cfgAxisCent, axisZDiffSignal}}); // create histograms @@ -132,6 +142,13 @@ struct NeutronProtonCorrZdc { histos.add("ASide/CentvsdiffZNSignal", "CentvsdiffZNSignal", defaultZDCDiffHist); histos.add("ASide/CentvsdiffZPSignal", "CentvsdiffZPSignal", defaultZDCDiffHist); + histos.add("ASide/CentvsZNAmplitude", "CentvsZNAmplitude", defaultZNAmplSectorHist); + histos.add("ASide/CentvsZPAmplitude", "CentvsZPAmplitude", defaultZPAmplSectorHist); + histos.add("ASide/ZNSignalvsZNAmplitudeSum", "ZNSignalvsZNAmplitudeSum", defaultEnergyZNAmplSectorHist); + histos.add("ASide/ZNSignalvsZNAmplitudeCommon", "ZNSignalvsZNAmplitudeCommon", defaultEnergyZNAmplSectorHist); + histos.add("ASide/ZPSignalvsZPAmplitudeSum", "ZPSignalvsZPAmplitudeSum", defaultEnergyZPAmplSectorHist); + histos.add("ASide/ZPSignalvsZPAmplitudeCommon", "ZPSignalvsZPAmplitudeCommon", defaultEnergyZPAmplSectorHist); + // Cloning the folder histos.addClone("ASide/", "CSide/"); @@ -143,6 +160,8 @@ struct NeutronProtonCorrZdc { histos.add("CentvsAlphaZP", "CentvsAlphaZP", kTH2F, {cfgAxisCent, axisAlphaZ}); histos.add("CentvsAlphaZNcommon", "CentvsAlphaZNcommon", kTH2F, {cfgAxisCent, axisAlphaZ}); histos.add("CentvsAlphaZPcommon", "CentvsAlphaZPcommon", kTH2F, {cfgAxisCent, axisAlphaZ}); + histos.add("CentvsAlphaZNAmplitude", "CentvsAlphaZNAmplitude", kTH2F, {cfgAxisCent, axisAlphaZ}); + histos.add("CentvsAlphaZPAmplitude", "CentvsAlphaZPAmplitude", kTH2F, {cfgAxisCent, axisAlphaZ}); histos.add("CentvsDiffZNSignal", "CentvsDiffZNSignal", defaultZDCDiffHist); histos.add("CentvsDiffZPSignal", "CentvsDiffZPSignal", defaultZDCDiffHist); histos.add("CentvsZNAvsZNC", "CentvsZNAvsZNC", kTH3F, {cfgAxisCent, axisZNASignal, axisZNCSignal}); @@ -238,6 +257,8 @@ struct NeutronProtonCorrZdc { std::array, 2> zpEnergyResponse = {zdc.energySectorZPA(), zdc.energySectorZPC()}; std::array znEnergyResponseCommon = {zdc.energyCommonZNA(), zdc.energyCommonZNC()}; std::array zpEnergyResponseCommon = {zdc.energyCommonZPA(), zdc.energyCommonZPC()}; + std::array znAmplitudeResponse = {zdc.amplitudeZNA(), zdc.amplitudeZNC()}; + std::array zpAmplitudeResponse = {zdc.amplitudeZPA(), zdc.amplitudeZPC()}; float sumZN = znEnergyResponse[side][0] + znEnergyResponse[side][1] + znEnergyResponse[side][2] + znEnergyResponse[side][3]; float sumZP = zpEnergyResponse[side][0] + zpEnergyResponse[side][1] + zpEnergyResponse[side][2] + zpEnergyResponse[side][3]; @@ -248,6 +269,13 @@ struct NeutronProtonCorrZdc { histos.fill(HIST(SubDir[side]) + HIST("CentvsZPSignalSum"), centr, sumZP); histos.fill(HIST(SubDir[side]) + HIST("CentvsZPSignalCommon"), centr, zpEnergyResponseCommon[side]); histos.fill(HIST(SubDir[side]) + HIST("CentvsdiffZPSignal"), centr, sumZP - zpEnergyResponseCommon[side]); + histos.fill(HIST(SubDir[side]) + HIST("CentvsZNAmplitude"), centr, znAmplitudeResponse[side]); + histos.fill(HIST(SubDir[side]) + HIST("CentvsZPAmplitude"), centr, zpAmplitudeResponse[side]); + + histos.fill(HIST(SubDir[side]) + HIST("ZNSignalvsZNAmplitudeSum"), sumZN, znAmplitudeResponse[side]); + histos.fill(HIST(SubDir[side]) + HIST("ZNSignalvsZNAmplitudeCommon"), znEnergyResponseCommon[side], znAmplitudeResponse[side]); + histos.fill(HIST(SubDir[side]) + HIST("ZPSignalvsZPAmplitudeSum"), sumZP, zpAmplitudeResponse[side]); + histos.fill(HIST(SubDir[side]) + HIST("ZPSignalvsZPAmplitudeCommon"), zpEnergyResponseCommon[side], zpAmplitudeResponse[side]); } template @@ -332,6 +360,9 @@ struct NeutronProtonCorrZdc { float alphaZN = (sumZNA - sumZNC) / (sumZNA + sumZNC); float alphaZP = (sumZPA - sumZPC) / (sumZPA + sumZPC); + float alphaZNAmplitude = (zdcread.amplitudeZNA() - zdcread.amplitudeZNC()) / (zdcread.amplitudeZNA() + zdcread.amplitudeZNC()); + float alphaZPAmplitude = (zdcread.amplitudeZPA() - zdcread.amplitudeZPC()) / (zdcread.amplitudeZPA() + zdcread.amplitudeZPC()); + histos.fill(HIST("CentvsDiffZNSignal"), cent, (sumZNA + sumZNC) - (zdcread.energyCommonZNA() + zdcread.energyCommonZNC())); histos.fill(HIST("CentvsDiffZPSignal"), cent, (sumZPA + sumZPC) - (zdcread.energyCommonZPA() + zdcread.energyCommonZPC())); histos.fill(HIST("CentvsZNSignalSum"), cent, sumZNA + sumZNC); @@ -342,6 +373,8 @@ struct NeutronProtonCorrZdc { histos.fill(HIST("CentvsAlphaZP"), cent, alphaZP); histos.fill(HIST("CentvsAlphaZNcommon"), cent, (zdcread.energyCommonZNA() - zdcread.energyCommonZNC()) / (zdcread.energyCommonZNA() + zdcread.energyCommonZNC())); histos.fill(HIST("CentvsAlphaZPcommon"), cent, (zdcread.energyCommonZPA() - zdcread.energyCommonZPC()) / (zdcread.energyCommonZPA() + zdcread.energyCommonZPC())); + histos.fill(HIST("CentvsAlphaZNAmplitude"), cent, alphaZNAmplitude); + histos.fill(HIST("CentvsAlphaZPAmplitude"), cent, alphaZPAmplitude); histos.fill(HIST("CentvsZNAvsZNC"), cent, sumZNA, sumZNC); histos.fill(HIST("CentvsZNAvsZPA"), cent, sumZNA, sumZPA); From 34624f566b84dc9ccc5e576f7e4e92181d9e7b2f Mon Sep 17 00:00:00 2001 From: Anantha Padmanabhan M Nair <82643666+ananthapadmanabhan18@users.noreply.github.com> Date: Fri, 8 Aug 2025 16:30:25 +0530 Subject: [PATCH 292/345] [PWGUD] Modified counter histogram (#12455) --- PWGUD/Tasks/exclusiveRhoTo4Pi.cxx | 33 +++++++++++-------------------- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/PWGUD/Tasks/exclusiveRhoTo4Pi.cxx b/PWGUD/Tasks/exclusiveRhoTo4Pi.cxx index b6ce41e54f7..0f4cbd0be70 100644 --- a/PWGUD/Tasks/exclusiveRhoTo4Pi.cxx +++ b/PWGUD/Tasks/exclusiveRhoTo4Pi.cxx @@ -395,10 +395,6 @@ struct ExclusiveRhoTo4Pi { // Run Numbers static int runNos[113]; static int numRunNums; - // static std::string eventLabels[12]; - // static std::string trackLabels[14]; - // static int numTrackCuts; - // static int numEventCuts; // Derived Data Produces sigFromData; Produces bkgFromData; @@ -438,7 +434,7 @@ struct ExclusiveRhoTo4Pi { Configurable rhoMassMin{"rhoMassMin", 1, "Min Mass of rho"}; Configurable rhoMassMax{"rhoMassMax", 2.5, "Max Mass of rho"}; // Axis Configurations - ConfigurableAxis pTAxis{"pTAxis", {1000, 0, 2}, "Axis for pT histograms"}; + ConfigurableAxis pTAxis{"pTAxis", {1000, 0, 1}, "Axis for pT histograms"}; ConfigurableAxis etaAxis{"etaAxis", {1000, -1.1, 1.1}, "Axis for Eta histograms"}; ConfigurableAxis rapidityAxis{"rapidityAxis", {1000, -2.5, 2.5}, "Axis for Rapidity histograms"}; ConfigurableAxis invMassAxis{"invMassAxis", {1000, 1, 2.5}, "Axis for Phi histograms"}; @@ -451,9 +447,11 @@ struct ExclusiveRhoTo4Pi { histosCounter.add("EventsCounts_vs_runNo", "Number of Selected 4-Pion Events per Run; Run Number; Number of Events", kTH2F, {{113, 0, 113}, {12, 0, 12}}); histosCounter.add("TracksCounts_vs_runNo", "Number of Selected Tracks per Run; Run Number; Number of Tracks", kTH2F, {{113, 0, 113}, {14, 0, 14}}); histosCounter.add("fourPionCounts_0c", "Four Pion Counts; Run Number; Events", kTH1F, {{113, 0, 113}}); + histosCounter.add("fourPionCounts_0c_within_mass", "Four Pion Counts within mass range; Run Number; Events", kTH1F, {{113, 0, 113}}); histosCounter.add("fourPionCounts_0c_within_rap", "Four Pion Counts; Run Number; Events", kTH1F, {{113, 0, 113}}); histosCounter.add("fourPionCounts_0c_selected", "Four Pion Counts; Run Number; Events", kTH1F, {{113, 0, 113}}); histosCounter.add("fourPionCounts_n0c", "Four Pion Counts; Run Number; Events", kTH1F, {{113, 0, 113}}); + histosCounter.add("fourPionCounts_n0c_within_mass", "Four Pion Counts within mass range; Run Number; Events", kTH1F, {{113, 0, 113}}); histosCounter.add("fourPionCounts_n0c_within_rap", "Four Pion Counts; Run Number; Events", kTH1F, {{113, 0, 113}}); histosCounter.add("fourPionCounts_n0c_selected", "Four Pion Counts; Run Number; Events", kTH1F, {{113, 0, 113}}); // QA plots: event selection @@ -800,6 +798,10 @@ struct ExclusiveRhoTo4Pi { histosCounter.fill(HIST("fourPionCounts_0c"), runIndex); + if (rhoMassMin < p1234.M() && p1234.M() < rhoMassMax) { + histosCounter.fill(HIST("fourPionCounts_0c_within_mass"), runIndex); + } + if (std::fabs(p1234.Rapidity()) < rhoRapCut) { histosData.fill(HIST("fourpion_pT_0_charge_within_rap"), p1234.Pt()); histosData.fill(HIST("fourpion_eta_0_charge_within_rap"), p1234.Eta()); @@ -912,7 +914,9 @@ struct ExclusiveRhoTo4Pi { p1234.M()); histosCounter.fill(HIST("fourPionCounts_n0c"), runIndex); - + if (rhoMassMin < p1234.M() && p1234.M() < rhoMassMax) { + histosCounter.fill(HIST("fourPionCounts_n0c_within_mass"), runIndex); + } if (std::fabs(p1234.Rapidity()) < rhoRapCut) { histosData.fill(HIST("fourpion_pT_non_0_charge_within_rap"), p1234.Pt()); histosData.fill(HIST("fourpion_eta_non_0_charge_within_rap"), p1234.Eta()); @@ -1231,6 +1235,7 @@ struct ExclusiveRhoTo4Pi { for (int i = 0; i < numTrackCuts; ++i) { h2->GetYaxis()->SetBinLabel(i + 1, trackLabels[i].c_str()); } + } // end of setHistBinLabels function }; // End of Struct exclusiveRhoTo4Pi @@ -1251,22 +1256,6 @@ int ExclusiveRhoTo4Pi::runNos[113] = { int ExclusiveRhoTo4Pi::numRunNums = 113; -// std::string ExclusiveRhoTo4Pi::eventLabels[12] = { -// "No Cuts","UPC mode","vtxITSTPC=1","sbp=1","itsROFb=1","tfb=1", -// "FT0A <= 50","FT0C <= 50","FV0A <= 50","ZDC <= 0", -// "n PV Contrib = 4","V_{z} < 10cm" -// }; - -// int ExclusiveRhoTo4Pi::numEventCuts = 20; - -// std::string ExclusiveRhoTo4Pi::trackLabels[14] = { -// "No Cuts","isPVContributor","pT > 0.15 GeV/c","|#eta| < 0.9","DCA Z < 2 cm", -// "DCA XY cut","hasITS","hasTPC","itsChi2NCl < 36","tpcChi2NCl < 4", -// "tpcNClsFindable < 70","#pi tracks","#pi^{+} tracks","#pi^{-} tracks" -// }; -// -// int ExclusiveRhoTo4Pi::numTrackCuts = 14; - WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ From 7cea6475d2b5bfe2a69618be1bb53ff8a1aceb49 Mon Sep 17 00:00:00 2001 From: altsybee Date: Fri, 8 Aug 2025 13:03:00 +0200 Subject: [PATCH 293/345] [DPG] more checks in lightIonsEvSelQa (#12488) --- DPG/Tasks/AOTEvent/lightIonsEvSelQa.cxx | 1204 ++++++++++++++++------- 1 file changed, 867 insertions(+), 337 deletions(-) diff --git a/DPG/Tasks/AOTEvent/lightIonsEvSelQa.cxx b/DPG/Tasks/AOTEvent/lightIonsEvSelQa.cxx index 59c88b55171..2d62bba9221 100644 --- a/DPG/Tasks/AOTEvent/lightIonsEvSelQa.cxx +++ b/DPG/Tasks/AOTEvent/lightIonsEvSelQa.cxx @@ -60,8 +60,10 @@ struct LightIonsEvSelQa { Configurable nMaxMultFwd{"nMaxMultFwd", 100000, "N max in mult fwd histo"}; // o2-linter: disable=name/configurable (temporary fix) Configurable timeBinWidthInSec{"TimeBinWidthInSec", 10, "Width of time bins in seconds"}; // o2-linter: disable=name/configurable (temporary fix) - Configurable nSigmaForVzDiff{"nSigmaForVzDiff", 3.0, "n +/- sigma for diff vZ"}; // o2-linter: disable=name/configurable (temporary fix) - Configurable safetyDiffMargin{"SafetyDiffVzMargin", 0.4, "margin for diff vZ, cm"}; // o2-linter: disable=name/configurable (temporary fix) + Configurable nSigmaForVzDiff{"nSigmaForVzDiff", 2.5, "n +/- sigma for diff vZ"}; // o2-linter: disable=name/configurable (temporary fix) + Configurable safetyDiffVzMargin{"SafetyDiffVzMargin", 0.5, "margin for diff vZ, cm"}; // o2-linter: disable=name/configurable (temporary fix) + + Configurable confUseDiffVzCutFromEvSel{"UseDiffVzCutFromEvSel", 0, "0 - custom diffVz cut from this task, 1 - cut from event selection"}; // o2-linter: disable=name/configurable (temporary fix) uint64_t minGlobalBC = 0; Service ccdb; @@ -114,6 +116,14 @@ struct LightIonsEvSelQa { histos.add("bcQA/pastActivity/hBcZDC", "", kTH1F, {axisBCs}); histos.add("bcQA/futureActivity/hBcZDC", "", kTH1F, {axisBCs}); + histos.add("bcQA/specFT0bits/hBc_kIsActiveSideA", "", kTH1F, {axisBCs}); + histos.add("bcQA/specFT0bits/hBc_kIsActiveSideC", "", kTH1F, {axisBCs}); + histos.add("bcQA/specFT0bits/hBc_kIsFlangeEvent", "", kTH1F, {axisBCs}); + + histos.add("bcQA/specFT0bits/hBc_kIsActiveSideA_inTVX", "", kTH1F, {axisBCs}); + histos.add("bcQA/specFT0bits/hBc_kIsActiveSideC_inTVX", "", kTH1F, {axisBCs}); + histos.add("bcQA/specFT0bits/hBc_kIsFlangeEvent_inTVX", "", kTH1F, {axisBCs}); + const AxisSpec axisNtracks{nBinsTracks, -0.5, nMaxTracks - 0.5, "n tracks"}; const AxisSpec axisNtracksGlobal{nBinsTracks, -0.5, nMaxGlobalTracks - 0.5, "n tracks"}; const AxisSpec axisMultV0A{nBinsMultFwd, 0., static_cast(nMaxMultFwd), "mult V0A"}; @@ -121,15 +131,23 @@ struct LightIonsEvSelQa { const AxisSpec axisMultFT0C{nBinsMultFwd, 0., static_cast(nMaxMultFwd * 0.15), "mult FT0C"}; const AxisSpec axisMultT0M{nBinsMultFwd * 2, 0., static_cast(nMaxMultFwd * 0.4), "mult FT0M"}; + const AxisSpec axisMultT0MlargeBins{nBinsMultFwd, 0., static_cast(nMaxMultFwd * 0.75), "mult FT0M"}; + histos.add("multT0M_vs_multSumFT0", ";multT0M;multT0M_uncorrected", kTH2F, {axisMultT0MlargeBins, axisMultT0MlargeBins}); + const AxisSpec axisVtxZ{800, -20., 20., ""}; const AxisSpec axisBcDiff{600, -300., 300., "bc difference"}; const AxisSpec axisNcontrib{801, -0.5, 800.5, "n contributors"}; const AxisSpec axisColTimeRes{1500, 0., 1500., "collision time resolution (ns)"}; + AxisSpec axisVertexChi2{100, 0, 500, "Chi2 of vertex fit"}; + AxisSpec axisVertexChi2perContrib{100, 0, 10, "Chi2 of vertex fit"}; + histos.add("noSpecSelections/hBcColNoSel8", "", kTH1F, {axisBCs}); + histos.add("noSpecSelections/hBcOrigNoSel8", "", kTH1F, {axisBCs}); // histos.add("noSpecSelections/hBcColNoSel8TOF", "", kTH1F, {axisBCs}); histos.add("noSpecSelections/hBcTVX", "", kTH1F, {axisBCs}); + histos.add("noSpecSelections/hBcOrig", "", kTH1F, {axisBCs}); histos.add("noSpecSelections/hBcFT0", "", kTH1F, {axisBCs}); histos.add("noSpecSelections/hBcFV0", "", kTH1F, {axisBCs}); histos.add("noSpecSelections/hBcFDD", "", kTH1F, {axisBCs}); @@ -142,12 +160,16 @@ struct LightIonsEvSelQa { histos.add("noSpecSelections/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); histos.add("noSpecSelections/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); histos.add("noSpecSelections/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); - histos.add("noSpecSelections/hTVXvsBcDiff", "", kTH1F, {axisBcDiff}); + histos.add("noSpecSelections/hTVXvsBcDiffwrtOrigBc", "", kTH1F, {axisBcDiff}); histos.add("noSpecSelections/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); histos.add("noSpecSelections/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); + histos.add("noSpecSelections/hVertexChi2VsNcontrib", "", kTH2F, {axisNcontrib, axisVertexChi2perContrib}); + histos.add("noSpecSelections/hNPVvsNch", "", kTH2F, {axisNcontrib, axisNcontrib}); histos.add("noPU/hBcColNoSel8", "", kTH1F, {axisBCs}); + histos.add("noPU/hBcOrigNoSel8", "", kTH1F, {axisBCs}); histos.add("noPU/hBcTVX", "", kTH1F, {axisBCs}); + histos.add("noPU/hBcOrig", "", kTH1F, {axisBCs}); histos.add("noPU/hBcFT0", "", kTH1F, {axisBCs}); histos.add("noPU/hBcFV0", "", kTH1F, {axisBCs}); histos.add("noPU/hBcFDD", "", kTH1F, {axisBCs}); @@ -160,16 +182,18 @@ struct LightIonsEvSelQa { histos.add("noPU/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); histos.add("noPU/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); histos.add("noPU/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); - histos.add("noPU/hTVXvsBcDiff", "", kTH1F, {axisBcDiff}); + histos.add("noPU/hTVXvsBcDiffwrtOrigBc", "", kTH1F, {axisBcDiff}); histos.add("noPU/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); histos.add("noPU/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); + histos.add("noPU/hVertexChi2VsNcontrib", "", kTH2F, {axisNcontrib, axisVertexChi2perContrib}); + histos.add("noPU/hNPVvsNch", "", kTH2F, {axisNcontrib, axisNcontrib}); histos.add("noPU_pvTOFmatched/hBcColNoSel8", "", kTH1F, {axisBCs}); - // histos.add("noPU_pvTOFmatched/hBcColNoSel8TOF", "", kTH1F, {axisBCs}); histos.add("noPU_pvTOFmatched/hBcTVX", "", kTH1F, {axisBCs}); + histos.add("noPU_pvTOFmatched/hBcOrig", "", kTH1F, {axisBCs}); histos.add("noPU_pvTOFmatched/hBcFT0", "", kTH1F, {axisBCs}); histos.add("noPU_pvTOFmatched/hBcFV0", "", kTH1F, {axisBCs}); - histos.add("noPU_pvTOFmatched/hBcFDD", "", kTH1F, {axisBCs}); + // histos.add("noPU_pvTOFmatched/hBcFDD", "", kTH1F, {axisBCs}); histos.add("noPU_pvTOFmatched/hBcZDC", "", kTH1F, {axisBCs}); histos.add("noPU_pvTOFmatched/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); histos.add("noPU_pvTOFmatched/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); @@ -179,34 +203,118 @@ struct LightIonsEvSelQa { histos.add("noPU_pvTOFmatched/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); histos.add("noPU_pvTOFmatched/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); histos.add("noPU_pvTOFmatched/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); - histos.add("noPU_pvTOFmatched/hTVXvsBcDiff", "", kTH1F, {axisBcDiff}); + histos.add("noPU_pvTOFmatched/hTVXvsBcDiffwrtOrigBc", "", kTH1F, {axisBcDiff}); histos.add("noPU_pvTOFmatched/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); histos.add("noPU_pvTOFmatched/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); - - histos.add("bcDiffCut/hBcColNoSel8", "", kTH1F, {axisBCs}); - // histos.add("bcDiffCut/hBcColNoSel8TOF", "", kTH1F, {axisBCs}); - histos.add("bcDiffCut/hBcTVX", "", kTH1F, {axisBCs}); - histos.add("bcDiffCut/hBcFT0", "", kTH1F, {axisBCs}); - histos.add("bcDiffCut/hBcFV0", "", kTH1F, {axisBCs}); - histos.add("bcDiffCut/hBcFDD", "", kTH1F, {axisBCs}); - histos.add("bcDiffCut/hBcZDC", "", kTH1F, {axisBCs}); - histos.add("bcDiffCut/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); - histos.add("bcDiffCut/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); - histos.add("bcDiffCut/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); - histos.add("bcDiffCut/nTracksPV_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracks}); - histos.add("bcDiffCut/nTracksPV_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracks}); - histos.add("bcDiffCut/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); - histos.add("bcDiffCut/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); - histos.add("bcDiffCut/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); - histos.add("bcDiffCut/hTVXvsBcDiff", "", kTH1F, {axisBcDiff}); - histos.add("bcDiffCut/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); - histos.add("bcDiffCut/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); + histos.add("noPU_pvTOFmatched/hVertexChi2VsNcontrib", "", kTH2F, {axisNcontrib, axisVertexChi2perContrib}); + histos.add("noPU_pvTOFmatched/hNPVvsNch", "", kTH2F, {axisNcontrib, axisNcontrib}); + + histos.add("noPU_pvTRDmatched/hBcColNoSel8", "", kTH1F, {axisBCs}); + histos.add("noPU_pvTRDmatched/hBcTVX", "", kTH1F, {axisBCs}); + histos.add("noPU_pvTRDmatched/hBcOrig", "", kTH1F, {axisBCs}); + histos.add("noPU_pvTRDmatched/hBcFT0", "", kTH1F, {axisBCs}); + histos.add("noPU_pvTRDmatched/hBcFV0", "", kTH1F, {axisBCs}); + histos.add("noPU_pvTRDmatched/hBcZDC", "", kTH1F, {axisBCs}); + histos.add("noPU_pvTRDmatched/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); + histos.add("noPU_pvTRDmatched/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); + histos.add("noPU_pvTRDmatched/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("noPU_pvTRDmatched/nTracksPV_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracks}); + histos.add("noPU_pvTRDmatched/nTracksPV_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracks}); + histos.add("noPU_pvTRDmatched/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); + histos.add("noPU_pvTRDmatched/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); + histos.add("noPU_pvTRDmatched/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); + histos.add("noPU_pvTRDmatched/hTVXvsBcDiffwrtOrigBc", "", kTH1F, {axisBcDiff}); + histos.add("noPU_pvTRDmatched/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); + histos.add("noPU_pvTRDmatched/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); + histos.add("noPU_pvTRDmatched/hVertexChi2VsNcontrib", "", kTH2F, {axisNcontrib, axisVertexChi2perContrib}); + histos.add("noPU_pvTRDmatched/hNPVvsNch", "", kTH2F, {axisNcontrib, axisNcontrib}); + + histos.add("noPU_notTRDmatched/hBcColNoSel8", "", kTH1F, {axisBCs}); + histos.add("noPU_notTRDmatched/hBcTVX", "", kTH1F, {axisBCs}); + histos.add("noPU_notTRDmatched/hBcOrig", "", kTH1F, {axisBCs}); + histos.add("noPU_notTRDmatched/hBcFT0", "", kTH1F, {axisBCs}); + histos.add("noPU_notTRDmatched/hBcFV0", "", kTH1F, {axisBCs}); + histos.add("noPU_notTRDmatched/hBcZDC", "", kTH1F, {axisBCs}); + histos.add("noPU_notTRDmatched/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); + histos.add("noPU_notTRDmatched/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); + histos.add("noPU_notTRDmatched/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("noPU_notTRDmatched/nTracksPV_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracks}); + histos.add("noPU_notTRDmatched/nTracksPV_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracks}); + histos.add("noPU_notTRDmatched/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); + histos.add("noPU_notTRDmatched/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); + histos.add("noPU_notTRDmatched/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); + histos.add("noPU_notTRDmatched/hTVXvsBcDiffwrtOrigBc", "", kTH1F, {axisBcDiff}); + histos.add("noPU_notTRDmatched/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); + histos.add("noPU_notTRDmatched/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); + histos.add("noPU_notTRDmatched/hNPVvsNch", "", kTH2F, {axisNcontrib, axisNcontrib}); + + histos.add("noPU_pvTOFmatched_notTRDmatched/hBcFV0", "", kTH1F, {axisBCs}); + histos.add("noPU_pvTOFmatched_notTRDmatched/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("noPU_pvTOFmatched_notTRDmatched/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); + histos.add("noPU_pvTOFmatched_notTRDmatched/hNPVvsNch", "", kTH2F, {axisNcontrib, axisNcontrib}); + + histos.add("bcDiffWrtClosestTVXCut/hBcColNoSel8", "", kTH1F, {axisBCs}); + histos.add("bcDiffWrtClosestTVXCut/hBcTVX", "", kTH1F, {axisBCs}); + histos.add("bcDiffWrtClosestTVXCut/hBcOrig", "", kTH1F, {axisBCs}); + histos.add("bcDiffWrtClosestTVXCut/hBcFT0", "", kTH1F, {axisBCs}); + histos.add("bcDiffWrtClosestTVXCut/hBcFV0", "", kTH1F, {axisBCs}); + histos.add("bcDiffWrtClosestTVXCut/hBcZDC", "", kTH1F, {axisBCs}); + histos.add("bcDiffWrtClosestTVXCut/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); + histos.add("bcDiffWrtClosestTVXCut/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); + histos.add("bcDiffWrtClosestTVXCut/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("bcDiffWrtClosestTVXCut/nTracksPV_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracks}); + histos.add("bcDiffWrtClosestTVXCut/nTracksPV_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracks}); + // histos.add("bcDiffWrtClosestTVXCut/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); + // histos.add("bcDiffWrtClosestTVXCut/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); + // histos.add("bcDiffWrtClosestTVXCut/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); + histos.add("bcDiffWrtClosestTVXCut/hTVXvsBcDiffwrtOrigBc", "", kTH1F, {axisBcDiff}); + histos.add("bcDiffWrtClosestTVXCut/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); + histos.add("bcDiffWrtClosestTVXCut/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); + histos.add("bcDiffWrtClosestTVXCut/hNPVvsNch", "", kTH2F, {axisNcontrib, axisNcontrib}); + + histos.add("noPU_bcDiffWrtOriginalBcCut/hBcColNoSel8", "", kTH1F, {axisBCs}); + histos.add("noPU_bcDiffWrtOriginalBcCut/hBcTVX", "", kTH1F, {axisBCs}); + histos.add("noPU_bcDiffWrtOriginalBcCut/hBcOrig", "", kTH1F, {axisBCs}); + histos.add("noPU_bcDiffWrtOriginalBcCut/hBcFT0", "", kTH1F, {axisBCs}); + histos.add("noPU_bcDiffWrtOriginalBcCut/hBcFV0", "", kTH1F, {axisBCs}); + histos.add("noPU_bcDiffWrtOriginalBcCut/hBcZDC", "", kTH1F, {axisBCs}); + histos.add("noPU_bcDiffWrtOriginalBcCut/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); + histos.add("noPU_bcDiffWrtOriginalBcCut/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); + histos.add("noPU_bcDiffWrtOriginalBcCut/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("noPU_bcDiffWrtOriginalBcCut/nTracksPV_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracks}); + histos.add("noPU_bcDiffWrtOriginalBcCut/nTracksPV_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracks}); + // histos.add("noPU_bcDiffWrtOriginalBcCut/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); + // histos.add("noPU_bcDiffWrtOriginalBcCut/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); + // histos.add("noPU_bcDiffWrtOriginalBcCut/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); + histos.add("noPU_bcDiffWrtOriginalBcCut/hTVXvsBcDiffwrtOrigBc", "", kTH1F, {axisBcDiff}); + histos.add("noPU_bcDiffWrtOriginalBcCut/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); + histos.add("noPU_bcDiffWrtOriginalBcCut/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); + histos.add("noPU_bcDiffWrtOriginalBcCut/hNPVvsNch", "", kTH2F, {axisNcontrib, axisNcontrib}); + + histos.add("noPU_goodVertexChi2/hBcColNoSel8", "", kTH1F, {axisBCs}); + histos.add("noPU_goodVertexChi2/hBcTVX", "", kTH1F, {axisBCs}); + histos.add("noPU_goodVertexChi2/hBcOrig", "", kTH1F, {axisBCs}); + histos.add("noPU_goodVertexChi2/hBcFT0", "", kTH1F, {axisBCs}); + histos.add("noPU_goodVertexChi2/hBcFV0", "", kTH1F, {axisBCs}); + histos.add("noPU_goodVertexChi2/hBcZDC", "", kTH1F, {axisBCs}); + histos.add("noPU_goodVertexChi2/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); + histos.add("noPU_goodVertexChi2/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); + histos.add("noPU_goodVertexChi2/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("noPU_goodVertexChi2/nTracksPV_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracks}); + histos.add("noPU_goodVertexChi2/nTracksPV_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracks}); + // histos.add("noPU_goodVertexChi2/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); + // histos.add("noPU_goodVertexChi2/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); + // histos.add("noPU_goodVertexChi2/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); + histos.add("noPU_goodVertexChi2/hTVXvsBcDiffwrtOrigBc", "", kTH1F, {axisBcDiff}); + histos.add("noPU_goodVertexChi2/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); + histos.add("noPU_goodVertexChi2/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); + histos.add("noPU_goodVertexChi2/hNPVvsNch", "", kTH2F, {axisNcontrib, axisNcontrib}); histos.add("narrowTimeVeto/hBcColNoSel8", "", kTH1F, {axisBCs}); histos.add("narrowTimeVeto/hBcTVX", "", kTH1F, {axisBCs}); + histos.add("narrowTimeVeto/hBcOrig", "", kTH1F, {axisBCs}); histos.add("narrowTimeVeto/hBcFT0", "", kTH1F, {axisBCs}); histos.add("narrowTimeVeto/hBcFV0", "", kTH1F, {axisBCs}); - histos.add("narrowTimeVeto/hBcFDD", "", kTH1F, {axisBCs}); histos.add("narrowTimeVeto/hBcZDC", "", kTH1F, {axisBCs}); histos.add("narrowTimeVeto/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); histos.add("narrowTimeVeto/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); @@ -216,15 +324,17 @@ struct LightIonsEvSelQa { histos.add("narrowTimeVeto/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); histos.add("narrowTimeVeto/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); histos.add("narrowTimeVeto/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); - histos.add("narrowTimeVeto/hTVXvsBcDiff", "", kTH1F, {axisBcDiff}); + histos.add("narrowTimeVeto/hTVXvsBcDiffwrtOrigBc", "", kTH1F, {axisBcDiff}); histos.add("narrowTimeVeto/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); histos.add("narrowTimeVeto/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); + histos.add("narrowTimeVeto/hNPVvsNch", "", kTH2F, {axisNcontrib, axisNcontrib}); histos.add("strictTimeVeto/hBcColNoSel8", "", kTH1F, {axisBCs}); histos.add("strictTimeVeto/hBcTVX", "", kTH1F, {axisBCs}); + histos.add("strictTimeVeto/hBcOrig", "", kTH1F, {axisBCs}); histos.add("strictTimeVeto/hBcFT0", "", kTH1F, {axisBCs}); histos.add("strictTimeVeto/hBcFV0", "", kTH1F, {axisBCs}); - histos.add("strictTimeVeto/hBcFDD", "", kTH1F, {axisBCs}); + // histos.add("strictTimeVeto/hBcFDD", "", kTH1F, {axisBCs}); histos.add("strictTimeVeto/hBcZDC", "", kTH1F, {axisBCs}); histos.add("strictTimeVeto/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); histos.add("strictTimeVeto/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); @@ -234,15 +344,17 @@ struct LightIonsEvSelQa { histos.add("strictTimeVeto/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); histos.add("strictTimeVeto/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); histos.add("strictTimeVeto/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); - histos.add("strictTimeVeto/hTVXvsBcDiff", "", kTH1F, {axisBcDiff}); + histos.add("strictTimeVeto/hTVXvsBcDiffwrtOrigBc", "", kTH1F, {axisBcDiff}); histos.add("strictTimeVeto/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); histos.add("strictTimeVeto/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); + histos.add("strictTimeVeto/hNPVvsNch", "", kTH2F, {axisNcontrib, axisNcontrib}); histos.add("noCollSameROF/hBcColNoSel8", "", kTH1F, {axisBCs}); histos.add("noCollSameROF/hBcTVX", "", kTH1F, {axisBCs}); + histos.add("noCollSameROF/hBcOrig", "", kTH1F, {axisBCs}); histos.add("noCollSameROF/hBcFT0", "", kTH1F, {axisBCs}); histos.add("noCollSameROF/hBcFV0", "", kTH1F, {axisBCs}); - histos.add("noCollSameROF/hBcFDD", "", kTH1F, {axisBCs}); + // histos.add("noCollSameROF/hBcFDD", "", kTH1F, {axisBCs}); histos.add("noCollSameROF/hBcZDC", "", kTH1F, {axisBCs}); histos.add("noCollSameROF/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); histos.add("noCollSameROF/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); @@ -252,69 +364,89 @@ struct LightIonsEvSelQa { histos.add("noCollSameROF/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); histos.add("noCollSameROF/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); histos.add("noCollSameROF/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); - histos.add("noCollSameROF/hTVXvsBcDiff", "", kTH1F, {axisBcDiff}); + histos.add("noCollSameROF/hTVXvsBcDiffwrtOrigBc", "", kTH1F, {axisBcDiff}); histos.add("noCollSameROF/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); histos.add("noCollSameROF/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); - - histos.add("noPU_LowMultCut/hBcColNoSel8", "", kTH1F, {axisBCs}); - histos.add("noPU_LowMultCut/hBcTVX", "", kTH1F, {axisBCs}); - histos.add("noPU_LowMultCut/hBcFT0", "", kTH1F, {axisBCs}); - histos.add("noPU_LowMultCut/hBcFV0", "", kTH1F, {axisBCs}); - histos.add("noPU_LowMultCut/hBcFDD", "", kTH1F, {axisBCs}); - histos.add("noPU_LowMultCut/hBcZDC", "", kTH1F, {axisBCs}); - histos.add("noPU_LowMultCut/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); - histos.add("noPU_LowMultCut/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); - histos.add("noPU_LowMultCut/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); - histos.add("noPU_LowMultCut/nTracksPV_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracks}); - histos.add("noPU_LowMultCut/nTracksPV_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracks}); - histos.add("noPU_LowMultCut/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); - histos.add("noPU_LowMultCut/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); - histos.add("noPU_LowMultCut/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); - histos.add("noPU_LowMultCut/hTVXvsBcDiff", "", kTH1F, {axisBcDiff}); - histos.add("noPU_LowMultCut/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); - histos.add("noPU_LowMultCut/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); - - histos.add("noPU_HighMultCloudCut/hBcColNoSel8", "", kTH1F, {axisBCs}); - histos.add("noPU_HighMultCloudCut/hBcTVX", "", kTH1F, {axisBCs}); - histos.add("noPU_HighMultCloudCut/hBcFT0", "", kTH1F, {axisBCs}); - histos.add("noPU_HighMultCloudCut/hBcFV0", "", kTH1F, {axisBCs}); - histos.add("noPU_HighMultCloudCut/hBcFDD", "", kTH1F, {axisBCs}); - histos.add("noPU_HighMultCloudCut/hBcZDC", "", kTH1F, {axisBCs}); - histos.add("noPU_HighMultCloudCut/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); - histos.add("noPU_HighMultCloudCut/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); - histos.add("noPU_HighMultCloudCut/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); - histos.add("noPU_HighMultCloudCut/nTracksPV_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracks}); - histos.add("noPU_HighMultCloudCut/nTracksPV_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracks}); - histos.add("noPU_HighMultCloudCut/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); - histos.add("noPU_HighMultCloudCut/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); - histos.add("noPU_HighMultCloudCut/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); - histos.add("noPU_HighMultCloudCut/hTVXvsBcDiff", "", kTH1F, {axisBcDiff}); - histos.add("noPU_HighMultCloudCut/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); - histos.add("noPU_HighMultCloudCut/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); - - histos.add("badVzDiff/hBcColNoSel8", "", kTH1F, {axisBCs}); - histos.add("badVzDiff/hBcTVX", "", kTH1F, {axisBCs}); - histos.add("badVzDiff/hBcFT0", "", kTH1F, {axisBCs}); - histos.add("badVzDiff/hBcFV0", "", kTH1F, {axisBCs}); - histos.add("badVzDiff/hBcFDD", "", kTH1F, {axisBCs}); - histos.add("badVzDiff/hBcZDC", "", kTH1F, {axisBCs}); - histos.add("badVzDiff/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); - histos.add("badVzDiff/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); - histos.add("badVzDiff/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); - histos.add("badVzDiff/nTracksPV_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracks}); - histos.add("badVzDiff/nTracksPV_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracks}); - histos.add("badVzDiff/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); - histos.add("badVzDiff/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); - histos.add("badVzDiff/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); - histos.add("badVzDiff/hTVXvsBcDiff", "", kTH1F, {axisBcDiff}); - histos.add("badVzDiff/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); - histos.add("badVzDiff/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); + histos.add("noCollSameROF/hNPVvsNch", "", kTH2F, {axisNcontrib, axisNcontrib}); + + histos.add("lowMultCut/hBcColNoSel8", "", kTH1F, {axisBCs}); + histos.add("lowMultCut/hBcOrigNoSel8", "", kTH1F, {axisBCs}); + histos.add("lowMultCut/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); + + histos.add("noPU_lowMultCut/hBcColNoSel8", "", kTH1F, {axisBCs}); + histos.add("noPU_lowMultCut/hBcOrigNoSel8", "", kTH1F, {axisBCs}); + histos.add("noPU_lowMultCut/hBcTVX", "", kTH1F, {axisBCs}); + histos.add("noPU_lowMultCut/hBcOrig", "", kTH1F, {axisBCs}); + histos.add("noPU_lowMultCut/hBcFT0", "", kTH1F, {axisBCs}); + histos.add("noPU_lowMultCut/hBcFV0", "", kTH1F, {axisBCs}); + // histos.add("noPU_lowMultCut/hBcFDD", "", kTH1F, {axisBCs}); + histos.add("noPU_lowMultCut/hBcZDC", "", kTH1F, {axisBCs}); + histos.add("noPU_lowMultCut/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); + histos.add("noPU_lowMultCut/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); + histos.add("noPU_lowMultCut/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("noPU_lowMultCut/nTracksPV_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracks}); + histos.add("noPU_lowMultCut/nTracksPV_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracks}); + histos.add("noPU_lowMultCut/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); + histos.add("noPU_lowMultCut/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); + histos.add("noPU_lowMultCut/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); + histos.add("noPU_lowMultCut/hTVXvsBcDiffwrtOrigBc", "", kTH1F, {axisBcDiff}); + histos.add("noPU_lowMultCut/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); + histos.add("noPU_lowMultCut/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); + histos.add("noPU_lowMultCut/hVertexChi2VsNcontrib", "", kTH2F, {axisNcontrib, axisVertexChi2perContrib}); + histos.add("noPU_lowMultCut/hNPVvsNch", "", kTH2F, {axisNcontrib, axisNcontrib}); + + histos.add("highMultCloudCut/hBcColNoSel8", "", kTH1F, {axisBCs}); + histos.add("highMultCloudCut/hBcOrigNoSel8", "", kTH1F, {axisBCs}); + histos.add("highMultCloudCut/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); + + histos.add("noPU_highMultCloudCut/hBcColNoSel8", "", kTH1F, {axisBCs}); + histos.add("noPU_highMultCloudCut/hBcOrigNoSel8", "", kTH1F, {axisBCs}); + histos.add("noPU_highMultCloudCut/hBcTVX", "", kTH1F, {axisBCs}); + histos.add("noPU_highMultCloudCut/hBcOrig", "", kTH1F, {axisBCs}); + histos.add("noPU_highMultCloudCut/hBcFT0", "", kTH1F, {axisBCs}); + histos.add("noPU_highMultCloudCut/hBcFV0", "", kTH1F, {axisBCs}); + // histos.add("noPU_highMultCloudCut/hBcFDD", "", kTH1F, {axisBCs}); + histos.add("noPU_highMultCloudCut/hBcZDC", "", kTH1F, {axisBCs}); + histos.add("noPU_highMultCloudCut/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); + histos.add("noPU_highMultCloudCut/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); + histos.add("noPU_highMultCloudCut/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("noPU_highMultCloudCut/nTracksPV_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracks}); + histos.add("noPU_highMultCloudCut/nTracksPV_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracks}); + histos.add("noPU_highMultCloudCut/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); + histos.add("noPU_highMultCloudCut/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); + histos.add("noPU_highMultCloudCut/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); + histos.add("noPU_highMultCloudCut/hTVXvsBcDiffwrtOrigBc", "", kTH1F, {axisBcDiff}); + histos.add("noPU_highMultCloudCut/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); + histos.add("noPU_highMultCloudCut/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); + histos.add("noPU_highMultCloudCut/hVertexChi2VsNcontrib", "", kTH2F, {axisNcontrib, axisVertexChi2perContrib}); + histos.add("noPU_highMultCloudCut/hNPVvsNch", "", kTH2F, {axisNcontrib, axisNcontrib}); + + histos.add("noPU_badVzDiff/hBcColNoSel8", "", kTH1F, {axisBCs}); + histos.add("noPU_badVzDiff/hBcTVX", "", kTH1F, {axisBCs}); + histos.add("noPU_badVzDiff/hBcOrig", "", kTH1F, {axisBCs}); + histos.add("noPU_badVzDiff/hBcFT0", "", kTH1F, {axisBCs}); + histos.add("noPU_badVzDiff/hBcFV0", "", kTH1F, {axisBCs}); + // histos.add("noPU_badVzDiff/hBcFDD", "", kTH1F, {axisBCs}); + histos.add("noPU_badVzDiff/hBcZDC", "", kTH1F, {axisBCs}); + histos.add("noPU_badVzDiff/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); + histos.add("noPU_badVzDiff/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); + histos.add("noPU_badVzDiff/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("noPU_badVzDiff/nTracksPV_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracks}); + histos.add("noPU_badVzDiff/nTracksPV_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracks}); + histos.add("noPU_badVzDiff/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); + histos.add("noPU_badVzDiff/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); + histos.add("noPU_badVzDiff/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); + histos.add("noPU_badVzDiff/hTVXvsBcDiffwrtOrigBc", "", kTH1F, {axisBcDiff}); + histos.add("noPU_badVzDiff/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); + histos.add("noPU_badVzDiff/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); + histos.add("noPU_badVzDiff/hVertexChi2VsNcontrib", "", kTH2F, {axisNcontrib, axisVertexChi2perContrib}); + histos.add("noPU_badVzDiff/hNPVvsNch", "", kTH2F, {axisNcontrib, axisNcontrib}); histos.add("noPU_goodVzDiff/hBcColNoSel8", "", kTH1F, {axisBCs}); histos.add("noPU_goodVzDiff/hBcTVX", "", kTH1F, {axisBCs}); + histos.add("noPU_goodVzDiff/hBcOrig", "", kTH1F, {axisBCs}); histos.add("noPU_goodVzDiff/hBcFT0", "", kTH1F, {axisBCs}); histos.add("noPU_goodVzDiff/hBcFV0", "", kTH1F, {axisBCs}); - histos.add("noPU_goodVzDiff/hBcFDD", "", kTH1F, {axisBCs}); histos.add("noPU_goodVzDiff/hBcZDC", "", kTH1F, {axisBCs}); histos.add("noPU_goodVzDiff/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); histos.add("noPU_goodVzDiff/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); @@ -324,51 +456,96 @@ struct LightIonsEvSelQa { histos.add("noPU_goodVzDiff/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); histos.add("noPU_goodVzDiff/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); histos.add("noPU_goodVzDiff/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); - histos.add("noPU_goodVzDiff/hTVXvsBcDiff", "", kTH1F, {axisBcDiff}); + histos.add("noPU_goodVzDiff/hTVXvsBcDiffwrtOrigBc", "", kTH1F, {axisBcDiff}); histos.add("noPU_goodVzDiff/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); histos.add("noPU_goodVzDiff/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); - - histos.add("noPastActivity/hBcColNoSel8", "", kTH1F, {axisBCs}); - histos.add("noPastActivity/hBcTVX", "", kTH1F, {axisBCs}); - histos.add("noPastActivity/hBcFT0", "", kTH1F, {axisBCs}); - histos.add("noPastActivity/hBcFV0", "", kTH1F, {axisBCs}); - histos.add("noPastActivity/hBcFDD", "", kTH1F, {axisBCs}); - histos.add("noPastActivity/hBcZDC", "", kTH1F, {axisBCs}); - histos.add("noPastActivity/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); - histos.add("noPastActivity/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); - histos.add("noPastActivity/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); - histos.add("noPastActivity/nTracksPV_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracks}); - histos.add("noPastActivity/nTracksPV_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracks}); - histos.add("noPastActivity/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); - histos.add("noPastActivity/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); - histos.add("noPastActivity/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); - histos.add("noPastActivity/hTVXvsBcDiff", "", kTH1F, {axisBcDiff}); - histos.add("noPastActivity/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); - histos.add("noPastActivity/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); - - histos.add("noFT0activityNearby/hBcColNoSel8", "", kTH1F, {axisBCs}); - histos.add("noFT0activityNearby/hBcTVX", "", kTH1F, {axisBCs}); - histos.add("noFT0activityNearby/hBcFT0", "", kTH1F, {axisBCs}); - histos.add("noFT0activityNearby/hBcFV0", "", kTH1F, {axisBCs}); - histos.add("noFT0activityNearby/hBcFDD", "", kTH1F, {axisBCs}); - histos.add("noFT0activityNearby/hBcZDC", "", kTH1F, {axisBCs}); - histos.add("noFT0activityNearby/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); - histos.add("noFT0activityNearby/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); - histos.add("noFT0activityNearby/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); - histos.add("noFT0activityNearby/nTracksPV_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracks}); - histos.add("noFT0activityNearby/nTracksPV_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracks}); - histos.add("noFT0activityNearby/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); - histos.add("noFT0activityNearby/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); - histos.add("noFT0activityNearby/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); - histos.add("noFT0activityNearby/hTVXvsBcDiff", "", kTH1F, {axisBcDiff}); - histos.add("noFT0activityNearby/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); - histos.add("noFT0activityNearby/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); + histos.add("noPU_goodVzDiff/hVertexChi2VsNcontrib", "", kTH2F, {axisNcontrib, axisVertexChi2perContrib}); + histos.add("noPU_goodVzDiff/hNPVvsNch", "", kTH2F, {axisNcontrib, axisNcontrib}); + + histos.add("noPU_goodVzDiff_narrowTimeVeto/hBcColNoSel8", "", kTH1F, {axisBCs}); + histos.add("noPU_goodVzDiff_narrowTimeVeto/hBcTVX", "", kTH1F, {axisBCs}); + histos.add("noPU_goodVzDiff_narrowTimeVeto/hBcOrig", "", kTH1F, {axisBCs}); + histos.add("noPU_goodVzDiff_narrowTimeVeto/hBcFT0", "", kTH1F, {axisBCs}); + histos.add("noPU_goodVzDiff_narrowTimeVeto/hBcFV0", "", kTH1F, {axisBCs}); + histos.add("noPU_goodVzDiff_narrowTimeVeto/hBcZDC", "", kTH1F, {axisBCs}); + histos.add("noPU_goodVzDiff_narrowTimeVeto/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); + histos.add("noPU_goodVzDiff_narrowTimeVeto/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); + histos.add("noPU_goodVzDiff_narrowTimeVeto/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("noPU_goodVzDiff_narrowTimeVeto/nTracksPV_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracks}); + histos.add("noPU_goodVzDiff_narrowTimeVeto/nTracksPV_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracks}); + histos.add("noPU_goodVzDiff_narrowTimeVeto/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); + histos.add("noPU_goodVzDiff_narrowTimeVeto/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); + histos.add("noPU_goodVzDiff_narrowTimeVeto/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); + histos.add("noPU_goodVzDiff_narrowTimeVeto/hTVXvsBcDiffwrtOrigBc", "", kTH1F, {axisBcDiff}); + histos.add("noPU_goodVzDiff_narrowTimeVeto/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); + histos.add("noPU_goodVzDiff_narrowTimeVeto/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); + histos.add("noPU_goodVzDiff_narrowTimeVeto/hVertexChi2VsNcontrib", "", kTH2F, {axisNcontrib, axisVertexChi2perContrib}); + histos.add("noPU_goodVzDiff_narrowTimeVeto/hNPVvsNch", "", kTH2F, {axisNcontrib, axisNcontrib}); + + histos.add("noPU_goodVzDiff_strictTimeVeto/hBcColNoSel8", "", kTH1F, {axisBCs}); + histos.add("noPU_goodVzDiff_strictTimeVeto/hBcTVX", "", kTH1F, {axisBCs}); + histos.add("noPU_goodVzDiff_strictTimeVeto/hBcOrig", "", kTH1F, {axisBCs}); + histos.add("noPU_goodVzDiff_strictTimeVeto/hBcFT0", "", kTH1F, {axisBCs}); + histos.add("noPU_goodVzDiff_strictTimeVeto/hBcFV0", "", kTH1F, {axisBCs}); + histos.add("noPU_goodVzDiff_strictTimeVeto/hBcZDC", "", kTH1F, {axisBCs}); + histos.add("noPU_goodVzDiff_strictTimeVeto/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); + histos.add("noPU_goodVzDiff_strictTimeVeto/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); + histos.add("noPU_goodVzDiff_strictTimeVeto/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("noPU_goodVzDiff_strictTimeVeto/nTracksPV_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracks}); + histos.add("noPU_goodVzDiff_strictTimeVeto/nTracksPV_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracks}); + histos.add("noPU_goodVzDiff_strictTimeVeto/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); + histos.add("noPU_goodVzDiff_strictTimeVeto/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); + histos.add("noPU_goodVzDiff_strictTimeVeto/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); + histos.add("noPU_goodVzDiff_strictTimeVeto/hTVXvsBcDiffwrtOrigBc", "", kTH1F, {axisBcDiff}); + histos.add("noPU_goodVzDiff_strictTimeVeto/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); + histos.add("noPU_goodVzDiff_strictTimeVeto/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); + histos.add("noPU_goodVzDiff_strictTimeVeto/hVertexChi2VsNcontrib", "", kTH2F, {axisNcontrib, axisVertexChi2perContrib}); + histos.add("noPU_goodVzDiff_strictTimeVeto/hNPVvsNch", "", kTH2F, {axisNcontrib, axisNcontrib}); + + histos.add("noPU_noPastActivity/hBcColNoSel8", "", kTH1F, {axisBCs}); + histos.add("noPU_noPastActivity/hBcTVX", "", kTH1F, {axisBCs}); + histos.add("noPU_noPastActivity/hBcOrig", "", kTH1F, {axisBCs}); + histos.add("noPU_noPastActivity/hBcFT0", "", kTH1F, {axisBCs}); + histos.add("noPU_noPastActivity/hBcFV0", "", kTH1F, {axisBCs}); + // histos.add("noPU_noPastActivity/hBcFDD", "", kTH1F, {axisBCs}); + histos.add("noPU_noPastActivity/hBcZDC", "", kTH1F, {axisBCs}); + histos.add("noPU_noPastActivity/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); + histos.add("noPU_noPastActivity/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); + histos.add("noPU_noPastActivity/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("noPU_noPastActivity/nTracksPV_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracks}); + histos.add("noPU_noPastActivity/nTracksPV_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracks}); + // histos.add("noPU_noPastActivity/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); + // histos.add("noPU_noPastActivity/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); + // histos.add("noPU_noPastActivity/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); + histos.add("noPU_noPastActivity/hTVXvsBcDiffwrtOrigBc", "", kTH1F, {axisBcDiff}); + histos.add("noPU_noPastActivity/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); + histos.add("noPU_noPastActivity/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); + histos.add("noPU_noPastActivity/hNPVvsNch", "", kTH2F, {axisNcontrib, axisNcontrib}); + + histos.add("noPU_noFT0activityNearby/hBcColNoSel8", "", kTH1F, {axisBCs}); + histos.add("noPU_noFT0activityNearby/hBcTVX", "", kTH1F, {axisBCs}); + histos.add("noPU_noFT0activityNearby/hBcOrig", "", kTH1F, {axisBCs}); + histos.add("noPU_noFT0activityNearby/hBcFT0", "", kTH1F, {axisBCs}); + histos.add("noPU_noFT0activityNearby/hBcFV0", "", kTH1F, {axisBCs}); + histos.add("noPU_noFT0activityNearby/hBcZDC", "", kTH1F, {axisBCs}); + histos.add("noPU_noFT0activityNearby/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); + histos.add("noPU_noFT0activityNearby/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); + histos.add("noPU_noFT0activityNearby/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("noPU_noFT0activityNearby/nTracksPV_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracks}); + histos.add("noPU_noFT0activityNearby/nTracksPV_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracks}); + // histos.add("noPU_noFT0activityNearby/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); + // histos.add("noPU_noFT0activityNearby/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); + // histos.add("noPU_noFT0activityNearby/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); + histos.add("noPU_noFT0activityNearby/hTVXvsBcDiffwrtOrigBc", "", kTH1F, {axisBcDiff}); + histos.add("noPU_noFT0activityNearby/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); + histos.add("noPU_noFT0activityNearby/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); + histos.add("noPU_noFT0activityNearby/hNPVvsNch", "", kTH2F, {axisNcontrib, axisNcontrib}); histos.add("noPU_cutByVzDiff_pvTOF/hBcColNoSel8", "", kTH1F, {axisBCs}); histos.add("noPU_cutByVzDiff_pvTOF/hBcTVX", "", kTH1F, {axisBCs}); + histos.add("noPU_cutByVzDiff_pvTOF/hBcOrig", "", kTH1F, {axisBCs}); histos.add("noPU_cutByVzDiff_pvTOF/hBcFT0", "", kTH1F, {axisBCs}); histos.add("noPU_cutByVzDiff_pvTOF/hBcFV0", "", kTH1F, {axisBCs}); - histos.add("noPU_cutByVzDiff_pvTOF/hBcFDD", "", kTH1F, {axisBCs}); histos.add("noPU_cutByVzDiff_pvTOF/hBcZDC", "", kTH1F, {axisBCs}); histos.add("noPU_cutByVzDiff_pvTOF/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); histos.add("noPU_cutByVzDiff_pvTOF/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); @@ -378,9 +555,32 @@ struct LightIonsEvSelQa { histos.add("noPU_cutByVzDiff_pvTOF/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); histos.add("noPU_cutByVzDiff_pvTOF/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); histos.add("noPU_cutByVzDiff_pvTOF/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); - histos.add("noPU_cutByVzDiff_pvTOF/hTVXvsBcDiff", "", kTH1F, {axisBcDiff}); + histos.add("noPU_cutByVzDiff_pvTOF/hTVXvsBcDiffwrtOrigBc", "", kTH1F, {axisBcDiff}); histos.add("noPU_cutByVzDiff_pvTOF/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); histos.add("noPU_cutByVzDiff_pvTOF/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); + histos.add("noPU_cutByVzDiff_pvTOF/hNPVvsNch", "", kTH2F, {axisNcontrib, axisNcontrib}); + + histos.add("noPU_cutByVzDiff_noFT0activityNearby/hBcColNoSel8", "", kTH1F, {axisBCs}); + histos.add("noPU_cutByVzDiff_noFT0activityNearby/hBcTVX", "", kTH1F, {axisBCs}); + histos.add("noPU_cutByVzDiff_noFT0activityNearby/hBcOrig", "", kTH1F, {axisBCs}); + histos.add("noPU_cutByVzDiff_noFT0activityNearby/hBcFT0", "", kTH1F, {axisBCs}); + histos.add("noPU_cutByVzDiff_noFT0activityNearby/hBcFV0", "", kTH1F, {axisBCs}); + histos.add("noPU_cutByVzDiff_noFT0activityNearby/hBcZDC", "", kTH1F, {axisBCs}); + histos.add("noPU_cutByVzDiff_noFT0activityNearby/hVtxFT0VsVtxCol", "", kTH2F, {axisVtxZ, axisVtxZ}); + histos.add("noPU_cutByVzDiff_noFT0activityNearby/hVtxFT0MinusVtxColVsMultT0M", "", kTH2F, {axisVtxZ, axisMultT0M}); + histos.add("noPU_cutByVzDiff_noFT0activityNearby/nTracksPV_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("noPU_cutByVzDiff_noFT0activityNearby/nTracksPV_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracks}); + histos.add("noPU_cutByVzDiff_noFT0activityNearby/nTracksPV_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracks}); + // histos.add("noPU_cutByVzDiff_noFT0activityNearby/nTracksGlobal_vs_V0A", "", kTH2F, {axisMultV0A, axisNtracksGlobal}); + // histos.add("noPU_cutByVzDiff_noFT0activityNearby/nTracksGlobal_vs_T0A", "", kTH2F, {axisMultFT0A, axisNtracksGlobal}); + // histos.add("noPU_cutByVzDiff_noFT0activityNearby/nTracksGlobal_vs_T0C", "", kTH2F, {axisMultFT0C, axisNtracksGlobal}); + histos.add("noPU_cutByVzDiff_noFT0activityNearby/hTVXvsBcDiffwrtOrigBc", "", kTH1F, {axisBcDiff}); + histos.add("noPU_cutByVzDiff_noFT0activityNearby/hColTimeResVsNcontrib", "", kTH2F, {axisNcontrib, axisColTimeRes}); + histos.add("noPU_cutByVzDiff_noFT0activityNearby/hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); + histos.add("noPU_cutByVzDiff_noFT0activityNearby/hNPVvsNch", "", kTH2F, {axisNcontrib, axisNcontrib}); + + histos.add("hNcontribColFromData", "", kTH1F, {axisNcontrib}); + histos.add("hNcontribAccFromData", "", kTH1F, {axisNcontrib}); } Preslice perCollision = aod::track::collisionId; @@ -434,11 +634,16 @@ struct LightIonsEvSelQa { double timeInterval = nTimeBins * timeBinWidthInSec; const AxisSpec axisSeconds{nTimeBins, 0, timeInterval, "seconds"}; - histos.add("hSecondsCollisions/sel8", "", kTH1D, {axisSeconds}); - histos.add("hSecondsCollisions/noPU", "", kTH1D, {axisSeconds}); - histos.add("hSecondsCollisions/noPU_underLine", "", kTH1D, {axisSeconds}); - histos.add("hSecondsCollisions/noPU_grassOnTheRight", "", kTH1D, {axisSeconds}); - histos.add("hSecondsCollisions/noPU_good", "", kTH1D, {axisSeconds}); + histos.add("hSecondsCollisions/sel8", "", kTH1F, {axisSeconds}); + histos.add("hSecondsCollisions/noPU", "", kTH1F, {axisSeconds}); + histos.add("hSecondsCollisions/noPU_underLine", "", kTH1F, {axisSeconds}); + histos.add("hSecondsCollisions/noPU_grassOnTheRight", "", kTH1F, {axisSeconds}); + histos.add("hSecondsCollisions/noPU_good", "", kTH1F, {axisSeconds}); + + const AxisSpec axisDiffMeanVz{80, -4, 4, ""}; + histos.add("hSecondsCollisions/noPU_meanDiffVz", "", kTH2F, {axisSeconds, axisDiffMeanVz}); + histos.add("hSecondsCollisions/noPU_meanDiffVz_lowMult", "", kTH2F, {axisSeconds, axisDiffMeanVz}); + histos.add("hSecondsCollisions/noPU_meanDiffVz_highMult", "", kTH2F, {axisSeconds, axisDiffMeanVz}); } // end of runNumber check @@ -482,7 +687,7 @@ struct LightIonsEvSelQa { // past bool pastActivityFT0 = 0; - bool pastActivityFDD = 0; + // bool pastActivityFDD = 0; bool pastActivityFV0 = 0; while (deltaBC < maxDeltaBC) { deltaIndex++; @@ -494,16 +699,17 @@ struct LightIonsEvSelQa { if (deltaBC < maxDeltaBC) { pastActivityFT0 |= bcPast.has_ft0(); pastActivityFV0 |= bcPast.has_fv0a(); - pastActivityFDD |= bcPast.has_fdd(); + // pastActivityFDD |= bcPast.has_fdd(); } if (deltaBC < 2) { if (bcPast.has_ft0()) { std::bitset<8> triggers = bcPast.ft0().triggerMask(); - nearbyFT0activity |= triggers[o2::ft0::RecPoints::ETriggerBits::kIsActiveSideA]; + nearbyFT0activity |= (triggers[o2::ft0::RecPoints::ETriggerBits::kIsActiveSideA] || triggers[o2::ft0::RecPoints::ETriggerBits::kIsActiveSideC]); } } } - bool pastActivity = pastActivityFT0 | pastActivityFV0 | pastActivityFDD; + // bool pastActivity = pastActivityFT0 | pastActivityFV0 | pastActivityFDD; + bool pastActivity = pastActivityFT0 | pastActivityFV0; // | pastActivityFDD; vPastActivity[indexBc] = pastActivity; // future @@ -527,7 +733,7 @@ struct LightIonsEvSelQa { if (deltaBC < 2) { if (bcFuture.has_ft0()) { std::bitset<8> triggers = bcFuture.ft0().triggerMask(); - nearbyFT0activity |= triggers[o2::ft0::RecPoints::ETriggerBits::kIsActiveSideA]; + nearbyFT0activity |= (triggers[o2::ft0::RecPoints::ETriggerBits::kIsActiveSideA] || triggers[o2::ft0::RecPoints::ETriggerBits::kIsActiveSideC]); } } } @@ -563,6 +769,25 @@ struct LightIonsEvSelQa { histos.fill(HIST("bcQA/noFutureActivity/hBcFT0"), localBC); if (!pastActivity && !futureActivity) histos.fill(HIST("bcQA/noPastFutureActivity/hBcFT0"), localBC); + + // spec bits: + std::bitset<8> triggers = bc.ft0().triggerMask(); + bool isTVX = bc.selection_bit(kIsTriggerTVX); + if (triggers[o2::ft0::RecPoints::ETriggerBits::kIsActiveSideA]) { + histos.fill(HIST("bcQA/specFT0bits/hBc_kIsActiveSideA"), localBC); + if (isTVX) + histos.fill(HIST("bcQA/specFT0bits/hBc_kIsActiveSideA_inTVX"), localBC); + } + if (triggers[o2::ft0::RecPoints::ETriggerBits::kIsActiveSideC]) { + histos.fill(HIST("bcQA/specFT0bits/hBc_kIsActiveSideC"), localBC); + if (isTVX) + histos.fill(HIST("bcQA/specFT0bits/hBc_kIsActiveSideC_inTVX"), localBC); + } + if (triggers[o2::ft0::RecPoints::ETriggerBits::kIsFlangeEvent]) { + histos.fill(HIST("bcQA/specFT0bits/hBc_kIsFlangeEvent"), localBC); + if (isTVX) + histos.fill(HIST("bcQA/specFT0bits/hBc_kIsFlangeEvent_inTVX"), localBC); + } } if (bc.has_fdd()) { histos.fill(HIST("bcQA/hBcFDD"), localBC); @@ -602,10 +827,11 @@ struct LightIonsEvSelQa { // selection decisions: bool noPU = col.selection_bit(kNoSameBunchPileup); bool pvTOFmatched = col.selection_bit(kIsVertexTOFmatched); + bool pvTRDmatched = col.selection_bit(kIsVertexTRDmatched); bool narrowTimeVeto = col.selection_bit(kNoCollInTimeRangeNarrow); bool strictTimeVeto = col.selection_bit(kNoCollInTimeRangeStrict); bool noCollSameROF = col.selection_bit(kNoCollInRofStrict); - bool bcDiffCut = (bcToClosestTVXdiff == 0); + bool bcDiffWrtClosestTVXCut = (bcToClosestTVXdiff == 0); auto bcIndex = foundBC.globalIndex(); // bool noNearbyActivity = (vPastActivity[bcIndex] == 0 && vFutureActivity[bcIndex] == 0); @@ -613,13 +839,11 @@ struct LightIonsEvSelQa { // ### count tracks of different types int nPVtracks = 0; - int nGlobalTracks = 0; + int nGlobalTracksPV = 0; + int nGlobalTracksAll = 0; // int nTOFtracks = 0; auto tracksGrouped = tracks.sliceBy(perCollision, col.globalIndex()); for (const auto& track : tracksGrouped) { - if (!track.isPVContributor()) { - continue; - } if (track.itsNCls() < 5) continue; if (track.pt() < 0.2 || track.pt() > 10) @@ -627,13 +851,21 @@ struct LightIonsEvSelQa { if (std::abs(track.eta()) > 0.8) continue; - nPVtracks++; - // nTOFtracks += track.hasTOF(); + if (track.hasITS() && track.hasTPC() && track.tpcNClsFound() > 50 && track.tpcNClsCrossedRows() > 50 && track.tpcChi2NCl() < 4) + nGlobalTracksAll++; + if (!track.isPVContributor()) { + continue; + } + nPVtracks++; if (track.hasITS() && track.hasTPC() && track.tpcNClsFound() > 50 && track.tpcNClsCrossedRows() > 50 && track.tpcChi2NCl() < 4) - nGlobalTracks++; + nGlobalTracksPV++; } // end of track loop + histos.fill(HIST("hNcontribColFromData"), nPVtracks); + if (col.selection_bit(kIsTriggerTVX)) + histos.fill(HIST("hNcontribAccFromData"), nPVtracks); + bool hasFT0 = foundBC.has_ft0(); bool hasFV0A = foundBC.has_fv0a(); @@ -651,33 +883,44 @@ struct LightIonsEvSelQa { float diffVz = vZft0 - vZ; float multV0A = hasFV0A ? col.multFV0A() : 0; + float multT0A = hasFT0 ? col.multFT0A() : 0; float multT0C = hasFT0 ? col.multFT0C() : 0; - float multT0M = multT0A + multT0C; - // bool badVzDiff = col.selection_bit(kIsGoodZvtxFT0vsPV); - // bool badVzDiff = hasFT0 && (multT0M > 5000) && (diffVz < -2.5 || diffVz > 2.5); - float meanDiff = 0.0; // cm - // O-O - if (lastRunNumber == 564356) - meanDiff = -0.01; - if (lastRunNumber == 564359) - meanDiff = -0.17; - if (lastRunNumber == 564373) - meanDiff = 0.99; - if (lastRunNumber == 564374) - meanDiff = 0.57; - // Ne-Ne - if (lastRunNumber == 564468) - meanDiff = -0.51; - if (lastRunNumber == 564468) - meanDiff = -0.60; - - // float stdDev = (multT0M > 20) ? 0.54 + 6.46 / sqrt(multT0M) : 2.0; // cm - float stdDev = (multT0M > 10) ? 0.144723 + 13.5345 / sqrt(multT0M) : 1.5; // cm - if (multT0M > 4000) - stdDev = 0.35; // cm - bool badVzDiff = diffVz < (meanDiff - stdDev * nSigmaForVzDiff - safetyDiffMargin) || diffVz > (meanDiff + stdDev * nSigmaForVzDiff + safetyDiffMargin); + if (hasFT0) { + float multT0A_uncorr = foundBC.ft0().sumAmpA(); + float multT0C_uncorr = foundBC.ft0().sumAmpC(); + float multT0M_uncorr = multT0A_uncorr + multT0C_uncorr; + + histos.fill(HIST("multT0M_vs_multSumFT0"), multT0M, multT0M_uncorr); + } + + // vZ diff (FT0 vs by tracks) + bool badVzDiff = 0; + if (confUseDiffVzCutFromEvSel) + badVzDiff = !col.selection_bit(kIsGoodZvtxFT0vsPV); + else { // tune by hand + float meanDiff = 0.0; // cm + // O-O + if (lastRunNumber == 564356) + meanDiff = -0.01; + if (lastRunNumber == 564359) + meanDiff = -0.17; + if (lastRunNumber == 564373) + meanDiff = 0.99; + if (lastRunNumber == 564374) + meanDiff = 0.57; + // Ne-Ne + if (lastRunNumber == 564468) + meanDiff = -0.51; + if (lastRunNumber == 564468) + meanDiff = -0.60; + + float stdDev = (multT0M > 10) ? 0.144723 + 13.5345 / sqrt(multT0M) : 1.5; // cm + if (multT0M > 5000) + stdDev = stdDev > 0.2 ? stdDev : 0.2; // 0.35; // cm + badVzDiff = diffVz < (meanDiff - stdDev * nSigmaForVzDiff - safetyDiffVzMargin) || diffVz > (meanDiff + stdDev * nSigmaForVzDiff + safetyDiffVzMargin); + } bool underLine = false; if (hasFT0 && nPVtracks < 45. / 40000 * multV0A - 4 && nPVtracks < 20) { @@ -688,7 +931,18 @@ struct LightIonsEvSelQa { grassOnTheRight = true; } - // study bc diff: + // study bc diff wrt original bc: + // auto bc = col.bc_as(); + auto bcOriginal = globalOrigBC % 3564; + float bcDiffWrtOriginal = bcOriginal - localBC; + bool bcDiffWrtOriginalBcCut = (bcDiffWrtOriginal == 0); + + // SPEC REMOVAL OF BC RANGES + // if (bcOriginal > 1200 && bcOriginal < 1300) + // continue; + // if (bcOriginal > 1700 && bcOriginal < 1900) + // continue; + int nContributors = col.numContrib(); float timeRes = col.collisionTimeRes(); // int64_t bcInTF = (globalBC - bcSOR) % nBCsPerTF; @@ -698,29 +952,53 @@ struct LightIonsEvSelQa { // histos.fill(HIST("hBcColTOF"), localBC); // } + float vChi2 = col.chi2(); + float vChi2perContrib = nContributors > 0 ? vChi2 / nContributors : 0; + bool goodVertexChi2 = (vChi2perContrib < 3.5); + histos.fill(HIST("noSpecSelections/hBcColNoSel8"), localBC); + histos.fill(HIST("noSpecSelections/hBcOrigNoSel8"), bcOriginal); if (noPU) { histos.fill(HIST("noPU/hBcColNoSel8"), localBC); + histos.fill(HIST("noPU/hBcOrigNoSel8"), bcOriginal); } if (noPU && pvTOFmatched) { histos.fill(HIST("noPU_pvTOFmatched/hBcColNoSel8"), localBC); } - if (bcDiffCut) { - histos.fill(HIST("bcDiffCut/hBcColNoSel8"), localBC); + if (noPU && pvTRDmatched) { + histos.fill(HIST("noPU_pvTRDmatched/hBcColNoSel8"), localBC); } - if (noPastActivity) { - histos.fill(HIST("noPastActivity/hBcColNoSel8"), localBC); + if (noPU && !pvTRDmatched) { + histos.fill(HIST("noPU_notTRDmatched/hBcColNoSel8"), localBC); } - if (noFT0activityNearby) { - histos.fill(HIST("noFT0activityNearby/hBcColNoSel8"), localBC); + if (bcDiffWrtClosestTVXCut) { + histos.fill(HIST("bcDiffWrtClosestTVXCut/hBcColNoSel8"), localBC); } - if (badVzDiff) { - histos.fill(HIST("badVzDiff/hBcColNoSel8"), localBC); + if (noPU && bcDiffWrtOriginalBcCut) { + histos.fill(HIST("noPU_bcDiffWrtOriginalBcCut/hBcColNoSel8"), localBC); + } + if (noPU && noPastActivity) { + histos.fill(HIST("noPU_noPastActivity/hBcColNoSel8"), localBC); + } + if (noPU && noFT0activityNearby) { + histos.fill(HIST("noPU_noFT0activityNearby/hBcColNoSel8"), localBC); + } + if (noPU && badVzDiff) { + histos.fill(HIST("noPU_badVzDiff/hBcColNoSel8"), localBC); } if (noPU && !badVzDiff) { histos.fill(HIST("noPU_goodVzDiff/hBcColNoSel8"), localBC); } + if (noPU && !badVzDiff && narrowTimeVeto) { + histos.fill(HIST("noPU_goodVzDiff_narrowTimeVeto/hBcColNoSel8"), localBC); + } + if (noPU && !badVzDiff && strictTimeVeto) { + histos.fill(HIST("noPU_goodVzDiff_strictTimeVeto/hBcColNoSel8"), localBC); + } + if (noPU && goodVertexChi2) { + histos.fill(HIST("noPU_goodVertexChi2/hBcColNoSel8"), localBC); + } if (narrowTimeVeto) { histos.fill(HIST("narrowTimeVeto/hBcColNoSel8"), localBC); } @@ -730,13 +1008,23 @@ struct LightIonsEvSelQa { if (noCollSameROF) { histos.fill(HIST("noCollSameROF/hBcColNoSel8"), localBC); } + if (underLine) { + histos.fill(HIST("lowMultCut/hBcColNoSel8"), localBC); + histos.fill(HIST("lowMultCut/hBcOrigNoSel8"), bcOriginal); + } if (noPU && underLine) { - histos.fill(HIST("noPU_LowMultCut/hBcColNoSel8"), localBC); + histos.fill(HIST("noPU_lowMultCut/hBcColNoSel8"), localBC); + histos.fill(HIST("noPU_lowMultCut/hBcOrigNoSel8"), bcOriginal); + } + if (grassOnTheRight) { + histos.fill(HIST("highMultCloudCut/hBcColNoSel8"), localBC); + histos.fill(HIST("highMultCloudCut/hBcOrigNoSel8"), bcOriginal); } if (noPU && grassOnTheRight) { - histos.fill(HIST("noPU_HighMultCloudCut/hBcColNoSel8"), localBC); + histos.fill(HIST("noPU_highMultCloudCut/hBcColNoSel8"), localBC); + histos.fill(HIST("noPU_highMultCloudCut/hBcOrigNoSel8"), bcOriginal); } - if (noPU && pvTOFmatched && !badVzDiff) { // noPileup_cutByVzDiff_pvTOF_noFT0act + if (noPU && !badVzDiff && pvTOFmatched) { // noPileup_cutByVzDiff_pvTOF_noFT0act histos.fill(HIST("noPU_cutByVzDiff_pvTOF/hBcColNoSel8"), localBC); } @@ -754,76 +1042,171 @@ struct LightIonsEvSelQa { histos.fill(HIST("hSecondsCollisions/noPU_grassOnTheRight"), secFromSOR); if (!underLine && !grassOnTheRight) histos.fill(HIST("hSecondsCollisions/noPU_good"), secFromSOR); + + if (std::abs(diffVz) < 4) { + histos.fill(HIST("hSecondsCollisions/noPU_meanDiffVz"), secFromSOR, diffVz); + if (multT0M < 1000) + histos.fill(HIST("hSecondsCollisions/noPU_meanDiffVz_lowMult"), secFromSOR, diffVz); + if (multT0M > 10000) + histos.fill(HIST("hSecondsCollisions/noPU_meanDiffVz_highMult"), secFromSOR, diffVz); + } } histos.fill(HIST("noSpecSelections/hBcTVX"), localBC); + histos.fill(HIST("noSpecSelections/hBcOrig"), bcOriginal); histos.fill(HIST("noSpecSelections/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); histos.fill(HIST("noSpecSelections/hColTimeResVsNcontrib"), nContributors, timeRes); + histos.fill(HIST("noSpecSelections/hVertexChi2VsNcontrib"), nContributors, vChi2perContrib); + histos.fill(HIST("noSpecSelections/hNPVvsNch"), nPVtracks, nGlobalTracksAll); if (noPU) { histos.fill(HIST("noPU/hBcTVX"), localBC); + histos.fill(HIST("noPU/hBcOrig"), bcOriginal); histos.fill(HIST("noPU/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); histos.fill(HIST("noPU/hColTimeResVsNcontrib"), nContributors, timeRes); + histos.fill(HIST("noPU/hVertexChi2VsNcontrib"), nContributors, vChi2perContrib); + histos.fill(HIST("noPU/hNPVvsNch"), nPVtracks, nGlobalTracksAll); } if (noPU && pvTOFmatched) { histos.fill(HIST("noPU_pvTOFmatched/hBcTVX"), localBC); + histos.fill(HIST("noPU_pvTOFmatched/hBcOrig"), bcOriginal); histos.fill(HIST("noPU_pvTOFmatched/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); histos.fill(HIST("noPU_pvTOFmatched/hColTimeResVsNcontrib"), nContributors, timeRes); + histos.fill(HIST("noPU_pvTOFmatched/hVertexChi2VsNcontrib"), nContributors, vChi2perContrib); + histos.fill(HIST("noPU_pvTOFmatched/hNPVvsNch"), nPVtracks, nGlobalTracksAll); + } + if (noPU && pvTRDmatched) { + histos.fill(HIST("noPU_pvTRDmatched/hBcTVX"), localBC); + histos.fill(HIST("noPU_pvTRDmatched/hBcOrig"), bcOriginal); + histos.fill(HIST("noPU_pvTRDmatched/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); + histos.fill(HIST("noPU_pvTRDmatched/hColTimeResVsNcontrib"), nContributors, timeRes); + histos.fill(HIST("noPU_pvTRDmatched/hVertexChi2VsNcontrib"), nContributors, vChi2perContrib); + histos.fill(HIST("noPU_pvTRDmatched/hNPVvsNch"), nPVtracks, nGlobalTracksAll); } - if (bcDiffCut) { - histos.fill(HIST("bcDiffCut/hBcTVX"), localBC); - histos.fill(HIST("bcDiffCut/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); - histos.fill(HIST("bcDiffCut/hColTimeResVsNcontrib"), nContributors, timeRes); + if (noPU && !pvTRDmatched) { + histos.fill(HIST("noPU_notTRDmatched/hBcTVX"), localBC); + histos.fill(HIST("noPU_notTRDmatched/hBcOrig"), bcOriginal); + histos.fill(HIST("noPU_notTRDmatched/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); + histos.fill(HIST("noPU_notTRDmatched/hColTimeResVsNcontrib"), nContributors, timeRes); + histos.fill(HIST("noPU_notTRDmatched/hNPVvsNch"), nPVtracks, nGlobalTracksAll); } - if (noPastActivity) { - histos.fill(HIST("noPastActivity/hBcTVX"), localBC); - histos.fill(HIST("noPastActivity/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); - histos.fill(HIST("noPastActivity/hColTimeResVsNcontrib"), nContributors, timeRes); + if (bcDiffWrtClosestTVXCut) { + histos.fill(HIST("bcDiffWrtClosestTVXCut/hBcTVX"), localBC); + histos.fill(HIST("bcDiffWrtClosestTVXCut/hBcOrig"), bcOriginal); + histos.fill(HIST("bcDiffWrtClosestTVXCut/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); + histos.fill(HIST("bcDiffWrtClosestTVXCut/hColTimeResVsNcontrib"), nContributors, timeRes); + histos.fill(HIST("bcDiffWrtClosestTVXCut/hNPVvsNch"), nPVtracks, nGlobalTracksAll); } - if (noFT0activityNearby) { - histos.fill(HIST("noFT0activityNearby/hBcTVX"), localBC); - histos.fill(HIST("noFT0activityNearby/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); - histos.fill(HIST("noFT0activityNearby/hColTimeResVsNcontrib"), nContributors, timeRes); + if (noPU && bcDiffWrtOriginalBcCut) { + histos.fill(HIST("noPU_bcDiffWrtOriginalBcCut/hBcTVX"), localBC); + histos.fill(HIST("noPU_bcDiffWrtOriginalBcCut/hBcOrig"), bcOriginal); + histos.fill(HIST("noPU_bcDiffWrtOriginalBcCut/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); + histos.fill(HIST("noPU_bcDiffWrtOriginalBcCut/hColTimeResVsNcontrib"), nContributors, timeRes); + histos.fill(HIST("noPU_bcDiffWrtOriginalBcCut/hNPVvsNch"), nPVtracks, nGlobalTracksAll); } - if (badVzDiff) { - histos.fill(HIST("badVzDiff/hBcTVX"), localBC); - histos.fill(HIST("badVzDiff/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); - histos.fill(HIST("badVzDiff/hColTimeResVsNcontrib"), nContributors, timeRes); + if (noPU && noPastActivity) { + histos.fill(HIST("noPU_noPastActivity/hBcTVX"), localBC); + histos.fill(HIST("noPU_noPastActivity/hBcOrig"), bcOriginal); + histos.fill(HIST("noPU_noPastActivity/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); + histos.fill(HIST("noPU_noPastActivity/hColTimeResVsNcontrib"), nContributors, timeRes); + histos.fill(HIST("noPU_noPastActivity/hNPVvsNch"), nPVtracks, nGlobalTracksAll); + } + if (noPU && noFT0activityNearby) { + histos.fill(HIST("noPU_noFT0activityNearby/hBcTVX"), localBC); + histos.fill(HIST("noPU_noFT0activityNearby/hBcOrig"), bcOriginal); + histos.fill(HIST("noPU_noFT0activityNearby/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); + histos.fill(HIST("noPU_noFT0activityNearby/hColTimeResVsNcontrib"), nContributors, timeRes); + histos.fill(HIST("noPU_noFT0activityNearby/hNPVvsNch"), nPVtracks, nGlobalTracksAll); + } + if (noPU && badVzDiff) { + histos.fill(HIST("noPU_badVzDiff/hBcTVX"), localBC); + histos.fill(HIST("noPU_badVzDiff/hBcOrig"), bcOriginal); + histos.fill(HIST("noPU_badVzDiff/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); + histos.fill(HIST("noPU_badVzDiff/hColTimeResVsNcontrib"), nContributors, timeRes); + histos.fill(HIST("noPU_badVzDiff/hVertexChi2VsNcontrib"), nContributors, vChi2perContrib); + histos.fill(HIST("noPU_badVzDiff/hNPVvsNch"), nPVtracks, nGlobalTracksAll); } if (noPU && !badVzDiff) { histos.fill(HIST("noPU_goodVzDiff/hBcTVX"), localBC); + histos.fill(HIST("noPU_goodVzDiff/hBcOrig"), bcOriginal); histos.fill(HIST("noPU_goodVzDiff/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); histos.fill(HIST("noPU_goodVzDiff/hColTimeResVsNcontrib"), nContributors, timeRes); + histos.fill(HIST("noPU_goodVzDiff/hVertexChi2VsNcontrib"), nContributors, vChi2perContrib); + histos.fill(HIST("noPU_goodVzDiff/hNPVvsNch"), nPVtracks, nGlobalTracksAll); + } + if (noPU && !badVzDiff && narrowTimeVeto) { + histos.fill(HIST("noPU_goodVzDiff_narrowTimeVeto/hBcTVX"), localBC); + histos.fill(HIST("noPU_goodVzDiff_narrowTimeVeto/hBcOrig"), bcOriginal); + histos.fill(HIST("noPU_goodVzDiff_narrowTimeVeto/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); + histos.fill(HIST("noPU_goodVzDiff_narrowTimeVeto/hColTimeResVsNcontrib"), nContributors, timeRes); + histos.fill(HIST("noPU_goodVzDiff_narrowTimeVeto/hVertexChi2VsNcontrib"), nContributors, vChi2perContrib); + histos.fill(HIST("noPU_goodVzDiff_narrowTimeVeto/hNPVvsNch"), nPVtracks, nGlobalTracksAll); + } + if (noPU && !badVzDiff && strictTimeVeto) { + histos.fill(HIST("noPU_goodVzDiff_strictTimeVeto/hBcTVX"), localBC); + histos.fill(HIST("noPU_goodVzDiff_strictTimeVeto/hBcOrig"), bcOriginal); + histos.fill(HIST("noPU_goodVzDiff_strictTimeVeto/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); + histos.fill(HIST("noPU_goodVzDiff_strictTimeVeto/hColTimeResVsNcontrib"), nContributors, timeRes); + histos.fill(HIST("noPU_goodVzDiff_strictTimeVeto/hVertexChi2VsNcontrib"), nContributors, vChi2perContrib); + histos.fill(HIST("noPU_goodVzDiff_strictTimeVeto/hNPVvsNch"), nPVtracks, nGlobalTracksAll); + } + if (noPU && goodVertexChi2) { + histos.fill(HIST("noPU_goodVertexChi2/hBcTVX"), localBC); + histos.fill(HIST("noPU_goodVertexChi2/hBcOrig"), bcOriginal); + histos.fill(HIST("noPU_goodVertexChi2/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); + histos.fill(HIST("noPU_goodVertexChi2/hColTimeResVsNcontrib"), nContributors, timeRes); + histos.fill(HIST("noPU_goodVertexChi2/hNPVvsNch"), nPVtracks, nGlobalTracksAll); } if (narrowTimeVeto) { histos.fill(HIST("narrowTimeVeto/hBcTVX"), localBC); + histos.fill(HIST("narrowTimeVeto/hBcOrig"), bcOriginal); histos.fill(HIST("narrowTimeVeto/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); histos.fill(HIST("narrowTimeVeto/hColTimeResVsNcontrib"), nContributors, timeRes); + histos.fill(HIST("narrowTimeVeto/hNPVvsNch"), nPVtracks, nGlobalTracksAll); } if (strictTimeVeto) { histos.fill(HIST("strictTimeVeto/hBcTVX"), localBC); + histos.fill(HIST("strictTimeVeto/hBcOrig"), bcOriginal); histos.fill(HIST("strictTimeVeto/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); histos.fill(HIST("strictTimeVeto/hColTimeResVsNcontrib"), nContributors, timeRes); + histos.fill(HIST("strictTimeVeto/hNPVvsNch"), nPVtracks, nGlobalTracksAll); } if (noCollSameROF) { histos.fill(HIST("noCollSameROF/hBcTVX"), localBC); + histos.fill(HIST("noCollSameROF/hBcOrig"), bcOriginal); histos.fill(HIST("noCollSameROF/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); histos.fill(HIST("noCollSameROF/hColTimeResVsNcontrib"), nContributors, timeRes); + histos.fill(HIST("noCollSameROF/hNPVvsNch"), nPVtracks, nGlobalTracksAll); } if (noPU && underLine) { - histos.fill(HIST("noPU_LowMultCut/hBcTVX"), localBC); - histos.fill(HIST("noPU_LowMultCut/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); - histos.fill(HIST("noPU_LowMultCut/hColTimeResVsNcontrib"), nContributors, timeRes); + histos.fill(HIST("noPU_lowMultCut/hBcTVX"), localBC); + histos.fill(HIST("noPU_lowMultCut/hBcOrig"), bcOriginal); + histos.fill(HIST("noPU_lowMultCut/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); + histos.fill(HIST("noPU_lowMultCut/hColTimeResVsNcontrib"), nContributors, timeRes); + histos.fill(HIST("noPU_lowMultCut/hVertexChi2VsNcontrib"), nContributors, vChi2perContrib); + histos.fill(HIST("noPU_lowMultCut/hNPVvsNch"), nPVtracks, nGlobalTracksAll); } if (noPU && grassOnTheRight) { - histos.fill(HIST("noPU_HighMultCloudCut/hBcTVX"), localBC); - histos.fill(HIST("noPU_HighMultCloudCut/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); - histos.fill(HIST("noPU_HighMultCloudCut/hColTimeResVsNcontrib"), nContributors, timeRes); + histos.fill(HIST("noPU_highMultCloudCut/hBcTVX"), localBC); + histos.fill(HIST("noPU_highMultCloudCut/hBcOrig"), bcOriginal); + histos.fill(HIST("noPU_highMultCloudCut/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); + histos.fill(HIST("noPU_highMultCloudCut/hColTimeResVsNcontrib"), nContributors, timeRes); + histos.fill(HIST("noPU_highMultCloudCut/hVertexChi2VsNcontrib"), nContributors, vChi2perContrib); + histos.fill(HIST("noPU_highMultCloudCut/hNPVvsNch"), nPVtracks, nGlobalTracksAll); } - if (noPU && pvTOFmatched && !badVzDiff) { // noPileup_cutByVzDiff_pvTOF_noFT0act + if (noPU && !badVzDiff && pvTOFmatched) { // noPileup_cutByVzDiff_pvTOF_noFT0act histos.fill(HIST("noPU_cutByVzDiff_pvTOF/hBcTVX"), localBC); + histos.fill(HIST("noPU_cutByVzDiff_pvTOF/hBcOrig"), bcOriginal); histos.fill(HIST("noPU_cutByVzDiff_pvTOF/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); histos.fill(HIST("noPU_cutByVzDiff_pvTOF/hColTimeResVsNcontrib"), nContributors, timeRes); + histos.fill(HIST("noPU_cutByVzDiff_pvTOF/hNPVvsNch"), nPVtracks, nGlobalTracksAll); + } + if (noPU && !badVzDiff && noFT0activityNearby) { + histos.fill(HIST("noPU_cutByVzDiff_noFT0activityNearby/hBcTVX"), localBC); + histos.fill(HIST("noPU_cutByVzDiff_noFT0activityNearby/hBcOrig"), bcOriginal); + histos.fill(HIST("noPU_cutByVzDiff_noFT0activityNearby/hColBcDiffVsNcontrib"), nContributors, bcToClosestTVXdiff); + histos.fill(HIST("noPU_cutByVzDiff_noFT0activityNearby/hColTimeResVsNcontrib"), nContributors, timeRes); + histos.fill(HIST("noPU_cutByVzDiff_noFT0activityNearby/hNPVvsNch"), nPVtracks, nGlobalTracksAll); } if (foundBC.has_ft0()) { @@ -834,197 +1217,306 @@ struct LightIonsEvSelQa { histos.fill(HIST("noSpecSelections/hVtxFT0VsVtxCol"), vZft0, vZ); histos.fill(HIST("noSpecSelections/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); histos.fill(HIST("noSpecSelections/nTracksPV_vs_T0A"), multT0A, nPVtracks); - histos.fill(HIST("noSpecSelections/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracks); + histos.fill(HIST("noSpecSelections/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracksPV); histos.fill(HIST("noSpecSelections/nTracksPV_vs_T0C"), multT0C, nPVtracks); - histos.fill(HIST("noSpecSelections/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracks); + histos.fill(HIST("noSpecSelections/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracksPV); if (noPU) { histos.fill(HIST("noPU/hBcFT0"), localBC); histos.fill(HIST("noPU/hVtxFT0VsVtxCol"), vZft0, vZ); histos.fill(HIST("noPU/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); histos.fill(HIST("noPU/nTracksPV_vs_T0A"), multT0A, nPVtracks); - histos.fill(HIST("noPU/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracks); + histos.fill(HIST("noPU/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracksPV); histos.fill(HIST("noPU/nTracksPV_vs_T0C"), multT0C, nPVtracks); - histos.fill(HIST("noPU/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracks); + histos.fill(HIST("noPU/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracksPV); } if (noPU && pvTOFmatched) { histos.fill(HIST("noPU_pvTOFmatched/hBcFT0"), localBC); histos.fill(HIST("noPU_pvTOFmatched/hVtxFT0VsVtxCol"), vZft0, vZ); histos.fill(HIST("noPU_pvTOFmatched/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); histos.fill(HIST("noPU_pvTOFmatched/nTracksPV_vs_T0A"), multT0A, nPVtracks); - histos.fill(HIST("noPU_pvTOFmatched/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracks); + histos.fill(HIST("noPU_pvTOFmatched/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracksPV); histos.fill(HIST("noPU_pvTOFmatched/nTracksPV_vs_T0C"), multT0C, nPVtracks); - histos.fill(HIST("noPU_pvTOFmatched/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracks); - } - if (bcDiffCut) { - histos.fill(HIST("bcDiffCut/hBcFT0"), localBC); - histos.fill(HIST("bcDiffCut/hVtxFT0VsVtxCol"), vZft0, vZ); - histos.fill(HIST("bcDiffCut/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); - histos.fill(HIST("bcDiffCut/nTracksPV_vs_T0A"), multT0A, nPVtracks); - histos.fill(HIST("bcDiffCut/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracks); - histos.fill(HIST("bcDiffCut/nTracksPV_vs_T0C"), multT0C, nPVtracks); - histos.fill(HIST("bcDiffCut/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracks); - } - if (badVzDiff) { - histos.fill(HIST("badVzDiff/hBcFT0"), localBC); - histos.fill(HIST("badVzDiff/hVtxFT0VsVtxCol"), vZft0, vZ); - histos.fill(HIST("badVzDiff/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); - histos.fill(HIST("badVzDiff/nTracksPV_vs_T0A"), multT0A, nPVtracks); - histos.fill(HIST("badVzDiff/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracks); - histos.fill(HIST("badVzDiff/nTracksPV_vs_T0C"), multT0C, nPVtracks); - histos.fill(HIST("badVzDiff/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracks); + histos.fill(HIST("noPU_pvTOFmatched/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracksPV); + } + if (noPU && pvTRDmatched) { + histos.fill(HIST("noPU_pvTRDmatched/hBcFT0"), localBC); + histos.fill(HIST("noPU_pvTRDmatched/hVtxFT0VsVtxCol"), vZft0, vZ); + histos.fill(HIST("noPU_pvTRDmatched/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); + histos.fill(HIST("noPU_pvTRDmatched/nTracksPV_vs_T0A"), multT0A, nPVtracks); + histos.fill(HIST("noPU_pvTRDmatched/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracksPV); + histos.fill(HIST("noPU_pvTRDmatched/nTracksPV_vs_T0C"), multT0C, nPVtracks); + histos.fill(HIST("noPU_pvTRDmatched/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracksPV); + } + if (noPU && !pvTRDmatched) { + histos.fill(HIST("noPU_notTRDmatched/hBcFT0"), localBC); + histos.fill(HIST("noPU_notTRDmatched/hVtxFT0VsVtxCol"), vZft0, vZ); + histos.fill(HIST("noPU_notTRDmatched/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); + histos.fill(HIST("noPU_notTRDmatched/nTracksPV_vs_T0A"), multT0A, nPVtracks); + histos.fill(HIST("noPU_notTRDmatched/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracksPV); + histos.fill(HIST("noPU_notTRDmatched/nTracksPV_vs_T0C"), multT0C, nPVtracks); + histos.fill(HIST("noPU_notTRDmatched/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracksPV); + } + if (bcDiffWrtClosestTVXCut) { + histos.fill(HIST("bcDiffWrtClosestTVXCut/hBcFT0"), localBC); + histos.fill(HIST("bcDiffWrtClosestTVXCut/hVtxFT0VsVtxCol"), vZft0, vZ); + histos.fill(HIST("bcDiffWrtClosestTVXCut/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); + histos.fill(HIST("bcDiffWrtClosestTVXCut/nTracksPV_vs_T0A"), multT0A, nPVtracks); + // histos.fill(HIST("bcDiffWrtClosestTVXCut/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracksPV); + histos.fill(HIST("bcDiffWrtClosestTVXCut/nTracksPV_vs_T0C"), multT0C, nPVtracks); + // histos.fill(HIST("bcDiffWrtClosestTVXCut/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracksPV); + } + if (noPU && bcDiffWrtOriginalBcCut) { + histos.fill(HIST("noPU_bcDiffWrtOriginalBcCut/hBcFT0"), localBC); + histos.fill(HIST("noPU_bcDiffWrtOriginalBcCut/hVtxFT0VsVtxCol"), vZft0, vZ); + histos.fill(HIST("noPU_bcDiffWrtOriginalBcCut/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); + histos.fill(HIST("noPU_bcDiffWrtOriginalBcCut/nTracksPV_vs_T0A"), multT0A, nPVtracks); + // histos.fill(HIST("noPU_bcDiffWrtOriginalBcCut/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracksPV); + histos.fill(HIST("noPU_bcDiffWrtOriginalBcCut/nTracksPV_vs_T0C"), multT0C, nPVtracks); + // histos.fill(HIST("noPU_bcDiffWrtOriginalBcCut/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracksPV); + } + if (noPU && badVzDiff) { + histos.fill(HIST("noPU_badVzDiff/hBcFT0"), localBC); + histos.fill(HIST("noPU_badVzDiff/hVtxFT0VsVtxCol"), vZft0, vZ); + histos.fill(HIST("noPU_badVzDiff/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); + histos.fill(HIST("noPU_badVzDiff/nTracksPV_vs_T0A"), multT0A, nPVtracks); + histos.fill(HIST("noPU_badVzDiff/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracksPV); + histos.fill(HIST("noPU_badVzDiff/nTracksPV_vs_T0C"), multT0C, nPVtracks); + histos.fill(HIST("noPU_badVzDiff/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracksPV); } if (noPU && !badVzDiff) { histos.fill(HIST("noPU_goodVzDiff/hBcFT0"), localBC); histos.fill(HIST("noPU_goodVzDiff/hVtxFT0VsVtxCol"), vZft0, vZ); histos.fill(HIST("noPU_goodVzDiff/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); histos.fill(HIST("noPU_goodVzDiff/nTracksPV_vs_T0A"), multT0A, nPVtracks); - histos.fill(HIST("noPU_goodVzDiff/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracks); + histos.fill(HIST("noPU_goodVzDiff/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracksPV); histos.fill(HIST("noPU_goodVzDiff/nTracksPV_vs_T0C"), multT0C, nPVtracks); - histos.fill(HIST("noPU_goodVzDiff/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracks); - } - if (noPastActivity) { - histos.fill(HIST("noPastActivity/hBcFT0"), localBC); - histos.fill(HIST("noPastActivity/hVtxFT0VsVtxCol"), vZft0, vZ); - histos.fill(HIST("noPastActivity/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); - histos.fill(HIST("noPastActivity/nTracksPV_vs_T0A"), multT0A, nPVtracks); - histos.fill(HIST("noPastActivity/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracks); - histos.fill(HIST("noPastActivity/nTracksPV_vs_T0C"), multT0C, nPVtracks); - histos.fill(HIST("noPastActivity/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracks); - } - if (noFT0activityNearby) { - histos.fill(HIST("noFT0activityNearby/hBcFT0"), localBC); - histos.fill(HIST("noFT0activityNearby/hVtxFT0VsVtxCol"), vZft0, vZ); - histos.fill(HIST("noFT0activityNearby/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); - histos.fill(HIST("noFT0activityNearby/nTracksPV_vs_T0A"), multT0A, nPVtracks); - histos.fill(HIST("noFT0activityNearby/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracks); - histos.fill(HIST("noFT0activityNearby/nTracksPV_vs_T0C"), multT0C, nPVtracks); - histos.fill(HIST("noFT0activityNearby/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracks); + histos.fill(HIST("noPU_goodVzDiff/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracksPV); + } + if (noPU && !badVzDiff && narrowTimeVeto) { + histos.fill(HIST("noPU_goodVzDiff_narrowTimeVeto/hBcFT0"), localBC); + histos.fill(HIST("noPU_goodVzDiff_narrowTimeVeto/hVtxFT0VsVtxCol"), vZft0, vZ); + histos.fill(HIST("noPU_goodVzDiff_narrowTimeVeto/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); + histos.fill(HIST("noPU_goodVzDiff_narrowTimeVeto/nTracksPV_vs_T0A"), multT0A, nPVtracks); + histos.fill(HIST("noPU_goodVzDiff_narrowTimeVeto/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracksPV); + histos.fill(HIST("noPU_goodVzDiff_narrowTimeVeto/nTracksPV_vs_T0C"), multT0C, nPVtracks); + histos.fill(HIST("noPU_goodVzDiff_narrowTimeVeto/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracksPV); + } + if (noPU && !badVzDiff && strictTimeVeto) { + histos.fill(HIST("noPU_goodVzDiff_strictTimeVeto/hBcFT0"), localBC); + histos.fill(HIST("noPU_goodVzDiff_strictTimeVeto/hVtxFT0VsVtxCol"), vZft0, vZ); + histos.fill(HIST("noPU_goodVzDiff_strictTimeVeto/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); + histos.fill(HIST("noPU_goodVzDiff_strictTimeVeto/nTracksPV_vs_T0A"), multT0A, nPVtracks); + histos.fill(HIST("noPU_goodVzDiff_strictTimeVeto/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracksPV); + histos.fill(HIST("noPU_goodVzDiff_strictTimeVeto/nTracksPV_vs_T0C"), multT0C, nPVtracks); + histos.fill(HIST("noPU_goodVzDiff_strictTimeVeto/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracksPV); + } + if (noPU && noPastActivity) { + histos.fill(HIST("noPU_noPastActivity/hBcFT0"), localBC); + histos.fill(HIST("noPU_noPastActivity/hVtxFT0VsVtxCol"), vZft0, vZ); + histos.fill(HIST("noPU_noPastActivity/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); + histos.fill(HIST("noPU_noPastActivity/nTracksPV_vs_T0A"), multT0A, nPVtracks); + // histos.fill(HIST("noPU_noPastActivity/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracksPV); + histos.fill(HIST("noPU_noPastActivity/nTracksPV_vs_T0C"), multT0C, nPVtracks); + // histos.fill(HIST("noPU_noPastActivity/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracksPV); + } + if (noPU && noFT0activityNearby) { + histos.fill(HIST("noPU_noFT0activityNearby/hBcFT0"), localBC); + histos.fill(HIST("noPU_noFT0activityNearby/hVtxFT0VsVtxCol"), vZft0, vZ); + histos.fill(HIST("noPU_noFT0activityNearby/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); + histos.fill(HIST("noPU_noFT0activityNearby/nTracksPV_vs_T0A"), multT0A, nPVtracks); + // histos.fill(HIST("noPU_noFT0activityNearby/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracksPV); + histos.fill(HIST("noPU_noFT0activityNearby/nTracksPV_vs_T0C"), multT0C, nPVtracks); + // histos.fill(HIST("noPU_noFT0activityNearby/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracksPV); + } + if (noPU && goodVertexChi2) { + histos.fill(HIST("noPU_goodVertexChi2/hBcFT0"), localBC); + histos.fill(HIST("noPU_goodVertexChi2/hVtxFT0VsVtxCol"), vZft0, vZ); + histos.fill(HIST("noPU_goodVertexChi2/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); + histos.fill(HIST("noPU_goodVertexChi2/nTracksPV_vs_T0A"), multT0A, nPVtracks); + // histos.fill(HIST("noPU_goodVertexChi2/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracksPV); + histos.fill(HIST("noPU_goodVertexChi2/nTracksPV_vs_T0C"), multT0C, nPVtracks); + // histos.fill(HIST("noPU_goodVertexChi2/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracksPV); } if (narrowTimeVeto) { histos.fill(HIST("narrowTimeVeto/hBcFT0"), localBC); histos.fill(HIST("narrowTimeVeto/hVtxFT0VsVtxCol"), vZft0, vZ); histos.fill(HIST("narrowTimeVeto/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); histos.fill(HIST("narrowTimeVeto/nTracksPV_vs_T0A"), multT0A, nPVtracks); - histos.fill(HIST("narrowTimeVeto/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracks); + histos.fill(HIST("narrowTimeVeto/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracksPV); histos.fill(HIST("narrowTimeVeto/nTracksPV_vs_T0C"), multT0C, nPVtracks); - histos.fill(HIST("narrowTimeVeto/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracks); + histos.fill(HIST("narrowTimeVeto/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracksPV); } if (strictTimeVeto) { histos.fill(HIST("strictTimeVeto/hBcFT0"), localBC); histos.fill(HIST("strictTimeVeto/hVtxFT0VsVtxCol"), vZft0, vZ); histos.fill(HIST("strictTimeVeto/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); histos.fill(HIST("strictTimeVeto/nTracksPV_vs_T0A"), multT0A, nPVtracks); - histos.fill(HIST("strictTimeVeto/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracks); + histos.fill(HIST("strictTimeVeto/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracksPV); histos.fill(HIST("strictTimeVeto/nTracksPV_vs_T0C"), multT0C, nPVtracks); - histos.fill(HIST("strictTimeVeto/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracks); + histos.fill(HIST("strictTimeVeto/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracksPV); } if (noCollSameROF) { histos.fill(HIST("noCollSameROF/hBcFT0"), localBC); histos.fill(HIST("noCollSameROF/hVtxFT0VsVtxCol"), vZft0, vZ); histos.fill(HIST("noCollSameROF/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); histos.fill(HIST("noCollSameROF/nTracksPV_vs_T0A"), multT0A, nPVtracks); - histos.fill(HIST("noCollSameROF/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracks); + histos.fill(HIST("noCollSameROF/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracksPV); histos.fill(HIST("noCollSameROF/nTracksPV_vs_T0C"), multT0C, nPVtracks); - histos.fill(HIST("noCollSameROF/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracks); + histos.fill(HIST("noCollSameROF/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracksPV); } if (noPU && underLine) { - histos.fill(HIST("noPU_LowMultCut/hBcFT0"), localBC); - histos.fill(HIST("noPU_LowMultCut/hVtxFT0VsVtxCol"), vZft0, vZ); - histos.fill(HIST("noPU_LowMultCut/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); - histos.fill(HIST("noPU_LowMultCut/nTracksPV_vs_T0A"), multT0A, nPVtracks); - histos.fill(HIST("noPU_LowMultCut/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracks); - histos.fill(HIST("noPU_LowMultCut/nTracksPV_vs_T0C"), multT0C, nPVtracks); - histos.fill(HIST("noPU_LowMultCut/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracks); + histos.fill(HIST("noPU_lowMultCut/hBcFT0"), localBC); + histos.fill(HIST("noPU_lowMultCut/hVtxFT0VsVtxCol"), vZft0, vZ); + histos.fill(HIST("noPU_lowMultCut/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); + histos.fill(HIST("noPU_lowMultCut/nTracksPV_vs_T0A"), multT0A, nPVtracks); + histos.fill(HIST("noPU_lowMultCut/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracksPV); + histos.fill(HIST("noPU_lowMultCut/nTracksPV_vs_T0C"), multT0C, nPVtracks); + histos.fill(HIST("noPU_lowMultCut/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracksPV); } if (noPU && grassOnTheRight) { - histos.fill(HIST("noPU_HighMultCloudCut/hBcFT0"), localBC); - histos.fill(HIST("noPU_HighMultCloudCut/hVtxFT0VsVtxCol"), vZft0, vZ); - histos.fill(HIST("noPU_HighMultCloudCut/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); - histos.fill(HIST("noPU_HighMultCloudCut/nTracksPV_vs_T0A"), multT0A, nPVtracks); - histos.fill(HIST("noPU_HighMultCloudCut/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracks); - histos.fill(HIST("noPU_HighMultCloudCut/nTracksPV_vs_T0C"), multT0C, nPVtracks); - histos.fill(HIST("noPU_HighMultCloudCut/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracks); - } - if (noPU && pvTOFmatched && !badVzDiff) { // noPileup_cutByVzDiff_pvTOF_noFT0act + histos.fill(HIST("noPU_highMultCloudCut/hBcFT0"), localBC); + histos.fill(HIST("noPU_highMultCloudCut/hVtxFT0VsVtxCol"), vZft0, vZ); + histos.fill(HIST("noPU_highMultCloudCut/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); + histos.fill(HIST("noPU_highMultCloudCut/nTracksPV_vs_T0A"), multT0A, nPVtracks); + histos.fill(HIST("noPU_highMultCloudCut/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracksPV); + histos.fill(HIST("noPU_highMultCloudCut/nTracksPV_vs_T0C"), multT0C, nPVtracks); + histos.fill(HIST("noPU_highMultCloudCut/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracksPV); + } + if (noPU && !badVzDiff && pvTOFmatched) { // noPileup_cutByVzDiff_pvTOF_noFT0act histos.fill(HIST("noPU_cutByVzDiff_pvTOF/hBcFT0"), localBC); histos.fill(HIST("noPU_cutByVzDiff_pvTOF/hVtxFT0VsVtxCol"), vZft0, vZ); histos.fill(HIST("noPU_cutByVzDiff_pvTOF/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); histos.fill(HIST("noPU_cutByVzDiff_pvTOF/nTracksPV_vs_T0A"), multT0A, nPVtracks); - histos.fill(HIST("noPU_cutByVzDiff_pvTOF/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracks); + histos.fill(HIST("noPU_cutByVzDiff_pvTOF/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracksPV); histos.fill(HIST("noPU_cutByVzDiff_pvTOF/nTracksPV_vs_T0C"), multT0C, nPVtracks); - histos.fill(HIST("noPU_cutByVzDiff_pvTOF/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracks); + histos.fill(HIST("noPU_cutByVzDiff_pvTOF/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracksPV); + } + if (noPU && !badVzDiff && noFT0activityNearby) { + histos.fill(HIST("noPU_cutByVzDiff_noFT0activityNearby/hBcFT0"), localBC); + histos.fill(HIST("noPU_cutByVzDiff_noFT0activityNearby/hVtxFT0VsVtxCol"), vZft0, vZ); + histos.fill(HIST("noPU_cutByVzDiff_noFT0activityNearby/hVtxFT0MinusVtxColVsMultT0M"), diffVz, multT0A + multT0C); + histos.fill(HIST("noPU_cutByVzDiff_noFT0activityNearby/nTracksPV_vs_T0A"), multT0A, nPVtracks); + // histos.fill(HIST("noPU_cutByVzDiff_noFT0activityNearby/nTracksGlobal_vs_T0A"), multT0A, nGlobalTracksPV); + histos.fill(HIST("noPU_cutByVzDiff_noFT0activityNearby/nTracksPV_vs_T0C"), multT0C, nPVtracks); + // histos.fill(HIST("noPU_cutByVzDiff_noFT0activityNearby/nTracksGlobal_vs_T0C"), multT0C, nGlobalTracksPV); } } if (foundBC.has_fv0a()) { histos.fill(HIST("noSpecSelections/hBcFV0"), localBC); histos.fill(HIST("noSpecSelections/nTracksPV_vs_V0A"), multV0A, nPVtracks); - histos.fill(HIST("noSpecSelections/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracks); + histos.fill(HIST("noSpecSelections/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracksPV); if (noPU) { histos.fill(HIST("noPU/hBcFV0"), localBC); histos.fill(HIST("noPU/nTracksPV_vs_V0A"), multV0A, nPVtracks); - histos.fill(HIST("noPU/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracks); + histos.fill(HIST("noPU/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracksPV); } if (noPU && pvTOFmatched) { histos.fill(HIST("noPU_pvTOFmatched/hBcFV0"), localBC); histos.fill(HIST("noPU_pvTOFmatched/nTracksPV_vs_V0A"), multV0A, nPVtracks); - histos.fill(HIST("noPU_pvTOFmatched/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracks); + histos.fill(HIST("noPU_pvTOFmatched/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracksPV); } - if (bcDiffCut) { - histos.fill(HIST("bcDiffCut/hBcFV0"), localBC); - histos.fill(HIST("bcDiffCut/nTracksPV_vs_V0A"), multV0A, nPVtracks); - histos.fill(HIST("bcDiffCut/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracks); + if (noPU && pvTRDmatched) { + histos.fill(HIST("noPU_pvTRDmatched/hBcFV0"), localBC); + histos.fill(HIST("noPU_pvTRDmatched/nTracksPV_vs_V0A"), multV0A, nPVtracks); + histos.fill(HIST("noPU_pvTRDmatched/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracksPV); } - if (badVzDiff) { - histos.fill(HIST("badVzDiff/hBcFV0"), localBC); - histos.fill(HIST("badVzDiff/nTracksPV_vs_V0A"), multV0A, nPVtracks); - histos.fill(HIST("badVzDiff/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracks); + if (noPU && !pvTRDmatched) { + histos.fill(HIST("noPU_notTRDmatched/hBcFV0"), localBC); + histos.fill(HIST("noPU_notTRDmatched/nTracksPV_vs_V0A"), multV0A, nPVtracks); + histos.fill(HIST("noPU_notTRDmatched/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracksPV); + } + if (noPU && pvTOFmatched && !pvTRDmatched) { // SPEC CHECK! + histos.fill(HIST("noPU_pvTOFmatched_notTRDmatched/hBcFV0"), localBC); + histos.fill(HIST("noPU_pvTOFmatched_notTRDmatched/nTracksPV_vs_V0A"), multV0A, nPVtracks); + histos.fill(HIST("noPU_pvTOFmatched_notTRDmatched/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracksPV); + } + if (bcDiffWrtClosestTVXCut) { + histos.fill(HIST("bcDiffWrtClosestTVXCut/hBcFV0"), localBC); + histos.fill(HIST("bcDiffWrtClosestTVXCut/nTracksPV_vs_V0A"), multV0A, nPVtracks); + // histos.fill(HIST("bcDiffWrtClosestTVXCut/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracksPV); + } + if (noPU && bcDiffWrtOriginalBcCut) { + histos.fill(HIST("noPU_bcDiffWrtOriginalBcCut/hBcFV0"), localBC); + histos.fill(HIST("noPU_bcDiffWrtOriginalBcCut/nTracksPV_vs_V0A"), multV0A, nPVtracks); + // histos.fill(HIST("noPU_bcDiffWrtOriginalBcCut/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracksPV); + } + if (noPU && badVzDiff) { + histos.fill(HIST("noPU_badVzDiff/hBcFV0"), localBC); + histos.fill(HIST("noPU_badVzDiff/nTracksPV_vs_V0A"), multV0A, nPVtracks); + histos.fill(HIST("noPU_badVzDiff/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracksPV); } if (noPU && !badVzDiff) { histos.fill(HIST("noPU_goodVzDiff/hBcFV0"), localBC); histos.fill(HIST("noPU_goodVzDiff/nTracksPV_vs_V0A"), multV0A, nPVtracks); - histos.fill(HIST("noPU_goodVzDiff/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracks); + histos.fill(HIST("noPU_goodVzDiff/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracksPV); + } + if (noPU && !badVzDiff && narrowTimeVeto) { + histos.fill(HIST("noPU_goodVzDiff_narrowTimeVeto/hBcFV0"), localBC); + histos.fill(HIST("noPU_goodVzDiff_narrowTimeVeto/nTracksPV_vs_V0A"), multV0A, nPVtracks); + histos.fill(HIST("noPU_goodVzDiff_narrowTimeVeto/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracksPV); } - if (noPastActivity) { - histos.fill(HIST("noPastActivity/hBcFV0"), localBC); - histos.fill(HIST("noPastActivity/nTracksPV_vs_V0A"), multV0A, nPVtracks); - histos.fill(HIST("noPastActivity/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracks); + if (noPU && !badVzDiff && strictTimeVeto) { + histos.fill(HIST("noPU_goodVzDiff_strictTimeVeto/hBcFV0"), localBC); + histos.fill(HIST("noPU_goodVzDiff_strictTimeVeto/nTracksPV_vs_V0A"), multV0A, nPVtracks); + histos.fill(HIST("noPU_goodVzDiff_strictTimeVeto/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracksPV); } - if (noFT0activityNearby) { - histos.fill(HIST("noFT0activityNearby/hBcFV0"), localBC); - histos.fill(HIST("noFT0activityNearby/nTracksPV_vs_V0A"), multV0A, nPVtracks); - histos.fill(HIST("noFT0activityNearby/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracks); + if (noPU && noPastActivity) { + histos.fill(HIST("noPU_noPastActivity/hBcFV0"), localBC); + histos.fill(HIST("noPU_noPastActivity/nTracksPV_vs_V0A"), multV0A, nPVtracks); + // histos.fill(HIST("noPU_noPastActivity/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracksPV); + } + if (noPU && noFT0activityNearby) { + histos.fill(HIST("noPU_noFT0activityNearby/hBcFV0"), localBC); + histos.fill(HIST("noPU_noFT0activityNearby/nTracksPV_vs_V0A"), multV0A, nPVtracks); + // histos.fill(HIST("noPU_noFT0activityNearby/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracksPV); + } + if (noPU && goodVertexChi2) { + histos.fill(HIST("noPU_goodVertexChi2/hBcFV0"), localBC); + histos.fill(HIST("noPU_goodVertexChi2/nTracksPV_vs_V0A"), multV0A, nPVtracks); + // histos.fill(HIST("noPU_goodVertexChi2/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracksPV); } if (narrowTimeVeto) { histos.fill(HIST("narrowTimeVeto/hBcFV0"), localBC); histos.fill(HIST("narrowTimeVeto/nTracksPV_vs_V0A"), multV0A, nPVtracks); - histos.fill(HIST("narrowTimeVeto/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracks); + histos.fill(HIST("narrowTimeVeto/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracksPV); } if (strictTimeVeto) { histos.fill(HIST("strictTimeVeto/hBcFV0"), localBC); histos.fill(HIST("strictTimeVeto/nTracksPV_vs_V0A"), multV0A, nPVtracks); - histos.fill(HIST("strictTimeVeto/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracks); + histos.fill(HIST("strictTimeVeto/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracksPV); } if (noCollSameROF) { histos.fill(HIST("noCollSameROF/hBcFV0"), localBC); histos.fill(HIST("noCollSameROF/nTracksPV_vs_V0A"), multV0A, nPVtracks); - histos.fill(HIST("noCollSameROF/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracks); + histos.fill(HIST("noCollSameROF/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracksPV); + } + if (underLine) { + histos.fill(HIST("lowMultCut/nTracksPV_vs_V0A"), multV0A, nPVtracks); } if (noPU && underLine) { - histos.fill(HIST("noPU_LowMultCut/hBcFV0"), localBC); - histos.fill(HIST("noPU_LowMultCut/nTracksPV_vs_V0A"), multV0A, nPVtracks); - histos.fill(HIST("noPU_LowMultCut/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracks); + histos.fill(HIST("noPU_lowMultCut/hBcFV0"), localBC); + histos.fill(HIST("noPU_lowMultCut/nTracksPV_vs_V0A"), multV0A, nPVtracks); + histos.fill(HIST("noPU_lowMultCut/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracksPV); + } + if (grassOnTheRight) { + histos.fill(HIST("highMultCloudCut/nTracksPV_vs_V0A"), multV0A, nPVtracks); } if (noPU && grassOnTheRight) { - histos.fill(HIST("noPU_HighMultCloudCut/hBcFV0"), localBC); - histos.fill(HIST("noPU_HighMultCloudCut/nTracksPV_vs_V0A"), multV0A, nPVtracks); - histos.fill(HIST("noPU_HighMultCloudCut/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracks); + histos.fill(HIST("noPU_highMultCloudCut/hBcFV0"), localBC); + histos.fill(HIST("noPU_highMultCloudCut/nTracksPV_vs_V0A"), multV0A, nPVtracks); + histos.fill(HIST("noPU_highMultCloudCut/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracksPV); } - if (noPU && pvTOFmatched && !badVzDiff) { // noPileup_cutByVzDiff_pvTOF_noFT0act + if (noPU && !badVzDiff && pvTOFmatched) { // noPileup_cutByVzDiff_pvTOF_noFT0act histos.fill(HIST("noPU_cutByVzDiff_pvTOF/hBcFV0"), localBC); histos.fill(HIST("noPU_cutByVzDiff_pvTOF/nTracksPV_vs_V0A"), multV0A, nPVtracks); - histos.fill(HIST("noPU_cutByVzDiff_pvTOF/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracks); + histos.fill(HIST("noPU_cutByVzDiff_pvTOF/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracksPV); + } + if (noPU && !badVzDiff && noFT0activityNearby) { + histos.fill(HIST("noPU_cutByVzDiff_noFT0activityNearby/hBcFV0"), localBC); + histos.fill(HIST("noPU_cutByVzDiff_noFT0activityNearby/nTracksPV_vs_V0A"), multV0A, nPVtracks); + // histos.fill(HIST("noPU_cutByVzDiff_noFT0activityNearby/nTracksGlobal_vs_V0A"), multV0A, nGlobalTracksPV); } } if (foundBC.has_zdc()) { @@ -1035,20 +1527,38 @@ struct LightIonsEvSelQa { if (noPU && pvTOFmatched) { histos.fill(HIST("noPU_pvTOFmatched/hBcZDC"), localBC); } - if (bcDiffCut) { - histos.fill(HIST("bcDiffCut/hBcZDC"), localBC); + if (noPU && pvTRDmatched) { + histos.fill(HIST("noPU_pvTRDmatched/hBcZDC"), localBC); + } + if (noPU && !pvTRDmatched) { + histos.fill(HIST("noPU_notTRDmatched/hBcZDC"), localBC); } - if (badVzDiff) { - histos.fill(HIST("badVzDiff/hBcZDC"), localBC); + if (bcDiffWrtClosestTVXCut) { + histos.fill(HIST("bcDiffWrtClosestTVXCut/hBcZDC"), localBC); + } + if (noPU && bcDiffWrtOriginalBcCut) { + histos.fill(HIST("noPU_bcDiffWrtOriginalBcCut/hBcZDC"), localBC); + } + if (noPU && badVzDiff) { + histos.fill(HIST("noPU_badVzDiff/hBcZDC"), localBC); } if (noPU && !badVzDiff) { histos.fill(HIST("noPU_goodVzDiff/hBcZDC"), localBC); } - if (noPastActivity) { - histos.fill(HIST("noPastActivity/hBcZDC"), localBC); + if (noPU && !badVzDiff && narrowTimeVeto) { + histos.fill(HIST("noPU_goodVzDiff_narrowTimeVeto/hBcZDC"), localBC); + } + if (noPU && !badVzDiff && strictTimeVeto) { + histos.fill(HIST("noPU_goodVzDiff_strictTimeVeto/hBcZDC"), localBC); + } + if (noPU && noPastActivity) { + histos.fill(HIST("noPU_noPastActivity/hBcZDC"), localBC); + } + if (noPU && noFT0activityNearby) { + histos.fill(HIST("noPU_noFT0activityNearby/hBcZDC"), localBC); } - if (noFT0activityNearby) { - histos.fill(HIST("noFT0activityNearby/hBcZDC"), localBC); + if (noPU && goodVertexChi2) { + histos.fill(HIST("noPU_goodVertexChi2/hBcZDC"), localBC); } if (narrowTimeVeto) { histos.fill(HIST("narrowTimeVeto/hBcZDC"), localBC); @@ -1060,60 +1570,80 @@ struct LightIonsEvSelQa { histos.fill(HIST("noCollSameROF/hBcZDC"), localBC); } if (noPU && underLine) { - histos.fill(HIST("noPU_LowMultCut/hBcZDC"), localBC); + histos.fill(HIST("noPU_lowMultCut/hBcZDC"), localBC); } if (noPU && grassOnTheRight) { - histos.fill(HIST("noPU_HighMultCloudCut/hBcZDC"), localBC); + histos.fill(HIST("noPU_highMultCloudCut/hBcZDC"), localBC); } - if (noPU && pvTOFmatched && !badVzDiff) { // noPileup_cutByVzDiff_pvTOF_noFT0act + if (noPU && !badVzDiff && pvTOFmatched) { // noPileup_cutByVzDiff_pvTOF_noFT0act histos.fill(HIST("noPU_cutByVzDiff_pvTOF/hBcZDC"), localBC); } + if (noPU && !badVzDiff && noFT0activityNearby) { + histos.fill(HIST("noPU_cutByVzDiff_noFT0activityNearby/hBcZDC"), localBC); + } } - // bc diff - // auto bc = col.bc_as(); - auto bcOriginal = globalOrigBC % 3564; - float bcDiff = bcOriginal - localBC; - - histos.fill(HIST("noSpecSelections/hTVXvsBcDiff"), bcDiff); + // bc diff wrt original bc + histos.fill(HIST("noSpecSelections/hTVXvsBcDiffwrtOrigBc"), bcDiffWrtOriginal); if (noPU) { - histos.fill(HIST("noPU/hTVXvsBcDiff"), bcDiff); + histos.fill(HIST("noPU/hTVXvsBcDiffwrtOrigBc"), bcDiffWrtOriginal); } if (noPU && pvTOFmatched) { - histos.fill(HIST("noPU_pvTOFmatched/hTVXvsBcDiff"), bcDiff); + histos.fill(HIST("noPU_pvTOFmatched/hTVXvsBcDiffwrtOrigBc"), bcDiffWrtOriginal); + } + if (noPU && pvTRDmatched) { + histos.fill(HIST("noPU_pvTRDmatched/hTVXvsBcDiffwrtOrigBc"), bcDiffWrtOriginal); + } + if (noPU && !pvTRDmatched) { + histos.fill(HIST("noPU_notTRDmatched/hTVXvsBcDiffwrtOrigBc"), bcDiffWrtOriginal); } - if (bcDiffCut) { - histos.fill(HIST("bcDiffCut/hTVXvsBcDiff"), bcDiff); + if (bcDiffWrtClosestTVXCut) { + histos.fill(HIST("bcDiffWrtClosestTVXCut/hTVXvsBcDiffwrtOrigBc"), bcDiffWrtOriginal); } - if (badVzDiff) { - histos.fill(HIST("badVzDiff/hTVXvsBcDiff"), bcDiff); + if (noPU && bcDiffWrtOriginalBcCut) { + histos.fill(HIST("noPU_bcDiffWrtOriginalBcCut/hTVXvsBcDiffwrtOrigBc"), bcDiffWrtOriginal); + } + if (noPU && badVzDiff) { + histos.fill(HIST("noPU_badVzDiff/hTVXvsBcDiffwrtOrigBc"), bcDiffWrtOriginal); } if (noPU && !badVzDiff) { - histos.fill(HIST("noPU_goodVzDiff/hTVXvsBcDiff"), bcDiff); + histos.fill(HIST("noPU_goodVzDiff/hTVXvsBcDiffwrtOrigBc"), bcDiffWrtOriginal); + } + if (noPU && !badVzDiff && narrowTimeVeto) { + histos.fill(HIST("noPU_goodVzDiff_narrowTimeVeto/hTVXvsBcDiffwrtOrigBc"), bcDiffWrtOriginal); + } + if (noPU && !badVzDiff && strictTimeVeto) { + histos.fill(HIST("noPU_goodVzDiff_strictTimeVeto/hTVXvsBcDiffwrtOrigBc"), bcDiffWrtOriginal); } - if (noPastActivity) { - histos.fill(HIST("noPastActivity/hTVXvsBcDiff"), bcDiff); + if (noPU && noPastActivity) { + histos.fill(HIST("noPU_noPastActivity/hTVXvsBcDiffwrtOrigBc"), bcDiffWrtOriginal); } - if (noFT0activityNearby) { - histos.fill(HIST("noFT0activityNearby/hTVXvsBcDiff"), bcDiff); + if (noPU && noFT0activityNearby) { + histos.fill(HIST("noPU_noFT0activityNearby/hTVXvsBcDiffwrtOrigBc"), bcDiffWrtOriginal); + } + if (noPU && goodVertexChi2) { + histos.fill(HIST("noPU_goodVertexChi2/hTVXvsBcDiffwrtOrigBc"), bcDiffWrtOriginal); } if (narrowTimeVeto) { - histos.fill(HIST("narrowTimeVeto/hTVXvsBcDiff"), bcDiff); + histos.fill(HIST("narrowTimeVeto/hTVXvsBcDiffwrtOrigBc"), bcDiffWrtOriginal); } if (strictTimeVeto) { - histos.fill(HIST("strictTimeVeto/hTVXvsBcDiff"), bcDiff); + histos.fill(HIST("strictTimeVeto/hTVXvsBcDiffwrtOrigBc"), bcDiffWrtOriginal); } if (noCollSameROF) { - histos.fill(HIST("noCollSameROF/hTVXvsBcDiff"), bcDiff); + histos.fill(HIST("noCollSameROF/hTVXvsBcDiffwrtOrigBc"), bcDiffWrtOriginal); } if (noPU && underLine) { - histos.fill(HIST("noPU_LowMultCut/hTVXvsBcDiff"), bcDiff); + histos.fill(HIST("noPU_lowMultCut/hTVXvsBcDiffwrtOrigBc"), bcDiffWrtOriginal); } if (noPU && grassOnTheRight) { - histos.fill(HIST("noPU_HighMultCloudCut/hTVXvsBcDiff"), bcDiff); + histos.fill(HIST("noPU_highMultCloudCut/hTVXvsBcDiffwrtOrigBc"), bcDiffWrtOriginal); + } + if (noPU && !badVzDiff && pvTOFmatched) { // noPileup_cutByVzDiff_pvTOF_noFT0act + histos.fill(HIST("noPU_cutByVzDiff_pvTOF/hTVXvsBcDiffwrtOrigBc"), bcDiffWrtOriginal); } - if (noPU && pvTOFmatched && !badVzDiff) { // noPileup_cutByVzDiff_pvTOF_noFT0act - histos.fill(HIST("noPU_cutByVzDiff_pvTOF/hTVXvsBcDiff"), bcDiff); + if (noPU && !badVzDiff && noFT0activityNearby) { + histos.fill(HIST("noPU_cutByVzDiff_noFT0activityNearby/hTVXvsBcDiffwrtOrigBc"), bcDiffWrtOriginal); } } // end of collisions loop From ed99878db70421155863965883b21753fb23ef7b Mon Sep 17 00:00:00 2001 From: ynishida-style Date: Fri, 8 Aug 2025 20:18:57 +0900 Subject: [PATCH 294/345] =?UTF-8?q?[PWGJE]=20Addition=20of=20n=CF=83=20dis?= =?UTF-8?q?tribution=20plot=20for=20the=20perpendicular=20cone.=20(#12483)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PWGJE/Tasks/jetShape.cxx | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/PWGJE/Tasks/jetShape.cxx b/PWGJE/Tasks/jetShape.cxx index 15dfd574c97..9a7c857e256 100644 --- a/PWGJE/Tasks/jetShape.cxx +++ b/PWGJE/Tasks/jetShape.cxx @@ -60,15 +60,19 @@ struct JetShapeTask { HistogramRegistry registry{"registry", {{"tpcTofPi", "tpcTofPi", {HistType::kTHnSparseD, {{35, 0, pMax}, {nBinsNSigma, nSigmaMin, nSigmaMax}, {nBinsDistance, 0, distanceMax}}}}, {"tpcTofPr", "tpcTofPr", {HistType::kTHnSparseD, {{35, 0, pMax}, {nBinsNSigma, nSigmaMin, nSigmaMax}, {nBinsDistance, 0, distanceMax}}}}, + {"tpcTofPiOutOfJet", "tpcTofPiOutOfJet", {HistType::kTH2F, {{35, 0, pMax}, {nBinsNSigma, nSigmaMin, nSigmaMax}}}}, + {"tpcTofPrOutOfJet", "tpcTofPrOutOfJet", {HistType::kTH2F, {{35, 0, pMax}, {nBinsNSigma, nSigmaMin, nSigmaMax}}}}, {"tpcPi", "tpcPi", {HistType::kTH2F, {{70, 0, pMax}, {nBinsNSigma, nSigmaMin, nSigmaMax}}}}, {"tofPi", "tofPi", {HistType::kTH2F, {{50, 0, ptMax}, {nBinsNSigma, nSigmaMin, nSigmaMax}}}}, {"tpcPr", "tpcPr", {HistType::kTH2F, {{70, 0, pMax}, {nBinsNSigma, nSigmaMin, nSigmaMax}}}}, {"tofPr", "tofPr", {HistType::kTH2F, {{50, 0, ptMax}, {nBinsNSigma, nSigmaMin, nSigmaMax}}}}, {"tpcDedx", "tpcDedx", {HistType::kTHnSparseD, {{nBinsPForDedx, 0, pMax}, {nBinsTpcDedx, 0, 1000}, {nBinsDistance, 0, distanceMax}}}}, {"tpcDedxOutOfJet", "tpcDedxOutOfJet", {HistType::kTH2F, {{nBinsPForDedx, 0, pMax}, {nBinsTpcDedx, 0, 1000}}}}, - {"tofBeta", "tofBeta", {HistType::kTHnSparseD, {{nBinsPForBeta, 0, pMax}, {nBinsTofBeta, 0.4, 1.1}, {nBinsDistance, 0, distanceMax}}}}, - {"pVsPtForProton", "pVsPtForProton", {HistType::kTHnSparseD, {{70, 0, pMax}, {50, 0, ptMax}, {nBinsDistance, 0, distanceMax}}}}, - {"pVsPtForPion", "pVsPtPion", {HistType::kTHnSparseD, {{70, 0, pMax}, {50, 0, ptMax}, {nBinsDistance, 0, distanceMax}}}}, + {"tofBeta", "tofBeta", {HistType::kTH2F, {{nBinsPForBeta, 0, pMax}, {nBinsTofBeta, 0.4, 1.1}}}}, + {"pVsPtForPr", "pVsPtForPr", {HistType::kTHnSparseD, {{70, 0, pMax}, {50, 0, ptMax}, {nBinsDistance, 0, distanceMax}}}}, + {"pVsPtForPi", "pVsPtPi", {HistType::kTHnSparseD, {{70, 0, pMax}, {50, 0, ptMax}, {nBinsDistance, 0, distanceMax}}}}, + {"pVsPtForPrOutOfJet", "pVsPtForPrOutOfJet", {HistType::kTH2F, {{70, 0, pMax}, {50, 0, ptMax}}}}, + {"pVsPtForPiOutOfJet", "pVsPtPionOutOfJet", {HistType::kTH2F, {{70, 0, pMax}, {50, 0, ptMax}}}}, {"tofMass", "tofMass", {HistType::kTH1F, {{300, 0, 3}}}}, {"trackPhi", "trackPhi", {HistType::kTH1F, {{80, -1, 7}}}}, {"trackEta", "trackEta", {HistType::kTH1F, {{100, -1, 1}}}}, @@ -298,8 +302,6 @@ struct JetShapeTask { // PID check registry.fill(HIST("tofMass"), track.mass()); - - // for calculate purity registry.fill(HIST("tpcPi"), track.p(), track.tpcNSigmaPi()); registry.fill(HIST("tofPi"), track.pt(), track.tofNSigmaPi()); registry.fill(HIST("tpcPr"), track.p(), track.tpcNSigmaPr()); @@ -324,30 +326,42 @@ struct JetShapeTask { float deltaPhiBg2 = RecoDecay::constrainAngle(preDeltaPhiBg2, -o2::constants::math::PI); // Calculate distance to background cone axes - // Note: deltaEta is the same for all cones at the same eta float distanceBg1 = std::sqrt(deltaEta * deltaEta + deltaPhiBg1 * deltaPhiBg1); float distanceBg2 = std::sqrt(deltaEta * deltaEta + deltaPhiBg2 * deltaPhiBg2); // Fill histogram if track is inside one of the perpendicular cones if (distanceBg1 < jetR || distanceBg2 < jetR) { registry.fill(HIST("tpcDedxOutOfJet"), track.p(), track.tpcSignal()); + + if (std::abs(track.tofNSigmaPi()) < nSigmaTofCut) { + registry.fill(HIST("tpcTofPiOutOfJet"), track.p(), track.tpcNSigmaPi()); + if (track.tpcNSigmaPi() > tpcNSigmaPiMin && track.tpcNSigmaPi() < tpcNSigmaPiMax) { + registry.fill(HIST("pVsPtForPiOutOfJet"), track.p(), track.pt()); + } + } + if (std::abs(track.tofNSigmaPr()) < nSigmaTofCut) { + registry.fill(HIST("tpcTofPrOutOfJet"), track.p(), track.tpcNSigmaPr()); + if (track.tpcNSigmaPr() > tpcNSigmaPrMin && track.tpcNSigmaPr() < tpcNSigmaPrMax) { + registry.fill(HIST("pVsPtForPrOutOfJet"), track.p(), track.pt()); + } + } } registry.fill(HIST("distanceVsTrackpt"), distance, track.pt()); registry.fill(HIST("tpcDedx"), track.p(), track.tpcSignal(), distance); - registry.fill(HIST("tofBeta"), track.p(), track.beta(), distance); + registry.fill(HIST("tofBeta"), track.p(), track.beta()); if (std::abs(track.tofNSigmaPr()) < nSigmaTofCut) { registry.fill(HIST("tpcTofPr"), track.p(), track.tpcNSigmaPr(), distance); if (track.tpcNSigmaPr() > tpcNSigmaPrMin && track.tpcNSigmaPr() < tpcNSigmaPrMax) { - registry.fill(HIST("pVsPtForProton"), track.p(), track.pt(), distance); + registry.fill(HIST("pVsPtForPr"), track.p(), track.pt(), distance); } } if (std::abs(track.tofNSigmaPi()) < nSigmaTofCut) { registry.fill(HIST("tpcTofPi"), track.p(), track.tpcNSigmaPi(), distance); if (track.tpcNSigmaPi() > tpcNSigmaPiMin && track.tpcNSigmaPi() < tpcNSigmaPiMax) { - registry.fill(HIST("pVsPtForPion"), track.p(), track.pt(), distance); + registry.fill(HIST("pVsPtForPi"), track.p(), track.pt(), distance); } } } From 24673f8ed63b322ee0c75de120fd4700dab89d2a Mon Sep 17 00:00:00 2001 From: Marvin Hemmer <53471402+mhemmer-cern@users.noreply.github.com> Date: Fri, 8 Aug 2025 17:12:33 +0200 Subject: [PATCH 295/345] [PWGJE] taskEmcExtensiveMcQa: Add more cluster energy informations (#12492) --- PWGJE/Tasks/taskEmcExtensiveMcQa.cxx | 75 +++++++++++++++++++++------- 1 file changed, 57 insertions(+), 18 deletions(-) diff --git a/PWGJE/Tasks/taskEmcExtensiveMcQa.cxx b/PWGJE/Tasks/taskEmcExtensiveMcQa.cxx index bd32d591775..9c2002c9a11 100644 --- a/PWGJE/Tasks/taskEmcExtensiveMcQa.cxx +++ b/PWGJE/Tasks/taskEmcExtensiveMcQa.cxx @@ -24,6 +24,7 @@ #include #include +#include #include #include #include @@ -35,6 +36,8 @@ #include #include +#include + #include #include #include @@ -46,24 +49,31 @@ using namespace o2::aod; using namespace o2::framework; using namespace o2::framework::expressions; +using namespace o2::constants; using namespace o2::hf_evsel; using namespace o2::hf_centrality; using CollisionEvSels = o2::soa::Join; using BcEvSelIt = o2::soa::Join::iterator; using SelectedClusters = o2::soa::Filtered>; +namespace poi +{ enum PoI { kPhoton = 0, - kElectron = 1, - kHadron = 2, - kNPoI = 3 + kElectronPrim = 1, + kElectronSec = 2, + kMuon = 3, + kHadronCharge = 4, + kHadronNeutral = 5, + kNPoI = 6 }; +} // namespace poi /// \struct TaskEmcExtensiveMcQa struct TaskEmcExtensiveMcQa { static constexpr int NSM = 20; // there 20 supermodlues for the EMCal - std::array arrPoIPDG = {22, 11}; + std::array arrPDGHadronNeutral = {kNeutron, kK0Short, kK0Long, kLambda0, physics::kXi0, kSigma0}; SliceCache cache; Preslice psClusterPerCollision = o2::aod::emcalcluster::collisionId; @@ -88,10 +98,13 @@ struct TaskEmcExtensiveMcQa { ConfigurableAxis nClustersBinning{"nClustersBinning", {201, -0.5, 200.5}, "binning for the number of clusters"}; ConfigurableAxis clusterEnergy{"clusterEnergy", {100, 0., 10}, "binning for the cluster energy in GeV"}; - ConfigurableAxis clusterTimeBinning{"clusterTimeBinning", {1500, -600, 900}, "binning for the cluster time in ns"}; ConfigurableAxis clusterM02{"clusterM02", {100, 0., 2.0}, "binning for the cluster M02"}; + ConfigurableAxis clusterM20{"clusterM20", {100, 0., 2.0}, "binning for the cluster M20"}; ConfigurableAxis clusterNCellBinning{"clusterNCellBinning", {100, 0.5, 100.5}, "binning for the number of cells per cluster"}; ConfigurableAxis clusterOriginRadius{"clusterOriginRadius", {225, 0., 450}, "binning for the radial original point of the main contributor of a cluster"}; + ConfigurableAxis clusterNContributor{"clusterNContributor", {20, 0.5, 20.5}, "binning for the number of contributor of a cluster"}; + ConfigurableAxis clusterEnergyRatio{"clusterEnergyRatio", {100, 0., 10.}, "binning for ratio of the deposited energy of the leading particle to its generated momentum cluster"}; + ConfigurableAxis collisionCent{"collisionCent", {10, 0., 100.}, "binning for the event centrality"}; std::vector mCellTime; @@ -103,12 +116,17 @@ struct TaskEmcExtensiveMcQa { // create common axes const AxisSpec numberClustersAxis{nClustersBinning, "#it{N}_{cl}/ #it{N}_{event}"}; - const AxisSpec axisParticle = {PoI::kNPoI, -0.5f, +PoI::kNPoI - 0.5f, ""}; + const AxisSpec axisParticle = {poi::kNPoI, -0.5f, +poi::kNPoI - 0.5f, ""}; const AxisSpec axisEnergy{clusterEnergy, "#it{E}_{cl} (GeV)"}; - const AxisSpec axisTime{clusterTimeBinning, "#it{t}_{cl} (ns)"}; const AxisSpec axisM02{clusterM02, "#it{M}_{02}"}; + const AxisSpec axisM20{clusterM20, "#it{M}_{20}"}; const AxisSpec axisNCell{clusterNCellBinning, "#it{N}_{cells}"}; const AxisSpec axisRadius{clusterOriginRadius, "#it{R}_{origin} (cm)"}; + const AxisSpec axisNContributor{clusterNContributor, "#it{N}_{particles}"}; + const AxisSpec axisCent{collisionCent, "cent (%)"}; + const AxisSpec axisLeadingEnergy{clusterEnergy, "#it{E}_{lead} (GeV)"}; + const AxisSpec axisLeadingGenMomentum{clusterEnergy, "#it{p}_{lead, gen} (GeV/#it{c})"}; + const AxisSpec axisLeadingRatio{clusterEnergy, "#it{E}_{lead}/#it{p}_{lead, gen} (#it{c})"}; // create histograms @@ -116,7 +134,8 @@ struct TaskEmcExtensiveMcQa { mHistManager.add("numberOfClustersEvents", "number of clusters per event (selected events)", HistType::kTH1D, {numberClustersAxis}); // cluster properties (matched clusters) - mHistManager.add("hSparseClusterQA", "THn for Cluster QA", HistType::kTHnSparseF, {axisEnergy, axisTime, axisM02, axisNCell, axisRadius, axisParticle}); + mHistManager.add("hSparseClusterQA", "THnSparse for Cluster QA", HistType::kTHnSparseF, {axisEnergy, axisM02, axisM20, axisNCell, axisRadius, axisParticle, axisNContributor, axisCent}); + mHistManager.add("hSparseClusterContributors", "THnSparse with cluster contributors and energies", HistType::kTHnSparseF, {axisEnergy, axisParticle, axisNContributor, axisLeadingEnergy, axisLeadingGenMomentum, axisLeadingRatio, axisCent}); mHistManager.add("clusterEtaPhi", "Eta and phi of cluster", HistType::kTH2F, {{140, -0.7, 0.7}, {360, 0, o2::constants::math::TwoPI}}); hfEvSel.addHistograms(mHistManager); @@ -127,9 +146,8 @@ struct TaskEmcExtensiveMcQa { } template - bool isCollSelected(const Coll& coll) + bool isCollSelected(const Coll& coll, float& cent) { - float cent{-1.f}; const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(coll, cent, ccdb, mHistManager); /// monitor the satisfied event selections hfEvSel.fillHistograms(coll, rejectionMask, cent); @@ -143,12 +161,28 @@ struct TaskEmcExtensiveMcQa { template int findPoIType(T const& mcparticle) { - auto it = std::find(arrPoIPDG.begin(), arrPoIPDG.end(), std::abs(mcparticle.pdgCode())); - if (it != arrPoIPDG.end()) { - int index = std::distance(arrPoIPDG.begin(), it); - return index; - } else { - return PoI::kHadron; + auto pdgValue = std::abs(mcparticle.pdgCode()); + switch (pdgValue) { + case kGamma: { + return poi::kPhoton; + } + case kElectron: { + if (mcparticle.isPhysicalPrimary()) { + return poi::kElectronPrim; + } else { + return poi::kElectronSec; + } + } + case kMuonMinus: { + return poi::kMuon; + } + default: { + auto it = std::find(arrPDGHadronNeutral.begin(), arrPDGHadronNeutral.end(), pdgValue); + if (it != arrPDGHadronNeutral.end()) { + return poi::kHadronNeutral; + } + return poi::kHadronCharge; + } } } @@ -159,7 +193,8 @@ struct TaskEmcExtensiveMcQa { { for (const auto& collision : collisions) { - if (applyEvSels && !isCollSelected(collision)) { + float cent = -1.f; + if (applyEvSels && !isCollSelected(collision, cent)) { continue; } @@ -175,7 +210,11 @@ struct TaskEmcExtensiveMcQa { } auto mainMcParticle = cluster.mcParticle_as()[0]; float radius = std::hypot(mainMcParticle.vx(), mainMcParticle.vy()); - mHistManager.fill(HIST("hSparseClusterQA"), cluster.energy(), cluster.time(), cluster.m02(), cluster.nCells(), radius, findPoIType(mainMcParticle)); + float momentum = mainMcParticle.p(); + float leadingEnergy = cluster.energy() * cluster.amplitudeA()[0]; + float leadingFraction = leadingEnergy / momentum; + mHistManager.fill(HIST("hSparseClusterQA"), cluster.energy(), cluster.m02(), cluster.m20(), cluster.nCells(), radius, findPoIType(mainMcParticle), cluster.mcParticle().size(), cent); + mHistManager.fill(HIST("hSparseClusterContributors"), cluster.energy(), findPoIType(mainMcParticle), cluster.mcParticle().size(), leadingEnergy, momentum, leadingFraction, cent); } } } From 38813278a6bdbfcb524213c6b05c7bafb0074639 Mon Sep 17 00:00:00 2001 From: altsybee Date: Fri, 8 Aug 2025 17:38:36 +0200 Subject: [PATCH 296/345] [Common] configs for special checks for light ion runs (#12494) --- Common/Tools/EventSelectionTools.h | 210 +++++++++++++++++++++++++---- 1 file changed, 183 insertions(+), 27 deletions(-) diff --git a/Common/Tools/EventSelectionTools.h b/Common/Tools/EventSelectionTools.h index d32cc2dcbcc..eef9ddaf7f6 100644 --- a/Common/Tools/EventSelectionTools.h +++ b/Common/Tools/EventSelectionTools.h @@ -106,6 +106,13 @@ struct evselConfigurables : o2::framework::ConfigurableGroup { o2::framework::Configurable confEpsilonVzDiffVetoInROF{"EpsilonVzDiffVetoInROF", 0.3, "Minumum distance to nearby collisions along z inside this ITS ROF, cm"}; // o2-linter: disable=name/configurable (temporary fix) o2::framework::Configurable confUseWeightsForOccupancyVariable{"UseWeightsForOccupancyEstimator", 1, "Use or not the delta-time weights for the occupancy estimator"}; // o2-linter: disable=name/configurable (temporary fix) o2::framework::Configurable confNumberOfOrbitsPerTF{"NumberOfOrbitsPerTF", -1, "Number of orbits per Time Frame. Take from CCDB if -1"}; // o2-linter: disable=name/configurable (temporary fix) + + // configurables for light-ion event selection (testing mode) + o2::framework::Configurable confLightIonsAlternativeBcMatching{"TestAlternativeBcMatching", 0, "0 - use standard matching, 1 - try alternative for light ions"}; // o2-linter: disable=name/configurable (temporary fix) + o2::framework::Configurable confLightIonsModifyTimeVetoOnNearbyColl{"TestModifyTimeVetoOnNearbyColl", 0, "0 - use standard time veto, 1 - modify time range"}; // o2-linter: disable=name/configurable (temporary fix) + o2::framework::Configurable confLightIonsVetoOnTRDinPast{"TestVetoOnTRDinPast", 0, "0 - use standard time veto, 1 - use veto on TRD in the past events"}; // o2-linter: disable=name/configurable (temporary fix) + o2::framework::Configurable confLightIonsNsigmaOnVzDiff{"TestVzDiffNsigma", 3.0, "+/- nSigma on vZ difference by FT0 and by tracks"}; // o2-linter: disable=name/configurable (temporary fix) + o2::framework::Configurable confLightIonsMarginVzDiff{"TestVzDiffMargin", 0.2, "margin for +/- nSigma on vZ difference by FT0 and by tracks"}; // o2-linter: disable=name/configurable (temporary fix) }; // luminosity configurables @@ -602,6 +609,7 @@ class EventSelectionModule int run3min = 500000; int lastRun = -1; // last run number (needed to access ccdb only if run!=lastRun) std::bitset bcPatternB; // bc pattern of colliding bunches + std::vector bcsPattern; // pattern of colliding BCs int64_t bcSOR = -1; // global bc of the start of the first orbit int64_t nBCsPerTF = -1; // duration of TF in bcs, should be 128*3564 or 32*3564 @@ -609,6 +617,12 @@ class EventSelectionModule int rofLength = -1; // ITS ROF length, in bc std::string strLPMProductionTag = ""; // MC production tag to be retrieved from AO2D metadata + // temporary (?) parameterizations for light ion runs + int runLightIons = -1; + int runListLightIons[11] = {564356, 564359, 564373, 564374, 564387, 564400, 564414, 564430, 564445, 564468, 564472}; + std::vector diffVzParMean; // parameterization for mean of diff vZ by FT0 vs by tracks + std::vector diffVzParSigma; // parameterization for stddev of diff vZ by FT0 vs by tracks + int32_t findClosest(int64_t globalBC, std::map& bcs) { auto it = bcs.lower_bound(globalBC); @@ -718,12 +732,38 @@ class EventSelectionModule // avoids crash related to specific run number auto grplhcif = ccdb->template getSpecific("GLO/Config/GRPLHCIF", ts); bcPatternB = grplhcif->getBunchFilling().getBCPattern(); + bcsPattern = grplhcif->getBunchFilling().getFilledBCs(); // extract ITS ROF parameters auto alppar = ccdb->template getForTimeStamp>("ITS/Config/AlpideParam", ts); rofOffset = alppar->roFrameBiasInBC; rofLength = alppar->roFrameLengthInBC; LOGP(debug, "ITS ROF Offset={} ITS ROF Length={}", rofOffset, rofLength); + if (evselOpts.confLightIonsAlternativeBcMatching) { + for (unsigned long i = 0; i < bcsPattern.size(); i++) + LOGP(info, "bcsPattern: i={} bc={}", i, bcsPattern.at(i)); + } + + // special treatment of light ion runs + if (lastRun >= 564356 && lastRun <= 564472) { + for (unsigned long i = 0; i < sizeof(runListLightIons) / sizeof(*runListLightIons); i++) { + if (runListLightIons[i] == lastRun) { + runLightIons = lastRun; + // extract parameterization for diff of vZ by FT0 vs by tracks + auto parMeans = ccdb->template getForTimeStamp>("Users/a/altsybee/diffVzCollVsFTOmeanPar", ts); + auto parSigmas = ccdb->template getForTimeStamp>("Users/a/altsybee/diffVzCollVsFTOsigmaPar", ts); + diffVzParMean = *parMeans; + diffVzParSigma = *parSigmas; + LOGP(info, ">>> special treatment for diffVz for light ion run {}", runLightIons); + for (int i = 0; i < 5; i++) + LOGP(info, " mean par {} = {}", i, diffVzParMean[i]); + for (int i = 0; i < 5; i++) + LOGP(info, " sigma par {} = {}", i, diffVzParSigma[i]); + break; + } + } + } + } // if run != lastRun return true; } @@ -824,6 +864,7 @@ class EventSelectionModule // create maps from globalBC to bc index for TVX-fired bcs // to be used for closest TVX searches std::map mapGlobalBcWithTVX; + std::map mapGlobalBcWithOrInFT0; std::map mapGlobalBcVtxZ; for (const auto& bc : bcs) { int64_t globalBC = bc.globalBC(); @@ -831,6 +872,11 @@ class EventSelectionModule if (run >= run3min && bcPatternB[globalBC % nBCsPerOrbit] == 0) { continue; } + + if (bc.has_ft0()) { + mapGlobalBcWithOrInFT0[globalBC] = bc.globalIndex(); + } + auto selection = bcselbuffer[bc.globalIndex()].selection; if (bitcheck64(selection, aod::evsel::kIsTriggerTVX)) { mapGlobalBcWithTVX[globalBC] = bc.globalIndex(); @@ -863,9 +909,11 @@ class EventSelectionModule std::vector vIsVertexTOFmatched(cols.size(), 0); // at least one of vertex contributors is matched to TOF std::vector vIsVertexTRDmatched(cols.size(), 0); // at least one of vertex contributors is matched to TRD - std::vector vCollisionsPerBc(bcs.size(), 0); // counter of collisions per found bc for pileup checks - std::vector vFoundBCindex(cols.size(), -1); // indices of found bcs - std::vector vFoundGlobalBC(cols.size(), 0); // global BCs for collisions + std::vector vCollisionsPerBc(bcs.size(), 0); // counter of collisions per found bc for pileup checks + std::vector vCollisionsPileupPerColl(cols.size(), 0); // counter of pileup in the same bc as a given collision + std::vector vBCinPatternPerColl(cols.size(), 0); // found nominal BCs for collisions + std::vector vFoundBCindex(cols.size(), -1); // indices of found bcs + std::vector vFoundGlobalBC(cols.size(), 0); // global BCs for collisions std::vector vIsVertexTOF(cols.size(), 0); std::vector vIsVertexTRD(cols.size(), 0); @@ -937,7 +985,67 @@ class EventSelectionModule int64_t foundGlobalBC = 0; int32_t foundBCindex = -1; - if (nPvTracksTOF > 0) { + // alternative collision-BC matching (currently: test mode, the aim is to improve pileup rejection) + if (evselOpts.confLightIonsAlternativeBcMatching) { + foundGlobalBC = globalBC; + // find closest nominal bc in pattern + for (unsigned long i = 0; i < bcsPattern.size(); i++) { + int32_t localBC = globalBC % nBCsPerOrbit; + int32_t bcFromPattern = bcsPattern.at(i); + int64_t bcDiff = bcFromPattern - localBC; + if (std::abs(bcDiff) <= 20) { + foundGlobalBC = (globalBC / nBCsPerOrbit) * nBCsPerOrbit + bcFromPattern; + break; // the bc in pattern is found + } + } + + // matched with TOF --> precise time, match to TVX, but keep the nominal foundGlobalBC from pattern + if (vIsVertexTOFmatched[colIndex]) { + std::map::iterator it = mapGlobalBcWithTVX.find(foundGlobalBC); + if (it != mapGlobalBcWithTVX.end()) { + foundBCindex = it->second; // TVX at foundGlobalBC is found + } else { // check if TVX is in nearby bcs + it = mapGlobalBcWithTVX.find(foundGlobalBC + 1); // next bc + if (it != mapGlobalBcWithTVX.end()) { + // foundGlobalBC += 1; + foundBCindex = it->second; + } else { + it = mapGlobalBcWithTVX.find(foundGlobalBC - 1); // previous bc + if (it != mapGlobalBcWithTVX.end()) { + // foundGlobalBC -= 1; + foundBCindex = it->second; + } else { + foundBCindex = bc.globalIndex(); // keep original BC index + } + } + } + } // end of if TOF-matched vertex + else { // for non-TOF and low-mult vertices, consider nearby nominal bcs + int64_t meanBC = globalBC + TMath::Nint(sumHighPtTime / sumHighPtW / bcNS); + int64_t bestGlobalBC = findBestGlobalBC(meanBC, evselOpts.confSigmaBCforHighPtTracks, vNcontributors[colIndex], col.posZ(), mapGlobalBcVtxZ); + if (bestGlobalBC > 0) { + foundGlobalBC = bestGlobalBC; + // find closest nominal bc in pattern + for (unsigned long j = 0; j < bcsPattern.size(); j++) { + int32_t bcFromPatternBest = bcsPattern.at(j); + int64_t bcDiff = bcFromPatternBest - (bestGlobalBC % nBCsPerOrbit); + if (std::abs(bcDiff) <= 20) { + foundGlobalBC = (bestGlobalBC / nBCsPerOrbit) * nBCsPerOrbit + bcFromPatternBest; + break; // the bc in pattern is found + } + } + foundBCindex = mapGlobalBcWithTVX[bestGlobalBC]; + } else { // failed to find a proper TVX with small vZ difference + foundBCindex = bc.globalIndex(); // keep original BC index + } + } // end of non-TOF matched vertices + // sanitity check: if BC was not found + if (foundBCindex == -1) { + foundBCindex = bc.globalIndex(); + } + vBCinPatternPerColl[colIndex] = foundGlobalBC; + // end of alternative coll-BC matching (test) + } else if (nPvTracksTOF > 0) { // "standard matching": // for collisions with TOF tracks: // take bc corresponding to TOF track with median time int64_t tofGlobalBC = globalBC + TMath::Nint(getMedian(vTrackTimesTOF) / bcNS); @@ -975,23 +1083,34 @@ class EventSelectionModule if (foundBCindex >= 0) mapGlobalBcVtxZ.erase(foundGlobalBC); } - - // second loop to match remaining low-pt TPCnoTOFnoTRD collisions - for (const auto& col : cols) { - int32_t colIndex = col.globalIndex(); - if (vIsVertexTPC[colIndex] > 0 && vIsVertexTOF[colIndex] == 0 && vIsVertexHighPtTPC[colIndex] == 0) { - float weightedTime = vWeightedTimesTPCnoTOFnoTRD[colIndex]; - float weightedSigma = vWeightedSigmaTPCnoTOFnoTRD[colIndex]; - auto bc = col.template bc_as>(); - int64_t globalBC = bc.globalBC(); - int64_t meanBC = globalBC + TMath::Nint(weightedTime / bcNS); - int64_t sigmaBC = TMath::CeilNint(weightedSigma / bcNS); - int64_t bestGlobalBC = findBestGlobalBC(meanBC, sigmaBC, vNcontributors[colIndex], col.posZ(), mapGlobalBcVtxZ); - vFoundGlobalBC[colIndex] = bestGlobalBC > 0 ? bestGlobalBC : globalBC; - vFoundBCindex[colIndex] = bestGlobalBC > 0 ? mapGlobalBcWithTVX[bestGlobalBC] : bc.globalIndex(); + // alternative matching: looking for collisions with the same nominal BC + if (evselOpts.confLightIonsAlternativeBcMatching) { + for (unsigned long iCol = 0; iCol < vBCinPatternPerColl.size(); iCol++) { + int64_t foundNominalBC = vBCinPatternPerColl[iCol]; + for (unsigned long jCol = 0; jCol < vBCinPatternPerColl.size(); jCol++) { + int64_t foundNominalBC2 = vBCinPatternPerColl[jCol]; + if (foundNominalBC2 == foundNominalBC) { + vCollisionsPileupPerColl[iCol]++; + } + } + } + } else { // continue standard matching: second loop to match remaining low-pt TPCnoTOFnoTRD collisions + for (const auto& col : cols) { + int32_t colIndex = col.globalIndex(); + if (vIsVertexTPC[colIndex] > 0 && vIsVertexTOF[colIndex] == 0 && vIsVertexHighPtTPC[colIndex] == 0) { + float weightedTime = vWeightedTimesTPCnoTOFnoTRD[colIndex]; + float weightedSigma = vWeightedSigmaTPCnoTOFnoTRD[colIndex]; + auto bc = col.template bc_as>(); + int64_t globalBC = bc.globalBC(); + int64_t meanBC = globalBC + TMath::Nint(weightedTime / bcNS); + int64_t sigmaBC = TMath::CeilNint(weightedSigma / bcNS); + int64_t bestGlobalBC = findBestGlobalBC(meanBC, sigmaBC, vNcontributors[colIndex], col.posZ(), mapGlobalBcVtxZ); + vFoundGlobalBC[colIndex] = bestGlobalBC > 0 ? bestGlobalBC : globalBC; + vFoundBCindex[colIndex] = bestGlobalBC > 0 ? mapGlobalBcWithTVX[bestGlobalBC] : bc.globalIndex(); + } + // fill pileup counter + vCollisionsPerBc[vFoundBCindex[colIndex]]++; } - // fill pileup counter - vCollisionsPerBc[vFoundBCindex[colIndex]]++; } // save indices of collisions for occupancy calculation (both in ROF and in time range) @@ -1188,10 +1307,24 @@ class EventSelectionModule sumAmpFT0CInFullTimeWindow += wOccup * vAmpFT0CperColl[thisColIndex]; // counting tracks from other collisions in fixed time windows - if (std::fabs(dt) < evselOpts.confTimeRangeVetoOnCollNarrow) - nITS567tracksForVetoNarrow += vTracksITS567perColl[thisColIndex]; - if (std::fabs(dt) < evselOpts.confTimeRangeVetoOnCollStandard) - nITS567tracksForVetoStrict += vTracksITS567perColl[thisColIndex]; + if (!evselOpts.confLightIonsModifyTimeVetoOnNearbyColl) { + if (std::fabs(dt) < evselOpts.confTimeRangeVetoOnCollNarrow) + nITS567tracksForVetoNarrow += vTracksITS567perColl[thisColIndex]; + if (std::fabs(dt) < evselOpts.confTimeRangeVetoOnCollStandard) + nITS567tracksForVetoStrict += vTracksITS567perColl[thisColIndex]; + } else { // special veto ranges (tests for light ion runs) + if (dt > -4.5 && dt < 2.5) // avoid TOF- and TRD-related structures, with 0.5 us margin + nITS567tracksForVetoNarrow += vTracksITS567perColl[thisColIndex]; + + if (!evselOpts.confLightIonsVetoOnTRDinPast) { + if (dt > -25.5 && dt < 2.5) // test effect from TRD triggers in the past + nITS567tracksForVetoStrict += vTracksITS567perColl[thisColIndex]; + } else { + // counting TRD-matched vertices in a long time interval in the past + if (dt > -25.5 && dt < 2.5) + nITS567tracksForVetoStrict += vIsVertexTRDmatched[thisColIndex]; + } + } // standard cut on other collisions vs delta-times const float driftV = 2.5; // drift velocity in cm/us, TPC drift_length / drift_time = 250 cm / 100 us @@ -1210,7 +1343,11 @@ class EventSelectionModule vSumAmpFT0CinFullTimeWin[colIndex] = sumAmpFT0CInFullTimeWindow; // occupancy by a sum of FT0C amplitudes (without a current collision) // occupancy flags based on nearby collisions vNoCollInTimeRangeNarrow[colIndex] = (nITS567tracksForVetoNarrow == 0); - vNoCollInTimeRangeStrict[colIndex] = (nITS567tracksForVetoStrict == 0); + if (!evselOpts.confLightIonsVetoOnTRDinPast) + vNoCollInTimeRangeStrict[colIndex] = (nITS567tracksForVetoStrict == 0); + else + vNoCollInTimeRangeStrict[colIndex] = (nITS567tracksForVetoStrict == 0 && nITS567tracksForVetoNarrow == 0); + vNoHighMultCollInTimeRange[colIndex] = (nCollsWithFT0CAboveVetoStandard == 0); } @@ -1228,7 +1365,23 @@ class EventSelectionModule bool isGoodZvtxFT0vsPV = 0; if (bcselEntry.foundFT0Id > -1) { auto foundFT0 = ft0s.rawIteratorAt(bcselEntry.foundFT0Id); - isGoodZvtxFT0vsPV = std::fabs(foundFT0.posZ() - col.posZ()) < evselOpts.maxDiffZvtxFT0vsPV; + float diffVz = foundFT0.posZ() - col.posZ(); + if (runLightIons == -1) + isGoodZvtxFT0vsPV = std::fabs(diffVz) < evselOpts.maxDiffZvtxFT0vsPV; + else { // special treatment of light ion runs + float multT0A = bc.ft0().sumAmpA(); + float multT0C = bc.ft0().sumAmpC(); + float T0M = multT0A + multT0C; + // calc mean at this T0 ampl. + float x = (T0M < 50 ? 50 : T0M); + double diffMean = diffVzParMean[0] + diffVzParMean[1] * pow(x, diffVzParMean[2]) + diffVzParMean[3] * pow(x, diffVzParMean[4]); + // calc sigma at this T0 ampl. + x = (T0M < 20 ? 20 : (T0M > 1.2e4 ? 1.2e4 : T0M)); + double diffSigma = diffVzParSigma[0] + diffVzParSigma[1] * pow(x, diffVzParSigma[2]) + diffVzParSigma[3] * pow(x, diffVzParSigma[4]); + float nSigma = evselOpts.confLightIonsNsigmaOnVzDiff; + float margin = evselOpts.confLightIonsMarginVzDiff; + isGoodZvtxFT0vsPV = (diffVz > diffMean - nSigma * diffSigma - margin && diffVz < diffMean + nSigma * diffSigma + margin); + } } // copy alias decisions from bcsel table @@ -1236,7 +1389,10 @@ class EventSelectionModule // copy selection decisions from bcsel table uint64_t selection = bcselbuffer[bc.globalIndex()].selection; - selection |= vCollisionsPerBc[foundBC] <= 1 ? BIT(aod::evsel::kNoSameBunchPileup) : 0; + if (evselOpts.confLightIonsAlternativeBcMatching) + selection |= vCollisionsPileupPerColl[colIndex] <= 1 ? BIT(aod::evsel::kNoSameBunchPileup) : 0; + else + selection |= vCollisionsPerBc[foundBC] <= 1 ? BIT(aod::evsel::kNoSameBunchPileup) : 0; selection |= vIsVertexITSTPC[colIndex] ? BIT(aod::evsel::kIsVertexITSTPC) : 0; selection |= vIsVertexTOFmatched[colIndex] ? BIT(aod::evsel::kIsVertexTOFmatched) : 0; selection |= vIsVertexTRDmatched[colIndex] ? BIT(aod::evsel::kIsVertexTRDmatched) : 0; From baca05da89ef346ffcbdc64a93adee23dfe0d039 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Fri, 8 Aug 2025 18:12:24 +0200 Subject: [PATCH 297/345] [PWGEM/PhotonMeson] fix in filterEoI.cxx (#12495) --- PWGEM/Dilepton/TableProducer/filterEoI.cxx | 50 +++++++++++++++------- 1 file changed, 35 insertions(+), 15 deletions(-) diff --git a/PWGEM/Dilepton/TableProducer/filterEoI.cxx b/PWGEM/Dilepton/TableProducer/filterEoI.cxx index ef232718485..59dfbf07e0b 100644 --- a/PWGEM/Dilepton/TableProducer/filterEoI.cxx +++ b/PWGEM/Dilepton/TableProducer/filterEoI.cxx @@ -32,16 +32,17 @@ struct filterEoI { kElectron = 0x1, kFwdMuon = 0x2, kPCM = 0x4, + kElectronFromDalitz = 0x8, }; Produces emeoi; - Configurable minNElectrons{"minNElectrons", 1, "min number of e+ or e- at midrapidity"}; - Configurable minNMuons{"minNMuons", 1, "min number of mu+ or mu- at forward rapidity"}; - Configurable minNV0s{"minNV0s", 1, "min number of v0 photons at midrapidity"}; + // Configurable minNElectrons{"minNElectrons", 1, "min number of e+ or e- at midrapidity"}; + // Configurable minNMuons{"minNMuons", 1, "min number of mu+ or mu- at forward rapidity"}; + // Configurable minNV0s{"minNV0s", 1, "min number of v0 photons at midrapidity"}; HistogramRegistry fRegistry{"output"}; void init(o2::framework::InitContext&) { - auto hEventCounter = fRegistry.add("hEventCounter", "hEventCounter", kTH1D, {{7, 0.5f, 7.5f}}); + auto hEventCounter = fRegistry.add("hEventCounter", "hEventCounter", kTH1D, {{8, 0.5f, 8.5f}}); hEventCounter->GetXaxis()->SetBinLabel(1, "all"); hEventCounter->GetXaxis()->SetBinLabel(2, "event with electron"); hEventCounter->GetXaxis()->SetBinLabel(3, "event with forward muon"); @@ -49,43 +50,52 @@ struct filterEoI { hEventCounter->GetXaxis()->SetBinLabel(5, "event with electron or forward muon"); hEventCounter->GetXaxis()->SetBinLabel(6, "event with electron and forward muon"); hEventCounter->GetXaxis()->SetBinLabel(7, "event with electron or forward muon or v0"); + hEventCounter->GetXaxis()->SetBinLabel(8, "event with v0 or electrons from dalitz"); } SliceCache cache; Preslice perCollision_el = aod::emprimaryelectron::collisionId; Preslice perCollision_mu = aod::emprimarymuon::collisionId; Preslice perCollision_v0 = aod::v0photonkf::collisionId; + Preslice perCollision_elda = aod::emprimaryelectron::collisionId; - template - void selectEoI(TCollisions const& collisions, TElectrons const& electrons, TMuons const& muons, TV0s const& v0s) + template + void selectEoI(TCollisions const& collisions, TElectrons const& electrons, TMuons const& muons, TV0s const& v0s, TElectronsDA const& electronsda) { for (const auto& collision : collisions) { bool does_electron_exist = false; bool does_fwdmuon_exist = false; bool does_pcm_exist = false; + bool does_electronda_exist = false; fRegistry.fill(HIST("hEventCounter"), 1); if constexpr (static_cast(system & kElectron)) { auto electrons_coll = electrons.sliceBy(perCollision_el, collision.globalIndex()); - if (electrons_coll.size() >= minNElectrons) { + if (electrons_coll.size() >= 1) { does_electron_exist = true; fRegistry.fill(HIST("hEventCounter"), 2); } } if constexpr (static_cast(system & kFwdMuon)) { auto muons_coll = muons.sliceBy(perCollision_mu, collision.globalIndex()); - if (muons_coll.size() >= minNMuons) { + if (muons_coll.size() >= 1) { does_fwdmuon_exist = true; fRegistry.fill(HIST("hEventCounter"), 3); } } if constexpr (static_cast(system & kPCM)) { auto v0s_coll = v0s.sliceBy(perCollision_v0, collision.globalIndex()); - if (v0s_coll.size() >= minNV0s) { + if (v0s_coll.size() >= 1) { does_pcm_exist = true; fRegistry.fill(HIST("hEventCounter"), 4); } } + if constexpr (static_cast(system & kElectronFromDalitz)) { + auto electronsda_coll = electronsda.sliceBy(perCollision_elda, collision.globalIndex()); + if (electronsda_coll.size() >= 2) { + does_electronda_exist = true; + } + } if (does_electron_exist || does_fwdmuon_exist) { fRegistry.fill(HIST("hEventCounter"), 5); @@ -96,8 +106,11 @@ struct filterEoI { if (does_electron_exist || does_fwdmuon_exist || does_pcm_exist) { fRegistry.fill(HIST("hEventCounter"), 7); } + if (does_pcm_exist || does_electronda_exist) { + fRegistry.fill(HIST("hEventCounter"), 8); + } - emeoi(does_electron_exist || does_fwdmuon_exist || does_pcm_exist); + emeoi(does_electron_exist || does_fwdmuon_exist || does_pcm_exist || does_electronda_exist); } // end of collision loop @@ -106,31 +119,37 @@ struct filterEoI { void process_Electron(aod::Collisions const& collisions, aod::EMPrimaryElectrons const& electrons) { const uint8_t sysflag = kElectron; - selectEoI(collisions, electrons, nullptr, nullptr); + selectEoI(collisions, electrons, nullptr, nullptr, nullptr); } void process_FwdMuon(aod::Collisions const& collisions, aod::EMPrimaryMuons const& muons) { const uint8_t sysflag = kFwdMuon; - selectEoI(collisions, nullptr, muons, nullptr); + selectEoI(collisions, nullptr, muons, nullptr, nullptr); } void process_Electron_FwdMuon(aod::Collisions const& collisions, aod::EMPrimaryElectrons const& electrons, aod::EMPrimaryMuons const& muons) { const uint8_t sysflag = kElectron | kFwdMuon; - selectEoI(collisions, electrons, muons, nullptr); + selectEoI(collisions, electrons, muons, nullptr, nullptr); } void process_PCM(aod::Collisions const& collisions, aod::V0PhotonsKF const& v0s) { const uint8_t sysflag = kPCM; - selectEoI(collisions, nullptr, nullptr, v0s); + selectEoI(collisions, nullptr, nullptr, v0s, nullptr); } void process_Electron_FwdMuon_PCM(aod::Collisions const& collisions, aod::EMPrimaryElectrons const& electrons, aod::EMPrimaryMuons const& muons, aod::V0PhotonsKF const& v0s) { const uint8_t sysflag = kElectron | kFwdMuon | kPCM; - selectEoI(collisions, electrons, muons, v0s); + selectEoI(collisions, electrons, muons, v0s, nullptr); + } + + void process_PCM_ElectronFromDalitz(aod::Collisions const& collisions, aod::V0PhotonsKF const& v0s, aod::EMPrimaryElectronsFromDalitz const& electronsda) + { + const uint8_t sysflag = kPCM | kElectronFromDalitz; + selectEoI(collisions, nullptr, nullptr, v0s, electronsda); } void processDummy(aod::Collisions const& collisions) @@ -145,6 +164,7 @@ struct filterEoI { PROCESS_SWITCH(filterEoI, process_PCM, "create filter bit for PCM", false); PROCESS_SWITCH(filterEoI, process_Electron_FwdMuon, "create filter bit for Electron, FwdMuon", false); PROCESS_SWITCH(filterEoI, process_Electron_FwdMuon_PCM, "create filter bit for Electron, FwdMuon, PCM", false); + PROCESS_SWITCH(filterEoI, process_PCM_ElectronFromDalitz, "create filter bit for PCM, ElectronFromDalitz", false); PROCESS_SWITCH(filterEoI, processDummy, "processDummy", true); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 8f362d1d29a523edd1839779714e3a920ed8c467 Mon Sep 17 00:00:00 2001 From: fkrizek Date: Fri, 8 Aug 2025 18:50:00 +0200 Subject: [PATCH 298/345] [PWGJE] added FT0 scaled histograms vs ZDC (#12487) Co-authored-by: ALICE Action Bot --- PWGJE/Tasks/recoilJets.cxx | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/PWGJE/Tasks/recoilJets.cxx b/PWGJE/Tasks/recoilJets.cxx index acd00af069c..ebf69f44e10 100644 --- a/PWGJE/Tasks/recoilJets.cxx +++ b/PWGJE/Tasks/recoilJets.cxx @@ -417,7 +417,6 @@ struct RecoilJets { {{200, 0.0, 20.}}); spectra.add("hScaleMultFT0M", "Scaled total mult. signal from FT0A & FTOC", kTH1F, {{200, 0.0, 20.}}); - spectra.add("hScaleMultFT0M_v2", "Scaled total mult. signal from FT0A & FTOC", kTH1F, {{200, 0.0, 20.}}); @@ -435,6 +434,14 @@ struct RecoilJets { kTH2F, {{1500, 0.0, 30000.}, {500, 0.0, 10000.}}); spectra.add("hMultFT0M_vs_ZNM", "Correlation of signals FTOM vs ZNM", kTH2F, {{3000, 0.0, 60000.}, {1000, 0.0, 20000.}}); + spectra.add("hScaleMultFT0A_vs_ZNA", "Correlation of signals FT0A/meanFT0A vs ZNA", + kTH2F, {{200, 0.0, 20.}, {500, 0.0, 10000.}}); + spectra.add("hScaleMultFT0C_vs_ZNC", "Correlation of signals FT0C/meanFT0C vs ZNC", + kTH2F, {{200, 0.0, 20.}, {500, 0.0, 10000.}}); + spectra.add("hScaleMultFT0M_vs_ZNM", "Correlation of signals FT0M/meanTF0M vs ZNM", + kTH2F, {{200, 0.0, 20.}, {1000, 0.0, 20000.}}); + spectra.add("hScaleMultFT0Mv2_vs_ZNM", "Correlation of signals FT0M/meanTF0M v2 vs ZNM", + kTH2F, {{200, 0.0, 20.}, {1000, 0.0, 20000.}}); } } @@ -680,10 +687,12 @@ struct RecoilJets { spectra.fill(HIST("hMultFT0C"), collision.multFT0C(), weight); spectra.fill(HIST("hMultFT0M"), collision.multFT0M(), weight); + float scaledFT0Mv2 = 0.5 * (collision.multFT0A() / meanFT0A + collision.multFT0C() / meanFT0C); + spectra.fill(HIST("hScaleMultFT0A"), collision.multFT0A() / meanFT0A, weight); spectra.fill(HIST("hScaleMultFT0C"), collision.multFT0C() / meanFT0C, weight); spectra.fill(HIST("hScaleMultFT0M"), collision.multFT0M() / meanFT0M, weight); - spectra.fill(HIST("hScaleMultFT0M_v2"), collision.multFT0A() / meanFT0A + collision.multFT0C() / meanFT0C, + spectra.fill(HIST("hScaleMultFT0M_v2"), scaledFT0Mv2, weight); spectra.fill(HIST("hMultZNA"), collision.multZNA(), weight); @@ -698,6 +707,14 @@ struct RecoilJets { collision.multZNC(), weight); spectra.fill(HIST("hMultFT0M_vs_ZNM"), collision.multFT0M(), collision.multZNA() + collision.multZNC(), weight); + spectra.fill(HIST("hScaleMultFT0A_vs_ZNA"), collision.multFT0A() / meanFT0A, + collision.multZNA(), weight); + spectra.fill(HIST("hScaleMultFT0C_vs_ZNC"), collision.multFT0C() / meanFT0C, + collision.multZNC(), weight); + spectra.fill(HIST("hScaleMultFT0M_vs_ZNM"), collision.multFT0M() / meanFT0M, + collision.multZNA() + collision.multZNC(), weight); + spectra.fill(HIST("hScaleMultFT0Mv2_vs_ZNM"), scaledFT0Mv2, + collision.multZNA() + collision.multZNC(), weight); } //------------------------------------------------------------------------------ From 1b169d380beba795fcde2edc95c50beaba4b4788 Mon Sep 17 00:00:00 2001 From: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Date: Fri, 8 Aug 2025 20:14:55 +0200 Subject: [PATCH 299/345] [PWGLF] Apply TOF only if available + add different centrality estimators (#12498) Co-authored-by: ALICE Action Bot --- .../derivedlambdakzeroanalysis.cxx | 62 ++++++++++++++----- 1 file changed, 45 insertions(+), 17 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx b/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx index 544ed23807a..2c872c3500f 100644 --- a/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx +++ b/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx @@ -83,6 +83,14 @@ using V0McCandidates = soa::Join(1) << static_cast(nbit))) #define BITCHECK(var, nbit) ((var) & (static_cast(1) << static_cast(nbit))) +enum CentEstimator { + kCentFT0C = 0, + kCentFT0M, + kCentFT0CVariant1, + kCentMFT, + kCentNGlobal +}; + struct derivedlambdakzeroanalysis { HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -96,6 +104,7 @@ struct derivedlambdakzeroanalysis { Configurable doPPAnalysis{"doPPAnalysis", false, "if in pp, set to true"}; Configurable irSource{"irSource", "T0VTX", "Estimator of the interaction rate (Recommended: pp --> T0VTX, Pb-Pb --> ZNC hadronic)"}; + Configurable centralityEstimator{"centralityEstimator", kCentFT0C, "Run 3 centrality estimator (0:CentFT0C, 1:CentFT0M, 3:CentFT0CVariant1, 4:CentMFT, 5:CentNGlobal)"}; struct : ConfigurableGroup { Configurable requireSel8{"requireSel8", true, "require sel8 event selection"}; @@ -273,7 +282,7 @@ struct derivedlambdakzeroanalysis { ConfigurableAxis axisPtCoarse{"axisPtCoarse", {VARIABLE_WIDTH, 0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 7.0f, 10.0f, 15.0f}, "pt axis for QA"}; ConfigurableAxis axisK0Mass{"axisK0Mass", {200, 0.4f, 0.6f}, ""}; ConfigurableAxis axisLambdaMass{"axisLambdaMass", {200, 1.101f, 1.131f}, ""}; - ConfigurableAxis axisCentrality{"axisCentrality", {VARIABLE_WIDTH, 0.0f, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f}, "Centrality"}; + ConfigurableAxis axisCentrality{"axisCentrality", {VARIABLE_WIDTH, 0.0f, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f}, "Centrality (%)"}; ConfigurableAxis axisNch{"axisNch", {500, 0.0f, +5000.0f}, "Number of charged particles"}; ConfigurableAxis axisIRBinning{"axisIRBinning", {500, 0, 50}, "Binning for the interaction rate (kHz)"}; @@ -971,6 +980,25 @@ struct derivedlambdakzeroanalysis { histos.print(); } + // ______________________________________________________ + // Return slicing output + template + auto getCentralityRun3(TCollision const& collision) + { + if (centralityEstimator == kCentFT0C) + return collision.centFT0C(); + else if (centralityEstimator == kCentFT0M) + return collision.centFT0M(); + else if (centralityEstimator == kCentFT0CVariant1) + return collision.centFT0CVariant1(); + else if (centralityEstimator == kCentMFT) + return collision.centMFT(); + else if (centralityEstimator == kCentNGlobal) + return collision.centNGlobal(); + + return -1.f; + } + // ______________________________________________________ // Return slicing output template @@ -1073,34 +1101,34 @@ struct derivedlambdakzeroanalysis { // TOF PID in DeltaT // Positive track - if (std::fabs(v0.posTOFDeltaTLaPr()) < v0Selections.maxDeltaTimeProton) + if (!posTrackExtra.hasTOF() || std::fabs(v0.posTOFDeltaTLaPr()) < v0Selections.maxDeltaTimeProton) BITSET(bitMap, selTOFDeltaTPositiveProtonLambda); - if (std::fabs(v0.posTOFDeltaTLaPi()) < v0Selections.maxDeltaTimePion) + if (!posTrackExtra.hasTOF() || std::fabs(v0.posTOFDeltaTLaPi()) < v0Selections.maxDeltaTimePion) BITSET(bitMap, selTOFDeltaTPositivePionLambda); - if (std::fabs(v0.posTOFDeltaTK0Pi()) < v0Selections.maxDeltaTimePion) + if (!posTrackExtra.hasTOF() || std::fabs(v0.posTOFDeltaTK0Pi()) < v0Selections.maxDeltaTimePion) BITSET(bitMap, selTOFDeltaTPositivePionK0Short); // Negative track - if (std::fabs(v0.negTOFDeltaTLaPr()) < v0Selections.maxDeltaTimeProton) + if (!negTrackExtra.hasTOF() || std::fabs(v0.negTOFDeltaTLaPr()) < v0Selections.maxDeltaTimeProton) BITSET(bitMap, selTOFDeltaTNegativeProtonLambda); - if (std::fabs(v0.negTOFDeltaTLaPi()) < v0Selections.maxDeltaTimePion) + if (!negTrackExtra.hasTOF() || std::fabs(v0.negTOFDeltaTLaPi()) < v0Selections.maxDeltaTimePion) BITSET(bitMap, selTOFDeltaTNegativePionLambda); - if (std::fabs(v0.negTOFDeltaTK0Pi()) < v0Selections.maxDeltaTimePion) + if (!negTrackExtra.hasTOF() || std::fabs(v0.negTOFDeltaTK0Pi()) < v0Selections.maxDeltaTimePion) BITSET(bitMap, selTOFDeltaTNegativePionK0Short); // TOF PID in NSigma // Positive track - if (std::fabs(v0.tofNSigmaLaPr()) < v0Selections.tofPidNsigmaCutLaPr) + if (!posTrackExtra.hasTOF() || std::fabs(v0.tofNSigmaLaPr()) < v0Selections.tofPidNsigmaCutLaPr) BITSET(bitMap, selTOFNSigmaPositiveProtonLambda); - if (std::fabs(v0.tofNSigmaALaPi()) < v0Selections.tofPidNsigmaCutLaPi) + if (!posTrackExtra.hasTOF() || std::fabs(v0.tofNSigmaALaPi()) < v0Selections.tofPidNsigmaCutLaPi) BITSET(bitMap, selTOFNSigmaPositivePionLambda); - if (std::fabs(v0.tofNSigmaK0PiPlus()) < v0Selections.tofPidNsigmaCutK0Pi) + if (!posTrackExtra.hasTOF() || std::fabs(v0.tofNSigmaK0PiPlus()) < v0Selections.tofPidNsigmaCutK0Pi) BITSET(bitMap, selTOFNSigmaPositivePionK0Short); // Negative track - if (std::fabs(v0.tofNSigmaALaPr()) < v0Selections.tofPidNsigmaCutLaPr) + if (!negTrackExtra.hasTOF() || std::fabs(v0.tofNSigmaALaPr()) < v0Selections.tofPidNsigmaCutLaPr) BITSET(bitMap, selTOFNSigmaNegativeProtonLambda); - if (std::fabs(v0.tofNSigmaLaPi()) < v0Selections.tofPidNsigmaCutLaPi) + if (!negTrackExtra.hasTOF() || std::fabs(v0.tofNSigmaLaPi()) < v0Selections.tofPidNsigmaCutLaPi) BITSET(bitMap, selTOFNSigmaNegativePionLambda); - if (std::fabs(v0.tofNSigmaK0PiMinus()) < v0Selections.tofPidNsigmaCutK0Pi) + if (!negTrackExtra.hasTOF() || std::fabs(v0.tofNSigmaK0PiMinus()) < v0Selections.tofPidNsigmaCutK0Pi) BITSET(bitMap, selTOFNSigmaNegativePionK0Short); // ITS only tag @@ -2016,7 +2044,7 @@ struct derivedlambdakzeroanalysis { void fillReconstructedEventProperties(TCollision const& collision, float& centrality, float& collisionOccupancy, double& interactionRate, int& gapSide, int& selGapSide) { if constexpr (requires { collision.centFT0C(); }) { // check if we are in Run 3 - centrality = doPPAnalysis ? collision.centFT0M() : collision.centFT0C(); + centrality = getCentralityRun3(collision); collisionOccupancy = eventSelections.useFT0CbasedOccupancy ? collision.ft0cOccupancyInTimeRange() : collision.trackOccupancyInTimeRange(); // Fetch interaction rate only if required (in order to limit ccdb calls) interactionRate = !irSource.value.empty() ? rateFetcher.fetch(ccdb.service, collision.timestamp(), collision.runNumber(), irSource) * 1.e-3 : -1; @@ -2098,7 +2126,7 @@ struct derivedlambdakzeroanalysis { if constexpr (run3) { // check if we are in Run 3 if (biggestNContribs < collision.multPVTotalContributors()) { biggestNContribs = collision.multPVTotalContributors(); - centrality = doPPAnalysis ? collision.centFT0M() : collision.centFT0C(); + centrality = getCentralityRun3(collision); } } else { // we are in Run 2: there should be only one collision in groupedCollisions centrality = eventSelections.useSPDTrackletsCent ? collision.centRun2SPDTracklets() : collision.centRun2V0M(); @@ -2337,7 +2365,7 @@ struct derivedlambdakzeroanalysis { if (listBestCollisionIdx[mcCollision.globalIndex()] > -1) { auto collision = collisions.iteratorAt(listBestCollisionIdx[mcCollision.globalIndex()]); if constexpr (requires { collision.centFT0C(); }) { // check if we are in Run 3 - centrality = doPPAnalysis ? collision.centFT0M() : collision.centFT0C(); + centrality = getCentralityRun3(collision); } else { // no, we are in Run 2 centrality = eventSelections.useSPDTrackletsCent ? collision.centRun2SPDTracklets() : collision.centRun2V0M(); } @@ -2402,7 +2430,7 @@ struct derivedlambdakzeroanalysis { if (listBestCollisionIdx[mcCollision.globalIndex()] > -1) { auto collision = collisions.iteratorAt(listBestCollisionIdx[mcCollision.globalIndex()]); if constexpr (requires { collision.centFT0C(); }) { // check if we are in Run 3 - centrality = doPPAnalysis ? collision.centFT0M() : collision.centFT0C(); + centrality = getCentralityRun3(collision); } else { // no, we are in Run 2 centrality = eventSelections.useSPDTrackletsCent ? collision.centRun2SPDTracklets() : collision.centRun2V0M(); } From 26db07228ed9827d4938ae684aefb33dd4c87e0e Mon Sep 17 00:00:00 2001 From: alcaliva <32872606+alcaliva@users.noreply.github.com> Date: Fri, 8 Aug 2025 20:50:34 +0200 Subject: [PATCH 300/345] [PWGLF] refactored and optimized antiproton loop, moved ITSResponse init, added MC config option (#12489) --- PWGLF/Tasks/Nuspex/antinucleiInJets.cxx | 59 +++++++++++-------------- 1 file changed, 25 insertions(+), 34 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx b/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx index 4ec0538917d..a84c39ed953 100644 --- a/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx +++ b/PWGLF/Tasks/Nuspex/antinucleiInJets.cxx @@ -138,6 +138,7 @@ struct AntinucleiInJets { Configurable ptMaxItsPidHel{"ptMaxItsPidHel", 1.0, "maximum pt for ITS PID for helium"}; Configurable nSigmaItsMin{"nSigmaItsMin", -3.0, "nSigmaITS min"}; Configurable nSigmaItsMax{"nSigmaItsMax", +3.0, "nSigmaITS max"}; + Configurable setMCDefaultItsParams{"setMCDefaultItsParams", false, "set MC default parameters"}; // CCDB manager service for accessing condition data Service ccdb; @@ -152,6 +153,9 @@ struct AntinucleiInJets { // Utility object for jet background subtraction methods JetBkgSubUtils backgroundSub; + // Initialize ITS PID Response object + o2::aod::ITSResponse itsResponse; + // Initialize CCDB access and histogram registry for Zorro processing void initCCDB(aod::BCsWithTimestamps::iterator const& bc) { @@ -168,6 +172,11 @@ struct AntinucleiInJets { zorroSummary.setObject(zorro.getZorroSummary()); } + // Set default MC parametrization for ITS response + if (setMCDefaultItsParams) { + itsResponse.setMCDefaultParameters(); + } + // Binning double min = 0.0; double max = 6.0; @@ -743,9 +752,6 @@ struct AntinucleiInJets { return; registryData.fill(HIST("number_of_events_data"), 8.5); - // Initialize ITS PID Response object - o2::aod::ITSResponse itsResponse; - // Loop over reconstructed tracks int id(-1); std::vector fjParticles; @@ -1182,11 +1188,6 @@ struct AntinucleiInJets { // Antinuclei reconstruction efficiency void processAntinucleiEfficiency(RecCollisionsMc const& collisions, AntiNucleiTracksMc const& mcTracks, aod::McParticles const& mcParticles) { - - // Initialize ITS PID Response object - o2::aod::ITSResponse itsResponse; - itsResponse.setMCDefaultParameters(); - // Loop over all simulated collision events for (const auto& collision : collisions) { @@ -1496,10 +1497,6 @@ struct AntinucleiInJets { // Reconstructed events void processJetsMCrec(RecCollisionsMc const& collisions, AntiNucleiTracksMc const& mcTracks, McParticles const&) { - // Initialize ITS PID Response object - o2::aod::ITSResponse itsResponse; - itsResponse.setMCDefaultParameters(); - // Loop over all reconstructed collisions for (const auto& collision : collisions) { @@ -1546,8 +1543,21 @@ struct AntinucleiInJets { // Loop over reconstructed tracks int id(-1); std::vector fjParticles; + std::vector trackIndex; for (auto const& track : mcTracks) { id++; + + // Get corresponding MC particle + if (!track.has_mcParticle()) + continue; + const auto mcparticle = track.mcParticle(); + + // Store track index for antiproton tracks + if (passedTrackSelection(track) && track.sign() < 0 && mcparticle.pdgCode() == PDG_t::kProtonBar) { + trackIndex.emplace_back(id); + } + + // Apply track selection for jet reconstruction if (!passedTrackSelectionForJetReconstruction(track)) continue; @@ -1667,25 +1677,16 @@ struct AntinucleiInJets { } // Loop over tracks in the underlying event - for (auto const& track : mcTracks) { + for (auto const& index : trackIndex) { - // Apply track selection - if (!passedTrackSelection(track)) - continue; - - // Antiproton selection - if (track.sign() > 0) - continue; + // retrieve track associated to index + auto const& track = mcTracks.iteratorAt(index); // Get corresponding MC particle if (!track.has_mcParticle()) continue; const auto mcparticle = track.mcParticle(); - // Antiproton selection based on the PDG - if (mcparticle.pdgCode() != PDG_t::kProtonBar) - continue; - // Define variables double nsigmaTPCPr = track.tpcNSigmaPr(); double nsigmaTOFPr = track.tofNSigmaPr(); @@ -1800,9 +1801,6 @@ struct AntinucleiInJets { return; registryData.fill(HIST("number_of_events_data_syst"), 7.5); - // Initialize ITS PID Response object - o2::aod::ITSResponse itsResponse; - // Cut settings static std::vector maxDcaxySyst = { 0.071, 0.060, 0.066, 0.031, 0.052, 0.078, 0.045, 0.064, 0.036, 0.074, @@ -1907,10 +1905,6 @@ struct AntinucleiInJets { // Process MC with systematic variations of analysis parameters void processSystEff(GenCollisionsMc const& genCollisions, RecCollisionsMc const& recCollisions, AntiNucleiTracksMc const& mcTracks, aod::McParticles const& mcParticles) { - // Initialize ITS PID Response object - o2::aod::ITSResponse itsResponse; - itsResponse.setMCDefaultParameters(); - // Cut settings static std::vector maxDcaxySyst = { 0.071, 0.060, 0.066, 0.031, 0.052, 0.078, 0.045, 0.064, 0.036, 0.074, @@ -2149,9 +2143,6 @@ struct AntinucleiInJets { return; registryCorr.fill(HIST("eventCounter"), 7.5); - // Initialize ITS PID Response object - o2::aod::ITSResponse itsResponse; - // Multiplicity percentile const float multiplicity = collision.centFT0M(); From 83227024d580ec99ad888983e5f3eaa573c0c84e Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Fri, 8 Aug 2025 22:17:48 +0200 Subject: [PATCH 301/345] [PWGEM/Dilepton] swap axes for visualization (#12502) --- PWGEM/Dilepton/Core/DileptonHadronMPC.h | 8 ++++---- PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/PWGEM/Dilepton/Core/DileptonHadronMPC.h b/PWGEM/Dilepton/Core/DileptonHadronMPC.h index c3e23080ffa..b8d54f9217d 100644 --- a/PWGEM/Dilepton/Core/DileptonHadronMPC.h +++ b/PWGEM/Dilepton/Core/DileptonHadronMPC.h @@ -527,7 +527,7 @@ struct DileptonHadronMPC { // hadron-hadron const AxisSpec axis_dphi_hh{cfgNbinsDPhi, -M_PI / 2, 3 * M_PI / 2, "#Delta#varphi = #varphi_{h}^{ref1} - #varphi_{h}^{ref2} (rad.)"}; - fRegistry.add("HadronHadron/same/hDEtaDPhi", "hadron-hadron 2PC", kTH2D, {axis_deta_hh, axis_dphi_hh}, true); + fRegistry.add("HadronHadron/same/hDEtaDPhi", "hadron-hadron 2PC", kTH2D, {axis_dphi_hh, axis_deta_hh}, true); fRegistry.addClone("HadronHadron/same/", "HadronHadron/mix/"); fRegistry.add("HadronHadron/mix/hDiffBC", "diff. global BC in mixed event;|BC_{current} - BC_{mixed}|", kTH1D, {{10001, -0.5, 10000.5}}, true); } else if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonHadronAnalysisType::kCumulant)) { @@ -541,7 +541,7 @@ struct DileptonHadronMPC { // hadron-hadron const AxisSpec axis_cosndphi_hh{cfgNbinsCosNDPhi, -1, +1, std::format("cos({0:d}(#varphi_{{h}}^{{trg}} - #varphi_{{h}}^{{ref}}))", cfgNmod.value)}; - fRegistry.add("HadronHadron/same/hDEtaCosNDPhi", "hadron-hadron 2PC", kTH2D, {axis_deta_hh, axis_cosndphi_hh}, true); + fRegistry.add("HadronHadron/same/hDEtaCosNDPhi", "hadron-hadron 2PC", kTH2D, {axis_cosndphi_hh, axis_deta_hh}, true); } fRegistry.add("Dilepton/mix/hDiffBC", "diff. global BC in mixed event;|BC_{current} - BC_{mixed}|", kTH1D, {{10001, -0.5, 10000.5}}, true); } @@ -994,11 +994,11 @@ struct DileptonHadronMPC { if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonHadronAnalysisType::kAzimuthalCorrelation)) { dphi = RecoDecay::constrainAngle(dphi, -M_PI / 2, 1U); - fRegistry.fill(HIST("HadronHadron/") + HIST(event_pair_types[ev_id]) + HIST("hDEtaDPhi"), deta, dphi, weight); + fRegistry.fill(HIST("HadronHadron/") + HIST(event_pair_types[ev_id]) + HIST("hDEtaDPhi"), dphi, deta, weight); } else if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonHadronAnalysisType::kCumulant)) { o2::math_utils::bringTo02Pi(dphi); float cosndphi = std::cos(cfgNmod * dphi); - fRegistry.fill(HIST("HadronHadron/") + HIST(event_pair_types[ev_id]) + HIST("hDEtaCosNDPhi"), deta, cosndphi, weight); + fRegistry.fill(HIST("HadronHadron/") + HIST(event_pair_types[ev_id]) + HIST("hDEtaCosNDPhi"), cosndphi, deta, weight); } // store ref tracks for mixed event in case of kAzimuthalCorrelation diff --git a/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h b/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h index 07a35ca0da6..706bb6ad6c4 100644 --- a/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h +++ b/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h @@ -374,7 +374,7 @@ struct DiphotonHadronMPC { const AxisSpec axis_deta_hh{ConfDEtaBins, "#Delta#eta = #eta_{h}^{ref1} - #eta_{h}^{ref2}"}; const AxisSpec axis_dphi_hh{cfgNbinsDPhi, -M_PI / 2, +3 * M_PI / 2, "#Delta#varphi = #varphi_{h}^{ref1} - #varphi_{h}^{ref2} (rad.)"}; // const AxisSpec axis_cosndphi_hh{cfgNbinsCosNDPhi, -1, +1, std::format("cos({0:d}(#varphi_{{h}}^{{ref1}} - #varphi_{{h}}^{{ref2}}))", cfgNmod.value)}; - fRegistry.add("HadronHadron/same/hDEtaDPhi", "hadron-hadron 2PC", kTH2D, {axis_deta_hh, axis_dphi_hh}, true); + fRegistry.add("HadronHadron/same/hDEtaDPhi", "hadron-hadron 2PC", kTH2D, {axis_dphi_hh, axis_deta_hh}, true); fRegistry.addClone("HadronHadron/same/", "HadronHadron/mix/"); } @@ -720,7 +720,7 @@ struct DiphotonHadronMPC { float dphi = ref1.phi() - ref2.phi(); // o2::math_utils::bringTo02Pi(dphi); dphi = RecoDecay::constrainAngle(dphi, -M_PI / 2, 1U); - fRegistry.fill(HIST("HadronHadron/same/hDEtaDPhi"), deta, dphi); + fRegistry.fill(HIST("HadronHadron/same/hDEtaDPhi"), dphi, deta); } } } @@ -917,7 +917,7 @@ struct DiphotonHadronMPC { float dphi = ref1.phi() - ref2.phi(); // o2::math_utils::bringTo02Pi(dphi); dphi = RecoDecay::constrainAngle(dphi, -M_PI / 2, 1U); - fRegistry.fill(HIST("HadronHadron/mix/hDEtaDPhi"), deta, dphi); + fRegistry.fill(HIST("HadronHadron/mix/hDEtaDPhi"), dphi, deta); } } } // end of loop over mixed event pool between hadron-hadron From 30acb4443926165bf7e9f56e077093a168b52f9d Mon Sep 17 00:00:00 2001 From: Matteo Morgante Date: Fri, 8 Aug 2025 22:51:28 +0200 Subject: [PATCH 302/345] [PWGLF] Added processFindable method for kinkBuilder efficiency analysis (#12477) Co-authored-by: ALICE Action Bot --- .../Strangeness/sigmaminustask.cxx | 472 +++++++++++++++++- 1 file changed, 451 insertions(+), 21 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/sigmaminustask.cxx b/PWGLF/TableProducer/Strangeness/sigmaminustask.cxx index fbf5929effc..c9b2d58f08c 100644 --- a/PWGLF/TableProducer/Strangeness/sigmaminustask.cxx +++ b/PWGLF/TableProducer/Strangeness/sigmaminustask.cxx @@ -15,12 +15,19 @@ #include "PWGLF/DataModel/LFKinkDecayTables.h" +#include "Common/Core/trackUtilities.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/PIDResponse.h" +#include "CCDB/BasicCCDBManager.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "DataFormatsParameters/GRPObject.h" +#include "DetectorsBase/GeometryManager.h" +#include "DetectorsBase/Propagator.h" #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" #include "ReconstructionDataFormats/PID.h" +#include "ReconstructionDataFormats/Track.h" using namespace o2; using namespace o2::framework; @@ -41,46 +48,183 @@ struct sigmaminustask { // Histograms are defined with HistogramRegistry HistogramRegistry rEventSelection{"eventSelection", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry rSigmaMinus{"sigmaminus", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry rFindable{"findable", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; // Configurable for event selection Configurable cutzvertex{"cutzvertex", 10.0f, "Accepted z-vertex range (cm)"}; Configurable cutNSigmaPi{"cutNSigmaPi", 4, "NSigmaTPCPion"}; - Configurable cutEtaMotherMC{"cutEtaMotherMC", 1.0f, "Eta cut for mother Sigma in MC"}; + Configurable cutRapMotherMC{"cutRapMotherMC", 1.0f, "Rapidity cut for mother Sigma in MC"}; + Configurable cutMinQtAP{"cutMinQtAP", 0.15f, "Minimum Qt for Armenteros-Podolanski cut"}; + Configurable cutMaxQtAP{"cutMaxQtAP", 0.20f, "Maximum Qt for Armenteros-Podolanski cut"}; Configurable fillOutputTree{"fillOutputTree", true, "If true, fill the output tree with Kink candidates"}; + // Configurables for findable tracks (kinkBuilder.cxx efficiency) + Configurable minPtMothKB{"minPtMothKB", 0.5f, "Minimum pT of the mother"}; + Configurable maxPhiDiffKB{"maxPhiDiffKB", 100.0f, "Max phi difference between the kink daughter and the mother"}; + Configurable maxZDiffKB{"maxZDiffKB", 20.0f, "Max z difference between the kink daughter and the mother"}; + Configurable etaMaxKB{"etaMaxKB", 1.0f, "Max eta for both mother and daughter"}; + Configurable nTPCClusMinDaugKB{"nTPCClusMinDaugKB", 80, "Min daug NTPC clusters"}; + Configurable radiusCutKB{"radiusCutKB", 19.6213f, "Min reconstructed decay radius of the mother"}; + Configurable maxDcaMothPvKB{"maxDcaMothPvKB", 0.1f, "Max DCA of the mother to PV"}; + Configurable minDcaDaugPvKB{"minDcaDaugPvKB", 0.1f, "Min DCA of the daughter to PV"}; + Preslice mPerCol = aod::track::collisionId; + // Constants + float radToDeg = o2::constants::math::Rad2Deg; + + // Services CCDB + Service ccdb; + Configurable ccdbPath{"ccdbPath", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; + Configurable lutPath{"lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"}; + Configurable cfgMaterialCorrection{"cfgMaterialCorrection", static_cast(o2::base::Propagator::MatCorrType::USEMatCorrLUT), "Type of material correction"}; + + // Runtime variables + int mRunNumber = 0; + float mBz = 0.0f; + o2::base::MatLayerCylSet* matLUT = nullptr; + void init(InitContext const&) { + // Initialize CCDB + ccdb->setURL(ccdbPath); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setFatalWhenNull(true); + + matLUT = o2::base::MatLayerCylSet::rectifyPtrFromFile(ccdb->get("GLO/Param/MatLUT")); + // Axes const AxisSpec ptAxis{100, -10, 10, "#it{p}_{T} (GeV/#it{c})"}; - const AxisSpec nSigmaPiAxis{100, -5, 5, "n#sigma_{#pi}"}; + const AxisSpec ptUnsignedAxis{100, 0, 10, "#it{p}_{T} (GeV/#it{c})"}; + const AxisSpec nSigmaPiAxis{60, -30, 30, "n#sigma_{#pi}"}; + const AxisSpec nSigmaPrAxis{60, -30, 30, "n#sigma_{p}"}; const AxisSpec sigmaMassAxis{100, 1.1, 1.4, "m (GeV/#it{c}^{2})"}; const AxisSpec xiMassAxis{100, 1.2, 1.6, "m_{#Xi} (GeV/#it{c}^{2})"}; const AxisSpec pdgAxis{10001, -5000, 5000, "PDG code"}; const AxisSpec vertexZAxis{100, -15., 15., "vrtx_{Z} [cm]"}; + const AxisSpec dcaMothAxis{100, 0, 0.03, "DCA [cm]"}; + const AxisSpec dcaDaugAxis{200, 0, 20, "DCA [cm]"}; + const AxisSpec radiusAxis{100, -1, 40, "Decay radius [cm]"}; + const AxisSpec alphaAPAxis{200, -1.0, 1.0, "#alpha_{AP}"}; + const AxisSpec qtAPAxis{200, 0.0, 0.5, "q_{T,AP}"}; + const AxisSpec cosPointingAngleAxis{100, -1.0, 1.0, "Cos#theta_{PA}"}; - const AxisSpec ptResolutionAxis{100, -0.5, 0.5, "#it{p}_{T}^{rec} - #it{p}_{T}^{gen} (GeV/#it{c})"}; - const AxisSpec massResolutionAxis{100, -0.1, 0.1, "m_{rec} - m_{gen} (GeV/#it{c}^{2})"}; + const AxisSpec ptResolutionAxis{100, -1.0, 1.0, "(#it{p}_{T}^{rec} - #it{p}_{T}^{gen}) / #it{p}_{T}^{gen}"}; + const AxisSpec massResolutionAxis{100, -0.5, 0.5, "(m_{rec} - m_{gen}) / m_{gen}"}; + const AxisSpec radiusResolutionAxis{100, -0.5, 0.5, "(r_{rec} - r_{gen}) / r_{gen}"}; + + const AxisSpec boolAxis{2, -0.5, 1.5, "Boolean value"}; + const AxisSpec filtersAxis{12, -0.5, 11.5, "Filter index"}; + const AxisSpec fakeITSAxis{8, -1.5, 6.5, "Fake ITS cluster layer"}; // Event selection rEventSelection.add("hVertexZRec", "hVertexZRec", {HistType::kTH1F, {vertexZAxis}}); // Sigma-minus reconstruction rSigmaMinus.add("h2MassSigmaMinusPt", "h2MassSigmaMinusPt", {HistType::kTH2F, {ptAxis, sigmaMassAxis}}); rSigmaMinus.add("h2SigmaMassVsXiMass", "h2SigmaMassVsXiMass", {HistType::kTH2F, {xiMassAxis, sigmaMassAxis}}); - rSigmaMinus.add("h2NSigmaPiPt", "h2NSigmaPiPt", {HistType::kTH2F, {ptAxis, nSigmaPiAxis}}); + rSigmaMinus.add("h2NSigmaTPCPiPt", "h2NSigmaTPCPiPt", {HistType::kTH2F, {ptAxis, nSigmaPiAxis}}); + rSigmaMinus.add("h2DCAMothPt", "h2DCAMothPt", {HistType::kTH2F, {ptAxis, dcaMothAxis}}); + rSigmaMinus.add("h2DCADaugPt", "h2DCADaugPt", {HistType::kTH2F, {ptAxis, dcaDaugAxis}}); + rSigmaMinus.add("h2ArmenterosPreCuts", "h2ArmenterosPreCuts", {HistType::kTH2F, {alphaAPAxis, qtAPAxis}}); + rSigmaMinus.add("h2CosPointingAnglePt", "h2CosPointingAnglePt", {HistType::kTH2F, {ptAxis, cosPointingAngleAxis}}); if (doprocessMC) { // Add MC histograms if needed rSigmaMinus.add("h2MassPtMCRec", "h2MassPtMCRec", {HistType::kTH2F, {ptAxis, sigmaMassAxis}}); rSigmaMinus.add("h2MassPtMCGen", "h2MassPtMCGen", {HistType::kTH2F, {ptAxis, sigmaMassAxis}}); - rSigmaMinus.add("h2MassResolution_minus", "h2MassResolution_minus", {HistType::kTH2F, {sigmaMassAxis, massResolutionAxis}}); - rSigmaMinus.add("h2PtResolution_minus", "h2PtResolution_minus", {HistType::kTH2F, {ptAxis, ptResolutionAxis}}); - rSigmaMinus.add("h2MassResolution_plus", "h2MassResolution_plus", {HistType::kTH2F, {sigmaMassAxis, massResolutionAxis}}); - rSigmaMinus.add("h2PtResolution_plus", "h2PtResolution_plus", {HistType::kTH2F, {ptAxis, ptResolutionAxis}}); + rSigmaMinus.add("h2MassResolution", "h2MassResolution", {HistType::kTH2F, {ptAxis, massResolutionAxis}}); + rSigmaMinus.add("h2PtResolution", "h2PtResolution", {HistType::kTH2F, {ptAxis, ptResolutionAxis}}); + rSigmaMinus.add("h2RadiusResolution", "h2RadiusResolution", {HistType::kTH2F, {ptAxis, radiusResolutionAxis}}); + + rSigmaMinus.add("h2NSigmaTOFPiPt", "h2NSigmaTOFPiPt", {HistType::kTH2F, {ptAxis, nSigmaPiAxis}}); + rSigmaMinus.add("h2NSigmaTOFPrPt", "h2NSigmaTOFPrPt", {HistType::kTH2F, {ptAxis, nSigmaPrAxis}}); + + // BC ID comparison histograms + rSigmaMinus.add("hMcCollIdCoherence", "McCollId (coll == daug)", {HistType::kTH1F, {boolAxis}}); + rSigmaMinus.add("h2CollId_BCId", "(McCollId coherence) vs (EvSelBC == McBC)", {HistType::kTH2F, {boolAxis, boolAxis}}); + rSigmaMinus.add("h2BCId_comp", "(McBC == EvSelBC) vs (BC == EvSelBC)", {HistType::kTH2F, {boolAxis, boolAxis}}); + } + + if (doprocessFindable) { + std::vector filterLabels = {"Initial", "ITS/TPC present", "ITS/TPC quality", "Moth p_{T}", "max #eta", "max #Delta#phi", "max #Delta Z", "max DCAmoth", "min DCAdaug", "min Radius", "sel8 coll", "Daug TOF"}; + + // Add findable Sigma histograms + rFindable.add("hfakeITSfindable", "hfakeITSfindable", {HistType::kTH1F, {fakeITSAxis}}); + rFindable.add("hFilterIndex", "hFilterIndex", {HistType::kTH1F, {filtersAxis}}); + rFindable.add("h2MCRadiusFilterIndex", "h2MCRadiusFilterIndex", {HistType::kTH2F, {filtersAxis, radiusAxis}}); + rFindable.add("h2RecRadiusFilterIndex", "h2RecRadiusFilterIndex", {HistType::kTH2F, {filtersAxis, radiusAxis}}); + + auto hFilterIndex = rFindable.get(HIST("hFilterIndex")); + auto h2MCRadiusFilterIndex = rFindable.get(HIST("h2MCRadiusFilterIndex")); + auto h2RecRadiusFilterIndex = rFindable.get(HIST("h2RecRadiusFilterIndex")); + for (size_t i = 0; i < filterLabels.size(); ++i) { + hFilterIndex->GetXaxis()->SetBinLabel(i + 1, filterLabels[i].c_str()); + h2MCRadiusFilterIndex->GetXaxis()->SetBinLabel(i + 1, filterLabels[i].c_str()); + h2RecRadiusFilterIndex->GetXaxis()->SetBinLabel(i + 1, filterLabels[i].c_str()); + } + + rFindable.add("h2MCRadiusFilter_plus_protonkink", "h2MCRadiusFilter_plus_protonkink", {HistType::kTH2F, {filtersAxis, radiusAxis}}); + rFindable.add("h2MCRadiusFilter_plus_pikink", "h2MCRadiusFilter_plus_pikink", {HistType::kTH2F, {filtersAxis, radiusAxis}}); + rFindable.add("h2MCRadiusFilter_minus_pikink", "h2MCRadiusFilter_minus_pikink", {HistType::kTH2F, {filtersAxis, radiusAxis}}); + + rFindable.add("h2PtFilter_plus_protonkink", "h2PtFilter_plus_protonkink", {HistType::kTH2F, {filtersAxis, ptUnsignedAxis}}); + rFindable.add("h2PtFilter_plus_pikink", "h2PtFilter_plus_pikink", {HistType::kTH2F, {filtersAxis, ptUnsignedAxis}}); + rFindable.add("h2PtFilter_minus_pikink", "h2PtFilter_minus_pikink", {HistType::kTH2F, {filtersAxis, ptUnsignedAxis}}); + + rFindable.add("h2PtDaugFilter_plus_protonkink", "h2PtDaugFilter_plus_protonkink", {HistType::kTH2F, {filtersAxis, ptUnsignedAxis}}); + rFindable.add("h2PtDaugFilter_plus_pikink", "h2PtDaugFilter_plus_pikink", {HistType::kTH2F, {filtersAxis, ptUnsignedAxis}}); + rFindable.add("h2PtDaugFilter_minus_pikink", "h2PtDaugFilter_minus_pikink", {HistType::kTH2F, {filtersAxis, ptUnsignedAxis}}); + + rFindable.add("h2DCAMothPt_protonkink", "h2DCAMothPt_protonkink", {HistType::kTH2F, {ptAxis, dcaMothAxis}}); + rFindable.add("h2DCADaugPt_protonkink", "h2DCADaugPt_protonkink", {HistType::kTH2F, {ptAxis, dcaDaugAxis}}); + rFindable.add("h2DCAMothPt_pikink", "h2DCAMothPt_pikink", {HistType::kTH2F, {ptAxis, dcaMothAxis}}); + rFindable.add("h2DCADaugPt_pikink", "h2DCADaugPt_pikink", {HistType::kTH2F, {ptAxis, dcaDaugAxis}}); + } + } + + void initCCDB(aod::BCs::iterator const& bc) + { + if (mRunNumber == bc.runNumber()) { + return; } + mRunNumber = bc.runNumber(); + LOG(info) << "Initializing CCDB for run " << mRunNumber; + o2::parameters::GRPMagField* grpmag = ccdb->getForRun(grpmagPath, mRunNumber); + o2::base::Propagator::initFieldFromGRP(grpmag); + mBz = grpmag->getNominalL3Field(); + if (!matLUT) { + matLUT = o2::base::MatLayerCylSet::rectifyPtrFromFile(ccdb->get(lutPath)); + } + o2::base::Propagator::Instance()->setMatLUT(matLUT); + LOG(info) << "Task initialized for run " << mRunNumber << " with magnetic field " << mBz << " kZG"; + } + + float alphaAP(const std::array& momMother, const std::array& momKink) + { + std::array momMissing = {momMother[0] - momKink[0], momMother[1] - momKink[1], momMother[2] - momKink[2]}; + float lQlP = std::inner_product(momMother.begin(), momMother.end(), momKink.begin(), 0.f); + float lQlN = std::inner_product(momMother.begin(), momMother.end(), momMissing.begin(), 0.f); + return (lQlP - lQlN) / (lQlP + lQlN); + } + + float qtAP(const std::array& momMother, const std::array& momKink) + { + float dp = std::inner_product(momMother.begin(), momMother.end(), momKink.begin(), 0.f); + float p2V0 = std::inner_product(momMother.begin(), momMother.end(), momMother.begin(), 0.f); + float p2A = std::inner_product(momKink.begin(), momKink.end(), momKink.begin(), 0.f); + return std::sqrt(p2A - dp * dp / p2V0); + } + + float cosPAngle(const std::array& momMother, const std::array& posMother, const std::array& posKink) + { + std::array vMother = {posKink[0] - posMother[0], posKink[1] - posMother[1], posKink[2] - posMother[2]}; + float pMother = std::sqrt(std::inner_product(momMother.begin(), momMother.end(), momMother.begin(), 0.f)); + float vMotherNorm = std::sqrt(std::inner_product(vMother.begin(), vMother.end(), vMother.begin(), 0.f)); + return (std::inner_product(momMother.begin(), momMother.end(), vMother.begin(), 0.f)) / (pMother * vMotherNorm); } void processData(CollisionsFull::iterator const& collision, aod::KinkCands const& KinkCands, TracksFull const&) @@ -97,9 +241,23 @@ struct sigmaminustask { continue; } + float alphaAPValue = alphaAP(std::array{kinkCand.pxMoth(), kinkCand.pyMoth(), kinkCand.pzMoth()}, std::array{kinkCand.pxDaug(), kinkCand.pyDaug(), kinkCand.pzDaug()}); + float qtValue = qtAP(std::array{kinkCand.pxMoth(), kinkCand.pyMoth(), kinkCand.pzMoth()}, std::array{kinkCand.pxDaug(), kinkCand.pyDaug(), kinkCand.pzDaug()}); + rSigmaMinus.fill(HIST("h2ArmenterosPreCuts"), alphaAPValue, qtValue); + + if (qtValue < cutMinQtAP || qtValue > cutMaxQtAP) { + continue; + } + float cosPointingAngleRec = cosPAngle(std::array{kinkCand.pxMoth(), kinkCand.pyMoth(), kinkCand.pzMoth()}, + std::array{0.0f, 0.0f, 0.0f}, + std::array{kinkCand.xDecVtx(), kinkCand.yDecVtx(), kinkCand.zDecVtx()}); + rSigmaMinus.fill(HIST("h2CosPointingAnglePt"), kinkCand.mothSign() * kinkCand.ptMoth(), cosPointingAngleRec); + rSigmaMinus.fill(HIST("h2MassSigmaMinusPt"), kinkCand.mothSign() * kinkCand.ptMoth(), kinkCand.mSigmaMinus()); rSigmaMinus.fill(HIST("h2SigmaMassVsXiMass"), kinkCand.mXiMinus(), kinkCand.mSigmaMinus()); - rSigmaMinus.fill(HIST("h2NSigmaPiPt"), kinkCand.mothSign() * kinkCand.ptMoth(), dauTrack.tpcNSigmaPi()); + rSigmaMinus.fill(HIST("h2NSigmaTPCPiPt"), kinkCand.mothSign() * kinkCand.ptMoth(), dauTrack.tpcNSigmaPi()); + rSigmaMinus.fill(HIST("h2DCAMothPt"), kinkCand.mothSign() * kinkCand.ptMoth(), kinkCand.dcaMothPv()); + rSigmaMinus.fill(HIST("h2DCADaugPt"), kinkCand.mothSign() * kinkCand.ptDaug(), kinkCand.dcaDaugPv()); if (fillOutputTree) { outputDataTable(kinkCand.xDecVtx(), kinkCand.yDecVtx(), kinkCand.zDecVtx(), @@ -114,7 +272,7 @@ struct sigmaminustask { } PROCESS_SWITCH(sigmaminustask, processData, "Data processing", true); - void processMC(CollisionsFullMC const& collisions, aod::KinkCands const& KinkCands, aod::McTrackLabels const& trackLabelsMC, aod::McParticles const& particlesMC, aod::McCollisions const&, TracksFull const&) + void processMC(CollisionsFullMC const& collisions, aod::KinkCands const& KinkCands, aod::McTrackLabels const& trackLabelsMC, aod::McParticles const& particlesMC, TracksFull const&, aod::McCollisions const&) { for (const auto& collision : collisions) { if (std::abs(collision.posZ()) > cutzvertex || !collision.sel8()) { @@ -136,9 +294,13 @@ struct sigmaminustask { continue; } + // histograms filled with all kink candidates + float alphaAPValue = alphaAP(std::array{kinkCand.pxMoth(), kinkCand.pyMoth(), kinkCand.pzMoth()}, std::array{kinkCand.pxDaug(), kinkCand.pyDaug(), kinkCand.pzDaug()}); + float qtValue = qtAP(std::array{kinkCand.pxMoth(), kinkCand.pyMoth(), kinkCand.pzMoth()}, std::array{kinkCand.pxDaug(), kinkCand.pyDaug(), kinkCand.pzDaug()}); + rSigmaMinus.fill(HIST("h2ArmenterosPreCuts"), alphaAPValue, qtValue); rSigmaMinus.fill(HIST("h2MassSigmaMinusPt"), kinkCand.mothSign() * kinkCand.ptMoth(), kinkCand.mSigmaMinus()); rSigmaMinus.fill(HIST("h2SigmaMassVsXiMass"), kinkCand.mXiMinus(), kinkCand.mSigmaMinus()); - rSigmaMinus.fill(HIST("h2NSigmaPiPt"), kinkCand.mothSign() * kinkCand.ptMoth(), dauTrack.tpcNSigmaPi()); + rSigmaMinus.fill(HIST("h2NSigmaTPCPiPt"), kinkCand.mothSign() * kinkCand.ptMoth(), dauTrack.tpcNSigmaPi()); // do MC association auto mcLabSigma = trackLabelsMC.rawIteratorAt(mothTrack.globalIndex()); @@ -153,7 +315,7 @@ struct sigmaminustask { if (piMother.globalIndex() != mcTrackSigma.globalIndex()) { continue; } - if (std::abs(mcTrackSigma.pdgCode()) != 3112) { + if (std::abs(mcTrackSigma.pdgCode()) != 3112 && std::abs(mcTrackSigma.pdgCode()) != 3222) { continue; } if (std::abs(mcTrackPiDau.pdgCode()) != 211 && std::abs(mcTrackPiDau.pdgCode()) != 2212) { @@ -165,20 +327,38 @@ struct sigmaminustask { float deltaXMother = mcTrackPiDau.vx() - piMother.vx(); float deltaYMother = mcTrackPiDau.vy() - piMother.vy(); float decayRadiusMC = std::sqrt(deltaXMother * deltaXMother + deltaYMother * deltaYMother); + float decayRadiusRec = std::sqrt(kinkCand.xDecVtx() * kinkCand.xDecVtx() + kinkCand.yDecVtx() * kinkCand.yDecVtx()); + float cosPointingAngleRec = cosPAngle(std::array{kinkCand.pxMoth(), kinkCand.pyMoth(), kinkCand.pzMoth()}, + std::array{0.0f, 0.0f, 0.0f}, + std::array{kinkCand.xDecVtx(), kinkCand.yDecVtx(), kinkCand.zDecVtx()}); // Check coherence of MCcollision Id for daughter MCparticle and reconstructed collision bool mcCollisionIdCheck = false; if (collision.has_mcCollision()) { mcCollisionIdCheck = collision.mcCollision().globalIndex() == mcTrackPiDau.mcCollisionId(); } + // Check bunch crossing ID coherence + auto mcCollision = mcTrackPiDau.template mcCollision_as(); + // bool BCId_vs_MCBCId = collision.bcId() == mcCollision.bcId(); + bool BCId_vs_EvSel = collision.bcId() == collision.foundBCId(); + bool EvSel_vs_MCBCId = collision.foundBCId() == mcCollision.bcId(); + + rSigmaMinus.fill(HIST("hMcCollIdCoherence"), static_cast(mcCollisionIdCheck)); + rSigmaMinus.fill(HIST("h2CollId_BCId"), static_cast(mcCollisionIdCheck), static_cast(EvSel_vs_MCBCId)); + rSigmaMinus.fill(HIST("h2BCId_comp"), static_cast(EvSel_vs_MCBCId), static_cast(BCId_vs_EvSel)); rSigmaMinus.fill(HIST("h2MassPtMCRec"), kinkCand.mothSign() * kinkCand.ptMoth(), kinkCand.mSigmaMinus()); - if (mcTrackSigma.pdgCode() > 0) { - rSigmaMinus.fill(HIST("h2MassResolution_plus"), kinkCand.mSigmaMinus(), kinkCand.mSigmaMinus() - MotherMassMC); - rSigmaMinus.fill(HIST("h2PtResolution_plus"), kinkCand.ptMoth(), kinkCand.ptMoth() - MotherpTMC); - } else { - rSigmaMinus.fill(HIST("h2MassResolution_minus"), kinkCand.mSigmaMinus(), kinkCand.mSigmaMinus() - MotherMassMC); - rSigmaMinus.fill(HIST("h2PtResolution_minus"), kinkCand.ptMoth(), kinkCand.ptMoth() - MotherpTMC); + rSigmaMinus.fill(HIST("h2MassResolution"), kinkCand.mothSign() * kinkCand.ptMoth(), (kinkCand.mSigmaMinus() - MotherMassMC) / MotherMassMC); + rSigmaMinus.fill(HIST("h2PtResolution"), kinkCand.mothSign() * kinkCand.ptMoth(), (kinkCand.ptMoth() - MotherpTMC) / MotherpTMC); + rSigmaMinus.fill(HIST("h2RadiusResolution"), kinkCand.mothSign() * kinkCand.ptMoth(), (decayRadiusRec - decayRadiusMC) / decayRadiusMC); + rSigmaMinus.fill(HIST("h2DCAMothPt"), kinkCand.mothSign() * kinkCand.ptMoth(), kinkCand.dcaMothPv()); + rSigmaMinus.fill(HIST("h2DCADaugPt"), kinkCand.mothSign() * kinkCand.ptMoth(), kinkCand.dcaDaugPv()); + rSigmaMinus.fill(HIST("h2CosPointingAnglePt"), kinkCand.mothSign() * kinkCand.ptMoth(), cosPointingAngleRec); + + if (std::abs(mcTrackPiDau.pdgCode()) == 211) { + rSigmaMinus.fill(HIST("h2NSigmaTOFPiPt"), kinkCand.mothSign() * kinkCand.ptMoth(), dauTrack.tofNSigmaPi()); + } else if (std::abs(mcTrackPiDau.pdgCode()) == 2212) { + rSigmaMinus.fill(HIST("h2NSigmaTOFPrPt"), kinkCand.mothSign() * kinkCand.ptMoth(), dauTrack.tofNSigmaPr()); } // fill the output table with Mc information @@ -200,7 +380,7 @@ struct sigmaminustask { // Loop over all generated particles to fill MC histograms for (const auto& mcPart : particlesMC) { - if (std::abs(mcPart.pdgCode()) != 3112 || std::abs(mcPart.y()) > cutEtaMotherMC) { // only sigma mothers and rapidity cut + if ((std::abs(mcPart.pdgCode()) != 3112 && std::abs(mcPart.pdgCode()) != 3222) || std::abs(mcPart.y()) > cutRapMotherMC) { // only sigma mothers and rapidity cut continue; } if (!mcPart.has_daughters()) { @@ -241,8 +421,258 @@ struct sigmaminustask { } } } - PROCESS_SWITCH(sigmaminustask, processMC, "MC processing", false); + + void fillFindableHistograms(int filterIndex, float mcRadius, float recRadius, float ptMoth, float ptDaug, bool isSigmaMinus, bool isPiDaughter) + { + rFindable.fill(HIST("hFilterIndex"), filterIndex); + rFindable.fill(HIST("h2MCRadiusFilterIndex"), filterIndex, mcRadius); + rFindable.fill(HIST("h2RecRadiusFilterIndex"), filterIndex, recRadius); + + if (isPiDaughter) { + if (isSigmaMinus) { + rFindable.fill(HIST("h2MCRadiusFilter_minus_pikink"), filterIndex, mcRadius); + rFindable.fill(HIST("h2PtFilter_minus_pikink"), filterIndex, ptMoth); + rFindable.fill(HIST("h2PtDaugFilter_minus_pikink"), filterIndex, ptDaug); + } else { + rFindable.fill(HIST("h2MCRadiusFilter_plus_pikink"), filterIndex, mcRadius); + rFindable.fill(HIST("h2PtFilter_plus_pikink"), filterIndex, ptMoth); + rFindable.fill(HIST("h2PtDaugFilter_plus_pikink"), filterIndex, ptDaug); + } + } else { + if (!isSigmaMinus) { + rFindable.fill(HIST("h2MCRadiusFilter_plus_protonkink"), filterIndex, mcRadius); + rFindable.fill(HIST("h2PtFilter_plus_protonkink"), filterIndex, ptMoth); + rFindable.fill(HIST("h2PtDaugFilter_plus_protonkink"), filterIndex, ptDaug); + } + } + } + + void processFindable(aod::KinkCands const& kinkCands, aod::McTrackLabels const& trackLabelsMC, + TracksFull const& tracks, aod::McParticles const&, CollisionsFullMC const&, aod::BCs const&) + { + // A - generated findable track pairs map: mcMother.globalIndex() -> (motherTrack.globalIndex(), daughterTrack.globalIndex()) + std::unordered_map> allCandsIndices; + + for (const auto& track : tracks) { + auto mcLabel = trackLabelsMC.rawIteratorAt(track.globalIndex()); + if (!mcLabel.has_mcParticle()) { + continue; + } + auto mcParticle = mcLabel.mcParticle_as(); + + if (mcParticle.has_daughters() && (std::abs(mcParticle.pdgCode()) == 3112 || std::abs(mcParticle.pdgCode()) == 3222)) { + allCandsIndices[mcParticle.globalIndex()] = {track.globalIndex(), -1}; + } + } + + for (const auto& track : tracks) { + auto mcLabel = trackLabelsMC.rawIteratorAt(track.globalIndex()); + if (!mcLabel.has_mcParticle()) { + continue; + } + auto mcParticle = mcLabel.mcParticle_as(); + + if (mcParticle.has_mothers() && (std::abs(mcParticle.pdgCode()) == 211 || std::abs(mcParticle.pdgCode()) == 2212)) { + for (const auto& mother : mcParticle.mothers_as()) { + auto it = allCandsIndices.find(mother.globalIndex()); + if (it != allCandsIndices.end()) { + it->second.second = track.globalIndex(); + break; + } + } + } + } + + // B - reconstructed kinkcands map: mcMother.globalIndex() -> kinkCand.globalIndex() + std::unordered_map findableToKinkCand; + for (const auto& kinkCand : kinkCands) { + auto motherTrack = kinkCand.trackMoth_as(); + auto daughterTrack = kinkCand.trackDaug_as(); + + auto mcLabMoth = trackLabelsMC.rawIteratorAt(motherTrack.globalIndex()); + auto mcLabDaug = trackLabelsMC.rawIteratorAt(daughterTrack.globalIndex()); + if (!mcLabMoth.has_mcParticle() || !mcLabDaug.has_mcParticle()) { + continue; + } + auto mcMother = mcLabMoth.mcParticle_as(); + auto mcDaughter = mcLabDaug.mcParticle_as(); + + if (std::abs(mcMother.pdgCode()) != 3112 && std::abs(mcMother.pdgCode()) != 3222) { + continue; + } + if (std::abs(mcDaughter.pdgCode()) != 211 && std::abs(mcDaughter.pdgCode()) != 2212) { + continue; + } + + auto findableIt = allCandsIndices.find(mcMother.globalIndex()); + if (findableIt != allCandsIndices.end() && + findableIt->second.first == motherTrack.globalIndex() && + findableIt->second.second == daughterTrack.globalIndex()) { + + findableToKinkCand[mcMother.globalIndex()] = kinkCand.globalIndex(); + } + } + + // C - loop on valid pairs for findable analysis + for (const auto& [mcMotherIndex, trackIndices] : allCandsIndices) { + if (trackIndices.second == -1 || trackIndices.first == -1) { + continue; + } + + // Retrieve mother and daughter tracks and mcParticles + auto motherTrack = tracks.rawIteratorAt(trackIndices.first); + auto daughterTrack = tracks.rawIteratorAt(trackIndices.second); + auto mcLabMoth = trackLabelsMC.rawIteratorAt(motherTrack.globalIndex()); + auto mcLabDaug = trackLabelsMC.rawIteratorAt(daughterTrack.globalIndex()); + auto mcMother = mcLabMoth.mcParticle_as(); + auto mcDaughter = mcLabDaug.mcParticle_as(); + + // Compute useful quantities for histograms + bool isSigmaMinus = (std::abs(mcMother.pdgCode()) == 3112); + bool isPiDaughter = (std::abs(mcDaughter.pdgCode()) == 211); + int sigmaSign = mcMother.pdgCode() > 0 ? 1 : -1; + float recPtDaughter = daughterTrack.pt(); + float recPtMother = motherTrack.pt(); + float mcRadius = std::sqrt((mcMother.vx() - mcDaughter.vx()) * (mcMother.vx() - mcDaughter.vx()) + (mcMother.vy() - mcDaughter.vy()) * (mcMother.vy() - mcDaughter.vy())); + float recRadius = -1.0; + if (findableToKinkCand.find(mcMother.globalIndex()) != findableToKinkCand.end()) { + auto kinkCand = kinkCands.rawIteratorAt(findableToKinkCand[mcMother.globalIndex()]); + recRadius = std::sqrt(kinkCand.xDecVtx() * kinkCand.xDecVtx() + kinkCand.yDecVtx() * kinkCand.yDecVtx()); + } + + // Check for detector mismatches in ITS mother tracks + auto mask_value = mcLabMoth.mcMask(); + int mismatchITS_index = -1; + + for (int i = 0; i < 7; ++i) { // ITS has layers 0-6, bit ON means mismatch + if ((mask_value & (1 << i)) != 0) { + mismatchITS_index = i; + break; + } + } + + // Define filter index and progressively apply kinkbuilder cuts to track pairs + int filterIndex = 0; + fillFindableHistograms(filterIndex, mcRadius, recRadius, recPtMother, recPtDaughter, isSigmaMinus, isPiDaughter); + + // 1 - tracks with right ITS, TPC, TOF signals + if (motherTrack.has_collision() && motherTrack.hasITS() && !motherTrack.hasTPC() && !motherTrack.hasTOF() && + daughterTrack.hasITS() && daughterTrack.hasTPC()) { + filterIndex += 1; + fillFindableHistograms(filterIndex, mcRadius, recRadius, recPtMother, recPtDaughter, isSigmaMinus, isPiDaughter); + rFindable.fill(HIST("hfakeITSfindable"), mismatchITS_index); + } else { + continue; + } + + // 2 - moth+daug track quality cuts + bool motherGoodITS = motherTrack.hasITS() && motherTrack.itsNCls() < 6 && motherTrack.itsNClsInnerBarrel() == 3 && motherTrack.itsChi2NCl() < 36; + bool daughterGoodITSTPC = daughterTrack.hasITS() && daughterTrack.hasTPC() && daughterTrack.itsNClsInnerBarrel() == 0 && + daughterTrack.itsNCls() < 4 && daughterTrack.tpcNClsCrossedRows() > 0.8 * daughterTrack.tpcNClsFindable() && daughterTrack.tpcNClsFound() > nTPCClusMinDaugKB; + if (motherGoodITS && daughterGoodITSTPC) { + filterIndex += 1; + fillFindableHistograms(filterIndex, mcRadius, recRadius, recPtMother, recPtDaughter, isSigmaMinus, isPiDaughter); + } else { + continue; + } + + // 3 - mother track min pT + if (motherTrack.pt() > minPtMothKB) { + filterIndex += 1; + fillFindableHistograms(filterIndex, mcRadius, recRadius, recPtMother, recPtDaughter, isSigmaMinus, isPiDaughter); + } else { + continue; + } + + // 4 - geometric cuts: eta + if (std::abs(motherTrack.eta()) < etaMaxKB && std::abs(daughterTrack.eta()) < etaMaxKB) { + filterIndex += 1; + fillFindableHistograms(filterIndex, mcRadius, recRadius, recPtMother, recPtDaughter, isSigmaMinus, isPiDaughter); + } else { + continue; + } + + // 5 - geometric cuts: phi difference + if (std::abs(motherTrack.phi() - daughterTrack.phi()) * radToDeg < maxPhiDiffKB) { + filterIndex += 1; + fillFindableHistograms(filterIndex, mcRadius, recRadius, recPtMother, recPtDaughter, isSigmaMinus, isPiDaughter); + } else { + continue; + } + + // DCA calculation: initialization CCDB + auto collision = motherTrack.template collision_as(); + auto bc = collision.template bc_as(); + initCCDB(bc); + const o2::math_utils::Point3D collVtx{collision.posX(), collision.posY(), collision.posZ()}; + o2::track::TrackParCov trackParCovMoth = getTrackParCov(motherTrack); + o2::track::TrackParCov trackParCovDaug = getTrackParCov(daughterTrack); + + // get DCA to PV for mother and daughter tracks + std::array dcaInfoMoth; + o2::base::Propagator::Instance()->propagateToDCA(collVtx, trackParCovMoth, mBz, 2.f, static_cast(cfgMaterialCorrection.value), &dcaInfoMoth); + std::array dcaInfoDaug; + o2::base::Propagator::Instance()->propagateToDCA(collVtx, trackParCovDaug, mBz, 2.f, static_cast(cfgMaterialCorrection.value), &dcaInfoDaug); + float dcaXYMother = std::abs(dcaInfoMoth[0]); + float dcaXYDaughter = std::abs(dcaInfoDaug[0]); + if (isPiDaughter) { + rFindable.fill(HIST("h2DCAMothPt_pikink"), sigmaSign * recPtMother, dcaXYMother); + rFindable.fill(HIST("h2DCADaugPt_pikink"), sigmaSign * recPtDaughter, dcaXYDaughter); + } else { + rFindable.fill(HIST("h2DCAMothPt_protonkink"), sigmaSign * recPtMother, dcaXYMother); + rFindable.fill(HIST("h2DCADaugPt_protonkink"), sigmaSign * recPtDaughter, dcaXYDaughter); + } + + // 6 - max Z difference + if (std::abs(trackParCovMoth.getZ() - trackParCovDaug.getZ()) < maxZDiffKB) { + filterIndex += 1; + fillFindableHistograms(filterIndex, mcRadius, recRadius, recPtMother, recPtDaughter, isSigmaMinus, isPiDaughter); + } else { + continue; + } + + // 7 - DCA mother + if (dcaXYMother < maxDcaMothPvKB) { + filterIndex += 1; + fillFindableHistograms(filterIndex, mcRadius, recRadius, recPtMother, recPtDaughter, isSigmaMinus, isPiDaughter); + } else { + continue; + } + + // 8 - DCA daughter + if (dcaXYDaughter > minDcaDaugPvKB) { + filterIndex += 1; + fillFindableHistograms(filterIndex, mcRadius, recRadius, recPtMother, recPtDaughter, isSigmaMinus, isPiDaughter); + } else { + continue; + } + + // 9 - radius cut + if (recRadius > radiusCutKB) { + filterIndex += 1; + fillFindableHistograms(filterIndex, mcRadius, recRadius, recPtMother, recPtDaughter, isSigmaMinus, isPiDaughter); + } else { + continue; + } + + // 10 - collision selection + if (!(std::abs(collision.posZ()) > cutzvertex || !collision.sel8())) { + filterIndex += 1; + fillFindableHistograms(filterIndex, mcRadius, recRadius, recPtMother, recPtDaughter, isSigmaMinus, isPiDaughter); + } else { + continue; + } + + // 11 - TOF daughter presence + if (daughterTrack.hasTOF()) { + filterIndex += 1; + fillFindableHistograms(filterIndex, mcRadius, recRadius, recPtMother, recPtDaughter, isSigmaMinus, isPiDaughter); + } + } + } + + PROCESS_SWITCH(sigmaminustask, processFindable, "Findable Sigma processing", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 6a703d0daea6d77d12626dcbf5ac4780f5ee86d3 Mon Sep 17 00:00:00 2001 From: Yash Patley <52608802+yashpatley@users.noreply.github.com> Date: Sat, 9 Aug 2025 03:08:40 +0530 Subject: [PATCH 303/345] [PWGCF] Update lambdaR2Correlation.cxx (#12499) --- .../Tasks/lambdaR2Correlation.cxx | 105 +++++++++++------- 1 file changed, 67 insertions(+), 38 deletions(-) diff --git a/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx b/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx index 3dd5ec474de..ba34f15f58d 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx @@ -19,6 +19,7 @@ #include "Common/DataModel/Centrality.h" #include "Common/DataModel/CollisionAssociationTables.h" #include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/PIDResponse.h" #include "CCDB/BasicCCDBManager.h" @@ -43,9 +44,11 @@ namespace o2::aod namespace lambdacollision { DECLARE_SOA_COLUMN(Cent, cent, float); -} +DECLARE_SOA_COLUMN(Mult, mult, float); +} // namespace lambdacollision DECLARE_SOA_TABLE(LambdaCollisions, "AOD", "LAMBDACOLS", o2::soa::Index<>, lambdacollision::Cent, + lambdacollision::Mult, aod::collision::PosX, aod::collision::PosY, aod::collision::PosZ); @@ -56,6 +59,7 @@ namespace lambdamcgencollision } DECLARE_SOA_TABLE(LambdaMcGenCollisions, "AOD", "LMCGENCOLS", o2::soa::Index<>, lambdacollision::Cent, + lambdacollision::Mult, o2::aod::mccollision::PosX, o2::aod::mccollision::PosY, o2::aod::mccollision::PosZ); @@ -172,6 +176,11 @@ enum TrackLabels { kGenLambdaToPrPi }; +enum CentEstType { + kCentFT0M = 0, + kCentFV0A +}; + enum RunType { kRun3 = 0, kRun2 @@ -229,6 +238,7 @@ struct LambdaTableProducer { Produces lambdaMCGenTrackTable; // Collisions + Configurable cCentEstimator{"cCentEstimator", 0, "Centrality Estimator : 0-FT0M, 1-FV0A"}; Configurable cMinZVtx{"cMinZVtx", -10.0, "Min VtxZ cut"}; Configurable cMaxZVtx{"cMaxZVtx", 10.0, "Max VtxZ cut"}; Configurable cMinMult{"cMinMult", 0., "Minumum Multiplicity"}; @@ -318,9 +328,8 @@ struct LambdaTableProducer { {"hPrimFracVsPtEtaCentLambda", "hPrimFracVsPtEtaCentAntiLambda"}}; // Initialize Global Variables - float cent = 0.; + float cent = 0., mult = 0.; float pt = 0., eta = 0., rap = 0., phi = 0.; - bool bSecondaryLambdaFlag = false; void init(InitContext const&) { @@ -412,9 +421,7 @@ struct LambdaTableProducer { // McReco Histos histos.add("Tracks/h2f_tracks_pid_before_sel", "PIDs", kTH2F, {axisPID, axisV0Pt}); histos.add("Tracks/h2f_tracks_pid_after_sel", "PIDs", kTH2F, {axisPID, axisV0Pt}); - histos.add("Tracks/h2f_lambda_from_sigma", "PIDs", kTH2F, {axisPID, axisV0Pt}); - histos.add("Tracks/h2f_lambda_from_cascade", "PIDs", kTH2F, {axisPID, axisV0Pt}); - histos.add("Tracks/h2f_lambda_from_omega", "PIDs", kTH2F, {axisPID, axisV0Pt}); + histos.add("Tracks/h2f_lambda_mothers_pdg", "PIDs", kTH2F, {axisPID, axisV0Pt}); // McGen Histos histos.add("McGen/h1f_collision_recgen", "# of Reco Collision Associated to One Mc Generator Collision", kTH1F, {axisMult}); @@ -481,7 +488,12 @@ struct LambdaTableProducer { } if constexpr (run == kRun3) { // Run3 Min-Bias Trigger - cent = col.centFT0M(); + // select centrality estimator + if (cCentEstimator == kCentFT0M) { + cent = col.centFT0M(); + } else if (cCentEstimator == kCentFV0A) { + cent = col.centFV0A(); + } if (cSel8Trig && !col.sel8()) { return false; } @@ -495,7 +507,7 @@ struct LambdaTableProducer { } } - if (cent <= cMinMult || cent >= cMaxMult) { // select centrality + if (cent <= cMinMult || cent >= cMaxMult) { // select centrality percentile class return false; } @@ -527,6 +539,9 @@ struct LambdaTableProducer { return false; } + // Set Multiplicity + mult = col.multNTracksPV(); + return true; } @@ -772,7 +787,6 @@ struct LambdaTableProducer { // check for secondary lambda if (!mcpart.isPhysicalPrimary()) { histos.fill(HIST("Tracks/h1f_tracks_info"), kSecondaryLambda); - bSecondaryLambdaFlag = true; return kSecondary; } @@ -817,18 +831,6 @@ struct LambdaTableProducer { } } - // get information about secondary lambdas - if (bSecondaryLambdaFlag) { - auto lambdaMothers = mcpart.template mothers_as(); - if (std::abs(lambdaMothers[0].pdgCode()) == kSigmaMinus || std::abs(lambdaMothers[0].pdgCode()) == kSigma0 || std::abs(lambdaMothers[0].pdgCode()) == kSigmaPlus) { - histos.fill(HIST("Tracks/h2f_lambda_from_sigma"), mcpart.pdgCode(), mcpart.pt()); - } else if (std::abs(lambdaMothers[0].pdgCode()) == kXiMinus || std::abs(lambdaMothers[0].pdgCode()) == kXi0) { - histos.fill(HIST("Tracks/h2f_lambda_from_cascade"), mcpart.pdgCode(), mcpart.pt()); - } else if (std::abs(lambdaMothers[0].pdgCode()) == kOmegaMinus) { - histos.fill(HIST("Tracks/h2f_lambda_from_omega"), mcpart.pdgCode(), mcpart.pt()); - } - } - return true; } @@ -893,6 +895,14 @@ struct LambdaTableProducer { return primFrac * effCorrFact; } + template + void fillLambdaMothers(V const& v0, T const&) + { + auto mcpart = v0.template mcParticle_as(); + auto lambdaMothers = mcpart.template mothers_as(); + histos.fill(HIST("Tracks/h2f_lambda_mothers_pdg"), lambdaMothers[0].pdgCode(), v0.pt()); + } + template void fillLambdaQAHistos(C const& col, V const& v0, T const&) { @@ -973,7 +983,7 @@ struct LambdaTableProducer { histos.fill(HIST("Events/h1f_collision_posZ"), collision.posZ()); // Fill Collision Table - lambdaCollisionTable(cent, collision.posX(), collision.posY(), collision.posZ()); + lambdaCollisionTable(cent, mult, collision.posX(), collision.posY(), collision.posZ()); // initialize v0track objects ParticleType v0Type = kLambda; @@ -1005,9 +1015,11 @@ struct LambdaTableProducer { // we have v0 as lambda histos.fill(HIST("Tracks/h1f_tracks_info"), kAllSelPassed); - // Remove lambda with ambiguous daughters - if (cRemoveAmbiguousTracks && hasAmbiguousDaughters(v0, tracks)) { - continue; + // Remove lambda with ambiguous daughters (Only for run3) + if constexpr (run == kRun3) { + if (cRemoveAmbiguousTracks && hasAmbiguousDaughters(v0, tracks)) { + continue; + } } // Get Lambda mass and kinematic variables @@ -1021,13 +1033,21 @@ struct LambdaTableProducer { if constexpr (dmc == kMC) { histos.fill(HIST("Tracks/h2f_tracks_pid_before_sel"), v0.mcParticle().pdgCode(), v0.pt()); - if (cSelMCPSV0) { // Get Primary/Secondary Lambda + // Get Primary/Secondary Lambda + if (cSelMCPSV0) { v0PrmScdType = isPrimaryV0(v0); } - if (cSelectTrueLambda && !selTrueMcRecLambda(v0, tracks)) { // check for true Lambda/Anti-Lambda + + // check for true Lambda/Anti-Lambda + if (cSelectTrueLambda && !selTrueMcRecLambda(v0, tracks)) { continue; } + // get mothers information + if (v0PrmScdType == kSecondary) { + fillLambdaMothers(v0, tracks); + } + histos.fill(HIST("Tracks/h1f_tracks_info"), kPassTrueLambdaSel); histos.fill(HIST("Tracks/h2f_tracks_pid_after_sel"), v0.mcParticle().pdgCode(), v0.pt()); @@ -1073,7 +1093,7 @@ struct LambdaTableProducer { void fillLambdaMcGenTables(C const& mcCollision, M const& mcParticles) { // Fill McGen Collision Table - lambdaMCGenCollisionTable(cent, mcCollision.posX(), mcCollision.posY(), mcCollision.posZ()); + lambdaMCGenCollisionTable(cent, mult, mcCollision.posX(), mcCollision.posY(), mcCollision.posZ()); // initialize track objects ParticleType v0Type = kLambda; @@ -1203,11 +1223,13 @@ struct LambdaTableProducer { SliceCache cache; Preslice> perCollision = aod::v0data::collisionId; - using CollisionsRun3 = soa::Join; - using CollisionsRun2 = soa::Join; + using CollisionsRun3 = soa::Join; + using CollisionsRun2 = soa::Join; using Tracks = soa::Join; - using McV0Tracks = soa::Join; + using TracksRun2 = soa::Join; using TracksMC = soa::Join; + using TracksMCRun2 = soa::Join; + using McV0Tracks = soa::Join; void processDataRun3(CollisionsRun3::iterator const& collision, aod::V0Datas const& V0s, Tracks const& tracks) { @@ -1216,7 +1238,7 @@ struct LambdaTableProducer { PROCESS_SWITCH(LambdaTableProducer, processDataRun3, "Process for Run3 DATA", true); - void processDataRun2(CollisionsRun2::iterator const& collision, aod::V0Datas const& V0s, Tracks const& tracks) + void processDataRun2(CollisionsRun2::iterator const& collision, aod::V0Datas const& V0s, TracksRun2 const& tracks) { fillLambdaRecoTables(collision, V0s, tracks); } @@ -1236,7 +1258,7 @@ struct LambdaTableProducer { PROCESS_SWITCH(LambdaTableProducer, processMCRecoRun3, "Process for Run3 McReco DATA", false); void processMCRecoRun2(soa::Join::iterator const& collision, aod::McCollisions const&, - McV0Tracks const& V0s, TracksMC const& tracks, aod::McParticles const&) + McV0Tracks const& V0s, TracksMCRun2 const& tracks, aod::McParticles const&) { // check collision if (!selCollision(collision)) { @@ -1259,7 +1281,7 @@ struct LambdaTableProducer { void processMCRun2(aod::McCollisions::iterator const& mcCollision, soa::SmallGroups> const& collisions, - McV0Tracks const& V0s, TracksMC const& tracks, + McV0Tracks const& V0s, TracksMCRun2 const& tracks, aod::McParticles const& mcParticles) { analyzeMcRecoGen(mcCollision, collisions, V0s, tracks, mcParticles); @@ -1483,6 +1505,7 @@ struct LambdaR2Correlation { const AxisSpec axisCheck(1, 0, 1, ""); const AxisSpec axisPosZ(220, -11, 11, "V_{z} (cm)"); const AxisSpec axisCent(cMultBins, "FT0M (%)"); + const AxisSpec axisChMult(200, 0, 200, "N_{ch}"); const AxisSpec axisMult(10, 0, 10, "N_{#Lambda}"); const AxisSpec axisMass(100, 1.06, 1.16, "M_{#Lambda} (GeV/#it{c}^{2})"); const AxisSpec axisPt(cNPtBins, cMinPt, cMaxPt, "p_{T} (GeV/#it{c})"); @@ -1496,8 +1519,9 @@ struct LambdaR2Correlation { // Event histos.add("Event/Reco/h1f_collision_posz", "V_{Z} Distribution", kTH1F, {axisPosZ}); histos.add("Event/Reco/h1f_ft0m_mult_percentile", "FT0M (%)", kTH1F, {axisCent}); - histos.add("Event/Reco/h1i_lambda_mult", "#Lambda - Multiplicity", kTH1I, {axisMult}); - histos.add("Event/Reco/h1i_antilambda_mult", "#bar{#Lambda} - Multiplicity", kTH1I, {axisMult}); + histos.add("Event/Reco/h2f_Mult_vs_Centrality", "N_{TPC} vs FT0M(%)", kTH2F, {axisCent, axisChMult}); + histos.add("Event/Reco/h2f_lambda_mult", "#Lambda - Multiplicity", kTH2F, {axisCent, axisMult}); + histos.add("Event/Reco/h2f_antilambda_mult", "#bar{#Lambda} - Multiplicity", kTH2F, {axisCent, axisMult}); // Efficiency Histograms // Single Particle Efficiencies @@ -1510,6 +1534,8 @@ struct LambdaR2Correlation { // Single and Two Particle Densities // 1D Histograms + histos.add("Reco/Primary/h2f_n1_mass_LaP", "#rho_{1}^{#Lambda}", kTH2F, {axisCent, axisMass}); + histos.add("Reco/Primary/h2f_n1_mass_LaM", "#rho_{1}^{#bar{#Lambda}}", kTH2F, {axisCent, axisMass}); histos.add("Reco/Primary/h2f_n1_pt_LaP", "#rho_{1}^{#Lambda}", kTH2F, {axisCent, axisPt}); histos.add("Reco/Primary/h2f_n1_pt_LaM", "#rho_{1}^{#bar{#Lambda}}", kTH2F, {axisCent, axisPt}); histos.add("Reco/Primary/h2f_n1_eta_LaP", "#rho_{1}^{#Lambda}", kTH2F, {axisCent, axisEta}); @@ -1622,6 +1648,7 @@ struct LambdaR2Correlation { histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST(SubDirPrmScd[pst]) + HIST("Efficiency/h3f_n1_centptrap_") + HIST(SubDirHist[part]), cent, track.pt(), track.rap()); // QA Plots + histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST(SubDirPrmScd[pst]) + HIST("h2f_n1_mass_") + HIST(SubDirHist[part]), cent, track.mass()); histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST(SubDirPrmScd[pst]) + HIST("h2f_n1_pt_") + HIST(SubDirHist[part]), cent, track.pt(), track.corrFact()); histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST(SubDirPrmScd[pst]) + HIST("h2f_n1_eta_") + HIST(SubDirHist[part]), cent, track.eta(), track.corrFact()); histos.fill(HIST(SubDirRecGen[rec_gen]) + HIST(SubDirPrmScd[pst]) + HIST("h2f_n1_phi_") + HIST(SubDirHist[part]), cent, track.phi(), track.corrFact()); @@ -1637,9 +1664,9 @@ struct LambdaR2Correlation { // fill multiplicity histograms if (ntrk != 0) { if (part == kLambda) { - histos.fill(HIST("Event/") + HIST(SubDirRecGen[rec_gen]) + HIST("h1i_lambda_mult"), ntrk); + histos.fill(HIST("Event/") + HIST(SubDirRecGen[rec_gen]) + HIST("h2f_lambda_mult"), cent, ntrk); } else { - histos.fill(HIST("Event/") + HIST(SubDirRecGen[rec_gen]) + HIST("h1i_antilambda_mult"), ntrk); + histos.fill(HIST("Event/") + HIST(SubDirRecGen[rec_gen]) + HIST("h2f_antilambda_mult"), cent, ntrk); } } } @@ -1671,6 +1698,7 @@ struct LambdaR2Correlation { { histos.fill(HIST("Event/Reco/h1f_collision_posz"), collision.posZ()); histos.fill(HIST("Event/Reco/h1f_ft0m_mult_percentile"), collision.cent()); + histos.fill(HIST("Event/Reco/h2f_Mult_vs_Centrality"), collision.cent(), collision.mult()); cent = collision.cent(); @@ -1723,6 +1751,7 @@ struct LambdaR2Correlation { { histos.fill(HIST("Event/McGen/h1f_collision_posz"), mcgencol.posZ()); histos.fill(HIST("Event/McGen/h1f_ft0m_mult_percentile"), mcgencol.cent()); + histos.fill(HIST("Event/McGen/h2f_Mult_vs_Centrality"), mcgencol.cent(), mcgencol.mult()); cent = mcgencol.cent(); From 5a829b0a23d7fd39bb742716d0b30a22527f3cec Mon Sep 17 00:00:00 2001 From: jaelpark Date: Fri, 8 Aug 2025 23:41:49 +0200 Subject: [PATCH 304/345] [PWGCF] multiplicity set fixes (#12505) --- PWGCF/DataModel/CorrelationsDerived.h | 6 +++--- PWGCF/TableProducer/filterCorrelations.cxx | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/PWGCF/DataModel/CorrelationsDerived.h b/PWGCF/DataModel/CorrelationsDerived.h index df44dde6d33..4ea9ec8a32b 100644 --- a/PWGCF/DataModel/CorrelationsDerived.h +++ b/PWGCF/DataModel/CorrelationsDerived.h @@ -87,13 +87,13 @@ using CFTrackWithLabel = CFTracksWithLabel::iterator; DECLARE_SOA_TABLE(CFCollRefs, "AOD", "CFCOLLREF", o2::soa::Index<>, track::CollisionId); //! Transient cf collision index table //------multiplicity set -namespace cfmultiplicityset +namespace cfmultset { DECLARE_SOA_COLUMN(Multiplicities, multiplicities, std::vector); //! List of auxiliary multiplicities } -DECLARE_SOA_TABLE(CFMultiplicitySets, "AOD", "CFMULTIPLICITYSET", cfmultiplicityset::Multiplicities); //! Auxilary multiplicity set table +DECLARE_SOA_TABLE(CFMultSets, "AOD", "CFMULTSET", cfmultset::Multiplicities); //! Auxilary multiplicity set table -using CFMultiplicitySet = CFMultiplicitySets::iterator; +using CFMultSet = CFMultSets::iterator; // Reco diff --git a/PWGCF/TableProducer/filterCorrelations.cxx b/PWGCF/TableProducer/filterCorrelations.cxx index ff499bc4178..7446a230311 100644 --- a/PWGCF/TableProducer/filterCorrelations.cxx +++ b/PWGCF/TableProducer/filterCorrelations.cxx @@ -97,7 +97,7 @@ struct FilterCF { O2_DEFINE_CONFIGURABLE(tpcnclusters, int, 50, "minimum number of TPC clusters found") O2_DEFINE_CONFIGURABLE(chi2pertpccluster, float, 2.5, "maximum Chi2 / cluster for the TPC track segment") O2_DEFINE_CONFIGURABLE(chi2peritscluster, float, 36, "maximum Chi2 / cluster for the ITS track segment") - O2_DEFINE_CONFIGURABLE(cfgEstimatorBitMask, uint16_t, 0, "BitMask for multiplicity estimators to be included in the CFMultiplicitySet tables."); + O2_DEFINE_CONFIGURABLE(cfgEstimatorBitMask, uint16_t, 0, "BitMask for multiplicity estimators to be included in the CFMultSet tables."); // Filters and input definitions Filter collisionZVtxFilter = nabs(aod::collision::posZ) < cfgCutVertex; @@ -125,7 +125,7 @@ struct FilterCF { Produces outputTrackRefs; Produces outputMcParticleRefs; - Produces outputMultSets; + Produces outputMultSets; std::vector multiplicities{}; // persistent caches @@ -269,7 +269,7 @@ struct FilterCF { auto bc = collision.template bc_as(); outputCollisions(bc.runNumber(), collision.posZ(), collision.multiplicity(), bc.timestamp()); - if constexpr (std::experimental::is_detected::value) { + if constexpr (std::experimental::is_detected::value) { multiplicities.clear(); if (cfgEstimatorBitMask & kCentFT0C) multiplicities.push_back(collision.centFT0C()); From 772d6cc63e119eeac1eb6cce33e62ba57e5550d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= Date: Sat, 9 Aug 2025 02:52:50 +0200 Subject: [PATCH 305/345] [PWGHF] XicToXiPiPi: Improve vertexing and selections in skimming (#12463) --- PWGHF/TableProducer/trackIndexSkimCreator.cxx | 341 +++++++++--------- 1 file changed, 180 insertions(+), 161 deletions(-) diff --git a/PWGHF/TableProducer/trackIndexSkimCreator.cxx b/PWGHF/TableProducer/trackIndexSkimCreator.cxx index ebe0713d03a..4b03533ce1f 100644 --- a/PWGHF/TableProducer/trackIndexSkimCreator.cxx +++ b/PWGHF/TableProducer/trackIndexSkimCreator.cxx @@ -87,6 +87,7 @@ using namespace o2::aod; using namespace o2::hf_centrality; using namespace o2::framework; using namespace o2::framework::expressions; +using namespace o2::constants::physics; // enum for candidate type enum CandidateType { @@ -510,7 +511,7 @@ struct HfTrackIndexSkimCreatorTagSelTracks { /// \param dca is a 2-element array with dca in transverse and longitudinal directions /// \param statusProng is the selection flag template - void isSelectedTrack(const T& hfTrack, const float& trackPt, const float& trackEta, const std::array& dca, int& statusProng) + void isSelectedTrack(const T& hfTrack, const float trackPt, const float trackEta, const std::array& dca, int& statusProng) { if (config.fillHistograms) { registry.fill(HIST("hPtNoCuts"), trackPt); @@ -1267,14 +1268,6 @@ struct HfTrackIndexSkimCreator { o2::base::Propagator::MatCorrType noMatCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE; int runNumber; - double massPi{0.}; - double massK{0.}; - double massProton{0.}; - double massElectron{0.}; - double massMuon{0.}; - double massDzero{0.}; - double massPhi{0.}; - // int nColls{0}; //can be added to run over limited collisions per file - for tesing purposes static constexpr int kN2ProngDecays = hf_cand_2prong::DecayType::N2ProngDecays; // number of 2-prong hadron types @@ -1328,34 +1321,26 @@ struct HfTrackIndexSkimCreator { return; } - massPi = o2::constants::physics::MassPiPlus; - massK = o2::constants::physics::MassKPlus; - massProton = o2::constants::physics::MassProton; - massElectron = o2::constants::physics::MassElectron; - massMuon = o2::constants::physics::MassMuonPlus; - massDzero = o2::constants::physics::MassD0; - massPhi = o2::constants::physics::MassPhi; - - arrMass2Prong[hf_cand_2prong::DecayType::D0ToPiK] = std::array{std::array{massPi, massK}, - std::array{massK, massPi}}; + arrMass2Prong[hf_cand_2prong::DecayType::D0ToPiK] = std::array{std::array{MassPiPlus, MassKPlus}, + std::array{MassKPlus, MassPiPlus}}; - arrMass2Prong[hf_cand_2prong::DecayType::JpsiToEE] = std::array{std::array{massElectron, massElectron}, - std::array{massElectron, massElectron}}; + arrMass2Prong[hf_cand_2prong::DecayType::JpsiToEE] = std::array{std::array{MassElectron, MassElectron}, + std::array{MassElectron, MassElectron}}; - arrMass2Prong[hf_cand_2prong::DecayType::JpsiToMuMu] = std::array{std::array{massMuon, massMuon}, - std::array{massMuon, massMuon}}; + arrMass2Prong[hf_cand_2prong::DecayType::JpsiToMuMu] = std::array{std::array{MassMuonPlus, MassMuonPlus}, + std::array{MassMuonPlus, MassMuonPlus}}; - arrMass3Prong[hf_cand_3prong::DecayType::DplusToPiKPi] = std::array{std::array{massPi, massK, massPi}, - std::array{massPi, massK, massPi}}; + arrMass3Prong[hf_cand_3prong::DecayType::DplusToPiKPi] = std::array{std::array{MassPiPlus, MassKPlus, MassPiPlus}, + std::array{MassPiPlus, MassKPlus, MassPiPlus}}; - arrMass3Prong[hf_cand_3prong::DecayType::LcToPKPi] = std::array{std::array{massProton, massK, massPi}, - std::array{massPi, massK, massProton}}; + arrMass3Prong[hf_cand_3prong::DecayType::LcToPKPi] = std::array{std::array{MassProton, MassKPlus, MassPiPlus}, + std::array{MassPiPlus, MassKPlus, MassProton}}; - arrMass3Prong[hf_cand_3prong::DecayType::DsToKKPi] = std::array{std::array{massK, massK, massPi}, - std::array{massPi, massK, massK}}; + arrMass3Prong[hf_cand_3prong::DecayType::DsToKKPi] = std::array{std::array{MassKPlus, MassKPlus, MassPiPlus}, + std::array{MassPiPlus, MassKPlus, MassKPlus}}; - arrMass3Prong[hf_cand_3prong::DecayType::XicToPKPi] = std::array{std::array{massProton, massK, massPi}, - std::array{massPi, massK, massProton}}; + arrMass3Prong[hf_cand_3prong::DecayType::XicToPKPi] = std::array{std::array{MassProton, MassKPlus, MassPiPlus}, + std::array{MassPiPlus, MassKPlus, MassProton}}; // cuts for 2-prong decays retrieved by json. the order must be then one in hf_cand_2prong::DecayType cut2Prong = {config.cutsD0ToPiK, config.cutsJpsiToEE, config.cutsJpsiToMuMu}; @@ -1572,10 +1557,10 @@ struct HfTrackIndexSkimCreator { whichHypo[kN2ProngDecays] = whichHypo[hf_cand_2prong::DecayType::D0ToPiK]; double deltaMass = config.cutsDstarToD0Pi->get(pTBinDstar, 1u); - if (TESTBIT(whichHypo[iDecay2P], 0) && (massHypos[0] > (massDzero + deltaMass) * (massDzero + deltaMass) || massHypos[0] < (massDzero - deltaMass) * (massDzero - deltaMass))) { + if (TESTBIT(whichHypo[iDecay2P], 0) && (massHypos[0] > (MassD0 + deltaMass) * (MassD0 + deltaMass) || massHypos[0] < (MassD0 - deltaMass) * (MassD0 - deltaMass))) { CLRBIT(whichHypo[kN2ProngDecays], 0); } - if (TESTBIT(whichHypo[iDecay2P], 1) && (massHypos[1] > (massDzero + deltaMass) * (massDzero + deltaMass) || massHypos[1] < (massDzero - deltaMass) * (massDzero - deltaMass))) { + if (TESTBIT(whichHypo[iDecay2P], 1) && (massHypos[1] > (MassD0 + deltaMass) * (MassD0 + deltaMass) || massHypos[1] < (MassD0 - deltaMass) * (MassD0 - deltaMass))) { CLRBIT(whichHypo[kN2ProngDecays], 1); } } @@ -1597,13 +1582,13 @@ struct HfTrackIndexSkimCreator { double deltaMassMax = cut3Prong[hf_cand_3prong::DecayType::DsToKKPi].get(pTBin, 4u); if (TESTBIT(whichHypo[hf_cand_3prong::DecayType::DsToKKPi], 0)) { double mass2PhiKKPi = RecoDecay::m2(std::array{pVecTrack0, pVecTrack1}, std::array{arrMass3Prong[hf_cand_3prong::DecayType::DsToKKPi][0][0], arrMass3Prong[hf_cand_3prong::DecayType::DsToKKPi][0][1]}); - if (mass2PhiKKPi > (massPhi + deltaMassMax) * (massPhi + deltaMassMax) || mass2PhiKKPi < (massPhi - deltaMassMax) * (massPhi - deltaMassMax)) { + if (mass2PhiKKPi > (MassPhi + deltaMassMax) * (MassPhi + deltaMassMax) || mass2PhiKKPi < (MassPhi - deltaMassMax) * (MassPhi - deltaMassMax)) { CLRBIT(whichHypo[hf_cand_3prong::DecayType::DsToKKPi], 0); } } if (TESTBIT(whichHypo[hf_cand_3prong::DecayType::DsToKKPi], 1)) { double mass2PhiPiKK = RecoDecay::m2(std::array{pVecTrack1, pVecTrack2}, std::array{arrMass3Prong[hf_cand_3prong::DecayType::DsToKKPi][1][1], arrMass3Prong[hf_cand_3prong::DecayType::DsToKKPi][1][2]}); - if (mass2PhiPiKK > (massPhi + deltaMassMax) * (massPhi + deltaMassMax) || mass2PhiPiKK < (massPhi - deltaMassMax) * (massPhi - deltaMassMax)) { + if (mass2PhiPiKK > (MassPhi + deltaMassMax) * (MassPhi + deltaMassMax) || mass2PhiPiKK < (MassPhi - deltaMassMax) * (MassPhi - deltaMassMax)) { CLRBIT(whichHypo[hf_cand_3prong::DecayType::DsToKKPi], 1); } } @@ -1701,7 +1686,7 @@ struct HfTrackIndexSkimCreator { /// \param cutStatus is a 2D array with outcome of each selection (filled only in debug mode) /// \param isSelected ia s bitmap with selection outcome template - void applySelections2Prong(const T1& pVecCand, const T2& secVtx, const T3& primVtx, T4& cutStatus, int& isSelected) + void applySelection2Prong(const T1& pVecCand, const T2& secVtx, const T3& primVtx, T4& cutStatus, int& isSelected) { if (config.debug || isSelected > 0) { @@ -1912,8 +1897,8 @@ struct HfTrackIndexSkimCreator { // D0 mass double deltaMassD0 = config.cutsDstarToD0Pi->get(pTBin, 1u); // 1u == deltaMassD0Index - double invMassD0 = RecoDecay::m(arrMomD0, std::array{massPi, massK}); - if (std::abs(invMassD0 - massDzero) > deltaMassD0) { + double invMassD0 = RecoDecay::m(arrMomD0, std::array{MassPiPlus, MassKPlus}); + if (std::abs(invMassD0 - MassD0) > deltaMassD0) { isSelected = 0; if (config.debug) { CLRBIT(cutStatus, 1); @@ -1923,7 +1908,7 @@ struct HfTrackIndexSkimCreator { // D*+ mass double maxDeltaMass = config.cutsDstarToD0Pi->get(pTBin, 0u); // 0u == deltaMassIndex - double invMassDstar = RecoDecay::m(arrMom, std::array{massPi, massK, massPi}); + double invMassDstar = RecoDecay::m(arrMom, std::array{MassPiPlus, MassKPlus, MassPiPlus}); deltaMass = invMassDstar - invMassD0; if (deltaMass > maxDeltaMass) { isSelected = 0; @@ -2309,7 +2294,7 @@ struct HfTrackIndexSkimCreator { pvCoord2Prong[1] = pvRefitCoord2Prong[1]; pvCoord2Prong[2] = pvRefitCoord2Prong[2]; } - applySelections2Prong(pVecCandProng2, secondaryVertex2, pvCoord2Prong, cutStatus2Prong, isSelected2ProngCand); + applySelection2Prong(pVecCandProng2, secondaryVertex2, pvCoord2Prong, cutStatus2Prong, isSelected2ProngCand); if (is2ProngCandidateGoodFor3Prong && config.do3Prong == 1) { is2ProngCandidateGoodFor3Prong = isTwoTrackVertexSelectedFor3Prongs(secondaryVertex2, pvCoord2Prong, df2); } @@ -3106,10 +3091,6 @@ struct HfTrackIndexSkimCreatorCascades { o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT; int runNumber{0}; - double massP{0.}; - double massK0s{0.}; - double massLc{0.}; - using SelectedCollisions = soa::Filtered>; using FilteredTrackAssocSel = soa::Filtered>; @@ -3132,10 +3113,6 @@ struct HfTrackIndexSkimCreatorCascades { config.etaMinV0Daugh.value = -config.etaMaxV0Daugh; } - massP = o2::constants::physics::MassProton; - massK0s = o2::constants::physics::MassK0Short; - massLc = o2::constants::physics::MassLambdaCPlus; - if (config.useDCAFitter) { df2.setPropagateToPCA(config.propagateToPCA); df2.setMaxR(config.maxR); @@ -3225,7 +3202,7 @@ struct HfTrackIndexSkimCreatorCascades { } // V0 invariant mass selection - if (std::abs(v0.mK0Short() - massK0s) > config.cutInvMassV0) { + if (std::abs(v0.mK0Short() - MassK0Short) > config.cutInvMassV0) { continue; // should go to the filter, but since it is a dynamic column, I cannot use it there } @@ -3238,8 +3215,8 @@ struct HfTrackIndexSkimCreatorCascades { // invariant-mass cut: we do it here, before updating the momenta of bach and V0 during the fitting to save CPU // TODO: but one should better check that the value here and after the fitter do not change significantly!!! - double mass2K0sP = RecoDecay::m(std::array{pVecBach, pVecV0}, std::array{massP, massK0s}); - if ((config.cutInvMassCascLc >= 0.) && (std::abs(mass2K0sP - massLc) > config.cutInvMassCascLc)) { + double mass2K0sP = RecoDecay::m(std::array{pVecBach, pVecV0}, std::array{MassProton, MassK0Short}); + if ((config.cutInvMassCascLc >= 0.) && (std::abs(mass2K0sP - MassLambdaCPlus) > config.cutInvMassCascLc)) { continue; } @@ -3281,7 +3258,7 @@ struct HfTrackIndexSkimCreatorCascades { // invariant mass // re-calculate invariant masses with updated momenta, to fill the histogram - mass2K0sP = RecoDecay::m(std::array{pVecBach, pVecV0}, std::array{massP, massK0s}); + mass2K0sP = RecoDecay::m(std::array{pVecBach, pVecV0}, std::array{MassProton, MassK0Short}); std::array posCasc = {0., 0., 0.}; if (config.useDCAFitter) { const auto& cascVtx = df2.getPCACandidate(); @@ -3316,6 +3293,7 @@ struct HfTrackIndexSkimCreatorLfCascades { Configurable do3Prong{"do3Prong", false, "do 3-prong cascade"}; Configurable rejDiffCollTrack{"rejDiffCollTrack", false, "Reject tracks coming from different collisions"}; + Configurable ptTolerance{"ptTolerance", 0.1, "pT tolerance in GeV/c for applying preselections before vertex reconstruction"}; // charm baryon invariant mass spectra limits Configurable massXiPiMin{"massXiPiMin", 2.1, "Invariant mass lower limit for xi pi decay channel"}; @@ -3345,18 +3323,20 @@ struct HfTrackIndexSkimCreatorLfCascades { Configurable ptMinOmegaczeroToOmegaKaLfCasc{"ptMinOmegaczeroToOmegaKaLfCasc", 0.f, "min. pT for Omegaczero in Omega + Ka decays"}; Configurable ptMinXicZeroOmegacZeroToXiPiLfCasc{"ptMinXicZeroOmegacZeroToXiPiLfCasc", 0.f, "min. pT for XicZeroOmegacZero in Xi + Pi decays"}; Configurable ptMinXicplusLfCasc{"ptMinXicplusLfCasc", 0.f, "min. pT for Xicplus in Xi + Pi + Pi decays"}; - Configurable v0TransvRadius{"v0TransvRadius", 1.0, "V0 radius in xy plane"}; // 1.2 (xi) and 1.1 (omega) in run2 - Configurable cascTransvRadius{"cascTransvRadius", 0.4, "Cascade radius in xy plane"}; // 0.5 cm (xi) and 0.6 (omega) in run2 - Configurable dcaBachToPv{"dcaBachToPv", 0.03, "DCA Bach To PV"}; // 0.04 in run2 - Configurable dcaV0ToPv{"dcaV0ToPv", 0.02, "DCA V0 To PV"}; // 0.03 in run2 - Configurable v0CosPA{"v0CosPA", 0.95, "V0 CosPA"}; // 0.97 in run2 - KEEP LOSE to re-cut after PVRefit! - double -> N.B. dcos(x)/dx = 0 at x=0) - Configurable cascCosPA{"cascCosPA", 0.95, "Casc CosPA"}; // 0.97 in run2 - KEEP LOSE to re-cut after PVRefit! - double -> N.B. dcos(x)/dx = 0 at x=0) - Configurable dcaV0Dau{"dcaV0Dau", 2.0, "DCA V0 Daughters"}; // conservative, a cut ar 1.0 should also be fine - Configurable dcaCascDau{"dcaCascDau", 2.0, "DCA Casc Daughters"}; // conservative, a cut ar 1.0 should also be fine - Configurable dcaNegToPv{"dcaNegToPv", 0.05, "DCA Neg To PV"}; // 0.06 in run2 - Configurable dcaPosToPv{"dcaPosToPv", 0.05, "DCA Pos To PV"}; // 0.06 in run2 - Configurable v0MassWindow{"v0MassWindow", 0.01, "V0 mass window"}; // 0.008 in run2 - Configurable cascadeMassWindow{"cascadeMassWindow", 0.01, "Cascade mass window"}; + Configurable v0TransvRadius{"v0TransvRadius", 1.f, "V0 radius in xy plane"}; // 1.2 (xi) and 1.1 (omega) in run2 + Configurable cascTransvRadius{"cascTransvRadius", 0.4f, "Cascade radius in xy plane"}; // 0.5 cm (xi) and 0.6 (omega) in run2 + Configurable decayLengthXicMin{"decayLengthXicMin", -1.f, "Min. decay length of Xic"}; // ... + Configurable dcaBachToPv{"dcaBachToPv", 0.03f, "DCA Bach To PV"}; // 0.04 in run2 + Configurable dcaV0ToPv{"dcaV0ToPv", 0.02f, "DCA V0 To PV"}; // 0.03 in run2 + Configurable v0CosPA{"v0CosPA", 0.95, "V0 CosPA"}; // 0.97 in run2 - KEEP LOSE to re-cut after PVRefit! - double -> N.B. dcos(x)/dx = 0 at x=0) + Configurable cascCosPA{"cascCosPA", 0.95, "Casc CosPA"}; // 0.97 in run2 - KEEP LOSE to re-cut after PVRefit! - double -> N.B. dcos(x)/dx = 0 at x=0) + Configurable xicCosPA{"xicCosPA", 0.95, "Xic CosPA"}; // ... + Configurable dcaV0Dau{"dcaV0Dau", 2.f, "DCA V0 Daughters"}; // conservative, a cut ar 1.0 should also be fine + Configurable dcaCascDau{"dcaCascDau", 2.f, "DCA Casc Daughters"}; // conservative, a cut ar 1.0 should also be fine + Configurable dcaNegToPv{"dcaNegToPv", 0.05f, "DCA Neg To PV"}; // 0.06 in run2 + Configurable dcaPosToPv{"dcaPosToPv", 0.05f, "DCA Pos To PV"}; // 0.06 in run2 + Configurable v0MassWindow{"v0MassWindow", 0.01f, "V0 mass window"}; // 0.008 in run2 + Configurable cascadeMassWindow{"cascadeMassWindow", 0.01f, "Cascade mass window"}; // magnetic field setting from CCDB Configurable isRun2{"isRun2", false, "enable Run 2 or Run 3 GRP objects for magnetic field"}; @@ -3367,7 +3347,6 @@ struct HfTrackIndexSkimCreatorLfCascades { } config; o2::vertexing::DCAFitterN<2> df2; // 2-prong vertex fitter - o2::vertexing::DCAFitterN<3> df3; // 3-prong vertex fitter Service ccdb; o2::base::MatLayerCylSet* lut; o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT; @@ -3379,14 +3358,6 @@ struct HfTrackIndexSkimCreatorLfCascades { std::array, kN2ProngDecays> arrMass2Prong; std::array, kN3ProngDecays> arrMass3Prong; - // PDG masses - double massP{0.}; - double massPi{0.}; - double massKaon{0.}; - double massXi{0.}; - double massOmega{0.}; - double massLambda{0.}; - using SelectedCollisions = soa::Filtered>; using SelectedHfTrackAssoc = soa::Filtered>; using CascFull = soa::Join; @@ -3408,17 +3379,10 @@ struct HfTrackIndexSkimCreatorLfCascades { return; } - massP = o2::constants::physics::MassProton; - massPi = o2::constants::physics::MassPiPlus; - massKaon = o2::constants::physics::MassKPlus; - massXi = o2::constants::physics::MassXiMinus; - massOmega = o2::constants::physics::MassOmegaMinus; - massLambda = o2::constants::physics::MassLambda0; - - arrMass2Prong[hf_cand_casc_lf::DecayType2Prong::XiczeroOmegaczeroToXiPi] = std::array{massXi, massPi}; - arrMass2Prong[hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaPi] = std::array{massOmega, massPi}; - arrMass2Prong[hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaK] = std::array{massOmega, massKaon}; - arrMass3Prong[hf_cand_casc_lf::DecayType3Prong::XicplusToXiPiPi] = std::array{massXi, massPi, massPi}; + arrMass2Prong[hf_cand_casc_lf::DecayType2Prong::XiczeroOmegaczeroToXiPi] = std::array{MassXiMinus, MassPiPlus}; + arrMass2Prong[hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaPi] = std::array{MassOmegaMinus, MassPiPlus}; + arrMass2Prong[hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaK] = std::array{MassOmegaMinus, MassKPlus}; + arrMass3Prong[hf_cand_casc_lf::DecayType3Prong::XicplusToXiPiPi] = std::array{MassXiMinus, MassPiPlus, MassPiPlus}; df2.setPropagateToPCA(config.propagateToPCA); df2.setMaxR(config.maxR); @@ -3428,14 +3392,6 @@ struct HfTrackIndexSkimCreatorLfCascades { df2.setUseAbsDCA(config.useAbsDCA); df2.setWeightedFinalPCA(config.useWeightedFinalPCA); - df3.setPropagateToPCA(config.propagateToPCA); - df3.setMaxR(config.maxR); - df3.setMaxDZIni(config.maxDZIni); - df3.setMinParamChange(config.minParamChange); - df3.setMinRelChi2Change(config.minRelChi2Change); - df3.setUseAbsDCA(config.useAbsDCA); - df3.setWeightedFinalPCA(config.useWeightedFinalPCA); - ccdb->setURL(config.ccdbUrl); ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); @@ -3493,7 +3449,7 @@ struct HfTrackIndexSkimCreatorLfCascades { /// Single-cascade cuts template - bool isPreselectedCascade(const TCascade& casc, const float& pvx, const float& pvy, const float& pvz) + bool isPreselectedCascade(const TCascade& casc, const float pvx, const float pvy, const float pvz) { registry.fill(HIST("hCandidateCounter"), 2.5); @@ -3507,7 +3463,7 @@ struct HfTrackIndexSkimCreatorLfCascades { std::abs(casc.dcav0topv(pvx, pvy, pvz)) > config.dcaV0ToPv && casc.v0radius() > config.v0TransvRadius && casc.cascradius() > config.cascTransvRadius && - std::abs(casc.mLambda() - massLambda) < config.v0MassWindow) { + std::abs(casc.mLambda() - MassLambda0) < config.v0MassWindow) { registry.fill(HIST("hCandidateCounter"), 3.5); // pass cascade selections @@ -3537,6 +3493,71 @@ struct HfTrackIndexSkimCreatorLfCascades { return false; } + /// Method to perform selections for Xic 3-prong candidates before vertex reconstruction + /// \param pVecXi is the momentum array of the Xi daughter track + /// \param pVecPi1 is the momentum array of the first pion daughter track + /// \param pVecPi2 is the momentum array of the second pion daughter track + /// \return selection outcome + template + bool isPreselectedCandidateXic(T1 const& pVecXi, T1 const& pVecPi1, T1 const& pVecPi2) + { + // pt + if (config.ptMinXicplusLfCasc > 0.f) { + const auto pt = RecoDecay::pt(pVecXi, pVecPi1, pVecPi2) + config.ptTolerance; // add tolerance because of no reco decay vertex + if (pt < config.ptMinXicplusLfCasc) { + return false; + } + } + + // invariant mass + if (config.massXiPiPiMin >= 0.f && config.massXiPiPiMax > 0.f) { + const double invMassMin = config.massXiPiPiMin; + const double invMassMax = config.massXiPiPiMax; + const std::array arrMom{pVecXi, pVecPi1, pVecPi2}; + const auto invMass2 = RecoDecay::m2(arrMom, arrMass3Prong[hf_cand_casc_lf::DecayType3Prong::XicplusToXiPiPi]); + if (invMass2 < invMassMin * invMassMin || invMass2 >= invMassMax * invMassMax) { + return false; + } + } + + return true; + } + + /// Method to perform selections for Xic 3-prong candidates after vertex reconstruction + /// \param pVecCand is the momentum array of the candidate after the reconstruction of the secondary vertex + /// \param secVtx is the secondary vertex + /// \param primVtx is the primary vertex + /// \return selection outcome + template + bool isSelectedCandidateXic(const T1& pVecCand, const T2& secVtx, const T3& primVtx) + { + // pt + if (config.ptMinXicplusLfCasc > 0.f) { + const auto pt = RecoDecay::pt(pVecCand); + if (pt < config.ptMinXicplusLfCasc) { + return false; + } + } + + // CPA + if (config.xicCosPA > -1.f) { + const auto cpa = RecoDecay::cpa(primVtx, secVtx, pVecCand); + if (cpa < config.xicCosPA) { + return false; + } + } + + // decay length + if (config.decayLengthXicMin > 0.f) { + const auto decayLength = RecoDecay::distance(primVtx, secVtx); + if (decayLength < config.decayLengthXicMin) { + return false; + } + } + + return true; + } + void processNoLfCascades(SelectedCollisions const&) { // dummy @@ -3557,19 +3578,16 @@ struct HfTrackIndexSkimCreatorLfCascades { for (const auto& collision : collisions) { // set the magnetic field from CCDB - auto bc = collision.bc_as(); + const auto bc = collision.bc_as(); initCCDB(bc, runNumber, ccdb, config.isRun2 ? config.ccdbPathGrp : config.ccdbPathGrpMag, lut, config.isRun2); - auto magneticField = o2::base::Propagator::Instance()->getNominalBz(); // z component + const auto magneticField = o2::base::Propagator::Instance()->getNominalBz(); // z component df2.setBz(magneticField); df2.setRefitWithMatCorr(config.refitWithMatCorr); - df3.setBz(magneticField); - df3.setRefitWithMatCorr(config.refitWithMatCorr); - // cascade loop - auto thisCollId = collision.globalIndex(); - auto groupedCascades = cascades.sliceBy(cascadesPerCollision, thisCollId); + const auto thisCollId = collision.globalIndex(); + const auto groupedCascades = cascades.sliceBy(cascadesPerCollision, thisCollId); for (const auto& casc : groupedCascades) { @@ -3577,11 +3595,11 @@ struct HfTrackIndexSkimCreatorLfCascades { //----------------accessing particles in the decay chain------------- // cascade daughter - charged particle - auto trackCascDauCharged = casc.bachelor_as(); // meson <- xi track + const auto trackCascDauCharged = casc.bachelor_as(); // meson <- xi track // cascade daughter - V0 - auto trackV0PosDau = casc.posTrack_as(); // p <- V0 track (positive track) 0 + const auto trackV0PosDau = casc.posTrack_as(); // p <- V0 track (positive track) 0 // V0 negative daughter - auto trackV0NegDau = casc.negTrack_as(); // pion <- V0 track (negative track) 1 + const auto trackV0NegDau = casc.negTrack_as(); // pion <- V0 track (negative track) 1 // check that particles come from the same collision if (config.rejDiffCollTrack) { @@ -3601,8 +3619,8 @@ struct HfTrackIndexSkimCreatorLfCascades { continue; } - std::array vertexCasc = {casc.x(), casc.y(), casc.z()}; - std::array pVecCasc = {casc.px(), casc.py(), casc.pz()}; + const std::array vertexCasc = {casc.x(), casc.y(), casc.z()}; + const std::array pVecCasc = {casc.px(), casc.py(), casc.pz()}; std::array covCasc = {0.}; constexpr int MomInd[6] = {9, 13, 14, 18, 19, 20}; // cov matrix elements for momentum component for (int i = 0; i < 6; i++) { @@ -3610,30 +3628,30 @@ struct HfTrackIndexSkimCreatorLfCascades { covCasc[i] = casc.positionCovMat()[i]; } // create cascade track - o2::track::TrackParCov trackCascXi; + o2::track::TrackParCov trackParCovCascXi; if (trackCascDauCharged.sign() > 0) { - trackCascXi = o2::track::TrackParCov(vertexCasc, pVecCasc, covCasc, 1, true); + trackParCovCascXi = o2::track::TrackParCov(vertexCasc, pVecCasc, covCasc, 1, true); } else if (trackCascDauCharged.sign() < 0) { - trackCascXi = o2::track::TrackParCov(vertexCasc, pVecCasc, covCasc, -1, true); + trackParCovCascXi = o2::track::TrackParCov(vertexCasc, pVecCasc, covCasc, -1, true); } else { continue; } - trackCascXi.setAbsCharge(1); + trackParCovCascXi.setAbsCharge(1); - auto trackCascOmega = trackCascXi; + auto trackParCovCascOmega = trackParCovCascXi; - trackCascXi.setPID(o2::track::PID::XiMinus); - trackCascOmega.setPID(o2::track::PID::OmegaMinus); + trackParCovCascXi.setPID(o2::track::PID::XiMinus); + trackParCovCascOmega.setPID(o2::track::PID::OmegaMinus); //--------------combining cascade and pion tracks-------------- - auto groupedBachTrackIndices = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + const auto groupedBachTrackIndices = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); for (auto trackIdCharmBachelor1 = groupedBachTrackIndices.begin(); trackIdCharmBachelor1 != groupedBachTrackIndices.end(); ++trackIdCharmBachelor1) { hfFlag = 0; isGoogForXi2Prong = true; isGoogForOmega2Prong = true; - auto trackCharmBachelor1 = trackIdCharmBachelor1.track_as(); + const auto trackCharmBachelor1 = trackIdCharmBachelor1.track_as(); if ((config.rejDiffCollTrack) && (trackCascDauCharged.collisionId() != trackCharmBachelor1.collisionId())) { continue; @@ -3650,12 +3668,12 @@ struct HfTrackIndexSkimCreatorLfCascades { } // primary pion track to be processed with DCAFitter - auto trackParVarCharmBachelor1 = getTrackParCov(trackCharmBachelor1); + const auto trackParCovCharmBachelor1 = getTrackParCov(trackCharmBachelor1); // find charm baryon decay using xi PID hypothesis (xi pi channel) int nVtxFrom2ProngFitterXiHyp = 0; try { - nVtxFrom2ProngFitterXiHyp = df2.process(trackCascXi, trackParVarCharmBachelor1); + nVtxFrom2ProngFitterXiHyp = df2.process(trackParCovCascXi, trackParCovCharmBachelor1); } catch (...) { if (config.fillHistograms) { registry.fill(HIST("hFitterStatusXi2Prong"), 1); @@ -3680,7 +3698,7 @@ struct HfTrackIndexSkimCreatorLfCascades { std::array, 2> arrMomToXi = {pVecXi, pVecPion1XiHyp}; auto mass2ProngXiHyp = RecoDecay::m(arrMomToXi, arrMass2Prong[hf_cand_casc_lf::DecayType2Prong::XiczeroOmegaczeroToXiPi]); - if ((std::abs(casc.mXi() - massXi) < config.cascadeMassWindow) && (mass2ProngXiHyp >= config.massXiPiMin) && (mass2ProngXiHyp <= config.massXiPiMax)) { + if ((std::abs(casc.mXi() - MassXiMinus) < config.cascadeMassWindow) && (mass2ProngXiHyp >= config.massXiPiMin) && (mass2ProngXiHyp <= config.massXiPiMax)) { registry.fill(HIST("hRejpTStatusXicZeroOmegacZeroToXiPi"), 0); if (ptXic >= config.ptMinXicZeroOmegacZeroToXiPiLfCasc) { SETBIT(hfFlag, aod::hf_cand_casc_lf::DecayType2Prong::XiczeroOmegaczeroToXiPi); @@ -3701,7 +3719,7 @@ struct HfTrackIndexSkimCreatorLfCascades { // find charm baryon decay using omega PID hypothesis to be combined with the charm bachelor (either pion or kaon) int nVtxFrom2ProngFitterOmegaHyp = 0; try { - nVtxFrom2ProngFitterOmegaHyp = df2.process(trackCascOmega, trackParVarCharmBachelor1); + nVtxFrom2ProngFitterOmegaHyp = df2.process(trackParCovCascOmega, trackParCovCharmBachelor1); } catch (...) { if (config.fillHistograms) { registry.fill(HIST("hFitterStatusOmega2Prong"), 1); @@ -3728,7 +3746,7 @@ struct HfTrackIndexSkimCreatorLfCascades { auto mass2ProngOmegaPiHyp = RecoDecay::m(arrMomToOmega, arrMass2Prong[hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaPi]); auto mass2ProngOmegaKHyp = RecoDecay::m(arrMomToOmega, arrMass2Prong[hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaK]); - if (std::abs(casc.mOmega() - massOmega) < config.cascadeMassWindow) { + if (std::abs(casc.mOmega() - MassOmegaMinus) < config.cascadeMassWindow) { if ((mass2ProngOmegaPiHyp >= config.massOmegaCharmBachelorMin) && (mass2ProngOmegaPiHyp <= config.massOmegaCharmBachelorMax)) { registry.fill(HIST("hRejpTStatusOmegacZeroToOmegaPi"), 0); if (ptOmegac >= config.ptMinOmegacZeroToOmegaPiLfCasc) { @@ -3769,19 +3787,21 @@ struct HfTrackIndexSkimCreatorLfCascades { hfFlag); } - // first loop over tracks + // Xic -> Xi pi pi if (config.do3Prong) { + // Xi mass cut + if (std::abs(casc.mXi() - MassXiMinus) > config.cascadeMassWindow) { + continue; + } - // second loop over positive tracks + // second loop over tracks for (auto trackIdCharmBachelor2 = trackIdCharmBachelor1 + 1; trackIdCharmBachelor2 != groupedBachTrackIndices.end(); ++trackIdCharmBachelor2) { - hfFlag = 0; - if (!TESTBIT(trackIdCharmBachelor2.isSelProng(), CandidateType::CandCascadeBachelor)) { continue; } - auto trackCharmBachelor2 = trackIdCharmBachelor2.track_as(); + const auto trackCharmBachelor2 = trackIdCharmBachelor2.track_as(); if ((config.rejDiffCollTrack) && (trackCascDauCharged.collisionId() != trackCharmBachelor2.collisionId())) { continue; @@ -3797,13 +3817,16 @@ struct HfTrackIndexSkimCreatorLfCascades { continue; } - // primary pion track to be processed with DCAFitter - auto trackParVarPion2 = getTrackParCov(trackCharmBachelor2); + if (!isPreselectedCandidateXic(pVecCasc, trackCharmBachelor1.pVector(), trackCharmBachelor2.pVector())) { + continue; + } // reconstruct Xic with DCAFitter + // Use only bachelor tracks for vertex reconstruction because the Xi track has large uncertainties. int nVtxFrom3ProngFitterXiHyp = 0; try { - nVtxFrom3ProngFitterXiHyp = df3.process(trackCascXi, trackParVarCharmBachelor1, trackParVarPion2); + const auto trackParCovCharmBachelor2 = getTrackParCov(trackCharmBachelor2); + nVtxFrom3ProngFitterXiHyp = df2.process(trackParCovCharmBachelor1, trackParCovCharmBachelor2); } catch (...) { if (config.fillHistograms) { registry.fill(HIST("hFitterStatusXi3Prong"), 1); @@ -3815,48 +3838,44 @@ struct HfTrackIndexSkimCreatorLfCascades { } if (nVtxFrom3ProngFitterXiHyp > 0) { + df2.propagateTracksToVertex(); + if (df2.isPropagateTracksToVertexDone()) { + std::array pVecPi1{}; + std::array pVecPi2{}; + // get bachelor momenta at the Xic vertex + df2.getTrack(0).getPxPyPzGlo(pVecPi1); + df2.getTrack(1).getPxPyPzGlo(pVecPi2); + const auto pVecCand = RecoDecay::pVec(pVecCasc, pVecPi1, pVecPi2); + const auto ptCand = RecoDecay::pt(pVecCand); + const std::array primaryVertex{collision.posX(), collision.posY(), collision.posZ()}; // primary vertex + const auto& secondaryVertex = df2.getPCACandidate(); // secondary vertex + + registry.fill(HIST("hRejpTStatusXicPlusToXiPiPi"), 0); + if (ptCand >= config.ptMinXicplusLfCasc) { + registry.fill(HIST("hRejpTStatusXicPlusToXiPiPi"), 1); + } - df3.propagateTracksToVertex(); - - if (df3.isPropagateTracksToVertexDone()) { - - std::array pVec1 = {0.}; - std::array pVec2 = {0.}; - std::array pVec3 = {0.}; - df3.getTrack(0).getPxPyPzGlo(pVec1); // take the momentum at the Xic vertex - df3.getTrack(1).getPxPyPzGlo(pVec2); - df3.getTrack(2).getPxPyPzGlo(pVec3); - float ptXic3Prong = RecoDecay::pt(pVec1, pVec2, pVec3); - - std::array, 3> arr3Mom = {pVec1, pVec2, pVec3}; - auto mass3Prong = RecoDecay::m(arr3Mom, arrMass3Prong[hf_cand_casc_lf::DecayType3Prong::XicplusToXiPiPi]); - - if ((std::abs(casc.mXi() - massXi) < config.cascadeMassWindow) && (mass3Prong >= config.massXiPiPiMin) && (mass3Prong <= config.massXiPiPiMax)) { - registry.fill(HIST("hRejpTStatusXicPlusToXiPiPi"), 0); - if (ptXic3Prong >= config.ptMinXicplusLfCasc) { - SETBIT(hfFlag, aod::hf_cand_casc_lf::DecayType3Prong::XicplusToXiPiPi); - registry.fill(HIST("hRejpTStatusXicPlusToXiPiPi"), 1); - } + if (!isSelectedCandidateXic(pVecCand, secondaryVertex, primaryVertex)) { + continue; } // fill histograms - if (config.fillHistograms && (TESTBIT(hfFlag, aod::hf_cand_casc_lf::DecayType3Prong::XicplusToXiPiPi))) { + if (config.fillHistograms) { + const std::array arr3Mom{pVecCasc, pVecPi1, pVecPi2}; + const auto mass3Prong = RecoDecay::m(arr3Mom, arrMass3Prong[hf_cand_casc_lf::DecayType3Prong::XicplusToXiPiPi]); registry.fill(HIST("hMassXicPlusToXiPiPi"), mass3Prong); - registry.fill(HIST("hPtCutsXicPlusToXiPiPi"), ptXic3Prong); + registry.fill(HIST("hPtCutsXicPlusToXiPiPi"), ptCand); } - } else if (df3.isPropagationFailure()) { + + // fill table row if a vertex was found + rowTrackIndexCasc3Prong(thisCollId, + casc.cascadeId(), + trackCharmBachelor1.globalIndex(), + trackCharmBachelor2.globalIndex()); + } else if (df2.isPropagationFailure()) { LOGF(info, "Exception caught: failed to propagate tracks (3prong) to charm baryon decay vtx"); } } - - // fill table row only if a vertex was found - if (hfFlag != 0) { - rowTrackIndexCasc3Prong(thisCollId, - casc.cascadeId(), - trackCharmBachelor1.globalIndex(), - trackCharmBachelor2.globalIndex()); - } - } // end 3prong loop } // end 3prong condition From 006799868327d7f7e526b69482e9c58d5e321856 Mon Sep 17 00:00:00 2001 From: Neelima Agrawal Date: Sat, 9 Aug 2025 03:04:34 +0200 Subject: [PATCH 306/345] [PWGCF] added Event_cut for removing time ranges with dead ITS - dips (#12475) --- PWGCF/Femto3D/DataModel/singletrackselector.h | 5 +++-- PWGCF/Femto3D/Tasks/femto3dPairTask.cxx | 6 +++++- PWGCF/Femto3D/Tasks/femto3dPairTaskMC.cxx | 7 +++++-- PWGCF/Femto3D/Tasks/femto3dQA.cxx | 6 +++++- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/PWGCF/Femto3D/DataModel/singletrackselector.h b/PWGCF/Femto3D/DataModel/singletrackselector.h index c7323d15a32..d7f4f0822d3 100644 --- a/PWGCF/Femto3D/DataModel/singletrackselector.h +++ b/PWGCF/Femto3D/DataModel/singletrackselector.h @@ -135,7 +135,7 @@ DECLARE_SOA_DYNAMIC_COLUMN(dIsGoodZvtxFT0vsPV, isGoodZvtxFT0vsPV, [](uint64_t se DECLARE_SOA_DYNAMIC_COLUMN(dIsVertexITSTPC, isVertexITSTPC, [](uint64_t selBit) -> bool { return TESTBIT(selBit, evsel::kIsVertexITSTPC); }); DECLARE_SOA_DYNAMIC_COLUMN(dIsVertexTOForTRDmatched, isVertexTOForTRDmatched, [](uint64_t selBit) -> int { return static_cast(TESTBIT(selBit, evsel::kIsVertexTOFmatched)) + static_cast(TESTBIT(selBit, evsel::kIsVertexTRDmatched)); }); DECLARE_SOA_DYNAMIC_COLUMN(dNoCollInTimeRangeStandard, noCollInTimeRangeStandard, [](uint64_t selBit) -> bool { return TESTBIT(selBit, evsel::kNoCollInTimeRangeStandard); }); - +DECLARE_SOA_DYNAMIC_COLUMN(dIsGoodITSLayersAll, isGoodITSLayersAll, [](uint64_t selBit) -> bool { return TESTBIT(selBit, evsel::kIsGoodITSLayersAll); }); } // namespace singletrackselector DECLARE_SOA_TABLE(SingleCollSels, "AOD", "SINGLECOLLSEL", // Table of the variables for single track selection. @@ -154,7 +154,8 @@ DECLARE_SOA_TABLE(SingleCollExtras_v1, "AOD", "SINGLECOLLEXTR1", // Joinable col singletrackselector::dIsGoodZvtxFT0vsPV, singletrackselector::dIsVertexITSTPC, singletrackselector::dIsVertexTOForTRDmatched, - singletrackselector::dNoCollInTimeRangeStandard); + singletrackselector::dNoCollInTimeRangeStandard, + singletrackselector::dIsGoodITSLayersAll); using SingleCollExtras = SingleCollExtras_v1; diff --git a/PWGCF/Femto3D/Tasks/femto3dPairTask.cxx b/PWGCF/Femto3D/Tasks/femto3dPairTask.cxx index 83aa740795c..db6c12dc14c 100644 --- a/PWGCF/Femto3D/Tasks/femto3dPairTask.cxx +++ b/PWGCF/Femto3D/Tasks/femto3dPairTask.cxx @@ -55,6 +55,7 @@ struct FemtoCorrelations { Configurable _requestVertexITSTPC{"requestVertexITSTPC", false, ""}; Configurable _requestVertexTOForTRDmatched{"requestVertexTOFmatched", 0, "0 -> no selectio; 1 -> vertex is matched to TOF or TRD; 2 -> matched to both;"}; Configurable _requestNoCollInTimeRangeStandard{"requestNoCollInTimeRangeStandard", false, ""}; + Configurable _requestIsGoodITSLayersAll{"requestIsGoodITSLayersAll", false, "cut time intervals with dead ITS staves"}; Configurable> _IRcut{"IRcut", std::pair{0.f, 100.f}, "[min., max.] IR range to keep events within"}; Configurable> _OccupancyCut{"OccupancyCut", std::pair{0, 10000}, "[min., max.] occupancy range to keep events within"}; @@ -423,6 +424,8 @@ struct FemtoCorrelations { continue; if (_requestNoCollInTimeRangeStandard && !track.template singleCollSel_as>().noCollInTimeRangeStandard()) continue; + if (_requestIsGoodITSLayersAll && !track.template singleCollSel_as>().isGoodITSLayersAll()) + continue; if (track.tpcFractionSharedCls() > _tpcFractionSharedCls || track.itsNCls() < _itsNCls) continue; if (track.template singleCollSel_as>().multPerc() < *_centBins.value.begin() || track.template singleCollSel_as>().multPerc() >= *(_centBins.value.end() - 1)) @@ -473,7 +476,8 @@ struct FemtoCorrelations { continue; if (_requestNoCollInTimeRangeStandard && !collision.noCollInTimeRangeStandard()) continue; - + if (_requestIsGoodITSLayersAll && !collision.isGoodITSLayersAll()) + continue; if (selectedtracks_1.find(collision.globalIndex()) == selectedtracks_1.end()) { if (IsIdentical) continue; diff --git a/PWGCF/Femto3D/Tasks/femto3dPairTaskMC.cxx b/PWGCF/Femto3D/Tasks/femto3dPairTaskMC.cxx index b776d34e629..252fb5fc410 100644 --- a/PWGCF/Femto3D/Tasks/femto3dPairTaskMC.cxx +++ b/PWGCF/Femto3D/Tasks/femto3dPairTaskMC.cxx @@ -51,6 +51,7 @@ struct FemtoCorrelationsMC { Configurable _requestVertexITSTPC{"requestVertexITSTPC", false, ""}; Configurable _requestVertexTOForTRDmatched{"requestVertexTOFmatched", 0, "0 -> no selectio; 1 -> vertex is matched to TOF or TRD; 2 -> matched to both;"}; Configurable _requestNoCollInTimeRangeStandard{"requestNoCollInTimeRangeStandard", false, ""}; + Configurable _requestIsGoodITSLayersAll{"requestIsGoodITSLayersAll", false, "cut time intervals with dead ITS staves"}; Configurable> _IRcut{"IRcut", std::pair{0.f, 100.f}, "[min., max.] IR range to keep events within"}; Configurable> _OccupancyCut{"OccupancyCut", std::pair{0, 10000}, "[min., max.] occupancy range to keep events within"}; @@ -350,7 +351,8 @@ struct FemtoCorrelationsMC { continue; if (_requestNoCollInTimeRangeStandard && !track.template singleCollSel_as>().noCollInTimeRangeStandard()) continue; - + if (_requestIsGoodITSLayersAll && !track.template singleCollSel_as>().isGoodITSLayersAll()) + continue; unsigned int centBin = o2::aod::singletrackselector::getBinIndex(track.template singleCollSel_as>().multPerc(), _centBins); if (track.sign() == _sign_1 && (track.p() < _PIDtrshld_1 ? o2::aod::singletrackselector::TPCselection(track, TPCcuts_1, _itsNSigma_1.value) : o2::aod::singletrackselector::TOFselection(track, TOFcuts_1, _tpcNSigmaResidual_1.value))) { @@ -412,7 +414,8 @@ struct FemtoCorrelationsMC { continue; if (_requestNoCollInTimeRangeStandard && !collision.noCollInTimeRangeStandard()) continue; - + if (_requestIsGoodITSLayersAll && !collision.isGoodITSLayersAll()) + continue; if (selectedtracks_1.find(collision.globalIndex()) == selectedtracks_1.end()) { if (IsIdentical) continue; diff --git a/PWGCF/Femto3D/Tasks/femto3dQA.cxx b/PWGCF/Femto3D/Tasks/femto3dQA.cxx index 64858324b48..b31f3cd970e 100644 --- a/PWGCF/Femto3D/Tasks/femto3dQA.cxx +++ b/PWGCF/Femto3D/Tasks/femto3dQA.cxx @@ -52,6 +52,7 @@ struct QAHistograms { Configurable _requestVertexITSTPC{"requestVertexITSTPC", false, ""}; Configurable _requestVertexTOForTRDmatched{"requestVertexTOFmatched", 0, "0 -> no selectio; 1 -> vertex is matched to TOF or TRD; 2 -> matched to both;"}; Configurable _requestNoCollInTimeRangeStandard{"requestNoCollInTimeRangeStandard", false, ""}; + Configurable _requestIsGoodITSLayersAll{"requestIsGoodITSLayersAll", false, "cut time intervals with dead ITS staves"}; Configurable> _IRcut{"IRcut", std::pair{0.f, 100.f}, "[min., max.] IR range to keep events within"}; Configurable> _OccupancyCut{"OccupancyCut", std::pair{0, 10000}, "[min., max.] occupancy range to keep events within"}; @@ -181,6 +182,8 @@ struct QAHistograms { continue; if (_requestNoCollInTimeRangeStandard && !collision.noCollInTimeRangeStandard()) continue; + if (_requestIsGoodITSLayersAll && !collision.isGoodITSLayersAll()) + continue; if (collision.multPerc() < _centCut.value.first || collision.multPerc() >= _centCut.value.second) continue; if (collision.hadronicRate() < _IRcut.value.first || collision.hadronicRate() >= _IRcut.value.second) @@ -206,7 +209,8 @@ struct QAHistograms { continue; if (_requestNoCollInTimeRangeStandard && !track.template singleCollSel_as().noCollInTimeRangeStandard()) continue; - + if (_requestIsGoodITSLayersAll && !track.template singleCollSel_as().isGoodITSLayersAll()) + continue; if (std::fabs(track.template singleCollSel_as().posZ()) > _vertexZ) continue; if (track.template singleCollSel_as().multPerc() < _centCut.value.first || track.template singleCollSel_as().multPerc() >= _centCut.value.second) From 9e465b7bdee9ab9bbe532dd0c1c5c9bd900e0299 Mon Sep 17 00:00:00 2001 From: spucillo <93769017+spucillo@users.noreply.github.com> Date: Sat, 9 Aug 2025 05:14:42 +0200 Subject: [PATCH 307/345] =?UTF-8?q?[PWGLF]=20Creation=20of=20a=20task=20to?= =?UTF-8?q?=20perform=20the=20analysis=20of=20cascades=20in=20light-ion=20?= =?UTF-8?q?c=E2=80=A6=20(#12473)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PWGLF/Tasks/Strangeness/CMakeLists.txt | 5 + .../cascadeAnalysisLightIonsDerivedData.cxx | 1030 +++++++++++++++++ 2 files changed, 1035 insertions(+) create mode 100644 PWGLF/Tasks/Strangeness/cascadeAnalysisLightIonsDerivedData.cxx diff --git a/PWGLF/Tasks/Strangeness/CMakeLists.txt b/PWGLF/Tasks/Strangeness/CMakeLists.txt index 5f88145c01d..100b8667aab 100644 --- a/PWGLF/Tasks/Strangeness/CMakeLists.txt +++ b/PWGLF/Tasks/Strangeness/CMakeLists.txt @@ -155,3 +155,8 @@ o2physics_add_dpl_workflow(lambdatwopartpolarization SOURCES lambdaTwoPartPolarization.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(cascadeanalysislightions + SOURCES cascadeAnalysisLightIonsDerivedData.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) diff --git a/PWGLF/Tasks/Strangeness/cascadeAnalysisLightIonsDerivedData.cxx b/PWGLF/Tasks/Strangeness/cascadeAnalysisLightIonsDerivedData.cxx new file mode 100644 index 00000000000..5d7178c60e5 --- /dev/null +++ b/PWGLF/Tasks/Strangeness/cascadeAnalysisLightIonsDerivedData.cxx @@ -0,0 +1,1030 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// +/// \file cascadeAnalysisLightIonsDerivedData.cxx +/// \brief analysis of cascades (Xi, antiXi, Omega, antiOmega) in light-ion collisions using derived data +/// +/// \author Sara Pucillo (sara.pucillo@cern.ch), Alberto Caliva (alberto.caliva@cern.ch) +// + +#include "PWGLF/DataModel/LFStrangenessPIDTables.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" + +#include "Common/CCDB/ctpRateFetcher.h" +#include "Common/Core/RecoDecay.h" +#include "Common/Core/TrackSelection.h" +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "CommonConstants/MathConstants.h" +#include "CommonConstants/PhysicsConstants.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/O2DatabasePDGPlugin.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/Track.h" + +#include +#include +#include +#include +#include +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::constants::math; +using namespace o2::constants::physics; +using std::array; + +using SelCollisions = soa::Join; +using SimCollisions = soa::Join; +using CascadeCandidates = soa::Join; +using CascadeMCCandidates = soa::Join; +using DaughterTracks = soa::Join; +using CollisionMCTrueTable = soa::Join; +using CascadeMCCores = soa::Join; + +struct CascadeAnalysisLightIonsDerivedData { + + // Instantiate the CCDB service and API interface + // CCDB options + struct : ConfigurableGroup { + std::string prefix = "ccdbConfigurations"; // JSON group name + Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"}; + Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; + Configurable lutPath{"lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"}; + Configurable geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; + Configurable mVtxPath{"mVtxPath", "GLO/Calib/MeanVertex", "Path of the mean vertex file"}; + } ccdbConfigurations; + + o2::ccdb::CcdbApi ccdbApi; + Service ccdb; + int mRunNumber; + + // Define histogram registries + HistogramRegistry registryData{"registryData", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry registryMC{"registryMC", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry registryQC{"registryQC", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + + // Global analysis parameters + Configurable zVtx{"zVtx", 10.0, "Maximum zVertex"}; + Configurable deltaEtaEdge{"deltaEtaEdge", 0.05, "eta gap from the edge"}; + Configurable nBins{"nBins", 100, "N bins in all QC histos"}; + + // Event selections parameters + Configurable applySel8{"applySel8", true, "0 - no, 1 - yes"}; + Configurable applyVtxZ{"applyVtxZ", true, "0 - no, 1 - yes"}; + Configurable rejectITSROFBorder{"rejectITSROFBorder", true, "reject events at ITS ROF border"}; + Configurable rejectTFBorder{"rejectTFBorder", true, "reject events at TF border"}; + Configurable requireVertexITSTPC{"requireVertexITSTPC", false, "require events with at least one ITS-TPC track"}; + Configurable requireIsGoodZvtxFT0VsPV{"requireIsGoodZvtxFT0VsPV", false, "require is good Zvtx FT0 vs PV"}; + Configurable requireIsVertexTOFmatched{"requireIsVertexTOFmatched", false, "require events with at least one of vertex contributors matched to TOF"}; + Configurable requireIsVertexTRDmatched{"requireIsVertexTRDmatched", false, "require events with at least one of vertex contributors matched to TRD"}; + Configurable rejectSameBunchPileup{"rejectSameBunchPileup", true, "reject collisions in case of pileup with another collision in the same foundBC"}; + + // Track analysis Parameters + Configurable minITSnCls{"minITSnCls", 4.0f, "min number of ITS clusters"}; + Configurable minTPCnClsFound{"minTPCnClsFound", 80.0f, "min number of found TPC clusters"}; + Configurable minNCrossedRowsTPC{"minNCrossedRowsTPC", 80.0f, "min number of TPC crossed rows"}; + Configurable etaMin{"etaMin", -0.8f, "eta min"}; + Configurable etaMax{"etaMax", +0.8f, "eta max"}; + Configurable rapcut{"rapcut", +0.5f, "rapidity cut"}; + Configurable maxChi2TPC{"maxChi2TPC", 4.0f, "max chi2 per cluster TPC"}; + Configurable requireITS{"requireITS", false, "require ITS hit"}; + Configurable requireTOF{"requireTOF", false, "require TOF hit"}; + + // Configurable parameters for PID selection + Configurable nsigmaTPCmin{"nsigmaTPCmin", -5.0f, "Minimum nsigma TPC"}; + Configurable nsigmaTPCmax{"nsigmaTPCmax", +5.0f, "Maximum nsigma TPC"}; + + // Configurable parameters for TOF PID selection + Configurable nsigmaTOFmin{"nsigmaTOFmin", -3.0f, "Minimum nsigma TOF"}; + Configurable nsigmaTOFmax{"nsigmaTOFmax", +3.0f, "Maximum nsigma TOF"}; + + // Topological Parameters + Configurable dcanegtoPVmin{"dcanegtoPVmin", 0.1f, "Minimum DCA Neg To PV"}; + Configurable dcapostoPVmin{"dcapostoPVmin", 0.1f, "Minimum DCA Pos To PV"}; + Configurable dcabachtopvMin{"dcabachtopvMin", 0.1f, "Minimum DCA bachelor to PV"}; + Configurable dcaV0DaughtersMax{"dcaV0DaughtersMax", 0.7f, "Maximum DCA Daughters"}; + Configurable dcaV0topvMin{"dcaV0topvMin", 0.02f, "Minimum DCA V0 to PV"}; + Configurable dcaCascDaughtersMax{"dcaCascDaughtersMax", 0.8f, "Maximum DCA Daughters"}; + Configurable v0cospaMin{"v0cospaMin", 0.99f, "Minimum V0 CosPA"}; + Configurable casccospaMin{"casccospaMin", 0.99f, "Minimum Cascade CosPA"}; + Configurable minimumV0Radius{"minimumV0Radius", 2.5f, "Minimum V0 Radius"}; + Configurable minimumCascRadius{"minimumCascRadius", 1.1f, "Minimum Cascade Radius"}; + Configurable v0masswindow{"v0masswindow", 0.005, "v0 mass window"}; + Configurable competingmassrej{"competingmassrej", 0.008, "Competing mass rejection"}; + // Axes parameters + ConfigurableAxis centEstimatorHistBin{"centEstimatorHistBin", {501, -0.5, 500.5}, ""}; + ConfigurableAxis centralityBinning{"centralityBinning", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}, ""}; + ConfigurableAxis axisNch{"axisNch", {500, 0.0f, +1000.0f}, "Number of charged particles"}; + + // Centrality estimator + Configurable centralityEstimator{"centralityEstimator", 0, "0 = FT0C, 1 = FTOM, 2 = FV0A, 3 = NGlobal"}; + + // List of estimators + enum Option { kFT0C, + kFT0M, + kFV0A, + kNGlobal }; + + // For manual sliceBy + PresliceUnsorted> perMcCollision = aod::v0data::straMCCollisionId; + + void init(InitContext const&) + { + // setting CCDB service + ccdb->setURL(ccdbConfigurations.ccdbUrl); + ccdb->setCaching(true); + ccdb->setFatalWhenNull(false); + ccdb->setLocalObjectValidityChecking(); + ccdb->setCreatedNotAfter( + std::chrono::duration_cast( + std::chrono::system_clock::now().time_since_epoch()) + .count()); + + // Axes and Binning + AxisSpec axisCentEstimator = {centEstimatorHistBin, "CentEstimator", "CentEstimatorAxis"}; + AxisSpec centAxis = {centralityBinning, "Centrality", "CentralityAxis"}; + const AxisSpec vertexZAxis = {nBins, -15., 15., "vrtx_{Z} [cm]"}; + const AxisSpec etaAxis{18, -0.9, 0.9, "#eta"}; + const AxisSpec ptAxis{100, 0.0, 10.0, "#it{p}_{T} (GeV/#it{c})"}; + const AxisSpec invMassXiAxis{200, 1.28, 1.36, "m_{p#pi#pi} (GeV/#it{c}^{2})"}; + const AxisSpec invMassOmegaAxis{200, 1.63, 1.71, "m_{p#piK} (GeV/#it{c}^{2})"}; + const AxisSpec nsigmaTOFAxis{200, -10, 10, "n#sigma_{TOF}"}; + const AxisSpec nsigmaTPCAxis{200, -10, 10, "n#sigma_{TPC}"}; + + // Histograms for data + if (doprocessData) { + registryData.add("number_of_events_data", "number of events in data", HistType::kTH1D, {{20, -0.5f, +19.5f}}); + registryData.get(HIST("number_of_events_data"))->GetXaxis()->SetBinLabel(1, "All collisions"); + registryData.get(HIST("number_of_events_data"))->GetXaxis()->SetBinLabel(2, "sel8 cut"); + registryData.get(HIST("number_of_events_data"))->GetXaxis()->SetBinLabel(3, "posZ cut"); + registryData.get(HIST("number_of_events_data"))->GetXaxis()->SetBinLabel(4, "kNoITSROFrameBorder"); + registryData.get(HIST("number_of_events_data"))->GetXaxis()->SetBinLabel(5, "kNoTimeFrameBorder"); + registryData.get(HIST("number_of_events_data"))->GetXaxis()->SetBinLabel(6, "kIsVertexITSTPC"); + registryData.get(HIST("number_of_events_data"))->GetXaxis()->SetBinLabel(7, "kIsGoodZvtxFT0vsPV"); + registryData.get(HIST("number_of_events_data"))->GetXaxis()->SetBinLabel(8, "kIsVertexTOFmatched"); + registryData.get(HIST("number_of_events_data"))->GetXaxis()->SetBinLabel(9, "kIsVertexTRDmatched"); + registryData.get(HIST("number_of_events_data"))->GetXaxis()->SetBinLabel(10, "kNoSameBunchPileup"); + + // QC Histograms + registryQC.add("hVertexZdata", "hVertexZdata", HistType::kTH1F, {vertexZAxis}); + registryQC.add("hv0cosPAdata", "hv0cosPAdata", HistType::kTH1F, {{nBins, 0.95f, 1.f}}); + registryQC.add("hcasccosPAdata", "hcasccosPAdata", HistType::kTH1F, {{nBins, 0.95f, 1.f}}); + registryQC.add("hv0radiusdata", "hv0radiusdata", HistType::kTH1F, {{nBins, 0.0f, 5.0f}}); + registryQC.add("hcascradiusdata", "hcascradiusdata", HistType::kTH1F, {{nBins, 0.0f, 5.0f}}); + registryQC.add("hdcaV0daughtersdata", "hdcaV0daughtersdata", HistType::kTH1F, {{nBins, 0.0f, 1.5f}}); + registryQC.add("hdcacascdaughtersdata", "hdcacascdaughtersdata", HistType::kTH1F, {{nBins, 0.0f, 1.5f}}); + registryQC.add("hdcapostopvdata", "hdcapostopvdata", HistType::kTH1F, {{nBins, 0.0f, 2.0f}}); + registryQC.add("hdcanegtopvdata", "hdcanegtopvdata", HistType::kTH1F, {{nBins, 0.0f, 2.0f}}); + registryQC.add("hdcabachtopvdata", "hdcabachtopvdata", HistType::kTH1F, {{nBins, 0.0f, 2.0f}}); + registryQC.add("hdcav0topvdata", "hdcav0topvdata", HistType::kTH1F, {{nBins, 0.0f, 2.0f}}); + + // Multiplicity Histograms + registryData.add("hCentEstimator", "hCentEstimator", HistType::kTH1D, {axisCentEstimator}); + registryData.add("hCentralityVsNch", "hCentralityVsNch", HistType::kTH2D, {axisCentEstimator, axisNch}); + + // Histograms for xi (data) + registryData.add("hMassXipos", "hMassXipos", HistType::kTH3F, {centAxis, ptAxis, invMassXiAxis}); + registryData.add("hMassXineg", "hMassXineg", HistType::kTH3F, {centAxis, ptAxis, invMassXiAxis}); + registryData.add("hMassXiposSelected", "hMassXiposSelected", HistType::kTH3F, {centAxis, ptAxis, invMassXiAxis}); + registryData.add("hMassXinegSelected", "hMassXinegSelected", HistType::kTH3F, {centAxis, ptAxis, invMassXiAxis}); + + // Histograms for omega (data) + registryData.add("hMassOmegapos", "hMassOmegapos", HistType::kTH3F, {centAxis, ptAxis, invMassOmegaAxis}); + registryData.add("hMassOmeganeg", "hMassOmeganeg", HistType::kTH3F, {centAxis, ptAxis, invMassOmegaAxis}); + registryData.add("hMassOmegaposSelected", "hMassOmegaposSelected", HistType::kTH3F, {centAxis, ptAxis, invMassOmegaAxis}); + registryData.add("hMassOmeganegSelected", "hMassOmeganegSelected", HistType::kTH3F, {centAxis, ptAxis, invMassOmegaAxis}); + } + + if (doprocessMonteCarloRec) { + // Histograms for mc reconstructed + registryMC.add("number_of_events_mc_rec", "number of events in mc_rec", HistType::kTH1D, {{20, -0.5f, +19.5f}}); + registryMC.get(HIST("number_of_events_mc_rec"))->GetXaxis()->SetBinLabel(1, "All collisions"); + registryMC.get(HIST("number_of_events_mc_rec"))->GetXaxis()->SetBinLabel(2, "sel8 cut"); + registryMC.get(HIST("number_of_events_mc_rec"))->GetXaxis()->SetBinLabel(3, "posZ cut"); + registryMC.get(HIST("number_of_events_mc_rec"))->GetXaxis()->SetBinLabel(4, "kNoITSROFrameBorder"); + registryMC.get(HIST("number_of_events_mc_rec"))->GetXaxis()->SetBinLabel(5, "kNoTimeFrameBorder"); + registryMC.get(HIST("number_of_events_mc_rec"))->GetXaxis()->SetBinLabel(6, "kIsVertexITSTPC"); + registryMC.get(HIST("number_of_events_mc_rec"))->GetXaxis()->SetBinLabel(7, "kIsGoodZvtxFT0vsPV"); + registryMC.get(HIST("number_of_events_mc_rec"))->GetXaxis()->SetBinLabel(8, "kIsVertexTOFmatched"); + registryMC.get(HIST("number_of_events_mc_rec"))->GetXaxis()->SetBinLabel(9, "kIsVertexTRDmatched"); + registryMC.get(HIST("number_of_events_mc_rec"))->GetXaxis()->SetBinLabel(10, "kNoSameBunchPileup"); + + // QC Histograms + registryQC.add("hVertexZRec", "hVertexZRec", HistType::kTH1F, {{vertexZAxis}}); + registryQC.add("hv0cosPARec", "hv0cosPARec", HistType::kTH1F, {{nBins, 0.95f, 1.f}}); + registryQC.add("hcasccosPARec", "hcasccosPARec", HistType::kTH1F, {{nBins, 0.95f, 1.f}}); + registryQC.add("hv0radiusRec", "hv0radiusRec", HistType::kTH1F, {{nBins, 0.0f, 5.0f}}); + registryQC.add("hcascradiusRec", "hcascradiusRec", HistType::kTH1F, {{nBins, 0.0f, 5.0f}}); + registryQC.add("hdcaV0daughtersRec", "hdcaV0daughtersRec", HistType::kTH1F, {{nBins, 0.0f, 1.5f}}); + registryQC.add("hdcacascdaughtersRec", "hdcacascdaughtersRec", HistType::kTH1F, {{nBins, 0.0f, 1.5f}}); + registryQC.add("hdcapostopvRec", "hdcapostopvRec", HistType::kTH1F, {{nBins, 0.0f, 2.0f}}); + registryQC.add("hdcanegtopvRec", "hdcanegtopvRec", HistType::kTH1F, {{nBins, 0.0f, 2.0f}}); + registryQC.add("hdcabachtopvRec", "hdcabachtopvRec", HistType::kTH1F, {{nBins, 0.0f, 2.0f}}); + registryQC.add("hdcav0topvRec", "hdcav0topvRec", HistType::kTH1F, {{nBins, 0.0f, 2.0f}}); + + // Multiplicity Histograms + registryMC.add("hCentEstimator_truerec", "hCentEstimator_truerec", HistType::kTH1D, {axisCentEstimator}); + registryMC.add("hCentralityVsNch_truerec", "hCentralityVsNch_truerec", HistType::kTH2D, {axisCentEstimator, axisNch}); + + // Histograms for xi (mc) + registryMC.add("hMassXipos_truerec", "hMassXipos_truerec", HistType::kTH3F, {centAxis, ptAxis, invMassXiAxis}); + registryMC.add("hMassXineg_truerec", "hMassXineg_truerec", HistType::kTH3F, {centAxis, ptAxis, invMassXiAxis}); + registryMC.add("hMassXiposSelected_truerec", "hMassXiposSelected_truerec", HistType::kTH3F, {centAxis, ptAxis, invMassXiAxis}); + registryMC.add("hMassXinegSelected_truerec", "hMassXinegSelected_truerec", HistType::kTH3F, {centAxis, ptAxis, invMassXiAxis}); + + // Histograms for omega (mc) + registryMC.add("hMassOmegapos_truerec", "hMassOmegapos_truerec", HistType::kTH3F, {centAxis, ptAxis, invMassOmegaAxis}); + registryMC.add("hMassOmeganeg_truerec", "hMassOmeganeg_truerec", HistType::kTH3F, {centAxis, ptAxis, invMassOmegaAxis}); + registryMC.add("hMassOmegaposSelected_truerec", "hMassOmegaposSelected_truerec", HistType::kTH3F, {centAxis, ptAxis, invMassOmegaAxis}); + registryMC.add("hMassOmeganegSelected_truerec", "hMassOmeganegSelected_truerec", HistType::kTH3F, {centAxis, ptAxis, invMassOmegaAxis}); + } + + if (doprocessMonteCarloGen) { + // Histograms for mc generated + // QC Histograms + registryQC.add("hVertexZGen", "hVertexZGen", HistType::kTH1F, {{vertexZAxis}}); + // Histograms for xi (mc) + registryMC.add("h2dGenXiMinusVsMultMC_RecoedEvt", "h2dGenXiMinusVsMultMC_RecoedEvt", HistType::kTH2F, {axisNch, ptAxis}); + registryMC.add("h2dGenXiPlusVsMultMC_RecoedEvt", "h2dGenXiPlusVsMultMC_RecoedEvt", HistType::kTH2F, {axisNch, ptAxis}); + registryMC.add("h2dGenXiMinusVsMultMC", "h2dGenXiMinusVsMultMC", HistType::kTH2F, {axisNch, ptAxis}); + registryMC.add("h2dGenXiPlusVsMultMC", "h2dGenXiPlusVsMultMC", HistType::kTH2F, {axisNch, ptAxis}); + + // Histograms for omega (mc) + registryMC.add("h2dGenOmegaMinusVsMultMC_RecoedEvt", "h2dGenOmegaMinusVsMultMC_RecoedEvt", HistType::kTH2F, {axisNch, ptAxis}); + registryMC.add("h2dGenOmegaPlusVsMultMC_RecoedEvt", "h2dGenOmegaPlusVsMultMC_RecoedEvt", HistType::kTH2F, {axisNch, ptAxis}); + registryMC.add("h2dGenOmegaMinusVsMultMC", "h2dGenOmegaMinusVsMultMC", HistType::kTH2F, {axisNch, ptAxis}); + registryMC.add("h2dGenOmegaPlusVsMultMC", "h2dGenOmegaPlusVsMultMC", HistType::kTH2F, {axisNch, ptAxis}); + + // Histograms for event loss/splitting + registryMC.add("hGenEvents", "hGenEvents", HistType::kTH2F, {{axisNch}, {2, -0.5f, +1.5f}}); + registryMC.get(HIST("hGenEvents"))->GetYaxis()->SetBinLabel(1, "All gen. events"); + registryMC.get(HIST("hGenEvents"))->GetYaxis()->SetBinLabel(2, "Gen. with at least 1 rec. events"); + registryMC.add("hGenEventCentrality", "hGenEventCentrality", kTH1D, {{101, 0.0f, 101.0f}}); + + registryMC.add("hCentralityVsNcoll_beforeEvSel", "hCentralityVsNcoll_beforeEvSel", HistType::kTH2F, {centAxis, {50, -0.5f, 49.5f}}); + registryMC.add("hCentralityVsNcoll_afterEvSel", "hCentralityVsNcoll_afterEvSel", HistType::kTH2F, {centAxis, {50, -0.5f, 49.5f}}); + + registryMC.add("hCentralityVsMultMC", "hCentralityVsMultMC", HistType::kTH2F, {{101, 0.0f, 101.0f}, axisNch}); + } + } + + // ______________________________________________________ + // Return slicing output + template + auto getGroupedCollisions(TCollisions const& collisions, int globalIndex) + { + return collisions.sliceBy(perMcCollision, globalIndex); + } + + template + void initCCDB(TCollision collision) + { + if (mRunNumber == collision.runNumber()) { + return; + } + + mRunNumber = collision.runNumber(); + } + + // Find ITS hit + // template + // bool hasITSHitOnLayer(const TrackIts& track, int layer) + // { + // int ibit = layer - 1; + // return (track.itsClusterMap() & (1 << ibit)); + // } + + // Single-Track Selection + template + bool passedSingleTrackSelection(const Track& track) + { + if (requireITS && (!track.hasITS())) + return false; + if (requireITS && track.itsNCls() < minITSnCls) + return false; + if (!track.hasTPC()) + return false; + if (track.tpcNClsFound() < minTPCnClsFound) + return false; + if (track.tpcNClsCrossedRows() < minNCrossedRowsTPC) + return false; + if (track.tpcChi2NCl() > maxChi2TPC) + return false; + if (requireTOF && (!track.hasTOF())) + return false; + return true; + } + + // Xi Selection + template + bool passedXiSelection(const Xi& casc, const TrackPos& ptrack, + const TrackNeg& ntrack, const TrackBac& btrack, + const Coll& coll) + { + if (!passedSingleTrackSelection(ptrack)) + return false; + if (!passedSingleTrackSelection(ntrack)) + return false; + if (!passedSingleTrackSelection(btrack)) + return false; + + if (std::abs(casc.yXi()) > rapcut) + return false; + + // Xi+ Selection (Xi+ -> antiL + pi+) + if (casc.sign() > 0) { + + // PID Selections (TPC) + if (ntrack.tpcNSigmaPr() < nsigmaTPCmin || + ntrack.tpcNSigmaPr() > nsigmaTPCmax) + return false; + if (ptrack.tpcNSigmaPi() < nsigmaTPCmin || + ptrack.tpcNSigmaPi() > nsigmaTPCmax) + return false; + + // PID Selections (TOF) + if (requireTOF) { + if (casc.tofNSigmaXiLaPr() < nsigmaTOFmin || + casc.tofNSigmaXiLaPr() > nsigmaTOFmax) + return false; + if (casc.tofNSigmaXiLaPi() < nsigmaTOFmin || + casc.tofNSigmaXiLaPi() > nsigmaTOFmax) + return false; + } + } + + // Xi- Selection (Xi- -> L + pi-) + if (casc.sign() < 0) { + + // PID Selections (TPC) + if (ptrack.tpcNSigmaPr() < nsigmaTPCmin || + ptrack.tpcNSigmaPr() > nsigmaTPCmax) + return false; + if (ntrack.tpcNSigmaPi() < nsigmaTPCmin || + ntrack.tpcNSigmaPi() > nsigmaTPCmax) + return false; + + // PID Selections (TOF) + if (requireTOF) { + if (casc.tofNSigmaXiLaPr() < nsigmaTOFmin || + casc.tofNSigmaXiLaPr() > nsigmaTOFmax) + return false; + if (casc.tofNSigmaXiLaPi() < nsigmaTOFmin || + casc.tofNSigmaXiLaPi() > nsigmaTOFmax) + return false; + } + } + + if (casc.v0cosPA(coll.posX(), coll.posY(), coll.posZ()) < v0cospaMin) + return false; + if (casc.v0radius() < minimumV0Radius) + return false; + if (std::fabs(casc.dcaV0daughters()) > dcaV0DaughtersMax) + return false; + if (std::fabs(casc.dcapostopv()) < dcapostoPVmin) + return false; + if (std::fabs(casc.dcanegtopv()) < dcanegtoPVmin) + return false; + + if (casc.casccosPA(coll.posX(), coll.posY(), coll.posZ()) < casccospaMin) + return false; + if (casc.cascradius() < minimumCascRadius) + return false; + if (std::fabs(casc.dcabachtopv()) < dcabachtopvMin) + return false; + if (std::fabs(casc.dcav0topv(coll.posX(), coll.posY(), coll.posZ())) < + dcaV0topvMin) + return false; + if (std::fabs(casc.dcacascdaughters()) > dcaCascDaughtersMax) + return false; + + // V0 mass window + if (std::abs(casc.mLambda() - o2::constants::physics::MassLambda0) > + v0masswindow) + return false; + + // reject candidates compatible with omega + if (std::abs(casc.mOmega() - o2::constants::physics::MassOmegaMinus) < + competingmassrej) + return false; + + // PID Selection on bachelor + if (btrack.tpcNSigmaPi() < nsigmaTPCmin || + btrack.tpcNSigmaPi() > nsigmaTPCmax) + return false; + + // PID Selections (TOF) + if (requireTOF) { + if (casc.tofNSigmaXiPi() < nsigmaTOFmin || + casc.tofNSigmaXiPi() > nsigmaTOFmax) + return false; + } + return true; + } + + // Omega Selection + template + bool passedOmegaSelection(const Omega& casc, const TrackPos& ptrack, + const TrackNeg& ntrack, const TrackBac& btrack, + const Coll& coll) + { + if (!passedSingleTrackSelection(ptrack)) + return false; + if (!passedSingleTrackSelection(ntrack)) + return false; + if (!passedSingleTrackSelection(btrack)) + return false; + + if (std::abs(casc.yOmega()) > rapcut) + return false; + + // Omega+ Selection (Omega+ -> antiL + K+) + if (casc.sign() > 0) { + // PID Selections (TPC) + if (ntrack.tpcNSigmaPr() < nsigmaTPCmin || + ntrack.tpcNSigmaPr() > nsigmaTPCmax) + return false; + if (ptrack.tpcNSigmaPi() < nsigmaTPCmin || + ptrack.tpcNSigmaPi() > nsigmaTPCmax) + return false; + + // PID Selections (TOF) + if (requireTOF) { + if (casc.tofNSigmaOmLaPr() < nsigmaTOFmin || + casc.tofNSigmaOmLaPr() > nsigmaTOFmax) + return false; + if (casc.tofNSigmaOmLaPi() < nsigmaTOFmin || + casc.tofNSigmaOmLaPi() > nsigmaTOFmax) + return false; + } + } + + // Omega- Selection (Omega- -> L + K-) + if (casc.sign() < 0) { + // PID Selections (TPC) + if (ptrack.tpcNSigmaPr() < nsigmaTPCmin || + ptrack.tpcNSigmaPr() > nsigmaTPCmax) + return false; + if (ntrack.tpcNSigmaPi() < nsigmaTPCmin || + ntrack.tpcNSigmaPi() > nsigmaTPCmax) + return false; + + // PID Selections (TOF) + if (requireTOF) { + if (casc.tofNSigmaOmLaPr() < nsigmaTOFmin || + casc.tofNSigmaOmLaPr() > nsigmaTOFmax) + return false; + if (casc.tofNSigmaOmLaPi() < nsigmaTOFmin || + casc.tofNSigmaOmLaPi() > nsigmaTOFmax) + return false; + } + } + + if (casc.v0cosPA(coll.posX(), coll.posY(), coll.posZ()) < v0cospaMin) + return false; + if (casc.v0radius() < minimumV0Radius) + return false; + if (std::fabs(casc.dcaV0daughters()) > dcaV0DaughtersMax) + return false; + if (std::fabs(casc.dcapostopv()) < dcapostoPVmin) + return false; + if (std::fabs(casc.dcanegtopv()) < dcanegtoPVmin) + return false; + + if (casc.casccosPA(coll.posX(), coll.posY(), coll.posZ()) < casccospaMin) + return false; + if (casc.cascradius() < minimumCascRadius) + return false; + if (std::fabs(casc.dcabachtopv()) < dcabachtopvMin) + return false; + if (std::fabs(casc.dcav0topv(coll.posX(), coll.posY(), coll.posZ())) < + dcaV0topvMin) + return false; + if (std::fabs(casc.dcacascdaughters()) > dcaCascDaughtersMax) + return false; + + // V0 mass window + if (std::abs(casc.mLambda() - o2::constants::physics::MassLambda0) > + v0masswindow) + return false; + + // Reject candidates compatible with Xi + if (std::abs(casc.mXi() - o2::constants::physics::MassXiMinus) < + competingmassrej) + return false; + + // PID Selection on bachelor + if (btrack.tpcNSigmaKa() < nsigmaTPCmin || + btrack.tpcNSigmaKa() > nsigmaTPCmax) + return false; + + // PID Selections (TOF) + if (requireTOF) { + if (casc.tofNSigmaOmKa() < nsigmaTOFmin || + casc.tofNSigmaOmKa() > nsigmaTOFmax) + return false; + } + return true; + } + + // Return the list of indices to the recoed collision associated to a given MC collision. + template + std::vector getListOfRecoCollIndices(TMCollisions const& mcCollisions, TCollisions const& collisions) + { + std::vector listBestCollisionIdx(mcCollisions.size()); + for (auto const& mcCollision : mcCollisions) { + auto groupedCollisions = getGroupedCollisions(collisions, mcCollision.globalIndex()); + int biggestNContribs = -1; + int bestCollisionIndex = -1; + for (auto const& collision : groupedCollisions) { + // event selections + if (applySel8 && !collision.sel8()) + continue; + + if (applyVtxZ && std::fabs(collision.posZ()) > zVtx) + continue; + + if (rejectITSROFBorder && !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { + continue; + } + + if (rejectTFBorder && !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { + continue; + } + + if (requireVertexITSTPC && !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { + continue; + } + + if (requireIsGoodZvtxFT0VsPV && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + continue; + } + + if (requireIsVertexTOFmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTOFmatched)) { + continue; + } + + if (requireIsVertexTRDmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTRDmatched)) { + continue; + } + + if (rejectSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + continue; + } + + // Find the collision with the biggest nbr of PV contributors + // Follows what was done here: https://github.com/AliceO2Group/O2Physics/blob/master/Common/TableProducer/mcCollsExtra.cxx#L93 + if (biggestNContribs < collision.multPVTotalContributors()) { + biggestNContribs = collision.multPVTotalContributors(); + bestCollisionIndex = collision.globalIndex(); + } + } + listBestCollisionIdx[mcCollision.globalIndex()] = bestCollisionIndex; + } + return listBestCollisionIdx; + } + + // Fill generated event information (for event loss/splitting estimation) + template + void fillGeneratedEventProperties(TMCCollisions const& mcCollisions, TCollisions const& collisions) + { + std::vector listBestCollisionIdx(mcCollisions.size()); + for (auto const& mcCollisions : mcCollisions) { + // event selections + if (applyVtxZ && std::fabs(mcCollisions.posZ()) > zVtx) + return; + + registryMC.fill(HIST("hGenEvents"), mcCollisions.multMCNParticlesEta05(), 0 /* all gen. events*/); + + auto groupedCollisions = getGroupedCollisions(collisions, mcCollisions.globalIndex()); + // Check if there is at least one of the reconstructed collisions associated to this MC collision + // If so, we consider it + bool atLeastOne = false; + int biggestNContribs = -1; + int nCollisions = 0; + float multiplicitydata = -1.0f; + for (auto const& collision : groupedCollisions) { + // event selections + if (applySel8 && !collision.sel8()) + continue; + + if (applyVtxZ && std::fabs(collision.posZ()) > zVtx) + continue; + + if (rejectITSROFBorder && !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { + continue; + } + + if (rejectTFBorder && !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { + continue; + } + + if (requireVertexITSTPC && !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { + continue; + } + + if (requireIsGoodZvtxFT0VsPV && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + continue; + } + + if (requireIsVertexTOFmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTOFmatched)) { + continue; + } + + if (requireIsVertexTRDmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTRDmatched)) { + continue; + } + + if (rejectSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + continue; + } + + if (biggestNContribs < collision.multPVTotalContributors()) { + biggestNContribs = collision.multPVTotalContributors(); + if (centralityEstimator == Option::kFT0C) + multiplicitydata = collision.centFT0C(); + if (centralityEstimator == Option::kFT0M) + multiplicitydata = collision.centFT0M(); + if (centralityEstimator == Option::kFV0A) + multiplicitydata = collision.centFV0A(); + if (centralityEstimator == Option::kNGlobal) + multiplicitydata = collision.centNGlobal(); + } + nCollisions++; + + atLeastOne = true; + } + + registryMC.fill(HIST("hCentralityVsNcoll_beforeEvSel"), multiplicitydata, groupedCollisions.size()); + registryMC.fill(HIST("hCentralityVsNcoll_afterEvSel"), multiplicitydata, nCollisions); + registryMC.fill(HIST("hCentralityVsMultMC"), multiplicitydata, mcCollisions.multMCNParticlesEta05()); + + registryQC.fill(HIST("hVertexZGen"), mcCollisions.posZ()); + + if (atLeastOne) { + registryMC.fill(HIST("hGenEvents"), mcCollisions.multMCNParticlesEta05(), 1 /* at least 1 rec. event*/); + + registryMC.fill(HIST("hGenEventCentrality"), multiplicitydata); + } + } + return; + } + + void processData(SelCollisions::iterator const& collision, + CascadeCandidates const& fullCascades, + DaughterTracks const&) + { + // Fill event counter before event selection + registryData.fill(HIST("number_of_events_data"), 0); + + // Initialize CCDB objects using the BC info + initCCDB(collision); + + // event selections + if (applySel8 && !collision.sel8()) + return; + registryData.fill(HIST("number_of_events_data"), 1); + if (applyVtxZ && std::fabs(collision.posZ()) > zVtx) + return; + registryData.fill(HIST("number_of_events_data"), 2); + + if (rejectITSROFBorder && !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { + return; + } + registryData.fill(HIST("number_of_events_data"), 3 /* Not at ITS ROF border */); + + if (rejectTFBorder && !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { + return; + } + registryData.fill(HIST("number_of_events_data"), 4 /* Not at TF border */); + + if (requireVertexITSTPC && !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { + return; + } + registryData.fill(HIST("number_of_events_data"), 5 /* Contains at least one ITS-TPC track */); + + if (requireIsGoodZvtxFT0VsPV && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + return; + } + registryData.fill(HIST("number_of_events_data"), 6 /* PV position consistency check */); + + if (requireIsVertexTOFmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTOFmatched)) { + return; + } + registryData.fill(HIST("number_of_events_data"), 7 /* PV with at least one contributor matched with TOF */); + + if (requireIsVertexTRDmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTRDmatched)) { + return; + } + registryData.fill(HIST("number_of_events_data"), 8 /* PV with at least one contributor matched with TRD */); + + if (rejectSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + return; + } + registryData.fill(HIST("number_of_events_data"), 9 /* Not at same bunch pile-up */); + + // Store the Zvtx + registryQC.fill(HIST("hVertexZdata"), std::fabs(collision.posZ())); + + // Store the event multiplicity using different estimators + float multiplicity = -1.0f; + + if (centralityEstimator == Option::kFT0C) + multiplicity = collision.centFT0C(); + if (centralityEstimator == Option::kFT0M) + multiplicity = collision.centFT0M(); + if (centralityEstimator == Option::kFV0A) + multiplicity = collision.centFV0A(); + if (centralityEstimator == Option::kNGlobal) + multiplicity = collision.centNGlobal(); + + registryData.fill(HIST("hCentEstimator"), multiplicity); + registryData.fill(HIST("hCentralityVsNch"), multiplicity, collision.multNTracksPVeta1()); + + // Loop over cascades + for (const auto& casc : fullCascades) { + if (etaMin > casc.bacheloreta() || casc.bacheloreta() > etaMax || + etaMin > casc.negativeeta() || casc.negativeeta() > etaMax || + etaMin > casc.positiveeta() || casc.positiveeta() > etaMax) + continue; // remove acceptance that's badly reproduced by MC / superfluous in future + + // Get cascade daughters + auto bach = casc.bachTrackExtra_as(); + auto pos = casc.posTrackExtra_as(); + auto neg = casc.negTrackExtra_as(); + + // ------------------------------------- Store selctions distribution for QC + registryQC.fill(HIST("hv0cosPAdata"), casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ())); + registryQC.fill(HIST("hcasccosPAdata"), casc.casccosPA(collision.posX(), collision.posY(), collision.posZ())); + registryQC.fill(HIST("hv0radiusdata"), casc.v0radius()); + registryQC.fill(HIST("hcascradiusdata"), casc.cascradius()); + registryQC.fill(HIST("hdcaV0daughtersdata"), casc.dcaV0daughters()); + registryQC.fill(HIST("hdcacascdaughtersdata"), casc.dcacascdaughters()); + registryQC.fill(HIST("hdcapostopvdata"), casc.dcapostopv()); + registryQC.fill(HIST("hdcanegtopvdata"), casc.dcanegtopv()); + registryQC.fill(HIST("hdcabachtopvdata"), casc.dcabachtopv()); + registryQC.fill(HIST("hdcav0topvdata"), casc.dcav0topv(collision.posX(), collision.posY(), collision.posZ())); + + // ------------------------------------- Store selctions distribution for analysis + if (casc.sign() < 0) { + registryData.fill(HIST("hMassXineg"), multiplicity, casc.pt(), casc.mXi()); + registryData.fill(HIST("hMassOmeganeg"), multiplicity, casc.pt(), casc.mOmega()); + } + if (casc.sign() > 0) { + registryData.fill(HIST("hMassXipos"), multiplicity, casc.pt(), casc.mXi()); + registryData.fill(HIST("hMassOmegapos"), multiplicity, casc.pt(), casc.mOmega()); + } + + if (casc.sign() < 0 && passedXiSelection(casc, pos, neg, bach, collision)) { + registryData.fill(HIST("hMassXinegSelected"), multiplicity, casc.pt(), casc.mXi()); + } + if (casc.sign() < 0 && passedOmegaSelection(casc, pos, neg, bach, collision)) { + registryData.fill(HIST("hMassOmeganegSelected"), multiplicity, casc.pt(), casc.mOmega()); + } + if (casc.sign() > 0 && passedXiSelection(casc, pos, neg, bach, collision)) { + registryData.fill(HIST("hMassXiposSelected"), multiplicity, casc.pt(), casc.mXi()); + } + if (casc.sign() > 0 && passedOmegaSelection(casc, pos, neg, bach, collision)) { + registryData.fill(HIST("hMassOmegaposSelected"), multiplicity, casc.pt(), casc.mOmega()); + } + } + } + + PROCESS_SWITCH(CascadeAnalysisLightIonsDerivedData, processData, "Process data", true); + + void processMonteCarloRec(SimCollisions const& RecCols, CascadeMCCandidates const& fullCascades, DaughterTracks const&) + { + for (const auto& RecCol : RecCols) { + // Fill event counter before event selection + registryMC.fill(HIST("number_of_events_mc_rec"), 0); + + // Initialize CCDB objects using the BC info + initCCDB(RecCol); + + // event selections + if (applySel8 && !RecCol.sel8()) + continue; + registryMC.fill(HIST("number_of_events_mc_rec"), 1); + + if (applyVtxZ && std::fabs(RecCol.posZ()) > zVtx) + continue; + registryMC.fill(HIST("number_of_events_mc_rec"), 2); + + if (rejectITSROFBorder && !RecCol.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { + continue; + } + registryMC.fill(HIST("number_of_events_mc_rec"), 3 /* Not at ITS ROF border */); + + if (rejectTFBorder && !RecCol.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { + continue; + } + registryMC.fill(HIST("number_of_events_mc_rec"), 4 /* Not at TF border */); + + if (requireVertexITSTPC && !RecCol.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { + continue; + } + registryMC.fill(HIST("number_of_events_mc_rec"), 5 /* Contains at least one ITS-TPC track */); + + if (requireIsGoodZvtxFT0VsPV && !RecCol.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + continue; + } + registryMC.fill(HIST("number_of_events_mc_rec"), 6 /* PV position consistency check */); + + if (requireIsVertexTOFmatched && !RecCol.selection_bit(o2::aod::evsel::kIsVertexTOFmatched)) { + continue; + } + registryMC.fill(HIST("number_of_events_mc_rec"), 7 /* PV with at least one contributor matched with TOF */); + + if (requireIsVertexTRDmatched && !RecCol.selection_bit(o2::aod::evsel::kIsVertexTRDmatched)) { + continue; + } + registryMC.fill(HIST("number_of_events_mc_rec"), 8 /* PV with at least one contributor matched with TRD */); + + if (rejectSameBunchPileup && !RecCol.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + continue; + } + registryMC.fill(HIST("number_of_events_mc_rec"), 9 /* Not at same bunch pile-up */); + + // Store the Zvtx + registryQC.fill(HIST("hVertexZRec"), RecCol.posZ()); + + // Store the event multiplicity using different estimators + float multiplicityMcRec = -1.0f; + + if (centralityEstimator == Option::kFT0C) + multiplicityMcRec = RecCol.centFT0C(); + if (centralityEstimator == Option::kFT0M) + multiplicityMcRec = RecCol.centFT0M(); + if (centralityEstimator == Option::kFV0A) + multiplicityMcRec = RecCol.centFV0A(); + if (centralityEstimator == Option::kNGlobal) + multiplicityMcRec = RecCol.centNGlobal(); + + registryMC.fill(HIST("hCentEstimator_truerec"), multiplicityMcRec); + registryMC.fill(HIST("hCentralityVsNch_truerec"), multiplicityMcRec, RecCol.multNTracksPVeta1()); + + for (const auto& casc : fullCascades) { + if (etaMin > casc.bacheloreta() || casc.bacheloreta() > etaMax || + etaMin > casc.negativeeta() || casc.negativeeta() > etaMax || + etaMin > casc.positiveeta() || casc.positiveeta() > etaMax) + continue; // remove acceptance that's badly reproduced by MC / superfluous in future + + if (!casc.has_cascMCCore()) + continue; + + auto cascMC = casc.template cascMCCore_as(); + + auto bach = casc.bachTrackExtra_as(); + auto pos = casc.posTrackExtra_as(); + auto neg = casc.negTrackExtra_as(); + + int pdgParent = cascMC.pdgCode(); + bool isPhysPrim = cascMC.isPhysicalPrimary(); + if (pdgParent == 0) + continue; + if (!isPhysPrim) + continue; + + float ptmc = RecoDecay::sqrtSumOfSquares(cascMC.pxMC(), cascMC.pyMC()); + + // ------------------------------------- Store selctions distribution for QC + registryQC.fill(HIST("hv0cosPARec"), casc.v0cosPA(RecCol.posX(), RecCol.posY(), RecCol.posZ())); + registryQC.fill(HIST("hcasccosPARec"), casc.casccosPA(RecCol.posX(), RecCol.posY(), RecCol.posZ())); + registryQC.fill(HIST("hv0radiusRec"), casc.v0radius()); + registryQC.fill(HIST("hcascradiusRec"), casc.cascradius()); + registryQC.fill(HIST("hdcaV0daughtersRec"), casc.dcaV0daughters()); + registryQC.fill(HIST("hdcacascdaughtersRec"), casc.dcacascdaughters()); + registryQC.fill(HIST("hdcapostopvRec"), casc.dcapostopv()); + registryQC.fill(HIST("hdcanegtopvRec"), casc.dcanegtopv()); + registryQC.fill(HIST("hdcabachtopvRec"), casc.dcabachtopv()); + registryQC.fill(HIST("hdcav0topvRec"), casc.dcav0topv(RecCol.posX(), RecCol.posY(), RecCol.posZ())); + + // ------------------------------------- Store selctions distribution for analysis + if (casc.sign() < 0) { + if (pdgParent == kXiMinus) { + registryMC.fill(HIST("hMassXineg_truerec"), multiplicityMcRec, ptmc, casc.mXi()); + } + if (pdgParent == kOmegaMinus) { + registryMC.fill(HIST("hMassOmeganeg_truerec"), multiplicityMcRec, ptmc, casc.mOmega()); + } + } + + if (casc.sign() > 0) { + if (pdgParent == kXiPlusBar) { + registryMC.fill(HIST("hMassXipos_truerec"), multiplicityMcRec, ptmc, casc.mXi()); + } + if (pdgParent == kOmegaPlusBar) { + registryMC.fill(HIST("hMassOmegapos_truerec"), multiplicityMcRec, ptmc, casc.mOmega()); + } + } + + if (casc.sign() < 0 && pdgParent == kXiMinus && passedXiSelection(casc, pos, neg, bach, RecCol)) { + registryMC.fill(HIST("hMassXinegSelected_truerec"), multiplicityMcRec, ptmc, casc.mXi()); + } + if (casc.sign() < 0 && pdgParent == kOmegaMinus && passedOmegaSelection(casc, pos, neg, bach, RecCol)) { + registryMC.fill(HIST("hMassOmeganegSelected_truerec"), multiplicityMcRec, ptmc, casc.mOmega()); + } + if (casc.sign() > 0 && pdgParent == kXiPlusBar && passedXiSelection(casc, pos, neg, bach, RecCol)) { + registryMC.fill(HIST("hMassXiposSelected_truerec"), multiplicityMcRec, ptmc, casc.mXi()); + } + if (casc.sign() > 0 && pdgParent == kOmegaPlusBar && passedOmegaSelection(casc, pos, neg, bach, RecCol)) { + registryMC.fill(HIST("hMassOmegaposSelected_truerec"), multiplicityMcRec, ptmc, casc.mOmega()); + } + } // casc loop + } // rec.collision loop + } + + PROCESS_SWITCH(CascadeAnalysisLightIonsDerivedData, processMonteCarloRec, "Process MC Rec", false); + + void processMonteCarloGen(CollisionMCTrueTable const& mcCollisions, + CascadeMCCores const& CascMCCores, + SimCollisions const& RecCols) + { + // Fill generated event information (for event loss/splitting estimation) + fillGeneratedEventProperties(mcCollisions, RecCols); + std::vector listBestCollisionIdx = getListOfRecoCollIndices(mcCollisions, RecCols); + for (auto const& cascMC : CascMCCores) { + int pdgParent = cascMC.pdgCode(); + bool isPhysPrim = cascMC.isPhysicalPrimary(); + if (pdgParent == 0) + continue; + if (!isPhysPrim) + continue; + + float ptmc = RecoDecay::sqrtSumOfSquares(cascMC.pxMC(), cascMC.pyMC()); + + auto mcCollision = cascMC.template straMCCollision_as(); + + // event selections + if (applyVtxZ && std::abs(mcCollision.posZ()) > zVtx) + return; + + // Store the Zvtx + registryQC.fill(HIST("hVertexZGen"), mcCollision.posZ()); + + // float centrality = 100.5f; + + if (listBestCollisionIdx[mcCollision.globalIndex()] > -1) { + // auto collision = RecCols.iteratorAt(listBestCollisionIdx[mcCollision.globalIndex()]); + // if (centralityEstimator == Option::kFT0C) centrality = collision.centFT0C(); + // if (centralityEstimator == Option::kFT0M) centrality = collision.centFT0M(); + // if (centralityEstimator == Option::kFV0A) centrality = collision.centFV0A(); + // if (centralityEstimator == Option::kNGlobal) centrality = collision.centNGlobal(); + + if (cascMC.pdgCode() == kXiMinus && std::abs(cascMC.rapidityMC(0)) < rapcut) { + registryMC.fill(HIST("h2dGenXiMinusVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); + } + if (cascMC.pdgCode() == kXiPlusBar && std::abs(cascMC.rapidityMC(0)) < rapcut) { + registryMC.fill(HIST("h2dGenXiPlusVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); + } + if (cascMC.pdgCode() == kOmegaMinus && std::abs(cascMC.rapidityMC(2)) < rapcut) { + registryMC.fill(HIST("h2dGenOmegaMinusVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); + } + if (cascMC.pdgCode() == kOmegaPlusBar && std::abs(cascMC.rapidityMC(2)) < rapcut) { + registryMC.fill(HIST("h2dGenOmegaPlusVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc); + } + } + + if (cascMC.pdgCode() == kXiMinus && std::abs(cascMC.rapidityMC(0)) < rapcut) { + registryMC.fill(HIST("h2dGenXiMinusVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); + } + if (cascMC.pdgCode() == kXiPlusBar && std::abs(cascMC.rapidityMC(0)) < rapcut) { + registryMC.fill(HIST("h2dGenXiPlusVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); + } + if (cascMC.pdgCode() == kOmegaMinus && std::abs(cascMC.rapidityMC(2)) < rapcut) { + registryMC.fill(HIST("h2dGenOmegaMinusVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); + } + if (cascMC.pdgCode() == kOmegaPlusBar && std::abs(cascMC.rapidityMC(2)) < rapcut) { + registryMC.fill(HIST("h2dGenOmegaPlusVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc); + } + } // cascMC loop + } + + PROCESS_SWITCH(CascadeAnalysisLightIonsDerivedData, processMonteCarloGen, "Process MC Gen", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} From 6518f7fd9588eb5c755cb023fc79b4e2cbb02ddb Mon Sep 17 00:00:00 2001 From: sarjeetagami <162087855+sarjeetagami@users.noreply.github.com> Date: Sat, 9 Aug 2025 11:22:47 +0530 Subject: [PATCH 308/345] [PWGLF] added different centrality estimator in MC (#12496) Co-authored-by: sarjeeta gami --- .../Tasks/Resonances/phianalysisrun3_PbPb.cxx | 34 ++++++++++++++++--- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/PWGLF/Tasks/Resonances/phianalysisrun3_PbPb.cxx b/PWGLF/Tasks/Resonances/phianalysisrun3_PbPb.cxx index 85a44210307..520fd541b26 100644 --- a/PWGLF/Tasks/Resonances/phianalysisrun3_PbPb.cxx +++ b/PWGLF/Tasks/Resonances/phianalysisrun3_PbPb.cxx @@ -381,7 +381,7 @@ struct phianalysisrun3_PbPb { using TrackCandidates = soa::Filtered>; // using EventCandidatesMC = soa::Join; - using EventCandidatesMC = soa::Join; + using EventCandidatesMC = soa::Join; using TrackCandidatesMC = soa::Filtered>; @@ -1462,7 +1462,6 @@ struct phianalysisrun3_PbPb { std::vector selectedEvents(collisions.size()); int nevts = 0; auto multiplicity = -1.0; - histos.fill(HIST("Centgen1"), multiplicity); histos.fill(HIST("hMC1"), 2.5); for (const auto& collision : collisions) { if (!collision.sel8() || std::abs(collision.mcCollision().posZ()) > cfgCutVertex) { @@ -1498,7 +1497,21 @@ struct phianalysisrun3_PbPb { continue; } histos.fill(HIST("hMC1"), 10.5); - multiplicity = collision.centFT0C(); + const int kCentFT0C = 0; + const int kCentFT0A = 1; + const int kCentFT0M = 2; + const int kCentFV0A = 3; + + if (centestimator == kCentFT0C) { + multiplicity = collision.centFT0C(); + } else if (centestimator == kCentFT0A) { + multiplicity = collision.centFT0A(); + } else if (centestimator == kCentFT0M) { + multiplicity = collision.centFT0M(); + } else if (centestimator == kCentFV0A) { + multiplicity = collision.centFV0A(); + } + histos.fill(HIST("Centgen1"), multiplicity); selectedEvents[nevts++] = collision.mcCollision_as().globalIndex(); } selectedEvents.resize(nevts); @@ -1578,7 +1591,20 @@ struct phianalysisrun3_PbPb { if (fillOccupancy && (occupancy > cfgCutOccupancy)) { return; } - auto multiplicity = collision.centFT0C(); + const int kCentFT0C = 0; + const int kCentFT0A = 1; + const int kCentFT0M = 2; + const int kCentFV0A = 3; + auto multiplicity = -1.0; + if (centestimator == kCentFT0C) { + multiplicity = collision.centFT0C(); + } else if (centestimator == kCentFT0A) { + multiplicity = collision.centFT0A(); + } else if (centestimator == kCentFT0M) { + multiplicity = collision.centFT0M(); + } else if (centestimator == kCentFV0A) { + multiplicity = collision.centFV0A(); + } histos.fill(HIST("Centrec1"), multiplicity); histos.fill(HIST("hMC1"), 13.5); auto oldindex = -999; From 2665920ec78b72695a40c7846c9b069ea8cb0d1f Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Sat, 9 Aug 2025 09:54:04 +0200 Subject: [PATCH 309/345] [PWGEM/Dilepton] reduce charged track size (#12497) Co-authored-by: ALICE Action Bot --- PWGEM/Dilepton/DataModel/dileptonTables.h | 9 +++- .../TableProducer/skimmerPrimaryTrack.cxx | 2 +- .../Dilepton/Tasks/Converters/CMakeLists.txt | 5 ++ .../Tasks/Converters/trackConverter1.cxx | 48 +++++++++++++++++++ 4 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 PWGEM/Dilepton/Tasks/Converters/trackConverter1.cxx diff --git a/PWGEM/Dilepton/DataModel/dileptonTables.h b/PWGEM/Dilepton/DataModel/dileptonTables.h index afd7dfc4dd9..f290ac8548b 100644 --- a/PWGEM/Dilepton/DataModel/dileptonTables.h +++ b/PWGEM/Dilepton/DataModel/dileptonTables.h @@ -769,12 +769,19 @@ DECLARE_SOA_COLUMN(CollisionId, collisionId, int); //! DECLARE_SOA_COLUMN(TrackId, trackId, int); //! DECLARE_SOA_COLUMN(Sign, sign, int8_t); //! DECLARE_SOA_COLUMN(TrackBit, trackBit, uint16_t); //! +DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt, [](float signed1Pt) -> float { return 1.f / std::fabs(signed1Pt); }); } // namespace emprimarytrack DECLARE_SOA_TABLE_VERSIONED(EMPrimaryTracks_000, "AOD", "EMPRIMARYTRACK", 0, //! primary charged track table for 2PC o2::soa::Index<>, emprimarytrack::CollisionId, emprimarytrack::TrackId, emprimarytrack::Sign, track::Pt, track::Eta, track::Phi, emprimarytrack::TrackBit); -using EMPrimaryTracks = EMPrimaryTracks_000; +DECLARE_SOA_TABLE_VERSIONED(EMPrimaryTracks_001, "AOD", "EMPRIMARYTRACK", 1, //! primary charged track table for 2PC + o2::soa::Index<>, emprimarytrack::CollisionId, emprimarytrack::TrackId, + track::Signed1Pt, track::Eta, track::Phi, emprimarytrack::TrackBit, + // dynamic column + track::Sign, emprimarytrack::Pt); + +using EMPrimaryTracks = EMPrimaryTracks_001; // iterators using EMPrimaryTrack = EMPrimaryTracks::iterator; diff --git a/PWGEM/Dilepton/TableProducer/skimmerPrimaryTrack.cxx b/PWGEM/Dilepton/TableProducer/skimmerPrimaryTrack.cxx index 2da9262c0dc..094065b6256 100644 --- a/PWGEM/Dilepton/TableProducer/skimmerPrimaryTrack.cxx +++ b/PWGEM/Dilepton/TableProducer/skimmerPrimaryTrack.cxx @@ -331,7 +331,7 @@ struct skimmerPrimaryTrack { trackBit |= static_cast(RefTrackBit::kDCAxy03cm); } - emprimarytracks(collision.globalIndex(), track.globalIndex(), track.sign(), pt, eta, phi, trackBit); + emprimarytracks(collision.globalIndex(), track.globalIndex(), track.sign() / pt, eta, phi, trackBit); // prmtrackeventidtmp(collision.globalIndex()); stored_trackIds.emplace_back(std::pair{collision.globalIndex(), track.globalIndex()}); diff --git a/PWGEM/Dilepton/Tasks/Converters/CMakeLists.txt b/PWGEM/Dilepton/Tasks/Converters/CMakeLists.txt index 31985d9d2d3..f5f41c009cd 100644 --- a/PWGEM/Dilepton/Tasks/Converters/CMakeLists.txt +++ b/PWGEM/Dilepton/Tasks/Converters/CMakeLists.txt @@ -35,3 +35,8 @@ o2physics_add_dpl_workflow(electron-converter4 PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(track-converter1 + SOURCES trackConverter1.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + diff --git a/PWGEM/Dilepton/Tasks/Converters/trackConverter1.cxx b/PWGEM/Dilepton/Tasks/Converters/trackConverter1.cxx new file mode 100644 index 00000000000..fda87265b3c --- /dev/null +++ b/PWGEM/Dilepton/Tasks/Converters/trackConverter1.cxx @@ -0,0 +1,48 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// +// ======================== +// +// This code runs loop over ULS ee pars for virtual photon QC. +// Please write to: daiki.sekihata@cern.ch + +#include "PWGEM/Dilepton/DataModel/dileptonTables.h" + +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" + +using namespace o2; +using namespace o2::aod; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::soa; + +struct trackConverter1 { + Produces track_001; + + void process(aod::EMPrimaryTracks_000 const& tracks) + { + for (auto& track : tracks) { + track_001(track.collisionId(), + track.trackId(), + track.sign() / track.pt(), + track.eta(), + track.phi(), + track.trackBit()); + } // end of track loop + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc, TaskName{"track-converter1"})}; +} From 4a44d637dcac9ea2426ad1a7a6e0e51731cb7129 Mon Sep 17 00:00:00 2001 From: Nicolas Strangmann <77485327+nstrangm@users.noreply.github.com> Date: Sat, 9 Aug 2025 11:55:07 +0200 Subject: [PATCH 310/345] [PWGEM/PhotonMeson,PWGJE/EMCal] Add event selection cuts to omega and mcgenerator studies (#12501) Co-authored-by: Nicolas Strangmann --- PWGEM/PhotonMeson/Tasks/OmegaMesonEMC.cxx | 9 ++++++++ PWGJE/Tasks/mcGeneratorStudies.cxx | 26 ++++++++++++++--------- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/PWGEM/PhotonMeson/Tasks/OmegaMesonEMC.cxx b/PWGEM/PhotonMeson/Tasks/OmegaMesonEMC.cxx index 6ac2788f549..d113fb5720b 100644 --- a/PWGEM/PhotonMeson/Tasks/OmegaMesonEMC.cxx +++ b/PWGEM/PhotonMeson/Tasks/OmegaMesonEMC.cxx @@ -85,6 +85,9 @@ struct OmegaMesonEMC { Configurable confEvtZvtx{"confEvtZvtx", 10.f, "Evt sel: Max. z-Vertex (cm)"}; Configurable confEvtRequireSel8{"confEvtRequireSel8", true, "Evt sel: check for sel8 trigger bit"}; Configurable confEvtRequirekTVXinEMC{"confEvtRequirekTVXinEMC", false, "Evt sel: check for EMCal MB trigger kTVXinEMC"}; + Configurable confEvtRequireL0{"confEvtRequireL0", false, "Evt sel: check for EMCal L0 trigger"}; + Configurable confEvtRequireGoodZVertex{"confEvtRequireGoodZVertex", false, "Evt sel: check for EMCal good z-vertex"}; + Configurable confEvtRequireNoSameBunchPileUp{"confEvtRequireNoSameBunchPileUp", false, "Evt sel: check for no same bunch pile-up"}; // ---> Track selection Configurable> cfgChargedPionCuts{"cfgChargedPionCuts", {hnm::chargedPionCutsTable[0], 3, 2, hnm::chargedPionCutsName, hnm::chargedPionMinMaxName}, "Charged pion track cuts"}; @@ -224,6 +227,12 @@ struct OmegaMesonEMC { return; // Skip this collision if sel8 trigger bit is not set if (confEvtRequirekTVXinEMC && !iskTVXinEMC) return; // Skip this collision if kTVXinEMC trigger bit is not set + if (confEvtRequireL0 && !isL0Triggered) + return; // Skip this collision if L0 trigger bit is not set + if (confEvtRequireGoodZVertex && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) + return; // Skip this collision if good z-vertex condition is not met + if (confEvtRequireNoSameBunchPileUp && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) + return; // Skip this collision if no same bunch pileup condition is not met if (bcHasEMCCells && iskTVXinEMC) mHistManager.fill(HIST("Event/nEMCalEvents"), 0); diff --git a/PWGJE/Tasks/mcGeneratorStudies.cxx b/PWGJE/Tasks/mcGeneratorStudies.cxx index c783a0a8c09..a1bfe3a5500 100644 --- a/PWGJE/Tasks/mcGeneratorStudies.cxx +++ b/PWGJE/Tasks/mcGeneratorStudies.cxx @@ -60,6 +60,7 @@ struct MCGeneratorStudies { Configurable mRequireNoSameBunchPileup{"mRequireNoSameBunchPileup", true, "require no same bunch pileup in event cut"}; Configurable mRequireGoodZvtxFT0vsPV{"mRequireGoodZvtxFT0vsPV", true, "require good Zvtx between FT0 vs. PV in event cut"}; Configurable mRequireEMCReadoutInMB{"mRequireEMCReadoutInMB", true, "require the EMC to be read out in an MB collision (kTVXinEMC)"}; + Configurable mRequireEMCReadoutInL0{"mRequireEMCReadoutInL0", false, "require the EMC to be read out by L0 trigger"}; void init(InitContext const&) { @@ -159,7 +160,7 @@ struct MCGeneratorStudies { continue; else if (mSelectOnlyChargedParticles && TDatabasePDG::Instance()->GetParticle(mcParticle.pdgCode())->Charge()) continue; - if (fabs(mcParticle.y()) > mRapidityCut) + if (std::abs(mcParticle.y()) > mRapidityCut) continue; if (!mcParticle.isPhysicalPrimary() && !mcParticle.producedByGenerator()) continue; @@ -186,7 +187,7 @@ struct MCGeneratorStudies { continue; else if (mSelectOnlyChargedParticles && TDatabasePDG::Instance()->GetParticle(mcParticle.pdgCode())->Charge()) continue; - if (fabs(mcParticle.y()) > mRapidityCut) + if (std::abs(mcParticle.y()) > mRapidityCut) continue; if (!mcParticle.isPhysicalPrimary() && !mcParticle.producedByGenerator()) continue; @@ -198,7 +199,7 @@ struct MCGeneratorStudies { mHistManager.fill(HIST("Yield_Accepted"), mcParticle.pt()); if (!mRequireTVX || collision.selection_bit(o2::aod::evsel::kIsTriggerTVX)) { mHistManager.fill(HIST("Yield_T"), mcParticle.pt()); - if (abs(collision.posZ()) < mVertexCut) { + if (std::abs(collision.posZ()) < mVertexCut) { mHistManager.fill(HIST("Yield_TZ"), mcParticle.pt()); if (!mRequireSel8 || collision.sel8()) { mHistManager.fill(HIST("Yield_TZS"), mcParticle.pt()); @@ -207,9 +208,11 @@ struct MCGeneratorStudies { if (!mRequireNoSameBunchPileup || collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { mHistManager.fill(HIST("Yield_TZSGU"), mcParticle.pt()); if (!mRequireEMCReadoutInMB || (mRequireEMCCellContent ? collision.isemcreadout() : collision.alias_bit(kTVXinEMC))) { - mHistManager.fill(HIST("Yield_TZSGUE"), mcParticle.pt()); - if (isAccepted(mcParticle, mcParticles)) - mHistManager.fill(HIST("Yield_TZSGUE_Accepted"), mcParticle.pt()); + if (!mRequireEMCReadoutInL0 || (collision.alias_bit(kEMC7) || collision.alias_bit(kDMC7))) { + mHistManager.fill(HIST("Yield_TZSGUE"), mcParticle.pt()); + if (isAccepted(mcParticle, mcParticles)) + mHistManager.fill(HIST("Yield_TZSGUE_Accepted"), mcParticle.pt()); + } } } } @@ -271,7 +274,7 @@ struct MCGeneratorStudies { fRegistry->fill(HIST("hEMCollisionCounter"), 7.0); if (collision.sel8()) fRegistry->fill(HIST("hEMCollisionCounter"), 8.0); - if (abs(collision.posZ()) < 10.0) + if (std::abs(collision.posZ()) < 10.0) fRegistry->fill(HIST("hEMCollisionCounter"), 9.0); if (collision.alias_bit(kTVXinEMC)) fRegistry->fill(HIST("hEMCollisionCounter"), 10.0); @@ -284,7 +287,7 @@ struct MCGeneratorStudies { fRegistry->fill(HIST("hCollisionCounter"), 1); if (!mRequireTVX || collision.selection_bit(o2::aod::evsel::kIsTriggerTVX)) { fRegistry->fill(HIST("hCollisionCounter"), 2); - if (abs(collision.posZ()) < mVertexCut) { + if (std::abs(collision.posZ()) < mVertexCut) { fRegistry->fill(HIST("hCollisionCounter"), 3); if (!mRequireSel8 || collision.sel8()) { fRegistry->fill(HIST("hCollisionCounter"), 4); @@ -292,8 +295,11 @@ struct MCGeneratorStudies { fRegistry->fill(HIST("hCollisionCounter"), 5); if (!mRequireNoSameBunchPileup || collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { fRegistry->fill(HIST("hCollisionCounter"), 6); - if (!mRequireEMCReadoutInMB || (mRequireEMCCellContent ? collision.isemcreadout() : collision.alias_bit(kTVXinEMC))) - fRegistry->fill(HIST("hCollisionCounter"), 7); + if (!mRequireEMCReadoutInMB || (mRequireEMCCellContent ? collision.isemcreadout() : collision.alias_bit(kTVXinEMC))) { + if (!mRequireEMCReadoutInL0 || (collision.alias_bit(kEMC7) || collision.alias_bit(kDMC7))) { + fRegistry->fill(HIST("hCollisionCounter"), 7); + } + } } } } From 197dec5dca756a5f551de64af1047af300dd8f85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?BiaoZhang=20=28=E5=BC=A0=E5=BD=AA=29?= <52267892+zhangbiao-phy@users.noreply.github.com> Date: Sat, 9 Aug 2025 15:56:30 +0200 Subject: [PATCH 311/345] [PWGHF,PWGCF] fix a small bug and fill timestamp into the track table (#12504) --- PWGCF/DataModel/FemtoDerived.h | 3 ++ .../HFC/TableProducer/femtoDreamProducer.cxx | 5 +++- .../HFC/Tasks/taskCharmHadronsFemtoDream.cxx | 28 +++++++++++-------- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/PWGCF/DataModel/FemtoDerived.h b/PWGCF/DataModel/FemtoDerived.h index 855b7d30bf2..3be2baadc37 100644 --- a/PWGCF/DataModel/FemtoDerived.h +++ b/PWGCF/DataModel/FemtoDerived.h @@ -374,6 +374,9 @@ DECLARE_SOA_TABLE(FDHfCandMC, "AOD", "FDHFCANDMC", //! Table for reconstructed M DECLARE_SOA_TABLE(FDParticlesIndex, "AOD", "FDPARTICLEINDEX", //! Table track index to match associate particle with charm hadron prongs o2::soa::Index<>, fdhf::TrackId); +DECLARE_SOA_TABLE(FDTrkTimeStamp, "AOD", "FDHFTRKTIMESTAMP", //! Time Stampe of track associate event + o2::soa::Index<>, + fdhf::TimeStamp); DECLARE_SOA_TABLE_STAGED(FDParticles, "FDPARTICLE", o2::soa::Index<>, diff --git a/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx b/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx index 2a6fad8c841..1255781f2b0 100644 --- a/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx +++ b/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx @@ -102,6 +102,7 @@ struct HfFemtoDreamProducer { Produces rowCandMcCharmHad; Produces rowCandCharmHadGen; Produces outputPartsIndex; + Produces outputPartsTime; Produces outputMcCollision; Produces outputCollsMcLabels; Produces outputParts; @@ -391,9 +392,11 @@ struct HfFemtoDreamProducer { trackCuts.fillQA(track); // the bit-wise container of the systematic variations is obtained auto cutContainer = trackCuts.getCutContainer(track, track.pt(), track.eta(), sqrtf(powf(track.dcaXY(), 2.f) + powf(track.dcaZ(), 2.f))); - + auto bc = col.template bc_as(); + int64_t timeStamp = bc.timestamp(); // track global index outputPartsIndex(track.globalIndex()); + outputPartsTime(timeStamp); // now the table is filled outputParts(outputCollision.lastIndex(), diff --git a/PWGHF/HFC/Tasks/taskCharmHadronsFemtoDream.cxx b/PWGHF/HFC/Tasks/taskCharmHadronsFemtoDream.cxx index f024e276a9a..5632f7eefe8 100644 --- a/PWGHF/HFC/Tasks/taskCharmHadronsFemtoDream.cxx +++ b/PWGHF/HFC/Tasks/taskCharmHadronsFemtoDream.cxx @@ -139,7 +139,7 @@ struct HfTaskCharmHadronsFemtoDream { using FilteredCharmMcCands = soa::Filtered>; using FilteredCharmMcCand = FilteredCharmMcCands::iterator; - using FilteredColisions = soa::Filtered>; + using FilteredColisions = soa::Filtered>; using FilteredColision = FilteredColisions::iterator; using FilteredMcColisions = soa::Filtered>; @@ -148,7 +148,7 @@ struct HfTaskCharmHadronsFemtoDream { using FilteredFDMcParts = soa::Filtered>; using FilteredFDMcPart = FilteredFDMcParts::iterator; - using FilteredFDParticles = soa::Filtered>; + using FilteredFDParticles = soa::Filtered>; using FilteredFDParticle = FilteredFDParticles::iterator; Filter eventMultiplicity = aod::femtodreamcollision::multNtr >= eventSel.multMin && aod::femtodreamcollision::multNtr <= eventSel.multMax; @@ -160,7 +160,8 @@ struct HfTaskCharmHadronsFemtoDream { Filter trackPtFilterLow = ifnode(aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kTrack), aod::femtodreamparticle::pt < ptTrack1Max, true); Filter trackPtFilterUp = ifnode(aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kTrack), aod::femtodreamparticle::pt > ptTrack1Min, true); - Preslice perCol = aod::femtodreamparticle::fdCollisionId; + Preslice perCol = aod::femtodreamparticle::fdCollisionId; + Preslice perHfByCol = aod::femtodreamparticle::fdCollisionId; /// Partition for particle 1 Partition partitionTrk1 = (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kTrack)) && (ncheckbit(aod::femtodreamparticle::cut, cutBitTrack1)) && ifnode(aod::femtodreamparticle::pt * coshEta(aod::femtodreamparticle::eta) <= pidThresTrack1, ncheckbit(aod::femtodreamparticle::pidcut, tpcBitTrack1), ncheckbit(aod::femtodreamparticle::pidcut, tpcTofBitTrack1)); @@ -477,8 +478,7 @@ struct HfTaskCharmHadronsFemtoDream { eventHisto.fillQA(col); auto sliceTrk1 = partitionTrk1->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); auto sliceCharmHad = partitionCharmHadron->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); - auto bc = col.template bc_as(); - int64_t timeStamp = bc.timestamp(); + int64_t timeStamp = -999; /// Filling QA histograms of the all tracks and all charm hadrons before pairing for (auto const& part : sliceTrk1) { @@ -491,7 +491,7 @@ struct HfTaskCharmHadronsFemtoDream { } else { chargeTrack = NegativeCharge; } - + timeStamp = part.timeStamp(); rowFemtoResultTrk( col.globalIndex(), timeStamp, @@ -509,6 +509,8 @@ struct HfTaskCharmHadronsFemtoDream { for (auto const& part : sliceCharmHad) { float invMass = getCharmHadronMass(part); registryCharmHadronQa.fill(HIST("CharmHadronQA/hPtVsMass"), part.pt(), invMass); + timeStamp = part.timeStamp(); + rowFemtoResultCharm( col.globalIndex(), timeStamp, @@ -525,15 +527,17 @@ struct HfTaskCharmHadronsFemtoDream { part.bdtFD()); } - rowFemtoResultColl( - col.globalIndex(), - timeStamp, - col.posZ(), - col.multNtr()); + if (sliceCharmHad.size() || sliceTrk1.size()) { - if ((col.bitmaskTrackOne() & bitMask) != bitMask || (col.bitmaskTrackTwo() & bitMask) != bitMask) { + rowFemtoResultColl( + col.globalIndex(), + timeStamp, + col.posZ(), + col.multNtr()); + } else { return; } + doSameEvent(sliceTrk1, sliceCharmHad, parts, col); } PROCESS_SWITCH(HfTaskCharmHadronsFemtoDream, processSameEvent, "Enable processing same event", false); From f29725a8042c522d52c47b9b3d382c1e08f4f827 Mon Sep 17 00:00:00 2001 From: prottayCMT <61418725+prottayCMT@users.noreply.github.com> Date: Sat, 9 Aug 2025 23:32:47 +0200 Subject: [PATCH 312/345] [PWGLF] fill subdetector histograms with acc weight (#12507) Co-authored-by: Prottay Das --- PWGLF/Tasks/Strangeness/lambdapolsp.cxx | 34 +++++++++++++++++-------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/lambdapolsp.cxx b/PWGLF/Tasks/Strangeness/lambdapolsp.cxx index 7377271460e..1ef475d5964 100644 --- a/PWGLF/Tasks/Strangeness/lambdapolsp.cxx +++ b/PWGLF/Tasks/Strangeness/lambdapolsp.cxx @@ -324,7 +324,7 @@ struct lambdapolsp { if (!checkwithpub) { // histos.add("hVtxZ", "Vertex distribution in Z;Z (cm)", kTH1F, {{20, -10.0, 10.0}}); histos.add("hpRes", "hpRes", HistType::kTHnSparseF, {axisGrp.configcentAxis, thnAxisres}); - histos.add("hpResSin", "hpResSin", HistType::kTHnSparseF, {axisGrp.configcentAxis, thnAxisres}); + // histos.add("hpResSin", "hpResSin", HistType::kTHnSparseF, {axisGrp.configcentAxis, thnAxisres}); /*histos.add("hpCosPsiA", "hpCosPsiA", HistType::kTHnSparseF, {axisGrp.configcentAxis, thnAxisres}); histos.add("hpCosPsiC", "hpCosPsiC", HistType::kTHnSparseF, {axisGrp.configcentAxis, thnAxisres}); histos.add("hpSinPsiA", "hpSinPsiA", HistType::kTHnSparseF, {axisGrp.configcentAxis, thnAxisres}); @@ -356,12 +356,16 @@ struct lambdapolsp { if (usesubdet) { histos.add("hSparseLambdaPolA", "hSparseLambdaPolA", HistType::kTHnSparseF, runaxes, true); histos.add("hSparseLambdaPolC", "hSparseLambdaPolC", HistType::kTHnSparseF, runaxes, true); + histos.add("hSparseLambdaPolAwgt", "hSparseLambdaPolAwgt", HistType::kTHnSparseF, runaxes, true); + histos.add("hSparseLambdaPolCwgt", "hSparseLambdaPolCwgt", HistType::kTHnSparseF, runaxes, true); } histos.add("hSparseAntiLambdaPol", "hSparseAntiLambdaPol", HistType::kTHnSparseF, runaxes, true); histos.add("hSparseAntiLambdaPolwgt", "hSparseAntiLambdaPolwgt", HistType::kTHnSparseF, runaxes, true); if (usesubdet) { histos.add("hSparseAntiLambdaPolA", "hSparseAntiLambdaPolA", HistType::kTHnSparseF, runaxes, true); histos.add("hSparseAntiLambdaPolC", "hSparseAntiLambdaPolC", HistType::kTHnSparseF, runaxes, true); + histos.add("hSparseAntiLambdaPolAwgt", "hSparseAntiLambdaPolAwgt", HistType::kTHnSparseF, runaxes, true); + histos.add("hSparseAntiLambdaPolCwgt", "hSparseAntiLambdaPolCwgt", HistType::kTHnSparseF, runaxes, true); } histos.add("hSparseLambda_corr1a", "hSparseLambda_corr1a", HistType::kTHnSparseF, runaxes, true); histos.add("hSparseLambda_corr1b", "hSparseLambda_corr1b", HistType::kTHnSparseF, runaxes, true); @@ -433,7 +437,7 @@ struct lambdapolsp { } template - bool isSelectedV0Daughter(V0 const& candidate, T const& track, int pid) + bool isSelectedV0Daughter(V0 const& candidate, T const& track, int pid, int pid2) { // const auto eta = track.eta(); // const auto pt = track.pt(); @@ -467,10 +471,10 @@ struct lambdapolsp { return false; } - if (pid == 0 && (TMath::Abs(candidate.dcapostopv()) < cMinV0DCAPr || TMath::Abs(candidate.dcanegtopv()) < cMinV0DCAPi)) { + if (pid2 == 0 && (TMath::Abs(candidate.dcapostopv()) < cMinV0DCAPr || TMath::Abs(candidate.dcanegtopv()) < cMinV0DCAPi)) { return false; } - if (pid == 1 && (TMath::Abs(candidate.dcapostopv()) < cMinV0DCAPi || TMath::Abs(candidate.dcanegtopv()) < cMinV0DCAPr)) { + if (pid2 == 1 && (TMath::Abs(candidate.dcapostopv()) < cMinV0DCAPi || TMath::Abs(candidate.dcanegtopv()) < cMinV0DCAPr)) { return false; } @@ -627,6 +631,8 @@ struct lambdapolsp { // PolA = PolA / acvalue; // Pol = Pol / acvalue; auto Polwgt = Pol / acvalue; + auto PolAwgt = PolA / acvalue; + auto PolCwgt = PolC / acvalue; // Fill histograms using constructed names if (tag2) { @@ -642,6 +648,8 @@ struct lambdapolsp { if (usesubdet) { histos.fill(HIST("hSparseAntiLambdaPolA"), candmass, candpt, PolA, centrality, desbinvalue); histos.fill(HIST("hSparseAntiLambdaPolC"), candmass, candpt, PolC, centrality, desbinvalue); + histos.fill(HIST("hSparseAntiLambdaPolAwgt"), candmass, candpt, PolAwgt, centrality, desbinvalue); + histos.fill(HIST("hSparseAntiLambdaPolCwgt"), candmass, candpt, PolCwgt, centrality, desbinvalue); } histos.fill(HIST("hSparseAntiLambdaPol"), candmass, candpt, Pol, centrality, desbinvalue); histos.fill(HIST("hSparseAntiLambdaPolwgt"), candmass, candpt, Polwgt, centrality, desbinvalue); @@ -662,6 +670,8 @@ struct lambdapolsp { if (usesubdet) { histos.fill(HIST("hSparseAntiLambdaPolA"), candmass, candpt, PolA, centrality); histos.fill(HIST("hSparseAntiLambdaPolC"), candmass, candpt, PolC, centrality); + histos.fill(HIST("hSparseAntiLambdaPolAwgt"), candmass, candpt, PolAwgt, centrality); + histos.fill(HIST("hSparseAntiLambdaPolCwgt"), candmass, candpt, PolCwgt, centrality); } histos.fill(HIST("hSparseAntiLambdaPol"), candmass, candpt, Pol, centrality); histos.fill(HIST("hSparseAntiLambdaPolwgt"), candmass, candpt, Polwgt, centrality); @@ -685,6 +695,8 @@ struct lambdapolsp { if (usesubdet) { histos.fill(HIST("hSparseLambdaPolA"), candmass, candpt, PolA, centrality, desbinvalue); histos.fill(HIST("hSparseLambdaPolC"), candmass, candpt, PolC, centrality, desbinvalue); + histos.fill(HIST("hSparseLambdaPolAwgt"), candmass, candpt, PolAwgt, centrality, desbinvalue); + histos.fill(HIST("hSparseLambdaPolCwgt"), candmass, candpt, PolCwgt, centrality, desbinvalue); } histos.fill(HIST("hSparseLambdaPol"), candmass, candpt, Pol, centrality, desbinvalue); histos.fill(HIST("hSparseLambdaPolwgt"), candmass, candpt, Polwgt, centrality, desbinvalue); @@ -705,6 +717,8 @@ struct lambdapolsp { if (usesubdet) { histos.fill(HIST("hSparseLambdaPolA"), candmass, candpt, PolA, centrality); histos.fill(HIST("hSparseLambdaPolC"), candmass, candpt, PolC, centrality); + histos.fill(HIST("hSparseLambdaPolAwgt"), candmass, candpt, PolAwgt, centrality); + histos.fill(HIST("hSparseLambdaPolCwgt"), candmass, candpt, PolCwgt, centrality); } histos.fill(HIST("hSparseLambdaPol"), candmass, candpt, Pol, centrality); histos.fill(HIST("hSparseLambdaPolwgt"), candmass, candpt, Polwgt, centrality); @@ -812,7 +826,7 @@ struct lambdapolsp { if (!checkwithpub) { // histos.fill(HIST("hVtxZ"), collision.posZ()); histos.fill(HIST("hpRes"), centrality, (TMath::Cos(GetPhiInRange(psiZDCA - psiZDCC)))); - histos.fill(HIST("hpResSin"), centrality, (TMath::Sin(GetPhiInRange(psiZDCA - psiZDCC)))); + // histos.fill(HIST("hpResSin"), centrality, (TMath::Sin(GetPhiInRange(psiZDCA - psiZDCC)))); /*histos.fill(HIST("hpCosPsiA"), centrality, (TMath::Cos(GetPhiInRange(psiZDCA)))); histos.fill(HIST("hpCosPsiC"), centrality, (TMath::Cos(GetPhiInRange(psiZDCC)))); histos.fill(HIST("hpSinPsiA"), centrality, (TMath::Sin(GetPhiInRange(psiZDCA)))); @@ -980,10 +994,10 @@ struct lambdapolsp { continue; } - if (isSelectedV0Daughter(v0, postrack, 0) && isSelectedV0Daughter(v0, negtrack, 1)) { + if (isSelectedV0Daughter(v0, postrack, 0, 0) && isSelectedV0Daughter(v0, negtrack, 1, 0)) { LambdaTag = 1; } - if (isSelectedV0Daughter(v0, negtrack, 0) && isSelectedV0Daughter(v0, postrack, 1)) { + if (isSelectedV0Daughter(v0, negtrack, 0, 1) && isSelectedV0Daughter(v0, postrack, 1, 1)) { aLambdaTag = 1; } @@ -1193,7 +1207,7 @@ struct lambdapolsp { if (!checkwithpub) { // histos.fill(HIST("hVtxZ"), collision.posZ()); histos.fill(HIST("hpRes"), centrality, (TMath::Cos(GetPhiInRange(psiZDCA - psiZDCC)))); - histos.fill(HIST("hpResSin"), centrality, (TMath::Sin(GetPhiInRange(psiZDCA - psiZDCC)))); + // histos.fill(HIST("hpResSin"), centrality, (TMath::Sin(GetPhiInRange(psiZDCA - psiZDCC)))); /*histos.fill(HIST("hpCosPsiA"), centrality, (TMath::Cos(GetPhiInRange(psiZDCA)))); histos.fill(HIST("hpCosPsiC"), centrality, (TMath::Cos(GetPhiInRange(psiZDCC)))); histos.fill(HIST("hpSinPsiA"), centrality, (TMath::Sin(GetPhiInRange(psiZDCA)))); @@ -1443,7 +1457,7 @@ struct lambdapolsp { } histos.fill(HIST("hpRes"), centrality, (TMath::Cos(GetPhiInRange(psiZDCA - psiZDCC)))); - histos.fill(HIST("hpResSin"), centrality, (TMath::Sin(GetPhiInRange(psiZDCA - psiZDCC)))); + // histos.fill(HIST("hpResSin"), centrality, (TMath::Sin(GetPhiInRange(psiZDCA - psiZDCC)))); for (const auto& v0 : groupV0) { @@ -1567,7 +1581,7 @@ struct lambdapolsp { histos.fill(HIST("hCentrality"), centrality); histos.fill(HIST("hpRes"), centrality, (TMath::Cos(GetPhiInRange(psiZDCA - psiZDCC)))); - histos.fill(HIST("hpResSin"), centrality, (TMath::Sin(GetPhiInRange(psiZDCA - psiZDCC)))); + // histos.fill(HIST("hpResSin"), centrality, (TMath::Sin(GetPhiInRange(psiZDCA - psiZDCC)))); // V0s from collision1 to match kinematics auto v0sCol1 = V0s.sliceBy(tracksPerCollisionV0Mixed, collision1.index()); From 0a15c46f01a4302b27e1f0ac6b0946288b1d688f Mon Sep 17 00:00:00 2001 From: hernasab Date: Sat, 9 Aug 2025 16:44:20 -0500 Subject: [PATCH 313/345] [PWGCF] added new profiles and histograms (#12506) Co-authored-by: Sabrina Hernandez --- PWGCF/Flow/Tasks/flowZdcTask.cxx | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowZdcTask.cxx b/PWGCF/Flow/Tasks/flowZdcTask.cxx index 478a21ee4fc..80844482e83 100644 --- a/PWGCF/Flow/Tasks/flowZdcTask.cxx +++ b/PWGCF/Flow/Tasks/flowZdcTask.cxx @@ -269,10 +269,14 @@ struct FlowZdcTask { histos.add("ZNVsFT0C", ";T0C (#times 1/100);ZNA+ZNC;", kTH2F, {{{nBinsAmpFT0, 0., maxAmpFT0}, {nBinsZDC, -0.5, maxZn}}}); histos.add("ZNVsFT0M", ";T0A+T0C (#times 1/100);ZNA+ZNC;", kTH2F, {{{nBinsAmpFT0, 0., 3000.}, {nBinsZDC, -0.5, maxZn}}}); histos.add("ZN", ";ZNA+ZNC;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZn}}); - histos.add("ZNA", ";ZNA;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZn}}); - histos.add("ZPA", ";ZPA;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZp}}); - histos.add("ZNC", ";ZNC;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZn}}); - histos.add("ZPC", ";ZPC;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZp}}); + histos.add("ZNA", ";ZNA Amplitude;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZn}}); + histos.add("ZPA", ";ZPA Amplitude;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZp}}); + histos.add("ZNC", ";ZNC Amplitude;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZn}}); + histos.add("ZPC", ";ZPC Amplitude;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZp}}); + histos.add("ZNACommon", ";ZNA Common Energy;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZn}}); + histos.add("ZPACommon", ";ZPA Common Energy;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZp}}); + histos.add("ZNCCommon", ";ZNC Common Energy;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZn}}); + histos.add("ZPCCommon", ";ZPC Common Energy;Entries;", kTH1F, {{nBinsZDC, -0.5, maxZp}}); histos.add("ZNAVsZNC", ";ZNC;ZNA", kTH2F, {{{30, -0.5, maxZn}, {30, -0.5, maxZn}}}); histos.add("ZPAVsZPC", ";ZPC;ZPA;", kTH2F, {{{100, -0.5, maxZp}, {100, -0.5, maxZp}}}); histos.add("ZNAVsZPA", ";ZPA;ZNA;", kTH2F, {{{20, -0.5, maxZp}, {30, -0.5, maxZn}}}); @@ -312,6 +316,8 @@ struct FlowZdcTask { histos.add("ZPCvsCent", ";centFT0C;ZPC", kTH2F, {{{axisCent}, {nBinsZDC, -0.5, maxZp}}}); histos.add("pZPAvsFT0Ccent", ";FT0C centrality;ZPA Amplitude", kTProfile, {{nBinsCent, minT0CcentCut, maxT0CcentCut}}); histos.add("pZPCvsFT0Ccent", ";FT0C centrality;ZPC Amplitude", kTProfile, {{nBinsCent, minT0CcentCut, maxT0CcentCut}}); + histos.add("pZPAvsGlbTrack", ";Global Tracks (ITS + TPC);ZPA Amplitude", kTProfile, {{nBinsNch, minNch, maxNch}}); + histos.add("pZPCvsGlbTrack", ";Global Tracks (ITS + TPC);ZPC Amplitude", kTProfile, {{nBinsNch, minNch, maxNch}}); } ccdb->setURL("http://alice-ccdb.cern.ch"); @@ -450,6 +456,10 @@ struct FlowZdcTask { float znC = zdc.amplitudeZNC() / cfgCollisionEnergy; float zpA = zdc.amplitudeZPA() / cfgCollisionEnergy; float zpC = zdc.amplitudeZPC() / cfgCollisionEnergy; + float commonSumZnc = zdc.energyCommonZNC() / cfgCollisionEnergy; + float commonSumZna = zdc.energyCommonZNA() / cfgCollisionEnergy; + float commonSumZpc = zdc.energyCommonZPC() / cfgCollisionEnergy; + float commonSumZpa = zdc.energyCommonZPA() / cfgCollisionEnergy; float aZEM1{zdc.amplitudeZEM1()}; float aZEM2{zdc.amplitudeZEM2()}; float sumZEMs{aZEM1 + aZEM2}; @@ -550,6 +560,8 @@ struct FlowZdcTask { // Neutron ZDC histos.fill(HIST("ZNA"), znA); histos.fill(HIST("ZNC"), znC); + histos.fill(HIST("ZNACommon"), commonSumZna); + histos.fill(HIST("ZNCCommon"), commonSumZnc); histos.fill(HIST("ZNASector"), sumZNA / cfgCollisionEnergy); histos.fill(HIST("ZNCSector"), sumZNC / cfgCollisionEnergy); histos.fill(HIST("ZN"), znA + znC); @@ -564,21 +576,25 @@ struct FlowZdcTask { // Proton ZDC if (!isOneNeutronFound || znA >= oneNeutron) { histos.fill(HIST("ZPA"), zpA); + histos.fill(HIST("ZPACommon"), commonSumZpa); histos.fill(HIST("ZPASector"), sumZPA / cfgCollisionEnergy); histos.fill(HIST("ZPAVstdc"), tZPA, zpA); histos.fill(HIST("ZPAvsCent"), cent, zpA); if (std::isfinite(zpA) && !std::isnan(zpA) && - cent >= minT0CcentCut && cent < maxT0CcentCut) { + cent >= minT0CcentCut && cent < maxT0CcentCut && glbTracks >= minNch && glbTracks < maxNch) { histos.fill(HIST("pZPAvsFT0Ccent"), cent, zpA); + histos.fill(HIST("pZPAvsGlbTrack"), glbTracks, zpA); } } if (!isOneNeutronFound || znC >= oneNeutron) { histos.fill(HIST("ZPC"), zpC); + histos.fill(HIST("ZPCCommon"), commonSumZpc); histos.fill(HIST("ZPCSector"), sumZPC / cfgCollisionEnergy); histos.fill(HIST("ZPCvsCent"), cent, zpC); if (std::isfinite(zpC) && !std::isnan(zpC) && - cent >= minT0CcentCut && cent < maxT0CcentCut) { + cent >= minT0CcentCut && cent < maxT0CcentCut && glbTracks >= minNch && glbTracks < maxNch) { histos.fill(HIST("pZPCvsFT0Ccent"), cent, zpC); + histos.fill(HIST("pZPCvsGlbTrack"), glbTracks, zpC); } } From 61b8a762e832198c2d63795981492fc11c396ad0 Mon Sep 17 00:00:00 2001 From: Pritam Chakraborty <47203359+prchakra@users.noreply.github.com> Date: Sun, 10 Aug 2025 03:46:48 +0200 Subject: [PATCH 314/345] [PWGCF] Revert "[PWGCF] FemtoUniverse: Fixing the bug in phi calculation at R" (#12509) --- PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h b/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h index 2fa14b2098a..1e336f20abd 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h @@ -621,7 +621,7 @@ class FemtoUniverseDetaDphiStar for (size_t i = 0; i < 9; i++) { double arg = 0.3 * charge * magfield * TmpRadiiTPC[i] * 0.01 / (2. * pt); if (std::abs(arg) < 1.0) { - tmpVec.push_back(phi0 + std::asin(arg)); + tmpVec.push_back(phi0 - std::asin(arg)); } else { tmpVec.push_back(999.0); } From 5228288ed05875c7118f2523e676b5ab59ced59d Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Sun, 10 Aug 2025 09:38:17 +0200 Subject: [PATCH 315/345] [PWGEM/Dilepton] remove unused argument (#12511) --- PWGEM/Dilepton/Core/Dilepton.h | 8 ++++---- PWGEM/Dilepton/Core/DileptonHadronMPC.h | 18 +++++++++--------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/PWGEM/Dilepton/Core/Dilepton.h b/PWGEM/Dilepton/Core/Dilepton.h index 531a1eb1043..2ded13ca237 100644 --- a/PWGEM/Dilepton/Core/Dilepton.h +++ b/PWGEM/Dilepton/Core/Dilepton.h @@ -1344,25 +1344,25 @@ struct Dilepton { for (const auto& pos : selected_posTracks_in_this_event) { // ULS mix for (const auto& neg : negTracks_from_event_pool) { - fillPairInfo<1>(collision, pos, neg, cut, tracks); + fillPairInfo<1>(collision, pos, neg, cut, nullptr); } } for (const auto& neg : selected_negTracks_in_this_event) { // ULS mix for (const auto& pos : posTracks_from_event_pool) { - fillPairInfo<1>(collision, neg, pos, cut, tracks); + fillPairInfo<1>(collision, neg, pos, cut, nullptr); } } for (const auto& pos1 : selected_posTracks_in_this_event) { // LS++ mix for (const auto& pos2 : posTracks_from_event_pool) { - fillPairInfo<1>(collision, pos1, pos2, cut, tracks); + fillPairInfo<1>(collision, pos1, pos2, cut, nullptr); } } for (const auto& neg1 : selected_negTracks_in_this_event) { // LS-- mix for (const auto& neg2 : negTracks_from_event_pool) { - fillPairInfo<1>(collision, neg1, neg2, cut, tracks); + fillPairInfo<1>(collision, neg1, neg2, cut, nullptr); } } } // end of loop over mixed event pool diff --git a/PWGEM/Dilepton/Core/DileptonHadronMPC.h b/PWGEM/Dilepton/Core/DileptonHadronMPC.h index b8d54f9217d..9efb785a21a 100644 --- a/PWGEM/Dilepton/Core/DileptonHadronMPC.h +++ b/PWGEM/Dilepton/Core/DileptonHadronMPC.h @@ -830,11 +830,6 @@ struct DileptonHadronMPC { } } } - - // possibleIds1.clear(); - // possibleIds1.shrink_to_fit(); - // possibleIds2.clear(); - // possibleIds2.shrink_to_fit(); } return true; } @@ -1186,6 +1181,8 @@ struct DileptonHadronMPC { auto collisionIds_in_mixing_pool = emh_pos->GetCollisionIdsFromEventPool(key_bin); // pos/neg does not matter. + // LOGF(info, "selected_posTracks_in_this_event.size() = %d, selected_negTracks_in_this_event.size() = %d, collisionIds_in_mixing_pool.size() = %d", selected_posTracks_in_this_event.size(), selected_negTracks_in_this_event.size(), collisionIds_in_mixing_pool.size()); + // perform event mixing, only if at least 1 dilepton exists. for (const auto& mix_dfId_collisionId : collisionIds_in_mixing_pool) { @@ -1204,28 +1201,29 @@ struct DileptonHadronMPC { auto posTracks_from_event_pool = emh_pos->GetTracksPerCollision(mix_dfId_collisionId); auto negTracks_from_event_pool = emh_neg->GetTracksPerCollision(mix_dfId_collisionId); + // LOGF(info, "posTracks_from_event_pool.size() = %d, negTracks_from_event_pool.size() = %d", posTracks_from_event_pool.size(), negTracks_from_event_pool.size()); for (const auto& pos : selected_posTracks_in_this_event) { // ULS mix for (const auto& neg : negTracks_from_event_pool) { - fillDilepton<1>(collision, pos, neg, cut, tracks); + fillDilepton<1>(collision, pos, neg, cut, nullptr); } } for (const auto& neg : selected_negTracks_in_this_event) { // ULS mix for (const auto& pos : posTracks_from_event_pool) { - fillDilepton<1>(collision, neg, pos, cut, tracks); + fillDilepton<1>(collision, neg, pos, cut, nullptr); } } for (const auto& pos1 : selected_posTracks_in_this_event) { // LS++ mix for (const auto& pos2 : posTracks_from_event_pool) { - fillDilepton<1>(collision, pos1, pos2, cut, tracks); + fillDilepton<1>(collision, pos1, pos2, cut, nullptr); } } for (const auto& neg1 : selected_negTracks_in_this_event) { // LS-- mix for (const auto& neg2 : negTracks_from_event_pool) { - fillDilepton<1>(collision, neg1, neg2, cut, tracks); + fillDilepton<1>(collision, neg1, neg2, cut, nullptr); } } } // end of loop over mixed event pool for lepton-lepton @@ -1233,6 +1231,7 @@ struct DileptonHadronMPC { if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonHadronAnalysisType::kAzimuthalCorrelation)) { auto selected_refTracks_in_this_event = emh_ref->GetTracksPerCollision(key_df_collision); auto collisionIds_in_mixing_pool_hadron = emh_ref->GetCollisionIdsFromEventPool(key_bin); + // LOGF(info, "selected_refTracks_in_this_event.size() = %d, collisionIds_in_mixing_pool_hadron.size() = %d", selected_refTracks_in_this_event.size(), collisionIds_in_mixing_pool_hadron.size()); for (const auto& mix_dfId_collisionId : collisionIds_in_mixing_pool_hadron) { int mix_dfId = mix_dfId_collisionId.first; @@ -1249,6 +1248,7 @@ struct DileptonHadronMPC { } auto refTracks_from_event_pool = emh_ref->GetTracksPerCollision(mix_dfId_collisionId); + // LOGF(info, "refTracks_from_event_pool.size() = %d", refTracks_from_event_pool.size()); for (const auto& ref1 : selected_refTracks_in_this_event) { // ref-ref mix for (const auto& ref2 : refTracks_from_event_pool) { fillHadronHadron<1>(collision, ref1, ref2, nullptr, nullptr); From d7e314a634952620cdc38c46d87e2b196ada6fa8 Mon Sep 17 00:00:00 2001 From: jaelpark Date: Sun, 10 Aug 2025 13:01:00 +0200 Subject: [PATCH 316/345] [PWGCF] CF correlations and JCorran multiplicity correlations (#12508) --- PWGCF/DataModel/CorrelationsDerived.h | 9 +- PWGCF/JCorran/Core/JFFlucAnalysis.cxx | 6 +- PWGCF/JCorran/Core/JFFlucAnalysis.h | 30 +++++-- PWGCF/JCorran/Core/JFFlucAnalysisO2Hist.cxx | 27 ++++-- PWGCF/JCorran/Core/JFFlucAnalysisO2Hist.h | 3 +- PWGCF/JCorran/Tasks/jflucAnalysisTask.cxx | 26 +++++- PWGCF/TableProducer/filterCorrelations.cxx | 15 +--- PWGCF/Tasks/correlations.cxx | 92 ++++++++++++++------- 8 files changed, 149 insertions(+), 59 deletions(-) diff --git a/PWGCF/DataModel/CorrelationsDerived.h b/PWGCF/DataModel/CorrelationsDerived.h index 4ea9ec8a32b..9be8ac7d58e 100644 --- a/PWGCF/DataModel/CorrelationsDerived.h +++ b/PWGCF/DataModel/CorrelationsDerived.h @@ -90,7 +90,14 @@ DECLARE_SOA_TABLE(CFCollRefs, "AOD", "CFCOLLREF", o2::soa::Index<>, track::Colli namespace cfmultset { DECLARE_SOA_COLUMN(Multiplicities, multiplicities, std::vector); //! List of auxiliary multiplicities -} +enum MultiplicityEstimators : uint8_t { + CentFT0C = 0x1, + MultFV0A = 0x2, + MultNTracksPV = 0x4, + MultNTracksGlobal = 0x8 +}; + +} // namespace cfmultset DECLARE_SOA_TABLE(CFMultSets, "AOD", "CFMULTSET", cfmultset::Multiplicities); //! Auxilary multiplicity set table using CFMultSet = CFMultSets::iterator; diff --git a/PWGCF/JCorran/Core/JFFlucAnalysis.cxx b/PWGCF/JCorran/Core/JFFlucAnalysis.cxx index 9dc4189a810..4c3b01adeca 100644 --- a/PWGCF/JCorran/Core/JFFlucAnalysis.cxx +++ b/PWGCF/JCorran/Core/JFFlucAnalysis.cxx @@ -12,10 +12,12 @@ /// \author Jasper Parkkila (jparkkil@cern.ch) /// \since Sep 2022 -#include +#include "JFFlucAnalysis.h" + #include +#include + #include -#include "JFFlucAnalysis.h" JFFlucAnalysis::JFFlucAnalysis() : TNamed(), fVertex(0), diff --git a/PWGCF/JCorran/Core/JFFlucAnalysis.h b/PWGCF/JCorran/Core/JFFlucAnalysis.h index 4900e5c5b62..b728c809173 100644 --- a/PWGCF/JCorran/Core/JFFlucAnalysis.h +++ b/PWGCF/JCorran/Core/JFFlucAnalysis.h @@ -15,13 +15,16 @@ #ifndef PWGCF_JCORRAN_CORE_JFFLUCANALYSIS_H_ #define PWGCF_JCORRAN_CORE_JFFLUCANALYSIS_H_ -#include #include "JQVectors.h" + #include -#include #include #include #include +#include + +#include +#include class JFFlucAnalysis : public TNamed { @@ -61,7 +64,6 @@ class JFFlucAnalysis : public TNamed enum HIST_THN { HIST_THN_PHIETAZ, HIST_THN_PTETA, - HIST_THN_PHIETA, HIST_THN_SC_with_QC_4corr, HIST_THN_SC_with_QC_2corr, HIST_THN_SC_with_QC_2corr_gap, @@ -98,6 +100,7 @@ class JFFlucAnalysis : public TNamed enum HIST_THN_SPARSE { HIST_THN_SPARSE_VN, HIST_THN_SPARSE_VN_VN, + HIST_THN_SPARSE_MULTCORR, HIST_THN_SPARSE_COUNT }; enum { @@ -144,12 +147,17 @@ class JFFlucAnalysis : public TNamed using hasWeightEff = decltype(std::declval().weightEff()); template using hasSign = decltype(std::declval().sign()); + template + using hasMultSet = decltype(std::declval().multiplicities()); template inline void FillQA(JInputClass& inputInst, UInt_t type = 0u) { - ph1[HIST_TH1_CENTRALITY]->Fill(fCent); - ph1[HIST_TH1_IMPACTPARAM]->Fill(fImpactParameter); + if (type == 0u) { + ph1[HIST_TH1_CENTRALITY]->Fill(fCent); + ph1[HIST_TH1_ZVERTEX]->Fill(fVertex); + ph1[HIST_TH1_IMPACTPARAM]->Fill(fImpactParameter); + } for (auto& track : inputInst) { Double_t corrInv = 1.0; @@ -162,11 +170,19 @@ class JFFlucAnalysis : public TNamed pht[HIST_THN_PTETA]->Fill(fCent, track.pt(), track.eta(), 0.0, corrInv); if constexpr (std::experimental::is_detected::value) corrInv /= track.weightNUA(); - pht[HIST_THN_PHIETA]->Fill(fCent, track.phi(), track.eta(), corrInv); pht[HIST_THN_PHIETAZ]->Fill(fCent, static_cast(type), track.phi(), track.eta(), fVertex, corrInv); } + } - ph1[HIST_TH1_ZVERTEX]->Fill(fVertex); + template + inline void FillMultSet(JEventClass& event) + { + // + if constexpr (std::experimental::is_detected::value) { + // need to convert to vec of doubles since THnSparse has no way to fill vec of floats directly + std::vector v(event.multiplicities().begin(), event.multiplicities().end()); + phs[HIST_THN_SPARSE_MULTCORR]->Fill(v.data()); + } } #define kcNH kH4 // max second dimension + 1 diff --git a/PWGCF/JCorran/Core/JFFlucAnalysisO2Hist.cxx b/PWGCF/JCorran/Core/JFFlucAnalysisO2Hist.cxx index b3419ff7dc8..502a14c6b28 100644 --- a/PWGCF/JCorran/Core/JFFlucAnalysisO2Hist.cxx +++ b/PWGCF/JCorran/Core/JFFlucAnalysisO2Hist.cxx @@ -12,24 +12,41 @@ /// \since Sep 2024 #include "JFFlucAnalysisO2Hist.h" -#include -#include + +#include "PWGCF/DataModel/CorrelationsDerived.h" + #include "CommonConstants/MathConstants.h" +#include +#include + using namespace o2; -JFFlucAnalysisO2Hist::JFFlucAnalysisO2Hist(HistogramRegistry& registry, AxisSpec& axisMultiplicity, AxisSpec& phiAxis, AxisSpec& etaAxis, AxisSpec& zvtAxis, AxisSpec& ptAxis, AxisSpec& massAxis, const TString& folder) : JFFlucAnalysis() +JFFlucAnalysisO2Hist::JFFlucAnalysisO2Hist(HistogramRegistry& registry, AxisSpec& axisMultiplicity, AxisSpec& phiAxis, AxisSpec& etaAxis, AxisSpec& zvtAxis, AxisSpec& ptAxis, AxisSpec& massAxis, uint16_t multCorrMask, const TString& folder) : JFFlucAnalysis() { ph1[HIST_TH1_CENTRALITY] = std::get>(registry.add(Form("%s/h_cent", folder.Data()), "multiplicity/centrality", {HistType::kTH1F, {axisMultiplicity}})).get(); ph1[HIST_TH1_IMPACTPARAM] = std::get>(registry.add(Form("%s/h_IP", folder.Data()), "impact parameter", {HistType::kTH1F, {{400, -2.0, 20.0}}})).get(); ph1[HIST_TH1_ZVERTEX] = std::get>(registry.add(Form("%s/h_vertex", folder.Data()), "z vertex", {HistType::kTH1F, {{100, -20.0, 20.0}}})).get(); + if (multCorrMask != 0) { + std::vector multAxes; + if (multCorrMask & aod::cfmultset::CentFT0C) + multAxes.emplace_back(100, 0, 100, "FT0C centrality"); + if (multCorrMask & aod::cfmultset::MultFV0A) + multAxes.emplace_back(100, 0, 100000, "V0A multiplicity"); + if (multCorrMask & aod::cfmultset::MultNTracksPV) + multAxes.emplace_back(100, 0, 1000, "Nch PV"); + if (multCorrMask & aod::cfmultset::MultNTracksGlobal) + multAxes.emplace_back(100, 0, 1000, "Nch Global"); + registry.add("multCorrelations", "Multiplicity correlations", {HistType::kTHnSparseF, multAxes}); + phs[HIST_THN_SPARSE_MULTCORR] = std::get>(registry.add(Form("%s/h_multcorr", folder.Data()), "multiplicity/centrality correlations", {HistType::kTHnSparseF, multAxes})).get(); + } + AxisSpec chgAxis = {3, -1.5, 1.5, "charge"}; AxisSpec typeAxis = {2, -0.5, 1.5, "type"}; - pht[HIST_THN_PHIETAZ] = std::get>(registry.add(Form("%s/h_phietaz", folder.Data()), "multiplicity/centrality, type, phi, eta, z", {HistType::kTHnSparseF, {axisMultiplicity, typeAxis, phiAxis, etaAxis, zvtAxis}})).get(); + pht[HIST_THN_PHIETAZ] = std::get>(registry.add(Form("%s/h_phietaz", folder.Data()), "(corrected) multiplicity/centrality, type, phi, eta, z", {HistType::kTHnSparseF, {axisMultiplicity, typeAxis, phiAxis, etaAxis, zvtAxis}})).get(); pht[HIST_THN_PTETA] = std::get>(registry.add(Form("%s/h_pteta", folder.Data()), "(corrected) multiplicity/centrality, pT, eta, charge", {HistType::kTHnSparseF, {axisMultiplicity, ptAxis, etaAxis, chgAxis}})).get(); - pht[HIST_THN_PHIETA] = std::get>(registry.add(Form("%s/h_phieta", folder.Data()), "(corrected) multiplicity/centrality, phi, eta", {HistType::kTHnSparseF, {axisMultiplicity, phiAxis, etaAxis}})).get(); AxisSpec hAxis = {kNH, -0.5, static_cast(kNH - 1) + 0.5, "#it{n}"}; AxisSpec kAxis = {nKL, -0.5, static_cast(nKL - 1) + 0.5, "#it{k}"}; AxisSpec vnAxis = {2048, -0.1, 0.1, "#it{V}_#it{n}"}; diff --git a/PWGCF/JCorran/Core/JFFlucAnalysisO2Hist.h b/PWGCF/JCorran/Core/JFFlucAnalysisO2Hist.h index a9de2fd7864..8821c64a225 100644 --- a/PWGCF/JCorran/Core/JFFlucAnalysisO2Hist.h +++ b/PWGCF/JCorran/Core/JFFlucAnalysisO2Hist.h @@ -15,6 +15,7 @@ #define PWGCF_JCORRAN_CORE_JFFLUCANALYSISO2HIST_H_ #include "JFFlucAnalysis.h" + #include "Framework/HistogramRegistry.h" using namespace o2; @@ -23,7 +24,7 @@ using namespace o2::framework; class JFFlucAnalysisO2Hist : public JFFlucAnalysis { public: - JFFlucAnalysisO2Hist(HistogramRegistry&, AxisSpec&, AxisSpec&, AxisSpec&, AxisSpec&, AxisSpec&, AxisSpec&, const TString&); + JFFlucAnalysisO2Hist(HistogramRegistry&, AxisSpec&, AxisSpec&, AxisSpec&, AxisSpec&, AxisSpec&, AxisSpec&, uint16_t, const TString&); ~JFFlucAnalysisO2Hist(); }; diff --git a/PWGCF/JCorran/Tasks/jflucAnalysisTask.cxx b/PWGCF/JCorran/Tasks/jflucAnalysisTask.cxx index 0072f2c2a51..8f1244661c7 100644 --- a/PWGCF/JCorran/Tasks/jflucAnalysisTask.cxx +++ b/PWGCF/JCorran/Tasks/jflucAnalysisTask.cxx @@ -55,6 +55,7 @@ struct jflucAnalysisTask { O2_DEFINE_CONFIGURABLE(ptmin, float, 0.2, "Minimum pt for tracks"); O2_DEFINE_CONFIGURABLE(ptmax, float, 5.0, "Maximum pt for tracks"); O2_DEFINE_CONFIGURABLE(cfgCentBinsForMC, int, 0, "0 = OFF and 1 = ON for data like multiplicity/centrality bins for MC process"); + O2_DEFINE_CONFIGURABLE(cfgMultCorrelationsMask, uint16_t, 0, "Selection bitmask for the multiplicity correlations. This should match the filter selection cfgEstimatorBitMask.") ConfigurableAxis axisMultiplicity{"axisMultiplicity", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 100.1}, "multiplicity / centrality axis for histograms"}; ConfigurableAxis phiAxis{"axisPhi", {50, 0.0, o2::constants::math::TwoPI}, "phi axis for histograms"}; @@ -78,15 +79,15 @@ struct jflucAnalysisTask { auto axisSpecZvt = AxisSpec(zvtAxis); auto axisSpecPt = AxisSpec(ptAxis); auto axisSpecMass = AxisSpec(massAxis); - if (doprocessJDerived || doprocessJDerivedCorrected || doprocessCFDerived || doprocessCFDerivedCorrected || doprocessMCCFDerived) { - pcf = new JFFlucAnalysisO2Hist(registry, axisSpecMult, axisSpecPhi, axisSpecEta, axisSpecZvt, axisSpecPt, axisSpecMass, "jfluc"); + if (doprocessJDerived || doprocessJDerivedCorrected || doprocessCFDerived || doprocessCFDerivedCorrected || doprocessCFDerivedMultSet || doprocessCFDerivedMultSetCorrected || doprocessMCCFDerived) { + pcf = new JFFlucAnalysisO2Hist(registry, axisSpecMult, axisSpecPhi, axisSpecEta, axisSpecZvt, axisSpecPt, axisSpecMass, cfgMultCorrelationsMask, "jfluc"); pcf->AddFlags(JFFlucAnalysis::kFlucEbEWeighting); pcf->UserCreateOutputObjects(); } else { pcf = 0; } if (doprocessCF2ProngDerived || doprocessCF2ProngDerivedCorrected) { - pcf2Prong = new JFFlucAnalysisO2Hist(registry, axisSpecMult, axisSpecPhi, axisSpecEta, axisSpecZvt, axisSpecPt, axisSpecMass, "jfluc2prong"); + pcf2Prong = new JFFlucAnalysisO2Hist(registry, axisSpecMult, axisSpecPhi, axisSpecEta, axisSpecZvt, axisSpecPt, axisSpecMass, cfgMultCorrelationsMask, "jfluc2prong"); pcf2Prong->AddFlags(JFFlucAnalysis::kFlucEbEWeighting); pcf2Prong->UserCreateOutputObjects(); @@ -95,6 +96,8 @@ struct jflucAnalysisTask { } else { pcf2Prong = 0; } + if ((doprocessCFDerivedMultSet || doprocessCFDerivedMultSetCorrected) && cfgMultCorrelationsMask == 0) + LOGF(fatal, "cfgMultCorrelationsMask can not be 0 when MultSet process functions are in use."); } template @@ -107,6 +110,7 @@ struct jflucAnalysisTask { pcf->SetEventCentrality(collision.multiplicity()); pcf->SetEventVertex(collision.posZ()); pcf->FillQA(tracks); + pcf->FillMultSet(collision); qvecs.Calculate(tracks, etamin, etamax); pcf->SetJQVectors(&qvecs); pcf->UserExec(""); @@ -158,6 +162,22 @@ struct jflucAnalysisTask { } PROCESS_SWITCH(jflucAnalysisTask, processCFDerivedCorrected, "Process CF derived data with corrections", true); + void processCFDerivedMultSet(soa::Join::iterator const& collision, soa::Filtered const& tracks) + { + if (std::popcount(cfgMultCorrelationsMask.value) != static_cast(collision.multiplicities().size())) + LOGF(fatal, "Multiplicity selections (cfgMultCorrelationsMask = 0x%x) do not match the size of the table column (%ld). The histogram filling relies on the preservation of order.", cfgMultCorrelationsMask.value, collision.multiplicities().size()); + analyze(collision, tracks); + } + PROCESS_SWITCH(jflucAnalysisTask, processCFDerivedMultSet, "Process CF derived data with multiplicity sets", false); + + void processCFDerivedMultSetCorrected(soa::Join::iterator const& collision, soa::Filtered> const& tracks) + { + if (std::popcount(cfgMultCorrelationsMask.value) != static_cast(collision.multiplicities().size())) + LOGF(fatal, "Multiplicity selections (cfgMultCorrelationsMask = 0x%x) do not match the size of the table column (%ld). The histogram filling relies on the preservation of order.", cfgMultCorrelationsMask.value, collision.multiplicities().size()); + analyze(collision, tracks); + } + PROCESS_SWITCH(jflucAnalysisTask, processCFDerivedMultSetCorrected, "Process CF derived data with corrections and multiplicity sets", false); + void processCF2ProngDerived(aod::CFCollision const& collision, soa::Filtered const& tracks, soa::Filtered const& p2tracks) { analyze(collision, p2tracks, tracks); diff --git a/PWGCF/TableProducer/filterCorrelations.cxx b/PWGCF/TableProducer/filterCorrelations.cxx index 7446a230311..70a009346c4 100644 --- a/PWGCF/TableProducer/filterCorrelations.cxx +++ b/PWGCF/TableProducer/filterCorrelations.cxx @@ -64,13 +64,6 @@ struct FilterCF { kPIDProton = BIT(1) }; - enum MultiplicityEstimators : uint8_t { - kCentFT0C = BIT(0), - kMultFV0A = BIT(1), - kMultNTracksPV = BIT(2), - kMultNTracksGlobal = BIT(3), - }; - // Configuration O2_DEFINE_CONFIGURABLE(cfgCutVertex, float, 7.0f, "Accepted z-vertex range") O2_DEFINE_CONFIGURABLE(cfgCutPt, float, 0.5f, "Minimal pT for tracks") @@ -271,13 +264,13 @@ struct FilterCF { if constexpr (std::experimental::is_detected::value) { multiplicities.clear(); - if (cfgEstimatorBitMask & kCentFT0C) + if (cfgEstimatorBitMask & aod::cfmultset::CentFT0C) multiplicities.push_back(collision.centFT0C()); - if (cfgEstimatorBitMask & kMultFV0A) + if (cfgEstimatorBitMask & aod::cfmultset::MultFV0A) multiplicities.push_back(collision.multFV0A()); - if (cfgEstimatorBitMask & kMultNTracksPV) + if (cfgEstimatorBitMask & aod::cfmultset::MultNTracksPV) multiplicities.push_back(collision.multNTracksPV()); - if (cfgEstimatorBitMask & kMultNTracksGlobal) + if (cfgEstimatorBitMask & aod::cfmultset::MultNTracksGlobal) multiplicities.push_back(collision.multNTracksGlobal()); outputMultSets(multiplicities); } diff --git a/PWGCF/Tasks/correlations.cxx b/PWGCF/Tasks/correlations.cxx index 044699d8f1e..0fdbb0499df 100644 --- a/PWGCF/Tasks/correlations.cxx +++ b/PWGCF/Tasks/correlations.cxx @@ -43,6 +43,7 @@ #include #include #include +#include #include #include @@ -85,6 +86,7 @@ struct CorrelationTask { O2_DEFINE_CONFIGURABLE(cfgLocalEfficiency, int, 0, "0 = OFF and 1 = ON for local efficiency"); O2_DEFINE_CONFIGURABLE(cfgCentBinsForMC, int, 0, "0 = OFF and 1 = ON for data like multiplicity/centrality bins for MC steps"); O2_DEFINE_CONFIGURABLE(cfgTrackBitMask, uint16_t, 0, "BitMask for track selection systematics; refer to the enum TrackSelectionCuts in filtering task"); + O2_DEFINE_CONFIGURABLE(cfgMultCorrelationsMask, uint16_t, 0, "Selection bitmask for the multiplicity correlations. This should match the filter selection cfgEstimatorBitMask.") // Suggested values: Photon: 0.004; K0 and Lambda: 0.005 Configurable> cfgPairCut{"cfgPairCut", {kCfgPairCutDefaults[0], 5, {"Photon", "K0", "Lambda", "Phi", "Rho"}}, "Pair cuts on various particles"}; @@ -175,6 +177,20 @@ struct CorrelationTask { registry.add("invMassTwoPartDPhi", "2D 2-prong invariant mass (GeV/c^2)", {HistType::kTHnSparseF, {axisSpecMass, axisSpecMass, axisPtTrigger, axisPtAssoc, axisDeltaPhi}}); } } + if (doprocessSameDerivedMultSet) { + if (cfgMultCorrelationsMask == 0) + LOGF(fatal, "cfgMultCorrelationsMask can not be 0 when MultSet process functions are in use."); + std::vector multAxes; + if (cfgMultCorrelationsMask & aod::cfmultset::CentFT0C) + multAxes.emplace_back(100, 0, 100, "FT0C centrality"); + if (cfgMultCorrelationsMask & aod::cfmultset::MultFV0A) + multAxes.emplace_back(100, 0, 100000, "V0A multiplicity"); + if (cfgMultCorrelationsMask & aod::cfmultset::MultNTracksPV) + multAxes.emplace_back(100, 0, 1000, "Nch PV"); + if (cfgMultCorrelationsMask & aod::cfmultset::MultNTracksGlobal) + multAxes.emplace_back(100, 0, 1000, "Nch Global"); + registry.add("multCorrelations", "Multiplicity correlations", {HistType::kTHnSparseF, multAxes}); + } registry.add("multiplicity", "event multiplicity", {HistType::kTH1F, {{1000, 0, 100, "/multiplicity/centrality"}}}); registry.add("yvspt", "y vs pT", {HistType::kTH2F, {{100, -1, 1, "y"}, {100, 0, 20, "p_{T}"}}}); // y vs pT for all tracks (control histogram) @@ -272,10 +288,20 @@ struct CorrelationTask { return !((track.decay() == 0 && track.mlProbD0()[0] > cfgPtCentDepMLbkgSel->at(idx)) || (track.decay() == 1 && track.mlProbD0bar()[0] > cfgPtCentDepMLbkgSel->at(idx))); } + template + using HasMultSet = decltype(std::declval().multiplicities()); + template - void fillQA(const TCollision& /*collision*/, float multiplicity, const TTracks& tracks) + void fillQA(const TCollision& collision, float multiplicity, const TTracks& tracks) { registry.fill(HIST("multiplicity"), multiplicity); + if constexpr (std::experimental::is_detected::value) { + if (std::popcount(cfgMultCorrelationsMask.value) != static_cast(collision.multiplicities().size())) + LOGF(fatal, "Multiplicity selections (cfgMultCorrelationsMask = 0x%x) do not match the size of the table column (%ld). The histogram filling relies on the preservation of order.", cfgMultCorrelationsMask.value, collision.multiplicities().size()); + // need to convert to vec of doubles since THnSparse has no way to fill vec of floats directly + std::vector v(collision.multiplicities().begin(), collision.multiplicities().end()); + registry.get(HIST("multCorrelations")).get()->Fill(v.data()); + } for (const auto& track1 : tracks) { registry.fill(HIST("yields"), multiplicity, track1.pt(), track1.eta()); registry.fill(HIST("etaphi"), multiplicity, track1.eta(), track1.phi()); @@ -401,8 +427,23 @@ struct CorrelationTask { using HasPartDaugh1Id = decltype(std::declval().cfParticleDaugh1Id()); template - float getV0Rapidity(const T& track) + std::tuple getV0Rapidity(const T& track) { + if constexpr (!std::experimental::is_detected::value) + return {false, 0.0f}; // no decay type, return dummy rapidity + const auto decayType = track.decay(); + float mass = 0.f; + + if (decayType == aod::cf2prongtrack::K0stoPiPi) { + mass = o2::constants::physics::MassK0Short; + } else if (decayType == aod::cf2prongtrack::LambdatoPPi || decayType == aod::cf2prongtrack::AntiLambdatoPiP) { + mass = o2::constants::physics::MassLambda; + } else if (decayType == aod::cf2prongtrack::PhiToKK) { + mass = o2::constants::physics::MassPhi; + } else { + return {false, 0.0f}; // unsupported decay type, return dummy rapidity + } + const float pt = track.pt(); const float eta = track.eta(); const float phi = track.phi(); @@ -413,25 +454,8 @@ struct CorrelationTask { const float p2 = px * px + py * py + pz * pz; - if constexpr (std::experimental::is_detected::value) { - const auto decayType = track.decay(); - float mass = 0.f; - - if (decayType == aod::cf2prongtrack::K0stoPiPi) { - mass = o2::constants::physics::MassK0Short; - } else if (decayType == aod::cf2prongtrack::LambdatoPPi || decayType == aod::cf2prongtrack::AntiLambdatoPiP) { - mass = o2::constants::physics::MassLambda; - } else if (decayType == aod::cf2prongtrack::PhiToKK) { - mass = o2::constants::physics::MassPhi; - } else { - return -999.f; // unsupported decay type, return dummy rapidity - } - - const float E = std::sqrt(p2 + mass * mass); - return 0.5f * std::log((E + pz) / (E - pz)); - } - - return -999.f; // no decay type, return dummy rapidity + const float E = std::sqrt(p2 + mass * mass); + return {true, 0.5f * std::log((E + pz) / (E - pz))}; } template @@ -484,10 +508,12 @@ struct CorrelationTask { if (cfgDecayParticleMask != 0 && (cfgDecayParticleMask & (1u << static_cast(track1.decay()))) == 0u) { continue; // skip particles that do not match the decay mask } - if (cfgV0RapidityMax > 0 && std::abs(getV0Rapidity(track1)) > cfgV0RapidityMax) { - continue; // V0s are not allowed to be outside the rapidity range + if (cfgV0RapidityMax > 0) { + auto [t, y] = getV0Rapidity(track1); + if (t && std::abs(y) > cfgV0RapidityMax) + continue; // V0s are not allowed to be outside the rapidity range + registry.fill(HIST("yvspt"), y, track1.pt()); } - registry.fill(HIST("yvspt"), getV0Rapidity(track1), track1.pt()); } if constexpr (std::experimental::is_detected::value) { @@ -565,8 +591,10 @@ struct CorrelationTask { if (cfgDecayParticleMask != 0 && (cfgDecayParticleMask & (1u << static_cast(track2.decay()))) == 0u) { continue; // skip particles that do not match the decay mask } - if (cfgV0RapidityMax > 0 && std::abs(getV0Rapidity(track1)) > cfgV0RapidityMax) { - continue; // V0s are not allowed to be outside the rapidity range + if (cfgV0RapidityMax > 0) { + auto [t, y] = getV0Rapidity(track1); + if (t && std::abs(y) > cfgV0RapidityMax) + continue; // V0s are not allowed to be outside the rapidity range } } @@ -739,8 +767,8 @@ struct CorrelationTask { } PROCESS_SWITCH(CorrelationTask, processSameAOD, "Process same event on AOD", true); - template - void processSameDerivedT(DerivedCollisions::iterator const& collision, TTracks1 const& tracks1, TTracks2 const& tracks2) + template + void processSameDerivedT(CollType const& collision, TTracks1 const& tracks1, TTracks2 const& tracks2) { BinningTypeDerived configurableBinningDerived{{axisVertex, axisMultiplicity}, true}; // true is for 'ignore overflows' (true by default). Underflows and overflows will have bin -1. if (cfgVerbosity > 0) { @@ -777,6 +805,12 @@ struct CorrelationTask { } PROCESS_SWITCH(CorrelationTask, processSameDerived, "Process same event on derived data", false); + void processSameDerivedMultSet(soa::Filtered>::iterator const& collision, soa::Filtered const& tracks) + { + processSameDerivedT(collision, tracks, tracks); + } + PROCESS_SWITCH(CorrelationTask, processSameDerivedMultSet, "Process same event on derived data with multiplicity sets", false); + void processSame2ProngDerived(DerivedCollisions::iterator const& collision, soa::Filtered const& tracks, soa::Filtered const& p2tracks) { processSameDerivedT(collision, p2tracks, tracks); @@ -1140,7 +1174,7 @@ struct CorrelationTask { } } - if (!(doprocessSameDerived || doprocessSame2ProngDerived || doprocessSame2ProngDerivedML || doprocessSame2Prong2Prong || doprocessSame2Prong2ProngML)) { + if (!(doprocessSameDerived || doprocessSameDerivedMultSet || doprocessSame2ProngDerived || doprocessSame2ProngDerivedML || doprocessSame2Prong2Prong || doprocessSame2Prong2ProngML)) { if constexpr (std::experimental::is_detected::value) fillQA(mcCollision, multiplicity, mcParticles1, mcParticles2); else From c16e6598f7e73ef4a3d42f627a1c103a0606f774 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Sun, 10 Aug 2025 14:20:35 +0200 Subject: [PATCH 317/345] [PWGEM/PhotonMeson] update 2PC (#12512) --- PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h b/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h index 706bb6ad6c4..53e26450c64 100644 --- a/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h +++ b/PWGEM/PhotonMeson/Core/DiphotonHadronMPC.h @@ -371,7 +371,7 @@ struct DiphotonHadronMPC { fRegistry.addClone("DiphotonHadron/same/", "DiphotonHadron/mix/"); // hadron-hadron - const AxisSpec axis_deta_hh{ConfDEtaBins, "#Delta#eta = #eta_{h}^{ref1} - #eta_{h}^{ref2}"}; + const AxisSpec axis_deta_hh{60, -3, +3, "#Delta#eta = #eta_{h}^{ref1} - #eta_{h}^{ref2}"}; const AxisSpec axis_dphi_hh{cfgNbinsDPhi, -M_PI / 2, +3 * M_PI / 2, "#Delta#varphi = #varphi_{h}^{ref1} - #varphi_{h}^{ref2} (rad.)"}; // const AxisSpec axis_cosndphi_hh{cfgNbinsCosNDPhi, -1, +1, std::format("cos({0:d}(#varphi_{{h}}^{{ref1}} - #varphi_{{h}}^{{ref2}}))", cfgNmod.value)}; fRegistry.add("HadronHadron/same/hDEtaDPhi", "hadron-hadron 2PC", kTH2D, {axis_dphi_hh, axis_deta_hh}, true); From f62cea959b4059e0e140be7ed767da4a22c63c3b Mon Sep 17 00:00:00 2001 From: prottayCMT <61418725+prottayCMT@users.noreply.github.com> Date: Sun, 10 Aug 2025 16:55:00 +0200 Subject: [PATCH 318/345] [PWGLF] added ratio of particletoantiparticle yield as a weight (#12513) Co-authored-by: Prottay Das --- PWGLF/Tasks/Strangeness/lambdapolsp.cxx | 194 +++++++++++++----------- 1 file changed, 109 insertions(+), 85 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/lambdapolsp.cxx b/PWGLF/Tasks/Strangeness/lambdapolsp.cxx index 1ef475d5964..105fc94bbc7 100644 --- a/PWGLF/Tasks/Strangeness/lambdapolsp.cxx +++ b/PWGLF/Tasks/Strangeness/lambdapolsp.cxx @@ -78,10 +78,16 @@ using v0Candidates = soa::Join; struct lambdapolsp { + struct : ConfigurableGroup { + Configurable cfgURL{"cfgURL", "http://alice-ccdb.cern.ch", "Address of the CCDB to browse"}; + Configurable nolaterthan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "Latest acceptable timestamp of creation for the object"}; + } cfgCcdbParam; + int mRunNumber; Service ccdb; Service pdg; - + o2::ccdb::CcdbApi ccdbApi; + TH1D* hwgtAL; // fill output Configurable additionalEvSel{"additionalEvSel", false, "additionalEvSel"}; Configurable additionalEvSel2{"additionalEvSel2", false, "additionalEvSel2"}; @@ -141,8 +147,10 @@ struct lambdapolsp { Configurable ConfDaughPIDCuts{"ConfDaughPIDCuts", 3, "PID selections for Lambda daughters"}; Configurable usesubdet{"usesubdet", false, "use subdet"}; Configurable useAccCorr{"useAccCorr", false, "use acceptance correction"}; + Configurable useyldwgt{"useyldwgt", false, "use yield weight"}; Configurable ConfAccPathL{"ConfAccPathL", "Users/p/prottay/My/Object/From379780/Fulldata/NewPbPbpass4_28032025/acccorrL", "Path to acceptance correction for Lambda"}; Configurable ConfAccPathAL{"ConfAccPathAL", "Users/p/prottay/My/Object/From379780/Fulldata/NewPbPbpass4_28032025/acccorrAL", "Path to acceptance correction for AntiLambda"}; + Configurable ConfWgtPathAL{"ConfWgtPathAL", "Users/p/prottay/My/Object/From379780/Fulldata/NewPbPbpass4_10082025/yieldweight2050", "Path to yield weight correction for AntiLambda"}; struct : ConfigurableGroup { Configurable QxyNbins{"QxyNbins", 100, "Number of bins in QxQy histograms"}; @@ -379,6 +387,14 @@ struct lambdapolsp { histos.add("hSparseAntiLambda_corr2a", "hSparseAntiLambda_corr2a", HistType::kTHnSparseF, runaxes, true); // histos.add("hSparseAntiLambda_corr2b", "hSparseAntiLambda_corr2b", HistType::kTHnSparseF, runaxes, true); } + + ccdb->setURL(cfgCcdbParam.cfgURL); + ccdbApi.init("http://alice-ccdb.cern.ch"); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); + LOGF(info, "Getting alignment offsets from the CCDB..."); + hwgtAL = ccdb->getForTimeStamp(ConfWgtPathAL.value, cfgCcdbParam.nolaterthan.value); } template @@ -602,7 +618,7 @@ struct lambdapolsp { void fillHistograms(bool tag1, bool tag2, const ROOT::Math::PxPyPzMVector& particle, const ROOT::Math::PxPyPzMVector& daughter, double psiZDCC, double psiZDCA, double psiZDC, double centrality, - double candmass, double candpt, float desbinvalue, double acvalue) + double candmass, double candpt, float desbinvalue, double acvalue, double wgtfactor) { TRandom3 randPhi(0); @@ -638,95 +654,95 @@ struct lambdapolsp { if (tag2) { if (needetaaxis) { if (usesubdet) { - histos.fill(HIST("hSparseAntiLambdaCosPsiA"), candmass, candpt, (TMath::Cos(GetPhiInRange(psiZDCA))), centrality, desbinvalue); - histos.fill(HIST("hSparseAntiLambdaCosPsiC"), candmass, candpt, (TMath::Cos(GetPhiInRange(psiZDCC))), centrality, desbinvalue); - histos.fill(HIST("hSparseAntiLambdaSinPsiA"), candmass, candpt, (TMath::Sin(GetPhiInRange(psiZDCA))), centrality, desbinvalue); - histos.fill(HIST("hSparseAntiLambdaSinPsiC"), candmass, candpt, (TMath::Sin(GetPhiInRange(psiZDCC))), centrality, desbinvalue); + histos.fill(HIST("hSparseAntiLambdaCosPsiA"), candmass, candpt, (TMath::Cos(GetPhiInRange(psiZDCA))), centrality, desbinvalue, wgtfactor); + histos.fill(HIST("hSparseAntiLambdaCosPsiC"), candmass, candpt, (TMath::Cos(GetPhiInRange(psiZDCC))), centrality, desbinvalue, wgtfactor); + histos.fill(HIST("hSparseAntiLambdaSinPsiA"), candmass, candpt, (TMath::Sin(GetPhiInRange(psiZDCA))), centrality, desbinvalue, wgtfactor); + histos.fill(HIST("hSparseAntiLambdaSinPsiC"), candmass, candpt, (TMath::Sin(GetPhiInRange(psiZDCC))), centrality, desbinvalue, wgtfactor); } - histos.fill(HIST("hSparseAntiLambdaCosPsi"), candmass, candpt, (TMath::Cos(GetPhiInRange(psiZDC))), centrality, desbinvalue); - histos.fill(HIST("hSparseAntiLambdaSinPsi"), candmass, candpt, (TMath::Sin(GetPhiInRange(psiZDC))), centrality, desbinvalue); + histos.fill(HIST("hSparseAntiLambdaCosPsi"), candmass, candpt, (TMath::Cos(GetPhiInRange(psiZDC))), centrality, desbinvalue, wgtfactor); + histos.fill(HIST("hSparseAntiLambdaSinPsi"), candmass, candpt, (TMath::Sin(GetPhiInRange(psiZDC))), centrality, desbinvalue, wgtfactor); if (usesubdet) { - histos.fill(HIST("hSparseAntiLambdaPolA"), candmass, candpt, PolA, centrality, desbinvalue); - histos.fill(HIST("hSparseAntiLambdaPolC"), candmass, candpt, PolC, centrality, desbinvalue); - histos.fill(HIST("hSparseAntiLambdaPolAwgt"), candmass, candpt, PolAwgt, centrality, desbinvalue); - histos.fill(HIST("hSparseAntiLambdaPolCwgt"), candmass, candpt, PolCwgt, centrality, desbinvalue); + histos.fill(HIST("hSparseAntiLambdaPolA"), candmass, candpt, PolA, centrality, desbinvalue, wgtfactor); + histos.fill(HIST("hSparseAntiLambdaPolC"), candmass, candpt, PolC, centrality, desbinvalue, wgtfactor); + histos.fill(HIST("hSparseAntiLambdaPolAwgt"), candmass, candpt, PolAwgt, centrality, desbinvalue, wgtfactor); + histos.fill(HIST("hSparseAntiLambdaPolCwgt"), candmass, candpt, PolCwgt, centrality, desbinvalue, wgtfactor); } - histos.fill(HIST("hSparseAntiLambdaPol"), candmass, candpt, Pol, centrality, desbinvalue); - histos.fill(HIST("hSparseAntiLambdaPolwgt"), candmass, candpt, Polwgt, centrality, desbinvalue); - histos.fill(HIST("hSparseAntiLambda_corr1a"), candmass, candpt, sinPhiStar, centrality, desbinvalue); - histos.fill(HIST("hSparseAntiLambda_corr1b"), candmass, candpt, cosPhiStar, centrality, desbinvalue); - // histos.fill(HIST("hSparseAntiLambda_corr1c"), candmass, candpt, phiphiStar, centrality, desbinvalue); - histos.fill(HIST("hSparseAntiLambda_corr2a"), candmass, candpt, sinThetaStar, centrality, desbinvalue); - // histos.fill(HIST("hSparseAntiLambda_corr2b"), candmass, candpt, sinThetaStarcosphiphiStar, centrality, desbinvalue); + histos.fill(HIST("hSparseAntiLambdaPol"), candmass, candpt, Pol, centrality, desbinvalue, wgtfactor); + histos.fill(HIST("hSparseAntiLambdaPolwgt"), candmass, candpt, Polwgt, centrality, desbinvalue, wgtfactor); + histos.fill(HIST("hSparseAntiLambda_corr1a"), candmass, candpt, sinPhiStar, centrality, desbinvalue, wgtfactor); + histos.fill(HIST("hSparseAntiLambda_corr1b"), candmass, candpt, cosPhiStar, centrality, desbinvalue, wgtfactor); + // histos.fill(HIST("hSparseAntiLambda_corr1c"), candmass, candpt, phiphiStar, centrality, desbinvalue, wgtfactor); + histos.fill(HIST("hSparseAntiLambda_corr2a"), candmass, candpt, sinThetaStar, centrality, desbinvalue, wgtfactor); + // histos.fill(HIST("hSparseAntiLambda_corr2b"), candmass, candpt, sinThetaStarcosphiphiStar, centrality, desbinvalue, wgtfactor); } else { if (usesubdet) { - histos.fill(HIST("hSparseAntiLambdaCosPsiA"), candmass, candpt, (TMath::Cos(GetPhiInRange(psiZDCA))), centrality); - histos.fill(HIST("hSparseAntiLambdaCosPsiC"), candmass, candpt, (TMath::Cos(GetPhiInRange(psiZDCC))), centrality); - histos.fill(HIST("hSparseAntiLambdaSinPsiA"), candmass, candpt, (TMath::Sin(GetPhiInRange(psiZDCA))), centrality); - histos.fill(HIST("hSparseAntiLambdaSinPsiC"), candmass, candpt, (TMath::Sin(GetPhiInRange(psiZDCC))), centrality); + histos.fill(HIST("hSparseAntiLambdaCosPsiA"), candmass, candpt, (TMath::Cos(GetPhiInRange(psiZDCA))), centrality, wgtfactor); + histos.fill(HIST("hSparseAntiLambdaCosPsiC"), candmass, candpt, (TMath::Cos(GetPhiInRange(psiZDCC))), centrality, wgtfactor); + histos.fill(HIST("hSparseAntiLambdaSinPsiA"), candmass, candpt, (TMath::Sin(GetPhiInRange(psiZDCA))), centrality, wgtfactor); + histos.fill(HIST("hSparseAntiLambdaSinPsiC"), candmass, candpt, (TMath::Sin(GetPhiInRange(psiZDCC))), centrality, wgtfactor); } - histos.fill(HIST("hSparseAntiLambdaCosPsi"), candmass, candpt, (TMath::Cos(GetPhiInRange(psiZDC))), centrality); - histos.fill(HIST("hSparseAntiLambdaSinPsi"), candmass, candpt, (TMath::Sin(GetPhiInRange(psiZDC))), centrality); + histos.fill(HIST("hSparseAntiLambdaCosPsi"), candmass, candpt, (TMath::Cos(GetPhiInRange(psiZDC))), centrality, wgtfactor); + histos.fill(HIST("hSparseAntiLambdaSinPsi"), candmass, candpt, (TMath::Sin(GetPhiInRange(psiZDC))), centrality, wgtfactor); if (usesubdet) { - histos.fill(HIST("hSparseAntiLambdaPolA"), candmass, candpt, PolA, centrality); - histos.fill(HIST("hSparseAntiLambdaPolC"), candmass, candpt, PolC, centrality); - histos.fill(HIST("hSparseAntiLambdaPolAwgt"), candmass, candpt, PolAwgt, centrality); - histos.fill(HIST("hSparseAntiLambdaPolCwgt"), candmass, candpt, PolCwgt, centrality); + histos.fill(HIST("hSparseAntiLambdaPolA"), candmass, candpt, PolA, centrality, wgtfactor); + histos.fill(HIST("hSparseAntiLambdaPolC"), candmass, candpt, PolC, centrality, wgtfactor); + histos.fill(HIST("hSparseAntiLambdaPolAwgt"), candmass, candpt, PolAwgt, centrality, wgtfactor); + histos.fill(HIST("hSparseAntiLambdaPolCwgt"), candmass, candpt, PolCwgt, centrality, wgtfactor); } - histos.fill(HIST("hSparseAntiLambdaPol"), candmass, candpt, Pol, centrality); - histos.fill(HIST("hSparseAntiLambdaPolwgt"), candmass, candpt, Polwgt, centrality); - histos.fill(HIST("hSparseAntiLambda_corr1a"), candmass, candpt, sinPhiStar, centrality); - histos.fill(HIST("hSparseAntiLambda_corr1b"), candmass, candpt, cosPhiStar, centrality); - // histos.fill(HIST("hSparseAntiLambda_corr1c"), candmass, candpt, phiphiStar, centrality); - histos.fill(HIST("hSparseAntiLambda_corr2a"), candmass, candpt, sinThetaStar, centrality); - // histos.fill(HIST("hSparseAntiLambda_corr2b"), candmass, candpt, sinThetaStarcosphiphiStar, centrality); + histos.fill(HIST("hSparseAntiLambdaPol"), candmass, candpt, Pol, centrality, wgtfactor); + histos.fill(HIST("hSparseAntiLambdaPolwgt"), candmass, candpt, Polwgt, centrality, wgtfactor); + histos.fill(HIST("hSparseAntiLambda_corr1a"), candmass, candpt, sinPhiStar, centrality, wgtfactor); + histos.fill(HIST("hSparseAntiLambda_corr1b"), candmass, candpt, cosPhiStar, centrality, wgtfactor); + // histos.fill(HIST("hSparseAntiLambda_corr1c"), candmass, candpt, phiphiStar, centrality, wgtfactor); + histos.fill(HIST("hSparseAntiLambda_corr2a"), candmass, candpt, sinThetaStar, centrality, wgtfactor); + // histos.fill(HIST("hSparseAntiLambda_corr2b"), candmass, candpt, sinThetaStarcosphiphiStar, centrality, wgtfactor); } } if (tag1) { if (needetaaxis) { if (usesubdet) { - histos.fill(HIST("hSparseLambdaCosPsiA"), candmass, candpt, (TMath::Cos(GetPhiInRange(psiZDCA))), centrality, desbinvalue); - histos.fill(HIST("hSparseLambdaCosPsiC"), candmass, candpt, (TMath::Cos(GetPhiInRange(psiZDCC))), centrality, desbinvalue); - histos.fill(HIST("hSparseLambdaSinPsiA"), candmass, candpt, (TMath::Sin(GetPhiInRange(psiZDCA))), centrality, desbinvalue); - histos.fill(HIST("hSparseLambdaSinPsiC"), candmass, candpt, (TMath::Sin(GetPhiInRange(psiZDCC))), centrality, desbinvalue); + histos.fill(HIST("hSparseLambdaCosPsiA"), candmass, candpt, (TMath::Cos(GetPhiInRange(psiZDCA))), centrality, desbinvalue, wgtfactor); + histos.fill(HIST("hSparseLambdaCosPsiC"), candmass, candpt, (TMath::Cos(GetPhiInRange(psiZDCC))), centrality, desbinvalue, wgtfactor); + histos.fill(HIST("hSparseLambdaSinPsiA"), candmass, candpt, (TMath::Sin(GetPhiInRange(psiZDCA))), centrality, desbinvalue, wgtfactor); + histos.fill(HIST("hSparseLambdaSinPsiC"), candmass, candpt, (TMath::Sin(GetPhiInRange(psiZDCC))), centrality, desbinvalue, wgtfactor); } - histos.fill(HIST("hSparseLambdaCosPsi"), candmass, candpt, (TMath::Cos(GetPhiInRange(psiZDC))), centrality, desbinvalue); - histos.fill(HIST("hSparseLambdaSinPsi"), candmass, candpt, (TMath::Sin(GetPhiInRange(psiZDC))), centrality, desbinvalue); + histos.fill(HIST("hSparseLambdaCosPsi"), candmass, candpt, (TMath::Cos(GetPhiInRange(psiZDC))), centrality, desbinvalue, wgtfactor); + histos.fill(HIST("hSparseLambdaSinPsi"), candmass, candpt, (TMath::Sin(GetPhiInRange(psiZDC))), centrality, desbinvalue, wgtfactor); if (usesubdet) { - histos.fill(HIST("hSparseLambdaPolA"), candmass, candpt, PolA, centrality, desbinvalue); - histos.fill(HIST("hSparseLambdaPolC"), candmass, candpt, PolC, centrality, desbinvalue); - histos.fill(HIST("hSparseLambdaPolAwgt"), candmass, candpt, PolAwgt, centrality, desbinvalue); - histos.fill(HIST("hSparseLambdaPolCwgt"), candmass, candpt, PolCwgt, centrality, desbinvalue); + histos.fill(HIST("hSparseLambdaPolA"), candmass, candpt, PolA, centrality, desbinvalue, wgtfactor); + histos.fill(HIST("hSparseLambdaPolC"), candmass, candpt, PolC, centrality, desbinvalue, wgtfactor); + histos.fill(HIST("hSparseLambdaPolAwgt"), candmass, candpt, PolAwgt, centrality, desbinvalue, wgtfactor); + histos.fill(HIST("hSparseLambdaPolCwgt"), candmass, candpt, PolCwgt, centrality, desbinvalue, wgtfactor); } - histos.fill(HIST("hSparseLambdaPol"), candmass, candpt, Pol, centrality, desbinvalue); - histos.fill(HIST("hSparseLambdaPolwgt"), candmass, candpt, Polwgt, centrality, desbinvalue); - histos.fill(HIST("hSparseLambda_corr1a"), candmass, candpt, sinPhiStar, centrality, desbinvalue); - histos.fill(HIST("hSparseLambda_corr1b"), candmass, candpt, cosPhiStar, centrality, desbinvalue); - // histos.fill(HIST("hSparseLambda_corr1c"), candmass, candpt, phiphiStar, centrality, desbinvalue); - histos.fill(HIST("hSparseLambda_corr2a"), candmass, candpt, sinThetaStar, centrality, desbinvalue); - // histos.fill(HIST("hSparseLambda_corr2b"), candmass, candpt, sinThetaStarcosphiphiStar, centrality, desbinvalue); + histos.fill(HIST("hSparseLambdaPol"), candmass, candpt, Pol, centrality, desbinvalue, wgtfactor); + histos.fill(HIST("hSparseLambdaPolwgt"), candmass, candpt, Polwgt, centrality, desbinvalue, wgtfactor); + histos.fill(HIST("hSparseLambda_corr1a"), candmass, candpt, sinPhiStar, centrality, desbinvalue, wgtfactor); + histos.fill(HIST("hSparseLambda_corr1b"), candmass, candpt, cosPhiStar, centrality, desbinvalue, wgtfactor); + // histos.fill(HIST("hSparseLambda_corr1c"), candmass, candpt, phiphiStar, centrality, desbinvalue, wgtfactor); + histos.fill(HIST("hSparseLambda_corr2a"), candmass, candpt, sinThetaStar, centrality, desbinvalue, wgtfactor); + // histos.fill(HIST("hSparseLambda_corr2b"), candmass, candpt, sinThetaStarcosphiphiStar, centrality, desbinvalue, wgtfactor); } else { if (usesubdet) { - histos.fill(HIST("hSparseLambdaCosPsiA"), candmass, candpt, (TMath::Cos(GetPhiInRange(psiZDCA))), centrality); - histos.fill(HIST("hSparseLambdaCosPsiC"), candmass, candpt, (TMath::Cos(GetPhiInRange(psiZDCC))), centrality); - histos.fill(HIST("hSparseLambdaSinPsiA"), candmass, candpt, (TMath::Sin(GetPhiInRange(psiZDCA))), centrality); - histos.fill(HIST("hSparseLambdaSinPsiC"), candmass, candpt, (TMath::Sin(GetPhiInRange(psiZDCC))), centrality); + histos.fill(HIST("hSparseLambdaCosPsiA"), candmass, candpt, (TMath::Cos(GetPhiInRange(psiZDCA))), centrality, wgtfactor); + histos.fill(HIST("hSparseLambdaCosPsiC"), candmass, candpt, (TMath::Cos(GetPhiInRange(psiZDCC))), centrality, wgtfactor); + histos.fill(HIST("hSparseLambdaSinPsiA"), candmass, candpt, (TMath::Sin(GetPhiInRange(psiZDCA))), centrality, wgtfactor); + histos.fill(HIST("hSparseLambdaSinPsiC"), candmass, candpt, (TMath::Sin(GetPhiInRange(psiZDCC))), centrality, wgtfactor); } - histos.fill(HIST("hSparseLambdaCosPsi"), candmass, candpt, (TMath::Cos(GetPhiInRange(psiZDC))), centrality); - histos.fill(HIST("hSparseLambdaSinPsi"), candmass, candpt, (TMath::Sin(GetPhiInRange(psiZDC))), centrality); + histos.fill(HIST("hSparseLambdaCosPsi"), candmass, candpt, (TMath::Cos(GetPhiInRange(psiZDC))), centrality, wgtfactor); + histos.fill(HIST("hSparseLambdaSinPsi"), candmass, candpt, (TMath::Sin(GetPhiInRange(psiZDC))), centrality, wgtfactor); if (usesubdet) { - histos.fill(HIST("hSparseLambdaPolA"), candmass, candpt, PolA, centrality); - histos.fill(HIST("hSparseLambdaPolC"), candmass, candpt, PolC, centrality); - histos.fill(HIST("hSparseLambdaPolAwgt"), candmass, candpt, PolAwgt, centrality); - histos.fill(HIST("hSparseLambdaPolCwgt"), candmass, candpt, PolCwgt, centrality); + histos.fill(HIST("hSparseLambdaPolA"), candmass, candpt, PolA, centrality, wgtfactor); + histos.fill(HIST("hSparseLambdaPolC"), candmass, candpt, PolC, centrality, wgtfactor); + histos.fill(HIST("hSparseLambdaPolAwgt"), candmass, candpt, PolAwgt, centrality, wgtfactor); + histos.fill(HIST("hSparseLambdaPolCwgt"), candmass, candpt, PolCwgt, centrality, wgtfactor); } - histos.fill(HIST("hSparseLambdaPol"), candmass, candpt, Pol, centrality); - histos.fill(HIST("hSparseLambdaPolwgt"), candmass, candpt, Polwgt, centrality); - histos.fill(HIST("hSparseLambda_corr1a"), candmass, candpt, sinPhiStar, centrality); - histos.fill(HIST("hSparseLambda_corr1b"), candmass, candpt, cosPhiStar, centrality); - // histos.fill(HIST("hSparseLambda_corr1c"), candmass, candpt, phiphiStar, centrality); - histos.fill(HIST("hSparseLambda_corr2a"), candmass, candpt, sinThetaStar, centrality); - // histos.fill(HIST("hSparseLambda_corr2b"), candmass, candpt, sinThetaStarcosphiphiStar, centrality); + histos.fill(HIST("hSparseLambdaPol"), candmass, candpt, Pol, centrality, wgtfactor); + histos.fill(HIST("hSparseLambdaPolwgt"), candmass, candpt, Polwgt, centrality, wgtfactor); + histos.fill(HIST("hSparseLambda_corr1a"), candmass, candpt, sinPhiStar, centrality, wgtfactor); + histos.fill(HIST("hSparseLambda_corr1b"), candmass, candpt, cosPhiStar, centrality, wgtfactor); + // histos.fill(HIST("hSparseLambda_corr1c"), candmass, candpt, phiphiStar, centrality, wgtfactor); + histos.fill(HIST("hSparseLambda_corr2a"), candmass, candpt, sinThetaStar, centrality, wgtfactor); + // histos.fill(HIST("hSparseLambda_corr2b"), candmass, candpt, sinThetaStarcosphiphiStar, centrality, wgtfactor); } } } @@ -1036,6 +1052,14 @@ struct lambdapolsp { accprofileL = ccdb->getForTimeStamp(ConfAccPathL.value, bc.timestamp()); accprofileAL = ccdb->getForTimeStamp(ConfAccPathAL.value, bc.timestamp()); } + int binxwgt; + double wgtvalue; + if (useyldwgt) { + binxwgt = hwgtAL->GetXaxis()->FindBin(v0.pt()); + wgtvalue = hwgtAL->GetBinContent(binxwgt); + } else { + wgtvalue = 1.0; + } float desbinvalue = 0.0; if (dosystematic) { @@ -1094,7 +1118,7 @@ struct lambdapolsp { int binx = accprofileL->GetXaxis()->FindBin(v0.eta()); int biny = accprofileL->GetYaxis()->FindBin(v0.pt()); double acvalue = accprofileL->GetBinContent(binx, biny); - fillHistograms(taga, tagb, Lambda, Proton, psiZDCC, psiZDCA, psiZDC, centrality, v0.mLambda(), v0.pt(), desbinvalue, acvalue); + fillHistograms(taga, tagb, Lambda, Proton, psiZDCC, psiZDCA, psiZDC, centrality, v0.mLambda(), v0.pt(), desbinvalue, acvalue, 1.0); } tagb = aLambdaTag; @@ -1104,7 +1128,7 @@ struct lambdapolsp { int binx = accprofileAL->GetXaxis()->FindBin(v0.eta()); int biny = accprofileAL->GetYaxis()->FindBin(v0.pt()); double acvalue = accprofileAL->GetBinContent(binx, biny); - fillHistograms(taga, tagb, AntiLambda, AntiProton, psiZDCC, psiZDCA, psiZDC, centrality, v0.mAntiLambda(), v0.pt(), desbinvalue, acvalue); + fillHistograms(taga, tagb, AntiLambda, AntiProton, psiZDCC, psiZDCA, psiZDC, centrality, v0.mAntiLambda(), v0.pt(), desbinvalue, acvalue, 1.0); } } } else { @@ -1114,7 +1138,7 @@ struct lambdapolsp { int binx = accprofileL->GetXaxis()->FindBin(v0.eta()); int biny = accprofileL->GetYaxis()->FindBin(v0.pt()); double acvalue = accprofileL->GetBinContent(binx, biny); - fillHistograms(taga, tagb, Lambda, Proton, psiZDCC, psiZDCA, psiZDC, centrality, v0.mLambda(), v0.pt(), v0.eta(), acvalue); + fillHistograms(taga, tagb, Lambda, Proton, psiZDCC, psiZDCA, psiZDC, centrality, v0.mLambda(), v0.pt(), v0.eta(), acvalue, 1.0); } tagb = aLambdaTag; @@ -1124,7 +1148,7 @@ struct lambdapolsp { int binx = accprofileAL->GetXaxis()->FindBin(v0.eta()); int biny = accprofileAL->GetYaxis()->FindBin(v0.pt()); double acvalue = accprofileAL->GetBinContent(binx, biny); - fillHistograms(taga, tagb, AntiLambda, AntiProton, psiZDCC, psiZDCA, psiZDC, centrality, v0.mAntiLambda(), v0.pt(), v0.eta(), acvalue); + fillHistograms(taga, tagb, AntiLambda, AntiProton, psiZDCC, psiZDCA, psiZDC, centrality, v0.mAntiLambda(), v0.pt(), v0.eta(), acvalue, wgtvalue); } } } @@ -1276,7 +1300,7 @@ struct lambdapolsp { if (analyzeK0s && K0sTag) { K0s = Pion + AntiPion; double acvalue = 1.0; - fillHistograms(tagc, 0, K0s, Pion, psiZDCC, psiZDCA, psiZDC, centrality, v0.mK0Short(), v0.pt(), v0.eta(), acvalue); + fillHistograms(tagc, 0, K0s, Pion, psiZDCC, psiZDCA, psiZDC, centrality, v0.mK0Short(), v0.pt(), v0.eta(), acvalue, 1.0); } if (analyzeLambda && dosystematic) { @@ -1333,7 +1357,7 @@ struct lambdapolsp { Lambda = Proton + AntiPion; tagb = 0; double acvalue = 1.0; - fillHistograms(taga, tagb, Lambda, Proton, psiZDCC, psiZDCA, psiZDC, centrality, v0.mLambda(), v0.pt(), desbinvalue, acvalue); + fillHistograms(taga, tagb, Lambda, Proton, psiZDCC, psiZDCA, psiZDC, centrality, v0.mLambda(), v0.pt(), desbinvalue, acvalue, 1.0); } tagb = aLambdaTag; @@ -1341,7 +1365,7 @@ struct lambdapolsp { AntiLambda = AntiProton + Pion; taga = 0; double acvalue = 1.0; - fillHistograms(taga, tagb, AntiLambda, AntiProton, psiZDCC, psiZDCA, psiZDC, centrality, v0.mAntiLambda(), v0.pt(), desbinvalue, acvalue); + fillHistograms(taga, tagb, AntiLambda, AntiProton, psiZDCC, psiZDCA, psiZDC, centrality, v0.mAntiLambda(), v0.pt(), desbinvalue, acvalue, 1.0); } } } else { @@ -1349,7 +1373,7 @@ struct lambdapolsp { Lambda = Proton + AntiPion; tagb = 0; double acvalue = 1.0; - fillHistograms(taga, tagb, Lambda, Proton, psiZDCC, psiZDCA, psiZDC, centrality, v0.mLambda(), v0.pt(), v0.eta(), acvalue); + fillHistograms(taga, tagb, Lambda, Proton, psiZDCC, psiZDCA, psiZDC, centrality, v0.mLambda(), v0.pt(), v0.eta(), acvalue, 1.0); } tagb = aLambdaTag; @@ -1357,7 +1381,7 @@ struct lambdapolsp { AntiLambda = AntiProton + Pion; taga = 0; double acvalue = 1.0; - fillHistograms(taga, tagb, AntiLambda, AntiProton, psiZDCC, psiZDCA, psiZDC, centrality, v0.mAntiLambda(), v0.pt(), v0.eta(), acvalue); + fillHistograms(taga, tagb, AntiLambda, AntiProton, psiZDCC, psiZDCA, psiZDC, centrality, v0.mAntiLambda(), v0.pt(), v0.eta(), acvalue, 1.0); } } } @@ -1489,7 +1513,7 @@ struct lambdapolsp { Lambda = Proton + AntiPion; tagb = 0; double acvalue = 1.0; - fillHistograms(taga, tagb, Lambda, Proton, psiZDCC, psiZDCA, psiZDC, centrality, v0.mLambda(), v0.pt(), v0.eta(), acvalue); + fillHistograms(taga, tagb, Lambda, Proton, psiZDCC, psiZDCA, psiZDC, centrality, v0.mLambda(), v0.pt(), v0.eta(), acvalue, 1.0); } tagb = aLambdaTag; @@ -1497,7 +1521,7 @@ struct lambdapolsp { AntiLambda = AntiProton + Pion; taga = 0; double acvalue = 1.0; - fillHistograms(taga, tagb, AntiLambda, AntiProton, psiZDCC, psiZDCA, psiZDC, centrality, v0.mAntiLambda(), v0.pt(), v0.eta(), acvalue); + fillHistograms(taga, tagb, AntiLambda, AntiProton, psiZDCC, psiZDCA, psiZDC, centrality, v0.mAntiLambda(), v0.pt(), v0.eta(), acvalue, 1.0); } } } @@ -1642,7 +1666,7 @@ struct lambdapolsp { Lambda = Proton + AntiPion; tagb = 0; double acvalue = 1.0; - fillHistograms(taga, tagb, Lambda, Proton, psiZDCC, psiZDCA, psiZDC, centrality, v0_2.mLambda(), v0_2.pt(), v0_2.eta(), acvalue); + fillHistograms(taga, tagb, Lambda, Proton, psiZDCC, psiZDCA, psiZDC, centrality, v0_2.mLambda(), v0_2.pt(), v0_2.eta(), acvalue, 1.0); } tagb = aLambdaTag; @@ -1650,7 +1674,7 @@ struct lambdapolsp { AntiLambda = AntiProton + Pion; taga = 0; double acvalue = 1.0; - fillHistograms(taga, tagb, AntiLambda, AntiProton, psiZDCC, psiZDCA, psiZDC, centrality, v0_2.mAntiLambda(), v0_2.pt(), v0_2.eta(), acvalue); + fillHistograms(taga, tagb, AntiLambda, AntiProton, psiZDCC, psiZDCA, psiZDC, centrality, v0_2.mAntiLambda(), v0_2.pt(), v0_2.eta(), acvalue, 1.0); } } } @@ -1781,11 +1805,11 @@ struct lambdapolsp { continue; if (LambdaTag1) { double acvalue = 1.0; - fillHistograms(1, 0, LambdaTag1dummy, proton_mix, psiZDCC, psiZDCA, psiZDC, centrality, v0_evt1.mLambda(), v0_evt1.pt(), v0_evt1.eta(), acvalue); + fillHistograms(1, 0, LambdaTag1dummy, proton_mix, psiZDCC, psiZDCA, psiZDC, centrality, v0_evt1.mLambda(), v0_evt1.pt(), v0_evt1.eta(), acvalue, 1.0); } if (aLambdaTag1) { double acvalue = 1.0; - fillHistograms(0, 1, AntiLambdaTag1dummy, antiproton_mix, psiZDCC, psiZDCA, psiZDC, centrality, v0_evt1.mAntiLambda(), v0_evt1.pt(), v0_evt1.eta(), acvalue); + fillHistograms(0, 1, AntiLambdaTag1dummy, antiproton_mix, psiZDCC, psiZDCA, psiZDC, centrality, v0_evt1.mAntiLambda(), v0_evt1.pt(), v0_evt1.eta(), acvalue, 1.0); } } } From d5b0474fe71f87e9214be95f3b73709f38804378 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Sun, 10 Aug 2025 17:34:08 +0200 Subject: [PATCH 319/345] [Common] fix bug in z-vertex eq for Nglobal estimator (#12516) --- Common/Tools/MultModule.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Common/Tools/MultModule.h b/Common/Tools/MultModule.h index 479c777b5e6..2250717a601 100644 --- a/Common/Tools/MultModule.h +++ b/Common/Tools/MultModule.h @@ -862,7 +862,7 @@ class MultModule if (!hVtxZNGlobalTracks || std::fabs(collision.posZ()) > 15.0f) { mults.multGlobalTracksZeq = mults.multGlobalTracks; // if no equalization available, don't do it } else { - mults.multGlobalTracksZeq = hVtxZNGlobalTracks->Interpolate(0.0) * mults.multFT0C / hVtxZNGlobalTracks->Interpolate(collision.posZ()); + mults.multGlobalTracksZeq = hVtxZNGlobalTracks->Interpolate(0.0) * mults.multGlobalTracks / hVtxZNGlobalTracks->Interpolate(collision.posZ()); } // provide vertex-Z equalized Nglobals (or non-equalized if missing or beyond range) From 3ec54544050d3568e4b4ab9cb721e7537d90ff95 Mon Sep 17 00:00:00 2001 From: Victor Gonzalez Date: Sun, 10 Aug 2025 20:36:39 +0200 Subject: [PATCH 320/345] [PWGCF] DptDpt - Applying clang for ordering header includes (#12517) Co-authored-by: Victor --- PWGCF/TableProducer/dptDptFilter.cxx | 41 +++++++------ PWGCF/TableProducer/dptDptFilter.h | 43 +++++++------ PWGCF/Tasks/dptDptCorrelations.cxx | 51 +++++++++------- PWGCF/Tasks/dptDptFilterQa.cxx | 9 +-- PWGCF/Tasks/matchRecoGen.cxx | 17 +++--- .../Tasks/dptDptEfficiencyAndQc.cxx | 61 ++++++++++--------- .../Tasks/dptDptPerRunExtraQc.cxx | 12 ++-- .../Tasks/dptDptPerRunQc.cxx | 25 ++++---- 8 files changed, 138 insertions(+), 121 deletions(-) diff --git a/PWGCF/TableProducer/dptDptFilter.cxx b/PWGCF/TableProducer/dptDptFilter.cxx index 30f55cf3c3f..c55cec45f1e 100644 --- a/PWGCF/TableProducer/dptDptFilter.cxx +++ b/PWGCF/TableProducer/dptDptFilter.cxx @@ -13,40 +13,43 @@ /// \brief Filters collisions and tracks according to selection criteria /// \author victor.gonzalez.sebastian@gmail.com -#include -#include -#include -#include +#include "PWGCF/TableProducer/dptDptFilter.h" + +#include "PWGCF/Core/AnalysisConfigurableCuts.h" +#include "PWGCF/DataModel/DptDptFiltered.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" -#include "CommonConstants/PhysicsConstants.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/Centrality.h" #include "Common/Core/TableHelper.h" #include "Common/Core/TrackSelection.h" #include "Common/Core/TrackSelectionDefaults.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/CollisionAssociationTables.h" +#include "Common/DataModel/EventSelection.h" #include "Common/DataModel/PIDResponse.h" -#include "PWGCF/Core/AnalysisConfigurableCuts.h" -#include "PWGCF/DataModel/DptDptFiltered.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/CollisionAssociationTables.h" + +#include "CommonConstants/PhysicsConstants.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" #include "Framework/O2DatabasePDGPlugin.h" -#include "Framework/runDataProcessing.h" #include "Framework/RunningWorkflowInfo.h" -#include -#include -#include -#include +#include "Framework/runDataProcessing.h" + #include #include #include #include #include +#include +#include +#include #include +#include -#include "PWGCF/TableProducer/dptDptFilter.h" +#include +#include +#include +#include using namespace o2; using namespace o2::framework; diff --git a/PWGCF/TableProducer/dptDptFilter.h b/PWGCF/TableProducer/dptDptFilter.h index 18076266f1a..b107156d5f3 100644 --- a/PWGCF/TableProducer/dptDptFilter.h +++ b/PWGCF/TableProducer/dptDptFilter.h @@ -16,33 +16,36 @@ #ifndef PWGCF_TABLEPRODUCER_DPTDPTFILTER_H_ #define PWGCF_TABLEPRODUCER_DPTDPTFILTER_H_ +#include "PWGCF/Core/AnalysisConfigurableCuts.h" + +#include "Common/Core/RecoDecay.h" +#include "Common/Core/TrackSelection.h" +#include "Common/Core/TrackSelectionDefaults.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "ReconstructionDataFormats/PID.h" #include -#include -#include + #include #include -#include +#include +#include + #include -#include -#include #include -#include -#include -#include #include +#include +#include #include - -#include "ReconstructionDataFormats/PID.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/Centrality.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/Core/RecoDecay.h" -#include "Common/Core/TrackSelection.h" -#include "Common/Core/TrackSelectionDefaults.h" -#include "PWGCF/Core/AnalysisConfigurableCuts.h" +#include +#include +#include +#include namespace o2 { diff --git a/PWGCF/Tasks/dptDptCorrelations.cxx b/PWGCF/Tasks/dptDptCorrelations.cxx index 065e4be286f..07754ef5316 100644 --- a/PWGCF/Tasks/dptDptCorrelations.cxx +++ b/PWGCF/Tasks/dptDptCorrelations.cxx @@ -13,7 +13,26 @@ /// \brief implements two-particle correlations base data collection /// \author victor.gonzalez.sebastian@gmail.com +#include "PWGCF/Core/AnalysisConfigurableCuts.h" +#include "PWGCF/Core/PairCuts.h" +#include "PWGCF/DataModel/DptDptFiltered.h" +#include "PWGCF/TableProducer/dptDptFilter.h" + +#include "Common/Core/RecoDecay.h" +#include "Common/Core/TableHelper.h" +#include "Common/Core/TrackSelection.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "DataFormatsParameters/GRPObject.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/runDataProcessing.h" #include + #include #include #include @@ -24,28 +43,12 @@ #include #include #include + +#include #include +#include #include #include -#include -#include - -#include "Common/Core/TrackSelection.h" -#include "Common/Core/TableHelper.h" -#include "Common/Core/RecoDecay.h" -#include "Common/DataModel/Centrality.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "DataFormatsParameters/GRPObject.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" -#include "Framework/RunningWorkflowInfo.h" -#include "PWGCF/Core/AnalysisConfigurableCuts.h" -#include "PWGCF/Core/PairCuts.h" -#include "PWGCF/DataModel/DptDptFiltered.h" -#include "PWGCF/TableProducer/dptDptFilter.h" using namespace o2; using namespace o2::framework; @@ -279,15 +282,17 @@ struct DptDptCorrelations { photon = p1+p2; photon.M()*/ - float tantheta1 = 1e10; + constexpr float kLARGETANTHETA = 1e10; + constexpr float kVERYSMALLETA = 1e-10; + float tantheta1 = kLARGETANTHETA; - if (track1.eta() < -1e-10 || track1.eta() > 1e-10) { + if (track1.eta() < -kVERYSMALLETA || track1.eta() > kVERYSMALLETA) { float expTmp = std::exp(-track1.eta()); tantheta1 = 2.0 * expTmp / (1.0 - expTmp * expTmp); } - float tantheta2 = 1e10; - if (track2.eta() < -1e-10 || track2.eta() > 1e-10) { + float tantheta2 = kLARGETANTHETA; + if (track2.eta() < -kVERYSMALLETA || track2.eta() > kVERYSMALLETA) { float expTmp = std::exp(-track2.eta()); tantheta2 = 2.0 * expTmp / (1.0 - expTmp * expTmp); } diff --git a/PWGCF/Tasks/dptDptFilterQa.cxx b/PWGCF/Tasks/dptDptFilterQa.cxx index 85dee751438..876fd8ccb5e 100644 --- a/PWGCF/Tasks/dptDptFilterQa.cxx +++ b/PWGCF/Tasks/dptDptFilterQa.cxx @@ -13,15 +13,16 @@ /// \brief basic checks for the behavior of the filter task /// \author victor.gonzalez.sebastian@gmail.com -#include -#include +#include "PWGCF/DataModel/DptDptFiltered.h" +#include "PWGCF/TableProducer/dptDptFilter.h" #include "Framework/ASoAHelpers.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" -#include "PWGCF/DataModel/DptDptFiltered.h" -#include "PWGCF/TableProducer/dptDptFilter.h" + +#include +#include using namespace o2; using namespace o2::framework; diff --git a/PWGCF/Tasks/matchRecoGen.cxx b/PWGCF/Tasks/matchRecoGen.cxx index 57ab00301b7..1881b17b268 100644 --- a/PWGCF/Tasks/matchRecoGen.cxx +++ b/PWGCF/Tasks/matchRecoGen.cxx @@ -13,25 +13,24 @@ /// \brief basic check for the matching between generator level and detector level /// \author victor.gonzalez.sebastian@gmail.com -#include -#include -#include +#include "PWGCF/Core/AnalysisConfigurableCuts.h" +#include "PWGCF/DataModel/DptDptFiltered.h" +#include "PWGCF/TableProducer/dptDptFilter.h" +#include "Common/Core/RecoDecay.h" #include "Common/Core/TrackSelection.h" #include "Common/Core/TrackSelectionDefaults.h" -#include "Common/Core/RecoDecay.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/TrackSelectionTables.h" + #include "Framework/ASoAHelpers.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" #include "Framework/O2DatabasePDGPlugin.h" #include "Framework/runDataProcessing.h" -#include "PWGCF/Core/AnalysisConfigurableCuts.h" -#include "PWGCF/DataModel/DptDptFiltered.h" -#include "PWGCF/TableProducer/dptDptFilter.h" + #include #include #include @@ -42,6 +41,10 @@ #include #include +#include +#include +#include + using namespace o2; using namespace o2::framework; using namespace o2::soa; diff --git a/PWGCF/TwoParticleCorrelations/Tasks/dptDptEfficiencyAndQc.cxx b/PWGCF/TwoParticleCorrelations/Tasks/dptDptEfficiencyAndQc.cxx index 0fdbca208bf..b561f50af0e 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/dptDptEfficiencyAndQc.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/dptDptEfficiencyAndQc.cxx @@ -13,35 +13,38 @@ /// \brief Provides efficiency extraction and QC for track cuts and PID /// \author victor.gonzalez.sebastian@gmail.com -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "ReconstructionDataFormats/PID.h" -#include "Common/Core/TrackSelection.h" -#include "Common/Core/TableHelper.h" +#include "PWGCF/Core/AnalysisConfigurableCuts.h" +#include "PWGCF/DataModel/DptDptFiltered.h" +#include "PWGCF/TableProducer/dptDptFilter.h" + #include "Common/Core/RecoDecay.h" -#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/Core/TableHelper.h" +#include "Common/Core/TrackSelection.h" #include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" + #include "Framework/ASoAHelpers.h" -#include "Framework/Expressions.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" +#include "Framework/Expressions.h" #include "Framework/RunningWorkflowInfo.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/PID.h" +#include + #include "Math/MatrixFunctions.h" #include "Math/SMatrix.h" +#include +#include +#include +#include +#include -#include "PWGCF/Core/AnalysisConfigurableCuts.h" -#include "PWGCF/DataModel/DptDptFiltered.h" -#include "PWGCF/TableProducer/dptDptFilter.h" +#include +#include +#include +#include +#include using namespace o2; using namespace o2::framework; @@ -741,41 +744,41 @@ struct PidDataCollectingEngine { if constexpr (kindOfData == kReco) { /* PID histograms */ std::vector whenname{"Before", "After"}; - constexpr char whenprefix[kNoOfSteps]{'B', 'A'}; + constexpr char kWhenPrefix[kNoOfSteps]{'B', 'A'}; std::vector whentitle{"before", ""}; for (uint ix = 0; ix < kNoOfSteps; ++ix) { fhTPCdEdxSignalVsP[ix] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "PID", whenname[ix].c_str()), - HNAMESTRING("tpcSignalVsP%c", whenprefix[ix]), + HNAMESTRING("tpcSignalVsP%c", kWhenPrefix[ix]), HTITLESTRING("TPC dE/dx signal %s", whentitle[ix].c_str()), kTH2F, {pidPAxis, dEdxAxis}); fhTOFSignalVsP[ix] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "PID", whenname[ix].c_str()), - HNAMESTRING("tofSignalVsP%c", whenprefix[ix]), + HNAMESTRING("tofSignalVsP%c", kWhenPrefix[ix]), HTITLESTRING("TOF signal %s", whentitle[ix].c_str()), kTH2F, {pidPAxis, {200, 0.0, 1.1, "#beta"}}); fhPvsTOFSqMass[ix] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "PID", whenname[ix].c_str()), - HNAMESTRING("tofPvsMassSq%c", whenprefix[ix]), + HNAMESTRING("tofPvsMassSq%c", kWhenPrefix[ix]), HTITLESTRING("Momentum versus #it{m}^{2} %s", whentitle[ix].c_str()), kTH2F, {{140, 0.0, 1.4, "#it{m}^{2} ((GeV/c^{2})^{2})"}, pidPAxis}); for (uint isp = 0; isp < nmainsp; ++isp) { fhTPCdEdxSignalDiffVsP[ix][isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "PID", whenname[ix].c_str()), - HNAMESTRING("tpcSignalDiffVsP%c_%s", whenprefix[ix], mainspnames[isp].c_str()), + HNAMESTRING("tpcSignalDiffVsP%c_%s", kWhenPrefix[ix], mainspnames[isp].c_str()), HTITLESTRING("TPC dE/dx to the %s line %s", mainsptitles[isp].c_str(), whentitle[ix].c_str()), kTH2F, {pidPAxis, {400, -200.0, 200.0, FORMATSTRING("dE/dx - _{%s}", mainsptitles[isp].c_str())}}); fhTOFSignalDiffVsP[ix][isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "PID", whenname[ix].c_str()), - HNAMESTRING("tofSignalDiffVsP%c_%s", whenprefix[ix], mainspnames[isp].c_str()), + HNAMESTRING("tofSignalDiffVsP%c_%s", kWhenPrefix[ix], mainspnames[isp].c_str()), HTITLESTRING("#Delta^{TOF_{%s}} %s", mainsptitles[isp].c_str(), whentitle[ix].c_str()), kTH2F, {pidPAxis, {200, -1000.0, 1000.0, FORMATSTRING("t-t_{ev}-t_{exp_{%s}} (ps)", mainsptitles[isp].c_str())}}); fhTPCTOFSigmaVsP[ix][isp] = ADDHISTOGRAM(TH3, DIRECTORYSTRING("%s/%s/%s", dirname, "PID", whenname[ix].c_str()), - HNAMESTRING("toftpcNSigmasVsP%c_%s", whenprefix[ix], mainspnames[isp].c_str()), + HNAMESTRING("toftpcNSigmasVsP%c_%s", kWhenPrefix[ix], mainspnames[isp].c_str()), HTITLESTRING("n#sigma to the %s line %s", mainsptitles[isp].c_str(), whentitle[ix].c_str()), kTH3F, {pidPAxis, {noOfNSigmaBins, minNSigma, maxNSigma, FORMATSTRING("n#sigma_{TPC}^{%s}", mainsptitles[isp].c_str())}, {120, -6.0, 6.0, FORMATSTRING("n#sigma_{TOF}^{%s}", mainsptitles[isp].c_str())}}); } for (uint isp = 0; isp < nallmainsp; ++isp) { fhTPCnSigmasVsP[ix][isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "PID", whenname[ix].c_str()), - HNAMESTRING("tpcNSigmasVsP%c_%s", whenprefix[ix], allmainspnames[isp].c_str()), + HNAMESTRING("tpcNSigmasVsP%c_%s", kWhenPrefix[ix], allmainspnames[isp].c_str()), HTITLESTRING("TPC n#sigma to the %s line %s", allmainsptitles[isp].c_str(), whentitle[ix].c_str()), kTH2F, {pidPAxis, {noOfNSigmaBins, minNSigma, maxNSigma, FORMATSTRING("n#sigma_{TPC}^{%s}", allmainsptitles[isp].c_str())}}); fhTOFnSigmasVsP[ix][isp] = ADDHISTOGRAM(TH2, DIRECTORYSTRING("%s/%s/%s", dirname, "PID", whenname[ix].c_str()), - HNAMESTRING("tofNSigmasVsP%c_%s", whenprefix[ix], allmainspnames[isp].c_str()), + HNAMESTRING("tofNSigmasVsP%c_%s", kWhenPrefix[ix], allmainspnames[isp].c_str()), HTITLESTRING("TOF n#sigma to the %s line %s", allmainsptitles[isp].c_str(), whentitle[ix].c_str()), kTH2F, {pidPAxis, {noOfNSigmaBins, minNSigma, maxNSigma, FORMATSTRING("n#sigma_{TOF}^{%s}", allmainsptitles[isp].c_str())}}); } diff --git a/PWGCF/TwoParticleCorrelations/Tasks/dptDptPerRunExtraQc.cxx b/PWGCF/TwoParticleCorrelations/Tasks/dptDptPerRunExtraQc.cxx index 8617a65de2f..c9304ec1ef9 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/dptDptPerRunExtraQc.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/dptDptPerRunExtraQc.cxx @@ -13,18 +13,18 @@ /// \brief basic per run check of the per analyzed species p vs TPC IW momentum /// \author victor.gonzalez.sebastian@gmail.com -#include -#include -#include +#include "PWGCF/DataModel/DptDptFiltered.h" +#include "PWGCF/TableProducer/dptDptFilter.h" +#include "Framework/ASoAHelpers.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" -#include "Framework/ASoAHelpers.h" #include "Framework/HistogramRegistry.h" #include "Framework/runDataProcessing.h" -#include "PWGCF/DataModel/DptDptFiltered.h" -#include "PWGCF/TableProducer/dptDptFilter.h" +#include +#include +#include using namespace o2; using namespace o2::framework; diff --git a/PWGCF/TwoParticleCorrelations/Tasks/dptDptPerRunQc.cxx b/PWGCF/TwoParticleCorrelations/Tasks/dptDptPerRunQc.cxx index 598d3305539..286641391ea 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/dptDptPerRunQc.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/dptDptPerRunQc.cxx @@ -13,29 +13,28 @@ /// \brief basic per run check of the ITS dead chips and of the hadronic interaction rate /// \author victor.gonzalez.sebastian@gmail.com -#include -#include -#include -#include -#include -#include +#include "PWGCF/DataModel/DptDptFiltered.h" +#include "PWGCF/TableProducer/dptDptFilter.h" -#include "CCDB/BasicCCDBManager.h" #include "Common/CCDB/ctpRateFetcher.h" -#include "DataFormatsParameters/AggregatedRunInfo.h" +#include "CCDB/BasicCCDBManager.h" #include "DataFormatsITSMFT/NoiseMap.h" // missing include in TimeDeadMap.h #include "DataFormatsITSMFT/TimeDeadMap.h" -#include "ITSMFTReconstruction/ChipMappingITS.h" - +#include "DataFormatsParameters/AggregatedRunInfo.h" +#include "Framework/ASoAHelpers.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" -#include "Framework/ASoAHelpers.h" #include "Framework/HistogramRegistry.h" #include "Framework/runDataProcessing.h" +#include "ITSMFTReconstruction/ChipMappingITS.h" -#include "PWGCF/DataModel/DptDptFiltered.h" -#include "PWGCF/TableProducer/dptDptFilter.h" +#include +#include +#include +#include +#include +#include using namespace o2; using namespace o2::framework; From c7c8c8afcd57eeb9ca9ecd79dda90e6d5411914b Mon Sep 17 00:00:00 2001 From: Victor Gonzalez Date: Mon, 11 Aug 2025 00:39:02 +0200 Subject: [PATCH 321/345] [PWGCF] DptDpt - Using metadata for auto autoconfiguration (#12521) Co-authored-by: Victor --- PWGCF/TableProducer/dptDptFilter.h | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/PWGCF/TableProducer/dptDptFilter.h b/PWGCF/TableProducer/dptDptFilter.h index b107156d5f3..3e44818103c 100644 --- a/PWGCF/TableProducer/dptDptFilter.h +++ b/PWGCF/TableProducer/dptDptFilter.h @@ -18,6 +18,7 @@ #include "PWGCF/Core/AnalysisConfigurableCuts.h" +#include "Common/Core/MetadataHelper.h" #include "Common/Core/RecoDecay.h" #include "Common/Core/TrackSelection.h" #include "Common/Core/TrackSelectionDefaults.h" @@ -74,6 +75,9 @@ enum SystemType { kXeXe, ///< **Xe-Xe** system kppRun3, ///< **p-p Run 3** system kPbPbRun3, ///< **Pb-Pb Run 3** system + kNeNeRun3, ///< **Ne-Ne Run 3** system + kOORun3, ///< **O-O Run 3** system + kpORun3, ///< **p-O Run 3** system knSystems ///< number of handled systems }; @@ -194,6 +198,11 @@ float overallminp = 0.0f; //============================================================================================ std::bitset<32> collisionFlags; +//============================================================================================ +// The input data metadata access helper +//============================================================================================ +o2::common::core::MetadataHelper metadataInfo; + //============================================================================================ // The DptDptFilter configuration objects //============================================================================================ @@ -561,6 +570,22 @@ inline TriggerSelectionType getTriggerSelection(std::string const& triggstr) } } +inline SystemType getSytemTypeFromMetaData() +{ + auto period = metadataInfo.get("LPMProductionTag"); + + if (period == "LHC25ad" || period == "LHC25g5") { + return kpORun3; + } else if (period == "LHC25ae" || period == "LHC25g6") { + return kOORun3; + } else if (period == "LHC25af" || period == "LHC25g7") { + return kNeNeRun3; + } else { + LOGF(fatal, "DptDptCorrelations::getSystemTypeFromMetadata(). No automatic system type configuration for %s period", period.c_str()); + } + return kPbp; +} + inline SystemType getSystemType(std::string const& sysstr) { /* we have to figure out how extract the system type */ @@ -572,14 +597,14 @@ inline SystemType getSystemType(std::string const& sysstr) return kpPb; } else if (sysstr == "Pbp") { return kPbp; - } else if (sysstr == "pPb") { - return kpPb; } else if (sysstr == "XeXe") { return kXeXe; } else if (sysstr == "ppRun3") { return kppRun3; } else if (sysstr == "PbPbRun3") { return kPbPbRun3; + } else if (sysstr == "Auto") { + return getSytemTypeFromMetaData(); } else { LOGF(fatal, "DptDptCorrelations::getSystemType(). Wrong system type: %s", sysstr.c_str()); } From 27eaec4f38e514719ef5e061766e6ef966c58de5 Mon Sep 17 00:00:00 2001 From: yuanzhe <90246048+wang-yuanzhe@users.noreply.github.com> Date: Mon, 11 Aug 2025 08:05:05 +0200 Subject: [PATCH 322/345] [PWGLF] Fix TOF PID selection and decay mode check for hypertriton kink analysis (#12500) --- PWGLF/TableProducer/Nuspex/hyperkinkRecoTask.cxx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/PWGLF/TableProducer/Nuspex/hyperkinkRecoTask.cxx b/PWGLF/TableProducer/Nuspex/hyperkinkRecoTask.cxx index 9614d561dc0..4c7ac865c18 100644 --- a/PWGLF/TableProducer/Nuspex/hyperkinkRecoTask.cxx +++ b/PWGLF/TableProducer/Nuspex/hyperkinkRecoTask.cxx @@ -142,9 +142,9 @@ struct H3LDecay { if ((haveTriton && havePion0) || (haveAntiTriton && havePion0)) { return H3LDecay::k2bodyNeutral; - } else if ((haveHelium3 && havePion0) || (haveAntiHelium3 && havePion0)) { + } else if ((haveHelium3 && havePionMinus) || (haveAntiHelium3 && havePionPlus)) { return H3LDecay::k2bodyCharged; - } else if ((haveDeuteron && haveProton && havePionPlus) || (haveAntiDeuteron && haveAntiProton && havePionMinus)) { + } else if ((haveDeuteron && haveProton && havePionMinus) || (haveAntiDeuteron && haveAntiProton && havePionPlus)) { return H3LDecay::k3bodyCharged; } else { return kNChannel; @@ -408,6 +408,7 @@ struct HyperkinkRecoTask { Configurable maxZVertex{"maxZVertex", 10.0f, "Accepted z-vertex range (cm)"}; Configurable cutTPCNSigmaDaug{"cutTPCNSigmaDaug", 5, "TPC NSigma cut for daughter tracks"}; Configurable cutTOFNSigmaDaug{"cutTOFNSigmaDaug", 1000, "TOF NSigma cut for daughter tracks"}; + Configurable askTOFForDaug{"askTOFForDaug", false, "If true, ask for TOF signal"}; // CCDB options Configurable inputBz{"inputBz", -999, "bz field, -999 is automatic"}; @@ -671,7 +672,7 @@ struct HyperkinkRecoTask { auto originalDaugCol = daugTrack.collision_as(); nSigmaTOF = getTOFNSigma(mRespParamsV3, daugTrack, collision, originalDaugCol); } - if (std::abs(nSigmaTOF) > cutTOFNSigmaDaug) { + if ((daugTrack.hasTOF() || askTOFForDaug) && std::abs(nSigmaTOF) > cutTOFNSigmaDaug) { continue; } @@ -793,7 +794,7 @@ struct HyperkinkRecoTask { registry.fill(HIST("hDaugNewTOFNSigma_WrongCol"), nSigmaTOF); } } - if (std::abs(nSigmaTOF) > cutTOFNSigmaDaug) { + if ((daugTrack.hasTOF() || askTOFForDaug) && std::abs(nSigmaTOF) > cutTOFNSigmaDaug) { continue; } registry.fill(HIST("hCandidateCounter"), 3); From d982630b789922c3770075dfc28625dd6084195e Mon Sep 17 00:00:00 2001 From: Chiara De Martin <39315597+ChiaraDeMartin95@users.noreply.github.com> Date: Mon, 11 Aug 2025 08:05:47 +0200 Subject: [PATCH 323/345] [PWGLF] Add new table to store lambda variables for longitudinal polarization (#12486) Co-authored-by: Chiara De Martin Co-authored-by: ALICE Action Bot --- PWGLF/DataModel/cascqaanalysis.h | 12 +++++++- .../TableProducer/Strangeness/cascadeflow.cxx | 30 +++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/PWGLF/DataModel/cascqaanalysis.h b/PWGLF/DataModel/cascqaanalysis.h index efe98908517..be74e5241bd 100644 --- a/PWGLF/DataModel/cascqaanalysis.h +++ b/PWGLF/DataModel/cascqaanalysis.h @@ -138,7 +138,14 @@ DECLARE_SOA_COLUMN(BDTResponseOmega, bdtResponseOmega, float); DECLARE_SOA_COLUMN(CosThetaStarLambdaFromOmega, cosThetaStarLambdaFromOmega, float); DECLARE_SOA_COLUMN(CosThetaStarLambdaFromXi, cosThetaStarLambdaFromXi, float); DECLARE_SOA_COLUMN(CosThetaStarProton, cosThetaStarProton, float); - +DECLARE_SOA_COLUMN(V0Radius, v0Radius, float); +DECLARE_SOA_COLUMN(DcaPosToPV, dcaPosToPV, float); +DECLARE_SOA_COLUMN(DcaNegToPV, dcaNegToPV, float); +DECLARE_SOA_COLUMN(V0CosPA, v0CosPA, double); +DECLARE_SOA_COLUMN(DcaV0Daughters, dcaV0Daughters, float); +DECLARE_SOA_COLUMN(Pzs2Lambda, pzs2Lambda, double); +DECLARE_SOA_COLUMN(Cos2ThetaLambda, cos2ThetaLambda, double); +DECLARE_SOA_COLUMN(CosThetaLambda, cosThetaLambda, double); } // namespace cascadesflow DECLARE_SOA_TABLE(MyCascades, "AOD", "MYCASCADES", o2::soa::Index<>, @@ -173,6 +180,9 @@ DECLARE_SOA_TABLE(CascTraining, "AOD", "CascTraining", o2::soa::Index<>, DECLARE_SOA_TABLE(CascAnalysis, "AOD", "CascAnalysis", o2::soa::Index<>, cascadesflow::CentFT0C, cascadesflow::IsNoCollInTimeRange, cascadesflow::IsNoCollInRof, cascadesflow::HasEventPlane, cascadesflow::HasSpectatorPlane, cascadesflow::Sign, cascadesflow::Pt, cascadesflow::Eta, cascadesflow::Phi, cascadesflow::MassLambda, cascadesflow::MassXi, cascadesflow::MassOmega, cascadesflow::V2CSP, cascadesflow::V2CEP, cascadesflow::V1SPzdcA, cascadesflow::V1SPzdcC, cascadesflow::PsiT0C, cascadesflow::BDTResponseXi, cascadesflow::BDTResponseOmega, cascadesflow::CosThetaStarLambdaFromOmega, cascadesflow::CosThetaStarLambdaFromXi, cascadesflow::CosThetaStarProton, mycascades::McPdgCode); +DECLARE_SOA_TABLE(LambdaAnalysis, "AOD", "LambdaAnalysis", o2::soa::Index<>, + cascadesflow::CentFT0C, cascadesflow::HasEventPlane, cascadesflow::HasSpectatorPlane, cascadesflow::Sign, cascadesflow::Pt, cascadesflow::Phi, cascadesflow::MassLambda, cascadesflow::V0Radius, cascadesflow::DcaPosToPV, cascadesflow::DcaNegToPV, cascadesflow::V0CosPA, cascadesflow::DcaV0Daughters, cascadesflow::V2CEP, cascadesflow::PsiT0C, cascadesflow::Pzs2Lambda, cascadesflow::Cos2ThetaLambda, cascadesflow::CosThetaLambda); + namespace myMCcascades { diff --git a/PWGLF/TableProducer/Strangeness/cascadeflow.cxx b/PWGLF/TableProducer/Strangeness/cascadeflow.cxx index 0b930932754..c83984f3a7c 100644 --- a/PWGLF/TableProducer/Strangeness/cascadeflow.cxx +++ b/PWGLF/TableProducer/Strangeness/cascadeflow.cxx @@ -475,6 +475,7 @@ struct cascadeFlow { // Tables to produce Produces trainingSample; Produces analysisSample; + Produces analysisLambdaSample; Configurable> parSigmaMass{ "parSigmaMass", {cascadev2::massSigmaParameters[0], nParameters, nParticles, @@ -572,6 +573,29 @@ struct cascadeFlow { cosThetaStarProton, pdgCode); } + + template + void fillAnalysedLambdaTable(collision_t coll, bool hasEventPlane, bool hasSpectatorPlane, int chargeIndex, v0_t v0, float v2CEP, float psiT0C, double pzs2Lambda, double cos2ThetaLambda, double cosThetaLambda) + { + analysisLambdaSample(coll.centFT0C(), + hasEventPlane, + hasSpectatorPlane, + chargeIndex, + v0.pt(), + v0.phi(), + v0.mLambda(), + v0.v0radius(), + v0.dcapostopv(), + v0.dcanegtopv(), + v0.v0cosPA(), + v0.dcaV0daughters(), + v2CEP, + psiT0C, + pzs2Lambda, + cos2ThetaLambda, + cosThetaLambda); + } + void initAcceptanceFromCCDB() { LOG(info) << "Loading acceptance from CCDB "; @@ -1483,6 +1507,9 @@ struct cascadeFlow { } } + bool hasSpectatorPlane = 0; + bool hasEventPlane = 1; + histos.fill(HIST("hNEvents"), 9.5); histos.fill(HIST("hEventNchCorrelationAfterEP"), coll.multNTracksPVeta1(), coll.multNTracksGlobal()); histos.fill(HIST("hEventPVcontributorsVsCentralityAfterEP"), coll.centFT0C(), coll.multNTracksPVeta1()); @@ -1631,6 +1658,9 @@ struct cascadeFlow { if (fillingConfigs.isFillTHN_Acc) histos.get(HIST("hLambdaCos2ThetaVsPsi"))->Fill(coll.centFT0C(), chargeIndex, v0.eta(), v0.pt(), v0.mLambda(), cos2ThetaLambda, 2 * lambdaminuspsiT0C); } + + if (fillingConfigs.isFillTree) + fillAnalysedLambdaTable(coll, hasEventPlane, hasSpectatorPlane, chargeIndex, v0, v2CEP, psiT0C, pzs2Lambda, cos2ThetaLambda, cosThetaLambda); } } From dfcf33c2bb1f202da069d5b1a2c7eff8d8b24376 Mon Sep 17 00:00:00 2001 From: abmodak <67369858+abmodak@users.noreply.github.com> Date: Mon, 11 Aug 2025 10:30:11 +0200 Subject: [PATCH 324/345] [PWGLF] Add configurable for split MC reco collisions (#12523) --- PWGLF/Tasks/GlobalEventProperties/heavyionMultiplicity.cxx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/PWGLF/Tasks/GlobalEventProperties/heavyionMultiplicity.cxx b/PWGLF/Tasks/GlobalEventProperties/heavyionMultiplicity.cxx index b91db8d09e0..3d0e34adb1c 100644 --- a/PWGLF/Tasks/GlobalEventProperties/heavyionMultiplicity.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/heavyionMultiplicity.cxx @@ -164,6 +164,7 @@ struct HeavyionMultiplicity { Configurable isApplyCentFT0M{"isApplyCentFT0M", false, "Centrality based on FT0A + FT0C"}; Configurable isApplyCentNGlobal{"isApplyCentNGlobal", false, "Centrality based on global tracks"}; Configurable isApplyCentMFT{"isApplyCentMFT", false, "Centrality based on MFT tracks"}; + Configurable isApplySplitRecCol{"isApplySplitRecCol", false, "Split MC reco collisions"}; void init(InitContext const&) { @@ -434,6 +435,11 @@ struct HeavyionMultiplicity { void processMonteCarlo(CollisionMCTrueTable::iterator const&, CollisionMCRecTable const& RecCols, TrackMCTrueTable const& GenParticles, FilTrackMCRecTable const& RecTracks) { + + if (isApplySplitRecCol && (RecCols.size() == 0 || RecCols.size() > 1)) { + return; + } + for (const auto& RecCol : RecCols) { if (!isEventSelected(RecCol)) { continue; From 0fe7f55d4359cc21e096c26eb10c70df17a28a16 Mon Sep 17 00:00:00 2001 From: Joachim Carlo Kristian Bjerg Hansen <50103987+joachimckh@users.noreply.github.com> Date: Mon, 11 Aug 2025 11:44:42 +0200 Subject: [PATCH 325/345] [PWGCF] ESE flow task for GFW (#12440) --- PWGCF/Flow/Tasks/CMakeLists.txt | 5 + PWGCF/Flow/Tasks/flowGfwEse.cxx | 1200 +++++++++++++++++++++++++++++++ 2 files changed, 1205 insertions(+) create mode 100644 PWGCF/Flow/Tasks/flowGfwEse.cxx diff --git a/PWGCF/Flow/Tasks/CMakeLists.txt b/PWGCF/Flow/Tasks/CMakeLists.txt index e368eef4c73..532351a316b 100644 --- a/PWGCF/Flow/Tasks/CMakeLists.txt +++ b/PWGCF/Flow/Tasks/CMakeLists.txt @@ -88,3 +88,8 @@ o2physics_add_dpl_workflow(flow-ese-task SOURCES flowEseTask.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::GFWCore COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(flow-gfw-ese + SOURCES flowGfwEse.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::GFWCore + COMPONENT_NAME Analysis) diff --git a/PWGCF/Flow/Tasks/flowGfwEse.cxx b/PWGCF/Flow/Tasks/flowGfwEse.cxx new file mode 100644 index 00000000000..fc4e06240f1 --- /dev/null +++ b/PWGCF/Flow/Tasks/flowGfwEse.cxx @@ -0,0 +1,1200 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file flowGfwEse.cxx +/// \brief Dedicated GFW task to analyse angular correlations using ESE primarily in light ions +/// \author Emil Gorm Nielsen, NBI, emil.gorm.nielsen@cern.ch, Joachim C. K. B. Hansen, Lund University, joachim.hansen@cern.ch + +#include "FlowContainer.h" +#include "FlowPtContainer.h" +#include "GFW.h" +#include "GFWConfig.h" +#include "GFWCumulant.h" +#include "GFWPowerArray.h" +#include "GFWWeights.h" +#include "GFWWeightsList.h" + +#include "Common/Core/TrackSelection.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EseTable.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/Qvectors.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/runDataProcessing.h" +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace o2; +using namespace o2::framework; + +#define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable NAME{#NAME, DEFAULT, HELP}; + +namespace o2::analysis::gfwflowese +{ +std::vector ptbinning = {0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.2, 2.4, 2.6, 2.8, 3, 3.5, 4, 5, 6, 8, 10}; +float ptpoilow = 0.2, ptpoiup = 10.0; +float ptreflow = 0.2, ptrefup = 3.0; +float ptlow = 0.2, ptup = 10.0; +int etabins = 16; +float etalow = -0.8, etaup = 0.8; +int vtxZbins = 40; +float vtxZlow = -10.0, vtxZup = 10.0; +int phibins = 72; +float philow = 0.0; +float phiup = o2::constants::math::TwoPI; +int nchbins = 300; +float nchlow = 0; +float nchup = 3000; +std::vector centbinning(90); +int nBootstrap = 10; +GFWRegions regions; +GFWCorrConfigs configs; +std::vector multGlobalCorrCutPars; +std::vector multPVCorrCutPars; +std::vector multGlobalPVCorrCutPars; +std::vector multGlobalV0ACutPars; +std::vector multGlobalT0ACutPars; +std::vector firstRunsOfFill; +} // namespace o2::analysis::gfwflowese + +struct FlowGfwEse { + + O2_DEFINE_CONFIGURABLE(cfgNbootstrap, int, 10, "Number of subsamples") + O2_DEFINE_CONFIGURABLE(cfgMpar, int, 4, "Highest order of pt-pt correlations") + O2_DEFINE_CONFIGURABLE(cfgCentEstimator, int, 0, "0:FT0C; 1:FT0CVariant1; 2:FT0M; 3:FV0A, 4:NTPV, 5:NGlobals, 6:MFT") + O2_DEFINE_CONFIGURABLE(cfgUseNch, bool, false, "Do correlations as function of Nch") + O2_DEFINE_CONFIGURABLE(cfgFillWeights, bool, false, "Fill NUA weights") + O2_DEFINE_CONFIGURABLE(cfgRunByRun, bool, false, "Fill histograms on a run-by-run basis") + O2_DEFINE_CONFIGURABLE(cfgFillFlowRunByRun, bool, false, "Fill flow profile run-by-run (only for v22)") + O2_DEFINE_CONFIGURABLE(cfgTimeDependent, bool, false, "Fill output as function of time (for contamination studies)") + O2_DEFINE_CONFIGURABLE(cfgFirstRunsOfFill, std::vector, {}, "First runs of a fill for time dependent analysis") + O2_DEFINE_CONFIGURABLE(cfgFillQA, bool, false, "Fill QA histograms") + O2_DEFINE_CONFIGURABLE(cfgUseAdditionalEventCut, bool, false, "Use additional event cut on mult correlations") + O2_DEFINE_CONFIGURABLE(cfgUseCentralMoments, bool, true, "Use central moments in vn-pt calculations") + O2_DEFINE_CONFIGURABLE(cfgEfficiency, std::string, "", "CCDB path to efficiency object") + O2_DEFINE_CONFIGURABLE(cfgAcceptance, std::string, "", "CCDB path to acceptance object") + O2_DEFINE_CONFIGURABLE(cfgDCAxyNSigma, float, 7, "Cut on number of sigma deviations from expected DCA in the transverse direction"); + O2_DEFINE_CONFIGURABLE(cfgDCAxy, std::string, "(0.0026+0.005/(x^1.01))", "Functional form of pt-dependent DCAxy cut"); + O2_DEFINE_CONFIGURABLE(cfgDCAz, float, 2, "Cut on DCA in the longitudinal direction (cm)"); + O2_DEFINE_CONFIGURABLE(cfgNTPCCls, float, 50, "Cut on number of TPC clusters found"); + O2_DEFINE_CONFIGURABLE(cfgNTPCXrows, float, 70, "Cut on number of TPC crossed rows"); + O2_DEFINE_CONFIGURABLE(cfgMinNITSCls, float, 5, "Cut on minimum number of ITS clusters found"); + O2_DEFINE_CONFIGURABLE(cfgChi2PrITSCls, float, 36, "Cut on chi^2 per ITS clusters found"); + O2_DEFINE_CONFIGURABLE(cfgChi2PrTPCCls, float, 2.5, "Cut on chi^2 per TPC clusters found"); + O2_DEFINE_CONFIGURABLE(cfgPtmin, float, 0.2, "minimum pt (GeV/c)"); + O2_DEFINE_CONFIGURABLE(cfgPtmax, float, 10, "maximum pt (GeV/c)"); + O2_DEFINE_CONFIGURABLE(cfgEta, float, 0.8, "eta cut"); + O2_DEFINE_CONFIGURABLE(cfgEtaPtPt, float, 0.4, "eta cut for pt-pt correlations"); + O2_DEFINE_CONFIGURABLE(cfgVtxZ, float, 10, "vertex cut (cm)"); + O2_DEFINE_CONFIGURABLE(cfgOccupancySelection, int, 2000, "Max occupancy selection, -999 to disable"); + O2_DEFINE_CONFIGURABLE(cfgNoSameBunchPileupCut, bool, true, "kNoSameBunchPileupCut"); + O2_DEFINE_CONFIGURABLE(cfgIsGoodZvtxFT0vsPV, bool, true, "kIsGoodZvtxFT0vsPV"); + O2_DEFINE_CONFIGURABLE(cfgIsGoodITSLayersAll, bool, true, "kIsGoodITSLayersAll"); + O2_DEFINE_CONFIGURABLE(cfgNoCollInTimeRangeStandard, bool, true, "kNoCollInTimeRangeStandard"); + O2_DEFINE_CONFIGURABLE(cfgDoOccupancySel, bool, true, "Bool for event selection on detector occupancy"); + O2_DEFINE_CONFIGURABLE(cfgMultCut, bool, true, "Use additional event cut on mult correlations"); + O2_DEFINE_CONFIGURABLE(cfgTVXinTRD, bool, true, "Use kTVXinTRD (reject TRD triggered events)"); + O2_DEFINE_CONFIGURABLE(cfgIsVertexITSTPC, bool, true, "Selects collisions with at least one ITS-TPC track"); + O2_DEFINE_CONFIGURABLE(cfgMagField, float, 99999, "Configurable magnetic field; default CCDB will be queried"); + O2_DEFINE_CONFIGURABLE(cfgFixedMultMin, int, 1, "Minimum for fixed nch range"); + O2_DEFINE_CONFIGURABLE(cfgFixedMultMax, int, 3000, "Maximum for fixed nch range"); + O2_DEFINE_CONFIGURABLE(cfgUseMultiplicityFlowWeights, bool, true, "Enable or disable the use of multiplicity-based event weighting"); + O2_DEFINE_CONFIGURABLE(cfgConsistentEventFlag, int, 0, "Flag to select consistent events - 0: off, 1: v2{2} gap calculable, 2: v2{4} full calculable, 4: v2{4} gap calculable, 8: v2{4} 3sub calculable"); + O2_DEFINE_CONFIGURABLE(cfgUseDensityDependentCorrection, bool, false, "Use density dependent efficiency correction based on Run 2 measurements"); + Configurable> cfgTrackDensityP0{"cfgTrackDensityP0", std::vector{0.7217476707, 0.7384792571, 0.7542625668, 0.7640680200, 0.7701951667, 0.7755299053, 0.7805901710, 0.7849446786, 0.7957356586, 0.8113039262, 0.8211968966, 0.8280558878, 0.8329342135}, "parameter 0 for track density efficiency correction"}; + Configurable> cfgTrackDensityP1{"cfgTrackDensityP1", std::vector{-2.169488e-05, -2.191913e-05, -2.295484e-05, -2.556538e-05, -2.754463e-05, -2.816832e-05, -2.846502e-05, -2.843857e-05, -2.705974e-05, -2.477018e-05, -2.321730e-05, -2.203315e-05, -2.109474e-05}, "parameter 1 for track density efficiency correction"}; + Configurable> cfgMultGlobalCutPars{"cfgMultGlobalCutPars", std::vector{2272.16, -76.6932, 1.01204, -0.00631545, 1.59868e-05, 136.336, -4.97006, 0.121199, -0.0015921, 7.66197e-06}, "Global vs FT0C multiplicity cut parameter values"}; + Configurable> cfgMultPVCutPars{"cfgMultPVCutPars", std::vector{3074.43, -106.192, 1.46176, -0.00968364, 2.61923e-05, 182.128, -7.43492, 0.193901, -0.00256715, 1.22594e-05}, "PV vs FT0C multiplicity cut parameter values"}; + Configurable> cfgMultGlobalPVCutPars{"cfgMultGlobalPVCutPars", std::vector{-0.223013, 0.715849, 0.664242, 0.0829653, -0.000503733, 1.21185e-06}, "Global vs PV multiplicity cut parameter values"}; + O2_DEFINE_CONFIGURABLE(cfgMultCorrHighCutFunction, std::string, "[0] + [1]*x + [2]*x*x + [3]*x*x*x + [4]*x*x*x*x + 3.*([5] + [6]*x + [7]*x*x + [8]*x*x*x + [9]*x*x*x*x)", "Functional for multiplicity correlation cut"); + O2_DEFINE_CONFIGURABLE(cfgMultCorrLowCutFunction, std::string, "[0] + [1]*x + [2]*x*x + [3]*x*x*x + [4]*x*x*x*x - 3.*([5] + [6]*x + [7]*x*x + [8]*x*x*x + [9]*x*x*x*x)", "Functional for multiplicity correlation cut"); + O2_DEFINE_CONFIGURABLE(cfgMultGlobalPVCorrCutFunction, std::string, "[0] + [1]*x + 3*([2] + [3]*x + [4]*x*x + [5]*x*x*x)", "Functional for global vs pv multiplicity correlation cut"); + struct : ConfigurableGroup { + O2_DEFINE_CONFIGURABLE(cfgMultGlobalASideCorrCutFunction, std::string, "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x + [10]*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", "Functional for global vs V0A multiplicity low correlation cut"); + Configurable> cfgMultGlobalV0ACutPars{"cfgMultGlobalV0ACutPars", std::vector{567.785, 172.715, 0.77888, -0.00693466, 1.40564e-05, 679.853, 66.8068, -0.444332, 0.00115002, -4.92064e-07}, "Global vs FV0A multiplicity cut parameter values"}; + Configurable> cfgMultGlobalT0ACutPars{"cfgMultGlobalT0ACutPars", std::vector{241.618, 61.8402, 0.348049, -0.00306078, 6.20357e-06, 315.235, 29.1491, -0.188639, 0.00044528, -9.08912e-08}, "Global vs FT0A multiplicity cut parameter values"}; + O2_DEFINE_CONFIGURABLE(cfgGlobalV0ALowSigma, float, -3, "Number of sigma deviations below expected value in global vs V0A correlation"); + O2_DEFINE_CONFIGURABLE(cfgGlobalV0AHighSigma, float, 4, "Number of sigma deviations above expected value in global vs V0A correlation"); + O2_DEFINE_CONFIGURABLE(cfgGlobalT0ALowSigma, float, -3., "Number of sigma deviations below expected value in global vs T0A correlation"); + O2_DEFINE_CONFIGURABLE(cfgGlobalT0AHighSigma, float, 4, "Number of sigma deviations above expected value in global vs T0A correlation"); + } cfgGlobalAsideCorrCuts; + Configurable cfgGFWBinning{"cfgGFWBinning", {40, 16, 72, 300, 0, 3000, 0.2, 10.0, 0.2, 3.0, {0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.25, 1.5, 1.75, 2, 2.25, 2.5, 2.75, 3, 3.25, 3.5, 3.75, 4, 4.5, 5, 5.5, 6, 7, 8, 9, 10}, {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90}}, "Configuration for binning"}; + Configurable cfgRegions{"cfgRegions", {{"refN", "refP", "refFull"}, {-0.8, 0.4, -0.8}, {-0.4, 0.8, 0.8}, {0, 0, 0}, {1, 1, 1}}, "Configurations for GFW regions"}; + Configurable cfgCorrConfig{"cfgCorrConfig", {{"refP {2} refN {-2}", "refP {3} refN {-3}", "refP {4} refN {-4}", "refFull {2 -2}", "refFull {2 2 -2 -2}"}, {"ChGap22", "ChGap32", "ChGap42", "ChFull22", "ChFull24"}, {1, 0, 0, 0, 0}, {15, 1, 1, 0, 0}}, "Configurations for each correlation to calculate"}; + // Configurable cfgESEbinning{"cfgESEbinning", 100, "Number of ESE bins"}; + + // Connect to ccdb + Service ccdb; + + struct Config { + TH1D* mEfficiency = nullptr; + GFWWeights* mAcceptance; + bool correctionsLoaded = false; + } cfg; + + // Define output + OutputObj fFC{FlowContainer("FlowContainer")}; + OutputObj fFCpt{FlowPtContainer("FlowPtContainer")}; + OutputObj fFCgen{FlowContainer("FlowContainer_gen")}; + OutputObj fFCptgen{FlowPtContainer("FlowPtContainer_gen")}; + HistogramRegistry registry{"registry"}; + + // QA outputs + std::map>> th1sList; + std::map>> tpfsList; + std::map>> th3sList; + enum OutputTH1Names { + hPhi = 0, + hEta, + hVtxZ, + hMult, + hCent, + hEventSel, + kCount_TH1Names + }; + enum OutputTProfileNames { + pfCorr22 = 0, + kCount_TProfileNames + }; + // NUA outputs + enum OutputTH3Names { + hNUAref = 0, + kCount_TH3Names + }; + enum CentEstimators { + kCentFT0C = 0, + kCentFT0CVariant1, + kCentFT0M, + kCentFV0A, + kCentNTPV, + kCentNGlobal, + kCentMFT + }; + enum EventSelFlags { + kFilteredEvent = 1, + kSel8, + kOccupancy, + kTVXTRD, + kNoSamebunchPU, + kZVtxFT0PV, + kNoCollTRStd, + kVtxITSTPC, + kGoodITSLayers, + kMultCuts, + kTrackCent + }; + + // Define global variables + // Generic Framework + GFW* fGFW = new GFW(); + std::vector corrconfigs; + + TRandom3* fRndm = new TRandom3(0); + TAxis* fSecondAxis; + int lastRun = -1; + std::vector::iterator firstRunOfCurrentFill; + std::vector runNumbers; + + // Density dependent eff correction + std::vector funcEff; + TH1D* hFindPtBin; + TF1* funcV2; + TF1* funcV3; + TF1* funcV4; + struct DensityCorr { + double psi2Est; + double psi3Est; + double psi4Est; + double v2; + double v3; + double v4; + int density; + DensityCorr() : psi2Est(0.), psi3Est(0.), psi4Est(0.), v2(0.), v3(0.), v4(0.), density(0) {} + }; + static constexpr int EseBins = 100; + + // region indices for consistency flag + int posRegionIndex = -1; + int negRegionIndex = -1; + int fullRegionIndex = -1; + int midRegionIndex = -1; + + // Event selection cuts - Alex + TF1* fMultPVCutLow = nullptr; + TF1* fMultPVCutHigh = nullptr; + TF1* fMultCutLow = nullptr; + TF1* fMultCutHigh = nullptr; + TF1* fMultPVGlobalCutHigh = nullptr; + TF1* fMultGlobalV0ACutLow = nullptr; + TF1* fMultGlobalV0ACutHigh = nullptr; + TF1* fMultGlobalT0ACutLow = nullptr; + TF1* fMultGlobalT0ACutHigh = nullptr; + + TF1* fPtDepDCAxy = nullptr; + + o2::framework::expressions::Filter collisionFilter = nabs(aod::collision::posZ) < cfgVtxZ; + o2::framework::expressions::Filter trackFilter = nabs(aod::track::eta) < cfgEta && aod::track::pt > cfgPtmin&& aod::track::pt < cfgPtmax && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == static_cast(true))) && (aod::track::itsChi2NCl < cfgChi2PrITSCls) && (aod::track::tpcChi2NCl < cfgChi2PrTPCCls) && nabs(aod::track::dcaZ) < cfgDCAz; + + Preslice perCollision = aod::track::collisionId; + o2::framework::expressions::Filter mcCollFilter = nabs(aod::mccollision::posZ) < cfgVtxZ; + o2::framework::expressions::Filter mcParticlesFilter = (aod::mcparticle::eta > o2::analysis::gfwflowese::etalow && aod::mcparticle::eta < o2::analysis::gfwflowese::etaup && aod::mcparticle::pt > o2::analysis::gfwflowese::ptlow && aod::mcparticle::pt < o2::analysis::gfwflowese::ptup); + + using GFWTracks = soa::Filtered>; + + void init(InitContext const&) + { + LOGF(info, "FlowGfwEse::init()"); + o2::analysis::gfwflowese::regions.SetNames(cfgRegions->GetNames()); + o2::analysis::gfwflowese::regions.SetEtaMin(cfgRegions->GetEtaMin()); + o2::analysis::gfwflowese::regions.SetEtaMax(cfgRegions->GetEtaMax()); + o2::analysis::gfwflowese::regions.SetpTDifs(cfgRegions->GetpTDifs()); + o2::analysis::gfwflowese::regions.SetBitmasks(cfgRegions->GetBitmasks()); + o2::analysis::gfwflowese::configs.SetCorrs(cfgCorrConfig->GetCorrs()); + o2::analysis::gfwflowese::configs.SetHeads(cfgCorrConfig->GetHeads()); + o2::analysis::gfwflowese::configs.SetpTDifs(cfgCorrConfig->GetpTDifs()); + o2::analysis::gfwflowese::configs.SetpTCorrMasks(cfgCorrConfig->GetpTCorrMasks()); + o2::analysis::gfwflowese::regions.Print(); + o2::analysis::gfwflowese::configs.Print(); + o2::analysis::gfwflowese::ptbinning = cfgGFWBinning->GetPtBinning(); + o2::analysis::gfwflowese::ptpoilow = cfgGFWBinning->GetPtPOImin(); + o2::analysis::gfwflowese::ptpoiup = cfgGFWBinning->GetPtPOImax(); + o2::analysis::gfwflowese::ptreflow = cfgGFWBinning->GetPtRefMin(); + o2::analysis::gfwflowese::ptrefup = cfgGFWBinning->GetPtRefMax(); + o2::analysis::gfwflowese::ptlow = cfgPtmin; + o2::analysis::gfwflowese::ptup = cfgPtmax; + o2::analysis::gfwflowese::etabins = cfgGFWBinning->GetEtaBins(); + o2::analysis::gfwflowese::vtxZbins = cfgGFWBinning->GetVtxZbins(); + o2::analysis::gfwflowese::phibins = cfgGFWBinning->GetPhiBins(); + o2::analysis::gfwflowese::philow = 0.0f; + o2::analysis::gfwflowese::phiup = o2::constants::math::TwoPI; + o2::analysis::gfwflowese::nchbins = cfgGFWBinning->GetNchBins(); + o2::analysis::gfwflowese::nchlow = cfgGFWBinning->GetNchMin(); + o2::analysis::gfwflowese::nchup = cfgGFWBinning->GetNchMax(); + o2::analysis::gfwflowese::centbinning = cfgGFWBinning->GetCentBinning(); + cfgGFWBinning->Print(); + o2::analysis::gfwflowese::multGlobalCorrCutPars = cfgMultGlobalCutPars; + o2::analysis::gfwflowese::multPVCorrCutPars = cfgMultPVCutPars; + o2::analysis::gfwflowese::multGlobalPVCorrCutPars = cfgMultGlobalPVCutPars; + o2::analysis::gfwflowese::multGlobalV0ACutPars = cfgGlobalAsideCorrCuts.cfgMultGlobalV0ACutPars; + o2::analysis::gfwflowese::multGlobalT0ACutPars = cfgGlobalAsideCorrCuts.cfgMultGlobalT0ACutPars; + o2::analysis::gfwflowese::firstRunsOfFill = cfgFirstRunsOfFill; + if (cfgTimeDependent && !std::is_sorted(o2::analysis::gfwflowese::firstRunsOfFill.begin(), o2::analysis::gfwflowese::firstRunsOfFill.end())) { + std::sort(o2::analysis::gfwflowese::firstRunsOfFill.begin(), o2::analysis::gfwflowese::firstRunsOfFill.end()); + } + firstRunOfCurrentFill = o2::analysis::gfwflowese::firstRunsOfFill.begin(); + + AxisSpec phiAxis = {o2::analysis::gfwflowese::phibins, o2::analysis::gfwflowese::philow, o2::analysis::gfwflowese::phiup, "#phi"}; + AxisSpec etaAxis = {o2::analysis::gfwflowese::etabins, -cfgEta, cfgEta, "#eta"}; + AxisSpec vtxAxis = {o2::analysis::gfwflowese::vtxZbins, -cfgVtxZ, cfgVtxZ, "Vtx_{z} (cm)"}; + AxisSpec ptAxis = {o2::analysis::gfwflowese::ptbinning, "#it{p}_{T} GeV/#it{c}"}; + std::string sCentralityEstimator; + std::map centEstimatorMap = { + {kCentFT0C, "FT0C"}, + {kCentFT0CVariant1, "FT0C variant 1"}, + {kCentFT0M, "FT0M"}, + {kCentFV0A, "FV0A"}, + {kCentNTPV, "NTPV"}, + {kCentNGlobal, "NGlobals"}, + {kCentMFT, "MFT"}}; + + sCentralityEstimator = centEstimatorMap.at(cfgCentEstimator); + sCentralityEstimator += " centrality (%)"; + AxisSpec centAxis = {o2::analysis::gfwflowese::centbinning, sCentralityEstimator.c_str()}; + std::vector nchbinning; + int nchskip = (o2::analysis::gfwflowese::nchup - o2::analysis::gfwflowese::nchlow) / o2::analysis::gfwflowese::nchbins; + for (int i = 0; i <= o2::analysis::gfwflowese::nchbins; ++i) { + nchbinning.push_back(nchskip * i + o2::analysis::gfwflowese::nchlow + 0.5); + } + AxisSpec nchAxis = {nchbinning, "N_{ch}"}; + std::vector bbinning(201); + std::generate(bbinning.begin(), bbinning.end(), [n = -0.1, step = 0.1]() mutable { + n += step; + return n; + }); + AxisSpec bAxis = {bbinning, "#it{b}"}; + AxisSpec t0cAxis = {1000, 0, 10000, "N_{ch} (T0C)"}; + AxisSpec t0aAxis = {300, 0, 30000, "N_{ch} (T0A)"}; + AxisSpec v0aAxis = {800, 0, 80000, "N_{ch} (V0A)"}; + AxisSpec multpvAxis = {600, 0, 600, "N_{ch} (PV)"}; + AxisSpec dcaZAXis = {200, -2, 2, "DCA_{z} (cm)"}; + AxisSpec dcaXYAXis = {200, -0.5, 0.5, "DCA_{xy} (cm)"}; + std::vector timebinning(289); + std::generate(timebinning.begin(), timebinning.end(), [n = -24 / 288., step = 24 / 288.]() mutable { + n += step; + return n; + }); + AxisSpec timeAxis = {timebinning, "time (hrs)"}; + + AxisSpec multAxis = (cfgTimeDependent) ? timeAxis : (cfgUseNch) ? nchAxis + : centAxis; + + ccdb->setURL("http://alice-ccdb.cern.ch"); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + + int64_t now = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); + ccdb->setCreatedNotAfter(now); + + int ptbins = o2::analysis::gfwflowese::ptbinning.size() - 1; + fSecondAxis = (cfgTimeDependent) ? new TAxis(timeAxis.binEdges.size() - 1, &(timeAxis.binEdges[0])) : new TAxis(ptbins, &o2::analysis::gfwflowese::ptbinning[0]); + + if (doprocessData) { + registry.add("trackQA/before/phi_eta_vtxZ", "", {HistType::kTH3D, {phiAxis, etaAxis, vtxAxis}}); + registry.add("trackQA/before/pt_dcaXY_dcaZ", "", {HistType::kTH3D, {ptAxis, dcaXYAXis, dcaZAXis}}); + registry.add("trackQA/before/nch_pt", "#it{p}_{T} vs multiplicity; N_{ch}; #it{p}_{T}", {HistType::kTH2D, {nchAxis, ptAxis}}); + registry.add("trackQA/before/chi2prTPCcls", "#chi^{2}/cluster for the TPC track segment; #chi^{2}/TPC cluster", {HistType::kTH1D, {{100, 0., 5.}}}); + registry.add("trackQA/before/chi2prITScls", "#chi^{2}/cluster for the ITS track; #chi^{2}/ITS cluster", {HistType::kTH1D, {{100, 0., 50.}}}); + registry.add("trackQA/before/nTPCClusters", "Number of found TPC clusters; TPC N_{cls}; Counts", {HistType::kTH1D, {{100, 40, 180}}}); + registry.add("trackQA/before/nITSClusters", "Number of found ITS clusters; ITS N_{cls}; Counts", {HistType::kTH1D, {{100, 0, 20}}}); + registry.add("trackQA/before/nTPCCrossedRows", "Number of crossed TPC Rows; TPC X-rows; Counts", {HistType::kTH1D, {{100, 40, 180}}}); + + registry.addClone("trackQA/before/", "trackQA/after/"); + registry.add("trackQA/after/pt_ref", "", {HistType::kTH1D, {{100, o2::analysis::gfwflowese::ptreflow, o2::analysis::gfwflowese::ptrefup}}}); + registry.add("trackQA/after/pt_poi", "", {HistType::kTH1D, {{100, o2::analysis::gfwflowese::ptpoilow, o2::analysis::gfwflowese::ptpoiup}}}); + + registry.add("eventQA/before/multiplicity", "", {HistType::kTH1D, {nchAxis}}); + if (cfgTimeDependent) { + registry.add("eventQA/before/multiplicity_time", "Multiplicity vs time; time (hrs); N_{ch}", {HistType::kTH2D, {timeAxis, nchAxis}}); + registry.add("eventQA/before/multT0C_time", "T0C Multiplicity vs time; time (hrs); N_{ch} (T0C)", {HistType::kTH2D, {timeAxis, t0cAxis}}); + registry.add("eventQA/before/multT0A_time", "T0A Multiplicity vs time; time (hrs); N_{ch} (T0A)", {HistType::kTH2D, {timeAxis, t0aAxis}}); + registry.add("eventQA/before/multV0A_time", "V0A Multiplicity vs time; time (hrs); N_{ch} (V0A)", {HistType::kTH2D, {timeAxis, v0aAxis}}); + registry.add("eventQA/before/multPV_time", "PV Multiplicity vs time; time (hrs); N_{ch} (PV)", {HistType::kTH2D, {timeAxis, multpvAxis}}); + } + registry.add("eventQA/before/globalTracks_PVTracks", "", {HistType::kTH2D, {multpvAxis, nchAxis}}); + registry.add("eventQA/before/globalTracks_multT0A", "", {HistType::kTH2D, {t0aAxis, nchAxis}}); + registry.add("eventQA/before/globalTracks_multV0A", "", {HistType::kTH2D, {v0aAxis, nchAxis}}); + registry.add("eventQA/before/multV0A_multT0A", "", {HistType::kTH2D, {t0aAxis, v0aAxis}}); + + if (doprocessData) { + registry.add("eventQA/before/centrality", "", {HistType::kTH1D, {centAxis}}); + registry.add("eventQA/before/globalTracks_centT0C", "", {HistType::kTH2D, {centAxis, nchAxis}}); + registry.add("eventQA/before/PVTracks_centT0C", "", {HistType::kTH2D, {centAxis, multpvAxis}}); + registry.add("eventQA/before/multT0C_centT0C", "", {HistType::kTH2D, {centAxis, t0cAxis}}); + + registry.add("eventQA/before/centT0M_centT0C", "", {HistType::kTH2D, {centAxis, centAxis}}); + registry.add("eventQA/before/centV0A_centT0C", "", {HistType::kTH2D, {centAxis, centAxis}}); + registry.add("eventQA/before/centGlobal_centT0C", "", {HistType::kTH2D, {centAxis, centAxis}}); + registry.add("eventQA/before/centNTPV_centT0C", "", {HistType::kTH2D, {centAxis, centAxis}}); + registry.add("eventQA/before/centMFT_centT0C", "", {HistType::kTH2D, {centAxis, centAxis}}); + } + + registry.addClone("eventQA/before/", "eventQA/after/"); + registry.add("eventQA/eventSel", "Number of Events;; Counts", {HistType::kTH1D, {{11, 0.5, 11.5}}}); + registry.get(HIST("eventQA/eventSel"))->GetXaxis()->SetBinLabel(kFilteredEvent, "Filtered event"); + registry.get(HIST("eventQA/eventSel"))->GetXaxis()->SetBinLabel(kSel8, "sel8"); + registry.get(HIST("eventQA/eventSel"))->GetXaxis()->SetBinLabel(kOccupancy, "occupancy"); + registry.get(HIST("eventQA/eventSel"))->GetXaxis()->SetBinLabel(kTVXTRD, "kTVXinTRD"); + registry.get(HIST("eventQA/eventSel"))->GetXaxis()->SetBinLabel(kNoSamebunchPU, "kNoSameBunchPileup"); + registry.get(HIST("eventQA/eventSel"))->GetXaxis()->SetBinLabel(kZVtxFT0PV, "kIsGoodZvtxFT0vsPV"); + registry.get(HIST("eventQA/eventSel"))->GetXaxis()->SetBinLabel(kNoCollTRStd, "kNoCollInTimeRangeStandard"); + registry.get(HIST("eventQA/eventSel"))->GetXaxis()->SetBinLabel(kVtxITSTPC, "kIsVertexITSTPC"); + registry.get(HIST("eventQA/eventSel"))->GetXaxis()->SetBinLabel(kGoodITSLayers, "kIsGoodITSLayersAll"); + registry.get(HIST("eventQA/eventSel"))->GetXaxis()->SetBinLabel(kMultCuts, "after Mult cuts"); + registry.get(HIST("eventQA/eventSel"))->GetXaxis()->SetBinLabel(kTrackCent, "has track + within cent"); + if (!cfgRunByRun && cfgFillWeights) { + registry.add("phi_eta_vtxz_ref", "", {HistType::kTH3D, {phiAxis, etaAxis, vtxAxis}}); + } + } + + if (o2::analysis::gfwflowese::regions.GetSize() < 0) + LOGF(error, "Configuration contains vectors of different size - check the GFWRegions configurable"); + for (auto i(0); i < o2::analysis::gfwflowese::regions.GetSize(); ++i) { + fGFW->AddRegion(o2::analysis::gfwflowese::regions.GetNames()[i], o2::analysis::gfwflowese::regions.GetEtaMin()[i], o2::analysis::gfwflowese::regions.GetEtaMax()[i], (o2::analysis::gfwflowese::regions.GetpTDifs()[i]) ? ptbins + 1 : 1, o2::analysis::gfwflowese::regions.GetBitmasks()[i]); + } + for (auto i = 0; i < o2::analysis::gfwflowese::configs.GetSize(); ++i) { + corrconfigs.push_back(fGFW->GetCorrelatorConfig(o2::analysis::gfwflowese::configs.GetCorrs()[i], o2::analysis::gfwflowese::configs.GetHeads()[i], o2::analysis::gfwflowese::configs.GetpTDifs()[i])); + } + if (corrconfigs.empty()) + LOGF(error, "Configuration contains vectors of different size - check the GFWCorrConfig configurable"); + fGFW->CreateRegions(); + TObjArray* oba = new TObjArray(); + addConfigObjectsToObjArray(oba, corrconfigs); + if (doprocessData) { + fFC->SetName("FlowContainer"); + fFC->SetXAxis(fSecondAxis); + fFC->Initialize(oba, multAxis, cfgNbootstrap); + } + delete oba; + fFCpt->setUseCentralMoments(cfgUseCentralMoments); + fFCpt->setUseGapMethod(true); + fFCpt->initialise(multAxis, cfgMpar, o2::analysis::gfwflowese::configs, cfgNbootstrap); + fFCptgen->setUseCentralMoments(cfgUseCentralMoments); + fFCptgen->setUseGapMethod(true); + fFCptgen->initialise(multAxis, cfgMpar, o2::analysis::gfwflowese::configs, cfgNbootstrap); + + fPtDepDCAxy = new TF1("ptDepDCAxy", Form("[0]*%s", cfgDCAxy->c_str()), 0.001, 100); + fPtDepDCAxy->SetParameter(0, cfgDCAxyNSigma); + LOGF(info, "DCAxy pt-dependence function: %s", Form("[0]*%s", cfgDCAxy->c_str())); + if (cfgUseAdditionalEventCut) { + fMultPVCutLow = new TF1("fMultPVCutLow", cfgMultCorrLowCutFunction->c_str(), 0, 100); + fMultPVCutLow->SetParameters(&(o2::analysis::gfwflowese::multPVCorrCutPars[0])); + fMultPVCutHigh = new TF1("fMultPVCutHigh", cfgMultCorrHighCutFunction->c_str(), 0, 100); + fMultPVCutHigh->SetParameters(&(o2::analysis::gfwflowese::multPVCorrCutPars[0])); + fMultCutLow = new TF1("fMultCutLow", cfgMultCorrLowCutFunction->c_str(), 0, 100); + fMultCutLow->SetParameters(&(o2::analysis::gfwflowese::multGlobalCorrCutPars[0])); + fMultCutHigh = new TF1("fMultCutHigh", cfgMultCorrHighCutFunction->c_str(), 0, 100); + fMultCutHigh->SetParameters(&(o2::analysis::gfwflowese::multGlobalCorrCutPars[0])); + fMultPVGlobalCutHigh = new TF1("fMultPVGlobalCutHigh", cfgMultGlobalPVCorrCutFunction->c_str(), 0, nchbinning.back()); + fMultPVGlobalCutHigh->SetParameters(&(o2::analysis::gfwflowese::multGlobalPVCorrCutPars[0])); + + LOGF(info, "Global V0A function: %s in range 0-%g", cfgGlobalAsideCorrCuts.cfgMultGlobalASideCorrCutFunction->c_str(), v0aAxis.binEdges.back()); + fMultGlobalV0ACutLow = new TF1("fMultGlobalV0ACutLow", cfgGlobalAsideCorrCuts.cfgMultGlobalASideCorrCutFunction->c_str(), 0, v0aAxis.binEdges.back()); + for (std::size_t i = 0; i < o2::analysis::gfwflowese::multGlobalV0ACutPars.size(); ++i) + fMultGlobalV0ACutLow->SetParameter(i, o2::analysis::gfwflowese::multGlobalV0ACutPars[i]); + fMultGlobalV0ACutLow->SetParameter(o2::analysis::gfwflowese::multGlobalV0ACutPars.size(), cfgGlobalAsideCorrCuts.cfgGlobalV0ALowSigma); + for (int i = 0; i < fMultGlobalV0ACutLow->GetNpar(); ++i) + LOGF(info, "fMultGlobalV0ACutLow par %d = %g", i, fMultGlobalV0ACutLow->GetParameter(i)); + + fMultGlobalV0ACutHigh = new TF1("fMultGlobalV0ACutHigh", cfgGlobalAsideCorrCuts.cfgMultGlobalASideCorrCutFunction->c_str(), 0, v0aAxis.binEdges.back()); + for (std::size_t i = 0; i < o2::analysis::gfwflowese::multGlobalV0ACutPars.size(); ++i) + fMultGlobalV0ACutHigh->SetParameter(i, o2::analysis::gfwflowese::multGlobalV0ACutPars[i]); + fMultGlobalV0ACutHigh->SetParameter(o2::analysis::gfwflowese::multGlobalV0ACutPars.size(), cfgGlobalAsideCorrCuts.cfgGlobalV0AHighSigma); + for (int i = 0; i < fMultGlobalV0ACutHigh->GetNpar(); ++i) + LOGF(info, "fMultGlobalV0ACutHigh par %d = %g", i, fMultGlobalV0ACutHigh->GetParameter(i)); + + LOGF(info, "Global T0A function: %s", cfgGlobalAsideCorrCuts.cfgMultGlobalASideCorrCutFunction->c_str()); + fMultGlobalT0ACutLow = new TF1("fMultGlobalT0ACutLow", cfgGlobalAsideCorrCuts.cfgMultGlobalASideCorrCutFunction->c_str(), 0, t0aAxis.binEdges.back()); + for (std::size_t i = 0; i < o2::analysis::gfwflowese::multGlobalT0ACutPars.size(); ++i) + fMultGlobalT0ACutLow->SetParameter(i, o2::analysis::gfwflowese::multGlobalT0ACutPars[i]); + fMultGlobalT0ACutLow->SetParameter(o2::analysis::gfwflowese::multGlobalT0ACutPars.size(), cfgGlobalAsideCorrCuts.cfgGlobalT0ALowSigma); + for (int i = 0; i < fMultGlobalT0ACutLow->GetNpar(); ++i) + LOGF(info, "fMultGlobalT0ACutLow par %d = %g", i, fMultGlobalT0ACutLow->GetParameter(i)); + + fMultGlobalT0ACutHigh = new TF1("fMultGlobalT0ACutHigh", cfgGlobalAsideCorrCuts.cfgMultGlobalASideCorrCutFunction->c_str(), 0, t0aAxis.binEdges.back()); + for (std::size_t i = 0; i < o2::analysis::gfwflowese::multGlobalT0ACutPars.size(); ++i) + fMultGlobalT0ACutHigh->SetParameter(i, o2::analysis::gfwflowese::multGlobalT0ACutPars[i]); + fMultGlobalT0ACutHigh->SetParameter(o2::analysis::gfwflowese::multGlobalT0ACutPars.size(), cfgGlobalAsideCorrCuts.cfgGlobalT0AHighSigma); + for (int i = 0; i < fMultGlobalT0ACutHigh->GetNpar(); ++i) + LOGF(info, "fMultGlobalT0ACutHigh par %d = %g", i, fMultGlobalT0ACutHigh->GetParameter(i)); + } + if (cfgUseDensityDependentCorrection) { + std::vector pTEffBins = {0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.4, 1.8, 2.2, 2.6, 3.0}; + hFindPtBin = new TH1D("hFindPtBin", "hFindPtBin", pTEffBins.size() - 1, &pTEffBins[0]); + funcEff.resize(pTEffBins.size() - 1); + // LHC24g3 Eff + std::vector f1p0 = cfgTrackDensityP0; + std::vector f1p1 = cfgTrackDensityP1; + for (uint ifunc = 0; ifunc < pTEffBins.size() - 1; ifunc++) { + funcEff[ifunc] = new TF1(Form("funcEff%i", ifunc), "[0]+[1]*x", 0, 3000); + funcEff[ifunc]->SetParameters(f1p0[ifunc], f1p1[ifunc]); + } + funcV2 = new TF1("funcV2", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x", 0, 100); + funcV2->SetParameters(0.0186111, 0.00351907, -4.38264e-05, 1.35383e-07, -3.96266e-10); + funcV3 = new TF1("funcV3", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x", 0, 100); + funcV3->SetParameters(0.0174056, 0.000703329, -1.45044e-05, 1.91991e-07, -1.62137e-09); + funcV4 = new TF1("funcV4", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x", 0, 100); + funcV4->SetParameters(0.008845, 0.000259668, -3.24435e-06, 4.54837e-08, -6.01825e-10); + } + if (cfgConsistentEventFlag) { + auto findRegionIndex = [&](const std::string& name) { + auto begin = cfgRegions->GetNames().begin(); + auto end = cfgRegions->GetNames().end(); + auto it = std::find(begin, end, name); + return (it != end) ? std::distance(begin, it) : -1; + }; + posRegionIndex = findRegionIndex("refP"); + negRegionIndex = findRegionIndex("refN"); + fullRegionIndex = findRegionIndex("refFull"); + midRegionIndex = findRegionIndex("refMid"); + } + } + + static constexpr std::string_view FillTimeName[] = {"before/", "after/"}; + + enum QAFillTime { + kBefore, + kAfter + }; + + void addConfigObjectsToObjArray(TObjArray* oba, const std::vector& configs) + { + for (auto it = configs.begin(); it != configs.end(); ++it) { + for (int jese = 0; jese < EseBins; ++jese) { + if (it->pTDif) { + for (int i = 0; i < fSecondAxis->GetNbins(); ++i) { + std::string name = Form("ese_%d_%s_pt_%d", jese, it->Head.c_str(), i + 1); + std::string title = it->Head + std::string("_ptDiff"); + oba->Add(new TNamed(name.c_str(), title.c_str())); + } + } else { + std::string name = Form("ese_%d_%s", jese, it->Head.c_str()); + std::string title = it->Head + std::string("_ese"); + oba->Add(new TNamed(name.c_str(), title.c_str())); + } + } + } + } + + int getMagneticField(uint64_t timestamp) + { + static o2::parameters::GRPMagField* grpo = nullptr; + if (grpo == nullptr) { + // grpo = ccdb->getForTimeStamp("GLO/GRP/GRP", timestamp); + grpo = ccdb->getForTimeStamp("GLO/Config/GRPMagField", timestamp); + if (grpo == nullptr) { + LOGF(fatal, "GRP object not found for timestamp %llu", timestamp); + return 0; + } + LOGF(info, "Retrieved GRP for timestamp %llu with magnetic field of %d kG", timestamp, grpo->getNominalL3Field()); + } + return grpo->getNominalL3Field(); + } + + void loadCorrections(aod::BCsWithTimestamps::iterator const& bc) + { + uint64_t timestamp = bc.timestamp(); + if (!cfgRunByRun && cfg.correctionsLoaded) + return; + if (!cfgAcceptance.value.empty()) { + std::string runstr = (cfgRunByRun) ? "RunByRun/" : ""; + cfg.mAcceptance = ccdb->getForTimeStamp(cfgAcceptance.value + runstr, timestamp); + } + if (!cfgEfficiency.value.empty()) { + cfg.mEfficiency = ccdb->getForTimeStamp(cfgEfficiency, timestamp); + if (cfg.mEfficiency == nullptr) { + LOGF(fatal, "Could not load efficiency histogram from %s", cfgEfficiency.value.c_str()); + } + LOGF(info, "Loaded efficiency histogram from %s (%p)", cfgEfficiency.value.c_str(), (void*)cfg.mEfficiency); + } + cfg.correctionsLoaded = true; + } + + template + double getAcceptance(TTrack track, const double& vtxz) + { + double wacc = 1; + if (cfg.mAcceptance) + wacc = cfg.mAcceptance->getNUA(track.phi(), track.eta(), vtxz); + return wacc; + } + + template + double getEfficiency(TTrack track) + { + double eff = 1.; + if (cfg.mEfficiency) + eff = cfg.mEfficiency->GetBinContent(cfg.mEfficiency->FindBin(track.pt())); + if (eff == 0) + return -1.; + else + return 1. / eff; + } + + template + bool eventSelected(TCollision collision, const int& multTrk, const float& centrality, const int& run) + { + if (cfgTVXinTRD) { + if (collision.alias_bit(kTVXinTRD)) { + // TRD triggered + // "CMTVX-B-NOPF-TRD,minbias_TVX" + return 0; + } + registry.fill(HIST("eventQA/eventSel"), kTVXTRD); + if (cfgRunByRun) + th1sList[run][hEventSel]->Fill(kTVXTRD); + } + if (cfgNoSameBunchPileupCut) { + if (!collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + // rejects collisions which are associated with the same "found-by-T0" bunch crossing + // https://indico.cern.ch/event/1396220/#1-event-selection-with-its-rof + return 0; + } + registry.fill(HIST("eventQA/eventSel"), kNoSamebunchPU); + if (cfgRunByRun) + th1sList[run][hEventSel]->Fill(kNoSamebunchPU); + } + if (cfgIsGoodZvtxFT0vsPV) { + if (!collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + // removes collisions with large differences between z of PV by tracks and z of PV from FT0 A-C time difference + // use this cut at low multiplicities with caution + return 0; + } + registry.fill(HIST("eventQA/eventSel"), kZVtxFT0PV); + if (cfgRunByRun) + th1sList[run][hEventSel]->Fill(kZVtxFT0PV); + } + if (cfgNoCollInTimeRangeStandard) { + if (!collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + // Rejection of the collisions which have other events nearby + return 0; + } + registry.fill(HIST("eventQA/eventSel"), kNoCollTRStd); + if (cfgRunByRun) + th1sList[run][hEventSel]->Fill(kNoCollTRStd); + } + + if (cfgIsVertexITSTPC) { + if (!collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { + // selects collisions with at least one ITS-TPC track, and thus rejects vertices built from ITS-only tracks + return 0; + } + registry.fill(HIST("eventQA/eventSel"), kVtxITSTPC); + if (cfgRunByRun) + th1sList[run][hEventSel]->Fill(kVtxITSTPC); + } + + if (cfgIsGoodITSLayersAll) { + if (!collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + return 0; + } + registry.fill(HIST("eventQA/eventSel"), kGoodITSLayers); + if (cfgRunByRun) + th1sList[run][hEventSel]->Fill(kGoodITSLayers); + } + + float vtxz = -999; + if (collision.numContrib() > 1) { + vtxz = collision.posZ(); + float zRes = std::sqrt(collision.covZZ()); + float minZRes = 0.25; + int minNContrib = 20; + if (zRes > minZRes && collision.numContrib() < minNContrib) + vtxz = -999; + } + auto multNTracksPV = collision.multNTracksPV(); + + if (vtxz > o2::analysis::gfwflowese::vtxZup || vtxz < o2::analysis::gfwflowese::vtxZlow) + return 0; + + if (cfgMultCut) { + if (multNTracksPV < fMultPVCutLow->Eval(centrality)) + return 0; + if (multNTracksPV > fMultPVCutHigh->Eval(centrality)) + return 0; + if (multTrk < fMultCutLow->Eval(centrality)) + return 0; + if (multTrk > fMultCutHigh->Eval(centrality)) + return 0; + if (multTrk > fMultPVGlobalCutHigh->Eval(collision.multNTracksPV())) + return 0; + + if (!(cfgGlobalAsideCorrCuts.cfgMultGlobalASideCorrCutFunction->empty()) && static_cast(collision.multFV0A()) < fMultGlobalV0ACutLow->Eval(multTrk)) + return 0; + if (!(cfgGlobalAsideCorrCuts.cfgMultGlobalASideCorrCutFunction->empty()) && static_cast(collision.multFV0A()) > fMultGlobalV0ACutHigh->Eval(multTrk)) + return 0; + if (!(cfgGlobalAsideCorrCuts.cfgMultGlobalASideCorrCutFunction->empty()) && static_cast(collision.multFT0A()) < fMultGlobalT0ACutLow->Eval(multTrk)) + return 0; + if (!(cfgGlobalAsideCorrCuts.cfgMultGlobalASideCorrCutFunction->empty()) && static_cast(collision.multFT0A()) > fMultGlobalT0ACutHigh->Eval(multTrk)) + return 0; + registry.fill(HIST("eventQA/eventSel"), kMultCuts); + if (cfgRunByRun) + th1sList[run][hEventSel]->Fill(kMultCuts); + } + return 1; + } + + template + bool trackSelected(TTrack track) + { + if (cfgDCAxyNSigma && (std::fabs(track.dcaXY()) > fPtDepDCAxy->Eval(track.pt()))) + return false; + return ((track.tpcNClsCrossedRows() >= cfgNTPCXrows) && (track.tpcNClsFound() >= cfgNTPCCls) && (track.itsNCls() >= cfgMinNITSCls)); + } + + enum DataType { + kReco, + kGen + }; + + template + void fillWeights(const TTrack track, const double vtxz, const int& run) + { + if (cfgRunByRun) + th3sList[run][hNUAref]->Fill(track.phi(), track.eta(), vtxz); + else + registry.fill(HIST("phi_eta_vtxz_ref"), track.phi(), track.eta(), vtxz); + return; + } + + void createRunByRunHistograms(const int& run) + { + AxisSpec phiAxis = {o2::analysis::gfwflowese::phibins, o2::analysis::gfwflowese::philow, o2::analysis::gfwflowese::phiup, "#phi"}; + AxisSpec etaAxis = {o2::analysis::gfwflowese::etabins, -cfgEta, cfgEta, "#eta"}; + AxisSpec vtxAxis = {o2::analysis::gfwflowese::vtxZbins, -cfgVtxZ, cfgVtxZ, "Vtx_{z} (cm)"}; + AxisSpec nchAxis = {o2::analysis::gfwflowese::nchbins, o2::analysis::gfwflowese::nchlow, o2::analysis::gfwflowese::nchup, "N_{ch}"}; + AxisSpec centAxis = {o2::analysis::gfwflowese::centbinning, "Centrality (%)"}; + std::vector> histos(kCount_TH1Names); + histos[hPhi] = registry.add(Form("%d/phi", run), "", {HistType::kTH1D, {phiAxis}}); + histos[hEta] = registry.add(Form("%d/eta", run), "", {HistType::kTH1D, {etaAxis}}); + histos[hVtxZ] = registry.add(Form("%d/vtxz", run), "", {HistType::kTH1D, {vtxAxis}}); + histos[hMult] = registry.add(Form("%d/mult", run), "", {HistType::kTH1D, {nchAxis}}); + histos[hCent] = registry.add(Form("%d/cent", run), "", {HistType::kTH1D, {centAxis}}); + if (cfgFillFlowRunByRun) { + std::vector> profiles(kCount_TProfileNames); + profiles[pfCorr22] = registry.add(Form("%d/corr22", run), "", {HistType::kTProfile, {(cfgUseNch) ? nchAxis : centAxis}}); + tpfsList.insert(std::make_pair(run, profiles)); + } + histos[hEventSel] = registry.add(Form("%d/eventSel", run), "Number of Events;; Counts", {HistType::kTH1D, {{11, 0.5, 11.5}}}); + histos[hEventSel]->GetXaxis()->SetBinLabel(kFilteredEvent, "Filtered event"); + histos[hEventSel]->GetXaxis()->SetBinLabel(kSel8, "sel8"); + histos[hEventSel]->GetXaxis()->SetBinLabel(kOccupancy, "occupancy"); + histos[hEventSel]->GetXaxis()->SetBinLabel(kTVXTRD, "kTVXinTRD"); + histos[hEventSel]->GetXaxis()->SetBinLabel(kNoSamebunchPU, "kNoSameBunchPileup"); + histos[hEventSel]->GetXaxis()->SetBinLabel(kZVtxFT0PV, "kIsGoodZvtxFT0vsPV"); + histos[hEventSel]->GetXaxis()->SetBinLabel(kNoCollTRStd, "kNoCollInTimeRangeStandard"); + histos[hEventSel]->GetXaxis()->SetBinLabel(kVtxITSTPC, "kIsVertexITSTPC"); + histos[hEventSel]->GetXaxis()->SetBinLabel(kGoodITSLayers, "kIsGoodITSLayersAll"); + histos[hEventSel]->GetXaxis()->SetBinLabel(kMultCuts, "after Mult cuts"); + histos[hEventSel]->GetXaxis()->SetBinLabel(kTrackCent, "has track + within cent"); + th1sList.insert(std::make_pair(run, histos)); + std::vector> histos3d(kCount_TH3Names); + histos3d[hNUAref] = registry.add(Form("%d/phi_eta_vtxz_ref", run), "", {HistType::kTH3D, {phiAxis, etaAxis, vtxAxis}}); + th3sList.insert(std::make_pair(run, histos3d)); + return; + } + + template + void fillOutputContainers(const float& centmult, const double& rndm, const int& run = 0, const float& qPerc = -1.0f) + { + (dt == kGen) ? fFCptgen->calculateCorrelations() : fFCpt->calculateCorrelations(); + (dt == kGen) ? fFCptgen->fillPtProfiles(centmult, rndm) : fFCpt->fillPtProfiles(centmult, rndm); + (dt == kGen) ? fFCptgen->fillCMProfiles(centmult, rndm) : fFCpt->fillCMProfiles(centmult, rndm); + int qPtmp = static_cast(qPerc); + for (uint l_ind = 0; l_ind < corrconfigs.size(); ++l_ind) { + if (!corrconfigs.at(l_ind).pTDif) { + auto dnx = fGFW->Calculate(corrconfigs.at(l_ind), 0, kTRUE).real(); + if (dnx == 0) + continue; + auto val = fGFW->Calculate(corrconfigs.at(l_ind), 0, kFALSE).real() / dnx; + if (std::abs(val) < 1) { + (dt == kGen) ? fFCgen->FillProfile(corrconfigs.at(l_ind).Head.c_str(), centmult, val, (cfgUseMultiplicityFlowWeights) ? dnx : 1.0, rndm) : fFC->FillProfile(Form("ese_%i_%s", qPtmp, corrconfigs.at(l_ind).Head.c_str()), centmult, val, (cfgUseMultiplicityFlowWeights) ? dnx : 1.0, rndm); + (dt == kGen) ? fFCptgen->fillVnPtProfiles(centmult, val, (cfgUseMultiplicityFlowWeights) ? dnx : 1.0, rndm, o2::analysis::gfwflowese::configs.GetpTCorrMasks()[l_ind]) : fFCpt->fillVnPtProfiles(centmult, val, (cfgUseMultiplicityFlowWeights) ? dnx : 1.0, rndm, o2::analysis::gfwflowese::configs.GetpTCorrMasks()[l_ind]); + if (cfgRunByRun && cfgFillFlowRunByRun && dt != kGen && l_ind == 0) { + tpfsList[run][pfCorr22]->Fill(centmult, val, (cfgUseMultiplicityFlowWeights) ? dnx : 1.0); + } + } + continue; + } + for (int i = 1; i <= fSecondAxis->GetNbins(); i++) { + auto dnx = fGFW->Calculate(corrconfigs.at(l_ind), i - 1, kTRUE).real(); + if (dnx == 0) + continue; + auto val = fGFW->Calculate(corrconfigs.at(l_ind), i - 1, kFALSE).real() / dnx; + if (std::abs(val) < 1) + (dt == kGen) ? fFCgen->FillProfile(Form("%s_pt_%i", corrconfigs.at(l_ind).Head.c_str(), i), centmult, val, (cfgUseMultiplicityFlowWeights) ? dnx : 1.0, rndm) : fFC->FillProfile(Form("ese_%i_%s_pt_%i", qPtmp, corrconfigs.at(l_ind).Head.c_str(), i), centmult, val, (cfgUseMultiplicityFlowWeights) ? dnx : 1.0, rndm); + // (dt == kGen) ? fFCgen->FillProfile(Form("%s_pt_%i", corrconfigs.at(l_ind).Head.c_str(), i), centmult, val, (cfgUseMultiplicityFlowWeights) ? dnx : 1.0, rndm) : fFC->FillProfile(Form("%s_pt_%i", corrconfigs.at(l_ind).Head.c_str(), i), centmult, val, (cfgUseMultiplicityFlowWeights) ? dnx : 1.0, rndm); + } + } + return; + } + + struct XAxis { + float centrality; + int64_t multiplicity; + double time; + }; + + struct AcceptedTracks { + int nPos; + int nNeg; + int nFull; + int nMid; + }; + + template + void processCollision(TCollision collision, TTracks tracks, const XAxis& xaxis, const int& run) + { + if (tracks.size() < 1) + return; + if (dt != kGen && xaxis.centrality >= 0 && (xaxis.centrality < o2::analysis::gfwflowese::centbinning.front() || xaxis.centrality > o2::analysis::gfwflowese::centbinning.back())) + return; + if (xaxis.multiplicity < cfgFixedMultMin || xaxis.multiplicity > cfgFixedMultMax) + return; + if (dt != kGen) { + registry.fill(HIST("eventQA/eventSel"), kTrackCent); + if (cfgRunByRun) + th1sList[run][hEventSel]->Fill(kTrackCent); + } + if (xaxis.centrality >= 0) + registry.fill(HIST("eventQA/after/centrality"), xaxis.centrality); + registry.fill(HIST("eventQA/after/multiplicity"), xaxis.multiplicity); + float vtxz = collision.posZ(); + if (dt != kGen && cfgRunByRun) { + th1sList[run][hVtxZ]->Fill(vtxz); + th1sList[run][hMult]->Fill(xaxis.multiplicity); + th1sList[run][hCent]->Fill(xaxis.centrality); + } + fGFW->Clear(); + (dt == kGen) ? fFCptgen->clearVector() : fFCpt->clearVector(); + + float lRandom = fRndm->Rndm(); + + // be cautious, this only works for Pb-Pb + // esimate the Event plane and vn for this event + DensityCorr densitycorrections; + if (cfgUseDensityDependentCorrection) { + double psi2Est = 0, psi3Est = 0, psi4Est = 0; + double v2 = 0, v3 = 0, v4 = 0; + double q2x = 0, q2y = 0; + double q3x = 0, q3y = 0; + double q4x = 0, q4y = 0; + for (const auto& track : tracks) { + bool withinPtRef = (o2::analysis::gfwflowese::ptreflow < track.pt()) && (track.pt() < o2::analysis::gfwflowese::ptrefup); // within RF pT rang + if (withinPtRef) { + q2x += std::cos(2 * track.phi()); + q2y += std::sin(2 * track.phi()); + q3x += std::cos(3 * track.phi()); + q3y += std::sin(3 * track.phi()); + q4x += std::cos(4 * track.phi()); + q4y += std::sin(4 * track.phi()); + } + } + psi2Est = std::atan2(q2y, q2x) / 2.; + psi3Est = std::atan2(q3y, q3x) / 3.; + psi4Est = std::atan2(q4y, q4x) / 4.; + v2 = funcV2->Eval(xaxis.centrality); + v3 = funcV3->Eval(xaxis.centrality); + v4 = funcV4->Eval(xaxis.centrality); + densitycorrections.psi2Est = psi2Est; + densitycorrections.psi3Est = psi3Est; + densitycorrections.psi4Est = psi4Est; + densitycorrections.v2 = v2; + densitycorrections.v3 = v3; + densitycorrections.v4 = v4; + densitycorrections.density = tracks.size(); + } + AcceptedTracks acceptedTracks{0, 0, 0, 0}; + for (const auto& track : tracks) { + processTrack(track, vtxz, xaxis.multiplicity, run, densitycorrections, acceptedTracks); + if (cfgConsistentEventFlag & 1) + if (!acceptedTracks.nPos || !acceptedTracks.nNeg) + return; + if (cfgConsistentEventFlag & 2) + if (acceptedTracks.nFull < 4) // o2-linter: disable=magic-number (at least four tracks in full acceptance) + return; + if (cfgConsistentEventFlag & 4) + if (acceptedTracks.nPos < 2 || acceptedTracks.nNeg < 2) // o2-linter: disable=magic-number (at least two tracks in each subevent) + return; + if (cfgConsistentEventFlag & 8) + if (acceptedTracks.nPos < 2 || acceptedTracks.nMid < 2 || acceptedTracks.nNeg < 2) // o2-linter: disable=magic-number (at least two tracks in all three subevents) + return; + } + const auto qPerc{collision.qPERCFT0C()}; + if (!cfgFillWeights) + fillOutputContainers
((cfgTimeDependent) ? xaxis.time : (cfgUseNch) ? xaxis.multiplicity + : xaxis.centrality, + lRandom, run, qPerc[0]); + } + + bool isStable(int pdg) + { + if (std::abs(pdg) == PDG_t::kPiPlus) + return true; + if (std::abs(pdg) == PDG_t::kKPlus) + return true; + if (std::abs(pdg) == PDG_t::kProton) + return true; + if (std::abs(pdg) == PDG_t::kElectron) + return true; + if (std::abs(pdg) == PDG_t::kMuonMinus) + return true; + return false; + } + + template + void fillAcceptedTracks(TTrack track, AcceptedTracks& acceptedTracks) + { + if (posRegionIndex >= 0 && track.eta() > o2::analysis::gfwflowese::regions.GetEtaMin()[posRegionIndex] && track.eta() < o2::analysis::gfwflowese::regions.GetEtaMax()[posRegionIndex]) + ++acceptedTracks.nPos; + if (negRegionIndex >= 0 && track.eta() > o2::analysis::gfwflowese::regions.GetEtaMin()[negRegionIndex] && track.eta() < o2::analysis::gfwflowese::regions.GetEtaMax()[negRegionIndex]) + ++acceptedTracks.nNeg; + if (fullRegionIndex >= 0 && track.eta() > o2::analysis::gfwflowese::regions.GetEtaMin()[fullRegionIndex] && track.eta() < o2::analysis::gfwflowese::regions.GetEtaMax()[fullRegionIndex]) + ++acceptedTracks.nFull; + if (midRegionIndex >= 0 && track.eta() > o2::analysis::gfwflowese::regions.GetEtaMin()[midRegionIndex] && track.eta() < o2::analysis::gfwflowese::regions.GetEtaMax()[midRegionIndex]) + ++acceptedTracks.nMid; + } + + template + inline void processTrack(TTrack const& track, const float& vtxz, const int& multiplicity, const int& run, DensityCorr densitycorrections, AcceptedTracks& acceptedTracks) + { + if constexpr (framework::has_type_v) { + if (track.mcParticleId() < 0 || !(track.has_mcParticle())) + return; + + auto mcParticle = track.mcParticle(); + if (!mcParticle.isPhysicalPrimary()) + return; + if (!isStable(mcParticle.pdgCode())) + return; + if (cfgFillQA) { + fillTrackQA(track, vtxz); + registry.fill(HIST("trackQA/before/nch_pt"), multiplicity, track.pt()); + } + if (!trackSelected(track)) + return; + + if (cfgFillWeights) { + fillWeights(track, vtxz, run); + } else { + fillPtSums(track); + fillGFW(track, vtxz, densitycorrections); + fillAcceptedTracks(track, acceptedTracks); + } + + if (cfgFillQA) { + fillTrackQA(track, vtxz); + registry.fill(HIST("trackQA/after/nch_pt"), multiplicity, track.pt()); + if (cfgRunByRun) { + th1sList[run][hPhi]->Fill(track.phi()); + th1sList[run][hEta]->Fill(track.eta()); + } + } + + } else if constexpr (framework::has_type_v) { + if (!track.isPhysicalPrimary() || !isStable(track.pdgCode())) + return; + + fillPtSums(track); + fillGFW(track, vtxz, densitycorrections); + fillAcceptedTracks(track, acceptedTracks); + if (cfgFillQA) { + fillTrackQA(track, vtxz); + registry.fill(HIST("MCGen/trackQA/nch_pt"), multiplicity, track.pt()); + } + } else { + if (cfgFillQA) { + fillTrackQA(track, vtxz); + registry.fill(HIST("trackQA/before/nch_pt"), multiplicity, track.pt()); + } + if (!trackSelected(track)) + return; + + if (cfgFillWeights) { + fillWeights(track, vtxz, run); + } else { + fillPtSums(track); + fillGFW(track, vtxz, densitycorrections); + fillAcceptedTracks(track, acceptedTracks); + } + if (cfgFillQA) { + fillTrackQA(track, vtxz); + registry.fill(HIST("trackQA/after/nch_pt"), multiplicity, track.pt()); + if (cfgRunByRun) { + th1sList[run][hPhi]->Fill(track.phi()); + th1sList[run][hEta]->Fill(track.eta()); + th3sList[run][hNUAref]->Fill(track.phi(), track.eta(), vtxz, getAcceptance(track, vtxz)); + } + } + } + return; + } + + template + inline void fillGFW(TTrack track, const double& vtxz, DensityCorr densitycorrections) + { + bool withinPtRef = (track.pt() > o2::analysis::gfwflowese::ptreflow && track.pt() < o2::analysis::gfwflowese::ptrefup); + bool withinPtPOI = (track.pt() > o2::analysis::gfwflowese::ptpoilow && track.pt() < o2::analysis::gfwflowese::ptpoiup); + if (!withinPtPOI && !withinPtRef) + return; + double weff = (dt == kGen) ? 1. : getEfficiency(track); + if (weff < 0) + return; + if (cfgUseDensityDependentCorrection && withinPtRef && dt != kGen) { + double fphi = densitycorrections.v2 * std::cos(2 * (track.phi() - densitycorrections.psi2Est)) + densitycorrections.v3 * std::cos(3 * (track.phi() - densitycorrections.psi3Est)) + densitycorrections.v4 * std::cos(4 * (track.phi() - densitycorrections.psi4Est)); + fphi = (1 + 2 * fphi); + int pTBinForEff = hFindPtBin->FindBin(track.pt()); + if (pTBinForEff >= 1 && pTBinForEff <= hFindPtBin->GetNbinsX()) { + float wEPeff = funcEff[pTBinForEff - 1]->Eval(fphi * densitycorrections.density); + if (wEPeff > 0.) { + wEPeff = 1. / wEPeff; + weff *= wEPeff; + } + } + } + double wacc = (dt == kGen) ? 1. : getAcceptance(track, vtxz); + if (withinPtRef) + fGFW->Fill(track.eta(), fSecondAxis->FindBin(track.pt()) - 1, track.phi(), weff * wacc, 1); + if (withinPtPOI) + fGFW->Fill(track.eta(), fSecondAxis->FindBin(track.pt()) - 1, track.phi(), weff * wacc, 2); + if (withinPtRef && withinPtPOI) + fGFW->Fill(track.eta(), fSecondAxis->FindBin(track.pt()) - 1, track.phi(), weff * wacc, 4); + return; + } + + template + inline void fillPtSums(TTrack track) + { + double weff = (dt == kGen) ? 1. : getEfficiency(track); + if (weff < 0) + return; + if (std::abs(track.eta()) < cfgEtaPtPt && track.pt() > o2::analysis::gfwflowese::ptreflow && track.pt() < o2::analysis::gfwflowese::ptrefup) { + (dt == kGen) ? fFCptgen->fill(1., track.pt()) : fFCpt->fill(weff, track.pt()); + } + } + + template + inline void fillTrackQA(TTrack track, const float vtxz) + { + if constexpr (dt == kGen) { + registry.fill(HIST("MCGen/trackQA/phi_eta_vtxZ"), track.phi(), track.eta(), vtxz); + registry.fill(HIST("MCGen/trackQA/pt_ref"), track.pt()); + registry.fill(HIST("MCGen/trackQA/pt_poi"), track.pt()); + } else { + double wacc = getAcceptance(track, vtxz); + registry.fill(HIST("trackQA/") + HIST(FillTimeName[ft]) + HIST("phi_eta_vtxZ"), track.phi(), track.eta(), vtxz, (ft == kAfter) ? wacc : 1.0); + registry.fill(HIST("trackQA/") + HIST(FillTimeName[ft]) + HIST("pt_dcaXY_dcaZ"), track.pt(), track.dcaXY(), track.dcaZ()); + + registry.fill(HIST("trackQA/") + HIST(FillTimeName[ft]) + HIST("chi2prTPCcls"), track.tpcChi2NCl()); + registry.fill(HIST("trackQA/") + HIST(FillTimeName[ft]) + HIST("chi2prITScls"), track.itsChi2NCl()); + registry.fill(HIST("trackQA/") + HIST(FillTimeName[ft]) + HIST("nTPCClusters"), track.tpcNClsFound()); + registry.fill(HIST("trackQA/") + HIST(FillTimeName[ft]) + HIST("nITSClusters"), track.itsNCls()); + registry.fill(HIST("trackQA/") + HIST(FillTimeName[ft]) + HIST("nTPCCrossedRows"), track.tpcNClsCrossedRows()); + + if (ft == kAfter) { + registry.fill(HIST("trackQA/") + HIST(FillTimeName[ft]) + HIST("pt_ref"), track.pt()); + registry.fill(HIST("trackQA/") + HIST(FillTimeName[ft]) + HIST("pt_poi"), track.pt()); + } + } + } + + template + float getCentrality(TCollision collision) + { + switch (cfgCentEstimator) { + case kCentFT0C: + return collision.centFT0C(); + case kCentFT0CVariant1: + return collision.centFT0CVariant1(); + case kCentFT0M: + return collision.centFT0M(); + case kCentFV0A: + return collision.centFV0A(); + case kCentNTPV: + return collision.centNTPV(); + case kCentNGlobal: + return collision.centNGlobal(); + case kCentMFT: + return collision.centMFT(); + default: + return collision.centFT0C(); + } + } + + template + inline void fillEventQA(TCollision collision, XAxis xaxis) + { + if constexpr (framework::has_type_v) { + registry.fill(HIST("eventQA/") + HIST(FillTimeName[ft]) + HIST("globalTracks_centT0C"), collision.centFT0C(), xaxis.multiplicity); + registry.fill(HIST("eventQA/") + HIST(FillTimeName[ft]) + HIST("PVTracks_centT0C"), collision.centFT0C(), collision.multNTracksPV()); + registry.fill(HIST("eventQA/") + HIST(FillTimeName[ft]) + HIST("multT0C_centT0C"), collision.centFT0C(), collision.multFT0C()); + registry.fill(HIST("eventQA/") + HIST(FillTimeName[ft]) + HIST("centT0M_centT0C"), collision.centFT0C(), collision.centFT0M()); + registry.fill(HIST("eventQA/") + HIST(FillTimeName[ft]) + HIST("centV0A_centT0C"), collision.centFT0C(), collision.centFV0A()); + registry.fill(HIST("eventQA/") + HIST(FillTimeName[ft]) + HIST("centGlobal_centT0C"), collision.centFT0C(), collision.centNGlobal()); + registry.fill(HIST("eventQA/") + HIST(FillTimeName[ft]) + HIST("centNTPV_centT0C"), collision.centFT0C(), collision.centNTPV()); + registry.fill(HIST("eventQA/") + HIST(FillTimeName[ft]) + HIST("centMFT_centT0C"), collision.centFT0C(), collision.centMFT()); + } + registry.fill(HIST("eventQA/") + HIST(FillTimeName[ft]) + HIST("globalTracks_PVTracks"), collision.multNTracksPV(), xaxis.multiplicity); + registry.fill(HIST("eventQA/") + HIST(FillTimeName[ft]) + HIST("globalTracks_multT0A"), collision.multFT0A(), xaxis.multiplicity); + registry.fill(HIST("eventQA/") + HIST(FillTimeName[ft]) + HIST("globalTracks_multV0A"), collision.multFV0A(), xaxis.multiplicity); + registry.fill(HIST("eventQA/") + HIST(FillTimeName[ft]) + HIST("multV0A_multT0A"), collision.multFT0A(), collision.multFV0A()); + if (cfgTimeDependent) { + registry.fill(HIST("eventQA/") + HIST(FillTimeName[ft]) + HIST("multiplicity_time"), xaxis.time, xaxis.multiplicity); + registry.fill(HIST("eventQA/") + HIST(FillTimeName[ft]) + HIST("multT0C_time"), xaxis.time, collision.multFT0C()); + registry.fill(HIST("eventQA/") + HIST(FillTimeName[ft]) + HIST("multT0A_time"), xaxis.time, collision.multFT0A()); + registry.fill(HIST("eventQA/") + HIST(FillTimeName[ft]) + HIST("multV0A_time"), xaxis.time, collision.multFV0A()); + registry.fill(HIST("eventQA/") + HIST(FillTimeName[ft]) + HIST("multPV_time"), xaxis.time, collision.multNTracksPV()); + } + return; + } + + double getTimeSinceStartOfFill(uint64_t timestamp, int firstRun) + { + auto runDuration = ccdb->getRunDuration(firstRun); + uint64_t tsSOF = runDuration.first; + uint64_t diff = timestamp - tsSOF; + return static_cast(diff) / 3600000.0; + } + + void processData(soa::Filtered>::iterator const& collision, aod::BCsWithTimestamps const&, GFWTracks const& tracks) + { + auto bc = collision.bc_as(); + int run = bc.runNumber(); + if (run != lastRun) { + lastRun = run; + LOGF(info, "run = %d", run); + if (cfgRunByRun) { + if (std::find(runNumbers.begin(), runNumbers.end(), run) == runNumbers.end()) { + LOGF(info, "Creating histograms for run %d", run); + createRunByRunHistograms(run); + runNumbers.push_back(run); + } else { + LOGF(info, "run %d already in runNumbers", run); + } + if (!cfgFillWeights) + loadCorrections(bc); + } + } + if (!cfgFillWeights && !cfgRunByRun) + loadCorrections(bc); + registry.fill(HIST("eventQA/eventSel"), kFilteredEvent); + if (cfgRunByRun) + th1sList[run][hEventSel]->Fill(kFilteredEvent); + if (!collision.sel8()) + return; + registry.fill(HIST("eventQA/eventSel"), kSel8); + if (cfgRunByRun) + th1sList[run][hEventSel]->Fill(kSel8); + if (cfgDoOccupancySel) { + int occupancy = collision.trackOccupancyInTimeRange(); + if (occupancy < 0 || occupancy > cfgOccupancySelection) + return; + } + const auto qPerc{collision.qPERCFT0C()}; + if (qPerc[0] < 0) + return; + registry.fill(HIST("eventQA/eventSel"), kOccupancy); + if (cfgRunByRun) + th1sList[run][hEventSel]->Fill(kOccupancy); + + const XAxis xaxis{getCentrality(collision), tracks.size(), (cfgTimeDependent) ? getTimeSinceStartOfFill(bc.timestamp(), *firstRunOfCurrentFill) : -1.0}; + if (cfgTimeDependent && run == *firstRunOfCurrentFill && firstRunOfCurrentFill != o2::analysis::gfwflowese::firstRunsOfFill.end() - 1) + ++firstRunOfCurrentFill; + + if (cfgFillQA) + fillEventQA(collision, xaxis); + registry.fill(HIST("eventQA/before/centrality"), xaxis.centrality); + registry.fill(HIST("eventQA/before/multiplicity"), xaxis.multiplicity); + if (cfgUseAdditionalEventCut && !eventSelected(collision, xaxis.multiplicity, xaxis.centrality, run)) + return; + if (cfgFillQA) + fillEventQA(collision, xaxis); + processCollision(collision, tracks, xaxis, run); + } + PROCESS_SWITCH(FlowGfwEse, processData, "Process analysis for non-derived data", true); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc), + }; +} From 2e51baa0bbc3ca47d64752d8566cf447de332fa3 Mon Sep 17 00:00:00 2001 From: Katarzyna <116073883+kgwizdzi@users.noreply.github.com> Date: Mon, 11 Aug 2025 11:50:42 +0200 Subject: [PATCH 326/345] [PWGCF] FemtoUniverse: updating MCReco and MCGen functions for track-D0 (#12510) --- .../femtoUniverseProducerTask.cxx | 419 +++++++----- .../Tasks/femtoUniverseEfficiencyBase.cxx | 30 +- .../Tasks/femtoUniversePairTaskTrackD0.cxx | 641 ++++++++++-------- 3 files changed, 670 insertions(+), 420 deletions(-) diff --git a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx index 1415e905f39..bf16f78ba14 100644 --- a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx +++ b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx @@ -297,6 +297,7 @@ struct FemtoUniverseProducerTask { /// Phi meson Configurable confPhiPtLowLimit{"confPhiPtLowLimit", 0.8, "Lower limit of the Phi pT."}; Configurable confPhiPtHighLimit{"confPhiPtHighLimit", 4.0, "Higher limit of the Phi pT."}; + Configurable confPhiEtaHighLimit{"confPhiEtaHighLimit", 0.8, "Maximum eta value of the Phi"}; Configurable confPhiInvMassLowLimit{"confPhiInvMassLowLimit", 1.011, "Lower limit of the Phi invariant mass"}; Configurable confPhiInvMassUpLimit{"confPhiInvMassUpLimit", 1.027, "Upper limit of the Phi invariant mass"}; // Phi meson daughters @@ -304,13 +305,21 @@ struct FemtoUniverseProducerTask { Configurable confPhiKaonRejectProtonNsigma{"confPhiKaonRejectProtonNsigma", 3.0, "Reject if particle could be a Proton combined nsigma value."}; // Kaons Configurable confPhiDoLFPID4Kaons{"confPhiDoLFPID4Kaons", true, "Switch on do PID for Kaons as in LF"}; - Configurable confPhiKaonNsigmaTPCfrom0_0to0_3{"confPhiKaonNsigmaTPCfrom0_0to0_3", 3.0, "Reject if Kaons in 0.0-0.3 are have TPC n sigma above this value."}; - Configurable confPhiKaonNsigmaTPCfrom0_3to0_45{"confPhiKaonNsigmaTPCfrom0_3to0_45", 2.0, "Reject if Kaons in 0.3-0.45 are have TPC n sigma above this value."}; - Configurable confPhiKaonNsigmaTPCfrom0_45to0_55{"confPhiKaonNsigmaTPCfrom0_45to0_55", 1.0, "Reject if Kaons in 0.45-0.55 are have TPC n sigma above this value."}; - Configurable confPhiKaonNsigmaTPCfrom0_55to1_5{"confPhiKaonNsigmaTPCfrom0_55to1_5", 3.0, "Reject if Kaons in 0.55-1.5 are have TPC n sigma above this value."}; - Configurable confPhiKaonNsigmaTOFfrom0_55to1_5{"confPhiKaonNsigmaTOFfrom0_55to1_5", 3.0, "Reject if Kaons in 0.55-1.5 are have TOF n sigma above this value."}; - Configurable confPhiKaonNsigmaTPCfrom1_5{"confPhiKaonNsigmaTPCfrom1_5", 3.0, "Reject if Kaons above 1.5 are have TPC n sigma above this value."}; - Configurable confPhiKaonNsigmaTOFfrom1_5{"confPhiKaonNsigmaTOFfrom1_5", 3.0, "Reject if Kaons above 1.5 are have TOF n sigma above this value."}; + Configurable confNSigmaTPCKaonLF{"confNSigmaTPCKaonLF", 3.0, "TPC Kaon Sigma as in LF"}; + Configurable confNSigmaCombKaonLF{"confNSigmaCombKaonLF", 3.0, "TPC and TOF Kaon Sigma (combined) as in LF"}; + Configurable confMomKaonLF{"confMomKaonLF", 0.5, "Momentum threshold for kaon identification as in LF"}; + Configurable confMomKaonRejected{"confMomKaonRejected", 0.5, "Momentum threshold for rejected kaon"}; + Configurable confMomKaon03{"confMomKaon03", 0.3, "Momentum threshold for kaon identification pT = 0.3 GeV/c"}; + Configurable confMomKaon045{"confMomKaon045", 0.45, "Momentum threshold for kaon identification pT = 0.45 GeV/c"}; + Configurable confMomKaon055{"confMomKaon055", 0.55, "Momentum threshold for kaon identification pT = 0.55 GeV/c"}; + Configurable confMomKaon15{"confMomKaon15", 1.5, "Momentum threshold for kaon identification pT = 1.5 GeV/c"}; + Configurable confPhiKaonNsigmaTPCfrom00to03{"confPhiKaonNsigmaTPCfrom00to03", 3.0, "Reject if Kaons in 0.0-0.3 are have TPC n sigma above this value."}; + Configurable confPhiKaonNsigmaTPCfrom03to045{"confPhiKaonNsigmaTPCfrom03to045", 2.0, "Reject if Kaons in 0.3-0.45 are have TPC n sigma above this value."}; + Configurable confPhiKaonNsigmaTPCfrom045to055{"confPhiKaonNsigmaTPCfrom045to055", 1.0, "Reject if Kaons in 0.45-0.55 are have TPC n sigma above this value."}; + Configurable confPhiKaonNsigmaTPCfrom055to15{"confPhiKaonNsigmaTPCfrom055to15", 3.0, "Reject if Kaons in 0.55-1.5 are have TPC n sigma above this value."}; + Configurable confPhiKaonNsigmaTOFfrom055to15{"confPhiKaonNsigmaTOFfrom055to15", 3.0, "Reject if Kaons in 0.55-1.5 are have TOF n sigma above this value."}; + Configurable confPhiKaonNsigmaTPCfrom15{"confPhiKaonNsigmaTPCfrom15", 3.0, "Reject if Kaons above 1.5 are have TPC n sigma above this value."}; + Configurable confPhiKaonNsigmaTOFfrom15{"confPhiKaonNsigmaTOFfrom15", 3.0, "Reject if Kaons above 1.5 are have TOF n sigma above this value."}; } ConfPhiSelection; // PDG codes for fillMCParticle function @@ -323,6 +332,8 @@ struct FemtoUniverseProducerTask { Configurable confD0D0barCandEtaCut{"confD0D0barCandEtaCut", 0.8, "max. cand. pseudorapidity"}; Configurable yD0D0barCandRecoMax{"yD0D0barCandRecoMax", 0.8, "MC Reco, max. rapidity of D0/D0bar cand."}; Configurable yD0D0barCandGenMax{"yD0D0barCandGenMax", 0.8, "MC Truth, max. rapidity of D0/D0bar cand."}; + Configurable trackD0pTGenMin{"trackD0pTGenMin", 0.0, "MC Truth, min. pT for tracks and D0/D0bar cand."}; + Configurable trackD0pTGenMax{"trackD0pTGenMax", 24.0, "MC Truth, max. pT for tracks and D0/D0bar cand."}; Configurable storeD0D0barDoubleMassHypo{"storeD0D0barDoubleMassHypo", false, "Store D0/D0bar cand. which pass selection criteria for both, D0 and D0bar"}; Configurable> classMlD0D0bar{"classMlD0D0bar", {0, 1, 2}, "Indexes of ML scores to be stored. Three indexes max."}; } ConfD0Selection; @@ -340,34 +351,34 @@ struct FemtoUniverseProducerTask { bool isKaonNSigma(float mom, float nsigmaTPCK, float nsigmaTOFK) { - if (mom < 0.3) { // 0.0-0.3 - if (std::abs(nsigmaTPCK) < ConfPhiSelection.confPhiKaonNsigmaTPCfrom0_0to0_3) { + if (mom < ConfPhiSelection.confMomKaon03) { // 0.0-0.3 + if (std::abs(nsigmaTPCK) < ConfPhiSelection.confPhiKaonNsigmaTPCfrom00to03) { return true; } else { return false; } - } else if (mom < 0.45) { // 0.30 - 0.45 - if (std::abs(nsigmaTPCK) < ConfPhiSelection.confPhiKaonNsigmaTPCfrom0_3to0_45) { + } else if (mom < ConfPhiSelection.confMomKaon045) { // 0.30 - 0.45 + if (std::abs(nsigmaTPCK) < ConfPhiSelection.confPhiKaonNsigmaTPCfrom03to045) { return true; } else { return false; } - } else if (mom < 0.55) { // 0.45-0.55 - if (std::abs(nsigmaTPCK) < ConfPhiSelection.confPhiKaonNsigmaTPCfrom0_45to0_55) { + } else if (mom < ConfPhiSelection.confMomKaon055) { // 0.45-0.55 + if (std::abs(nsigmaTPCK) < ConfPhiSelection.confPhiKaonNsigmaTPCfrom045to055) { return true; } else { return false; } - } else if (mom < 1.5) { // 0.55-1.5 (now we use TPC and TOF) - if ((std::abs(nsigmaTOFK) < ConfPhiSelection.confPhiKaonNsigmaTOFfrom0_55to1_5) && (std::abs(nsigmaTPCK) < ConfPhiSelection.confPhiKaonNsigmaTPCfrom0_55to1_5)) { + } else if (mom < ConfPhiSelection.confMomKaon15) { // 0.55-1.5 (now we use TPC and TOF) + if ((std::abs(nsigmaTOFK) < ConfPhiSelection.confPhiKaonNsigmaTOFfrom055to15) && (std::abs(nsigmaTPCK) < ConfPhiSelection.confPhiKaonNsigmaTPCfrom055to15)) { { return true; } } else { return false; } - } else if (mom > 1.5) { // 1.5 - - if ((std::abs(nsigmaTOFK) < ConfPhiSelection.confPhiKaonNsigmaTOFfrom1_5) && (std::abs(nsigmaTPCK) < ConfPhiSelection.confPhiKaonNsigmaTPCfrom1_5)) { + } else if (mom > ConfPhiSelection.confMomKaon15) { // 1.5 - + if ((std::abs(nsigmaTOFK) < ConfPhiSelection.confPhiKaonNsigmaTOFfrom15) && (std::abs(nsigmaTPCK) < ConfPhiSelection.confPhiKaonNsigmaTPCfrom15)) { return true; } else { return false; @@ -379,17 +390,17 @@ struct FemtoUniverseProducerTask { bool isKaonNSigmaLF(float mom, float nsigmaTPCK, float nsigmaTOFK, bool hasTOF) { - if (mom < 0.5) { - if (std::abs(nsigmaTPCK) < 3.0) { + if (mom < ConfPhiSelection.confMomKaonLF) { + if (std::abs(nsigmaTPCK) < ConfPhiSelection.confNSigmaTPCKaonLF) { return true; } else { return false; } - } else if (mom >= 0.5) { // 0.55-1.5 (now we use TPC and TOF) + } else if (mom >= ConfPhiSelection.confMomKaonLF) { // 0.5-1.5 (now we use TPC and TOF) if (!hasTOF) { return false; } else { - if (std::sqrt(nsigmaTPCK * nsigmaTPCK + nsigmaTOFK * nsigmaTOFK) < 3.0) { + if (std::sqrt(nsigmaTPCK * nsigmaTPCK + nsigmaTOFK * nsigmaTOFK) < ConfPhiSelection.confNSigmaCombKaonLF) { return true; } else { return false; @@ -402,14 +413,14 @@ struct FemtoUniverseProducerTask { bool isKaonRejected(float mom, float nsigmaTPCPr, float nsigmaTOFPr, float nsigmaTPCPi, float nsigmaTOFPi) { - if (mom < 0.5) { + if (mom < ConfPhiSelection.confMomKaonRejected) { if (std::abs(nsigmaTPCPi) < ConfPhiSelection.confPhiKaonRejectPionNsigma.value) { return true; } else if (std::abs(nsigmaTPCPr) < ConfPhiSelection.confPhiKaonRejectProtonNsigma.value) { return true; } } - if (mom > 0.5) { + if (mom > ConfPhiSelection.confMomKaonRejected) { if (std::hypot(nsigmaTOFPi, nsigmaTPCPi) < ConfPhiSelection.confPhiKaonRejectPionNsigma.value) { return true; } else if (std::hypot(nsigmaTOFPr, nsigmaTPCPr) < ConfPhiSelection.confPhiKaonRejectProtonNsigma.value) { @@ -442,7 +453,7 @@ struct FemtoUniverseProducerTask { if (mom <= ConfPIDBitmask.confMinMomTOF) { return (std::abs(nsigmaTPCParticle) < ConfPIDBitmask.confNsigmaTPCParticle); } else { - return (TMath::Hypot(nsigmaTOFParticle, nsigmaTPCParticle) < ConfPIDBitmask.confNsigmaCombinedParticle); + return (std::hypot(nsigmaTOFParticle, nsigmaTPCParticle) < ConfPIDBitmask.confNsigmaCombinedParticle); } } @@ -723,7 +734,8 @@ struct FemtoUniverseProducerTask { outputDebugParts(-999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., - -999., -999., + -999., + hfHelper.yD0(particle), // getter transRadius particle.mlProbD0()[0], // getter decayVtxX particle.mlProbD0()[1], // getter decayVtxY particle.mlProbD0()[2], // getter decayVtxZ @@ -732,7 +744,48 @@ struct FemtoUniverseProducerTask { outputDebugParts(-999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., - -999., -999., + -999., + hfHelper.yD0(particle), // getter transRadius + particle.mlProbD0bar()[0], // getter decayVtxX + particle.mlProbD0bar()[1], // getter decayVtxY + particle.mlProbD0bar()[2], // getter decayVtxZ + -999.); // Additional info for D0/D0bar + } else { + outputDebugParts(-999., -999., -999., -999., -999., -999., -999., -999., -999., + -999., -999., -999., -999., -999., -999., -999., -999., + -999., -999., -999., -999., -999., + -999., -999., -999., -999., -999., -999.); + } + } + + template + void fillDebugD0D0barMcMl(ParticleType const& particle) + { + int8_t originMcReco = 2; // 0 - prompt, 1 - non-prompt, 2 - default/else + if (particle.originMcRec() == RecoDecay::OriginType::Prompt) { + originMcReco = 0; + } else if (particle.originMcRec() == RecoDecay::OriginType::NonPrompt) { + originMcReco = 1; + } else { + originMcReco = 2; + } + if constexpr (isD0ML) { + outputDebugParts(particle.flagMcMatchRec(), // getter sign + originMcReco, -999., -999., -999., -999., -999., -999., -999., + -999., -999., -999., -999., -999., -999., -999., -999., + -999., -999., -999., -999., -999., + -999., + hfHelper.yD0(particle), // getter transRadius + particle.mlProbD0()[0], // getter decayVtxX + particle.mlProbD0()[1], // getter decayVtxY + particle.mlProbD0()[2], // getter decayVtxZ + -999.); // Additional info for D0/D0bar + } else if constexpr (isD0barML) { + outputDebugParts(particle.flagMcMatchRec(), -999., -999., -999., -999., -999., -999., -999., -999., + originMcReco, -999., -999., -999., -999., -999., -999., -999., + -999., -999., -999., -999., -999., + -999., + hfHelper.yD0(particle), // getter transRadius particle.mlProbD0bar()[0], // getter decayVtxX particle.mlProbD0bar()[1], // getter decayVtxY particle.mlProbD0bar()[2], // getter decayVtxZ @@ -815,7 +868,7 @@ struct FemtoUniverseProducerTask { if ((kaon1MC.isPhysicalPrimary() && kaon2MC.isPhysicalPrimary()) && (!motherskaon1MC.empty() && !motherskaon2MC.empty())) { for (const auto& particleMotherOfNeg : motherskaon1MC) { for (const auto& particleMotherOfPos : motherskaon2MC) { - if (particleMotherOfNeg == particleMotherOfPos && particleMotherOfNeg.pdgCode() == 333) { + if (particleMotherOfNeg == particleMotherOfPos && particleMotherOfNeg.pdgCode() == Pdg::kPhi) { phiOrigin = aod::femtouniverse_mc_particle::ParticleOriginMCTruth::kPrimary; } else { phiOrigin = aod::femtouniverse_mc_particle::ParticleOriginMCTruth::kFake; @@ -852,44 +905,6 @@ struct FemtoUniverseProducerTask { } } - template - void fillMCParticleD0(ParticleType const& hfCand) - { - if (std::abs(hfCand.flagMcMatchRec()) == o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { - // get corresponding MC particle and its info - int pdgCode = 0; - int hfCandOrigin = 99; - - if (hfCand.originMcRec() == RecoDecay::OriginType::Prompt) { - if (hfCand.isSelD0() == 1 && hfCand.isSelD0bar() == 0) { - hfCandOrigin = aod::femtouniverse_mc_particle::ParticleOriginMCTruth::kPrompt; - pdgCode = static_cast(Pdg::kD0); - } else if (hfCand.isSelD0() == 0 && hfCand.isSelD0bar() == 1) { - hfCandOrigin = aod::femtouniverse_mc_particle::ParticleOriginMCTruth::kPrompt; - pdgCode = static_cast(Pdg::kD0Bar); - } else { - hfCandOrigin = aod::femtouniverse_mc_particle::ParticleOriginMCTruth::kFake; - pdgCode = 0; - } - } else { - if (hfCand.isSelD0() == 1 && hfCand.isSelD0bar() == 0) { - hfCandOrigin = aod::femtouniverse_mc_particle::ParticleOriginMCTruth::kNonPrompt; - pdgCode = static_cast(Pdg::kD0); - } else if (hfCand.isSelD0() == 0 && hfCand.isSelD0bar() == 1) { - hfCandOrigin = aod::femtouniverse_mc_particle::ParticleOriginMCTruth::kNonPrompt; - pdgCode = static_cast(Pdg::kD0Bar); - } else { - hfCandOrigin = aod::femtouniverse_mc_particle::ParticleOriginMCTruth::kFake; - pdgCode = 0; - } - } - outputPartsMC(hfCandOrigin, pdgCode, hfCand.pt(), hfHelper.yD0(hfCand), hfCand.phi()); - outputPartsMCLabels(outputPartsMC.lastIndex()); - } else { - outputPartsMCLabels(-1); - } - } - template bool fillCollisions(CollisionType const& col, TrackType const& tracks) { @@ -1327,7 +1342,7 @@ struct FemtoUniverseProducerTask { } template - void fillD0mesons(CollisionType const&, TrackType const&, HfCandidate const& hfCands) + void fillD0D0barData(CollisionType const&, TrackType const&, HfCandidate const& hfCands) { std::vector childIDs = {0, 0}; // these IDs are necessary to keep track of the children std::vector tmpIDtrack; // this vector keeps track of the matching of the primary track table row <-> aod::track table global index @@ -1450,15 +1465,14 @@ struct FemtoUniverseProducerTask { } template - void fillD0D0barUsingML(CollisionType const&, TrackType const&, HfCandidate const& hfCands) + void fillD0D0barDataMl(CollisionType const&, TrackType const&, HfCandidate const& hfCands) { std::vector childIDs = {0, 0}; // these IDs are necessary to keep track of the children std::vector tmpIDtrack; // this vector keeps track of the matching of the primary track table row <-> aod::track table global index double invMassD0 = 0.0; double invMassD0bar = 0.0; bool isD0D0bar = false; - double mlProbD0D0barBg = 0.0; - uint8_t daughFlag = 0; // flag = 0 (daugh of D0 or D0bar), 1 (daug of D0), -1 (daugh of D0bar) + int8_t daughFlag = 0; // flag = 0 (daugh of D0 or D0bar), 1 (daug of D0), -1 (daugh of D0bar) for (const auto& hfCand : hfCands) { @@ -1474,7 +1488,6 @@ struct FemtoUniverseProducerTask { continue; } - // int postrackID = hfCand.prong0().globalIndex(); int postrackID = hfCand.prong0Id(); // Index to first prong int rowInPrimaryTrackTablePos = -1; rowInPrimaryTrackTablePos = getRowDaughters(postrackID, tmpIDtrack); @@ -1486,13 +1499,11 @@ struct FemtoUniverseProducerTask { if (hfCand.isSelD0() == 1 && hfCand.isSelD0bar() == 0) { invMassD0 = hfHelper.invMassD0ToPiK(hfCand); invMassD0bar = -hfHelper.invMassD0barToKPi(hfCand); - mlProbD0D0barBg = hfCand.mlProbD0()[0]; isD0D0bar = true; daughFlag = 1; } else if (hfCand.isSelD0() == 0 && hfCand.isSelD0bar() == 1) { invMassD0 = -hfHelper.invMassD0ToPiK(hfCand); invMassD0bar = hfHelper.invMassD0barToKPi(hfCand); - mlProbD0D0barBg = hfCand.mlProbD0bar()[0]; isD0D0bar = true; daughFlag = -1; } else if (hfCand.isSelD0() == 1 && hfCand.isSelD0bar() == 1) { @@ -1556,9 +1567,9 @@ struct FemtoUniverseProducerTask { hfCand.eta(), hfCand.phi(), aod::femtouniverseparticle::ParticleType::kD0, - -999, // cut, CutContainerType - -999, // PID, CutContainerType - mlProbD0D0barBg, // saving the probability for ML score class 1 + -999, // cut, CutContainerType + -999, // PID, CutContainerType + -999., // tempFitVar indexChildID, invMassD0, // D0 mass (mLambda) invMassD0bar); // D0bar mass (mAntiLambda) @@ -1566,9 +1577,9 @@ struct FemtoUniverseProducerTask { if (confIsDebug) { fillDebugParticle(postrack); // QA for positive daughter fillDebugParticle(negtrack); // QA for negative daughter - if (hfCand.isSelD0() == 1 && hfCand.isSelD0bar() == 0) { + if (hfCand.isSelD0() == 1) { fillDebugD0D0barML(hfCand); // QA for D0/D0bar - } else if (hfCand.isSelD0() == 0 && hfCand.isSelD0bar() == 1) { + } else if (hfCand.isSelD0bar() == 1) { fillDebugD0D0barML(hfCand); } else { fillDebugD0D0barML(hfCand); @@ -1581,6 +1592,149 @@ struct FemtoUniverseProducerTask { } } + template + void fillD0D0barMcMl(CollisionType const&, TrackType const&, HfCandidate const& hfCands, McPart const& mcParticles) + { + std::vector childIDs = {0, 0}; // these IDs are necessary to keep track of the children + std::vector tmpIDtrack; // this vector keeps track of the matching of the primary track table row <-> aod::track table global index + double invMassD0 = 0.0; + double invMassD0bar = 0.0; + bool isD0D0bar = false; + int indexMcRec = -1; + int8_t sign = 0; + int8_t daughFlag = 0; // flag = 0 (daugh of D0 or D0bar), 1 (daug of D0), -1 (daugh of D0bar) + + for (const auto& hfCand : hfCands) { + + if (!(hfCand.hfflag() & 1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) { + continue; + } + + if (ConfD0Selection.confD0D0barCandMaxY >= 0. && std::abs(hfHelper.yD0(hfCand)) > ConfD0Selection.confD0D0barCandMaxY) { + continue; + } + + if (std::abs(hfCand.eta()) > ConfD0Selection.confD0D0barCandEtaCut) { + continue; + } + + // Check whether the D0 candidate has the corresponding MC particle + auto postrack = hfCand.template prong0_as(); + auto negtrack = hfCand.template prong1_as(); + auto arrayDaughters = std::array{postrack, negtrack}; + indexMcRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughters, Pdg::kD0, std::array{+kPiPlus, -kKPlus}, true, &sign); + + if (!(indexMcRec > -1)) { + continue; + } + + if (std::abs(hfCand.flagMcMatchRec()) == o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { + int postrackID = hfCand.prong0Id(); // Index to first prong + int rowInPrimaryTrackTablePos = -1; + rowInPrimaryTrackTablePos = getRowDaughters(postrackID, tmpIDtrack); + childIDs[0] = rowInPrimaryTrackTablePos; + childIDs[1] = 0; + + if (hfCand.isSelD0() == 1 && hfCand.isSelD0bar() == 0) { + invMassD0 = hfHelper.invMassD0ToPiK(hfCand); + invMassD0bar = -hfHelper.invMassD0barToKPi(hfCand); + isD0D0bar = true; + daughFlag = 1; + } else if (hfCand.isSelD0() == 0 && hfCand.isSelD0bar() == 1) { + invMassD0 = -hfHelper.invMassD0ToPiK(hfCand); + invMassD0bar = hfHelper.invMassD0barToKPi(hfCand); + isD0D0bar = true; + daughFlag = -1; + } else if (hfCand.isSelD0() == 1 && hfCand.isSelD0bar() == 1) { + invMassD0 = hfHelper.invMassD0ToPiK(hfCand); + invMassD0bar = hfHelper.invMassD0barToKPi(hfCand); + if (ConfD0Selection.storeD0D0barDoubleMassHypo) { + isD0D0bar = true; + daughFlag = 0; + } else { + isD0D0bar = false; + daughFlag = 0; + } + } else { + invMassD0 = 0.0; + invMassD0bar = 0.0; + isD0D0bar = false; + } + + if (isD0D0bar) { + outputParts(outputCollision.lastIndex(), + hfCand.ptProng0(), + RecoDecay::eta(std::array{hfCand.pxProng0(), hfCand.pyProng0(), hfCand.pzProng0()}), // eta + RecoDecay::phi(hfCand.pxProng0(), hfCand.pyProng0()), // phi + aod::femtouniverseparticle::ParticleType::kD0Child, + -999, // cutContainerV0.at(femto_universe_v0_selection::V0ContainerPosition::kPosCuts), + -999, // cutContainerV0.at(femto_universe_v0_selection::V0ContainerPosition::kPosPID), + -999, + childIDs, + postrack.sign(), // D0 mass -> positive daughter of D0/D0bar + daughFlag); // D0bar mass -> sign that the daugh is from D0 or D0 decay + const int rowOfPosTrack = outputParts.lastIndex(); + if constexpr (isMC) { + fillMCParticle(postrack, o2::aod::femtouniverseparticle::ParticleType::kD0Child); + } + // int negtrackID = hfCand.prong1().globalIndex(); + int negtrackID = hfCand.prong1Id(); + int rowInPrimaryTrackTableNeg = -1; + rowInPrimaryTrackTableNeg = getRowDaughters(negtrackID, tmpIDtrack); + childIDs[0] = 0; + childIDs[1] = rowInPrimaryTrackTableNeg; + + outputParts(outputCollision.lastIndex(), + hfCand.ptProng1(), + RecoDecay::eta(std::array{hfCand.pxProng1(), hfCand.pyProng1(), hfCand.pzProng1()}), // eta + RecoDecay::phi(hfCand.pxProng1(), hfCand.pyProng1()), // phi + aod::femtouniverseparticle::ParticleType::kD0Child, + -999, // cutContainerV0.at(femto_universe_v0_selection::V0ContainerPosition::kNegCuts), + -999, // cutContainerV0.at(femto_universe_v0_selection::V0ContainerPosition::kNegPID), + -999, + childIDs, + negtrack.sign(), // negative daughter of D0/D0bar + daughFlag); // sign that the daugh is from D0 or D0 decay + const int rowOfNegTrack = outputParts.lastIndex(); + if constexpr (isMC) { + fillMCParticle(negtrack, o2::aod::femtouniverseparticle::ParticleType::kD0Child); + } + std::vector indexChildID = {rowOfPosTrack, rowOfNegTrack}; + + outputParts(outputCollision.lastIndex(), + hfCand.pt(), + hfCand.eta(), + hfCand.phi(), + aod::femtouniverseparticle::ParticleType::kD0, + -999, // cut, CutContainerType + -999, // PID, CutContainerType + -999., // tempFitVar + indexChildID, + invMassD0, // D0 mass (mLambda) + invMassD0bar); // D0bar mass (mAntiLambda) + + if (confIsDebug) { + fillDebugParticle(postrack); // QA for positive daughter + fillDebugParticle(negtrack); // QA for negative daughter + if (hfCand.isSelD0() == 1) { + fillDebugD0D0barMcMl(hfCand); // QA for D0/D0bar + } else if (hfCand.isSelD0bar() == 1) { + fillDebugD0D0barMcMl(hfCand); + } else { + fillDebugD0D0barMcMl(hfCand); + } + } + if constexpr (isMC) { + auto particleMother = mcParticles.rawIteratorAt(indexMcRec); // gen. level pT + auto yGen = RecoDecay::y(particleMother.pVector(), o2::constants::physics::MassD0); // gen. level y + outputPartsMC(0, particleMother.pdgCode(), particleMother.pt(), yGen, particleMother.phi()); + outputPartsMCLabels(outputPartsMC.lastIndex()); + } + } + } + } + } + template void fillPhi(CollisionType const& col, TrackType const& tracks) { @@ -1633,7 +1787,7 @@ struct FemtoUniverseProducerTask { sumVec += part2Vec; float phiEta = sumVec.Eta(); - if (std::abs(phiEta) > 0.8) { + if (std::abs(phiEta) > ConfPhiSelection.confPhiEtaHighLimit.value) { continue; } @@ -1736,7 +1890,9 @@ struct FemtoUniverseProducerTask { std::vector tmpPDGCodes = ConfGeneral.confMCTruthPDGCodes; // necessary due to some features of the Configurable for (auto const& pdg : tmpPDGCodes) { if (static_cast(pdg) == static_cast(pdgCode)) { - if (pdgCode == 333) { // && (recoMcIds && recoMcIds->get().contains(particle.globalIndex()))) { // ATTENTION: all Phi mesons are NOT primary particles + if (pdgCode == Pdg::kPhi) { // && (recoMcIds && recoMcIds->get().contains(particle.globalIndex()))) { // ATTENTION: all Phi mesons are NOT primary particles + pass = true; + } else if (pdgCode == Pdg::kD0) { pass = true; } else { if (confStoreMCmothers || particle.isPhysicalPrimary() || (ConfGeneral.confActivateSecondaries && recoMcIds && recoMcIds->get().contains(particle.globalIndex()))) @@ -1840,19 +1996,18 @@ struct FemtoUniverseProducerTask { } } - template - void fillMCTruthParticlesD0(TrackType const& tracks, std::optional>> recoMcIds = std::nullopt) + template + void fillMCTruthParticlesD0(TrackType const& mcParts, std::optional>> recoMcIds = std::nullopt) { std::vector childIDs = {0, 0}; // these IDs are necessary to keep track of the children std::vector tmpIDtrack; + float ptGenB = -1; - for (const auto& particle : tracks) { - /// if the most open selection criteria are not fulfilled there is no - /// point looking further at the track + for (const auto& particle : mcParts) { if (particle.eta() < -ConfFilterCuts.confEtaFilterCut || particle.eta() > ConfFilterCuts.confEtaFilterCut) continue; - if (particle.pt() < ConfFilterCuts.confPtLowFilterCut || particle.pt() > ConfFilterCuts.confPtHighFilterCut) + if (particle.pt() < ConfD0Selection.trackD0pTGenMin || particle.pt() > ConfD0Selection.trackD0pTGenMax) continue; uint32_t pdgCode = static_cast(particle.pdgCode()); @@ -1862,9 +2017,9 @@ struct FemtoUniverseProducerTask { std::vector tmpPDGCodes = ConfGeneral.confMCTruthPDGCodes; // necessary due to some features of the Configurable for (auto const& pdg : tmpPDGCodes) { if (static_cast(pdg) == static_cast(pdgCode)) { - if (pdgCode == 333) { // && (recoMcIds && recoMcIds->get().contains(particle.globalIndex()))) { // ATTENTION: all Phi mesons are NOT primary particles + if (pdgCode == Pdg::kPhi) { pass = true; - } else if (pdgCode == 421) { + } else if (pdgCode == Pdg::kD0) { pass = true; } else { if (particle.isPhysicalPrimary() || (ConfGeneral.confActivateSecondaries && recoMcIds && recoMcIds->get().contains(particle.globalIndex()))) @@ -1876,38 +2031,26 @@ struct FemtoUniverseProducerTask { continue; } - // now the table is filled - if constexpr (resolveDaughs) { - tmpIDtrack.push_back(particle.globalIndex()); - continue; - } - if (ConfGeneral.confIsActiveD0) { - - auto mcD0origin = aod::femtouniverseparticle::ParticleType::kMCTruthTrack; - float ptGenB = -1; + if (pdgCode == Pdg::kD0) { if (std::abs(particle.flagMcMatchGen()) == o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { if (ConfD0Selection.yD0D0barCandGenMax >= 0. && std::abs(RecoDecay::y(particle.pVector(), o2::constants::physics::MassD0)) > ConfD0Selection.yD0D0barCandGenMax) { continue; } - mcD0origin = aod::femtouniverseparticle::ParticleType::kMCTruthTrack; - // WORK IN PROGRESS: If needed changed it to prompt and non-prompt - /*if (particle.originMcGen() == RecoDecay::OriginType::Prompt) { - mcD0origin = aod::femtouniverse_mc_particle::ParticleOriginMCTruth::kPrompt; + if (particle.originMcGen() == RecoDecay::OriginType::Prompt) { ptGenB = -1; } else { - mcD0origin = aod::femtouniverse_mc_particle::ParticleOriginMCTruth::kNonPrompt; - ptGenB = particle.idxBhadMotherPart().pt(); - }*/ + ptGenB = mcParts.rawIteratorAt(particle.idxBhadMotherPart()).pt(); + } outputParts(outputCollision.lastIndex(), particle.pt(), particle.eta(), particle.phi(), - mcD0origin, - 0, - pdgCode, + aod::femtouniverseparticle::ParticleType::kMCTruthTrack, + -999., pdgCode, + pdgCode, // getter tempFitVar childIDs, - RecoDecay::y(particle.pVector(), o2::constants::physics::MassD0), + particle.flagMcMatchGen(), ptGenB); // pT of the B hadron (mother particle, only when non-prompt D0) } } else { @@ -1916,10 +2059,12 @@ struct FemtoUniverseProducerTask { particle.eta(), particle.phi(), aod::femtouniverseparticle::ParticleType::kMCTruthTrack, - 0, + -999., pdgCode, pdgCode, - childIDs, 0, 0); + childIDs, + -999., + -999.); } if (confIsDebug) { fillDebugParticle(particle); @@ -1932,43 +2077,6 @@ struct FemtoUniverseProducerTask { outputDebugPartsMC(9999); } } - if constexpr (resolveDaughs) { - childIDs[0] = 0; - childIDs[1] = 0; - for (std::size_t i = 0; i < tmpIDtrack.size(); i++) { - const auto& particle = tracks.iteratorAt(tmpIDtrack[i] - tracks.begin().globalIndex()); - for (int daughIndex = 0, n = std::min(2ul, particle.daughtersIds().size()); daughIndex < n; daughIndex++) { - // loop to find the corresponding index of the daughters - for (std::size_t j = 0; j < tmpIDtrack.size(); j++) { - if (tmpIDtrack[j] == particle.daughtersIds()[daughIndex]) { - childIDs[daughIndex] = i - j; - break; - } - } - } - outputParts(outputCollision.lastIndex(), - particle.pt(), - particle.eta(), - particle.phi(), - aod::femtouniverseparticle::ParticleType::kMCTruthTrack, - 0, - static_cast(particle.pdgCode()), - particle.pdgCode(), - childIDs, - 0, - 0); - if (confIsDebug) { - fillDebugParticle(particle); - } - - // Workaround to keep the FDParticles and MC label tables - // aligned, so that they can be joined in the task. - if constexpr (transientLabels) { - outputPartsMCLabels(-1); - outputDebugPartsMC(9999); - } - } - } } template (col, tracks); if (colcheck) { fillTracks(tracks); - fillD0mesons(col, tracks, candidates); + fillD0D0barData(col, tracks, candidates); } } PROCESS_SWITCH(FemtoUniverseProducerTask, processTrackD0mesonData, @@ -2191,7 +2299,7 @@ struct FemtoUniverseProducerTask { const auto colcheck = fillCollisions(col, tracks); if (colcheck) { fillTracks(tracks); - fillD0D0barUsingML(col, tracks, candidates); + fillD0D0barDataMl(col, tracks, candidates); } } PROCESS_SWITCH(FemtoUniverseProducerTask, processTrackD0DataML, @@ -2415,14 +2523,15 @@ struct FemtoUniverseProducerTask { } PROCESS_SWITCH(FemtoUniverseProducerTask, processTruthAndFullMCCentRun3Casc, "Provide both MC truth and reco for tracks and cascades with centrality", false); + Preslice> mcPartPerMcColl = aod::mcparticle::mcCollisionId; Preslice> perCollisionD0s = aod::track::collisionId; void processTrackD0MC(aod::McCollisions const& mccols, - aod::TracksWMc const&, soa::Join const& collisions, soa::Filtered> const& tracks, soa::Join const& hfMcGenCands, soa::Join const& hfMcRecoCands, - aod::BCsWithTimestamps const&) + aod::BCsWithTimestamps const&, + aod::McParticles const& mcParts) { // MC Reco std::set recoMcIds; @@ -2434,8 +2543,8 @@ struct FemtoUniverseProducerTask { // fill the tables const auto colcheck = fillCollisions(col, tracks); if (colcheck) { - fillTracks(tracks); - fillD0D0barUsingML(col, groupedTracks, groupedD0s); + fillTracks(groupedTracks); + fillD0D0barMcMl(col, groupedTracks, groupedD0s, mcParts); for (const auto& track : groupedTracks) { if (trackCuts.isSelectedMinimal(track)) recoMcIds.insert(track.mcParticleId()); @@ -2444,10 +2553,10 @@ struct FemtoUniverseProducerTask { } // MC Truth for (const auto& mccol : mccols) { - auto groupedMCParticles = hfMcGenCands.sliceBy(perMCCollision, mccol.globalIndex()); + auto groupedMCParticles = hfMcGenCands.sliceBy(mcPartPerMcColl, mccol.globalIndex()); auto groupedCollisions = collisions.sliceBy(recoCollsPerMCColl, mccol.globalIndex()); - fillMCTruthCollisions(groupedCollisions, groupedMCParticles); // fills the reco collisions for mc collision - fillMCTruthParticlesD0(groupedMCParticles, recoMcIds); // fills mc particles + fillMCTruthCollisions(groupedCollisions, groupedMCParticles); // fills the reco collisions for mc collision + fillMCTruthParticlesD0(groupedMCParticles, recoMcIds); // fills mc particles } } PROCESS_SWITCH(FemtoUniverseProducerTask, processTrackD0MC, "Provide MC data for track D0 analysis", false); diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniverseEfficiencyBase.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniverseEfficiencyBase.cxx index cc0ab0077c8..d974dd0f408 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniverseEfficiencyBase.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniverseEfficiencyBase.cxx @@ -70,6 +70,7 @@ struct FemtoUniverseEfficiencyBase { /// Kaon configurable Configurable isKaonRun2{"isKaonRun2", false, "Enable kaon selection used in Run2"}; // to check consistency with Run2 results + Configurable isKaonLF{"isKaonLF", false, "Enable kaon selection used in LF group"}; // select kaons according to the selection in LF group struct : o2::framework::ConfigurableGroup { // Momentum thresholds for Run2 and Run3 Configurable confMomKaonRun2{"confMomKaonRun2", 0.4, "Momentum threshold for kaon identification using ToF (Run2)"}; @@ -93,6 +94,10 @@ struct FemtoUniverseEfficiencyBase { Configurable confKaonNsigmaTOFfrom055to15{"confKaonNsigmaTOFfrom055to15", 3.0, "Reject kaons within pT from 0.55 to 1.5 if ToF n sigma is above this value."}; Configurable confKaonNsigmaTPCfrom15{"confKaonNsigmaTPCfrom15", 3.0, "Reject kaons with pT above 1.5 if TPC n sigma is above this value."}; Configurable confKaonNsigmaTOFfrom15{"confKaonNsigmaTOFfrom15", 2.0, "Reject kaons with pT above 1.5 if ToF n sigma is above this value.."}; + // n sigma cuts as in LF + Configurable confMomKaonLF{"confMomKaonLF", 0.5, "Momentum threshold for kaon identification using TOF (LF selection)"}; + Configurable confNSigmaTPCKaonLF{"confNSigmaTPCKaonLF", 3.0, "TPC Kaon Sigma as in LF"}; + Configurable confNSigmaCombKaonLF{"confNSigmaCombKaonLF", 3.0, "TPC and TOF Kaon Sigma (combined) as in LF"}; } ConfKaonSelection; /// Deuteron configurables @@ -259,6 +264,25 @@ struct FemtoUniverseEfficiencyBase { } } + bool isKaonNSigmaLF(float mom, float nsigmaTPCK, float nsigmaTOFK) + { + if (mom < ConfKaonSelection.confMomKaonLF) { + if (std::abs(nsigmaTPCK) < ConfKaonSelection.confNSigmaTPCKaonLF) { + return true; + } else { + return false; + } + } else if (mom >= ConfKaonSelection.confMomKaonLF) { + if (std::sqrt(nsigmaTPCK * nsigmaTPCK + nsigmaTOFK * nsigmaTOFK) < ConfKaonSelection.confNSigmaCombKaonLF) { + return true; + } else { + return false; + } + } else { + return false; + } + } + bool isPionNSigma(float mom, float nsigmaTPCPi, float nsigmaTOFPi) { if (mom < ConfBothTracks.confMomPion) { @@ -303,7 +327,11 @@ struct FemtoUniverseEfficiencyBase { break; case 321: // Kaon+ case -321: // Kaon- - return isKaonNSigma(mom, nsigmaTPCK, nsigmaTOFK); + if (isKaonLF) { + return isKaonNSigmaLF(mom, nsigmaTPCK, nsigmaTOFK); + } else { + return isKaonNSigma(mom, nsigmaTPCK, nsigmaTOFK); + } break; case 1000010020: // Deuteron case -1000010020: // Antideuteron diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackD0.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackD0.cxx index 3e68a275452..9075414cab1 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackD0.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackD0.cxx @@ -17,38 +17,37 @@ /// \author Zuzanna Chochulska, WUT Warsaw & CTU Prague, zchochul@cern.ch /// \author Katarzyna Gwiździel, WUT Warsaw, katarzyna.gwizdziel@cern.ch -#include -#include - -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/RunningWorkflowInfo.h" -#include "Framework/StepTHn.h" -#include "Framework/O2DatabasePDGPlugin.h" -#include "ReconstructionDataFormats/PID.h" - -#include "Common/DataModel/PIDResponse.h" -#include "Common/Core/RecoDecay.h" - -#include "PWGCF/FemtoUniverse/DataModel/FemtoDerived.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniverseParticleHisto.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseContainer.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseEfficiencyCalculator.h" #include "PWGCF/FemtoUniverse/Core/FemtoUniverseEventHisto.h" #include "PWGCF/FemtoUniverse/Core/FemtoUniversePairCleaner.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniverseFemtoContainer.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniverseAngularContainer.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h" -#include "PWGCF/FemtoUniverse/Core/femtoUtils.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniverseTrackSelection.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseParticleHisto.h" #include "PWGCF/FemtoUniverse/Core/FemtoUniverseSoftPionRemoval.h" -#include "PWGCF/FemtoUniverse/Core/FemtoUniverseEfficiencyCalculator.h" - +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseTrackSelection.h" +#include "PWGCF/FemtoUniverse/Core/femtoUtils.h" +#include "PWGCF/FemtoUniverse/DataModel/FemtoDerived.h" +#include "PWGHF/Core/DecayChannels.h" #include "PWGHF/Core/HfHelper.h" #include "PWGHF/Core/SelectorCuts.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "Common/Core/RecoDecay.h" +#include "Common/DataModel/PIDResponse.h" + +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/O2DatabasePDGPlugin.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/StepTHn.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/PID.h" + +#include +#include + using namespace o2; using namespace o2::analysis; using namespace o2::analysis::femto_universe; @@ -84,15 +83,17 @@ struct FemtoUniversePairTaskTrackD0 { SliceCache cache; Preslice perCol = aod::femtouniverseparticle::fdCollisionId; - using FemtoMCParticles = soa::Join; - Preslice perColMC = aod::femtouniverseparticle::fdCollisionId; + using FemtoMcRecoParticles = soa::Join; + Preslice perColMc = aod::femtouniverseparticle::fdCollisionId; /// Table for both particles struct : o2::framework::ConfigurableGroup { - Configurable confNsigmaCombinedProton{"confNsigmaCombinedProton", 3.0, "TPC and TOF Proton Sigma (combined) for momentum > 0.5"}; - Configurable confNsigmaTPCProton{"confNsigmaTPCProton", 3.0, "TPC Proton Sigma for momentum < 0.5"}; - Configurable confNsigmaCombinedPion{"confNsigmaCombinedPion", 3.0, "TPC and TOF Pion Sigma (combined) for momentum > 0.5"}; - Configurable confNsigmaTPCPion{"confNsigmaTPCPion", 3.0, "TPC Pion Sigma for momentum < 0.5"}; + Configurable confNsigmaCombinedProton{"confNsigmaCombinedProton", 3.0, "TPC and TOF Proton Sigma (combined)"}; + Configurable confNsigmaTPCProton{"confNsigmaTPCProton", 3.0, "TPC Proton Sigma"}; + Configurable confNsigmaCombinedPion{"confNsigmaCombinedPion", 3.0, "TPC and TOF Pion Sigma (combined)"}; + Configurable confNsigmaTPCPion{"confNsigmaTPCPion", 3.0, "TPC Pion Sigma"}; + Configurable confNsigmaCombinedKaon{"confNsigmaCombinedKaon", 3.0, "TPC and TOF Kaon Sigma (combined)"}; + Configurable confNsigmaTPCKaon{"confNsigmaTPCKaon", 3.0, "TPC Kaon Sigma"}; Configurable confIsMC{"confIsMC", false, "Enable additional Histogramms in the case of a MonteCarlo Run"}; Configurable> confTrkPIDnSigmaMax{"confTrkPIDnSigmaMax", std::vector{4.f, 3.f, 2.f}, "This configurable needs to be the same as the one used in the producer task"}; @@ -110,8 +111,9 @@ struct FemtoUniversePairTaskTrackD0 { Configurable confIsTrackIdentified{"confIsTrackIdentified", true, "Enable PID for the track"}; Configurable confTrackLowPtCut{"confTrackLowPtCut", 0.5, "Low pT cut of the track"}; Configurable confTrackHighPtCut{"confTrackHighPtCut", 2.5, "High pT cut of the track"}; - Configurable protonMinPtPidTpcTof{"protonMinPtPidTpcTof", 0.5, "Momentum threshold for change of the PID method (from using TPC to TPC and TOF)."}; - Configurable pionMinPtPidTpcTof{"pionMinPtPidTpcTof", 0.5, "Momentum threshold for change of the PID method (from using TPC to TPC and TOF)."}; + Configurable minPtPidTpcTofProton{"minPtPidTpcTofProton", 0.5, "Momentum threshold for change of the PID method (from using TPC to TPC and TOF)."}; + Configurable minPtPidTpcTofPion{"minPtPidTpcTofPion", 0.5, "Momentum threshold for change of the PID method (from using TPC to TPC and TOF)."}; + Configurable minPtPidTpcTofKaonLF{"minPtPidTpcTofKaonLF", 0.5, "Momentum threshold for change of the PID method (from using TPC to TPC and TOF)."}; } ConfTrack; /// Particle 2 --- D0/D0bar meson @@ -120,6 +122,8 @@ struct FemtoUniversePairTaskTrackD0 { Configurable confPDGCodeD0bar{"confPDGCodeD0bar", -421, "D0bar meson - PDG code"}; Configurable confMinPtD0D0bar{"confMinPtD0D0bar", 1.0, "D0/D0bar sel. - min. pT"}; Configurable confMaxPtD0D0bar{"confMaxPtD0D0bar", 3.0, "D0/D0bar sel. - max. pT"}; + Configurable confMinPtD0D0barReco{"confMinPtD0D0barReco", 0.5, "MC Reco - D0/D0bar sel. - min. pT"}; + Configurable confMaxPtD0D0barReco{"confMaxPtD0D0barReco", 24.0, "MC Reco - D0/D0bar sel. - max. pT"}; Configurable minInvMassD0D0barSignal{"minInvMassD0D0barSignal", 1.81, "Min. inv. mass of D0/D0bar for signal region"}; Configurable maxInvMassD0D0barSignal{"maxInvMassD0D0barSignal", 1.922, "Max. inv. mass of D0/D0bar for signal region"}; Configurable minInvMassD0D0barLeftSB{"minInvMassD0D0barLeftSB", 1.65, "Min. inv. mass of D0/D0bar for left SB region"}; @@ -148,34 +152,35 @@ struct FemtoUniversePairTaskTrackD0 { /// Partitions for particle 1 Partition partsTrack = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && (aod::femtouniverseparticle::sign == int8_t(ConfTrack.confTrackSign)) && (aod::femtouniverseparticle::pt > ConfTrack.confTrackLowPtCut) && (aod::femtouniverseparticle::pt < ConfTrack.confTrackHighPtCut); - Partition partsTrackMCReco = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && (aod::femtouniverseparticle::sign == int8_t(ConfTrack.confTrackSign)) && (aod::femtouniverseparticle::pt > ConfTrack.confTrackLowPtCut) && (aod::femtouniverseparticle::pt < ConfTrack.confTrackHighPtCut); - Partition partsTrackMCTruth = (aod::femtouniverseparticle::partType == static_cast(aod::femtouniverseparticle::ParticleType::kMCTruthTrack)) && (aod::femtouniverseparticle::pidCut == static_cast(ConfTrack.confPDGCodeTrack)) && (aod::femtouniverseparticle::pt > ConfTrack.confTrackLowPtCut) && (aod::femtouniverseparticle::pt < ConfTrack.confTrackHighPtCut); + Partition partsTrackMCReco = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && (aod::femtouniverseparticle::sign == int8_t(ConfTrack.confTrackSign)) && (aod::femtouniverseparticle::pt > ConfTrack.confTrackLowPtCut) && (aod::femtouniverseparticle::pt < ConfTrack.confTrackHighPtCut); + Partition partsTrackMCTruth = (aod::femtouniverseparticle::partType == static_cast(aod::femtouniverseparticle::ParticleType::kMCTruthTrack)) && (aod::femtouniverseparticle::pidCut == static_cast(ConfTrack.confPDGCodeTrack)) && (aod::femtouniverseparticle::pt > ConfTrack.confTrackLowPtCut) && (aod::femtouniverseparticle::pt < ConfTrack.confTrackHighPtCut); /// Partitions for particle 2 - /// Partition with all D0/D0bar mesons (which pass double mass hypothesis) - Partition partsAllDmesons = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0)) && ((aod::femtouniverseparticle::mLambda > 0.0f) || (aod::femtouniverseparticle::mAntiLambda > 0.0f)); + /// Partition with all D0/D0bar mesons (which pass one and double mass hypothesis) + Partition partsAllDmesons = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0)) && ((aod::femtouniverseparticle::mLambda > 0.0f) || (aod::femtouniverseparticle::mAntiLambda > 0.0f)) && (aod::femtouniverseparticle::decayVtxX < ConfMlOpt.confMaxProbMlClass1Bg) && (aod::femtouniverseparticle::decayVtxY > ConfMlOpt.confMinProbMlClass2Prompt); /// Partition with D0/D0bar candidates, which pass only one mass hypothesis - Partition partsOnlyD0D0bar = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0)) && (aod::femtouniverseparticle::mLambda < 0.0f || aod::femtouniverseparticle::mAntiLambda < 0.0f) && (aod::femtouniverseparticle::tempFitVar < ConfMlOpt.confMaxProbMlClass1Bg) && (aod::femtouniverseparticle::decayVtxY > ConfMlOpt.confMinProbMlClass2Prompt); + Partition partsOnlyD0D0bar = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0)) && (aod::femtouniverseparticle::mLambda < 0.0f || aod::femtouniverseparticle::mAntiLambda < 0.0f) && (aod::femtouniverseparticle::decayVtxX < ConfMlOpt.confMaxProbMlClass1Bg) && (aod::femtouniverseparticle::decayVtxY > ConfMlOpt.confMinProbMlClass2Prompt); /// Partition with D0 mesons only (one and double mass hypothesis) Partition partsAllD0s = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0)) && (aod::femtouniverseparticle::mLambda > ConfDmesons.minInvMassD0D0barSignal) && (aod::femtouniverseparticle::mLambda < ConfDmesons.maxInvMassD0D0barSignal) && (aod::femtouniverseparticle::pt > ConfDmesons.confMinPtD0D0bar) && (aod::femtouniverseparticle::pt < ConfDmesons.confMaxPtD0D0bar); /// Partition with D0 mesons only (one mass hypothesis) - Partition partsD0s = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0)) && (aod::femtouniverseparticle::mLambda > ConfDmesons.minInvMassD0D0barSignal) && (aod::femtouniverseparticle::mLambda < ConfDmesons.maxInvMassD0D0barSignal) && (aod::femtouniverseparticle::mAntiLambda < 0.0f) && (aod::femtouniverseparticle::pt > ConfDmesons.confMinPtD0D0bar) && (aod::femtouniverseparticle::pt < ConfDmesons.confMaxPtD0D0bar) && (aod::femtouniverseparticle::tempFitVar < ConfMlOpt.confMaxProbMlClass1Bg) && (aod::femtouniverseparticle::decayVtxY > ConfMlOpt.confMinProbMlClass2Prompt); + Partition partsD0s = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0)) && (aod::femtouniverseparticle::mLambda > ConfDmesons.minInvMassD0D0barSignal) && (aod::femtouniverseparticle::mLambda < ConfDmesons.maxInvMassD0D0barSignal) && (aod::femtouniverseparticle::mAntiLambda < 0.0f) && (aod::femtouniverseparticle::pt > ConfDmesons.confMinPtD0D0bar) && (aod::femtouniverseparticle::pt < ConfDmesons.confMaxPtD0D0bar) && (aod::femtouniverseparticle::decayVtxX < ConfMlOpt.confMaxProbMlClass1Bg) && (aod::femtouniverseparticle::decayVtxY > ConfMlOpt.confMinProbMlClass2Prompt); /// Partition with D0s selected from the side-band (SB) regions (candidates with double mass hypothesis included) Partition partsD0sFromSB = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0)) && ((aod::femtouniverseparticle::mLambda > ConfDmesons.minInvMassD0D0barLeftSB && aod::femtouniverseparticle::mLambda < ConfDmesons.maxInvMassD0D0barLeftSB) || (aod::femtouniverseparticle::mLambda > ConfDmesons.minInvMassD0D0barRightSB && aod::femtouniverseparticle::mLambda < ConfDmesons.maxInvMassD0D0barRightSB)) && (aod::femtouniverseparticle::pt > ConfDmesons.confMinPtD0D0bar) && (aod::femtouniverseparticle::pt < ConfDmesons.confMaxPtD0D0bar); /// Partition with D0bar mesons only (one and double mass hypothesis) Partition partsAllD0bars = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0)) && (aod::femtouniverseparticle::mAntiLambda > ConfDmesons.minInvMassD0D0barSignal) && (aod::femtouniverseparticle::mAntiLambda < ConfDmesons.maxInvMassD0D0barSignal) && (aod::femtouniverseparticle::pt > ConfDmesons.confMinPtD0D0bar) && (aod::femtouniverseparticle::pt < ConfDmesons.confMaxPtD0D0bar); /// Partition with D0bar mesons only (one mass hypothesis) - Partition partsD0bars = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0)) && (aod::femtouniverseparticle::mLambda < 0.0f) && (aod::femtouniverseparticle::mAntiLambda > ConfDmesons.minInvMassD0D0barSignal) && (aod::femtouniverseparticle::mAntiLambda < ConfDmesons.maxInvMassD0D0barSignal) && (aod::femtouniverseparticle::pt > ConfDmesons.confMinPtD0D0bar) && (aod::femtouniverseparticle::pt < ConfDmesons.confMaxPtD0D0bar) && (aod::femtouniverseparticle::tempFitVar < ConfMlOpt.confMaxProbMlClass1Bg) && (aod::femtouniverseparticle::decayVtxY > ConfMlOpt.confMinProbMlClass2Prompt); + Partition partsD0bars = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0)) && (aod::femtouniverseparticle::mLambda < 0.0f) && (aod::femtouniverseparticle::mAntiLambda > ConfDmesons.minInvMassD0D0barSignal) && (aod::femtouniverseparticle::mAntiLambda < ConfDmesons.maxInvMassD0D0barSignal) && (aod::femtouniverseparticle::pt > ConfDmesons.confMinPtD0D0bar) && (aod::femtouniverseparticle::pt < ConfDmesons.confMaxPtD0D0bar) && (aod::femtouniverseparticle::decayVtxX < ConfMlOpt.confMaxProbMlClass1Bg) && (aod::femtouniverseparticle::decayVtxY > ConfMlOpt.confMinProbMlClass2Prompt); /// Partition with D0bars selected from the side-band (SB) regions (candidates with double mass hypothesis included) Partition partsD0barsFromSB = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0)) && ((aod::femtouniverseparticle::mAntiLambda > ConfDmesons.minInvMassD0D0barLeftSB && aod::femtouniverseparticle::mAntiLambda < ConfDmesons.maxInvMassD0D0barLeftSB) || (aod::femtouniverseparticle::mAntiLambda > ConfDmesons.minInvMassD0D0barRightSB && aod::femtouniverseparticle::mAntiLambda < ConfDmesons.maxInvMassD0D0barRightSB)) && (aod::femtouniverseparticle::pt > ConfDmesons.confMinPtD0D0bar) && (aod::femtouniverseparticle::pt < ConfDmesons.confMaxPtD0D0bar); /// Partition for D0/D0bar mesons from MC - Partition partsD0D0barMCReco = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0)) && (aod::femtouniverseparticle::mLambda < 0.0f || aod::femtouniverseparticle::mAntiLambda < 0.0f) && (aod::femtouniverseparticle::pt > ConfDmesons.confMinPtD0D0bar) && (aod::femtouniverseparticle::pt < ConfDmesons.confMaxPtD0D0bar) && (aod::femtouniverseparticle::tempFitVar < ConfMlOpt.confMaxProbMlClass1Bg) && (aod::femtouniverseparticle::decayVtxY > ConfMlOpt.confMinProbMlClass2Prompt); - Partition partsD0D0barMCTruth = (aod::femtouniverseparticle::partType == static_cast(aod::femtouniverseparticle::ParticleType::kMCTruthTrack)) && (aod::femtouniverseparticle::pidCut == static_cast(ConfDmesons.confPDGCodeD0) || aod::femtouniverseparticle::pidCut == static_cast(ConfDmesons.confPDGCodeD0bar)) && (aod::femtouniverseparticle::pt > ConfDmesons.confMinPtD0D0bar) && (aod::femtouniverseparticle::pt < ConfDmesons.confMaxPtD0D0bar); + Partition partsD0D0barMCReco = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0)) && (aod::femtouniverseparticle::mLambda < 0.0f || aod::femtouniverseparticle::mAntiLambda < 0.0f) && (aod::femtouniverseparticle::pt > ConfDmesons.confMinPtD0D0bar) && (aod::femtouniverseparticle::pt < ConfDmesons.confMaxPtD0D0bar) && (aod::femtouniverseparticle::decayVtxX < ConfMlOpt.confMaxProbMlClass1Bg) && (aod::femtouniverseparticle::decayVtxY > ConfMlOpt.confMinProbMlClass2Prompt); + Partition partsD0D0barMCTruth = (aod::femtouniverseparticle::partType == static_cast(aod::femtouniverseparticle::ParticleType::kMCTruthTrack)) && (aod::femtouniverseparticle::pidCut == static_cast(ConfDmesons.confPDGCodeD0) || aod::femtouniverseparticle::pidCut == static_cast(ConfDmesons.confPDGCodeD0bar)) && (aod::femtouniverseparticle::pt > ConfDmesons.confMinPtD0D0bar) && (aod::femtouniverseparticle::pt < ConfDmesons.confMaxPtD0D0bar); /// Partition for D0/D0bar daughters Partition partsDmesonsChildren = aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kD0Child); /// Histogramming for particle 1 - FemtoUniverseParticleHisto trackHistoPartTrack; + FemtoUniverseParticleHisto trackHistoPartTrack; + FemtoUniverseParticleHisto hTrackDCA; /// Histogramming for particle 2 FemtoUniverseParticleHisto trackHistoPartD0D0bar; @@ -191,6 +196,7 @@ struct FemtoUniversePairTaskTrackD0 { ConfigurableAxis confTempFitVarBins{"confTempFitVarBins", {300, -0.15, 0.15}, "binning of the TempFitVar in the pT vs. TempFitVar plot"}; ConfigurableAxis confTempFitVarInvMassBins{"confTempFitVarInvMassBins", {6000, 0.9, 4.0}, "binning of the TempFitVar in the pT vs. TempFitVar plot"}; ConfigurableAxis confTempFitVarpTBins{"confTempFitVarpTBins", {20, 0.5, 4.05}, "pT binning of the pT vs. TempFitVar plot"}; + ConfigurableAxis confTempFitVarDCABins{"confTempFitVarDCABins", {500, -1.0, 1.0}, "binning of the DCA histograms"}; /// Correlation part ConfigurableAxis confMultBins{"confMultBins", {VARIABLE_WIDTH, 0.0f, 4.0f, 8.0f, 12.0f, 16.0f, 20.0f, 24.0f, 28.0f, 32.0f, 36.0f, 40.0f, 44.0f, 48.0f, 52.0f, 56.0f, 60.0f, 64.0f, 68.0f, 72.0f, 76.0f, 80.0f, 84.0f, 88.0f, 92.0f, 96.0f, 100.0f, 200.0f, 99999.f}, "Mixing bins - multiplicity"}; // \todo to be obtained from the hash task @@ -223,8 +229,8 @@ struct FemtoUniversePairTaskTrackD0 { // Event mixing configurables Configurable confNEventsMix{"confNEventsMix", 5, "Number of events for mixing"}; - FemtoUniverseAngularContainer sameEventAngularCont; - FemtoUniverseAngularContainer mixedEventAngularCont; + FemtoUniverseContainer sameEventAngularCont; + FemtoUniverseContainer mixedEventAngularCont; FemtoUniversePairCleaner pairCleaner; FemtoUniverseDetaDphiStar pairCloseRejection; FemtoUniverseSoftPionRemoval softPionRemoval; @@ -237,8 +243,9 @@ struct FemtoUniversePairTaskTrackD0 { HistogramRegistry qaRegistry{"TrackQA", {}, OutputObjHandlingPolicy::AnalysisObject}; HistogramRegistry resultRegistry{"Correlations", {}, OutputObjHandlingPolicy::AnalysisObject}; HistogramRegistry mixQaRegistry{"mixQaRegistry", {}, OutputObjHandlingPolicy::AnalysisObject}; - HistogramRegistry mcRecoRegistry{"mcRecoRegistry", {}, OutputObjHandlingPolicy::AnalysisObject, false, true}; - HistogramRegistry mcTruthRegistry{"mcTruthRegistry", {}, OutputObjHandlingPolicy::AnalysisObject, false, true}; + HistogramRegistry mcRecoRegistry{"McRecoHistos", {}, OutputObjHandlingPolicy::AnalysisObject, false, true}; + HistogramRegistry mcTruthRegistry{"McGenHistos", {}, OutputObjHandlingPolicy::AnalysisObject, false, true}; + HistogramRegistry registryDCA{"registryDCA", {}, OutputObjHandlingPolicy::AnalysisObject, false, true}; // Efficiency EfficiencyConfigurableGroup effConfGroup; @@ -246,16 +253,13 @@ struct FemtoUniversePairTaskTrackD0 { float weight = 1.0; HistogramRegistry registry{"registry", - {{"hInvMassD0", ";#it{M}(K^{-}#pi^{+}) (GeV/#it{c}^{2});counts", {HistType::kTH1F, {confInvMassBins}}}, - {"hInvMassD0bar", ";#it{M}(#pi^{-}K^{+}) (GeV/#it{c}^{2});counts", {HistType::kTH1F, {confInvMassBins}}}, - {"hPtDmesonCand", "2-prong candidates;#it{p}_{T} (GeV/#it{c});counts", {HistType::kTH1F, {confPtBins}}}, - {"hPtD0", "D^{0} cand.;#it{p}_{T} (GeV/#it{c});counts", {HistType::kTH1F, {confPtBins}}}, + {{"hPtD0", "D^{0} cand.;#it{p}_{T} (GeV/#it{c});counts", {HistType::kTH1F, {confPtBins}}}, {"hPtD0bar", "#bar{D^{0}};#it{p}_{T} (GeV/#it{c});counts", {HistType::kTH1F, {confPtBins}}}, {"hPtD0D0bar", "#bar{D^{0}};#it{p}_{T} (GeV/#it{c});counts", {HistType::kTH1F, {confPtBins}}}, - {"hPhiDmesonCand", ";#varphi (rad);counts", {HistType::kTH1F, {{80, 0., o2::constants::math::TwoPI}}}}, + {"hPhiD0D0bar", ";#varphi (rad);counts", {HistType::kTH1F, {{80, 0., o2::constants::math::TwoPI}}}}, {"hPhiD0", ";#varphi (rad);counts", {HistType::kTH1F, {{80, 0., o2::constants::math::TwoPI}}}}, {"hPhiD0bar", ";#varphi (rad);counts", {HistType::kTH1F, {{80, 0., o2::constants::math::TwoPI}}}}, - {"hEtaDmesonCand", ";#eta ;counts", {HistType::kTH1F, {{200, -1., 1.}}}}, + {"hEtaD0D0bar", ";#eta ;counts", {HistType::kTH1F, {{200, -1., 1.}}}}, {"hEtaD0", ";#eta ;counts", {HistType::kTH1F, {{200, -1., 1.}}}}, {"hEtaD0bar", ";#eta ;counts", {HistType::kTH1F, {{200, -1., 1.}}}}, {"hDecayLengthD0", ";decay length (cm);counts", {HistType::kTH1F, {{800, 0., 4.}}}}, @@ -268,13 +272,13 @@ struct FemtoUniversePairTaskTrackD0 { // PID for protons bool isProtonNSigma(float mom, float nsigmaTPCPr, float nsigmaTOFPr) // previous version from: https://github.com/alisw/AliPhysics/blob/master/PWGCF/FEMTOSCOPY/AliFemtoUser/AliFemtoMJTrackCut.cxx { - if (mom < ConfTrack.protonMinPtPidTpcTof) { + if (mom < ConfTrack.minPtPidTpcTofProton) { if (std::abs(nsigmaTPCPr) < ConfBothTracks.confNsigmaTPCProton) { return true; } else { return false; } - } else if (mom > ConfTrack.protonMinPtPidTpcTof) { + } else if (mom > ConfTrack.minPtPidTpcTofProton) { if (std::hypot(nsigmaTOFPr, nsigmaTPCPr) < ConfBothTracks.confNsigmaCombinedProton) { return true; } else { @@ -284,36 +288,16 @@ struct FemtoUniversePairTaskTrackD0 { return false; } - bool isKaonNSigma(float mom, float nsigmaTPCK, float nsigmaTOFK) + bool isKaonNSigmaLF(float mom, float nsigmaTPCK, float nsigmaTOFK) { - if (mom < 0.3) { // 0.0-0.3 - if (std::abs(nsigmaTPCK) < 3.0) { - return true; - } else { - return false; - } - } else if (mom < 0.45) { // 0.30 - 0.45 - if (std::abs(nsigmaTPCK) < 2.0) { + if (mom < ConfTrack.minPtPidTpcTofKaonLF) { + if (std::abs(nsigmaTPCK) < ConfBothTracks.confNsigmaTPCKaon) { return true; } else { return false; } - } else if (mom < 0.55) { // 0.45-0.55 - if (std::abs(nsigmaTPCK) < 1.0) { - return true; - } else { - return false; - } - } else if (mom < 1.5) { // 0.55-1.5 (now we use TPC and TOF) - if ((std::abs(nsigmaTOFK) < 3.0) && (std::abs(nsigmaTPCK) < 3.0)) { - { - return true; - } - } else { - return false; - } - } else if (mom > 1.5) { - if ((std::abs(nsigmaTOFK) < 2.0) && (std::abs(nsigmaTPCK) < 3.0)) { + } else if (mom >= ConfTrack.minPtPidTpcTofKaonLF) { + if (std::sqrt(nsigmaTPCK * nsigmaTPCK + nsigmaTOFK * nsigmaTOFK) < ConfBothTracks.confNsigmaCombinedKaon) { return true; } else { return false; @@ -326,16 +310,16 @@ struct FemtoUniversePairTaskTrackD0 { bool isPionNSigma(float mom, float nsigmaTPCPi, float nsigmaTOFPi) { // using configurables: - // confNsigmaTPCPion -> TPC Pion Sigma for momentum < 0.5 GeV/c - // confNsigmaCombinedPion -> TPC and TOF Pion Sigma (combined) for momentum > 0.5 GeV/c + // confNsigmaTPCPion -> TPC Pion Sigma for a given momentum + // confNsigmaCombinedPion -> TPC and TOF Pion Sigma (combined) for a given momentum if (true) { - if (mom < ConfTrack.pionMinPtPidTpcTof) { + if (mom < ConfTrack.minPtPidTpcTofPion) { if (std::abs(nsigmaTPCPi) < ConfBothTracks.confNsigmaTPCPion) { return true; } else { return false; } - } else if (mom > ConfTrack.pionMinPtPidTpcTof) { + } else if (mom > ConfTrack.minPtPidTpcTofPion) { if (std::hypot(nsigmaTOFPi, nsigmaTPCPi) < ConfBothTracks.confNsigmaCombinedPion) { return true; } else { @@ -359,7 +343,7 @@ struct FemtoUniversePairTaskTrackD0 { break; case 321: // Kaon+ case -321: // Kaon- - return isKaonNSigma(mom, nsigmaTPCK, nsigmaTOFK); + return isKaonNSigmaLF(mom, nsigmaTPCK, nsigmaTOFK); break; default: return false; @@ -368,12 +352,8 @@ struct FemtoUniversePairTaskTrackD0 { void init(InitContext&) { - // if (effConfGroup.confEfficiencyDoMCTruth) { - // WORK IN PROGRESS - // hMCTruth1.init(&qaRegistry, confBinsTempFitVarpT, confBinsTempFitVarPDG, false, ConfTrack.confTrackPDGCode, false); - // hMCTruth2.init(&qaRegistry, confBinsTempFitVarpT, confBinsTempFitVarPDG, false, 333, false); - // } efficiencyCalculator.init(); + hTrackDCA.init(®istryDCA, confTempFitVarpTBins, confTempFitVarDCABins, true, ConfTrack.confPDGCodeTrack, true); eventHisto.init(&qaRegistry); qaRegistry.add("QA_D0D0barSelection/hInvMassD0", ";#it{M}(K^{-}#pi^{+}) (GeV/#it{c}^{2});counts", kTH1F, {confInvMassBins}); @@ -418,22 +398,94 @@ struct FemtoUniversePairTaskTrackD0 { qaRegistry.add("Hadron/nSigmaTPCKa", "; #it{p} (GeV/#it{c}); n#sigma_{TPCKa}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); qaRegistry.add("Hadron/nSigmaTOFKa", "; #it{p} (GeV/#it{c}); n#sigma_{TOFKa}", kTH2F, {{100, 0, 10}, {200, -4.975, 5.025}}); + // D0/D0bar histograms + auto vbins = (std::vector)binsPt; + if (doEfficiencyCorr) { + registry.add("D0D0bar_oneMassHypo/hMassVsPtEffCorr", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("D0D0bar_oneMassHypo/hMassVsPtD0EffCorr", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("D0D0bar_oneMassHypo/hMassVsPtD0barEffCorr", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("D0D0bar_doubleMassHypo/hMassVsPtEffCorr", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("D0D0bar_doubleMassHypo/hMassVsPtD0EffCorr", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("D0D0bar_doubleMassHypo/hMassVsPtD0barEffCorr", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + } else { + registry.add("D0D0bar_oneMassHypo/hMassVsPt", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("D0D0bar_oneMassHypo/hMassVsPtD0", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("D0D0bar_oneMassHypo/hMassVsPtD0bar", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("D0D0bar_doubleMassHypo/hMassVsPt", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("D0D0bar_doubleMassHypo/hMassVsPtD0", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("D0D0bar_doubleMassHypo/hMassVsPtD0bar", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + } + // Histograms for BDT score classes' check + registry.add("DebugBdt/hBdtScore1VsStatus", ";BDT score;status", {HistType::kTH2F, {axisBdtScore, axisSelStatus}}); + registry.add("DebugBdt/hBdtScore2VsStatus", ";BDT score;status", {HistType::kTH2F, {axisBdtScore, axisSelStatus}}); + registry.add("DebugBdt/hBdtScore3VsStatus", ";BDT score;status", {HistType::kTH2F, {axisBdtScore, axisSelStatus}}); + if (applyMLOpt) { + registry.add("D0D0bar_MLSel/hMassVsPt1", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("D0D0bar_MLSel/hMassVsPt2", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("D0D0bar_MLSel/hMassVsPt3", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("D0D0bar_MLSel/hMassVsPt4", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("D0D0bar_MLSel/hMassVsPt5", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("D0D0bar_MLSel/hMassVsPt6", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("D0D0bar_MLSel/hMassVsPt7", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("D0D0bar_MLSel/hMassVsPt8", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("D0D0bar_MLSel/hMassVsPt9", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("D0D0bar_MLSel/hMassVsPt10", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + } + // MC Reco + mcRecoRegistry.add("hMcRecD0", "MC Reco all D0s;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {400, -1.0, 1.0}}}); + mcRecoRegistry.add("hMcRecD0Prompt", "MC Reco prompt D0s;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {400, -1.0, 1.0}}}); + mcRecoRegistry.add("hMcRecD0NonPrompt", "MC Reco non-prompt D0s;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {400, -1.0, 1.0}}}); + mcRecoRegistry.add("hMcRecD0Phi", "MC Reco all D0s;#varphi (rad); counts", {HistType::kTH1F, {{80, 0., o2::constants::math::TwoPI}}}); + mcRecoRegistry.add("hMcRecD0bar", "MC Reco all D0bars;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {400, -1.0, 1.0}}}); + mcRecoRegistry.add("hMcRecD0barPrompt", "MC Reco prompt D0bars;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {400, -1.0, 1.0}}}); + mcRecoRegistry.add("hMcRecD0barNonPrompt", "MC Reco non-prompt D0bars;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {400, -1.0, 1.0}}}); + mcRecoRegistry.add("hMcRecD0barPhi", "MC Reco all D0bars;#varphi (rad); counts", {HistType::kTH1F, {{80, 0., o2::constants::math::TwoPI}}}); + // Inv. mass histograms + mcRecoRegistry.add("hMassVsPtD0Sig", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + mcRecoRegistry.add("hMassVsPtD0Refl", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + mcRecoRegistry.add("hMassVsPtD0Bkg", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + mcRecoRegistry.add("hMassVsPtD0Prompt", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + mcRecoRegistry.add("hMassVsPtD0NonPrompt", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + mcRecoRegistry.add("hMassVsPtD0barSig", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + mcRecoRegistry.add("hMassVsPtD0barRefl", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + mcRecoRegistry.add("hMassVsPtD0barBkg", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + mcRecoRegistry.add("hMassVsPtD0barPrompt", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + mcRecoRegistry.add("hMassVsPtD0barNonPrompt", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + // Histograms for identified hadrons + mcRecoRegistry.add("hMcRecKpPt", "MC Reco K+;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{500, 0, 5}}}); + mcRecoRegistry.add("hMcRecKpPtGenEtaGen", "MC Reco K+;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + mcRecoRegistry.add("hMcRecKmPt", "MC Reco K-;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{500, 0, 5}}}); + mcRecoRegistry.add("hMcRecKmPtGenEtaGen", "MC Reco K-;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + mcRecoRegistry.add("hMcRecPipPt", "MC Reco #pi+;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{500, 0, 5}}}); + mcRecoRegistry.add("hMcRecPipPtGenEtaGen", "MC Reco #pi+;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + mcRecoRegistry.add("hMcRecPimPt", "MC Reco #pi-;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{500, 0, 5}}}); + mcRecoRegistry.add("hMcRecPimPtGenEtaGen", "MC Reco #pi-;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + mcRecoRegistry.add("hMcRecPrPt", "MC Reco proton;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{500, 0, 5}}}); + mcRecoRegistry.add("hMcRecPrPtGenEtaGen", "MC Reco proton;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + mcRecoRegistry.add("hMcRecAntiPrPt", "MC Reco antiproton;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{500, 0, 5}}}); + mcRecoRegistry.add("hMcRecAntiPrPtGenEtaGen", "MC Reco antiproton;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + // MC truth - mcTruthRegistry.add("MCTruthD0D0bar", "MC Truth D0/D0bar;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{360, 0, 36}, {400, -1.0, 1.0}}}); - mcTruthRegistry.add("MCTruthAllPositivePt", "MC Truth all positive;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{360, 0, 36}}}); - mcTruthRegistry.add("MCTruthAllNegativePt", "MC Truth all negative;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{360, 0, 36}}}); - mcTruthRegistry.add("MCTruthKpPtVsEta", "MC Truth K+;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); - mcTruthRegistry.add("MCTruthKmPtVsEta", "MC Truth K-;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); - mcTruthRegistry.add("MCTruthPipPtVsEta", "MC Truth #pi+;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); - mcTruthRegistry.add("MCTruthPimPtVsEta", "MC Truth #pi-;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); - mcTruthRegistry.add("MCTruthProtonPtVsEta", "MC Truth proton;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); - mcTruthRegistry.add("MCTruthAntiProtonPtVsEta", "MC Truth antiproton;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); - mcTruthRegistry.add("MCTruthKpPt", "MC Truth K+;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{500, 0, 5}}}); - mcTruthRegistry.add("MCTruthKmPt", "MC Truth K-;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{500, 0, 5}}}); - mcTruthRegistry.add("MCTruthPipPt", "MC Truth #pi+;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{500, 0, 5}}}); - mcTruthRegistry.add("MCTruthPimPt", "MC Truth #pi-;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{500, 0, 5}}}); - mcTruthRegistry.add("MCTruthProtonPt", "MC Truth proton;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{500, 0, 5}}}); - mcTruthRegistry.add("MCTruthAntiProtonPt", "MC Truth antiproton;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{500, 0, 5}}}); + mcTruthRegistry.add("hMcGenD0", "MC Truth all D0s;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {400, -1.0, 1.0}}}); + mcTruthRegistry.add("hMcGenD0Prompt", "MC Truth prompt D0s;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {400, -1.0, 1.0}}}); + mcTruthRegistry.add("hMcGenD0NonPrompt", "MC Truth non-prompt D0s;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {400, -1.0, 1.0}}}); + mcTruthRegistry.add("hMcGenD0bar", "MC Truth all D0bars;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {400, -1.0, 1.0}}}); + mcTruthRegistry.add("hMcGenD0barPrompt", "MC Truth prompt D0bars;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {400, -1.0, 1.0}}}); + mcTruthRegistry.add("hMcGenD0barNonPrompt", "MC Truth non-prompt D0bars;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{vbins, "#it{p}_{T} (GeV/#it{c})"}, {400, -1.0, 1.0}}}); + mcTruthRegistry.add("hMcGenAllPositivePt", "MC Truth all positive;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{360, 0, 36}}}); + mcTruthRegistry.add("hMcGenAllNegativePt", "MC Truth all negative;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{360, 0, 36}}}); + mcTruthRegistry.add("hMcGenKpPtVsEta", "MC Truth K+;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + mcTruthRegistry.add("hMcGenKmPtVsEta", "MC Truth K-;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + mcTruthRegistry.add("hMcGenPipPtVsEta", "MC Truth #pi+;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + mcTruthRegistry.add("hMcGenPimPtVsEta", "MC Truth #pi-;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + mcTruthRegistry.add("hMcGenPrPtVsEta", "MC Truth proton;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + mcTruthRegistry.add("hMcGenAntiPrPtVsEta", "MC Truth antiproton;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + mcTruthRegistry.add("hMcGenKpPt", "MC Truth K+;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{500, 0, 5}}}); + mcTruthRegistry.add("hMcGenKmPt", "MC Truth K-;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{500, 0, 5}}}); + mcTruthRegistry.add("hMcGenPipPt", "MC Truth #pi+;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{500, 0, 5}}}); + mcTruthRegistry.add("hMcGenPimPt", "MC Truth #pi-;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{500, 0, 5}}}); + mcTruthRegistry.add("hMcGenPrPt", "MC Truth proton;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{500, 0, 5}}}); + mcTruthRegistry.add("hMcGenAntiPrPt", "MC Truth antiproton;#it{p}_{T} (GeV/c); counts", {HistType::kTH1F, {{500, 0, 5}}}); trackHistoPartD0D0bar.init(&qaRegistry, confTempFitVarpTBins, confTempFitVarInvMassBins, ConfBothTracks.confIsMC, ConfDmesons.confPDGCodeD0); if (!ConfTrack.confIsSame) { @@ -457,34 +509,6 @@ struct FemtoUniversePairTaskTrackD0 { vPIDTrack = ConfTrack.confPIDTrack.value; kNsigma = ConfBothTracks.confTrkPIDnSigmaMax.value; - - // D0/D0bar histograms - auto vbins = (std::vector)binsPt; - registry.add("D0D0bar_oneMassHypo/hMassVsPt", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("D0D0bar_oneMassHypo/hMassVsPtReflected", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("D0D0bar_oneMassHypo/hMassVsPtD0", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("D0D0bar_oneMassHypo/hMassVsPtD0bar", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("D0D0bar_oneMassHypo/hMassVsPtD0Reflected", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("D0D0bar_oneMassHypo/hMassVsPtD0barReflected", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("D0D0bar_doubleMassHypo/hMassVsPt", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("D0D0bar_doubleMassHypo/hMassVsPtD0", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("D0D0bar_doubleMassHypo/hMassVsPtD0bar", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - // Histograms for BDT score classes' check - registry.add("DebugBdt/hBdtScore1VsStatus", ";BDT score;status", {HistType::kTH2F, {axisBdtScore, axisSelStatus}}); - registry.add("DebugBdt/hBdtScore2VsStatus", ";BDT score;status", {HistType::kTH2F, {axisBdtScore, axisSelStatus}}); - registry.add("DebugBdt/hBdtScore3VsStatus", ";BDT score;status", {HistType::kTH2F, {axisBdtScore, axisSelStatus}}); - if (applyMLOpt) { - registry.add("D0D0bar_MLSel/hMassVsPt1", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("D0D0bar_MLSel/hMassVsPt2", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("D0D0bar_MLSel/hMassVsPt3", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("D0D0bar_MLSel/hMassVsPt4", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("D0D0bar_MLSel/hMassVsPt5", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("D0D0bar_MLSel/hMassVsPt6", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("D0D0bar_MLSel/hMassVsPt7", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("D0D0bar_MLSel/hMassVsPt8", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("D0D0bar_MLSel/hMassVsPt9", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("D0D0bar_MLSel/hMassVsPt10", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {confInvMassBins, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - } } template @@ -496,7 +520,7 @@ struct FemtoUniversePairTaskTrackD0 { void processD0MLOptBg(o2::aod::FdCollision const& col, FemtoFullParticles const&) { - auto groupD0D0barCands = partsOnlyD0D0bar->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); + auto groupD0D0barCands = partsAllDmesons->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); // loop over selected D0/D0bar candidates for (auto const& charmCand : groupD0D0barCands) { @@ -552,7 +576,7 @@ struct FemtoUniversePairTaskTrackD0 { void processD0MLOptBgAndPrompt(o2::aod::FdCollision const& col, FemtoFullParticles const&) { - auto groupD0D0barCands = partsOnlyD0D0bar->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); + auto groupD0D0barCands = partsAllDmesons->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); // loop over selected D0/D0bar candidates for (auto const& charmCand : groupD0D0barCands) { @@ -639,143 +663,106 @@ struct FemtoUniversePairTaskTrackD0 { void processAllDmesons(o2::aod::FdCollision const& col, FemtoFullParticles const&) { auto groupPartsAllD0D0barCands = partsAllDmesons->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); - auto groupPartsD0D0barChildren = partsDmesonsChildren->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); - // loop over D0/D0bar mesons (ONLY) + // loop over D0/D0bar mesons for (auto const& d0d0bar : groupPartsAllD0D0barCands) { registry.fill(HIST("hPtD0D0bar"), d0d0bar.pt()); - registry.fill(HIST("hPhiDmesonCand"), d0d0bar.phi()); - registry.fill(HIST("hEtaDmesonCand"), d0d0bar.eta()); + registry.fill(HIST("hPhiD0D0bar"), d0d0bar.phi()); + registry.fill(HIST("hEtaD0D0bar"), d0d0bar.eta()); // BDT score classes registry.fill(HIST("DebugBdt/hBdtScore1VsStatus"), d0d0bar.decayVtxX(), 1); registry.fill(HIST("DebugBdt/hBdtScore2VsStatus"), d0d0bar.decayVtxY(), 1); registry.fill(HIST("DebugBdt/hBdtScore3VsStatus"), d0d0bar.decayVtxZ(), 1); - if (d0d0bar.mLambda() > 0.0f) { - registry.fill(HIST("D0D0bar_doubleMassHypo/hMassVsPt"), d0d0bar.mLambda(), d0d0bar.pt()); - registry.fill(HIST("D0D0bar_doubleMassHypo/hMassVsPtD0"), d0d0bar.mLambda(), d0d0bar.pt()); - if (d0d0bar.mAntiLambda() < 0.0f) { - registry.fill(HIST("D0D0bar_oneMassHypo/hMassVsPt"), d0d0bar.mLambda(), d0d0bar.pt()); - registry.fill(HIST("D0D0bar_oneMassHypo/hMassVsPtD0"), d0d0bar.mLambda(), d0d0bar.pt()); - registry.fill(HIST("hPtD0"), d0d0bar.pt()); - registry.fill(HIST("hPhiD0"), d0d0bar.phi()); - registry.fill(HIST("hEtaD0"), d0d0bar.eta()); + weight = 1.0f; + if (doEfficiencyCorr) { + weight = efficiencyCalculator.getWeight(ParticleNo::TWO, d0d0bar.pt()); + if (d0d0bar.mLambda() > 0.0f) { + registry.fill(HIST("D0D0bar_doubleMassHypo/hMassVsPtEffCorr"), d0d0bar.mLambda(), d0d0bar.pt(), weight); + registry.fill(HIST("D0D0bar_doubleMassHypo/hMassVsPtD0EffCorr"), d0d0bar.mLambda(), d0d0bar.pt(), weight); + if (d0d0bar.mAntiLambda() < 0.0f) { + registry.fill(HIST("D0D0bar_oneMassHypo/hMassVsPtEffCorr"), d0d0bar.mLambda(), d0d0bar.pt(), weight); + registry.fill(HIST("D0D0bar_oneMassHypo/hMassVsPtD0EffCorr"), d0d0bar.mLambda(), d0d0bar.pt(), weight); + registry.fill(HIST("hPtD0"), d0d0bar.pt()); + registry.fill(HIST("hPhiD0"), d0d0bar.phi()); + registry.fill(HIST("hEtaD0"), d0d0bar.eta()); + } } - } - if (d0d0bar.mAntiLambda() > 0.0f) { - registry.fill(HIST("D0D0bar_doubleMassHypo/hMassVsPt"), d0d0bar.mLambda(), d0d0bar.pt()); - registry.fill(HIST("D0D0bar_doubleMassHypo/hMassVsPtD0bar"), d0d0bar.mLambda(), d0d0bar.pt()); - if (d0d0bar.mLambda() < 0.0f) { - registry.fill(HIST("D0D0bar_oneMassHypo/hMassVsPt"), d0d0bar.mAntiLambda(), d0d0bar.pt()); - registry.fill(HIST("D0D0bar_oneMassHypo/hMassVsPtD0bar"), d0d0bar.mAntiLambda(), d0d0bar.pt()); - registry.fill(HIST("hPtD0bar"), d0d0bar.pt()); - registry.fill(HIST("hPhiD0bar"), d0d0bar.phi()); - registry.fill(HIST("hEtaD0bar"), d0d0bar.eta()); + if (d0d0bar.mAntiLambda() > 0.0f) { + registry.fill(HIST("D0D0bar_doubleMassHypo/hMassVsPtEffCorr"), d0d0bar.mLambda(), d0d0bar.pt(), weight); + registry.fill(HIST("D0D0bar_doubleMassHypo/hMassVsPtD0barEffCorr"), d0d0bar.mLambda(), d0d0bar.pt(), weight); + if (d0d0bar.mLambda() < 0.0f) { + registry.fill(HIST("D0D0bar_oneMassHypo/hMassVsPtEffCorr"), d0d0bar.mAntiLambda(), d0d0bar.pt(), weight); + registry.fill(HIST("D0D0bar_oneMassHypo/hMassVsPtD0barEffCorr"), d0d0bar.mAntiLambda(), d0d0bar.pt(), weight); + registry.fill(HIST("hPtD0bar"), d0d0bar.pt()); + registry.fill(HIST("hPhiD0bar"), d0d0bar.phi()); + registry.fill(HIST("hEtaD0bar"), d0d0bar.eta()); + } + } + } else { + if (d0d0bar.mLambda() > 0.0f) { + registry.fill(HIST("D0D0bar_doubleMassHypo/hMassVsPt"), d0d0bar.mLambda(), d0d0bar.pt()); + registry.fill(HIST("D0D0bar_doubleMassHypo/hMassVsPtD0"), d0d0bar.mLambda(), d0d0bar.pt()); + if (d0d0bar.mAntiLambda() < 0.0f) { + registry.fill(HIST("D0D0bar_oneMassHypo/hMassVsPt"), d0d0bar.mLambda(), d0d0bar.pt()); + registry.fill(HIST("D0D0bar_oneMassHypo/hMassVsPtD0"), d0d0bar.mLambda(), d0d0bar.pt()); + registry.fill(HIST("hPtD0"), d0d0bar.pt()); + registry.fill(HIST("hPhiD0"), d0d0bar.phi()); + registry.fill(HIST("hEtaD0"), d0d0bar.eta()); + } + } + if (d0d0bar.mAntiLambda() > 0.0f) { + registry.fill(HIST("D0D0bar_doubleMassHypo/hMassVsPt"), d0d0bar.mLambda(), d0d0bar.pt()); + registry.fill(HIST("D0D0bar_doubleMassHypo/hMassVsPtD0bar"), d0d0bar.mLambda(), d0d0bar.pt()); + if (d0d0bar.mLambda() < 0.0f) { + registry.fill(HIST("D0D0bar_oneMassHypo/hMassVsPt"), d0d0bar.mAntiLambda(), d0d0bar.pt()); + registry.fill(HIST("D0D0bar_oneMassHypo/hMassVsPtD0bar"), d0d0bar.mAntiLambda(), d0d0bar.pt()); + registry.fill(HIST("hPtD0bar"), d0d0bar.pt()); + registry.fill(HIST("hPhiD0bar"), d0d0bar.phi()); + registry.fill(HIST("hEtaD0bar"), d0d0bar.eta()); + } } - } - } - - // loop over D mesons childen - for (auto const& daughD0D0bar : groupPartsD0D0barChildren) { - registry.fill(HIST("hPtDaughters"), daughD0D0bar.pt()); - registry.fill(HIST("hSignDaughters"), daughD0D0bar.mLambda()); - // filling QA plots for D0 mesons' positive daughters (K+) - if (daughD0D0bar.mLambda() == 1 && (daughD0D0bar.mAntiLambda() == 1 || daughD0D0bar.mAntiLambda() == 0)) { - qaRegistry.fill(HIST("D0_pos_daugh/pt"), daughD0D0bar.pt()); - qaRegistry.fill(HIST("D0_pos_daugh/eta"), daughD0D0bar.eta()); - qaRegistry.fill(HIST("D0_pos_daugh/phi"), daughD0D0bar.phi()); - } - // filling QA plots for D0 mesons' negative daughters (pi-) - if (daughD0D0bar.mLambda() == -1 && (daughD0D0bar.mAntiLambda() == 1 || daughD0D0bar.mAntiLambda() == 0)) { - qaRegistry.fill(HIST("D0_neg_daugh/pt"), daughD0D0bar.pt()); - qaRegistry.fill(HIST("D0_neg_daugh/eta"), daughD0D0bar.eta()); - qaRegistry.fill(HIST("D0_neg_daugh/phi"), daughD0D0bar.phi()); - } - // filling QA plots for D0bar mesons' positive daughters (pi+) - if (daughD0D0bar.mLambda() == 1 && (daughD0D0bar.mAntiLambda() == -1 || daughD0D0bar.mAntiLambda() == 0)) { - qaRegistry.fill(HIST("D0bar_pos_daugh/pt"), daughD0D0bar.pt()); - qaRegistry.fill(HIST("D0bar_pos_daugh/eta"), daughD0D0bar.eta()); - qaRegistry.fill(HIST("D0bar_pos_daugh/phi"), daughD0D0bar.phi()); - } - // filling QA plots for D0bar mesons' negative daughters (K-) - if (daughD0D0bar.mLambda() == -1 && (daughD0D0bar.mAntiLambda() == -1 || daughD0D0bar.mAntiLambda() == 0)) { - qaRegistry.fill(HIST("D0bar_neg_daugh/pt"), daughD0D0bar.pt()); - qaRegistry.fill(HIST("D0bar_neg_daugh/eta"), daughD0D0bar.eta()); - qaRegistry.fill(HIST("D0bar_neg_daugh/phi"), daughD0D0bar.phi()); } } } PROCESS_SWITCH(FemtoUniversePairTaskTrackD0, processAllDmesons, "Enable processing over all D meson candidates", false); - void processD0mesons(o2::aod::FdCollision const& col, FemtoFullParticles const&) + void processD0Children(o2::aod::FdCollision const& col, FemtoFullParticles const&) { - auto groupPartsAllD0D0barCands = partsAllDmesons->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); - auto groupPartsOnlyD0D0bar = partsOnlyD0D0bar->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); auto groupPartsD0D0barChildren = partsDmesonsChildren->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); - // loop over D0/D0bar mesons (ONLY) - for (auto const& d0d0bar : groupPartsOnlyD0D0bar) { - - registry.fill(HIST("hPtD0D0bar"), d0d0bar.pt()); - // BDT score classes - registry.fill(HIST("DebugBdt/hBdtScore1VsStatus"), d0d0bar.decayVtxX(), 1); - registry.fill(HIST("DebugBdt/hBdtScore2VsStatus"), d0d0bar.decayVtxY(), 1); - registry.fill(HIST("DebugBdt/hBdtScore3VsStatus"), d0d0bar.decayVtxZ(), 1); - - if (d0d0bar.mLambda() > 0.0f && d0d0bar.mAntiLambda() < 0.0f) { - registry.fill(HIST("D0D0bar_oneMassHypo/hMassVsPt"), d0d0bar.mLambda(), d0d0bar.pt()); - registry.fill(HIST("D0D0bar_oneMassHypo/hMassVsPtD0"), d0d0bar.mLambda(), d0d0bar.pt()); - registry.fill(HIST("D0D0bar_oneMassHypo/hMassVsPtReflected"), std::abs(d0d0bar.mAntiLambda()), d0d0bar.pt()); - registry.fill(HIST("D0D0bar_oneMassHypo/hMassVsPtD0Reflected"), std::abs(d0d0bar.mAntiLambda()), d0d0bar.pt()); - registry.fill(HIST("hInvMassD0"), d0d0bar.mLambda()); - registry.fill(HIST("hPtD0"), d0d0bar.pt()); - registry.fill(HIST("hPhiD0"), d0d0bar.phi()); - registry.fill(HIST("hEtaD0"), d0d0bar.eta()); - } - if (d0d0bar.mLambda() < 0.0f && d0d0bar.mAntiLambda() > 0.0f) { - registry.fill(HIST("D0D0bar_oneMassHypo/hMassVsPt"), d0d0bar.mAntiLambda(), d0d0bar.pt()); - registry.fill(HIST("D0D0bar_oneMassHypo/hMassVsPtD0bar"), d0d0bar.mAntiLambda(), d0d0bar.pt()); - registry.fill(HIST("D0D0bar_oneMassHypo/hMassVsPtReflected"), std::abs(d0d0bar.mLambda()), d0d0bar.pt()); - registry.fill(HIST("D0D0bar_oneMassHypo/hMassVsPtD0barReflected"), std::abs(d0d0bar.mLambda()), d0d0bar.pt()); - registry.fill(HIST("hInvMassD0bar"), d0d0bar.mAntiLambda()); - registry.fill(HIST("hPtD0bar"), d0d0bar.pt()); - registry.fill(HIST("hPhiD0bar"), d0d0bar.phi()); - registry.fill(HIST("hEtaD0bar"), d0d0bar.eta()); - } - } - // loop over D mesons childen for (auto const& daughD0D0bar : groupPartsD0D0barChildren) { registry.fill(HIST("hPtDaughters"), daughD0D0bar.pt()); registry.fill(HIST("hSignDaughters"), daughD0D0bar.mLambda()); // filling QA plots for D0 mesons' positive daughters (K+) - if (daughD0D0bar.mLambda() == 1 && daughD0D0bar.mAntiLambda() == 1) { + if (daughD0D0bar.mLambda() == 1 && (daughD0D0bar.mAntiLambda() == 1 || daughD0D0bar.mAntiLambda() == 0)) { qaRegistry.fill(HIST("D0_pos_daugh/pt"), daughD0D0bar.pt()); qaRegistry.fill(HIST("D0_pos_daugh/eta"), daughD0D0bar.eta()); qaRegistry.fill(HIST("D0_pos_daugh/phi"), daughD0D0bar.phi()); } // filling QA plots for D0 mesons' negative daughters (pi-) - if (daughD0D0bar.mLambda() == -1 && daughD0D0bar.mAntiLambda() == 1) { + if (daughD0D0bar.mLambda() == -1 && (daughD0D0bar.mAntiLambda() == 1 || daughD0D0bar.mAntiLambda() == 0)) { qaRegistry.fill(HIST("D0_neg_daugh/pt"), daughD0D0bar.pt()); qaRegistry.fill(HIST("D0_neg_daugh/eta"), daughD0D0bar.eta()); qaRegistry.fill(HIST("D0_neg_daugh/phi"), daughD0D0bar.phi()); } // filling QA plots for D0bar mesons' positive daughters (pi+) - if (daughD0D0bar.mLambda() == 1 && daughD0D0bar.mAntiLambda() == -1) { + if (daughD0D0bar.mLambda() == 1 && (daughD0D0bar.mAntiLambda() == -1 || daughD0D0bar.mAntiLambda() == 0)) { qaRegistry.fill(HIST("D0bar_pos_daugh/pt"), daughD0D0bar.pt()); qaRegistry.fill(HIST("D0bar_pos_daugh/eta"), daughD0D0bar.eta()); qaRegistry.fill(HIST("D0bar_pos_daugh/phi"), daughD0D0bar.phi()); } // filling QA plots for D0bar mesons' negative daughters (K-) - if (daughD0D0bar.mLambda() == -1 && daughD0D0bar.mAntiLambda() == -1) { + if (daughD0D0bar.mLambda() == -1 && (daughD0D0bar.mAntiLambda() == -1 || daughD0D0bar.mAntiLambda() == 0)) { qaRegistry.fill(HIST("D0bar_neg_daugh/pt"), daughD0D0bar.pt()); qaRegistry.fill(HIST("D0bar_neg_daugh/eta"), daughD0D0bar.eta()); qaRegistry.fill(HIST("D0bar_neg_daugh/phi"), daughD0D0bar.phi()); } } } - PROCESS_SWITCH(FemtoUniversePairTaskTrackD0, processD0mesons, "Enable processing D0 mesons", true); + PROCESS_SWITCH(FemtoUniversePairTaskTrackD0, processD0Children, "Enable processing over daughters of D0 meson candidates", false); /// This function processes the same event and takes care of all the histogramming /// \todo the trivial loops over the tracks should be factored out since they will be common to all combinations of T-T, T-V0, V0-V0, ... @@ -925,9 +912,7 @@ struct FemtoUniversePairTaskTrackD0 { /// \param col subscribe to the collision table (Monte Carlo Reconstructed reconstructed) /// \param parts subscribe to joined table FemtoUniverseParticles and FemtoUniverseMCLables to access Monte Carlo truth /// \param FemtoUniverseMCParticles subscribe to the Monte Carlo truth table - void processSameEventMC(o2::aod::FdCollision const& col, - soa::Join const& parts, - o2::aod::FdMCParticles const&) + void processSameEventMC(aod::FdCollision const& col, FemtoMcRecoParticles const& parts, aod::FdMCParticles const&) { fillCollision(col); @@ -1094,9 +1079,7 @@ struct FemtoUniversePairTaskTrackD0 { /// @param cols subscribe to the collisions table (Monte Carlo Reconstructed reconstructed) /// @param parts subscribe to joined table FemtoUniverseParticles and FemtoUniverseMCLables to access Monte Carlo truth /// @param FemtoUniverseMCParticles subscribe to the Monte Carlo truth table - void processMixedEventMC(o2::aod::FdCollisions const& cols, - soa::Join const& parts, - o2::aod::FdMCParticles const&) + void processMixedEventMC(aod::FdCollisions const& cols, FemtoMcRecoParticles const& parts, aod::FdMCParticles const&) { for (auto const& [collision1, collision2] : soa::selfCombinations(colBinning, confNEventsMix, -1, cols, cols)) { @@ -1120,65 +1103,195 @@ struct FemtoUniversePairTaskTrackD0 { } PROCESS_SWITCH(FemtoUniversePairTaskTrackD0, processMixedEventMC, "Enable processing mixed events MC", false); - void processMCReco(FemtoMCParticles const&, aod::FdMCParticles const&) + void processMcReco(FemtoMcRecoParticles const& recoParts, aod::FdMCParticles const& mcParts) + { + for (auto const& part : recoParts) { + auto mcPartId = part.fdMCParticleId(); + if (mcPartId == -1) { + continue; // no MC particle + } + const auto& mcpart = mcParts.iteratorAt(mcPartId); + weight = 1.0f; + + // filling the histograms for identified hadrons + if (part.partType() == aod::femtouniverseparticle::ParticleType::kTrack) { + if (part.sign() > 0) { + if ((mcpart.pdgMCTruth() == PDG_t::kProton) && (part.pt() > ConfTrack.confTrackLowPtCut) && (part.pt() < ConfTrack.confTrackHighPtCut) && isParticleNSigma(part.p(), trackCuts.getNsigmaTPC(part, o2::track::PID::Proton), trackCuts.getNsigmaTOF(part, o2::track::PID::Proton), trackCuts.getNsigmaTPC(part, o2::track::PID::Pion), trackCuts.getNsigmaTOF(part, o2::track::PID::Pion), trackCuts.getNsigmaTPC(part, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(part, o2::track::PID::Kaon))) { + mcRecoRegistry.fill(HIST("hMcRecPrPt"), part.pt()); + if (mcpart.partOriginMCTruth() == aod::femtouniverse_mc_particle::ParticleOriginMCTruth::kPrimary) { + mcRecoRegistry.fill(HIST("hMcRecPrPtGenEtaGen"), mcpart.pt(), mcpart.eta()); + } + } + if ((mcpart.pdgMCTruth() == PDG_t::kPiPlus) && (part.pt() > ConfTrack.confTrackLowPtCut) && (part.pt() < ConfTrack.confTrackHighPtCut) && isParticleNSigma(part.p(), trackCuts.getNsigmaTPC(part, o2::track::PID::Proton), trackCuts.getNsigmaTOF(part, o2::track::PID::Proton), trackCuts.getNsigmaTPC(part, o2::track::PID::Pion), trackCuts.getNsigmaTOF(part, o2::track::PID::Pion), trackCuts.getNsigmaTPC(part, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(part, o2::track::PID::Kaon))) { + mcRecoRegistry.fill(HIST("hMcRecPipPt"), part.pt()); + if (mcpart.partOriginMCTruth() == aod::femtouniverse_mc_particle::ParticleOriginMCTruth::kPrimary) { + mcRecoRegistry.fill(HIST("hMcRecPipPtGenEtaGen"), mcpart.pt(), mcpart.eta()); + } + } + if ((mcpart.pdgMCTruth() == PDG_t::kKPlus) && (part.pt() > ConfTrack.confTrackLowPtCut) && (part.pt() < ConfTrack.confTrackHighPtCut) && isParticleNSigma(part.p(), trackCuts.getNsigmaTPC(part, o2::track::PID::Proton), trackCuts.getNsigmaTOF(part, o2::track::PID::Proton), trackCuts.getNsigmaTPC(part, o2::track::PID::Pion), trackCuts.getNsigmaTOF(part, o2::track::PID::Pion), trackCuts.getNsigmaTPC(part, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(part, o2::track::PID::Kaon))) { + mcRecoRegistry.fill(HIST("hMcRecKpPt"), part.pt()); + if (mcpart.partOriginMCTruth() == aod::femtouniverse_mc_particle::ParticleOriginMCTruth::kPrimary) { + mcRecoRegistry.fill(HIST("hMcRecKpPtGenEtaGen"), mcpart.pt(), mcpart.eta()); + } + } + } else if (part.sign() < 0) { + if ((mcpart.pdgMCTruth() == -PDG_t::kProton) && (part.pt() > ConfTrack.confTrackLowPtCut) && (part.pt() < ConfTrack.confTrackHighPtCut) && isParticleNSigma(part.p(), trackCuts.getNsigmaTPC(part, o2::track::PID::Proton), trackCuts.getNsigmaTOF(part, o2::track::PID::Proton), trackCuts.getNsigmaTPC(part, o2::track::PID::Pion), trackCuts.getNsigmaTOF(part, o2::track::PID::Pion), trackCuts.getNsigmaTPC(part, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(part, o2::track::PID::Kaon))) { + mcRecoRegistry.fill(HIST("hMcRecAntiPrPt"), part.pt()); + if (mcpart.partOriginMCTruth() == aod::femtouniverse_mc_particle::ParticleOriginMCTruth::kPrimary) { + mcRecoRegistry.fill(HIST("hMcRecAntiPrPtGenEtaGen"), mcpart.pt(), mcpart.eta()); + } + } + if ((mcpart.pdgMCTruth() == -PDG_t::kPiPlus) && (part.pt() > ConfTrack.confTrackLowPtCut) && (part.pt() < ConfTrack.confTrackHighPtCut) && isParticleNSigma(part.p(), trackCuts.getNsigmaTPC(part, o2::track::PID::Proton), trackCuts.getNsigmaTOF(part, o2::track::PID::Proton), trackCuts.getNsigmaTPC(part, o2::track::PID::Pion), trackCuts.getNsigmaTOF(part, o2::track::PID::Pion), trackCuts.getNsigmaTPC(part, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(part, o2::track::PID::Kaon))) { + mcRecoRegistry.fill(HIST("hMcRecPimPt"), part.pt()); + if (mcpart.partOriginMCTruth() == aod::femtouniverse_mc_particle::ParticleOriginMCTruth::kPrimary) { + mcRecoRegistry.fill(HIST("hMcRecPimPtGenEtaGen"), mcpart.pt(), mcpart.eta()); + } + } + if ((mcpart.pdgMCTruth() == -PDG_t::kKPlus) && (part.pt() > ConfTrack.confTrackLowPtCut) && (part.pt() < ConfTrack.confTrackHighPtCut) && isParticleNSigma(part.p(), trackCuts.getNsigmaTPC(part, o2::track::PID::Proton), trackCuts.getNsigmaTOF(part, o2::track::PID::Proton), trackCuts.getNsigmaTPC(part, o2::track::PID::Pion), trackCuts.getNsigmaTOF(part, o2::track::PID::Pion), trackCuts.getNsigmaTPC(part, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(part, o2::track::PID::Kaon))) { + mcRecoRegistry.fill(HIST("hMcRecKmPt"), part.pt()); + if (mcpart.partOriginMCTruth() == aod::femtouniverse_mc_particle::ParticleOriginMCTruth::kPrimary) { + mcRecoRegistry.fill(HIST("hMcRecKmPtGenEtaGen"), mcpart.pt(), mcpart.eta()); + } + } + } + } else if ((part.partType() == aod::femtouniverseparticle::ParticleType::kD0) && (part.pt() > ConfDmesons.confMinPtD0D0barReco) && (part.pt() < ConfDmesons.confMaxPtD0D0barReco)) { + if (mcpart.pdgMCTruth() == ConfDmesons.confPDGCodeD0) { + mcRecoRegistry.fill(HIST("hMcRecD0"), part.pt(), part.eta()); + mcRecoRegistry.fill(HIST("hMcRecD0Phi"), part.phi()); + if (part.tpcNClsFound() == 0) { // prompt candidates + mcRecoRegistry.fill(HIST("hMcRecD0Prompt"), part.pt(), part.eta()); + } else if (part.tpcNClsFound() == 1) { // non-prompt candidates + mcRecoRegistry.fill(HIST("hMcRecD0NonPrompt"), part.pt(), part.eta()); + } + } else if (mcpart.pdgMCTruth() == ConfDmesons.confPDGCodeD0bar) { + mcRecoRegistry.fill(HIST("hMcRecD0bar"), part.pt(), part.eta()); + mcRecoRegistry.fill(HIST("hMcRecD0barPhi"), part.phi()); + if (part.tpcNClsFound() == 0) { // prompt candidates + mcRecoRegistry.fill(HIST("hMcRecD0barPrompt"), part.pt(), part.eta()); + } else if (part.tpcNClsFound() == 1) { // non-prompt candidates + mcRecoRegistry.fill(HIST("hMcRecD0barNonPrompt"), part.pt(), part.eta()); + } + } + } + if (isParticleNSigma(part.p(), trackCuts.getNsigmaTPC(part, o2::track::PID::Proton), trackCuts.getNsigmaTOF(part, o2::track::PID::Proton), trackCuts.getNsigmaTPC(part, o2::track::PID::Pion), trackCuts.getNsigmaTOF(part, o2::track::PID::Pion), trackCuts.getNsigmaTPC(part, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(part, o2::track::PID::Kaon))) { + hTrackDCA.fillQA(part); + } + } + } + PROCESS_SWITCH(FemtoUniversePairTaskTrackD0, processMcReco, "Process MC reco data", false); + + void processMcRecoD0InvMass(FemtoMcRecoParticles const& recoParts) { - // WORK IN PROGRESS - // for (auto const& part : parts) {} + for (auto const& part : recoParts) { + // filling the histograms for identified hadrons + if ((part.partType() == aod::femtouniverseparticle::ParticleType::kD0) && (part.pt() > ConfDmesons.confMinPtD0D0barReco) && (part.pt() < ConfDmesons.confMaxPtD0D0barReco)) { + // getting the efficiency value + if (doEfficiencyCorr) { + weight = efficiencyCalculator.getWeight(ParticleNo::TWO, part.pt()); + } else { + weight = 1.0f; + } + // filling the inv. mass histograms + if (part.mLambda() > 0) { + if (part.sign() == o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { + mcRecoRegistry.fill(HIST("hMassVsPtD0Sig"), part.mLambda(), part.pt(), weight); + } else if (part.sign() == -o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { + mcRecoRegistry.fill(HIST("hMassVsPtD0Refl"), part.mLambda(), part.pt(), weight); + } else { + mcRecoRegistry.fill(HIST("hMassVsPtD0Bkg"), part.mLambda(), part.pt(), weight); + } + if (part.tpcNClsFound() == 0) { // prompt candidates + mcRecoRegistry.fill(HIST("hMassVsPtD0Prompt"), part.mLambda(), part.pt(), weight); + } else if (part.tpcNClsFound() == 1) { // non-prompt candidates + mcRecoRegistry.fill(HIST("hMassVsPtD0NonPrompt"), part.mLambda(), part.pt(), weight); + } + } else if (part.mAntiLambda() > 0) { + if (part.sign() == -o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { + mcRecoRegistry.fill(HIST("hMassVsPtD0barSig"), part.mAntiLambda(), part.pt(), weight); + } else if (part.sign() == o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { + mcRecoRegistry.fill(HIST("hMassVsPtD0barRefl"), part.mAntiLambda(), part.pt(), weight); + } else { + mcRecoRegistry.fill(HIST("hMassVsPtD0barBkg"), part.mAntiLambda(), part.pt(), weight); + } + if (part.tpcNClsFound() == 0) { // prompt candidates + mcRecoRegistry.fill(HIST("hMassVsPtD0barPrompt"), part.mAntiLambda(), part.pt(), weight); + } else if (part.tpcNClsFound() == 1) { // non-prompt candidates + mcRecoRegistry.fill(HIST("hMassVsPtD0barNonPrompt"), part.mAntiLambda(), part.pt(), weight); + } + } + } + } } - PROCESS_SWITCH(FemtoUniversePairTaskTrackD0, processMCReco, "Process MC reco data", false); + PROCESS_SWITCH(FemtoUniversePairTaskTrackD0, processMcRecoD0InvMass, "Process MC reco inv. mass histograms for D0", false); - void processMCTruth(aod::FDParticles const& parts) // WORK IN PROGRESS + void processMcTruth(aod::FDParticles const& parts) { for (auto const& part : parts) { - if (part.partType() != uint8_t(aod::femtouniverseparticle::ParticleType::kMCTruthTrack)) + if (part.partType() != uint8_t(aod::femtouniverseparticle::ParticleType::kMCTruthTrack)) { continue; + } - int pdgCode = static_cast(part.pidCut()); + int pdgCode = static_cast(part.tempFitVar()); + int8_t hfFlagMcGen = static_cast(part.mLambda()); const auto& pdgParticle = pdgMC->GetParticle(pdgCode); if (!pdgParticle) { continue; } if (pdgParticle->Charge() > 0.0) { - mcTruthRegistry.fill(HIST("MCTruthAllPositivePt"), part.pt()); + mcTruthRegistry.fill(HIST("hMcGenAllPositivePt"), part.pt()); } - if (pdgCode == 211) { - mcTruthRegistry.fill(HIST("MCTruthPipPtVsEta"), part.pt(), part.eta()); - mcTruthRegistry.fill(HIST("MCTruthPipPt"), part.pt()); + if (pdgCode == PDG_t::kPiPlus) { + mcTruthRegistry.fill(HIST("hMcGenPipPtVsEta"), part.pt(), part.eta()); + mcTruthRegistry.fill(HIST("hMcGenPipPt"), part.pt()); } - if (pdgCode == 321) { - mcTruthRegistry.fill(HIST("MCTruthKpPtVsEta"), part.pt(), part.eta()); - mcTruthRegistry.fill(HIST("MCTruthKpPt"), part.pt()); + if (pdgCode == PDG_t::kKPlus) { + mcTruthRegistry.fill(HIST("hMcGenKpPtVsEta"), part.pt(), part.eta()); + mcTruthRegistry.fill(HIST("hMcGenKpPt"), part.pt()); } - if (pdgCode == 421) { - mcTruthRegistry.fill(HIST("MCTruthD0D0bar"), part.pt(), part.eta()); + if (pdgCode == o2::constants::physics::Pdg::kD0) { + if (std::abs(hfFlagMcGen) == o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { + mcTruthRegistry.fill(HIST("hMcGenD0"), part.pt(), part.eta()); + if (part.mAntiLambda() > 0) { + mcTruthRegistry.fill(HIST("hMcGenD0Prompt"), part.pt(), part.eta()); + } else { + mcTruthRegistry.fill(HIST("hMcGenD0NonPrompt"), part.pt(), part.eta()); + } + } } - if (pdgCode == 2212) { - mcTruthRegistry.fill(HIST("MCTruthProtonPtVsEta"), part.pt(), part.eta()); - mcTruthRegistry.fill(HIST("MCTruthProtonPt"), part.pt()); + if (pdgCode == PDG_t::kProton) { + mcTruthRegistry.fill(HIST("hMcGenPrPtVsEta"), part.pt(), part.eta()); + mcTruthRegistry.fill(HIST("hMcGenPrPt"), part.pt()); } if (pdgParticle->Charge() < 0.0) { - mcTruthRegistry.fill(HIST("MCTruthAllNegativePt"), part.pt()); + mcTruthRegistry.fill(HIST("hMcGenAllNegativePt"), part.pt()); } - if (pdgCode == -211) { - mcTruthRegistry.fill(HIST("MCTruthPimPtVsEta"), part.pt(), part.eta()); - mcTruthRegistry.fill(HIST("MCTruthPimPt"), part.pt()); + if (pdgCode == PDG_t::kPiMinus) { + mcTruthRegistry.fill(HIST("hMcGenPimPtVsEta"), part.pt(), part.eta()); + mcTruthRegistry.fill(HIST("hMcGenPimPt"), part.pt()); } - if (pdgCode == -321) { - mcTruthRegistry.fill(HIST("MCTruthKmPtVsEta"), part.pt(), part.eta()); - mcTruthRegistry.fill(HIST("MCTruthKmPt"), part.pt()); + if (pdgCode == PDG_t::kKMinus) { + mcTruthRegistry.fill(HIST("hMcGenKmPtVsEta"), part.pt(), part.eta()); + mcTruthRegistry.fill(HIST("hMcGenKmPt"), part.pt()); } - if (pdgCode == -421) { - mcTruthRegistry.fill(HIST("MCTruthD0D0bar"), part.pt(), part.eta()); + if (pdgCode == o2::constants::physics::Pdg::kD0Bar) { + if (std::abs(hfFlagMcGen) == o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { + mcTruthRegistry.fill(HIST("hMcGenD0bar"), part.pt(), part.eta()); + if (part.mAntiLambda() > 0) { + mcTruthRegistry.fill(HIST("hMcGenD0barPrompt"), part.pt(), part.eta()); + } else { + mcTruthRegistry.fill(HIST("hMcGenD0barNonPrompt"), part.pt(), part.eta()); + } + } } - if (pdgCode == -2212) { - mcTruthRegistry.fill(HIST("MCTruthAntiProtonPtVsEta"), part.pt(), part.eta()); - mcTruthRegistry.fill(HIST("MCTruthAntiProtonPt"), part.pt()); + if (pdgCode == -PDG_t::kProton) { + mcTruthRegistry.fill(HIST("hMcGenAntiPrPtVsEta"), part.pt(), part.eta()); + mcTruthRegistry.fill(HIST("hMcGenAntiPrPt"), part.pt()); } } } - PROCESS_SWITCH(FemtoUniversePairTaskTrackD0, processMCTruth, "Process MC truth data", false); + PROCESS_SWITCH(FemtoUniversePairTaskTrackD0, processMcTruth, "Process MC truth data", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 9eb3e6633a6c195d54e9384b44463af90dc482f1 Mon Sep 17 00:00:00 2001 From: jaimenorman Date: Mon, 11 Aug 2025 12:31:19 +0200 Subject: [PATCH 327/345] [PWGJE] fix filling of histogram (#12524) --- PWGJE/Tasks/jetHadronRecoil.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGJE/Tasks/jetHadronRecoil.cxx b/PWGJE/Tasks/jetHadronRecoil.cxx index 731e8a7c78b..1bc88828066 100644 --- a/PWGJE/Tasks/jetHadronRecoil.cxx +++ b/PWGJE/Tasks/jetHadronRecoil.cxx @@ -257,7 +257,7 @@ struct JetHadronRecoil { registry.fill(HIST("hEtaTrack"), track.eta(), weight); registry.fill(HIST("hPhiTrack"), track.phi(), weight); registry.fill(HIST("hTrack3D"), track.pt(), track.eta(), track.phi(), weight); - registry.fill(HIST("hPtTrackPtHard"), track.pt(), track.pt() / pTHat, weight); + registry.fill(HIST("hPtTrackPtHard"), track.pt() / pTHat, track.pt(), weight); } if (nTT > 0) { From e45655a971330ea2add08a419a10b25f0c63638c Mon Sep 17 00:00:00 2001 From: Jesper Karlsson Gumprecht <113693781+jesgum@users.noreply.github.com> Date: Mon, 11 Aug 2025 13:31:07 +0200 Subject: [PATCH 328/345] [ALICE3] Fix typo in otf multi-charm table producer (#12468) --- ALICE3/TableProducer/alice3-multicharmTable.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ALICE3/TableProducer/alice3-multicharmTable.cxx b/ALICE3/TableProducer/alice3-multicharmTable.cxx index 164e5f83f9b..3c81557082a 100644 --- a/ALICE3/TableProducer/alice3-multicharmTable.cxx +++ b/ALICE3/TableProducer/alice3-multicharmTable.cxx @@ -723,7 +723,7 @@ struct alice3multicharmTable { histos.fill(HIST("hDCAxyXiCC"), std::fabs(xiccdcaXY * 1e+4)); histos.fill(HIST("hDCAzXiCC"), std::fabs(xiccdcaZ * 1e+4)); - if (std::fabs(thisXiCcandidate.eta) > xiccMaxEta) + if (std::fabs(thisXiCCcandidate.eta) > xiccMaxEta) continue; // not in central barrel histos.fill(HIST("hCharmBuilding"), 3.0f); From eb675c834a7cf34c6952602e3b3451198ca68f31 Mon Sep 17 00:00:00 2001 From: Sahil Upadhyaya <36447687+sahilupadhyaya92@users.noreply.github.com> Date: Mon, 11 Aug 2025 15:00:22 +0200 Subject: [PATCH 329/345] [PWGDQ] Repositioning of Drell-Yan 1D Histograms (#12503) Co-authored-by: Sahil Upadhyaya --- PWGDQ/Core/HistogramsLibrary.cxx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/PWGDQ/Core/HistogramsLibrary.cxx b/PWGDQ/Core/HistogramsLibrary.cxx index b9618a4c64e..65d07c909e1 100644 --- a/PWGDQ/Core/HistogramsLibrary.cxx +++ b/PWGDQ/Core/HistogramsLibrary.cxx @@ -1621,6 +1621,12 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h hm->AddHistogram(histClass, "MassMult", "", false, 750, 0.0, 15.0, VarManager::kMass, 301, -0.5, 300.5, VarManager::kVtxNcontrib); hm->AddHistogram(histClass, "MassVtxZMult", "", false, 300, 0.0, 6.0, VarManager::kMass, 60, -15.0, 15.0, VarManager::kVtxZ, 100, 0.0, 100.0, VarManager::kVtxNcontrib); } + if (subGroupStr.Contains("dimuon-drellyan")) { + hm->AddHistogram(histClass, "DY_mass", "", false, 5000, 0.0, 50.0, VarManager::kMass); // 10 MeV mass res + hm->AddHistogram(histClass, "DY_pT", "", false, 2000, 0.0, 100.0, VarManager::kPt); // 50 MeV pT res + hm->AddHistogram(histClass, "DY_y", "", false, 20, 2.0, 4.0, VarManager::kRap); + hm->AddHistogram(histClass, "DY_phi", "", false, 180, constants::math::PI, 2 * constants::math::PI, VarManager::kPhi); + } } else if (subGroupStr.Contains("electronmuon")) { hm->AddHistogram(histClass, "Mass", "", false, 750, 0.0, 30.0, VarManager::kMass); hm->AddHistogram(histClass, "Pt", "", false, 120, 0.0, 30.0, VarManager::kPt); @@ -1986,13 +1992,6 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h hm->AddHistogram(histClass, "Mass_Pt", "", false, 500, 0.0, 5.0, VarManager::kMassDau, 200, 0.0, 20.0, VarManager::kPt); hm->AddHistogram(histClass, "Rapidity", "", false, 400, -4.0, 4.0, VarManager::kRap); } - - if (subGroupStr.Contains("DY-dimuon")) { - hm->AddHistogram(histClass, "DY_mass", "", false, 5000, 0.0, 50.0, VarManager::kMass); // 10 MeV mass res - hm->AddHistogram(histClass, "DY_pT", "", false, 2000, 0.0, 100.0, VarManager::kPt); // 50 MeV pT res - hm->AddHistogram(histClass, "DY_y", "", false, 20, 2.0, 4.0, VarManager::kRap); - hm->AddHistogram(histClass, "DY_phi", "", false, 180, constants::math::PI, 2 * constants::math::PI, VarManager::kPhi); - } } //__________________________________________________________________ From 61d255f6d1786258a955169cf89a60c2bf5188ef Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Mon, 11 Aug 2025 17:01:19 +0200 Subject: [PATCH 330/345] [PWGEM/Dilepton] add eoi in MC for consistency (#12528) --- PWGEM/Dilepton/TableProducer/associateMCinfoDilepton.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/PWGEM/Dilepton/TableProducer/associateMCinfoDilepton.cxx b/PWGEM/Dilepton/TableProducer/associateMCinfoDilepton.cxx index 52867a7609d..6bd004a0e40 100644 --- a/PWGEM/Dilepton/TableProducer/associateMCinfoDilepton.cxx +++ b/PWGEM/Dilepton/TableProducer/associateMCinfoDilepton.cxx @@ -42,7 +42,7 @@ struct AssociateMCInfoDilepton { kPCM = 0x4, }; - using MyCollisionsMC = soa::Join; + using MyCollisionsMC = soa::Join; using TracksMC = soa::Join; using FwdTracksMC = soa::Join; using MFTTracksMC = soa::Join; @@ -172,6 +172,10 @@ struct AssociateMCInfoDilepton { continue; } + if (!collision.isEoI()) { // events with at least 1 lepton for data reduction. + continue; + } + registry.fill(HIST("hEventCounter"), 2); auto mcCollision = collision.mcCollision(); mceventlabels(fEventLabels.find(mcCollision.globalIndex())->second, collision.mcMask()); From 358da97564d76201008909df012006f37bfe1b9c Mon Sep 17 00:00:00 2001 From: Sweta Singh <122526337+sweta29singh@users.noreply.github.com> Date: Mon, 11 Aug 2025 17:11:44 +0200 Subject: [PATCH 331/345] [PWGCF] Added Efficiency correction (#12526) --- .../EbyEFluctuations/Tasks/eventMeanPtId.cxx | 436 ++++++++---------- 1 file changed, 188 insertions(+), 248 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/eventMeanPtId.cxx b/PWGCF/EbyEFluctuations/Tasks/eventMeanPtId.cxx index 182876d39d1..7ef12c2b69f 100644 --- a/PWGCF/EbyEFluctuations/Tasks/eventMeanPtId.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/eventMeanPtId.cxx @@ -86,20 +86,11 @@ struct EventMeanPtId { Configurable ccdbNoLaterThan{"ccdbNoLaterThan", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; Configurable cfgUrlCCDB{"cfgUrlCCDB", "http://alice-ccdb.cern.ch", "url of ccdb"}; - Configurable cfgPathCCDB{"cfgPathCCDB", "Users/s/swsingh/My/Object/eff_Pb", "Path for ccdb-object"}; + Configurable cfgPathCCDB{"cfgPathCCDB", "Users/s/swsingh/My/Object/test", "Path for ccdb-object"}; Configurable cfgLoadEff{"cfgLoadEff", true, "Load efficiency"}; HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; - TH1D* ptHistogramAllchargeRec = nullptr; - TH1D* ptHistogramPionrec = nullptr; - TH1D* ptHistogramKaonrec = nullptr; - TH1D* ptHistogramProtonrec = nullptr; - TH1D* hRecoPi = nullptr; - TH1D* hRecoKa = nullptr; - TH1D* hRecoPr = nullptr; - TH2D* hPtyPion = nullptr; - TH2D* hPtyKaon = nullptr; - TH2D* hPtyProton = nullptr; + TH2D* ptHistogramAllchargeRec = nullptr; Configurable ptMax{"ptMax", 2.0, "maximum pT"}; Configurable ptMin{"ptMin", 0.15, "minimum pT"}; @@ -117,20 +108,7 @@ struct EventMeanPtId { // LOGF(info, "Getting object %s", ccdbPath.value.data()); TList* lst = ccdb->getForTimeStamp(cfgPathCCDB.value, -1); - ptHistogramAllchargeRec = reinterpret_cast(lst->FindObject("ptHistogramAllchargeRec")); - ptHistogramPionrec = reinterpret_cast(lst->FindObject("ptHistogramPionrec")); - ptHistogramKaonrec = reinterpret_cast(lst->FindObject("ptHistogramKaonrec")); - ptHistogramProtonrec = reinterpret_cast(lst->FindObject("ptHistogramProtonrec")); - hRecoPi = reinterpret_cast(lst->FindObject("hRecoPi")); - hRecoKa = reinterpret_cast(lst->FindObject("hRecoKa")); - hRecoPr = reinterpret_cast(lst->FindObject("hRecoPr")); - hPtyPion = reinterpret_cast(lst->FindObject("hPtyPion")); - hPtyKaon = reinterpret_cast(lst->FindObject("hPtyKaon")); - hPtyProton = reinterpret_cast(lst->FindObject("hPtyProton")); - - if (!ptHistogramAllchargeRec || !ptHistogramPionrec || !ptHistogramKaonrec || !ptHistogramProtonrec || !hRecoPi || !hRecoKa || !hRecoPr || !hPtyPion || !hPtyKaon || !hPtyProton) { - LOGF(info, "FATAL!! Could not find required histograms in CCDB"); - } + ptHistogramAllchargeRec = reinterpret_cast(lst->FindObject("hPtEta_rec")); } std::vector ptBinning = {0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4.0}; @@ -148,7 +126,8 @@ struct EventMeanPtId { AxisSpec nSigmaTOFAxispid = {170, -8.5, 8.5, "n#sigma_{TOF}"}; AxisSpec centAxis = {100, 0., 100., "centrality"}; AxisSpec subAxis = {30, 0., 30., "sample"}; - AxisSpec nchAxis = {4000, 0., 4000., "nch"}; + // AxisSpec nchAxis = {4000, 0., 4000., "nch"}; + AxisSpec nchAxis = {nchBins, nchMin, nchMax, "nch"}; AxisSpec varAxis1 = {400, 0., 4., "var1"}; AxisSpec varAxis2 = {400, 0., 4., "var2"}; AxisSpec chi2Axis = {100, 0., 100., "Chi2"}; @@ -157,7 +136,7 @@ struct EventMeanPtId { // QA Plots histos.add("hEventcounter", "event counts", kTH1D, {counter}); - auto h = histos.add("tracksel", "tracksel", HistType::kTH1D, {{10, 0.5, 10.5}}); + auto h = histos.add("tracksel", "tracksel", HistType::kTH1D, {{15, 0.5, 15.5}}); h->GetXaxis()->SetBinLabel(1, "Tracks read"); h->GetXaxis()->SetBinLabel(2, "Global track passed"); h->GetXaxis()->SetBinLabel(3, "DCAxy passed"); @@ -167,8 +146,9 @@ struct EventMeanPtId { h->GetXaxis()->SetBinLabel(7, "TPC crossed rows passed"); h->GetXaxis()->SetBinLabel(8, "TPC Chai2cluster passed"); h->GetXaxis()->SetBinLabel(9, "ITS Chai2cluster passed"); + h->GetXaxis()->SetBinLabel(10, "No. of ITS cluster 5 passed"); + h->GetXaxis()->SetBinLabel(11, "No. of TPC cluster 80 passed"); - histos.add("hEventcounter_recMC", "event counts rec MC", kTH1D, {counter}); auto hRec = histos.add("trackSelRec", "trackSelRec", HistType::kTH1D, {{10, 0.5, 10.5}}); hRec->GetXaxis()->SetBinLabel(1, "has_mcCollision() read"); hRec->GetXaxis()->SetBinLabel(2, "Vertex Z > 10cm passed"); @@ -179,7 +159,6 @@ struct EventMeanPtId { hRec->GetXaxis()->SetBinLabel(7, "klsVertexITSTPC passed"); histos.add("Data/hZvtx_before_sel", "hZvtx_before_sel", kTH1D, {vtxZAxis}); - histos.add("Data/hZvtx_after_sel", "hZvtx_after_sel", kTH1D, {vtxZAxis}); histos.add("Data/hZvtx_after_sel8", "hZvtx_after_sel8", kTH1D, {vtxZAxis}); histos.add("Data/hP", "hP", kTH1D, {pAxis}); histos.add("Data/hEta", ";hEta", kTH1D, {etaAxis}); @@ -207,29 +186,16 @@ struct EventMeanPtId { histos.add("Data/hyPion", ";hyPion", kTH1D, {etaAxis}); histos.add("Data/hyKaon", ";hyKaon", kTH1D, {etaAxis}); histos.add("Data/hyProton", ";hyProton", kTH1D, {etaAxis}); - histos.add("Data/hPtCh", "hPtCh", kTH2D, {nchAxis, ptAxis}); - histos.add("Data/hPtChPion", "hPtChPion", kTH2D, {nchAxis, ptAxis}); - histos.add("Data/hPtChKaon", "hPtChKaon", kTH2D, {nchAxis, ptAxis}); - histos.add("Data/hPtChProton", "hPtChProton", kTH2D, {nchAxis, ptAxis}); - histos.add("Data/hPtCent", "hPtCent", kTH2D, {centAxis, ptAxis}); - histos.add("Data/hPtCentPion", "hPtCentPion", kTH2D, {centAxis, ptAxis}); - histos.add("Data/hPtCentKaon", "hPtCentKaon", kTH2D, {centAxis, ptAxis}); - histos.add("Data/hPtCentProton", "hPtCentProton", kTH2D, {centAxis, ptAxis}); - histos.add("Data/hMeanPtCh", "hMeanPtCh", kTH2D, {nchAxis, ptAxis}); - histos.add("Data/hCent", "hCent", kTH2D, {nchAxis, centAxis}); histos.add("Data/hVar1", "hVar1", kTH2D, {subAxis, centAxis}); histos.add("Data/hVar2", "hVar2", kTH2D, {subAxis, centAxis}); histos.add("Data/hVar2meanpt", "hVar2meanpt", kTH2D, {centAxis, varAxis2}); - histos.add("Data/hVar", "hVar", kTH2D, {subAxis, centAxis}); histos.add("Data/hVarc", "hVarc", kTH2D, {subAxis, centAxis}); histos.add("Data/hVar1pi", "hVar1pi", kTH2D, {subAxis, centAxis}); histos.add("Data/hVar2pi", "hVar2pi", kTH2D, {subAxis, centAxis}); - histos.add("Data/hVarpi", "hVarpi", kTH2D, {subAxis, centAxis}); histos.add("Data/hVar2meanptpi", "hVar2meanptpi", kTH2D, {centAxis, varAxis2}); histos.add("Data/hVar1k", "hVar1k", kTH2D, {subAxis, centAxis}); histos.add("Data/hVar2k", "hVar2k", kTH2D, {subAxis, centAxis}); - histos.add("Data/hVark", "hVark", kTH2D, {subAxis, centAxis}); histos.add("Data/hVar2meanptk", "hVar2meanptk", kTH2D, {centAxis, varAxis2}); histos.add("Data/hVar1p", "hVar1p", kTH2D, {subAxis, centAxis}); histos.add("Data/hVar2p", "hVar2p", kTH2D, {subAxis, centAxis}); @@ -258,12 +224,9 @@ struct EventMeanPtId { histos.add("Data/hVar2px", "hVar2px", kTH2D, {subAxis, nchAxis}); histos.add("Data/hVarpx", "hVarpx", kTH2D, {subAxis, nchAxis}); histos.add("Data/hVar2meanptpx", "hVar2meanptpx", kTH2D, {nchAxis, varAxis2}); - histos.add("Data/ht", "ht", kTH1D, {centAxis}); histos.add("Data/hCentrality", "hCentrality", kTH1D, {centAxis}); histos.add("Data/hPEta", "hPEta", kTH2D, {pAxis, etaAxis}); histos.add("Data/hPtEta", "hPtEta", kTH2D, {ptAxis, etaAxis}); - histos.add("Data/hPy", "hPy", kTH2D, {pAxis, etaAxis}); - histos.add("Data/hPty", "hPty", kTH2D, {ptAxis, etaAxis}); histos.add("Data/hPtyPion", "hPtyPion", kTH2D, {ptAxis, etaAxis}); histos.add("Data/hPtyKaon", "hPtyKaon", kTH2D, {ptAxis, etaAxis}); histos.add("Data/hPtyProton", "hPtyProton", kTH2D, {ptAxis, etaAxis}); @@ -279,11 +242,11 @@ struct EventMeanPtId { histos.add("Data/hTPCchi2perCluster_after", "TPC #Chi^{2}/Cluster", kTH1D, {chi2Axis}); histos.add("Data/hITSchi2perCluster_after", "ITS #Chi^{2}/Cluster", kTH1D, {chi2Axis}); histos.add("Data/hTPCCrossedrows_after", "Crossed TPC rows", kTH1D, {crossedRowTpcAxis}); - histos.add("Data/hdEdx_rec_bf_anycut", "hdEdx_rec_bf_anycut", kTH2D, {pAxis, dEdxAxis}); histos.add("Data/hcent_nacc", "hcent_nacc", kTH2D, {centAxis, nchAxis}); histos.addClone("Data/", "Rec/"); // rec histograms + histos.add("hcent_nacc_corr", "hcent_nacc_corr", kTH2D, {centAxis, nchAxis}); histos.add("NSigamaTPCpion_rec", "NSigamaTPCpion_rec", kTH2D, {pAxis, nSigmaTPCAxispid}); histos.add("NSigamaTPCkaon_rec", "NSigamaTPCkaon_rec", kTH2D, {pAxis, nSigmaTPCAxispid}); histos.add("NSigamaTPCproton_rec", "NSigamaTPCproton_rec", kTH2D, {pAxis, nSigmaTPCAxispid}); @@ -293,56 +256,15 @@ struct EventMeanPtId { histos.add("NSigamaTPCTOFpion_rec", "NSigamaTPCTOFpion_rec", kTH2D, {nSigmaTPCAxispid, nSigmaTOFAxispid}); histos.add("NSigamaTPCTOFkaon_rec", "NSigamaTPCTOFkaon_rec", kTH2D, {nSigmaTPCAxispid, nSigmaTOFAxispid}); histos.add("NSigamaTPCTOFproton_rec", "NSigamaTPCTOFproton_rec", kTH2D, {nSigmaTPCAxispid, nSigmaTOFAxispid}); - histos.add("NSigamaTPCpion_rec_bf_sel", "NSigamaTPCpion_rec_bf_sel", kTH2D, {pAxis, nSigmaTPCAxispid}); - histos.add("NSigamaTPCkaon_rec_bf_sel", "NSigamaTPCkaon_rec_bf_sel", kTH2D, {pAxis, nSigmaTPCAxispid}); - histos.add("NSigamaTPCproton_rec_bf_sel", "NSigamaTPCproton_rec_bf_sel", kTH2D, {pAxis, nSigmaTPCAxispid}); - histos.add("NSigamaTOFpion_rec_bf_sel", "NSigamaTOFpion_rec_bf_sel", kTH2D, {pAxis, nSigmaTOFAxispid}); - histos.add("NSigamaTOFkaon_rec_bf_sel", "NSigamaTOFkaon_rec_bf_sel", kTH2D, {pAxis, nSigmaTOFAxispid}); - histos.add("NSigamaTOFproton_rec_bf_sel", "NSigamaTOFproton_rec_bf_sel", kTH2D, {pAxis, nSigmaTOFAxispid}); - histos.add("NSigamaTPCTOFpion_rec_bf_sel", "NSigamaTPCTOFpion_rec_bf_sel", kTH2D, {nSigmaTPCAxispid, nSigmaTOFAxispid}); - histos.add("NSigamaTPCTOFkaon_rec_bf_sel", "NSigamaTPCTOFkaon_rec_bf_sel", kTH2D, {nSigmaTPCAxispid, nSigmaTOFAxispid}); - histos.add("NSigamaTPCTOFproton_rec_bf_sel", "NSigamaTPCTOFproton_rec_bf_sel", kTH2D, {nSigmaTPCAxispid, nSigmaTOFAxispid}); histos.add("hPtyPion_rec", "hPtyPion_rec", kTH2D, {ptAxis, etaAxis}); histos.add("hPtyKaon_rec", "hPtyKaon_rec", kTH2D, {ptAxis, etaAxis}); histos.add("hPtyProton_rec", "hPtyProton_rec", kTH2D, {ptAxis, etaAxis}); histos.add("hPyPion_rec", "hPyPion_rec", kTH2D, {pAxis, etaAxis}); histos.add("hPyKaon_rec", "hPyKaon_rec", kTH2D, {pAxis, etaAxis}); histos.add("hPyProton_rec", "hPyProton_rec", kTH2D, {pAxis, etaAxis}); - histos.add("hTOFbeta_afterselection_rec_afterpidcut", "hTOFbeta_afterselection_rec_afterpidcut", kTH2D, {pAxis, betaAxis}); - histos.add("hdEdx_afterselection_rec_afterpidcut", "hdEdx_afterselection_rec_afterpidcut", kTH2D, {pAxis, dEdxAxis}); histos.add("hTOFbeta_afterselection_rec_beforepidcut", "hTOFbeta_afterselection_rec_beforepidcut", kTH2D, {pAxis, betaAxis}); histos.add("hdEdx_afterselection_rec_beforepidcut", "hdEdx_afterselection_rec_beforepidcut", kTH2D, {pAxis, dEdxAxis}); - histos.add("heffVar1x", "heffVar1x", kTH2D, {subAxis, nchAxis}); - histos.add("heffVar2x", "heffVar2x", kTH2D, {subAxis, nchAxis}); - histos.add("heffVarx", "heffVarx", kTH2D, {subAxis, nchAxis}); - histos.add("heffVar2meanptx", "heffVar2meanptx", kTH2D, {nchAxis, varAxis2}); - histos.add("hnchRec_all", ";hnchRec_all", kTH1D, {nchAxis}); - histos.add("hnchRec", ";hnchRec", kTH1D, {nchAxis}); - histos.add("hnchRec_true", ";hnchRec_true", kTH1D, {nchAxis}); - histos.add("hVar1x_rec_old", "hVar1x_rec_old", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2x_rec_old", "hVar2x_rec_old", kTH2D, {subAxis, nchAxis}); - histos.add("hVarx_rec_old", "hVarx_rec_old", kTH2D, {subAxis, nchAxis}); - histos.add("hVar1x_rec", "hVar1x_rec", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2x_rec", "hVar2x_rec", kTH2D, {subAxis, nchAxis}); - histos.add("hVarx_rec", "hVarx_rec", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2meanptx_rec", "hVar2meanptx_rec", kTH2D, {nchAxis, varAxis2}); - histos.add("hVar1pix_rec", "hVar1pix_rec", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2pix_rec", "hVar2pix_rec", kTH2D, {subAxis, nchAxis}); - histos.add("hVarpix_rec", "hVarpix_rec", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2meanptpix_rec", "hVar2meanptpix_rec", kTH2D, {nchAxis, varAxis2}); - histos.add("hVar1kx_rec", "hVar1kx_rec", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2kx_rec", "hVar2kx_rec", kTH2D, {subAxis, nchAxis}); - histos.add("hVarkx_rec", "hVarkx_rec", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2meanptkx_rec", "hVar2meanptkx_rec", kTH2D, {nchAxis, varAxis2}); - histos.add("hVar1px_rec", "hVar1px_rec", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2px_rec", "hVar2px_rec", kTH2D, {subAxis, nchAxis}); - histos.add("hVarpx_rec", "hVarpx_rec", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2meanptpx_rec", "hVar2meanptpx_rec", kTH2D, {nchAxis, varAxis2}); - histos.add("hZvtx_after_sel_rec", "hZvtx_after_sel_rec", kTH1D, {vtxZAxis}); - histos.add("hZvtx_after_sel8_rec", "hZvtx_after_sel8_rec", kTH1D, {vtxZAxis}); - histos.add("etaHistogram_allcharge_rec", "etaHistogram_allcharge_rec", kTH1D, {etaAxis}); - histos.add("ptHistogram_allcharge_bfptcut_rec", "ptHistogram_allcharge_bfptcut_rec", kTH1D, {ptAxis}); histos.add("ptHistogramAllchargeRec", "ptHistogramAllchargeRec", kTH1D, {ptAxis}); histos.add("ptHistogramPionrec", "ptHistogramPionrec", kTH1D, {ptAxis}); histos.add("ptHistogramKaonrec", "ptHistogramKaonrec", kTH1D, {ptAxis}); @@ -353,11 +275,9 @@ struct EventMeanPtId { histos.add("ptHistogramPionrec_pdg", "ptHistogramPionrec_pdg", kTH1D, {ptAxis}); histos.add("ptHistogramKaonrec_pdg", "ptHistogramKaonrec_pdg", kTH1D, {ptAxis}); histos.add("ptHistogramProtonrec_pdg", "ptHistogramProtonrec_pdg", kTH1D, {ptAxis}); - histos.add("Histogram_mass2_p_rec_beforesel", "Histogram_mass2_p_rec_beforesel", kTH1D, {ptAxis}); - histos.add("Histogram_mass2_p_rec_aftersel", "Histogram_mass2_p_rec_aftersel", kTH1D, {ptAxis}); - histos.add("hEffVar1x", "hEffVar1x", kTH2D, {subAxis, nchAxis}); - histos.add("hEffVar2x", "hEffVar2x", kTH2D, {subAxis, nchAxis}); - histos.add("hEffVarx", "hEffVarx", kTH2D, {subAxis, nchAxis}); + histos.add("hEffVar1x_rec", "hEffVar1x_rec", kTH2D, {subAxis, nchAxis}); + histos.add("hEffVar2x_rec", "hEffVar2x_rec", kTH2D, {subAxis, nchAxis}); + histos.add("hEffVarx_rec", "hEffVarx_rec", kTH2D, {subAxis, nchAxis}); histos.add("hEffVar1pix", "hEffVar1pix", kTH2D, {subAxis, nchAxis}); histos.add("hEffVar2pix", "hEffVar2pix", kTH2D, {subAxis, nchAxis}); histos.add("hEffVarpix", "hEffVarpix", kTH2D, {subAxis, nchAxis}); @@ -367,7 +287,7 @@ struct EventMeanPtId { histos.add("hEffVar1px", "hEffVar1px", kTH2D, {subAxis, nchAxis}); histos.add("hEffVar2px", "hEffVar2px", kTH2D, {subAxis, nchAxis}); histos.add("hEffVarpx", "hEffVarpx", kTH2D, {subAxis, nchAxis}); - histos.add("hEffVar2Meanptx", "hEffVar2Meanptx", kTH2D, {nchAxis, varAxis2}); + histos.add("hEffVar2Meanptx_rec", "hEffVar2Meanptx_rec", kTH2D, {nchAxis, varAxis2}); histos.add("hEffVar2Meanptpix", "hEffVar2Meanptpix", kTH2D, {nchAxis, varAxis2}); histos.add("hEffVar2Meanptkx", "hEffVar2Meanptkx", kTH2D, {nchAxis, varAxis2}); histos.add("hEffVar2Meanptpx", "hEffVar2Meanptpx", kTH2D, {nchAxis, varAxis2}); @@ -376,14 +296,8 @@ struct EventMeanPtId { histos.add("ptHistogramPion", "ptHistogramPion", kTH1D, {ptAxis}); histos.add("ptHistogramKaon", "ptHistogramKaon", kTH1D, {ptAxis}); histos.add("ptHistogramProton", "ptHistogramProton", kTH1D, {ptAxis}); - histos.add("hMC_Pt", ";#it{p}_{T} (GeV/#it{c})", kTH1D, {ptAxis}); - histos.add("MC_hZvtx_after_sel", ";#it{p}_{T} (GeV/#it{c})", kTH1D, {vtxZAxis}); - histos.add("hTOFbeta_gen_pion", "hTOFbeta_gen_pion", kTH2D, {pAxis, betaAxis}); - histos.add("hdEdx_gen_pion", "hdEdx_gen_pion", kTH2D, {pAxis, dEdxAxis}); histos.add("hnch_gen_all", ";hnch_gen_all", kTH1D, {nchAxis}); - histos.add("hnch_gen", ";hnch_gen", kTH1D, {nchAxis}); histos.add("hnch_gen_true", ";hnch_gen_true", kTH1D, {nchAxis}); - histos.add("hnch_gen_eta", ";hnch_gen_eta", kTH1D, {etaAxis}); histos.add("hnch1", ";hnch1", kTH1D, {nchAxis}); histos.add("hnch2", ";hnch2", kTH1D, {nchAxis}); histos.add("hnch3", ";hnch3", kTH1D, {nchAxis}); @@ -391,9 +305,6 @@ struct EventMeanPtId { histos.add("hnch_ka", ";hnch_ka", kTH1D, {nchAxis}); histos.add("hnch_pr", ";hnch_pr", kTH1D, {nchAxis}); - histos.add("hVar1x_gen_old", "hVar1x_gen_old", kTH2D, {subAxis, nchAxis}); - histos.add("hVar2x_gen_old", "hVar2x_gen_old", kTH2D, {subAxis, nchAxis}); - histos.add("hVarx_gen_old", "hVarx_gen_old", kTH2D, {subAxis, nchAxis}); histos.add("hVar1x_gen", "hVar1x_gen", kTH2D, {subAxis, nchAxis}); histos.add("hVar2x_gen", "hVar2x_gen", kTH2D, {subAxis, nchAxis}); histos.add("hVarx_gen", "hVarx_gen", kTH2D, {subAxis, nchAxis}); @@ -410,28 +321,63 @@ struct EventMeanPtId { histos.add("hVar2px_gen", "hVar2px_gen", kTH2D, {subAxis, nchAxis}); histos.add("hVarpx_gen", "hVarpx_gen", kTH2D, {subAxis, nchAxis}); histos.add("hVar2meanptpx_gen", "hVar2meanptpx_gen", kTH2D, {nchAxis, varAxis2}); - histos.add("hcent_nacc_rec", "hcent_nacc_rec", kTH2D, {centAxis, nchAxis}); histos.add("hcent_nacc_gen", "hcent_nacc_gen", kTH2D, {centAxis, nchAxis}); - histos.add("hGenCentrality", "hGenCentrality", kTH1D, {centAxis}); histos.add("hVtxZ_before_gen", "", kTH1F, {vtxZAxis}); - histos.add("hVtxZ_after_gen", "", kTH1F, {vtxZAxis}); + histos.add("hVtxZ_after_gensim", "", kTH1F, {vtxZAxis}); histos.add("hEta_gen", "", kTH1F, {etaAxis}); histos.add("hEta_rec", "", kTH1F, {etaAxis}); histos.add("hPt_gen", "", kTH1F, {ptAxis}); histos.add("hPt_rec", "", kTH1F, {ptAxis}); + histos.add("hEta_rec_corr", "", kTH1F, {etaAxis}); + histos.add("hPt_rec_corr", "", kTH1F, {ptAxis}); + histos.add("hPtEta_rec", "hPtEta_rec", kTH2D, {ptAxis, etaAxis}); + histos.add("hPtEta_pi_rec", "hPtEta_pi_rec", kTH2D, {ptAxis, etaAxis}); + histos.add("hPtEta_ka_rec", "hPtEta_ka_rec", kTH2D, {ptAxis, etaAxis}); + histos.add("hPtEta_pr_rec", "hPtEta_pr_rec", kTH2D, {ptAxis, etaAxis}); + histos.add("hPtEta_gen", "hPtEta_gen", kTH2D, {ptAxis, etaAxis}); + histos.add("hPtEta_pi_gen", "hPtEta_pi_gen", kTH2D, {ptAxis, etaAxis}); + histos.add("hPtEta_ka_gen", "hPtEta_ka_gen", kTH2D, {ptAxis, etaAxis}); + histos.add("hPtEta_pr_gen", "hPtEta_pr_gen", kTH2D, {ptAxis, etaAxis}); + histos.add("hPty_pi_gen", "hPty_pi_gen", kTH2D, {ptAxis, etaAxis}); + histos.add("hPty_ka_gen", "hPty_ka_gen", kTH2D, {ptAxis, etaAxis}); + histos.add("hPty_pr_gen", "hPty_pr_gen", kTH2D, {ptAxis, etaAxis}); + histos.add("hNch_vs_corr", "hNch_vs_corr", kTH1D, {nchAxis}); + histos.add("hVar1_gen", "hVar1_gen", kTH2D, {subAxis, centAxis}); + histos.add("hVar2_gen", "hVar2_gen", kTH2D, {subAxis, centAxis}); + histos.add("hVarc_gen", "hVarc_gen", kTH2D, {subAxis, centAxis}); + histos.add("hEffVar1x_Naccorr_rec", "hEffVar1x_Naccorr_rec", kTH2D, {subAxis, nchAxis}); + histos.add("hEffVar2x_Naccorr_rec", "hEffVar2x_Naccorr_rec", kTH2D, {subAxis, nchAxis}); + histos.add("hEffVarx_Naccorr_rec", "hEffVarx_Naccorr_rec", kTH2D, {subAxis, nchAxis}); + histos.add("hEffVar1x_Naccorr_xaxis_rec", "hEffVar1x_Naccorr_xaxis_rec", kTH2D, {subAxis, nchAxis}); + histos.add("hEffVar2x_Naccorr_xaxis_rec", "hEffVar2x_Naccorr_xaxis_rec", kTH2D, {subAxis, nchAxis}); + histos.add("hEffVarx_Naccorr_xaxis_rec", "hEffVarx_Naccorr_xaxis_rec", kTH2D, {subAxis, nchAxis}); + histos.add("hEffVar1x_Naccorr_data", "hEffVar1x_Naccorr_data", kTH2D, {subAxis, nchAxis}); + histos.add("hEffVar2x_Naccorr_data", "hEffVar2x_Naccorr_data", kTH2D, {subAxis, nchAxis}); + histos.add("hEffVarx_Naccorr_data", "hEffVarx_Naccorr_data", kTH2D, {subAxis, nchAxis}); + histos.add("hEffVar1x_Naccorr_xaxis_data", "hEffVar1x_Naccorr_xaxis_data", kTH2D, {subAxis, nchAxis}); + histos.add("hEffVar2x_Naccorr_xaxis_data", "hEffVar2x_Naccorr_xaxis_data", kTH2D, {subAxis, nchAxis}); + histos.add("hEffVarx_Naccorr_xaxis_data", "hEffVarx_Naccorr_xaxis_data", kTH2D, {subAxis, nchAxis}); + histos.add("hEffVar1x_data", "hEffVar1x_data", kTH2D, {subAxis, nchAxis}); + histos.add("hEffVar2x_data", "hEffVar2x_data", kTH2D, {subAxis, nchAxis}); + histos.add("hEffVarx_data", "hEffVarx_data", kTH2D, {subAxis, nchAxis}); + histos.add("hEffVar2Meanptx_data", "hEffVar2Meanptx_data", kTH2D, {nchAxis, varAxis2}); } + // Configurables Configurable cVtxZcut{"cVtxZcut", 10.f, "Vertex Z"}; Configurable cEtacut{"cEtacut", 0.8, "Eta cut"}; Configurable cPtmincut{"cPtmincut", 0.2, "Pt min cut"}; Configurable cPtmaxcut{"cPtmaxcut", 2.0, "Pt max cut"}; Configurable cDcaXYcut{"cDcaXYcut", 0.12, "DCA XY cut"}; - Configurable cDcaZcut{"cDcaZcut", 0.3, "DCA Z cut"}; + Configurable cDcaZcut{"cDcaZcut", 2.0, "DCA Z cut"}; Configurable cCentmincut{"cCentmincut", 0.0, "Min cent cut"}; Configurable cCentmaxcut{"cCentmaxcut", 90.0, "Max cent cut"}; Configurable cTPCcrosscut{"cTPCcrosscut", 70, "TPC crossrows cut"}; - Configurable cItsChiCut{"cItsChiCut", 70, "ITS chi2 cluster cut"}; - Configurable cTpcChiCut{"cTpcChiCut", 70, "TPC chi2 cluster cut"}; + Configurable cItsChiCut{"cItsChiCut", 36, "ITS chi2 cluster cut"}; + Configurable cTpcChiCut{"cTpcChiCut", 4, "TPC chi2 cluster cut"}; + Configurable cnITSClustersCut{"cnITSClustersCut", 5, "Number of ITS clusters cut"}; + Configurable ctpcNClsCut{"ctpcNClsCut", 80, "No. of TPC clusters cut"}; + Configurable threshold{"threshold", 1e-6, "Delta eta bin count"}; // Event selections Configurable cSel8Trig{"cSel8Trig", true, "Sel8 (T0A + T0C) Selection Run3"}; @@ -443,7 +389,10 @@ struct EventMeanPtId { Configurable cIsGoodITSLayers{"cIsGoodITSLayers", true, "Good ITS Layers All"}; Configurable cItslayerall{"cItslayerall", true, "dead staves of ITS removed"}; Configurable cvtxtofmatched{"cvtxtofmatched", true, "TOF vertex matched"}; - Configurable cfgRejEl{"cfgRejEl", true, "Rejected electrons"}; + Configurable cfgRejEl{"cfgRejEl", false, "Rejected electrons"}; + Configurable cdata{"cdata", false, "Enable histogram filling for processData"}; + Configurable citsNCluster{"citsNCluster", false, "Enable Number of ITS clusters"}; + Configurable ctpcNClusterFound{"ctpcNClusterFound", false, "Enable Number of TPC clusters"}; // PID selection configurables Configurable cPionPmincut{"cPionPmincut", 0.2, "pion min cut of pion"}; @@ -461,6 +410,9 @@ struct EventMeanPtId { Configurable cElMaxCut{"cElMaxCut", 5.0, "electron max cut"}; Configurable cTwoPtlCut2{"cTwoPtlCut2", 2.0, "n2ptl cut"}; Configurable cRapidityCut05{"cRapidityCut05", 0.5, "rapidity cut"}; + Configurable nchBins{"nchBins", 4000, "Number of bins for nch axis"}; + Configurable nchMin{"nchMin", 0.0, "Minimum value for nch axis"}; + Configurable nchMax{"nchMax", 4000.0, "Maximum value for nch axis"}; template bool selCollision(C const& coll) @@ -522,7 +474,9 @@ struct EventMeanPtId { // if (std::fabs(track.dcaXY()) > cDcaXYcut) {return false;} histos.fill(HIST("tracksel"), 3); - // if (std::fabs(track.dcaZ()) > cDcaZcut) {return false;} + if (std::fabs(track.dcaZ()) > cDcaZcut) { + return false; + } histos.fill(HIST("tracksel"), 4); if (std::fabs(track.eta()) >= cEtacut) { @@ -538,18 +492,38 @@ struct EventMeanPtId { } histos.fill(HIST("tracksel"), 6); - // if (track.tpcNClsCrossedRows() < cTPCcrosscut) {return false;} + if (track.tpcNClsCrossedRows() < cTPCcrosscut) { + return false; + } histos.fill(HIST("tracksel"), 7); - // if (track.itsChi2NCl() > cItsChiCut) {return false;} + if (track.itsChi2NCl() > cItsChiCut) { + return false; + } histos.fill(HIST("tracksel"), 8); - // if (track.tpcChi2NCl() > cTpcChiCut) {return false;} + if (track.tpcChi2NCl() > cTpcChiCut) { + return false; + } histos.fill(HIST("tracksel"), 9); if (track.sign() == 0) return false; + if (citsNCluster) { + if (track.itsNCls() < cnITSClustersCut) { + return false; + } + histos.fill(HIST("tracksel"), 10); + } + + if (ctpcNClusterFound) { + if (track.tpcNClsFound() < ctpcNClsCut) { + return false; + } + histos.fill(HIST("tracksel"), 11); + } + return true; // if all checks pass, accept the collision } @@ -643,16 +617,21 @@ struct EventMeanPtId { return false; } - double getEfficiency(double pt, TH1D* ptHistogramAllchargeRec) + double getEfficiency(double pt, double eta, TH2D* ptHistogramAllchargeRec) { - int bin = ptHistogramAllchargeRec->FindBin(pt); - double eff = ptHistogramAllchargeRec->GetBinContent(bin); + int xbin = ptHistogramAllchargeRec->GetXaxis()->FindBin(pt); + int ybin = ptHistogramAllchargeRec->GetYaxis()->FindBin(eta); + + if (xbin < 1 || xbin > ptHistogramAllchargeRec->GetNbinsX() || ybin < 1 || ybin > ptHistogramAllchargeRec->GetNbinsY()) { + LOGF(warn, "pt or eta out of histograms bounds : %f, eta = %f", pt, eta); + return 1e-6; + } + double eff = ptHistogramAllchargeRec->GetBinContent(xbin, ybin); return (eff > 0) ? eff : 1e-6; // Avoid division by zero } //++++++++++++++++++++++++++++++++++++DATA CALCULATION +++++++++++++++++++++++++++++++++++++++++++++++++++++// - - void process(aod::MyCollision const& coll, aod::MyTracks const& inputTracks) + void processData(aod::MyCollision const& coll, aod::MyTracks const& inputTracks) { histos.fill(HIST("hEventcounter"), 1.); histos.fill(HIST("Data/hZvtx_before_sel"), coll.posZ()); @@ -666,13 +645,12 @@ struct EventMeanPtId { const auto cent = coll.centFT0C(); histos.fill(HIST("Data/hCentrality"), cent); - double nch = 0., nchPi = 0., nchKa = 0., nchPr = 0., nchAll = 0., nchAllBfCut = 0., nchEta = 0., nchPt = 0.; - double q1 = 0., q2 = 0.; - double q1Pi = 0., q2Pi = 0., q1Ka = 0., q2Ka = 0., q1Pr = 0., q2Pr = 0.; - double var1 = 0., var2 = 0., twoParAllCharge = 0.; - double var1Pi = 0., var2Pi = 0.; - double var1Ka = 0., var2Ka = 0.; - double var1Pr = 0., var2Pr = 0.; + double nchAll = 0., nchAllBfCut = 0., nchEta = 0., nchPt = 0., nch = 0., nchPi = 0., nchKa = 0., nchPr = 0.; + double q1 = 0., q2 = 0., var1 = 0., var2 = 0.; + double sumPtWeight = 0., sumWeight = 0., sumPtPtWeight = 0., var1Eff = 0., var2Eff = 0.; + double q1Pi = 0., q2Pi = 0., var1Pi = 0., var2Pi = 0.; + double q1Ka = 0., q2Ka = 0., var1Ka = 0., var2Ka = 0.; + double q1Pr = 0., q2Pr = 0., var1Pr = 0., var2Pr = 0.; int sample = histos.get(HIST("Data/hZvtx_after_sel8"))->GetEntries(); sample = sample % 30; // subsample error estimation @@ -693,37 +671,44 @@ struct EventMeanPtId { nchPt += 1.; histos.fill(HIST("Data/hnchTrue_pt"), nchPt); } - if (track.sign() == 0) continue; if (!selTrack(track)) continue; nchAll += 1.; + q1 += track.pt(); + q2 += (track.pt() * track.pt()); + histos.fill(HIST("Data/hnchAll"), nchAll); + histos.fill(HIST("Data/hPt"), track.pt()); + histos.fill(HIST("Data/hEta"), track.eta()); histos.fill(HIST("Data/hDCAxy"), track.dcaXY()); histos.fill(HIST("Data/hDCAz"), track.dcaZ()); histos.fill(HIST("Data/hTPCCrossedrows_after"), track.tpcNClsCrossedRows()); histos.fill(HIST("Data/hTPCchi2perCluster_after"), track.tpcChi2NCl()); histos.fill(HIST("Data/hITSchi2perCluster_after"), track.itsChi2NCl()); histos.fill(HIST("Data/hP"), track.p()); - histos.fill(HIST("Data/hPt"), track.pt()); - histos.fill(HIST("Data/hEta"), track.eta()); histos.fill(HIST("Data/hPtDCAxy"), track.pt(), track.dcaXY()); histos.fill(HIST("Data/hPtDCAz"), track.pt(), track.dcaZ()); histos.fill(HIST("Data/hPtEta"), track.pt(), track.eta()); histos.fill(HIST("Data/hPEta"), track.p(), track.eta()); histos.fill(HIST("Data/hNsigmaTPC"), track.p(), track.tpcNSigmaPr()); + double eff = getEfficiency(track.pt(), track.eta(), ptHistogramAllchargeRec); + if (eff < threshold) + continue; + double weight = 1. / eff; + sumPtWeight += track.pt() / eff; + sumPtPtWeight += (track.pt() * track.pt()) / (eff * eff); + sumWeight += weight; + if (track.pt() >= cPtmincut || track.pt() <= cPtmaxcut) // do not change this (it is for different pt work) { nch += 1.; histos.fill(HIST("Data/hnch"), nch); } - q1 += track.pt(); - q2 += (track.pt() * track.pt()); - // only TPC tracks: Pion, Kaon, Proton if (track.hasTPC() && std::abs(track.tpcNSigmaPi()) < cNSigCut3) histos.fill(HIST("Data/NSigamaTPCpion"), track.pt(), track.tpcNSigmaPi()); @@ -753,7 +738,6 @@ struct EventMeanPtId { histos.fill(HIST("Data/hdEdx_afterselection"), track.p(), track.tpcSignal()); histos.fill(HIST("Data/hTOFbeta_afterselection"), track.p(), track.beta()); } - if (selPion(track)) { histos.fill(HIST("Data/hPtPion"), track.pt()); histos.fill(HIST("Data/hEtaPion"), track.eta()); @@ -762,7 +746,6 @@ struct EventMeanPtId { nchPi += 1.; q1Pi += track.pt(); q2Pi += (track.pt() * track.pt()); - if (track.beta() > 1) continue; histos.fill(HIST("Data/hdEdx_afterselection1"), track.p(), track.tpcSignal()); @@ -775,7 +758,6 @@ struct EventMeanPtId { histos.fill(HIST("Data/hdEdx_afterselection"), track.p(), track.tpcSignal()); histos.fill(HIST("Data/hTOFbeta_afterselection"), track.p(), track.beta()); } - if (selKaon(track)) { histos.fill(HIST("Data/hPtKaon"), track.pt()); histos.fill(HIST("Data/hEtaKaon"), track.eta()); @@ -784,7 +766,6 @@ struct EventMeanPtId { nchKa += 1.; q1Ka += track.pt(); q2Ka += (track.pt() * track.pt()); - if (track.beta() > 1) continue; histos.fill(HIST("Data/hdEdx_afterselection1"), track.p(), track.tpcSignal()); @@ -797,7 +778,6 @@ struct EventMeanPtId { histos.fill(HIST("Data/hdEdx_afterselection"), track.p(), track.tpcSignal()); histos.fill(HIST("Data/hTOFbeta_afterselection"), track.p(), track.beta()); } - if (selProton(track)) { histos.fill(HIST("Data/hPtProton"), track.pt()); histos.fill(HIST("Data/hEtaProton"), track.eta()); @@ -806,12 +786,12 @@ struct EventMeanPtId { nchPr += 1.; q1Pr += track.pt(); q2Pr += (track.pt() * track.pt()); - if (track.beta() > 1) continue; histos.fill(HIST("Data/hdEdx_afterselection1"), track.p(), track.tpcSignal()); histos.fill(HIST("Data/hTOFbeta_afterselection1"), track.p(), track.beta()); } + } // Track loop ends! histos.fill(HIST("Data/hcent_nacc"), cent, nchAll); @@ -820,41 +800,37 @@ struct EventMeanPtId { var1 = (q1 * q1 - q2) / (nchAll * (nchAll - 1)); var2 = (q1 / nchAll); - //------------------ all charges------------------------------------- - histos.fill(HIST("Data/hVar1"), sample, cent, var1); - histos.fill(HIST("Data/hVar2"), sample, cent, var2); - histos.fill(HIST("Data/hVarc"), sample, cent); - histos.fill(HIST("Data/hVar2meanpt"), cent, var2); - twoParAllCharge = (var1 - var2); - histos.fill(HIST("Data/hVar"), nchAll, twoParAllCharge); + //------------------ Efficiency corrected histograms --------------- + var1Eff = (sumPtWeight * sumPtWeight - sumPtPtWeight) / (sumWeight * (sumWeight - 1)); + var2Eff = (sumPtWeight / sumWeight); //---------------------- pions ---------------------------------------- if (nchPi >= cTwoPtlCut2) { var1Pi = (q1Pi * q1Pi - q2Pi) / (nchPi * (nchPi - 1)); var2Pi = (q1Pi / nchPi); } - //----------------------- kaons --------------------------------------- if (nchKa >= cTwoPtlCut2) { var1Ka = (q1Ka * q1Ka - q2Ka) / (nchKa * (nchKa - 1)); var2Ka = (q1Ka / nchKa); } - //---------------------------- protons ---------------------------------- if (nchPr >= cTwoPtlCut2) { var1Pr = (q1Pr * q1Pr - q2Pr) / (nchPr * (nchPr - 1)); var2Pr = (q1Pr / nchPr); } - //========================centrality========================================== + //------------------ all charges------------------------------------- + histos.fill(HIST("Data/hVar1"), sample, cent, var1); + histos.fill(HIST("Data/hVar2"), sample, cent, var2); + histos.fill(HIST("Data/hVarc"), sample, cent); + histos.fill(HIST("Data/hVar2meanpt"), cent, var2); histos.fill(HIST("Data/hVar1pi"), sample, cent, var1Pi); histos.fill(HIST("Data/hVar2pi"), sample, cent, var2Pi); histos.fill(HIST("Data/hVar2meanptpi"), cent, var2Pi); - histos.fill(HIST("Data/hVar1k"), sample, cent, var1Ka); histos.fill(HIST("Data/hVar2k"), sample, cent, var2Ka); histos.fill(HIST("Data/hVar2meanptk"), cent, var2Ka); - histos.fill(HIST("Data/hVar1p"), sample, cent, var1Pr); histos.fill(HIST("Data/hVar2p"), sample, cent, var2Pr); histos.fill(HIST("Data/hVar2meanptp"), cent, var2Pr); @@ -865,6 +841,20 @@ struct EventMeanPtId { histos.fill(HIST("Data/hVarx"), sample, nchAll); histos.fill(HIST("Data/hVar2meanptx"), nchAll, var2); + histos.fill(HIST("hEffVar1x_data"), sample, nchAll, var1Eff); + histos.fill(HIST("hEffVar2x_data"), sample, nchAll, var2Eff); + histos.fill(HIST("hEffVarx_data"), sample, nchAll); + histos.fill(HIST("hEffVar2Meanptx_data"), nchAll, var2Eff); + histos.fill(HIST("hEffVar1x_Naccorr_data"), sample, sumWeight, var1Eff); + histos.fill(HIST("hEffVar2x_Naccorr_data"), sample, sumWeight, var2Eff); + histos.fill(HIST("hEffVarx_Naccorr_data"), sample, sumWeight); + histos.fill(HIST("hEffVar1x_Naccorr_data"), sample, nchAll, var1Eff); + histos.fill(HIST("hEffVar2x_Naccorr_data"), sample, nchAll, var2Eff); + histos.fill(HIST("hEffVarx_Naccorr_data"), sample, nchAll, sumWeight); + histos.fill(HIST("hEffVar1x_Naccorr_xaxis_data"), sample, sumWeight, var1); + histos.fill(HIST("hEffVar2x_Naccorr_xaxis_data"), sample, sumWeight, var2); + histos.fill(HIST("hEffVarx_Naccorr_xaxis_data"), sample, sumWeight); + histos.fill(HIST("Data/hVar1pix"), sample, nchAll, var1Pi); histos.fill(HIST("Data/hVar2pix"), sample, nchAll, var2Pi); histos.fill(HIST("Data/hVarpix"), sample, nchPi); @@ -879,10 +869,9 @@ struct EventMeanPtId { histos.fill(HIST("Data/hVar2px"), sample, nchAll, var2Pr); histos.fill(HIST("Data/hVarpx"), sample, nchPr); histos.fill(HIST("Data/hVar2meanptpx"), nchAll, var2Pr); - } // event loop ends! - PROCESS_SWITCH(EventMeanPtId, process, "process real data information", false); + PROCESS_SWITCH(EventMeanPtId, processData, "process real data information", false); //++++++++++++++++++++++++++++++++++++MC Reconstructed +++++++++++++++++++++++++++++++++++++++++++++++++++++// @@ -897,43 +886,19 @@ struct EventMeanPtId { histos.fill(HIST("Rec/hZvtx_before_sel"), coll.posZ()); histos.fill(HIST("hVtxZ_before_gen"), coll.mcCollision().posZ()); - if (cTFBorder && !coll.selection_bit(aod::evsel::kNoTimeFrameBorder)) { - return; - } - if (cNoItsROBorder && !coll.selection_bit(aod::evsel::kNoITSROFrameBorder)) { - return; - } - if (cPileupReject && !coll.selection_bit(aod::evsel::kNoSameBunchPileup)) { - return; - } - if (cZVtxTimeDiff && !coll.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { - return; - } - if (cItsTpcVtx && !coll.selection_bit(aod::evsel::kIsVertexITSTPC)) { - return; - } - if (cvtxtofmatched && !coll.selection_bit(aod::evsel::kIsVertexTOFmatched)) { - return; - } - if (std::abs(coll.posZ()) > cVtxZcut) { + if (!selCollision(coll)) // add return; - } - if (!coll.sel8()) { - return; - } float cent = coll.centFT0C(); histos.fill(HIST("Rec/hZvtx_after_sel8"), coll.posZ()); + histos.fill(HIST("Rec/hCentrality"), cent); double nch = 0., nchPi = 0., nchKa = 0., nchPr = 0., nchAll = 0., nchAllBfCut = 0., nchEta = 0., nchPt = 0.; double q1 = 0., q2 = 0.; double q1Pi = 0., q2Pi = 0., q1Ka = 0., q2Ka = 0., q1Pr = 0., q2Pr = 0.; - double var1 = 0., var2 = 0., twoParAllCharge = 0.; + double var1 = 0., var2 = 0.; double var1Pi = 0., var2Pi = 0., var1Ka = 0., var2Ka = 0., var1Pr = 0., var2Pr = 0.; double sumPtWeight = 0., sumWeight = 0., sumPtPtWeight = 0., var1Eff = 0., var2Eff = 0.; - double sumPtWeightPi = 0., sumWeightPi = 0., sumPtPtWeightPi = 0., var1EffPi = 0., var2EffPi = 0.; - double sumPtWeightKa = 0., sumWeightKa = 0., sumPtPtWeightKa = 0., var1EffKa = 0., var2EffKa = 0.; - double sumPtWeightPr = 0., sumWeightPr = 0., sumPtPtWeightPr = 0., var1EffPr = 0., var2EffPr = 0.; int sample = histos.get(HIST("Rec/hZvtx_after_sel8"))->GetEntries(); sample = sample % 30; @@ -953,18 +918,23 @@ struct EventMeanPtId { nchPt += 1.; histos.fill(HIST("Rec/hnchTrue_pt"), nchPt); } - if (!track.isGlobalTrack()) - continue; - if (std::fabs(track.eta()) > cEtacut) - continue; - if ((track.pt() <= cPtmincut) || (track.pt() >= cPtmaxcut)) - continue; - if (track.sign() == 0) + if (!selTrack(track)) continue; // if (std::fabs(track.y()) > 0.5) continue; histos.fill(HIST("hPt_rec"), track.pt()); histos.fill(HIST("hEta_rec"), track.eta()); + double eff = getEfficiency(track.pt(), track.eta(), ptHistogramAllchargeRec); + if (eff < threshold) + continue; + double weight = 1.0 / eff; + sumPtWeight += track.pt() * weight; + sumPtPtWeight += (track.pt() * track.pt() * weight * weight); + sumWeight += weight; + + histos.fill(HIST("hPt_rec_corr"), track.pt(), weight); + histos.fill(HIST("hEta_rec_corr"), track.eta(), weight); + auto mcParticle = track.mcParticle(); nchAll += 1.; histos.fill(HIST("Rec/hnchAll"), nchAll); @@ -982,6 +952,7 @@ struct EventMeanPtId { histos.fill(HIST("Rec/hPtEta"), track.pt(), track.eta()); histos.fill(HIST("Rec/hPEta"), track.p(), track.eta()); histos.fill(HIST("Rec/hNsigmaTPC"), track.p(), track.tpcNSigmaPr()); + histos.fill(HIST("hPtEta_rec"), track.pt(), track.eta()); if (track.pt() >= cPtmincut || track.pt() <= cPtmaxcut) // do not change this (it is for different pt work) { @@ -991,12 +962,6 @@ struct EventMeanPtId { q1 += track.pt(); q2 += (track.pt() * track.pt()); - double eff = getEfficiency(track.pt(), ptHistogramAllchargeRec); - // LOGF(info, " with value %.2f", eff); - sumPtWeight += track.pt() / eff; - sumPtPtWeight += (track.pt() * track.pt()) / (eff * eff); - sumWeight += 1. / eff; - if (std::abs(mcParticle.pdgCode()) == PDG_t::kPiPlus) histos.fill(HIST("ptHistogramPionrec_pdg"), track.pt()); if (std::abs(mcParticle.pdgCode()) == PDG_t::kKPlus) @@ -1004,10 +969,6 @@ struct EventMeanPtId { if (std::abs(mcParticle.pdgCode()) == PDG_t::kProton) histos.fill(HIST("ptHistogramProtonrec_pdg"), track.pt()); - if (cfgRejEl == false && rejEl(track)) { - return; - } - // only TPC tracks: Pion, Kaon, Proton if (track.hasTPC() && std::abs(track.tpcNSigmaPi()) < cNSigCut3) histos.fill(HIST("Rec/NSigamaTPCpion"), track.pt(), track.tpcNSigmaPi()); @@ -1047,6 +1008,7 @@ struct EventMeanPtId { if (track.beta() > 1) continue; histos.fill(HIST("ptHistogramPionrec"), track.pt()); + histos.fill(HIST("hPtEta_pi_rec"), track.pt(), track.eta()); histos.fill(HIST("Rec/hPtPion"), track.pt()); histos.fill(HIST("Rec/hEtaPion"), track.eta()); histos.fill(HIST("Rec/hyPion"), track.rapidity(massPi)); @@ -1063,12 +1025,6 @@ struct EventMeanPtId { q1Pi += track.pt(); q2Pi += (track.pt() * track.pt()); - double effPi = getEfficiency(track.pt(), ptHistogramPionrec); - // LOGF(info, " with value %.2f", eff); - sumPtWeightPi += track.pt() / effPi; - sumPtPtWeightPi += (track.pt() * track.pt()) / (effPi * effPi); - sumWeightPi += 1. / effPi; - histos.fill(HIST("hPyPion_rec"), track.p(), track.rapidity(massPi)); histos.fill(HIST("hPtyPion_rec"), track.pt(), track.rapidity(massPi)); } @@ -1087,6 +1043,7 @@ struct EventMeanPtId { if (track.beta() > 1) continue; histos.fill(HIST("ptHistogramKaonrec"), track.pt()); + histos.fill(HIST("hPtEta_ka_rec"), track.pt(), track.eta()); histos.fill(HIST("Rec/hPtKaon"), track.pt()); histos.fill(HIST("Rec/hEtaKaon"), track.eta()); histos.fill(HIST("Rec/hyKaon"), track.rapidity(massKa)); @@ -1103,12 +1060,6 @@ struct EventMeanPtId { q1Ka += track.pt(); q2Ka += (track.pt() * track.pt()); - double effKa = getEfficiency(track.pt(), ptHistogramKaonrec); - // LOGF(info, " with value %.2f", eff); - sumPtWeightKa += track.pt() / effKa; - sumPtPtWeightKa += (track.pt() * track.pt()) / (effKa * effKa); - sumWeightKa += 1. / effKa; - histos.fill(HIST("hPyKaon_rec"), track.p(), track.rapidity(massKa)); histos.fill(HIST("hPtyKaon_rec"), track.pt(), track.rapidity(massKa)); } @@ -1127,6 +1078,7 @@ struct EventMeanPtId { if (track.beta() > 1) continue; histos.fill(HIST("ptHistogramProtonrec"), track.pt()); + histos.fill(HIST("hPtEta_pr_rec"), track.pt(), track.eta()); histos.fill(HIST("Rec/hPtProton"), track.pt()); histos.fill(HIST("Rec/hEtaProton"), track.eta()); histos.fill(HIST("Rec/hyProton"), track.rapidity(massPr)); @@ -1143,18 +1095,14 @@ struct EventMeanPtId { q1Pr += track.pt(); q2Pr += (track.pt() * track.pt()); - double effPr = getEfficiency(track.pt(), ptHistogramProtonrec); - // LOGF(info, " with value %.2f", eff); - sumPtWeightPr += track.pt() / effPr; - sumPtPtWeightPr += (track.pt() * track.pt()) / (effPr * effPr); - sumWeightPr += 1. / effPr; - histos.fill(HIST("hPyProton_rec"), track.p(), track.rapidity(massPr)); histos.fill(HIST("hPtyProton_rec"), track.pt(), track.rapidity(massPr)); } } // loop over tracks histos.fill(HIST("Rec/hcent_nacc"), cent, nchAll); + histos.fill(HIST("hcent_nacc_corr"), cent, sumWeight); + histos.fill(HIST("hNch_vs_corr"), nchAll, sumWeight); if (nchAll < cTwoPtlCut2) return; @@ -1170,32 +1118,21 @@ struct EventMeanPtId { histos.fill(HIST("Rec/hVar2"), sample, cent, var2); histos.fill(HIST("Rec/hVarc"), sample, cent); histos.fill(HIST("Rec/hVar2meanpt"), cent, var2); - twoParAllCharge = (var1 - var2); - histos.fill(HIST("Rec/hVar"), nchAll, twoParAllCharge); //---------------------- pions ---------------------------------------- if (nchPi >= cTwoPtlCut2) { var1Pi = (q1Pi * q1Pi - q2Pi) / (nchPi * (nchPi - 1)); var2Pi = (q1Pi / nchPi); - - var1EffPi = (sumPtWeightPi * sumPtWeightPi - sumPtPtWeightPi) / (sumWeightPi * (sumWeightPi - 1)); - var2EffPi = (sumPtWeightPi / sumWeightPi); } //----------------------- kaons --------------------------------------- if (nchKa >= cTwoPtlCut2) { var1Ka = (q1Ka * q1Ka - q2Ka) / (nchKa * (nchKa - 1)); var2Ka = (q1Ka / nchKa); - - var1EffKa = (sumPtWeightKa * sumPtWeightKa - sumPtPtWeightKa) / (sumWeightKa * (sumWeightKa - 1)); - var2EffKa = (sumPtWeightKa / sumWeightKa); } //---------------------------- protons ---------------------------------- if (nchPr >= cTwoPtlCut2) { var1Pr = (q1Pr * q1Pr - q2Pr) / (nchPr * (nchPr - 1)); var2Pr = (q1Pr / nchPr); - - var1EffPr = (sumPtWeightPr * sumPtWeightPr - sumPtPtWeightPr) / (sumWeightPr * (sumWeightPr - 1)); - var2EffPr = (sumPtWeightPr / sumWeightPr); } //========================centrality========================================== @@ -1227,25 +1164,16 @@ struct EventMeanPtId { histos.fill(HIST("Rec/hVarpx"), sample, nchPr); histos.fill(HIST("Rec/hVar2meanptpx"), nchAll, var2Pr); - histos.fill(HIST("hEffVar1x"), sample, nchAll, var1Eff); - histos.fill(HIST("hEffVar2x"), sample, nchAll, var2Eff); - histos.fill(HIST("hEffVarx"), sample, nchAll); - histos.fill(HIST("hEffVar2Meanptx"), nchAll, var2Eff); - - histos.fill(HIST("hEffVar1pix"), sample, nchAll, var1EffPi); - histos.fill(HIST("hEffVar2pix"), sample, nchAll, var2EffPi); - histos.fill(HIST("hEffVarpix"), sample, nchAll); - histos.fill(HIST("hEffVar2Meanptpix"), nchAll, var2EffPi); - - histos.fill(HIST("hEffVar1kx"), sample, nchAll, var1EffKa); - histos.fill(HIST("hEffVar2kx"), sample, nchAll, var2EffKa); - histos.fill(HIST("hEffVarkx"), sample, nchAll); - histos.fill(HIST("hEffVar2Meanptkx"), nchAll, var2EffKa); - - histos.fill(HIST("hEffVar1px"), sample, nchAll, var1EffPr); - histos.fill(HIST("hEffVar2px"), sample, nchAll, var2EffPr); - histos.fill(HIST("hEffVarpx"), sample, nchAll); - histos.fill(HIST("hEffVar2Meanptpx"), nchAll, var2EffPr); + histos.fill(HIST("hEffVar1x_rec"), sample, nchAll, var1Eff); + histos.fill(HIST("hEffVar2x_rec"), sample, nchAll, var2Eff); + histos.fill(HIST("hEffVarx_rec"), sample, nchAll); + histos.fill(HIST("hEffVar2Meanptx_rec"), nchAll, var2Eff); + histos.fill(HIST("hEffVar1x_Naccorr_rec"), sample, sumWeight, var1Eff); + histos.fill(HIST("hEffVar2x_Naccorr_rec"), sample, sumWeight, var2Eff); + histos.fill(HIST("hEffVarx_Naccorr_rec"), sample, sumWeight); + histos.fill(HIST("hEffVar1x_Naccorr_xaxis_rec"), sample, sumWeight, var1); + histos.fill(HIST("hEffVar2x_Naccorr_xaxis_rec"), sample, sumWeight, var2); + histos.fill(HIST("hEffVarx_Naccorr_xaxis_rec"), sample, sumWeight); //================= generated level============================== @@ -1254,9 +1182,9 @@ struct EventMeanPtId { return; } const auto& mcpartgen = mcParticles.sliceByCached(aod::mcparticle::mcCollisionId, mccolgen.globalIndex(), cache); - histos.fill(HIST("hVtxZ_after_gen"), mccolgen.posZ()); + histos.fill(HIST("hVtxZ_after_gensim"), mccolgen.posZ()); - double nchGen = 0., nchGenAll = 0., nchGenTrue = 0.; + double nchGenAll = 0., nchGenTrue = 0.; double nchPiGen = 0., nchKaGen = 0., nchPrGen = 0.; double nch1 = 0., nch2 = 0., nch3 = 0.; double q1AllGen = 0, q2AllGen = 0.; @@ -1264,7 +1192,7 @@ struct EventMeanPtId { double var1AllGen = 0, var2AllGen = 0.; double var1PiGen = 0, var2PiGen = 0, var1KaGen = 0, var2KaGen = 0, var1PrGen = 0, var2PrGen = 0; - int sampleGen = histos.get(HIST("hVtxZ_after_gen"))->GetEntries(); + int sampleGen = histos.get(HIST("hVtxZ_after_gensim"))->GetEntries(); sampleGen = sampleGen % 30; for (const auto& mcpart : mcpartgen) { @@ -1302,10 +1230,14 @@ struct EventMeanPtId { q1AllGen += mcpart.pt(); q2AllGen += (mcpart.pt() * mcpart.pt()); histos.fill(HIST("hnch_gen_all"), nchGenAll); + histos.fill(HIST("hPtEta_gen"), mcpart.pt(), mcpart.eta()); + if (std::fabs(mcpart.y()) < cRapidityCut05) { if (mcpart.pdgCode() == PDG_t::kPiPlus || mcpart.pdgCode() == PDG_t::kPiMinus) { histos.fill(HIST("ptHistogramPion"), mcpart.pt()); + histos.fill(HIST("hPtEta_pi_gen"), mcpart.pt(), mcpart.eta()); + histos.fill(HIST("hPty_pi_gen"), mcpart.pt(), mcpart.y()); nchPiGen += 1.; q1PiGen += mcpart.pt(); q2PiGen += (mcpart.pt() * mcpart.pt()); @@ -1314,6 +1246,8 @@ struct EventMeanPtId { if (mcpart.pdgCode() == PDG_t::kKPlus || mcpart.pdgCode() == PDG_t::kKMinus) { histos.fill(HIST("ptHistogramKaon"), mcpart.pt()); + histos.fill(HIST("hPtEta_ka_gen"), mcpart.pt(), mcpart.eta()); + histos.fill(HIST("hPty_ka_gen"), mcpart.pt(), mcpart.y()); nchKaGen += 1.; q1KaGen += mcpart.pt(); q2KaGen += (mcpart.pt() * mcpart.pt()); @@ -1322,6 +1256,8 @@ struct EventMeanPtId { if (mcpart.pdgCode() == PDG_t::kProton || mcpart.pdgCode() == PDG_t::kProtonBar) { histos.fill(HIST("ptHistogramProton"), mcpart.pt()); + histos.fill(HIST("hPtEta_pr_gen"), mcpart.pt(), mcpart.eta()); + histos.fill(HIST("hPty_pr_gen"), mcpart.pt(), mcpart.y()); nchPrGen += 1.; q1PrGen += mcpart.pt(); q2PrGen += (mcpart.pt() * mcpart.pt()); @@ -1331,18 +1267,22 @@ struct EventMeanPtId { } //|y| < 0.5 cut ends! } // particle - histos.fill(HIST("hcent_nacc_gen"), cent, nchGen); + histos.fill(HIST("hcent_nacc_gen"), cent, nchGenAll); if (nchGenAll < cTwoPtlCut2) return; var1AllGen = (q1AllGen * q1AllGen - q2AllGen) / (nchGenAll * (nchGenAll - 1)); var2AllGen = (q1AllGen / nchGenAll); + histos.fill(HIST("hVar1_gen"), sampleGen, cent, var1AllGen); + histos.fill(HIST("hVar2_gen"), sampleGen, cent, var2AllGen); + histos.fill(HIST("hVarc_gen"), sampleGen, cent); + + //--------------------------Pions------------------------------------------- if (nchPiGen >= cTwoPtlCut2) { var1PiGen = (q1PiGen * q1PiGen - q2PiGen) / (nchPiGen * (nchPiGen - 1)); var2PiGen = (q1PiGen / nchPiGen); } - //----------------------- kaons --------------------------------------- if (nchKaGen >= cTwoPtlCut2) { var1KaGen = (q1KaGen * q1KaGen - q2KaGen) / (nchKaGen * (nchKaGen - 1)); From f8fff293101cbb83e13028f7a30b01f22b2192db Mon Sep 17 00:00:00 2001 From: CesarOmarRA <35703156+CesarOmarRA@users.noreply.github.com> Date: Mon, 11 Aug 2025 18:22:20 +0200 Subject: [PATCH 332/345] [PWGUD] Rho prime to 4 pi (#12527) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: ddobrigk Co-authored-by: Fabrizio Co-authored-by: Daiki Sekihata Co-authored-by: MaolinZH <109225729+MaolinZH@users.noreply.github.com> Co-authored-by: Vít Kučera Co-authored-by: Paola Vargas Torres <88360333+PaolaVT@users.noreply.github.com> Co-authored-by: mherzer <96999709+mherzer28@users.noreply.github.com> Co-authored-by: ALICE Action Bot Co-authored-by: BiaoZhang (张彪) <52267892+zhangbiao-phy@users.noreply.github.com> Co-authored-by: JStaa <39123272+JStaa@users.noreply.github.com> Co-authored-by: Noor Koster <82090643+cnkoster@users.noreply.github.com> Co-authored-by: Yash Patley <52608802+yashpatley@users.noreply.github.com> Co-authored-by: glromane <95305986+glromane@users.noreply.github.com> Co-authored-by: Rahul Verma <110929992+rahulverma012@users.noreply.github.com> Co-authored-by: Anton Alkin Co-authored-by: skundu692 <86804743+skundu692@users.noreply.github.com> Co-authored-by: Zhiyong <71517277+Luzhiyongg@users.noreply.github.com> Co-authored-by: Dawid Karpiński <40724893+davkk@users.noreply.github.com> Co-authored-by: Evgeny Kryshen Co-authored-by: Nicolò Jacazio Co-authored-by: Jesper Gumprecht <113693781+jesgum@users.noreply.github.com> Co-authored-by: Zhenjun Xiong <108917659+zjxiongOvO@users.noreply.github.com> Co-authored-by: Marvin Hemmer <53471402+mhemmer-cern@users.noreply.github.com> Co-authored-by: Florian Jonas Co-authored-by: altsybee Co-authored-by: Md Samsul Islam <56156956+mislam17@users.noreply.github.com> Co-authored-by: ariedel-cern <85537041+ariedel-cern@users.noreply.github.com> Co-authored-by: Kangkan Goswami Co-authored-by: Stefano Cannito <143754257+scannito@users.noreply.github.com> Co-authored-by: suyoupeng <109774812+15071832337@users.noreply.github.com> Co-authored-by: Francesco Mazzaschi <43742195+fmazzasc@users.noreply.github.com> Co-authored-by: Francesco Mazzaschi Co-authored-by: Fabio Colamaria Co-authored-by: fcolamar Co-authored-by: sashingo Co-authored-by: yhambard <127940767+yhambard@users.noreply.github.com> Co-authored-by: FDUEnrich <23210190047@m.fudan.edu.cn> Co-authored-by: EmilGorm <50658075+EmilGorm@users.noreply.github.com> Co-authored-by: aimeric-landou <46970521+aimeric-landou@users.noreply.github.com> Co-authored-by: Dongguk Kim <157434406+DonggukKim0@users.noreply.github.com> Co-authored-by: hernasab Co-authored-by: Sabrina Hernandez Co-authored-by: Ionut Cristian Arsene Co-authored-by: Ionut Cristian Arsene Co-authored-by: Peter Stratmann <80676312+pestratm@users.noreply.github.com> Co-authored-by: Debadatta3337 Co-authored-by: Debadatta3337 Co-authored-by: Josué Martínez García Co-authored-by: Gyula Bencedi Co-authored-by: Anisa Khatun Co-authored-by: akhatun Co-authored-by: yuanzhe <90246048+wang-yuanzhe@users.noreply.github.com> Co-authored-by: dajones2 <140733426+dajones2@users.noreply.github.com> Co-authored-by: chengtt0406 <39661669+chengtt0406@users.noreply.github.com> Co-authored-by: Lars <146946151+ljoergen@users.noreply.github.com> Co-authored-by: Mario Ciacco Co-authored-by: omvazque Co-authored-by: Rik Spijkers <78484875+rspijkers@users.noreply.github.com> Co-authored-by: mhartung71 <50153519+mhartung71@users.noreply.github.com> Co-authored-by: Maximiliano Puccio Co-authored-by: Anantha Padmanabhan M Nair <82643666+ananthapadmanabhan18@users.noreply.github.com> Co-authored-by: Luca Aglietta <75362880+Luca610@users.noreply.github.com> Co-authored-by: Tao_Fang <52570362+Tao-Fang@users.noreply.github.com> Co-authored-by: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Co-authored-by: Paul Veen (paveen) <80593165+ppoava@users.noreply.github.com> Co-authored-by: GijsvWeelden <55794847+GijsvWeelden@users.noreply.github.com> Co-authored-by: Archita-Dash <91664849+Archita-Dash@users.noreply.github.com> Co-authored-by: Jerome Jung Co-authored-by: Roman Lietava Co-authored-by: Lucia Anna Tarasovicova Co-authored-by: Lucia Anna Tarasovicova Co-authored-by: ALICE Builder Co-authored-by: lmattei01 <122298453+lmattei01@users.noreply.github.com> Co-authored-by: MATTEI Co-authored-by: Kaare Endrup Iversen <69893472+kaareendrup@users.noreply.github.com> Co-authored-by: Thorkj <154221526+Thorkj@users.noreply.github.com> Co-authored-by: Mingyu Zhang <83645570+Mingyu3360715@users.noreply.github.com> Co-authored-by: Sigurd Nese <32108009+sigurdnese@users.noreply.github.com> Co-authored-by: Samuele Cattaruzzi <124249902+scattaru@users.noreply.github.com> Co-authored-by: cterrevo Co-authored-by: Fabrizio Chinu <91954233+fchinu@users.noreply.github.com> Co-authored-by: Sergio Garcia <47090312+singiamtel@users.noreply.github.com> Co-authored-by: Ravindra Singh <56298081+singhra1994@users.noreply.github.com> Co-authored-by: blacwovie Co-authored-by: a-m-andrushko <96832230+a-m-andrushko@users.noreply.github.com> Co-authored-by: Pritam Chakraborty <47203359+prchakra@users.noreply.github.com> Co-authored-by: Nida Malik Co-authored-by: Hirak Koley Co-authored-by: sarjeetagami <162087855+sarjeetagami@users.noreply.github.com> Co-authored-by: sarjeeta gami Co-authored-by: basiach <74355517+basiach@users.noreply.github.com> Co-authored-by: Barbara Chytla Co-authored-by: Shyam Kumar Co-authored-by: Oleksii Lubynets Co-authored-by: Zhengqing Wang Co-authored-by: Rrantu <156880782+Rrantu@users.noreply.github.com> Co-authored-by: Felix Schlepper Co-authored-by: Sandeep Dudi <69388148+sdudi123@users.noreply.github.com> Co-authored-by: sandeep dudi Co-authored-by: prottayCMT <61418725+prottayCMT@users.noreply.github.com> Co-authored-by: Prottay Das Co-authored-by: Simone Ragoni <47641042+siragoni@users.noreply.github.com> Co-authored-by: creetz16 <79141119+creetz16@users.noreply.github.com> Co-authored-by: ynishida-style Co-authored-by: spucillo <93769017+spucillo@users.noreply.github.com> Co-authored-by: Javier Castillo Castellanos Co-authored-by: marcobianchi463 <121625445+marcobianchi463@users.noreply.github.com> Co-authored-by: Artem Kotliarov <71133985+KotliarovAr@users.noreply.github.com> Co-authored-by: Preet-Bhanjan Co-authored-by: Preet Pati Co-authored-by: romainschotter Co-authored-by: jaelpark Co-authored-by: Francesca Ercolessi Co-authored-by: YubiaoWang Co-authored-by: Rashi gupta <167059733+rashigupt@users.noreply.github.com> Co-authored-by: Rashi Gupta Co-authored-by: dyx-11 <1260971129@qq.com> Co-authored-by: Banajit Barman <113376372+BanajitBarman@users.noreply.github.com> Co-authored-by: fuchuncui <162277233+fuchuncui@users.noreply.github.com> Co-authored-by: sawan <124118453+sawankumawat@users.noreply.github.com> Co-authored-by: Sawan Sawan --- PWGUD/Tasks/upcRhoPrimeAnalysis.cxx | 613 ++++++++++++++++------------ 1 file changed, 351 insertions(+), 262 deletions(-) diff --git a/PWGUD/Tasks/upcRhoPrimeAnalysis.cxx b/PWGUD/Tasks/upcRhoPrimeAnalysis.cxx index 49b6e478674..c1ebc114efa 100644 --- a/PWGUD/Tasks/upcRhoPrimeAnalysis.cxx +++ b/PWGUD/Tasks/upcRhoPrimeAnalysis.cxx @@ -21,318 +21,407 @@ #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" -#include "Math/Vector4D.h" // similiar to TLorentzVector (which is now legacy apparently) +#include "Math/Vector4D.h" +#include "TH1F.h" +#include "TH2F.h" #include "random" -#include // Para std::string -#include // Para std::vector +#include +#include +#include using namespace o2; using namespace o2::framework; -using namespace o2::framework::expressions; -using FullUDSgCollision = soa::Join::iterator; -using FullUDTracks = soa::Join; +// Define UD tables +using UDtracks = soa::Join; +using UDCollisions = soa::Join; namespace o2::aod { namespace fourpi { - -// for event -DECLARE_SOA_COLUMN(RunNumber, runNumber, int32_t); - -// for rho prime -DECLARE_SOA_COLUMN(M, m, double); -DECLARE_SOA_COLUMN(Pt, pt, double); -DECLARE_SOA_COLUMN(Eta, eta, double); -DECLARE_SOA_COLUMN(Phi, phi, double); - -// for vertex -DECLARE_SOA_COLUMN(PosX, posX, double); -DECLARE_SOA_COLUMN(PosY, posY, double); -DECLARE_SOA_COLUMN(PosZ, posZ, double); - -// for other -DECLARE_SOA_COLUMN(TotalCharge, totalCharge, int); - -// info detec -DECLARE_SOA_COLUMN(TotalFT0AmplitudeA, totalFT0AmplitudeA, float); -DECLARE_SOA_COLUMN(TotalFT0AmplitudeC, totalFT0AmplitudeC, float); -DECLARE_SOA_COLUMN(TotalFV0AmplitudeA, totalFV0AmplitudeA, float); -DECLARE_SOA_COLUMN(TotalFDDAmplitudeA, totalFDDAmplitudeA, float); -DECLARE_SOA_COLUMN(TotalFDDAmplitudeC, totalFDDAmplitudeC, float); -DECLARE_SOA_COLUMN(TimeFT0A, timeFT0A, float); -DECLARE_SOA_COLUMN(TimeFT0C, timeFT0C, float); -DECLARE_SOA_COLUMN(TimeFV0A, timeFV0A, float); -DECLARE_SOA_COLUMN(TimeFDDA, timeFDDA, float); -DECLARE_SOA_COLUMN(TimeFDDC, timeFDDC, float); - -// for pion tracks -DECLARE_SOA_COLUMN(NumContrib, numContrib, int32_t); -DECLARE_SOA_COLUMN(Sign, sign, std::vector); -DECLARE_SOA_COLUMN(TrackPt, trackPt, std::vector); -DECLARE_SOA_COLUMN(TrackEta, trackEta, std::vector); -DECLARE_SOA_COLUMN(TrackPhi, trackPhi, std::vector); -DECLARE_SOA_COLUMN(TPCNSigmaEl, tpcNSigmaEl, std::vector); -DECLARE_SOA_COLUMN(TPCNSigmaPi, tpcNSigmaPi, std::vector); -DECLARE_SOA_COLUMN(TPCNSigmaKa, tpcNSigmaKa, std::vector); -DECLARE_SOA_COLUMN(TPCNSigmaPr, tpcNSigmaPr, std::vector); -DECLARE_SOA_COLUMN(TrackID, trackID, std::vector); - -// for others -DECLARE_SOA_COLUMN(IsReconstructedWithUPC, isReconstructedWithUPC, bool); -DECLARE_SOA_COLUMN(TimeZNA, timeZNA, float); -DECLARE_SOA_COLUMN(TimeZNC, timeZNC, float); -DECLARE_SOA_COLUMN(EnergyCommonZNA, energyCommonZNA, float); -DECLARE_SOA_COLUMN(EnergyCommonZNC, energyCommonZNC, float); -DECLARE_SOA_COLUMN(IsChargeZero, isChargeZero, bool); - -DECLARE_SOA_COLUMN(OccupancyInTime, occupancyInTime, int); -DECLARE_SOA_COLUMN(HadronicRate, hadronicRate, double); - +// Declare columns +DECLARE_SOA_COLUMN(RunNumber, runNumber, int32_t); // Run number for event identification +DECLARE_SOA_COLUMN(M, m, double); // Invariant mass of the system +DECLARE_SOA_COLUMN(Pt, pt, double); // Transverse momentum of the system +DECLARE_SOA_COLUMN(Eta, eta, double); // Pseudorapidity of the system +DECLARE_SOA_COLUMN(Phi, phi, double); // Azimuthal angle of the system +DECLARE_SOA_COLUMN(PosX, posX, double); // Vertex X position +DECLARE_SOA_COLUMN(PosY, posY, double); // Vertex Y position +DECLARE_SOA_COLUMN(PosZ, posZ, double); // Vertex Z position +DECLARE_SOA_COLUMN(TotalCharge, totalCharge, int); // Total charge of selected tracks +DECLARE_SOA_COLUMN(TotalFT0AmplitudeA, totalFT0AmplitudeA, float); // FT0A amplitude +DECLARE_SOA_COLUMN(TotalFT0AmplitudeC, totalFT0AmplitudeC, float); // FT0C amplitude +DECLARE_SOA_COLUMN(TotalFV0AmplitudeA, totalFV0AmplitudeA, float); // FV0A amplitude +DECLARE_SOA_COLUMN(NumContrib, numContrib, int32_t); // Number of primary vertex contributors +DECLARE_SOA_COLUMN(Sign, sign, std::vector); // Track charges +DECLARE_SOA_COLUMN(TrackPt, trackPt, std::vector); // Track pT values +DECLARE_SOA_COLUMN(TrackEta, trackEta, std::vector); // Track eta values +DECLARE_SOA_COLUMN(TrackPhi, trackPhi, std::vector); // Track phi values +DECLARE_SOA_COLUMN(TPCNSigmaEl, tpcNSigmaEl, std::vector); // TPC nσ for electrons +DECLARE_SOA_COLUMN(TPCNSigmaPi, tpcNSigmaPi, std::vector); // TPC nσ for pions +DECLARE_SOA_COLUMN(TPCNSigmaKa, tpcNSigmaKa, std::vector); // TPC nσ for kaons +DECLARE_SOA_COLUMN(TPCNSigmaPr, tpcNSigmaPr, std::vector); // TPC nσ for protons +DECLARE_SOA_COLUMN(TrackID, trackID, std::vector); // Track identifiers +DECLARE_SOA_COLUMN(IsReconstructedWithUPC, isReconstructedWithUPC, bool); // UPC mode reconstruction flag +DECLARE_SOA_COLUMN(TimeZNA, timeZNA, float); // ZNA timing +DECLARE_SOA_COLUMN(TimeZNC, timeZNC, float); // ZNC timing +DECLARE_SOA_COLUMN(EnergyCommonZNA, energyCommonZNA, float); // ZNA energy +DECLARE_SOA_COLUMN(EnergyCommonZNC, energyCommonZNC, float); // ZNC energy +DECLARE_SOA_COLUMN(IsChargeZero, isChargeZero, bool); // Neutral system flag +DECLARE_SOA_COLUMN(OccupancyInTime, occupancyInTime, int); // Occupancy in time +DECLARE_SOA_COLUMN(HadronicRate, hadronicRate, double); // Hadronic interaction rate } // namespace fourpi -DECLARE_SOA_TABLE(SYSTEMTREE, "AOD", "SystemTree", fourpi::RunNumber, fourpi::M, fourpi::Pt, fourpi::Eta, fourpi::Phi, - fourpi::PosX, fourpi::PosY, fourpi::PosZ, fourpi::TotalCharge, fourpi::TotalFT0AmplitudeA, fourpi::TotalFT0AmplitudeC, fourpi::TotalFV0AmplitudeA, - fourpi::TotalFDDAmplitudeA, fourpi::TotalFDDAmplitudeC, fourpi::TimeFT0A, fourpi::TimeFT0C, fourpi::TimeFV0A, fourpi::TimeFDDA, fourpi::TimeFDDC, - fourpi::NumContrib, fourpi::Sign, fourpi::TrackPt, fourpi::TrackEta, fourpi::TrackPhi, - fourpi::TPCNSigmaEl, fourpi::TPCNSigmaPi, fourpi::TPCNSigmaKa, fourpi::TPCNSigmaPr, fourpi::TrackID, fourpi::IsReconstructedWithUPC, - fourpi::TimeZNA, fourpi::TimeZNC, fourpi::EnergyCommonZNA, fourpi::EnergyCommonZNC, fourpi::IsChargeZero, fourpi::OccupancyInTime, fourpi::HadronicRate); +// Define the output +DECLARE_SOA_TABLE(SYSTEMTREE, "AOD", "SystemTree", + fourpi::RunNumber, fourpi::M, fourpi::Pt, fourpi::Eta, fourpi::Phi, + fourpi::PosX, fourpi::PosY, fourpi::PosZ, fourpi::TotalCharge, + fourpi::TotalFT0AmplitudeA, fourpi::TotalFT0AmplitudeC, fourpi::TotalFV0AmplitudeA, + fourpi::NumContrib, + fourpi::Sign, fourpi::TrackPt, fourpi::TrackEta, fourpi::TrackPhi, + fourpi::TPCNSigmaEl, fourpi::TPCNSigmaPi, fourpi::TPCNSigmaKa, fourpi::TPCNSigmaPr, + fourpi::TrackID, fourpi::IsReconstructedWithUPC, + fourpi::TimeZNA, fourpi::TimeZNC, fourpi::EnergyCommonZNA, fourpi::EnergyCommonZNC, + fourpi::IsChargeZero, fourpi::OccupancyInTime, fourpi::HadronicRate); } // namespace o2::aod struct upcRhoPrimeAnalysis { Produces systemTree; - double PcEtaCut = 0.9; // physics coordination recommendation - + // System selection configuration + Configurable systemYCut{"systemYCut", 0.5, "Max Rapidity of rho prime"}; + Configurable systemPtCut{"systemPtCut", 0.1, "Min Pt of rho prime"}; + Configurable systemMassMinCut{"systemMassMinCut", 0.8, "Min Mass of rho prime"}; + Configurable systemMassMaxCut{"systemMassMaxCut", 2.2, "Max Mass of rho prime"}; + Configurable etaCut{"etaCut", 0.9, "Track Pseudorapidity"}; + + // Event selection configuration + Configurable vZCut{"vZCut", 10.0, "Cut on vertex Z position"}; + Configurable numPVContrib{"numPVContrib", 4, "Number of PV contributors"}; + Configurable fv0Cut{"fv0Cut", 50.0, "FV0 amplitude cut"}; + Configurable ft0aCut{"ft0aCut", 50.0, "FT0A amplitude cut"}; + Configurable ft0cCut{"ft0cCut", 50.0, "FT0C amplitude cut"}; + Configurable zdcCut{"zdcCut", 0.0, "ZDC energy cut"}; + Configurable sbpCut{"sbpCut", true, "SBP cut"}; + Configurable itsROFbCut{"itsROFbCut", true, "ITS ROFb cut"}; + Configurable vtxITSTPCcut{"vtxITSTPCcut", true, "Vertex ITS-TPC cut"}; + Configurable tfbCut{"tfbCut", true, "TFB cut"}; Configurable specifyGapSide{"specifyGapSide", true, "specify gap side for SG/DG produced data"}; Configurable gapSide{"gapSide", 2, "gap side for SG produced data"}; - Configurable requireTof{"requireTof", false, "require TOF signal"}; - - Configurable collisionsPosZMaxCut{"collisionsPosZMaxCut", 10.0, "max Z position cut on collisions"}; - Configurable ZNcommonEnergyCut{"ZNcommonEnergyCut", 0.0, "ZN common energy cut"}; - Configurable ZNtimeCut{"ZNtimeCut", 2.0, "ZN time cut"}; - - Configurable tracksTpcNSigmaPiCut{"tracksTpcNSigmaPiCut", 3.0, "TPC nSigma pion cut"}; - Configurable tracksDcaMaxCut{"tracksDcaMaxCut", 1.0, "max DCA cut on tracks"}; - - Configurable systemMassMinCut{"systemMassMinCut", 0.8, "min M cut for reco system"}; - Configurable systemMassMaxCut{"systemMassMaxCut", 2.2, "max M cut for reco system"}; - Configurable systemPtCut{"systemPtMaxCut", 0.1, "max pT cut for reco system"}; - Configurable systemYCut{"systemYCut", 0.9, "rapiditiy cut for reco system"}; - - ConfigurableAxis mAxis{"mAxis", {1000, 0.0, 10.0}, "m (GeV/#it{c}^{2})"}; - ConfigurableAxis mCutAxis{"mCutAxis", {70, 0.5, 1.2}, "m (GeV/#it{c}^{2})"}; - ConfigurableAxis ptAxis{"ptAxis", {1000, 0.0, 10.0}, "p_{T} (GeV/#it{c})"}; - ConfigurableAxis ptCutAxis{"ptCutAxis", {300, 0.0, 0.3}, "p_{T} (GeV/#it{c})"}; - ConfigurableAxis pt2Axis{"pt2Axis", {300, 0.0, 0.09}, "p_{T}^{2} (GeV^{2}/#it{c}^{2})"}; - ConfigurableAxis etaAxis{"etaAxis", {180, -0.9, 0.9}, "#eta"}; - ConfigurableAxis yAxis{"yAxis", {180, -0.9, 0.9}, "y"}; - ConfigurableAxis phiAxis{"phiAxis", {180, 0.0, o2::constants::math::TwoPI}, "#phi"}; - ConfigurableAxis phiAsymmAxis{"phiAsymmAxis", {182, -o2::constants::math::PI, o2::constants::math::PI}, "#phi"}; - ConfigurableAxis momentumFromPhiAxis{"momentumFromPhiAxis", {400, -0.1, 0.1}, "p (GeV/#it{c})"}; - ConfigurableAxis ptQuantileAxis{"ptQuantileAxis", {0, 0.0181689, 0.0263408, 0.0330488, 0.0390369, 0.045058, 0.0512604, 0.0582598, 0.066986, 0.0788085, 0.1}, "p_{T} (GeV/#it{c})"}; - - HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject}; - - void init(o2::framework::InitContext&) + + // Track selection configuration + Configurable useOnlyPVtracks{"useOnlyPVtracks", true, "Use only PV tracks"}; + Configurable tpcChi2NClsCut{"tpcChi2NClsCut", 5.0, "TPC chi2/N clusters cut"}; + Configurable itsChi2NClsCut{"itsChi2NClsCut", 36.0, "ITS chi2/N clusters cut"}; + Configurable nSigmaTPCcut{"nSigmaTPCcut", 5.0, "TPC nSigma cut"}; + Configurable dcaXYcut{"dcaXYcut", 0, "dcaXY cut"}; + Configurable dcaZcut{"dcaZcut", 2, "dcaZ cut"}; + Configurable minTPCFindableClusters{"minTPCFindableClusters", 70, "Minimum number of findable TPC clusters"}; + + // Define histogram registry + HistogramRegistry registry{ + "registry", + {// Event flow histograms + {"Events/Flow", "Event flow;Cut;Counts", {HistType::kTH1F, {{9, 0, 9}}}}, + {"Events/VertexZ", "Vertex Z;z (cm);Counts", {HistType::kTH1F, {{200, -20, 20}}}}, + {"Events/NumContrib", "Number of contributors;N_{contrib};Counts", {HistType::kTH1F, {{100, 0, 100}}}}, + {"Events/FV0Amplitude", "FV0 amplitude;Amplitude;Counts", {HistType::kTH1F, {{200, 0, 200}}}}, + {"Events/FT0AmplitudeA", "FT0A amplitude;Amplitude;Counts", {HistType::kTH1F, {{200, 0, 200}}}}, + {"Events/FT0AmplitudeC", "FT0C amplitude;Amplitude;Counts", {HistType::kTH1F, {{200, 0, 200}}}}, + {"Events/ZDCEnergy", "ZDC energy;Energy (TeV);Counts", {HistType::kTH1F, {{200, 0, 2}}}}, + + // Track quality histograms + {"Tracks/Pt", "Track p_{T};p_{T} (GeV/c);Counts", {HistType::kTH1F, {{200, 0, 2}}}}, + {"Tracks/Eta", "Track #eta;#eta;Counts", {HistType::kTH1F, {{200, -2, 2}}}}, + {"Tracks/TPCNSigmaPi", "TPC n#sigma for #pi;n#sigma;Counts", {HistType::kTH1F, {{200, -10, 10}}}}, + {"Tracks/TPCChi2NCl", "TPC #chi^{2}/N_{cls};#chi^{2}/N_{cls};Counts", {HistType::kTH1F, {{200, 0, 20}}}}, + {"Tracks/ITSChi2NCl", "ITS #chi^{2}/N_{cls};#chi^{2}/N_{cls};Counts", {HistType::kTH1F, {{200, 0, 50}}}}, + {"Tracks/RejectionReasons", "Track rejection reasons;Reason;Counts", {HistType::kTH1F, {{12, 0, 12}}}}, + {"Tracks/DCASpectrum", "Track DCA spectrum;DCA (cm);Counts", {HistType::kTH1F, {{100, 0, 5}}}}, + {"Tracks/ChargeDistribution", "Track charge distribution;Charge;Counts", {HistType::kTH1F, {{3, -1.5, 1.5}}}}, + {"Tracks/TPCClusters", "TPC clusters findable;N_{clusters};Counts", {HistType::kTH1F, {{100, 0, 200}}}}, + + // System kinematics histograms + {"System/hM", ";m (GeV/#it{c}^{2});counts", {HistType::kTH1F, {{1000, 0.0, 10.0}}}}, + {"System/hPt", ";p_{T} (GeV/#it{c});counts", {HistType::kTH1F, {{1000, 0.0, 10.0}}}}, + {"System/hEta", ";#eta;counts", {HistType::kTH1F, {{180, -0.9, 0.9}}}}, + {"System/hPhi", ";#phi;counts", {HistType::kTH1F, {{180, 0.0, 6.28}}}}, + {"System/hY", ";y;counts", {HistType::kTH1F, {{180, -0.9, 0.9}}}}, + + // Comparison histograms + {"Cuts/MBefore", "Mass before cuts;m (GeV/c^{2});Counts", {HistType::kTH1F, {{1000, 0, 10}}}}, + {"Cuts/MAfter", "Mass after cuts;m (GeV/c^{2});Counts", {HistType::kTH1F, {{1000, 0, 10}}}}, + {"Cuts/PtBefore", "p_{T} before cuts;p_{T} (GeV/c);Counts", {HistType::kTH1F, {{1000, 0, 1}}}}, + {"Cuts/PtAfter", "p_{T} after cuts;p_{T} (GeV/c);Counts", {HistType::kTH1F, {{1000, 0, 10}}}}}}; + + void init(InitContext&) { - // selection counter - std::vector selectionCounterLabels = {"all tracks", "PV contributor", "ITS + TPC hit", "TOF requirement", "DCA cut", "#eta cut", "2D TPC n#sigma_{#pi} cut"}; - - // 4PI SYSTEM - // registry.add("4pi/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mAxis}); - // registry.add("4pi/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptAxis}); - // registry.add("4pi/hEta", ";Eta (1);counts", kTH1D, {etaAxis}); - // registry.add("4pi/hPhi", ";Phi ();counts", kTH1D, {phiAxis}); + // Configure event flow histogram labels + auto hFlow = registry.get(HIST("Events/Flow")); + hFlow->GetXaxis()->SetBinLabel(1, "All events"); + hFlow->GetXaxis()->SetBinLabel(2, "ITS-TPC cut"); + hFlow->GetXaxis()->SetBinLabel(3, "SBP cut"); + hFlow->GetXaxis()->SetBinLabel(4, "ITS ROFb cut"); + hFlow->GetXaxis()->SetBinLabel(5, "TFB cut"); + hFlow->GetXaxis()->SetBinLabel(6, "Gap Side cut"); + hFlow->GetXaxis()->SetBinLabel(7, "PV contrib cut"); + hFlow->GetXaxis()->SetBinLabel(8, "Z vtx cut"); + hFlow->GetXaxis()->SetBinLabel(9, "4 tracks cut"); + + // Configure track rejection reasons histogram labels + auto hReject = registry.get(HIST("Tracks/RejectionReasons")); + hReject->GetXaxis()->SetBinLabel(1, "All Tracks"); + hReject->GetXaxis()->SetBinLabel(2, "PV Contributor"); + hReject->GetXaxis()->SetBinLabel(3, "Has ITS+TPC"); + hReject->GetXaxis()->SetBinLabel(4, "pT > 0.1 GeV/c"); + hReject->GetXaxis()->SetBinLabel(5, "TPC chi2/cluster"); + hReject->GetXaxis()->SetBinLabel(6, "ITS chi2/cluster"); + hReject->GetXaxis()->SetBinLabel(7, "TPC clusters findable"); + hReject->GetXaxis()->SetBinLabel(8, "TPC nSigmaPi"); + hReject->GetXaxis()->SetBinLabel(9, "Eta acceptance"); + hReject->GetXaxis()->SetBinLabel(10, "DCAz cut"); + hReject->GetXaxis()->SetBinLabel(11, "DCAxy cut"); + hReject->GetXaxis()->SetBinLabel(12, "Accepted Tracks"); } - template - bool collisionPassesCuts(const C& collision) // collision cuts + void process(UDCollisions::iterator const& collision, UDtracks const& tracks) { - if (std::abs(collision.posZ()) > collisionsPosZMaxCut) - return false; + // Count all processed events + registry.fill(HIST("Events/Flow"), 0); + + // Fill basic event diagnostics + registry.fill(HIST("Events/VertexZ"), collision.posZ()); + registry.fill(HIST("Events/NumContrib"), collision.numContrib()); + registry.fill(HIST("Events/FV0Amplitude"), collision.totalFV0AmplitudeA()); + registry.fill(HIST("Events/FT0AmplitudeA"), collision.totalFT0AmplitudeA()); + registry.fill(HIST("Events/FT0AmplitudeC"), collision.totalFT0AmplitudeC()); + registry.fill(HIST("Events/ZDCEnergy"), collision.energyCommonZNA()); + registry.fill(HIST("Events/ZDCEnergy"), collision.energyCommonZNC()); + + // Apply event selection cuts in sequence + if (collision.vtxITSTPC() != vtxITSTPCcut) + return; + registry.fill(HIST("Events/Flow"), 1); + + if (collision.sbp() != sbpCut) + return; + registry.fill(HIST("Events/Flow"), 2); + + if (collision.itsROFb() != itsROFbCut) + return; + registry.fill(HIST("Events/Flow"), 3); + + if (collision.tfb() != tfbCut) + return; + registry.fill(HIST("Events/Flow"), 4); + if (specifyGapSide && collision.gapSide() != gapSide) - return false; - return true; - } + return; + if (collision.totalFV0AmplitudeA() > fv0Cut) + return; + if (collision.totalFT0AmplitudeA() > ft0aCut) + return; + if (collision.totalFT0AmplitudeC() > ft0cCut) + return; + if (collision.energyCommonZNA() > zdcCut || collision.energyCommonZNC() > zdcCut) + return; + registry.fill(HIST("Events/Flow"), 5); - template - bool trackPassesCuts(const T& track) // track cuts (PID done separately) - { - if (!track.isPVContributor()) - return false; - if (!track.hasITS() || !track.hasTPC()) - return false; - if (requireTof && !track.hasTOF()) - return false; - if (std::abs(track.dcaZ()) > tracksDcaMaxCut || std::abs(track.dcaXY()) > (0.0182 + 0.0350 / std::pow(track.pt(), 1.01))) // Run 2 dynamic DCA cut - return false; - if (std::abs(eta(track.px(), track.py(), track.pz())) > PcEtaCut) - return false; - return true; - } + if (collision.numContrib() != numPVContrib) + return; + registry.fill(HIST("Events/Flow"), 6); - template - bool tracksPassPiPID(const T& cutTracks) // n-dimensional PID cut - { - double radius = 0.0; - for (const auto& track : cutTracks) - radius += std::pow(track.tpcNSigmaPi(), 2); - return radius < std::pow(tracksTpcNSigmaPiCut, 2); - } + if (std::abs(collision.posZ()) > vZCut) + return; + registry.fill(HIST("Events/Flow"), 7); - template - double tracksTotalCharge(const T& cutTracks) // total charge of selected tracks - { - double charge = 0.0; - for (const auto& track : cutTracks) - charge += track.sign(); - return charge; - } + std::vector posPions; + std::vector negPions; + posPions.reserve(2); + negPions.reserve(2); - bool systemPassCuts(const ROOT::Math::PxPyPzMVector& system) // system cuts - { - if (system.M() < systemMassMinCut || system.M() > systemMassMaxCut) - return false; - if (system.Pt() > systemPtCut) - return false; - if (std::abs(system.Rapidity()) > systemYCut) - return false; - return true; - } + // Loop over all tracks in the event + for (const auto& track : tracks) { + registry.fill(HIST("Tracks/RejectionReasons"), 0); // Count all tracks - ROOT::Math::PxPyPzMVector reconstructSystem(const std::vector& cutTracks4Vecs) // reconstruct system from 4-vectors - { - ROOT::Math::PxPyPzMVector system; - for (const auto& track4Vec : cutTracks4Vecs) - system += track4Vec; - return system; - } + // Track selection criteria applied in sequence: + if (useOnlyPVtracks && !track.isPVContributor()) { + registry.fill(HIST("Tracks/RejectionReasons"), 1); + continue; + } - double deltaPhi(const ROOT::Math::PxPyPzMVector& p1, const ROOT::Math::PxPyPzMVector& p2) - { - double dPhi = p1.Phi() - p2.Phi(); - if (dPhi > o2::constants::math::PI) - dPhi -= o2::constants::math::TwoPI; - else if (dPhi < -o2::constants::math::PI) - dPhi += o2::constants::math::TwoPI; - return dPhi; // calculate delta phi in (-pi, pi) - } + if (!track.hasITS() || !track.hasTPC()) { + registry.fill(HIST("Tracks/RejectionReasons"), 2); + continue; + } - double getPhiRandom(const std::vector& cutTracks4Vecs) // decay phi anisotropy - { // two possible definitions of phi: randomize the tracks - std::vector indices = {0, 1}; - unsigned seed = std::chrono::system_clock::now().time_since_epoch().count(); // get time-based seed - std::shuffle(indices.begin(), indices.end(), std::default_random_engine(seed)); // shuffle indices - // calculate phi - ROOT::Math::PxPyPzMVector pOne = cutTracks4Vecs[indices[0]]; - ROOT::Math::PxPyPzMVector pTwo = cutTracks4Vecs[indices[1]]; - ROOT::Math::PxPyPzMVector pPlus = pOne + pTwo; - ROOT::Math::PxPyPzMVector pMinus = pOne - pTwo; - return deltaPhi(pPlus, pMinus); - } + // Fill track spectra + registry.fill(HIST("Tracks/Pt"), track.pt()); + registry.fill(HIST("Tracks/Eta"), eta(track.px(), track.py(), track.pz())); + registry.fill(HIST("Tracks/TPCNSigmaPi"), track.tpcNSigmaPi()); + registry.fill(HIST("Tracks/TPCChi2NCl"), track.tpcChi2NCl()); + registry.fill(HIST("Tracks/ITSChi2NCl"), track.itsChi2NCl()); + registry.fill(HIST("Tracks/DCASpectrum"), std::hypot(track.dcaXY(), track.dcaZ())); + registry.fill(HIST("Tracks/ChargeDistribution"), track.sign()); + registry.fill(HIST("Tracks/TPCClusters"), track.tpcNClsFindable()); + + if (track.pt() <= 0.1f) { + registry.fill(HIST("Tracks/RejectionReasons"), 3); + continue; + } - template - double getPhiCharge(const T& cutTracks, const std::vector& cutTracks4Vecs) - { // two possible definitions of phi: charge-based assignment - ROOT::Math::PxPyPzMVector pOne, pTwo; - if (cutTracks[0].sign() > 0) { - pOne = cutTracks4Vecs[0]; - pTwo = cutTracks4Vecs[1]; - } else { - pOne = cutTracks4Vecs[1]; - pTwo = cutTracks4Vecs[0]; - } - ROOT::Math::PxPyPzMVector pPlus = pOne + pTwo; - ROOT::Math::PxPyPzMVector pMinus = pOne - pTwo; - return deltaPhi(pPlus, pMinus); - } + if (track.tpcChi2NCl() > tpcChi2NClsCut) { + registry.fill(HIST("Tracks/RejectionReasons"), 4); + continue; + } + if (track.itsChi2NCl() > itsChi2NClsCut) { + registry.fill(HIST("Tracks/RejectionReasons"), 5); + continue; + } - void processReco(FullUDSgCollision const& collision, FullUDTracks const& tracks) - { + if (track.tpcNClsFindable() < minTPCFindableClusters) { + registry.fill(HIST("Tracks/RejectionReasons"), 6); + continue; + } - if (!collisionPassesCuts(collision)) - return; + if (std::abs(track.tpcNSigmaPi()) > nSigmaTPCcut) { + registry.fill(HIST("Tracks/RejectionReasons"), 7); + continue; + } - // vectors for storing selected tracks and their 4-vectors - std::vector cutTracks; - std::vector cutTracks4Vecs; + float trackEta = eta(track.px(), track.py(), track.pz()); + if (std::abs(trackEta) > etaCut) { + registry.fill(HIST("Tracks/RejectionReasons"), 8); + continue; + } - // int trackCounter = 0; - for (const auto& track : tracks) { + if (std::abs(track.dcaZ()) > dcaZcut) { + registry.fill(HIST("Tracks/RejectionReasons"), 9); + continue; + } - if (!trackPassesCuts(track)) + float maxDCAxy = 0.0105 + 0.035 / std::pow(track.pt(), 1.1); + if (dcaXYcut == 0 && (std::fabs(track.dcaXY()) > maxDCAxy)) { + registry.fill(HIST("Tracks/RejectionReasons"), 10); continue; - // trackCounter++; - cutTracks.push_back(track); - cutTracks4Vecs.push_back(ROOT::Math::PxPyPzMVector(track.px(), track.py(), track.pz(), o2::constants::physics::MassPionCharged)); // apriori assume pion mass + } else if (dcaXYcut != 0 && (std::fabs(track.dcaXY()) > dcaXYcut)) { + registry.fill(HIST("Tracks/RejectionReasons"), 10); + continue; + } + + // Track passed all selection criteria + registry.fill(HIST("Tracks/RejectionReasons"), 11); + + if (track.sign() > 0 && posPions.size() < 2) { + posPions.push_back(track); + } else if (track.sign() < 0 && negPions.size() < 2) { + negPions.push_back(track); + } + + if (posPions.size() == 2 && negPions.size() == 2) + break; } - if (!tracksPassPiPID(cutTracks)) + if (posPions.size() != 2 || negPions.size() != 2) { return; - // reonstruct system and calculate total charge, save commonly used values into variables - ROOT::Math::PxPyPzMVector system = reconstructSystem(cutTracks4Vecs); - int totalCharge = tracksTotalCharge(cutTracks); - int nTracks = cutTracks.size(); - double mass = system.M(); - double pT = system.Pt(); - // double pTsquare = pT * pT; - double rapidity = system.Rapidity(); - double systemPhi = system.Phi() + o2::constants::math::PI; - - if (nTracks == 4) { - bool isChargeZero = (tracksTotalCharge(cutTracks) == 0); - - std::vector vTrackPt, vTrackEta, vTrackPhi; - std::vector vSign, vTrackID; - std::vector vTpcNSigmaEl, vTpcNSigmaPi, vTpcNSigmaKa, vTpcNSigmaPr; - - for (size_t i = 0; i < cutTracks.size(); i++) { - double tPt = cutTracks[i].pt(); - double tEta = eta(cutTracks[i].px(), cutTracks[i].py(), cutTracks[i].pz()); - double tPhi = phi(cutTracks[i].px(), cutTracks[i].py()); - - vTrackPt.push_back(tPt); - vTrackEta.push_back(tEta); - vTrackPhi.push_back(tPhi); - vSign.push_back(cutTracks[i].sign()); - vTpcNSigmaEl.push_back(cutTracks[i].tpcNSigmaEl()); - vTpcNSigmaPi.push_back(cutTracks[i].tpcNSigmaPi()); - vTpcNSigmaKa.push_back(cutTracks[i].tpcNSigmaKa()); - vTpcNSigmaPr.push_back(cutTracks[i].tpcNSigmaPr()); - - vTrackID.push_back(i); - } + } + registry.fill(HIST("Events/Flow"), 8); + + std::vector selectedTracks; + selectedTracks.insert(selectedTracks.end(), posPions.begin(), posPions.end()); + selectedTracks.insert(selectedTracks.end(), negPions.begin(), negPions.end()); + + // Reconstruct the 4-pion system + ROOT::Math::PxPyPzMVector fourPionSystem; + std::vector pionFourVectors; + + for (const auto& track : selectedTracks) { + ROOT::Math::PxPyPzMVector pionVec( + track.px(), track.py(), track.pz(), + o2::constants::physics::MassPionCharged); + fourPionSystem += pionVec; + pionFourVectors.push_back(pionVec); + } - bool isReconstructedWithUPC = false; + // Fill pre-cut system histograms + registry.fill(HIST("Cuts/MBefore"), fourPionSystem.M()); + registry.fill(HIST("Cuts/PtBefore"), fourPionSystem.Pt()); - if (collision.flags() == 1) { - isReconstructedWithUPC = true; - } else { - isReconstructedWithUPC = false; - } + // Apply system-level kinematic cuts + if (fourPionSystem.M() < systemMassMinCut || fourPionSystem.M() > systemMassMaxCut) + return; + if (fourPionSystem.Pt() > systemPtCut) + return; + if (std::abs(fourPionSystem.Rapidity()) > systemYCut) + return; - systemTree(collision.runNumber(), mass, pT, rapidity, systemPhi, - collision.posX(), collision.posY(), collision.posZ(), totalCharge, - collision.totalFT0AmplitudeA(), collision.totalFT0AmplitudeC(), collision.timeFV0A(), - collision.totalFDDAmplitudeA(), collision.totalFDDAmplitudeC(), - collision.timeFT0A(), collision.timeFT0C(), collision.timeFV0A(), - collision.timeFDDA(), collision.timeFDDC(), collision.numContrib(), - vSign, vTrackPt, vTrackEta, vTrackPhi, - vTpcNSigmaEl, vTpcNSigmaPi, vTpcNSigmaKa, vTpcNSigmaPr, - vTrackID, isReconstructedWithUPC, collision.timeZNA(), collision.timeZNC(), - collision.energyCommonZNA(), collision.energyCommonZNC(), - isChargeZero, collision.occupancyInTime(), collision.hadronicRate()); + // Fill post-cut system histograms + registry.fill(HIST("Cuts/MAfter"), fourPionSystem.M()); + registry.fill(HIST("Cuts/PtAfter"), fourPionSystem.Pt()); + registry.fill(HIST("System/hM"), fourPionSystem.M()); + registry.fill(HIST("System/hPt"), fourPionSystem.Pt()); + registry.fill(HIST("System/hEta"), fourPionSystem.Eta()); + registry.fill(HIST("System/hPhi"), fourPionSystem.Phi() + o2::constants::math::PI); + registry.fill(HIST("System/hY"), fourPionSystem.Rapidity()); + + std::vector trackPts, trackEtas, trackPhis; + std::vector trackSigns, trackIDs; + std::vector tpcNSigmasEl, tpcNSigmasPi, tpcNSigmasKa, tpcNSigmasPr; + + for (size_t i = 0; i < selectedTracks.size(); i++) { + const auto& track = selectedTracks[i]; + trackPts.push_back(track.pt()); + trackEtas.push_back(eta(track.px(), track.py(), track.pz())); + trackPhis.push_back(phi(track.px(), track.py())); + trackSigns.push_back(track.sign()); + tpcNSigmasEl.push_back(track.tpcNSigmaEl()); + tpcNSigmasPi.push_back(track.tpcNSigmaPi()); + tpcNSigmasKa.push_back(track.tpcNSigmaKa()); + tpcNSigmasPr.push_back(track.tpcNSigmaPr()); + trackIDs.push_back(i); } - // std::cout<<"Hello World"<(cfgc)}; + adaptAnalysisTask(cfgc)}; } From 2f179c2f2d837ad0d5b1218c682136a12ae61ece Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Mon, 11 Aug 2025 19:02:16 +0200 Subject: [PATCH 333/345] [PWGEM/Dilepton] remove collinear from treeCreatorElectronMLDDA.cxx (#12522) --- .../treeCreatorElectronMLDDA.cxx | 41 +++++++++---------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx index 81e914de7bb..ef773ae86a9 100644 --- a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx +++ b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx @@ -207,7 +207,6 @@ struct TreeCreatorElectronMLDDA { Configurable cfg_includeITSsa{"cfg_includeITSsa", false, "Flag to include ITSsa tracks"}; Configurable cfg_max_pt_itssa{"cfg_max_pt_itssa", 0.15, "mix pt for ITSsa track"}; Configurable cfg_min_qt_strangeness{"cfg_min_qt_strangeness", 0.015, "min qt for Lambda and K0S"}; - Configurable cfg_require_collinearV0{"cfg_require_collinearV0", false, "require collinear V0 for photon conversions"}; Configurable cfg_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -5, "min n sigma e in TPC"}; Configurable cfg_max_TPCNsigmaEl{"cfg_max_TPCNsigmaEl", +5, "max n sigma e in TPC"}; @@ -749,7 +748,7 @@ struct TreeCreatorElectronMLDDA { Partition negTracks = o2::aod::track::signed1Pt < 0.f && ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::ITS) == true; std::vector stored_trackIds; - void processPID(filteredMyCollisions const& collisions, aod::BCsWithTimestamps const&, filteredV0s const& v0s, filteredCascades const& cascades, MyTracks const& tracks, aod::V0s const&) + void processPID(filteredMyCollisions const& collisions, aod::BCsWithTimestamps const&, filteredV0s const& v0s, filteredCascades const& cascades, MyTracks const& tracks) { stored_trackIds.reserve(tracks.size()); for (const auto& collision : collisions) { @@ -769,7 +768,7 @@ struct TreeCreatorElectronMLDDA { auto v0s_coll = v0s.sliceBy(perCollision_v0, collision.globalIndex()); for (const auto& v0 : v0s_coll) { - auto o2v0 = v0.template v0_as(); + // auto o2v0 = v0.template v0_as(); auto pos = v0.template posTrack_as(); auto neg = v0.template negTrack_as(); // LOGF(info, "v0.globalIndex() = %d, v0.collisionId() = %d, v0.posTrackId() = %d, v0.negTrackId() = %d", v0.globalIndex(), v0.collisionId(), v0.posTrackId(), v0.negTrackId()); @@ -833,27 +832,25 @@ struct TreeCreatorElectronMLDDA { } } // end of stangeness - if (!v0cuts.cfg_require_collinearV0 || o2v0.isCollinearV0()) { - if (isElectronTight(pos) && isElectron(neg)) { - registry.fill(HIST("V0/hMassGamma"), v0.mGamma()); - registry.fill(HIST("V0/hMassGamma_Rxy"), v0.v0radius(), v0.mGamma()); - if (v0cuts.cfg_min_mass_photon < v0.mGamma() && v0.mGamma() < v0cuts.cfg_max_mass_photon) { - registry.fill(HIST("V0/hXY_Gamma"), v0.x(), v0.y()); - fillTrackTable(collision, neg, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kElectron)); - registry.fill(HIST("V0/hTPCdEdx_P_El"), neg.tpcInnerParam(), neg.tpcSignal()); - registry.fill(HIST("V0/hTOFbeta_P_El"), neg.tpcInnerParam(), neg.beta()); - } + if (isElectronTight(pos) && isElectron(neg)) { + registry.fill(HIST("V0/hMassGamma"), v0.mGamma()); + registry.fill(HIST("V0/hMassGamma_Rxy"), v0.v0radius(), v0.mGamma()); + if (v0cuts.cfg_min_mass_photon < v0.mGamma() && v0.mGamma() < v0cuts.cfg_max_mass_photon) { + registry.fill(HIST("V0/hXY_Gamma"), v0.x(), v0.y()); + fillTrackTable(collision, neg, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kElectron)); + registry.fill(HIST("V0/hTPCdEdx_P_El"), neg.tpcInnerParam(), neg.tpcSignal()); + registry.fill(HIST("V0/hTOFbeta_P_El"), neg.tpcInnerParam(), neg.beta()); } + } - if (isElectron(pos) && isElectronTight(neg)) { - registry.fill(HIST("V0/hMassGamma"), v0.mGamma()); - registry.fill(HIST("V0/hMassGamma_Rxy"), v0.v0radius(), v0.mGamma()); - if (v0cuts.cfg_min_mass_photon < v0.mGamma() && v0.mGamma() < v0cuts.cfg_max_mass_photon) { - registry.fill(HIST("V0/hXY_Gamma"), v0.x(), v0.y()); - fillTrackTable(collision, pos, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kElectron)); - registry.fill(HIST("V0/hTPCdEdx_P_El"), pos.tpcInnerParam(), pos.tpcSignal()); - registry.fill(HIST("V0/hTOFbeta_P_El"), pos.tpcInnerParam(), pos.beta()); - } + if (isElectron(pos) && isElectronTight(neg)) { + registry.fill(HIST("V0/hMassGamma"), v0.mGamma()); + registry.fill(HIST("V0/hMassGamma_Rxy"), v0.v0radius(), v0.mGamma()); + if (v0cuts.cfg_min_mass_photon < v0.mGamma() && v0.mGamma() < v0cuts.cfg_max_mass_photon) { + registry.fill(HIST("V0/hXY_Gamma"), v0.x(), v0.y()); + fillTrackTable(collision, pos, static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kElectron)); + registry.fill(HIST("V0/hTPCdEdx_P_El"), pos.tpcInnerParam(), pos.tpcSignal()); + registry.fill(HIST("V0/hTOFbeta_P_El"), pos.tpcInnerParam(), pos.beta()); } } From dce3943c5a2a9582e811555a0c6c29b79e59a2ee Mon Sep 17 00:00:00 2001 From: JStaa <39123272+JStaa@users.noreply.github.com> Date: Mon, 11 Aug 2025 19:08:28 +0200 Subject: [PATCH 334/345] [PWGCF] Changed the configuration of the trackFilters function (#12530) --- .../Tasks/threeParticleCorrelations.cxx | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/PWGCF/MultiparticleCorrelations/Tasks/threeParticleCorrelations.cxx b/PWGCF/MultiparticleCorrelations/Tasks/threeParticleCorrelations.cxx index 1a50269aa9b..4bd814039cc 100644 --- a/PWGCF/MultiparticleCorrelations/Tasks/threeParticleCorrelations.cxx +++ b/PWGCF/MultiparticleCorrelations/Tasks/threeParticleCorrelations.cxx @@ -45,7 +45,7 @@ struct ThreeParticleCorrelations { // Track PID parameters double pionID = 0.0, kaonID = 1.0, protonID = 2.0; - float nSigma0 = 0.0, nSigma2 = 2.0, nSigma4 = 4.0, nSigma5 = 5.0; + float nSigma0 = 0.0, nSigma1 = 1.0, nSigma2 = 2.0, nSigma4 = 4.0, nSigma5 = 5.0; // V0 filter parameters float tpcNCrossedRowsMin = 70.0; @@ -55,8 +55,8 @@ struct ThreeParticleCorrelations { int dcaV0DauMax = 1; // Track filter parameters - float pionPtMin = 0.3, pionPtMax = 2.3, kaonPtMin = 0.5, kaonPtMax = 2.5, protonPtMin = 0.5, protonPtMax = 2.5; - float pionPtMid = 1.5, kaonPtMid1 = 1.5, kaonPtMid2 = 2.0, protonPtMid = 0.7; + float pionPtMin = 0.3, pionPtMax = 2.3, kaonPtMin = 0.5, kaonPtMax = 2.3, protonPtMin = 0.6; + float pionPtMid1 = 1.6, pionPtMid2 = 2.0, kaonPtMid1 = 1.5, kaonPtMid2 = 2.0, protonPtMid = 2.3; // RD filter parameters float dEtaMax = 0.05, dEtaMin = 0.023; @@ -1002,11 +1002,15 @@ struct ThreeParticleCorrelations { } if (track.pt() < pionPtMin) { return false; - } else if (track.pt() > pionPtMin && track.pt() < pionPtMid) { + } else if (track.pt() > pionPtMin && track.pt() < pionPtMid1) { if (std::abs(track.tofNSigmaPi()) >= nSigma4) { return false; } - } else if (track.pt() > pionPtMid && track.pt() < pionPtMax) { + } else if (track.pt() > pionPtMid1 && track.pt() < pionPtMid2) { + if (track.tofNSigmaPi() <= -nSigma4 || track.tofNSigmaPi() >= -nSigma2) { + return false; + } + } else if (track.pt() > pionPtMid2 && track.pt() < pionPtMax) { if (track.tofNSigmaPi() <= -nSigma4 || track.tofNSigmaPi() >= nSigma0) { return false; } @@ -1025,7 +1029,7 @@ struct ThreeParticleCorrelations { return false; } } else if (track.pt() > kaonPtMid1 && track.pt() < kaonPtMid2) { - if (track.tofNSigmaKa() <= -nSigma2 || track.tofNSigmaKa() >= nSigma4) { + if (track.tofNSigmaKa() <= -nSigma1 || track.tofNSigmaKa() >= nSigma4) { return false; } } else if (track.pt() > kaonPtMid2 && track.pt() < kaonPtMax) { @@ -1043,14 +1047,10 @@ struct ThreeParticleCorrelations { if (track.pt() < protonPtMin) { return false; } else if (track.pt() > protonPtMin && track.pt() < protonPtMid) { - if (track.tofNSigmaPr() <= -nSigma2 || track.tofNSigmaPr() >= nSigma4) { - return false; - } - } else if (track.pt() > protonPtMid && track.pt() < protonPtMax) { if (std::abs(track.tofNSigmaPr()) >= nSigma4) { return false; } - } else if (track.pt() > protonPtMax) { + } else if (track.pt() > protonPtMid) { if (track.tofNSigmaPr() <= -nSigma2 || track.tofNSigmaPr() >= nSigma4) { return false; } From f09744e2dc387d87f93a3e0f9fdb027ad91c92d6 Mon Sep 17 00:00:00 2001 From: Matteo Morgante Date: Mon, 11 Aug 2025 20:50:09 +0200 Subject: [PATCH 335/345] [PWGLF] Added pt cut configurable for generated mc particles (#12532) Co-authored-by: ALICE Action Bot --- .../Strangeness/sigmaminustask.cxx | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/sigmaminustask.cxx b/PWGLF/TableProducer/Strangeness/sigmaminustask.cxx index c9b2d58f08c..e6441c413e0 100644 --- a/PWGLF/TableProducer/Strangeness/sigmaminustask.cxx +++ b/PWGLF/TableProducer/Strangeness/sigmaminustask.cxx @@ -56,6 +56,7 @@ struct sigmaminustask { Configurable cutRapMotherMC{"cutRapMotherMC", 1.0f, "Rapidity cut for mother Sigma in MC"}; Configurable cutMinQtAP{"cutMinQtAP", 0.15f, "Minimum Qt for Armenteros-Podolanski cut"}; Configurable cutMaxQtAP{"cutMaxQtAP", 0.20f, "Maximum Qt for Armenteros-Podolanski cut"}; + Configurable cutPtGen{"cutPtGen", 0.5f, "Minimum pT for generated sigma particles"}; Configurable fillOutputTree{"fillOutputTree", true, "If true, fill the output tree with Kink candidates"}; @@ -129,6 +130,7 @@ struct sigmaminustask { rSigmaMinus.add("h2DCAMothPt", "h2DCAMothPt", {HistType::kTH2F, {ptAxis, dcaMothAxis}}); rSigmaMinus.add("h2DCADaugPt", "h2DCADaugPt", {HistType::kTH2F, {ptAxis, dcaDaugAxis}}); rSigmaMinus.add("h2ArmenterosPreCuts", "h2ArmenterosPreCuts", {HistType::kTH2F, {alphaAPAxis, qtAPAxis}}); + rSigmaMinus.add("h2ArmenterosPostCuts", "h2ArmenterosPostCuts", {HistType::kTH2F, {alphaAPAxis, qtAPAxis}}); rSigmaMinus.add("h2CosPointingAnglePt", "h2CosPointingAnglePt", {HistType::kTH2F, {ptAxis, cosPointingAngleAxis}}); if (doprocessMC) { @@ -179,10 +181,10 @@ struct sigmaminustask { rFindable.add("h2PtDaugFilter_plus_pikink", "h2PtDaugFilter_plus_pikink", {HistType::kTH2F, {filtersAxis, ptUnsignedAxis}}); rFindable.add("h2PtDaugFilter_minus_pikink", "h2PtDaugFilter_minus_pikink", {HistType::kTH2F, {filtersAxis, ptUnsignedAxis}}); - rFindable.add("h2DCAMothPt_protonkink", "h2DCAMothPt_protonkink", {HistType::kTH2F, {ptAxis, dcaMothAxis}}); - rFindable.add("h2DCADaugPt_protonkink", "h2DCADaugPt_protonkink", {HistType::kTH2F, {ptAxis, dcaDaugAxis}}); - rFindable.add("h2DCAMothPt_pikink", "h2DCAMothPt_pikink", {HistType::kTH2F, {ptAxis, dcaMothAxis}}); - rFindable.add("h2DCADaugPt_pikink", "h2DCADaugPt_pikink", {HistType::kTH2F, {ptAxis, dcaDaugAxis}}); + rFindable.add("h2DCAMothPt_protonkink", "h2DCAMothPt_protonkink", {HistType::kTH2F, {ptUnsignedAxis, dcaMothAxis}}); + rFindable.add("h2DCADaugPt_protonkink", "h2DCADaugPt_protonkink", {HistType::kTH2F, {ptUnsignedAxis, dcaDaugAxis}}); + rFindable.add("h2DCAMothPt_pikink", "h2DCAMothPt_pikink", {HistType::kTH2F, {ptUnsignedAxis, dcaMothAxis}}); + rFindable.add("h2DCADaugPt_pikink", "h2DCADaugPt_pikink", {HistType::kTH2F, {ptUnsignedAxis, dcaDaugAxis}}); } } @@ -252,7 +254,7 @@ struct sigmaminustask { std::array{0.0f, 0.0f, 0.0f}, std::array{kinkCand.xDecVtx(), kinkCand.yDecVtx(), kinkCand.zDecVtx()}); rSigmaMinus.fill(HIST("h2CosPointingAnglePt"), kinkCand.mothSign() * kinkCand.ptMoth(), cosPointingAngleRec); - + rSigmaMinus.fill(HIST("h2ArmenterosPostCuts"), alphaAPValue, qtValue); rSigmaMinus.fill(HIST("h2MassSigmaMinusPt"), kinkCand.mothSign() * kinkCand.ptMoth(), kinkCand.mSigmaMinus()); rSigmaMinus.fill(HIST("h2SigmaMassVsXiMass"), kinkCand.mXiMinus(), kinkCand.mSigmaMinus()); rSigmaMinus.fill(HIST("h2NSigmaTPCPiPt"), kinkCand.mothSign() * kinkCand.ptMoth(), dauTrack.tpcNSigmaPi()); @@ -354,7 +356,7 @@ struct sigmaminustask { rSigmaMinus.fill(HIST("h2DCAMothPt"), kinkCand.mothSign() * kinkCand.ptMoth(), kinkCand.dcaMothPv()); rSigmaMinus.fill(HIST("h2DCADaugPt"), kinkCand.mothSign() * kinkCand.ptMoth(), kinkCand.dcaDaugPv()); rSigmaMinus.fill(HIST("h2CosPointingAnglePt"), kinkCand.mothSign() * kinkCand.ptMoth(), cosPointingAngleRec); - + rSigmaMinus.fill(HIST("h2ArmenterosPostCuts"), alphaAPValue, qtValue); if (std::abs(mcTrackPiDau.pdgCode()) == 211) { rSigmaMinus.fill(HIST("h2NSigmaTOFPiPt"), kinkCand.mothSign() * kinkCand.ptMoth(), dauTrack.tofNSigmaPi()); } else if (std::abs(mcTrackPiDau.pdgCode()) == 2212) { @@ -383,6 +385,11 @@ struct sigmaminustask { if ((std::abs(mcPart.pdgCode()) != 3112 && std::abs(mcPart.pdgCode()) != 3222) || std::abs(mcPart.y()) > cutRapMotherMC) { // only sigma mothers and rapidity cut continue; } + + if (mcPart.pt() < cutPtGen) { + continue; // Skip if pT is below threshold + } + if (!mcPart.has_daughters()) { continue; // Skip if no daughters } @@ -531,7 +538,7 @@ struct sigmaminustask { // Compute useful quantities for histograms bool isSigmaMinus = (std::abs(mcMother.pdgCode()) == 3112); bool isPiDaughter = (std::abs(mcDaughter.pdgCode()) == 211); - int sigmaSign = mcMother.pdgCode() > 0 ? 1 : -1; + float recPtDaughter = daughterTrack.pt(); float recPtMother = motherTrack.pt(); float mcRadius = std::sqrt((mcMother.vx() - mcDaughter.vx()) * (mcMother.vx() - mcDaughter.vx()) + (mcMother.vy() - mcDaughter.vy()) * (mcMother.vy() - mcDaughter.vy())); @@ -617,11 +624,11 @@ struct sigmaminustask { float dcaXYMother = std::abs(dcaInfoMoth[0]); float dcaXYDaughter = std::abs(dcaInfoDaug[0]); if (isPiDaughter) { - rFindable.fill(HIST("h2DCAMothPt_pikink"), sigmaSign * recPtMother, dcaXYMother); - rFindable.fill(HIST("h2DCADaugPt_pikink"), sigmaSign * recPtDaughter, dcaXYDaughter); + rFindable.fill(HIST("h2DCAMothPt_pikink"), recPtMother, dcaXYMother); + rFindable.fill(HIST("h2DCADaugPt_pikink"), recPtDaughter, dcaXYDaughter); } else { - rFindable.fill(HIST("h2DCAMothPt_protonkink"), sigmaSign * recPtMother, dcaXYMother); - rFindable.fill(HIST("h2DCADaugPt_protonkink"), sigmaSign * recPtDaughter, dcaXYDaughter); + rFindable.fill(HIST("h2DCAMothPt_protonkink"), recPtMother, dcaXYMother); + rFindable.fill(HIST("h2DCADaugPt_protonkink"), recPtDaughter, dcaXYDaughter); } // 6 - max Z difference From 891d90836d6ea5a72fdc6b2eefba5eac0fc93f0c Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Mon, 11 Aug 2025 21:25:30 +0200 Subject: [PATCH 336/345] [PWGEM/Dilepton] use pin instead of ppv (#12533) --- PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx index ef773ae86a9..704a7d79112 100644 --- a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx +++ b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx @@ -593,7 +593,7 @@ struct TreeCreatorElectronMLDDA { // float dcaZ = mDcaInfoCov.getZ(); if (pidlabel == static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kElectron)) { - if (trackParCov.getP() < max_p_for_downscaling_electron) { + if (track.tpcInnerParam() < max_p_for_downscaling_electron) { if (dist01(engine) > downscaling_electron_lowP) { return; } @@ -603,7 +603,7 @@ struct TreeCreatorElectronMLDDA { } } } else if (pidlabel == static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kPion)) { - if (trackParCov.getP() < max_p_for_downscaling_pion) { + if (track.tpcInnerParam() < max_p_for_downscaling_pion) { if (dist01(engine) > downscaling_pion_lowP) { return; } @@ -613,7 +613,7 @@ struct TreeCreatorElectronMLDDA { } } } else if (pidlabel == static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kKaon)) { - if (trackParCov.getP() < max_p_for_downscaling_kaon) { + if (track.tpcInnerParam() < max_p_for_downscaling_kaon) { if (dist01(engine) > downscaling_kaon_lowP) { return; } @@ -623,7 +623,7 @@ struct TreeCreatorElectronMLDDA { } } } else if (pidlabel == static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kProton)) { - if (trackParCov.getP() < max_p_for_downscaling_proton) { + if (track.tpcInnerParam() < max_p_for_downscaling_proton) { if (dist01(engine) > downscaling_proton_lowP) { return; } From 7b1ed4aeff6af23ab077ad8e210a1813747f8de8 Mon Sep 17 00:00:00 2001 From: omvazque Date: Mon, 11 Aug 2025 16:48:51 -0500 Subject: [PATCH 337/345] [PWGLF] NPV-based rejection for light-ion data (#12537) --- PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx b/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx index f0e6012d4a4..69db7b49952 100644 --- a/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/uccZdc.cxx @@ -227,6 +227,7 @@ struct UccZdc { const char* tiT0C{"T0C (#times 1/100, -3.3 < #eta < -2.1)"}; const char* tiT0M{"T0A+T0C (#times 1/100, -3.3 < #eta < -2.1 and 3.5 < #eta < 4.9)"}; const char* tiNch{"#it{N}_{ch} (|#eta| < 0.8)"}; + const char* tiNPV{"#it{N}_{PV} (|#eta|<1)"}; const char* tiV0A{"V0A (#times 1/100, 2.2 < #eta < 5)"}; const char* tiZNs{"ZNA + ZNC"}; const char* tiZPs{"ZPA + ZPC"}; @@ -250,6 +251,7 @@ struct UccZdc { registry.add("ExcludedEvtVsFT0M", Form(";%s;Entries;", tiT0M), kTH1F, {{nBinsAmpFT0, 0., maxAmpFT0}}); registry.add("ExcludedEvtVsFV0A", Form(";%s;Entries;", tiT0M), kTH1F, {{nBinsAmpV0A, 0., maxAmpV0A}}); registry.add("ExcludedEvtVsNch", Form(";%s;Entries;", tiNch), kTH1F, {{nBinsNch, minNch, maxNch}}); + registry.add("ExcludedEvtVsNPV", Form(";%s;Entries;", tiNPV), kTH1F, {{nBinsITSTrack, 0, maxITSTrack}}); registry.add("Nch", Form(";%s;Entries;", tiNch), kTH1F, {{nBinsNch, minNch, maxNch}}); registry.add("NchVsOneParCorr", Form(";%s;%s;", tiNch, tiOneParCorr), kTProfile, {{nBinsNch, minNch, maxNch}}); @@ -549,6 +551,7 @@ struct UccZdc { } } + const double nPV{collision.multNTracksPVeta1() / 1.}; const double normT0M{(aT0A + aT0C) / 100.}; const double normV0A{aV0A / 100.}; const double normT0A{aT0A / 100.}; @@ -619,6 +622,9 @@ struct UccZdc { if (s1 == "V0A") { xEval = normV0A; } + if (s1 == "NPV") { + xEval = nPV; + } const int bin4Calibration{cfgNch.hMeanNch->FindBin(xEval)}; const double meanNch{cfgNch.hMeanNch->GetBinContent(bin4Calibration)}; @@ -630,6 +636,7 @@ struct UccZdc { registry.fill(HIST("ExcludedEvtVsFT0M"), normT0M); registry.fill(HIST("ExcludedEvtVsFV0A"), normV0A); registry.fill(HIST("ExcludedEvtVsNch"), glbTracks); + registry.fill(HIST("ExcludedEvtVsNPV"), nPV); skipEvent = true; } } @@ -725,6 +732,7 @@ struct UccZdc { } } + const double nPV{collision.multNTracksPVeta1() / 1.}; const double normT0M{(aT0A + aT0C) / 100.}; const double normV0A{aV0A / 100.}; float znA{foundBC.zdc().amplitudeZNA()}; @@ -802,6 +810,9 @@ struct UccZdc { if (s1 == "V0A") { xEval = normV0A; } + if (s1 == "NPV") { + xEval = nPV; + } const int bin4Calibration{cfgNch.hMeanNch->FindBin(xEval)}; const double meanNch{cfgNch.hMeanNch->GetBinContent(bin4Calibration)}; @@ -813,6 +824,7 @@ struct UccZdc { registry.fill(HIST("ExcludedEvtVsFT0M"), normT0M); registry.fill(HIST("ExcludedEvtVsFV0A"), normV0A); registry.fill(HIST("ExcludedEvtVsNch"), glbTracks); + registry.fill(HIST("ExcludedEvtVsNPV"), nPV); skipEvent = true; } } From 759fbe00157986ada465fe1e94cc49dd4d4f5698 Mon Sep 17 00:00:00 2001 From: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Date: Tue, 12 Aug 2025 01:47:32 +0200 Subject: [PATCH 338/345] [PWGLF] Add V0 Vs Phi vs Eta histograms (#12538) --- .../derivedlambdakzeroanalysis.cxx | 44 +++++++++++++------ 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx b/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx index 2c872c3500f..fb3255fb412 100644 --- a/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx +++ b/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx @@ -203,6 +203,7 @@ struct derivedlambdakzeroanalysis { Configurable doTPCQA{"doTPCQA", false, "do TPC QA histograms"}; Configurable doTOFQA{"doTOFQA", false, "do TOF QA histograms"}; Configurable doDetectPropQA{"doDetectPropQA", 0, "do Detector/ITS map QA: 0: no, 1: 4D, 2: 5D with mass; 3: plain in 3D"}; + Configurable doEtaPhiQA{"doEtaPhiQA", false, "do Eta/Phi QA histograms"}; Configurable doPlainTopoQA{"doPlainTopoQA", true, "do simple 1D QA of candidates"}; Configurable qaMinPt{"qaMinPt", 0.0f, "minimum pT for QA plots"}; @@ -715,6 +716,11 @@ struct derivedlambdakzeroanalysis { histos.add("K0Short/h3dPositiveTPCcrossedRows", "h3dPositiveTPCcrossedRows", kTH3D, {axisCentrality, axisPtCoarse, axisTPCrows}); histos.add("K0Short/h3dNegativeTPCcrossedRows", "h3dNegativeTPCcrossedRows", kTH3D, {axisCentrality, axisPtCoarse, axisTPCrows}); } + if (doEtaPhiQA) { + histos.add("K0Short/h5dV0PhiVsEta", "h5dV0PhiVsEta", kTHnD, {axisCentrality, axisPtCoarse, axisK0Mass, axisPhi, axisEta}); + histos.add("K0Short/h5dPosPhiVsNegPhi", "h5dPosPhiVsEta", kTHnD, {axisCentrality, axisPtCoarse, axisK0Mass, axisPhi, axisPhi}); + histos.add("K0Short/h5dPosEtaVsNegEta", "h5dNegPhiVsEta", kTHnD, {axisCentrality, axisPtCoarse, axisK0Mass, axisEta, axisEta}); + } } if (analyseLambda) { histos.add("h2dNbrOfLambdaVsCentrality", "h2dNbrOfLambdaVsCentrality", kTH2D, {axisCentrality, {10, -0.5f, 9.5f}}); @@ -782,6 +788,11 @@ struct derivedlambdakzeroanalysis { histos.add("Lambda/h3dPositiveTPCcrossedRows", "h3dPositiveTPCcrossedRows", kTH3D, {axisCentrality, axisPtCoarse, axisTPCrows}); histos.add("Lambda/h3dNegativeTPCcrossedRows", "h3dNegativeTPCcrossedRows", kTH3D, {axisCentrality, axisPtCoarse, axisTPCrows}); } + if (doEtaPhiQA) { + histos.add("Lambda/h5dV0PhiVsEta", "h5dV0PhiVsEta", kTHnD, {axisCentrality, axisPtCoarse, axisLambdaMass, axisPhi, axisEta}); + histos.add("Lambda/h5dPosPhiVsNegPhi", "h5dPosPhiVsEta", kTHnD, {axisCentrality, axisPtCoarse, axisLambdaMass, axisPhi, axisPhi}); + histos.add("Lambda/h5dPosEtaVsNegEta", "h5dNegPhiVsEta", kTHnD, {axisCentrality, axisPtCoarse, axisLambdaMass, axisEta, axisEta}); + } } if (analyseAntiLambda) { histos.add("h2dNbrOfAntiLambdaVsCentrality", "h2dNbrOfAntiLambdaVsCentrality", kTH2D, {axisCentrality, {10, -0.5f, 9.5f}}); @@ -849,6 +860,11 @@ struct derivedlambdakzeroanalysis { histos.add("AntiLambda/h3dPositiveTPCcrossedRows", "h3dPositiveTPCcrossedRows", kTH3D, {axisCentrality, axisPtCoarse, axisTPCrows}); histos.add("AntiLambda/h3dNegativeTPCcrossedRows", "h3dNegativeTPCcrossedRows", kTH3D, {axisCentrality, axisPtCoarse, axisTPCrows}); } + if (doEtaPhiQA) { + histos.add("AntiLambda/h5dV0PhiVsEta", "h5dV0PhiVsEta", kTHnD, {axisCentrality, axisPtCoarse, axisLambdaMass, axisPhi, axisEta}); + histos.add("AntiLambda/h5dPosPhiVsNegPhi", "h5dPosPhiVsEta", kTHnD, {axisCentrality, axisPtCoarse, axisLambdaMass, axisPhi, axisPhi}); + histos.add("AntiLambda/h5dPosEtaVsNegEta", "h5dNegPhiVsEta", kTHnD, {axisCentrality, axisPtCoarse, axisLambdaMass, axisEta, axisEta}); + } } if (analyseLambda && calculateFeeddownMatrix && (doprocessMonteCarloRun3 || doprocessMonteCarloRun2)) @@ -868,7 +884,6 @@ struct derivedlambdakzeroanalysis { histos.add("K0Short/h4dDCADaughters", "h4dDCADaughters", kTHnD, {axisCentrality, axisPtCoarse, axisK0Mass, axisDCAdau}); histos.add("K0Short/h4dPointingAngle", "h4dPointingAngle", kTHnD, {axisCentrality, axisPtCoarse, axisK0Mass, axisPointingAngle}); histos.add("K0Short/h4dV0Radius", "h4dV0Radius", kTHnD, {axisCentrality, axisPtCoarse, axisK0Mass, axisV0Radius}); - histos.add("K0Short/h4dV0PhiVsEta", "h4dV0PhiVsEta", kTHnD, {axisPtCoarse, axisK0Mass, axisPhi, axisEta}); } if (analyseLambda) { histos.add("Lambda/h4dPosDCAToPV", "h4dPosDCAToPV", kTHnD, {axisCentrality, axisPtCoarse, axisLambdaMass, axisDCAtoPV}); @@ -876,7 +891,6 @@ struct derivedlambdakzeroanalysis { histos.add("Lambda/h4dDCADaughters", "h4dDCADaughters", kTHnD, {axisCentrality, axisPtCoarse, axisLambdaMass, axisDCAdau}); histos.add("Lambda/h4dPointingAngle", "h4dPointingAngle", kTHnD, {axisCentrality, axisPtCoarse, axisLambdaMass, axisPointingAngle}); histos.add("Lambda/h4dV0Radius", "h4dV0Radius", kTHnD, {axisCentrality, axisPtCoarse, axisLambdaMass, axisV0Radius}); - histos.add("Lambda/h4dV0PhiVsEta", "h4dV0PhiVsEta", kTHnD, {axisPtCoarse, axisK0Mass, axisPhi, axisEta}); } if (analyseAntiLambda) { histos.add("AntiLambda/h4dPosDCAToPV", "h4dPosDCAToPV", kTHnD, {axisCentrality, axisPtCoarse, axisLambdaMass, axisDCAtoPV}); @@ -884,7 +898,6 @@ struct derivedlambdakzeroanalysis { histos.add("AntiLambda/h4dDCADaughters", "h4dDCADaughters", kTHnD, {axisCentrality, axisPtCoarse, axisLambdaMass, axisDCAdau}); histos.add("AntiLambda/h4dPointingAngle", "h4dPointingAngle", kTHnD, {axisCentrality, axisPtCoarse, axisLambdaMass, axisPointingAngle}); histos.add("AntiLambda/h4dV0Radius", "h4dV0Radius", kTHnD, {axisCentrality, axisPtCoarse, axisLambdaMass, axisV0Radius}); - histos.add("AntiLambda/h4dV0PhiVsEta", "h4dV0PhiVsEta", kTHnD, {axisPtCoarse, axisK0Mass, axisPhi, axisEta}); } } @@ -1496,6 +1509,11 @@ struct derivedlambdakzeroanalysis { histos.fill(HIST("K0Short/h3dPosTOFdeltaTvsTrackPt"), centrality, v0.positivept(), v0.posTOFDeltaTK0Pi()); histos.fill(HIST("K0Short/h3dNegTOFdeltaTvsTrackPt"), centrality, v0.negativept(), v0.negTOFDeltaTK0Pi()); } + if (doEtaPhiQA) { + histos.fill(HIST("K0Short/h5dV0PhiVsEta"), centrality, pt, v0.mK0Short(), v0.phi(), v0.eta()); + histos.fill(HIST("K0Short/h5dPosPhiVsNegPhi"), centrality, pt, v0.mK0Short(), v0.positivephi(), v0.negativephi()); + histos.fill(HIST("K0Short/h5dPosEtaVsNegEta"), centrality, pt, v0.mK0Short(), v0.positiveeta(), v0.negativeeta()); + } nK0Shorts++; } if (passLambdaSelections && analyseLambda) { @@ -1570,6 +1588,11 @@ struct derivedlambdakzeroanalysis { histos.fill(HIST("Lambda/h3dPosTOFdeltaTvsTrackPt"), centrality, v0.positivept(), v0.posTOFDeltaTLaPr()); histos.fill(HIST("Lambda/h3dNegTOFdeltaTvsTrackPt"), centrality, v0.negativept(), v0.negTOFDeltaTLaPi()); } + if (doEtaPhiQA) { + histos.fill(HIST("Lambda/h5dV0PhiVsEta"), centrality, pt, v0.mLambda(), v0.phi(), v0.eta()); + histos.fill(HIST("Lambda/h5dPosPhiVsNegPhi"), centrality, pt, v0.mLambda(), v0.positivephi(), v0.negativephi()); + histos.fill(HIST("Lambda/h5dPosEtaVsNegEta"), centrality, pt, v0.mLambda(), v0.positiveeta(), v0.negativeeta()); + } nLambdas++; } if (passAntiLambdaSelections && analyseAntiLambda) { @@ -1644,6 +1667,11 @@ struct derivedlambdakzeroanalysis { histos.fill(HIST("AntiLambda/h3dPosTOFdeltaTvsTrackPt"), centrality, v0.positivept(), v0.posTOFDeltaTLaPi()); histos.fill(HIST("AntiLambda/h3dNegTOFdeltaTvsTrackPt"), centrality, v0.negativept(), v0.negTOFDeltaTLaPr()); } + if (doEtaPhiQA) { + histos.fill(HIST("AntiLambda/h5dV0PhiVsEta"), centrality, pt, v0.mAntiLambda(), v0.phi(), v0.eta()); + histos.fill(HIST("AntiLambda/h5dPosPhiVsNegPhi"), centrality, pt, v0.mAntiLambda(), v0.positivephi(), v0.negativephi()); + histos.fill(HIST("AntiLambda/h5dPosEtaVsNegEta"), centrality, pt, v0.mAntiLambda(), v0.positiveeta(), v0.negativeeta()); + } nAntiLambdas++; } @@ -1661,11 +1689,7 @@ struct derivedlambdakzeroanalysis { histos.fill(HIST("K0Short/h4dPointingAngle"), centrality, pt, v0.mK0Short(), std::acos(v0.v0cosPA())); if (verifyMask(selMap, maskTopoNoDCAV0Dau | maskK0ShortSpecific)) histos.fill(HIST("K0Short/h4dDCADaughters"), centrality, pt, v0.mK0Short(), v0.dcaV0daughters()); - - if (passK0ShortSelections) - histos.fill(HIST("K0Short/h4dV0PhiVsEta"), pt, v0.mK0Short(), v0.phi(), v0.eta()); } - if (analyseLambda) { if (verifyMask(selMap, maskTopoNoV0Radius | maskLambdaSpecific)) histos.fill(HIST("Lambda/h4dV0Radius"), centrality, pt, v0.mLambda(), v0.v0radius()); @@ -1677,9 +1701,6 @@ struct derivedlambdakzeroanalysis { histos.fill(HIST("Lambda/h4dPointingAngle"), centrality, pt, v0.mLambda(), std::acos(v0.v0cosPA())); if (verifyMask(selMap, maskTopoNoDCAV0Dau | maskLambdaSpecific)) histos.fill(HIST("Lambda/h4dDCADaughters"), centrality, pt, v0.mLambda(), v0.dcaV0daughters()); - - if (passLambdaSelections) - histos.fill(HIST("Lambda/h4dV0PhiVsEta"), pt, v0.mLambda(), v0.phi(), v0.eta()); } if (analyseAntiLambda) { if (verifyMask(selMap, maskTopoNoV0Radius | maskAntiLambdaSpecific)) @@ -1692,9 +1713,6 @@ struct derivedlambdakzeroanalysis { histos.fill(HIST("AntiLambda/h4dPointingAngle"), centrality, pt, v0.mAntiLambda(), std::acos(v0.v0cosPA())); if (verifyMask(selMap, maskTopoNoDCAV0Dau | maskAntiLambdaSpecific)) histos.fill(HIST("AntiLambda/h4dDCADaughters"), centrality, pt, v0.mAntiLambda(), v0.dcaV0daughters()); - - if (passAntiLambdaSelections) - histos.fill(HIST("AntiLambda/h4dV0PhiVsEta"), pt, v0.mAntiLambda(), v0.phi(), v0.eta()); } } // end systematics / qa } From e69a3e4cc553f731f63fad44887797cb5b0119ae Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Tue, 12 Aug 2025 02:56:57 +0200 Subject: [PATCH 339/345] [PWGEM/Dilepton] update treeCreatorElectronMLDDA.cxx (#12539) --- PWGEM/Dilepton/Core/Dilepton.h | 2 +- PWGEM/Dilepton/Core/DileptonHadronMPC.h | 38 ++++++-- PWGEM/Dilepton/Core/DileptonMC.h | 2 +- PWGEM/Dilepton/Core/DimuonCut.h | 8 +- .../treeCreatorElectronMLDDA.cxx | 94 +++++++++---------- 5 files changed, 82 insertions(+), 62 deletions(-) diff --git a/PWGEM/Dilepton/Core/Dilepton.h b/PWGEM/Dilepton/Core/Dilepton.h index 2ded13ca237..929932d4269 100644 --- a/PWGEM/Dilepton/Core/Dilepton.h +++ b/PWGEM/Dilepton/Core/Dilepton.h @@ -757,7 +757,7 @@ struct Dilepton { fDimuonCut.SetTrackEtaRange(dimuoncuts.cfg_min_eta_track, dimuoncuts.cfg_max_eta_track); fDimuonCut.SetTrackPhiRange(dimuoncuts.cfg_min_phi_track, dimuoncuts.cfg_max_phi_track); fDimuonCut.SetNClustersMFT(dimuoncuts.cfg_min_ncluster_mft, 10); - fDimuonCut.SetNClustersMCHMID(dimuoncuts.cfg_min_ncluster_mch, 16); + fDimuonCut.SetNClustersMCHMID(dimuoncuts.cfg_min_ncluster_mch, 20); fDimuonCut.SetChi2(0.f, dimuoncuts.cfg_max_chi2); fDimuonCut.SetMatchingChi2MCHMFT(0.f, dimuoncuts.cfg_max_matching_chi2_mftmch); fDimuonCut.SetMatchingChi2MCHMID(0.f, dimuoncuts.cfg_max_matching_chi2_mchmid); diff --git a/PWGEM/Dilepton/Core/DileptonHadronMPC.h b/PWGEM/Dilepton/Core/DileptonHadronMPC.h index 9efb785a21a..e59fc87ad3c 100644 --- a/PWGEM/Dilepton/Core/DileptonHadronMPC.h +++ b/PWGEM/Dilepton/Core/DileptonHadronMPC.h @@ -658,7 +658,7 @@ struct DileptonHadronMPC { fDimuonCut.SetTrackEtaRange(dimuoncuts.cfg_min_eta_track, dimuoncuts.cfg_max_eta_track); fDimuonCut.SetTrackPhiRange(dimuoncuts.cfg_min_phi_track, dimuoncuts.cfg_max_phi_track); fDimuonCut.SetNClustersMFT(dimuoncuts.cfg_min_ncluster_mft, 10); - fDimuonCut.SetNClustersMCHMID(dimuoncuts.cfg_min_ncluster_mch, 16); + fDimuonCut.SetNClustersMCHMID(dimuoncuts.cfg_min_ncluster_mch, 20); fDimuonCut.SetChi2(0.f, dimuoncuts.cfg_max_chi2); fDimuonCut.SetMatchingChi2MCHMFT(0.f, dimuoncuts.cfg_max_matching_chi2_mftmch); fDimuonCut.SetMatchingChi2MCHMID(0.f, dimuoncuts.cfg_max_matching_chi2_mchmid); @@ -954,8 +954,8 @@ struct DileptonHadronMPC { return true; } - template - bool fillHadronHadron(TCollision const& collision, TRefTrack const& t1, TRefTrack const& t2, TLeptons const& posLeptons, TLeptons const& negLeptons) + template + bool fillHadronHadron(TCollision const& collision, TRefTrack const& t1, TRefTrack const& t2, TLeptons const& posLeptons, TLeptons const& negLeptons, TLeptonCut const& cut) { if constexpr (ev_id == 0) { if (!fEMTrackCut.IsSelected(t1) || !fEMTrackCut.IsSelected(t2)) { // for charged track @@ -965,17 +965,37 @@ struct DileptonHadronMPC { // Leptons should not be in reference track sample. if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { for (const auto& pos : posLeptons) { // leptons per collision + if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { + if (!cut.template IsSelectedTrack(pos, collision)) { + continue; + } + } else { // cut based + if (!cut.template IsSelectedTrack(pos)) { + continue; + } + } if (t1.trackId() == pos.trackId() || t2.trackId() == pos.trackId()) { return false; } - } + } // end of pos lepton loop + for (const auto& neg : negLeptons) { // leptons per collision + if (dielectroncuts.cfg_pid_scheme == static_cast(DielectronCut::PIDSchemes::kPIDML)) { + if (!cut.template IsSelectedTrack(neg, collision)) { + continue; + } + } else { // cut based + if (!cut.template IsSelectedTrack(neg)) { + continue; + } + } if (t1.trackId() == neg.trackId() || t2.trackId() == neg.trackId()) { return false; } - } - } - } + } // end of neg lepton lopp + + } // end of if kDielectron + } // end of if same event if constexpr (ev_id == 1) { if (t1.dfId() == t2.dfId() && t1.globalIndex() == t2.globalIndex()) { @@ -1132,7 +1152,7 @@ struct DileptonHadronMPC { } } for (const auto& [trg, ref] : combinations(CombinationsStrictlyUpperIndexPolicy(refTracks_per_coll, refTracks_per_coll))) { - fillHadronHadron<0>(collision, trg, ref, posTracks_per_coll, negTracks_per_coll); + fillHadronHadron<0>(collision, trg, ref, posTracks_per_coll, negTracks_per_coll, cut); } } @@ -1251,7 +1271,7 @@ struct DileptonHadronMPC { // LOGF(info, "refTracks_from_event_pool.size() = %d", refTracks_from_event_pool.size()); for (const auto& ref1 : selected_refTracks_in_this_event) { // ref-ref mix for (const auto& ref2 : refTracks_from_event_pool) { - fillHadronHadron<1>(collision, ref1, ref2, nullptr, nullptr); + fillHadronHadron<1>(collision, ref1, ref2, nullptr, nullptr, nullptr); } } } // end of loop over mixed event pool for lepton-lepton diff --git a/PWGEM/Dilepton/Core/DileptonMC.h b/PWGEM/Dilepton/Core/DileptonMC.h index 46e7ecbe9be..6e308ead765 100644 --- a/PWGEM/Dilepton/Core/DileptonMC.h +++ b/PWGEM/Dilepton/Core/DileptonMC.h @@ -736,7 +736,7 @@ struct DileptonMC { fDimuonCut.SetTrackEtaRange(dimuoncuts.cfg_min_eta_track, dimuoncuts.cfg_max_eta_track); fDimuonCut.SetTrackPhiRange(dimuoncuts.cfg_min_phi_track, dimuoncuts.cfg_max_phi_track); fDimuonCut.SetNClustersMFT(dimuoncuts.cfg_min_ncluster_mft, 10); - fDimuonCut.SetNClustersMCHMID(dimuoncuts.cfg_min_ncluster_mch, 16); + fDimuonCut.SetNClustersMCHMID(dimuoncuts.cfg_min_ncluster_mch, 20); fDimuonCut.SetChi2(0.f, dimuoncuts.cfg_max_chi2); fDimuonCut.SetMatchingChi2MCHMFT(0.f, dimuoncuts.cfg_max_matching_chi2_mftmch); fDimuonCut.SetMatchingChi2MCHMID(0.f, dimuoncuts.cfg_max_matching_chi2_mchmid); diff --git a/PWGEM/Dilepton/Core/DimuonCut.h b/PWGEM/Dilepton/Core/DimuonCut.h index 2895c95f311..1c2ce81010b 100644 --- a/PWGEM/Dilepton/Core/DimuonCut.h +++ b/PWGEM/Dilepton/Core/DimuonCut.h @@ -265,11 +265,11 @@ class DimuonCut : public TNamed // track quality cuts int mTrackType{3}; - int mMinNClustersMFT{0}, mMaxNClustersMFT{10}; // min number of TPC clusters - int mMinNClustersMCHMID{0}, mMaxNClustersMCHMID{16}; // min number of TPC clusters + int mMinNClustersMFT{0}, mMaxNClustersMFT{10}; // min number of MFT clusters + int mMinNClustersMCHMID{0}, mMaxNClustersMCHMID{20}; // min number of MCH-MID clusters float mMinChi2{0.f}, mMaxChi2{1e10f}; // max tpc fit chi2 per TPC cluster - float mMinMatchingChi2MCHMFT{0.f}, mMaxMatchingChi2MCHMFT{1e10f}; // max tpc fit chi2 per TPC cluster - float mMinMatchingChi2MCHMID{0.f}, mMaxMatchingChi2MCHMID{1e10f}; // max tpc fit chi2 per TPC cluster + float mMinMatchingChi2MCHMFT{0.f}, mMaxMatchingChi2MCHMFT{1e10f}; // max matching chi2 between MCH-MFT + float mMinMatchingChi2MCHMID{0.f}, mMaxMatchingChi2MCHMID{1e10f}; // max matching chi2 between MCH-MID std::function mMaxPDCARabsDep{}; // max pdca in xy plane as function of Rabs float mMinRabs{17.6}, mMaxRabs{89.5}; diff --git a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx index 704a7d79112..b87ce1be2bd 100644 --- a/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx +++ b/PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx @@ -955,63 +955,63 @@ struct MLTrackQC { HistogramRegistry registry{ "registry", { - {"hTPCdEdx_P_All", "TPC dE/dx vs. p;p_{pv} (GeV/c);TPC dE/dx", {HistType::kTH2F, {{500, 0.f, 5.f}, {200, 0, 200}}}}, - {"hTOFbeta_P_All", "TOF beta vs. p;p_{pv} (GeV/c);TOF #beta", {HistType::kTH2F, {{500, 0.f, 5.f}, {220, 0.0, 1.1}}}}, - {"hITSobClusterSize_P_All", "mean ITSob cluster size vs. p;p_{pv} (GeV/c); #times cos(#lambda)", {HistType::kTH2F, {{500, 0.f, 5.f}, {150, 0.0, 15}}}}, - {"hTPCdEdx_P_Electron", "TPC dE/dx vs. p;p_{pv} (GeV/c);TPC dE/dx", {HistType::kTH2F, {{500, 0.f, 5.f}, {200, 0, 200}}}}, - {"hTOFbeta_P_Electron", "TOF beta vs. p;p_{pv} (GeV/c);TOF #beta", {HistType::kTH2F, {{500, 0.f, 5.f}, {220, 0.0, 1.1}}}}, - {"hITSobClusterSize_P_Electron", "mean ITSob cluster size vs. p;p_{pv} (GeV/c); #times cos(#lambda)", {HistType::kTH2F, {{500, 0.f, 5.f}, {150, 0.0, 15}}}}, - {"hTPCdEdx_P_Pion", "TPC dE/dx vs. p;p_{pv} (GeV/c);TPC dE/dx", {HistType::kTH2F, {{500, 0.f, 5.f}, {200, 0, 200}}}}, - {"hTOFbeta_P_Pion", "TOF beta vs. p;p_{pv} (GeV/c);TOF #beta", {HistType::kTH2F, {{500, 0.f, 5.f}, {220, 0.0, 1.1}}}}, - {"hITSobClusterSize_P_Pion", "mean ITSob cluster size vs. p;p_{pv} (GeV/c); #times cos(#lambda)", {HistType::kTH2F, {{500, 0.f, 5.f}, {150, 0.0, 15}}}}, - {"hTPCdEdx_P_Kaon", "TPC dE/dx vs. p;p_{pv} (GeV/c);TPC dE/dx", {HistType::kTH2F, {{500, 0.f, 5.f}, {200, 0, 200}}}}, - {"hTOFbeta_P_Kaon", "TOF beta vs. p;p_{pv} (GeV/c);TOF #beta", {HistType::kTH2F, {{500, 0.f, 5.f}, {220, 0.0, 1.1}}}}, - {"hITSobClusterSize_P_Kaon", "mean ITSob cluster size vs. p;p_{pv} (GeV/c); #times cos(#lambda)", {HistType::kTH2F, {{500, 0.f, 5.f}, {150, 0.0, 15}}}}, - {"hTPCdEdx_P_Proton", "TPC dE/dx vs. p;p_{pv} (GeV/c);TPC dE/dx", {HistType::kTH2F, {{500, 0.f, 5.f}, {200, 0, 200}}}}, - {"hTOFbeta_P_Proton", "TOF beta vs. p;p_{pv} (GeV/c);TOF #beta", {HistType::kTH2F, {{500, 0.f, 5.f}, {220, 0.0, 1.1}}}}, - {"hITSobClusterSize_P_Proton", "mean ITSob cluster size vs. p;p_{pv} (GeV/c); #times cos(#lambda)", {HistType::kTH2F, {{500, 0.f, 5.f}, {150, 0.0, 15}}}}, - - {"hTPCNsigmaEl_P", "TPC n#sigma_{e} vs. p;p_{pv} (GeV/c);n #sigma_{e}^{TPC}", {HistType::kTH2F, {{500, 0.f, 5.f}, {100, -5, +5}}}}, - {"hTPCNsigmaPi_P", "TPC n#sigma_{#pi} vs. p;p_{pv} (GeV/c);n #sigma_{#pi}^{TPC}", {HistType::kTH2F, {{500, 0.f, 5.f}, {100, -5, +5}}}}, - {"hTPCNsigmaKa_P", "TPC n#sigma_{K} vs. p;p_{pv} (GeV/c);n #sigma_{K}^{TPC}", {HistType::kTH2F, {{500, 0.f, 5.f}, {100, -5, +5}}}}, - {"hTPCNsigmaPr_P", "TPC n#sigma_{p} vs. p;p_{pv} (GeV/c);n #sigma_{p}^{TPC}", {HistType::kTH2F, {{500, 0.f, 5.f}, {100, -5, +5}}}}, - {"hTOFNsigmaEl_P", "TOF n#sigma_{e} vs. p;p_{pv} (GeV/c);n #sigma_{e}^{TOF}", {HistType::kTH2F, {{500, 0.f, 5.f}, {100, -5, +5}}}}, - {"hTOFNsigmaPi_P", "TOF n#sigma_{#pi} vs. p;p_{pv} (GeV/c);n #sigma_{#pi}^{TOF}", {HistType::kTH2F, {{500, 0.f, 5.f}, {100, -5, +5}}}}, - {"hTOFNsigmaKa_P", "TOF n#sigma_{K} vs. p;p_{pv} (GeV/c);n #sigma_{K}^{TOF}", {HistType::kTH2F, {{500, 0.f, 5.f}, {100, -5, +5}}}}, - {"hTOFNsigmaPr_P", "TOF n#sigma_{p} vs. p;p_{pv} (GeV/c);n #sigma_{p}^{TOF}", {HistType::kTH2F, {{500, 0.f, 5.f}, {100, -5, +5}}}}, + {"hTPCdEdx_P_All", "TPC dE/dx vs. p;p_{in} (GeV/c);TPC dE/dx", {HistType::kTH2F, {{1000, 0.f, 10.f}, {200, 0, 200}}}}, + {"hTOFbeta_P_All", "TOF beta vs. p;p_{in} (GeV/c);TOF #beta", {HistType::kTH2F, {{1000, 0.f, 10.f}, {220, 0.0, 1.1}}}}, + {"hITSobClusterSize_P_All", "mean ITSob cluster size vs. p;p_{in} (GeV/c); #times cos(#lambda)", {HistType::kTH2F, {{1000, 0.f, 10.f}, {150, 0.0, 15}}}}, + {"hTPCdEdx_P_Electron", "TPC dE/dx vs. p;p_{in} (GeV/c);TPC dE/dx", {HistType::kTH2F, {{1000, 0.f, 10.f}, {200, 0, 200}}}}, + {"hTOFbeta_P_Electron", "TOF beta vs. p;p_{in} (GeV/c);TOF #beta", {HistType::kTH2F, {{1000, 0.f, 10.f}, {220, 0.0, 1.1}}}}, + {"hITSobClusterSize_P_Electron", "mean ITSob cluster size vs. p;p_{in} (GeV/c); #times cos(#lambda)", {HistType::kTH2F, {{1000, 0.f, 10.f}, {150, 0.0, 15}}}}, + {"hTPCdEdx_P_Pion", "TPC dE/dx vs. p;p_{in} (GeV/c);TPC dE/dx", {HistType::kTH2F, {{1000, 0.f, 10.f}, {200, 0, 200}}}}, + {"hTOFbeta_P_Pion", "TOF beta vs. p;p_{in} (GeV/c);TOF #beta", {HistType::kTH2F, {{1000, 0.f, 10.f}, {220, 0.0, 1.1}}}}, + {"hITSobClusterSize_P_Pion", "mean ITSob cluster size vs. p;p_{in} (GeV/c); #times cos(#lambda)", {HistType::kTH2F, {{1000, 0.f, 10.f}, {150, 0.0, 15}}}}, + {"hTPCdEdx_P_Kaon", "TPC dE/dx vs. p;p_{in} (GeV/c);TPC dE/dx", {HistType::kTH2F, {{1000, 0.f, 10.f}, {200, 0, 200}}}}, + {"hTOFbeta_P_Kaon", "TOF beta vs. p;p_{in} (GeV/c);TOF #beta", {HistType::kTH2F, {{1000, 0.f, 10.f}, {220, 0.0, 1.1}}}}, + {"hITSobClusterSize_P_Kaon", "mean ITSob cluster size vs. p;p_{in} (GeV/c); #times cos(#lambda)", {HistType::kTH2F, {{1000, 0.f, 10.f}, {150, 0.0, 15}}}}, + {"hTPCdEdx_P_Proton", "TPC dE/dx vs. p;p_{in} (GeV/c);TPC dE/dx", {HistType::kTH2F, {{1000, 0.f, 10.f}, {200, 0, 200}}}}, + {"hTOFbeta_P_Proton", "TOF beta vs. p;p_{in} (GeV/c);TOF #beta", {HistType::kTH2F, {{1000, 0.f, 10.f}, {220, 0.0, 1.1}}}}, + {"hITSobClusterSize_P_Proton", "mean ITSob cluster size vs. p;p_{in} (GeV/c); #times cos(#lambda)", {HistType::kTH2F, {{1000, 0.f, 10.f}, {150, 0.0, 15}}}}, + + {"hTPCNsigmaEl_P", "TPC n#sigma_{e} vs. p;p_{in} (GeV/c);n #sigma_{e}^{TPC}", {HistType::kTH2F, {{1000, 0.f, 10.f}, {100, -5, +5}}}}, + {"hTPCNsigmaPi_P", "TPC n#sigma_{#pi} vs. p;p_{in} (GeV/c);n #sigma_{#pi}^{TPC}", {HistType::kTH2F, {{1000, 0.f, 10.f}, {100, -5, +5}}}}, + {"hTPCNsigmaKa_P", "TPC n#sigma_{K} vs. p;p_{in} (GeV/c);n #sigma_{K}^{TPC}", {HistType::kTH2F, {{1000, 0.f, 10.f}, {100, -5, +5}}}}, + {"hTPCNsigmaPr_P", "TPC n#sigma_{p} vs. p;p_{in} (GeV/c);n #sigma_{p}^{TPC}", {HistType::kTH2F, {{1000, 0.f, 10.f}, {100, -5, +5}}}}, + {"hTOFNsigmaEl_P", "TOF n#sigma_{e} vs. p;p_{in} (GeV/c);n #sigma_{e}^{TOF}", {HistType::kTH2F, {{1000, 0.f, 10.f}, {100, -5, +5}}}}, + {"hTOFNsigmaPi_P", "TOF n#sigma_{#pi} vs. p;p_{in} (GeV/c);n #sigma_{#pi}^{TOF}", {HistType::kTH2F, {{1000, 0.f, 10.f}, {100, -5, +5}}}}, + {"hTOFNsigmaKa_P", "TOF n#sigma_{K} vs. p;p_{in} (GeV/c);n #sigma_{K}^{TOF}", {HistType::kTH2F, {{1000, 0.f, 10.f}, {100, -5, +5}}}}, + {"hTOFNsigmaPr_P", "TOF n#sigma_{p} vs. p;p_{in} (GeV/c);n #sigma_{p}^{TOF}", {HistType::kTH2F, {{1000, 0.f, 10.f}, {100, -5, +5}}}}, }, }; void processQC(aod::EMTracksForMLPID const& tracks) { for (const auto& track : tracks) { - registry.fill(HIST("hTPCdEdx_P_All"), track.p(), track.tpcSignal()); - registry.fill(HIST("hTOFbeta_P_All"), track.p(), track.beta()); - registry.fill(HIST("hITSobClusterSize_P_All"), track.p(), track.meanClusterSizeITSob() * std::cos(std::atan(track.tgl()))); + registry.fill(HIST("hTPCdEdx_P_All"), track.tpcInnerParam(), track.tpcSignal()); + registry.fill(HIST("hTOFbeta_P_All"), track.tpcInnerParam(), track.beta()); + registry.fill(HIST("hITSobClusterSize_P_All"), track.tpcInnerParam(), track.meanClusterSizeITSob() * std::cos(std::atan(track.tgl()))); if (track.pidlabel() == static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kElectron)) { - registry.fill(HIST("hTPCdEdx_P_Electron"), track.p(), track.tpcSignal()); - registry.fill(HIST("hTOFbeta_P_Electron"), track.p(), track.beta()); - registry.fill(HIST("hITSobClusterSize_P_Electron"), track.p(), track.meanClusterSizeITSob() * std::cos(std::atan(track.tgl()))); - registry.fill(HIST("hTPCNsigmaEl_P"), track.p(), track.tpcNSigmaEl()); - registry.fill(HIST("hTOFNsigmaEl_P"), track.p(), track.tofNSigmaEl()); + registry.fill(HIST("hTPCdEdx_P_Electron"), track.tpcInnerParam(), track.tpcSignal()); + registry.fill(HIST("hTOFbeta_P_Electron"), track.tpcInnerParam(), track.beta()); + registry.fill(HIST("hITSobClusterSize_P_Electron"), track.tpcInnerParam(), track.meanClusterSizeITSob() * std::cos(std::atan(track.tgl()))); + registry.fill(HIST("hTPCNsigmaEl_P"), track.tpcInnerParam(), track.tpcNSigmaEl()); + registry.fill(HIST("hTOFNsigmaEl_P"), track.tpcInnerParam(), track.tofNSigmaEl()); } else if (track.pidlabel() == static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kPion)) { - registry.fill(HIST("hTPCdEdx_P_Pion"), track.p(), track.tpcSignal()); - registry.fill(HIST("hTOFbeta_P_Pion"), track.p(), track.beta()); - registry.fill(HIST("hITSobClusterSize_P_Pion"), track.p(), track.meanClusterSizeITSob() * std::cos(std::atan(track.tgl()))); - registry.fill(HIST("hTPCNsigmaPi_P"), track.p(), track.tpcNSigmaPi()); - registry.fill(HIST("hTOFNsigmaPi_P"), track.p(), track.tofNSigmaPi()); + registry.fill(HIST("hTPCdEdx_P_Pion"), track.tpcInnerParam(), track.tpcSignal()); + registry.fill(HIST("hTOFbeta_P_Pion"), track.tpcInnerParam(), track.beta()); + registry.fill(HIST("hITSobClusterSize_P_Pion"), track.tpcInnerParam(), track.meanClusterSizeITSob() * std::cos(std::atan(track.tgl()))); + registry.fill(HIST("hTPCNsigmaPi_P"), track.tpcInnerParam(), track.tpcNSigmaPi()); + registry.fill(HIST("hTOFNsigmaPi_P"), track.tpcInnerParam(), track.tofNSigmaPi()); } else if (track.pidlabel() == static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kKaon)) { - registry.fill(HIST("hTPCdEdx_P_Kaon"), track.p(), track.tpcSignal()); - registry.fill(HIST("hTOFbeta_P_Kaon"), track.p(), track.beta()); - registry.fill(HIST("hITSobClusterSize_P_Kaon"), track.p(), track.meanClusterSizeITSob() * std::cos(std::atan(track.tgl()))); - registry.fill(HIST("hTPCNsigmaKa_P"), track.p(), track.tpcNSigmaKa()); - registry.fill(HIST("hTOFNsigmaKa_P"), track.p(), track.tofNSigmaKa()); + registry.fill(HIST("hTPCdEdx_P_Kaon"), track.tpcInnerParam(), track.tpcSignal()); + registry.fill(HIST("hTOFbeta_P_Kaon"), track.tpcInnerParam(), track.beta()); + registry.fill(HIST("hITSobClusterSize_P_Kaon"), track.tpcInnerParam(), track.meanClusterSizeITSob() * std::cos(std::atan(track.tgl()))); + registry.fill(HIST("hTPCNsigmaKa_P"), track.tpcInnerParam(), track.tpcNSigmaKa()); + registry.fill(HIST("hTOFNsigmaKa_P"), track.tpcInnerParam(), track.tofNSigmaKa()); } else if (track.pidlabel() == static_cast(o2::aod::pwgem::dilepton::ml::PID_Label::kProton)) { - registry.fill(HIST("hTPCdEdx_P_Proton"), track.p(), track.tpcSignal()); - registry.fill(HIST("hTOFbeta_P_Proton"), track.p(), track.beta()); - registry.fill(HIST("hITSobClusterSize_P_Proton"), track.p(), track.meanClusterSizeITSob() * std::cos(std::atan(track.tgl()))); - registry.fill(HIST("hTPCNsigmaPr_P"), track.p(), track.tpcNSigmaPr()); - registry.fill(HIST("hTOFNsigmaPr_P"), track.p(), track.tofNSigmaPr()); + registry.fill(HIST("hTPCdEdx_P_Proton"), track.tpcInnerParam(), track.tpcSignal()); + registry.fill(HIST("hTOFbeta_P_Proton"), track.tpcInnerParam(), track.beta()); + registry.fill(HIST("hITSobClusterSize_P_Proton"), track.tpcInnerParam(), track.meanClusterSizeITSob() * std::cos(std::atan(track.tgl()))); + registry.fill(HIST("hTPCNsigmaPr_P"), track.tpcInnerParam(), track.tpcNSigmaPr()); + registry.fill(HIST("hTOFNsigmaPr_P"), track.tpcInnerParam(), track.tofNSigmaPr()); } } // end of track loop } From c6f21f9c71b1570f5f588f77179fc9c0b767640e Mon Sep 17 00:00:00 2001 From: abmodak <67369858+abmodak@users.noreply.github.com> Date: Tue, 12 Aug 2025 03:03:23 +0200 Subject: [PATCH 340/345] [PWGLF] Add FV0A-based centrality estimator (#12534) --- .../Tasks/GlobalEventProperties/heavyionMultiplicity.cxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/PWGLF/Tasks/GlobalEventProperties/heavyionMultiplicity.cxx b/PWGLF/Tasks/GlobalEventProperties/heavyionMultiplicity.cxx index 3d0e34adb1c..4d730fab40d 100644 --- a/PWGLF/Tasks/GlobalEventProperties/heavyionMultiplicity.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/heavyionMultiplicity.cxx @@ -48,13 +48,13 @@ using namespace o2::framework::expressions; using namespace o2::aod::track; using namespace o2::aod::evsel; -using CollisionDataTable = soa::Join; +using CollisionDataTable = soa::Join; using ColDataTablepp = soa::Join; using TrackDataTable = soa::Join; using FilTrackDataTable = soa::Filtered; using CollisionMCTrueTable = aod::McCollisions; using TrackMCTrueTable = aod::McParticles; -using CollisionMCRecTable = soa::SmallGroups>; +using CollisionMCRecTable = soa::SmallGroups>; using ColMCRecTablepp = soa::SmallGroups>; using TrackMCRecTable = soa::Join; using FilTrackMCRecTable = soa::Filtered; @@ -160,6 +160,7 @@ struct HeavyionMultiplicity { Configurable isApplyNoHighMultCollInPrevRof{"isApplyNoHighMultCollInPrevRof", false, "Enable NoHighMultCollInPrevRof cut"}; Configurable isApplyFT0CbasedOccupancy{"isApplyFT0CbasedOccupancy", false, "Enable FT0CbasedOccupancy cut"}; Configurable isApplyCentFT0C{"isApplyCentFT0C", true, "Centrality based on FT0C"}; + Configurable isApplyCentFV0A{"isApplyCentFV0A", false, "Centrality based on FV0A"}; Configurable isApplyCentFT0CVariant1{"isApplyCentFT0CVariant1", false, "Centrality based on FT0C variant1"}; Configurable isApplyCentFT0M{"isApplyCentFT0M", false, "Centrality based on FT0A + FT0C"}; Configurable isApplyCentNGlobal{"isApplyCentNGlobal", false, "Centrality based on global tracks"}; @@ -318,6 +319,9 @@ struct HeavyionMultiplicity { if (isApplyCentFT0C) { cent = col.centFT0C(); } + if (isApplyCentFV0A) { + cent = col.centFV0A(); + } if (isApplyCentFT0CVariant1) { cent = col.centFT0CVariant1(); } From 499a0d778671035343d4366ade57c32b72e51b33 Mon Sep 17 00:00:00 2001 From: Maximiliano Puccio Date: Tue, 12 Aug 2025 05:04:08 +0200 Subject: [PATCH 341/345] [Trigger] Change base CCDB path to common directory (#12535) --- EventFiltering/Zorro.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EventFiltering/Zorro.h b/EventFiltering/Zorro.h index f03badab2ce..8cab70192c5 100644 --- a/EventFiltering/Zorro.h +++ b/EventFiltering/Zorro.h @@ -74,7 +74,7 @@ class Zorro ZorroSummary mZorroSummary{"ZorroSummary", "ZorroSummary"}; - std::string mBaseCCDBPath = "Users/m/mpuccio/EventFiltering/OTS/Chunked/"; + std::string mBaseCCDBPath = "EventFiltering/Zorro/"; int mRunNumber = 0; std::pair mRunDuration; int64_t mOrbitResetTimestamp = 0; From 0fd4ca22e59950278508c552631668139c559cb6 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Tue, 12 Aug 2025 07:42:47 +0200 Subject: [PATCH 342/345] [Common] Add hepMC info to extras table task (#12536) --- Common/TableProducer/multiplicityExtraTable.cxx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Common/TableProducer/multiplicityExtraTable.cxx b/Common/TableProducer/multiplicityExtraTable.cxx index 001e75e6adb..5b0840e5f2d 100644 --- a/Common/TableProducer/multiplicityExtraTable.cxx +++ b/Common/TableProducer/multiplicityExtraTable.cxx @@ -36,6 +36,9 @@ struct MultiplicityExtraTable { Produces mult2bc; Produces bc2mult; + // auxiliary for MC + Produces multHepMCHIs; + // Allow for downscaling of BC table for less space use in derived data Configurable bcDownscaleFactor{"bcDownscaleFactor", 2, "Downscale factor for BC table (0: save nothing, 1: save all)"}; Configurable minFT0CforBCTable{"minFT0CforBCTable", 25.0f, "Minimum FT0C amplitude to fill BC table to reduce data"}; @@ -277,9 +280,22 @@ struct MultiplicityExtraTable { } } + void processHepMCHeavyIons(aod::HepMCHeavyIons const& hepmchis) + { + for (auto const& hepmchi : hepmchis) { + multHepMCHIs(hepmchi.mcCollisionId(), + hepmchi.ncollHard(), + hepmchi.npartProj(), + hepmchi.npartTarg(), + hepmchi.ncoll(), + hepmchi.impactParameter()); + } + } + // Process switches PROCESS_SWITCH(MultiplicityExtraTable, processBCs, "Produce BC tables", true); PROCESS_SWITCH(MultiplicityExtraTable, processCollisionNeighbors, "Produce neighbor timing tables", true); + PROCESS_SWITCH(MultiplicityExtraTable, processHepMCHeavyIons, "Produce MultHepMCHIs tables", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 38ab0905a092f5c40b3e5f905ccd0289ab302502 Mon Sep 17 00:00:00 2001 From: abmodak <67369858+abmodak@users.noreply.github.com> Date: Tue, 12 Aug 2025 08:09:53 +0200 Subject: [PATCH 343/345] [PWGLF] Add INEl>0 event selection condition (#12542) --- .../heavyionMultiplicity.cxx | 210 ++++++++---------- 1 file changed, 96 insertions(+), 114 deletions(-) diff --git a/PWGLF/Tasks/GlobalEventProperties/heavyionMultiplicity.cxx b/PWGLF/Tasks/GlobalEventProperties/heavyionMultiplicity.cxx index 4d730fab40d..6637d6f2dcd 100644 --- a/PWGLF/Tasks/GlobalEventProperties/heavyionMultiplicity.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/heavyionMultiplicity.cxx @@ -48,14 +48,14 @@ using namespace o2::framework::expressions; using namespace o2::aod::track; using namespace o2::aod::evsel; -using CollisionDataTable = soa::Join; -using ColDataTablepp = soa::Join; +using CollisionDataTable = soa::Join; +using ColDataTablepp = soa::Join; using TrackDataTable = soa::Join; using FilTrackDataTable = soa::Filtered; using CollisionMCTrueTable = aod::McCollisions; using TrackMCTrueTable = aod::McParticles; -using CollisionMCRecTable = soa::SmallGroups>; -using ColMCRecTablepp = soa::SmallGroups>; +using CollisionMCRecTable = soa::SmallGroups>; +using ColMCRecTablepp = soa::SmallGroups>; using TrackMCRecTable = soa::Join; using FilTrackMCRecTable = soa::Filtered; using V0TrackCandidates = soa::Join; @@ -115,7 +115,6 @@ AxisSpec axisMassLambda = {200, 1.07, 1.17, "Lambda/AntiLamda Mass", "Lambda/Ant AxisSpec axisTracks{9, 0.5, 9.5, "#tracks", "TrackAxis"}; auto static constexpr kMinCharge = 3.f; auto static constexpr kMinpTcut = 0.1f; -auto static constexpr kEtaInelgt0 = 1.0f; auto static constexpr kNItslayers = 7; struct HeavyionMultiplicity { @@ -166,6 +165,7 @@ struct HeavyionMultiplicity { Configurable isApplyCentNGlobal{"isApplyCentNGlobal", false, "Centrality based on global tracks"}; Configurable isApplyCentMFT{"isApplyCentMFT", false, "Centrality based on MFT tracks"}; Configurable isApplySplitRecCol{"isApplySplitRecCol", false, "Split MC reco collisions"}; + Configurable isApplyInelgt0{"isApplyInelgt0", false, "Enable INEL > 0 condition"}; void init(InitContext const&) { @@ -192,6 +192,7 @@ struct HeavyionMultiplicity { x->SetBinLabel(6, "ApplyNoCollInTimeRangeStandard"); x->SetBinLabel(7, "ApplyNoCollInRofStandard"); x->SetBinLabel(8, "ApplyNoHighMultCollInPrevRof"); + x->SetBinLabel(9, "INEL > 0"); if (doprocessData) { histos.add("CentPercentileHist", "CentPercentileHist", kTH1D, {axisCent}, false); @@ -309,6 +310,11 @@ struct HeavyionMultiplicity { return false; } histos.fill(HIST("EventHist"), 8); + + if (isApplyInelgt0 && !col.isInelGt0()) { + return false; + } + histos.fill(HIST("EventHist"), 9); return true; } @@ -673,41 +679,31 @@ struct HeavyionMultiplicity { return; } - // INEL>0 sample - auto nTrks = 0; + histos.fill(HIST("VtxZHist"), cols.posZ()); + histos.fill(HIST("MultPercentileHist"), cols.centFT0M()); + histos.fill(HIST("hdatazvtxmultpp"), cols.posZ(), cols.centFT0M()); + for (const auto& track : tracks) { if (!isTrackSelected(track)) { continue; } - if (track.eta() < kEtaInelgt0) { - nTrks++; + histos.fill(HIST("PhiVsEtaHistpp"), track.phi(), track.eta()); + histos.fill(HIST("hdatadndetapp"), cols.posZ(), cols.centFT0M(), track.eta(), track.phi(), kGlobalplusITS); + if (track.hasTPC()) { + histos.fill(HIST("hdatadndetapp"), cols.posZ(), cols.centFT0M(), track.eta(), track.phi(), kGlobalonly); + } else { + histos.fill(HIST("hdatadndetapp"), cols.posZ(), cols.centFT0M(), track.eta(), track.phi(), kITSonly); } } // track loop - - if (nTrks > 0) { - histos.fill(HIST("EventHist"), 9); - histos.fill(HIST("VtxZHist"), cols.posZ()); - histos.fill(HIST("MultPercentileHist"), cols.centFT0M()); - histos.fill(HIST("hdatazvtxmultpp"), cols.posZ(), cols.centFT0M()); - - for (const auto& track : tracks) { - if (!isTrackSelected(track)) { - continue; - } - histos.fill(HIST("PhiVsEtaHistpp"), track.phi(), track.eta()); - histos.fill(HIST("hdatadndetapp"), cols.posZ(), cols.centFT0M(), track.eta(), track.phi(), kGlobalplusITS); - if (track.hasTPC()) { - histos.fill(HIST("hdatadndetapp"), cols.posZ(), cols.centFT0M(), track.eta(), track.phi(), kGlobalonly); - } else { - histos.fill(HIST("hdatadndetapp"), cols.posZ(), cols.centFT0M(), track.eta(), track.phi(), kITSonly); - } - } // track loop - } // nTrks>0 } PROCESS_SWITCH(HeavyionMultiplicity, processppData, "process pp data", false); void processppMonteCarlo(CollisionMCTrueTable::iterator const&, ColMCRecTablepp const& RecCols, TrackMCTrueTable const& GenParticles, FilTrackMCRecTable const& RecTracks) { + if (isApplySplitRecCol && (RecCols.size() == 0 || RecCols.size() > 1)) { + return; + } + for (const auto& RecCol : RecCols) { if (!isEventSelected(RecCol)) { continue; @@ -715,103 +711,89 @@ struct HeavyionMultiplicity { auto recTracksPart = RecTracks.sliceBy(perCollision, RecCol.globalIndex()); std::vector mclabels; - // INEL>0 sample - auto nTrks = 0; + histos.fill(HIST("VtxZHist"), RecCol.posZ()); + histos.fill(HIST("MultPercentileMCRecHist"), RecCol.centFT0M()); + histos.fill(HIST("hmczvtxmultpp"), RecCol.posZ(), RecCol.centFT0M()); + for (const auto& Rectrack : recTracksPart) { if (!isTrackSelected(Rectrack)) { continue; } - if (Rectrack.eta() < kEtaInelgt0) { - nTrks++; + histos.fill(HIST("MCrecPhiVsEtaHistpp"), Rectrack.phi(), Rectrack.eta()); + histos.fill(HIST("hmcrecdndetapp"), RecCol.posZ(), RecCol.centFT0M(), Rectrack.eta(), Rectrack.phi(), static_cast(kSpAll), kGlobalplusITS); + if (Rectrack.hasTPC()) { + histos.fill(HIST("hmcrecdndetapp"), RecCol.posZ(), RecCol.centFT0M(), Rectrack.eta(), Rectrack.phi(), static_cast(kSpAll), kGlobalonly); + } else { + histos.fill(HIST("hmcrecdndetapp"), RecCol.posZ(), RecCol.centFT0M(), Rectrack.eta(), Rectrack.phi(), static_cast(kSpAll), kITSonly); } - } - if (nTrks > 0) { - histos.fill(HIST("EventHist"), 9); - histos.fill(HIST("VtxZHist"), RecCol.posZ()); - histos.fill(HIST("MultPercentileMCRecHist"), RecCol.centFT0M()); - histos.fill(HIST("hmczvtxmultpp"), RecCol.posZ(), RecCol.centFT0M()); - - for (const auto& Rectrack : recTracksPart) { - if (!isTrackSelected(Rectrack)) { - continue; - } - histos.fill(HIST("MCrecPhiVsEtaHistpp"), Rectrack.phi(), Rectrack.eta()); - histos.fill(HIST("hmcrecdndetapp"), RecCol.posZ(), RecCol.centFT0M(), Rectrack.eta(), Rectrack.phi(), static_cast(kSpAll), kGlobalplusITS); - if (Rectrack.hasTPC()) { - histos.fill(HIST("hmcrecdndetapp"), RecCol.posZ(), RecCol.centFT0M(), Rectrack.eta(), Rectrack.phi(), static_cast(kSpAll), kGlobalonly); - } else { - histos.fill(HIST("hmcrecdndetapp"), RecCol.posZ(), RecCol.centFT0M(), Rectrack.eta(), Rectrack.phi(), static_cast(kSpAll), kITSonly); - } - - if (Rectrack.has_mcParticle()) { - int pid = kBkg; - auto mcpart = Rectrack.template mcParticle_as(); - if (mcpart.isPhysicalPrimary()) { - switch (std::abs(mcpart.pdgCode())) { - case PDG_t::kPiPlus: - pid = kSpPion; - break; - case PDG_t::kKPlus: - pid = kSpKaon; - break; - case PDG_t::kProton: - pid = kSpProton; - break; - default: - pid = kSpOther; - break; - } - } else { - pid = kSpNotPrimary; - } - if (mcpart.has_mothers()) { - auto mcpartMother = mcpart.template mothers_as().front(); - if (mcpartMother.pdgCode() == PDG_t::kK0Short || std::abs(mcpartMother.pdgCode()) == PDG_t::kLambda0) { - pid = kSpStrangeDecay; - } - } - if (find(mclabels.begin(), mclabels.end(), Rectrack.mcParticleId()) != mclabels.end()) { - pid = kBkg; + if (Rectrack.has_mcParticle()) { + int pid = kBkg; + auto mcpart = Rectrack.template mcParticle_as(); + if (mcpart.isPhysicalPrimary()) { + switch (std::abs(mcpart.pdgCode())) { + case PDG_t::kPiPlus: + pid = kSpPion; + break; + case PDG_t::kKPlus: + pid = kSpKaon; + break; + case PDG_t::kProton: + pid = kSpProton; + break; + default: + pid = kSpOther; + break; } - mclabels.push_back(Rectrack.mcParticleId()); - histos.fill(HIST("hmcrecdndetapp"), RecCol.posZ(), RecCol.centFT0M(), Rectrack.eta(), Rectrack.phi(), static_cast(pid), kGlobalplusITS); } else { - histos.fill(HIST("hmcrecdndetapp"), RecCol.posZ(), RecCol.centFT0M(), Rectrack.eta(), Rectrack.phi(), static_cast(kBkg), kGlobalplusITS); + pid = kSpNotPrimary; } - } // track (mcrec) loop - - for (const auto& particle : GenParticles) { - if (!isGenTrackSelected(particle)) { - continue; + if (mcpart.has_mothers()) { + auto mcpartMother = mcpart.template mothers_as().front(); + if (mcpartMother.pdgCode() == PDG_t::kK0Short || std::abs(mcpartMother.pdgCode()) == PDG_t::kLambda0) { + pid = kSpStrangeDecay; + } } - histos.fill(HIST("hmcgendndetapp"), RecCol.posZ(), RecCol.centFT0M(), particle.eta(), particle.phi(), static_cast(kSpAll), kNoGenpTVar); - if (particle.pt() < kMinpTcut) { - histos.fill(HIST("hmcgendndetapp"), RecCol.posZ(), RecCol.centFT0M(), particle.eta(), particle.phi(), static_cast(kSpAll), kGenpTup, -10.0 * particle.pt() + 2); - histos.fill(HIST("hmcgendndetapp"), RecCol.posZ(), RecCol.centFT0M(), particle.eta(), particle.phi(), static_cast(kSpAll), kGenpTdown, 5.0 * particle.pt() + 0.5); - } else { - histos.fill(HIST("hmcgendndetapp"), RecCol.posZ(), RecCol.centFT0M(), particle.eta(), particle.phi(), static_cast(kSpAll), kGenpTup); - histos.fill(HIST("hmcgendndetapp"), RecCol.posZ(), RecCol.centFT0M(), particle.eta(), particle.phi(), static_cast(kSpAll), kGenpTdown); + if (find(mclabels.begin(), mclabels.end(), Rectrack.mcParticleId()) != mclabels.end()) { + pid = kBkg; } + mclabels.push_back(Rectrack.mcParticleId()); + histos.fill(HIST("hmcrecdndetapp"), RecCol.posZ(), RecCol.centFT0M(), Rectrack.eta(), Rectrack.phi(), static_cast(pid), kGlobalplusITS); + } else { + histos.fill(HIST("hmcrecdndetapp"), RecCol.posZ(), RecCol.centFT0M(), Rectrack.eta(), Rectrack.phi(), static_cast(kBkg), kGlobalplusITS); + } + } // track (mcrec) loop - int pid = 0; - switch (std::abs(particle.pdgCode())) { - case PDG_t::kPiPlus: - pid = kSpPion; - break; - case PDG_t::kKPlus: - pid = kSpKaon; - break; - case PDG_t::kProton: - pid = kSpProton; - break; - default: - pid = kSpOther; - break; - } - histos.fill(HIST("hmcgendndetapp"), RecCol.posZ(), RecCol.centFT0M(), particle.eta(), particle.phi(), static_cast(pid), kNoGenpTVar); - } // track (mcgen) loop - } // nTrks>0 + for (const auto& particle : GenParticles) { + if (!isGenTrackSelected(particle)) { + continue; + } + histos.fill(HIST("hmcgendndetapp"), RecCol.posZ(), RecCol.centFT0M(), particle.eta(), particle.phi(), static_cast(kSpAll), kNoGenpTVar); + if (particle.pt() < kMinpTcut) { + histos.fill(HIST("hmcgendndetapp"), RecCol.posZ(), RecCol.centFT0M(), particle.eta(), particle.phi(), static_cast(kSpAll), kGenpTup, -10.0 * particle.pt() + 2); + histos.fill(HIST("hmcgendndetapp"), RecCol.posZ(), RecCol.centFT0M(), particle.eta(), particle.phi(), static_cast(kSpAll), kGenpTdown, 5.0 * particle.pt() + 0.5); + } else { + histos.fill(HIST("hmcgendndetapp"), RecCol.posZ(), RecCol.centFT0M(), particle.eta(), particle.phi(), static_cast(kSpAll), kGenpTup); + histos.fill(HIST("hmcgendndetapp"), RecCol.posZ(), RecCol.centFT0M(), particle.eta(), particle.phi(), static_cast(kSpAll), kGenpTdown); + } + + int pid = 0; + switch (std::abs(particle.pdgCode())) { + case PDG_t::kPiPlus: + pid = kSpPion; + break; + case PDG_t::kKPlus: + pid = kSpKaon; + break; + case PDG_t::kProton: + pid = kSpProton; + break; + default: + pid = kSpOther; + break; + } + histos.fill(HIST("hmcgendndetapp"), RecCol.posZ(), RecCol.centFT0M(), particle.eta(), particle.phi(), static_cast(pid), kNoGenpTVar); + } // track (mcgen) loop } // collision loop } PROCESS_SWITCH(HeavyionMultiplicity, processppMonteCarlo, "process pp MC", false); From 5dca4c1811dd899bb447285f09d0a451c796b259 Mon Sep 17 00:00:00 2001 From: SuJeong Ji <120470463+SuJeong-Ji@users.noreply.github.com> Date: Tue, 12 Aug 2025 17:03:48 +0900 Subject: [PATCH 344/345] [PWGLF] Added invariant mass histogram of K0s (#12515) Co-authored-by: ALICE Action Bot --- PWGLF/Tasks/Resonances/chk892pp.cxx | 116 +++++++++++++++------------- 1 file changed, 61 insertions(+), 55 deletions(-) diff --git a/PWGLF/Tasks/Resonances/chk892pp.cxx b/PWGLF/Tasks/Resonances/chk892pp.cxx index 72ecdce733e..419a8ea69b6 100644 --- a/PWGLF/Tasks/Resonances/chk892pp.cxx +++ b/PWGLF/Tasks/Resonances/chk892pp.cxx @@ -15,66 +15,60 @@ /// /// \author Su-Jeong Ji -#include -#include #include +#include +#include +#include +#include #include -#include #include #include -#include -#include // #include // FIXME -#include // FIXME - -#include -#include -#include -#include -#include -#include +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGLF/Utils/collisionCuts.h" -#include "TRandom3.h" -#include "TF1.h" -#include "TVector2.h" -#include "Math/Vector3D.h" -#include "Math/Vector4D.h" -#include "Math/GenVector/Boost.h" -#include +#include "Common/Core/RecoDecay.h" +#include "Common/Core/TrackSelection.h" +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" +#include "CCDB/BasicCCDBManager.h" +#include "CCDB/CcdbApi.h" +#include "CommonConstants/MathConstants.h" +#include "CommonConstants/PhysicsConstants.h" +#include "DCAFitter/DCAFitterN.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "DataFormatsParameters/GRPObject.h" +#include "Framework/ASoAHelpers.h" #include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" -#include "Framework/StepTHn.h" #include "Framework/O2DatabasePDGPlugin.h" -#include "Framework/ASoAHelpers.h" #include "Framework/StaticFor.h" -#include "DCAFitter/DCAFitterN.h" - -#include "Common/DataModel/PIDResponse.h" -#include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/Centrality.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/EventSelection.h" - -#include "Common/Core/trackUtilities.h" -#include "Common/Core/TrackSelection.h" -#include "Common/Core/RecoDecay.h" - -#include "CommonConstants/PhysicsConstants.h" -#include "CommonConstants/MathConstants.h" - +#include "Framework/StepTHn.h" +#include "Framework/runDataProcessing.h" #include "ReconstructionDataFormats/Track.h" -#include "DataFormatsParameters/GRPObject.h" -#include "DataFormatsParameters/GRPMagField.h" - -#include "CCDB/CcdbApi.h" -#include "CCDB/BasicCCDBManager.h" +#include "Math/GenVector/Boost.h" +#include "Math/RotationZ.h" +#include "Math/Vector3D.h" +#include "Math/Vector4D.h" +#include "TF1.h" +#include "TRandom3.h" +#include "TVector2.h" +#include +#include // FIXME -#include "PWGLF/DataModel/LFStrangenessTables.h" -#include "PWGLF/Utils/collisionCuts.h" +#include +#include +#include +#include +#include +#include using namespace o2; using namespace o2::framework; @@ -105,6 +99,7 @@ struct Chk892pp { using MCEventCandidates = soa::Join; using MCTrackCandidates = soa::Join; using MCV0Candidates = soa::Join; + using LorentzVectorSetXYZM = ROOT::Math::LorentzVector>; HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -159,7 +154,7 @@ struct Chk892pp { Configurable cfgMinOccupancy{"cfgMinOccupancy", -100, "maximum occupancy of tracks in neighbouring collisions in a given time range"}; Configurable cfgNCollinTR{"cfgNCollinTR", false, "Additional selection for the number of coll in time range"}; */ - Configurable cfgCentEst{"cfgCentEst", 1, "Centrality estimator, 1: FT0C, 2: FT0M"}; + Configurable cfgCentEst{"cfgCentEst", 2, "Centrality estimator, 1: FT0C, 2: FT0M"}; /// PID Selections, pion struct : ConfigurableGroup { @@ -368,6 +363,7 @@ struct Chk892pp { histos.add("QA/before/KstarRapidity", "Rapidity distribution of chK(892)", HistType::kTH1D, {yAxis}); histos.add("hInvmass_Kstar", "Invariant mass of unlike-sign chK(892)", HistType::kTHnSparseD, {axisType, centAxis, ptAxis, invMassAxisReso}); histos.add("hInvmass_Kstar_Mix", "Invariant mass of unlike-sign chK(892) from mixed event", HistType::kTHnSparseD, {axisType, centAxis, ptAxis, invMassAxisReso}); + histos.add("hInvmass_K0s", "Invariant mass of unlike-sign K0s", HistType::kTHnSparseD, {centAxis, ptAxis, invMassAxisK0s}); // Mass QA (quick check) histos.add("QA/before/kstarinvmass", "Invariant mass of unlike-sign chK(892)", HistType::kTH1D, {invMassAxisReso}); @@ -441,15 +437,19 @@ struct Chk892pp { histos.print(); } + const int kCentFT0C = 1; + const int kCentFT0M = 2; + const float kInvalidCentrality = -999.f; + template float getCentrality(CollisionType const& collision) { - if (cfgCentEst == 1) { + if (cfgCentEst == kCentFT0C) { return collision.multFT0C(); - } else if (cfgCentEst == 2) { + } else if (cfgCentEst == kCentFT0M) { return collision.multFT0M(); } else { - return -999; + return kInvalidCentrality; } } @@ -696,7 +696,7 @@ struct Chk892pp { { histos.fill(HIST("QA/before/CentDist"), lCentrality); - TLorentzVector lDecayDaughter1, lDecayDaughter2, lResoSecondary, lDecayDaughter_bach, lResoKstar, lDaughterRot, lResonanceRot; + LorentzVectorSetXYZM lDecayDaughter1, lDecayDaughter2, lResoSecondary, lDecayDaughter_bach, lResoKstar, lDaughterRot, lResonanceRot; std::vector trackIndicies = {}; std::vector k0sIndicies = {}; @@ -848,8 +848,8 @@ struct Chk892pp { auto k0sCand = dTracks2.rawIteratorAt(k0sIndex); auto trkkMass = k0sCand.mK0Short(); - lDecayDaughter_bach.SetXYZM(bTrack.px(), bTrack.py(), bTrack.pz(), MassPionCharged); - lResoSecondary.SetXYZM(k0sCand.px(), k0sCand.py(), k0sCand.pz(), trkkMass); + lDecayDaughter_bach = LorentzVectorSetXYZM(bTrack.px(), bTrack.py(), bTrack.pz(), MassPionCharged); + lResoSecondary = LorentzVectorSetXYZM(k0sCand.px(), k0sCand.py(), k0sCand.pz(), trkkMass); lResoKstar = lResoSecondary + lDecayDaughter_bach; // QA plots @@ -874,11 +874,17 @@ struct Chk892pp { histos.fill(HIST("QA/RotBkg/hRotBkg"), lRotAngle); if (BkgEstimationConfig.cfgRotPion) { lDaughterRot = lDecayDaughter_bach; - lDaughterRot.RotateZ(lRotAngle); + // lDaughterRot.RotateZ(lRotAngle); + ROOT::Math::RotationZ rot(lRotAngle); + auto p3 = rot * lDaughterRot.Vect(); + lDaughterRot = LorentzVectorSetXYZM(p3.X(), p3.Y(), p3.Z(), lDaughterRot.M()); lResonanceRot = lDaughterRot + lResoSecondary; } else { lDaughterRot = lResoSecondary; - lDaughterRot.RotateZ(lRotAngle); + // lDaughterRot.RotateZ(lRotAngle); + ROOT::Math::RotationZ rot(lRotAngle); + auto p3 = rot * lDaughterRot.Vect(); + lDaughterRot = LorentzVectorSetXYZM(p3.X(), p3.Y(), p3.Z(), lDaughterRot.M()); lResonanceRot = lDecayDaughter_bach + lDaughterRot; } typeKstar = bTrack.sign() > 0 ? BinType::kKstarP_Rot : BinType::kKstarN_Rot; From 87e005bb5d6dd9a01a2d3f89a846e33141e861c2 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Tue, 12 Aug 2025 08:39:59 +0000 Subject: [PATCH 345/345] Please consider the following formatting changes --- PWGLF/DataModel/LFSlimHeLambda.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGLF/DataModel/LFSlimHeLambda.h b/PWGLF/DataModel/LFSlimHeLambda.h index 8745ac1838a..3ec606d6cb8 100644 --- a/PWGLF/DataModel/LFSlimHeLambda.h +++ b/PWGLF/DataModel/LFSlimHeLambda.h @@ -82,7 +82,7 @@ struct lambdaCandidate { float v0Radius = -1.f; // V0 radius float protonNSigmaTPC = -999.f; // Proton TPC nSigma float pionNSigmaTPC = -999.f; // Pion TPC nSigma - int8_t sign = 0; // Charge sign of the Lambda candidate + int8_t sign = 0; // Charge sign of the Lambda candidate }; #endif // PWGLF_DATAMODEL_LFSLIMNUCLEITABLES_H_