From 1583b475d1bbb27fa3970e291a7f2c7e72ef016f Mon Sep 17 00:00:00 2001 From: skundu692 Date: Sun, 8 Jun 2025 13:33:55 +0200 Subject: [PATCH 1/8] add new expression for angular correlation --- PWGLF/Tasks/Strangeness/taskLambdaSpinCorr.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/PWGLF/Tasks/Strangeness/taskLambdaSpinCorr.cxx b/PWGLF/Tasks/Strangeness/taskLambdaSpinCorr.cxx index be85c214406..2ab12a018d8 100644 --- a/PWGLF/Tasks/Strangeness/taskLambdaSpinCorr.cxx +++ b/PWGLF/Tasks/Strangeness/taskLambdaSpinCorr.cxx @@ -290,6 +290,7 @@ struct LfTaskLambdaSpinCorr { auto proton1LambdaRF = boostLambda1ToCM(proton1pairCM); auto proton2LambdaRF = boostLambda2ToCM(proton2pairCM); + auto cosThetaDiff = -999.0; if (cosCalculation == 0) { cosThetaDiff = proton1LambdaRF.Vect().Unit().Dot(proton2LambdaRF.Vect().Unit()); From 8e5bc13692893efbc7fda9370b2f983ef00f14fa Mon Sep 17 00:00:00 2001 From: skundu692 Date: Mon, 9 Jun 2025 19:10:09 +0200 Subject: [PATCH 2/8] Fix clang formating --- PWGLF/Tasks/Strangeness/taskLambdaSpinCorr.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/PWGLF/Tasks/Strangeness/taskLambdaSpinCorr.cxx b/PWGLF/Tasks/Strangeness/taskLambdaSpinCorr.cxx index 2ab12a018d8..be85c214406 100644 --- a/PWGLF/Tasks/Strangeness/taskLambdaSpinCorr.cxx +++ b/PWGLF/Tasks/Strangeness/taskLambdaSpinCorr.cxx @@ -290,7 +290,6 @@ struct LfTaskLambdaSpinCorr { auto proton1LambdaRF = boostLambda1ToCM(proton1pairCM); auto proton2LambdaRF = boostLambda2ToCM(proton2pairCM); - auto cosThetaDiff = -999.0; if (cosCalculation == 0) { cosThetaDiff = proton1LambdaRF.Vect().Unit().Dot(proton2LambdaRF.Vect().Unit()); From 07641da9a5abf4985324d2034dfa175e19f71cae Mon Sep 17 00:00:00 2001 From: skundu692 Date: Wed, 11 Jun 2025 17:25:08 +0200 Subject: [PATCH 3/8] Add new process function to study derived data --- PWGLF/Tasks/Strangeness/taskLambdaSpinCorr.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/PWGLF/Tasks/Strangeness/taskLambdaSpinCorr.cxx b/PWGLF/Tasks/Strangeness/taskLambdaSpinCorr.cxx index be85c214406..3f8790098ed 100644 --- a/PWGLF/Tasks/Strangeness/taskLambdaSpinCorr.cxx +++ b/PWGLF/Tasks/Strangeness/taskLambdaSpinCorr.cxx @@ -866,9 +866,9 @@ struct LfTaskLambdaSpinCorr { continue; } + // auto postrack1 = v0.template posTrackExtra_as(); // auto negtrack1 = v0.template negTrackExtra_as(); - // 2nd loop for combination of lambda lambda for (const auto& v02 : V0s) { if (v02.index() <= v0.index()) { @@ -899,8 +899,10 @@ struct LfTaskLambdaSpinCorr { continue; } + // auto postrack2 = v02.template posTrackExtra_as(); // auto negtrack2 = v02.template negTrackExtra_as(); + if (v0.posTrackExtraId() == v02.posTrackExtraId() || v0.negTrackExtraId() == v02.negTrackExtraId()) { continue; } @@ -1012,6 +1014,7 @@ struct LfTaskLambdaSpinCorr { if (lambdaTag2 && aLambdaTag2) { continue; } + // auto postrack1 = t1.template posTrackExtra_as(); // auto negtrack1 = t1.template negTrackExtra_as(); // auto postrack2 = t2.template posTrackExtra_as(); From 020a706816f2a257014d9fbcba31c1e489fd6866 Mon Sep 17 00:00:00 2001 From: skundu692 Date: Wed, 11 Jun 2025 17:25:39 +0200 Subject: [PATCH 4/8] Fix --- PWGLF/Tasks/Strangeness/taskLambdaSpinCorr.cxx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/taskLambdaSpinCorr.cxx b/PWGLF/Tasks/Strangeness/taskLambdaSpinCorr.cxx index 3f8790098ed..80c75717d08 100644 --- a/PWGLF/Tasks/Strangeness/taskLambdaSpinCorr.cxx +++ b/PWGLF/Tasks/Strangeness/taskLambdaSpinCorr.cxx @@ -866,9 +866,9 @@ struct LfTaskLambdaSpinCorr { continue; } - // auto postrack1 = v0.template posTrackExtra_as(); // auto negtrack1 = v0.template negTrackExtra_as(); + // 2nd loop for combination of lambda lambda for (const auto& v02 : V0s) { if (v02.index() <= v0.index()) { @@ -899,10 +899,8 @@ struct LfTaskLambdaSpinCorr { continue; } - // auto postrack2 = v02.template posTrackExtra_as(); // auto negtrack2 = v02.template negTrackExtra_as(); - if (v0.posTrackExtraId() == v02.posTrackExtraId() || v0.negTrackExtraId() == v02.negTrackExtraId()) { continue; } @@ -1014,7 +1012,6 @@ struct LfTaskLambdaSpinCorr { if (lambdaTag2 && aLambdaTag2) { continue; } - // auto postrack1 = t1.template posTrackExtra_as(); // auto negtrack1 = t1.template negTrackExtra_as(); // auto postrack2 = t2.template posTrackExtra_as(); From ff3e3cd8136012633700f03dcfeda7ff15adbd9c Mon Sep 17 00:00:00 2001 From: skundu692 Date: Wed, 18 Jun 2025 16:59:09 +0200 Subject: [PATCH 5/8] Fix clang and whitespace error --- PWGLF/Tasks/Strangeness/taskLambdaSpinCorr.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGLF/Tasks/Strangeness/taskLambdaSpinCorr.cxx b/PWGLF/Tasks/Strangeness/taskLambdaSpinCorr.cxx index 80c75717d08..be85c214406 100644 --- a/PWGLF/Tasks/Strangeness/taskLambdaSpinCorr.cxx +++ b/PWGLF/Tasks/Strangeness/taskLambdaSpinCorr.cxx @@ -868,7 +868,7 @@ struct LfTaskLambdaSpinCorr { // auto postrack1 = v0.template posTrackExtra_as(); // auto negtrack1 = v0.template negTrackExtra_as(); - + // 2nd loop for combination of lambda lambda for (const auto& v02 : V0s) { if (v02.index() <= v0.index()) { From a2f7a3da574b73c3de296fe30bb4243774207164 Mon Sep 17 00:00:00 2001 From: skundu692 Date: Thu, 19 Jun 2025 18:30:11 +0200 Subject: [PATCH 6/8] Fix indexing issue in derived data --- PWGLF/DataModel/LFSpincorrelationTables.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGLF/DataModel/LFSpincorrelationTables.h b/PWGLF/DataModel/LFSpincorrelationTables.h index f7ff44377d4..7327fb1cfa6 100644 --- a/PWGLF/DataModel/LFSpincorrelationTables.h +++ b/PWGLF/DataModel/LFSpincorrelationTables.h @@ -81,4 +81,4 @@ DECLARE_SOA_TABLE(LambdaPairs, "AOD", "LAMBDAPAIR", using LambdaPair = LambdaPairs::iterator; } // namespace o2::aod -#endif // PWGLF_DATAMODEL_LFSPINCORRELATIONTABLES_H_ +#endif // PWGLF_DATAMODEL_LFELATIONTABLES_H_ From 7ccc1b8e4e2b0fc260ff190802cbc58991af17bd Mon Sep 17 00:00:00 2001 From: skundu692 Date: Thu, 19 Jun 2025 18:58:44 +0200 Subject: [PATCH 7/8] fix linter error --- PWGLF/DataModel/LFSpincorrelationTables.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGLF/DataModel/LFSpincorrelationTables.h b/PWGLF/DataModel/LFSpincorrelationTables.h index 7327fb1cfa6..f7ff44377d4 100644 --- a/PWGLF/DataModel/LFSpincorrelationTables.h +++ b/PWGLF/DataModel/LFSpincorrelationTables.h @@ -81,4 +81,4 @@ DECLARE_SOA_TABLE(LambdaPairs, "AOD", "LAMBDAPAIR", using LambdaPair = LambdaPairs::iterator; } // namespace o2::aod -#endif // PWGLF_DATAMODEL_LFELATIONTABLES_H_ +#endif // PWGLF_DATAMODEL_LFSPINCORRELATIONTABLES_H_ From 83c87fb8c5deb774c54bf489860dc7ba393ac65c Mon Sep 17 00:00:00 2001 From: skundu692 Date: Thu, 26 Jun 2025 16:42:21 +0200 Subject: [PATCH 8/8] Add analysis task for lambda spin correlation using derived data --- PWGLF/Tasks/Strangeness/CMakeLists.txt | 5 + .../Strangeness/lambdaspincorrderived.cxx | 321 ++++++++++++++++++ 2 files changed, 326 insertions(+) create mode 100644 PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx diff --git a/PWGLF/Tasks/Strangeness/CMakeLists.txt b/PWGLF/Tasks/Strangeness/CMakeLists.txt index 569768bd273..a6bc1f60334 100644 --- a/PWGLF/Tasks/Strangeness/CMakeLists.txt +++ b/PWGLF/Tasks/Strangeness/CMakeLists.txt @@ -145,3 +145,8 @@ o2physics_add_dpl_workflow(lambdajetpolarization SOURCES lambdaJetpolarization.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGJECore FastJet::FastJet FastJet::Contrib O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(lambdaspincorrderived + SOURCES lambdaspincorrderived.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) diff --git a/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx b/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx new file mode 100644 index 00000000000..0dd9b2ac542 --- /dev/null +++ b/PWGLF/Tasks/Strangeness/lambdaspincorrderived.cxx @@ -0,0 +1,321 @@ +// 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 taskLambdaSpinCorr.cxx +/// \brief Analysis task for Lambda spin spin correlation +/// +/// \author sourav.kundu@cern.ch + +#include "PWGLF/DataModel/LFSpincorrelationTables.h" + +#include "Common/Core/trackUtilities.h" + +#include "CommonConstants/PhysicsConstants.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/StepTHn.h" +#include "Framework/runDataProcessing.h" +#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::soa; + +struct lambdaspincorrderived { + // event sel///////// + Configurable centMin{"centMin", 0, "Minimum Centrality"}; + Configurable centMax{"centMax", 80, "Maximum Centrality"}; + + // Lambda selection //////////// + Configurable usePDGM{"usePDGM", 1, "Use PDG mass"}; + Configurable checkDoubleStatus{"checkDoubleStatus", 0, "Check Double status"}; + Configurable cosPA{"cosPA", 0.995, "Cosine Pointing Angle"}; + Configurable radiusMin{"radiusMin", 3, "Minimum V0 radius"}; + Configurable radiusMax{"radiusMax", 30, "Maximum V0 radius"}; + Configurable dcaProton{"dcaProton", 0.1, "DCA Proton"}; + Configurable dcaPion{"dcaPion", 0.2, "DCA Pion"}; + Configurable dcaDaughters{"dcaDaughters", 1.0, "DCA between daughters"}; + Configurable ptMin{"ptMin", 0.5, "V0 Pt minimum"}; + Configurable ptMax{"ptMax", 3.0, "V0 Pt maximum"}; + Configurable rapidity{"rapidity", 0.5, "Rapidity cut on lambda"}; + + // Event Mixing + Configurable nEvtMixing{"nEvtMixing", 10, "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"}; + Configurable etaMix{"etaMix", 0.1, "Eta cut on event mixing"}; + Configurable ptMix{"ptMix", 0.1, "Pt cut on event mixing"}; + Configurable phiMix{"phiMix", 0.1, "Phi cut on event mixing"}; + Configurable massMix{"massMix", 0.0028, "Masscut on event mixing"}; + + // THnsparse bining + ConfigurableAxis configThnAxisInvMass{"configThnAxisInvMass", {50, 1.09, 1.14}, "#it{M} (GeV/#it{c}^{2})"}; + ConfigurableAxis configThnAxisR{"configThnAxisR", {80, 0.0, 8.0}, "#it{R}"}; + ConfigurableAxis configThnAxisPol{"configThnAxisPol", {80, 0.0, 8.0}, "cos#it{#theta *}"}; + ConfigurableAxis configThnAxisCentrality{"configThnAxisCentrality", {8, 0.0, 80.0}, "Centrality"}; + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + void init(o2::framework::InitContext&) + { + histos.add("hCentrality", "Centrality distribution", kTH1F, {{configThnAxisCentrality}}); + + histos.add("hSparseLambdaLambda", "hSparseLambdaLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisCentrality, configThnAxisR}, true); + histos.add("hSparseLambdaAntiLambda", "hSparseLambdaAntiLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisCentrality, configThnAxisR}, true); + histos.add("hSparseAntiLambdaAntiLambda", "hSparseAntiLambdaAntiLambda", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisCentrality, configThnAxisR}, true); + + histos.add("hSparseLambdaLambdaMixed", "hSparseLambdaLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisCentrality, configThnAxisR}, true); + histos.add("hSparseLambdaAntiLambdaMixed", "hSparseLambdaAntiLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisCentrality, configThnAxisR}, true); + histos.add("hSparseAntiLambdaAntiLambdaMixed", "hSparseAntiLambdaAntiLambdaMixed", HistType::kTHnSparseF, {configThnAxisInvMass, configThnAxisInvMass, configThnAxisPol, configThnAxisCentrality, configThnAxisR}, true); + } + + template + bool selectionV0(T const& candidate) + { + if (candidate.v0Cospa() < cosPA) { + return false; + } + if (checkDoubleStatus && candidate.doubleStatus()) { + return false; + } + if (candidate.v0Radius() > radiusMax) { + return false; + } + if (candidate.v0Radius() < radiusMin) { + return false; + } + if (candidate.dcaBetweenDaughter() > dcaDaughters) { + return false; + } + if (candidate.v0Status() == 0 && std::abs(candidate.dcaPositive()) < dcaProton && std::abs(candidate.dcaNegative()) < dcaPion) { + return false; + } + if (candidate.v0Status() == 1 && std::abs(candidate.dcaPositive()) < dcaPion && std::abs(candidate.dcaNegative()) < dcaProton) { + return false; + } + if (candidate.lambdaPt() < ptMin) { + return false; + } + if (candidate.lambdaPt() > ptMax) { + return false; + } + return true; + } + + template + bool checkKinematics(T1 const& candidate1, T2 const& candidate2) + { + if (std::abs(candidate1.lambdaPt() - candidate2.lambdaPt()) > ptMix) { + return false; + } + if (std::abs(candidate1.lambdaEta() - candidate2.lambdaEta()) > etaMix) { + return false; + } + if (std::abs(candidate1.lambdaPhi() - candidate2.lambdaPhi()) > phiMix) { + return false; + } + if (std::abs(candidate1.lambdaMass() - candidate2.lambdaMass()) > massMix) { + return false; + } + return true; + } + + void fillHistograms(int tag1, int tag2, + const ROOT::Math::PtEtaPhiMVector& particle1, const ROOT::Math::PtEtaPhiMVector& particle2, + const ROOT::Math::PtEtaPhiMVector& daughpart1, const ROOT::Math::PtEtaPhiMVector& daughpart2, + double centrality, int datatype) + { + auto lambda1Mass = 0.0; + auto lambda2Mass = 0.0; + if (!usePDGM) { + lambda1Mass = particle1.M(); + lambda2Mass = particle2.M(); + } else { + lambda1Mass = o2::constants::physics::MassLambda; + lambda2Mass = o2::constants::physics::MassLambda; + } + auto particle1Dummy = ROOT::Math::PtEtaPhiMVector(particle1.Pt(), particle1.Eta(), particle1.Phi(), lambda1Mass); + auto particle2Dummy = ROOT::Math::PtEtaPhiMVector(particle2.Pt(), particle2.Eta(), particle2.Phi(), lambda2Mass); + auto pairDummy = particle1Dummy + particle2Dummy; + ROOT::Math::Boost boostPairToCM{pairDummy.BoostToCM()}; // boosting vector for pair CM + + // Step1: Boosting both Lambdas to Lambda-Lambda pair rest frame + auto lambda1CM = boostPairToCM(particle1Dummy); + auto lambda2CM = boostPairToCM(particle2Dummy); + + // Step 2: Boost Each Lambda to its Own Rest Frame + ROOT::Math::Boost boostLambda1ToCM{lambda1CM.BoostToCM()}; + ROOT::Math::Boost boostLambda2ToCM{lambda2CM.BoostToCM()}; + + // Also boost the daughter protons to the same frame + auto proton1pairCM = boostPairToCM(daughpart1); // proton1 to pair CM + auto proton2pairCM = boostPairToCM(daughpart2); // proton2 to pair CM + + // Boost protons into their respective Lambda rest frames + auto proton1LambdaRF = boostLambda1ToCM(proton1pairCM); + auto proton2LambdaRF = boostLambda2ToCM(proton2pairCM); + + auto cosThetaDiff = -999.0; + cosThetaDiff = proton1LambdaRF.Vect().Unit().Dot(proton2LambdaRF.Vect().Unit()); + double deltaPhi = RecoDecay::constrainAngle(particle1Dummy.Phi() - particle2Dummy.Phi(), 0.0F, 2U); + double deltaEta = particle1Dummy.Eta() - particle2Dummy.Eta(); + double deltaR = TMath::Sqrt(deltaEta * deltaEta + deltaPhi * deltaPhi); + + if (datatype == 0) { + if (tag1 == 0 && tag2 == 0) { + histos.fill(HIST("hSparseLambdaLambda"), particle1.M(), particle2.M(), cosThetaDiff, centrality, deltaR); + } else if ((tag1 == 0 && tag2 == 1) || (tag1 == 1 && tag2 == 0)) { + histos.fill(HIST("hSparseLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, centrality, deltaR); + } else if (tag1 == 1 && tag2 == 1) { + histos.fill(HIST("hSparseAntiLambdaAntiLambda"), particle1.M(), particle2.M(), cosThetaDiff, centrality, deltaR); + } + } else if (datatype == 1) { + if (tag1 == 0 && tag2 == 0) { + histos.fill(HIST("hSparseLambdaLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, centrality, deltaR); + } else if ((tag1 == 0 && tag2 == 1) || (tag1 == 1 && tag2 == 0)) { + histos.fill(HIST("hSparseLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, centrality, deltaR); + } else if (tag1 == 1 && tag2 == 1) { + histos.fill(HIST("hSparseAntiLambdaAntiLambdaMixed"), particle1.M(), particle2.M(), cosThetaDiff, centrality, deltaR); + } + } + } + + ROOT::Math::PtEtaPhiMVector lambda0, proton0; + ROOT::Math::PtEtaPhiMVector lambda, proton; + ROOT::Math::PtEtaPhiMVector lambda2, proton2; + + Filter centralityFilter = (nabs(aod::lambdaevent::cent) < centMax && nabs(aod::lambdaevent::cent) > centMin); + + using EventCandidates = soa::Filtered; + using AllTrackCandidates = aod::LambdaPairs; + + void processData(EventCandidates::iterator const& collision, AllTrackCandidates const& V0s) + { + auto centrality = collision.cent(); + for (const auto& v0 : V0s) { + if (!selectionV0(v0)) { + continue; + } + proton = ROOT::Math::PtEtaPhiMVector(v0.protonPt(), v0.protonEta(), v0.protonPhi(), o2::constants::physics::MassProton); + lambda = ROOT::Math::PtEtaPhiMVector(v0.lambdaPt(), v0.lambdaEta(), v0.lambdaPhi(), v0.lambdaMass()); + for (const auto& v02 : V0s) { + if (v02.index() <= v0.index()) { + continue; + } + if (!selectionV0(v02)) { + continue; + } + if (v0.protonIndex() == v02.protonIndex()) { + continue; + } + if (v0.pionIndex() == v02.pionIndex()) { + continue; + } + proton2 = ROOT::Math::PtEtaPhiMVector(v02.protonPt(), v02.protonEta(), v02.protonPhi(), o2::constants::physics::MassProton); + lambda2 = ROOT::Math::PtEtaPhiMVector(v02.lambdaPt(), v02.lambdaEta(), v02.lambdaPhi(), v02.lambdaMass()); + if (v0.v0Status() == 0 && v02.v0Status() == 0) { + fillHistograms(0, 0, lambda, lambda2, proton, proton2, centrality, 0); + } + if (v0.v0Status() == 0 && v02.v0Status() == 1) { + fillHistograms(0, 1, lambda, lambda2, proton, proton2, centrality, 0); + } + if (v0.v0Status() == 1 && v02.v0Status() == 0) { + fillHistograms(1, 0, lambda2, lambda, proton2, proton, centrality, 0); + } + if (v0.v0Status() == 1 && v02.v0Status() == 1) { + fillHistograms(1, 1, lambda, lambda2, proton, proton2, centrality, 0); + } + } + } + } + PROCESS_SWITCH(lambdaspincorrderived, processData, "Process data", true); + + // Processing Event Mixing + SliceCache cache; + using BinningType = ColumnBinningPolicy; + BinningType colBinning{{CfgVtxBins, CfgMultBins}, true}; + Preslice tracksPerCollisionV0 = aod::lambdapair::lambdaeventId; + void processME(EventCandidates const& collisions, AllTrackCandidates const& V0s) + { + for (auto& [collision1, collision2] : selfCombinations(colBinning, nEvtMixing, -1, collisions, collisions)) { + // LOGF(info, "Mixed event collisions: (%d, %d)", collision1.index(), collision2.index()); + auto centrality = collision1.cent(); + auto groupV01 = V0s.sliceBy(tracksPerCollisionV0, collision1.globalIndex()); + auto groupV02 = V0s.sliceBy(tracksPerCollisionV0, collision1.globalIndex()); + auto groupV03 = V0s.sliceBy(tracksPerCollisionV0, collision2.globalIndex()); + std::vector t1Used(groupV01.size(), false); // <-- reset here + for (auto& [t1, t3] : soa::combinations(o2::soa::CombinationsFullIndexPolicy(groupV01, groupV03))) { + if (t1Used[t1.index()]) { + continue; + } + if (!checkKinematics(t1, t3)) { + continue; + } + if (!selectionV0(t1)) { + continue; + } + if (!selectionV0(t3)) { + continue; + } + t1Used[t1.index()] = true; + for (const auto& t2 : groupV02) { + if (t2.index() <= t1.index()) { + continue; + } + if (!selectionV0(t2)) { + continue; + } + if (t1.protonIndex() == t2.protonIndex()) { + continue; + } + if (t1.pionIndex() == t2.pionIndex()) { + continue; + } + proton = ROOT::Math::PtEtaPhiMVector(t3.protonPt(), t3.protonEta(), t3.protonPhi(), o2::constants::physics::MassProton); + lambda = ROOT::Math::PtEtaPhiMVector(t3.lambdaPt(), t3.lambdaEta(), t3.lambdaPhi(), t3.lambdaMass()); + proton2 = ROOT::Math::PtEtaPhiMVector(t2.protonPt(), t2.protonEta(), t2.protonPhi(), o2::constants::physics::MassProton); + lambda2 = ROOT::Math::PtEtaPhiMVector(t2.lambdaPt(), t2.lambdaEta(), t2.lambdaPhi(), t2.lambdaMass()); + if (t3.v0Status() == 0 && t2.v0Status() == 0) { + fillHistograms(0, 0, lambda, lambda2, proton, proton2, centrality, 1); + } + if (t3.v0Status() == 0 && t2.v0Status() == 1) { + fillHistograms(0, 1, lambda, lambda2, proton, proton2, centrality, 1); + } + if (t3.v0Status() == 1 && t2.v0Status() == 0) { + fillHistograms(1, 0, lambda2, lambda, proton2, proton, centrality, 1); + } + if (t3.v0Status() == 1 && t2.v0Status() == 1) { + fillHistograms(1, 1, lambda, lambda2, proton, proton2, centrality, 1); + } + } + } // replacement track pair + } // collision pair + } + PROCESS_SWITCH(lambdaspincorrderived, processME, "Process data ME", true); +}; +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +}