From e48c0609f2f0337afac8d208a2bfbcfa3d80a0a2 Mon Sep 17 00:00:00 2001 From: David Dobrigkeit Chinellato Date: Thu, 13 Apr 2023 06:11:32 -0300 Subject: [PATCH 1/5] Correlation work --- PWGLF/DataModel/LFHStrangeCorrelationTables.h | 28 +- PWGLF/DataModel/LFStrangenessTables.h | 28 +- .../hStrangeCorrelationFilter.cxx | 7 +- PWGLF/Tasks/hStrangeCorrelation.cxx | 361 +++++++----------- 4 files changed, 198 insertions(+), 226 deletions(-) diff --git a/PWGLF/DataModel/LFHStrangeCorrelationTables.h b/PWGLF/DataModel/LFHStrangeCorrelationTables.h index d6c6933f08b..265c372f65b 100644 --- a/PWGLF/DataModel/LFHStrangeCorrelationTables.h +++ b/PWGLF/DataModel/LFHStrangeCorrelationTables.h @@ -14,8 +14,11 @@ /// Trigger particle : Hadrons /// Associated Particles : V0s or Cascades /// -/// \author Kai Cui -/// \since +/// \author Kai Cui (kaicui@mails.ccnu.edu.cn) +/// \author Lucia Anna Tarasovicova (lucia.anna.husova@cern.ch) +/// \author David Dobrigkeit Chinellato (david.dobrigkeit.chinellato@cern.ch) +/// \author Zhongbao Yin (Zhong-Bao.Yin@cern.ch) + #ifndef O2_ANALYSIS_HSTRANGECORRELATIONTABLES_H_ #define O2_ANALYSIS_HSTRANGECORRELATIONTABLES_H_ @@ -43,12 +46,20 @@ DECLARE_SOA_INDEX_COLUMN(V0Data, v0Data); //! DECLARE_SOA_COLUMN(CompatibleK0Short, compatibleK0Short, bool); // compatible with K0Short DECLARE_SOA_COLUMN(CompatibleLambda, compatibleLambda, bool); // compatible with Lambda DECLARE_SOA_COLUMN(CompatibleAntiLambda, compatibleAntiLambda, bool); // compatible with AntiLambda +DECLARE_SOA_DYNAMIC_COLUMN(Compatible, compatible, //! check compatibility with a hypothesis of a certain number (0 - K0, 1 - L, 2 - Lbar) + [](bool cK0Short, bool cLambda, bool cAntiLambda, int value) -> bool { + if(value==0 && cK0Short) return true; + if(value==1 && cLambda) return true; + if(value==2 && cAntiLambda) return true; + return false; + }); } // namespace assocV0s DECLARE_SOA_TABLE(AssocV0s, "AOD", "ASSOCV0S", o2::soa::Index<>, assocV0s::CollisionId, assocV0s::V0DataId, assocV0s::CompatibleK0Short, assocV0s::CompatibleLambda, - assocV0s::CompatibleAntiLambda); + assocV0s::CompatibleAntiLambda, + assocV0s::Compatible); /// _________________________________________ /// Table for storing associated casc indices namespace assocCascades @@ -59,12 +70,21 @@ DECLARE_SOA_COLUMN(CompatibleXiMinus, compatibleXiMinus, bool); // compati DECLARE_SOA_COLUMN(CompatibleXiPlus, compatibleXiPlus, bool); // compatible with XiPlus DECLARE_SOA_COLUMN(CompatibleOmegaMinus, compatibleOmegaMinus, bool); // compatible with OmegaMinus DECLARE_SOA_COLUMN(CompatibleOmegaPlus, compatibleOmegaPlus, bool); // compatible with OmegaPlus +DECLARE_SOA_DYNAMIC_COLUMN(Compatible, compatible, //! check compatibility with a hypothesis of a certain number (0 - K0, 1 - L, 2 - Lbar) + [](bool cXiMinus, bool cXiPlus, bool cOmegaMinus, bool cOmegaPlus, int value) -> bool { + if(value==0 && cXiMinus) return true; + if(value==1 && cXiPlus) return true; + if(value==2 && cOmegaMinus) return true; + if(value==3 && cOmegaPlus) return true; + return false; + }); } // namespace assocCascades DECLARE_SOA_TABLE(AssocCascades, "AOD", "ASSOCCASCADES", o2::soa::Index<>, assocCascades::CollisionId, assocCascades::CascDataId, assocCascades::CompatibleXiMinus, assocCascades::CompatibleXiPlus, assocCascades::CompatibleOmegaMinus, - assocCascades::CompatibleOmegaPlus); + assocCascades::CompatibleOmegaPlus, + assocCascades::Compatible); } // namespace o2::aod #endif // O2_ANALYSIS_HSTRANGECORRELATIONTABLES_H_ diff --git a/PWGLF/DataModel/LFStrangenessTables.h b/PWGLF/DataModel/LFStrangenessTables.h index 5b61be36549..634248f0bfa 100644 --- a/PWGLF/DataModel/LFStrangenessTables.h +++ b/PWGLF/DataModel/LFStrangenessTables.h @@ -132,6 +132,22 @@ DECLARE_SOA_DYNAMIC_COLUMN(MHypertriton, mHypertriton, //! mass under hypertrito [](float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) -> float { return RecoDecay::m(array{array{2.0f * pxpos, 2.0f * pypos, 2.0f * pzpos}, array{pxneg, pyneg, pzneg}}, array{o2::constants::physics::MassHelium3, o2::constants::physics::MassPionCharged}); }); DECLARE_SOA_DYNAMIC_COLUMN(MAntiHypertriton, mAntiHypertriton, //! mass under antihypertriton hypothesis [](float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) -> float { return RecoDecay::m(array{array{pxpos, pypos, pzpos}, array{2.0f * pxneg, 2.0f * pyneg, 2.0f * pzneg}}, array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassHelium3}); }); +DECLARE_SOA_DYNAMIC_COLUMN(M, m, //! mass under a certain hypothesis (0:K0, 1:L, 2:Lbar, 3:gamma, 4:hyp, 5:ahyp) + [](float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg, int value) -> float { + if(value==0) + return RecoDecay::m(array{array{pxpos, pypos, pzpos}, array{pxneg, pyneg, pzneg}}, array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassPionCharged}); + if(value==1) + return RecoDecay::m(array{array{pxpos, pypos, pzpos}, array{pxneg, pyneg, pzneg}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged}); + if(value==2) + return RecoDecay::m(array{array{pxpos, pypos, pzpos}, array{pxneg, pyneg, pzneg}}, array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassProton}); + if(value==3) + return RecoDecay::m(array{array{pxpos, pypos, pzpos}, array{pxneg, pyneg, pzneg}}, array{o2::constants::physics::MassElectron, o2::constants::physics::MassElectron}); + if(value==4) + return RecoDecay::m(array{array{2.0f * pxpos, 2.0f * pypos, 2.0f * pzpos}, array{pxneg, pyneg, pzneg}}, array{o2::constants::physics::MassHelium3, o2::constants::physics::MassPionCharged}); + if(value==5) + return RecoDecay::m(array{array{pxpos, pypos, pzpos}, array{2.0f * pxneg, 2.0f * pyneg, 2.0f * pzneg}}, array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassHelium3}); + return 0.0f; + }); DECLARE_SOA_DYNAMIC_COLUMN(YK0Short, yK0Short, //! V0 y with K0short hypothesis [](float Px, float Py, float Pz) -> float { return RecoDecay::y(array{Px, Py, Pz}, o2::constants::physics::MassKaonNeutral); }); @@ -196,6 +212,7 @@ DECLARE_SOA_TABLE_FULL(StoredV0Datas, "V0Datas", "AOD", "V0DATA", //! v0data::MGamma, v0data::MHypertriton, v0data::MAntiHypertriton, + v0data::M, // Longitudinal v0data::YK0Short, @@ -336,7 +353,15 @@ DECLARE_SOA_DYNAMIC_COLUMN(DCAV0ToPV, dcav0topv, //! // Calculated on the fly with mass assumption + dynamic tables DECLARE_SOA_DYNAMIC_COLUMN(MLambda, mLambda, //! [](int charge, float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) -> float { return RecoDecay::m(array{array{pxpos, pypos, pzpos}, array{pxneg, pyneg, pzneg}}, charge < 0 ? array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged} : array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassProton}); }); -// Calculated on the fly with mass assumption + dynamic tables +DECLARE_SOA_DYNAMIC_COLUMN(M, m, //! mass under a certain hypothesis (0:K0, 1:L, 2:Lbar, 3:gamma, 4:hyp, 5:ahyp) + [](float mXi, float mOmega, int value) -> float { + if(value==0||value==1) + return mXi; + if(value==2||value==3) + return mOmega; + return 0.0f; + }); + DECLARE_SOA_DYNAMIC_COLUMN(YXi, yXi, //! [](float Px, float Py, float Pz) -> float { return RecoDecay::y(array{Px, Py, Pz}, o2::constants::physics::MassXiMinus); }); @@ -380,6 +405,7 @@ DECLARE_SOA_TABLE(StoredCascDatas, "AOD", "CASCDATA", //! // Invariant masses cascdata::MLambda, + cascdata::M, // Longitudinal cascdata::YXi, diff --git a/PWGLF/TableProducer/hStrangeCorrelationFilter.cxx b/PWGLF/TableProducer/hStrangeCorrelationFilter.cxx index bc93a08c287..cfbfcb74531 100644 --- a/PWGLF/TableProducer/hStrangeCorrelationFilter.cxx +++ b/PWGLF/TableProducer/hStrangeCorrelationFilter.cxx @@ -11,8 +11,11 @@ /// /// \brief This task pre-filters tracks, V0s and cascades to do h-strangeness /// correlations with an analysis task. -/// \author Kai Cui -/// \since +/// +/// \author Kai Cui (kaicui@mails.ccnu.edu.cn) +/// \author Lucia Anna Tarasovicova (lucia.anna.husova@cern.ch) +/// \author David Dobrigkeit Chinellato (david.dobrigkeit.chinellato@cern.ch) +/// \author Zhongbao Yin (Zhong-Bao.Yin@cern.ch) #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" diff --git a/PWGLF/Tasks/hStrangeCorrelation.cxx b/PWGLF/Tasks/hStrangeCorrelation.cxx index ff2b188547d..1774d7d436b 100644 --- a/PWGLF/Tasks/hStrangeCorrelation.cxx +++ b/PWGLF/Tasks/hStrangeCorrelation.cxx @@ -15,8 +15,10 @@ /// Associated Particles : V0s or Cascades /// this task requires the hStrangeCorrelationFilter to have been run before. /// -/// \author Kai Cui -/// \since +/// \author Kai Cui (kaicui@mails.ccnu.edu.cn) +/// \author Lucia Anna Tarasovicova (lucia.anna.husova@cern.ch) +/// \author David Dobrigkeit Chinellato (david.dobrigkeit.chinellato@cern.ch) +/// \author Zhongbao Yin (Zhong-Bao.Yin@cern.ch) #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" @@ -27,6 +29,7 @@ #include "Common/DataModel/PIDResponse.h" #include "Framework/ASoAHelpers.h" #include "Common/DataModel/Multiplicity.h" +#include "Framework/StaticFor.h" using namespace o2; using namespace o2::framework; @@ -34,13 +37,28 @@ using namespace o2::framework::expressions; using TracksComplete = soa::Join; -struct correlateSameEvents { +struct correlateStrangeness { HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; - Configurable nBinsPhi{"nBinsPhi", 80, "Number of phi bins"}; + Configurable nBinsPhi{"nBinsPhi", 72, "Number of phi bins"}; Configurable nBinsEta{"nBinsEta", 80, "Number of eta bins"}; Configurable nBinsDeltaEta{"nBinsDeltaEta", 160, "Number of delta-eta bins"}; + Configurable nBinsDeltaPhi{"nBinsDeltaPhi", 144, "Number of delta-phi bins"}; Configurable nBinsMass{"nBinsMass", 200, "Number of mass bins"}; + Configurable zVertexCut{"zVertexCut", 10, "Cut on PV position"}; + + ConfigurableAxis ConfMultBins{"ConfMultBins", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 100.1}, "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"}; + + using BinningType = ColumnBinningPolicy>; + + //collision slicing for mixed events + Preslice collisionSliceTracks = aod::triggerTracks::collisionId; + Preslice collisionSliceV0s = aod::assocV0s::collisionId; + Preslice collisionSliceCascades = aod::assocCascades::collisionId; + + static constexpr std::string_view v0names[]={"K0Short","Lambda","AntiLambda"}; + static constexpr std::string_view cascadenames[]={"XiMinus","XiPlus","OmegaMinus","OmegaPlus"}; /// Function to aid in calculating delta-phi /// \param phi1 first phi value @@ -71,58 +89,113 @@ struct correlateSameEvents { return lReturnVal; } + template + void fillCorrelationsV0(TTrigger& triggers, TAssoc& assocs, bool mixing){ + for (auto& triggerTrack : triggers) { + auto trigg = triggerTrack.template track_as(); + histos.fill(HIST("triggerV0"), trigg.pt()); + for (auto& assocCandidate : assocs){ + auto assoc = assocCandidate.v0Data(); + + //---] removing autocorrelations [--- + auto postrack = assoc.template posTrack_as(); + auto negtrack = assoc.template negTrack_as(); + if (trigg.globalIndex() == postrack.globalIndex()) continue; + if (trigg.globalIndex() == negtrack.globalIndex()) continue; + //TODO: add histogram checking how many pairs are rejected (should be small!) + + static_for<0, 2>([&](auto i) { + constexpr int index = i.value; + if( assocCandidate.compatible(index) && !mixing) + histos.fill(HIST(v0names[index]),ComputeDeltaPhi(trigg.phi(), assoc.phi()), trigg.eta() - assoc.eta(),assoc.pt()); + if( assocCandidate.compatible(index) && mixing) + histos.fill(HIST(v0names[index]),ComputeDeltaPhi(trigg.phi(), assoc.phi()), trigg.eta() - assoc.eta(),assoc.pt()); + }); + } + } + } + + template + void fillCorrelationsCascade(TTrigger& triggers, TAssoc& assocs, bool mixing){ + for (auto& triggerTrack : triggers) { + auto trigg = triggerTrack.template track_as(); + if(!mixing)histos.fill(HIST("triggerCas"), trigg.pt()); + for (auto& assocCandidate : assocs){ + auto assoc = assocCandidate.cascData(); + + //---] removing autocorrelations [--- + auto v0index = assoc.template v0_as(); + if (!(v0index.has_v0Data())) + continue; // this should not happen - included for safety + auto assocV0 = v0index.v0Data(); // de-reference index to correct v0data in case it exists + auto postrack = assocV0.template posTrack_as(); + auto negtrack = assocV0.template negTrack_as(); + auto bachtrack = assoc.template bachelor_as(); + if (trigg.globalIndex() == postrack.globalIndex()) continue; + if (trigg.globalIndex() == negtrack.globalIndex()) continue; + if (trigg.globalIndex() == bachtrack.globalIndex()) continue; + //TODO: add histogram checking how many pairs are rejected (should be small!) + + static_for<0, 3>([&](auto i) { + constexpr int index = i.value; + if( assocCandidate.compatible(index) && !mixing) + histos.fill(HIST(cascadenames[index]),ComputeDeltaPhi(trigg.phi(), assoc.phi()), trigg.eta() - assoc.eta(),assoc.pt()); + if( assocCandidate.compatible(index) && mixing) + histos.fill(HIST(cascadenames[index]),ComputeDeltaPhi(trigg.phi(), assoc.phi()), trigg.eta() - assoc.eta(),assoc.pt()); + }); + } + } + } + void init(InitContext const&) { // define usual axes to be used const AxisSpec axisPhi{nBinsPhi, -0.5 * M_PI, 1.5 * M_PI, "#phi"}; const AxisSpec axisEta{nBinsEta, -0.8, +0.8, "#eta"}; const AxisSpec axisDeltaEta{nBinsDeltaEta, -1.6, 1.6, "#Delta#eta"}; + const AxisSpec axisDeltaPhi{nBinsDeltaPhi, -0.5 * M_PI, 1.5 * M_PI, "#Delta#phi"}; + const AxisSpec axisPtFine{100, 0, 10, "#it{p}_{T} (GeV/c)"}; const AxisSpec axisPt{10, 0, 5, "#it{p}_{T} (GeV/c)"}; const AxisSpec axisK0ShortMass{nBinsMass, 0.400f, 0.600f, "Inv. Mass (GeV/c^{2})"}; const AxisSpec axisLambdaMass{nBinsMass, 1.01f, 1.21f, "Inv. Mass (GeV/c^{2})"}; const AxisSpec axisXiMass{nBinsMass, 1.22f, 1.42f, "Inv. Mass (GeV/c^{2})"}; const AxisSpec axisOmegaMass{nBinsMass, 1.57f, 1.77f, "Inv. Mass (GeV/c^{2})"}; - // correlation histograms in phi alone (warning: not mixed-event-corrected) - histos.add("correlationPhiHadronK0Short", "correlationPhiHadronK0Short", kTH1F, {axisPhi}); - histos.add("correlationPhiHadronLambda", "correlationPhiHadronLambda", kTH1F, {axisPhi}); - histos.add("correlationPhiHadronAntiLambda", "correlationPhiHadronAntiLambda", kTH1F, {axisPhi}); - histos.add("correlationPhiHadronXiMinus", "correlationPhiHadronXiMinus", kTH1F, {axisPhi}); - histos.add("correlationPhiHadronXiPlus", "correlationPhiHadronXiPlus", kTH1F, {axisPhi}); - histos.add("correlationPhiHadronOmegaMinus", "correlationPhiHadronOmegaMinus", kTH1F, {axisPhi}); - histos.add("correlationPhiHadronOmegaPlus", "correlationPhiHadronOmegaPlus", kTH1F, {axisPhi}); - - // full correlation functions - histos.add("correlationFullHadronK0Short", "correlationFullHadronK0Short", kTH3F, {axisPhi, axisDeltaEta, axisPt}); - histos.add("correlationFullHadronLambda", "correlationFullHadronLambda", kTH3F, {axisPhi, axisDeltaEta, axisPt}); - histos.add("correlationFullHadronAntiLambda", "correlationFullHadronAntiLambda", kTH3F, {axisPhi, axisDeltaEta, axisPt}); - histos.add("correlationFullHadronXiMinus", "correlationFullHadronXiMinus", kTH3F, {axisPhi, axisDeltaEta, axisPt}); - histos.add("correlationFullHadronXiPlus", "correlationFullHadronXiPlus", kTH3F, {axisPhi, axisDeltaEta, axisPt}); - histos.add("correlationFullHadronOmegaMinus", "correlationFullHadronOmegaMinus", kTH3F, {axisPhi, axisDeltaEta, axisPt}); - histos.add("correlationFullHadronOmegaPlus", "correlationFullHadronOmegaPlus", kTH3F, {axisPhi, axisDeltaEta, axisPt}); + // same-event correlation functions + histos.add("sameEvent/HadronK0Short", "HadronK0Short", kTH3F, {axisDeltaPhi, axisDeltaEta, axisPt}); + histos.add("sameEvent/HadronLambda", "HadronLambda", kTH3F, {axisDeltaPhi, axisDeltaEta, axisPt}); + histos.add("sameEvent/HadronAntiLambda", "HadronAntiLambda", kTH3F, {axisDeltaPhi, axisDeltaEta, axisPt}); + histos.add("sameEvent/HadronXiMinus", "HadronXiMinus", kTH3F, {axisDeltaPhi, axisDeltaEta, axisPt}); + histos.add("sameEvent/HadronXiPlus", "HadronXiPlus", kTH3F, {axisDeltaPhi, axisDeltaEta, axisPt}); + histos.add("sameEvent/HadronOmegaMinus", "HadronOmegaMinus", kTH3F, {axisDeltaPhi, axisDeltaEta, axisPt}); + histos.add("sameEvent/HadronOmegaPlus", "HadronOmegaPlus", kTH3F, {axisDeltaPhi, axisDeltaEta, axisPt}); + + // mixed-event correlation functions + histos.addClone("sameEvent/", "mixedEvent"); // Some QA plots - histos.add("h2dMassK0Short", "h2dMassK0Short", kTH2F, {axisPt, axisK0ShortMass}); - histos.add("h2dMassLambda", "h2dMassLambda", kTH2F, {axisPt, axisLambdaMass}); - histos.add("h2dMassAntiLambda", "h2dMassAntiLambda", kTH2F, {axisPt, axisLambdaMass}); - histos.add("h2dMassXiMinus", "h2dMassXiMinus", kTH2F, {axisPt, axisXiMass}); - histos.add("h2dMassXiPlus", "h2dMassXiPlus", kTH2F, {axisPt, axisXiMass}); - histos.add("h2dMassOmegaMinus", "h2dMassOmegaMinus", kTH2F, {axisPt, axisOmegaMass}); - histos.add("h2dMassOmegaPlus", "h2dMassOmegaPlus", kTH2F, {axisPt, axisOmegaMass}); + histos.add("h2dMassK0Short", "h2dMassK0Short", kTH2F, {axisPtFine, axisK0ShortMass}); + histos.add("h2dMassLambda", "h2dMassLambda", kTH2F, {axisPtFine, axisLambdaMass}); + histos.add("h2dMassAntiLambda", "h2dMassAntiLambda", kTH2F, {axisPtFine, axisLambdaMass}); + histos.add("h2dMassXiMinus", "h2dMassXiMinus", kTH2F, {axisPtFine, axisXiMass}); + histos.add("h2dMassXiPlus", "h2dMassXiPlus", kTH2F, {axisPtFine, axisXiMass}); + histos.add("h2dMassOmegaMinus", "h2dMassOmegaMinus", kTH2F, {axisPtFine, axisOmegaMass}); + histos.add("h2dMassOmegaPlus", "h2dMassOmegaPlus", kTH2F, {axisPtFine, axisOmegaMass}); histos.add("hTrackEta", "hTrackEta", kTH1F, {axisEta}); histos.add("hV0Eta", "hV0Eta", kTH1F, {axisEta}); + histos.add("hCascEta", "hCascEta", kTH1F, {axisEta}); } - void process(soa::Join::iterator const& collision, + void processSameEvent(soa::Join::iterator const& collision, aod::AssocV0s const& associatedV0s, aod::AssocCascades const& associatedCascades, aod::TriggerTracks const& triggerTracks, - aod::V0Datas const&, aod::CascDatas const&, TracksComplete const&) + aod::V0Datas const&, aod::V0sLinked const&, aod::CascDatas const&, TracksComplete const&) { // ________________________________________________ // Perform basic event selection if (!collision.sel8()) { return; } - if (TMath::Abs(collision.posZ()) > 10.0) { + if (TMath::Abs(collision.posZ()) > zVertexCut) { return; } // ________________________________________________ @@ -130,34 +203,20 @@ struct correlateSameEvents { for (auto const& v0 : associatedV0s) { auto v0Data = v0.v0Data(); histos.fill(HIST("hV0Eta"), v0Data.eta()); - if (v0.compatibleK0Short()) { - // K0Short compatible - histos.fill(HIST("h2dMassK0Short"), v0Data.pt(), v0Data.mK0Short()); - } - if (v0.compatibleLambda()) { - // Lambda compatible - histos.fill(HIST("h2dMassLambda"), v0Data.pt(), v0Data.mLambda()); - } - if (v0.compatibleAntiLambda()) { - // AntiLambda compatible - histos.fill(HIST("h2dMassAntiLambda"), v0Data.pt(), v0Data.mAntiLambda()); - } + static_for<0, 2>([&](auto i) { + constexpr int index = i.value; + if( v0.compatible(index) ) + histos.fill(HIST("h2dMass") + HIST(v0names[index]),v0Data.pt(), v0Data.m(index)); + }); } for (auto const& casc : associatedCascades) { auto cascData = casc.cascData(); - histos.fill(HIST("hV0Eta"), cascData.eta()); - if (casc.compatibleXiMinus()) { // XiMinus compatible - histos.fill(HIST("h2dMassXiMinus"), cascData.pt(), cascData.mXi()); - } - if (casc.compatibleXiPlus()) { // XiPlus compatible - histos.fill(HIST("h2dMassXiPlus"), cascData.pt(), cascData.mXi()); - } - if (casc.compatibleOmegaMinus()) { // OmegaMinus compatible - histos.fill(HIST("h2dMassOmegaMinus"), cascData.pt(), cascData.mOmega()); - } - if (casc.compatibleOmegaPlus()) { // OmegaPlus compatible - histos.fill(HIST("h2dMassOmegaPlus"), cascData.pt(), cascData.mOmega()); - } + histos.fill(HIST("hCascEta"), cascData.eta()); + static_for<0, 3>([&](auto i) { + constexpr int index = i.value; + if( casc.compatible(index) ) + histos.fill(HIST("h2dMass") + HIST(cascadenames[index]),cascData.pt(), cascData.m(index)); + }); } for (auto const& triggerTrack : triggerTracks) { auto track = triggerTrack.track_as(); @@ -166,185 +225,49 @@ struct correlateSameEvents { // ________________________________________________ // Do hadron - V0 correlations - for (auto const& [triggerTrackRef, assocTrackRef] : combinations(o2::soa::CombinationsFullIndexPolicy(triggerTracks, associatedV0s))) { - // De-reference - auto triggerTrack = triggerTrackRef.track_as(); - auto assocTrack = assocTrackRef.v0Data(); - // Correlate - if (assocTrackRef.compatibleK0Short()) { - histos.fill(HIST("correlationPhiHadronK0Short"), ComputeDeltaPhi(triggerTrack.phi(), assocTrack.phi())); - histos.fill(HIST("correlationFullHadronK0Short"), ComputeDeltaPhi(triggerTrack.phi(), assocTrack.phi()), triggerTrack.eta() - assocTrack.eta(), assocTrack.pt()); - } - if (assocTrackRef.compatibleLambda()) { - histos.fill(HIST("correlationPhiHadronLambda"), ComputeDeltaPhi(triggerTrack.phi(), assocTrack.phi())); - histos.fill(HIST("correlationFullHadronLambda"), ComputeDeltaPhi(triggerTrack.phi(), assocTrack.phi()), triggerTrack.eta() - assocTrack.eta(), assocTrack.pt()); - } - if (assocTrackRef.compatibleAntiLambda()) { - histos.fill(HIST("correlationPhiHadronAntiLambda"), ComputeDeltaPhi(triggerTrack.phi(), assocTrack.phi())); - histos.fill(HIST("correlationFullHadronAntiLambda"), ComputeDeltaPhi(triggerTrack.phi(), assocTrack.phi()), triggerTrack.eta() - assocTrack.eta(), assocTrack.pt()); - } - } + fillCorrelationsV0( triggerTracks, associatedV0s, false ); // ________________________________________________ // Do hadron - cascade correlations - for (auto const& [triggerTrackRef, assocTrackRef] : combinations(o2::soa::CombinationsFullIndexPolicy(triggerTracks, associatedCascades))) { - // De-reference - auto triggerTrack = triggerTrackRef.track_as(); - auto assocTrack = assocTrackRef.cascData(); - // Correlate - if (assocTrackRef.compatibleXiMinus()) { - histos.fill(HIST("correlationPhiHadronXiMinus"), ComputeDeltaPhi(triggerTrack.phi(), assocTrack.phi())); - histos.fill(HIST("correlationFullHadronXiMinus"), ComputeDeltaPhi(triggerTrack.phi(), assocTrack.phi()), triggerTrack.eta() - assocTrack.eta(), assocTrack.pt()); - } - if (assocTrackRef.compatibleXiPlus()) { - histos.fill(HIST("correlationPhiHadronXiPlus"), ComputeDeltaPhi(triggerTrack.phi(), assocTrack.phi())); - histos.fill(HIST("correlationFullHadronXiPlus"), ComputeDeltaPhi(triggerTrack.phi(), assocTrack.phi()), triggerTrack.eta() - assocTrack.eta(), assocTrack.pt()); - } - if (assocTrackRef.compatibleOmegaMinus()) { - histos.fill(HIST("correlationPhiHadronOmegaMinus"), ComputeDeltaPhi(triggerTrack.phi(), assocTrack.phi())); - histos.fill(HIST("correlationFullHadronOmegaMinus"), ComputeDeltaPhi(triggerTrack.phi(), assocTrack.phi()), triggerTrack.eta() - assocTrack.eta(), assocTrack.pt()); - } - if (assocTrackRef.compatibleOmegaPlus()) { - histos.fill(HIST("correlationPhiHadronOmegaPlus"), ComputeDeltaPhi(triggerTrack.phi(), assocTrack.phi())); - histos.fill(HIST("correlationFullHadronOmegaPlus"), ComputeDeltaPhi(triggerTrack.phi(), assocTrack.phi()), triggerTrack.eta() - assocTrack.eta(), assocTrack.pt()); - } - } + fillCorrelationsCascade( triggerTracks, associatedCascades, false ); } -}; + PROCESS_SWITCH(correlateStrangeness, processSameEvent, "Process same events", true); -struct correlateMixedEvents { - HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; - - ConfigurableAxis ConfMultBins{"ConfMultBins", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 100.1}, "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 nBinsPhi{"nBinsPhi", 80, "Number of phi bins"}; - Configurable nBinsEta{"nBinsEta", 80, "Number of eta bins"}; - Configurable nBinsDeltaEta{"nBinsDeltaEta", 160, "Number of delta-eta bins"}; - - // using BinningType = ColumnBinningPolicy; - using BinningType = ColumnBinningPolicy>; - BinningType colBinning{{ConfVtxBins, ConfMultBins}, true}; - Pair, aod::TriggerTracks, aod::AssocV0s, BinningType> pairV0s{colBinning, 5, -1}; // indicates that 5 events should be mixed and under/overflow (-1) to be ignored - Pair, aod::TriggerTracks, aod::AssocCascades, BinningType> pairCascades{colBinning, 5, -1}; // indicates that 5 events should be mixed and under/overflow (-1) to be ignored - - /// Function to aid in calculating delta-phi - /// \param phi1 first phi value - /// \param phi2 second phi value - Double_t ComputeDeltaPhi(Double_t phi1, Double_t phi2) + void processMixedEvent(soa::Join const& collisions, + aod::AssocV0s const& associatedV0s, aod::AssocCascades const& associatedCascades, aod::TriggerTracks const& triggerTracks, + aod::V0Datas const&, aod::V0sLinked const&, aod::CascDatas const&, TracksComplete const&) { - // To be completely sure, use inner products - Double_t x1, y1, x2, y2; - x1 = TMath::Cos(phi1); - y1 = TMath::Sin(phi1); - x2 = TMath::Cos(phi2); - y2 = TMath::Sin(phi2); - Double_t lInnerProd = x1 * x2 + y1 * y2; - Double_t lVectorProd = x1 * y2 - x2 * y1; - - Double_t lReturnVal = 0; - if (lVectorProd > 1e-8) { - lReturnVal = TMath::ACos(lInnerProd); - } - if (lVectorProd < -1e-8) { - lReturnVal = -TMath::ACos(lInnerProd); - } - if (lReturnVal < -TMath::Pi() / 2.) { - lReturnVal += 2. * TMath::Pi(); - } + BinningType colBinning{{ConfVtxBins, ConfMultBins}, true}; // true is for 'ignore overflows' (true by default). Underflows and overflows will have bin -1. - return lReturnVal; - } + for (auto& [collision1, collision2] : soa::selfCombinations(colBinning, 5, -1, collisions, collisions)) { + // ________________________________________________ + // Perform basic event selection on both collisions + if (!collision1.sel8() || !collision2.sel8()) + continue; + if (TMath::Abs(collision1.posZ()) > zVertexCut && TMath::Abs(collision2.posZ()) > zVertexCut) + continue; - void init(InitContext const&) - { - // define usual axes to be used - const AxisSpec axisPhi{nBinsPhi, -0.5 * M_PI, 1.5 * M_PI, "#phi"}; - const AxisSpec axisEta{nBinsEta, -1, 1, "#eta"}; - const AxisSpec axisDeltaEta{nBinsDeltaEta, -2, 2, "#Delta#eta"}; - const AxisSpec axisPt{10, 0, 5, "#it{p}_{T} (GeV/c)"}; + // ________________________________________________ + // Do slicing + auto slicedTriggerTracks = triggerTracks.sliceBy(collisionSliceTracks, collision1.globalIndex()); + auto slicedAssocV0s = associatedV0s.sliceBy(collisionSliceV0s, collision2.globalIndex()); + auto slicedAssocCascades = associatedCascades.sliceBy(collisionSliceCascades, collision2.globalIndex()); - // correlation histograms in phi alone (warning: not mixed-event-corrected) - histos.add("deltaPhiDistribution", "deltaPhiDistribution", kTH1F, {axisPhi}); - histos.add("deltaEtaDistribution", "deltaEtaDistribution", kTH1F, {axisEta}); - - // full correlation functions - histos.add("mixedFullHadronK0Short", "mixedFullHadronK0Short", kTH3F, {axisPhi, axisDeltaEta, axisPt}); - histos.add("mixedFullHadronLambda", "mixedFullHadronLambda", kTH3F, {axisPhi, axisDeltaEta, axisPt}); - histos.add("mixedFullHadronAntiLambda", "mixedFullHadronAntiLambda", kTH3F, {axisPhi, axisDeltaEta, axisPt}); - histos.add("mixedFullHadronXiMinus", "mixedFullHadronXiMinus", kTH3F, {axisPhi, axisDeltaEta, axisPt}); - histos.add("mixedFullHadronXiPlus", "mixedFullHadronXiPlus", kTH3F, {axisPhi, axisDeltaEta, axisPt}); - histos.add("mixedFullHadronOmegaMinus", "mixedFullHadronOmegaMinus", kTH3F, {axisPhi, axisDeltaEta, axisPt}); - histos.add("mixedFullHadronOmegaPlus", "mixedFullHadronOmegaPlus", kTH3F, {axisPhi, axisDeltaEta, axisPt}); - } + // ________________________________________________ + // Do hadron - V0 correlations + fillCorrelationsV0( slicedTriggerTracks, slicedAssocV0s, true ); - void process(soa::Join const& collisions, - aod::TriggerTracks const& triggerTracks, aod::AssocV0s const& associatedV0s, aod::AssocCascades const& associatedCascades, - aod::V0Datas const& V0s, aod::CascDatas const& Cascades, TracksComplete const&) - { - // LOGF(info, "Input data Collisions %d, Tracks %d V0s %d Cascades %d", collisions.size(), triggerTracks.size(), associatedV0s.size(), associatedCascades.size()); - // ________________________________________________ - // Mixed event loop for associated = V0s - for (auto& [c1, tracks1, c2, tracks2] : pairV0s) { - // LOGF(info, "Mixed event collisions: (%d, %d)", c1.globalIndex(), c2.globalIndex()); - if (c1.globalIndex() == c2.globalIndex()) { - // Skip same collisions - continue; - } - for (auto& [t1, t2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { - // LOGF(info, "Mixed event tracks pair: (%d, %d) from events (%d, %d), track event: (%d, %d)", t1.collisionId(), t2.collisionId(), c1.index(), c2.index(), t1.collision().index(), t2.collision().index()); - // De-reference - auto triggerTrack = t1.track_as(); - auto assocTrack = t2.v0Data(); - // do correlations - histos.fill(HIST("deltaPhiDistribution"), ComputeDeltaPhi(triggerTrack.phi(), assocTrack.phi())); - histos.fill(HIST("deltaEtaDistribution"), triggerTrack.eta() - assocTrack.eta()); - // Correlate - if (t2.compatibleK0Short()) { - histos.fill(HIST("mixedFullHadronK0Short"), ComputeDeltaPhi(triggerTrack.phi(), assocTrack.phi()), triggerTrack.eta() - assocTrack.eta(), assocTrack.pt()); - } - if (t2.compatibleLambda()) { - histos.fill(HIST("mixedFullHadronLambda"), ComputeDeltaPhi(triggerTrack.phi(), assocTrack.phi()), triggerTrack.eta() - assocTrack.eta(), assocTrack.pt()); - } - if (t2.compatibleAntiLambda()) { - histos.fill(HIST("mixedFullHadronAntiLambda"), ComputeDeltaPhi(triggerTrack.phi(), assocTrack.phi()), triggerTrack.eta() - assocTrack.eta(), assocTrack.pt()); - } - } - } - // ________________________________________________ - // Mixed event loop for associated = Cascades - for (auto& [c1, tracks1, c2, tracks2] : pairCascades) { - // LOGF(info, "Mixed event collisions: (%d, %d)", c1.globalIndex(), c2.globalIndex()); - if (c1.globalIndex() == c2.globalIndex()) { - // Skip same collisions - continue; - } - for (auto& [t1, t2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { - // LOGF(info, "Mixed event tracks pair: (%d, %d) from events (%d, %d), track event: (%d, %d)", t1.collisionId(), t2.collisionId(), c1.index(), c2.index(), t1.collision().index(), t2.collision().index()); - // De-reference - auto triggerTrack = t1.track_as(); - auto assocTrack = t2.cascData(); - // Correlate - if (t2.compatibleXiMinus()) { - histos.fill(HIST("mixedFullHadronXiMinus"), ComputeDeltaPhi(triggerTrack.phi(), assocTrack.phi()), triggerTrack.eta() - assocTrack.eta(), assocTrack.pt()); - } - if (t2.compatibleXiPlus()) { - histos.fill(HIST("mixedFullHadronXiPlus"), ComputeDeltaPhi(triggerTrack.phi(), assocTrack.phi()), triggerTrack.eta() - assocTrack.eta(), assocTrack.pt()); - } - if (t2.compatibleOmegaMinus()) { - histos.fill(HIST("mixedFullHadronOmegaMinus"), ComputeDeltaPhi(triggerTrack.phi(), assocTrack.phi()), triggerTrack.eta() - assocTrack.eta(), assocTrack.pt()); - } - if (t2.compatibleOmegaPlus()) { - histos.fill(HIST("mixedFullHadronOmegaPlus"), ComputeDeltaPhi(triggerTrack.phi(), assocTrack.phi()), triggerTrack.eta() - assocTrack.eta(), assocTrack.pt()); - } - } + // ________________________________________________ + // Do hadron - cascade correlations + fillCorrelationsCascade( slicedTriggerTracks, slicedAssocCascades, true ); } } + PROCESS_SWITCH(correlateStrangeness, processMixedEvent, "Process mixed events", true); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ - adaptAnalysisTask(cfgc), - adaptAnalysisTask(cfgc)}; + adaptAnalysisTask(cfgc)}; } From 98d3f1897602d4b7e3021bd70ca3276b61a58c4c Mon Sep 17 00:00:00 2001 From: David Dobrigkeit Chinellato Date: Thu, 13 Apr 2023 09:07:25 -0300 Subject: [PATCH 2/5] Update correlation task (Lucia, Kai) --- PWGLF/Tasks/hStrangeCorrelation.cxx | 36 ++++++++++++++++------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/PWGLF/Tasks/hStrangeCorrelation.cxx b/PWGLF/Tasks/hStrangeCorrelation.cxx index 1774d7d436b..e226d5b4097 100644 --- a/PWGLF/Tasks/hStrangeCorrelation.cxx +++ b/PWGLF/Tasks/hStrangeCorrelation.cxx @@ -89,59 +89,63 @@ struct correlateStrangeness { return lReturnVal; } - template - void fillCorrelationsV0(TTrigger& triggers, TAssoc& assocs, bool mixing){ + void fillCorrelationsV0(aod::TriggerTracks const& triggers, aod::AssocV0s const& assocs, bool mixing){ for (auto& triggerTrack : triggers) { - auto trigg = triggerTrack.template track_as(); + auto trigg = triggerTrack.track_as(); histos.fill(HIST("triggerV0"), trigg.pt()); for (auto& assocCandidate : assocs){ auto assoc = assocCandidate.v0Data(); //---] removing autocorrelations [--- - auto postrack = assoc.template posTrack_as(); - auto negtrack = assoc.template negTrack_as(); + auto postrack = assoc.posTrack_as(); + auto negtrack = assoc.negTrack_as(); if (trigg.globalIndex() == postrack.globalIndex()) continue; if (trigg.globalIndex() == negtrack.globalIndex()) continue; //TODO: add histogram checking how many pairs are rejected (should be small!) + float deltaphi = ComputeDeltaPhi(trigg.phi(), assoc.phi()); + float deltaeta = trigg.eta() - assoc.eta(); + float ptassoc = assoc.pt(); static_for<0, 2>([&](auto i) { constexpr int index = i.value; if( assocCandidate.compatible(index) && !mixing) - histos.fill(HIST(v0names[index]),ComputeDeltaPhi(trigg.phi(), assoc.phi()), trigg.eta() - assoc.eta(),assoc.pt()); + histos.fill(HIST("sameEvent/Hadron") + HIST(v0names[index]), deltaphi, deltaeta, ptassoc); if( assocCandidate.compatible(index) && mixing) - histos.fill(HIST(v0names[index]),ComputeDeltaPhi(trigg.phi(), assoc.phi()), trigg.eta() - assoc.eta(),assoc.pt()); + histos.fill(HIST("mixedEvent/Hadron") + HIST(v0names[index]), deltaphi, deltaeta, ptassoc); }); } } } - template - void fillCorrelationsCascade(TTrigger& triggers, TAssoc& assocs, bool mixing){ + void fillCorrelationsCascade(aod::TriggerTracks const& triggers, aod::AssocCascades const& assocs, bool mixing){ for (auto& triggerTrack : triggers) { - auto trigg = triggerTrack.template track_as(); + auto trigg = triggerTrack.track_as(); if(!mixing)histos.fill(HIST("triggerCas"), trigg.pt()); for (auto& assocCandidate : assocs){ auto assoc = assocCandidate.cascData(); //---] removing autocorrelations [--- - auto v0index = assoc.template v0_as(); + auto v0index = assoc.v0_as(); if (!(v0index.has_v0Data())) continue; // this should not happen - included for safety auto assocV0 = v0index.v0Data(); // de-reference index to correct v0data in case it exists - auto postrack = assocV0.template posTrack_as(); - auto negtrack = assocV0.template negTrack_as(); - auto bachtrack = assoc.template bachelor_as(); + auto postrack = assocV0.posTrack_as(); + auto negtrack = assocV0.negTrack_as(); + auto bachtrack = assoc.bachelor_as(); if (trigg.globalIndex() == postrack.globalIndex()) continue; if (trigg.globalIndex() == negtrack.globalIndex()) continue; if (trigg.globalIndex() == bachtrack.globalIndex()) continue; //TODO: add histogram checking how many pairs are rejected (should be small!) + float deltaphi = ComputeDeltaPhi(trigg.phi(), assoc.phi()); + float deltaeta = trigg.eta() - assoc.eta(); + float ptassoc = assoc.pt(); static_for<0, 3>([&](auto i) { constexpr int index = i.value; if( assocCandidate.compatible(index) && !mixing) - histos.fill(HIST(cascadenames[index]),ComputeDeltaPhi(trigg.phi(), assoc.phi()), trigg.eta() - assoc.eta(),assoc.pt()); + histos.fill(HIST("sameEvent/Hadron") + HIST(cascadenames[index]), deltaphi, deltaeta, ptassoc); if( assocCandidate.compatible(index) && mixing) - histos.fill(HIST(cascadenames[index]),ComputeDeltaPhi(trigg.phi(), assoc.phi()), trigg.eta() - assoc.eta(),assoc.pt()); + histos.fill(HIST("mixedEvent/Hadron") + HIST(cascadenames[index]),deltaphi, deltaeta, ptassoc); }); } } From 6ead1e1567eea3cdabc085890400e424b61bdf48 Mon Sep 17 00:00:00 2001 From: ALICE Builder Date: Thu, 13 Apr 2023 14:10:15 +0200 Subject: [PATCH 3/5] Please consider the following formatting changes (#96) --- PWGLF/DataModel/LFHStrangeCorrelationTables.h | 29 +++--- PWGLF/DataModel/LFStrangenessTables.h | 37 ++++---- PWGLF/Tasks/hStrangeCorrelation.cxx | 92 ++++++++++--------- 3 files changed, 86 insertions(+), 72 deletions(-) diff --git a/PWGLF/DataModel/LFHStrangeCorrelationTables.h b/PWGLF/DataModel/LFHStrangeCorrelationTables.h index 265c372f65b..3be29288da7 100644 --- a/PWGLF/DataModel/LFHStrangeCorrelationTables.h +++ b/PWGLF/DataModel/LFHStrangeCorrelationTables.h @@ -46,12 +46,15 @@ DECLARE_SOA_INDEX_COLUMN(V0Data, v0Data); //! DECLARE_SOA_COLUMN(CompatibleK0Short, compatibleK0Short, bool); // compatible with K0Short DECLARE_SOA_COLUMN(CompatibleLambda, compatibleLambda, bool); // compatible with Lambda DECLARE_SOA_COLUMN(CompatibleAntiLambda, compatibleAntiLambda, bool); // compatible with AntiLambda -DECLARE_SOA_DYNAMIC_COLUMN(Compatible, compatible, //! check compatibility with a hypothesis of a certain number (0 - K0, 1 - L, 2 - Lbar) +DECLARE_SOA_DYNAMIC_COLUMN(Compatible, compatible, //! check compatibility with a hypothesis of a certain number (0 - K0, 1 - L, 2 - Lbar) [](bool cK0Short, bool cLambda, bool cAntiLambda, int value) -> bool { - if(value==0 && cK0Short) return true; - if(value==1 && cLambda) return true; - if(value==2 && cAntiLambda) return true; - return false; + if (value == 0 && cK0Short) + return true; + if (value == 1 && cLambda) + return true; + if (value == 2 && cAntiLambda) + return true; + return false; }); } // namespace assocV0s DECLARE_SOA_TABLE(AssocV0s, "AOD", "ASSOCV0S", o2::soa::Index<>, @@ -70,13 +73,17 @@ DECLARE_SOA_COLUMN(CompatibleXiMinus, compatibleXiMinus, bool); // compati DECLARE_SOA_COLUMN(CompatibleXiPlus, compatibleXiPlus, bool); // compatible with XiPlus DECLARE_SOA_COLUMN(CompatibleOmegaMinus, compatibleOmegaMinus, bool); // compatible with OmegaMinus DECLARE_SOA_COLUMN(CompatibleOmegaPlus, compatibleOmegaPlus, bool); // compatible with OmegaPlus -DECLARE_SOA_DYNAMIC_COLUMN(Compatible, compatible, //! check compatibility with a hypothesis of a certain number (0 - K0, 1 - L, 2 - Lbar) +DECLARE_SOA_DYNAMIC_COLUMN(Compatible, compatible, //! check compatibility with a hypothesis of a certain number (0 - K0, 1 - L, 2 - Lbar) [](bool cXiMinus, bool cXiPlus, bool cOmegaMinus, bool cOmegaPlus, int value) -> bool { - if(value==0 && cXiMinus) return true; - if(value==1 && cXiPlus) return true; - if(value==2 && cOmegaMinus) return true; - if(value==3 && cOmegaPlus) return true; - return false; + if (value == 0 && cXiMinus) + return true; + if (value == 1 && cXiPlus) + return true; + if (value == 2 && cOmegaMinus) + return true; + if (value == 3 && cOmegaPlus) + return true; + return false; }); } // namespace assocCascades DECLARE_SOA_TABLE(AssocCascades, "AOD", "ASSOCCASCADES", o2::soa::Index<>, assocCascades::CollisionId, assocCascades::CascDataId, diff --git a/PWGLF/DataModel/LFStrangenessTables.h b/PWGLF/DataModel/LFStrangenessTables.h index 634248f0bfa..52959c93e2e 100644 --- a/PWGLF/DataModel/LFStrangenessTables.h +++ b/PWGLF/DataModel/LFStrangenessTables.h @@ -134,19 +134,19 @@ DECLARE_SOA_DYNAMIC_COLUMN(MAntiHypertriton, mAntiHypertriton, //! mass under an [](float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) -> float { return RecoDecay::m(array{array{pxpos, pypos, pzpos}, array{2.0f * pxneg, 2.0f * pyneg, 2.0f * pzneg}}, array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassHelium3}); }); DECLARE_SOA_DYNAMIC_COLUMN(M, m, //! mass under a certain hypothesis (0:K0, 1:L, 2:Lbar, 3:gamma, 4:hyp, 5:ahyp) [](float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg, int value) -> float { - if(value==0) - return RecoDecay::m(array{array{pxpos, pypos, pzpos}, array{pxneg, pyneg, pzneg}}, array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassPionCharged}); - if(value==1) - return RecoDecay::m(array{array{pxpos, pypos, pzpos}, array{pxneg, pyneg, pzneg}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged}); - if(value==2) - return RecoDecay::m(array{array{pxpos, pypos, pzpos}, array{pxneg, pyneg, pzneg}}, array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassProton}); - if(value==3) - return RecoDecay::m(array{array{pxpos, pypos, pzpos}, array{pxneg, pyneg, pzneg}}, array{o2::constants::physics::MassElectron, o2::constants::physics::MassElectron}); - if(value==4) - return RecoDecay::m(array{array{2.0f * pxpos, 2.0f * pypos, 2.0f * pzpos}, array{pxneg, pyneg, pzneg}}, array{o2::constants::physics::MassHelium3, o2::constants::physics::MassPionCharged}); - if(value==5) - return RecoDecay::m(array{array{pxpos, pypos, pzpos}, array{2.0f * pxneg, 2.0f * pyneg, 2.0f * pzneg}}, array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassHelium3}); - return 0.0f; + if (value == 0) + return RecoDecay::m(array{array{pxpos, pypos, pzpos}, array{pxneg, pyneg, pzneg}}, array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassPionCharged}); + if (value == 1) + return RecoDecay::m(array{array{pxpos, pypos, pzpos}, array{pxneg, pyneg, pzneg}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged}); + if (value == 2) + return RecoDecay::m(array{array{pxpos, pypos, pzpos}, array{pxneg, pyneg, pzneg}}, array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassProton}); + if (value == 3) + return RecoDecay::m(array{array{pxpos, pypos, pzpos}, array{pxneg, pyneg, pzneg}}, array{o2::constants::physics::MassElectron, o2::constants::physics::MassElectron}); + if (value == 4) + return RecoDecay::m(array{array{2.0f * pxpos, 2.0f * pypos, 2.0f * pzpos}, array{pxneg, pyneg, pzneg}}, array{o2::constants::physics::MassHelium3, o2::constants::physics::MassPionCharged}); + if (value == 5) + return RecoDecay::m(array{array{pxpos, pypos, pzpos}, array{2.0f * pxneg, 2.0f * pyneg, 2.0f * pzneg}}, array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassHelium3}); + return 0.0f; }); DECLARE_SOA_DYNAMIC_COLUMN(YK0Short, yK0Short, //! V0 y with K0short hypothesis @@ -355,14 +355,13 @@ DECLARE_SOA_DYNAMIC_COLUMN(MLambda, mLambda, //! [](int charge, float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) -> float { return RecoDecay::m(array{array{pxpos, pypos, pzpos}, array{pxneg, pyneg, pzneg}}, charge < 0 ? array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged} : array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassProton}); }); DECLARE_SOA_DYNAMIC_COLUMN(M, m, //! mass under a certain hypothesis (0:K0, 1:L, 2:Lbar, 3:gamma, 4:hyp, 5:ahyp) [](float mXi, float mOmega, int value) -> float { - if(value==0||value==1) - return mXi; - if(value==2||value==3) - return mOmega; - return 0.0f; + if (value == 0 || value == 1) + return mXi; + if (value == 2 || value == 3) + return mOmega; + return 0.0f; }); - DECLARE_SOA_DYNAMIC_COLUMN(YXi, yXi, //! [](float Px, float Py, float Pz) -> float { return RecoDecay::y(array{Px, Py, Pz}, o2::constants::physics::MassXiMinus); }); DECLARE_SOA_DYNAMIC_COLUMN(YOmega, yOmega, //! diff --git a/PWGLF/Tasks/hStrangeCorrelation.cxx b/PWGLF/Tasks/hStrangeCorrelation.cxx index e226d5b4097..82b4057c549 100644 --- a/PWGLF/Tasks/hStrangeCorrelation.cxx +++ b/PWGLF/Tasks/hStrangeCorrelation.cxx @@ -52,13 +52,13 @@ struct correlateStrangeness { using BinningType = ColumnBinningPolicy>; - //collision slicing for mixed events + // collision slicing for mixed events Preslice collisionSliceTracks = aod::triggerTracks::collisionId; Preslice collisionSliceV0s = aod::assocV0s::collisionId; Preslice collisionSliceCascades = aod::assocCascades::collisionId; - static constexpr std::string_view v0names[]={"K0Short","Lambda","AntiLambda"}; - static constexpr std::string_view cascadenames[]={"XiMinus","XiPlus","OmegaMinus","OmegaPlus"}; + static constexpr std::string_view v0names[] = {"K0Short", "Lambda", "AntiLambda"}; + static constexpr std::string_view cascadenames[] = {"XiMinus", "XiPlus", "OmegaMinus", "OmegaPlus"}; /// Function to aid in calculating delta-phi /// \param phi1 first phi value @@ -89,63 +89,71 @@ struct correlateStrangeness { return lReturnVal; } - void fillCorrelationsV0(aod::TriggerTracks const& triggers, aod::AssocV0s const& assocs, bool mixing){ + void fillCorrelationsV0(aod::TriggerTracks const& triggers, aod::AssocV0s const& assocs, bool mixing) + { for (auto& triggerTrack : triggers) { auto trigg = triggerTrack.track_as(); histos.fill(HIST("triggerV0"), trigg.pt()); - for (auto& assocCandidate : assocs){ + for (auto& assocCandidate : assocs) { auto assoc = assocCandidate.v0Data(); //---] removing autocorrelations [--- auto postrack = assoc.posTrack_as(); auto negtrack = assoc.negTrack_as(); - if (trigg.globalIndex() == postrack.globalIndex()) continue; - if (trigg.globalIndex() == negtrack.globalIndex()) continue; - //TODO: add histogram checking how many pairs are rejected (should be small!) + if (trigg.globalIndex() == postrack.globalIndex()) + continue; + if (trigg.globalIndex() == negtrack.globalIndex()) + continue; + // TODO: add histogram checking how many pairs are rejected (should be small!) float deltaphi = ComputeDeltaPhi(trigg.phi(), assoc.phi()); - float deltaeta = trigg.eta() - assoc.eta(); - float ptassoc = assoc.pt(); + float deltaeta = trigg.eta() - assoc.eta(); + float ptassoc = assoc.pt(); static_for<0, 2>([&](auto i) { constexpr int index = i.value; - if( assocCandidate.compatible(index) && !mixing) - histos.fill(HIST("sameEvent/Hadron") + HIST(v0names[index]), deltaphi, deltaeta, ptassoc); - if( assocCandidate.compatible(index) && mixing) - histos.fill(HIST("mixedEvent/Hadron") + HIST(v0names[index]), deltaphi, deltaeta, ptassoc); + if (assocCandidate.compatible(index) && !mixing) + histos.fill(HIST("sameEvent/Hadron") + HIST(v0names[index]), deltaphi, deltaeta, ptassoc); + if (assocCandidate.compatible(index) && mixing) + histos.fill(HIST("mixedEvent/Hadron") + HIST(v0names[index]), deltaphi, deltaeta, ptassoc); }); } } } - void fillCorrelationsCascade(aod::TriggerTracks const& triggers, aod::AssocCascades const& assocs, bool mixing){ + void fillCorrelationsCascade(aod::TriggerTracks const& triggers, aod::AssocCascades const& assocs, bool mixing) + { for (auto& triggerTrack : triggers) { auto trigg = triggerTrack.track_as(); - if(!mixing)histos.fill(HIST("triggerCas"), trigg.pt()); - for (auto& assocCandidate : assocs){ + if (!mixing) + histos.fill(HIST("triggerCas"), trigg.pt()); + for (auto& assocCandidate : assocs) { auto assoc = assocCandidate.cascData(); //---] removing autocorrelations [--- auto v0index = assoc.v0_as(); if (!(v0index.has_v0Data())) - continue; // this should not happen - included for safety + continue; // this should not happen - included for safety auto assocV0 = v0index.v0Data(); // de-reference index to correct v0data in case it exists auto postrack = assocV0.posTrack_as(); auto negtrack = assocV0.negTrack_as(); auto bachtrack = assoc.bachelor_as(); - if (trigg.globalIndex() == postrack.globalIndex()) continue; - if (trigg.globalIndex() == negtrack.globalIndex()) continue; - if (trigg.globalIndex() == bachtrack.globalIndex()) continue; - //TODO: add histogram checking how many pairs are rejected (should be small!) + if (trigg.globalIndex() == postrack.globalIndex()) + continue; + if (trigg.globalIndex() == negtrack.globalIndex()) + continue; + if (trigg.globalIndex() == bachtrack.globalIndex()) + continue; + // TODO: add histogram checking how many pairs are rejected (should be small!) float deltaphi = ComputeDeltaPhi(trigg.phi(), assoc.phi()); - float deltaeta = trigg.eta() - assoc.eta(); - float ptassoc = assoc.pt(); + float deltaeta = trigg.eta() - assoc.eta(); + float ptassoc = assoc.pt(); static_for<0, 3>([&](auto i) { constexpr int index = i.value; - if( assocCandidate.compatible(index) && !mixing) + if (assocCandidate.compatible(index) && !mixing) histos.fill(HIST("sameEvent/Hadron") + HIST(cascadenames[index]), deltaphi, deltaeta, ptassoc); - if( assocCandidate.compatible(index) && mixing) - histos.fill(HIST("mixedEvent/Hadron") + HIST(cascadenames[index]),deltaphi, deltaeta, ptassoc); + if (assocCandidate.compatible(index) && mixing) + histos.fill(HIST("mixedEvent/Hadron") + HIST(cascadenames[index]), deltaphi, deltaeta, ptassoc); }); } } @@ -174,7 +182,7 @@ struct correlateStrangeness { histos.add("sameEvent/HadronOmegaMinus", "HadronOmegaMinus", kTH3F, {axisDeltaPhi, axisDeltaEta, axisPt}); histos.add("sameEvent/HadronOmegaPlus", "HadronOmegaPlus", kTH3F, {axisDeltaPhi, axisDeltaEta, axisPt}); - // mixed-event correlation functions + // mixed-event correlation functions histos.addClone("sameEvent/", "mixedEvent"); // Some QA plots @@ -191,8 +199,8 @@ struct correlateStrangeness { } void processSameEvent(soa::Join::iterator const& collision, - aod::AssocV0s const& associatedV0s, aod::AssocCascades const& associatedCascades, aod::TriggerTracks const& triggerTracks, - aod::V0Datas const&, aod::V0sLinked const&, aod::CascDatas const&, TracksComplete const&) + aod::AssocV0s const& associatedV0s, aod::AssocCascades const& associatedCascades, aod::TriggerTracks const& triggerTracks, + aod::V0Datas const&, aod::V0sLinked const&, aod::CascDatas const&, TracksComplete const&) { // ________________________________________________ // Perform basic event selection @@ -209,8 +217,8 @@ struct correlateStrangeness { histos.fill(HIST("hV0Eta"), v0Data.eta()); static_for<0, 2>([&](auto i) { constexpr int index = i.value; - if( v0.compatible(index) ) - histos.fill(HIST("h2dMass") + HIST(v0names[index]),v0Data.pt(), v0Data.m(index)); + if (v0.compatible(index)) + histos.fill(HIST("h2dMass") + HIST(v0names[index]), v0Data.pt(), v0Data.m(index)); }); } for (auto const& casc : associatedCascades) { @@ -218,8 +226,8 @@ struct correlateStrangeness { histos.fill(HIST("hCascEta"), cascData.eta()); static_for<0, 3>([&](auto i) { constexpr int index = i.value; - if( casc.compatible(index) ) - histos.fill(HIST("h2dMass") + HIST(cascadenames[index]),cascData.pt(), cascData.m(index)); + if (casc.compatible(index)) + histos.fill(HIST("h2dMass") + HIST(cascadenames[index]), cascData.pt(), cascData.m(index)); }); } for (auto const& triggerTrack : triggerTracks) { @@ -229,17 +237,17 @@ struct correlateStrangeness { // ________________________________________________ // Do hadron - V0 correlations - fillCorrelationsV0( triggerTracks, associatedV0s, false ); + fillCorrelationsV0(triggerTracks, associatedV0s, false); // ________________________________________________ // Do hadron - cascade correlations - fillCorrelationsCascade( triggerTracks, associatedCascades, false ); + fillCorrelationsCascade(triggerTracks, associatedCascades, false); } PROCESS_SWITCH(correlateStrangeness, processSameEvent, "Process same events", true); void processMixedEvent(soa::Join const& collisions, - aod::AssocV0s const& associatedV0s, aod::AssocCascades const& associatedCascades, aod::TriggerTracks const& triggerTracks, - aod::V0Datas const&, aod::V0sLinked const&, aod::CascDatas const&, TracksComplete const&) + aod::AssocV0s const& associatedV0s, aod::AssocCascades const& associatedCascades, aod::TriggerTracks const& triggerTracks, + aod::V0Datas const&, aod::V0sLinked const&, aod::CascDatas const&, TracksComplete const&) { BinningType colBinning{{ConfVtxBins, ConfMultBins}, true}; // true is for 'ignore overflows' (true by default). Underflows and overflows will have bin -1. @@ -247,9 +255,9 @@ struct correlateStrangeness { for (auto& [collision1, collision2] : soa::selfCombinations(colBinning, 5, -1, collisions, collisions)) { // ________________________________________________ // Perform basic event selection on both collisions - if (!collision1.sel8() || !collision2.sel8()) + if (!collision1.sel8() || !collision2.sel8()) continue; - if (TMath::Abs(collision1.posZ()) > zVertexCut && TMath::Abs(collision2.posZ()) > zVertexCut) + if (TMath::Abs(collision1.posZ()) > zVertexCut && TMath::Abs(collision2.posZ()) > zVertexCut) continue; // ________________________________________________ @@ -260,11 +268,11 @@ struct correlateStrangeness { // ________________________________________________ // Do hadron - V0 correlations - fillCorrelationsV0( slicedTriggerTracks, slicedAssocV0s, true ); + fillCorrelationsV0(slicedTriggerTracks, slicedAssocV0s, true); // ________________________________________________ // Do hadron - cascade correlations - fillCorrelationsCascade( slicedTriggerTracks, slicedAssocCascades, true ); + fillCorrelationsCascade(slicedTriggerTracks, slicedAssocCascades, true); } } PROCESS_SWITCH(correlateStrangeness, processMixedEvent, "Process mixed events", true); From b047e12461cb814a4a33f47cd1fdb5da9186b823 Mon Sep 17 00:00:00 2001 From: David Dobrigkeit Chinellato Date: Thu, 13 Apr 2023 10:49:36 -0300 Subject: [PATCH 4/5] Change computeDeltaPhi --- PWGLF/Tasks/hStrangeCorrelation.cxx | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/PWGLF/Tasks/hStrangeCorrelation.cxx b/PWGLF/Tasks/hStrangeCorrelation.cxx index 82b4057c549..49aab15c79c 100644 --- a/PWGLF/Tasks/hStrangeCorrelation.cxx +++ b/PWGLF/Tasks/hStrangeCorrelation.cxx @@ -65,28 +65,14 @@ struct correlateStrangeness { /// \param phi2 second phi value Double_t ComputeDeltaPhi(Double_t phi1, Double_t phi2) { - // To be completely sure, use inner products - Double_t x1, y1, x2, y2; - x1 = TMath::Cos(phi1); - y1 = TMath::Sin(phi1); - x2 = TMath::Cos(phi2); - y2 = TMath::Sin(phi2); - Double_t lInnerProd = x1 * x2 + y1 * y2; - Double_t lVectorProd = x1 * y2 - x2 * y1; - - Double_t lReturnVal = 0; - if (lVectorProd > 1e-8) { - lReturnVal = TMath::ACos(lInnerProd); - } - if (lVectorProd < -1e-8) { - lReturnVal = -TMath::ACos(lInnerProd); + Double_t deltaPhi = phi1-phi2; + if (deltaPhi < -TMath::Pi() / 2.) { + deltaPhi += 2. * TMath::Pi(); } - - if (lReturnVal < -TMath::Pi() / 2.) { - lReturnVal += 2. * TMath::Pi(); + if(deltaPhi> 3*TMath::Pi() / 2.){ + deltaPhi -= 2. * TMath::Pi(); } - - return lReturnVal; + return deltaPhi; } void fillCorrelationsV0(aod::TriggerTracks const& triggers, aod::AssocV0s const& assocs, bool mixing) From 1df8c7f9627c0d1f1f07a854e932a2e61a71e22b Mon Sep 17 00:00:00 2001 From: ALICE Builder Date: Thu, 13 Apr 2023 15:50:28 +0200 Subject: [PATCH 5/5] Please consider the following formatting changes (#97) --- PWGLF/Tasks/hStrangeCorrelation.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGLF/Tasks/hStrangeCorrelation.cxx b/PWGLF/Tasks/hStrangeCorrelation.cxx index 49aab15c79c..f0a5636548b 100644 --- a/PWGLF/Tasks/hStrangeCorrelation.cxx +++ b/PWGLF/Tasks/hStrangeCorrelation.cxx @@ -65,11 +65,11 @@ struct correlateStrangeness { /// \param phi2 second phi value Double_t ComputeDeltaPhi(Double_t phi1, Double_t phi2) { - Double_t deltaPhi = phi1-phi2; + Double_t deltaPhi = phi1 - phi2; if (deltaPhi < -TMath::Pi() / 2.) { deltaPhi += 2. * TMath::Pi(); } - if(deltaPhi> 3*TMath::Pi() / 2.){ + if (deltaPhi > 3 * TMath::Pi() / 2.) { deltaPhi -= 2. * TMath::Pi(); } return deltaPhi;